Skip to content

Commit

Permalink
Add meaningful names for magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Nov 25, 2023
1 parent 412eb67 commit 67a4a78
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions regamedll/pm_shared/pm_shared.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "precompiled.h"

#define PLAYER_MOVEMENT_STOPSPEED 100.0 // sv_stopspeed Minimum stopping speed when on ground
#define PLAYER_MOVEMENT_FRICTION 4.0 // sv_friction Surface friction
#define PLAYER_MOVEMENT_JUMP_FACTOR 19.0

BOOL pm_shared_initialized = FALSE;

vec3_t rgv3tStuckTable[54];
Expand Down Expand Up @@ -888,10 +892,10 @@ void PM_WalkMove()

#ifdef REGAMEDLL_ADD
if (player_movement_legacy.value == 0)
flRatio = (100.0 - pmove->fuser2 * 0.001 * 19.0 * player_movement_penalty_jump.value * pmove->frametime) * 0.01;
flRatio = (PLAYER_MOVEMENT_STOPSPEED - pmove->fuser2 * 0.001 * PLAYER_MOVEMENT_JUMP_FACTOR * player_movement_penalty_jump.value * pmove->frametime) / 100.0;
else
#endif
flRatio = (100.0 - pmove->fuser2 * 0.001 * 19.0) * 0.01;
flRatio = (PLAYER_MOVEMENT_STOPSPEED - pmove->fuser2 * 0.001 * PLAYER_MOVEMENT_JUMP_FACTOR /** PLAYER_MOVEMENT_FRICTION * pmove->frametime*/) / 100.0;

pmove->velocity[0] *= flRatio;
pmove->velocity[1] *= flRatio;
Expand Down Expand Up @@ -2566,15 +2570,15 @@ void EXT_FUNC __API_HOOK(PM_Jump)()

#ifdef REGAMEDLL_ADD
if (player_movement_legacy.value == 0)
flRatio = (100.0 - pmove->fuser2 * 0.001 * 19.0 * player_movement_penalty_jump.value * pmove->frametime) * 0.01;
flRatio = (PLAYER_MOVEMENT_STOPSPEED - pmove->fuser2 * 0.001 * PLAYER_MOVEMENT_JUMP_FACTOR * player_movement_penalty_jump.value * pmove->frametime) / 100.0;
else
#endif
flRatio = (100.0 - pmove->fuser2 * 0.001 * 19.0) * 0.01;
flRatio = (PLAYER_MOVEMENT_STOPSPEED - pmove->fuser2 * 0.001 * PLAYER_MOVEMENT_JUMP_FACTOR /** PLAYER_MOVEMENT_FRICTION * pmove->frametime*/) / 100.0;

pmove->velocity[2] *= flRatio;
}

pmove->fuser2 = 100.0 * 1000.0 / 19.0 / 4.0;
pmove->fuser2 = 100.0 / 0.001 / PLAYER_MOVEMENT_JUMP_FACTOR / PLAYER_MOVEMENT_FRICTION;

// Decay it for simulation
PM_FixupGravityVelocity();
Expand Down

0 comments on commit 67a4a78

Please sign in to comment.