Skip to content

Commit

Permalink
libcommon|Automap: Added cvar 'map-title-position'
Browse files Browse the repository at this point in the history
This variable determines if the map title is drawn in the top or the
bottom of the automap. The default is 1 (bottom).
  • Loading branch information
skyjake committed Jul 23, 2013
1 parent 215e9ce commit 51f92ad
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions doomsday/plugins/common/src/hu_automap.c
Expand Up @@ -126,6 +126,7 @@ void UIAutomap_Register(void)
{ "map-rotate", 0, CVT_BYTE, &cfg.automapRotate, 0, 1 },
{ "map-zoom-speed", 0, CVT_FLOAT, &cfg.automapZoomSpeed, 0, 1 },
{ "map-open-timer", CVF_NO_MAX, CVT_FLOAT, &cfg.automapOpenSeconds, 0, 0 },
{ "map-title-position", 0, CVT_BYTE, &cfg.automapTitleAtBottom, 0, 1},
{ "rend-dev-freeze-map", CVF_NO_ARCHIVE, CVT_BYTE, &freezeMapRLs, 0, 1 },

// Aliases for old names:
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/hu_log.c
Expand Up @@ -289,7 +289,7 @@ void UILog_Drawer(uiwidget_t* obj, const Point2Raw* offset)
guidata_log_message_t* msg;
assert(obj->type == GUI_LOG);

if(Hu_IsMapTitleVisible())
if(Hu_IsMapTitleVisible() && !cfg.automapTitleAtBottom)
{
offsetDueToMapTitle = Hu_MapTitleHeight();
}
Expand Down
18 changes: 13 additions & 5 deletions doomsday/plugins/common/src/hu_stuff.cpp
Expand Up @@ -1569,20 +1569,28 @@ void Hu_MapTitleDrawer(const RectRaw* portGeometry)
{
if(!cfg.mapTitle || !portGeometry) return;

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

// Determine origin of the title.
Point2Raw origin(portGeometry->size.width / 2,
6 * portGeometry->size.height / SCREENHEIGHT);
float scale;

if(cfg.automapTitleAtBottom && ST_AutomapIsActive(DISPLAYPLAYER) && (actualMapTime > 6 * TICSPERSEC))
{
origin.y = portGeometry->size.height *
(SCREENHEIGHT - 1.2f * (cfg.statusbarScale * ST_HEIGHT + Hu_MapTitleHeight()))/float(SCREENHEIGHT);
}

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_Scalef(scale, scale * 1.2f/*aspect correct*/, 1);

// Level information is shown for a few seconds in the beginning of a level.
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/doom/include/d_config.h
Expand Up @@ -199,6 +199,7 @@ typedef struct jdoom_config_s {
float automapPanSpeed;
byte automapPanResetOnOpen;
float automapOpenSeconds;
byte automapTitleAtBottom;

int msgCount;
float msgScale;
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/doom/src/d_main.c
Expand Up @@ -318,6 +318,7 @@ void D_PreInit(void)
cfg.netGravity = -1; // use map default
cfg.plrViewHeight = DEFAULT_PLAYER_VIEWHEIGHT;
cfg.mapTitle = true;
cfg.automapTitleAtBottom = true;
cfg.hideIWADAuthor = true;

cfg.confirmQuickGameSave = true;
Expand Down
3 changes: 3 additions & 0 deletions doomsday/plugins/doom64/include/d_config.h
Expand Up @@ -114,6 +114,8 @@ typedef struct jdoom64_config_s {
int menuTextFlashSpeed;
float menuTextGlitter;

float statusbarScale;

byte inludeScaleMode;
int inludePatchReplaceMode;

Expand Down Expand Up @@ -192,6 +194,7 @@ typedef struct jdoom64_config_s {
float automapPanSpeed;
byte automapPanResetOnOpen;
float automapOpenSeconds;
byte automapTitleAtBottom;

int msgCount;
float msgScale;
Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/doom64/include/st_stuff.h
Expand Up @@ -43,6 +43,8 @@
extern "C" {
#endif

#define ST_HEIGHT 32

// Palette indices.
// For damage/bonus red-/gold-shifts
#define STARTREDPALS (1)
Expand Down
3 changes: 3 additions & 0 deletions doomsday/plugins/doom64/src/d_main.c
Expand Up @@ -237,6 +237,7 @@ void D_PreInit(void)
cfg.netGravity = -1; // Use map default.
cfg.plrViewHeight = DEFAULT_PLAYER_VIEWHEIGHT;
cfg.mapTitle = true;
cfg.automapTitleAtBottom = true;
cfg.hideIWADAuthor = true;
cfg.menuTextColors[0][CR] = 1;
cfg.menuTextColors[0][CG] = 0;
Expand All @@ -254,6 +255,8 @@ void D_PreInit(void)
cfg.menuShortcutsEnabled = true;
cfg.menuGameSaveSuggestName = true;

cfg.statusbarScale = 1;

cfg.confirmQuickGameSave = true;
cfg.confirmRebornLoad = true;
cfg.loadAutoSaveOnReborn = false;
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/heretic/include/h_config.h
Expand Up @@ -189,6 +189,7 @@ typedef struct jheretic_config_s {
float automapPanSpeed;
byte automapPanResetOnOpen;
float automapOpenSeconds;
byte automapTitleAtBottom;

int msgCount;
float msgScale;
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/heretic/src/h_main.c
Expand Up @@ -240,6 +240,7 @@ void H_PreInit(void)
cfg.netGravity = -1; // Use map default.
cfg.plrViewHeight = DEFAULT_PLAYER_VIEWHEIGHT;
cfg.mapTitle = true;
cfg.automapTitleAtBottom = true;
cfg.hideIWADAuthor = true;
cfg.menuTextColors[0][0] = defFontRGB[0];
cfg.menuTextColors[0][1] = defFontRGB[1];
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/hexen/include/x_config.h
Expand Up @@ -153,6 +153,7 @@ typedef struct {
float automapPanSpeed;
byte automapPanResetOnOpen;
float automapOpenSeconds;
byte automapTitleAtBottom;

int messagesOn;
char* chatMacros[10];
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/hexen/src/h2_main.c
Expand Up @@ -216,6 +216,7 @@ void X_PreInit(void)
cfg.netGravity = -1; // use map default
cfg.plrViewHeight = DEFAULT_PLAYER_VIEWHEIGHT;
cfg.mapTitle = true;
cfg.automapTitleAtBottom = true;
cfg.hideIWADAuthor = true;
cfg.menuPatchReplaceMode = PRM_ALLOW_TEXT;
cfg.menuScale = .75f;
Expand Down

0 comments on commit 51f92ad

Please sign in to comment.