Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MP] fix water jumping discrepancy #1212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion codemp/game/bg_pmove.c
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
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
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
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