From b04a30bcb8bd63c44ee0213148955e43481cd6ca Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 2 May 2001 20:27:49 +0000 Subject: [PATCH] --- source/player/player.cpp | 55 +++++++++++++++++++++++++++----------- source/player/player.h | 11 +++++--- source/player/pmbubble.cpp | 4 +-- source/player/pmcoral.cpp | 4 +-- source/player/pmjelly.cpp | 8 +++--- source/player/pmnet.cpp | 4 +-- 6 files changed, 56 insertions(+), 30 deletions(-) diff --git a/source/player/player.cpp b/source/player/player.cpp index 5362aa5f5..2dc221fdc 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -579,6 +579,16 @@ if(newmode!=-1) m_allowConversation=false; + + if(m_healthReactFrames) + { + m_healthReactFrames-=_frames; + if(m_healthReactFrames<0) + { + m_healthReactFrames=0; + } + } + for(i=0;i<_frames;i++) { // Think @@ -796,11 +806,6 @@ else if(Pos.vy>m_mapEdge.vy-64)Pos.vy=m_mapEdge.vy-64; ---------------------------------------------------------------------- */ int panim=-1; #include "gfx\prim.h" // (pkg) -int healthx=40; -int healthy=40; -int healthr=128; -int healthg=0; -int healthb=0; #ifdef _STATE_DEBUG_ int stateDebugX=280; @@ -817,6 +822,12 @@ static int lastposnum=0; int mouth=-1,eyes=-1; #endif + +int itembaseX=110; +int itembaseY=60; +int itemgap=40; + + void CPlayer::render() { CPlayerThing::render(); @@ -880,14 +891,10 @@ for(int i=0;i0;i--) { ft4=m_spriteBank->printFT4(*frames++,x,y,0,0,0); - if(i>m_health) - { - setRGB0(ft4,healthr,healthg,healthb); - } + setSemiTrans(ft4,i>m_health); y+=ygap; } } // Mode specific ui + int itemX=itembaseX; + + // Pickups m_currentPlayerModeClass->renderModeUi(); + if(isWearingBoots()) + { + int x,y; + sFrameHdr *fh=m_spriteBank->getFrameHeader(FRM__SHOE); + x=itemX-(fh->W/2); + y=itembaseY-(fh->H/2); + m_spriteBank->printFT4(fh,x+2,y+2,0,0,0); + m_spriteBank->printFT4(fh,x-2,y-2,0,0,0); + itemX+=itemgap; + } + if(isWearingHelmet()) + { + sFrameHdr *fh=m_spriteBank->getFrameHeader(FRM__HELMET); + m_spriteBank->printFT4(fh,itemX-(fh->W/2),itembaseY-(fh->H/2),0,0,0); + itemX+=itemgap; + } } @@ -1354,7 +1377,7 @@ void CPlayer::takeDamage(DAMAGE_TYPE _damage) if(m_health) { m_invincibleFrameCount=INVINCIBLE_FRAMES__HIT; - m_healthReactFrames=10; + m_healthReactFrames=25; m_health--; } else diff --git a/source/player/player.h b/source/player/player.h index 4c87560c2..c810b0896 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -302,6 +302,7 @@ public: int isWearingGlasses() {return m_glassesFlag;} void giveSqueakyBoots() {m_squeakyBootsTimer=SQUEAKY_BOOTS_TIME;} int isWearingBoots() {return m_squeakyBootsTimer;} + int isWearingHelmet() {return false;} void giveInvincibilityRing() {m_invincibilityRingTimer=INVINCIBILITY_RING_TIME;} void giveDivingHelmet() {m_divingHelmet=true;} @@ -355,10 +356,12 @@ public: enum { - POWERUPUI_ICONX=40, - POWERUPUI_ICONY=200, - POWERUPUI_TEXTX=60, - POWERUPUI_TEXTY=200, + HEALTH_ICONX=40, + HEALTH_ICONY=40, + POWERUPUI_ICONX=400, + POWERUPUI_ICONY=40, + POWERUPUI_TEXTX=440, + POWERUPUI_TEXTY=37, POWERUPUI_OT=0, }; diff --git a/source/player/pmbubble.cpp b/source/player/pmbubble.cpp index 828d6653c..90833d586 100644 --- a/source/player/pmbubble.cpp +++ b/source/player/pmbubble.cpp @@ -172,11 +172,11 @@ void CPlayerModeBubbleMixture::renderModeUi() sb=m_player->getSpriteBank(); fh=sb->getFrameHeader(FRM__BUBBLEWAND); - sb->printFT4(fh,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT); + sb->printFT4(fh,CPlayer::POWERUPUI_ICONX,CPlayer::POWERUPUI_ICONY,0,0,CPlayer::POWERUPUI_OT); fb=m_player->getFontBank(); sprintf(buf,"x%d",m_player->getBubbleAmmo()); - fb->print(CPlayer::POWERUPUI_TEXTX,CPlayer::POWERUPUI_TEXTY-(fb->getCharHeight()/2),buf); + fb->print(CPlayer::POWERUPUI_TEXTX,CPlayer::POWERUPUI_TEXTY,buf); } /*---------------------------------------------------------------------- diff --git a/source/player/pmcoral.cpp b/source/player/pmcoral.cpp index 5d35babc0..ba89a2143 100644 --- a/source/player/pmcoral.cpp +++ b/source/player/pmcoral.cpp @@ -191,11 +191,11 @@ void CPlayerModeCoralBlower::renderModeUi() if(m_blowerState==BLOWER_STATE__FULL||m_blowerState==BLOWER_STATE__AIMING) { // Blower has a creature/object inside - sb->printFT4Scaled(FRM__BLOWER,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT,256+128); + sb->printFT4Scaled(FRM__BLOWER,CPlayer::POWERUPUI_ICONX,CPlayer::POWERUPUI_ICONY,0,0,CPlayer::POWERUPUI_OT,256+128); } else { - sb->printFT4(fh,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT); + sb->printFT4(fh,CPlayer::POWERUPUI_ICONX,CPlayer::POWERUPUI_ICONY,0,0,CPlayer::POWERUPUI_OT); } } diff --git a/source/player/pmjelly.cpp b/source/player/pmjelly.cpp index a9c5dc18a..7c8092b20 100644 --- a/source/player/pmjelly.cpp +++ b/source/player/pmjelly.cpp @@ -157,26 +157,26 @@ void CPlayerModeJellyLauncher::renderModeUi() { case FIRING_STATE__NONE: case FIRING_STATE__FIRING: - sb->printFT4(fh,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT); + sb->printFT4(fh,CPlayer::POWERUPUI_ICONX,CPlayer::POWERUPUI_ICONY,0,0,CPlayer::POWERUPUI_OT); break; case FIRING_STATE__POWERINGUP: { int rotRange,scaleBase,scaleRange; int xs,ys,rot; rotRange=m_firingTime; - scaleBase=4096+(m_firingTime*10); + scaleBase=4500+(m_firingTime*10); scaleRange=m_firingTime*2; rot=(getRndRange(rotRange*2)-rotRange)&4095; xs=scaleBase+getRndRange(scaleRange); ys=scaleBase+getRndRange(scaleRange); - sb->printRotatedScaledSprite(fh,CPlayer::POWERUPUI_ICONX,CPlayer::POWERUPUI_ICONY,xs,ys,rot,CPlayer::POWERUPUI_OT); + sb->printRotatedScaledSprite(fh,CPlayer::POWERUPUI_ICONX+(fh->W/2),CPlayer::POWERUPUI_ICONY+(fh->H/2),xs,ys,rot,CPlayer::POWERUPUI_OT); } break; } fb=m_player->getFontBank(); sprintf(buf,"x%d",m_player->getJellyAmmo()); - fb->print(CPlayer::POWERUPUI_TEXTX,CPlayer::POWERUPUI_TEXTY-(fb->getCharHeight()/2),buf); + fb->print(CPlayer::POWERUPUI_TEXTX,CPlayer::POWERUPUI_TEXTY,buf); } /*---------------------------------------------------------------------- diff --git a/source/player/pmnet.cpp b/source/player/pmnet.cpp index 2e11760b7..2d78f398f 100644 --- a/source/player/pmnet.cpp +++ b/source/player/pmnet.cpp @@ -246,11 +246,11 @@ void CPlayerModeNet::renderModeUi() { // Net has a jellyfish inside int size=256+128+((msin(m_netSin)*npsize)>>12); - sb->printFT4Scaled(fh,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT,size); + sb->printFT4Scaled(fh,CPlayer::POWERUPUI_ICONX,CPlayer::POWERUPUI_ICONY,0,0,CPlayer::POWERUPUI_OT,size); } else { - sb->printFT4(fh,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT); + sb->printFT4(fh,CPlayer::POWERUPUI_ICONX,CPlayer::POWERUPUI_ICONY,0,0,CPlayer::POWERUPUI_OT); } }