- use a separate variable pointing to the current level for the UI code.

UI always runs on the primary level, so this does not need the ability to operate on multiple levels. Additionally, this can later be set to null when running play code so that scope violations result in an abort.
This commit is contained in:
Christoph Oelckers 2019-01-25 18:16:18 +01:00
parent ba114f6f23
commit 4e052f2857
21 changed files with 107 additions and 103 deletions

View file

@ -154,6 +154,7 @@ extern bool sendpause, sendsave, sendturn180, SendLand;
void *statcopy; // for statistics driver
FLevelLocals level; // info about current level
FLevelLocals *currentUILevel = &level; // level for which to display the user interface.
//==========================================================================

View file

@ -413,9 +413,9 @@ public:
}
};
#ifndef NO_DEFINE_LEVEL
extern FLevelLocals level;
extern FLevelLocals *currentUILevel; // level for which to display the user interface. This will always be the one the current consoleplayer is in.
inline FSectorPortal *line_t::GetTransferredPortal()
{
@ -510,4 +510,3 @@ inline bool line_t::hitSkyWall(AActor* mo) const
backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
mo->Z() >= backsector->ceilingplane.ZatPoint(mo->PosRelative(this));
}
#endif

View file

@ -516,7 +516,6 @@ DBaseStatusBar *CreateCustomStatusBar(int script=0);
// Crosshair stuff ----------------------------------------------------------
void ST_FormatMapName(FString &mapname, const char *mapnamecolor = "");
void ST_LoadCrosshair(bool alwaysload=false);
void ST_Clear();
void ST_CreateStatusBar(bool bTitleLevel);

View file

@ -1075,7 +1075,7 @@ public:
lastHud = hud;
// Handle inventory bar drawing
if(CPlayer->inventorytics > 0 && !(level.flags & LEVEL_NOINVENTORYBAR) && (state == HUD_StatusBar || state == HUD_Fullscreen))
if(CPlayer->inventorytics > 0 && !(currentUILevel->flags & LEVEL_NOINVENTORYBAR) && (state == HUD_StatusBar || state == HUD_Fullscreen))
{
SBarInfoMainBlock *inventoryBar = state == HUD_StatusBar ? script->huds[STBAR_INVENTORY] : script->huds[STBAR_INVENTORYFULLSCREEN];
if(inventoryBar != lastInventoryBar)

View file

@ -850,26 +850,26 @@ class CommandDrawString : public SBarInfoCommand
switch(strValue)
{
case LEVELNAME:
if(level.lumpnum != cache)
if(currentUILevel->lumpnum != cache)
{
cache = level.lumpnum;
str = level.LevelName;
cache = currentUILevel->lumpnum;
str = currentUILevel->LevelName;
RealignString();
}
break;
case LEVELLUMP:
if(level.lumpnum != cache)
if(currentUILevel->lumpnum != cache)
{
cache = level.lumpnum;
str = level.MapName;
cache = currentUILevel->lumpnum;
str = currentUILevel->MapName;
str.ToUpper();
RealignString();
}
break;
case SKILLNAME:
if(level.lumpnum != cache) // Can only change skill between level.
if(currentUILevel->lumpnum != cache) // Can only change skill between currentUILevel->
{
cache = level.lumpnum;
cache = currentUILevel->lumpnum;
str = G_SkillName();
RealignString();
}
@ -904,7 +904,7 @@ class CommandDrawString : public SBarInfoCommand
if(ACS_GlobalVars[valueArgument] != cache)
{
cache = ACS_GlobalVars[valueArgument];
str = level.Behaviors.LookupString(ACS_GlobalVars[valueArgument]);
str = currentUILevel->Behaviors.LookupString(ACS_GlobalVars[valueArgument]);
RealignString();
}
break;
@ -912,13 +912,13 @@ class CommandDrawString : public SBarInfoCommand
if(ACS_GlobalArrays[valueArgument][consoleplayer] != cache)
{
cache = ACS_GlobalArrays[valueArgument][consoleplayer];
str = level.Behaviors.LookupString(ACS_GlobalArrays[valueArgument][consoleplayer]);
str = currentUILevel->Behaviors.LookupString(ACS_GlobalArrays[valueArgument][consoleplayer]);
RealignString();
}
break;
case TIME:
{
int sec = Tics2Seconds(level.time);
int sec = Tics2Seconds(currentUILevel->time);
str.Format("%02d:%02d:%02d", sec / 3600, (sec % 3600) / 60, sec % 60);
break;
}
@ -1389,25 +1389,25 @@ class CommandDrawNumber : public CommandDrawString
num = statusBar->CPlayer->fragcount;
break;
case KILLS:
num = level.killed_monsters;
num = currentUILevel->killed_monsters;
break;
case MONSTERS:
num = level.total_monsters;
num = currentUILevel->total_monsters;
break;
case ITEMS:
num = level.found_items;
num = currentUILevel->found_items;
break;
case TOTALITEMS:
num = level.total_items;
num = currentUILevel->total_items;
break;
case SECRETS:
num = level.found_secrets;
num = currentUILevel->found_secrets;
break;
case SCORE:
num = statusBar->CPlayer->mo->Score;
break;
case TOTALSECRETS:
num = level.total_secrets;
num = currentUILevel->total_secrets;
break;
case ARMORCLASS:
case SAVEPERCENT:
@ -1459,9 +1459,9 @@ class CommandDrawNumber : public CommandDrawString
case AIRTIME:
{
if(statusBar->CPlayer->mo->waterlevel < 3)
num = level.airsupply/TICRATE;
num = currentUILevel->airsupply/TICRATE;
else
num = clamp<int>((statusBar->CPlayer->air_finished - level.time + (TICRATE-1))/TICRATE, 0, INT_MAX);
num = clamp<int>((statusBar->CPlayer->air_finished - currentUILevel->time + (TICRATE-1))/TICRATE, 0, INT_MAX);
break;
}
case SELECTEDINVENTORY:
@ -1502,7 +1502,7 @@ class CommandDrawNumber : public CommandDrawString
}
default: break;
}
if(interpolationSpeed != 0 && (!hudChanged || level.time == 1))
if(interpolationSpeed != 0 && (!hudChanged || currentUILevel->time == 1))
{
if(num < drawValue)
drawValue -= clamp<int>((drawValue - num) >> 2, 1, interpolationSpeed);
@ -1691,7 +1691,7 @@ class CommandDrawSelectedInventory : public CommandDrawImage, private CommandDra
if(alternateOnEmpty)
SBarInfoCommandFlowControl::Draw(block, statusBar);
if(statusBar->CPlayer->mo->PointerVar<AActor>(NAME_InvSel) != NULL && !(level.flags & LEVEL_NOINVENTORYBAR))
if(statusBar->CPlayer->mo->PointerVar<AActor>(NAME_InvSel) != NULL && !(currentUILevel->flags & LEVEL_NOINVENTORYBAR))
{
if(artiflash && statusBar->wrapper->artiflashTick)
{
@ -1791,7 +1791,7 @@ class CommandDrawSelectedInventory : public CommandDrawImage, private CommandDra
{
SBarInfoCommandFlowControl::Tick(block, statusBar, hudChanged);
SetTruth(statusBar->CPlayer->mo->PointerVar<AActor>(NAME_InvSel) == NULL || (level.flags & LEVEL_NOINVENTORYBAR), block, statusBar);
SetTruth(statusBar->CPlayer->mo->PointerVar<AActor>(NAME_InvSel) == NULL || (currentUILevel->flags & LEVEL_NOINVENTORYBAR), block, statusBar);
CommandDrawImage::Tick(block, statusBar, hudChanged);
CommandDrawNumber::Tick(block, statusBar, hudChanged);
@ -1910,7 +1910,7 @@ class CommandInventoryBarNotVisible : public SBarInfoCommandFlowControl
{
SBarInfoCommandFlowControl::Tick(block, statusBar, hudChanged);
SetTruth(statusBar->CPlayer->inventorytics <= 0 || (level.flags & LEVEL_NOINVENTORYBAR), block, statusBar);
SetTruth(statusBar->CPlayer->inventorytics <= 0 || (currentUILevel->flags & LEVEL_NOINVENTORYBAR), block, statusBar);
}
};
@ -2727,16 +2727,16 @@ class CommandDrawBar : public SBarInfoCommand
max = fraglimit;
break;
case KILLS:
value = level.killed_monsters;
max = level.total_monsters;
value = currentUILevel->killed_monsters;
max = currentUILevel->total_monsters;
break;
case ITEMS:
value = level.found_items;
max = level.total_items;
value = currentUILevel->found_items;
max = currentUILevel->total_items;
break;
case SECRETS:
value = level.found_secrets;
max = level.total_secrets;
value = currentUILevel->found_secrets;
max = currentUILevel->total_secrets;
break;
case INVENTORY:
{
@ -2751,8 +2751,8 @@ class CommandDrawBar : public SBarInfoCommand
break;
}
case AIRTIME:
value = clamp<int>(statusBar->CPlayer->air_finished - level.time, 0, INT_MAX);
max = level.airsupply;
value = clamp<int>(statusBar->CPlayer->air_finished - currentUILevel->time, 0, INT_MAX);
max = currentUILevel->airsupply;
break;
case POWERUPTIME:
{
@ -2798,7 +2798,7 @@ class CommandDrawBar : public SBarInfoCommand
}
else
value = 0;
if(interpolationSpeed != 0 && (!hudChanged || level.time == 1))
if(interpolationSpeed != 0 && (!hudChanged || currentUILevel->time == 1))
{
// [BL] Since we used a percentage (in order to get the most fluid animation)
// we need to establish a cut off point so the last pixel won't hang as the animation slows
@ -3192,7 +3192,7 @@ class CommandDrawGem : public SBarInfoCommand
goalValue = reverse ? 100 - goalValue : goalValue;
if(interpolationSpeed != 0 && (!hudChanged || level.time == 1)) // At the start force an animation
if(interpolationSpeed != 0 && (!hudChanged || currentUILevel->time == 1)) // At the start force an animation
{
if(goalValue < drawValue)
drawValue -= clamp<int>((drawValue - goalValue) >> 2, 1, interpolationSpeed);
@ -3202,7 +3202,7 @@ class CommandDrawGem : public SBarInfoCommand
else
drawValue = goalValue;
if(wiggle && level.time & 1)
if(wiggle && currentUILevel->time & 1)
chainWiggle = pr_chainwiggle() & 1;
}
protected:

View file

@ -133,25 +133,6 @@ CUSTOM_CVAR(Int, am_showmaplabel, 2, CVAR_ARCHIVE)
CVAR (Bool, idmypos, false, 0);
//---------------------------------------------------------------------------
//
// Format the map name, include the map label if wanted
//
//---------------------------------------------------------------------------
void ST_FormatMapName(FString &mapname, const char *mapnamecolor)
{
cluster_info_t *cluster = FindClusterInfo (level.cluster);
bool ishub = (cluster != NULL && (cluster->flags & CLUSTER_HUB));
mapname = "";
if (am_showmaplabel == 1 || (am_showmaplabel == 2 && !ishub))
{
mapname << level.MapName << ": ";
}
mapname << mapnamecolor << level.LevelName;
}
//---------------------------------------------------------------------------
//
// Load crosshair definitions

View file

@ -52,11 +52,11 @@
#undef DD
#endif
void FNodeBuilder::Extract (FLevelLocals &level)
void FNodeBuilder::Extract (FLevelLocals &theLevel)
{
int i;
auto &outVerts = level.vertexes;
auto &outVerts = theLevel.vertexes;
int vertCount = Vertices.Size ();
outVerts.Alloc(vertCount);
@ -65,12 +65,12 @@ void FNodeBuilder::Extract (FLevelLocals &level)
outVerts[i].set(Vertices[i].x, Vertices[i].y);
}
auto &outSubs = level.subsectors;
auto &outSubs = theLevel.subsectors;
auto subCount = Subsectors.Size();
outSubs.Alloc(subCount);
memset(&outSubs[0], 0, subCount * sizeof(subsector_t));
auto &outNodes = level.nodes;
auto &outNodes = theLevel.nodes;
auto nodeCount = Nodes.Size ();
outNodes.Alloc(nodeCount);
@ -103,7 +103,7 @@ void FNodeBuilder::Extract (FLevelLocals &level)
}
}
auto &outSegs = level.segs;
auto &outSegs = theLevel.segs;
if (GLNodes)
{
TArray<glseg_t> segs (Segs.Size()*5/4);

View file

@ -612,7 +612,7 @@ unsigned FLevelLocals::GetStackPortal(AActor *point, int plane)
//============================================================================
//
// level.GetPortalOffsetPosition
// GetPortalOffsetPosition
//
// Offsets a given coordinate if the trace from the origin crosses an
// interactive line-to-line portal.

View file

@ -2496,10 +2496,28 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetSpotState, GetSpotState)
ACTION_RETURN_POINTER(GetSpotState(self, create));
}
//---------------------------------------------------------------------------
//
// Format the map name, include the map label if wanted
//
//---------------------------------------------------------------------------
EXTERN_CVAR(Int, am_showmaplabel)
static void FormatMapName(FLevelLocals *self, int cr, FString *result)
{
char mapnamecolor[3] = { '\34', char(cr + 'A'), 0 };
ST_FormatMapName(*result, mapnamecolor);
cluster_info_t *cluster = FindClusterInfo(self->cluster);
bool ishub = (cluster != nullptr && (cluster->flags & CLUSTER_HUB));
*result = "";
if (am_showmaplabel == 1 || (am_showmaplabel == 2 && !ishub))
{
*result << self->MapName << ": ";
}
*result << mapnamecolor << self->LevelName;
}
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, FormatMapName, FormatMapName)
@ -2696,6 +2714,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_AltHUD, GetLatency, Net_GetLatency)
//
//==========================================================================
DEFINE_GLOBAL(level);
DEFINE_GLOBAL(currentUILevel);
DEFINE_FIELD(FLevelLocals, sectors)
DEFINE_FIELD(FLevelLocals, lines)
DEFINE_FIELD(FLevelLocals, sides)

View file

@ -1369,11 +1369,15 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
{
Error(field, "Cannot add field %s to %s. %s has native children which means it size may not change", FName(name->Name).GetChars(), type->TypeName.GetChars(), type->TypeName.GetChars());
}
else
else if (type != nullptr)
{
auto f = type->AddField(name->Name, thisfieldtype, varflags);
if (field->Flags & (ZCC_Version | ZCC_Deprecated)) f->mVersion = field->Version;
}
else
{
Error(field, "Cannot declare non-native global variables. Tried to declare %s", FName(name->Name).GetChars());
}
}
name = static_cast<ZCC_VarName*>(name->SiblingNext);
} while (name != field->Names);

View file

@ -428,7 +428,7 @@ void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
// is necessary in order to best reproduce Doom's original lighting.
double fadelevel;
if (vid_rendermode != 4 || level.lightMode == ELightMode::Doom || level.lightMode == ELightMode::ZDoomSoftware || level.lightMode == ELightMode::DoomSoftware)
if (vid_rendermode != 4 || currentUILevel->lightMode == ELightMode::Doom || currentUILevel->lightMode == ELightMode::ZDoomSoftware || currentUILevel->lightMode == ELightMode::DoomSoftware)
{
double map = (NUMCOLORMAPS * 2.) - ((lightlevel + 12) * (NUMCOLORMAPS / 128.));
fadelevel = clamp((map - 12) / NUMCOLORMAPS, 0.0, 1.0);

View file

@ -45,6 +45,7 @@ struct _ native // These are the global variables, the struct is only here to av
native ui BaseStatusBar StatusBar;
native readonly Weapon WP_NOCHANGE;
native int LocalViewPitch;
native ui readonly LevelLocals currentUILevel;
}

