mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-14 16:40:52 +00:00
- moved GetReservedScreenSpace function into the scripted status bar where it belongs.
Since this is supposed to return the height of the status bar, keeping it native is a bit pointless as it cannot be modified that way.
This commit is contained in:
parent
b4f6ea6232
commit
a9ea2cd5c0
17 changed files with 66 additions and 39 deletions
|
@ -53,6 +53,7 @@
|
|||
#include "gamecvars.h"
|
||||
#include "menustate.h"
|
||||
#include "cheathandler.h"
|
||||
#include "statusbar.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -235,7 +236,7 @@ void CT_Drawer (void)
|
|||
int screen_height= twod->GetHeight() / scale;
|
||||
|
||||
y = screen_height - displayfont->GetHeight()-2;
|
||||
auto res = gi->GetReservedScreenSpace(hud_size);
|
||||
auto res = GetReservedScreenSpace(hud_size);
|
||||
|
||||
promptwidth = displayfont->StringWidth (prompt) * scalex;
|
||||
x = displayfont->GetCharWidth (displayfont->GetCursor()) * scalex * 2 + promptwidth;
|
||||
|
|
|
@ -41,12 +41,6 @@ struct FSavegameInfo
|
|||
int currentsavever;
|
||||
};
|
||||
|
||||
struct ReservedSpace
|
||||
{
|
||||
int top;
|
||||
int statusbar;
|
||||
};
|
||||
|
||||
enum EMenuSounds : int;
|
||||
struct MapRecord;
|
||||
struct TilesetBuildInfo;
|
||||
|
@ -95,7 +89,6 @@ struct GameInterface
|
|||
virtual void SetAmbience(bool on) {}
|
||||
virtual std::pair<DVector3, DAngle> GetCoordinates() { return {}; }
|
||||
virtual void ExitFromMenu() { throw CExitEvent(0); }
|
||||
virtual ReservedSpace GetReservedScreenSpace(int viewsize) { return { 0, 0 }; }
|
||||
virtual void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) {}
|
||||
virtual void UpdateSounds() {}
|
||||
virtual void ErrorCleanup() {}
|
||||
|
|
|
@ -93,4 +93,12 @@ void TickStatusBar();
|
|||
void ResetStatusBar();
|
||||
void InitStatusBar();
|
||||
|
||||
struct ReservedSpace
|
||||
{
|
||||
int top;
|
||||
int statusbar;
|
||||
};
|
||||
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize);
|
||||
|
||||
#endif /* __SBAR_H__ */
|
||||
|
|
|
@ -93,6 +93,20 @@ void ST_Clear()
|
|||
*/
|
||||
}
|
||||
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize)
|
||||
{
|
||||
ReservedSpace res{};
|
||||
IFVIRTUALPTRNAME(StatusBar, NAME_RazeStatusBar, GetReservedScreenSpace)
|
||||
{
|
||||
VMReturn ret[2];
|
||||
ret[0].IntAt(&res.top);
|
||||
ret[1].IntAt(&res.statusbar);
|
||||
VMValue params[] = { StatusBar, viewsize };
|
||||
VMCall(func, params, 2, ret, 2);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
//
|
||||
|
@ -106,7 +120,7 @@ void setViewport(int viewSize)
|
|||
int xdim = screen->GetWidth();
|
||||
int ydim = screen->GetHeight();
|
||||
if (xdim == 0 || ydim == 0) return;
|
||||
auto reserved = gi->GetReservedScreenSpace(viewSize);
|
||||
auto reserved = GetReservedScreenSpace(viewSize);
|
||||
reserved.top = xs_CRoundToInt((reserved.top * hud_scalefactor * ydim) / 200);
|
||||
reserved.statusbar = xs_CRoundToInt((reserved.statusbar * hud_scalefactor * ydim) / 200);
|
||||
|
||||
|
|
|
@ -687,16 +687,6 @@ void GameInterface::FreeLevelData()
|
|||
}
|
||||
|
||||
|
||||
ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
|
||||
{
|
||||
int top = 0;
|
||||
if (gGameOptions.nGameType > 0 && gGameOptions.nGameType <= 3)
|
||||
{
|
||||
top = (tileHeight(kSBPlayerSlot) * ((gNetPlayers + 3) / 4));
|
||||
}
|
||||
return { top, 25 };
|
||||
}
|
||||
|
||||
::GameInterface* CreateInterface()
|
||||
{
|
||||
return new GameInterface;
|
||||
|
|
|
@ -120,7 +120,6 @@ struct GameInterface : public ::GameInterface
|
|||
void MenuClosed() override;
|
||||
bool CanSave() override;
|
||||
std::pair<DVector3, DAngle> GetCoordinates() override;
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize) override;
|
||||
void UpdateSounds() override;
|
||||
void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) override;
|
||||
void Ticker() override;
|
||||
|
|
|
@ -38,7 +38,6 @@ struct GameInterface : public ::GameInterface
|
|||
void SerializeGameState(FSerializer& arc) override;
|
||||
std::pair<DVector3, DAngle> GetCoordinates() override;
|
||||
void ExitFromMenu() override;
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize) override;
|
||||
void DrawPlayerSprite(const DVector2& origin, bool onteam) override;
|
||||
void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) override;
|
||||
void UpdateSounds() override;
|
||||
|
|
|
@ -364,17 +364,6 @@ int startrts(int lumpNum, int localPlayer)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
|
||||
{
|
||||
// todo: factor in the frag bar: tileHeight(TILE_FRAGBAR)
|
||||
int sbar = tileHeight(TILE_BOTTOMSTATUSBAR);
|
||||
if (isRR())
|
||||
{
|
||||
sbar >>= 1;
|
||||
}
|
||||
return { 0, sbar };
|
||||
}
|
||||
|
||||
::GameInterface* CreateInterface()
|
||||
{
|
||||
return new GameInterface;
|
||||
|
|
|
@ -219,7 +219,6 @@ struct GameInterface : public ::GameInterface
|
|||
FSavegameInfo GetSaveSig() override;
|
||||
void SerializeGameState(FSerializer& arc);
|
||||
bool CanSave() override;
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize) override { return { 0, 24 }; }
|
||||
void UpdateSounds() override;
|
||||
void ErrorCleanup() override;
|
||||
void Ticker() override;
|
||||
|
|
|
@ -831,11 +831,6 @@ int StdRandomRange(int range)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
|
||||
{
|
||||
return { 0, 48 };
|
||||
}
|
||||
|
||||
::GameInterface* CreateInterface()
|
||||
{
|
||||
return new GameInterface;
|
||||
|
|
|
@ -1677,7 +1677,6 @@ struct GameInterface : public ::GameInterface
|
|||
void SerializeGameState(FSerializer& arc);
|
||||
void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); }
|
||||
std::pair<DVector3, DAngle> GetCoordinates() override;
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize) override;
|
||||
void UpdateSounds() override;
|
||||
void ErrorCleanup() override;
|
||||
void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* input = nullptr) override;
|
||||
|
|
|
@ -33,6 +33,19 @@ class BloodStatusBar : RazeStatusBar
|
|||
bool gBlueFlagDropped, gRedFlagDropped; // also placeholders until we know where MP will go.
|
||||
|
||||
|
||||
override int, int GetReservedScreenSpace(int viewsize)
|
||||
{
|
||||
int top = 0;
|
||||
/*
|
||||
if (gGameOptions.nGameType > 0 && gGameOptions.nGameType <= 3)
|
||||
{
|
||||
top = (tileHeight("SBPlayerSlot") * ((gNetPlayers + 3) / 4));
|
||||
}
|
||||
*/
|
||||
return top, 25;
|
||||
}
|
||||
|
||||
|
||||
override void Init()
|
||||
{
|
||||
smallf = HUDFont.Create(SmallFont, 0, Mono_Off, 0, 0);
|
||||
|
|
|
@ -39,6 +39,12 @@ class DukeStatusBar : DukeCommonStatusBar
|
|||
TextureID ThreeByFive[12];
|
||||
HUDFont indxfont;
|
||||
|
||||
override int, int GetReservedScreenSpace(int viewsize)
|
||||
{
|
||||
int sbar = tileHeight("BOTTOMSTATUSBAR");
|
||||
return 0, sbar;
|
||||
}
|
||||
|
||||
override void Init()
|
||||
{
|
||||
numberFont = HUDFont.Create(BigFont, 0, Mono_Off, 1, 1 );
|
||||
|
|
|
@ -29,6 +29,13 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
class RedneckStatusBar : DukeCommonStatusBar
|
||||
{
|
||||
override int, int GetReservedScreenSpace(int viewsize)
|
||||
{
|
||||
// todo: factor in the frag bar: tileHeight(TILE_FRAGBAR)
|
||||
int sbar = tileHeight("BOTTOMSTATUSBAR");
|
||||
return 0, sbar >> 1;
|
||||
}
|
||||
|
||||
override void Init()
|
||||
{
|
||||
numberFont = HudFont.Create(BigFont, 0, Mono_Off, 1, 1 );
|
||||
|
|
|
@ -60,6 +60,11 @@ class ExhumedStatusBar : RazeStatusBar
|
|||
KeySeq = 36,
|
||||
}
|
||||
|
||||
override int, int GetReservedScreenSpace(int viewsize)
|
||||
{
|
||||
return 0, 24;
|
||||
}
|
||||
|
||||
override void Init()
|
||||
{
|
||||
textfont = HUDFont.Create(SmallFont, 1, Mono_Off, 1, 1);
|
||||
|
|
|
@ -104,6 +104,11 @@ class SWStatusBar : RazeStatusBar
|
|||
TextureID SmallSBFont[3][12];
|
||||
HUDFont numberFont, miniFont;
|
||||
|
||||
override int, int GetReservedScreenSpace(int viewsize)
|
||||
{
|
||||
return 0, 48;
|
||||
}
|
||||
|
||||
override void Init()
|
||||
{
|
||||
numberFont = HudFont.Create(BigFont, 0, Mono_Off, 1, 1);
|
||||
|
|
|
@ -23,6 +23,11 @@ class RazeStatusBar : StatusBarCore
|
|||
{
|
||||
}
|
||||
|
||||
virtual int, int GetReservedScreenSpace(int viewsize)
|
||||
{
|
||||
return 0, 0;
|
||||
}
|
||||
|
||||
virtual void Tick() {}
|
||||
virtual void Reset() {}
|
||||
virtual void UpdateStatusBar(SummaryInfo info) {}
|
||||
|
|
Loading…
Reference in a new issue