DrawIdentifyInfo:
Unified indentation style, added safer checks, moved code that draws sgBuilding info inside a block that checks if we're aiming at a sgBuilding.
Code:
simulated function bool DrawIdentifyInfo(canvas Canvas)
{
local sgTeleporter tel;
local string s, timeleft;
local float l,buildTime;
local bool bSiegeStats;
local PlayerReplicationInfo BuilderPRI;
local sgBuilding Building;
local Pawn ViewedBuilder;
local float NextLVCost;
local int BasicUpgradeCost;
if ( PlayerPawn(Owner) != none )
{
if ( sgPRI(PlayerPawn(Owner).PlayerReplicationInfo) != None )
l = sgPRI(PlayerPawn(Owner).PlayerReplicationInfo).iStatus;
if (int(l/2)*2 != l)
bSiegeStats = true;
}
if (bSiegeStats)
return false;
if ( !TraceIdentify(Canvas) )
return false;
if( sgBuilding(IdentifyPawn) != None )
{
// We Are Looking at a building
if ( IdentifyPawn.bDeleteMe )
return false;
Building = sgBuilding(IdentifyPawn); //Higor, don't do a subclass lookup like 20 times.
if ( IdentifyPawn.Owner != None ) //Higor, why check for sgBuilding(IdentifyPawn) like 4 times if it can be done once?
BuilderPRI = Pawn(Building.Owner).PlayerReplicationInfo;
s = string(Building.Energy / Building.MaxEnergy * 100);
s = left(s, InStr(s, ".")+nHUDDecPlaces+1);
if (right(s,1)==".")
s = left(s,len(s)-1);
s = s @ "%";
if ( BuilderPRI != None ) //Higor: only happens if looking at building, place it inside building status code block
{
Canvas.Font = MyFonts.GetBigFont(Canvas.ClipX);
DrawTwoColorID(Canvas,"Built by:",
BuilderPRI.PlayerName,
Canvas.ClipY - 136 * Scale);
}
if(!Building.DoneBuilding) //Higor: same here, placing it in this block ensures Building exists and preventes yet another log warning
{
buildTime = Building.BuildTime / Building.GS;
timeleft = string(buildTime - (buildTime * (Building.TotalSCount - Building.SCount) / Building.TotalSCount));
timeleft = left(timeleft, InStr(timeleft, ".")+nHUDDecPlaces+1);
if(float(timeleft) > 0)
{
Canvas.Font = MyFonts.GetBigFont(Canvas.ClipX);
DrawTwoColorID(Canvas,"Time left:", timeleft @ "sec" ,Canvas.ClipY - 96 * Scale);
}
}
}
else
{
// We are looking at a Player
if ( IdentifyTarget != None )
if ( IdentifyTarget.PlayerName != "" )
{
Canvas.Font = MyFonts.GetBigFont(Canvas.ClipX);
DrawTwoColorID(Canvas,IdentifyTarget.PlayerName,string(IdentifyPawn.Health)
,Canvas.ClipY - 256 * Scale);
}
}
}
DrawGameSynopsis:
Fixes at beginning of function, fixes log warnings on spectators by not trying to check the spectator's team ru and core health
Code:
simulated function DrawGameSynopsis(canvas Canvas)
{
local TournamentGameReplicationInfo
GRI;
local float XL,XL2,
YL,YL2,
XOffset,l,
YOffset;
local int i,
X;
local string text;
local sgConstructor gun;
local class<sgBuilding>
buildType;
local Inventory inv;
local PlayerPawn POwner;
// Percents
local float fuelPercent, DashPercent;
local sgPRI PRI;
local Jetpack pack;
local string s;
local color cCol;
local bool bSiegeStats;
local sgBaseCore sgB;
local WildcardsOrbs Orb, OrbLocked;
local int OrbX;
local int OrbSpace;
local WildcardsOrbs WOR;
// HUD Item Slot Vars
local float HudItemSlotY;
POwner = PlayerPawn(Owner);
if ( (POwner != none) && (sgPRI(POwner.PlayerReplicationInfo) != none) )
{
l = sgPRI(POwner.PlayerReplicationInfo).iStatus;
if (int(l/2)*2 != l) bSiegeStats = true;
}
else
bSiegeStats=false;
if (bSiegeStats) return;
GRI = TournamentGameReplicationInfo(PlayerOwner.GameReplicationInfo);
if ( GRI != None )
for ( i = 0; i < 4; i++ )
DrawTeam(Canvas, GRI.Teams[i]);
if ( PawnOwner.PlayerReplicationInfo == None ||
PawnOwner.PlayerReplicationInfo.bIsSpectator )
return;
PRI = sgPRI(PawnOwner.PlayerReplicationInfo);
sgB = PRI.Cores[PRI.Team];
Speaking of unified indentation... There should be specific tabs stops for specific notifications in the server scroll. So that you can find messages quickly in the log... Like the extra spacing in the Player >??>>???>? was warned for Team Removing...
05-26-2012
.seVered.][
Also, on the HUD issue.. when you set your screen rez to 1600x1280 the server scroll (server message log in the top left corner)_ looks like your in the clouds. I mean the words are very small. Can you implement a way to increase the font if the screen rez is large?
05-26-2012
Higor
Could be done, but that won't be me.
05-31-2012
.seVered.][
Whilst it is in discussion, perhaps a change in the RU/Core graphic could be addressed. Maybe change it to a more adjustable graphic that is scale-able with the HUD/Screen Rez... same goes for the Message Scroll.
06-01-2012
nOs*Wildcard
mmm, more homework. I might just wipe out the hud as stands and make something more fancy like what I made for Gauntlet 10