Skip to content

Commit

Permalink
Merge branch 'master' of ssh://deng.git.sourceforge.net/gitroot/deng/…
Browse files Browse the repository at this point in the history
…deng
  • Loading branch information
danij-deng committed Feb 12, 2012
2 parents 85dd9c5 + 9424be8 commit bd19127
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/g_controls.c
Expand Up @@ -177,7 +177,7 @@ void G_ControlRegister(void)
for(i = 0; controlCmds[i].name; ++i)
Con_AddCommand(controlCmds + i);

// FIXME: Is this is the proper place, this being a console registering function?
/// @todo Move the control setup to a separate function.
P_NewPlayerControl(CTL_WALK, CTLT_NUMERIC, "walk", "game");
P_NewPlayerControl(CTL_SIDESTEP, CTLT_NUMERIC, "sidestep", "game");
P_NewPlayerControl(CTL_ZFLY, CTLT_NUMERIC, "zfly", "game");
Expand Down
32 changes: 31 additions & 1 deletion doomsday/plugins/common/src/hu_automap.c
Expand Up @@ -153,6 +153,7 @@ static void calcViewScaleFactors(uiwidget_t* obj)
{
guidata_automap_t* am = (guidata_automap_t*)obj->typedata;
float dx, dy, dist, a, b;
float oldMinScale = am->minScaleMTOF;
assert(obj->type == GUI_AUTOMAP);

dx = am->bounds[BOXRIGHT] - am->bounds[BOXLEFT];
Expand All @@ -167,6 +168,16 @@ static void calcViewScaleFactors(uiwidget_t* obj)
am->minScaleMTOF = (a < b ? a : b);
am->maxScaleMTOF = Rect_Height(UIWidget_Geometry(obj)) / am->minScale;

#ifdef _DEBUG
Con_Message("calcViewScaleFactors: dx=%f dy=%f dist=%f w=%i h=%i a=%f b=%f minmtof=%f\n",
dx, dy, dist, Rect_Width(UIWidget_Geometry(obj)),
Rect_Height(UIWidget_Geometry(obj)), a, b, am->minScaleMTOF);
#endif

// Update previously set view scale accordingly.
/// @todo The view scale factor needs to be resolution independent!
am->targetViewScale = am->viewScale = am->minScaleMTOF/oldMinScale * am->targetViewScale;

am->updateViewScale = false;
}

Expand Down Expand Up @@ -1508,7 +1519,11 @@ DGL_End();
{
rendThingPoints(obj);
}

// Sharp player markers.
DGL_SetFloat(DGL_LINE_WIDTH, 1.f);
rendPlayerMarkers(obj);

DGL_SetFloat(DGL_LINE_WIDTH, oldLineWidth);

if(amMaskTexture)
Expand Down Expand Up @@ -1851,6 +1866,13 @@ void UIAutomap_UpdateGeometry(uiwidget_t* obj)
// the position and/or size of the automap must therefore change too.
R_ViewWindowGeometry(UIWidget_Player(obj), &newGeom);

/*#ifdef _DEBUG
Con_Message("UIAutomap_UpdateGeometry: newGeom %i,%i %i,%i current %i,%i %i,%i\n",
newGeom.origin.x, newGeom.origin.y,
newGeom.size.width, newGeom.size.height,
Rect_X(obj->geometry), Rect_Y(obj->geometry), Rect_Width(obj->geometry), Rect_Height(obj->geometry));
#endif*/

if(newGeom.origin.x != Rect_X(obj->geometry) ||
newGeom.origin.y != Rect_Y(obj->geometry) ||
newGeom.size.width != Rect_Width(obj->geometry) ||
Expand Down Expand Up @@ -2242,8 +2264,16 @@ void UIAutomap_SetWorldBounds(uiwidget_t* obj, float lowX, float hiX, float lowY
am->bounds[BOXBOTTOM] = lowY;
am->updateViewScale = true;

// Update minScaleMTOF.
calcViewScaleFactors(obj);

#ifdef _DEBUG
Con_Message("SetWorldBounds: low=%f,%f hi=%f,%f minScaleMTOF=%f\n", lowX, lowY, hiX, hiY,
am->minScaleMTOF);
#endif

// Choose a default view scale factor.
UIAutomap_SetScale(obj, am->minScaleMTOF * 20);
UIAutomap_SetScale(obj, am->minScaleMTOF * 2.4f);
}

void UIAutomap_SetMinScale(uiwidget_t* obj, const float scale)
Expand Down

0 comments on commit bd19127

Please sign in to comment.