- Added HUD message visibility flags, which are ORed into the type field:
* HUDMSG_NOTWITH3DVIEW : This message does not appear when the 3D view is active.
* HUDMSG_NOTWITHFULLMAP : This message does not appear when the fullscreen automap is active.
* HUDMSG_NOTWITHOVERLAYMAP : This message does not appear when the overlay automap is active.
These flags may be combined, so for example: HUDMSG_NOTWITHFULLMAP | HUDMSG_NOTWITHOVERLAYMAP
would prevent the message from appearing if any form of automap is active.
- Added HUD message layers, which are ORed into the type field:
* HUDMSG_LAYER_OVERHUD : This is the default and standard behavior. The message appear on
top of most HUD elements. This definition is just included for completeness' sake; you
don't need to explicitly use it.
* HUDMSG_LAYER_UNDERHUD : The message appears underneath other HUD elements, such as the status bar.
* HUDMSG_LAYER_OVERMAP : The message appears on top of the fullscreen automap. At the moment,
this layer is functionally equivalent to using the flags HUDMSG_NOTWITH3DVIEW | HUDMSG_NOTWITHOVERLAYMAP.
However, if Blzut3 decides to implement support for drawing the automap permanently on a
second screen, messages on this layer will move to that screen with the automap and be permanently
visible as long as the map is visible on that other screen.
These are not flags, so for example HUDMSG_LAYER_UNDERHUD | HUDMSG_LAYER_OVERHUD is not valid.
SVN r3821 (trunk)
This commit is contained in:
parent
27f6d431ca
commit
73552f0365
5 changed files with 198 additions and 111 deletions
|
|
@ -220,7 +220,7 @@ DBaseStatusBar::DBaseStatusBar (int reltop, int hres, int vres)
|
|||
FixedOrigin = false;
|
||||
CrosshairSize = FRACUNIT;
|
||||
RelTop = reltop;
|
||||
Messages = NULL;
|
||||
memset(Messages, 0, sizeof(Messages));
|
||||
Displacement = 0;
|
||||
CPlayer = NULL;
|
||||
ShowLog = false;
|
||||
|
|
@ -238,16 +238,17 @@ DBaseStatusBar::DBaseStatusBar (int reltop, int hres, int vres)
|
|||
|
||||
void DBaseStatusBar::Destroy ()
|
||||
{
|
||||
DHUDMessage *msg;
|
||||
|
||||
msg = Messages;
|
||||
while (msg)
|
||||
for (int i = 0; i < countof(Messages); ++i)
|
||||
{
|
||||
DHUDMessage *next = msg->Next;
|
||||
msg->Destroy();
|
||||
msg = next;
|
||||
DHUDMessage *msg = Messages[i];
|
||||
while (msg)
|
||||
{
|
||||
DHUDMessage *next = msg->Next;
|
||||
msg->Destroy();
|
||||
msg = next;
|
||||
}
|
||||
Messages[i] = NULL;
|
||||
}
|
||||
Messages = NULL;
|
||||
Super::Destroy();
|
||||
}
|
||||
|
||||
|
|
@ -339,32 +340,35 @@ void DBaseStatusBar::MultiplayerChanged ()
|
|||
|
||||
void DBaseStatusBar::Tick ()
|
||||
{
|
||||
DHUDMessage *msg = Messages;
|
||||
DHUDMessage **prev = &Messages;
|
||||
|
||||
while (msg)
|
||||
for (int i = 0; i < countof(Messages); ++i)
|
||||
{
|
||||
DHUDMessage *next = msg->Next;
|
||||
DHUDMessage *msg = Messages[i];
|
||||
DHUDMessage **prev = &Messages[i];
|
||||
|
||||
if (msg->Tick ())
|
||||
while (msg)
|
||||
{
|
||||
*prev = next;
|
||||
msg->Destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
prev = &msg->Next;
|
||||
}
|
||||
msg = next;
|
||||
}
|
||||
DHUDMessage *next = msg->Next;
|
||||
|
||||
// If the crosshair has been enlarged, shrink it.
|
||||
if (CrosshairSize > FRACUNIT)
|
||||
{
|
||||
CrosshairSize -= XHAIRSHRINKSIZE;
|
||||
if (CrosshairSize < FRACUNIT)
|
||||
if (msg->Tick ())
|
||||
{
|
||||
*prev = next;
|
||||
msg->Destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
prev = &msg->Next;
|
||||
}
|
||||
msg = next;
|
||||
}
|
||||
|
||||
// If the crosshair has been enlarged, shrink it.
|
||||
if (CrosshairSize > FRACUNIT)
|
||||
{
|
||||
CrosshairSize = FRACUNIT;
|
||||
CrosshairSize -= XHAIRSHRINKSIZE;
|
||||
if (CrosshairSize < FRACUNIT)
|
||||
{
|
||||
CrosshairSize = FRACUNIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -375,7 +379,7 @@ void DBaseStatusBar::Tick ()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DBaseStatusBar::AttachMessage (DHUDMessage *msg, DWORD id)
|
||||
void DBaseStatusBar::AttachMessage (DHUDMessage *msg, DWORD id, int layer)
|
||||
{
|
||||
DHUDMessage *old = NULL;
|
||||
DHUDMessage **prev;
|
||||
|
|
@ -387,7 +391,7 @@ void DBaseStatusBar::AttachMessage (DHUDMessage *msg, DWORD id)
|
|||
old->Destroy();
|
||||
}
|
||||
|
||||
prev = &Messages;
|
||||
prev = &Messages[layer];
|
||||
|
||||
// The ID serves as a priority, where lower numbers appear in front of
|
||||
// higher numbers. (i.e. The list is sorted in descending order, since
|
||||
|
|
@ -412,48 +416,56 @@ void DBaseStatusBar::AttachMessage (DHUDMessage *msg, DWORD id)
|
|||
|
||||
DHUDMessage *DBaseStatusBar::DetachMessage (DHUDMessage *msg)
|
||||
{
|
||||
DHUDMessage *probe = Messages;
|
||||
DHUDMessage **prev = &Messages;
|
||||
for (int i = 0; i < countof(Messages); ++i)
|
||||
{
|
||||
DHUDMessage *probe = Messages[i];
|
||||
DHUDMessage **prev = &Messages[i];
|
||||
|
||||
while (probe && probe != msg)
|
||||
{
|
||||
prev = &probe->Next;
|
||||
probe = probe->Next;
|
||||
}
|
||||
if (probe != NULL)
|
||||
{
|
||||
*prev = probe->Next;
|
||||
probe->Next = NULL;
|
||||
// Redraw the status bar in case it was covered
|
||||
if (screen != NULL)
|
||||
while (probe && probe != msg)
|
||||
{
|
||||
SB_state = screen->GetPageCount();
|
||||
prev = &probe->Next;
|
||||
probe = probe->Next;
|
||||
}
|
||||
if (probe != NULL)
|
||||
{
|
||||
*prev = probe->Next;
|
||||
probe->Next = NULL;
|
||||
// Redraw the status bar in case it was covered
|
||||
if (screen != NULL)
|
||||
{
|
||||
SB_state = screen->GetPageCount();
|
||||
}
|
||||
return probe;
|
||||
}
|
||||
}
|
||||
return probe;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DHUDMessage *DBaseStatusBar::DetachMessage (DWORD id)
|
||||
{
|
||||
DHUDMessage *probe = Messages;
|
||||
DHUDMessage **prev = &Messages;
|
||||
for (int i = 0; i < countof(Messages); ++i)
|
||||
{
|
||||
DHUDMessage *probe = Messages[i];
|
||||
DHUDMessage **prev = &Messages[i];
|
||||
|
||||
while (probe && probe->SBarID != id)
|
||||
{
|
||||
prev = &probe->Next;
|
||||
probe = probe->Next;
|
||||
}
|
||||
if (probe != NULL)
|
||||
{
|
||||
*prev = probe->Next;
|
||||
probe->Next = NULL;
|
||||
// Redraw the status bar in case it was covered
|
||||
if (screen != NULL)
|
||||
while (probe && probe->SBarID != id)
|
||||
{
|
||||
SB_state = screen->GetPageCount();
|
||||
prev = &probe->Next;
|
||||
probe = probe->Next;
|
||||
}
|
||||
if (probe != NULL)
|
||||
{
|
||||
*prev = probe->Next;
|
||||
probe->Next = NULL;
|
||||
// Redraw the status bar in case it was covered
|
||||
if (screen != NULL)
|
||||
{
|
||||
SB_state = screen->GetPageCount();
|
||||
}
|
||||
return probe;
|
||||
}
|
||||
}
|
||||
return probe;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -464,31 +476,18 @@ DHUDMessage *DBaseStatusBar::DetachMessage (DWORD id)
|
|||
|
||||
void DBaseStatusBar::DetachAllMessages ()
|
||||
{
|
||||
DHUDMessage *probe = Messages;
|
||||
|
||||
Messages = NULL;
|
||||
while (probe != NULL)
|
||||
for (int i = 0; i < countof(Messages); ++i)
|
||||
{
|
||||
DHUDMessage *next = probe->Next;
|
||||
probe->Destroy();
|
||||
probe = next;
|
||||
}
|
||||
}
|
||||
DHUDMessage *probe = Messages[i];
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC CheckMessage
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool DBaseStatusBar::CheckMessage (DHUDMessage *msg)
|
||||
{
|
||||
DHUDMessage *probe = Messages;
|
||||
while (probe && probe != msg)
|
||||
{
|
||||
probe = probe->Next;
|
||||
Messages[i] = NULL;
|
||||
while (probe != NULL)
|
||||
{
|
||||
DHUDMessage *next = probe->Next;
|
||||
probe->Destroy();
|
||||
probe = next;
|
||||
}
|
||||
}
|
||||
return (probe == msg);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -1191,13 +1190,23 @@ void DBaseStatusBar::FlashCrosshair ()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DBaseStatusBar::DrawMessages (int bottom)
|
||||
void DBaseStatusBar::DrawMessages (int layer, int bottom)
|
||||
{
|
||||
DHUDMessage *msg = Messages;
|
||||
DHUDMessage *msg = Messages[layer];
|
||||
int visibility = 0;
|
||||
|
||||
if (viewactive)
|
||||
{
|
||||
visibility |= HUDMSG_NotWith3DView;
|
||||
}
|
||||
if (automapactive)
|
||||
{
|
||||
visibility |= viewactive ? HUDMSG_NotWithOverlayMap : HUDMSG_NotWithFullMap;
|
||||
}
|
||||
while (msg)
|
||||
{
|
||||
DHUDMessage *next = msg->Next;
|
||||
msg->Draw (bottom);
|
||||
msg->Draw (bottom, visibility);
|
||||
msg = next;
|
||||
}
|
||||
}
|
||||
|
|
@ -1445,6 +1454,17 @@ void DBaseStatusBar::SetMugShotState(const char *stateName, bool waitTillDone, b
|
|||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// DrawBottomStuff
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DBaseStatusBar::DrawBottomStuff (EHudState state)
|
||||
{
|
||||
DrawMessages (HUDMSGLayer_UnderHUD, (state == HUD_StatusBar) ? ::ST_Y : SCREENHEIGHT);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// DrawTopStuff
|
||||
|
|
@ -1462,16 +1482,11 @@ void DBaseStatusBar::DrawTopStuff (EHudState state)
|
|||
}
|
||||
|
||||
DrawPowerups ();
|
||||
|
||||
if (state == HUD_StatusBar)
|
||||
if (automapactive && !viewactive)
|
||||
{
|
||||
DrawMessages (::ST_Y);
|
||||
DrawMessages (HUDMSGLayer_OverMap, (state == HUD_StatusBar) ? ::ST_Y : SCREENHEIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawMessages (SCREENHEIGHT);
|
||||
}
|
||||
|
||||
DrawMessages (HUDMSGLayer_OverHUD, (state == HUD_StatusBar) ? ::ST_Y : SCREENHEIGHT);
|
||||
DrawConsistancy ();
|
||||
if (ShowLog && MustDrawLog(state)) DrawLog ();
|
||||
|
||||
|
|
@ -1597,7 +1612,18 @@ void DBaseStatusBar::ReceivedWeapon (AWeapon *weapon)
|
|||
|
||||
void DBaseStatusBar::Serialize (FArchive &arc)
|
||||
{
|
||||
arc << Messages;
|
||||
if (SaveVersion < 3821)
|
||||
{
|
||||
memset(Messages, 0, sizeof(Messages));
|
||||
arc << Messages[HUDMSGLayer_Default];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < countof(Messages); ++i)
|
||||
{
|
||||
arc << Messages[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DBaseStatusBar::ScreenSizeChanged ()
|
||||
|
|
@ -1605,11 +1631,14 @@ void DBaseStatusBar::ScreenSizeChanged ()
|
|||
st_scale.Callback ();
|
||||
SB_state = screen->GetPageCount ();
|
||||
|
||||
DHUDMessage *message = Messages;
|
||||
while (message != NULL)
|
||||
for (int i = 0; i < countof(Messages); ++i)
|
||||
{
|
||||
message->ScreenSizeChanged ();
|
||||
message = message->Next;
|
||||
DHUDMessage *message = Messages[i];
|
||||
while (message != NULL)
|
||||
{
|
||||
message->ScreenSizeChanged ();
|
||||
message = message->Next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue