This commit is contained in:
parent
461123580e
commit
0cb7d8d491
5 changed files with 159 additions and 28 deletions
|
@ -179,7 +179,6 @@ static const char *s_modeText[NUM_PLAYERMODES]=
|
|||
#endif
|
||||
|
||||
|
||||
int s_health;
|
||||
int s_screenPos;
|
||||
DVECTOR m_cameraScrollPos={0,600};
|
||||
|
||||
|
@ -458,19 +457,23 @@ m_fontBank->print(40,40,posBuf);
|
|||
|
||||
x=healthx;
|
||||
y=healthy;
|
||||
if(s_health)
|
||||
if(m_health==0||m_healthReactFrames)
|
||||
{
|
||||
frames=s_fullHealthFrames;
|
||||
if(m_healthReactFrames)
|
||||
{
|
||||
m_healthReactFrames--;
|
||||
}
|
||||
frames=s_emptyHealthFrames;
|
||||
}
|
||||
else
|
||||
{
|
||||
frames=s_emptyHealthFrames;
|
||||
frames=s_fullHealthFrames;
|
||||
}
|
||||
|
||||
for(i=5;i>0;i--)
|
||||
{
|
||||
ft4=m_spriteBank->printFT4(*frames++,x,y,0,0,5);
|
||||
if(i>s_health)
|
||||
if(i>m_health)
|
||||
{
|
||||
setRGB0(ft4,healthr,healthg,healthb);
|
||||
}
|
||||
|
@ -538,10 +541,10 @@ int CPlayer::getHeightFromGround(int _x,int _y,int _maxHeight)
|
|||
---------------------------------------------------------------------- */
|
||||
void CPlayer::addHealth(int _health)
|
||||
{
|
||||
s_health+=_health;
|
||||
if(s_health>MAX_HEALTH)
|
||||
m_health+=_health;
|
||||
if(m_health>MAX_HEALTH)
|
||||
{
|
||||
s_health=MAX_HEALTH;
|
||||
m_health=MAX_HEALTH;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -670,7 +673,8 @@ void CPlayer::respawn()
|
|||
setMode(PLAYER_MODE_BASICUNARMED);
|
||||
}
|
||||
|
||||
s_health=MAX_HEALTH;
|
||||
m_health=MAX_HEALTH;
|
||||
m_healthReactFrames=0;
|
||||
m_invincibleFrameCount=INVINCIBLE_FRAMES__START;
|
||||
Pos=m_respawnPos;
|
||||
|
||||
|
@ -743,10 +747,11 @@ void CPlayer::takeDamage(DAMAGE_TYPE _damage)
|
|||
#ifdef __VERSION_DEBUG__
|
||||
if(invincibleSponge){m_invincibleFrameCount=INVINCIBLE_FRAMES__HIT;return;}
|
||||
#endif
|
||||
if(s_health)
|
||||
if(m_health)
|
||||
{
|
||||
m_invincibleFrameCount=INVINCIBLE_FRAMES__HIT;
|
||||
s_health--;
|
||||
m_healthReactFrames=10;
|
||||
m_health--;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -89,21 +89,65 @@ void CPlayerModeNet::think()
|
|||
{
|
||||
m_netFrame=0;
|
||||
m_netting=true;
|
||||
switch(m_netState)
|
||||
{
|
||||
case NET_STATE__EMPTY:
|
||||
m_netState=NET_STATE__FULL;
|
||||
break;
|
||||
case NET_STATE__FULL:
|
||||
m_netState=NET_STATE__EMPTY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Netting?
|
||||
if(m_netting)
|
||||
{
|
||||
//!!! m_player->setAnimNo(ANIM_SPONGEBOB_KARATE);
|
||||
switch(m_netState)
|
||||
{
|
||||
case NET_STATE__EMPTY:
|
||||
{
|
||||
DVECTOR playerPos;
|
||||
int playerFacing;
|
||||
CRECT netRect;
|
||||
CThing *thing;
|
||||
|
||||
playerPos=m_player->getPos();
|
||||
playerFacing=m_player->getFacing();
|
||||
|
||||
netRect.x1=playerPos.vx-20;
|
||||
netRect.y1=playerPos.vy-20-40;
|
||||
netRect.x2=playerPos.vx+20;
|
||||
netRect.y2=playerPos.vy+20-40;
|
||||
|
||||
thing=CThingManager::checkCollisionAreaAgainstThings(&netRect,CThing::TYPE_ENEMY,false);
|
||||
while(thing)
|
||||
{
|
||||
// if((CEnemy*)thing)->canBeCaughtByNet()) ( or whatever.. )
|
||||
if(1) // just to stop the complier complaining until the above line can be put it..
|
||||
{
|
||||
PAUL_DBGMSG("Caught!");
|
||||
//((CEnemy*)thing)->caughtWithNet(); ( or whatever.. )
|
||||
m_netState=NET_STATE__JUST_CAUGHT_SOMETHING;
|
||||
thing=NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
thing=CThingManager::checkCollisionAreaAgainstThings(&netRect,CThing::TYPE_ENEMY,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NET_STATE__JUST_CAUGHT_SOMETHING:
|
||||
break;
|
||||
|
||||
case NET_STATE__FULL:
|
||||
if(m_netFrame==0)
|
||||
{
|
||||
// Launch projectile at halfway through the swing..
|
||||
PAUL_DBGMSG("Released!");
|
||||
// new cprojectile ( or whatever.. )
|
||||
m_netState=NET_STATE__JUST_LAUNCHED_SOMETHING;
|
||||
}
|
||||
break;
|
||||
|
||||
case NET_STATE__JUST_LAUNCHED_SOMETHING:
|
||||
break;
|
||||
}
|
||||
|
||||
//!!! m_player->setAnimNo(ANIM_SPONGEBOB_KARATE);
|
||||
m_player->setAnimNo(ANIM_SPONGEBOB_FIRE);
|
||||
m_player->setAnimFrame(m_netFrame);
|
||||
m_netFrame++;
|
||||
|
@ -112,6 +156,15 @@ void CPlayerModeNet::think()
|
|||
m_player->setAnimNo(m_savedAnimNo);
|
||||
m_player->setAnimFrame(m_savedAnimFrame);
|
||||
m_netting=false;
|
||||
|
||||
if(m_netState==NET_STATE__JUST_CAUGHT_SOMETHING)
|
||||
{
|
||||
m_netState=NET_STATE__FULL;
|
||||
}
|
||||
else if(m_netState==NET_STATE__JUST_LAUNCHED_SOMETHING)
|
||||
{
|
||||
m_netState=NET_STATE__EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
netstate=m_netState;
|
||||
|
|
|
@ -48,7 +48,9 @@ private:
|
|||
typedef enum
|
||||
{
|
||||
NET_STATE__EMPTY,
|
||||
NET_STATE__JUST_CAUGHT_SOMETHING,
|
||||
NET_STATE__FULL,
|
||||
NET_STATE__JUST_LAUNCHED_SOMETHING,
|
||||
} NetState;
|
||||
|
||||
int canSwingNetFromThisState();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue