This commit is contained in:
Paul 2001-03-01 20:30:25 +00:00
parent 3f78338c37
commit 5f1d6156c3
2 changed files with 50 additions and 6 deletions

View file

@ -557,10 +557,12 @@ void CPlayer::thinkHorizontalMovement()
int panim=-1; int panim=-1;
#include "gfx\prim.h" // (pkg) #include "gfx\prim.h" // (pkg)
int healthx=100; int healthx=100;
int healthy=20; int healthy=27;
int healthw=10; int healthw=10;
int healthh=10; int healthh=10;
int healthg=2; int healthg=2;
int livesx=162;
int livesy=28;
#ifdef __USER_paul__ #ifdef __USER_paul__
int mouth=-1,eyes=-1; int mouth=-1,eyes=-1;
@ -613,7 +615,7 @@ if(eyes!=-1)
#endif #endif
// Temporary health thing // Temporary health/lives thing
int i,x; int i,x;
x=healthx; x=healthx;
for(i=0;i<5;i++) for(i=0;i<5;i++)
@ -621,7 +623,6 @@ if(eyes!=-1)
POLY_F4 *f4; POLY_F4 *f4;
f4=GetPrimF4(); f4=GetPrimF4();
setXYWH(f4,x,healthy,healthw,healthh); setXYWH(f4,x,healthy,healthw,healthh);
if(i<s_health) if(i<s_health)
{ {
setRGB0(f4,0,255,0); setRGB0(f4,0,255,0);
@ -630,12 +631,20 @@ if(eyes!=-1)
{ {
setRGB0(f4,255,0,0); setRGB0(f4,255,0,0);
} }
setSemiTrans(f4,true); setSemiTrans(f4,true);
AddPrimToList(f4,0); AddPrimToList(f4,0);
f4=GetPrimF4();
setXYWH(f4,x+1,healthy+1,healthw,healthh);
setRGB0(f4,0,0,0);
setSemiTrans(f4,true);
AddPrimToList(f4,1);
x+=healthw+healthg; x+=healthw+healthg;
} }
char lifebuf[5];
sprintf(lifebuf,"x%d",m_lives);
s_debugFont.print(livesx,livesy,lifebuf);
} }
@ -667,8 +676,35 @@ void CPlayer::setMapSize(DVECTOR _mapSize)
m_mapEdge.vy=_mapSize.vy*MAP2D_BLOCKSTEPSIZE; m_mapEdge.vy=_mapSize.vy*MAP2D_BLOCKSTEPSIZE;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayer::addHealth(int _health)
{
s_health+=_health;
if(s_health>MAX_HEALTH)
{
s_health=MAX_HEALTH;
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayer::addLife()
{
m_lives++;
if(m_lives>MAX_LIVES)
{
m_lives=MAX_LIVES;
}
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
@ -1064,7 +1100,7 @@ void CPlayer::respawn()
setMode(PLAYER_MODE_BASICUNARMED); setMode(PLAYER_MODE_BASICUNARMED);
} }
s_health=5; s_health=MAX_HEALTH;
m_invincibleFrameCount=INVIBCIBLE_FRAMES__START; m_invincibleFrameCount=INVIBCIBLE_FRAMES__START;
Pos=m_respawnPos; Pos=m_respawnPos;
m_moveVel.vx=0; m_moveVel.vx=0;

View file

@ -159,6 +159,14 @@ public:
void setMapSize(DVECTOR _mapSize); void setMapSize(DVECTOR _mapSize);
void setRespawnPos(DVECTOR _respawn) {m_respawnPos=_respawn;} void setRespawnPos(DVECTOR _respawn) {m_respawnPos=_respawn;}
enum
{
MAX_HEALTH=5,
MAX_LIVES=99,
};
void addHealth(int _health);
void addLife();
protected: protected:
enum enum
{ {