Skip to content

Commit

Permalink
Merge pull request #945 from osm/add-ruleset-2024
Browse files Browse the repository at this point in the history
Add ruleset smackdrive
  • Loading branch information
tcsabina authored Nov 3, 2024
2 parents c3b9c43 + 22b5b6c commit bfa1f5b
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 11 deletions.
10 changes: 5 additions & 5 deletions help_variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@
"default": "1",
"desc": "Enables/Disables strings-hud.\nStrings hud is not mqwcl hud. It gives you ability put any string (or value of some variable) on your hud.",
"group-id": "40",
"remarks": "Strings hud banned for ruleset smackdown.",
"remarks": "Strings hud banned for ruleset smackdown and smackdrive.",
"type": "boolean",
"values": [
{
Expand Down Expand Up @@ -2521,7 +2521,7 @@
"default": "20",
"desc": "You can turn off the 'dodging' or 'rolling' effect for your own point of view while still see other player models affected by cl_rollangle.",
"group-id": "53",
"remarks": "0 disables, 1 is standard. Disabled by ruleset smackdown.",
"remarks": "0 disables, 1 is standard. Disabled by ruleset smackdown and smackdrive.",
"type": "integer"
},
"cl_rollangle": {
Expand Down Expand Up @@ -5142,7 +5142,7 @@
},
"gl_outline_scale_model": {
"default": "1",
"desc": "Determines the scale of model outlines. Allows values 0 to 1 for rulesets smackdown and qcon, and 0 to 5 for other rulesets.",
"desc": "Determines the scale of model outlines. Allows values 0 to 1 for rulesets smackdown, smackdrive and qcon, and 0 to 5 for other rulesets.",
"group-id": "35",
"remarks": "Requires vid_renderer 1",
"type": "float"
Expand Down Expand Up @@ -16516,7 +16516,7 @@
"default": "1",
"desc": "Adds transparency to the lightning gun beam (shaft).",
"group-id": "8",
"remarks": "Disabled in ruleset smackdown.",
"remarks": "Disabled in ruleset smackdown and smackdrive.",
"type": "float",
"values": [
{
Expand All @@ -16529,7 +16529,7 @@
"default": "0",
"desc": "Shift start of the shaft lights.",
"group-id": "8",
"remarks": "Doesn't work with smackdown ruleset. Intended for movies.",
"remarks": "Doesn't work with ruleset smackdown and smackdrive. Intended for movies.",
"type": "float"
},
"r_skincolormode": {
Expand Down
2 changes: 1 addition & 1 deletion src/menu_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ const char* s_desired_samples_enum[] = {
};

const char* cl_nolerp_enum[] = {"on", "off"};
const char* ruleset_enum[] = { "ezQuake default", "default", "Smackdown", "smackdown", "Thunderdome", "thunderdome", "Moscow TF League", "mtfl", "QuakeCon", "qcon" };
const char* ruleset_enum[] = { "ezQuake default", "default", "Smackdown", "smackdown", "Thunderdome", "thunderdome", "Moscow TF League", "mtfl", "QuakeCon", "qcon", "Smackdrive", "smackdrive" };
const char *mediaroot_enum[] = { "relative to exe", "relative to home", "full path" };
const char *teamforceskins_enum[] = { "off", "use player's name", "use player's userid", "set t1, t2, t3, ..." };
const char *enemyforceskins_enum[] = { "off", "use player's name", "use player's userid", "set e1, e2, e3, ..." };
Expand Down
75 changes: 71 additions & 4 deletions src/rulesets.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ qbool RuleSets_DisallowExternalTexture(struct model_s *mod)
case MOD_EYES:
return true;
case MOD_BACKPACK:
return rulesetDef.ruleset == rs_smackdown || rulesetDef.ruleset == rs_qcon;
return rulesetDef.ruleset == rs_smackdown || rulesetDef.ruleset == rs_qcon || rulesetDef.ruleset == rs_smackdrive;
default:
return false;
}
Expand All @@ -74,7 +74,7 @@ qbool RuleSets_DisallowSimpleTexture(model_t* mod)

case MOD_BACKPACK:
// Now allowed in Thunderdome...
return rulesetDef.ruleset == rs_smackdown || rulesetDef.ruleset == rs_qcon;
return rulesetDef.ruleset == rs_smackdown || rulesetDef.ruleset == rs_qcon || rulesetDef.ruleset == rs_smackdrive;

default:
return false; // replacement always allowed
Expand All @@ -94,10 +94,10 @@ qbool RuleSets_DisallowModelOutline(struct model_s *mod)
case MOD_THUNDERBOLT:
return true;
case MOD_BACKPACK:
return !cls.demoplayback && (rulesetDef.ruleset == rs_qcon || rulesetDef.ruleset == rs_smackdown);
return !cls.demoplayback && (rulesetDef.ruleset == rs_qcon || rulesetDef.ruleset == rs_smackdown || rulesetDef.ruleset == rs_smackdrive);
default:
// return to just rs_qcon once backface outlining tested
// return !cls.demoplayback && (rulesetDef.ruleset == rs_qcon || rulesetDef.ruleset == rs_smackdown);
// return !cls.demoplayback && (rulesetDef.ruleset == rs_qcon || rulesetDef.ruleset == rs_smackdown || rulesetDef.ruleset == rs_smackdrive);
return !cls.demoplayback && (rulesetDef.ruleset == rs_qcon);
}
}
Expand All @@ -108,6 +108,7 @@ float RuleSets_ModelOutlineScale(void) {
extern cvar_t gl_outline_scale_model;
switch(rulesetDef.ruleset) {
case rs_smackdown:
case rs_smackdrive:
case rs_qcon:
return bound(0.0f, gl_outline_scale_model.value, 1.0f);
default:
Expand All @@ -130,6 +131,7 @@ qbool Rulesets_AllowTimerefresh(void)
{
switch(rulesetDef.ruleset) {
case rs_smackdown:
case rs_smackdrive:
case rs_thunderdome:
case rs_qcon:
return (cl.standby || cl.spectator || cls.demoplayback);
Expand All @@ -143,6 +145,7 @@ qbool Rulesets_AllowNoShadows(void)
switch(rulesetDef.ruleset) {
case rs_mtfl:
case rs_smackdown:
case rs_smackdrive:
case rs_thunderdome:
case rs_qcon:
return false;
Expand Down Expand Up @@ -204,6 +207,7 @@ qbool Rulesets_RestrictTCL(void)
{
switch(rulesetDef.ruleset) {
case rs_smackdown:
case rs_smackdrive:
case rs_thunderdome:
case rs_qcon:
return true;
Expand All @@ -224,6 +228,8 @@ const char *Rulesets_Ruleset(void)
return "thunderdome";
case rs_qcon:
return "qcon";
case rs_smackdrive:
return "smackdrive";
default:
return "default";
}
Expand Down Expand Up @@ -459,6 +465,60 @@ static void Rulesets_MTFL(qbool enable)
}
}

static void Rulesets_Smackdrive(qbool enable)
{
extern cvar_t cl_independentPhysics, cl_c2spps;
extern cvar_t cl_hud;
extern cvar_t cl_rollalpha;
extern cvar_t r_shiftbeam;
extern cvar_t allow_scripts;
extern cvar_t scr_allowsnap;
int i;

locked_cvar_t disabled_cvars[] = {
{&allow_scripts, "0"}, // disable movement scripting
{&cl_hud, "0"}, // allows you place any text on the screen & filter incoming messages (hud strings)
{&cl_rollalpha, "20"}, // allows you to not dodge while seeing enemies dodging
{&r_shiftbeam, "0"}, // perphaps some people would think this allows you to aim better (maybe should be added for demo playback and spectating only)
{&scr_allowsnap, "1"}
};

if (enable) {
for (i = 0; i < (sizeof(disabled_cvars) / sizeof(disabled_cvars[0])); i++) {
Cvar_RulesetSet(disabled_cvars[i].var, disabled_cvars[i].value, 2);
Cvar_Set(disabled_cvars[i].var, disabled_cvars[i].value);
Cvar_SetFlags(disabled_cvars[i].var, Cvar_GetFlags(disabled_cvars[i].var) | CVAR_ROM);
}

if (cl_independentPhysics.value) {
Cvar_Set(&cl_c2spps, "0"); // people were complaining that player move is jerky with this. however this has not much to do with independent physics, but people are too paranoid about it
Cvar_SetFlags(&cl_c2spps, Cvar_GetFlags(&cl_c2spps) | CVAR_ROM);
}

rulesetDef.maxfps = 77;
rulesetDef.restrictTriggers = true;
rulesetDef.restrictPacket = true; // packet command could have been exploited for external timers
rulesetDef.restrictParticles = true;
rulesetDef.restrictLogging = true;
rulesetDef.restrictRollAngle = true;
rulesetDef.ruleset = rs_smackdrive;
} 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);

if (cl_independentPhysics.value)
Cvar_SetFlags(&cl_c2spps, Cvar_GetFlags(&cl_c2spps) & ~CVAR_ROM);

rulesetDef.maxfps = 72.0;
rulesetDef.restrictTriggers = false;
rulesetDef.restrictPacket = false;
rulesetDef.restrictParticles = false;
rulesetDef.restrictLogging = false;
rulesetDef.restrictRollAngle = false;
rulesetDef.ruleset = rs_default;
}
}

static void Rulesets_Default(void)
{
rulesetDef.ruleset = rs_default;
Expand Down Expand Up @@ -670,6 +730,7 @@ static void Rulesets_OnChange_ruleset(cvar_t *var, char *value, qbool *cancel)
strncasecmp(value, "thunderdome", sizeof("thunderdome")) &&
strncasecmp(value, "mtfl", sizeof("mtfl")) &&
strncasecmp(value, "qcon", sizeof("qcon")) &&
strncasecmp(value, "smackdrive", sizeof("smackdrive")) &&
strncasecmp(value, "default", sizeof("default"))) {
Com_Printf_State(PRINT_INFO, "Unknown ruleset \"%s\"\n", value);
*cancel = true;
Expand All @@ -690,6 +751,8 @@ static void Rulesets_OnChange_ruleset(cvar_t *var, char *value, qbool *cancel)
case rs_thunderdome:
Rulesets_Thunderdome(false);
break;
case rs_smackdrive:
Rulesets_Smackdrive(false);
case rs_default:
break;
default:
Expand All @@ -711,6 +774,9 @@ static void Rulesets_OnChange_ruleset(cvar_t *var, char *value, qbool *cancel)
} else if (!strncasecmp(value, "qcon", sizeof("qcon"))) {
Rulesets_Qcon(true);
Com_Printf_State(PRINT_OK, "Ruleset Qcon initialized\n");
} else if (!strncasecmp(value, "smackdrive", sizeof("smackdrive"))) {
Rulesets_Smackdrive(true);
Com_Printf_State(PRINT_OK, "Ruleset Smackdrive initialized\n");
} else if (!strncasecmp(value, "default", sizeof("default"))) {
Rulesets_Default();
Com_Printf_State(PRINT_OK, "Ruleset default initialized\n");
Expand Down Expand Up @@ -740,6 +806,7 @@ qbool Ruleset_BlockHudPicChange(void)
switch (rulesetDef.ruleset) {
case rs_qcon:
case rs_smackdown:
case rs_smackdrive:
case rs_thunderdome:
return cls.state != ca_disconnected && !(cl.standby || cl.spectator || cls.demoplayback);
default:
Expand Down
3 changes: 2 additions & 1 deletion src/rulesets.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ typedef enum {
rs_smackdown,
rs_thunderdome,
rs_qcon,
rs_mtfl
rs_mtfl,
rs_smackdrive
} ruleset_t;

void Rulesets_Init(void);
Expand Down

0 comments on commit bfa1f5b

Please sign in to comment.