Core.Object | +--Engine.Actor | +--Engine.Info | +--Engine.ScoreBoard | +--RuneI.RuneScoreBoard
PingText,
AwardsText
Seperator,
Background
float
BackgroundAlpha
BlueColor,
BackgroundColor
ContinueMsg,
ContinueTrailer
string
FontInfoClass
FontInfo
MyFonts
IdealPlayerCountMsg,
NumPlayersMsg
PlayerReplicationInfo
Ordered[32]
ReadyText
bool
bTimeDown
void
DrawBackground(Canvas Canvas, int X, int Y, int W, int H)
DrawHeader(Canvas Canvas)
DrawPlayerInfo(Canvas Canvas, PlayerReplicationInfo PRI, float XOffset, float YOffset)
DrawTableHeadings(Canvas Canvas)
DrawTrailer(Canvas Canvas)
PostBeginPlay()
ShowScores(Canvas Canvas)
SortScores(int N)
TwoDigitString(int Num)
00001 //============================================================================= 00002 // RuneScoreBoard 00003 //============================================================================= 00004 class RuneScoreBoard extends ScoreBoard; 00005 00006 #exec Texture Import File=Textures\sb_seperator.pcx Name=sb_seperator Mips=Off Flags=0 00007 #exec Texture Import File=Textures\sb_vertramp.pcx Name=sb_vertramp Mips=Off Flags=0 00008 #exec Texture Import File=Textures\sb_horizramp.pcx Name=sb_horizramp Mips=Off Flags=0 00009 00010 #exec Texture Import File=Textures\trophyskull.pcx Name=TrophyHeads Mips=Off Flags=2 00011 #exec Texture Import File=Textures\trophyblood.pcx Name=TrophyFirstBlood Mips=Off Flags=2 00012 #exec Texture Import File=Textures\trophycrossbones.pcx Name=TrophySpree Mips=Off Flags=2 00013 00014 var color GreenColor, WhiteColor, GoldColor, CyanColor, RedColor, LightCyanColor, LightGreenColor, VioletColor, BlueColor, BackgroundColor; 00015 var PlayerReplicationInfo Ordered[32]; 00016 var bool bTimeDown; 00017 var localized string ReadyText; 00018 var localized string RemainingTimeMsg, ElapsedTimeMsg, GameTypeMsg, MapTitleMsg, IdealPlayerCountMsg, NumPlayersMsg; 00019 var localized string RestartMsg, ContinueMsg, ContinueTrailer; 00020 var localized string NameText, FragsText, DeathsText, PingText, AwardsText; 00021 var Texture FirstBloodIcon, SpreeIcon, HeadIcon, Seperator, Background; 00022 var() float BackgroundAlpha; 00023 00024 var globalconfig string FontInfoClass; 00025 var FontInfo MyFonts; 00026 00027 function PostBeginPlay() 00028 { 00029 Super.PostBeginPlay(); 00030 00031 if(FontInfoClass != "") 00032 MyFonts = FontInfo(spawn(Class<Actor>(DynamicLoadObject(FontInfoClass, class'Class')))); 00033 00034 00035 } 00036 function DrawHeader( canvas Canvas ) 00037 { 00038 local GameReplicationInfo GRI; 00039 local float XL, YL; 00040 local float YOffset; 00041 local PlayerPawn PlayerOwner; 00042 00043 Canvas.DrawColor = GreenColor; 00044 PlayerOwner = PlayerPawn(Owner); 00045 Canvas.StrLen("TEST", XL, YL); 00046 YOffset = 8*YL; 00047 00048 if (Canvas.ClipX > 500) 00049 { 00050 GRI = PlayerOwner.GameReplicationInfo; 00051 00052 // Left Column 00053 Canvas.SetPos(0.1*Canvas.ClipX, YOffset); 00054 Canvas.DrawText(MapTitleMsg$Level.Title, true); 00055 YOffset += YL; 00056 00057 Canvas.SetPos(0.1*Canvas.ClipX, YOffset); 00058 Canvas.DrawText("Author: "$Level.Author, true); 00059 YOffset += YL; 00060 00061 if (Level.IdealPlayerCount != "") 00062 { 00063 Canvas.SetPos(0.1*Canvas.ClipX, YOffset); 00064 Canvas.DrawText(IdealPlayerCountMsg$Level.IdealPlayerCount, true); 00065 YOffset += YL; 00066 } 00067 00068 // Right Column 00069 YOffset = 8*YL; 00070 if (Level.Netmode != NM_StandAlone) 00071 { 00072 Canvas.DrawTextRightJustify(GRI.ServerName, 0.9*Canvas.ClipX, YOffset); 00073 YOffset += YL; 00074 } 00075 00076 Canvas.DrawTextRightJustify(GameTypeMsg$GRI.GameName, 0.9*Canvas.ClipX, YOffset); 00077 YOffset += YL; 00078 00079 Canvas.DrawTextRightJustify(GRI.NumPlayers$NumPlayersMsg, 0.9*Canvas.ClipX, YOffset); 00080 YOffset += 2*YL; 00081 00082 Canvas.SetPos(0.0, YOffset); 00083 } 00084 } 00085 00086 function string TwoDigitString(int Num) 00087 { 00088 if ( Num < 10 ) 00089 return "0"$Num; 00090 else 00091 return string(Num); 00092 } 00093 00094 function DrawTrailer( canvas Canvas ) 00095 { 00096 local int Hours, Minutes, Seconds; 00097 local string HourString, MinuteString, SecondString; 00098 local float XL, YL; 00099 local PlayerPawn PlayerOwner; 00100 local int YOffset; 00101 00102 PlayerOwner = PlayerPawn(Owner); 00103 Canvas.bCenter = true; 00104 Canvas.DrawColor = WhiteColor; 00105 Canvas.StrLen("Test", XL, YL); 00106 00107 // Bottom seperator 00108 YOffset = Canvas.CurY; 00109 YOffset += YL*0.25; 00110 Canvas.SetPos(Canvas.ClipX*0.1, YOffset); 00111 Canvas.DrawTile(Seperator, Canvas.ClipX*0.8, YL*0.5, 0, 0, Seperator.USize, Seperator.VSize); 00112 00113 if (Canvas.ClipX > 500) 00114 { 00115 // Now start from bottom 00116 Canvas.SetPos(0, Canvas.ClipY - YL); 00117 00118 if ( bTimeDown || (PlayerOwner.GameReplicationInfo.RemainingTime > 0) ) 00119 { 00120 bTimeDown = true; 00121 if ( PlayerOwner.GameReplicationInfo.RemainingTime <= 0 ) 00122 Canvas.DrawText(RemainingTimeMsg@"00:00", true); 00123 else 00124 { 00125 Minutes = PlayerOwner.GameReplicationInfo.RemainingTime/60; 00126 Seconds = PlayerOwner.GameReplicationInfo.RemainingTime % 60; 00127 Canvas.DrawText(RemainingTimeMsg@TwoDigitString(Minutes)$":"$TwoDigitString(Seconds), true); 00128 } 00129 } 00130 else 00131 { 00132 Seconds = int(Level.TimeSeconds); 00133 Minutes = Seconds / 60; 00134 Hours = Minutes / 60; 00135 Seconds = Seconds - (Minutes * 60); 00136 Minutes = Minutes - (Hours * 60); 00137 00138 if (Seconds < 10) 00139 SecondString = "0"$Seconds; 00140 else 00141 SecondString = string(Seconds); 00142 00143 if (Minutes < 10) 00144 MinuteString = "0"$Minutes; 00145 else 00146 MinuteString = string(Minutes); 00147 00148 if (Hours < 10) 00149 HourString = "0"$Hours; 00150 else 00151 HourString = string(Hours); 00152 00153 Canvas.DrawText(ElapsedTimeMsg$HourString$":"$MinuteString$":"$SecondString, true); 00154 } 00155 } 00156 00157 // Hit fire to continue message 00158 Canvas.bCenter = true; 00159 Canvas.StrLen("Test", XL, YL); 00160 Canvas.SetPos(0, Canvas.ClipY - YL*4); 00161 Canvas.DrawColor = RedColor; 00162 if ( PlayerOwner.GameReplicationInfo.GameEndedComments != "" ) 00163 Canvas.DrawText(ContinueMsg@PlayerOwner.GameReplicationInfo.GameEndedComments@ContinueTrailer, true); 00164 else if ((PlayerOwner != None) && (PlayerOwner.Health <= 0) ) 00165 Canvas.DrawText(RestartMsg, true); 00166 Canvas.bCenter = false; 00167 } 00168 00169 function DrawBackground( canvas Canvas, int X, int Y, int W, int H) 00170 { 00171 Canvas.DrawColor = BackgroundColor; 00172 Canvas.Style = ERenderStyle.STY_AlphaBlend; 00173 Canvas.AlphaScale = BackgroundAlpha; 00174 Canvas.SetPos(X, Y); 00175 Canvas.DrawTile(Background, W, H, 0, 0, Background.USize, Background.VSize); 00176 Canvas.Style = ERenderStyle.STY_Normal; 00177 Canvas.AlphaScale = 1.0; 00178 } 00179 00180 function DrawTableHeadings( canvas Canvas) 00181 { 00182 local float XL, YL; 00183 local float YOffset; 00184 00185 Canvas.DrawColor = GoldColor; 00186 Canvas.StrLen("00", XL, YL); 00187 YOffset = Canvas.CurY; 00188 00189 // Name 00190 Canvas.SetPos(Canvas.ClipX*0.1, YOffset); 00191 Canvas.DrawText(NameText, false); 00192 00193 // Score 00194 Canvas.SetPos(Canvas.ClipX*0.5, YOffset); 00195 Canvas.DrawText(FragsText, false); 00196 00197 // Draw Deaths 00198 Canvas.SetPos(Canvas.ClipX*0.6, YOffset); 00199 Canvas.DrawText(DeathsText, false); 00200 00201 // Draw Awards 00202 Canvas.SetPos(Canvas.ClipX*0.8, YOffset); 00203 Canvas.DrawText(AwardsText, false); 00204 00205 if (Canvas.ClipX > 512) 00206 { 00207 // Ping 00208 Canvas.SetPos(Canvas.ClipX*0.7, YOffset); 00209 Canvas.DrawText(PingText, false); 00210 } 00211 00212 // Draw seperator 00213 YOffset += YL*1.25; 00214 Canvas.DrawColor = WhiteColor; 00215 Canvas.SetPos(Canvas.ClipX*0.1, YOffset); 00216 Canvas.DrawTile(Seperator, Canvas.ClipX*0.8, YL*0.5, 0, 0, Seperator.USize, Seperator.VSize); 00217 YOffset += YL*0.75; 00218 Canvas.SetPos(Canvas.ClipX*0.1, YOffset); 00219 } 00220 00221 function DrawPlayerInfo( canvas Canvas, PlayerReplicationInfo PRI, float XOffset, float YOffset) 00222 { 00223 local bool bLocalPlayer; 00224 local PlayerPawn PlayerOwner; 00225 local float XL,YL; 00226 local int AwardPos; 00227 00228 PlayerOwner = PlayerPawn(Owner); 00229 bLocalPlayer = (PRI.PlayerName == PlayerOwner.PlayerReplicationInfo.PlayerName); 00230 //FONT ALTER 00231 // Canvas.Font = RegFont; 00232 if(MyFonts != None) 00233 Canvas.Font = MyFonts.GetStaticMedFont(); 00234 else 00235 Canvas.Font = RegFont; 00236 00237 // Draw Ready 00238 if (PRI.bReadyToPlay) 00239 { 00240 Canvas.StrLen("R ", XL, YL); 00241 Canvas.SetPos(Canvas.ClipX*0.1-XL, YOffset); 00242 Canvas.DrawText(ReadyText, false); 00243 } 00244 00245 if (bLocalPlayer) 00246 Canvas.DrawColor = VioletColor; 00247 else 00248 Canvas.DrawColor = WhiteColor; 00249 00250 // Draw Name 00251 if (PRI.bAdmin) //FONT ALTER 00252 { 00253 //Canvas.Font = Font'SmallFont'; 00254 if(MyFonts != None) 00255 Canvas.Font = MyFonts.GetStaticSmallFont(); 00256 else 00257 Canvas.Font = Font'SmallFont'; 00258 } 00259 else 00260 { //FONT ALTER 00261 //Canvas.Font = RegFont; 00262 if(MyFonts != None) 00263 Canvas.Font = MyFonts.GetStaticMedFont(); 00264 else 00265 Canvas.Font = RegFont; 00266 } 00267 00268 Canvas.SetPos(Canvas.ClipX*0.1, YOffset); 00269 Canvas.DrawText(PRI.PlayerName, false); 00270 //FONT ALTER 00271 //Canvas.Font = RegFont; 00272 if(MyFonts != None) 00273 Canvas.Font = MyFonts.GetStaticMedFont(); 00274 else 00275 Canvas.Font = RegFont; 00276 00277 // Draw Score 00278 Canvas.SetPos(Canvas.ClipX*0.5, YOffset); 00279 Canvas.DrawText(int(PRI.Score), false); 00280 00281 // Draw Deaths 00282 Canvas.SetPos(Canvas.ClipX*0.6, YOffset); 00283 Canvas.DrawText(int(PRI.Deaths), false); 00284 00285 if (Canvas.ClipX > 512 && Level.Netmode != NM_Standalone) 00286 { 00287 // Draw Ping 00288 Canvas.SetPos(Canvas.ClipX*0.7, YOffset); 00289 Canvas.DrawText(PRI.Ping, false); 00290 00291 // Packetloss 00292 //FONT ALTER 00293 //Canvas.Font = RegFont; 00294 if(MyFonts != None) 00295 Canvas.Font = MyFonts.GetStaticMedFont(); 00296 else 00297 Canvas.Font = RegFont; 00298 00299 Canvas.DrawColor = WhiteColor; 00300 } 00301 00302 // Draw Awards 00303 AwardPos = Canvas.ClipX*0.8; 00304 Canvas.DrawColor = WhiteColor; 00305 //FONT ALTER 00306 //Canvas.Font = Font'SmallFont'; 00307 if(MyFonts != None) 00308 Canvas.Font = MyFonts.GetStaticSmallFont(); 00309 else 00310 Canvas.Font = Font'SmallFont'; 00311 00312 Canvas.StrLen("00", XL, YL); 00313 if (PRI.bFirstBlood) 00314 { // First blood 00315 Canvas.SetPos(AwardPos-YL+XL*0.25, YOffset-YL*0.5); 00316 Canvas.DrawTile(FirstBloodIcon, YL*2, YL*2, 0, 0, FirstBloodIcon.USize, FirstBloodIcon.VSize); 00317 AwardPos += XL*2; 00318 } 00319 if (PRI.MaxSpree > 2) 00320 { // Killing sprees 00321 Canvas.SetPos(AwardPos-YL+XL*0.25, YOffset-YL*0.5); 00322 Canvas.DrawTile(SpreeIcon, YL*2, YL*2, 0, 0, SpreeIcon.USize, SpreeIcon.VSize); 00323 Canvas.SetPos(AwardPos, YOffset); 00324 Canvas.DrawColor = CyanColor; 00325 Canvas.DrawText(PRI.MaxSpree, false); 00326 Canvas.DrawColor = WhiteColor; 00327 AwardPos += XL*2; 00328 } 00329 if (PRI.HeadKills > 0) 00330 { // Head kills 00331 Canvas.SetPos(AwardPos-YL+XL*0.25, YOffset-YL*0.5); 00332 Canvas.DrawTile(HeadIcon, YL*2, YL*2, 0, 0, HeadIcon.USize, HeadIcon.VSize); 00333 Canvas.SetPos(AwardPos, YOffset); 00334 Canvas.DrawColor = CyanColor; 00335 Canvas.DrawText(PRI.HeadKills, false); 00336 Canvas.DrawColor = WhiteColor; 00337 AwardPos += XL*2; 00338 } 00339 //FONT ALTER 00340 //Canvas.Font = RegFont; 00341 if(MyFonts != None) 00342 Canvas.Font = MyFonts.GetStaticMedFont(); 00343 else 00344 Canvas.Font = RegFont; 00345 } 00346 00347 function SortScores(int N) 00348 { 00349 local int i,j,Max; 00350 local PlayerReplicationInfo TempPRI; 00351 00352 for (i=0; i<N-1; i++) 00353 { 00354 Max = i; 00355 for (j=i+1; j<N; j++) 00356 { 00357 if (Ordered[j].Score > Ordered[Max].Score) 00358 Max=j; 00359 else if ((Ordered[j].Score == Ordered[Max].Score) && (Ordered[j].Deaths < Ordered[Max].Deaths)) 00360 Max=j; 00361 else if ((Ordered[j].Score == Ordered[Max].Score) && (Ordered[j].Deaths == Ordered[Max].Deaths) && 00362 (Ordered[j].PlayerID < Ordered[Max].Score)) 00363 Max=j; 00364 } 00365 00366 TempPRI = Ordered[Max]; 00367 Ordered[Max] = Ordered[i]; 00368 Ordered[i] = TempPRI; 00369 } 00370 } 00371 00372 function ShowScores( canvas Canvas ) 00373 { 00374 local PlayerReplicationInfo PRI; 00375 local int PlayerCount, I; 00376 local float XL, YL; 00377 local float YOffset, YStart; 00378 00379 // Sort the PRIs 00380 for (i=0; i<ArrayCount(Ordered); i++) 00381 Ordered[i] = None; 00382 for (i=0; i<32; i++) 00383 { 00384 if (PlayerPawn(Owner).GameReplicationInfo.PRIArray[i] != None) 00385 { 00386 PRI = PlayerPawn(Owner).GameReplicationInfo.PRIArray[i]; 00387 if ( !PRI.bIsSpectator || PRI.bWaitingPlayer ) 00388 { 00389 Ordered[PlayerCount] = PRI; 00390 PlayerCount++; 00391 if (PlayerCount == ArrayCount(Ordered)) 00392 break; 00393 } 00394 } 00395 } 00396 SortScores(PlayerCount); 00397 //FONT ALTER 00398 //Canvas.Font = RegFont; 00399 if(MyFonts != None) 00400 Canvas.Font = MyFonts.GetStaticMedFont(); 00401 else 00402 Canvas.Font = RegFont; 00403 00404 Canvas.DrawColor = WhiteColor; 00405 00406 // Header 00407 DrawHeader(Canvas); 00408 DrawTableHeadings(Canvas); 00409 00410 // Calculate vertical spacing 00411 Canvas.StrLen("TEST", XL, YL); 00412 YStart = Canvas.CurY; 00413 00414 //TODO: Calculate continuous spacing based on screensize available 00415 00416 if (PlayerCount < 15) 00417 YL *= 2; 00418 else if (PlayerCount < 20) 00419 YL *= 1.5; 00420 if (PlayerCount > 15) 00421 PlayerCount = FMin(PlayerCount, (Canvas.ClipY - YStart)/YL - 1); 00422 00423 DrawBackground(Canvas, 0.1*Canvas.ClipX, YStart-YL*0.25+1, 0.8*Canvas.ClipX, PlayerCount*YL); 00424 00425 YOffset = YStart; 00426 for ( I=0; I<PlayerCount; I++ ) 00427 { 00428 YOffset = YStart + I*YL; 00429 DrawPlayerInfo(Canvas, Ordered[I], 0, YOffset); 00430 } 00431 00432 // Draw bottom seperator 00433 Canvas.StrLen("TEST", XL, YL); 00434 YOffset += YL; 00435 Canvas.SetPos(0, YOffset); 00436 00437 // Trailer 00438 DrawTrailer(Canvas); 00439 00440 Canvas.DrawColor = WhiteColor; 00441 } 00442 00443 defaultproperties 00444 { 00445 GreenColor=(G=255) 00446 WhiteColor=(R=255,G=255,B=255) 00447 GoldColor=(R=255,G=255) 00448 CyanColor=(G=255,B=255) 00449 RedColor=(R=255) 00450 LightCyanColor=(R=128,G=255,B=255) 00451 LightGreenColor=(G=128,B=128) 00452 VioletColor=(R=228,B=228) 00453 BlueColor=(B=255) 00454 BackgroundColor=(R=255,G=255,B=255) 00455 ReadyText="R" 00456 RemainingTimeMsg="Remaining Time: " 00457 ElapsedTimeMsg="Elapsed Time: " 00458 GameTypeMsg="Game Type: " 00459 MapTitleMsg="Map: " 00460 IdealPlayerCountMsg="Ideal Player Load:" 00461 NumPlayersMsg=" Players" 00462 RestartMsg="You are dead. Hit [Fire] to respawn!" 00463 ContinueMsg="The match has ended. " 00464 ContinueTrailer="reached." 00465 NameText="Name" 00466 FragsText="Frags" 00467 DeathsText="Deaths" 00468 PingText="Ping" 00469 AwardsText="Trophies" 00470 FirstBloodIcon=Texture'RuneI.TrophyFirstBlood' 00471 SpreeIcon=Texture'RuneI.TrophySpree' 00472 HeadIcon=Texture'RuneI.TrophyHeads' 00473 Seperator=Texture'RuneI.sb_seperator' 00474 Background=Texture'RuneI.sb_horizramp' 00475 BackgroundAlpha=0.100000 00476 RegFont=Font'Engine.MedFont' 00477 }