mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- wrapped the entire DSBarInfo class in a container and completely decoupled it from DBaseStatusBar.
The idea is, when status bars are moved to ZScript that only this small wrapper class needs to be dealt with and the implementation can be left alone. SBARINFO is far too complex to be scriptified, but having it inherit directly from DBaseStatusBar and access its member variables severely limits the options of dealing with the status bar code. This way, it only accesses some globally visible functions in DBaseStatusBar and no variables. - renamed the global ST_X and ST_Y variables because it is far too confusing and error-prone to have the same names inside and outside DBaseStatusBar.
This commit is contained in:
parent
f3159af211
commit
f5421491ec
12 changed files with 213 additions and 92 deletions
|
@ -1059,7 +1059,7 @@ static void AM_findMinMaxBoundaries ()
|
|||
static void AM_calcMinMaxMtoF()
|
||||
{
|
||||
double a = SCREENWIDTH / max_w;
|
||||
double b = ::ST_Y / max_h;
|
||||
double b = gST_Y / max_h;
|
||||
|
||||
min_scale_mtof = a < b ? a : b;
|
||||
max_scale_mtof = SCREENHEIGHT / (2*PLAYERRADIUS);
|
||||
|
@ -1417,7 +1417,7 @@ void AM_NewResolution()
|
|||
else if (scale_mtof > max_scale_mtof)
|
||||
AM_maxOutWindowScale();
|
||||
f_w = screen->GetWidth();
|
||||
f_h = ST_Y;
|
||||
f_h = gST_Y;
|
||||
AM_activateNewScale();
|
||||
}
|
||||
|
||||
|
@ -3066,7 +3066,7 @@ void AM_Drawer ()
|
|||
// and view size adjustments.
|
||||
f_x = f_y = 0;
|
||||
f_w = screen->GetWidth ();
|
||||
f_h = ST_Y;
|
||||
f_h = gST_Y;
|
||||
f_p = screen->GetPitch ();
|
||||
|
||||
AM_clearFB(AMColors[AMColors.Background]);
|
||||
|
|
|
@ -241,13 +241,13 @@ void CT_Drawer (void)
|
|||
{
|
||||
screen_width = SCREENWIDTH;
|
||||
screen_height = SCREENHEIGHT;
|
||||
st_y = ST_Y;
|
||||
st_y = gST_Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen_width = SCREENWIDTH / active_con_scaletext();
|
||||
screen_height = SCREENHEIGHT / active_con_scaletext();
|
||||
st_y = ST_Y / active_con_scaletext();
|
||||
st_y = gST_Y / active_con_scaletext();
|
||||
}
|
||||
|
||||
y += ((SCREENHEIGHT == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y;
|
||||
|
|
|
@ -787,13 +787,13 @@ void D_Display ()
|
|||
screen->DrawBlendingRect();
|
||||
if (automapactive)
|
||||
{
|
||||
int saved_ST_Y = ST_Y;
|
||||
int saved_ST_Y = gST_Y;
|
||||
if (hud_althud && viewheight == SCREENHEIGHT)
|
||||
{
|
||||
ST_Y = viewheight;
|
||||
gST_Y = viewheight;
|
||||
}
|
||||
AM_Drawer ();
|
||||
ST_Y = saved_ST_Y;
|
||||
gST_Y = saved_ST_Y;
|
||||
}
|
||||
if (!automapactive || viewactive)
|
||||
{
|
||||
|
|
|
@ -307,6 +307,7 @@ enum
|
|||
|
||||
class DBaseStatusBar : public DObject
|
||||
{
|
||||
friend class DSBarInfo;
|
||||
DECLARE_CLASS (DBaseStatusBar, DObject)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
|
@ -342,8 +343,6 @@ public:
|
|||
DBaseStatusBar (int reltop, int hres=320, int vres=200);
|
||||
void OnDestroy() override;
|
||||
|
||||
void SetScaled (bool scale, bool force=false);
|
||||
|
||||
void AttachMessage (DHUDMessage *msg, uint32 id=0, int layer=HUDMSGLayer_Default);
|
||||
DHUDMessage *DetachMessage (DHUDMessage *msg);
|
||||
DHUDMessage *DetachMessage (uint32 id);
|
||||
|
@ -357,6 +356,7 @@ public:
|
|||
// do not make this a DObject Serialize function because it's not used like one!
|
||||
void SerializeMessages(FSerializer &arc);
|
||||
|
||||
virtual void SetScaled(bool scale, bool force = false);
|
||||
virtual void Tick ();
|
||||
virtual void Draw (EHudState state);
|
||||
void DrawBottomStuff (EHudState state);
|
||||
|
@ -375,6 +375,13 @@ public:
|
|||
virtual void SetMugShotState (const char *state_name, bool wait_till_done=false, bool reset=false);
|
||||
void DrawLog();
|
||||
|
||||
void GetCoords(int &x, int &y)
|
||||
{
|
||||
x = ST_X;
|
||||
y = ST_Y;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
void DrawPowerups ();
|
||||
|
||||
|
|
|
@ -970,17 +970,16 @@ inline void adjustRelCenter(bool relX, bool relY, const double &x, const double
|
|||
outY = y;
|
||||
}
|
||||
|
||||
class DSBarInfo : public DBaseStatusBar
|
||||
class DSBarInfo
|
||||
{
|
||||
DECLARE_CLASS(DSBarInfo, DBaseStatusBar)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
DSBarInfo (SBarInfo *script=NULL) : DBaseStatusBar(script->height, script->resW, script->resH),
|
||||
DSBarInfo (DBaseStatusBar *wrapper, SBarInfo *script=NULL) :
|
||||
ammo1(NULL), ammo2(NULL), ammocount1(0), ammocount2(0), armor(NULL),
|
||||
pendingPopup(POP_None), currentPopup(POP_None), lastHud(-1),
|
||||
pendingPopup(DBaseStatusBar::POP_None), currentPopup(DBaseStatusBar::POP_None), lastHud(-1),
|
||||
scalingWasForced(false), lastInventoryBar(NULL), lastPopup(NULL)
|
||||
{
|
||||
this->script = script;
|
||||
this->wrapper = wrapper;
|
||||
|
||||
static const char *InventoryBarLumps[] =
|
||||
{
|
||||
|
@ -1001,8 +1000,6 @@ public:
|
|||
}
|
||||
invBarOffset = script->Images.Size();
|
||||
Images.Init(&patchnames[0], patchnames.Size());
|
||||
|
||||
CompleteBorder = script->completeBorder;
|
||||
}
|
||||
|
||||
~DSBarInfo ()
|
||||
|
@ -1010,9 +1007,18 @@ public:
|
|||
Images.Uninit();
|
||||
}
|
||||
|
||||
void ScreenSizeChanged() override
|
||||
void _SetScaled(bool scaled)
|
||||
{
|
||||
Scaled = scaled;
|
||||
}
|
||||
|
||||
void _AttachToPlayer(player_t *player)
|
||||
{
|
||||
CPlayer = player;
|
||||
}
|
||||
|
||||
void _ScreenSizeChanged()
|
||||
{
|
||||
Super::ScreenSizeChanged();
|
||||
if (uiscale > 0)
|
||||
{
|
||||
script->cleanX = uiscale;
|
||||
|
@ -1024,13 +1030,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void Draw (EHudState state) override
|
||||
void _Draw (EHudState state)
|
||||
{
|
||||
DBaseStatusBar::Draw(state);
|
||||
if (script->cleanX <= 0)
|
||||
{ // Calculate cleanX and cleanY
|
||||
ScreenSizeChanged();
|
||||
wrapper->ScreenSizeChanged();
|
||||
}
|
||||
wrapper->GetCoords(ST_X, ST_Y);
|
||||
int hud = STBAR_NORMAL;
|
||||
if(state == HUD_StatusBar)
|
||||
{
|
||||
|
@ -1059,13 +1065,13 @@ public:
|
|||
else if(!Scaled)
|
||||
{
|
||||
scalingWasForced = true;
|
||||
SetScaled(true, true);
|
||||
wrapper->SetScaled(true, true);
|
||||
setsizeneeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
//prepare ammo counts
|
||||
GetCurrentAmmo(ammo1, ammo2, ammocount1, ammocount2);
|
||||
wrapper->GetCurrentAmmo(ammo1, ammo2, ammocount1, ammocount2);
|
||||
armor = CPlayer->mo->FindInventory(NAME_BasicArmor);
|
||||
|
||||
if(state != HUD_AltHud)
|
||||
|
@ -1078,12 +1084,12 @@ public:
|
|||
if(scalingWasForced)
|
||||
{
|
||||
scalingWasForced = false;
|
||||
SetScaled(false);
|
||||
wrapper->SetScaled(false);
|
||||
setsizeneeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(currentPopup != POP_None && !script->huds[hud]->FullScreenOffsets())
|
||||
if(currentPopup != DBaseStatusBar::POP_None && !script->huds[hud]->FullScreenOffsets())
|
||||
script->huds[hud]->Draw(NULL, this, script->popups[currentPopup-1].getXDisplacement(), script->popups[currentPopup-1].getYDisplacement(), 1.);
|
||||
else
|
||||
script->huds[hud]->Draw(NULL, this, 0, 0, 1.);
|
||||
|
@ -1105,14 +1111,14 @@ public:
|
|||
}
|
||||
|
||||
// Handle popups
|
||||
if(currentPopup != POP_None)
|
||||
if(currentPopup != DBaseStatusBar::POP_None)
|
||||
{
|
||||
int popbar = 0;
|
||||
if(currentPopup == POP_Log)
|
||||
if(currentPopup == DBaseStatusBar::POP_Log)
|
||||
popbar = STBAR_POPUPLOG;
|
||||
else if(currentPopup == POP_Keys)
|
||||
else if(currentPopup == DBaseStatusBar::POP_Keys)
|
||||
popbar = STBAR_POPUPKEYS;
|
||||
else if(currentPopup == POP_Status)
|
||||
else if(currentPopup == DBaseStatusBar::POP_Status)
|
||||
popbar = STBAR_POPUPSTATUS;
|
||||
if(script->huds[popbar] != lastPopup)
|
||||
{
|
||||
|
@ -1129,40 +1135,33 @@ public:
|
|||
hud_scale = oldhud_scale;
|
||||
}
|
||||
|
||||
void NewGame () override
|
||||
void _NewGame ()
|
||||
{
|
||||
if (CPlayer != NULL)
|
||||
{
|
||||
AttachToPlayer (CPlayer);
|
||||
|
||||
// Reset the huds
|
||||
script->ResetHuds();
|
||||
lastHud = -1; // Reset
|
||||
}
|
||||
// Reset the huds
|
||||
script->ResetHuds();
|
||||
lastHud = -1; // Reset
|
||||
}
|
||||
|
||||
bool MustDrawLog (EHudState state) override
|
||||
bool _MustDrawLog (EHudState state)
|
||||
{
|
||||
return script->huds[STBAR_POPUPLOG]->NumCommands() == 0;
|
||||
}
|
||||
|
||||
void SetMugShotState (const char *state_name, bool wait_till_done, bool reset) override
|
||||
void _SetMugShotState (const char *state_name, bool wait_till_done, bool reset)
|
||||
{
|
||||
script->MugShot.SetState(state_name, wait_till_done, reset);
|
||||
}
|
||||
|
||||
void Tick () override
|
||||
void _Tick ()
|
||||
{
|
||||
DBaseStatusBar::Tick();
|
||||
|
||||
script->MugShot.Tick(CPlayer);
|
||||
if(currentPopup != POP_None)
|
||||
if(currentPopup != DBaseStatusBar::POP_None)
|
||||
{
|
||||
script->popups[currentPopup-1].tick();
|
||||
if(script->popups[currentPopup-1].opened == false && script->popups[currentPopup-1].isDoneMoving())
|
||||
{
|
||||
currentPopup = pendingPopup;
|
||||
if(currentPopup != POP_None)
|
||||
if(currentPopup != DBaseStatusBar::POP_None)
|
||||
script->popups[currentPopup-1].open();
|
||||
}
|
||||
|
||||
|
@ -1175,30 +1174,29 @@ public:
|
|||
lastInventoryBar->Tick(NULL, this, false);
|
||||
}
|
||||
|
||||
void ReceivedWeapon(AWeapon *weapon) override
|
||||
void _ReceivedWeapon(AWeapon *weapon)
|
||||
{
|
||||
script->MugShot.Grin();
|
||||
}
|
||||
|
||||
// void DSBarInfo::FlashItem(const PClass *itemtype) - Is defined with CommandDrawSelectedInventory
|
||||
void FlashItem(const PClass *itemtype) override;
|
||||
void _FlashItem(const PClass *itemtype);
|
||||
|
||||
void ShowPop(int popnum) override
|
||||
void _ShowPop(int popnum)
|
||||
{
|
||||
DBaseStatusBar::ShowPop(popnum);
|
||||
if(popnum != currentPopup)
|
||||
{
|
||||
pendingPopup = popnum;
|
||||
}
|
||||
else
|
||||
pendingPopup = POP_None;
|
||||
if(currentPopup != POP_None)
|
||||
pendingPopup = DBaseStatusBar::POP_None;
|
||||
if(currentPopup != DBaseStatusBar::POP_None)
|
||||
script->popups[currentPopup-1].close();
|
||||
else
|
||||
{
|
||||
currentPopup = pendingPopup;
|
||||
pendingPopup = POP_None;
|
||||
if(currentPopup != POP_None)
|
||||
pendingPopup = DBaseStatusBar::POP_None;
|
||||
if(currentPopup != DBaseStatusBar::POP_None)
|
||||
script->popups[currentPopup-1].open();
|
||||
}
|
||||
}
|
||||
|
@ -1519,6 +1517,10 @@ public:
|
|||
AInventory *armor;
|
||||
FImageCollection Images;
|
||||
unsigned int invBarOffset;
|
||||
player_t *CPlayer = nullptr;
|
||||
DBaseStatusBar *wrapper;
|
||||
bool Scaled;
|
||||
int ST_X, ST_Y;
|
||||
|
||||
private:
|
||||
SBarInfo *script;
|
||||
|
@ -1530,20 +1532,6 @@ private:
|
|||
SBarInfoMainBlock *lastPopup;
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DSBarInfo, false, true)
|
||||
|
||||
IMPLEMENT_POINTERS_START(DSBarInfo)
|
||||
IMPLEMENT_POINTER(ammo1)
|
||||
IMPLEMENT_POINTER(ammo2)
|
||||
IMPLEMENT_POINTER(armor)
|
||||
IMPLEMENT_POINTERS_END
|
||||
|
||||
DBaseStatusBar *CreateCustomStatusBar (int script)
|
||||
{
|
||||
if(SBarInfoScript[script] == NULL)
|
||||
I_FatalError("Tried to create a status bar with no script!");
|
||||
return new DSBarInfo(SBarInfoScript[script]);
|
||||
}
|
||||
|
||||
void SBarInfoMainBlock::DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statusBar, int xOffset, int yOffset, double alpha)
|
||||
{
|
||||
|
@ -1562,7 +1550,7 @@ void SBarInfoMainBlock::DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statu
|
|||
else if(!statusBar->Scaled)
|
||||
{
|
||||
rescale = true;
|
||||
statusBar->SetScaled(true, true);
|
||||
statusBar->wrapper->SetScaled(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1573,8 +1561,111 @@ void SBarInfoMainBlock::DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statu
|
|||
if(FullScreenOffsets())
|
||||
hud_scale = false;
|
||||
else
|
||||
statusBar->SetScaled(false);
|
||||
statusBar->wrapper->SetScaled(false);
|
||||
}
|
||||
}
|
||||
|
||||
#include "sbarinfo_commands.cpp"
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SBarinfoWrapper
|
||||
//
|
||||
// This class abstracts SBARINFO from the rest of the engine.
|
||||
// The idea is, when status bars are moved to ZScript that only
|
||||
// this small wrapper class needs to be dealt with and the implementation
|
||||
// can be left alone.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
||||
DSBarInfoWrapper::DSBarInfoWrapper(SBarInfo *script)
|
||||
: DBaseStatusBar(script->height, script->resW, script->resH)
|
||||
{
|
||||
core = new DSBarInfo(this, script);
|
||||
core->_SetScaled(Scaled);
|
||||
CompleteBorder = script->completeBorder;
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::OnDestroy()
|
||||
{
|
||||
if (core != nullptr) delete core;
|
||||
Super::OnDestroy();
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::SetScaled(bool scale, bool force)
|
||||
{
|
||||
Super::SetScaled(scale, force);
|
||||
core->_SetScaled(scale);
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::AttachToPlayer(player_t *player)
|
||||
{
|
||||
Super::AttachToPlayer(player);
|
||||
core->_AttachToPlayer(player);
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::ScreenSizeChanged()
|
||||
{
|
||||
Super::ScreenSizeChanged();
|
||||
core->_ScreenSizeChanged();
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::Draw(EHudState state)
|
||||
{
|
||||
Super::Draw(state);
|
||||
core->_Draw(state);
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::NewGame()
|
||||
{
|
||||
Super::NewGame();
|
||||
if (CPlayer != NULL)
|
||||
{
|
||||
AttachToPlayer(CPlayer);
|
||||
core->_NewGame();
|
||||
}
|
||||
}
|
||||
|
||||
bool DSBarInfoWrapper::MustDrawLog(EHudState state)
|
||||
{
|
||||
return core->_MustDrawLog(state);
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::SetMugShotState(const char *state_name, bool wait_till_done, bool reset)
|
||||
{
|
||||
core->_SetMugShotState(state_name, wait_till_done, reset);
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::Tick()
|
||||
{
|
||||
DBaseStatusBar::Tick();
|
||||
core->_Tick();
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::ReceivedWeapon(AWeapon *weapon)
|
||||
{
|
||||
core->_ReceivedWeapon(weapon);
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::FlashItem(const PClass *itemtype)
|
||||
{
|
||||
core->_FlashItem(itemtype);
|
||||
}
|
||||
|
||||
void DSBarInfoWrapper::ShowPop(int popnum)
|
||||
{
|
||||
DBaseStatusBar::ShowPop(popnum); //DBaseStatusBar supercall
|
||||
core->_ShowPop(popnum);
|
||||
}
|
||||
|
||||
IMPLEMENT_CLASS(DSBarInfoWrapper, false, false)
|
||||
|
||||
DBaseStatusBar *CreateCustomStatusBar(int script)
|
||||
{
|
||||
if (SBarInfoScript[script] == NULL)
|
||||
I_FatalError("Tried to create a status bar with no script!");
|
||||
return new DSBarInfoWrapper(SBarInfoScript[script]);
|
||||
}
|
||||
|
||||
|
|
|
@ -129,4 +129,27 @@ struct SBarInfo
|
|||
#define SCRIPT_DEFAULT 1
|
||||
extern SBarInfo *SBarInfoScript[2];
|
||||
|
||||
class DSBarInfoWrapper : public DBaseStatusBar
|
||||
{
|
||||
DSBarInfo *core;
|
||||
DECLARE_CLASS(DSBarInfoWrapper, DBaseStatusBar)
|
||||
public:
|
||||
DSBarInfoWrapper() : DBaseStatusBar(10, 10, 10) { core = nullptr; }
|
||||
DSBarInfoWrapper(SBarInfo *script);
|
||||
void OnDestroy() override;
|
||||
void SetScaled(bool scale, bool force);
|
||||
void AttachToPlayer(player_t *player) override;
|
||||
|
||||
void ScreenSizeChanged() override;
|
||||
void Draw(EHudState state) override;
|
||||
void NewGame() override;
|
||||
bool MustDrawLog(EHudState state) override;
|
||||
void SetMugShotState(const char *state_name, bool wait_till_done, bool reset) override;
|
||||
void Tick() override;
|
||||
void ReceivedWeapon(AWeapon *weapon) override;
|
||||
void FlashItem(const PClass *itemtype) override;
|
||||
void ShowPop(int popnum) override;
|
||||
};
|
||||
|
||||
|
||||
#endif //__SBarInfo_SBAR_H__
|
||||
|
|
|
@ -1818,7 +1818,7 @@ class CommandDrawSelectedInventory : public CommandDrawImage, private CommandDra
|
|||
int CommandDrawSelectedInventory::artiflashTick = 0;
|
||||
double CommandDrawSelectedInventory::itemflashFade = 0.75;
|
||||
|
||||
void DSBarInfo::FlashItem(const PClass *itemtype)
|
||||
void DSBarInfo::_FlashItem(const PClass *itemtype)
|
||||
{
|
||||
CommandDrawSelectedInventory::Flash();
|
||||
}
|
||||
|
@ -2190,7 +2190,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
|||
AInventory *item;
|
||||
unsigned int i = 0;
|
||||
// If the player has no artifacts, don't draw the bar
|
||||
statusBar->CPlayer->mo->InvFirst = statusBar->ValidateInvFirst(size);
|
||||
statusBar->CPlayer->mo->InvFirst = statusBar->wrapper->ValidateInvFirst(size);
|
||||
if(statusBar->CPlayer->mo->InvFirst != NULL || alwaysShow)
|
||||
{
|
||||
for(item = statusBar->CPlayer->mo->InvFirst, i = 0; item != NULL && i < size; item = item->NextInv(), ++i)
|
||||
|
|
|
@ -86,7 +86,7 @@ DBaseStatusBar *StatusBar;
|
|||
|
||||
extern int setblocks;
|
||||
|
||||
int ST_X, ST_Y;
|
||||
int gST_X, gST_Y;
|
||||
int SB_state = 3;
|
||||
|
||||
FTexture *CrosshairImage;
|
||||
|
@ -292,7 +292,7 @@ void DBaseStatusBar::SetScaled (bool scale, bool force)
|
|||
{
|
||||
ST_X = (SCREENWIDTH - HorizontalResolution) / 2;
|
||||
ST_Y = SCREENHEIGHT - RelTop;
|
||||
::ST_Y = ST_Y;
|
||||
gST_Y = ST_Y;
|
||||
if (RelTop > 0)
|
||||
{
|
||||
Displacement = double((ST_Y * VirticalResolution / SCREENHEIGHT) - (VirticalResolution - RelTop))/RelTop;
|
||||
|
@ -309,16 +309,16 @@ void DBaseStatusBar::SetScaled (bool scale, bool force)
|
|||
float aspect = ActiveRatio(SCREENWIDTH, SCREENHEIGHT);
|
||||
if (!AspectTallerThanWide(aspect))
|
||||
{ // Normal resolution
|
||||
::ST_Y = Scale (ST_Y, SCREENHEIGHT, VirticalResolution);
|
||||
gST_Y = Scale (ST_Y, SCREENHEIGHT, VirticalResolution);
|
||||
}
|
||||
else
|
||||
{ // 5:4 resolution
|
||||
::ST_Y = Scale(ST_Y - VirticalResolution/2, SCREENHEIGHT*3, Scale(VirticalResolution, AspectBaseHeight(aspect), 200)) + SCREENHEIGHT/2
|
||||
gST_Y = Scale(ST_Y - VirticalResolution/2, SCREENHEIGHT*3, Scale(VirticalResolution, AspectBaseHeight(aspect), 200)) + SCREENHEIGHT/2
|
||||
+ (SCREENHEIGHT - SCREENHEIGHT * AspectMultiplier(aspect) / 48) / 2;
|
||||
}
|
||||
Displacement = 0;
|
||||
}
|
||||
::ST_X = ST_X;
|
||||
gST_X = ST_X;
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
|
||||
|
@ -1047,7 +1047,7 @@ void DBaseStatusBar::RefreshBackground () const
|
|||
|
||||
float ratio = ActiveRatio (SCREENWIDTH, SCREENHEIGHT);
|
||||
x = (ratio < 1.5f || !Scaled) ? ST_X : SCREENWIDTH*(48-AspectMultiplier(ratio))/(48*2);
|
||||
y = x == ST_X && x > 0 ? ST_Y : ::ST_Y;
|
||||
y = x == ST_X && x > 0 ? ST_Y : gST_Y;
|
||||
|
||||
if(!CompleteBorder)
|
||||
{
|
||||
|
@ -1255,21 +1255,21 @@ void DBaseStatusBar::Draw (EHudState state)
|
|||
vwidth = SCREENWIDTH;
|
||||
vheight = SCREENHEIGHT;
|
||||
xpos = vwidth - 80;
|
||||
y = ::ST_Y - height;
|
||||
y = gST_Y - height;
|
||||
}
|
||||
else if (active_con_scaletext() > 1)
|
||||
{
|
||||
vwidth = SCREENWIDTH / active_con_scaletext();
|
||||
vheight = SCREENHEIGHT / active_con_scaletext();
|
||||
xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
|
||||
y = ::ST_Y/4 - height;
|
||||
y = gST_Y/4 - height;
|
||||
}
|
||||
else
|
||||
{
|
||||
vwidth = SCREENWIDTH/2;
|
||||
vheight = SCREENHEIGHT/2;
|
||||
xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
|
||||
y = ::ST_Y/2 - height;
|
||||
y = gST_Y/2 - height;
|
||||
}
|
||||
|
||||
if (gameinfo.gametype == GAME_Strife)
|
||||
|
@ -1325,7 +1325,7 @@ void DBaseStatusBar::Draw (EHudState state)
|
|||
}
|
||||
|
||||
// Draw map name
|
||||
y = ::ST_Y - height;
|
||||
y = gST_Y - height;
|
||||
if (gameinfo.gametype == GAME_Heretic && SCREENWIDTH > 320 && !Scaled)
|
||||
{
|
||||
y -= 8;
|
||||
|
@ -1476,7 +1476,7 @@ void DBaseStatusBar::SetMugShotState(const char *stateName, bool waitTillDone, b
|
|||
|
||||
void DBaseStatusBar::DrawBottomStuff (EHudState state)
|
||||
{
|
||||
DrawMessages (HUDMSGLayer_UnderHUD, (state == HUD_StatusBar) ? ::ST_Y : SCREENHEIGHT);
|
||||
DrawMessages (HUDMSGLayer_UnderHUD, (state == HUD_StatusBar) ? gST_Y : SCREENHEIGHT);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -1498,9 +1498,9 @@ void DBaseStatusBar::DrawTopStuff (EHudState state)
|
|||
DrawPowerups ();
|
||||
if (automapactive && !viewactive)
|
||||
{
|
||||
DrawMessages (HUDMSGLayer_OverMap, (state == HUD_StatusBar) ? ::ST_Y : SCREENHEIGHT);
|
||||
DrawMessages (HUDMSGLayer_OverMap, (state == HUD_StatusBar) ? gST_Y : SCREENHEIGHT);
|
||||
}
|
||||
DrawMessages (HUDMSGLayer_OverHUD, (state == HUD_StatusBar) ? ::ST_Y : SCREENHEIGHT);
|
||||
DrawMessages (HUDMSGLayer_OverHUD, (state == HUD_StatusBar) ? gST_Y : SCREENHEIGHT);
|
||||
DrawConsistancy ();
|
||||
DrawWaiting ();
|
||||
if (ShowLog && MustDrawLog(state)) DrawLog ();
|
||||
|
|
|
@ -252,7 +252,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
|||
lineheight = MAX(height, maxiconheight * CleanYfac);
|
||||
ypadding = (lineheight - height + 1) / 2;
|
||||
|
||||
bottom = ST_Y;
|
||||
bottom = gST_Y;
|
||||
y = MAX(48*CleanYfac, (bottom - MAXPLAYERS * (height + CleanYfac + 1)) / 2);
|
||||
|
||||
HU_DrawTimeRemaining (bottom - height);
|
||||
|
|
|
@ -273,13 +273,13 @@ void R_ExecuteSetViewSize ()
|
|||
setsizeneeded = false;
|
||||
V_SetBorderNeedRefresh();
|
||||
|
||||
R_SetWindow (setblocks, SCREENWIDTH, SCREENHEIGHT, ST_Y);
|
||||
R_SetWindow (setblocks, SCREENWIDTH, SCREENHEIGHT, gST_Y);
|
||||
|
||||
// Handle resize, e.g. smaller view windows with border and/or status bar.
|
||||
viewwindowx = (screen->GetWidth() - viewwidth) >> 1;
|
||||
|
||||
// Same with base row offset.
|
||||
viewwindowy = (viewwidth == screen->GetWidth()) ? 0 : (ST_Y - viewheight) >> 1;
|
||||
viewwindowy = (viewwidth == screen->GetWidth()) ? 0 : (gST_Y - viewheight) >> 1;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
struct event_t;
|
||||
|
||||
extern int ST_X;
|
||||
extern int ST_Y;
|
||||
extern int gST_X;
|
||||
extern int gST_Y;
|
||||
|
||||
bool ST_Responder(event_t* ev);
|
||||
|
||||
|
|
|
@ -1662,10 +1662,10 @@ static void V_DrawViewBorder (void)
|
|||
V_DrawBorder (0, 0, SCREENWIDTH, viewwindowy);
|
||||
V_DrawBorder (0, viewwindowy, viewwindowx, viewheight + viewwindowy);
|
||||
V_DrawBorder (viewwindowx + viewwidth, viewwindowy, SCREENWIDTH, viewheight + viewwindowy);
|
||||
V_DrawBorder (0, viewwindowy + viewheight, SCREENWIDTH, ST_Y);
|
||||
V_DrawBorder (0, viewwindowy + viewheight, SCREENWIDTH, gST_Y);
|
||||
|
||||
V_DrawFrame (viewwindowx, viewwindowy, viewwidth, viewheight);
|
||||
V_MarkRect (0, 0, SCREENWIDTH, ST_Y);
|
||||
V_MarkRect (0, 0, SCREENWIDTH, gST_Y);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
Loading…
Reference in a new issue