]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
set mayhem_fraglimit to respect fraglimit_override and set menu to use fraglimit_over...
authordrjaska <drjaska83@gmail.com>
Sat, 29 Jan 2022 06:26:30 +0000 (08:26 +0200)
committerdrjaska <drjaska83@gmail.com>
Sat, 29 Jan 2022 06:26:30 +0000 (08:26 +0200)
qcsrc/common/gamemodes/gamemode/mayhem/mayhem.qh
qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc
qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc
qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh

index e853d35532bef99fa691e423f1bb7cc8e1e54efc..19de29f035151685879278c2b977846a42a0b89e 100644 (file)
@@ -26,7 +26,7 @@ CLASS(mayhem, Gametype)
        METHOD(mayhem, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns))
     {
         TC(Gametype, this);
-        returns(menu, _("Frag limit:"),     5,  100,  5, "g_mayhem_fraglimit",         string_null,         _("How many frags worth of score is needed before the match will end"));
+        returns(menu, _("Frag limit:"),     5,  100,  5, "fraglimit_override",         string_null,         _("How many frags worth of score is needed before the match will end"));
     }
     ATTRIB(mayhem, m_legacydefaults, string, "30 20 0");
 ENDCLASS(mayhem)
index 7a8ae68e35507cf0b0e1440397a3155099257d3e..035718794e9ceb806615b7399c73dc7948ec55a9 100644 (file)
@@ -3,7 +3,6 @@
 
 float autocvar_g_mayhem_fraglimit;
 float autocvar_g_mayhem_visual_score_limit;
-float mayhempointmultiplier;
 
 bool autocvar_g_mayhem_regenerate;
 string autocvar_g_mayhem_weaponarena;
@@ -35,10 +34,10 @@ void mayhem_DelayedInit(entity this)
 
 void mayhem_Initialize()
 {
-       if(autocvar_g_mayhem_visual_score_limit > 0 && autocvar_g_mayhem_fraglimit > 0)
-               mayhempointmultiplier = autocvar_g_mayhem_visual_score_limit / autocvar_g_mayhem_fraglimit;
-
-       GameRules_limit_score(autocvar_g_mayhem_visual_score_limit);
+       if (autocvar_fraglimit_override != 0)
+               GameRules_limit_score(autocvar_g_mayhem_visual_score_limit);
+       else
+               GameRules_limit_score(9999);
 
        InitializeEntity(NULL, mayhem_DelayedInit, INITPRIO_GAMETYPE);
 }
@@ -52,7 +51,7 @@ MUTATOR_HOOKFUNCTION(mayhem, Scores_CountFragsRemaining)
 MUTATOR_HOOKFUNCTION(mayhem, SetStartItems)
 {
        start_items       &= ~(IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS);
-       if(!cvar("g_use_ammunition") || autocvar_g_mayhem_unlimited_ammo)
+       if (!cvar("g_use_ammunition") || autocvar_g_mayhem_unlimited_ammo)
                start_items |= IT_UNLIMITED_AMMO;
 
        start_health       = warmup_start_health       = autocvar_g_mayhem_start_health;
@@ -68,7 +67,7 @@ MUTATOR_HOOKFUNCTION(mayhem, SetStartItems)
 //this hook also enables rotting, as players spawn with more hp and armor than what default rot limits are set to this is a bad idea as of now
 MUTATOR_HOOKFUNCTION(mayhem, PlayerRegen)
 {
-       if(autocvar_g_mayhem_regenerate)
+       if (autocvar_g_mayhem_regenerate)
                return false;
        return true;
 }
@@ -130,7 +129,10 @@ MUTATOR_HOOKFUNCTION(mayhem, Damage_Calculate)
        M_ARGV(4, float) = frag_damage;
 }
 
