diff --git a/data/translations/text.dat b/data/translations/text.dat index 8c2a323ca..befdde744 100644 --- a/data/translations/text.dat +++ b/data/translations/text.dat @@ -159,6 +159,8 @@ eng=Set BASICUNARMED mode eng=Set FULLUNARMED mode [STR__DEBUG__SQUEAKYBOOTS_MODE] eng=Set SQUEAKYBOOTS mode +[STR__DEBUG__BALLOON_MODE] +eng=Set BALLOON mode [STR__DEBUG__NET_MODE] eng=Set NET mode [STR__DEBUG__CORALBLOWER_MODE] diff --git a/makefile.gaz b/makefile.gaz index 241bbbb66..b8503c4cc 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -157,6 +157,7 @@ pickups_src := pickup \ player_src := demoplay \ panimsfx \ player \ + psballoon \ psbutt \ pschop \ psdead \ @@ -169,6 +170,7 @@ player_src := demoplay \ pstates \ modelist \ pmodes \ + pmballoon \ pmboots script_src := script \ diff --git a/source/game/pause.cpp b/source/game/pause.cpp index 058409df2..692f4d4d1 100644 --- a/source/game/pause.cpp +++ b/source/game/pause.cpp @@ -73,6 +73,7 @@ #define TEXT_BOX_WIDTH 300 #define TEXT_BOX_HEIGHT 20 #define OT_POS 5 +#define TEXT_SPACING 13 extern int newmode; void CPauseMenu::init() { @@ -83,37 +84,41 @@ void CPauseMenu::init() m_guiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER); CGUIFactory::createValueButtonFrame(m_guiFrame, - (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,10,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__PAUSE_MENU__CONTINUE, &m_exitPauseMenuFlag,true); CGUIFactory::createValueButtonFrame(m_guiFrame, - (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,30,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*2,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__PAUSE_MENU__QUIT, &m_quitGameFlag,true); CGUIFactory::createValueButtonFrame(m_guiFrame, - (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,60,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*4,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__DEBUG__FLY_MODE, &newmode,PLAYER_MODE_FLY); CGUIFactory::createValueButtonFrame(m_guiFrame, - (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,80,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*5,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__DEBUG__BASICUNARMED_MODE, &newmode,PLAYER_MODE_BASICUNARMED); #ifdef __USER_paul__ CGUIFactory::createValueButtonFrame(m_guiFrame, - (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,100,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*6,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__DEBUG__FULLUNARMED_MODE, &newmode,PLAYER_MODE_FULLUNARMED); CGUIFactory::createValueButtonFrame(m_guiFrame, - (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,120,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*7,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__DEBUG__SQUEAKYBOOTS_MODE, &newmode,PLAYER_MODE_SQUEAKYBOOTS); CGUIFactory::createValueButtonFrame(m_guiFrame, - (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,140,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*8,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__DEBUG__NET_MODE, &newmode,PLAYER_MODE_NET); CGUIFactory::createValueButtonFrame(m_guiFrame, - (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,160,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*9,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + STR__DEBUG__BALLOON_MODE, + &newmode,PLAYER_MODE_BALLOON); + CGUIFactory::createValueButtonFrame(m_guiFrame, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*10,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__DEBUG__CORALBLOWER_MODE, &newmode,PLAYER_MODE_CORALBLOWER); #endif diff --git a/source/pickups/pballoon.cpp b/source/pickups/pballoon.cpp index f44bb1f1f..e4ff1869a 100644 --- a/source/pickups/pballoon.cpp +++ b/source/pickups/pballoon.cpp @@ -37,6 +37,10 @@ #include "utils\mathtab.h" #endif +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + /* Std Lib ------- */ @@ -91,6 +95,7 @@ void CBalloonPickup::init() void CBalloonPickup::collect(class CPlayer *_player) { CBaseRespawningPickup::collect(_player); + _player->setMode(PLAYER_MODE_BALLOON); } /*---------------------------------------------------------------------- diff --git a/source/player/modelist.cpp b/source/player/modelist.cpp index 1c22a3f77..e093dbbf8 100644 --- a/source/player/modelist.cpp +++ b/source/player/modelist.cpp @@ -26,6 +26,10 @@ #include "player/pmboots.h" #endif +#ifndef __PLAYER_PMBALLOON_H__ +#include "player/pmballoon.h" +#endif + #ifndef __PLAYER__PSJUMP_H__ #include "player\psjump.h" @@ -63,6 +67,10 @@ #include "player\psfly.h" #endif +#ifndef __PLAYER__PSBALLOON_H__ +#include "player\psballoon.h" +#endif + /* Std Lib ------- */ @@ -88,6 +96,7 @@ CPlayerMode modeEmpty; CPlayerModeBoots modeBoots; +CPlayerModeBalloon modeBalloon; CPlayerStateUnarmedIdle stateUnarmedIdle; CPlayerStateCoralBlowerIdle stateCoralBlowerIdle; @@ -107,6 +116,7 @@ CPlayerStateSoakUp stateSoackUp; CPlayerStateGetUp stateGetup; CPlayerStateDead stateDead; CPlayerStateFly stateFly; +CPlayerStateBalloon stateBalloon; @@ -119,6 +129,7 @@ CPlayerStateFly stateFly; CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]= { // + // PLAYER_MODE_BASICUNARMED // Basic player mode. No attack, only butt bounce // { @@ -153,6 +164,7 @@ CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]= }, // + // PLAYER_MODE_FULLUNARMED // Full unarmed player mode. With butt bounce and karate chop // { @@ -187,6 +199,7 @@ CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]= }, // + // PLAYER_MODE_SQUEAKYBOOTS // Squeaky boots. Also has butt bounce and karate chop // { @@ -221,6 +234,42 @@ CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]= }, // + // PLAYER_MODE_BALLOON + // Holding a balloon + // + { + { { + 0, // PM__JUMP_VELOCITY + 0, // PM__MAX_JUMP_FRAMES + 0, // PM__MAX_SAFE_FALL_FRAMES + DEFAULT_PLAYER_MAX_RUN_VELOCITY/2, // PM__MAX_RUN_VELOCITY + DEFAULT_PLAYER_RUN_SPEEDUP/4, // PM__RUN_SPEEDUP + DEFAULT_PLAYER_RUN_REVERSESLOWDOWN/4, // PM__RUN_REVERSESLOWDOWN + DEFAULT_PLAYER_RUN_SLOWDOWN/4, // PM__RUN_SLOWDOWN + } }, + &modeBalloon, + { + &stateBalloon, // STATE_IDLE + NULL, // STATE_IDLETEETER + NULL, // STATE_JUMP + NULL, // STATE_RUN + NULL, // STATE_FALL + NULL, // STATE_FALLFAR + NULL, // STATE_BUTTBOUNCE + NULL, // STATE_BUTTFALL + NULL, // STATE_BUTTLAND + NULL, // STATE_ATTACK + NULL, // STATE_RUNATTACK + NULL, // STATE_AIRATTACK + NULL, // STATE_DUCK + NULL, // STATE_SOAKUP + NULL, // STATE_GETUP + &stateDead, // STATE_DEAD + } + }, + + // + // PLAYER_MODE_NET // Armed with net // { @@ -255,6 +304,7 @@ CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]= }, // + // PLAYER_MODE_CORALBLOWER // Armed with coral blower ( Heavy weapon so slows SB down ) // { @@ -289,6 +339,7 @@ CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]= }, // + // PLAYER_MODE_FLY // Fly mode ( A useful debugging mode.. ) // { diff --git a/source/player/player.cpp b/source/player/player.cpp index 9b2779317..33907ab7d 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -68,6 +68,9 @@ Structure defintions -------------------- */ +// Two dice. One says 'Re' on every face, the other says 'boot', +// 'install', 'try', 'tire', 'sume' and 'number' + /*---------------------------------------------------------------------- Function Prototypes ------------------- */ @@ -132,6 +135,7 @@ static const char *s_modeText[NUM_PLAYERMODES]= "BASICUNARMED", "FULLUNARMED", "SQUEAKYBOOTS", + "BALLOON", "NET", "CORALBLOWER", }; @@ -388,29 +392,32 @@ void CPlayer::thinkVerticalMovement() Pos.vy+=(m_moveVel.vy>>VELOCITY_SHIFT)+colHeight; m_moveVel.vy=0; m_fallFrames=0; - if(m_currentState==STATE_BUTTFALL) + if(m_currentMode!=PLAYER_MODE_BALLOON) { - // Landed from a butt bounce - setState(STATE_BUTTLAND); - } - else if(m_currentState==STATE_FALLFAR) - { - // Landed from a painfully long fall - setState(STATE_IDLE); - takeDamage(DAMAGE__FALL); - m_moveVel.vx=0; - CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_LAND_AFTER_FALL); - } - else if(m_moveVel.vx) - { - // Landed from a jump with x movement - setState(STATE_RUN); - } - else - { - // Landed from a jump with no x movement - setState(STATE_IDLE); - setAnimNo(ANIM_SPONGEBOB_JUMPEND); + if(m_currentState==STATE_BUTTFALL) + { + // Landed from a butt bounce + setState(STATE_BUTTLAND); + } + else if(m_currentState==STATE_FALLFAR) + { + // Landed from a painfully long fall + setState(STATE_IDLE); + takeDamage(DAMAGE__FALL); + m_moveVel.vx=0; + CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_LAND_AFTER_FALL); + } + else if(m_moveVel.vx) + { + // Landed from a jump with x movement + setState(STATE_RUN); + } + else + { + // Landed from a jump with no x movement + setState(STATE_IDLE); + setAnimNo(ANIM_SPONGEBOB_JUMPEND); + } } } } @@ -680,7 +687,12 @@ void CPlayer::setMode(PLAYER_MODE _mode) { m_currentMode=_mode; // Need to do something about this setState() for when the new mode doesn't have that state (pkg) - setState(m_currentState); + if(!setState(m_currentState)) + { + m_moveVel.vx=0; + m_moveVel.vy=0; + setState(STATE_IDLE); + } s_modes[m_currentMode].m_modeControl->enter(this); } diff --git a/source/player/player.h b/source/player/player.h index 591a56f44..f86e4eae0 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -55,6 +55,7 @@ typedef enum PLAYER_MODE_BASICUNARMED, PLAYER_MODE_FULLUNARMED, PLAYER_MODE_SQUEAKYBOOTS, + PLAYER_MODE_BALLOON, PLAYER_MODE_NET, PLAYER_MODE_CORALBLOWER, PLAYER_MODE_FLY, @@ -144,7 +145,7 @@ class CPlayer : public CPlayerThing public: enum { - VELOCITY_SHIFT=2 + VELOCITY_SHIFT=4, }; virtual void init(); @@ -165,10 +166,10 @@ protected: DEFAULT_PLAYER_MAX_JUMP_FRAMES=12, DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES=30, DEFAULT_PLAYER_MAX_RUN_VELOCITY=8, - DEFAULT_PLAYER_RUN_SPEEDUP=4, - DEFAULT_PLAYER_RUN_REVERSESLOWDOWN=3, - DEFAULT_PLAYER_RUN_SLOWDOWN=2, - PLAYER_GRAVITY=4, + DEFAULT_PLAYER_RUN_SPEEDUP=4<<2, + DEFAULT_PLAYER_RUN_REVERSESLOWDOWN=3<<2, + DEFAULT_PLAYER_RUN_SLOWDOWN=2<<2, + PLAYER_GRAVITY=4<<2, PLAYER_TERMINAL_VELOCITY=8, }; const PlayerMetrics *getPlayerMetrics(); diff --git a/source/player/psballoon.cpp b/source/player/psballoon.cpp index 21ffb5476..1b0dacca5 100644 --- a/source/player/psballoon.cpp +++ b/source/player/psballoon.cpp @@ -38,6 +38,9 @@ Tyepdefs && Defines ------------------- */ +#define MAX_BALLOON_VELOCITY 5 + + /*---------------------------------------------------------------------- Structure defintions -------------------- */ @@ -58,29 +61,10 @@ ---------------------------------------------------------------------- */ void CPlayerStateBalloon::enter(CPlayer *_player) { - int controlHeld; - controlHeld=getPadInputHeld(_player); - - if(getMoveVelocity(_player).vx) - { - setAnimNo(_player,ANIM_SPONGEBOB_RUN); - } - else - { - setAnimNo(_player,ANIM_SPONGEBOB_RUNSTART); - } - - if(controlHeld&PI_LEFT) - { - setFacing(_player,FACING_LEFT); - } - else if(controlHeld&PI_RIGHT) - { - setFacing(_player,FACING_RIGHT); - } + setAnimNo(_player,ANIM_SPONGEBOB_HOVER); + m_canDropBalloon=false; } - /*---------------------------------------------------------------------- Function: Purpose: @@ -93,17 +77,9 @@ void CPlayerStateBalloon::think(CPlayer *_player) controlDown=getPadInputDown(_player); controlHeld=getPadInputHeld(_player); - if(controlDown&PI_JUMP) + if(m_canDropBalloon&&controlDown&PI_ACTION) { - setState(_player,STATE_JUMP); - } - if(controlHeld&PI_DOWN) - { - setState(_player,STATE_DUCK); - } - if(controlDown&PI_ACTION) - { - setState(_player,STATE_RUNATTACK); + setMode(_player,PLAYER_MODE_FULLUNARMED); } if(controlHeld&PI_LEFT) @@ -116,22 +92,25 @@ void CPlayerStateBalloon::think(CPlayer *_player) } else { - if(getMoveVelocity(_player).vx==0) - { - setState(_player,STATE_IDLE); - } - else - { - slowdown(_player); - } + slowdown(_player); } + DVECTOR moveVel=getMoveVelocity(_player); + if(moveVel.vy>-MAX_BALLOON_VELOCITY) + { + moveVel.vy--; + } + if(moveVel.vy<-MAX_BALLOON_VELOCITY) + { + moveVel.vy++; + } + setMoveVelocity(_player,&moveVel); + if(advanceAnimFrameAndCheckForEndOfAnim(_player)) { - setAnimNo(_player,ANIM_SPONGEBOB_RUN); + m_canDropBalloon=true; } } - /*=========================================================================== end */ diff --git a/source/player/psballoon.h b/source/player/psballoon.h index 6f9a8ddb9..436b85061 100644 --- a/source/player/psballoon.h +++ b/source/player/psballoon.h @@ -38,6 +38,8 @@ public: void enter(class CPlayer *_player); void think(class CPlayer *_player); +private: + int m_canDropBalloon; }; diff --git a/source/player/pstates.cpp b/source/player/pstates.cpp index 97889af65..52fd8d658 100644 --- a/source/player/pstates.cpp +++ b/source/player/pstates.cpp @@ -69,6 +69,18 @@ int CPlayerState::setState(CPlayer *_player,int _state) } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerState::setMode(class CPlayer *_player,int _mode) +{ + _player->setMode((PLAYER_MODE)_mode); +} + + /*---------------------------------------------------------------------- Function: Purpose: diff --git a/source/player/pstates.h b/source/player/pstates.h index 879b7c187..9c49e7f6e 100644 --- a/source/player/pstates.h +++ b/source/player/pstates.h @@ -44,6 +44,7 @@ public: protected: const struct PlayerMetrics *getPlayerMetrics(class CPlayer *_player); int setState(class CPlayer *_player,int _state); + void setMode(class CPlayer *_player,int _mode); int getFacing(class CPlayer *_player); void setFacing(class CPlayer *_player,int _facing); int getAnimNo(class CPlayer *_player); diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 49e217e73..3d23eac0a 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -776,6 +776,14 @@ SOURCE=..\..\..\source\player\modelist.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\player\pmballoon.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\player\pmballoon.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\player\pmboots.cpp # End Source File # Begin Source File @@ -796,6 +804,14 @@ SOURCE=..\..\..\source\player\pmodes.h # PROP Default_Filter "" # Begin Source File +SOURCE=..\..\..\source\player\psballoon.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\player\psballoon.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\player\psbutt.cpp # End Source File # Begin Source File