From 44ff77f5a2bdc8aaff63acb44a9f69406dab7994 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 16 May 2001 16:47:29 +0000 Subject: [PATCH] --- source/player/player.cpp | 31 ++++++++++++++++++++++--------- source/player/player.h | 6 ++++++ source/player/pmnet.cpp | 17 ++++++++--------- source/player/pmnet.h | 2 -- source/player/pmodes.h | 1 - 5 files changed, 36 insertions(+), 21 deletions(-) diff --git a/source/player/player.cpp b/source/player/player.cpp index 735657d86..a298cde4e 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -592,12 +592,14 @@ m_animFrame=0; // Always ( cept for one level ) need this registerAddon(PLAYER_ADDON_GLOVE); -// registerAddon(PLAYER_ADDON_NET); -// registerAddon(PLAYER_ADDON_CORALBLOWER); -// registerAddon(PLAYER_ADDON_JELLYLAUNCHER); -// registerAddon(PLAYER_ADDON_GLASSES); -// registerAddon(PLAYER_ADDON_BUBBLEWAND); -// registerAddon(PLAYER_ADDON_JELLYFISHINNET); +#ifdef __USER_paul__ +registerAddon(PLAYER_ADDON_NET); +registerAddon(PLAYER_ADDON_CORALBLOWER); +registerAddon(PLAYER_ADDON_JELLYLAUNCHER); +registerAddon(PLAYER_ADDON_GLASSES); +registerAddon(PLAYER_ADDON_BUBBLEWAND); +registerAddon(PLAYER_ADDON_JELLYFISHINNET); +#endif } /*---------------------------------------------------------------------- @@ -1504,6 +1506,7 @@ void CPlayer::respawn() m_invincibilityRingTimer=0; m_bubbleAmmo=0; m_jellyAmmo=0; + m_jellyfishAmmo=0; m_moveVelocity.vx=m_moveVelocity.vy=0; @@ -1524,14 +1527,23 @@ void CPlayer::respawn() ---------------------------------------------------------------------- */ void CPlayer::renderSb(DVECTOR *_pos,int _animNo,int _animFrame) { - POLY_FT4 *ft4; + int playerMode; int trans; int addon; + POLY_FT4 *ft4; + if(m_currentMode==PLAYER_MODE_DEAD) + { + playerMode=m_lastModeBeforeDeath; + } + else + { + playerMode=m_currentMode; + } trans=m_invincibleFrameCount||m_invincibilityRingTimer; // Render an addon? - addon=s_addonNumbers[m_currentMode]; + addon=s_addonNumbers[playerMode]; if(addon!=NO_ADDON) { s8 addonAnimNo=s_animMapNet[addon][_animNo]; @@ -1554,7 +1566,7 @@ void CPlayer::renderSb(DVECTOR *_pos,int _animNo,int _animFrame) } // Render JFish in a net? - if(m_currentMode==PLAYER_MODE_NET&&m_currentPlayerModeClass->isJellyfishNetFull()) + if(playerMode==PLAYER_MODE_NET&&getJellyFishAmmo()) { s8 addonAnimNo=s_animMapNet[PLAYER_ADDON_JELLYFISHINNET][_animNo]; if(addonAnimNo!=-1) @@ -1575,6 +1587,7 @@ void CPlayer::renderSb(DVECTOR *_pos,int _animNo,int _animFrame) } } } + // Render glasses addon? if(isWearingGlasses()) { diff --git a/source/player/player.h b/source/player/player.h index d54163893..aa1c30c72 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -360,6 +360,11 @@ public: void useOneJelly() {m_jellyAmmo--;} int getJellyAmmo() {return m_jellyAmmo;} + void giveJellyFishAmmo() {if(!isJellyFishAmmoFull())m_jellyfishAmmo++;} + void useOneJellyFishAmmo() {m_jellyfishAmmo--;} + int isJellyFishAmmoFull() {return m_jellyfishAmmo==5;} + int getJellyFishAmmo() {return m_jellyfishAmmo;} + void setIsInWater(int _in) {m_isInWater=_in;} int getIsInWater() {return m_isInWater;} int getIsHealthFullSoICanStopSoakingUp() {return m_healthWaterLevel==WATERMAXHEALTH;} @@ -376,6 +381,7 @@ private: int m_divingHelmet; int m_bubbleAmmo; int m_jellyAmmo; + int m_jellyfishAmmo; int m_isInWater; // Platforms diff --git a/source/player/pmnet.cpp b/source/player/pmnet.cpp index fc8da9d85..7c490262d 100644 --- a/source/player/pmnet.cpp +++ b/source/player/pmnet.cpp @@ -88,7 +88,6 @@ void CPlayerModeNet::enter() { CPlayerModeBase::enter(); m_netState=NET_STATE__INERT; - m_jellyfishHeld=0; } /*---------------------------------------------------------------------- @@ -140,11 +139,11 @@ void CPlayerModeNet::think() padDown=getPadInputDown(); if(padDown&(PI_CATCH|PI_FIRE)&&canSwingNetFromThisState()) { - if(padDown&PI_CATCH&&m_jellyfishHeld<5) + if(padDown&PI_CATCH&&!m_player->isJellyFishAmmoFull()) { m_netState=NET_STATE__CATCHING; } - else if(padDown&PI_FIRE&&m_jellyfishHeld) + else if(padDown&PI_FIRE&&m_player->getJellyFishAmmo()) { m_netState=NET_STATE__LAUNCHING; } @@ -196,11 +195,11 @@ void CPlayerModeNet::think() ((CNpcEnemy*)thing)->caughtWithNet(); m_netState=NET_STATE__JUST_CAUGHT_SOMETHING; thing=NULL; - if(m_jellyfishHeld==0) + if(m_player->getJellyFishAmmo()==0) { m_netSin=0; } - m_jellyfishHeld++; + m_player->giveJellyFishAmmo(); } else { @@ -241,7 +240,7 @@ void CPlayerModeNet::think() projectile->updateCollisionArea(); m_netState=NET_STATE__JUST_LAUNCHED_SOMETHING; - m_jellyfishHeld--; + m_player->useOneJellyFishAmmo(); } break; @@ -263,7 +262,7 @@ void CPlayerModeNet::think() } } - if(m_jellyfishHeld) + if(m_player->getJellyFishAmmo()) { m_netSin=(m_netSin+npspeed)&4095; } @@ -283,7 +282,7 @@ void CPlayerModeNet::think() sb=m_player->getSpriteBank(); fh=sb->getFrameHeader(FRM__NET); - if(m_jellyfishHeld) + if(m_player->getJellyFishAmmo()) { POLY_FT4 *ft4; @@ -299,7 +298,7 @@ void CPlayerModeNet::think() sb->printFT4(fh,CPlayer::POWERUPUI_ICONX,CPlayer::POWERUPUI_ICONY,0,0,CPlayer::POWERUPUI_OT); } - sprintf(buf,"x%d",m_jellyfishHeld); + sprintf(buf,"x%d",m_player->getJellyFishAmmo()); m_player->getFontBank()->print(CPlayer::POWERUPUI_TEXTX,CPlayer::POWERUPUI_TEXTY,buf); } diff --git a/source/player/pmnet.h b/source/player/pmnet.h index 70d3e161c..44204375f 100644 --- a/source/player/pmnet.h +++ b/source/player/pmnet.h @@ -40,7 +40,6 @@ public: virtual void enter(); virtual void think(); virtual void renderModeUi(); - virtual int isJellyfishNetFull() {return m_jellyfishHeld!=0;} virtual void setAnimNo(int _animNo); virtual void setAnimFrame(int _animFrame); @@ -61,7 +60,6 @@ private: int m_netFrame; NetState m_netState; int m_netSin; - int m_jellyfishHeld; }; diff --git a/source/player/pmodes.h b/source/player/pmodes.h index dca86c0fa..7b1982f2d 100644 --- a/source/player/pmodes.h +++ b/source/player/pmodes.h @@ -93,7 +93,6 @@ public: virtual int canDoLookAround() {return false;} virtual void springPlayerUp() {;} void inSoakUpState(); - virtual int isJellyfishNetFull() {ASSERT(0);return false;} // Fugly.. virtual int setState(int _state) {return 0;} virtual int getState() {return STATE_IDLE;} // ARSE.. states need to go back in CPlayer! (pkg)