This commit is contained in:
parent
3b7feb9176
commit
c0983f9bfb
7 changed files with 40 additions and 27 deletions
|
@ -258,7 +258,8 @@ triggers_src := tcamlock \
|
|||
tlevexit \
|
||||
tlook \
|
||||
trestart \
|
||||
tteleprt
|
||||
tteleprt \
|
||||
twater
|
||||
|
||||
utils_src := utils \
|
||||
sincos \
|
||||
|
|
|
@ -315,10 +315,6 @@ void CGameScene::initLevel()
|
|||
DVECTOR mapSize=Level.getMapSize();
|
||||
CPlayer::CameraBox camBox={0,0,mapSize.vx<<4,mapSize.vy<<4};
|
||||
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
|
||||
// better timing over when it starts (pkg)
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
#include "triggers\tcamlock.h"
|
||||
#endif
|
||||
|
||||
#ifndef __TRIGGERS_TWATER_H__
|
||||
#include "triggers\twater.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PICKUPS_PICKUP_H__
|
||||
#include "pickups\pickup.h"
|
||||
#endif
|
||||
|
@ -390,6 +394,14 @@ void CLevel::initThings(int _respawningLevel)
|
|||
case 3:
|
||||
trigger=NULL;
|
||||
break;
|
||||
|
||||
// In/Out of water triggers
|
||||
case 4:
|
||||
trigger=(CInWaterTrigger*)new ("InWaterTrigger") CInWaterTrigger();
|
||||
break;
|
||||
case 5:
|
||||
trigger=(COutOfWaterTrigger*)new ("OutOfWaterTrigger") COutOfWaterTrigger();
|
||||
break;
|
||||
}
|
||||
if(trigger)
|
||||
{
|
||||
|
|
|
@ -486,6 +486,7 @@ m_animFrame=0;
|
|||
resetPlayerCollisionSizeToBase();
|
||||
|
||||
m_divingHelmet=false;
|
||||
setIsInWater(true);
|
||||
|
||||
//#ifdef __USER_paul__
|
||||
registerAddon(PLAYER_ADDON_NET);
|
||||
|
@ -494,9 +495,6 @@ registerAddon(PLAYER_ADDON_JELLYLAUNCHER);
|
|||
registerAddon(PLAYER_ADDON_GLASSES);
|
||||
registerAddon(PLAYER_ADDON_BUBBLEWAND);
|
||||
//#endif
|
||||
|
||||
|
||||
setHealthType(HEALTH_TYPE__NORMAL);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
|
@ -546,7 +544,10 @@ void CPlayer::think(int _frames)
|
|||
{
|
||||
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;
|
||||
if(m_healthWaterLevel<=0)
|
||||
|
@ -871,7 +872,7 @@ for(int i=0;i<NUM_LASTPOS;i++)
|
|||
|
||||
|
||||
// Health
|
||||
if(m_healthType==HEALTH_TYPE__NORMAL)
|
||||
if(!isWearingDivingHelmet())
|
||||
{
|
||||
// In water - Use normal SB face for health
|
||||
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);
|
||||
itemX+=COLLECTEDITEM_GAP;
|
||||
}
|
||||
if(isWearingHelmet())
|
||||
if(isWearingDivingHelmet())
|
||||
{
|
||||
sFrameHdr *fh=m_spriteBank->getFrameHeader(FRM__HELMET);
|
||||
m_spriteBank->printFT4(fh,itemX-(fh->W/2),COLLECTEDITEM_BASEY-(fh->H/2),0,0,0);
|
||||
itemX+=COLLECTEDITEM_GAP;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1030,7 +1032,7 @@ int CPlayer::getHeightFromGroundNoPlatform(int _x,int _y,int _maxHeight=32)
|
|||
---------------------------------------------------------------------- */
|
||||
void CPlayer::addHealth(int _health)
|
||||
{
|
||||
if(m_healthType==HEALTH_TYPE__NORMAL)
|
||||
if(!isWearingDivingHelmet())
|
||||
{
|
||||
m_health+=_health;
|
||||
if(m_health>MAX_HEALTH)
|
||||
|
@ -1389,7 +1391,7 @@ int CPlayer::canDoLookAround()
|
|||
---------------------------------------------------------------------- */
|
||||
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_healthWaterLevel+=waterSoakUpSpeed;
|
||||
|
@ -1446,7 +1448,7 @@ void CPlayer::takeDamage(DAMAGE_TYPE _damage)
|
|||
{
|
||||
int died=false;
|
||||
if(invincibleSponge){m_invincibleFrameCount=INVINCIBLE_FRAMES__HIT;return;}
|
||||
if(m_healthType==HEALTH_TYPE__NORMAL)
|
||||
if(!isWearingDivingHelmet())
|
||||
{
|
||||
m_health--;
|
||||
if(m_health<0)
|
||||
|
|
|
@ -285,18 +285,8 @@ private:
|
|||
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:
|
||||
int m_lives;
|
||||
HEALTH_TYPE m_healthType;
|
||||
int m_health;
|
||||
int m_healthWaterLevel;
|
||||
int m_healthReactFrames;
|
||||
|
@ -333,9 +323,9 @@ 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;}
|
||||
int isWearingDivingHelmet() {return m_divingHelmet;}
|
||||
|
||||
void giveBubbleAmmo() {m_bubbleAmmo+=10;if(m_bubbleAmmo>99)m_bubbleAmmo=99;}
|
||||
void useOneBubble() {m_bubbleAmmo--;}
|
||||
|
@ -345,6 +335,9 @@ public:
|
|||
void useOneJelly() {m_jellyAmmo--;}
|
||||
int getJellyAmmo() {return m_jellyAmmo;}
|
||||
|
||||
void setIsInWater(int _in) {m_isInWater=_in;}
|
||||
int getIsInWater() {return m_isInWater;}
|
||||
|
||||
private:
|
||||
int m_glassesFlag;
|
||||
int m_squeakyBootsTimer;
|
||||
|
@ -352,6 +345,7 @@ private:
|
|||
int m_divingHelmet;
|
||||
int m_bubbleAmmo;
|
||||
int m_jellyAmmo;
|
||||
int m_isInWater;
|
||||
|
||||
// Platforms
|
||||
public:
|
||||
|
|
|
@ -55,7 +55,7 @@ void CInWaterTrigger::collidedWith(CThing *_thisThing)
|
|||
{
|
||||
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)
|
||||
{
|
||||
// ((CPlayer*)_thisThing)->setCameraBox(camBox);
|
||||
((CPlayer*)_thisThing)->setIsInWater(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1771,6 +1771,14 @@ SOURCE=..\..\..\source\triggers\tteleprt.cpp
|
|||
|
||||
SOURCE=..\..\..\source\triggers\tteleprt.h
|
||||
# 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
|
||||
# Begin Group "utils"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue