- 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:
parent
ba114f6f23
commit
4e052f2857
21 changed files with 107 additions and 103 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue