From 0ac227fabdbef785548d3f6d4eb21116d1252d7a Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 31 Jan 2001 20:16:34 +0000 Subject: [PATCH] --- source/player/player.cpp | 9 ++- source/player/player.h | 14 ++++- source/player/pmodes.cpp | 132 +++++++++++++++++++-------------------- 3 files changed, 81 insertions(+), 74 deletions(-) diff --git a/source/player/player.cpp b/source/player/player.cpp index 6c2bcbb56..4bc9b4fbf 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -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]<=PLAYER_TERMINAL_VELOCITY<m_metric[PM__TERMINAL_VELOCITY]<metrics->m_metric[PM__MAX_SAFE_FALL_FRAMES]) { diff --git a/source/player/player.h b/source/player/player.h index 7bdd30e70..b4a63c09e 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -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 diff --git a/source/player/pmodes.cpp b/source/player/pmodes.cpp index 4b71db1a9..a86c65344 100644 --- a/source/player/pmodes.cpp +++ b/source/player/pmodes.cpp @@ -103,31 +103,29 @@ 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 - &stateJump, // STATE_JUMP - &stateRun, // STATE_RUN - &stateFall, // STATE_FALL - &stateFallFar, // STATE_FALLFAR - &stateButtBounce, // STATE_BUTTBOUNCE - &stateButtBounceFall, // STATE_BUTTFALL - &stateButtBounceLand, // STATE_BUTTLAND - NULL, // STATE_ATTACK - NULL, // STATE_RUNATTACK - NULL, // STATE_AIRATTACK - &stateDuck, // STATE_DUCK - &stateSoackUp, // STATE_SOAKUP - &stateGetup, // STATE_GETUP + &stateUnarmedIdle, // STATE_IDLE + &stateJump, // STATE_JUMP + &stateRun, // STATE_RUN + &stateFall, // STATE_FALL + &stateFallFar, // STATE_FALLFAR + &stateButtBounce, // STATE_BUTTBOUNCE + &stateButtBounceFall, // STATE_BUTTFALL + &stateButtBounceLand, // STATE_BUTTLAND + NULL, // STATE_ATTACK + NULL, // STATE_RUNATTACK + NULL, // STATE_AIRATTACK + &stateDuck, // STATE_DUCK + &stateSoackUp, // STATE_SOAKUP + &stateGetup, // STATE_GETUP } }, @@ -136,31 +134,29 @@ 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 - &stateJump, // STATE_JUMP - &stateRun, // STATE_RUN - &stateFall, // STATE_FALL - &stateFallFar, // STATE_FALLFAR - &stateButtBounce, // STATE_BUTTBOUNCE - &stateButtBounceFall, // STATE_BUTTFALL - &stateButtBounceLand, // STATE_BUTTLAND - &stateChop, // STATE_ATTACK - &stateRunChop, // STATE_RUNATTACK - &stateAirChop, // STATE_AIRATTACK - &stateDuck, // STATE_DUCK - &stateSoackUp, // STATE_SOAKUP - &stateGetup, // STATE_GETUP + &stateUnarmedIdle, // STATE_IDLE + &stateJump, // STATE_JUMP + &stateRun, // STATE_RUN + &stateFall, // STATE_FALL + &stateFallFar, // STATE_FALLFAR + &stateButtBounce, // STATE_BUTTBOUNCE + &stateButtBounceFall, // STATE_BUTTFALL + &stateButtBounceLand, // STATE_BUTTLAND + &stateChop, // STATE_ATTACK + &stateRunChop, // STATE_RUNATTACK + &stateAirChop, // STATE_AIRATTACK + &stateDuck, // STATE_DUCK + &stateSoackUp, // STATE_SOAKUP + &stateGetup, // STATE_GETUP } }, @@ -169,31 +165,29 @@ 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 - &stateRun, // STATE_RUN - &stateFall, // STATE_FALL - &stateFallFar, // STATE_FALLFAR - NULL, // STATE_BUTTBOUNCE - NULL, // STATE_BUTTFALL - NULL, // STATE_BUTTLAND - NULL, // STATE_ATTACK - NULL, // STATE_RUNATTACK - NULL, // STATE_AIRATTACK - NULL, // STATE_DUCK - NULL, // STATE_SOAKUP - NULL, // STATE_GETUP + &stateCoralBlowerIdle, // STATE_IDLE + &stateJump, // STATE_JUMP + &stateRun, // STATE_RUN + &stateFall, // STATE_FALL + &stateFallFar, // STATE_FALLFAR + NULL, // STATE_BUTTBOUNCE + NULL, // STATE_BUTTFALL + NULL, // STATE_BUTTLAND + NULL, // STATE_ATTACK + NULL, // STATE_RUNATTACK + NULL, // STATE_AIRATTACK + NULL, // STATE_DUCK + NULL, // STATE_SOAKUP + NULL, // STATE_GETUP } }, };