This commit is contained in:
Paul 2001-05-14 22:08:19 +00:00
parent b8d08e6ded
commit 56a8006029
10 changed files with 109 additions and 25 deletions

View File

@ -130,6 +130,35 @@ BubicleEmitterData CGameBubicleFactory::s_emitters[CGameBubicleFactory::NUM_TYPE
{0,0,0} // m_colour
}
},
// TYPE_SPONGEBOBSOAKUP
{
0,0,0,0, // m_x,m_y,m_w,m_h
1,1, // m_birthRate,m_birthAmount
15, // m_life
true, // m_applyMapOffsets
{ // m_bubicleBase
10, // m_life
0,0,0, // m_vx,m_vdx,m_vxmax
-100,0,0, // m_vy,m_vdy,m_vymax
10,7, // m_w,m_h
0, // m_dvSizeChange
0,0, // m_theta,m_vtheta
0,0,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
0, // m_ot
{200,200,200} // m_colour
},
{ // m_bubicleRange
50, // m_life
0,0,0, // m_vx,m_vdx,m_vxmax
50,0,0, // m_vy,m_vdy,m_vymax
3,3, // m_w,m_h
0, // m_dvSizeChange
0,100, // m_theta,m_vtheta
10,0,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
0, // m_ot
{0,0,0} // m_colour
}
},
};

View File

@ -42,6 +42,7 @@ public:
TYPE_SMALL,
TYPE_MEDIUM,
TYPE_LARGE,
TYPE_SPONGEBOBSOAKUP,
NUM_TYPES
}GAMEBUBICLETYPE;

View File

