This commit is contained in:
Paul 2001-02-28 19:37:01 +00:00
parent c26bed0f30
commit b94df4dc3f
12 changed files with 165 additions and 77 deletions

View file

@ -159,6 +159,8 @@ eng=Set BASICUNARMED mode
eng=Set FULLUNARMED mode eng=Set FULLUNARMED mode
[STR__DEBUG__SQUEAKYBOOTS_MODE] [STR__DEBUG__SQUEAKYBOOTS_MODE]
eng=Set SQUEAKYBOOTS mode eng=Set SQUEAKYBOOTS mode
[STR__DEBUG__BALLOON_MODE]
eng=Set BALLOON mode
[STR__DEBUG__NET_MODE] [STR__DEBUG__NET_MODE]
eng=Set NET mode eng=Set NET mode
[STR__DEBUG__CORALBLOWER_MODE] [STR__DEBUG__CORALBLOWER_MODE]

View file

@ -157,6 +157,7 @@ pickups_src := pickup \
player_src := demoplay \ player_src := demoplay \
panimsfx \ panimsfx \
player \ player \
psballoon \
psbutt \ psbutt \
pschop \ pschop \
psdead \ psdead \
@ -169,6 +170,7 @@ player_src := demoplay \
pstates \ pstates \
modelist \ modelist \
pmodes \ pmodes \
pmballoon \
pmboots pmboots
script_src := script \ script_src := script \

View file

@ -73,6 +73,7 @@
#define TEXT_BOX_WIDTH 300 #define TEXT_BOX_WIDTH 300
#define TEXT_BOX_HEIGHT 20 #define TEXT_BOX_HEIGHT 20
#define OT_POS 5 #define OT_POS 5
#define TEXT_SPACING 13
extern int newmode; extern int newmode;
void CPauseMenu::init() void CPauseMenu::init()
{ {
@ -83,37 +84,41 @@ void CPauseMenu::init()
m_guiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER); m_guiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER);
CGUIFactory::createValueButtonFrame(m_guiFrame, 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, STR__PAUSE_MENU__CONTINUE,
&m_exitPauseMenuFlag,true); &m_exitPauseMenuFlag,true);
CGUIFactory::createValueButtonFrame(m_guiFrame, 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, STR__PAUSE_MENU__QUIT,
&m_quitGameFlag,true); &m_quitGameFlag,true);
CGUIFactory::createValueButtonFrame(m_guiFrame, 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, STR__DEBUG__FLY_MODE,
&newmode,PLAYER_MODE_FLY); &newmode,PLAYER_MODE_FLY);
CGUIFactory::createValueButtonFrame(m_guiFrame, 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, STR__DEBUG__BASICUNARMED_MODE,
&newmode,PLAYER_MODE_BASICUNARMED); &newmode,PLAYER_MODE_BASICUNARMED);
#ifdef __USER_paul__ #ifdef __USER_paul__
CGUIFactory::createValueButtonFrame(m_guiFrame, 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, STR__DEBUG__FULLUNARMED_MODE,
&newmode,PLAYER_MODE_FULLUNARMED); &newmode,PLAYER_MODE_FULLUNARMED);
CGUIFactory::createValueButtonFrame(m_guiFrame, 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, STR__DEBUG__SQUEAKYBOOTS_MODE,
&newmode,PLAYER_MODE_SQUEAKYBOOTS); &newmode,PLAYER_MODE_SQUEAKYBOOTS);
CGUIFactory::createValueButtonFrame(m_guiFrame, 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, STR__DEBUG__NET_MODE,
&newmode,PLAYER_MODE_NET); &newmode,PLAYER_MODE_NET);
CGUIFactory::createValueButtonFrame(m_guiFrame, 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, STR__DEBUG__CORALBLOWER_MODE,
&newmode,PLAYER_MODE_CORALBLOWER); &newmode,PLAYER_MODE_CORALBLOWER);
#endif #endif

View file

@ -37,6 +37,10 @@
#include "utils\mathtab.h" #include "utils\mathtab.h"
#endif #endif
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
/* Std Lib /* Std Lib
------- */ ------- */
@ -91,6 +95,7 @@ void CBalloonPickup::init()
void CBalloonPickup::collect(class CPlayer *_player) void CBalloonPickup::collect(class CPlayer *_player)
{ {
CBaseRespawningPickup::collect(_player); CBaseRespawningPickup::collect(_player);
_player->setMode(PLAYER_MODE_BALLOON);
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------

View file

@ -26,6 +26,10 @@
#include "player/pmboots.h" #include "player/pmboots.h"
#endif #endif
#ifndef __PLAYER_PMBALLOON_H__
#include "player/pmballoon.h"
#endif
#ifndef __PLAYER__PSJUMP_H__ #ifndef __PLAYER__PSJUMP_H__
#include "player\psjump.h" #include "player\psjump.h"
@ -63,6 +67,10 @@
#include "player\psfly.h" #include "player\psfly.h"
#endif #endif
#ifndef __PLAYER__PSBALLOON_H__
#include "player\psballoon.h"
#endif
/* Std Lib /* Std Lib
------- */ ------- */
@ -88,6 +96,7 @@
CPlayerMode modeEmpty; CPlayerMode modeEmpty;
CPlayerModeBoots modeBoots; CPlayerModeBoots modeBoots;
CPlayerModeBalloon modeBalloon;
CPlayerStateUnarmedIdle stateUnarmedIdle; CPlayerStateUnarmedIdle stateUnarmedIdle;
CPlayerStateCoralBlowerIdle stateCoralBlowerIdle; CPlayerStateCoralBlowerIdle stateCoralBlowerIdle;
@ -107,6 +116,7 @@ CPlayerStateSoakUp stateSoackUp;
CPlayerStateGetUp stateGetup; CPlayerStateGetUp stateGetup;
CPlayerStateDead stateDead; CPlayerStateDead stateDead;
CPlayerStateFly stateFly; CPlayerStateFly stateFly;
CPlayerStateBalloon stateBalloon;
@ -119,6 +129,7 @@ CPlayerStateFly stateFly;
CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]= CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]=
{ {
// //
// PLAYER_MODE_BASICUNARMED
// Basic player mode. No attack, only butt bounce // 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 // 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 // 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 // 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 ) // 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.. ) // Fly mode ( A useful debugging mode.. )
// //
{ {

View file

@ -68,6 +68,9 @@
Structure defintions Structure defintions
-------------------- */ -------------------- */
// Two dice. One says 'Re' on every face, the other says 'boot',
// 'install', 'try', 'tire', 'sume' and 'number'
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function Prototypes Function Prototypes
------------------- */ ------------------- */
@ -132,6 +135,7 @@ static const char *s_modeText[NUM_PLAYERMODES]=
"BASICUNARMED", "BASICUNARMED",
"FULLUNARMED", "FULLUNARMED",
"SQUEAKYBOOTS", "SQUEAKYBOOTS",
"BALLOON",
"NET", "NET",
"CORALBLOWER", "CORALBLOWER",
}; };
@ -388,29 +392,32 @@ void CPlayer::thinkVerticalMovement()
Pos.vy+=(m_moveVel.vy>>VELOCITY_SHIFT)+colHeight; Pos.vy+=(m_moveVel.vy>>VELOCITY_SHIFT)+colHeight;
m_moveVel.vy=0; m_moveVel.vy=0;
m_fallFrames=0; m_fallFrames=0;
if(m_currentState==STATE_BUTTFALL) if(m_currentMode!=PLAYER_MODE_BALLOON)
{ {
// Landed from a butt bounce if(m_currentState==STATE_BUTTFALL)
setState(STATE_BUTTLAND); {
} // Landed from a butt bounce
else if(m_currentState==STATE_FALLFAR) setState(STATE_BUTTLAND);
{ }
// Landed from a painfully long fall else if(m_currentState==STATE_FALLFAR)
setState(STATE_IDLE); {
takeDamage(DAMAGE__FALL); // Landed from a painfully long fall
m_moveVel.vx=0; setState(STATE_IDLE);
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_LAND_AFTER_FALL); takeDamage(DAMAGE__FALL);
} m_moveVel.vx=0;
else if(m_moveVel.vx) CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_LAND_AFTER_FALL);
{ }
// Landed from a jump with x movement else if(m_moveVel.vx)
setState(STATE_RUN); {
} // Landed from a jump with x movement
else setState(STATE_RUN);
{ }
// Landed from a jump with no x movement else
setState(STATE_IDLE); {
setAnimNo(ANIM_SPONGEBOB_JUMPEND); // 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; m_currentMode=_mode;
// Need to do something about this setState() for when the new mode doesn't have that state (pkg) // 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); s_modes[m_currentMode].m_modeControl->enter(this);
} }

View file

@ -55,6 +55,7 @@ typedef enum
PLAYER_MODE_BASICUNARMED, PLAYER_MODE_BASICUNARMED,
PLAYER_MODE_FULLUNARMED, PLAYER_MODE_FULLUNARMED,
PLAYER_MODE_SQUEAKYBOOTS, PLAYER_MODE_SQUEAKYBOOTS,
PLAYER_MODE_BALLOON,
PLAYER_MODE_NET, PLAYER_MODE_NET,
PLAYER_MODE_CORALBLOWER, PLAYER_MODE_CORALBLOWER,
PLAYER_MODE_FLY, PLAYER_MODE_FLY,
@ -144,7 +145,7 @@ class CPlayer : public CPlayerThing
public: public:
enum enum
{ {
VELOCITY_SHIFT=2 VELOCITY_SHIFT=4,
}; };
virtual void init(); virtual void init();
@ -165,10 +166,10 @@ protected:
DEFAULT_PLAYER_MAX_JUMP_FRAMES=12, DEFAULT_PLAYER_MAX_JUMP_FRAMES=12,
DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES=30, DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES=30,
DEFAULT_PLAYER_MAX_RUN_VELOCITY=8, DEFAULT_PLAYER_MAX_RUN_VELOCITY=8,
DEFAULT_PLAYER_RUN_SPEEDUP=4, DEFAULT_PLAYER_RUN_SPEEDUP=4<<2,
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN=3, DEFAULT_PLAYER_RUN_REVERSESLOWDOWN=3<<2,
DEFAULT_PLAYER_RUN_SLOWDOWN=2, DEFAULT_PLAYER_RUN_SLOWDOWN=2<<2,
PLAYER_GRAVITY=4, PLAYER_GRAVITY=4<<2,
PLAYER_TERMINAL_VELOCITY=8, PLAYER_TERMINAL_VELOCITY=8,
}; };
const PlayerMetrics *getPlayerMetrics(); const PlayerMetrics *getPlayerMetrics();

