This commit is contained in:
Paul 2001-06-22 16:22:03 +00:00
parent 56d6711c9e
commit 06c292656c
2 changed files with 50 additions and 4 deletions

View File

@ -611,6 +611,9 @@ void CPlayer::init()
m_fontBank->initialise(&standardFont); m_fontBank->initialise(&standardFont);
m_fontBank->setOt(POWERUPUI_OT); m_fontBank->setOt(POWERUPUI_OT);
m_scalableFontBank=new ("PlayerFont") ScalableFontBank();
m_scalableFontBank->initialise(&standardFont);
m_scalableFontBank->setOt(POWERUPUI_OT);
m_actorGfx=CActorPool::GetActor(ACTORS_SPONGEBOB_SBK); m_actorGfx=CActorPool::GetActor(ACTORS_SPONGEBOB_SBK);
@ -674,7 +677,8 @@ void CPlayer::shutdown()
} }
delete m_actorGfx; delete m_actorGfx;
m_fontBank->dump(); delete m_fontBank; m_scalableFontBank->dump(); delete m_scalableFontBank;
m_fontBank->dump(); delete m_fontBank;
CPlayerThing::shutdown(); CPlayerThing::shutdown();
} }
@ -1321,6 +1325,35 @@ if(drawlastpos)
sb->printFT4(FRM__WATERMETER,x,y,0,0,POWERUPUI_OT); sb->printFT4(FRM__WATERMETER,x,y,0,0,POWERUPUI_OT);
if(m_healthWaterLevel<(WATER_COUNTER_SECONDTIME*6))
{
int digit;
DVECTOR src={x+(W/2),y+(H/2)};
DVECTOR dst={INGAME_SCREENW/2,(INGAME_SCREENH/3)*1};
int frame;
int digitX,digitY,scale;
char buf[4];
int r,g,b;
digit=m_healthWaterLevel/WATER_COUNTER_SECONDTIME;
if(digit<0)digit=0;
frame=WATER_COUNTER_SECONDTIME-(m_healthWaterLevel%WATER_COUNTER_SECONDTIME);
if(frame>WATER_COUNTER_MOVINGTIME)frame=WATER_COUNTER_MOVINGTIME;
digitX=src.vx+(((dst.vx-src.vx)*frame)/WATER_COUNTER_MOVINGTIME);
digitY=src.vy+(((dst.vy-src.vy)*frame)/WATER_COUNTER_MOVINGTIME);
scale=WATER_COUNTER_STARTSCALE+(((WATER_COUNTER_ENDSCALE-WATER_COUNTER_STARTSCALE)*frame)/WATER_COUNTER_MOVINGTIME);
sprintf(buf,"%d",digit);
m_scalableFontBank->setJustification(FontBank::JUST_CENTRE);
m_scalableFontBank->setScale(scale);
r=WATER_COUNTER_R2-(((WATER_COUNTER_R2-WATER_COUNTER_R1)*(m_healthWaterLevel))/(WATER_COUNTER_SECONDTIME*6));
g=WATER_COUNTER_G2-(((WATER_COUNTER_G2-WATER_COUNTER_G1)*(m_healthWaterLevel))/(WATER_COUNTER_SECONDTIME*6));
b=WATER_COUNTER_B2-(((WATER_COUNTER_B2-WATER_COUNTER_B1)*(m_healthWaterLevel))/(WATER_COUNTER_SECONDTIME*6));
m_scalableFontBank->setColour(r,g,b);
m_scalableFontBank->print(digitX,digitY,buf);
}
x+=fh->W+SB_UI_GAP_BETWEEN_ITEMS; x+=fh->W+SB_UI_GAP_BETWEEN_ITEMS;
} }
if(isWearingBoots()) if(isWearingBoots())

View File

@ -196,6 +196,17 @@ public:
WATERLEVELSHIFT=5, WATERLEVELSHIFT=5,
WATERMAXHEALTH=(255<<WATERLEVELSHIFT), WATERMAXHEALTH=(255<<WATERLEVELSHIFT),
WATERMINSOAKUPLEVEL=(245<<WATERLEVELSHIFT), // SB won't auto soak unless water is lower than this WATERMINSOAKUPLEVEL=(245<<WATERLEVELSHIFT), // SB won't auto soak unless water is lower than this
WATER_COUNTER_STARTSCALE=50, // Scale of text
WATER_COUNTER_ENDSCALE=511,
WATER_COUNTER_R1=59, // Colour of text
WATER_COUNTER_G1=118,
WATER_COUNTER_B1=253,
WATER_COUNTER_R2=255,
WATER_COUNTER_G2=28,
WATER_COUNTER_B2=17,
WATER_COUNTER_SECONDTIME=15<<CPlayer::WATERLEVELSHIFT, // Each digit lasts this many frames..
WATER_COUNTER_MOVINGTIME=5<<CPlayer::WATERLEVELSHIFT, // ..and spends this longing moving into position
}; };
typedef struct typedef struct
@ -451,7 +462,8 @@ public:
// Graphical resources // Graphical resources
public: public:
class FontBank *getFontBank() {return m_fontBank;} class FontBank *getFontBank() {return m_fontBank;}
class ScalableFontBank *getScalableFontBank() {return m_scalableFontBank;}
enum enum
{ {
@ -468,7 +480,8 @@ public:
}; };
private: private:
class FontBank *m_fontBank; class FontBank *m_fontBank;
class ScalableFontBank *m_scalableFontBank;
public: public: