This commit is contained in:
Paul 2001-07-30 15:08:29 +00:00
parent 22ac2f0d4a
commit d5b89cc1e7
3 changed files with 45 additions and 21 deletions

View file

@ -2609,9 +2609,17 @@ int CPlayer::moveVertical(int _moveDistance)
{ {
if(colHeightBefore[i]>=0&&colHeightAfter[i]<=0) if(colHeightBefore[i]>=0&&colHeightAfter[i]<=0)
{ {
moveRequired[i]=colHeightAfter[i]; int goingIntoThisBlock=blockAfter[i]&COLLISION_TYPE_MASK;
hitGround=true; if(goingIntoThisBlock!=COLLISION_TYPE_FLAG_DEATH_FALL)
if(!hitThisSuspectBlock)hitThisSuspectBlock=blockAfter[i]; {
moveRequired[i]=colHeightAfter[i];
hitGround=true;
}
else
{
moveRequired[i]=0;
}
if(!hitThisSuspectBlock)hitThisSuspectBlock=goingIntoThisBlock;
} }
else else
{ {
@ -2720,6 +2728,7 @@ int CPlayer::moveVertical(int _moveDistance)
// Stood on any important types of collision? // Stood on any important types of collision?
hitThisSuspectBlock=CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy+_moveDistance); hitThisSuspectBlock=CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy+_moveDistance);
} }
pos.vy+=_moveDistance; pos.vy+=_moveDistance;
setPlayerPos(&pos); setPlayerPos(&pos);

View file

@ -53,6 +53,8 @@
Vars Vars
---- */ ---- */
static int anim=0;
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:
@ -61,38 +63,35 @@
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerModeDead::enter() void CPlayerModeDead::enter()
{ {
int deathAnim;
m_deadTime=0; m_deadTime=0;
switch(m_player->getDeathType()) switch(m_player->getDeathType())
{ {
default: default:
case DEATHTYPE__NORMAL: case DEATHTYPE__NORMAL:
deathAnim=ANIM_SPONGEBOB_DEATHFORWARDS; m_deathAnim=ANIM_SPONGEBOB_DEATHFORWARDS;
break; break;
case DEATHTYPE__DRYUP: case DEATHTYPE__DRYUP:
deathAnim=ANIM_SPONGEBOB_DEATHDRY; m_deathAnim=ANIM_SPONGEBOB_DEATHDRY;
break; break;
case DEATHTYPE__SQUASH: case DEATHTYPE__SQUASH:
deathAnim=ANIM_SPONGEBOB_DEATHSQUASH; m_deathAnim=ANIM_SPONGEBOB_DEATHSQUASH;
break; break;
case DEATHTYPE__LIQUID: case DEATHTYPE__LIQUID:
deathAnim=ANIM_SPONGEBOB_DEATHFORWARDS; m_deathAnim=ANIM_SPONGEBOB_DEATHFORWARDS;
break; break;
case DEATHTYPE__FALL_TO_DEATH: case DEATHTYPE__FALL_TO_DEATH:
deathAnim=-1; m_deathAnim=-1;
break; break;
} }
if(deathAnim!=-1) if(m_deathAnim!=-1)
{ {
m_player->setAnimNo(deathAnim); m_player->setAnimNo(m_deathAnim);
} }
CSoundMediator::stopSpeech(); CSoundMediator::stopSpeech();
m_killed=false; m_killed=false;
} }
@ -107,23 +106,37 @@ void CPlayerModeDead::think()
m_deadTime++; m_deadTime++;
if(m_player->getDeathType()!=DEATHTYPE__FALL_TO_DEATH) if(m_player->getDeathType()!=DEATHTYPE__FALL_TO_DEATH)
{ {
if(m_deadTime<m_player->getAnimFrameCount()) int frameCount,frame;
if(m_deathAnim!=-1)
{ {
m_player->setAnimFrame(m_deadTime); m_player->setAnimNo(m_deathAnim);
} }
frameCount=m_player->getAnimFrameCount()-1;
if(m_deadTime<=frameCount)
{
frame=m_deadTime;
}
else
{
frame=frameCount;
}
m_player->setAnimFrame(frame);
} }
m_player->moveVertical(5); m_player->moveVertical(5);
if(!m_killed) if(!m_killed)
if((m_deadTime>DEATH_DELAY&&m_player->getPadInputDown()&(PI_JUMP|PI_FIRE))||
m_deadTime>DEATH_TIMEOUT)
{ {
// Take a life off.. if((m_deadTime>DEATH_DELAY&&m_player->getPadInputDown()&(PI_JUMP|PI_FIRE))||
CGameSlotManager::getSlotData()->m_lives--; m_deadTime>DEATH_TIMEOUT)
{
// Take a life off..
CGameSlotManager::getSlotData()->m_lives--;
CGameScene::restartlevel(); CGameScene::restartlevel();
m_killed=true; m_killed=true;
}
} }
} }

View file

@ -49,12 +49,14 @@ private:
DEATH_TIMEOUT=5*60, // SB respawns automatically after this long DEATH_TIMEOUT=5*60, // SB respawns automatically after this long
}; };
int m_deadTime; int m_deadTime;
int m_deathAnim;
void fall(); void fall();
int m_yVelocity; int m_yVelocity;
int m_killed; int m_killed;
}; };