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 +++++++++++++++++++++++++++- TemplePushing.c4s/StringTblDE.txt | 9 +++++- TemplePushing.c4s/StringTblUS.txt | 9 +++++- TemplePushing.c4s/System.c4g/Compatibility.c | 5 ++++ 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 TemplePushing.c4s/System.c4g/Compatibility.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)); + } +} diff --git a/TemplePushing.c4s/StringTblDE.txt b/TemplePushing.c4s/StringTblDE.txt index 6250fbe..709493f 100644 --- a/TemplePushing.c4s/StringTblDE.txt +++ b/TemplePushing.c4s/StringTblDE.txt @@ -11,4 +11,11 @@ Kills=Kills WinScore=Ziel MsgDeathmatchWin=Team %s erringt den Sieg. Win=Sieg -Rematch=Startet eine weitere Runde Tempelschubsen. \ No newline at end of file +Rematch=Startet eine weitere Runde Tempelschubsen. + +# GameComment-Strings +LobbyComment= Es wird noch eingestellt… +SuddenDeath=mit Sudden Death +DM=DM mit %d Punkten +LMS=LMS mit %d Relaunches +GameComment=Tempel: %s| Modus: %s%s| Ziel: %s| Spielstand: %s diff --git a/TemplePushing.c4s/StringTblUS.txt b/TemplePushing.c4s/StringTblUS.txt index 98deff7..320ad3d 100644 --- a/TemplePushing.c4s/StringTblUS.txt +++ b/TemplePushing.c4s/StringTblUS.txt @@ -11,4 +11,11 @@ Kills=Kills WinScore=Goal MsgDeathmatchWin=Team %s wins the match. Win=Win -Rematch=Starts another round of Temple Pushing. \ No newline at end of file +Rematch=Starts another round of Temple Pushing. + +# GameComment-Strings +LobbyComment= Settings are still being chosen… +SuddenDeath=with sudden death +DM=DM with %d points +LMS=LMS with %d relaunches +GameComment=Temple: %s| Mode: %s%s| Goal: %s| Score: %s diff --git a/TemplePushing.c4s/System.c4g/Compatibility.c b/TemplePushing.c4s/System.c4g/Compatibility.c new file mode 100644 index 0000000..5d3865e --- /dev/null +++ b/TemplePushing.c4s/System.c4g/Compatibility.c @@ -0,0 +1,5 @@ +/*-- Avoid errors from non-existent Engine-Functions --*/ + +#strict 2 + +global func SetGameComment() { return _inherited(...); } -- cgit v1.2.3-54-g00ecf