Skip to content

Commit

Permalink
Fixed|All Games: Centering the map title text
Browse files Browse the repository at this point in the history
When drawing the map title, the scale factor was incorrectly being
applied to the horizontal alignment offset, even though the title
is always supposed to be in the center of the viewport (and thus the
scale factor should not affect it at all).
  • Loading branch information
skyjake committed Dec 13, 2012
1 parent 2af25a9 commit 654e250
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions doomsday/plugins/common/src/hu_stuff.cpp
Expand Up @@ -1517,22 +1517,26 @@ void Hu_DrawMapTitle(const Point2Raw* offset)

void Hu_MapTitleDrawer(const RectRaw* portGeometry)
{
Point2Raw origin(SCREENWIDTH/2, 6);
Point2Raw origin(portGeometry->size.width / 2,
6 * portGeometry->size.height / SCREENHEIGHT);
float scale;

if(!portGeometry) return;

// Level information is shown for a few seconds in the beginning of a level.
if(!cfg.mapTitle || (actualMapTime > 6 * TICSPERSEC)) return;

DGL_MatrixMode(DGL_MODELVIEW);
DGL_PushMatrix();

// After scaling, the title is centered horizontally on the screen.
DGL_Translatef(origin.x, origin.y, 0);

// Scale according to the viewport size.
R_ChooseAlignModeAndScaleFactor(&scale, SCREENWIDTH, SCREENHEIGHT,
portGeometry->size.width, portGeometry->size.height,
scalemode_t(cfg.menuScaleMode));

DGL_MatrixMode(DGL_MODELVIEW);
DGL_PushMatrix();
DGL_Scalef(scale, scale * 1.2f/*aspect correct*/, 1);
DGL_Translatef(origin.x, origin.y, 0);

// Make the title 3/4 smaller.
DGL_Scalef(.75f, .75f, 1);
Expand Down

0 comments on commit 654e250

Please sign in to comment.