View file

@ -38,6 +38,9 @@
Tyepdefs && Defines Tyepdefs && Defines
------------------- */ ------------------- */
#define MAX_BALLOON_VELOCITY 5
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Structure defintions Structure defintions
-------------------- */ -------------------- */
@ -58,29 +61,10 @@
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateBalloon::enter(CPlayer *_player) void CPlayerStateBalloon::enter(CPlayer *_player)
{ {
int controlHeld; setAnimNo(_player,ANIM_SPONGEBOB_HOVER);
controlHeld=getPadInputHeld(_player); m_canDropBalloon=false;
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);
}
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:
@ -93,17 +77,9 @@ void CPlayerStateBalloon::think(CPlayer *_player)
controlDown=getPadInputDown(_player); controlDown=getPadInputDown(_player);
controlHeld=getPadInputHeld(_player); controlHeld=getPadInputHeld(_player);
if(controlDown&PI_JUMP) if(m_canDropBalloon&&controlDown&PI_ACTION)
{ {
setState(_player,STATE_JUMP); setMode(_player,PLAYER_MODE_FULLUNARMED);
}
if(controlHeld&PI_DOWN)
{
setState(_player,STATE_DUCK);
}
if(controlDown&PI_ACTION)
{
setState(_player,STATE_RUNATTACK);
} }
if(controlHeld&PI_LEFT) if(controlHeld&PI_LEFT)
@ -116,22 +92,25 @@ void CPlayerStateBalloon::think(CPlayer *_player)
} }
else else
{ {
if(getMoveVelocity(_player).vx==0) slowdown(_player);
{
setState(_player,STATE_IDLE);
}
else
{
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)) if(advanceAnimFrameAndCheckForEndOfAnim(_player))
{ {
setAnimNo(_player,ANIM_SPONGEBOB_RUN); m_canDropBalloon=true;
} }
} }
/*=========================================================================== /*===========================================================================
end */ end */

View file

@ -38,6 +38,8 @@ public:
void enter(class CPlayer *_player); void enter(class CPlayer *_player);
void think(class CPlayer *_player); void think(class CPlayer *_player);
private:
int m_canDropBalloon;
}; };

View file

@ -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: Function:
Purpose: Purpose:

View file

@ -44,6 +44,7 @@ public:
protected: protected:
const struct PlayerMetrics *getPlayerMetrics(class CPlayer *_player); const struct PlayerMetrics *getPlayerMetrics(class CPlayer *_player);
int setState(class CPlayer *_player,int _state); int setState(class CPlayer *_player,int _state);
void setMode(class CPlayer *_player,int _mode);
int getFacing(class CPlayer *_player); int getFacing(class CPlayer *_player);
void setFacing(class CPlayer *_player,int _facing); void setFacing(class CPlayer *_player,int _facing);
int getAnimNo(class CPlayer *_player); int getAnimNo(class CPlayer *_player);

View file

@ -776,6 +776,14 @@ SOURCE=..\..\..\source\player\modelist.cpp
# End Source File # End Source File
# Begin 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 SOURCE=..\..\..\source\player\pmboots.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -796,6 +804,14 @@ SOURCE=..\..\..\source\player\pmodes.h
# PROP Default_Filter "" # PROP Default_Filter ""
# Begin Source File # 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 SOURCE=..\..\..\source\player\psbutt.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File