mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-13 11:30:44 +00:00
- removed all leftover parts of the native status bars.
This commit is contained in:
parent
83f151529b
commit
ee559b7ba9
5 changed files with 4 additions and 1277 deletions
|
@ -140,7 +140,7 @@ void PostLoadSetup();
|
|||
void FontCharCreated(FGameTexture* base, FGameTexture* untranslated, FGameTexture* translated);
|
||||
void LoadVoxelModels();
|
||||
|
||||
DBaseStatusBar* StatusBar;
|
||||
DStatusBarCore* StatusBar;
|
||||
|
||||
|
||||
bool AppActive = true;
|
||||
|
@ -825,15 +825,9 @@ void CreateStatusBar()
|
|||
{
|
||||
I_FatalError("No status bar defined");
|
||||
}
|
||||
StatusBar = static_cast<DBaseStatusBar*>(stbarclass->CreateNew());
|
||||
StatusBar = static_cast<DStatusBarCore*>(stbarclass->CreateNew());
|
||||
StatusBar->SetSize(0, 320, 200);
|
||||
InitStatusBar();
|
||||
// this is for comparing the scriptification with the C++ versions
|
||||
stbarclass = PClass::FindClass("NativeSWStatusBar");
|
||||
StatusBar2 = static_cast<DBaseStatusBar*>(stbarclass->CreateNew());
|
||||
StatusBar2->SetSize(0, 320, 200);
|
||||
StatusBar2->Release();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -70,64 +70,7 @@ enum
|
|||
HUDMSGLayer_Default = HUDMSGLayer_OverHUD,
|
||||
};
|
||||
|
||||
struct FLevelStats
|
||||
{
|
||||
int screenbottomspace;
|
||||
int time; // in milliseconds
|
||||
int frags;
|
||||
int kills, maxkills; // set maxkills to -1 to ignore, or to -2 to only print kills
|
||||
int secrets, maxsecrets, supersecrets; // set maxsecrets to -1 to ignore
|
||||
int spacing; // uses fontheight if 0 or less.
|
||||
EColorRange letterColor, standardColor, completeColor;
|
||||
double fontscale;
|
||||
FFont* font;
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
class DBaseStatusBar : public DStatusBarCore
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS (DBaseStatusBar, DStatusBarCore)
|
||||
|
||||
public:
|
||||
DBaseStatusBar ();
|
||||
virtual ~DBaseStatusBar() = default;
|
||||
|
||||
// do not make this a DObject Serialize function because it's not used like one!
|
||||
//void SerializeMessages(FSerializer &arc);
|
||||
|
||||
virtual void Tick ();
|
||||
|
||||
void PrintLevelStats(FLevelStats& stats);
|
||||
void PrintAutomapInfo(FLevelStats& stats, bool forcetextfont = false);
|
||||
int GetTopOfStatusbar() const
|
||||
{
|
||||
return SBarTop;
|
||||
}
|
||||
short CalcMagazineAmount(short ammo_remaining, short clip_capacity, bool reloading);
|
||||
void Set43ClipRect();
|
||||
virtual void UpdateStatusBar() = 0;
|
||||
|
||||
|
||||
private:
|
||||
DObject *AltHud = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
bool Centering;
|
||||
bool FixedOrigin;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
extern DBaseStatusBar *StatusBar;
|
||||
inline DBaseStatusBar* StatusBar2;
|
||||
extern DStatusBarCore *StatusBar;
|
||||
|
||||
// Status bar factories -----------------------------------------------------
|
||||
|
||||
|
@ -137,7 +80,6 @@ void ST_Clear();
|
|||
extern FGameTexture *CrosshairImage;
|
||||
|
||||
|
||||
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int pt = 0, int style = STYLE_Translucent);
|
||||
void setViewport(int viewSize);
|
||||
struct MapRecord;
|
||||
void setLevelStarted(MapRecord *);
|
||||
|
|
|
@ -64,12 +64,6 @@
|
|||
|
||||
#include "../version.h"
|
||||
|
||||
#define XHAIRSHRINKSIZE (1./18)
|
||||
#define XHAIRPICKUPSIZE (2+XHAIRSHRINKSIZE)
|
||||
#define POWERUPICONSIZE 32
|
||||
|
||||
//IMPLEMENT_CLASS(DHUDFont, true, false);
|
||||
|
||||
EXTERN_CVAR (Bool, am_showmonsters)
|
||||
EXTERN_CVAR (Bool, am_showsecrets)
|
||||
EXTERN_CVAR (Bool, am_showtime)
|
||||
|
@ -78,12 +72,10 @@ EXTERN_CVAR (Bool, noisedebug)
|
|||
EXTERN_CVAR(Bool, vid_fps)
|
||||
EXTERN_CVAR(Bool, inter_subtitles)
|
||||
|
||||
//extern DBaseStatusBar *StatusBar;
|
||||
|
||||
extern int setblocks;
|
||||
|
||||
IMPLEMENT_CLASS(DBaseStatusBar, true, false)
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// ST_Clear
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -99,198 +91,6 @@ void ST_Clear()
|
|||
*/
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Constructor
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
DBaseStatusBar::DBaseStatusBar ()
|
||||
{
|
||||
CompleteBorder = false;
|
||||
Centering = false;
|
||||
FixedOrigin = false;
|
||||
SetSize(0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC Tick
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DBaseStatusBar::Tick ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static DObject *InitObject(PClass *type, int paramnum, VM_ARGS)
|
||||
{
|
||||
auto obj = type->CreateNew();
|
||||
// Todo: init
|
||||
return obj;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void DBaseStatusBar::PrintLevelStats(FLevelStats &stats)
|
||||
{
|
||||
double y;
|
||||
double scale = stats.fontscale * hud_statscale;
|
||||
if (stats.spacing <= 0) stats.spacing = xs_CRoundToInt(stats.font->GetHeight() * stats.fontscale);
|
||||
double spacing = stats.spacing * hud_statscale;
|
||||
if (stats.screenbottomspace < 0)
|
||||
{
|
||||
y = 200 - (RelTop - stats.screenbottomspace) * hud_scalefactor - spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = 200 - stats.screenbottomspace * hud_scalefactor - spacing;
|
||||
}
|
||||
|
||||
double y1, y2, y3;
|
||||
|
||||
if (stats.maxsecrets > 0) // don't bother if there are no secrets.
|
||||
{
|
||||
y1 = y;
|
||||
y -= spacing;
|
||||
}
|
||||
if (stats.frags >= 0 || stats.maxkills != -1)
|
||||
{
|
||||
y2 = y;
|
||||
y -= spacing;
|
||||
}
|
||||
y3 = y;
|
||||
|
||||
|
||||
FString text;
|
||||
int black = 0x80000000;
|
||||
|
||||
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 + scale, y3 + scale, text, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||
DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_LegacyRenderStyle, STYLE_TranslucentStencil, DTA_Color, black, TAG_DONE);
|
||||
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y3, text, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||
DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
||||
|
||||
text = "";
|
||||
if (stats.frags > -1) text.Format(TEXTCOLOR_ESCAPESTR "%cF: " TEXTCOLOR_ESCAPESTR "%c%d", stats.letterColor + 'A', stats.standardColor + 'A', stats.frags);
|
||||
else if (stats.maxkills == -2) text.Format(TEXTCOLOR_ESCAPESTR "%cK: " TEXTCOLOR_ESCAPESTR "%c%d", stats.letterColor + 'A', stats.standardColor + 'A', stats.kills);
|
||||
else if (stats.maxkills != -1) text.Format(TEXTCOLOR_ESCAPESTR "%cK: " TEXTCOLOR_ESCAPESTR "%c%d/%d",
|
||||
stats.letterColor + 'A', stats.kills == stats.maxkills ? stats.completeColor + 'A' : stats.standardColor + 'A', stats.kills, stats.maxkills);
|
||||
|
||||
if (text.IsNotEmpty())
|
||||
{
|
||||
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale+scale, y2+scale, text, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||
DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_LegacyRenderStyle, STYLE_TranslucentStencil, DTA_Color, black, TAG_DONE);
|
||||
|
||||
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y2, text, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||
DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
||||
}
|
||||
|
||||
if (stats.maxsecrets > 0) // don't bother if there are no secrets.
|
||||
{
|
||||
if (stats.supersecrets <= 0)
|
||||
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);
|
||||
else
|
||||
text.Format(TEXTCOLOR_ESCAPESTR "%cS: " TEXTCOLOR_ESCAPESTR "%c%d/%d+%d",
|
||||
stats.letterColor + 'A', stats.secrets >= stats.maxsecrets ? stats.completeColor + 'A' : stats.standardColor + 'A', stats.secrets, stats.maxsecrets, stats.supersecrets);
|
||||
|
||||
|
||||
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale + scale, y1 + scale, text, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||
DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_LegacyRenderStyle, STYLE_TranslucentStencil, DTA_Color, black, TAG_DONE);
|
||||
|
||||
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y1, 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, bool forcetextfont)
|
||||
{
|
||||
auto lev = currentLevel;
|
||||
FString mapname;
|
||||
if (am_showlabel)
|
||||
mapname.Format(TEXTCOLOR_ESCAPESTR "%c%s: " TEXTCOLOR_ESCAPESTR "%c%s", stats.letterColor+'A', lev->LabelName(), stats.standardColor+'A', lev->DisplayName());
|
||||
else
|
||||
mapname = lev->DisplayName();
|
||||
|
||||
forcetextfont |= am_textfont;
|
||||
double y;
|
||||
double scale = stats.fontscale * (forcetextfont ? *hud_statscale : 1); // the tiny default font used by all games here cannot be scaled for readability purposes.
|
||||
if (stats.spacing <= 0) stats.spacing = xs_CRoundToInt(stats.font->GetHeight() * stats.fontscale);
|
||||
double spacing = stats.spacing * (forcetextfont ? *hud_statscale : 1);
|
||||
if (am_nameontop)
|
||||
{
|
||||
y = spacing + 1;
|
||||
}
|
||||
else if (stats.screenbottomspace < 0)
|
||||
{
|
||||
y = 200 - RelTop - spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = 200 - stats.screenbottomspace - spacing;
|
||||
}
|
||||
auto cluster = FindCluster(lev->cluster);
|
||||
FString volname;
|
||||
if (cluster) volname = cluster->name;
|
||||
if (volname.IsEmpty() && am_nameontop) y = 1;
|
||||
|
||||
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 (!(lev->flags & MI_USERMAP) && !(g_gameType & GAMEFLAG_PSEXHUMED) && volname.IsNotEmpty())
|
||||
DrawText(twod, stats.font, stats.standardColor, 2 * hud_statscale, y, GStrings.localize(volname),
|
||||
DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||
DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
short DBaseStatusBar::CalcMagazineAmount(short ammo_remaining, short clip_capacity, bool reloading)
|
||||
{
|
||||
// Determine amount in clip.
|
||||
short clip_amount = ammo_remaining % clip_capacity;
|
||||
|
||||
// Set current clip value to clip capacity if wrapped around to zero, otherwise use determined value.
|
||||
short clip_current = ammo_remaining != 0 && clip_amount == 0 ? clip_capacity : clip_amount;
|
||||
|
||||
// Return current clip value if weapon has rounds or is not on a reload cycle.
|
||||
return ammo_remaining == 0 || (reloading && clip_amount == 0) ? 0 : clip_current;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void DBaseStatusBar::Set43ClipRect()
|
||||
{
|
||||
auto GetWidth = [=]() { return twod->GetWidth(); };
|
||||
auto GetHeight = [=]() {return twod->GetHeight(); };
|
||||
|
||||
auto screenratio = ActiveRatio(GetWidth(), GetHeight());
|
||||
if (screenratio < 1.34) return;
|
||||
|
||||
int width = xs_CRoundToInt(GetWidth() * 1.333 / screenratio);
|
||||
int left = (GetWidth() - width) / 2;
|
||||
twod->SetClipRect(left, 0, width, GetHeight());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
//
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -243,12 +243,3 @@ class RazeMenuDelegate : MenuDelegateBase
|
|||
native override void MenuDismissed();
|
||||
|
||||
}
|
||||
|
||||
// dummy definitions for the status bar. We need them to create the class descriptors
|
||||
|
||||
class BaseStatusBar : StatusBarCore native
|
||||
{}
|
||||
|
||||
|
||||
class NativeSWStatusBar : BaseStatusBar native
|
||||
{}
|
||||
|
|
Loading…
Reference in a new issue