Skip to content

Commit

Permalink
Refactor|libcommon: Reuse existing title patch finder; added R_Status…
Browse files Browse the repository at this point in the history
…BarSize
  • Loading branch information
skyjake committed Jul 24, 2013
1 parent 515de32 commit 90bf0e4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 2 additions & 0 deletions doomsday/plugins/common/include/r_common.h
Expand Up @@ -70,6 +70,8 @@ void R_GetGammaMessageStrings(void);

void R_CycleGammaLevel(void);

void R_StatusBarSize(int player, Size2Raw *statusBarSize);

#ifdef __cplusplus
} // extern "C"
#endif
Expand Down
19 changes: 5 additions & 14 deletions doomsday/plugins/common/src/hu_stuff.cpp
Expand Up @@ -1451,19 +1451,7 @@ void Hu_FogEffectSetAlphaTarget(float alpha)
#if __JDOOM__ || __JDOOM64__
patchid_t Hu_MapTitlePatchId(void)
{
uint mapNum;

// Compose the mapnumber used to check the map name patches array.
#if __JDOOM__
if(gameModeBits & (GM_ANY_DOOM2|GM_DOOM_CHEX))
mapNum = gameMap;
else
mapNum = (gameEpisode * 9) + gameMap;
#else // __JDOOM64__
mapNum = gameMap;
#endif

return (mapNum < pMapNamesSize? pMapNames[mapNum] : 0);
return P_FindMapTitlePatch(gameEpisode, gameMap);
}

int Hu_MapTitleFirstLineHeight(void)
Expand Down Expand Up @@ -1579,10 +1567,13 @@ void Hu_MapTitleDrawer(const RectRaw* portGeometry)
Point2Raw origin(portGeometry->size.width / 2,
6 * portGeometry->size.height / SCREENHEIGHT);

// Should the title be positioned above the status bar?
if(cfg.automapTitleAtBottom && ST_AutomapIsActive(DISPLAYPLAYER) && (actualMapTime > 6 * TICSPERSEC))
{
Size2Raw stBarSize;
R_StatusBarSize(DISPLAYPLAYER, &stBarSize);
origin.y = portGeometry->size.height *
(SCREENHEIGHT - 1.2f * (cfg.statusbarScale * ST_HEIGHT + Hu_MapTitleHeight()))/float(SCREENHEIGHT);
(SCREENHEIGHT - stBarSize.height - 1.2f * Hu_MapTitleHeight()) / float(SCREENHEIGHT);
}

DGL_MatrixMode(DGL_MODELVIEW);
Expand Down
7 changes: 7 additions & 0 deletions doomsday/plugins/common/src/r_common.c
Expand Up @@ -112,6 +112,13 @@ static void calcStatusBarSize(Size2Raw* size, Size2Rawf* viewScale, int maxWidth
#endif
}

void R_StatusBarSize(int player, Size2Raw *statusBarSize)
{
Size2Raw viewSize;
R_ViewWindowSize(player, &viewSize);
calcStatusBarSize(statusBarSize, &viewScale, viewSize.width);
}

static void resizeViewWindow(int player, const RectRaw* newGeometry,
const RectRaw* oldGeometry, boolean interpolate)
{
Expand Down

0 comments on commit 90bf0e4

Please sign in to comment.