From 29726293c49ba1c3a4bd6d5c9ab09a1f6942ad1d Mon Sep 17 00:00:00 2001 From: Mittendrein Markus Date: Wed, 26 Aug 2015 22:47:46 +0200 Subject: Add GameComments to show current game state --- TemplePushing.c4s/Script.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'TemplePushing.c4s/Script.c') diff --git a/TemplePushing.c4s/Script.c b/TemplePushing.c4s/Script.c index b01d6e4..41b1bca 100644 --- a/TemplePushing.c4s/Script.c +++ b/TemplePushing.c4s/Script.c @@ -156,11 +156,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) @@ -674,4 +677,42 @@ func ToggleAmbienceSounds(int player) SetPlrExtraData(player, PlrData_EnableAmbienceSounds, preference); DoAmbienceSounds(player); -} \ No newline at end of file +} + +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 = 0; i <= GetTeamCount(); ++i) + { + var team = GetTeamByIndex(i); + if (teams[team]) + { + if (GetLength(score)) score = Format("%s : ", score); + if (deathmatchEnabled) score = Format("%s%d", score, GetTeamColor(team), teamScore[team]); + else score = Format("%s%d", score, GetTeamColor(team), teamRelaunches[team]); + } + } + + 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), mode->ModeName(), sudden, goalDesc, score)); + } +} -- cgit v1.2.3-54-g00ecf