Stop HUD messages from ticking when game is paused
These are often synchronized to the world so should be treated as such.
This commit is contained in:
parent
0e3682ae24
commit
bfefd2363e
3 changed files with 44 additions and 17 deletions
|
|
@ -71,6 +71,8 @@
|
|||
#define XHAIRPICKUPSIZE (2+XHAIRSHRINKSIZE)
|
||||
#define POWERUPICONSIZE 32
|
||||
|
||||
int WorldPaused();
|
||||
|
||||
IMPLEMENT_CLASS(DBaseStatusBar, false, true)
|
||||
|
||||
IMPLEMENT_POINTERS_START(DBaseStatusBar)
|
||||
|
|
@ -682,31 +684,34 @@ int DBaseStatusBar::GetPlayer ()
|
|||
|
||||
void DBaseStatusBar::Tick ()
|
||||
{
|
||||
PrevCrosshairSize = CrosshairSize;
|
||||
|
||||
for (size_t i = 0; i < countof(Messages); ++i)
|
||||
if (!WorldPaused())
|
||||
{
|
||||
DHUDMessageBase *msg = Messages[i];
|
||||
PrevCrosshairSize = CrosshairSize;
|
||||
|
||||
while (msg)
|
||||
for (size_t i = 0; i < countof(Messages); ++i)
|
||||
{
|
||||
DHUDMessageBase *next = msg->Next;
|
||||
DHUDMessageBase* msg = Messages[i];
|
||||
|
||||
if (msg->CallTick ())
|
||||
while (msg)
|
||||
{
|
||||
DetachMessage(msg);
|
||||
msg->Destroy();
|
||||
DHUDMessageBase* next = msg->Next;
|
||||
|
||||
if (msg->CallTick())
|
||||
{
|
||||
DetachMessage(msg);
|
||||
msg->Destroy();
|
||||
}
|
||||
msg = next;
|
||||
}
|
||||
msg = next;
|
||||
}
|
||||
|
||||
// If the crosshair has been enlarged, shrink it.
|
||||
if (CrosshairSize > 1.)
|
||||
{
|
||||
CrosshairSize -= XHAIRSHRINKSIZE;
|
||||
if (CrosshairSize < 1.)
|
||||
// If the crosshair has been enlarged, shrink it.
|
||||
if (CrosshairSize > 1.)
|
||||
{
|
||||
CrosshairSize = 1.;
|
||||
CrosshairSize -= XHAIRSHRINKSIZE;
|
||||
if (CrosshairSize < 1.)
|
||||
{
|
||||
CrosshairSize = 1.;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@
|
|||
#include "texturemanager.h"
|
||||
#include "v_draw.h"
|
||||
|
||||
extern int paused;
|
||||
extern bool pauseext;
|
||||
|
||||
DVector2 AM_GetPosition();
|
||||
int Net_GetLatency(int *ld, int *ad);
|
||||
void PrintPickupMessage(bool localview, const FString &str);
|
||||
|
|
@ -499,6 +502,23 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, RemoveForceField, RemoveForceField)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int WorldPaused()
|
||||
{
|
||||
if (paused)
|
||||
return true;
|
||||
|
||||
if (netgame || gamestate != GS_LEVEL)
|
||||
return false;
|
||||
|
||||
return pauseext || menuactive == MENU_On || ConsoleState != c_up;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, WorldPaused, WorldPaused)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
ACTION_RETURN_BOOL(WorldPaused());
|
||||
}
|
||||
|
||||
static sector_t *PointInSectorXY(FLevelLocals *self, double x, double y)
|
||||
{
|
||||
return self->PointInSector(x ,y);
|
||||
|
|
|
|||
|
|
@ -625,6 +625,8 @@ struct LevelLocals native
|
|||
|
||||
native void SpawnParticle(FSpawnParticleParams p);
|
||||
native VisualThinker SpawnVisualThinker(Class<VisualThinker> type);
|
||||
|
||||
clearscope native static bool WorldPaused();
|
||||
}
|
||||
|
||||
// a few values of this need to be readable by the play code.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue