Skip to content

Commit

Permalink
Player Log: Fixed vertical offset scroll calculation
Browse files Browse the repository at this point in the history
The y offset was calculated incorrectly due to code which assumed
it still had to take the vertical aspect ratio into consideration
(this is now handled at a higher level; as far as the head-up
displays are concerned they should assume a square 1:1 aspect in
both geometry and drawing calculations)).
  • Loading branch information
danij-deng committed Jan 2, 2012
1 parent cc9d0fe commit 005e720
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
22 changes: 2 additions & 20 deletions doomsday/plugins/common/src/hu_log.c
Expand Up @@ -339,23 +339,16 @@ void UILog_Drawer(uiwidget_t* obj, const Point2Raw* offset)
msg = &log->_msgs[firstMsg];
if(msg->ticsRemain > 0 && msg->ticsRemain <= (unsigned) lineHeight)
{
Size2Raw portSize;
float scale;

R_ViewPortSize(UIWidget_Player(obj), &portSize);
R_ChooseAlignModeAndScaleFactor(&scale, SCREENWIDTH, SCREENHEIGHT,
portSize.width, portSize.height, SCALEMODE_SMART_STRETCH);

scrollFactor = 1.0f - (((float)msg->ticsRemain)/lineHeight);
yOffset = -lineHeight * scrollFactor * cfg.msgScale * scale;
yOffset = -lineHeight * scrollFactor;
}
else
{
scrollFactor = 0;
yOffset = 0;
}

DGL_MatrixMode(DGL_PROJECTION);
DGL_MatrixMode(DGL_MODELVIEW);
DGL_Translatef(0, yOffset, 0);
DGL_Enable(DGL_TEXTURE_2D);

Expand Down Expand Up @@ -416,10 +409,6 @@ void UILog_Drawer(uiwidget_t* obj, const Point2Raw* offset)
}

DGL_Disable(DGL_TEXTURE_2D);

DGL_MatrixMode(DGL_PROJECTION);
DGL_Translatef(0, -yOffset, 0);

DGL_MatrixMode(DGL_MODELVIEW);
DGL_PopMatrix();
}
Expand Down Expand Up @@ -478,13 +467,6 @@ void UILog_UpdateGeometry(uiwidget_t* obj)
msg = &log->_msgs[firstMsg];
if(msg->ticsRemain > 0 && msg->ticsRemain <= (unsigned) lineHeight)
{
Size2Raw portSize;
float scale;

R_ViewPortSize(UIWidget_Player(obj), &portSize);
R_ChooseAlignModeAndScaleFactor(&scale, SCREENWIDTH, SCREENHEIGHT,
portSize.width, portSize.height, SCALEMODE_SMART_STRETCH);

scrollFactor = 1.0f - (((float)msg->ticsRemain)/lineHeight);
}
else
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/jdoom/src/st_stuff.c
Expand Up @@ -2477,7 +2477,7 @@ static void drawUIWidgetsForPlayer(player_t* plr)

DGL_MatrixMode(DGL_MODELVIEW);
DGL_PushMatrix();
DGL_Scalef(scale, scale, 1);
DGL_Scalef(scale, scale * 1.2f /*aspect correct*/, 1);

obj = GUI_MustFindObjectById(hud->widgetGroupIds[UWG_AUTOMAP]);
UIWidget_SetOpacity(obj, ST_AutomapOpacity(playerNum));
Expand All @@ -2495,7 +2495,7 @@ static void drawUIWidgetsForPlayer(player_t* plr)

displayRegion.origin.x = displayRegion.origin.y = 0;
displayRegion.size.width = .5f + portSize.width / scale;
displayRegion.size.height = .5f + portSize.height / scale;
displayRegion.size.height = .5f + portSize.height / (scale * 1.2f /*aspect correct*/);

if(hud->statusbarActive)
{
Expand Down

0 comments on commit 005e720

Please sign in to comment.