Skip to content

Commit

Permalink
libcommon|Automap: Further map title position improvements
Browse files Browse the repository at this point in the history
Respect 'hud-face' in Doom, and hide the automap title if the inventory
is open in fullscreen in Heretic/Hexen.
  • Loading branch information
skyjake committed Jul 24, 2013
1 parent fb02e1a commit a89f782
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions doomsday/plugins/common/src/hu_stuff.cpp
Expand Up @@ -35,6 +35,7 @@
#include "hu_menu.h"
#include "hu_msg.h"
#include "hu_stuff.h"
#include "hu_inventory.h"
#include "g_common.h"
#include "p_mapsetup.h"
#include "p_tick.h"
Expand Down Expand Up @@ -1570,6 +1571,23 @@ boolean Hu_IsMapTitleVisible(void)
return (actualMapTime < 6 * 35) || ST_AutomapIsActive(DISPLAYPLAYER);
}

static bool needToRespectStatusBarHeightWhenAutomapOpen(void)
{
#ifndef __JDOOM64__
return Hu_IsStatusBarVisible(DISPLAYPLAYER);
#endif

return false;
}

static bool needToRespectHudSizeWhenAutomapOpen(void)
{
#ifdef __JDOOM__
if(cfg.hudShown[HUD_FACE] && !Hu_IsStatusBarVisible(DISPLAYPLAYER)) return true;
#endif
return false;
}

void Hu_MapTitleDrawer(const RectRaw* portGeometry)
{
if(!cfg.mapTitle || !portGeometry) return;
Expand All @@ -1591,14 +1609,24 @@ void Hu_MapTitleDrawer(const RectRaw* portGeometry)
{
float y = SCREENHEIGHT - 1.2f * Hu_MapTitleHeight();

#ifndef __JDOOM64__
if(Hu_IsStatusBarVisible(DISPLAYPLAYER))
#if __JHERETIC__ || __JHEXEN__
if(Hu_InventoryIsOpen(DISPLAYPLAYER) && !Hu_IsStatusBarVisible(DISPLAYPLAYER))
{
// Omit the title altogether while the inventory is open.
return;
}
#endif

if(needToRespectStatusBarHeightWhenAutomapOpen())
{
Size2Raw stBarSize;
R_StatusBarSize(DISPLAYPLAYER, &stBarSize);
y -= stBarSize.height;
}
#endif
else if(needToRespectHudSizeWhenAutomapOpen())
{
y -= 30 * cfg.hudScale;
}

origin.y = portGeometry->size.height * y / float(SCREENHEIGHT);
}
Expand Down

0 comments on commit a89f782

Please sign in to comment.