This commit is contained in:
Paul 2001-05-08 16:58:07 +00:00
parent 3b7feb9176
commit c0983f9bfb
7 changed files with 40 additions and 27 deletions

View file

@ -258,7 +258,8 @@ triggers_src := tcamlock \
tlevexit \ tlevexit \
tlook \ tlook \
trestart \ trestart \
tteleprt tteleprt \
twater
utils_src := utils \ utils_src := utils \
sincos \ sincos \

View file

@ -315,10 +315,6 @@ void CGameScene::initLevel()
DVECTOR mapSize=Level.getMapSize(); DVECTOR mapSize=Level.getMapSize();
CPlayer::CameraBox camBox={0,0,mapSize.vx<<4,mapSize.vy<<4}; CPlayer::CameraBox camBox={0,0,mapSize.vx<<4,mapSize.vy<<4};
m_player->setCameraBox(camBox); m_player->setCameraBox(camBox);
if(s_globalLevelSelectThing==1)
{
m_player->setHealthType(CPlayer::HEALTH_TYPE__OUT_OF_WATER);
}
// Song is loaded/dumped by the level, and played from here. This just gives some // Song is loaded/dumped by the level, and played from here. This just gives some
// better timing over when it starts (pkg) // better timing over when it starts (pkg)

View file

@ -35,6 +35,10 @@
#include "triggers\tcamlock.h" #include "triggers\tcamlock.h"
#endif #endif
#ifndef __TRIGGERS_TWATER_H__
#include "triggers\twater.h"
#endif
#ifndef __PICKUPS_PICKUP_H__ #ifndef __PICKUPS_PICKUP_H__
#include "pickups\pickup.h" #include "pickups\pickup.h"
#endif #endif
@ -390,6 +394,14 @@ void CLevel::initThings(int _respawningLevel)
case 3: case 3:
trigger=NULL; trigger=NULL;
break; break;
// In/Out of water triggers
case 4:
trigger=(CInWaterTrigger*)new ("InWaterTrigger") CInWaterTrigger();
break;
case 5:
trigger=(COutOfWaterTrigger*)new ("OutOfWaterTrigger") COutOfWaterTrigger();
break;
} }
if(trigger) if(trigger)
{ {

View file

@ -486,6 +486,7 @@ m_animFrame=0;
resetPlayerCollisionSizeToBase(); resetPlayerCollisionSizeToBase();
m_divingHelmet=false; m_divingHelmet=false;
setIsInWater(true);
//#ifdef __USER_paul__ //#ifdef __USER_paul__
registerAddon(PLAYER_ADDON_NET); registerAddon(PLAYER_ADDON_NET);
@ -494,9 +495,6 @@ registerAddon(PLAYER_ADDON_JELLYLAUNCHER);
registerAddon(PLAYER_ADDON_GLASSES); registerAddon(PLAYER_ADDON_GLASSES);
registerAddon(PLAYER_ADDON_BUBBLEWAND); registerAddon(PLAYER_ADDON_BUBBLEWAND);
//#endif //#endif
setHealthType(HEALTH_TYPE__NORMAL);
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -546,7 +544,10 @@ void CPlayer::think(int _frames)
{ {
int i; int i;
if(m_healthType==HEALTH_TYPE__OUT_OF_WATER&&m_currentMode!=PLAYER_MODE_DEAD&&m_currentMode!=PLAYER_MODE_FLY) ASSERT(!(getIsInWater()==false&&isWearingDivingHelmet()==false));
if(isWearingDivingHelmet()&&getIsInWater()==false&&
m_currentMode!=PLAYER_MODE_DEAD&&m_currentMode!=PLAYER_MODE_FLY)
{ {
m_healthWaterLevel-=waterDrainSpeed*_frames; m_healthWaterLevel-=waterDrainSpeed*_frames;
if(m_healthWaterLevel<=0) if(m_healthWaterLevel<=0)
@ -871,7 +872,7 @@ for(int i=0;i<NUM_LASTPOS;i++)
// Health // Health
if(m_healthType==HEALTH_TYPE__NORMAL) if(!isWearingDivingHelmet())
{ {
// In water - Use normal SB face for health // In water - Use normal SB face for health
static int s_fullHealthFrames[]= static int s_fullHealthFrames[]=
@ -955,12 +956,13 @@ for(int i=0;i<NUM_LASTPOS;i++)
m_spriteBank->printFT4(fh,x-2,y-2,0,0,0); m_spriteBank->printFT4(fh,x-2,y-2,0,0,0);
itemX+=COLLECTEDITEM_GAP; itemX+=COLLECTEDITEM_GAP;
} }
if(isWearingHelmet()) if(isWearingDivingHelmet())
{ {
sFrameHdr *fh=m_spriteBank->getFrameHeader(FRM__HELMET); sFrameHdr *fh=m_spriteBank->getFrameHeader(FRM__HELMET);
m_spriteBank->printFT4(fh,itemX-(fh->W/2),COLLECTEDITEM_BASEY-(fh->H/2),0,0,0); m_spriteBank->printFT4(fh,itemX-(fh->W/2),COLLECTEDITEM_BASEY-(fh->H/2),0,0,0);
itemX+=COLLECTEDITEM_GAP; itemX+=COLLECTEDITEM_GAP;
} }
} }
@ -1030,7 +1032,7 @@ int CPlayer::getHeightFromGroundNoPlatform(int _x,int _y,int _maxHeight=32)
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayer::addHealth(int _health) void CPlayer::addHealth(int _health)
{ {
if(m_healthType==HEALTH_TYPE__NORMAL) if(!isWearingDivingHelmet())
{ {
m_health+=_health; m_health+=_health;
if(m_health>MAX_HEALTH) if(m_health>MAX_HEALTH)
@ -1389,7 +1391,7 @@ int CPlayer::canDoLookAround()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayer::inSoakUpState() void CPlayer::inSoakUpState()
{ {
if(m_healthType==HEALTH_TYPE__OUT_OF_WATER&& if(isWearingDivingHelmet()&&
(m_layerCollision->getCollisionBlock(Pos.vx,Pos.vy)&COLLISION_TYPE_MASK)==COLLISION_TYPE_FLAG_WATER) (m_layerCollision->getCollisionBlock(Pos.vx,Pos.vy)&COLLISION_TYPE_MASK)==COLLISION_TYPE_FLAG_WATER)
{ {
m_healthWaterLevel+=waterSoakUpSpeed; m_healthWaterLevel+=waterSoakUpSpeed;
@ -1446,7 +1448,7 @@ void CPlayer::takeDamage(DAMAGE_TYPE _damage)
{ {
int died=false; int died=false;
if(invincibleSponge){m_invincibleFrameCount=INVINCIBLE_FRAMES__HIT;return;} if(invincibleSponge){m_invincibleFrameCount=INVINCIBLE_FRAMES__HIT;return;}
if(m_healthType==HEALTH_TYPE__NORMAL) if(!isWearingDivingHelmet())
{ {
m_health--; m_health--;
if(m_health<0) if(m_health<0)

View file

@ -285,18 +285,8 @@ private:
int m_currentMode; int m_currentMode;
public:
typedef enum
{
HEALTH_TYPE__NORMAL,
HEALTH_TYPE__OUT_OF_WATER,
} HEALTH_TYPE;
void setHealthType(HEALTH_TYPE _healthType) {m_healthType=_healthType;}
private: private:
int m_lives; int m_lives;
HEALTH_TYPE m_healthType;
int m_health; int m_health;
int m_healthWaterLevel; int m_healthWaterLevel;
int m_healthReactFrames; int m_healthReactFrames;
@ -333,9 +323,9 @@ public:
int isWearingGlasses() {return m_glassesFlag;} int isWearingGlasses() {return m_glassesFlag;}
void giveSqueakyBoots() {m_squeakyBootsTimer=SQUEAKY_BOOTS_TIME;} void giveSqueakyBoots() {m_squeakyBootsTimer=SQUEAKY_BOOTS_TIME;}
int isWearingBoots() {return m_squeakyBootsTimer;} int isWearingBoots() {return m_squeakyBootsTimer;}
int isWearingHelmet() {return false;}
void giveInvincibilityRing() {m_invincibilityRingTimer=INVINCIBILITY_RING_TIME;} void giveInvincibilityRing() {m_invincibilityRingTimer=INVINCIBILITY_RING_TIME;}
void giveDivingHelmet() {m_divingHelmet=true;} void giveDivingHelmet() {m_divingHelmet=true;}
int isWearingDivingHelmet() {return m_divingHelmet;}
void giveBubbleAmmo() {m_bubbleAmmo+=10;if(m_bubbleAmmo>99)m_bubbleAmmo=99;} void giveBubbleAmmo() {m_bubbleAmmo+=10;if(m_bubbleAmmo>99)m_bubbleAmmo=99;}
void useOneBubble() {m_bubbleAmmo--;} void useOneBubble() {m_bubbleAmmo--;}
@ -345,6 +335,9 @@ public:
void useOneJelly() {m_jellyAmmo--;} void useOneJelly() {m_jellyAmmo--;}
int getJellyAmmo() {return m_jellyAmmo;} int getJellyAmmo() {return m_jellyAmmo;}
void setIsInWater(int _in) {m_isInWater=_in;}
int getIsInWater() {return m_isInWater;}
private: private:
int m_glassesFlag; int m_glassesFlag;
int m_squeakyBootsTimer; int m_squeakyBootsTimer;
@ -352,6 +345,7 @@ private:
int m_divingHelmet; int m_divingHelmet;
int m_bubbleAmmo; int m_bubbleAmmo;
int m_jellyAmmo; int m_jellyAmmo;
int m_isInWater;
// Platforms // Platforms
public: public:

View file

@ -55,7 +55,7 @@ void CInWaterTrigger::collidedWith(CThing *_thisThing)
{ {
if(_thisThing->getThingType()==TYPE_PLAYER) if(_thisThing->getThingType()==TYPE_PLAYER)
{ {
// ((CPlayer*)_thisThing)->setCameraBox(camBox); ((CPlayer*)_thisThing)->setIsInWater(true);
} }
} }
@ -69,7 +69,7 @@ void COutOfWaterTrigger::collidedWith(CThing *_thisThing)
{ {
if(_thisThing->getThingType()==TYPE_PLAYER) if(_thisThing->getThingType()==TYPE_PLAYER)
{ {
// ((CPlayer*)_thisThing)->setCameraBox(camBox); ((CPlayer*)_thisThing)->setIsInWater(false);
} }
} }

View file

@ -1771,6 +1771,14 @@ SOURCE=..\..\..\source\triggers\tteleprt.cpp
SOURCE=..\..\..\source\triggers\tteleprt.h SOURCE=..\..\..\source\triggers\tteleprt.h
# End Source File # End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\twater.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\twater.h
# End Source File
# End Group # End Group
# Begin Group "utils" # Begin Group "utils"