- backend update from GZDoom.

This commit is contained in:
Christoph Oelckers 2022-10-02 20:33:18 +02:00
parent 5a27390eaf
commit c1d603e1e9
58 changed files with 487 additions and 333 deletions

View file

@ -931,10 +931,6 @@ set( FASTMATH_SOURCES
common/textures/hires/xbr/xbrz.cpp
common/textures/hires/xbr/xbrz_old.cpp
common/utility/matrix.cpp
# The rest is only here because it is C, not C++
gitinfo.cpp
)
#Vulkan stuff must go into a separate list because it needs to be disabled for some platforms
@ -1164,6 +1160,7 @@ set (PCH_SOURCES
common/cutscenes/screenjob.cpp
common/utility/engineerrors.cpp
common/utility/i_module.cpp
common/utility/gitinfo.cpp
common/utility/m_alloc.cpp
common/utility/utf8.cpp
common/utility/palette.cpp

View file

@ -199,7 +199,7 @@ void DoDrawTexture(F2DDrawer *drawer, FGameTexture* img, double x, double y, int
DrawParms parms;
if (!img || !img->isValid()) return;
bool res = ParseDrawTextureTags(drawer, img, x, y, tags_first, tags, &parms, false);
bool res = ParseDrawTextureTags(drawer, img, x, y, tags_first, tags, &parms, DrawTexture_Normal);
va_end(tags.list);
if (!res)
{
@ -238,7 +238,7 @@ void DoDrawTexture(F2DDrawer *drawer, FGameTexture *img, double x, double y, VMV
DrawParms parms;
uint32_t tag = ListGetInt(args);
if (!img || !img->isValid()) return;
bool res = ParseDrawTextureTags(drawer, img, x, y, tag, args, &parms, false);
bool res = ParseDrawTextureTags(drawer, img, x, y, tag, args, &parms, DrawTexture_Normal);
if (!res) return;
drawer->AddTexture(img, parms);
}
@ -290,7 +290,7 @@ void DrawShape(F2DDrawer *drawer, FGameTexture *img, DShape2D *shape, int tags_f
va_start(tags.list, tags_first);
DrawParms parms;
bool res = ParseDrawTextureTags(drawer, img, 0, 0, tags_first, tags, &parms, false);
bool res = ParseDrawTextureTags(drawer, img, 0, 0, tags_first, tags, &parms, DrawTexture_Normal);
va_end(tags.list);
if (!res) return;
drawer->AddShape(img, shape, parms);
@ -301,21 +301,19 @@ void DrawShape(F2DDrawer *drawer, FGameTexture *img, DShape2D *shape, VMVa_List
DrawParms parms;
uint32_t tag = ListGetInt(args);
bool res = ParseDrawTextureTags(drawer, img, 0, 0, tag, args, &parms, false);
bool res = ParseDrawTextureTags(drawer, img, 0, 0, tag, args, &parms, DrawTexture_Normal);
if (!res) return;
drawer->AddShape(img, shape, parms);
}
void DrawShapeFill(F2DDrawer *drawer, int color, DShape2D *shape, VMVa_List &args)
void DrawShapeFill(F2DDrawer *drawer, PalEntry color, double amount, DShape2D *shape, VMVa_List &args)
{
DrawParms parms;
uint32_t tag = ListGetInt(args);
bool res = ParseDrawTextureTags(drawer, nullptr, 0, 0, tag, args, &parms, false, false);
bool res = ParseDrawTextureTags(drawer, nullptr, 0, 0, tag, args, &parms, DrawTexture_Fill, color, amount);
if (!res) return;
parms.fillcolor = color;
drawer->AddShape(nullptr, shape, parms);
}
@ -367,9 +365,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawShapeFill)
VMVa_List args = { param + 3, 0, numparam - 4, va_reginfo + 3 };
color.a = int(amount * 255.0f);
DrawShapeFill(twod, color, shape, args);
DrawShapeFill(twod, color, amount, shape, args);
return 0;
}
@ -384,9 +380,7 @@ DEFINE_ACTION_FUNCTION(FCanvas, DrawShapeFill)
VMVa_List args = { param + 4, 0, numparam - 5, va_reginfo + 4 };
color.a = int(amount * 255.0f);
DrawShapeFill(&self->Drawer, color, shape, args);
DrawShapeFill(&self->Drawer, color, amount, shape, args);
self->Tex->NeedUpdate();
return 0;
}
@ -532,7 +526,7 @@ void CalcFullscreenScale(DrawParms *parms, double srcwidth, double srcheight, in
if (autoaspect == FSMode_ScaleToFit43 || autoaspect == FSMode_ScaleToFit43Top || autoaspect == FSMode_ScaleToFit43Bottom)
{
// screen is wider than the image -> pillarbox it. 4:3 images must also be pillarboxed if the screen is taller than the image
if (screenratio >= aspect || aspect < 1.4) autoaspect = FSMode_ScaleToFit;
if (screenratio >= aspect || aspect < 1.4) autoaspect = FSMode_ScaleToFit;
else if (screenratio > 1.32) autoaspect = FSMode_ScaleToFill; // on anything 4:3 and wider crop the sides of the image.
else
{
@ -833,13 +827,13 @@ static inline FSpecialColormap * ListGetSpecialColormap(VMVa_List &tags)
//==========================================================================
template<class T>
bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double y, uint32_t tag, T& tags, DrawParms *parms, bool fortext, bool checkimage)
bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double y, uint32_t tag, T& tags, DrawParms *parms, int type, PalEntry fill, double fillalpha)
{
INTBOOL boolval;
int intval;
bool fillcolorset = false;
bool fillcolorset = type == DrawTexture_Fill;
if (!fortext && checkimage)
if (type == DrawTexture_Normal)
{
if (img == NULL || !img->isValid())
{
@ -855,7 +849,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
return false;
}
parms->fortext = fortext;
parms->fortext = type == DrawTexture_Text;
parms->windowleft = 0;
parms->windowright = INT_MAX;
parms->dclip = drawer->GetHeight();
@ -866,8 +860,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
parms->top = INT_MAX;
parms->destwidth = INT_MAX;
parms->destheight = INT_MAX;
parms->Alpha = 1.f;
parms->fillcolor = -1;
parms->Alpha = type == DrawTexture_Fill ? fillalpha : 1.f;
parms->fillcolor = type == DrawTexture_Fill ? fill : PalEntry(~0u);
parms->TranslationId = -1;
parms->colorOverlay = 0;
parms->alphaChannel = false;
@ -916,29 +910,29 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
break;
case DTA_DestWidth:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->cleanmode = DTA_Base;
parms->destwidth = ListGetInt(tags);
break;
case DTA_DestWidthF:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->cleanmode = DTA_Base;
parms->destwidth = ListGetDouble(tags);
break;
case DTA_DestHeight:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->cleanmode = DTA_Base;
parms->destheight = ListGetInt(tags);
break;
case DTA_DestHeightF:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->cleanmode = DTA_Base;
parms->destheight = ListGetDouble(tags);
break;
@ -1046,7 +1040,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
boolval = ListGetInt(tags);
if (boolval)
{
assert(fortext == false);
assert(type != DrawTexture_Text);
if (img == NULL) return false;
parms->cleanmode = DTA_Fullscreen;
parms->fsscalemode = (uint8_t)twod->fullscreenautoaspect;
@ -1060,7 +1054,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
intval = ListGetInt(tags);
if (intval >= 0 && intval <= 3)
{
assert(fortext == false);
assert(type != DrawTexture_Text);
if (img == NULL) return false;
parms->cleanmode = DTA_Fullscreen;
parms->fsscalemode = (uint8_t)intval;
@ -1135,32 +1129,32 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
break;
case DTA_TopOffset:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->top = ListGetInt(tags);
break;
case DTA_TopOffsetF:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->top = ListGetDouble(tags);
break;
case DTA_LeftOffset:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->left = ListGetInt(tags);
break;
case DTA_LeftOffsetF:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->left = ListGetDouble(tags);
break;
case DTA_TopLeft:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
if (ListGetInt(tags))
{
parms->left = 0;
@ -1169,8 +1163,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
break;
case DTA_CenterOffset:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
if (ListGetInt(tags))
{
parms->left = img->GetDisplayWidth() * 0.5;
@ -1179,8 +1173,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
break;
case DTA_CenterOffsetRel:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
intval = ListGetInt(tags);
if (intval == 1)
{
@ -1195,8 +1189,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
break;
case DTA_CenterBottomOffset:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
if (ListGetInt(tags))
{
parms->left = img->GetDisplayWidth() * 0.5;
@ -1205,26 +1199,26 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
break;
case DTA_WindowLeft:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->windowleft = ListGetInt(tags);
break;
case DTA_WindowLeftF:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->windowleft = ListGetDouble(tags);
break;
case DTA_WindowRight:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->windowright = ListGetInt(tags);
break;
case DTA_WindowRightF:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->windowright = ListGetDouble(tags);
break;
@ -1362,8 +1356,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
break;
case DTA_Rotate:
assert(fortext == false);
if (fortext) return false;
assert(type != DrawTexture_Text);
if (type == DrawTexture_Text) return false;
parms->rotateangle = ListGetDouble(tags);
break;
@ -1436,8 +1430,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
}
// explicitly instantiate both versions for v_text.cpp.
template bool ParseDrawTextureTags<Va_List>(F2DDrawer* drawer, FGameTexture *img, double x, double y, uint32_t tag, Va_List& tags, DrawParms *parms, bool fortext, bool checkimage);
template bool ParseDrawTextureTags<VMVa_List>(F2DDrawer* drawer, FGameTexture *img, double x, double y, uint32_t tag, VMVa_List& tags, DrawParms *parms, bool fortext, bool checkimage);
template bool ParseDrawTextureTags<Va_List>(F2DDrawer* drawer, FGameTexture *img, double x, double y, uint32_t tag, Va_List& tags, DrawParms *parms, int type, PalEntry fill, double fillalpha);
template bool ParseDrawTextureTags<VMVa_List>(F2DDrawer* drawer, FGameTexture *img, double x, double y, uint32_t tag, VMVa_List& tags, DrawParms *parms, int type, PalEntry fill, double fillalpha);
//==========================================================================
//
@ -1446,7 +1440,7 @@ template bool ParseDrawTextureTags<VMVa_List>(F2DDrawer* drawer, FGameTexture *i
//==========================================================================
static void VirtualToRealCoords(F2DDrawer *drawer, double Width, double Height, double &x, double &y, double &w, double &h,
double vwidth, double vheight, bool vbottom, bool handleaspect)
double vwidth, double vheight, bool vbottom, bool handleaspect)
{
float myratio = float(handleaspect ? ActiveRatio (Width, Height) : (4.0 / 3.0));
@ -1594,7 +1588,7 @@ DEFINE_ACTION_FUNCTION(FCanvas, DrawLine)
return 0;
}
static void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, uint32_t realcolor, int alpha)
static void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, uint32_t realcolor, int alpha)
{
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
twod->AddThickLine(x0, y0, x1, y1, thickness, realcolor, alpha);
@ -1980,4 +1974,3 @@ DEFINE_ACTION_FUNCTION(FCanvas, ClearTransform)
self->Tex->NeedUpdate();
return 0;
}

View file

@ -103,7 +103,7 @@ enum
DTA_CellX, // horizontal size of character cell
DTA_CellY, // vertical size of character cell
// New additions.
// New additions.
DTA_Color,
DTA_FlipY, // bool: flip image vertically
DTA_SrcX, // specify a source rectangle (this supersedes the poorly implemented DTA_WindowLeft/Right
@ -258,8 +258,15 @@ inline int active_con_scale(F2DDrawer *drawer)
#undef DrawText // See WinUser.h for the definition of DrawText as a macro
#endif
enum
{
DrawTexture_Normal,
DrawTexture_Text,
DrawTexture_Fill,
};
template<class T>
bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture* img, double x, double y, uint32_t tag, T& tags, DrawParms* parms, bool fortext, bool checkimage = true);
bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture* img, double x, double y, uint32_t tag, T& tags, DrawParms* parms, int type, PalEntry fill = ~0u, double fillalpha = 0.0);
template<class T>
void DrawTextCommon(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double y, const T* string, DrawParms& parms);

View file

@ -179,7 +179,7 @@ void DrawChar(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double
DrawParms parms;
Va_List tags;
va_start(tags.list, tag_first);
bool res = ParseDrawTextureTags(drawer, pic, x, y, tag_first, tags, &parms, false);
bool res = ParseDrawTextureTags(drawer, pic, x, y, tag_first, tags, &parms, DrawTexture_Normal);
va_end(tags.list);
if (!res)
{
@ -208,7 +208,7 @@ void DrawChar(F2DDrawer *drawer, FFont *font, int normalcolor, double x, double
{
DrawParms parms;
uint32_t tag = ListGetInt(args);
bool res = ParseDrawTextureTags(drawer, pic, x, y, tag, args, &parms, false);
bool res = ParseDrawTextureTags(drawer, pic, x, y, tag, args, &parms, DrawTexture_Normal);
if (!res) return;
bool palettetrans = (normalcolor == CR_NATIVEPAL && parms.TranslationId != 0);
PalEntry color = 0xffffffff;
@ -261,7 +261,7 @@ DEFINE_ACTION_FUNCTION(FCanvas, DrawChar)
//==========================================================================
// This is only needed as a dummy. The code using wide strings does not need color control.
EColorRange V_ParseFontColor(const char32_t *&color_value, int normalcolor, int boldcolor) { return CR_UNTRANSLATED; }
EColorRange V_ParseFontColor(const char32_t *&color_value, int normalcolor, int boldcolor) { return CR_UNTRANSLATED; }
template<class chartype>
void DrawTextCommon(F2DDrawer *drawer, FFont *font, int normalcolor, double x, double y, const chartype *string, DrawParms &parms)
@ -374,7 +374,7 @@ void DrawText(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double
return;
va_start(tags.list, tag_first);
bool res = ParseDrawTextureTags(drawer, nullptr, 0, 0, tag_first, tags, &parms, true);
bool res = ParseDrawTextureTags(drawer, nullptr, 0, 0, tag_first, tags, &parms, DrawTexture_Text);
va_end(tags.list);
if (!res)
{
@ -393,7 +393,7 @@ void DrawText(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double
return;
va_start(tags.list, tag_first);
bool res = ParseDrawTextureTags(drawer, nullptr, 0, 0, tag_first, tags, &parms, true);
bool res = ParseDrawTextureTags(drawer, nullptr, 0, 0, tag_first, tags, &parms, DrawTexture_Text);
va_end(tags.list);
if (!res)
{
@ -411,7 +411,7 @@ void DrawText(F2DDrawer *drawer, FFont *font, int normalcolor, double x, double
return;
uint32_t tag = ListGetInt(args);
bool res = ParseDrawTextureTags(drawer, nullptr, 0, 0, tag, args, &parms, true);
bool res = ParseDrawTextureTags(drawer, nullptr, 0, 0, tag, args, &parms, DrawTexture_Text);
if (!res)
{
return;
@ -455,4 +455,3 @@ DEFINE_ACTION_FUNCTION(FCanvas, DrawText)
self->Tex->NeedUpdate();
return 0;
}

View file

@ -156,6 +156,23 @@ int wipe_CalcBurn (uint8_t *burnarray, int width, int height, int density)
// TYPES -------------------------------------------------------------------
class Wiper
{
protected:
FGameTexture* startScreen = nullptr, * endScreen = nullptr;
public:
virtual ~Wiper();
virtual bool Run(int ticks) = 0;
virtual void SetTextures(FGameTexture* startscreen, FGameTexture* endscreen)
{
startScreen = startscreen;
endScreen = endscreen;
}
static Wiper* Create(int type);
};
class Wiper_Crossfade : public Wiper
{
public:

View file

@ -5,7 +5,6 @@
#include <functional>
class FTexture;
int wipe_CalcBurn(uint8_t *buffer, int width, int height, int density);
enum
{
@ -16,22 +15,6 @@ enum
wipe_NUMWIPES
};
class Wiper
{
protected:
FGameTexture *startScreen = nullptr, *endScreen = nullptr;
public:
virtual ~Wiper();
virtual bool Run(int ticks) = 0;
virtual void SetTextures(FGameTexture *startscreen, FGameTexture *endscreen)
{
startScreen = startscreen;
endScreen = endscreen;
}
static Wiper *Create(int type);
};
void PerformWipe(FTexture* startimg, FTexture* endimg, int wipe_type, bool stopsound, std::function<void()> overlaydrawer);

View file

@ -58,12 +58,12 @@ EXTERN_CVAR(Float, snd_musicvolume)
inline float AmplitudeTodB(float amplitude)
{
return 20.0f * log10(amplitude);
return 20.0f * log10f(amplitude);
}
inline float dBToAmplitude(float dB)
{
return pow(10.0f, dB / 20.0f);
return powf(10.0f, dB / 20.0f);
}
#endif //__I_MUSIC_H__

View file

@ -38,12 +38,13 @@
#include "i_soundinternal.h"
#include "cmdlib.h"
#include "i_system.h"
#include "gameconfigfile.h"
#include "filereadermusicinterface.h"
#include <zmusic.h>
#include "resourcefile.h"
#include "version.h"
#include "findfile.h"
#include "i_interface.h"
#include "configfile.h"
//==========================================================================
//
@ -392,6 +393,7 @@ void FSoundFontManager::CollectSoundfonts()
findstate_t c_file;
void *file;
FConfigFile* GameConfig = sysCallbacks.GetConfig ? sysCallbacks.GetConfig() : nullptr;
if (GameConfig != NULL && GameConfig->SetSection ("SoundfontSearch.Directories"))
{
const char *key;

View file

@ -51,8 +51,8 @@
#include <zmusic.h>
#include "md5.h"
#include "gain_analysis.h"
#include "gameconfigfile.h"
#include "i_specialpaths.h"
#include "configfile.h"
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------

View file

@ -44,8 +44,11 @@
#include "m_random.h"
#include "printf.h"
#include "c_cvars.h"
#include "gamestate.h"
CVARD(Bool, snd_enabled, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enables/disables sound effects")
CVAR(Bool, i_soundinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, i_pauseinbackground, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
int SoundEnabled()
{
@ -1710,3 +1713,155 @@ void S_SoundReset()
S_RestartMusic();
}
//==========================================================================
//
// CCMD cachesound <sound name>
//
//==========================================================================
#include "s_music.h"
#include "vm.h"
#include "c_dispatch.h"
#include "stats.h"
#include "i_net.h"
#include "i_interface.h"
CCMD(cachesound)
{
if (argv.argc() < 2)
{
Printf("Usage: cachesound <sound> ...\n");
return;
}
for (int i = 1; i < argv.argc(); ++i)
{
FSoundID sfxnum = argv[i];
if (sfxnum != FSoundID(0))
{
soundEngine->CacheSound(sfxnum);
}
}
}
CCMD(listsoundchannels)
{
Printf("%s", soundEngine->ListSoundChannels().GetChars());
}
// intentionally moved here to keep the s_music include out of the rest of the file.
//==========================================================================
//
// S_PauseSound
//
// Stop music and sound effects, during game PAUSE.
//==========================================================================
void S_PauseSound(bool notmusic, bool notsfx)
{
if (!notmusic)
{
S_PauseMusic();
}
if (!notsfx)
{
soundEngine->SetPaused(true);
GSnd->SetSfxPaused(true, 0);
}
}
DEFINE_ACTION_FUNCTION(DObject, S_PauseSound)
{
PARAM_PROLOGUE;
PARAM_BOOL(notmusic);
PARAM_BOOL(notsfx);
S_PauseSound(notmusic, notsfx);
return 0;
}
//==========================================================================
//
// S_ResumeSound
//
// Resume music and sound effects, after game PAUSE.
//==========================================================================
void S_ResumeSound(bool notsfx)
{
S_ResumeMusic();
if (!notsfx)
{
soundEngine->SetPaused(false);
GSnd->SetSfxPaused(false, 0);
}
}
DEFINE_ACTION_FUNCTION(DObject, S_ResumeSound)
{
PARAM_PROLOGUE;
PARAM_BOOL(notsfx);
S_ResumeSound(notsfx);
return 0;
}
//==========================================================================
//
// S_SetSoundPaused
//
// Called with state non-zero when the app is active, zero when it isn't.
//
//==========================================================================
void S_SetSoundPaused(int state)
{
if (!netgame && (i_pauseinbackground))
{
pauseext = !state;
}
if ((state || i_soundinbackground) && !pauseext)
{
if (paused == 0)
{
S_ResumeSound(true);
if (GSnd != nullptr)
{
GSnd->SetInactive(SoundRenderer::INACTIVE_Active);
}
}
}
else
{
if (paused == 0)
{
S_PauseSound(false, true);
if (GSnd != nullptr)
{
GSnd->SetInactive(gamestate == GS_LEVEL || gamestate == GS_TITLELEVEL ?
SoundRenderer::INACTIVE_Complete :
SoundRenderer::INACTIVE_Mute);
}
}
}
}
CCMD(snd_status)
{
GSnd->PrintStatus();
}
CCMD(snd_listdrivers)
{
GSnd->PrintDriversList();
}
ADD_STAT(sound)
{
return GSnd->GatherStats();
}

View file

@ -306,6 +306,7 @@ public:
void MarkUsed(int num);
void CacheMarkedSounds();
TArray<FSoundChan*> AllActiveChannels();
virtual void SetSoundPaused(int state) {}
void MarkAllUnused()
{

View file

@ -49,8 +49,6 @@
#include "d_eventbase.h"
extern int chatmodeon;
const char *KeyNames[NUM_KEYS] =
{
// We use the DirectInput codes and assume a qwerty keyboard layout.
@ -69,7 +67,7 @@ const char *KeyNames[NUM_KEYS] =
"KP2", "KP3", "KP0", "KP.", nullptr, nullptr, "OEM102", "F11", //50
"F12", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, //58
nullptr, nullptr, nullptr, nullptr, "F13", "F14", "F15", "F16", //60
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, //68
"F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24", //68
"Kana", nullptr, nullptr, "Abnt_C1", nullptr, nullptr, nullptr, nullptr, //70
nullptr, "Convert", nullptr, "NoConvert",nullptr, "Yen", "Abnt_C2", nullptr, //78
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, //80

View file

@ -45,7 +45,7 @@
#include "filesystem.h"
#include "d_gui.h"
#include "cmdlib.h"
#include "d_event.h"
#include "d_eventbase.h"
#include "c_consolebuffer.h"
#include "utf8.h"
#include "v_2ddrawer.h"
@ -95,7 +95,6 @@ static FTextureID conflat;
static uint32_t conshade;
static bool conline;
extern int chatmodeon;
extern FBaseCVar *CVars;
extern FConsoleCommand *Commands[FConsoleCommand::HASH_SIZE];

View file

@ -85,5 +85,6 @@ extern double NotifyFontScale;
void C_SetNotifyFontScale(double scale);
extern const char *console_bar;
extern int chatmodeon;
#endif

View file

@ -43,6 +43,7 @@
#include "engineerrors.h"
#include "printf.h"
#include "palutil.h"
#include "i_interface.h"
struct FLatchedValue
@ -1462,7 +1463,7 @@ EXTERN_CVAR(Bool, sv_cheats);
void FBaseCVar::CmdSet (const char *newval)
{
if ((GetFlags() & CVAR_CHEAT) && CheckCheatmode ())
if ((GetFlags() & CVAR_CHEAT) && sysCallbacks.CheckCheatmode && sysCallbacks.CheckCheatmode(true, false))
return;
MarkUnsafe();

View file

@ -59,8 +59,6 @@ extern bool ParsingKeyConf, UnsafeExecutionContext;
extern FString StoredWarp; // [RH] +warp at the command line
extern bool CheckCheatmode (bool printmsg = true, bool sponly = false);
FExecList *C_ParseCmdLineParams(FExecList *exec);
// Add commands to the console as if they were typed in. Can handle wait

View file

@ -94,7 +94,7 @@ void D_ProcessEvents (void)
continue; // menu ate the event
}
if (G_Responder(ev) && ev->type == EV_KeyDown) keywasdown.Set(ev->data1);
if (sysCallbacks.G_Responder(ev) && ev->type == EV_KeyDown) keywasdown.Set(ev->data1);
}
for (auto& ev: delayedevents)

View file

@ -1,5 +1,9 @@
#include "i_interface.h"
#include "st_start.h"
#include "gamestate.h"
#include "startupinfo.h"
#include "c_cvars.h"
#include "gstrings.h"
static_assert(sizeof(void*) == 8, "32 builds are not supported");
@ -10,3 +14,25 @@ FString endoomName;
bool batchrun;
float menuBlurAmount;
bool AppActive = true;
int chatmodeon;
gamestate_t gamestate = GS_STARTUP;
bool ToggleFullscreen;
int paused;
bool pauseext;
FStartupInfo GameStartupInfo;
CVAR(Bool, queryiwad, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR(String, defaultiwad, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR(Bool, vid_fps, false, 0)
EXTERN_CVAR(Bool, ui_generic)
CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
{
GStrings.UpdateLanguage(self);
UpdateGenericUI(ui_generic);
if (sysCallbacks.LanguageChanged) sysCallbacks.LanguageChanged(self);
}

View file

@ -2,14 +2,18 @@
#include "zstring.h"
#include "intrect.h"
#include "name.h"
struct event_t;
class FRenderState;
class FGameTexture;
class FTextureID;
enum EUpscaleFlags : int;
class FConfigFile;
struct SystemCallbacks
{
bool (*G_Responder)(event_t* ev); // this MUST be set, otherwise nothing will work
bool (*WantGuiCapture)();
bool (*WantLeftButton)();
bool (*NetGame)();
@ -35,6 +39,13 @@ struct SystemCallbacks
void (*ToggleFullConsole)();
void (*StartCutscene)(bool blockui);
void (*SetTransition)(int type);
bool (*CheckCheatmode)(bool printmsg, bool sponly);
void (*HudScaleChanged)();
bool (*SetSpecialMenu)(FName& menu, int param);
void (*OnMenuOpen)(bool makesound);
void (*LanguageChanged)(const char*);
bool (*OkForLocalization)(FTextureID, const char*);
FConfigFile* (*GetConfig)();
};
extern SystemCallbacks sysCallbacks;
@ -50,5 +61,7 @@ extern FString endoomName;
extern bool batchrun;
extern float menuBlurAmount;
extern bool generic_ui;
extern int paused;
extern bool pauseext;
void UpdateGenericUI(bool cvar);

View file

@ -35,7 +35,8 @@
#include <math.h>
#include "vectors.h"
#include "m_joy.h"
#include "gameconfigfile.h"
#include "configfile.h"
#include "i_interface.h"
#include "d_eventbase.h"
#include "cmdlib.h"
#include "printf.h"
@ -92,10 +93,11 @@ IJoystickConfig::~IJoystickConfig()
//
//==========================================================================
static bool M_SetJoystickConfigSection(IJoystickConfig *joy, bool create)
static bool M_SetJoystickConfigSection(IJoystickConfig *joy, bool create, FConfigFile* GameConfig)
{
FString id = "Joy:";
id += joy->GetIdentifier();
if (!GameConfig) return false;
return GameConfig->SetSection(id, create);
}
@ -107,13 +109,14 @@ static bool M_SetJoystickConfigSection(IJoystickConfig *joy, bool create)
bool M_LoadJoystickConfig(IJoystickConfig *joy)
{
FConfigFile* GameConfig = sysCallbacks.GetConfig ? sysCallbacks.GetConfig() : nullptr;
char key[32];
const char *value;
int axislen;
int numaxes;
joy->SetDefaultConfig();
if (!M_SetJoystickConfigSection(joy, false))
if (!M_SetJoystickConfigSection(joy, false, GameConfig))
{
return false;
}
@ -166,10 +169,11 @@ bool M_LoadJoystickConfig(IJoystickConfig *joy)
void M_SaveJoystickConfig(IJoystickConfig *joy)
{
FConfigFile* GameConfig = sysCallbacks.GetConfig ? sysCallbacks.GetConfig() : nullptr;
char key[32], value[32];
int axislen, numaxes;
if (GameConfig != NULL && M_SetJoystickConfigSection(joy, true))
if (GameConfig != NULL && M_SetJoystickConfigSection(joy, true, GameConfig))
{
GameConfig->ClearCurrentSection();
if (!joy->IsSensitivityDefault())

View file

@ -1608,17 +1608,17 @@ FileData::~FileData ()
{
}
FString::FString(ELumpNum lumpnum)
FString::FString (ELumpNum lumpnum)
{
auto lumpr = fileSystem.OpenFileReader((int)lumpnum);
auto size = lumpr.GetLength();
AllocBuffer(size + 1);
auto numread = lumpr.Read(&Chars[0], size);
auto lumpr = fileSystem.OpenFileReader ((int)lumpnum);
auto size = lumpr.GetLength ();
AllocBuffer (1 + size);
auto numread = lumpr.Read (&Chars[0], size);
Chars[size] = '\0';
if (numread != size)
{
I_Error("ConstructStringFromLump: Only read %ld of %ld bytes on lump %i (%s)\n",
I_Error ("ConstructStringFromLump: Only read %ld of %ld bytes on lump %i (%s)\n",
numread, size, lumpnum, fileSystem.GetFileFullName((int)lumpnum));
}
}

View file

@ -265,7 +265,6 @@ DEFINE_ACTION_FUNCTION(FFont, BreakLines)
bool generic_ui;
EXTERN_CVAR(String, language)
bool CheckFontComplete(FFont* font)
{

View file

@ -55,11 +55,8 @@
#include "i_time.h"
#include "printf.h"
void M_StartControlPanel(bool makeSound, bool scaleoverride = false);
int DMenu::InMenu;
static ScaleOverrider *CurrentScaleOverrider;
extern int chatmodeon;
//
// Todo: Move these elsewhere
//
@ -114,8 +111,6 @@ extern PClass *DefaultOptionMenuClass;
#define KEY_REPEAT_DELAY (GameTicRate*5/12)
#define KEY_REPEAT_RATE (3)
bool OkForLocalization(FTextureID texnum, const char* substitute);
//============================================================================
//
//
@ -435,8 +430,10 @@ bool DMenu::TranslateKeyboardEvents()
//
//=============================================================================
void M_DoStartControlPanel (bool scaleoverride)
void M_StartControlPanel (bool makesound, bool scaleoverride)
{
if (sysCallbacks.OnMenuOpen) sysCallbacks.OnMenuOpen(makesound);
// intro might call this repeatedly
if (CurrentMenu != nullptr)
return;
@ -505,11 +502,9 @@ DEFINE_ACTION_FUNCTION(DMenu, ActivateMenu)
//
//=============================================================================
bool M_SetSpecialMenu(FName& menu, int param); // game specific checks
void M_SetMenu(FName menu, int param)
{
if (!M_SetSpecialMenu(menu, param)) return;
if (sysCallbacks.SetSpecialMenu && !sysCallbacks.SetSpecialMenu(menu, param)) return;
DMenuDescriptor **desc = MenuDescriptors.CheckKey(menu);
if (desc != nullptr)

View file

@ -303,7 +303,7 @@ void M_ActivateMenu(DMenu *menu);
void M_ClearMenus ();
void M_PreviousMenu ();
void M_ParseMenuDefs();
void M_DoStartControlPanel(bool scaleoverride);
void M_StartControlPanel(bool makeSound, bool scaleoverride = false);
void M_SetMenu(FName menu, int param = -1);
void M_StartMessage(const char *message, int messagemode, FName action = NAME_None);
DMenu *StartPickerMenu(DMenu *parent, const char *name, FColorCVar *cvar);

View file

@ -40,7 +40,6 @@
#include "vm.h"
#include "menustate.h"
void M_StartControlPanel(bool makeSound, bool scaleoverride = false);
FName MessageBoxClass = NAME_MessageBoxMenu;
CVAR(Bool, m_quickexit, false, CVAR_ARCHIVE)

View file

@ -55,7 +55,7 @@ CVAR(Bool, use_mouse, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
extern int paused, chatmodeon;
extern int paused;
extern bool ToggleFullscreen;
bool GUICapture;

View file

@ -121,7 +121,7 @@ void I_ShowFatalError(const char *message)
}
int I_PickIWad(WadStuff* const wads, const int numwads, const bool showwin, const int defaultiwad)
int I_PickIWad(WadStuff* const wads, const int numwads, const bool showwin, const int defaultiwad, int&)
{
if (!showwin)
{

View file

@ -36,12 +36,11 @@
#include "cmdlib.h"
#include "i_system.h"
#include "gameconfigfile.h"
bool I_WriteIniFailed()
bool I_WriteIniFailed(const char * filename)
{
printf("The config file %s could not be saved:\n%s\n", GameConfig->GetPathName(), strerror(errno));
printf("The config file %s could not be saved:\n%s\n", filename, strerror(errno));
return false; // return true to retry
}

View file

@ -56,7 +56,7 @@ static bool NativeMouse = true;
CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
extern int WaitingForKey, chatmodeon;
extern int WaitingForKey;
static const SDL_Keycode DIKToKeySym[256] =
{

View file

@ -301,7 +301,7 @@ void I_PrintStr(const char *cp)
if (StartWindow) RedrawProgressBar(ProgressBarCurPos,ProgressBarMaxPos);
}
int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad, int&)
{
int i;

View file

@ -63,7 +63,6 @@
#include "d_gui.h"
#include "c_console.h"
#include "s_soundinternal.h"
#include "gameconfigfile.h"
#include "hardware.h"
#include "d_eventbase.h"
#include "v_text.h"
@ -125,8 +124,6 @@ static bool EventHandlerResultForNativeMouse;
CVAR (Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
extern int chatmodeon;
static void I_CheckGUICapture ()
{
bool wantCapt = sysCallbacks.WantGuiCapture && sysCallbacks.WantGuiCapture();

View file

@ -80,7 +80,6 @@
#include "i_input.h"
#include "c_dispatch.h"
#include "gameconfigfile.h"
#include "v_font.h"
#include "i_system.h"
#include "bitmap.h"
@ -112,10 +111,6 @@ static HCURSOR CreateBitmapCursor(int xhot, int yhot, HBITMAP and_mask, HBITMAP
EXTERN_CVAR (Bool, queryiwad);
// Used on welcome/IWAD screen.
EXTERN_CVAR (Bool, disableautoload)
EXTERN_CVAR (Bool, autoloadlights)
EXTERN_CVAR (Bool, autoloadbrightmaps)
EXTERN_CVAR (Bool, autoloadwidescreen)
EXTERN_CVAR (Int, vid_preferbackend)
extern HANDLE StdOut;
@ -357,9 +352,12 @@ static void SetQueryIWad(HWND dialog)
// Dialog proc for the IWAD selector.
//
//==========================================================================
static int* pAutoloadflags;
BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int& flags = *pAutoloadflags;;
HWND ctrl;
int i;
@ -403,10 +401,10 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
// [SP] This is our's
SendDlgItemMessage( hDlg, IDC_WELCOME_NOAUTOLOAD, BM_SETCHECK, disableautoload ? BST_CHECKED : BST_UNCHECKED, 0 );
SendDlgItemMessage( hDlg, IDC_WELCOME_LIGHTS, BM_SETCHECK, autoloadlights ? BST_CHECKED : BST_UNCHECKED, 0 );
SendDlgItemMessage( hDlg, IDC_WELCOME_BRIGHTMAPS, BM_SETCHECK, autoloadbrightmaps ? BST_CHECKED : BST_UNCHECKED, 0 );
SendDlgItemMessage( hDlg, IDC_WELCOME_WIDESCREEN, BM_SETCHECK, autoloadwidescreen ? BST_CHECKED : BST_UNCHECKED, 0 );
SendDlgItemMessage( hDlg, IDC_WELCOME_NOAUTOLOAD, BM_SETCHECK, (flags & 1) ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage( hDlg, IDC_WELCOME_LIGHTS, BM_SETCHECK, (flags & 2) ? BST_CHECKED : BST_UNCHECKED, 0 );
SendDlgItemMessage( hDlg, IDC_WELCOME_BRIGHTMAPS, BM_SETCHECK, (flags & 4) ? BST_CHECKED : BST_UNCHECKED, 0 );
SendDlgItemMessage( hDlg, IDC_WELCOME_WIDESCREEN, BM_SETCHECK, (flags & 8) ? BST_CHECKED : BST_UNCHECKED, 0 );
// Set up our version string.
sprintf(szString, "Version %s.", GetVersionString());
@ -461,10 +459,11 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
vid_preferbackend = 0;
// [SP] This is our's.
disableautoload = SendDlgItemMessage( hDlg, IDC_WELCOME_NOAUTOLOAD, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
autoloadlights = SendDlgItemMessage( hDlg, IDC_WELCOME_LIGHTS, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
autoloadbrightmaps = SendDlgItemMessage( hDlg, IDC_WELCOME_BRIGHTMAPS, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
autoloadwidescreen = SendDlgItemMessage( hDlg, IDC_WELCOME_WIDESCREEN, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
flags = 0;
if (SendDlgItemMessage(hDlg, IDC_WELCOME_NOAUTOLOAD, BM_GETCHECK, 0, 0) == BST_CHECKED) flags |= 1;
if (SendDlgItemMessage(hDlg, IDC_WELCOME_LIGHTS, BM_GETCHECK, 0, 0) == BST_CHECKED) flags |= 2;
if (SendDlgItemMessage(hDlg, IDC_WELCOME_BRIGHTMAPS, BM_GETCHECK, 0, 0) == BST_CHECKED) flags |= 4;
if (SendDlgItemMessage(hDlg, IDC_WELCOME_WIDESCREEN, BM_GETCHECK, 0, 0) == BST_CHECKED) flags |= 8;
ctrl = GetDlgItem (hDlg, IDC_IWADLIST);
EndDialog(hDlg, SendMessage (ctrl, LB_GETCURSEL, 0, 0));
}
@ -481,10 +480,10 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
//
//==========================================================================
int I_PickIWad(WadStuff *wads, int numwads, bool showwin, int defaultiwad)
int I_PickIWad(WadStuff *wads, int numwads, bool showwin, int defaultiwad, int& autoloadflags)
{
int vkey;
pAutoloadflags = &autoloadflags;
if (stricmp(queryiwad_key, "shift") == 0)
{
vkey = VK_SHIFT;
@ -764,7 +763,7 @@ void DestroyCustomCursor()
//
//==========================================================================
bool I_WriteIniFailed()
bool I_WriteIniFailed(const char* filename)
{
char *lpMsgBuf;
FString errortext;
@ -779,7 +778,7 @@ bool I_WriteIniFailed()
0,
NULL
);
errortext.Format ("The config file %s could not be written:\n%s", GameConfig->GetPathName(), lpMsgBuf);
errortext.Format ("The config file %s could not be written:\n%s", filename, lpMsgBuf);
LocalFree (lpMsgBuf);
return MessageBoxA(mainwindow.GetHandle(), errortext.GetChars(), GAMENAME " configuration not saved", MB_ICONEXCLAMATION | MB_RETRYCANCEL) == IDRETRY;
}

View file

@ -38,10 +38,10 @@ void I_PrintStr (const char *cp);
void I_SetIWADInfo ();
// Pick from multiple IWADs to use
int I_PickIWad (WadStuff *wads, int numwads, bool queryiwad, int defaultiwad);
int I_PickIWad(WadStuff* wads, int numwads, bool queryiwad, int defaultiwad, int& autoloadflags);
// The ini could not be saved at exit
bool I_WriteIniFailed ();
bool I_WriteIniFailed (const char* filename);
// [RH] Checks the registry for Steam's install path, so we can scan its
// directories for IWADs if the user purchased any through Steam.

View file

@ -44,6 +44,7 @@
#include "gl_framebuffer.h"
#include "gl_shaderprogram.h"
#include "gl_buffers.h"
#include "menu.h"
EXTERN_CVAR(Int, vr_mode)
@ -53,7 +54,32 @@ EXTERN_CVAR(Float, vid_contrast)
EXTERN_CVAR(Int, gl_satformula)
EXTERN_CVAR(Int, gl_dither_bpc)
void UpdateVRModes(bool considerQuadBuffered = true);
#ifdef _WIN32
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
#endif
void UpdateVRModes(bool considerQuadBuffered)
{
FOptionValues** pVRModes = OptionValues.CheckKey("VRMode");
if (pVRModes == nullptr) return;
TArray<FOptionValues::Pair>& vals = (*pVRModes)->mValues;
TArray<FOptionValues::Pair> filteredValues;
int cnt = vals.Size();
for (int i = 0; i < cnt; ++i) {
auto const& mode = vals[i];
if (mode.Value == 7) { // Quad-buffered stereo
#ifdef _WIN32
if (!vr_enable_quadbuffered) continue;
#else
continue; // Remove quad-buffered option on Mac and Linux
#endif
if (!considerQuadBuffered) continue; // Probably no compatible screen mode was found
}
filteredValues.Push(mode);
}
vals = filteredValues;
}
namespace OpenGLRenderer
{

View file

@ -78,6 +78,8 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
}
break;
@ -88,6 +90,8 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
}
break;
@ -98,6 +102,8 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
}
break;
@ -108,6 +114,8 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
}
break;
@ -116,6 +124,8 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].magfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
case CLAMP_NOFILTER:
@ -123,6 +133,8 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (gles.anistropicFilterAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
case CLAMP_NOFILTER_X:
@ -130,6 +142,8 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (gles.anistropicFilterAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
case CLAMP_NOFILTER_Y:
@ -137,6 +151,8 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (gles.anistropicFilterAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
case CLAMP_NOFILTER_XY:
@ -144,6 +160,8 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (gles.anistropicFilterAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
case CLAMP_CAMTEX:
@ -151,6 +169,8 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].magfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
}
glActiveTexture(GL_TEXTURE0);

View file

@ -184,11 +184,13 @@ namespace OpenGLESRenderer
gles.depthStencilAvailable = CheckExtension("GL_OES_packed_depth_stencil");
gles.npotAvailable = CheckExtension("GL_OES_texture_npot");
gles.depthClampAvailable = CheckExtension("GL_EXT_depth_clamp");
gles.anistropicFilterAvailable = CheckExtension("GL_EXT_texture_filter_anisotropic");
#else
gles.depthStencilAvailable = true;
gles.npotAvailable = true;
gles.useMappedBuffers = true;
gles.depthClampAvailable = true;
gles.anistropicFilterAvailable = true;
#endif
gles.numlightvectors = (gles.maxlights * LIGHT_VEC4_NUM);

View file

@ -23,7 +23,8 @@
#include <sys/stat.h>
#include <fcntl.h>
#define USE_GLES2 0
#define USE_GLES2 0 // For Desktop PC leave as 0, it will use the exisiting OpenGL context creationg code but run with the GLES2 renderer
// Set to 1 for when comipling for a real GLES device
#if (USE_GLES2)
#include "glad/glad.h"
@ -43,6 +44,7 @@ GLAPI PFNGLUNMAPBUFFEROESPROC glUnmapBuffer;
#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
#define GL_BGRA 0x80E1
#define GL_DEPTH_CLAMP 0x864F
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#else
#include "gl_load/gl_load.h"
@ -71,6 +73,7 @@ namespace OpenGLESRenderer
bool npotAvailable;
bool forceGLSLv100;
bool depthClampAvailable;
bool anistropicFilterAvailable;
int max_texturesize;
char* vendorstring;
char* modelstring;

View file

@ -842,27 +842,45 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Ptr, Clear, ArrayClear<FDynArray_Ptr>)
//
//-----------------------------------------------------
DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Copy, ArrayCopy<FDynArray_Obj>)
void ObjArrayCopy(FDynArray_Obj *self, FDynArray_Obj *other)
{
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj);
PARAM_POINTER(other, FDynArray_Obj);
for (auto& elem : *other) GC::WriteBarrier(elem);
*self = *other;
return 0;
}
DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Move, ArrayMove<FDynArray_Obj>)
DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Copy, ObjArrayCopy)
{
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj);
PARAM_POINTER(other, FDynArray_Obj);
ObjArrayCopy(self, other);
return 0;
}
void ObjArrayMove(FDynArray_Obj *self, FDynArray_Obj *other)
{
for (auto& elem : *other) GC::WriteBarrier(elem);
*self = std::move(*other);
return 0;
}
DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Append, ArrayAppend<FDynArray_Obj>)
DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Move, ObjArrayMove)
{
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj);
PARAM_POINTER(other, FDynArray_Obj);
ObjArrayMove(self, other);
return 0;
}
void ObjArrayAppend(FDynArray_Obj *self, FDynArray_Obj *other)
{
for (auto& elem : *other) GC::WriteBarrier(elem);
self->Append(*other);
}
DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Append, ObjArrayAppend)
{
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj);
PARAM_POINTER(other, FDynArray_Obj);
ObjArrayAppend(self, other);
return 0;
}

View file

@ -522,11 +522,9 @@ DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckRealHeight, CheckRealHeight)
ACTION_RETURN_INT(CheckRealHeight(texid));
}
bool OkForLocalization(FTextureID texnum, const char* substitute);
static int OkForLocalization_(int index, const FString& substitute)
{
return OkForLocalization(FSetTextureID(index), substitute);
return sysCallbacks.OkForLocalization? sysCallbacks.OkForLocalization(FSetTextureID(index), substitute) : false;
}
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, OkForLocalization, OkForLocalization_)
@ -719,6 +717,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetDefaultKerning, GetDefaultKerning)
ACTION_RETURN_INT(self->GetDefaultKerning());
}
static double GetDisplayTopOffset(FFont* font, int c)
{
auto texc = font->GetChar(c, CR_UNDEFINED, nullptr);
return texc ? texc->GetDisplayTopOffset() : 0;
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetDisplayTopOffset, GetDisplayTopOffset)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
PARAM_INT(code);
ACTION_RETURN_FLOAT(GetDisplayTopOffset(self, code));
}
//==========================================================================
//
// file system

View file

@ -131,7 +131,7 @@ struct VMReturn
*(double *)Location = val;
}
void SetVector(const double val[3])
{
{
assert(RegType == (REGT_FLOAT|REGT_MULTIREG3));
((double *)Location)[0] = val[0];
((double *)Location)[1] = val[1];
@ -513,7 +513,7 @@ bool AssertObject(void * ob);
#define PARAM_BOOL_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); bool x = !!param[p].i;
#define PARAM_NAME_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); FName x = ENamedName(param[p].i);
#define PARAM_SOUND_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); FSoundID x = param[p].i;
#define PARAM_COLOR_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); PalEntry x; x.d = param[p].i;
#define PARAM_COLOR_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); PalEntry x = param[p].i;
#define PARAM_FLOAT_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_FLOAT); double x = param[p].f;
#define PARAM_ANGLE_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_FLOAT); DAngle x = DAngle::fromDeg(param[p].f);
#define PARAM_FANGLE_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_FLOAT); FAngle x = FAngle::fromDeg(param[p].f);

View file

@ -49,7 +49,6 @@
#include "v_draw.h"
#include "g_input.h"
#include "texturemanager.h"
#include "gi.h"
// Text mode color values
enum{

View file

@ -38,6 +38,7 @@
#include <stdint.h>
#include <functional>
#include "bitmap.h"
#include "zstring.h"
class FGameTexture;

View file

@ -46,6 +46,7 @@
#include "utf8.h"
#include "v_text.h"
#include "vm.h"
#include "i_interface.h"
FGameTexture* CrosshairImage;
static int CrosshairNum;
@ -60,8 +61,18 @@ CVAR(Int, crosshairhealth, 2, CVAR_ARCHIVE);
CVARD(Float, crosshairscale, 0.5, CVAR_ARCHIVE, "changes the size of the crosshair");
CVAR(Bool, crosshairgrow, false, CVAR_ARCHIVE);
EXTERN_CVAR(Float, hud_scalefactor)
EXTERN_CVAR(Bool, hud_aspectscale)
CUSTOM_CVARD(Float, hud_scalefactor, 1, CVAR_ARCHIVE, "changes the hud scale")
{
if (self < 0.36f) self = 0.36f;
else if (self > 1) self = 1;
else if (sysCallbacks.HudScaleChanged) sysCallbacks.HudScaleChanged();
}
CUSTOM_CVARD(Bool, hud_aspectscale, true, CVAR_ARCHIVE, "enables aspect ratio correction for the status bar")
{
if (sysCallbacks.HudScaleChanged) sysCallbacks.HudScaleChanged();
}
void ST_LoadCrosshair(int num, bool alwaysload)
{

View file

@ -35,7 +35,6 @@
*/
#include "files.h"
#include "gi.h"
#include "bitmap.h"
#include "textures.h"
#include "imagehelpers.h"

View file

@ -1183,7 +1183,6 @@ void FTextureManager::AddLocalizedVariants()
//
//==========================================================================
FGameTexture *CreateShaderTexture(bool, bool);
void InitBuildTiles();
FImageSource* CreateEmptyTexture();
void FTextureManager::Init()
@ -1213,7 +1212,7 @@ void FTextureManager::Init()
AddGameTexture(mt);
}
void FTextureManager::AddTextures(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&))
void FTextureManager::AddTextures(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&), void (*customtexturehandler)())
{
progressFunc = progressFunc_;
//if (BuildTileFiles.Size() == 0) CountBuildTiles ();
@ -1229,9 +1228,9 @@ void FTextureManager::AddTextures(void (*progressFunc_)(), void (*checkForHacks)
build.ResolveAllPatches();
// Add one marker so that the last WAD is easier to handle and treat
// Build tiles as a completely separate block.
// custom textures as a completely separate block.
FirstTextureForFile.Push(Textures.Size());
InitBuildTiles ();
if (customtexturehandler) customtexturehandler();
FirstTextureForFile.Push(Textures.Size());
DefaultTexture = CheckForTexture ("-NOFLAT-", ETextureType::Override, 0);

View file

@ -124,7 +124,7 @@ public:
void LoadTextureX(int wadnum, FMultipatchTextureBuilder &build);
void AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &build);
void Init();
void AddTextures(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&));
void AddTextures(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&), void (*customtexturehandler)() = nullptr);
void DeleteAll();
void ReplaceTexture (FTextureID picnum, FGameTexture *newtexture, bool free);

View file

@ -1366,12 +1366,6 @@ public:
}
};
// Emulates the old floatbob offset table with direct calls to trig functions.
inline double BobSin(double fb)
{
return g_sindeg(double(fb * (180.0 / 32))) * 8;
}
template<class T>
inline TAngle<T> fabs (const TAngle<T> &deg)
{

View file

@ -42,6 +42,7 @@
#include "utf8.h"
#include "d_protocol.h"
#include "d_net.h"
#include "gamecontrol.h"
static cheatseq_t *cheatlist;
static int numcheats;

View file

@ -72,7 +72,7 @@ void CT_Drawer ();
bool CT_Responder (event_t *ev);
void CT_PasteChat(const char *clip);
int chatmodeon;
extern int chatmodeon;
// Private data

View file

@ -88,19 +88,12 @@ void LoadHexFont(const char* filename);
CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, autoloadwidescreen, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, i_pauseinbackground, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
// Note: For the automap label there is a separate option "am_textfont".
CVARD(Bool, hud_textfont, false, CVAR_ARCHIVE, "Use the regular text font as replacement for the tiny 3x5 font for HUD messages whenever possible")
EXTERN_CVAR(Bool, ui_generic)
CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
{
GStrings.UpdateLanguage(self);
UpdateGenericUI(ui_generic);
}
EXTERN_CVAR(String, language)
CUSTOM_CVAR(Int, mouse_capturemode, 1, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
{
@ -136,7 +129,6 @@ extern bool pauseext;
cycle_t thinktime, actortime, gameupdatetime, drawtime;
gamestate_t gamestate = GS_STARTUP;
gameaction_t gameaction = ga_nothing;
// gameaction state
MapRecord* g_nextmap;
@ -146,8 +138,6 @@ int g_bossexit;
FILE* hashfile;
FStartupInfo GameStartupInfo;
InputState inputState;
int ShowStartupWindow(TArray<GrpEntry> &);
TArray<FString> GetGameFronUserFiles();
@ -166,22 +156,22 @@ void MarkMap();
void BuildFogTable();
void ParseGLDefs();
void I_UpdateDiscordPresence(bool SendPresence, const char* curstatus, const char* appid, const char* steamappid);
bool G_Responder(event_t* ev);
void HudScaleChanged();
bool M_SetSpecialMenu(FName& menu, int param);
void OnMenuOpen(bool makeSound);
DStatusBarCore* StatusBar;
bool AppActive = true;
FString currentGame;
FString LumpFilter;
CVAR(Bool, queryiwad, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR(String, defaultiwad, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
EXTERN_CVAR(Bool, queryiwad);
EXTERN_CVAR(String, defaultiwad);
CVAR(Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
extern int hud_size_max;
int paused;
bool pausedWithKey;
bool gamesetinput = false;
@ -553,6 +543,8 @@ static void System_SetTransition(int type)
nextwipe = type;
}
void I_StartupJoysticks();
void I_ShutdownInput();
int RunGame();
@ -566,6 +558,7 @@ int GameMain()
SetConsoleNotifyBuffer();
sysCallbacks =
{
G_Responder,
System_WantGuiCapture,
System_WantLeftButton,
System_NetGame,
@ -591,6 +584,13 @@ int GameMain()
System_ToggleFullConsole,
System_StartCutscene,
System_SetTransition,
CheckCheatmode,
HudScaleChanged,
M_SetSpecialMenu,
OnMenuOpen,
nullptr,
nullptr,
[]() ->FConfigFile* { return GameConfig; }
};
try
@ -773,9 +773,20 @@ static TArray<GrpEntry> SetupGame()
stuff.Path = ExtractFileBase(found.FileName);
wads.Push(stuff);
}
pick = I_PickIWad(&wads[0], (int)wads.Size(), queryiwad, pick);
int flags = 0;
if (disableautoload) flags |= 1;
if (autoloadlights) flags |= 2;
if (autoloadbrightmaps) flags |= 4;
if (autoloadwidescreen) flags |= 8;
pick = I_PickIWad(&wads[0], (int)wads.Size(), queryiwad, pick, flags);
if (pick >= 0)
{
disableautoload = !!(flags & 1);
autoloadlights = !!(flags & 2);
autoloadbrightmaps = !!(flags & 4);
autoloadwidescreen = !!(flags & 8);
// The newly selected IWAD becomes the new default
defaultiwad = groups[pick].FileName;
}
@ -1242,92 +1253,6 @@ CCMD(snd_reset)
Mus_ResumeSaved();
}
//==========================================================================
//
// S_PauseSound
//
// Stop music and sound effects, during game PAUSE.
//
//==========================================================================
void S_PauseSound (bool notmusic, bool notsfx)
{
if (!notmusic)
{
S_PauseMusic();
}
if (!notsfx)
{
soundEngine->SetPaused(true);
GSnd->SetSfxPaused (true, 0);
S_PauseAllCustomStreams(true);
}
}
//==========================================================================
//
// S_ResumeSound
//
// Resume music and sound effects, after game PAUSE.
//
//==========================================================================
void S_ResumeSound (bool notsfx)
{
S_ResumeMusic();
if (!notsfx)
{
soundEngine->SetPaused(false);
GSnd->SetSfxPaused (false, 0);
S_PauseAllCustomStreams(false);
}
}
//==========================================================================
//
// S_SetSoundPaused
//
// Called with state non-zero when the app is active, zero when it isn't.
//
//==========================================================================
void S_SetSoundPaused(int state)
{
if (!netgame && (i_pauseinbackground)
#if 0 //ifdef _DEBUG
&& !demoplayback
#endif
)
{
pauseext = !state;
}
if ((state || i_soundinbackground) && !pauseext)
{
if (paused == 0)
{
S_ResumeSound(true);
if (GSnd != nullptr)
{
GSnd->SetInactive(SoundRenderer::INACTIVE_Active);
}
}
}
else
{
if (paused == 0)
{
S_PauseSound(false, true);
if (GSnd != nullptr)
{
GSnd->SetInactive(gamestate == GS_LEVEL || gamestate == GS_TITLELEVEL ?
SoundRenderer::INACTIVE_Complete :
SoundRenderer::INACTIVE_Mute);
}
}
}
}
FString G_GetDemoPath()
{

View file

@ -45,6 +45,7 @@ void updatePauseStatus();
void DeferredStartGame(MapRecord* map, int skill, bool nostopsound = false);
void ChangeLevel(MapRecord* map, int skill, bool bossexit = false);
void CompleteLevel(MapRecord* map);
bool CheckCheatmode(bool printmsg = true, bool sponly = false);
void TITLE_InformName(const char* newname);

View file

@ -132,19 +132,11 @@ CUSTOM_CVARD(Int, hud_size, Hud_Stbar, CVAR_ARCHIVE, "Defines the HUD size and s
else setViewport(self);
}
CUSTOM_CVARD(Float, hud_scalefactor, 1, CVAR_ARCHIVE, "changes the hud scale")
{
if (self < 0.36f) self = 0.36f;
else if (self > 1) self = 1;
else setViewport(hud_size);
}
CUSTOM_CVAR(Bool, hud_aspectscale, true, CVAR_ARCHIVE)
void HudScaleChanged()
{
setViewport(hud_size);
}
// Note: The shift detection here should be part of the key event data, but that requires a lot more work. Ideally use a ShiftBinds mapping. For control through bound keys this should be fine, bunt not for use from the console.
CCMD(sizeup)
{

View file

@ -87,7 +87,7 @@ void hud_drawsprite(double sx, double sy, double sz, double a, int picnum, int d
// Draws the fps counter, dot ticker, and palette debug.
//
//==========================================================================
CVAR(Bool, vid_fps, false, 0)
EXTERN_CVAR(Bool, vid_fps)
static FString statFPS()

View file

@ -163,7 +163,7 @@ void InputState::ClearAllInput()
//==========================================================================
void I_StartTic();
bool ToggleFullscreen;
extern bool ToggleFullscreen;
int32_t handleevents(void)
{

View file

@ -88,6 +88,7 @@
#include "v_draw.h"
#include "gamehud.h"
#include "wipe.h"
#include "i_interface.h"
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, r_ticstability, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
@ -99,7 +100,6 @@ ticcmd_t playercmds[MAXPLAYERS];
static uint64_t stabilityticduration = 0;
static uint64_t stabilitystarttime = 0;
bool pauseext;
bool r_NoInterpolate;
int entertic;
int oldentertics;

View file

@ -191,7 +191,7 @@ bool M_SetSpecialMenu(FName& menu, int param)
//
//=============================================================================
void M_StartControlPanel(bool makeSound, bool)
void OnMenuOpen(bool makeSound)
{
// intro might call this repeatedly
if (CurrentMenu != NULL)
@ -200,7 +200,6 @@ void M_StartControlPanel(bool makeSound, bool)
GSnd->SetSfxPaused(true, PAUSESFX_MENU);
gi->MenuOpened();
if (makeSound && menu_sounds) gi->MenuSound(ActivateSound);
M_DoStartControlPanel(false);
}
@ -755,29 +754,3 @@ DEFINE_ACTION_FUNCTION(_PlayerMenu, DrawPlayerSprite)
return 0;
}
#ifdef _WIN32
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
#endif
void UpdateVRModes(bool considerQuadBuffered)
{
FOptionValues** pVRModes = OptionValues.CheckKey("VRMode");
if (pVRModes == nullptr) return;
TArray<FOptionValues::Pair>& vals = (*pVRModes)->mValues;
TArray<FOptionValues::Pair> filteredValues;
int cnt = vals.Size();
for (int i = 0; i < cnt; ++i) {
auto const& mode = vals[i];
if (mode.Value == 7) { // Quad-buffered stereo
#ifdef _WIN32
if (!vr_enable_quadbuffered) continue;
#else
continue; // Remove quad-buffered option on Mac and Linux
#endif
if (!considerQuadBuffered) continue; // Probably no compatible screen mode was found
}
filteredValues.Push(mode);
}
vals = filteredValues;
}

View file

@ -6,9 +6,6 @@
extern bool help_disabled;
void M_StartControlPanel (bool makeSound, bool scaleoverride = false);
extern FNewGameStartup NewGameStartupInfo;
void M_StartupEpisodeMenu(FNewGameStartup *gs);
void M_StartupSkillMenu(FNewGameStartup *gs);