This commit is contained in:
Paul 2001-01-31 20:16:34 +00:00
parent 57e4e40672
commit 0ac227fabd
3 changed files with 81 additions and 74 deletions

View File

@ -184,6 +184,9 @@ if(newmode!=-1)
Pos.vy+=m_moveVel.vy>>VELOCITY_SHIFT;
if(isOnSolidGround())
{
//stick to ground (PKG)
Pos.vy=23*16+1;//16*15;
if(m_moveVel.vy)
{
// Was falling.. so we've just hit the ground
@ -216,10 +219,10 @@ if(newmode!=-1)
// Fall
const PlayerMetrics *metrics;
metrics=getPlayerMetrics();
m_moveVel.vy+=metrics->m_metric[PM__GRAVITY_VALUE];
if(m_moveVel.vy>=metrics->m_metric[PM__TERMINAL_VELOCITY]<<VELOCITY_SHIFT)
m_moveVel.vy+=PLAYER_GRAVITY;
if(m_moveVel.vy>=PLAYER_TERMINAL_VELOCITY<<VELOCITY_SHIFT)
{
m_moveVel.vy=metrics->m_metric[PM__TERMINAL_VELOCITY]<<VELOCITY_SHIFT;
m_moveVel.vy=PLAYER_TERMINAL_VELOCITY<<VELOCITY_SHIFT;
m_fallFrames++;
if(m_fallFrames>metrics->m_metric[PM__MAX_SAFE_FALL_FRAMES])
{

View File

@ -82,8 +82,6 @@ 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,
@ -119,6 +117,18 @@ public:
DVECTOR getCameraPos();
protected:
enum
{
DEFAULT_PLAYER_JUMP_VELOCITY=8,
DEFAULT_PLAYER_MAX_JUMP_FRAMES=10,
DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES=20,
DEFAULT_PLAYER_MAX_RUN_VELOCITY=8,
DEFAULT_PLAYER_RUN_SPEEDUP=4,
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN=2,
DEFAULT_PLAYER_RUN_SLOWDOWN=1,
PLAYER_GRAVITY=4,
PLAYER_TERMINAL_VELOCITY=8,
};
const PlayerMetrics *getPlayerMetrics();
// State

View File

@ -103,15 +103,13 @@ CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]=
//
{
{ {
8, // PM__JUMP_VELOCITY
10, // PM__MAX_JUMP_FRAMES
20, // PM__MAX_SAFE_FALL_FRAMES
4, // PM__GRAVITY_VALUE
8, // PM__TERMINAL_VELOCITY
8, // PM__MAX_RUN_VELOCITY
4, // PM__RUN_SPEEDUP
2, // PM__RUN_REVERSESLOWDOWN
1, // PM__RUN_SLOWDOWN
DEFAULT_PLAYER_JUMP_VELOCITY, // PM__JUMP_VELOCITY
DEFAULT_PLAYER_MAX_JUMP_FRAMES, // PM__MAX_JUMP_FRAMES
DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES, // PM__MAX_SAFE_FALL_FRAMES
DEFAULT_PLAYER_MAX_RUN_VELOCITY, // PM__MAX_RUN_VELOCITY
DEFAULT_PLAYER_RUN_SPEEDUP, // PM__RUN_SPEEDUP
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
} },
{
&stateUnarmedIdle, // STATE_IDLE
@ -136,15 +134,13 @@ CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]=
//
{
{ {
8, // PM__JUMP_VELOCITY
10, // PM__MAX_JUMP_FRAMES
20, // PM__MAX_SAFE_FALL_FRAMES
4, // PM__GRAVITY_VALUE
8, // PM__TERMINAL_VELOCITY
8, // PM__MAX_RUN_VELOCITY
4, // PM__RUN_SPEEDUP
2, // PM__RUN_REVERSESLOWDOWN
1, // PM__RUN_SLOWDOWN
DEFAULT_PLAYER_JUMP_VELOCITY, // PM__JUMP_VELOCITY
DEFAULT_PLAYER_MAX_JUMP_FRAMES, // PM__MAX_JUMP_FRAMES
DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES, // PM__MAX_SAFE_FALL_FRAMES
DEFAULT_PLAYER_MAX_RUN_VELOCITY, // PM__MAX_RUN_VELOCITY
DEFAULT_PLAYER_RUN_SPEEDUP, // PM__RUN_SPEEDUP
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
} },
{
&stateUnarmedIdle, // STATE_IDLE
@ -169,19 +165,17 @@ CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]=
//
{
{ {
8, // PM__JUMP_VELOCITY
10, // PM__MAX_JUMP_FRAMES
20, // PM__MAX_SAFE_FALL_FRAMES
4, // PM__GRAVITY_VALUE
8, // PM__TERMINAL_VELOCITY
4,//8, // PM__MAX_RUN_VELOCITY
2,//4, // PM__RUN_SPEEDUP
2, // PM__RUN_REVERSESLOWDOWN
2,//1, // PM__RUN_SLOWDOWN
DEFAULT_PLAYER_JUMP_VELOCITY/3, // PM__JUMP_VELOCITY
DEFAULT_PLAYER_MAX_JUMP_FRAMES/2, // PM__MAX_JUMP_FRAMES
DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES, // PM__MAX_SAFE_FALL_FRAMES
DEFAULT_PLAYER_MAX_RUN_VELOCITY/2, // PM__MAX_RUN_VELOCITY
DEFAULT_PLAYER_RUN_SPEEDUP/2, // PM__RUN_SPEEDUP
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
} },
{
&stateCoralBlowerIdle, // STATE_IDLE
NULL, // STATE_JUMP
&stateJump, // STATE_JUMP
&stateRun, // STATE_RUN
&stateFall, // STATE_FALL
&stateFallFar, // STATE_FALLFAR