@ -121,7 +121,7 @@ void CSpatulaPickup::collect(class CPlayer *_player)
int spat_maxglint=50;
int spat_glintgrowspeed=3;
int spat_glintrotspeed=90;
DVECTOR spat_gxy={19,1};
DVECTOR spat_gxy={20,0};
static const int spat_glintFrames[]={FRM__GLINT1,FRM__GLINT2,FRM__GLINT3,FRM__GLINT4,FRM__GLINT4,FRM__GLINT3,FRM__GLINT2,FRM__GLINT1};
void CSpatulaPickup::thinkPickup(int _frames)
{

View File

@ -1629,6 +1629,7 @@ void CPlayer::takeDamage(DAMAGE_TYPE _damage,REACT_DIRECTION _reactDirection,CTh
{
if(m_invincibleFrameCount==0&& // Don't take damage if still recovering from the last hit
m_invincibilityRingTimer==0&& // Or if we have the invincibility ring on
m_currentPlayerModeClass->getState()!=STATE_SOAKUP&& // Or soaking up
m_currentMode!=PLAYER_MODE_DEAD) // Or already dead! :)
{
int ouchThatHurt=true;
@ -2079,12 +2080,14 @@ int CPlayer::moveVertical(int _moveDistance)
else
{
// Stood on any important types of collision?
int colType;
colType=m_layerCollision->getCollisionBlock(pos.vx,pos.vy+_moveDistance)&COLLISION_TYPE_MASK;
if(colType==COLLISION_TYPE_FLAG_DAMAGE)
switch(m_layerCollision->getCollisionBlock(pos.vx,pos.vy+_moveDistance)&COLLISION_TYPE_MASK)
{
case COLLISION_TYPE_FLAG_DAMAGE:
takeDamage(DAMAGE__COLLISION_DAMAGE);
break;
default:
break;
}
}
pos.vy+=_moveDistance;

View File

@ -177,6 +177,7 @@ public:
WATERLEVELSHIFT=5,
WATERMAXHEALTH=(255<<WATERLEVELSHIFT),
WATERHEALTHPART=WATERMAXHEALTH/(MAX_HEALTH+1),
WATERMINSOACKUPLEVEL=(245<<WATERLEVELSHIFT), // SB won't auto soak unless water is lower than this
};
typedef struct
@ -359,6 +360,8 @@ public:
void setIsInWater(int _in) {m_isInWater=_in;}
int getIsInWater() {return m_isInWater;}
int getIsHealthFullSoICanStopSoakingUp() {return m_healthWaterLevel==WATERMAXHEALTH;}
int getIsHealthSoFullThatIDontNeedToSoakUp(){return m_healthWaterLevel>=WATERMINSOACKUPLEVEL;}
int isHoldingNet() {return m_currentMode==PLAYER_MODE_NET;}

View File

@ -294,7 +294,17 @@ void CPlayerModeBase::thinkVerticalMovement()
{
if(m_player->moveVertical(m_player->getMoveVelocity()->vy>>VELOCITY_SHIFT))
{
DVECTOR pos;
playerHasHitGround();
pos=m_player->getPlayerPos();
if(m_player->getHeightFromGround(pos.vx,pos.vy,5)==0&&
(m_player->getLayerCollision()->getCollisionBlock(pos.vx,pos.vy)&COLLISION_TYPE_MASK)==COLLISION_TYPE_FLAG_WATER&&
!m_player->getIsHealthSoFullThatIDontNeedToSoakUp())
{
// Hit water - Go into soakup mode
setState(STATE_SOAKUP);
}
}
else if(m_currentState!=STATE_FALL&&m_currentState!=STATE_FALLFAR&& // Hmm.. (pkg)
m_currentState!=STATE_BUTTFALL&&m_currentState!=STATE_BUTTBOUNCE&&

View File

@ -96,6 +96,7 @@ public:
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)
int getPadInputHeld();
int getPadInputDown();
@ -103,9 +104,10 @@ public:
virtual ATTACK_STATE getAttackState() {return ATTACK_STATE__NONE;}
public:
DVECTOR getPlayerPos(); // Public so that the states can get the position for bubicle spawners
protected:
DVECTOR getPlayerPos();
void setPlayerPos(DVECTOR *_pos);
void setPlayerPos(DVECTOR *_pos); // Private so that they cannot directly alter it
void respawn();
@ -140,7 +142,7 @@ public:
virtual const struct PlayerMetrics *getPlayerMetrics();
virtual int setState(int _state);
int getState() {return m_currentState;}
virtual int getState() {return m_currentState;}
int getFacing();
void setFacing(int _facing);
virtual int getAnimNo();
@ -158,6 +160,10 @@ public:
virtual void setPlayerCollisionSize(int _x,int _y,int _w,int _h);
virtual void getPlayerCollisionSize(int *_x,int *_y,int *_w,int *_h);
int getIsInWater() {return m_player->getIsInWater();}
int getIsHealthFullSoICanStopSoakingUp() {return m_player->getIsHealthFullSoICanStopSoakingUp();}
int getIsHealthSoFullThatIDontNeedToSoakUp(){return m_player->getIsHealthSoFullThatIDontNeedToSoakUp();}
void moveLeft();
void moveRight();
int slowdown();

View File

@ -125,10 +125,12 @@ void CPlayerStateButtBounceFall::think(CPlayerModeBase *_playerMode)
---------------------------------------------------------------------- */
void CPlayerStateButtBounceLand::enter(CPlayerModeBase *_playerMode)
{
// DVECTOR pos;
//
// pos=_playerMode->getPlayerPos();
// CGameBubicleFactory::spawnBubicles(pos.vx,pos.vy,40,10,CGameBubicleFactory::TYPE_MEDIUM);
if(_playerMode->getIsInWater())
{
DVECTOR pos;
pos=_playerMode->getPlayerPos();
CGameBubicleFactory::spawnBubicles(pos.vx-20,pos.vy,40,10,CGameBubicleFactory::TYPE_MEDIUM);
}
}
@ -155,6 +157,13 @@ void CPlayerStateButtBounceLand::think(CPlayerModeBase *_playerMode)
---------------------------------------------------------------------- */
void CPlayerStateButtBounceUp::enter(CPlayerModeBase *_playerMode)
{
if(_playerMode->getIsInWater())
{
DVECTOR pos;
pos=_playerMode->getPlayerPos();
CGameBubicleFactory::spawnBubicles(pos.vx-20,pos.vy,40,10,CGameBubicleFactory::TYPE_MEDIUM);
}
_playerMode->setAnimNo(ANIM_SPONGEBOB_BUTTBOUNCEEND);
m_bounceFrames=0;
}

View File

@ -27,6 +27,10 @@
#include "player\pmodes.h"
#endif
#ifndef __GAME_GAMEBUBS_H__
#include "game\gamebubs.h"
#endif
/* Std Lib
------- */
@ -99,7 +103,7 @@ void CPlayerStateSoakUp::enter(CPlayerModeBase *_playerMode)
_playerMode->zeroMoveVelocity();
_playerMode->setAnimNo(ANIM_SPONGEBOB_SOAKUP);
_playerMode->setAnimFrame(_playerMode->getAnimFrameCount()-1);
_playerMode->setPlayerCollisionSize(0,-10,60,20);
m_breatheDelayFrames=0;
}
@ -111,16 +115,24 @@ void CPlayerStateSoakUp::enter(CPlayerModeBase *_playerMode)
---------------------------------------------------------------------- */
void CPlayerStateSoakUp::think(CPlayerModeBase *_playerMode)
{
int controlHeld;
controlHeld=_playerMode->getPadInputHeld();
if(!(controlHeld&PI_DOWN))
if(!_playerMode->getIsHealthFullSoICanStopSoakingUp())
{
_playerMode->setState(STATE_GETUP);
if(m_breatheDelayFrames==0)
{
DVECTOR pos;
pos=_playerMode->getPlayerPos();
CGameBubicleFactory::spawnBubicles(pos.vx+BUBBLE_XOFF,pos.vy+BUBBLE_YOFF,BUBBLE_W,BUBBLE_H,CGameBubicleFactory::TYPE_SPONGEBOBSOAKUP);
m_breatheDelayFrames=0;
}
if(++m_breatheDelayFrames>BUBBLE_SPAWNDELAY)
{
m_breatheDelayFrames=0;
}
_playerMode->inSoakUpState();
}
else
{
_playerMode->inSoakUpState();
_playerMode->setState(STATE_GETUP);
}
}

View File

@ -47,6 +47,17 @@ public:
void enter(class CPlayerModeBase *_playerMode);
void think(class CPlayerModeBase *_playerMode);
private:
enum
{
BUBBLE_SPAWNDELAY=20,
BUBBLE_XOFF=-10,
BUBBLE_YOFF=-35,
BUBBLE_W=20,
BUBBLE_H=10,
};
int m_breatheDelayFrames;
};