Before Width: | Height: | Size: 742 B After Width: | Height: | Size: 534 B |
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 454 B |
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 614 B |
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 526 B |
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 526 B |
Before Width: | Height: | Size: 582 B After Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 646 B After Width: | Height: | Size: 630 B |
|
@ -157,6 +157,7 @@ player_src := demoplay \
|
|||
panimsfx \
|
||||
player \
|
||||
pmodes \
|
||||
pmbloon \
|
||||
pmfly \
|
||||
psbutt \
|
||||
psduck \
|
||||
|
|
|
@ -99,26 +99,25 @@ void CPauseMenu::init()
|
|||
(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,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,TEXT_SPACING*7,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
|
||||
STR__DEBUG__NET_MODE,
|
||||
&newmode,PLAYER_MODE_NET);
|
||||
// CGUIFactory::createValueButtonFrame(m_guiFrame,
|
||||
// (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,TEXT_SPACING*7,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
|
||||
// STR__DEBUG__NET_MODE,
|
||||
// &newmode,PLAYER_MODE_NET);
|
||||
CGUIFactory::createValueButtonFrame(m_guiFrame,
|
||||
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*8,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*9,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
|
||||
STR__DEBUG__CORALBLOWER_MODE,
|
||||
&newmode,PLAYER_MODE_CORALBLOWER);
|
||||
// CGUIFactory::createValueButtonFrame(m_guiFrame,
|
||||
// (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*9,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
|
||||
// STR__DEBUG__CORALBLOWER_MODE,
|
||||
// &newmode,PLAYER_MODE_CORALBLOWER);
|
||||
#endif
|
||||
*/
|
||||
|
||||
m_active=false;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ void CBalloonPickup::init()
|
|||
---------------------------------------------------------------------- */
|
||||
void CBalloonPickup::collect(class CPlayer *_player)
|
||||
{
|
||||
// _player->setMode(PLAYER_MODE_BALLOON);
|
||||
_player->setMode(PLAYER_MODE_BALLOON);
|
||||
CBaseRespawningPickup::collect(_player);
|
||||
}
|
||||
|
||||
|
@ -105,14 +105,18 @@ void CBalloonPickup::collect(class CPlayer *_player)
|
|||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int balloon_height=30;
|
||||
int balloon_r=180;
|
||||
int balloon_g=180;
|
||||
int balloon_b=180;
|
||||
int balloon_r1=251;
|
||||
int balloon_g1=207;
|
||||
int balloon_b1=167;
|
||||
int balloon_r2=147;
|
||||
int balloon_g2=95;
|
||||
int balloon_b2=75;
|
||||
int balloon_speed=25;
|
||||
int balloon_scale1=5;
|
||||
int balloon_scale2=2;
|
||||
int balloon_phase=1024;
|
||||
int balloon_vissize=40;
|
||||
int balloon_stringx=-3;
|
||||
int CBalloonPickup::getVisibilityRadius()
|
||||
{
|
||||
return balloon_vissize;
|
||||
|
@ -163,9 +167,11 @@ void CBalloonPickup::renderPickup(DVECTOR *_pos)
|
|||
sprites->printFT4(fh,x+xo1,y,0,0,PICKUPS_OT_POS);
|
||||
setCollisionCentreOffset(xo1,0);
|
||||
|
||||
x=_pos->vx;
|
||||
x=_pos->vx+balloon_stringx;
|
||||
y=_pos->vy+(fh->H/2);
|
||||
DrawLine(x+xo1,y,x+xo2,y+balloon_height,balloon_r,balloon_g,balloon_b,PICKUPS_OT_POS);
|
||||
DrawLine(x+xo1,y,x+xo2,y+balloon_height,balloon_r1,balloon_g1,balloon_b1,PICKUPS_OT_POS);
|
||||
x++;
|
||||
DrawLine(x+xo1,y,x+xo2,y+balloon_height,balloon_r2,balloon_g2,balloon_b2,PICKUPS_OT_POS);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
#include "player\pmfly.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER_PMBLOON_H__
|
||||
#include "player\pmbloon.h"
|
||||
#endif
|
||||
|
||||
// to be removed
|
||||
#include "gfx\tpage.h"
|
||||
|
||||
|
@ -127,7 +131,7 @@ static const char *s_modeText[NUM_PLAYERMODES]=
|
|||
{
|
||||
"BASICUNARMED",
|
||||
// "FULLUNARMED",
|
||||
// "BALLOON",
|
||||
"BALLOON",
|
||||
// "NET",
|
||||
// "CORALBLOWER",
|
||||
"FLY",
|
||||
|
@ -158,12 +162,14 @@ int CAMERA_SCROLLSPEED=60; // Speed of the scroll ( 60=1 tile scrolled every
|
|||
|
||||
|
||||
|
||||
CPlayerModeBasic PLAYERMODE;
|
||||
CPlayerModeBase PLAYERMODE;
|
||||
CPlayerModeBalloon PLAYERMODEBALLOON;
|
||||
CPlayerModeFly PLAYERMODEFLY;
|
||||
|
||||
CPlayerMode *CPlayer::s_playerModes[NUM_PLAYERMODES]=
|
||||
{
|
||||
&PLAYERMODE, // PLAYER_MODE_BASICUNARMED
|
||||
&PLAYERMODEBALLOON, // PLAYER_MODE_BALLOON
|
||||
&PLAYERMODEFLY, // PLAYER_MODE_FLY
|
||||
};
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef enum
|
|||
{
|
||||
PLAYER_MODE_BASICUNARMED,
|
||||
// PLAYER_MODE_FULLUNARMED,
|
||||
// PLAYER_MODE_BALLOON,
|
||||
PLAYER_MODE_BALLOON,
|
||||
//PLAYER_MODE_BUBBLE_MIXTURE,
|
||||
//PLAYER_MODE_HELMET,
|
||||
// PLAYER_MODE_NET,
|
||||
|
|
|
@ -11,51 +11,11 @@
|
|||
|
||||
===========================================================================*/
|
||||
|
||||
void a(){}
|
||||
#if 0
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Includes
|
||||
-------- */
|
||||
|
||||
#include "player\pmodes.h"
|
||||
|
||||
#ifndef __PLAYER_PLAYER_H__
|
||||
#include "player\player.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER_PSTATES_H__
|
||||
#include "player\pstates.h"
|
||||
#endif
|
||||
|
||||
#ifndef __LAYER_COLLISION_H__
|
||||
#include "level\layercollision.h"
|
||||
#endif
|
||||
|
||||
// States
|
||||
#ifndef __PLAYER__PSJUMP_H__
|
||||
#include "player\psjump.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER__PSRUN_H__
|
||||
#include "player\psrun.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER__PSFALL_H__
|
||||
#include "player\psfall.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER__PSIDLE_H__
|
||||
#include "player\psidle.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER__PSBUTT_H__
|
||||
#include "player\psbutt.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER__PSDUCK_H__
|
||||
#include "player\psduck.h"
|
||||
#endif
|
||||
#include "player\pmbloon.h"
|
||||
|
||||
|
||||
/* Std Lib
|
||||
|
@ -64,11 +24,6 @@ void a(){}
|
|||
/* Data
|
||||
---- */
|
||||
|
||||
#ifndef __ANIM_SPONGEBOB_HEADER__
|
||||
#include <ACTOR_SPONGEBOB_ANIM.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Tyepdefs && Defines
|
||||
------------------- */
|
||||
|
@ -85,40 +40,7 @@ void a(){}
|
|||
Vars
|
||||
---- */
|
||||
|
||||
static CPlayerStateUnarmedIdle stateUnarmedIdle;
|
||||
static CPlayerStateTeeterIdle stateTeeterIdle;
|
||||
static CPlayerStateJump stateJump;
|
||||
static CPlayerStateRun stateRun;
|
||||
static CPlayerStateFall stateFall;
|
||||
static CPlayerStateFallFar stateFallFar;
|
||||
static CPlayerStateDuck stateDuck;
|
||||
static CPlayerStateSoakUp stateSoakUp;
|
||||
static CPlayerStateGetUp stateGetUp;
|
||||
static CPlayerStateButtBounce stateButtBounce;
|
||||
static CPlayerStateButtBounceFall stateButtBounceFall;
|
||||
static CPlayerStateButtBounceLand stateButtBounceLand;
|
||||
|
||||
/*
|
||||
static CPlayerStateDead stateDead;
|
||||
*/
|
||||
|
||||
CPlayerState *CPlayerModeBasic::s_stateTable[]=
|
||||
{
|
||||
&stateUnarmedIdle, // STATE_IDLE
|
||||
&stateTeeterIdle, // STATE_IDLETEETER
|
||||
&stateJump, // STATE_JUMP
|
||||
&stateRun, // STATE_RUN
|
||||
&stateFall, // STATE_FALL
|
||||
&stateFallFar, // STATE_FALLFAR
|
||||
&stateButtBounce, // STATE_BUTTBOUNCE
|
||||
&stateButtBounceFall, // STATE_BUTTFALL
|
||||
&stateButtBounceLand, // STATE_BUTTLAND
|
||||
&stateDuck, // STATE_DUCK
|
||||
&stateSoakUp, // STATE_SOAKUP
|
||||
&stateGetUp, // STATE_GETUP
|
||||
};
|
||||
|
||||
PlayerMetrics CPlayerModeBasic::s_playerMetrics=
|
||||
static PlayerMetrics s_playerMetrics=
|
||||
{ {
|
||||
DEFAULT_PLAYER_JUMP_VELOCITY, // PM__JUMP_VELOCITY
|
||||
DEFAULT_PLAYER_MAX_JUMP_FRAMES, // PM__MAX_JUMP_FRAMES
|
||||
|
@ -127,528 +49,22 @@ PlayerMetrics CPlayerModeBasic::s_playerMetrics=
|
|||
DEFAULT_PLAYER_RUN_SPEEDUP, // PM__RUN_SPEEDUP
|
||||
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN
|
||||
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
|
||||
DEFAULT_PLAYER_PLAYER_GRAVITY/3, // PM__GRAVITY
|
||||
DEFAULT_PLAYER_TERMINAL_VELOCITY/3, // PM__TERMINAL_VELOCITY
|
||||
} };
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayerMode::getPadInputHeld() {return m_player->getPadInputHeld();}
|
||||
int CPlayerMode::getPadInputDown() {return m_player->getPadInputDown();}
|
||||
DVECTOR CPlayerMode::getPlayerPos() {return m_player->getPlayerPos();}
|
||||
void CPlayerMode::setPlayerPos(DVECTOR *_pos) {m_player->setPlayerPos(_pos);}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::enter()
|
||||
{
|
||||
m_fallFrames=0;
|
||||
setState(STATE_IDLE);
|
||||
m_moveVelocity.vx=m_moveVelocity.vy=0;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::think()
|
||||
{
|
||||
s_stateTable[m_currentState]->think(this);
|
||||
thinkVerticalMovement();
|
||||
thinkHorizontalMovement();
|
||||
|
||||
// Teeter if on an edge
|
||||
if(canTeeter()&&isOnEdge())
|
||||
{
|
||||
setState(STATE_IDLETEETER);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::render()
|
||||
{
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::thinkVerticalMovement()
|
||||
{
|
||||
CLayerCollision *collision;
|
||||
DVECTOR pos;
|
||||
int colHeight;
|
||||
|
||||
collision=m_player->getLayerCollision();
|
||||
pos=m_player->getPlayerPos();
|
||||
|
||||
colHeight=collision->getHeightFromGround(pos.vx,pos.vy,1);
|
||||
|
||||
//New collision stuff (pkg)
|
||||
//if(m_layerCollision->getCollisionType(Pos.vx,Pos.vy+(m_moveVelocity.vy>>VELOCITY_SHIFT))&COLLISION_TYPE_MASK)
|
||||
//{
|
||||
// m_moveVelocity.vy=0;
|
||||
// return;
|
||||
//}
|
||||
if(colHeight>=0)
|
||||
{
|
||||
// Above or on the ground
|
||||
// Are we falling?
|
||||
if(m_moveVelocity.vy>0)
|
||||
{
|
||||
// Yes.. Check to see if we're about to hit/go through the ground
|
||||
colHeight=collision->getHeightFromGround(pos.vx,pos.vy+(m_moveVelocity.vy>>VELOCITY_SHIFT),PLAYER_TERMINAL_VELOCITY+1);
|
||||
|
||||
if(colHeight<=0)
|
||||
{
|
||||
// Just hit the ground
|
||||
// Stick at ground level
|
||||
pos.vy+=(m_moveVelocity.vy>>VELOCITY_SHIFT)+colHeight;
|
||||
m_moveVelocity.vy=0;
|
||||
m_fallFrames=0;
|
||||
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);
|
||||
m_player->takeDamage(DAMAGE__FALL);
|
||||
m_moveVelocity.vx=0;
|
||||
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_LAND_AFTER_FALL);
|
||||
}
|
||||
else if(m_moveVelocity.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(colHeight)
|
||||
{
|
||||
if(m_currentState!=STATE_FALL&&m_currentState!=STATE_FALLFAR&&
|
||||
m_currentState!=STATE_BUTTFALL&&m_currentState!=STATE_BUTTBOUNCE&&
|
||||
m_currentState!=STATE_JUMP)
|
||||
{
|
||||
// Was floating in the air.. fall!
|
||||
|
||||
// if ( !m_onPlatform )
|
||||
// {
|
||||
setState(STATE_FALL);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
// Below ground
|
||||
// Perhaps we should be falling?
|
||||
if(m_currentState!=STATE_FALL&&m_currentState!=STATE_FALLFAR&&
|
||||
m_currentState!=STATE_BUTTFALL&&m_currentState!=STATE_BUTTBOUNCE&&
|
||||
m_currentState!=STATE_JUMP)
|
||||
{
|
||||
setState(STATE_FALL);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
pos.vy+=m_moveVelocity.vy>>VELOCITY_SHIFT;
|
||||
m_player->setPlayerPos(&pos);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::thinkHorizontalMovement()
|
||||
{
|
||||
if(m_moveVelocity.vx)
|
||||
{
|
||||
CLayerCollision *collision;
|
||||
DVECTOR pos;
|
||||
|
||||
collision=m_player->getLayerCollision();
|
||||
pos=m_player->getPlayerPos();
|
||||
//New collision stuff (pkg)
|
||||
//if(m_layerCollision->getCollisionType(Pos.vx+(m_moveVelocity.vx>>VELOCITY_SHIFT),Pos.vy)&COLLISION_TYPE_MASK)
|
||||
//{
|
||||
// m_moveVelocity.vx=0;
|
||||
// return;
|
||||
//}
|
||||
int colHeight;
|
||||
colHeight=collision->getHeightFromGround(pos.vx,pos.vy,5);
|
||||
if(colHeight==0)
|
||||
{
|
||||
// Ok.. we're on the ground. What happens if we move left/right
|
||||
colHeight=collision->getHeightFromGround(pos.vx+(m_moveVelocity.vx>>VELOCITY_SHIFT),pos.vy);
|
||||
if(colHeight<-8)
|
||||
{
|
||||
// Big step up. Stop at the edge of the obstruction
|
||||
int dir,vx,cx,i;
|
||||
if(m_moveVelocity.vx<0)
|
||||
{
|
||||
dir=-1;
|
||||
vx=-m_moveVelocity.vx>>VELOCITY_SHIFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
dir=+1;
|
||||
vx=m_moveVelocity.vx>>VELOCITY_SHIFT;
|
||||
}
|
||||
cx=pos.vx;
|
||||
for(i=0;i<vx;i++)
|
||||
{
|
||||
if(collision->getHeightFromGround(cx,pos.vy)<-8)
|
||||
{
|
||||
break;
|
||||
}
|
||||
cx+=dir;
|
||||
}
|
||||
pos.vx=cx-dir;
|
||||
|
||||
// If running then go to idle, otherwise leave in same state
|
||||
if(m_currentState==STATE_RUN)
|
||||
{
|
||||
setState(STATE_IDLE);
|
||||
}
|
||||
m_moveVelocity.vx=0;
|
||||
|
||||
// Get the height at this new position and then try the step-up code below.
|
||||
// Without this, there are problems when you run up a slope and hit a wall at the same time
|
||||
colHeight=collision->getHeightFromGround(pos.vx,pos.vy);
|
||||
}
|
||||
if(colHeight&&colHeight>=-8&&colHeight<=8)
|
||||
{
|
||||
// Small step up/down. Follow the contour of the level
|
||||
pos.vy+=colHeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// In the air
|
||||
// if(!(colHeight<0&&m_currentState==STATE_JUMP)) // Lets you jump through platforms from below
|
||||
if(colHeight>=0) // Lets you jump through platforms from below
|
||||
{
|
||||
colHeight=collision->getHeightFromGround(pos.vx+(m_moveVelocity.vx>>VELOCITY_SHIFT),pos.vy,5);
|
||||
if(colHeight<0)
|
||||
{
|
||||
// Stop at the edge of the obstruction
|
||||
int dir,vx,cx,i;
|
||||
if(m_moveVelocity.vx<0)
|
||||
{
|
||||
dir=-1;
|
||||
vx=-m_moveVelocity.vx>>VELOCITY_SHIFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
dir=+1;
|
||||
vx=m_moveVelocity.vx>>VELOCITY_SHIFT;
|
||||
}
|
||||
cx=pos.vx;
|
||||
for(i=0;i<vx;i++)
|
||||
{
|
||||
if(collision->getHeightFromGround(cx,pos.vy)<0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
cx+=dir;
|
||||
}
|
||||
pos.vx=cx-dir;
|
||||
m_moveVelocity.vx=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
pos.vx+=m_moveVelocity.vx>>VELOCITY_SHIFT;
|
||||
m_player->setPlayerPos(&pos);
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
const struct PlayerMetrics *CPlayerModeBasic::getPlayerMetrics()
|
||||
const struct PlayerMetrics *CPlayerModeBalloon::getPlayerMetrics()
|
||||
{
|
||||
return &s_playerMetrics;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayerModeBasic::setState(int _state)
|
||||
{
|
||||
CPlayerState *nextState;
|
||||
int ret=false;
|
||||
|
||||
nextState=s_stateTable[_state];
|
||||
if(nextState)
|
||||
{
|
||||
m_currentStateClass=nextState;
|
||||
m_currentStateClass->enter(this);
|
||||
m_currentState=(PLAYER_STATE)_state;
|
||||
ret=true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayerModeBasic::getFacing() {return m_player->getFacing();}
|
||||
void CPlayerModeBasic::setFacing(int _facing) {m_player->setFacing(_facing);}
|
||||
void CPlayerModeBasic::setAnimNo(int _animNo) {m_player->setAnimNo(_animNo);}
|
||||
void CPlayerModeBasic::setAnimFrame(int _animFrame) {m_player->setAnimFrame(_animFrame);}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayerModeBasic::advanceAnimFrameAndCheckForEndOfAnim()
|
||||
{
|
||||
int animFrame,frameCount;
|
||||
int looped;
|
||||
animFrame=m_player->getAnimFrame()+1;
|
||||
frameCount=m_player->getAnimFrameCount();
|
||||
looped=false;
|
||||
if(animFrame>=frameCount)
|
||||
{
|
||||
looped=true;
|
||||
animFrame=0;
|
||||
}
|
||||
m_player->setAnimFrame(animFrame);
|
||||
return looped;
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
DVECTOR CPlayerModeBasic::getMoveVelocity() {return m_moveVelocity;}
|
||||
void CPlayerModeBasic::zeroMoveVelocity() {m_moveVelocity.vx=m_moveVelocity.vy=0;}
|
||||
void CPlayerModeBasic::setMoveVelocity(DVECTOR *_moveVel) {m_moveVelocity=*_moveVel;}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns: FACING_LEFT if left half of player is hanging, FACING_RIGHT
|
||||
if right half of player is hanging or 0 if no part of the
|
||||
player is hanging
|
||||
---------------------------------------------------------------------- */
|
||||
int csize=5;
|
||||
int cheight=15;
|
||||
int CPlayerModeBasic::isOnEdge()
|
||||
{
|
||||
CLayerCollision *collision;
|
||||
DVECTOR pos;
|
||||
int ret;
|
||||
|
||||
collision=m_player->getLayerCollision();
|
||||
pos=m_player->getPlayerPos();
|
||||
ret=0;
|
||||
if(collision->getHeightFromGround(pos.vx-csize,pos.vy,cheight+1)>cheight)
|
||||
{
|
||||
ret=FACING_LEFT;
|
||||
}
|
||||
else if(collision->getHeightFromGround(pos.vx+csize,pos.vy,cheight+1)>cheight)
|
||||
{
|
||||
ret=FACING_RIGHT;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayerModeBasic::canMoveLeft()
|
||||
{
|
||||
DVECTOR pos;
|
||||
pos=m_player->getPlayerPos();
|
||||
return m_player->getLayerCollision()->getHeightFromGround(pos.vx-1,pos.vy,16)>-8?true:false;
|
||||
}
|
||||
|
||||
int CPlayerModeBasic::canMoveRight()
|
||||
{
|
||||
DVECTOR pos;
|
||||
pos=m_player->getPlayerPos();
|
||||
return m_player->getLayerCollision()->getHeightFromGround(pos.vx+1,pos.vy,16)>-8?true:false;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::moveLeft()
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
metrics=getPlayerMetrics();
|
||||
|
||||
setFacing(FACING_LEFT);
|
||||
if(m_moveVelocity.vx<=0)
|
||||
{
|
||||
m_moveVelocity.vx-=metrics->m_metric[PM__RUN_SPEEDUP];
|
||||
if(m_moveVelocity.vx<-metrics->m_metric[PM__MAX_RUN_VELOCITY]<<VELOCITY_SHIFT)
|
||||
{
|
||||
m_moveVelocity.vx=-metrics->m_metric[PM__MAX_RUN_VELOCITY]<<VELOCITY_SHIFT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_moveVelocity.vx-=metrics->m_metric[PM__RUN_REVERSESLOWDOWN];
|
||||
}
|
||||
|
||||
/*
|
||||
if(m_moveVelocity.vx<-CAMERA_STARTMOVETHRESHOLD||m_cameraScrollPos.vx<-CAMERA_SCROLLTHRESHOLD<<8)
|
||||
{
|
||||
m_cameraScrollDir=+1;
|
||||
}
|
||||
else if(m_moveVelocity.vx>-CAMERA_STOPMOVETHRESHOLD)
|
||||
{
|
||||
m_cameraScrollDir=0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void CPlayerModeBasic::moveRight()
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
metrics=getPlayerMetrics();
|
||||
|
||||
setFacing(FACING_RIGHT);
|
||||
if(m_moveVelocity.vx>=0)
|
||||
{
|
||||
m_moveVelocity.vx+=metrics->m_metric[PM__RUN_SPEEDUP];
|
||||
if(m_moveVelocity.vx>metrics->m_metric[PM__MAX_RUN_VELOCITY]<<VELOCITY_SHIFT)
|
||||
{
|
||||
m_moveVelocity.vx=metrics->m_metric[PM__MAX_RUN_VELOCITY]<<VELOCITY_SHIFT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_moveVelocity.vx+=metrics->m_metric[PM__RUN_REVERSESLOWDOWN];
|
||||
}
|
||||
|
||||
/*
|
||||
if(m_moveVelocity.vx>CAMERA_STARTMOVETHRESHOLD||m_cameraScrollPos.vx>CAMERA_SCROLLTHRESHOLD<<8)
|
||||
{
|
||||
m_cameraScrollDir=-1;
|
||||
}
|
||||
else if(m_moveVelocity.vx<CAMERA_STOPMOVETHRESHOLD)
|
||||
{
|
||||
m_cameraScrollDir=0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
int CPlayerModeBasic::slowdown()
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
int ret=false;
|
||||
metrics=getPlayerMetrics();
|
||||
|
||||
if(m_moveVelocity.vx<0)
|
||||
{
|
||||
m_moveVelocity.vx+=metrics->m_metric[PM__RUN_SLOWDOWN];
|
||||
if(m_moveVelocity.vx>=0)
|
||||
{
|
||||
m_moveVelocity.vx=0;
|
||||
ret=true;
|
||||
}
|
||||
}
|
||||
else if(m_moveVelocity.vx>0)
|
||||
{
|
||||
m_moveVelocity.vx-=metrics->m_metric[PM__RUN_SLOWDOWN];
|
||||
if(m_moveVelocity.vx<=0)
|
||||
{
|
||||
m_moveVelocity.vx=0;
|
||||
ret=true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
void CPlayerModeBasic::jump()
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
metrics=getPlayerMetrics();
|
||||
m_moveVelocity.vy=-metrics->m_metric[PM__JUMP_VELOCITY]<<VELOCITY_SHIFT;
|
||||
}
|
||||
void CPlayerModeBasic::fall()
|
||||
{
|
||||
m_moveVelocity.vy+=PLAYER_GRAVITY;
|
||||
if(m_moveVelocity.vy>=PLAYER_TERMINAL_VELOCITY<<VELOCITY_SHIFT)
|
||||
{
|
||||
m_moveVelocity.vy=PLAYER_TERMINAL_VELOCITY<<VELOCITY_SHIFT;
|
||||
if(!canFallForever()&&m_currentState!=STATE_FALLFAR)
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
metrics=getPlayerMetrics();
|
||||
m_fallFrames++;
|
||||
if(m_fallFrames>metrics->m_metric[PM__MAX_SAFE_FALL_FRAMES])
|
||||
{
|
||||
setState(STATE_FALLFAR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
||||
|
||||
#endif
|
|
@ -34,8 +34,11 @@
|
|||
Structure defintions
|
||||
-------------------- */
|
||||
|
||||
class CPlayerModeBalloon : public CPlayerModeBasic
|
||||
class CPlayerModeBalloon : public CPlayerModeBase
|
||||
{
|
||||
public:
|
||||
virtual int canFallForever() {return true;}
|
||||
virtual const struct PlayerMetrics *getPlayerMetrics();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
Structure defintions
|
||||
-------------------- */
|
||||
|
||||
class CPlayerModeFly : public CPlayerModeBasic
|
||||
class CPlayerModeFly : public CPlayerModeBase
|
||||
{
|
||||
public:
|
||||
virtual void enter();
|
||||
|
|
|
@ -99,7 +99,7 @@ static CPlayerStateButtBounceLand stateButtBounceLand;
|
|||
static CPlayerStateDead stateDead;
|
||||
*/
|
||||
|
||||
CPlayerState *CPlayerModeBasic::s_stateTable[]=
|
||||
CPlayerState *CPlayerModeBase::s_stateTable[]=
|
||||
{
|
||||
&stateUnarmedIdle, // STATE_IDLE
|
||||
&stateTeeterIdle, // STATE_IDLETEETER
|
||||
|
@ -115,7 +115,7 @@ CPlayerState *CPlayerModeBasic::s_stateTable[]=
|
|||
&stateGetUp, // STATE_GETUP
|
||||
};
|
||||
|
||||
PlayerMetrics CPlayerModeBasic::s_playerMetrics=
|
||||
static PlayerMetrics s_playerMetrics=
|
||||
{ {
|
||||
DEFAULT_PLAYER_JUMP_VELOCITY, // PM__JUMP_VELOCITY
|
||||
DEFAULT_PLAYER_MAX_JUMP_FRAMES, // PM__MAX_JUMP_FRAMES
|
||||
|
@ -124,6 +124,8 @@ PlayerMetrics CPlayerModeBasic::s_playerMetrics=
|
|||
DEFAULT_PLAYER_RUN_SPEEDUP, // PM__RUN_SPEEDUP
|
||||
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN
|
||||
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
|
||||
DEFAULT_PLAYER_PLAYER_GRAVITY, // PM__GRAVITY
|
||||
DEFAULT_PLAYER_TERMINAL_VELOCITY, // PM__TERMINAL_VELOCITY
|
||||
} };
|
||||
|
||||
|
||||
|
@ -154,7 +156,7 @@ void CPlayerMode::setPlayerPos(DVECTOR *_pos) {m_player->setPlayerPos(_pos);}
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::enter()
|
||||
void CPlayerModeBase::enter()
|
||||
{
|
||||
m_fallFrames=0;
|
||||
setState(STATE_IDLE);
|
||||
|
@ -167,7 +169,7 @@ void CPlayerModeBasic::enter()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::think()
|
||||
void CPlayerModeBase::think()
|
||||
{
|
||||
s_stateTable[m_currentState]->think(this);
|
||||
thinkVerticalMovement();
|
||||
|
@ -187,7 +189,7 @@ void CPlayerModeBasic::think()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::render()
|
||||
void CPlayerModeBase::render()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -197,7 +199,7 @@ void CPlayerModeBasic::render()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::thinkVerticalMovement()
|
||||
void CPlayerModeBase::thinkVerticalMovement()
|
||||
{
|
||||
CLayerCollision *collision;
|
||||
DVECTOR pos;
|
||||
|
@ -221,7 +223,7 @@ void CPlayerModeBasic::thinkVerticalMovement()
|
|||
if(m_moveVelocity.vy>0)
|
||||
{
|
||||
// Yes.. Check to see if we're about to hit/go through the ground
|
||||
colHeight=collision->getHeightFromGround(pos.vx,pos.vy+(m_moveVelocity.vy>>VELOCITY_SHIFT),PLAYER_TERMINAL_VELOCITY+1);
|
||||
colHeight=collision->getHeightFromGround(pos.vx,pos.vy+(m_moveVelocity.vy>>VELOCITY_SHIFT),getPlayerMetrics()->m_metric[PM__TERMINAL_VELOCITY]+1);
|
||||
|
||||
if(colHeight<=0)
|
||||
{
|
||||
|
@ -295,7 +297,7 @@ void CPlayerModeBasic::thinkVerticalMovement()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::thinkHorizontalMovement()
|
||||
void CPlayerModeBase::thinkHorizontalMovement()
|
||||
{
|
||||
if(m_moveVelocity.vx)
|
||||
{
|
||||
|
@ -404,7 +406,7 @@ void CPlayerModeBasic::thinkHorizontalMovement()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
const struct PlayerMetrics *CPlayerModeBasic::getPlayerMetrics()
|
||||
const struct PlayerMetrics *CPlayerModeBase::getPlayerMetrics()
|
||||
{
|
||||
return &s_playerMetrics;
|
||||
}
|
||||
|
@ -415,7 +417,7 @@ const struct PlayerMetrics *CPlayerModeBasic::getPlayerMetrics()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayerModeBasic::setState(int _state)
|
||||
int CPlayerModeBase::setState(int _state)
|
||||
{
|
||||
CPlayerState *nextState;
|
||||
int ret=false;
|
||||
|
@ -437,10 +439,10 @@ int CPlayerModeBasic::setState(int _state)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayerModeBasic::getFacing() {return m_player->getFacing();}
|
||||
void CPlayerModeBasic::setFacing(int _facing) {m_player->setFacing(_facing);}
|
||||
void CPlayerModeBasic::setAnimNo(int _animNo) {m_player->setAnimNo(_animNo);}
|
||||
void CPlayerModeBasic::setAnimFrame(int _animFrame) {m_player->setAnimFrame(_animFrame);}
|
||||
int CPlayerModeBase::getFacing() {return m_player->getFacing();}
|
||||
void CPlayerModeBase::setFacing(int _facing) {m_player->setFacing(_facing);}
|
||||
void CPlayerModeBase::setAnimNo(int _animNo) {m_player->setAnimNo(_animNo);}
|
||||
void CPlayerModeBase::setAnimFrame(int _animFrame) {m_player->setAnimFrame(_animFrame);}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
|
@ -448,7 +450,7 @@ void CPlayerModeBasic::setAnimFrame(int _animFrame) {m_player->setAnimFrame(_
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayerModeBasic::advanceAnimFrameAndCheckForEndOfAnim()
|
||||
int CPlayerModeBase::advanceAnimFrameAndCheckForEndOfAnim()
|
||||
{
|
||||
int animFrame,frameCount;
|
||||
int looped;
|
||||
|
@ -471,9 +473,9 @@ int CPlayerModeBasic::advanceAnimFrameAndCheckForEndOfAnim()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
DVECTOR CPlayerModeBasic::getMoveVelocity() {return m_moveVelocity;}
|
||||
void CPlayerModeBasic::zeroMoveVelocity() {m_moveVelocity.vx=m_moveVelocity.vy=0;}
|
||||
void CPlayerModeBasic::setMoveVelocity(DVECTOR *_moveVel) {m_moveVelocity=*_moveVel;}
|
||||
DVECTOR CPlayerModeBase::getMoveVelocity() {return m_moveVelocity;}
|
||||
void CPlayerModeBase::zeroMoveVelocity() {m_moveVelocity.vx=m_moveVelocity.vy=0;}
|
||||
void CPlayerModeBase::setMoveVelocity(DVECTOR *_moveVel) {m_moveVelocity=*_moveVel;}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
|
@ -485,7 +487,7 @@ void CPlayerModeBasic::setMoveVelocity(DVECTOR *_moveVel) {m_moveVelocity=*_mo
|
|||
---------------------------------------------------------------------- */
|
||||
int csize=5;
|
||||
int cheight=15;
|
||||
int CPlayerModeBasic::isOnEdge()
|
||||
int CPlayerModeBase::isOnEdge()
|
||||
{
|
||||
CLayerCollision *collision;
|
||||
DVECTOR pos;
|
||||
|
@ -511,14 +513,14 @@ int CPlayerModeBasic::isOnEdge()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayerModeBasic::canMoveLeft()
|
||||
int CPlayerModeBase::canMoveLeft()
|
||||
{
|
||||
DVECTOR pos;
|
||||
pos=m_player->getPlayerPos();
|
||||
return m_player->getLayerCollision()->getHeightFromGround(pos.vx-1,pos.vy,16)>-8?true:false;
|
||||
}
|
||||
|
||||
int CPlayerModeBasic::canMoveRight()
|
||||
int CPlayerModeBase::canMoveRight()
|
||||
{
|
||||
DVECTOR pos;
|
||||
pos=m_player->getPlayerPos();
|
||||
|
@ -531,7 +533,7 @@ int CPlayerModeBasic::canMoveRight()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeBasic::moveLeft()
|
||||
void CPlayerModeBase::moveLeft()
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
metrics=getPlayerMetrics();
|
||||
|
@ -562,7 +564,7 @@ void CPlayerModeBasic::moveLeft()
|
|||
*/
|
||||
}
|
||||
|
||||
void CPlayerModeBasic::moveRight()
|
||||
void CPlayerModeBase::moveRight()
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
metrics=getPlayerMetrics();
|
||||
|
@ -592,7 +594,7 @@ void CPlayerModeBasic::moveRight()
|
|||
}
|
||||
*/
|
||||
}
|
||||
int CPlayerModeBasic::slowdown()
|
||||
int CPlayerModeBase::slowdown()
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
int ret=false;
|
||||
|
@ -618,18 +620,20 @@ int CPlayerModeBasic::slowdown()
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
void CPlayerModeBasic::jump()
|
||||
void CPlayerModeBase::jump()
|
||||
{
|
||||
m_moveVelocity.vy=-getPlayerMetrics()->m_metric[PM__JUMP_VELOCITY]<<VELOCITY_SHIFT;
|
||||
}
|
||||
void CPlayerModeBase::fall()
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
metrics=getPlayerMetrics();
|
||||
m_moveVelocity.vy=-metrics->m_metric[PM__JUMP_VELOCITY]<<VELOCITY_SHIFT;
|
||||
}
|
||||
void CPlayerModeBasic::fall()
|
||||
{
|
||||
m_moveVelocity.vy+=PLAYER_GRAVITY;
|
||||
if(m_moveVelocity.vy>=PLAYER_TERMINAL_VELOCITY<<VELOCITY_SHIFT)
|
||||
|
||||
|
||||
m_moveVelocity.vy+=getPlayerMetrics()->m_metric[PM__GRAVITY];
|
||||
if(m_moveVelocity.vy>=metrics->m_metric[PM__TERMINAL_VELOCITY]<<VELOCITY_SHIFT)
|
||||
{
|
||||
m_moveVelocity.vy=PLAYER_TERMINAL_VELOCITY<<VELOCITY_SHIFT;
|
||||
m_moveVelocity.vy=metrics->m_metric[PM__TERMINAL_VELOCITY]<<VELOCITY_SHIFT;
|
||||
if(!canFallForever()&&m_currentState!=STATE_FALLFAR)
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
|
|
|
@ -47,6 +47,8 @@ typedef enum
|
|||
PM__RUN_SPEEDUP,
|
||||
PM__RUN_REVERSESLOWDOWN,
|
||||
PM__RUN_SLOWDOWN,
|
||||
PM__GRAVITY,
|
||||
PM__TERMINAL_VELOCITY,
|
||||
|
||||
NUM_PLAYER_METRICS
|
||||
}PLAYER_METRIC;
|
||||
|
@ -56,6 +58,18 @@ struct PlayerMetrics
|
|||
s16 m_metric[NUM_PLAYER_METRICS];
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
DEFAULT_PLAYER_JUMP_VELOCITY=4,
|
||||
DEFAULT_PLAYER_MAX_JUMP_FRAMES=12,
|
||||
DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES=30,
|
||||
DEFAULT_PLAYER_MAX_RUN_VELOCITY=6,
|
||||
DEFAULT_PLAYER_RUN_SPEEDUP=2<<2,
|
||||
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN=4<<2,
|
||||
DEFAULT_PLAYER_RUN_SLOWDOWN=3<<2,
|
||||
DEFAULT_PLAYER_PLAYER_GRAVITY=4<<2,
|
||||
DEFAULT_PLAYER_TERMINAL_VELOCITY=8,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -79,7 +93,7 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
class CPlayerModeBasic : public CPlayerMode
|
||||
class CPlayerModeBase : public CPlayerMode
|
||||
{
|
||||
public:
|
||||
enum
|
||||
|
@ -91,15 +105,14 @@ public:
|
|||
virtual void think();
|
||||
virtual void render();
|
||||
|
||||
//protected:
|
||||
int canTeeter() {return m_currentState==STATE_IDLE;}
|
||||
int canFallForever() {return m_currentState==STATE_BUTTFALL;}
|
||||
virtual int canTeeter() {return m_currentState==STATE_IDLE;}
|
||||
virtual int canFallForever() {return m_currentState==STATE_BUTTFALL;}
|
||||
|
||||
void thinkVerticalMovement();
|
||||
void thinkHorizontalMovement();
|
||||
|
||||
|
||||
const struct PlayerMetrics *getPlayerMetrics();
|
||||
virtual const struct PlayerMetrics *getPlayerMetrics();
|
||||
int setState(int _state);
|
||||
// virtual void setMode(class CPlayer *_player,int _mode);
|
||||
int getFacing();
|
||||
|
@ -123,20 +136,6 @@ public:
|
|||
void fall();
|
||||
|
||||
// virtual void respawn(class CPlayer *_player);
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
DEFAULT_PLAYER_JUMP_VELOCITY=4,
|
||||
DEFAULT_PLAYER_MAX_JUMP_FRAMES=12,
|
||||
DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES=30,
|
||||
DEFAULT_PLAYER_MAX_RUN_VELOCITY=6, //8
|
||||
DEFAULT_PLAYER_RUN_SPEEDUP=2<<2, //4
|
||||
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN=4<<2, //3
|
||||
DEFAULT_PLAYER_RUN_SLOWDOWN=3<<2, //2
|
||||
PLAYER_GRAVITY=4<<2,
|
||||
PLAYER_TERMINAL_VELOCITY=8,
|
||||
};
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
@ -146,8 +145,6 @@ private:
|
|||
static class CPlayerState *s_stateTable[];
|
||||
class CPlayerState *m_currentStateClass;
|
||||
PLAYER_STATE m_currentState;
|
||||
|
||||
static PlayerMetrics s_playerMetrics;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateButtBounce::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateButtBounce::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->zeroMoveVelocity();
|
||||
_playerMode->setAnimNo(ANIM_SPONGEBOB_BUTTBOUNCESTART);
|
||||
|
@ -78,7 +78,7 @@ void CPlayerStateButtBounce::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateButtBounce::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateButtBounce::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ void CPlayerStateButtBounce::think(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateButtBounceFall::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateButtBounceFall::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->setAnimNo(ANIM_SPONGEBOB_BUTTBOUNCEEND);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ void CPlayerStateButtBounceFall::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateButtBounceFall::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateButtBounceFall::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->fall();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ void CPlayerStateButtBounceFall::think(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateButtBounceLand::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateButtBounceLand::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
// DVECTOR pos;
|
||||
//
|
||||
|
@ -132,7 +132,7 @@ void CPlayerStateButtBounceLand::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateButtBounceLand::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateButtBounceLand::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
|
||||
{
|
||||
|
|
|
@ -35,24 +35,24 @@
|
|||
class CPlayerStateButtBounce : public CPlayerState
|
||||
{
|
||||
public:
|
||||
virtual void enter(class CPlayerModeBasic *_playerMode);
|
||||
virtual void think(class CPlayerModeBasic *_playerMode);
|
||||
virtual void enter(class CPlayerModeBase *_playerMode);
|
||||
virtual void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
};
|
||||
|
||||
class CPlayerStateButtBounceFall : public CPlayerState
|
||||
{
|
||||
public:
|
||||
virtual void enter(class CPlayerModeBasic *_playerMode);
|
||||
virtual void think(class CPlayerModeBasic *_playerMode);
|
||||
virtual void enter(class CPlayerModeBase *_playerMode);
|
||||
virtual void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
};
|
||||
|
||||
class CPlayerStateButtBounceLand : public CPlayerState
|
||||
{
|
||||
public:
|
||||
virtual void enter(class CPlayerModeBasic *_playerMode);
|
||||
virtual void think(class CPlayerModeBasic *_playerMode);
|
||||
virtual void enter(class CPlayerModeBase *_playerMode);
|
||||
virtual void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateDuck::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateDuck::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->setAnimNo(ANIM_SPONGEBOB_SOAKUP);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ void CPlayerStateDuck::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateDuck::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateDuck::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->slowdown();
|
||||
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
|
||||
|
@ -89,7 +89,7 @@ void CPlayerStateDuck::think(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateSoakUp::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateSoakUp::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->zeroMoveVelocity();
|
||||
_playerMode->setAnimNo(ANIM_SPONGEBOB_GETUP);
|
||||
|
@ -102,7 +102,7 @@ void CPlayerStateSoakUp::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateSoakUp::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateSoakUp::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
int controlHeld;
|
||||
|
||||
|
@ -120,7 +120,7 @@ void CPlayerStateSoakUp::think(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateGetUp::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateGetUp::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->setAnimNo(ANIM_SPONGEBOB_GETUP);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ void CPlayerStateGetUp::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateGetUp::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateGetUp::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
|
||||
{
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
class CPlayerStateDuck : public CPlayerState
|
||||
{
|
||||
public:
|
||||
void enter(class CPlayerModeBasic *_playerMode);
|
||||
void think(class CPlayerModeBasic *_playerMode);
|
||||
void enter(class CPlayerModeBase *_playerMode);
|
||||
void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
};
|
||||
|
||||
|
@ -44,8 +44,8 @@ public:
|
|||
class CPlayerStateSoakUp : public CPlayerState
|
||||
{
|
||||
public:
|
||||
void enter(class CPlayerModeBasic *_playerMode);
|
||||
void think(class CPlayerModeBasic *_playerMode);
|
||||
void enter(class CPlayerModeBase *_playerMode);
|
||||
void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
};
|
||||
|
||||
|
@ -53,8 +53,8 @@ public:
|
|||
class CPlayerStateGetUp : public CPlayerState
|
||||
{
|
||||
public:
|
||||
void enter(class CPlayerModeBasic *_playerMode);
|
||||
void think(class CPlayerModeBasic *_playerMode);
|
||||
void enter(class CPlayerModeBase *_playerMode);
|
||||
void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateFall::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateFall::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->setAnimNo(ANIM_SPONGEBOB_HOVER);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ void CPlayerStateFall::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateFall::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateFall::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
int controlHeld,controlDown;
|
||||
|
@ -109,7 +109,7 @@ void CPlayerStateFall::think(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateFallFar::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateFallFar::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->setAnimNo(ANIM_SPONGEBOB_FALL);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ void CPlayerStateFallFar::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateFallFar::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateFallFar::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
int controlHeld;
|
||||
DVECTOR move;
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
class CPlayerStateFall : public CPlayerState
|
||||
{
|
||||
public:
|
||||
void enter(class CPlayerModeBasic *_playerMode);
|
||||
void think(class CPlayerModeBasic *_playerMode);
|
||||
void enter(class CPlayerModeBase *_playerMode);
|
||||
void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
};
|
||||
|
||||
|
@ -44,8 +44,8 @@ public:
|
|||
class CPlayerStateFallFar : public CPlayerStateFall
|
||||
{
|
||||
private:
|
||||
void enter(class CPlayerModeBasic *_playerMode);
|
||||
void think(class CPlayerModeBasic *_playerMode);
|
||||
void enter(class CPlayerModeBase *_playerMode);
|
||||
void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateBaseIdle::thinkControl(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateBaseIdle::thinkControl(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
int controlDown,controlHeld;
|
||||
controlDown=_playerMode->getPadInputDown();
|
||||
|
@ -98,7 +98,7 @@ void CPlayerStateBaseIdle::thinkControl(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateTeeterIdle::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateTeeterIdle::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
int edgeType,dir;
|
||||
int anim;
|
||||
|
@ -124,7 +124,7 @@ void CPlayerStateTeeterIdle::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateTeeterIdle::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateTeeterIdle::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->advanceAnimFrameAndCheckForEndOfAnim();
|
||||
thinkControl(_playerMode);
|
||||
|
@ -137,7 +137,7 @@ void CPlayerStateTeeterIdle::think(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateIdle::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateIdle::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
m_idleTime=0;
|
||||
m_currentIdleAnim=0;
|
||||
|
@ -153,7 +153,7 @@ void CPlayerStateIdle::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateIdle::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateIdle::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
|
||||
{
|
||||
|
@ -169,7 +169,7 @@ void CPlayerStateIdle::think(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateIdle::setNextIdleAnim(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateIdle::setNextIdleAnim(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
IdleAnims *anims;
|
||||
int finished=false;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
class CPlayerStateBaseIdle : public CPlayerState
|
||||
{
|
||||
public:
|
||||
void thinkControl(class CPlayerModeBasic *CPlayerMode);
|
||||
void thinkControl(class CPlayerModeBase *CPlayerMode);
|
||||
};
|
||||
|
||||
|
||||
|
@ -44,8 +44,8 @@ public:
|
|||
class CPlayerStateTeeterIdle : public CPlayerStateBaseIdle
|
||||
{
|
||||
public:
|
||||
virtual void enter(class CPlayerModeBasic *_playerMode);
|
||||
virtual void think(class CPlayerModeBasic *_playerMode);
|
||||
virtual void enter(class CPlayerModeBase *_playerMode);
|
||||
virtual void think(class CPlayerModeBase *_playerMode);
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,8 +62,8 @@ typedef struct
|
|||
class CPlayerStateIdle : public CPlayerStateBaseIdle
|
||||
{
|
||||
public:
|
||||
virtual void enter(class CPlayerModeBasic *_playerMode);
|
||||
virtual void think(class CPlayerModeBasic *_playerMode);
|
||||
virtual void enter(class CPlayerModeBase *_playerMode);
|
||||
virtual void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
private:
|
||||
typedef enum
|
||||
|
@ -73,7 +73,7 @@ private:
|
|||
ANIMSTATE_END,
|
||||
} ANIMSTATE;
|
||||
|
||||
void setNextIdleAnim(class CPlayerModeBasic *_playerMode);
|
||||
void setNextIdleAnim(class CPlayerModeBase *_playerMode);
|
||||
|
||||
virtual IdleAnims *getIdleAnimsDb(int _animNo)=0;
|
||||
virtual int getNumIdleAnims()=0;
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateJump::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateJump::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
_playerMode->setAnimNo(ANIM_SPONGEBOB_HOVER);
|
||||
m_jumpFrames=0;
|
||||
|
@ -82,7 +82,7 @@ void CPlayerStateJump::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateJump::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateJump::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
const PlayerMetrics *metrics;
|
||||
int controlHeld,controlDown;
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
class CPlayerStateJump : public CPlayerState
|
||||
{
|
||||
public:
|
||||
void enter(class CPlayerModeBasic *_playerMode);
|
||||
void think(class CPlayerModeBasic *_playerMode);
|
||||
void enter(class CPlayerModeBase *_playerMode);
|
||||
void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
private:
|
||||
int m_jumpFrames;
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateRun::enter(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateRun::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
int controlHeld;
|
||||
controlHeld=_playerMode->getPadInputHeld();
|
||||
|
@ -93,7 +93,7 @@ void CPlayerStateRun::enter(CPlayerModeBasic *_playerMode)
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateRun::think(CPlayerModeBasic *_playerMode)
|
||||
void CPlayerStateRun::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
int controlDown,controlHeld;
|
||||
int switchedState=false;
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
class CPlayerStateRun : public CPlayerState
|
||||
{
|
||||
public:
|
||||
void enter(class CPlayerModeBasic *_playerMode);
|
||||
void think(class CPlayerModeBasic *_playerMode);
|
||||
void enter(class CPlayerModeBase *_playerMode);
|
||||
void think(class CPlayerModeBase *_playerMode);
|
||||
|
||||
private:
|
||||
int m_numberOfTimeAnimHasLooped;
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
class CPlayerState
|
||||
{
|
||||
public:
|
||||
virtual void enter(class CPlayerModeBasic *_playerMode) {;}
|
||||
virtual void think(class CPlayerModeBasic *_playerMode) {;}
|
||||
virtual void enter(class CPlayerModeBase *_playerMode) {;}
|
||||
virtual void think(class CPlayerModeBase *_playerMode) {;}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -820,6 +820,14 @@ SOURCE=..\..\..\source\player\pstates.h
|
|||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\player\pmbloon.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\player\pmbloon.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\player\pmfly.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|