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-05-11 21:49:41 +02:00
|
|
|
PM__HITREACT_XVELOCITY,
|
|
|
|
PM__HITREACT_YVELOCITY,
|
|
|
|
PM__HITREACT_FRAMES,
|
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,
|
2001-06-10 19:07:06 +02:00
|
|
|
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN=3<<2,
|
|
|
|
DEFAULT_PLAYER_RUN_SLOWDOWN=2<<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-05-11 21:49:41 +02:00
|
|
|
DEFAULT_HITREACT_XVELOCITY=5,
|
2001-05-12 19:24:44 +02:00
|
|
|
DEFAULT_HITREACT_YVELOCITY=3-1,
|
2001-05-11 21:49:41 +02:00
|
|
|
DEFAULT_HITREACT_FRAMES=15,
|
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-06-14 23:22:40 +02:00
|
|
|
virtual void springPlayerUp(int _springHeight) {;}
|
2001-06-15 23:24:14 +02:00
|
|
|
virtual void setFloating() {;}
|
2001-05-04 01:45:28 +02:00
|
|
|
void inSoakUpState();
|
2001-04-18 18:35:26 +02:00
|
|
|
|
2001-05-11 21:49:41 +02:00
|
|
|
virtual int setState(int _state) {return 0;}
|
2001-05-15 00:08:19 +02:00
|
|
|
virtual int getState() {return STATE_IDLE;} // ARSE.. states need to go back in CPlayer! (pkg)
|
2001-07-03 00:57:52 +02:00
|
|
|
int getHeightFromGound();
|
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-05-15 00:08:19 +02:00
|
|
|
public:
|
|
|
|
DVECTOR getPlayerPos(); // Public so that the states can get the position for bubicle spawners
|
2001-03-23 21:09:14 +01:00
|
|
|
protected:
|
2001-05-15 00:08:19 +02:00
|
|
|
void setPlayerPos(DVECTOR *_pos); // Private so that they cannot directly alter it
|
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-06-14 23:22:40 +02:00
|
|
|
virtual void springPlayerUp(int _springHeight) {m_springHeight=_springHeight;setState(STATE_SPRINGUP);}
|
2001-06-15 23:24:14 +02:00
|
|
|
virtual void setFloating() {setState( STATE_FLOAT );}
|
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-05-15 00:08:19 +02:00
|
|
|
virtual 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-06-12 18:28:39 +02:00
|
|
|
CPlayer *getPlayer() { return( m_player ); }
|
2001-03-23 21:09:14 +01:00
|
|
|
|
2001-05-15 00:08:19 +02:00
|
|
|
int getIsInWater() {return m_player->getIsInWater();}
|
2001-06-14 17:19:57 +02:00
|
|
|
int getIsHelmetFullSoICanStopSoakingUp() {return m_player->getIsHelmetFullSoICanStopSoakingUp();}
|
|
|
|
int getIsHelmetSoFullThatIDontNeedToSoakUp(){return m_player->getIsHelmetSoFullThatIDontNeedToSoakUp();}
|
2001-05-15 00:08:19 +02:00
|
|
|
|
2001-03-23 21:09:14 +01:00
|
|
|
void moveLeft();
|
|
|
|
void moveRight();
|
|
|
|
int slowdown();
|
|
|
|
void jump();
|
2001-06-10 19:07:06 +02:00
|
|
|
void spring();
|
2001-05-11 21:49:41 +02:00
|
|
|
void jumpback();
|
2001-03-23 21:09:14 +01:00
|
|
|
void fall();
|
2001-07-03 00:57:52 +02:00
|
|
|
void fallToDance();
|
2001-04-11 17:48:16 +02:00
|
|
|
void buttFall();
|
2001-03-23 21:09:14 +01:00
|
|
|
|
2001-06-14 23:22:40 +02:00
|
|
|
int getSpringHeight() {return m_springHeight;}
|
|
|
|
|
2001-03-23 21:09:14 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
int m_fallFrames;
|
2001-06-14 23:22:40 +02:00
|
|
|
int m_springHeight;
|
2001-03-23 21:09:14 +01:00
|
|
|
|
2001-04-03 18:47:07 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual class CPlayerState **getStateTable();
|
|
|
|
|
2001-06-14 23:22:40 +02:00
|
|
|
|
2001-04-03 18:47:07 +02:00
|
|
|
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 */
|
|
|
|
|
|
|
|
|
|
|
|
|