-void FFAMayhemCalculatePlayerScore(entity scorer){
+void FFAMayhemCalculatePlayerScore(entity scorer)
+{
+       if (autocvar_fraglimit_override > 0) autocvar_g_mayhem_fraglimit = autocvar_fraglimit_override;
+       
        switch (autocvar_g_mayhem_scoringmethod)
        {
                default:
index 4c9e7f85d32a6ac54eaca6cabae56593cd5e2f22..22914adc1e2d3992f800d7faa69a03ef8c14a42d 100644 (file)
@@ -4,7 +4,6 @@ float autocvar_g_tmayhem_fraglimit;
 float autocvar_g_tmayhem_visual_score_limit;
 float autocvar_g_tmayhem_score_leadlimit;
 bool autocvar_g_tmayhem_team_spawns;
-float tmayhempointmultiplier;
 
 // TODO? rename to teammayhem? requires checking alias and other string lengths
 int autocvar_g_tmayhem_teams;
@@ -47,7 +46,7 @@ void tmayhem_SpawnTeam (string teamname, int teamcolor)
 void tmayhem_DelayedInit(entity this)
 {
        // if no teams are found, spawn defaults
-       if(find(NULL, classname, "tmayhem_team") == NULL)
+       if (find(NULL, classname, "tmayhem_team") == NULL)
        {
                LOG_TRACE("No \"tmayhem_team\" entities found on this map, creating them anyway.");
 
@@ -68,14 +67,15 @@ void tmayhem_DelayedInit(entity this)
 
 void tmayhem_Initialize()
 {
-       if(autocvar_g_tmayhem_visual_score_limit != 0 && autocvar_g_tmayhem_fraglimit != 0)
-               tmayhempointmultiplier = autocvar_g_tmayhem_visual_score_limit / autocvar_g_tmayhem_fraglimit;
-
        GameRules_teams(true);
        GameRules_spawning_teams(autocvar_g_tmayhem_team_spawns);
-       GameRules_limit_score(autocvar_g_tmayhem_visual_score_limit);
        GameRules_limit_lead(autocvar_g_tmayhem_score_leadlimit);
 
+       if (autocvar_fraglimit_override != 0)
+               GameRules_limit_score(autocvar_g_tmayhem_visual_score_limit);
+       else
+               GameRules_limit_score(9999);
+
        InitializeEntity(NULL, tmayhem_DelayedInit, INITPRIO_GAMETYPE);
 }
 // code up to here is just to support maps that don't have team entities
@@ -94,7 +94,7 @@ MUTATOR_HOOKFUNCTION(tmayhem, Scores_CountFragsRemaining)
 MUTATOR_HOOKFUNCTION(tmayhem, SetStartItems)
 {
        start_items       &= ~(IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS);
-       if(!cvar("g_use_ammunition") || autocvar_g_tmayhem_unlimited_ammo)
+       if (!cvar("g_use_ammunition") || autocvar_g_tmayhem_unlimited_ammo)
                start_items |= IT_UNLIMITED_AMMO;
 
        start_health       = warmup_start_health       = autocvar_g_tmayhem_start_health;
@@ -110,7 +110,7 @@ MUTATOR_HOOKFUNCTION(tmayhem, SetStartItems)
 //this hook also enables rotting, as players spawn with more hp and armor than what default rot limits are set to this is a bad idea as of now until PlayerRegen is changed
 MUTATOR_HOOKFUNCTION(tmayhem, PlayerRegen)
 {
-       if(autocvar_g_tmayhem_regenerate)
+       if (autocvar_g_tmayhem_regenerate)
                return false;
        return true;
 }
@@ -178,7 +178,10 @@ MUTATOR_HOOKFUNCTION(tmayhem, Damage_Calculate)
        M_ARGV(5, float) = frag_mirrordamage;
 }
 
-void TeamMayhemCalculatePlayerScore(entity scorer){
+void TeamMayhemCalculatePlayerScore(entity scorer)
+{
+       if (autocvar_fraglimit_override > 0) autocvar_g_tmayhem_fraglimit = autocvar_fraglimit_override;
+       
        switch (autocvar_g_tmayhem_scoringmethod)
        {
                default:
index 0e18d05d2742b6759d0eaa4de2109ac306bf5f35..dd4fa6e3782e9aab5de9eda4c53fa6d98725210a 100644 (file)
@@ -43,7 +43,7 @@ CLASS(tmayhem, Gametype)
     METHOD(tmayhem, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns))
     {
         TC(Gametype, this);
-        returns(menu, _("Frag limit:"),     5,  100,  5, "g_tmayhem_fraglimit",         "g_tmayhem_teams_override",         _("How many frags worth of score is needed before the match will end"));
+        returns(menu, _("Frag limit:"),     5,  100,  5, "fraglimit_override",         "g_tmayhem_teams_override",         _("How many frags worth of score is needed before the match will end"));
     }
     ATTRIB(tmayhem, m_legacydefaults, string, "50 20 2 0");
 ENDCLASS(tmayhem)