This commit is contained in:
Paul 2001-03-25 20:36:28 +00:00
parent 09d09e136d
commit 6c5e152bb8
33 changed files with 171 additions and 731 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 742 B

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 630 B

View File

@ -157,6 +157,7 @@ player_src := demoplay \
panimsfx \ panimsfx \
player \ player \
pmodes \ pmodes \
pmbloon \
pmfly \ pmfly \
psbutt \ psbutt \
psduck \ psduck \

View File

@ -99,26 +99,25 @@ void CPauseMenu::init()
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*5,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,TEXT_SPACING*6,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,TEXT_SPACING*7,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, // (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*7,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,TEXT_SPACING*8,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*8,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__BALLOON_MODE, STR__DEBUG__BALLOON_MODE,
&newmode,PLAYER_MODE_BALLOON); &newmode,PLAYER_MODE_BALLOON);
CGUIFactory::createValueButtonFrame(m_guiFrame, // CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*9,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, // (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*9,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__CORALBLOWER_MODE, // STR__DEBUG__CORALBLOWER_MODE,
&newmode,PLAYER_MODE_CORALBLOWER); // &newmode,PLAYER_MODE_CORALBLOWER);
#endif #endif
*/
m_active=false; m_active=false;
} }

View File

@ -94,7 +94,7 @@ void CBalloonPickup::init()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CBalloonPickup::collect(class CPlayer *_player) void CBalloonPickup::collect(class CPlayer *_player)
{ {
// _player->setMode(PLAYER_MODE_BALLOON); _player->setMode(PLAYER_MODE_BALLOON);
CBaseRespawningPickup::collect(_player); CBaseRespawningPickup::collect(_player);
} }
@ -105,14 +105,18 @@ void CBalloonPickup::collect(class CPlayer *_player)
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int balloon_height=30; int balloon_height=30;
int balloon_r=180; int balloon_r1=251;
int balloon_g=180; int balloon_g1=207;
int balloon_b=180; int balloon_b1=167;
int balloon_r2=147;
int balloon_g2=95;
int balloon_b2=75;
int balloon_speed=25; int balloon_speed=25;
int balloon_scale1=5; int balloon_scale1=5;
int balloon_scale2=2; int balloon_scale2=2;
int balloon_phase=1024; int balloon_phase=1024;
int balloon_vissize=40; int balloon_vissize=40;
int balloon_stringx=-3;
int CBalloonPickup::getVisibilityRadius() int CBalloonPickup::getVisibilityRadius()
{ {
return balloon_vissize; return balloon_vissize;
@ -163,9 +167,11 @@ void CBalloonPickup::renderPickup(DVECTOR *_pos)
sprites->printFT4(fh,x+xo1,y,0,0,PICKUPS_OT_POS); sprites->printFT4(fh,x+xo1,y,0,0,PICKUPS_OT_POS);
setCollisionCentreOffset(xo1,0); setCollisionCentreOffset(xo1,0);
x=_pos->vx; x=_pos->vx+balloon_stringx;
y=_pos->vy+(fh->H/2); 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);
} }
/*=========================================================================== /*===========================================================================

View File

@ -37,6 +37,10 @@
#include "player\pmfly.h" #include "player\pmfly.h"
#endif #endif
#ifndef __PLAYER_PMBLOON_H__
#include "player\pmbloon.h"
#endif
// to be removed // to be removed
#include "gfx\tpage.h" #include "gfx\tpage.h"
@ -127,7 +131,7 @@ static const char *s_modeText[NUM_PLAYERMODES]=
{ {
"BASICUNARMED", "BASICUNARMED",
// "FULLUNARMED", // "FULLUNARMED",
// "BALLOON", "BALLOON",
// "NET", // "NET",
// "CORALBLOWER", // "CORALBLOWER",
"FLY", "FLY",
@ -158,13 +162,15 @@ int CAMERA_SCROLLSPEED=60; // Speed of the scroll ( 60=1 tile scrolled every
CPlayerModeBasic PLAYERMODE; CPlayerModeBase PLAYERMODE;
CPlayerModeBalloon PLAYERMODEBALLOON;
CPlayerModeFly PLAYERMODEFLY; CPlayerModeFly PLAYERMODEFLY;
CPlayerMode *CPlayer::s_playerModes[NUM_PLAYERMODES]= CPlayerMode *CPlayer::s_playerModes[NUM_PLAYERMODES]=
{ {
&PLAYERMODE, // PLAYER_MODE_BASICUNARMED &PLAYERMODE, // PLAYER_MODE_BASICUNARMED
&PLAYERMODEFLY, // PLAYER_MODE_FLY &PLAYERMODEBALLOON, // PLAYER_MODE_BALLOON
&PLAYERMODEFLY, // PLAYER_MODE_FLY
}; };

View File

@ -50,7 +50,7 @@ typedef enum
{ {
PLAYER_MODE_BASICUNARMED, PLAYER_MODE_BASICUNARMED,
// PLAYER_MODE_FULLUNARMED, // PLAYER_MODE_FULLUNARMED,
// PLAYER_MODE_BALLOON, PLAYER_MODE_BALLOON,
//PLAYER_MODE_BUBBLE_MIXTURE, //PLAYER_MODE_BUBBLE_MIXTURE,
//PLAYER_MODE_HELMET, //PLAYER_MODE_HELMET,
// PLAYER_MODE_NET, // PLAYER_MODE_NET,

View File

@ -11,51 +11,11 @@
===========================================================================*/ ===========================================================================*/
void a(){}
#if 0
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Includes Includes
-------- */ -------- */
#include "player\pmodes.h" #include "player\pmbloon.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
/* Std Lib /* Std Lib
@ -64,11 +24,6 @@ void a(){}
/* Data /* Data
---- */ ---- */
#ifndef __ANIM_SPONGEBOB_HEADER__
#include <ACTOR_SPONGEBOB_ANIM.h>
#endif
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Tyepdefs && Defines Tyepdefs && Defines
------------------- */ ------------------- */
@ -85,570 +40,31 @@ void a(){}
Vars Vars
---- */ ---- */
static CPlayerStateUnarmedIdle stateUnarmedIdle; static PlayerMetrics s_playerMetrics=
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=
{ { { {
DEFAULT_PLAYER_JUMP_VELOCITY, // PM__JUMP_VELOCITY DEFAULT_PLAYER_JUMP_VELOCITY, // PM__JUMP_VELOCITY
DEFAULT_PLAYER_MAX_JUMP_FRAMES, // PM__MAX_JUMP_FRAMES DEFAULT_PLAYER_MAX_JUMP_FRAMES, // PM__MAX_JUMP_FRAMES
DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES, // PM__MAX_SAFE_FALL_FRAMES DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES, // PM__MAX_SAFE_FALL_FRAMES
DEFAULT_PLAYER_MAX_RUN_VELOCITY, // PM__MAX_RUN_VELOCITY DEFAULT_PLAYER_MAX_RUN_VELOCITY, // PM__MAX_RUN_VELOCITY
DEFAULT_PLAYER_RUN_SPEEDUP, // PM__RUN_SPEEDUP DEFAULT_PLAYER_RUN_SPEEDUP, // PM__RUN_SPEEDUP
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
DEFAULT_PLAYER_PLAYER_GRAVITY/3, // PM__GRAVITY
DEFAULT_PLAYER_TERMINAL_VELOCITY/3, // PM__TERMINAL_VELOCITY
} }; } };
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int CPlayerMode::getPadInputHeld() {return m_player->getPadInputHeld();} const struct PlayerMetrics *CPlayerModeBalloon::getPlayerMetrics()
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()
{ {
return &s_playerMetrics; 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 */ end */
#endif

View File

@ -34,8 +34,11 @@
Structure defintions Structure defintions
-------------------- */ -------------------- */
class CPlayerModeBalloon : public CPlayerModeBasic class CPlayerModeBalloon : public CPlayerModeBase
{ {
public:
virtual int canFallForever() {return true;}
virtual const struct PlayerMetrics *getPlayerMetrics();
}; };

View File

@ -34,7 +34,7 @@
Structure defintions Structure defintions
-------------------- */ -------------------- */
class CPlayerModeFly : public CPlayerModeBasic class CPlayerModeFly : public CPlayerModeBase
{ {
public: public:
virtual void enter(); virtual void enter();

View File

@ -99,7 +99,7 @@ static CPlayerStateButtBounceLand stateButtBounceLand;
static CPlayerStateDead stateDead; static CPlayerStateDead stateDead;
*/ */
CPlayerState *CPlayerModeBasic::s_stateTable[]= CPlayerState *CPlayerModeBase::s_stateTable[]=
{ {
&stateUnarmedIdle, // STATE_IDLE &stateUnarmedIdle, // STATE_IDLE
&stateTeeterIdle, // STATE_IDLETEETER &stateTeeterIdle, // STATE_IDLETEETER
@ -115,15 +115,17 @@ CPlayerState *CPlayerModeBasic::s_stateTable[]=
&stateGetUp, // STATE_GETUP &stateGetUp, // STATE_GETUP
}; };
PlayerMetrics CPlayerModeBasic::s_playerMetrics= static PlayerMetrics s_playerMetrics=
{ { { {
DEFAULT_PLAYER_JUMP_VELOCITY, // PM__JUMP_VELOCITY DEFAULT_PLAYER_JUMP_VELOCITY, // PM__JUMP_VELOCITY
DEFAULT_PLAYER_MAX_JUMP_FRAMES, // PM__MAX_JUMP_FRAMES DEFAULT_PLAYER_MAX_JUMP_FRAMES, // PM__MAX_JUMP_FRAMES
DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES, // PM__MAX_SAFE_FALL_FRAMES DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES, // PM__MAX_SAFE_FALL_FRAMES
DEFAULT_PLAYER_MAX_RUN_VELOCITY, // PM__MAX_RUN_VELOCITY DEFAULT_PLAYER_MAX_RUN_VELOCITY, // PM__MAX_RUN_VELOCITY
DEFAULT_PLAYER_RUN_SPEEDUP, // PM__RUN_SPEEDUP DEFAULT_PLAYER_RUN_SPEEDUP, // PM__RUN_SPEEDUP
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
DEFAULT_PLAYER_PLAYER_GRAVITY, // PM__GRAVITY
DEFAULT_PLAYER_TERMINAL_VELOCITY, // PM__TERMINAL_VELOCITY
} }; } };
@ -145,8 +147,8 @@ PlayerMetrics CPlayerModeBasic::s_playerMetrics=
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int CPlayerMode::getPadInputHeld() {return m_player->getPadInputHeld();} int CPlayerMode::getPadInputHeld() {return m_player->getPadInputHeld();}
int CPlayerMode::getPadInputDown() {return m_player->getPadInputDown();} int CPlayerMode::getPadInputDown() {return m_player->getPadInputDown();}
DVECTOR CPlayerMode::getPlayerPos() {return m_player->getPlayerPos();} DVECTOR CPlayerMode::getPlayerPos() {return m_player->getPlayerPos();}
void CPlayerMode::setPlayerPos(DVECTOR *_pos) {m_player->setPlayerPos(_pos);} void CPlayerMode::setPlayerPos(DVECTOR *_pos) {m_player->setPlayerPos(_pos);}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
@ -154,7 +156,7 @@ void CPlayerMode::setPlayerPos(DVECTOR *_pos) {m_player->setPlayerPos(_pos);}
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerModeBasic::enter() void CPlayerModeBase::enter()
{ {
m_fallFrames=0; m_fallFrames=0;
setState(STATE_IDLE); setState(STATE_IDLE);
@ -167,7 +169,7 @@ void CPlayerModeBasic::enter()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerModeBasic::think() void CPlayerModeBase::think()
{ {
s_stateTable[m_currentState]->think(this); s_stateTable[m_currentState]->think(this);
thinkVerticalMovement(); thinkVerticalMovement();
@ -187,7 +189,7 @@ void CPlayerModeBasic::think()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerModeBasic::render() void CPlayerModeBase::render()
{ {
} }
@ -197,7 +199,7 @@ void CPlayerModeBasic::render()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerModeBasic::thinkVerticalMovement() void CPlayerModeBase::thinkVerticalMovement()
{ {
CLayerCollision *collision; CLayerCollision *collision;
DVECTOR pos; DVECTOR pos;
@ -221,7 +223,7 @@ void CPlayerModeBasic::thinkVerticalMovement()
if(m_moveVelocity.vy>0) if(m_moveVelocity.vy>0)
{ {
// Yes.. Check to see if we're about to hit/go through the ground // 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) if(colHeight<=0)
{ {
@ -295,7 +297,7 @@ void CPlayerModeBasic::thinkVerticalMovement()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerModeBasic::thinkHorizontalMovement() void CPlayerModeBase::thinkHorizontalMovement()
{ {
if(m_moveVelocity.vx) if(m_moveVelocity.vx)
{ {
@ -404,7 +406,7 @@ void CPlayerModeBasic::thinkHorizontalMovement()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
const struct PlayerMetrics *CPlayerModeBasic::getPlayerMetrics() const struct PlayerMetrics *CPlayerModeBase::getPlayerMetrics()
{ {
return &s_playerMetrics; return &s_playerMetrics;
} }
@ -415,7 +417,7 @@ const struct PlayerMetrics *CPlayerModeBasic::getPlayerMetrics()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int CPlayerModeBasic::setState(int _state) int CPlayerModeBase::setState(int _state)
{ {
CPlayerState *nextState; CPlayerState *nextState;
int ret=false; int ret=false;
@ -437,10 +439,10 @@ int CPlayerModeBasic::setState(int _state)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int CPlayerModeBasic::getFacing() {return m_player->getFacing();} int CPlayerModeBase::getFacing() {return m_player->getFacing();}
void CPlayerModeBasic::setFacing(int _facing) {m_player->setFacing(_facing);} void CPlayerModeBase::setFacing(int _facing) {m_player->setFacing(_facing);}
void CPlayerModeBasic::setAnimNo(int _animNo) {m_player->setAnimNo(_animNo);} void CPlayerModeBase::setAnimNo(int _animNo) {m_player->setAnimNo(_animNo);}
void CPlayerModeBasic::setAnimFrame(int _animFrame) {m_player->setAnimFrame(_animFrame);} void CPlayerModeBase::setAnimFrame(int _animFrame) {m_player->setAnimFrame(_animFrame);}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
@ -448,7 +450,7 @@ void CPlayerModeBasic::setAnimFrame(int _animFrame) {m_player->setAnimFrame(_
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int CPlayerModeBasic::advanceAnimFrameAndCheckForEndOfAnim() int CPlayerModeBase::advanceAnimFrameAndCheckForEndOfAnim()
{ {
int animFrame,frameCount; int animFrame,frameCount;
int looped; int looped;
@ -471,9 +473,9 @@ int CPlayerModeBasic::advanceAnimFrameAndCheckForEndOfAnim()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
DVECTOR CPlayerModeBasic::getMoveVelocity() {return m_moveVelocity;} DVECTOR CPlayerModeBase::getMoveVelocity() {return m_moveVelocity;}
void CPlayerModeBasic::zeroMoveVelocity() {m_moveVelocity.vx=m_moveVelocity.vy=0;} void CPlayerModeBase::zeroMoveVelocity() {m_moveVelocity.vx=m_moveVelocity.vy=0;}
void CPlayerModeBasic::setMoveVelocity(DVECTOR *_moveVel) {m_moveVelocity=*_moveVel;} void CPlayerModeBase::setMoveVelocity(DVECTOR *_moveVel) {m_moveVelocity=*_moveVel;}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
@ -485,7 +487,7 @@ void CPlayerModeBasic::setMoveVelocity(DVECTOR *_moveVel) {m_moveVelocity=*_mo
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int csize=5; int csize=5;
int cheight=15; int cheight=15;
int CPlayerModeBasic::isOnEdge() int CPlayerModeBase::isOnEdge()
{ {
CLayerCollision *collision; CLayerCollision *collision;
DVECTOR pos; DVECTOR pos;
@ -511,14 +513,14 @@ int CPlayerModeBasic::isOnEdge()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int CPlayerModeBasic::canMoveLeft() int CPlayerModeBase::canMoveLeft()
{ {
DVECTOR pos; DVECTOR pos;
pos=m_player->getPlayerPos(); pos=m_player->getPlayerPos();
return m_player->getLayerCollision()->getHeightFromGround(pos.vx-1,pos.vy,16)>-8?true:false; return m_player->getLayerCollision()->getHeightFromGround(pos.vx-1,pos.vy,16)>-8?true:false;
} }
int CPlayerModeBasic::canMoveRight() int CPlayerModeBase::canMoveRight()
{ {
DVECTOR pos; DVECTOR pos;
pos=m_player->getPlayerPos(); pos=m_player->getPlayerPos();
@ -531,7 +533,7 @@ int CPlayerModeBasic::canMoveRight()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerModeBasic::moveLeft() void CPlayerModeBase::moveLeft()
{ {
const PlayerMetrics *metrics; const PlayerMetrics *metrics;
metrics=getPlayerMetrics(); metrics=getPlayerMetrics();
@ -562,7 +564,7 @@ void CPlayerModeBasic::moveLeft()
*/ */
} }
void CPlayerModeBasic::moveRight() void CPlayerModeBase::moveRight()
{ {
const PlayerMetrics *metrics; const PlayerMetrics *metrics;
metrics=getPlayerMetrics(); metrics=getPlayerMetrics();
@ -592,7 +594,7 @@ void CPlayerModeBasic::moveRight()
} }
*/ */
} }
int CPlayerModeBasic::slowdown() int CPlayerModeBase::slowdown()
{ {
const PlayerMetrics *metrics; const PlayerMetrics *metrics;
int ret=false; int ret=false;
@ -618,18 +620,20 @@ int CPlayerModeBasic::slowdown()
} }
return ret; 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; const PlayerMetrics *metrics;
metrics=getPlayerMetrics(); metrics=getPlayerMetrics();
m_moveVelocity.vy=-metrics->m_metric[PM__JUMP_VELOCITY]<<VELOCITY_SHIFT;
}
void CPlayerModeBasic::fall() m_moveVelocity.vy+=getPlayerMetrics()->m_metric[PM__GRAVITY];
{ if(m_moveVelocity.vy>=metrics->m_metric[PM__TERMINAL_VELOCITY]<<VELOCITY_SHIFT)
m_moveVelocity.vy+=PLAYER_GRAVITY;
if(m_moveVelocity.vy>=PLAYER_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) if(!canFallForever()&&m_currentState!=STATE_FALLFAR)
{ {
const PlayerMetrics *metrics; const PlayerMetrics *metrics;

View File

@ -47,6 +47,8 @@ typedef enum
PM__RUN_SPEEDUP, PM__RUN_SPEEDUP,
PM__RUN_REVERSESLOWDOWN, PM__RUN_REVERSESLOWDOWN,
PM__RUN_SLOWDOWN, PM__RUN_SLOWDOWN,
PM__GRAVITY,
PM__TERMINAL_VELOCITY,
NUM_PLAYER_METRICS NUM_PLAYER_METRICS
}PLAYER_METRIC; }PLAYER_METRIC;
@ -56,6 +58,18 @@ struct PlayerMetrics
s16 m_metric[NUM_PLAYER_METRICS]; 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: public:
enum enum
@ -91,15 +105,14 @@ public:
virtual void think(); virtual void think();
virtual void render(); virtual void render();
//protected: virtual int canTeeter() {return m_currentState==STATE_IDLE;}
int canTeeter() {return m_currentState==STATE_IDLE;} virtual int canFallForever() {return m_currentState==STATE_BUTTFALL;}
int canFallForever() {return m_currentState==STATE_BUTTFALL;}
void thinkVerticalMovement(); void thinkVerticalMovement();
void thinkHorizontalMovement(); void thinkHorizontalMovement();
const struct PlayerMetrics *getPlayerMetrics(); virtual const struct PlayerMetrics *getPlayerMetrics();
int setState(int _state); int setState(int _state);
// virtual void setMode(class CPlayer *_player,int _mode); // virtual void setMode(class CPlayer *_player,int _mode);
int getFacing(); int getFacing();
@ -123,20 +136,6 @@ public:
void fall(); void fall();
// virtual void respawn(class CPlayer *_player); // 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: private:
@ -146,8 +145,6 @@ private:
static class CPlayerState *s_stateTable[]; static class CPlayerState *s_stateTable[];
class CPlayerState *m_currentStateClass; class CPlayerState *m_currentStateClass;
PLAYER_STATE m_currentState; PLAYER_STATE m_currentState;
static PlayerMetrics s_playerMetrics;
}; };

View File

@ -65,7 +65,7 @@
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateButtBounce::enter(CPlayerModeBasic *_playerMode) void CPlayerStateButtBounce::enter(CPlayerModeBase *_playerMode)
{ {
_playerMode->zeroMoveVelocity(); _playerMode->zeroMoveVelocity();
_playerMode->setAnimNo(ANIM_SPONGEBOB_BUTTBOUNCESTART); _playerMode->setAnimNo(ANIM_SPONGEBOB_BUTTBOUNCESTART);
@ -78,7 +78,7 @@ void CPlayerStateButtBounce::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateButtBounce::think(CPlayerModeBasic *_playerMode) void CPlayerStateButtBounce::think(CPlayerModeBase *_playerMode)
{ {
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim()) if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
{ {
@ -93,7 +93,7 @@ void CPlayerStateButtBounce::think(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateButtBounceFall::enter(CPlayerModeBasic *_playerMode) void CPlayerStateButtBounceFall::enter(CPlayerModeBase *_playerMode)
{ {
_playerMode->setAnimNo(ANIM_SPONGEBOB_BUTTBOUNCEEND); _playerMode->setAnimNo(ANIM_SPONGEBOB_BUTTBOUNCEEND);
} }
@ -105,7 +105,7 @@ void CPlayerStateButtBounceFall::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateButtBounceFall::think(CPlayerModeBasic *_playerMode) void CPlayerStateButtBounceFall::think(CPlayerModeBase *_playerMode)
{ {
_playerMode->fall(); _playerMode->fall();
} }
@ -117,7 +117,7 @@ void CPlayerStateButtBounceFall::think(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateButtBounceLand::enter(CPlayerModeBasic *_playerMode) void CPlayerStateButtBounceLand::enter(CPlayerModeBase *_playerMode)
{ {
// DVECTOR pos; // DVECTOR pos;
// //
@ -132,7 +132,7 @@ void CPlayerStateButtBounceLand::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateButtBounceLand::think(CPlayerModeBasic *_playerMode) void CPlayerStateButtBounceLand::think(CPlayerModeBase *_playerMode)
{ {
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim()) if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
{ {

View File

@ -35,24 +35,24 @@
class CPlayerStateButtBounce : public CPlayerState class CPlayerStateButtBounce : public CPlayerState
{ {
public: public:
virtual void enter(class CPlayerModeBasic *_playerMode); virtual void enter(class CPlayerModeBase *_playerMode);
virtual void think(class CPlayerModeBasic *_playerMode); virtual void think(class CPlayerModeBase *_playerMode);
}; };
class CPlayerStateButtBounceFall : public CPlayerState class CPlayerStateButtBounceFall : public CPlayerState
{ {
public: public:
virtual void enter(class CPlayerModeBasic *_playerMode); virtual void enter(class CPlayerModeBase *_playerMode);
virtual void think(class CPlayerModeBasic *_playerMode); virtual void think(class CPlayerModeBase *_playerMode);
}; };
class CPlayerStateButtBounceLand : public CPlayerState class CPlayerStateButtBounceLand : public CPlayerState
{ {
public: public:
virtual void enter(class CPlayerModeBasic *_playerMode); virtual void enter(class CPlayerModeBase *_playerMode);
virtual void think(class CPlayerModeBasic *_playerMode); virtual void think(class CPlayerModeBase *_playerMode);
private: private:

View File

@ -61,7 +61,7 @@
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateDuck::enter(CPlayerModeBasic *_playerMode) void CPlayerStateDuck::enter(CPlayerModeBase *_playerMode)
{ {
_playerMode->setAnimNo(ANIM_SPONGEBOB_SOAKUP); _playerMode->setAnimNo(ANIM_SPONGEBOB_SOAKUP);
} }
@ -73,7 +73,7 @@ void CPlayerStateDuck::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateDuck::think(CPlayerModeBasic *_playerMode) void CPlayerStateDuck::think(CPlayerModeBase *_playerMode)
{ {
_playerMode->slowdown(); _playerMode->slowdown();
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim()) if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
@ -89,7 +89,7 @@ void CPlayerStateDuck::think(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateSoakUp::enter(CPlayerModeBasic *_playerMode) void CPlayerStateSoakUp::enter(CPlayerModeBase *_playerMode)
{ {
_playerMode->zeroMoveVelocity(); _playerMode->zeroMoveVelocity();
_playerMode->setAnimNo(ANIM_SPONGEBOB_GETUP); _playerMode->setAnimNo(ANIM_SPONGEBOB_GETUP);
@ -102,7 +102,7 @@ void CPlayerStateSoakUp::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateSoakUp::think(CPlayerModeBasic *_playerMode) void CPlayerStateSoakUp::think(CPlayerModeBase *_playerMode)
{ {
int controlHeld; int controlHeld;
@ -120,7 +120,7 @@ void CPlayerStateSoakUp::think(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateGetUp::enter(CPlayerModeBasic *_playerMode) void CPlayerStateGetUp::enter(CPlayerModeBase *_playerMode)
{ {
_playerMode->setAnimNo(ANIM_SPONGEBOB_GETUP); _playerMode->setAnimNo(ANIM_SPONGEBOB_GETUP);
} }
@ -132,7 +132,7 @@ void CPlayerStateGetUp::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateGetUp::think(CPlayerModeBasic *_playerMode) void CPlayerStateGetUp::think(CPlayerModeBase *_playerMode)
{ {
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim()) if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
{ {

View File

@ -35,8 +35,8 @@
class CPlayerStateDuck : public CPlayerState class CPlayerStateDuck : public CPlayerState
{ {
public: public:
void enter(class CPlayerModeBasic *_playerMode); void enter(class CPlayerModeBase *_playerMode);
void think(class CPlayerModeBasic *_playerMode); void think(class CPlayerModeBase *_playerMode);
}; };
@ -44,8 +44,8 @@ public:
class CPlayerStateSoakUp : public CPlayerState class CPlayerStateSoakUp : public CPlayerState
{ {
public: public:
void enter(class CPlayerModeBasic *_playerMode); void enter(class CPlayerModeBase *_playerMode);
void think(class CPlayerModeBasic *_playerMode); void think(class CPlayerModeBase *_playerMode);
}; };
@ -53,8 +53,8 @@ public:
class CPlayerStateGetUp : public CPlayerState class CPlayerStateGetUp : public CPlayerState
{ {
public: public:
void enter(class CPlayerModeBasic *_playerMode); void enter(class CPlayerModeBase *_playerMode);
void think(class CPlayerModeBasic *_playerMode); void think(class CPlayerModeBase *_playerMode);
}; };

View File

@ -60,7 +60,7 @@
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateFall::enter(CPlayerModeBasic *_playerMode) void CPlayerStateFall::enter(CPlayerModeBase *_playerMode)
{ {
_playerMode->setAnimNo(ANIM_SPONGEBOB_HOVER); _playerMode->setAnimNo(ANIM_SPONGEBOB_HOVER);
} }
@ -72,7 +72,7 @@ void CPlayerStateFall::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateFall::think(CPlayerModeBasic *_playerMode) void CPlayerStateFall::think(CPlayerModeBase *_playerMode)
{ {
const PlayerMetrics *metrics; const PlayerMetrics *metrics;
int controlHeld,controlDown; int controlHeld,controlDown;
@ -109,7 +109,7 @@ void CPlayerStateFall::think(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateFallFar::enter(CPlayerModeBasic *_playerMode) void CPlayerStateFallFar::enter(CPlayerModeBase *_playerMode)
{ {
_playerMode->setAnimNo(ANIM_SPONGEBOB_FALL); _playerMode->setAnimNo(ANIM_SPONGEBOB_FALL);
} }
@ -121,7 +121,7 @@ void CPlayerStateFallFar::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateFallFar::think(CPlayerModeBasic *_playerMode) void CPlayerStateFallFar::think(CPlayerModeBase *_playerMode)
{ {
int controlHeld; int controlHeld;
DVECTOR move; DVECTOR move;

View File

@ -35,8 +35,8 @@
class CPlayerStateFall : public CPlayerState class CPlayerStateFall : public CPlayerState
{ {
public: public:
void enter(class CPlayerModeBasic *_playerMode); void enter(class CPlayerModeBase *_playerMode);
void think(class CPlayerModeBasic *_playerMode); void think(class CPlayerModeBase *_playerMode);
}; };
@ -44,8 +44,8 @@ public:
class CPlayerStateFallFar : public CPlayerStateFall class CPlayerStateFallFar : public CPlayerStateFall
{ {
private: private:
void enter(class CPlayerModeBasic *_playerMode); void enter(class CPlayerModeBase *_playerMode);
void think(class CPlayerModeBasic *_playerMode); void think(class CPlayerModeBase *_playerMode);
}; };

View File

@ -61,7 +61,7 @@
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateBaseIdle::thinkControl(CPlayerModeBasic *_playerMode) void CPlayerStateBaseIdle::thinkControl(CPlayerModeBase *_playerMode)
{ {
int controlDown,controlHeld; int controlDown,controlHeld;
controlDown=_playerMode->getPadInputDown(); controlDown=_playerMode->getPadInputDown();
@ -98,7 +98,7 @@ void CPlayerStateBaseIdle::thinkControl(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateTeeterIdle::enter(CPlayerModeBasic *_playerMode) void CPlayerStateTeeterIdle::enter(CPlayerModeBase *_playerMode)
{ {
int edgeType,dir; int edgeType,dir;
int anim; int anim;
@ -124,7 +124,7 @@ void CPlayerStateTeeterIdle::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateTeeterIdle::think(CPlayerModeBasic *_playerMode) void CPlayerStateTeeterIdle::think(CPlayerModeBase *_playerMode)
{ {
_playerMode->advanceAnimFrameAndCheckForEndOfAnim(); _playerMode->advanceAnimFrameAndCheckForEndOfAnim();
thinkControl(_playerMode); thinkControl(_playerMode);
@ -137,7 +137,7 @@ void CPlayerStateTeeterIdle::think(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateIdle::enter(CPlayerModeBasic *_playerMode) void CPlayerStateIdle::enter(CPlayerModeBase *_playerMode)
{ {
m_idleTime=0; m_idleTime=0;
m_currentIdleAnim=0; m_currentIdleAnim=0;
@ -153,7 +153,7 @@ void CPlayerStateIdle::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateIdle::think(CPlayerModeBasic *_playerMode) void CPlayerStateIdle::think(CPlayerModeBase *_playerMode)
{ {
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim()) if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
{ {
@ -169,7 +169,7 @@ void CPlayerStateIdle::think(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateIdle::setNextIdleAnim(CPlayerModeBasic *_playerMode) void CPlayerStateIdle::setNextIdleAnim(CPlayerModeBase *_playerMode)
{ {
IdleAnims *anims; IdleAnims *anims;
int finished=false; int finished=false;

View File

@ -36,7 +36,7 @@
class CPlayerStateBaseIdle : public CPlayerState class CPlayerStateBaseIdle : public CPlayerState
{ {
public: public:
void thinkControl(class CPlayerModeBasic *CPlayerMode); void thinkControl(class CPlayerModeBase *CPlayerMode);
}; };
@ -44,8 +44,8 @@ public:
class CPlayerStateTeeterIdle : public CPlayerStateBaseIdle class CPlayerStateTeeterIdle : public CPlayerStateBaseIdle
{ {
public: public:
virtual void enter(class CPlayerModeBasic *_playerMode); virtual void enter(class CPlayerModeBase *_playerMode);
virtual void think(class CPlayerModeBasic *_playerMode); virtual void think(class CPlayerModeBase *_playerMode);
}; };
@ -62,8 +62,8 @@ typedef struct
class CPlayerStateIdle : public CPlayerStateBaseIdle class CPlayerStateIdle : public CPlayerStateBaseIdle
{ {
public: public:
virtual void enter(class CPlayerModeBasic *_playerMode); virtual void enter(class CPlayerModeBase *_playerMode);
virtual void think(class CPlayerModeBasic *_playerMode); virtual void think(class CPlayerModeBase *_playerMode);
private: private:
typedef enum typedef enum
@ -73,7 +73,7 @@ private:
ANIMSTATE_END, ANIMSTATE_END,
} ANIMSTATE; } ANIMSTATE;
void setNextIdleAnim(class CPlayerModeBasic *_playerMode); void setNextIdleAnim(class CPlayerModeBase *_playerMode);
virtual IdleAnims *getIdleAnimsDb(int _animNo)=0; virtual IdleAnims *getIdleAnimsDb(int _animNo)=0;
virtual int getNumIdleAnims()=0; virtual int getNumIdleAnims()=0;

View File

@ -65,7 +65,7 @@
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateJump::enter(CPlayerModeBasic *_playerMode) void CPlayerStateJump::enter(CPlayerModeBase *_playerMode)
{ {
_playerMode->setAnimNo(ANIM_SPONGEBOB_HOVER); _playerMode->setAnimNo(ANIM_SPONGEBOB_HOVER);
m_jumpFrames=0; m_jumpFrames=0;
@ -82,7 +82,7 @@ void CPlayerStateJump::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateJump::think(CPlayerModeBasic *_playerMode) void CPlayerStateJump::think(CPlayerModeBase *_playerMode)
{ {
const PlayerMetrics *metrics; const PlayerMetrics *metrics;
int controlHeld,controlDown; int controlHeld,controlDown;

View File

@ -35,8 +35,8 @@
class CPlayerStateJump : public CPlayerState class CPlayerStateJump : public CPlayerState
{ {
public: public:
void enter(class CPlayerModeBasic *_playerMode); void enter(class CPlayerModeBase *_playerMode);
void think(class CPlayerModeBasic *_playerMode); void think(class CPlayerModeBase *_playerMode);
private: private:
int m_jumpFrames; int m_jumpFrames;

View File

@ -60,7 +60,7 @@
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateRun::enter(CPlayerModeBasic *_playerMode) void CPlayerStateRun::enter(CPlayerModeBase *_playerMode)
{ {
int controlHeld; int controlHeld;
controlHeld=_playerMode->getPadInputHeld(); controlHeld=_playerMode->getPadInputHeld();
@ -93,7 +93,7 @@ void CPlayerStateRun::enter(CPlayerModeBasic *_playerMode)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerStateRun::think(CPlayerModeBasic *_playerMode) void CPlayerStateRun::think(CPlayerModeBase *_playerMode)
{ {
int controlDown,controlHeld; int controlDown,controlHeld;
int switchedState=false; int switchedState=false;

View File

@ -35,8 +35,8 @@
class CPlayerStateRun : public CPlayerState class CPlayerStateRun : public CPlayerState
{ {
public: public:
void enter(class CPlayerModeBasic *_playerMode); void enter(class CPlayerModeBase *_playerMode);
void think(class CPlayerModeBasic *_playerMode); void think(class CPlayerModeBase *_playerMode);
private: private:
int m_numberOfTimeAnimHasLooped; int m_numberOfTimeAnimHasLooped;

View File

@ -32,8 +32,8 @@
class CPlayerState class CPlayerState
{ {
public: public:
virtual void enter(class CPlayerModeBasic *_playerMode) {;} virtual void enter(class CPlayerModeBase *_playerMode) {;}
virtual void think(class CPlayerModeBasic *_playerMode) {;} virtual void think(class CPlayerModeBase *_playerMode) {;}
}; };

View File

@ -820,6 +820,14 @@ SOURCE=..\..\..\source\player\pstates.h
# End Group # End Group
# Begin Source File # 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 SOURCE=..\..\..\source\player\pmfly.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File