From 65633ae078febacbf6c09ff806cc3bd992eea7c3 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Fri, 2 Sep 2005 16:25:20 +0000 Subject: * Added option for changing whether or not the wallwalk control is a toggle or not --- src/cgame/cg_local.h | 1 + src/cgame/cg_main.c | 2 ++ src/game/bg_pmove.c | 26 ++++++++++++++++++-------- src/game/bg_public.h | 3 ++- src/game/g_client.c | 8 ++++++++ 5 files changed, 31 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index ad44eafc..7af0525b 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1462,6 +1462,7 @@ extern vmCvar_t cg_drawBBOX; extern vmCvar_t cg_debugAlloc; extern vmCvar_t cg_wwSmoothTime; extern vmCvar_t cg_wwFollow; +extern vmCvar_t cg_wwToggle; extern vmCvar_t cg_depthSortParticles; extern vmCvar_t cg_consoleLatency; extern vmCvar_t cg_lightFlare; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 8a657ab7..fd890426 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -194,6 +194,7 @@ vmCvar_t cg_drawBBOX; vmCvar_t cg_debugAlloc; vmCvar_t cg_wwSmoothTime; vmCvar_t cg_wwFollow; +vmCvar_t cg_wwToggle; vmCvar_t cg_depthSortParticles; vmCvar_t cg_consoleLatency; vmCvar_t cg_lightFlare; @@ -298,6 +299,7 @@ static cvarTable_t cvarTable[ ] = { &cg_debugAlloc, "cg_debugAlloc", "0", 0 }, { &cg_wwSmoothTime, "cg_wwSmoothTime", "300", CVAR_ARCHIVE }, { &cg_wwFollow, "cg_wwFollow", "1", CVAR_ARCHIVE|CVAR_USERINFO }, + { &cg_wwToggle, "cg_wwToggle", "1", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_depthSortParticles, "cg_depthSortParticles", "1", CVAR_ARCHIVE }, { &cg_consoleLatency, "cg_consoleLatency", "3000", CVAR_ARCHIVE }, { &cg_lightFlare, "cg_lightFlare", "3", CVAR_ARCHIVE }, diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index bceba335..6fbc059b 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -1997,18 +1997,28 @@ static void PM_GroundTrace( void ) if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) ) { - //toggle wall climbing if holding crouch - if( pm->cmd.upmove < 0 && !( pm->ps->pm_flags & PMF_CROUCH_HELD ) ) + if( pm->ps->persistant[ PERS_STATE ] & PS_WALLCLIMBINGTOGGLE ) { - if( !( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) ) + //toggle wall climbing if holding crouch + if( pm->cmd.upmove < 0 && !( pm->ps->pm_flags & PMF_CROUCH_HELD ) ) + { + if( !( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) ) + pm->ps->stats[ STAT_STATE ] |= SS_WALLCLIMBING; + else if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) + pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING; + + pm->ps->pm_flags |= PMF_CROUCH_HELD; + } + else if( pm->cmd.upmove >= 0 ) + pm->ps->pm_flags &= ~PMF_CROUCH_HELD; + } + else + { + if( pm->cmd.upmove < 0 ) pm->ps->stats[ STAT_STATE ] |= SS_WALLCLIMBING; - else if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) + else if( pm->cmd.upmove >= 0 ) pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING; - - pm->ps->pm_flags |= PMF_CROUCH_HELD; } - else if( pm->cmd.upmove >= 0 ) - pm->ps->pm_flags &= ~PMF_CROUCH_HELD; if( pm->ps->pm_type == PM_DEAD ) pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 5055a632..b67eaac2 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -264,7 +264,8 @@ typedef enum } persEnum_t; #define PS_WALLCLIMBINGFOLLOW 0x00000001 -#define PS_NONSEGMODEL 0x00000002 +#define PS_WALLCLIMBINGTOGGLE 0x00000002 +#define PS_NONSEGMODEL 0x00000004 // entityState_t->eFlags #define EF_DEAD 0x00000001 // don't draw a foe marker over players with EF_DEAD diff --git a/src/game/g_client.c b/src/game/g_client.c index 7c564be9..d137b9bb 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1052,6 +1052,14 @@ void ClientUserinfoChanged( int clientNum ) else client->ps.persistant[ PERS_STATE ] &= ~PS_WALLCLIMBINGFOLLOW; + // wallwalk toggle + s = Info_ValueForKey( userinfo, "cg_wwToggle" ); + + if( atoi( s ) ) + client->ps.persistant[ PERS_STATE ] |= PS_WALLCLIMBINGTOGGLE; + else + client->ps.persistant[ PERS_STATE ] &= ~PS_WALLCLIMBINGTOGGLE; + // teamInfo s = Info_ValueForKey( userinfo, "teamoverlay" ); -- cgit