From 56a8006029dc2631fc2d235c48fe225fa643aff1 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 14 May 2001 22:08:19 +0000 Subject: [PATCH] --- source/game/gamebubs.cpp | 29 +++++++++++++++++++++++++++++ source/game/gamebubs.h | 1 + source/pickups/pspatula.cpp | 2 +- source/player/player.cpp | 19 +++++++++++-------- source/player/player.h | 7 +++++-- source/player/pmodes.cpp | 10 ++++++++++ source/player/pmodes.h | 12 +++++++++--- source/player/psbutt.cpp | 17 +++++++++++++---- source/player/psduck.cpp | 26 +++++++++++++++++++------- source/player/psduck.h | 11 +++++++++++ 10 files changed, 109 insertions(+), 25 deletions(-) diff --git a/source/game/gamebubs.cpp b/source/game/gamebubs.cpp index b06b2af94..830ddcbfb 100644 --- a/source/game/gamebubs.cpp +++ b/source/game/gamebubs.cpp @@ -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 + } + }, }; diff --git a/source/game/gamebubs.h b/source/game/gamebubs.h index f894cddb8..35e9e2d03 100644 --- a/source/game/gamebubs.h +++ b/source/game/gamebubs.h @@ -42,6 +42,7 @@ public: TYPE_SMALL, TYPE_MEDIUM, TYPE_LARGE, + TYPE_SPONGEBOBSOAKUP, NUM_TYPES }GAMEBUBICLETYPE; diff --git a/source/pickups/pspatula.cpp b/source/pickups/pspatula.cpp index 55a8694fe..5bff044f2 100644 --- a/source/pickups/pspatula.cpp +++ b/source/pickups/pspatula.cpp @@ -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) { diff --git a/source/player/player.cpp b/source/player/player.cpp index 60e616c60..8cb9775ab 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -1627,9 +1627,10 @@ int invincibleSponge=false; // NB: This is for debugging purposes only so don't #endif void CPlayer::takeDamage(DAMAGE_TYPE _damage,REACT_DIRECTION _reactDirection,CThing *_thing) { - 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_currentMode!=PLAYER_MODE_DEAD) // Or already dead! :) + 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; int ouchThatHurtSoMuchThatImJustGoingToDieNow=false; @@ -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) { - takeDamage(DAMAGE__COLLISION_DAMAGE); + case COLLISION_TYPE_FLAG_DAMAGE: + takeDamage(DAMAGE__COLLISION_DAMAGE); + break; + + default: + break; } } pos.vy+=_moveDistance; diff --git a/source/player/player.h b/source/player/player.h index 873099950..10801e10a 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -177,6 +177,7 @@ public: WATERLEVELSHIFT=5, WATERMAXHEALTH=(255<=WATERMINSOACKUPLEVEL;} int isHoldingNet() {return m_currentMode==PLAYER_MODE_NET;} diff --git a/source/player/pmodes.cpp b/source/player/pmodes.cpp index 80ec2db4b..8ebd47563 100644 --- a/source/player/pmodes.cpp +++ b/source/player/pmodes.cpp @@ -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&& diff --git a/source/player/pmodes.h b/source/player/pmodes.h index 1a50afdf4..dca86c0fa 100644 --- a/source/player/pmodes.h +++ b/source/player/pmodes.h @@ -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(); diff --git a/source/player/psbutt.cpp b/source/player/psbutt.cpp index 28e1b7c75..141756548 100644 --- a/source/player/psbutt.cpp +++ b/source/player/psbutt.cpp @@ -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; } diff --git a/source/player/psduck.cpp b/source/player/psduck.cpp index 8f20f660f..8e94a6468 100644 --- a/source/player/psduck.cpp +++ b/source/player/psduck.cpp @@ -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); } } diff --git a/source/player/psduck.h b/source/player/psduck.h index b4342adba..6c6f56d42 100644 --- a/source/player/psduck.h +++ b/source/player/psduck.h @@ -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; };