Skip to content

Commit

Permalink
fix water jumping discrepancy
Browse files Browse the repository at this point in the history
reverts a change introduced in Razish/jasdk_modbase@09edabf but provide an alternative fix that better matches SP code/behaviour with as few changes as possible
this lets you jump out of the water pools in taspir2 like you can in SP
introduces g_fixWaterJump (default: 0) / LEGACYFIX_WATERJUMP

discovered by @CansecoDev
  • Loading branch information
Razish committed Feb 20, 2024
1 parent 1e8a799 commit a699f84
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
20 changes: 19 additions & 1 deletion codemp/game/bg_pmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ float forceJumpStrength[NUM_FORCE_POWER_LEVELS] =
840
};

static qboolean BG_FixWaterJump(void) {
#if defined(_GAME)
return !!g_fixWaterJump.integer;
#elif defined(_CGAME)
const char *cs = CG_ConfigString(CS_LEGACY_FIXES);
const uint32_t legacyFixes = strtoul(cs, NULL, 0);
return !!(legacyFixes & (1 << LEGACYFIX_WATERJUMP));
#endif
}

//rww - Get a pointer to the bgEntity by the index
bgEntity_t *PM_BGEntForNum( int num )
{
Expand Down Expand Up @@ -2775,7 +2785,7 @@ static qboolean PM_CheckWaterJump( void ) {

spot[2] += 16;
cont = pm->pointcontents (spot, pm->ps->clientNum );
if ( cont & (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY) ) {
if (cont) {
return qfalse;
}

Expand Down Expand Up @@ -2830,6 +2840,14 @@ static void PM_WaterMove( void ) {
PM_WaterJumpMove();
return;
}
else if ( BG_FixWaterJump() && pm->ps->fd.forcePowerLevel[FP_LEVITATION] > FORCE_LEVEL_0 && pm->waterlevel < 3 )
{
if ( PM_CheckJump () ) {
// jumped away
return;
}
}

#if 0
// jump = head for surface
if ( pm->cmd.upmove >= 10 ) {
Expand Down
1 change: 1 addition & 0 deletions codemp/game/bg_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ typedef enum legacyFixes_e {
LEGACYFIX_SABERMOVEDATA = 0,
LEGACYFIX_WEAPONATTACKANIM,
LEGACYFIX_RUNWALKANIMS,
LEGACYFIX_WATERJUMP,
/*
m m ""# " m m
# # mmm m m # mmm mmm mm#mm mmm m mm #
Expand Down
4 changes: 4 additions & 0 deletions codemp/game/g_cvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ static void CVU_FixRunWalkAnims(void) {
UpdateLegacyFixesConfigstring(LEGACYFIX_RUNWALKANIMS, g_fixRunWalkAnims.integer);
}

static void CVU_FixWaterJump(void) {
UpdateLegacyFixesConfigstring(LEGACYFIX_WATERJUMP, g_fixWaterJump.integer);
}

static void CVU_FixWeaponAttackAnim(void) {
BG_FixWeaponAttackAnim();
UpdateLegacyFixesConfigstring(LEGACYFIX_WEAPONATTACKANIM, g_fixWeaponAttackAnim.integer);
Expand Down
1 change: 1 addition & 0 deletions codemp/game/g_xcvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ XCVAR_DEF( g_filterBan, "1", NULL, CVAR_ARCHIVE, qfalse )
XCVAR_DEF( g_fixSaberDisarmBonus, "1", NULL, CVAR_ARCHIVE, qfalse )
XCVAR_DEF( g_fixSaberMoveData, "1", CVU_FixSaberMoveData, CVAR_ARCHIVE, qfalse )
XCVAR_DEF( g_fixRunWalkAnims, "1", CVU_FixRunWalkAnims, CVAR_ARCHIVE, qfalse )
XCVAR_DEF( g_fixWaterJump, "0", CVU_FixWaterJump, CVAR_ARCHIVE, qfalse )
XCVAR_DEF( g_fixWeaponAttackAnim, "1", CVU_FixWeaponAttackAnim, CVAR_ARCHIVE, qfalse )
XCVAR_DEF( g_forceBasedTeams, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qfalse )
XCVAR_DEF( g_forceClientUpdateRate, "250", NULL, CVAR_NONE, qfalse )
Expand Down

0 comments on commit a699f84

Please sign in to comment.