mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
- Moved all BorderNeedRefresh and SB_state updating code into separate functions that won't crash if screen is NULL.
SVN r4167 (trunk)
This commit is contained in:
parent
01fed92920
commit
be0845acf1
22 changed files with 85 additions and 45 deletions
|
@ -41,6 +41,7 @@
|
|||
#include "farchive.h"
|
||||
#include "r_renderer.h"
|
||||
#include "r_sky.h"
|
||||
#include "sbar.h"
|
||||
|
||||
#include "m_cheat.h"
|
||||
#include "i_system.h"
|
||||
|
@ -1081,7 +1082,7 @@ void AM_Stop ()
|
|||
{
|
||||
automapactive = false;
|
||||
stopped = true;
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
viewactive = true;
|
||||
}
|
||||
|
||||
|
@ -1180,7 +1181,7 @@ void AM_ToggleMap ()
|
|||
if (dmflags2 & DF2_NO_AUTOMAP)
|
||||
return;
|
||||
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
if (!automapactive)
|
||||
{
|
||||
AM_Start ();
|
||||
|
@ -1191,7 +1192,7 @@ void AM_ToggleMap ()
|
|||
if (am_overlay==1 && viewactive)
|
||||
{
|
||||
viewactive = false;
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1134,7 +1134,7 @@ void C_DrawConsole (bool hw2d)
|
|||
(viewwindowx || viewwindowy) &&
|
||||
viewactive)
|
||||
{
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
|
||||
oldbottom = ConBottom;
|
||||
|
@ -1224,8 +1224,8 @@ void C_DrawConsole (bool hw2d)
|
|||
{
|
||||
screen->Dim (PalEntry ((unsigned char)(player->BlendR*255), (unsigned char)(player->BlendG*255), (unsigned char)(player->BlendB*255)),
|
||||
player->BlendA, 0, ConBottom, screen->GetWidth(), screen->GetHeight() - ConBottom);
|
||||
SB_state = screen->GetPageCount ();
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -697,21 +697,21 @@ void D_Display ()
|
|||
|
||||
if (screen->Lock (false))
|
||||
{
|
||||
SB_state = screen->GetPageCount ();
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
|
||||
// [RH] Allow temporarily disabling wipes
|
||||
if (NoWipe)
|
||||
{
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
NoWipe--;
|
||||
wipe = false;
|
||||
wipegamestate = gamestate;
|
||||
}
|
||||
else if (gamestate != wipegamestate && gamestate != GS_FULLCONSOLE && gamestate != GS_TITLELEVEL)
|
||||
{ // save the current screen if about to wipe
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
switch (wipegamestate)
|
||||
{
|
||||
default:
|
||||
|
@ -780,8 +780,8 @@ void D_Display ()
|
|||
if ((hw2d = screen->Begin2D(viewactive)))
|
||||
{
|
||||
// Redraw everything every frame when using 2D accel
|
||||
SB_state = screen->GetPageCount();
|
||||
BorderNeedRefresh = screen->GetPageCount();
|
||||
ST_SetNeedRefresh();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
Renderer->DrawRemainingPlayerSprites();
|
||||
screen->DrawBlendingRect();
|
||||
|
@ -1278,7 +1278,7 @@ void D_DoAdvanceDemo (void)
|
|||
Advisory = NULL;
|
||||
if (!M_DemoNoPlay)
|
||||
{
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
democount++;
|
||||
mysnprintf (demoname + 4, countof(demoname) - 4, "%d", democount);
|
||||
if (Wads.CheckNumForName (demoname) < 0)
|
||||
|
|
|
@ -2245,7 +2245,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
|||
paused = player + 1;
|
||||
S_PauseSound (false, false);
|
||||
}
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ void G_NewInit ()
|
|||
int i;
|
||||
|
||||
G_ClearSnapshots ();
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
netgame = false;
|
||||
multiplayer = false;
|
||||
if (demoplayback)
|
||||
|
@ -424,7 +424,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
|
|||
demoplayback = false;
|
||||
automapactive = false;
|
||||
viewactive = true;
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
|
||||
//Added by MC: Initialize bots.
|
||||
if (!deathmatch)
|
||||
|
|
|
@ -163,7 +163,7 @@ DHUDMessage::~DHUDMessage ()
|
|||
Lines = NULL;
|
||||
if (screen != NULL)
|
||||
{
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
}
|
||||
if (SourceText != NULL)
|
||||
|
@ -597,7 +597,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
|
|||
DTA_RenderStyle, Style,
|
||||
TAG_DONE);
|
||||
}
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -698,7 +698,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
|
|||
DTA_RenderStyle, Style,
|
||||
TAG_DONE);
|
||||
}
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -55,6 +55,8 @@ enum EHudState
|
|||
|
||||
class AWeapon;
|
||||
|
||||
void ST_SetNeedRefresh();
|
||||
|
||||
// HUD Message base object --------------------------------------------------
|
||||
|
||||
class DHUDMessage : public DObject
|
||||
|
|
|
@ -209,6 +209,17 @@ void ST_Clear()
|
|||
CrosshairNum = 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// ST_SetNeedRefresh
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void ST_SetNeedRefresh()
|
||||
{
|
||||
SB_state = (StatusBar == NULL || screen == NULL) ? 0 : screen->GetPageCount();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Constructor
|
||||
|
@ -297,7 +308,7 @@ void DBaseStatusBar::SetScaled (bool scale, bool force)
|
|||
Displacement = 0;
|
||||
}
|
||||
::ST_X = ST_X;
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -309,7 +320,7 @@ void DBaseStatusBar::SetScaled (bool scale, bool force)
|
|||
void DBaseStatusBar::AttachToPlayer (player_t *player)
|
||||
{
|
||||
CPlayer = player;
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -331,7 +342,7 @@ int DBaseStatusBar::GetPlayer ()
|
|||
|
||||
void DBaseStatusBar::MultiplayerChanged ()
|
||||
{
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -441,7 +452,7 @@ DHUDMessage *DBaseStatusBar::DetachMessage (DHUDMessage *msg)
|
|||
// Redraw the status bar in case it was covered
|
||||
if (screen != NULL)
|
||||
{
|
||||
SB_state = screen->GetPageCount();
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
return probe;
|
||||
}
|
||||
|
@ -468,7 +479,7 @@ DHUDMessage *DBaseStatusBar::DetachMessage (DWORD id)
|
|||
// Redraw the status bar in case it was covered
|
||||
if (screen != NULL)
|
||||
{
|
||||
SB_state = screen->GetPageCount();
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
return probe;
|
||||
}
|
||||
|
@ -1281,7 +1292,7 @@ void DBaseStatusBar::Draw (EHudState state)
|
|||
DTA_KeepRatio, true,
|
||||
DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight,
|
||||
TAG_DONE);
|
||||
BorderNeedRefresh = screen->GetPageCount();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1641,7 +1652,7 @@ void DBaseStatusBar::Serialize (FArchive &arc)
|
|||
void DBaseStatusBar::ScreenSizeChanged ()
|
||||
{
|
||||
st_scale.Callback ();
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
|
||||
for (unsigned int i = 0; i < countof(Messages); ++i)
|
||||
{
|
||||
|
|
|
@ -234,7 +234,7 @@ public:
|
|||
{
|
||||
if (state == HUD_Fullscreen)
|
||||
{
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
DrawFullScreenStuff ();
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ private:
|
|||
|
||||
CursorImage = Images[imgINVCURS] != NULL ? imgINVCURS : imgCURSOR01;
|
||||
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
|
||||
CurrentPop = POP_None;
|
||||
PendingPop = POP_NoChange;
|
||||
|
|
|
@ -168,7 +168,7 @@ void HU_DrawScores (player_t *player)
|
|||
|
||||
HU_DoDrawScores (player, sortedplayers);
|
||||
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -88,7 +88,7 @@ void cht_DoCheat (player_t *player, int cheat)
|
|||
msg = GStrings("STSTR_DQDON");
|
||||
else
|
||||
msg = GStrings("STSTR_DQDOFF");
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
break;
|
||||
|
||||
case CHT_BUDDHA:
|
||||
|
|
|
@ -961,7 +961,7 @@ void DSaveMenu::DoSave (FSaveGameNode *node)
|
|||
G_SaveGame (filename, savegamestring);
|
||||
}
|
||||
M_ClearMenus();
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -1100,7 +1100,7 @@ bool DLoadMenu::MenuEvent (int mkey, bool fromcontroller)
|
|||
quickSaveSlot = SaveGames[Selected];
|
||||
}
|
||||
M_ClearMenus();
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
LastAccessed = Selected;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -734,7 +734,7 @@ void M_ClearMenus ()
|
|||
DMenu::CurrentMenu->Destroy();
|
||||
DMenu::CurrentMenu = NULL;
|
||||
}
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
menuactive = MENU_Off;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,8 +179,8 @@ void DMessageBoxMenu::Drawer ()
|
|||
PalEntry fade = 0;
|
||||
|
||||
int fontheight = SmallFont->GetHeight();
|
||||
//BorderNeedRefresh = screen->GetPageCount ();
|
||||
//SB_state = screen->GetPageCount ();
|
||||
//V_SetBorderNeedRefresh();
|
||||
//ST_SetNeedRefresh();
|
||||
|
||||
y = 100;
|
||||
|
||||
|
|
|
@ -460,7 +460,7 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
|
|||
void R_ExecuteSetViewSize ()
|
||||
{
|
||||
setsizeneeded = false;
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
|
||||
R_SetWindow (setblocks, SCREENWIDTH, SCREENHEIGHT, ST_Y);
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ void S_NoiseDebug (void)
|
|||
}
|
||||
chan = (FSoundChan *)((size_t)chan->PrevChan - myoffsetof(FSoundChan, NextChan));
|
||||
}
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
}
|
||||
|
||||
static FString LastLocalSndInfo;
|
||||
|
|
|
@ -29,7 +29,6 @@ struct event_t;
|
|||
extern int ST_X;
|
||||
extern int ST_Y;
|
||||
|
||||
extern int SB_state;
|
||||
bool ST_Responder(event_t* ev);
|
||||
|
||||
// [RH] Base blending values (for e.g. underwater)
|
||||
|
|
|
@ -94,7 +94,7 @@ void FStat::ToggleStat (const char *name)
|
|||
void FStat::ToggleStat ()
|
||||
{
|
||||
m_Active = !m_Active;
|
||||
SB_state = StatusBar == NULL ? 0 : screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
|
||||
void FStat::PrintStat ()
|
||||
|
@ -124,7 +124,7 @@ void FStat::PrintStat ()
|
|||
}
|
||||
if (count)
|
||||
{
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "gi.h"
|
||||
#include "g_level.h"
|
||||
#include "st_stuff.h"
|
||||
#include "sbar.h"
|
||||
|
||||
#include "i_system.h"
|
||||
#include "i_video.h"
|
||||
|
@ -1377,8 +1378,32 @@ bool DCanvas::ClipBox (int &x, int &y, int &w, int &h, const BYTE *&src, const i
|
|||
return false;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// V_SetBorderNeedRefresh
|
||||
//
|
||||
// Flag the border as in need of updating. (Probably because something that
|
||||
// was on top of it has changed.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void V_SetBorderNeedRefresh()
|
||||
{
|
||||
if (screen != NULL)
|
||||
{
|
||||
BorderNeedRefresh = screen->GetPageCount();
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// V_DrawFrame
|
||||
//
|
||||
// Draw a frame around the specified area using the view border
|
||||
// frame graphics. The border is drawn outside the area, not in it.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void V_DrawFrame (int left, int top, int width, int height)
|
||||
{
|
||||
FTexture *p;
|
||||
|
@ -1411,7 +1436,7 @@ void V_DrawFrame (int left, int top, int width, int height)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
// V_DrawBorder
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
|
@ -1455,7 +1480,7 @@ static void V_DrawViewBorder (void)
|
|||
// Will draw borders around itself, too.
|
||||
if (SCREENWIDTH > 320)
|
||||
{
|
||||
SB_state = screen->GetPageCount ();
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
|
||||
if (viewwidth == SCREENWIDTH)
|
||||
|
|
|
@ -1605,7 +1605,7 @@ void V_Init2()
|
|||
FBaseCVar::ResetColors ();
|
||||
C_NewModeAdjust();
|
||||
M_InitVideoModesMenu();
|
||||
BorderNeedRefresh = screen->GetPageCount ();
|
||||
V_SetBorderNeedRefresh();
|
||||
setsizeneeded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -485,6 +485,7 @@ void V_DrawFrame (int left, int top, int width, int height);
|
|||
void V_DrawBorder (int x1, int y1, int x2, int y2);
|
||||
void V_RefreshViewBorder ();
|
||||
|
||||
void V_SetBorderNeedRefresh();
|
||||
|
||||
#if defined(X86_ASM) || defined(X64_ASM)
|
||||
extern "C" void ASM_PatchPitch (void);
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
#include "r_main.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "f_wipe.h"
|
||||
#include "st_stuff.h"
|
||||
#include "sbar.h"
|
||||
#include "win32iface.h"
|
||||
#include "doomstat.h"
|
||||
#include "v_palette.h"
|
||||
|
@ -225,7 +225,8 @@ const char *const D3DFB::ShaderNames[D3DFB::NUM_SHADERS] =
|
|||
|
||||
CUSTOM_CVAR(Bool, vid_hw2d, true, CVAR_NOINITCALL)
|
||||
{
|
||||
BorderNeedRefresh = SB_state = screen->GetPageCount();
|
||||
V_SetBorderNeedRefresh();
|
||||
ST_SetNeedRefresh();
|
||||
}
|
||||
|
||||
CVAR(Bool, d3d_antilag, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
|
Loading…
Reference in a new issue