diff --git a/Graphics/ingamefx/+water.bmp b/Graphics/ingamefx/+water.bmp index 3cdc681d9..469951476 100644 Binary files a/Graphics/ingamefx/+water.bmp and b/Graphics/ingamefx/+water.bmp differ diff --git a/Graphics/ingamefx/+watermeter.bmp b/Graphics/ingamefx/+watermeter.bmp index 3cdc681d9..1ef0eaaf3 100644 Binary files a/Graphics/ingamefx/+watermeter.bmp and b/Graphics/ingamefx/+watermeter.bmp differ diff --git a/makefile.gfx b/makefile.gfx index 1dd0831c6..5dd61690c 100644 --- a/makefile.gfx +++ b/makefile.gfx @@ -174,10 +174,12 @@ INGAMEFX_GFX_DIR := $(GRAF_DIR)/ingamefx INGAMEFX_GFX_TRANS := +bubble_1 +bubble_2 +bubble_3 \ +health_full_1 +health_full_2 +health_full_3 +health_full_4 +health_full_5 \ +health_empty_1 +health_empty_2 +health_empty_3 +health_empty_4 +health_empty_5 \ - +watermeter +netblob \ + +watermeter +waterhilight +netblob \ +spike +INGAMEFX_GFX_TRANS_NONROT_NONCLIP := +water INGAMEFX_GFX_TRANS_IN := $(foreach FILE,$(INGAMEFX_GFX_TRANS),$(INGAMEFX_GFX_DIR)/$(FILE).bmp) +INGAMEFX_GFX_TRANS_NONROT_NONCLIP_IN := $(foreach FILE,$(INGAMEFX_GFX_TRANS_NONROT_NONCLIP),$(INGAMEFX_GFX_DIR)/$(FILE).bmp) #### @@ -229,11 +231,12 @@ UI_GFX_TRANS_IN := $(foreach FILE,$(UI_GFX_TRANS),$(UI_GFX_DIR)/$(FILE)) #### -INGAMEGFX_SPR_DEP := $(INGAMEFX_GFX_NONTRANS_IN) $(INGAMEFX_GFX_TRANS_IN) $(PICKUP_GFX_IN) \ - $(UI_GFX_FONT_IN) $(UI_GFX_NONTRANS_IN) $(UI_GFX_TRANS_IN) +INGAMEGFX_SPR_DEP := $(INGAMEFX_GFX_NONTRANS_IN) $(INGAMEFX_GFX_TRANS_IN) $(INGAMEFX_GFX_TRANS_NONROT_NONCLIP_IN) \ + $(PICKUP_GFX_IN) $(UI_GFX_FONT_IN) $(UI_GFX_NONTRANS_IN) $(UI_GFX_TRANS_IN) INGAMEGFX_SPR_IN := -c+ -z+ $(INGAMEFX_GFX_TRANS_IN) $(PICKUP_GFX_IN) $(UI_GFX_FONT_IN) $(UI_GFX_TRANS_IN) \ - -c- -z- $(INGAMEFX_GFX_NONTRANS_IN) $(UI_GFX_NONTRANS_IN) + -c- -z- $(INGAMEFX_GFX_NONTRANS_IN) $(UI_GFX_NONTRANS_IN) \ + -c- -q- -z+ -r- $(INGAMEFX_GFX_TRANS_NONROT_NONCLIP_IN) #---------------------------------------------------------------------------- # Front end graphics diff --git a/source/game/game.cpp b/source/game/game.cpp index fdbf9483c..b42519c1b 100644 --- a/source/game/game.cpp +++ b/source/game/game.cpp @@ -309,6 +309,10 @@ void CGameScene::initLevel() DVECTOR mapSize=Level.getMapSize(); CPlayer::CameraBox camBox={0,0,mapSize.vx,mapSize.vy}; m_player->setCameraBox(camBox); + if(s_globalLevelSelectThing==1) + { + m_player->setHealthType(CPlayer::HEALTH_TYPE__OUT_OF_WATER); + } // Init actors (needs moving and tidying int actorNum; diff --git a/source/player/player.cpp b/source/player/player.cpp index 19cb8a41c..441a4e811 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -126,8 +126,6 @@ #define _STATE_DEBUG_ -#define SLIPSPEED 10 // Speed that player slips on icy surfaces - /*---------------------------------------------------------------------- Structure defintions -------------------- */ @@ -261,6 +259,9 @@ pint ledgeShift=1; pint cammove=2; +pint waterDrainSpeed=4; +pint waterSoakUpSpeed=20; + // --------------------------------- Addon stuff --------------------------------- @@ -493,6 +494,9 @@ registerAddon(PLAYER_ADDON_JELLYLAUNCHER); registerAddon(PLAYER_ADDON_GLASSES); registerAddon(PLAYER_ADDON_BUBBLEWAND); //#endif + + + setHealthType(HEALTH_TYPE__NORMAL); } /*---------------------------------------------------------------------- @@ -542,6 +546,14 @@ void CPlayer::think(int _frames) { int i; + if(m_healthType==HEALTH_TYPE__OUT_OF_WATER&&m_currentMode!=PLAYER_MODE_DEAD) + { + m_healthWaterLevel-=waterDrainSpeed*_frames; + if(m_healthWaterLevel<=0) + { + dieYouPorousFreak(); + } + } if(PadGetDown(0)&PAD_L1) { @@ -808,11 +820,6 @@ static int lastposnum=0; int mouth=-1,eyes=-1; #endif - -int itembaseX=110; -int itembaseY=60; -int itemgap=40; - #include "gui\gui.h" void CPlayer::render() { @@ -861,7 +868,9 @@ for(int i=0;iprintFT4(FRM__WATERHILIGHT,HEALTH_ICONX,HEALTH_ICONY,0,0,0); + setSemiTrans(ft4,true); + + m_spriteBank->printFT4(FRM__WATERMETER,HEALTH_ICONX,HEALTH_ICONY,0,0,0); + + fh=m_spriteBank->getFrameHeader(FRM__WATER); + ft4=m_spriteBank->printFT4(fh,0,0,0,0,0); + setSemiTrans(ft4,true); + V=fh->V; + W=fh->W; + H=fh->H; + partH=(H*(255-(m_healthWaterLevel>>WATERLEVELSHIFT)))>>8; + if(partH>H)partH=H; + setXYWH(ft4,HEALTH_ICONX,HEALTH_ICONY+(partH),W,H-partH); + ft4->v0=V+(partH); + ft4->v1=V+(partH); + } + // Mode specific ui - int itemX=itembaseX; + int itemX=COLLECTEDITEM_BASEX; // Pickups m_currentPlayerModeClass->renderModeUi(); @@ -913,16 +947,16 @@ for(int i=0;igetFrameHeader(FRM__SHOE); x=itemX-(fh->W/2); - y=itembaseY-(fh->H/2); + y=COLLECTEDITEM_BASEY-(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; + itemX+=COLLECTEDITEM_GAP; } 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; + m_spriteBank->printFT4(fh,itemX-(fh->W/2),COLLECTEDITEM_BASEY-(fh->H/2),0,0,0); + itemX+=COLLECTEDITEM_GAP; } } @@ -1001,10 +1035,21 @@ int CPlayer::getHeightFromGroundNoPlatform(int _x,int _y,int _maxHeight=32) ---------------------------------------------------------------------- */ void CPlayer::addHealth(int _health) { - m_health+=_health; - if(m_health>MAX_HEALTH) + if(m_healthType==HEALTH_TYPE__NORMAL) { - m_health=MAX_HEALTH; + m_health+=_health; + if(m_health>MAX_HEALTH) + { + m_health=MAX_HEALTH; + } + } + else + { + m_healthWaterLevel+=WATERHEALTHPART*_health; + if(m_healthWaterLevel>WATERMAXHEALTH) + { + m_healthWaterLevel=WATERMAXHEALTH; + } } } @@ -1240,6 +1285,7 @@ void CPlayer::respawn() m_allowConversation=false; m_health=MAX_HEALTH; + m_healthWaterLevel=WATERMAXHEALTH; m_healthReactFrames=0; m_invincibleFrameCount=INVINCIBLE_FRAMES__START; Pos=m_respawnPos; @@ -1333,6 +1379,26 @@ int CPlayer::canDoLookAround() return m_currentPlayerModeClass->canDoLookAround(); } + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayer::inSoakUpState() +{ + if(m_healthType==HEALTH_TYPE__OUT_OF_WATER&& + (m_layerCollision->getCollisionBlock(Pos.vx,Pos.vy)&COLLISION_TYPE_MASK)==COLLISION_TYPE_FLAG_WATER) + { + m_healthWaterLevel+=waterSoakUpSpeed; + if(m_healthWaterLevel>WATERMAXHEALTH) + { + m_healthWaterLevel=WATERMAXHEALTH; + } + } +} + /*---------------------------------------------------------------------- Function: Purpose: @@ -1377,22 +1443,52 @@ void CPlayer::takeDamage(DAMAGE_TYPE _damage) if(ouchThatHurt) { + int died=false; if(invincibleSponge){m_invincibleFrameCount=INVINCIBLE_FRAMES__HIT;return;} - if(m_health) + if(m_healthType==HEALTH_TYPE__NORMAL) { - m_invincibleFrameCount=INVINCIBLE_FRAMES__HIT; - m_healthReactFrames=25; m_health--; + if(m_health<0) + { + died=true; + } } else { - CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_DEFEATED_JINGLE); - setMode(PLAYER_MODE_DEAD); + m_healthWaterLevel-=WATERHEALTHPART; + if(m_healthWaterLevel<0) + { + died=true; + } + } + + if(died) + { + dieYouPorousFreak(); + } + else + { + m_invincibleFrameCount=INVINCIBLE_FRAMES__HIT; + m_healthReactFrames=25; } } } } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayer::dieYouPorousFreak() +{ + ASSERT(m_currentMode!=PLAYER_MODE_DEAD); + + CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_DEFEATED_JINGLE); + setMode(PLAYER_MODE_DEAD); +} + /*---------------------------------------------------------------------- Function: diff --git a/source/player/player.h b/source/player/player.h index 8462a1959..daa75b3d5 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -155,6 +155,10 @@ public: { MAX_HEALTH=5, MAX_LIVES=99, + + WATERLEVELSHIFT=4, + WATERMAXHEALTH=(255<getPadInputHeld();} int CPlayerMode::getPadInputDown() {return m_player->getPadInputDown();} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerMode::inSoakUpState() {m_player->inSoakUpState();} + + /*---------------------------------------------------------------------- Function: Purpose: diff --git a/source/player/pmodes.h b/source/player/pmodes.h index d36c08da3..c8b138028 100644 --- a/source/player/pmodes.h +++ b/source/player/pmodes.h @@ -86,6 +86,7 @@ public: virtual void renderModeUi() {;} // Ui specific to this mode (eg: ammo) virtual int canDoLookAround() {return false;} virtual void springPlayerUp() {;} + void inSoakUpState(); int getPadInputHeld(); diff --git a/source/player/psduck.cpp b/source/player/psduck.cpp index d7404176e..8f20f660f 100644 --- a/source/player/psduck.cpp +++ b/source/player/psduck.cpp @@ -118,6 +118,10 @@ void CPlayerStateSoakUp::think(CPlayerModeBase *_playerMode) { _playerMode->setState(STATE_GETUP); } + else + { + _playerMode->inSoakUpState(); + } }