View file

@ -509,7 +509,7 @@ class ConversationMenu : Menu
override void Ticker()
{
// [CW] Freeze the game depending on MAPINFO options.
if (ConversationPauseTic < gametic && !multiplayer && !level.no_dlg_freeze)
if (ConversationPauseTic < gametic && !multiplayer && !currentUILevel.no_dlg_freeze)
{
menuactive = Menu.On;
}

View file

@ -57,9 +57,9 @@ class ReadThisMenu : GenericMenu
TextureID tex, prevpic;
// Did the mapper choose a custom help page via MAPINFO?
if (level.F1Pic.Length() != 0)
if (currentUILevel.F1Pic.Length() != 0)
{
tex = TexMan.CheckForTexture(level.F1Pic, TexMan.Type_MiscPatch);
tex = TexMan.CheckForTexture(currentUILevel.F1Pic, TexMan.Type_MiscPatch);
mScreen = 1;
}
@ -98,7 +98,7 @@ class ReadThisMenu : GenericMenu
MenuSound("menu/choose");
mScreen++;
mInfoTic = gametic;
if (level.F1Pic.Length() != 0 || mScreen > gameinfo.infoPages.Size())
if (currentUILevel.F1Pic.Length() != 0 || mScreen > gameinfo.infoPages.Size())
{
Close();
}

View file

@ -205,17 +205,17 @@ class AltHud ui
// work in cooperative hub games
if (hud_showsecrets)
{
DrawStatLine(x, y, "S:", String.Format("%i/%i ", multiplayer? CPlayer.secretcount : level.found_secrets, level.total_secrets));
DrawStatLine(x, y, "S:", String.Format("%i/%i ", multiplayer? CPlayer.secretcount : currentUILevel.found_secrets, currentUILevel.total_secrets));
}
if (hud_showitems)
{
DrawStatLine(x, y, "I:", String.Format("%i/%i ", multiplayer? CPlayer.itemcount : level.found_items, level.total_items));
DrawStatLine(x, y, "I:", String.Format("%i/%i ", multiplayer? CPlayer.itemcount : currentUILevel.found_items, currentUILevel.total_items));
}
if (hud_showmonsters)
{
DrawStatLine(x, y, "K:", String.Format("%i/%i ", multiplayer? CPlayer.killcount : level.killed_monsters, level.total_monsters));
DrawStatLine(x, y, "K:", String.Format("%i/%i ", multiplayer? CPlayer.killcount : currentUILevel.killed_monsters, currentUILevel.total_monsters));
}
}
}
@ -739,18 +739,18 @@ class AltHud ui
}
else
{
pos.xy = Level.GetAutomapPosition();
pos.xy = currentUILevel.GetAutomapPosition();
pos.z = Sector.PointInSector(pos.xy).floorplane.ZatPoint(pos.xy);
}
int xpos = hudwidth - SmallFont.StringWidth("X: -00000")-6;
int ypos = 18;
screen.DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont.StringWidth(level.MapName), ypos, level.MapName,
screen.DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont.StringWidth(currentUILevel.MapName), ypos, currentUILevel.MapName,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
screen.DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont.StringWidth(level.LevelName), ypos + h, level.LevelName,
screen.DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont.StringWidth(currentUILevel.LevelName), ypos + h, currentUILevel.LevelName,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
@ -793,10 +793,10 @@ class AltHud ui
{
int timeTicks =
hud_showtime < 4
? level.maptime
? currentUILevel.maptime
: (hud_showtime < 6
? level.time
: level.totaltime);
? currentUILevel.time
: currentUILevel.totaltime);
timeSeconds = Thinker.Tics2Seconds(timeTicks);
}
else
@ -815,7 +815,7 @@ class AltHud ui
if (showMillis)
{
int millis = (level.time % Thinker.TICRATE) * (1000 / Thinker.TICRATE);
int millis = (currentUILevel.time % Thinker.TICRATE) * (1000 / Thinker.TICRATE);
timeString = String.Format("%02i:%02i:%02i.%03i", hours, minutes, seconds, millis);
}
else if (showSeconds)
@ -946,23 +946,23 @@ class AltHud ui
if (am_showtotaltime)
{
DrawTimeString(SmallFont, hudcolor_ttim, level.totaltime, hudwidth-2, bottom, 1);
DrawTimeString(SmallFont, hudcolor_ttim, currentUILevel.totaltime, hudwidth-2, bottom, 1);
bottom -= fonth;
}
if (am_showtime)
{
if (level.clusterflags & level.CLUSTER_HUB)
if (currentUILevel.clusterflags & currentUILevel.CLUSTER_HUB)
{
DrawTimeString(SmallFont, hudcolor_time, level.time, hudwidth-2, bottom, 1);
DrawTimeString(SmallFont, hudcolor_time, currentUILevel.time, hudwidth-2, bottom, 1);
bottom -= fonth;
}
// Single level time for hubs
DrawTimeString(SmallFont, hudcolor_ltim, level.maptime, hudwidth-2, bottom, 1);
DrawTimeString(SmallFont, hudcolor_ltim, currentUILevel.maptime, hudwidth-2, bottom, 1);
}
screen.DrawText(SmallFont, 0, 1, hudheight - fonth - 1, level.FormatMapName(hudcolor_titl),
screen.DrawText(SmallFont, 0, 1, hudheight - fonth - 1, currentUILevel.FormatMapName(hudcolor_titl),
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);

View file

@ -105,7 +105,7 @@ class DoomStatusBar : BaseStatusBar
DrawImage("STFBANY", (143, 168), DI_ITEM_OFFSETS|DI_TRANSLATABLE);
}
if (CPlayer.mo.InvSel != null && !level.NoInventoryBar)
if (CPlayer.mo.InvSel != null && !currentUILevel.NoInventoryBar)
{
DrawInventoryIcon(CPlayer.mo.InvSel, (160, 198));
if (CPlayer.mo.InvSel.Amount > 1)
@ -153,7 +153,7 @@ class DoomStatusBar : BaseStatusBar
DrawString(mHUDFont, FormatNumber(ammotype2.Amount, 3), (-30, invY), DI_TEXT_ALIGN_RIGHT);
invY -= 20;
}
if (!isInventoryBarVisible() && !level.NoInventoryBar && CPlayer.mo.InvSel != null)
if (!isInventoryBarVisible() && !currentUILevel.NoInventoryBar && CPlayer.mo.InvSel != null)
{
DrawInventoryIcon(CPlayer.mo.InvSel, (-14, invY + 17));
DrawString(mHUDFont, FormatNumber(CPlayer.mo.InvSel.Amount, 3), (-30, invY), DI_TEXT_ALIGN_RIGHT);

View file

@ -60,7 +60,7 @@ class HarmonyStatusBar : DoomStatusBar
DrawString(mHUDFont, FormatNumber(ammotype2.Amount, 3), (-30, invY), DI_TEXT_ALIGN_RIGHT);
invY -= 20;
}
if (!isInventoryBarVisible() && !level.NoInventoryBar && CPlayer.mo.InvSel != null)
if (!isInventoryBarVisible() && !currentUILevel.NoInventoryBar && CPlayer.mo.InvSel != null)
{
DrawInventoryIcon(CPlayer.mo.InvSel, (-14, invY + 17));
DrawString(mHUDFont, FormatNumber(CPlayer.mo.InvSel.Amount, 3), (-30, invY), DI_TEXT_ALIGN_RIGHT);

View file

@ -43,7 +43,7 @@ class HereticStatusBar : BaseStatusBar
mHealthInterpolator.Update(CPlayer.health);
// wiggle the chain if it moves
if (level.time & 1)
if (currentUILevel.time & 1)
{
wiggle = (mHealthInterpolator.GetValue() != CPlayer.health) && Random[ChainWiggle](0, 1);
}
@ -200,7 +200,7 @@ class HereticStatusBar : BaseStatusBar
y -= 40;
}
if (!isInventoryBarVisible() && !level.NoInventoryBar && CPlayer.mo.InvSel != null)
if (!isInventoryBarVisible() && !currentUILevel.NoInventoryBar && CPlayer.mo.InvSel != null)
{
// This code was changed to always fit the item into the box, regardless of alignment or sprite size.
// Heretic's ARTIBOX is 30x30 pixels.

View file

@ -74,7 +74,7 @@ class HexenStatusBar : BaseStatusBar
DrawString(mHUDFont, FormatNumber(CPlayer.FragCount, 3), (70, -16));
}
if (!isInventoryBarVisible() && !level.NoInventoryBar && CPlayer.mo.InvSel != null)
if (!isInventoryBarVisible() && !currentUILevel.NoInventoryBar && CPlayer.mo.InvSel != null)
{
// This code was changed to always fit the item into the box, regardless of alignment or sprite size.
// Heretic's ARTIBOX is 30x30 pixels.

View file

@ -597,9 +597,9 @@ class BaseStatusBar native ui
int GetAirTime()
{
if(CPlayer.mo.waterlevel < 3)
return level.airsupply;
return currentUILevel.airsupply;
else
return max(CPlayer.air_finished - level.time, 0);
return max(CPlayer.air_finished - currentUILevel.time, 0);
}
int GetSelectedInventoryAmount()
@ -654,7 +654,7 @@ class BaseStatusBar native ui
bool isInventoryBarVisible()
{
if (CPlayer == null) return false;
return (CPlayer.inventorytics > 0 && !level.NoInventoryBar);
return (CPlayer.inventorytics > 0 && !currentUILevel.NoInventoryBar);
}
//============================================================================
@ -850,13 +850,13 @@ class BaseStatusBar native ui
let width = SmallFont.StringWidth("00:00:00");
if (am_showtime)
{
printtext = level.TimeFormatted();
DrawString(mSmallFont, level.TimeFormatted(), (-textdist-width, y), 0, crdefault);
printtext = currentUILevel.TimeFormatted();
DrawString(mSmallFont, currentUILevel.TimeFormatted(), (-textdist-width, y), 0, crdefault);
y += height;
}
if (am_showtotaltime)
{
DrawString(mSmallFont, level.TimeFormatted(true), (-textdist-width, y), 0, crdefault);
DrawString(mSmallFont, currentUILevel.TimeFormatted(true), (-textdist-width, y), 0, crdefault);
}
if (!deathmatch)
@ -866,25 +866,25 @@ class BaseStatusBar native ui
// Draw monster count
if (am_showmonsters)
{
DrawString(mSmallFont, String.Format("%s\34%c %d/%d", Stringtable.Localize("$AM_MONSTERS"), crdefault+65, level.killed_monsters, level.total_monsters), (textdist, y), 0, highlight);
DrawString(mSmallFont, String.Format("%s\34%c %d/%d", Stringtable.Localize("$AM_MONSTERS"), crdefault+65, currentUILevel.killed_monsters, currentUILevel.total_monsters), (textdist, y), 0, highlight);
y += height;
}
// Draw secret count
if (am_showsecrets)
{
DrawString(mSmallFont, String.Format("%s\34%c %d/%d", Stringtable.Localize("$AM_SECRETS"), crdefault+65, level.found_secrets, level.total_secrets), (textdist, y), 0, highlight);
DrawString(mSmallFont, String.Format("%s\34%c %d/%d", Stringtable.Localize("$AM_SECRETS"), crdefault+65, currentUILevel.found_secrets, currentUILevel.total_secrets), (textdist, y), 0, highlight);
y += height;
}
// Draw item count
if (am_showitems)
{
DrawString(mSmallFont, String.Format("%s\34%c %d/%d", Stringtable.Localize("$AM_ITEMS"), crdefault+65, level.found_items, level.total_items), (textdist, y), 0, highlight);
DrawString(mSmallFont, String.Format("%s\34%c %d/%d", Stringtable.Localize("$AM_ITEMS"), crdefault+65, currentUILevel.found_items, currentUILevel.total_items), (textdist, y), 0, highlight);
}
}
String mapname = level.FormatMapName(crdefault);
String mapname = currentUILevel.FormatMapName(crdefault);
BrokenLines lines = SmallFont.BreakLines(mapname, int(SCREENWIDTH / scale.X));
int numlines = lines.Count();
int finalwidth = int(SmallFont.StringWidth(lines.StringAt(numlines-1)) * scale.X);

View file

@ -427,7 +427,7 @@ class StrifeStatusBar : BaseStatusBar
case POP_Log:
{
// Draw the latest log message.
screen.DrawText(SmallFont2, Font.CR_UNTRANSLATED, left + 210 * xscale, top + 8 * yscale, Level.TimeFormatted(),
screen.DrawText(SmallFont2, Font.CR_UNTRANSLATED, left + 210 * xscale, top + 8 * yscale, currentUILevel.TimeFormatted(),
DTA_CleanNoMove, true);
if (CPlayer.LogText.Length() > 0)