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
[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]

View File

@ -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 \

View File

@ -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

View File

@ -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);
}
/*----------------------------------------------------------------------

View File

@ -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.. )
//
{

View File

@ -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);
}

View File

@ -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();

View File

@ -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 */

View File

@ -38,6 +38,8 @@ public:
void enter(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:
Purpose:

View File

@ -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);

View File

@ -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