diff --git a/cl_view.c b/cl_view.c index cae582a1a..357eebb84 100644 --- a/cl_view.c +++ b/cl_view.c @@ -105,7 +105,7 @@ float V_CalcRoll (vec3_t angles, vec3_t velocity) { sign = side < 0 ? -1 : 1; side = fabs(side); - side = (side < cl_rollspeed.value) ? side * cl_rollangle.value / cl_rollspeed.value : cl_rollangle.value; + side = (side < cl_rollspeed.value) ? side * Ruleset_RollAngle() / cl_rollspeed.value : Ruleset_RollAngle(); if (side > 45) side = 45; @@ -773,7 +773,7 @@ void V_CalcViewRoll (void) { float side, adjspeed; side = V_CalcRoll (cl.simangles, cl.simvel); - adjspeed = cl_rollalpha.value * bound (2, fabs(cl_rollangle.value), 45); + adjspeed = cl_rollalpha.value * bound (2, Ruleset_RollAngle(), 45); if (side > cl.rollangle) { cl.rollangle += cls.frametime * adjspeed; if (cl.rollangle > side) diff --git a/menu_options.c b/menu_options.c index c56710554..158312dba 100644 --- a/menu_options.c +++ b/menu_options.c @@ -902,7 +902,7 @@ setting settfps_arr[] = { ADDSET_NUMBER ("View Size (fov)", scr_fov, 40, 140, 2), ADDSET_NUMBER ("Screen Size", scr_viewsize, 30, 120, 5), ADDSET_ADVANCED_SECTION(), - ADDSET_NUMBER ("Rollangle", cl_rollangle, 0, 30, 2), + ADDSET_NUMBER ("Rollangle", cl_rollangle, 0, 10, 1), ADDSET_NUMBER ("Rollspeed", cl_rollspeed, 0, 30, 2), ADDSET_BOOL ("Gun Kick", v_gunkick), ADDSET_NUMBER ("Kick Pitch", v_kickpitch, 0, 10, 0.5), diff --git a/rulesets.c b/rulesets.c index d4ef796a9..8d3b80bb9 100644 --- a/rulesets.c +++ b/rulesets.c @@ -33,6 +33,7 @@ static rulesetDef_t rulesetDef = { 72.0, false, false, + false, false }; @@ -223,6 +224,7 @@ static void Rulesets_Smackdown(qbool enable) rulesetDef.restrictPacket = true; // packet command could have been exploited for external timers rulesetDef.restrictParticles = true; rulesetDef.ruleset = rs_smackdown; + rulesetDef.restrictRollAngle = true; } else { for (i = 0; i < (sizeof(disabled_cvars) / sizeof(disabled_cvars[0])); i++) Cvar_SetFlags(disabled_cvars[i].var, Cvar_GetFlags(disabled_cvars[i].var) & ~CVAR_ROM); @@ -235,6 +237,7 @@ static void Rulesets_Smackdown(qbool enable) rulesetDef.restrictPacket = false; rulesetDef.restrictParticles = false; rulesetDef.ruleset = rs_default; + rulesetDef.restrictRollAngle = false; } } @@ -274,6 +277,7 @@ static void Rulesets_Qcon(qbool enable) rulesetDef.restrictParticles = true; rulesetDef.restrictSound = true; rulesetDef.ruleset = rs_qcon; + rulesetDef.restrictRollAngle = true; } else { for (i = 0; i < (sizeof(disabled_cvars) / sizeof(disabled_cvars[0])); i++) Cvar_SetFlags(disabled_cvars[i].var, Cvar_GetFlags(disabled_cvars[i].var) & ~CVAR_ROM); @@ -287,6 +291,7 @@ static void Rulesets_Qcon(qbool enable) rulesetDef.restrictParticles = false; rulesetDef.restrictSound = false; rulesetDef.ruleset = rs_default; + rulesetDef.restrictRollAngle = false; } } static void Rulesets_Thunderdome(qbool enable) @@ -322,6 +327,7 @@ static void Rulesets_Thunderdome(qbool enable) rulesetDef.restrictPacket = true; // packet command could have been exploited for external timers rulesetDef.restrictParticles = false; rulesetDef.ruleset = rs_thunderdome; + rulesetDef.restrictRollAngle = true; } else { for (i = 0; i < (sizeof(disabled_cvars) / sizeof(disabled_cvars[0])); i++) Cvar_SetFlags(disabled_cvars[i].var, Cvar_GetFlags(disabled_cvars[i].var) & ~CVAR_ROM); @@ -334,6 +340,7 @@ static void Rulesets_Thunderdome(qbool enable) rulesetDef.restrictPacket = false; rulesetDef.restrictParticles = false; rulesetDef.ruleset = rs_default; + rulesetDef.restrictRollAngle = false; } } static void Rulesets_MTFL(qbool enable) @@ -383,6 +390,7 @@ static void Rulesets_MTFL(qbool enable) Cvar_SetFlags(limited_min_cvars[i].var, Cvar_GetFlags(limited_min_cvars[i].var) | CVAR_RULESET_MIN); } + rulesetDef.restrictRollAngle = false; rulesetDef.ruleset = rs_mtfl; } else { for (i = 0; i < (sizeof(disabled_cvars) / sizeof(disabled_cvars[0])); i++) @@ -394,6 +402,7 @@ static void Rulesets_MTFL(qbool enable) for (i = 0; i < (sizeof(limited_min_cvars) / sizeof(limited_min_cvars[0])); i++) Cvar_SetFlags(limited_min_cvars[i].var, Cvar_GetFlags(limited_min_cvars[i].var) & ~CVAR_RULESET_MIN); + rulesetDef.restrictRollAngle = false; rulesetDef.ruleset = rs_default; } } @@ -685,3 +694,14 @@ qbool Ruleset_AllowPolygonOffset(entity_t* ent) return ent->model && ent->model->isworldmodel; } } + +float Ruleset_RollAngle(void) +{ + extern cvar_t cl_rollangle; + + if (cls.demoplayback || cl.spectator || !rulesetDef.restrictRollAngle) { + return fabs(cl_rollangle.value); + } + + return bound(0.0f, cl_rollangle.value, 5.0f); +} diff --git a/rulesets.h b/rulesets.h index b6ae1ed8c..2dac20e73 100644 --- a/rulesets.h +++ b/rulesets.h @@ -51,6 +51,7 @@ typedef struct rulesetDef_s { qbool restrictPacket; qbool restrictParticles; qbool restrictSound; + qbool restrictRollAngle; } rulesetDef_t; void Rulesets_Init(void); @@ -78,3 +79,5 @@ void Rulesets_OnChange_allow_scripts (cvar_t *var, char *value, qbool *cancel); void Rulesets_OnChange_cl_fakeshaft (cvar_t *var, char *value, qbool *cancel); void Rulesets_OnChange_cl_delay_packet(cvar_t *var, char *value, qbool *cancel); void Rulesets_OnChange_cl_iDrive(cvar_t *var, char *value, qbool *cancel); + +float Ruleset_RollAngle(void);