]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
sv_main: Add campaign cvar. Set 1 if not coop or deathmatch (Quake rerelease compatib...
authorCloudwalk <cloudwalk009@gmail.com>
Fri, 20 Aug 2021 14:22:20 +0000 (10:22 -0400)
committerCloudwalk <cloudwalk009@gmail.com>
Fri, 20 Aug 2021 14:22:20 +0000 (10:22 -0400)
sv_main.c

index 4479a30e6a77ad4e2eb0a46cee9bd8f4751cb243..ba0c5d525e3416d05719684870a7120802f7e0a7 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -50,6 +50,7 @@ cvar_t pausable = {CF_SERVER, "pausable","1", "allow players to pause or not (ot
 cvar_t pr_checkextension = {CF_SERVER | CF_READONLY, "pr_checkextension", "1", "indicates to QuakeC that the standard quakec extensions system is available (if 0, quakec should not attempt to use extensions)"};
 cvar_t samelevel = {CF_SERVER | CF_NOTIFY, "samelevel","0", "repeats same level if level ends (due to timelimit or someone hitting an exit)"};
 cvar_t skill = {CF_SERVER, "skill","1", "difficulty level of game, affects monster layouts in levels, 0 = easy, 1 = normal, 2 = hard, 3 = nightmare (same layout as hard but monsters fire twice)"};
+cvar_t campaign = {CF_SERVER, "campaign", "0", "singleplayer mode"};
 cvar_t host_timescale = {CF_CLIENT | CF_SERVER, "host_timescale", "1.0", "controls game speed, 0.5 is half speed, 2 is double speed"};
 
 cvar_t sv_accelerate = {CF_SERVER, "sv_accelerate", "10", "rate at which a player accelerates to sv_maxspeed"};
@@ -524,6 +525,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&pr_checkextension);
        Cvar_RegisterVariable (&samelevel);
        Cvar_RegisterVariable (&skill);
+       Cvar_RegisterVariable (&campaign);
        Cvar_RegisterVariable (&host_timescale);
        Cvar_RegisterCallback (&host_timescale, Host_Timescale_c);
        Cvar_RegisterVirtual (&host_timescale, "slowmo");
@@ -1863,8 +1865,16 @@ void SV_SpawnServer (const char *map)
 //
 // make cvars consistant
 //
+
        if (coop.integer)
+       {
                Cvar_SetValueQuick(&deathmatch, 0);
+               Cvar_SetValueQuick(&campaign, 0);
+       }
+       else if(!deathmatch.integer)
+               Cvar_SetValueQuick(&campaign, 1);
+       else
+               Cvar_SetValueQuick(&campaign, 0);
        // LadyHavoc: it can be useful to have skills outside the range 0-3...
        //current_skill = bound(0, (int)(skill.value + 0.5), 3);
        //Cvar_SetValue ("skill", (float)current_skill);