From a699f8493113a0dd8a54193f2372890948acf5e2 Mon Sep 17 00:00:00 2001 From: Razish Date: Tue, 20 Feb 2024 19:12:01 +1100 Subject: [PATCH] fix water jumping discrepancy 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 --- codemp/game/bg_pmove.c | 20 +++++++++++++++++++- codemp/game/bg_public.h | 1 + codemp/game/g_cvar.c | 4 ++++ codemp/game/g_xcvar.h | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/codemp/game/bg_pmove.c b/codemp/game/bg_pmove.c index 894867f1c4..82ac8ba9d2 100644 --- a/codemp/game/bg_pmove.c +++ b/codemp/game/bg_pmove.c @@ -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 ) { @@ -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; } @@ -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 ) { diff --git a/codemp/game/bg_public.h b/codemp/game/bg_public.h index 1c2d7b6311..b0a9cfab8f 100644 --- a/codemp/game/bg_public.h +++ b/codemp/game/bg_public.h @@ -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 # diff --git a/codemp/game/g_cvar.c b/codemp/game/g_cvar.c index e2c7600e0c..9d100d517e 100644 --- a/codemp/game/g_cvar.c +++ b/codemp/game/g_cvar.c @@ -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); diff --git a/codemp/game/g_xcvar.h b/codemp/game/g_xcvar.h index df9ee8094a..aebe485364 100644 --- a/codemp/game/g_xcvar.h +++ b/codemp/game/g_xcvar.h @@ -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 )