- improvements for automap labels.

* use a CVAR to decide whether to show them at the top or bottom
* draw them on top of the screen border so that they don't get overdrawn on smaller windows.
This commit is contained in:
Christoph Oelckers 2020-08-24 00:25:42 +02:00
parent e7c1595531
commit e25d1c4cda
6 changed files with 32 additions and 29 deletions

View file

@ -779,6 +779,10 @@ int RunGame()
cl_weaponswitch.SetGenericRepDefault(1, CVAR_Int);
if (cl_weaponswitch > 1) cl_weaponswitch = 1;
}
if (g_gameType & (GAMEFLAG_BLOOD|GAMEFLAG_RR))
{
am_nameontop.SetGenericRepDefault(true, CVAR_Bool); // Blood and RR show the map name on the top of the screen by default.
}
G_ReadConfig(currentGame);

View file

@ -475,6 +475,7 @@ CUSTOM_CVAR(Int, playergender, 0, CVAR_USERINFO|CVAR_ARCHIVE)
CVAR(Bool, am_textfont, false, CVAR_ARCHIVE)
CVAR(Bool, am_showlabel, false, CVAR_ARCHIVE)
CVAR(Bool, am_nameontop, false, CVAR_ARCHIVE)
// Internal settings for demo recording and the multiplayer menu. These won't get saved and only are CVARs so that the menu code can use them.

View file

@ -72,6 +72,7 @@ EXTERN_CVAR(Int, althud_flashing)
EXTERN_CVAR(Bool, am_textfont)
EXTERN_CVAR(Bool, am_showlabel)
EXTERN_CVAR(Bool, am_nameontop)
EXTERN_CVAR(Int, r_fov)

View file

@ -92,10 +92,6 @@ CVAR (Color, crosshaircolor, 0xff0000, CVAR_ARCHIVE);
CVAR (Int, crosshairhealth, 1, CVAR_ARCHIVE);
CVAR (Float, crosshairscale, 1.0, CVAR_ARCHIVE);
CVAR (Bool, crosshairgrow, false, CVAR_ARCHIVE);
CUSTOM_CVAR(Int, am_showmaplabel, 2, CVAR_ARCHIVE)
{
if (self < 0 || self > 2) self = 2;
}
CVAR (Bool, idmypos, false, 0);

View file

@ -653,29 +653,6 @@ void drawoverheadmap(int cposx, int cposy, int czoom, int cang)
DTA_Color, shadeToLight(sprite[pp.i].shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j/65536., TAG_DONE);
}
}
if (/*textret == 0 &&*/ ud.overhead_on == 2)
{
FString mapname;
if (am_showlabel) mapname.Format(TEXTCOLOR_GOLD "%s: %s%s", currentLevel->LabelName(), (am_textfont && isNamWW2GI()) ? TEXTCOLOR_ORANGE : TEXTCOLOR_UNTRANSLATED, currentLevel->DisplayName());
else mapname = currentLevel->DisplayName();
double scale = isRR() ? 0.5 : 1.;
FFont* font = SmallFont2;
int color = CR_UNTRANSLATED;
if (am_textfont)
{
scale *= 0.66;
font = isNamWW2GI()? ConFont : SmallFont;
if (isNamWW2GI()) color = CR_ORANGE;
}
int top = (isRR() && !am_textfont) ? 0 : (hud_size != Hud_Nothing ? 147 : 179);
if (!(currentLevel->flags & MI_USERMAP))
DrawText(twod, font, color, 5, top+6, GStrings.localize(gVolumeNames[volfromlevelnum(currentLevel->levelNumber)]),
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
DrawText(twod, font, color, 5, top + ((isRR() && am_textfont)? 15:12), mapname,
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
}
}
//---------------------------------------------------------------------------

View file

@ -39,6 +39,8 @@ source as it is released.
#include "sbar.h"
#include "v_draw.h"
#include "texturemanager.h"
#include "mapinfo.h"
BEGIN_DUKE_NS
//==========================================================================
@ -177,9 +179,31 @@ PalEntry DDukeCommonStatusBar::LightForShade(int shade)
void DDukeCommonStatusBar::PrintLevelStats(int bottomy)
{
// JBF 20040124: display level stats in screen corner
if (ud.overhead_on != 2 && hud_stats)
if (ud.overhead_on == 2)
{
// Automap label printer moved here so that it is on top of the screen border.
FString mapname;
if (am_showlabel) mapname.Format(TEXTCOLOR_GOLD "%s: %s%s", currentLevel->LabelName(), (am_textfont && isNamWW2GI()) ? TEXTCOLOR_ORANGE : TEXTCOLOR_UNTRANSLATED, currentLevel->DisplayName());
else mapname = currentLevel->DisplayName();
double scale = isRR() ? 0.5 : 1.;
FFont* font = SmallFont2;
int color = CR_UNTRANSLATED;
if (am_textfont)
{
scale *= 0.66;
font = isNamWW2GI() ? ConFont : SmallFont;
if (isNamWW2GI()) color = CR_ORANGE;
}
int top = am_nameontop ? 0 : 200 - Scale(bottomy < 0 ? RelTop : bottomy, hud_scale, 100) - isRR()? 25 : 20;
if (!(currentLevel->flags & MI_USERMAP))
DrawText(twod, font, color, 5, top + 6, GStrings.localize(gVolumeNames[volfromlevelnum(currentLevel->levelNumber)]),
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
DrawText(twod, font, color, 5, top + ((isRR() && am_textfont) ? 15 : 12), mapname,
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
}
else if (hud_stats)
{
// JBF 20040124: display level stats in screen corner
FLevelStats stats{};
auto pp = &ps[myconnectindex];