mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- generalized the automap label code.
Using proper scaling and should be reusable from all games now.
This commit is contained in:
parent
25ade79b90
commit
6672b8af99
4 changed files with 72 additions and 31 deletions
|
@ -214,7 +214,7 @@ CCMD(sizedown)
|
||||||
|
|
||||||
CUSTOM_CVARD(Float, hud_statscale, 0.5, CVAR_ARCHIVE, "change the scale of the stats display")
|
CUSTOM_CVARD(Float, hud_statscale, 0.5, CVAR_ARCHIVE, "change the scale of the stats display")
|
||||||
{
|
{
|
||||||
if (self < 0.36) self = 0.36;
|
if (self < 0.36f) self = 0.36f;
|
||||||
else if (self > 1) self = 1;
|
else if (self > 1) self = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,10 @@
|
||||||
#include "v_draw.h"
|
#include "v_draw.h"
|
||||||
#include "gamecvars.h"
|
#include "gamecvars.h"
|
||||||
#include "m_fixed.h"
|
#include "m_fixed.h"
|
||||||
|
#include "gamecontrol.h"
|
||||||
#include "gamestruct.h"
|
#include "gamestruct.h"
|
||||||
|
#include "menu.h"
|
||||||
|
#include "mapinfo.h"
|
||||||
|
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
|
|
||||||
|
@ -720,7 +723,8 @@ void DBaseStatusBar::PrintLevelStats(FLevelStats &stats)
|
||||||
{
|
{
|
||||||
text.Format(TEXTCOLOR_ESCAPESTR "%cS: " TEXTCOLOR_ESCAPESTR "%c%d/%d",
|
text.Format(TEXTCOLOR_ESCAPESTR "%cS: " TEXTCOLOR_ESCAPESTR "%c%d/%d",
|
||||||
stats.letterColor + 'A', stats.secrets == stats.maxsecrets ? stats.completeColor + 'A' : stats.standardColor + 'A', stats.secrets, stats.maxsecrets);
|
stats.letterColor + 'A', stats.secrets == stats.maxsecrets ? stats.completeColor + 'A' : stats.standardColor + 'A', stats.secrets, stats.maxsecrets);
|
||||||
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y, text, DTA_FullscreenScale, FSMode_Fit320x200, DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y, text, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||||
|
DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
||||||
y -= spacing;
|
y -= spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,14 +736,57 @@ void DBaseStatusBar::PrintLevelStats(FLevelStats &stats)
|
||||||
|
|
||||||
if (text.IsNotEmpty())
|
if (text.IsNotEmpty())
|
||||||
{
|
{
|
||||||
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y, text, DTA_FullscreenScale, FSMode_Fit320x200, DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y, text, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||||
|
DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
||||||
y -= spacing;
|
y -= spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
text.Format(TEXTCOLOR_ESCAPESTR "%cT: " TEXTCOLOR_ESCAPESTR "%c%d:%02d", stats.letterColor+'A', stats.standardColor + 'A', stats.time / 60000, (stats.time % 60000) / 1000);
|
text.Format(TEXTCOLOR_ESCAPESTR "%cT: " TEXTCOLOR_ESCAPESTR "%c%d:%02d", stats.letterColor+'A', stats.standardColor + 'A', stats.time / 60000, (stats.time % 60000) / 1000);
|
||||||
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y, text, DTA_FullscreenScale, FSMode_Fit320x200, DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y, text, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||||
|
DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
void DBaseStatusBar::PrintAutomapInfo(FLevelStats& stats)
|
||||||
|
{
|
||||||
|
FString mapname;
|
||||||
|
if (am_showlabel)
|
||||||
|
mapname.Format(TEXTCOLOR_ESCAPESTR "%c%s: " TEXTCOLOR_ESCAPESTR "%c%s", stats.letterColor+'A', currentLevel->LabelName(), stats.standardColor+'A', currentLevel->DisplayName());
|
||||||
|
else
|
||||||
|
mapname = currentLevel->DisplayName();
|
||||||
|
|
||||||
|
double y;
|
||||||
|
double scale = stats.fontscale * (am_textfont? *hud_statscale : 1); // the tiny default font used by all games here cannot be scaled for readability purposes.
|
||||||
|
if (stats.spacing <= 0) stats.spacing = stats.font->GetHeight() * stats.fontscale;
|
||||||
|
double spacing = stats.spacing * (am_textfont ? *hud_statscale : 1);
|
||||||
|
if (am_nameontop)
|
||||||
|
{
|
||||||
|
y = spacing;
|
||||||
|
}
|
||||||
|
else if (stats.screenbottomspace < 0)
|
||||||
|
{
|
||||||
|
y = 200 - RelTop - spacing;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
y = 200 - stats.screenbottomspace - spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText(twod, stats.font, stats.standardColor, 2 * hud_statscale, y, mapname, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||||
|
DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
y -= spacing;
|
||||||
|
|
||||||
|
if (!(currentLevel->flags & MI_USERMAP) && !(g_gameType & GAMEFLAG_PSEXHUMED))
|
||||||
|
DrawText(twod, stats.font, stats.standardColor, 2 * hud_statscale, y, GStrings.localize(gVolumeNames[volfromlevelnum(currentLevel->levelNumber)]),
|
||||||
|
DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||||
|
DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
|
||||||
|
}
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -190,6 +190,7 @@ public:
|
||||||
void BeginHUD(int resW, int resH, double Alpha);
|
void BeginHUD(int resW, int resH, double Alpha);
|
||||||
void StatusbarToRealCoords(double &x, double &y, double &w, double &h) const;
|
void StatusbarToRealCoords(double &x, double &y, double &w, double &h) const;
|
||||||
void PrintLevelStats(FLevelStats& stats);
|
void PrintLevelStats(FLevelStats& stats);
|
||||||
|
void PrintAutomapInfo(FLevelStats& stats);
|
||||||
int GetTopOfStatusbar() const
|
int GetTopOfStatusbar() const
|
||||||
{
|
{
|
||||||
return SBarTop;
|
return SBarTop;
|
||||||
|
|
|
@ -179,50 +179,43 @@ PalEntry DDukeCommonStatusBar::LightForShade(int shade)
|
||||||
|
|
||||||
void DDukeCommonStatusBar::PrintLevelStats(int bottomy)
|
void DDukeCommonStatusBar::PrintLevelStats(int bottomy)
|
||||||
{
|
{
|
||||||
|
FLevelStats stats{};
|
||||||
|
auto pp = &ps[myconnectindex];
|
||||||
|
stats.fontscale = isRR() ? 0.5 : 1.;
|
||||||
|
stats.spacing = isRR() ? 10 : 7;
|
||||||
|
stats.screenbottomspace = bottomy;
|
||||||
|
stats.time = Scale(pp->player_par, 1000, REALGAMETICSPERSEC);
|
||||||
|
stats.font = SmallFont;
|
||||||
|
if (isNamWW2GI())
|
||||||
|
{
|
||||||
|
// The stock font of these games is totally unusable for this.
|
||||||
|
stats.font = ConFont;
|
||||||
|
stats.spacing = ConFont->GetHeight() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (automapMode == am_full)
|
if (automapMode == am_full)
|
||||||
{
|
{
|
||||||
// Automap label printer moved here so that it is on top of the screen border.
|
if (!am_textfont)
|
||||||
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;
|
stats.font = SmallFont2;
|
||||||
font = isNamWW2GI() ? ConFont : SmallFont;
|
stats.spacing = 6;
|
||||||
if (isNamWW2GI()) color = CR_ORANGE;
|
|
||||||
}
|
}
|
||||||
double top = am_nameontop ? 0 : ( 200 - (bottomy < 0 ? RelTop : bottomy) * hud_scale - (isRR()? 25 : 20));
|
stats.standardColor = (isNamWW2GI() && am_textfont)? CR_ORANGE : CR_UNTRANSLATED;
|
||||||
if (!(currentLevel->flags & MI_USERMAP))
|
stats.letterColor = CR_GOLD;
|
||||||
DrawText(twod, font, color, 5, top + 6, GStrings.localize(gVolumeNames[volfromlevelnum(currentLevel->levelNumber)]),
|
DBaseStatusBar::PrintAutomapInfo(stats);
|
||||||
DTA_FullscreenScale, FSMode_Fit320x200, 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_Fit320x200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
|
||||||
}
|
}
|
||||||
else if (hud_stats)
|
else if (hud_stats)
|
||||||
{
|
{
|
||||||
// JBF 20040124: display level stats in screen corner
|
// JBF 20040124: display level stats in screen corner
|
||||||
FLevelStats stats{};
|
|
||||||
auto pp = &ps[myconnectindex];
|
|
||||||
|
|
||||||
stats.fontscale = isRR() ? 0.5 : 1.;
|
|
||||||
stats.spacing = isRR() ? 10 : 7;
|
|
||||||
stats.screenbottomspace = bottomy;
|
|
||||||
|
|
||||||
stats.time = Scale(pp->player_par, 1000, REALGAMETICSPERSEC);
|
|
||||||
stats.kills = pp->actors_killed;
|
stats.kills = pp->actors_killed;
|
||||||
stats.maxkills = !isRR() && ud.player_skill > 3 ? -2 : pp->max_actors_killed;
|
stats.maxkills = !isRR() && ud.player_skill > 3 ? -2 : pp->max_actors_killed;
|
||||||
stats.frags = ud.multimode > 1 && !ud.coop ? pp->frag - pp->fraggedself : -1;
|
stats.frags = ud.multimode > 1 && !ud.coop ? pp->frag - pp->fraggedself : -1;
|
||||||
stats.secrets = pp->secret_rooms;
|
stats.secrets = pp->secret_rooms;
|
||||||
stats.maxsecrets = pp->max_secret_rooms;
|
stats.maxsecrets = pp->max_secret_rooms;
|
||||||
stats.font = SmallFont;
|
|
||||||
if (isNamWW2GI())
|
if (isNamWW2GI())
|
||||||
{
|
{
|
||||||
// The stock font of these games is totally unusable for this.
|
// The stock font of these games is totally unusable for this.
|
||||||
stats.font = ConFont;
|
|
||||||
stats.spacing = ConFont->GetHeight() + 1;
|
|
||||||
stats.letterColor = CR_ORANGE;
|
stats.letterColor = CR_ORANGE;
|
||||||
stats.standardColor = CR_YELLOW;
|
stats.standardColor = CR_YELLOW;
|
||||||
stats.completeColor = CR_FIRE;
|
stats.completeColor = CR_FIRE;
|
||||||
|
|
Loading…
Reference in a new issue