From 4bef4ef2d5b49bb0954597c4bd7f04a952518bea Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 3 May 2010 19:43:20 +0000 Subject: [PATCH] sv_aircontrol_power - customizing the response curve of CPMA style air control git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10168 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_input.c | 7 ++++++- client.h | 1 + quakedef.h | 1 + server.h | 1 + sv_main.c | 3 +++ 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cl_input.c b/cl_input.c index 4c94d38e..aacdfcc5 100644 --- a/cl_input.c +++ b/cl_input.c @@ -1121,9 +1121,9 @@ void CL_ClientMovement_Physics_CPM_PM_Aircontrol(cl_clientmovement_state_t *s, v speed = VectorNormalizeLength(s->velocity); dot = DotProduct(s->velocity, wishdir); - k *= cl.movevars_aircontrol*dot*dot*s->cmd.frametime; if(dot > 0) { // we can't change direction while slowing down + k *= cl.movevars_aircontrol*pow(dot, cl.movevars_aircontrol_power)*s->cmd.frametime; VectorMAM(speed, s->velocity, k, wishdir, s->velocity); VectorNormalize(s->velocity); } @@ -1462,6 +1462,7 @@ void CL_UpdateMoveVars(void) cl.movevars_airstrafeaccelerate = cl.statsf[STAT_MOVEVARS_AIRSTRAFEACCELERATE]; cl.movevars_maxairstrafespeed = cl.statsf[STAT_MOVEVARS_MAXAIRSTRAFESPEED]; cl.movevars_aircontrol = cl.statsf[STAT_MOVEVARS_AIRCONTROL]; + cl.movevars_aircontrol_power = cl.statsf[STAT_MOVEVARS_AIRCONTROL_POWER]; cl.movevars_warsowbunny_airforwardaccel = cl.statsf[STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL]; cl.movevars_warsowbunny_accel = cl.statsf[STAT_MOVEVARS_WARSOWBUNNY_ACCEL]; cl.movevars_warsowbunny_topspeed = cl.statsf[STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED]; @@ -1494,6 +1495,7 @@ void CL_UpdateMoveVars(void) cl.movevars_airstrafeaccelerate = 0; cl.movevars_maxairstrafespeed = 0; cl.movevars_aircontrol = 0; + cl.movevars_aircontrol_power = 2; cl.movevars_warsowbunny_airforwardaccel = 0; cl.movevars_warsowbunny_accel = 0; cl.movevars_warsowbunny_topspeed = 0; @@ -1506,6 +1508,9 @@ void CL_UpdateMoveVars(void) if(gamemode == GAME_NEXUIZ) cl.moveflags = MOVEFLAG_Q2AIRACCELERATE; } + + if(cl.movevars_aircontrol_power <= 0) + cl.movevars_aircontrol = 2; // CPMA default } void CL_ClientMovement_Replay(void) diff --git a/client.h b/client.h index 3dd9a76f..3a7b6939 100644 --- a/client.h +++ b/client.h @@ -1188,6 +1188,7 @@ typedef struct client_state_s float movevars_airstrafeaccelerate; float movevars_maxairstrafespeed; float movevars_aircontrol; + float movevars_aircontrol_power; float movevars_warsowbunny_airforwardaccel; float movevars_warsowbunny_accel; float movevars_warsowbunny_topspeed; diff --git a/quakedef.h b/quakedef.h index 55e8e6ac..09192850 100644 --- a/quakedef.h +++ b/quakedef.h @@ -229,6 +229,7 @@ extern char engineversion[128]; //#define STAT_TIME 17 ///< FTE //#define STAT_VIEW2 20 ///< FTE #define STAT_VIEWZOOM 21 ///< DP +#define STAT_MOVEVARS_AIRCONTROL_POWER 224 ///< DP #define STAT_MOVEFLAGS 225 ///< DP #define STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL 226 ///< DP #define STAT_MOVEVARS_WARSOWBUNNY_ACCEL 227 ///< DP diff --git a/server.h b/server.h index 0d597762..ad15e21f 100644 --- a/server.h +++ b/server.h @@ -388,6 +388,7 @@ extern cvar_t sv_airstopaccelerate; extern cvar_t sv_airstrafeaccelerate; extern cvar_t sv_maxairstrafespeed; extern cvar_t sv_aircontrol; +extern cvar_t sv_aircontrol_power; extern cvar_t sv_allowdownloads; extern cvar_t sv_allowdownloads_archive; extern cvar_t sv_allowdownloads_config; diff --git a/sv_main.c b/sv_main.c index cda3379f..612f6fed 100644 --- a/sv_main.c +++ b/sv_main.c @@ -54,6 +54,7 @@ cvar_t sv_airstopaccelerate = {0, "sv_airstopaccelerate", "0", "when set, replac cvar_t sv_airstrafeaccelerate = {0, "sv_airstrafeaccelerate", "0", "when set, replacement for sv_airaccelerate when just strafing"}; cvar_t sv_maxairstrafespeed = {0, "sv_maxairstrafespeed", "0", "when set, replacement for sv_maxairspeed when just strafing"}; cvar_t sv_aircontrol = {0, "sv_aircontrol", "0", "CPMA-style air control"}; +cvar_t sv_aircontrol_power = {0, "sv_aircontrol", "2", "CPMA-style air control exponent"}; cvar_t sv_allowdownloads = {0, "sv_allowdownloads", "1", "whether to allow clients to download files from the server (does not affect http downloads)"}; cvar_t sv_allowdownloads_archive = {0, "sv_allowdownloads_archive", "0", "whether to allow downloads of archives (pak/pk3)"}; cvar_t sv_allowdownloads_config = {0, "sv_allowdownloads_config", "0", "whether to allow downloads of config files (cfg)"}; @@ -368,6 +369,7 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_airstrafeaccelerate); Cvar_RegisterVariable (&sv_maxairstrafespeed); Cvar_RegisterVariable (&sv_aircontrol); + Cvar_RegisterVariable (&sv_aircontrol_power); Cvar_RegisterVariable (&sv_allowdownloads); Cvar_RegisterVariable (&sv_allowdownloads_archive); Cvar_RegisterVariable (&sv_allowdownloads_config); @@ -1961,6 +1963,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t statsf[STAT_MOVEVARS_AIRSTRAFEACCELERATE] = sv_airstrafeaccelerate.value; statsf[STAT_MOVEVARS_MAXAIRSTRAFESPEED] = sv_maxairstrafespeed.value; statsf[STAT_MOVEVARS_AIRCONTROL] = sv_aircontrol.value; + statsf[STAT_MOVEVARS_AIRCONTROL_POWER] = sv_aircontrol_power.value; statsf[STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL] = sv_warsowbunny_airforwardaccel.value; statsf[STAT_MOVEVARS_WARSOWBUNNY_ACCEL] = sv_warsowbunny_accel.value; statsf[STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED] = sv_warsowbunny_topspeed.value; -- 2.39.2