2001-01-16 20:27:14 +01:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
player.h
|
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
2001-01-09 21:38:20 +01:00
|
|
|
|
2001-01-16 17:20:45 +01:00
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
2001-01-16 20:27:14 +01:00
|
|
|
#define __PLAYER_PLAYER_H__
|
2001-01-09 21:38:20 +01:00
|
|
|
|
2001-01-16 20:27:14 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
|
|
|
#ifndef __GAME_THING_H__
|
2001-01-09 21:38:20 +01:00
|
|
|
#include "Game/Thing.h"
|
2001-01-16 20:27:14 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __SKEL_HEADER__
|
2001-01-12 23:40:39 +01:00
|
|
|
#include "Gfx/Skel.h"
|
2001-01-16 20:27:14 +01:00
|
|
|
#endif
|
2001-01-09 21:38:20 +01:00
|
|
|
|
2001-01-16 20:27:14 +01:00
|
|
|
#ifndef __DATA_STRUCTS_HEADER__
|
|
|
|
#include <dstructs.h>
|
|
|
|
#endif
|
2001-01-15 23:09:47 +01:00
|
|
|
|
2001-01-20 00:37:40 +01:00
|
|
|
#ifndef __PLAYER_PSTATES_H__
|
|
|
|
#include "player\pstates.h"
|
|
|
|
#endif
|
|
|
|
|
2001-01-16 20:27:14 +01:00
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
2001-01-20 00:37:40 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
STATE_IDLE,
|
|
|
|
STATE_JUMP,
|
|
|
|
STATE_RUN,
|
|
|
|
STATE_FALL,
|
|
|
|
STATE_FALLFAR,
|
2001-01-22 22:02:59 +01:00
|
|
|
STATE_BUTTBOUNCE,
|
|
|
|
STATE_BUTTFALL,
|
|
|
|
STATE_BUTTLAND,
|
|
|
|
STATE_CHOP,
|
|
|
|
STATE_RUNCHOP,
|
|
|
|
STATE_DUCK,
|
|
|
|
STATE_SOAKUP,
|
|
|
|
STATE_GETUP,
|
2001-01-20 00:37:40 +01:00
|
|
|
|
|
|
|
NUM_STATES,
|
|
|
|
}PLAYER_STATE;
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FACING_LEFT=+1,
|
|
|
|
FACING_RIGHT=-1,
|
|
|
|
};
|
|
|
|
|
2001-01-22 22:02:59 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
PM__JUMP_VELOCITY,
|
|
|
|
PM__MAX_JUMP_FRAMES,
|
|
|
|
PM__MAX_SAFE_FALL_FRAMES,
|
|
|
|
PM__GRAVITY_VALUE,
|
|
|
|
PM__TERMINAL_VELOCITY,
|
|
|
|
PM__MAX_RUN_VELOCITY,
|
|
|
|
PM__RUN_SPEEDUP,
|
|
|
|
PM__RUN_REVERSESLOWDOWN,
|
|
|
|
PM__RUN_SLOWDOWN,
|
|
|
|
|
|
|
|
NUM_PLAYER_METRICS
|
|
|
|
}PLAYER_METRIC;
|
2001-01-20 00:37:40 +01:00
|
|
|
|
|
|
|
|
2001-01-16 20:27:14 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
2001-01-12 23:40:39 +01:00
|
|
|
|
2001-01-22 22:02:59 +01:00
|
|
|
struct PlayerMetrics
|
|
|
|
{
|
|
|
|
s16 m_metric[NUM_PLAYER_METRICS];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-01-20 00:37:40 +01:00
|
|
|
class CPlayer : public CThing
|
2001-01-09 21:38:20 +01:00
|
|
|
{
|
|
|
|
public:
|
2001-01-22 22:02:59 +01:00
|
|
|
enum
|
2001-01-20 00:37:40 +01:00
|
|
|
{
|
2001-01-22 22:02:59 +01:00
|
|
|
VELOCITY_SHIFT=2
|
|
|
|
};
|
2001-01-20 00:37:40 +01:00
|
|
|
|
2001-01-15 23:09:47 +01:00
|
|
|
void init();
|
|
|
|
void shutdown();
|
|
|
|
void think(int _frames);
|
|
|
|
void render();
|
|
|
|
|
2001-01-20 00:37:40 +01:00
|
|
|
protected:
|
2001-01-22 23:58:12 +01:00
|
|
|
const PlayerMetrics *getPlayerMetrics();
|
2001-01-16 20:27:14 +01:00
|
|
|
|
|
|
|
void setState(PLAYER_STATE _state);
|
2001-01-20 00:37:40 +01:00
|
|
|
int getFacing();
|
2001-01-16 20:27:14 +01:00
|
|
|
void setFacing(int _facing);
|
2001-01-20 00:37:40 +01:00
|
|
|
int getAnimFrame();
|
|
|
|
void setAnimFrame(int _animFrame);
|
|
|
|
int getAnimFrameCount();
|
|
|
|
int getAnimNo();
|
|
|
|
void setAnimNo(int _animNo);
|
|
|
|
DVECTOR getMoveVelocity();
|
|
|
|
void setMoveVelocity(DVECTOR *_moveVel);
|
2001-01-16 20:27:14 +01:00
|
|
|
virtual int getPadInput();
|
|
|
|
|
2001-01-20 00:37:40 +01:00
|
|
|
int isOnSolidGround();
|
|
|
|
|
|
|
|
void moveLeft();
|
|
|
|
void moveRight();
|
|
|
|
void slowdown();
|
|
|
|
void jump();
|
|
|
|
void fall();
|
|
|
|
|
|
|
|
friend class CPlayerState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
int m_animFrame;
|
2001-01-16 20:27:14 +01:00
|
|
|
int m_animNo;
|
|
|
|
PLAYER_STATE m_state;
|
|
|
|
CSkel m_skel;
|
|
|
|
|
2001-01-20 00:37:40 +01:00
|
|
|
DVECTOR m_moveVel;
|
2001-01-15 23:09:47 +01:00
|
|
|
int m_facing;
|
|
|
|
|
2001-01-22 23:58:12 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
INVIBCIBLE_FRAMES__START=120, // Invincible for this many frames at start of life
|
|
|
|
INVINCIBLE_FRAMES__HIT=25, // Invincible for this many frames after taking damage
|
|
|
|
};
|
|
|
|
int m_invincibleFrameCount;
|
|
|
|
|
2001-01-20 00:37:40 +01:00
|
|
|
static class CPlayerState *s_states[NUM_STATES];
|
|
|
|
|
|
|
|
class CPlayerState *m_currentState;
|
2001-01-12 23:40:39 +01:00
|
|
|
|
2001-01-22 23:58:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
int m_lives;
|
|
|
|
|
2001-01-09 21:38:20 +01:00
|
|
|
};
|
|
|
|
|
2001-01-15 23:09:47 +01:00
|
|
|
|
2001-01-16 20:27:14 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Globals
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Functions
|
|
|
|
--------- */
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#endif /* __PLAYER_PLAYER_H__ */
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|