mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-02 22:01:41 +00:00
- Backend update from Raze
Mostly cleanup and better separation of game/backend concerns.
This commit is contained in:
parent
b7f3cc157d
commit
c62e14d2c1
30 changed files with 200 additions and 196 deletions
|
@ -55,9 +55,6 @@ struct FLatchedValue
|
|||
|
||||
static TArray<FLatchedValue> LatchedValues;
|
||||
|
||||
bool FBaseCVar::m_DoNoSet = false;
|
||||
bool FBaseCVar::m_UseCallback = false;
|
||||
|
||||
FBaseCVar *CVars = NULL;
|
||||
|
||||
int cvar_defflags;
|
||||
|
|
|
@ -216,8 +216,8 @@ private:
|
|||
void (*m_Callback)(FBaseCVar &);
|
||||
FBaseCVar *m_Next;
|
||||
|
||||
static bool m_UseCallback;
|
||||
static bool m_DoNoSet;
|
||||
static inline bool m_UseCallback = false;
|
||||
static inline bool m_DoNoSet = false;
|
||||
|
||||
void *m_ExtraDataPointer;
|
||||
|
||||
|
|
|
@ -255,7 +255,6 @@ public:
|
|||
failed = true;
|
||||
}
|
||||
|
||||
// The decoder needs a buffer with even height
|
||||
Pic.Resize(width * height * 4);
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "i_interface.h"
|
||||
#include "st_start.h"
|
||||
|
||||
// Some global engine variables taken out of the backend code.
|
||||
FStartupScreen* StartWindow;
|
||||
SystemCallbacks sysCallbacks;
|
||||
FString endoomName;
|
||||
bool batchrun;
|
||||
|
|
|
@ -455,7 +455,7 @@ void FSkyVertexBuffer::RenderRow(FRenderState& state, EDrawType prim, int row, T
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FSkyVertexBuffer::RenderDome(FRenderState& state, FGameTexture* tex, int mode, bool which, PalEntry color)
|
||||
void FSkyVertexBuffer::DoRenderDome(FRenderState& state, FGameTexture* tex, int mode, bool which, PalEntry color)
|
||||
{
|
||||
auto& primStart = which ? mPrimStartBuild : mPrimStartDoom;
|
||||
if (tex && tex->isValid())
|
||||
|
@ -510,7 +510,7 @@ void FSkyVertexBuffer::RenderDome(FRenderState& state, FGameTexture* tex, float
|
|||
{
|
||||
SetupMatrices(tex, x_offset, y_offset, mirror, mode, state.mModelMatrix, state.mTextureMatrix, tiled, xscale, yscale);
|
||||
}
|
||||
RenderDome(state, tex, mode, false, color);
|
||||
DoRenderDome(state, tex, mode, false, color);
|
||||
}
|
||||
|
||||
|
||||
|
@ -570,5 +570,6 @@ void FSkyVertexBuffer::RenderBox(FRenderState& state, FSkyBox* tex, float x_offs
|
|||
state.Draw(DT_TriangleStrip, FaceStart(4), 4);
|
||||
|
||||
state.EnableModelMatrix(false);
|
||||
state.SetObjectColor(0xffffffff);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
}
|
||||
|
||||
void RenderRow(FRenderState& state, EDrawType prim, int row, TArray<unsigned int>& mPrimStart, bool apply = true);
|
||||
void RenderDome(FRenderState& state, FGameTexture* tex, int mode, bool which, PalEntry color = 0xffffffff);
|
||||
void DoRenderDome(FRenderState& state, FGameTexture* tex, int mode, bool which, PalEntry color = 0xffffffff);
|
||||
void RenderDome(FRenderState& state, FGameTexture* tex, float x_offset, float y_offset, bool mirror, int mode, bool tiled, float xscale = 0, float yscale = 0, PalEntry color = 0xffffffff);
|
||||
void RenderBox(FRenderState& state, FSkyBox* tex, float x_offset, bool sky2, float stretch, const FVector3& skyrotatevector, const FVector3& skyrotatevector2, PalEntry color = 0xffffffff);
|
||||
|
||||
|
|
|
@ -11158,7 +11158,7 @@ ExpEmit FxLocalArrayDeclaration::Emit(VMFunctionBuilder *build)
|
|||
|
||||
auto zero = build->GetConstantInt(0);
|
||||
auto elementSizeConst = build->GetConstantInt(static_cast<PArray *>(ValueType)->ElementSize);
|
||||
int arrOffsetReg;
|
||||
int arrOffsetReg = 0;
|
||||
if (!isDynamicArray)
|
||||
{
|
||||
arrOffsetReg = build->Registers[REGT_POINTER].Get(1);
|
||||
|
|
|
@ -425,9 +425,9 @@ PNamespace *ParseOneScript(const int baselump, ZCCParseState &state)
|
|||
{
|
||||
FString fullPath = IncludeLocs[i].FileName.GetChars(); // get full path, format 'wad:filepath/filename'
|
||||
|
||||
long start = fullPath.IndexOf(":"); // find first ':'
|
||||
auto start = fullPath.IndexOf(":"); // find first ':'
|
||||
|
||||
long end = fullPath.LastIndexOf("/"); // find last '/'
|
||||
auto end = fullPath.LastIndexOf("/"); // find last '/'
|
||||
|
||||
if (start!=-1&&end!=-1)
|
||||
{
|
||||
|
@ -443,7 +443,7 @@ PNamespace *ParseOneScript(const int baselump, ZCCParseState &state)
|
|||
while (relativePath.IndexOf("../") == 0) // go back one folder for each '..'
|
||||
{
|
||||
relativePath = relativePath.Mid(3);
|
||||
long slash_index = resolvedPath.LastIndexOf("/");
|
||||
auto slash_index = resolvedPath.LastIndexOf("/");
|
||||
if (slash_index != -1) {
|
||||
resolvedPath = resolvedPath.Mid(0,slash_index);
|
||||
} else {
|
||||
|
|
|
@ -350,15 +350,15 @@ FStartScreen* GetGameStartScreen(int max_progress)
|
|||
{
|
||||
try
|
||||
{
|
||||
if (GameStartupInfo.Type == FStartupInfo::HexenStartup || (gameinfo.gametype == GAME_Hexen && GameStartupInfo.Type == FStartupInfo::DefaultStartup))
|
||||
if (GameStartupInfo.Type == FStartupInfo::HexenStartup)
|
||||
{
|
||||
return CreateHexenStartScreen(max_progress);
|
||||
}
|
||||
else if (GameStartupInfo.Type == FStartupInfo::HereticStartup || (gameinfo.gametype == GAME_Heretic && GameStartupInfo.Type == FStartupInfo::DefaultStartup))
|
||||
else if (GameStartupInfo.Type == FStartupInfo::HereticStartup)
|
||||
{
|
||||
return CreateHereticStartScreen(max_progress);
|
||||
}
|
||||
else if (GameStartupInfo.Type == FStartupInfo::StrifeStartup || (gameinfo.gametype == GAME_Strife && GameStartupInfo.Type == FStartupInfo::DefaultStartup))
|
||||
else if (GameStartupInfo.Type == FStartupInfo::StrifeStartup)
|
||||
{
|
||||
return CreateStrifeStartScreen(max_progress);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "gi.h"
|
||||
#include "bitmap.h"
|
||||
|
|
|
@ -198,35 +198,27 @@ void I_ResetFrameTime()
|
|||
FirstFrameStartTime += (CurrentFrameStartTime - ft);
|
||||
}
|
||||
|
||||
double I_GetInputFrac(bool const synchronised, double const ticrate)
|
||||
double I_GetInputFrac(bool const synchronised)
|
||||
{
|
||||
if (!synchronised)
|
||||
{
|
||||
const double max = 1000. / ticrate;
|
||||
const double now = I_msTimeF();
|
||||
const double elapsedInputTicks = std::min(now - lastinputtime, max);
|
||||
const double result = (now - lastinputtime) * GameTicRate * (1. / 1000.);
|
||||
lastinputtime = now;
|
||||
|
||||
if (elapsedInputTicks < max)
|
||||
if (result < 1)
|
||||
{
|
||||
// Calculate an amplification to apply to the result before returning,
|
||||
// factoring in the game's ticrate and the value of the result.
|
||||
// This rectifies a deviation of 100+ ms or more depending on the length
|
||||
// of the operation to be within 1-2 ms of synchronised input
|
||||
// from 60 fps to at least 1000 fps at ticrates of 30 and 40 Hz.
|
||||
const double result = elapsedInputTicks * ticrate * (1. / 1000.);
|
||||
return result * (1. + 0.35 * (1. - ticrate * (1. / 50.)) * (1. - result));
|
||||
return result * (1. + 0.35 * (1. - GameTicRate * (1. / 50.)) * (1. - result));
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void I_ResetInputTime()
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ uint64_t I_nsTime();
|
|||
void I_ResetFrameTime();
|
||||
|
||||
// Return a decimal fraction to scale input operations at framerate
|
||||
double I_GetInputFrac(bool const synchronised, double const ticrate = GameTicRate);
|
||||
double I_GetInputFrac(bool const synchronised);
|
||||
|
||||
// Reset the last input check to after a lengthy operation
|
||||
void I_ResetInputTime();
|
||||
|
|
|
@ -335,7 +335,6 @@ int restart = 0;
|
|||
bool AppActive = true;
|
||||
bool playedtitlemusic;
|
||||
|
||||
FStartupScreen* StartWindow;
|
||||
FStartScreen* StartScreen;
|
||||
|
||||
cycle_t FrameCycles;
|
||||
|
@ -3098,6 +3097,17 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
|
|||
int max_progress = TexMan.GuesstimateNumTextures();
|
||||
int per_shader_progress = 0;//screen->GetShaderCount()? (max_progress / 10 / screen->GetShaderCount()) : 0;
|
||||
bool nostartscreen = batchrun || restart || Args->CheckParm("-join") || Args->CheckParm("-host") || Args->CheckParm("-norun");
|
||||
|
||||
if (GameStartupInfo.Type == FStartupInfo::DefaultStartup)
|
||||
{
|
||||
if (gameinfo.gametype == GAME_Hexen)
|
||||
GameStartupInfo.Type = FStartupInfo::HexenStartup;
|
||||
else if (gameinfo.gametype == GAME_Heretic)
|
||||
GameStartupInfo.Type = FStartupInfo::HereticStartup;
|
||||
else if (gameinfo.gametype == GAME_Strife)
|
||||
GameStartupInfo.Type = FStartupInfo::StrifeStartup;
|
||||
}
|
||||
|
||||
StartScreen = nostartscreen? nullptr : GetGameStartScreen(per_shader_progress > 0 ? max_progress * 10 / 9 : max_progress + 3);
|
||||
|
||||
GameConfig->DoKeySetup(gameinfo.ConfigName);
|
||||
|
|
|
@ -226,7 +226,11 @@ struct System native
|
|||
if (ev.type == InputEvent.Type_KeyDown || ev.type == InputEvent.Type_KeyUp)
|
||||
{
|
||||
int key = ev.KeyScan;
|
||||
if (key == InputEvent.KEY_VOLUMEDOWN || key == InputEvent.KEY_VOLUMEUP || (key > InputEvent.KEY_LASTJOYBUTTON && key < InputEvent.KEY_PAD_LTHUMB_RIGHT)) return true;
|
||||
let binding = Bindings.GetBinding(key);
|
||||
bool volumekeys = key == InputEvent.KEY_VOLUMEDOWN || key == InputEvent.KEY_VOLUMEUP;
|
||||
bool gamepadkeys = key > InputEvent.KEY_LASTJOYBUTTON && key < InputEvent.KEY_PAD_LTHUMB_RIGHT;
|
||||
bool altkeys = key == InputEvent.KEY_LALT || key == InputEvent.KEY_RALT;
|
||||
if (volumekeys || gamepadkeys || altkeys || binding ~== "screenshot") return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue