Merge branch 'master' into TimePath/scoreboard_elo
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 6 Aug 2016 06:59:04 +0000 (16:59 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 6 Aug 2016 06:59:04 +0000 (16:59 +1000)
# Conflicts:
# .gitlab-ci.yml
# qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
# qcsrc/server/mutators/mutator/gamemode_freezetag.qc
# qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
# qcsrc/server/scores_rules.qc

22 files changed:
1  2 
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/hud/panel/modicons.qc
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/client/scoreboard.qc
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/dpdefs/doc.md
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qh
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/mutators/mutator/gamemode_race.qc
qcsrc/server/scores.qc
qcsrc/server/scores_rules.qc

@@@ -93,16 -114,16 +114,16 @@@ void HUD_InfoMessages(
                        {
                                entity sk;
                                sk = playerslots[player_localnum];
 -                              if(sk.(scores[ps_primary]) >= 666)
 +                              if(sk.(scores(ps_primary)) >= 666)
                                        s = _("^1Match has already begun");
 -                              else if(sk.(scores[ps_primary]) > 0)
 +                              else if(sk.(scores(ps_primary)) > 0)
                                        s = _("^1You have no more lives left");
                                else
-                                       s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey("jump", "+jump"));
+                                       s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey(_("jump"), "+jump"));
                        }
                        else
-                               s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey("jump", "+jump"));
-                       drawInfoMessage(s);
+                               s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey(_("jump"), "+jump"));
+                       InfoMessage(s);
                }
  
                if (time < STAT(GAMESTARTTIME))
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -70,7 -70,9 +70,7 @@@ float OtherTeam(float t)  //works only 
  }
  
  const float ST_NEXBALL_GOALS = 1;
- void nb_ScoreRules(float teams)
 -const float SP_NEXBALL_GOALS = 4;
 -const float SP_NEXBALL_FAULTS = 5;
+ void nb_ScoreRules(int teams)
  {
        ScoreRules_basics(teams, 0, 0, true);
        ScoreInfo_SetLabel_TeamScore(   ST_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
@@@ -2249,9 -2229,14 +2227,14 @@@ spawnfunc(onslaught_generator
  void ons_ScoreRules()
  {
        CheckAllowedTeams(NULL);
-       ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, 0, true);
+       int teams = 0;
+       if(c1 >= 0) teams |= BIT(0);
+       if(c2 >= 0) teams |= BIT(1);
+       if(c3 >= 0) teams |= BIT(2);
+       if(c4 >= 0) teams |= BIT(3);
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
        ScoreInfo_SetLabel_TeamScore  (ST_ONS_CAPS,     "destroyed", SFL_SORT_PRIO_PRIMARY);
 -      ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS,     "caps",      SFL_SORT_PRIO_SECONDARY);
 +      ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS,    "caps",      SFL_SORT_PRIO_SECONDARY);
        ScoreInfo_SetLabel_PlayerScore(SP_ONS_TAKES,    "takes",     0);
        ScoreRules_basics_end();
  }
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -61,7 -61,8 +61,7 @@@ int autocvar_g_freezetag_teams
  int autocvar_g_freezetag_teams_override;
  float autocvar_g_freezetag_warmup;
  
- void freezetag_ScoreRules(float teams)
 -const float SP_FREEZETAG_REVIVALS = 4;
+ void freezetag_ScoreRules(int teams)
  {
        ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true); // SFL_SORT_PRIO_PRIMARY
        ScoreInfo_SetLabel_PlayerScore(SP_FREEZETAG_REVIVALS, "revivals", 0);
@@@ -138,7 -138,13 +138,7 @@@ float kh_interferemsg_time, kh_interfer
  float kh_key_dropped, kh_key_carried;
  
  const float ST_KH_CAPS = 1;
- void kh_ScoreRules(float teams)
 -const float SP_KH_CAPS = 4;
 -const float SP_KH_PUSHES = 5;
 -const float SP_KH_DESTROYS = 6;
 -const float SP_KH_PICKUPS = 7;
 -const float SP_KH_KCKILLS = 8;
 -const float SP_KH_LOSSES = 9;
+ void kh_ScoreRules(int teams)
  {
        ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
        ScoreInfo_SetLabel_TeamScore(  ST_KH_CAPS,      "caps",      SFL_SORT_PRIO_SECONDARY);
Simple merge
@@@ -3,17 -3,30 +3,30 @@@
  #include "cl_client.qh"
  #include "scores.qh"
  
+ int ScoreRules_teams;
  void CheckAllowedTeams (entity for_whom);
  
 -// NOTE: SP_ constants may not be >= MAX_SCORE; ST_constants may not be >= MAX_TEAMSCORE
+ int NumTeams(int teams)
+ {
+       return boolean(teams & BIT(0)) + boolean(teams & BIT(1)) + boolean(teams & BIT(2)) + boolean(teams & BIT(3));
+ }
+ int AvailableTeams()
+ {
+       return NumTeams(ScoreRules_teams);
+       // NOTE: this method is unreliable, as forced teams set the c* globals to weird values
+       //return boolean(c1 >= 0) + boolean(c2 >= 0) + boolean(c3 >= 0) + boolean(c4 >= 0);
+ }
 +// NOTE: ST_constants may not be >= MAX_TEAMSCORE
  // scores that should be in all modes:
- float ScoreRules_teams;
- void ScoreRules_basics(float teams, float sprio, float stprio, float score_enabled)
+ void ScoreRules_basics(int teams, float sprio, float stprio, float score_enabled)
  {
 -      float i;
 -      for(i = 0; i < MAX_SCORE; ++i)
 -              ScoreInfo_SetLabel_PlayerScore(i, "", 0);
 -      for(i = 0; i < MAX_TEAMSCORE; ++i)
 +      FOREACH(Scores, true, {
 +              ScoreInfo_SetLabel_PlayerScore(it, "", 0);
 +    });
 +      for(int i = 0; i < MAX_TEAMSCORE; ++i)
                ScoreInfo_SetLabel_TeamScore(i, "", 0);
  
        ScoreRules_teams = teams;