1010class MonsterBoard extends TournamentScoreBoard ;
1111
1212var color LightGreenColor , DarkGreenColor ;
13+ var localized String MonsterDifficultyJoinString , ObjectivesString ;
1314
1415function DrawHeader (canvas Canvas ) {
1516 local GameReplicationInfo GRI ;
@@ -57,47 +58,58 @@ function DrawTrailer(canvas Canvas) {
5758 local int Hours , Minutes , Seconds ;
5859 local float XL , YL ;
5960 local PlayerPawn PlayerOwner ;
60- local string TitleQuote ;
61+ local GameReplicationInfo GRI ;
62+ local string TitleQuote , DifficultyQuote ;
6163
6264 Canvas .bCenter = true ;
6365 Canvas .StrLen ("Test" , XL , YL );
6466 Canvas .DrawColor = LightGreenColor ;
65- PlayerOwner = PlayerPawn (Owner );
6667 Canvas .SetPos (0 , Canvas .ClipY - 2 * YL );
6768
68- if ((Level .NetMode == NM_Standalone ) && Level .Game .IsA ('DeathMatchPlus' )) {
69- TitleQuote = PlayerOwner .GameReplicationInfo .GameName @ MapTitle @ MapTitleQuote $ Level .Title $ MapTitleQuote ;
70- if (DeathMatchPlus (Level .Game ).bRatedGame ) {
71- Canvas .DrawText (DeathMatchPlus (Level .Game ).RatedGameLadderObj .SkillText @ TitleQuote , true );
72- } else if (DeathMatchPlus (Level .Game ).bNoviceMode ) {
73- Canvas .DrawText (class 'ChallengeBotInfo' .default .Skills [Level .Game .Difficulty ] @ TitleQuote , true );
69+ PlayerOwner = PlayerPawn (Owner );
70+ GRI = PlayerPawn (Owner ).GameReplicationInfo ;
71+
72+ if (Level .Game .IsA ('MonsterHunt' ) && GRI .IsA ('MonsterReplicationInfo' )) {
73+ DifficultyQuote = class 'MonsterHuntRules' .default .Skills [
74+ class 'MonsterHuntRules' .static .TranslateMonsterSkillIndex (MonsterReplicationInfo (GRI ).MonsterSkill )
75+ ] @ MonsterDifficultyJoinString ;
76+ } else {
77+ DifficultyQuote = "" ;
78+ }
79+
80+ if ((Level .NetMode == NM_Standalone ) && Level .Game .IsA ('MonsterHunt' )) {
81+ TitleQuote = GRI .GameName @ MapTitle @ MapTitleQuote $ Level .Title $ MapTitleQuote ;
82+ if (DeathMatchPlus (Level .Game ).bNoviceMode ) {
83+ TitleQuote = class 'ChallengeBotInfo' .default .Skills [Level .Game .Difficulty ] @ TitleQuote ;
7484 } else {
75- Canvas . DrawText ( class 'ChallengeBotInfo' .default .Skills [Level .Game .Difficulty + 4 ] @ TitleQuote , true ) ;
85+ TitleQuote = class 'ChallengeBotInfo' .default .Skills [Level .Game .Difficulty + 4 ] @ TitleQuote ;
7686 }
7787 } else {
78- Canvas . DrawText ( PlayerOwner . GameReplicationInfo . GameName @ MapTitle @ Level .Title , true ) ;
88+ TitleQuote = GRI . GameName @ MapTitle @ Level .Title ;
7989 }
8090
91+ Canvas .DrawText (DifficultyQuote @ TitleQuote , true );
92+
8193 Canvas .SetPos (0 , Canvas .ClipY - YL );
82- if (bTimeDown || (PlayerOwner . GameReplicationInfo .RemainingTime > 0 )) {
94+ if (bTimeDown || (GRI .RemainingTime > 0 )) {
8395 bTimeDown = true ;
84- if (PlayerOwner . GameReplicationInfo .RemainingTime <= 0 ) {
96+ if (GRI .RemainingTime <= 0 ) {
8597 Canvas .DrawText (RemainingTime @ "00:00" , true );
8698 } else {
87- Minutes = PlayerOwner . GameReplicationInfo .RemainingTime / 60 ;
88- Seconds = PlayerOwner . GameReplicationInfo .RemainingTime % 60 ;
99+ Minutes = GRI .RemainingTime / 60 ;
100+ Seconds = GRI .RemainingTime % 60 ;
89101 Canvas .DrawText (RemainingTime @ TwoDigitString (Minutes ) $ ":" $ TwoDigitString (Seconds ), true );
90102 }
91103 } else {
92- Seconds = PlayerOwner . GameReplicationInfo .ElapsedTime ;
104+ Seconds = GRI .ElapsedTime ;
93105 Minutes = Seconds / 60 ;
94106 Hours = Minutes / 60 ;
95107 Seconds = Seconds - (Minutes * 60 );
96108 Minutes = Minutes - (Hours * 60 );
97109 Canvas .DrawText (ElapsedTime @ TwoDigitString (Hours ) $ ":" $ TwoDigitString (Minutes ) $ ":" $ TwoDigitString (Seconds ), true );
98110 }
99111
100- if (PlayerOwner . GameReplicationInfo .GameEndedComments != "" ) {
112+ if (GRI .GameEndedComments != "" ) {
101113 Canvas .bCenter = true ;
102114 Canvas .StrLen ("Test" , XL , YL );
103115 Canvas .SetPos (0 , Canvas .ClipY - Min (YL * 6 , Canvas .ClipY * 0.1 ));
@@ -112,6 +124,8 @@ function DrawTrailer(canvas Canvas) {
112124 Canvas .DrawText (Restart , true );
113125 }
114126 Canvas .bCenter = false ;
127+
128+ DrawObjectivesList (Canvas );
115129}
116130
117131function DrawCategoryHeaders (Canvas Canvas ) {
@@ -196,96 +210,65 @@ function DrawNameAndPing(Canvas Canvas, PlayerReplicationInfo PRI, float XOffset
196210 }
197211}
198212
199- function SortScores(int N) {
200- local int I, J, Max;
201- local PlayerReplicationInfo TempPRI;
202-
203- for (I = 0; I < N - 1; I++) {
204- Max = I;
205- for (J = I + 1; J < N; J++) {
206- if (Ordered[J].Score > Ordered[Max].Score) {
207- Max = J;
208- } else if ((Ordered[J].Score == Ordered[Max].Score) && (Ordered[J].Deaths < Ordered[Max].Deaths)) {
209- Max = J;
210- } else if ((Ordered[J].Score == Ordered[Max].Score) && (Ordered[J].Deaths == Ordered[Max].Deaths)
211- && (Ordered[J].PlayerID < Ordered[Max].Score)) {
212- Max = J;
213- }
214- }
213+ function DrawObjectivesList(Canvas Canvas) {
214+ local float XL, YL, YOffset, XOffset;
215+ local int i;
216+ local MonsterReplicationInfo mri;
217+ local MonsterHuntObjective obj;
218+ local bool wasObjectives;
215219
216- TempPRI = Ordered[Max];
217- Ordered[Max] = Ordered[I];
218- Ordered[I] = TempPRI;
219- }
220- }
220+ if (PlayerPawn(Owner) == None) return;
221221
222- function ShowScores(canvas Canvas) {
223- local PlayerReplicationInfo PRI;
224- local int PlayerCount, i;
225- local float XL, YL;
226- local float YOffset, YStart;
227- local font CanvasFont;
222+ mri = MonsterReplicationInfo(PlayerPawn(Owner).GameReplicationInfo);
228223
229- Canvas.Style = ERenderStyle.STY_Normal ;
224+ if (mri == None) return ;
230225
231- // Header
232- Canvas.SetPos(0, 0);
233- DrawHeader(Canvas);
226+ Canvas.Font = MyFonts.GetBigFont(Canvas.ClipX);
227+ Canvas.StrLen(" Test ", XL, YL);
234228
235- // Wipe everything.
236- for (i = 0; i < ArrayCount(Ordered); i++) Ordered[i] = None;
237- for (i = 0; i < 32; i++) {
238- if (PlayerPawn(Owner).GameReplicationInfo.PRIArray[i] != None) {
239- PRI = PlayerPawn(Owner).GameReplicationInfo.PRIArray[i];
240- if (!PRI.bIsSpectator || PRI.bWaitingPlayer) {
241- Ordered[PlayerCount] = PRI;
242- PlayerCount++;
229+ YOffset = Canvas.ClipY - (YL * 6);
230+ XOffset = Canvas.ClipX * 0.1875; // in line with names list
243231
244- if (PlayerCount == ArrayCount(Ordered)) break;
245- }
232+ for (i = 15; i >= 0; i--) { // rendering bottom-up
233+ obj = mri.objectives[i];
234+ if (obj == None) continue;
235+ if (!obj.bActive && !obj.bAlwaysShown) {
236+ if (!obj.bCompleted || (obj.bCompleted && !obj.bShowWhenComplete)) continue;
246237 }
247- }
248238
249- SortScores(PlayerCount);
250-
251- CanvasFont = Canvas.Font;
252- Canvas.Font = MyFonts.GetBigFont(Canvas.ClipX);
239+ if (!obj.bActive) {
240+ Canvas.Style = ERenderStyle.STY_Translucent;
241+ Canvas.DrawColor = WhiteColor * 0.5;
242+ } else {
243+ Canvas.DrawColor = GoldColor;
244+ }
253245
254- Canvas.SetPos(0, 160.0 / 768.0 * Canvas.ClipY );
255- DrawCategoryHeaders( Canvas);
246+ Canvas.SetPos(XOffset + YL, YOffset );
247+ Canvas.DrawText(obj.message, False );
256248
257- Canvas.StrLen(" TEST ", XL, YL);
258- YStart = Canvas.CurY;
259- YOffset = YStart;
260- if (PlayerCount > 15) PlayerCount = FMin(PlayerCount, (Canvas.ClipY - YStart) / YL - 1);
249+ Canvas.Style = ERenderStyle.STY_Translucent;
250+ Canvas.SetPos(XOffset + 4, YOffset + 4);
251+ if (obj.bCompleted) {
252+ Canvas.DrawTile(Texture'{{package}}.Hud.ObjComplete', (YL - 8), (YL - 8), 0, 0, 32, 32);
253+ } else {
254+ Canvas.DrawTile(Texture'{{package}}.Hud.ObjIncomplete', (YL - 8), (YL - 8), 0, 0, 32, 32);
255+ }
256+
257+ Canvas.Style = Style;
261258
262- Canvas.SetPos(0, 0);
263- for (I = 0; I < PlayerCount; I++) {
264- YOffset = YStart + I * YL;
265- DrawNameAndPing(Canvas, Ordered[I], 0, YOffset, false);
259+ YOffset -= YL;
260+
261+ wasObjectives = true;
266262 }
267- Canvas.DrawColor = LightGreenColor;
268- Canvas.Font = CanvasFont;
269263
270- // Trailer
271- if (!Level.bLowRes) {
272- Canvas.Font = MyFonts.GetSmallFont(Canvas.ClipX) ;
273- DrawTrailer( Canvas);
264+ if (wasObjectives) {
265+ Canvas.SetPos(XOffset, YOffset);
266+ Canvas.DrawColor = GreenColor ;
267+ Canvas.DrawText(ObjectivesString, False );
274268 }
275- Canvas.DrawColor = WhiteColor;
276- Canvas.Font = CanvasFont;
277269}
278270
279- defaultproperties {
280- GreenColor=(G=255)
281- WhiteColor=(R=255, G=255, B=255)
282- GoldColor=(R=255, G=255)
283- BlueColor=(B=255)
284- LightCyanColor=(R=128, G=255, B=255)
285- SilverColor=(R=138, G=164, B=166)
286- BronzeColor=(R=203, G=147, B=52)
287- CyanColor=(G=128, B=255)
288- RedColor=(R=255)
271+ defaultproperties
289272 LightGreenColor=(G=136)
290273 DarkGreenColor=(G=255, B=128)
291274 Restart=" You have been killed . Hit [Fire ] to continue the hunt !"
@@ -294,4 +277,6 @@ defaultproperties {
294277 PlayerString ="Hunter"
295278 FragsString ="Score"
296279 DeathsString ="Lives"
280+ MonsterDifficultyJoinString ="Monsters /"
281+ ObjectivesString ="Objectives"
297282}
0 commit comments