SBSPSS/source/player/pmodes.h

191 lines
4.2 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-04-11 17:48:16 +02:00
PM__BUTT_FALL_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,
2001-04-12 18:02:47 +02:00
DEFAULT_PLAYER_MAX_JUMP_FRAMES=10,
2001-03-25 22:36:28 +02:00
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,
2001-04-12 18:02:47 +02:00
DEFAULT_PLAYER_PLAYER_GRAVITY=2<<2,
2001-03-25 22:36:28 +02:00
DEFAULT_PLAYER_TERMINAL_VELOCITY=8,
2001-04-11 17:48:16 +02:00
DEFAULT_BUTT_FALL_VELOCITY=14,
2001-03-25 22:36:28 +02:00
};
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() {;}
2001-04-05 18:26:17 +02:00
virtual void render(DVECTOR *_pos) {;}
2001-03-31 20:22:38 +02:00
virtual void renderModeUi() {;} // Ui specific to this mode (eg: ammo)
2001-04-18 18:35:26 +02:00
virtual int canDoLookAround() {return false;}
2001-05-01 20:39:41 +02:00
virtual void springPlayerUp() {;}
2001-05-04 01:45:28 +02:00
void inSoakUpState();
2001-04-18 18:35:26 +02:00
2001-03-23 21:09:14 +01:00
int getPadInputHeld();
int getPadInputDown();
2001-04-12 20:48:33 +02:00
virtual ATTACK_STATE getAttackState() {return ATTACK_STATE__NONE;}
2001-03-27 22:29:02 +02:00
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();
2001-04-18 18:35:26 +02:00
virtual void render() {;}
virtual int canDoLookAround();
2001-05-01 20:39:41 +02:00
virtual void springPlayerUp() {setState(STATE_SPRINGUP);}
2001-03-23 21:09:14 +01:00
2001-04-12 20:48:33 +02:00
virtual ATTACK_STATE getAttackState();
2001-03-27 22:29:02 +02:00
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-04-08 20:57:16 +02:00
virtual 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
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();
DVECTOR getMoveVelocity();
void zeroMoveVelocity();
void setMoveVelocity(DVECTOR *_moveVel);
int isOnEdge();
int canMoveLeft();
int canMoveRight();
2001-05-01 22:23:32 +02:00
virtual void setPlayerCollisionSize(int _x,int _y,int _w,int _h);
virtual void getPlayerCollisionSize(int *_x,int *_y,int *_w,int *_h);
2001-03-23 21:09:14 +01:00
void moveLeft();
void moveRight();
int slowdown();
void jump();
void fall();
2001-04-11 17:48:16 +02:00
void buttFall();
2001-03-23 21:09:14 +01:00
private:
int m_fallFrames;
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 */