SBSPSS/source/player/pmodes.h

182 lines
3.9 KiB
C
Raw Normal View History

2001-02-27 23:05:16 +01:00
/*=========================================================================
pmodes.h
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __PLAYER_PMODES_H__
#define __PLAYER_PMODES_H__
/*----------------------------------------------------------------------
Includes
-------- */
2001-03-23 21:09:14 +01:00
#ifndef _GLOBAL_HEADER_
#include "system\global.h"
#endif
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
2001-02-27 23:05:16 +01:00
/* Std Lib
------- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
2001-03-23 21:09:14 +01:00
typedef enum
{
PM__JUMP_VELOCITY,
PM__MAX_JUMP_FRAMES,
PM__MAX_SAFE_FALL_FRAMES,
PM__MAX_RUN_VELOCITY,
PM__RUN_SPEEDUP,
PM__RUN_REVERSESLOWDOWN,
PM__RUN_SLOWDOWN,
2001-03-25 22:36:28 +02:00
PM__GRAVITY,
PM__TERMINAL_VELOCITY,
2001-03-23 21:09:14 +01:00
NUM_PLAYER_METRICS
}PLAYER_METRIC;
struct PlayerMetrics
{
s16 m_metric[NUM_PLAYER_METRICS];
};
2001-03-25 22:36:28 +02:00
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,
};
2001-03-23 21:09:14 +01:00
2001-02-27 23:05:16 +01:00
class CPlayerMode
{
public:
2001-03-23 21:09:14 +01:00
virtual void initialise(class CPlayer *_player) {m_player=_player;}
2001-03-27 22:29:02 +02:00
virtual void shutdown() {;}
2001-03-23 21:09:14 +01:00
virtual void enter() {;}
virtual void think() {;}
virtual void render() {;}
2001-03-31 20:22:38 +02:00
virtual void renderModeUi() {;} // Ui specific to this mode (eg: ammo)
2001-03-23 21:09:14 +01:00
int getPadInputHeld();
int getPadInputDown();
2001-03-27 22:29:02 +02:00
virtual int isInAttackState() {return false;}
2001-03-23 21:09:14 +01:00
protected:
DVECTOR getPlayerPos();
void setPlayerPos(DVECTOR *_pos);
2001-02-27 23:05:16 +01:00
2001-03-25 23:33:20 +02:00
void respawn();
2001-03-23 21:09:14 +01:00
class CPlayer *m_player;
};
2001-03-25 22:36:28 +02:00
class CPlayerModeBase : public CPlayerMode
2001-03-23 21:09:14 +01:00
{
public:
enum
{
VELOCITY_SHIFT=4,
};
virtual void enter();
virtual void think();
virtual void render();
2001-03-27 22:29:02 +02:00
virtual int isInAttackState();
2001-03-25 22:36:28 +02:00
virtual int canTeeter() {return m_currentState==STATE_IDLE;}
virtual int canFallForever() {return m_currentState==STATE_BUTTFALL;}
2001-03-23 21:09:14 +01:00
void thinkVerticalMovement();
void thinkHorizontalMovement();
2001-04-03 22:26:21 +02:00
void playerHasHitGround();
2001-03-23 21:09:14 +01:00
2001-03-25 22:36:28 +02:00
virtual const struct PlayerMetrics *getPlayerMetrics();
2001-03-23 21:09:14 +01:00
int setState(int _state);
2001-03-27 22:29:02 +02:00
int getState() {return m_currentState;}
2001-03-23 21:09:14 +01:00
// virtual void setMode(class CPlayer *_player,int _mode);
int getFacing();
void setFacing(int _facing);
2001-03-27 22:29:02 +02:00
virtual int getAnimNo();
virtual void setAnimNo(int _animNo);
virtual void setAnimFrame(int _animFrame);
virtual int getAnimFrame();
virtual int getAnimFrameCount();
2001-03-23 21:09:14 +01:00
int advanceAnimFrameAndCheckForEndOfAnim();
// virtual int retreatAnimFrameAndCheckForEndOfAnim(class CPlayer *_player);
DVECTOR getMoveVelocity();
void zeroMoveVelocity();
void setMoveVelocity(DVECTOR *_moveVel);
int isOnEdge();
int canMoveLeft();
int canMoveRight();
void moveLeft();
void moveRight();
int slowdown();
void jump();
void fall();
private:
int m_fallFrames;
DVECTOR m_moveVelocity;
2001-04-03 18:47:07 +02:00
protected:
virtual class CPlayerState **getStateTable();
private:
2001-03-23 21:09:14 +01:00
class CPlayerState *m_currentStateClass;
PLAYER_STATE m_currentState;
2001-02-27 23:05:16 +01:00
};
/*----------------------------------------------------------------------
Globals
------- */
/*----------------------------------------------------------------------
Functions
--------- */
/*---------------------------------------------------------------------- */
#endif /* __PLAYER_PMODES_H__ */
/*===========================================================================
end */