mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- fixed a warning and set NOINITCALL for a few CVARs accessing the current level.
These inits are done at a time when the data isn't even initialized so they will get overwritten anyway.
This commit is contained in:
parent
d5f138f14d
commit
6129f9a9cc
10 changed files with 53 additions and 39 deletions
|
@ -388,7 +388,7 @@ void D_Render(std::function<void()> action, bool interpolate)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
CUSTOM_CVAR (Int, dmflags, 0, CVAR_SERVERINFO)
|
||||
CUSTOM_CVAR (Int, dmflags, 0, CVAR_SERVERINFO | CVAR_NOINITCALL)
|
||||
{
|
||||
// In case DF_NO_FREELOOK was changed, reinitialize the sky
|
||||
// map. (If no freelook, then no need to stretch the sky.)
|
||||
|
@ -463,7 +463,7 @@ CVAR (Mask, sv_freelook, dmflags, DF_NO_FREELOOK|DF_YES_FREELOOK);
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
CUSTOM_CVAR (Int, dmflags2, 0, CVAR_SERVERINFO)
|
||||
CUSTOM_CVAR (Int, dmflags2, 0, CVAR_SERVERINFO | CVAR_NOINITCALL)
|
||||
{
|
||||
// Stop the automap if we aren't allowed to use it.
|
||||
if ((self & DF2_NO_AUTOMAP) && automapactive)
|
||||
|
@ -546,7 +546,7 @@ static int GetCompatibility2(FLevelLocals *Level, int mask)
|
|||
: (mask & ~Level->info->compatmask2) | (Level->info->compatflags2 & Level->info->compatmask2);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Int, compatflags, 0, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
||||
CUSTOM_CVAR (Int, compatflags, 0, CVAR_ARCHIVE|CVAR_SERVERINFO | CVAR_NOINITCALL)
|
||||
{
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
|
@ -559,7 +559,7 @@ CUSTOM_CVAR (Int, compatflags, 0, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Int, compatflags2, 0, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
||||
CUSTOM_CVAR (Int, compatflags2, 0, CVAR_ARCHIVE|CVAR_SERVERINFO | CVAR_NOINITCALL)
|
||||
{
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
|
|
|
@ -40,33 +40,6 @@ FStringTable GStrings;
|
|||
// Game speed
|
||||
EGameSpeed GameSpeed = SPEED_Normal;
|
||||
|
||||
// Show developer messages if true.
|
||||
CVAR (Int, developer, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
||||
// [RH] Feature control cvars
|
||||
CVAR (Bool, var_friction, true, CVAR_SERVERINFO);
|
||||
|
||||
CVAR (Bool, alwaysapplydmflags, false, CVAR_SERVERINFO);
|
||||
|
||||
CUSTOM_CVAR (Float, teamdamage, 0.f, CVAR_SERVERINFO)
|
||||
{
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
Level->teamdamage = self;
|
||||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (String, language, "auto", CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
{
|
||||
SetLanguageIDs ();
|
||||
GStrings.UpdateLanguage();
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
// does this even make sense on secondary levels...?
|
||||
if (Level->info != nullptr) Level->LevelName = Level->info->LookupLevelName();
|
||||
}
|
||||
}
|
||||
|
||||
// [RH] Network arbitrator
|
||||
int Net_Arbitrator = 0;
|
||||
|
||||
|
|
|
@ -36,11 +36,22 @@
|
|||
#include "c_cvars.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "g_game.h"
|
||||
#include "gstrings.h"
|
||||
#include "i_system.h"
|
||||
|
||||
CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE)
|
||||
CVAR(Bool, var_pushers, true, CVAR_SERVERINFO);
|
||||
CVAR(Bool, gl_cachenodes, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(Float, gl_cachetime, 0.6f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, alwaysapplydmflags, false, CVAR_SERVERINFO);
|
||||
|
||||
// Show developer messages if true.
|
||||
CVAR(Int, developer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
// [RH] Feature control cvars
|
||||
CVAR(Bool, var_friction, true, CVAR_SERVERINFO);
|
||||
|
||||
|
||||
|
||||
|
||||
CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
|
@ -52,7 +63,7 @@ CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOIN
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Int, sv_corpsequeuesize, 64, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
||||
CUSTOM_CVAR(Int, sv_corpsequeuesize, 64, CVAR_ARCHIVE|CVAR_SERVERINFO|CVAR_NOINITCALL)
|
||||
{
|
||||
if (self > 0)
|
||||
{
|
||||
|
@ -69,7 +80,7 @@ CUSTOM_CVAR(Int, sv_corpsequeuesize, 64, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Int, cl_maxdecals, 1024, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR (Int, cl_maxdecals, 1024, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
{
|
||||
if (self < 0)
|
||||
{
|
||||
|
@ -91,7 +102,7 @@ CUSTOM_CVAR (Int, cl_maxdecals, 1024, CVAR_ARCHIVE)
|
|||
|
||||
// [BC] Allow the maximum number of particles to be specified by a cvar (so people
|
||||
// with lots of nice hardware can have lots of particles!).
|
||||
CUSTOM_CVAR(Int, r_maxparticles, 4000, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR(Int, r_maxparticles, 4000, CVAR_ARCHIVE | CVAR_NOINITCALL)
|
||||
{
|
||||
if (self == 0)
|
||||
self = 4000;
|
||||
|
@ -109,3 +120,22 @@ CUSTOM_CVAR(Int, r_maxparticles, 4000, CVAR_ARCHIVE)
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Float, teamdamage, 0.f, CVAR_SERVERINFO | CVAR_NOINITCALL)
|
||||
{
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
Level->teamdamage = self;
|
||||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL)
|
||||
{
|
||||
SetLanguageIDs();
|
||||
GStrings.UpdateLanguage();
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
// does this even make sense on secondary levels...?
|
||||
if (Level->info != nullptr) Level->LevelName = Level->info->LookupLevelName();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1551,6 +1551,7 @@ void FLevelLocals::Init()
|
|||
|
||||
gravity = sv_gravity * 35/TICRATE;
|
||||
aircontrol = sv_aircontrol;
|
||||
AirControlChanged();
|
||||
teamdamage = ::teamdamage;
|
||||
flags = 0;
|
||||
flags2 = 0;
|
||||
|
|
|
@ -109,6 +109,16 @@ struct FLevelLocals
|
|||
FLevelLocals();
|
||||
~FLevelLocals();
|
||||
|
||||
void *operator new(size_t blocksize)
|
||||
{
|
||||
// Null the allocated memory before running the constructor.
|
||||
// If we later allocate secondary levels they need to behave exactly like a global variable, i.e. start nulled.
|
||||
auto block = ::operator new(blocksize);
|
||||
memset(block, 0, blocksize);
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
friend class MapLoader;
|
||||
|
||||
void Tick();
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
FTextureManager TexMan;
|
||||
|
||||
CUSTOM_CVAR(Bool, vid_nopalsubstitutions, false, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR(Bool, vid_nopalsubstitutions, false, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
{
|
||||
// This is in case the sky texture has been substituted.
|
||||
R_InitSkyMap ();
|
||||
|
|
|
@ -256,7 +256,7 @@ void DIntermissionScreenText::Init(FIntermissionAction *desc, bool first)
|
|||
if (mTextX < 0) mTextX =gameinfo.TextScreenX;
|
||||
mTextY = static_cast<FIntermissionActionTextscreen*>(desc)->mTextY;
|
||||
if (mTextY < 0) mTextY =gameinfo.TextScreenY;
|
||||
mTextLen = mText.CharacterCount();
|
||||
mTextLen = (int)mText.CharacterCount();
|
||||
mTextDelay = static_cast<FIntermissionActionTextscreen*>(desc)->mTextDelay;
|
||||
mTextColor = static_cast<FIntermissionActionTextscreen*>(desc)->mTextColor;
|
||||
// For text screens, the duration only counts when the text is complete.
|
||||
|
|
|
@ -143,7 +143,7 @@ static FRandom pr_uniquetid("UniqueTID");
|
|||
|
||||
FRandom pr_spawnmobj ("SpawnActor");
|
||||
|
||||
CUSTOM_CVAR (Float, sv_gravity, 800.f, CVAR_SERVERINFO|CVAR_NOSAVE)
|
||||
CUSTOM_CVAR (Float, sv_gravity, 800.f, CVAR_SERVERINFO|CVAR_NOSAVE|CVAR_NOINITCALL)
|
||||
{
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
|
|
|
@ -973,7 +973,7 @@ void P_CheckPlayerSprite(AActor *actor, int &spritenum, DVector2 &scale)
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Float, sv_aircontrol, 0.00390625f, CVAR_SERVERINFO|CVAR_NOSAVE)
|
||||
CUSTOM_CVAR (Float, sv_aircontrol, 0.00390625f, CVAR_SERVERINFO|CVAR_NOSAVE|CVAR_NOINITCALL)
|
||||
{
|
||||
primaryLevel->aircontrol = self;
|
||||
primaryLevel->AirControlChanged ();
|
||||
|
|
|
@ -46,7 +46,7 @@ FTextureID skyflatnum;
|
|||
|
||||
// [RH] Stretch sky texture if not taller than 128 pixels?
|
||||
// Also now controls capped skies. 0 = normal, 1 = stretched, 2 = capped
|
||||
CUSTOM_CVAR (Int, r_skymode, 2, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR (Int, r_skymode, 2, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
{
|
||||
R_InitSkyMap ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue