diff options
| author | Mittendrein Markus <maxmitti@gmx.net> | 2015-08-26 22:47:46 +0200 |
|---|---|---|
| committer | Mittendrein Markus <maxmitti@gmx.net> | 2015-09-03 19:22:38 +0200 |
| commit | 736efdaf6aea46dc44322e84656a7a489face44a (patch) | |
| tree | 58803fed93d6fef0f7ff01d6d7476ff4a3b16d9e /TemplePushing.c4s/Script.c | |
| parent | 14ea123b3950acd08d136ee0a6a23201df074756 (diff) | |
| download | tempelschubsen-736efdaf6aea46dc44322e84656a7a489face44a.tar.gz tempelschubsen-736efdaf6aea46dc44322e84656a7a489face44a.zip | |
Add GameComments to show current game state
Diffstat (limited to 'TemplePushing.c4s/Script.c')
| -rw-r--r-- | TemplePushing.c4s/Script.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/TemplePushing.c4s/Script.c b/TemplePushing.c4s/Script.c index 197757c..a75c6cf 100644 --- a/TemplePushing.c4s/Script.c +++ b/TemplePushing.c4s/Script.c @@ -154,11 +154,14 @@ func UpdateScoreboard(int player, bool leaver) SortScoreboard(SBRD_ScoreCol, true); if (!deathmatchEnabled) SortScoreboard(SBRD_RelaunchesCol, true); SortScoreboard(SBRD_SortCol); + + UpdateComment(); } func ShowLobby() { LoadScenarioSection("Lobby"); + UpdateComment(true); } func SetupDone(object menu, string message) @@ -719,3 +722,41 @@ func ToggleAmbienceSounds(int player) SetPlrExtraData(player, PlrData_EnableAmbienceSounds, preference); DoAmbienceSounds(player); } + +func UpdateComment(bool inLobby) +{ + if (inLobby) SetGameComment(" $LobbyComment$"); + else + { + var score = ""; + var teams = []; + var teamRelaunches = []; + for (var i = 0; i < GetPlayerCount(); i++) + { + if (!eliminatedPlayers[GetPlayerID(GetPlayerByIndex(i))]) + { + ++teams[GetPlayerTeam(GetPlayerByIndex(i))]; + if (!deathmatchEnabled) teamRelaunches[GetPlayerTeam(GetPlayerByIndex(i))] += numRelaunches - playerDeaths[GetPlayerID(GetPlayerByIndex(i))]; + } + } + + for (var i = 1; i <= GetTeamCount(); ++i) + { + if (teams[i]) + { + if (GetLength(score)) score = Format("%s : ", score); + if (deathmatchEnabled) score = Format("%s<c %x>%d</c>", score, GetTeamColor(i), teamScore[i]); + else score = Format("%s<c %x>%d</c>", score, GetTeamColor(i), teamRelaunches[i]); + } + } + + var modes = SPMU->GetModes(); + var sudden = ""; + if(suddendeathEnabled) sudden = " $SuddenDeath$"; + var goalDesc; + if(deathmatchEnabled) goalDesc = Format("$DM$", deathmatchWinScore); + else goalDesc = Format("$LMS$", numRelaunches); + + SetGameComment(Format(" $GameComment$", GetName(0, sectionID), modes[mode][1], sudden, goalDesc, score)); + } +} |
