From 3ea5be1ea7674e7945355cf4fb3caa95ca7bea8e Mon Sep 17 00:00:00 2001 From: Boondorl Date: Wed, 6 Nov 2024 22:41:26 -0500 Subject: [PATCH] Reworked FRandom constructors Removes ambiguity while keeping old constructor syntax in check for better overall portability. --- src/bbannouncer.cpp | 2 +- src/common/audio/sound/s_sound.cpp | 2 +- src/common/engine/m_random.cpp | 8 ++--- src/common/engine/m_random.h | 19 ++++++++--- src/d_netinfo.cpp | 2 +- src/g_game.cpp | 4 +-- src/g_level.cpp | 2 +- src/g_statusbar/sbarinfo_commands.cpp | 4 +-- src/gamedata/decallib.cpp | 4 +-- src/gamedata/info.cpp | 2 +- src/gamedata/textures/animations.cpp | 2 +- src/p_conversation.cpp | 2 +- src/playsim/a_dynlight.cpp | 2 +- src/playsim/a_specialspot.cpp | 2 +- src/playsim/bots/b_func.cpp | 2 +- src/playsim/bots/b_game.cpp | 2 +- src/playsim/bots/b_move.cpp | 6 ++-- src/playsim/bots/b_think.cpp | 2 +- src/playsim/fragglescript/t_func.cpp | 2 +- src/playsim/mapthinkers/a_lightning.cpp | 2 +- src/playsim/mapthinkers/a_lights.cpp | 8 ++--- src/playsim/mapthinkers/a_plats.cpp | 2 +- src/playsim/mapthinkers/a_quake.cpp | 2 +- src/playsim/p_acs.cpp | 2 +- src/playsim/p_actionfunctions.cpp | 28 ++++++++--------- src/playsim/p_effect.cpp | 2 +- src/playsim/p_enemy.cpp | 38 +++++++++++----------- src/playsim/p_interaction.cpp | 12 +++---- src/playsim/p_lnspec.cpp | 2 +- src/playsim/p_map.cpp | 8 ++--- src/playsim/p_mobj.cpp | 42 ++++++++++++------------- src/playsim/p_sight.cpp | 4 +-- src/playsim/p_spec.cpp | 2 +- src/playsim/p_switch.cpp | 2 +- src/playsim/p_teleport.cpp | 4 +-- src/playsim/p_things.cpp | 2 +- src/playsim/p_user.cpp | 2 +- src/playsim/shadowinlines.h | 2 +- src/rendering/r_utility.cpp | 4 +-- src/scripting/decorate/thingdef_exp.cpp | 2 +- src/sound/s_doomsound.cpp | 2 +- src/sound/s_sndseq.cpp | 2 +- 42 files changed, 129 insertions(+), 118 deletions(-) diff --git a/src/bbannouncer.cpp b/src/bbannouncer.cpp index caf9f9f42a..f52b5344b2 100644 --- a/src/bbannouncer.cpp +++ b/src/bbannouncer.cpp @@ -169,7 +169,7 @@ static const char *TelefragSounds[] = #endif static int LastAnnounceTime; -static FRandom pr_bbannounce ("BBAnnounce", true); +static FCRandom pr_bbannounce ("BBAnnounce"); // CODE -------------------------------------------------------------------- diff --git a/src/common/audio/sound/s_sound.cpp b/src/common/audio/sound/s_sound.cpp index b9084692d5..d8ae7fe001 100644 --- a/src/common/audio/sound/s_sound.cpp +++ b/src/common/audio/sound/s_sound.cpp @@ -61,7 +61,7 @@ enum { DEFAULT_PITCH = 128, }; -static FRandom pr_soundpitch ("SoundPitch", true); +static FCRandom pr_soundpitch ("SoundPitch"); SoundEngine* soundEngine; //========================================================================== diff --git a/src/common/engine/m_random.cpp b/src/common/engine/m_random.cpp index ee29a80554..11c4350b76 100644 --- a/src/common/engine/m_random.cpp +++ b/src/common/engine/m_random.cpp @@ -79,11 +79,11 @@ // EXTERNAL DATA DECLARATIONS ---------------------------------------------- -FRandom pr_exrandom("EX_Random", false); +FRandom pr_exrandom("EX_Random"); // PUBLIC DATA DEFINITIONS ------------------------------------------------- -FRandom M_Random(true); +FCRandom M_Random; // Global seed. This is modified predictably to initialize every RNG. uint32_t rngseed; @@ -145,7 +145,7 @@ FRandom::FRandom (bool client) #ifndef NDEBUG Name = NULL; #endif - if (client) + if (bClient) { Next = CRNGList; CRNGList = this; @@ -178,7 +178,7 @@ FRandom::FRandom (const char *name, bool client) : bClient(client) #endif // Insert the RNG in the list, sorted by CRC - FRandom **prev = (client ? &CRNGList : &RNGList), * probe = (client ? CRNGList : RNGList); + FRandom **prev = (bClient ? &CRNGList : &RNGList), * probe = (bClient ? CRNGList : RNGList); while (probe != NULL && probe->NameCRC < NameCRC) { diff --git a/src/common/engine/m_random.h b/src/common/engine/m_random.h index 991d812dbf..ba0bcaf626 100644 --- a/src/common/engine/m_random.h +++ b/src/common/engine/m_random.h @@ -44,9 +44,9 @@ class FSerializer; class FRandom : public SFMTObj { public: - FRandom (bool client); - FRandom (const char *name, bool client); - ~FRandom (); + FRandom() : FRandom(false) {} + FRandom(const char* name) : FRandom(name, false) {} + ~FRandom(); int Seed() const { @@ -178,6 +178,10 @@ public: static void StaticPrintSeeds (); #endif +protected: + FRandom(bool client); + FRandom(const char* name, bool client); + private: #ifndef NDEBUG const char *Name; @@ -189,6 +193,13 @@ private: static FRandom *RNGList, *CRNGList; }; +class FCRandom : public FRandom +{ +public: + FCRandom() : FRandom(true) {} + FCRandom(const char* name) : FRandom(name, true) {} +}; + extern uint32_t rngseed; // The starting seed (not part of state) extern uint32_t staticrngseed; // Static rngseed that can be set by the user @@ -196,6 +207,6 @@ extern bool use_staticrng; // M_Random can be used for numbers that do not affect gameplay -extern FRandom M_Random; +extern FCRandom M_Random; #endif diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 369abcca30..bac6eddfe8 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -52,7 +52,7 @@ #include "gstrings.h" #include "g_game.h" -static FRandom pr_pickteam ("PickRandomTeam", false); +static FRandom pr_pickteam ("PickRandomTeam"); CVAR (Float, autoaim, 35.f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (String, name, "Player", CVAR_USERINFO | CVAR_ARCHIVE); diff --git a/src/g_game.cpp b/src/g_game.cpp index 774c7b5b24..42ce6e99a9 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -93,8 +93,8 @@ #include "fs_findfile.h" -static FRandom pr_dmspawn ("DMSpawn", false); -static FRandom pr_pspawn ("PlayerSpawn", false); +static FRandom pr_dmspawn ("DMSpawn"); +static FRandom pr_pspawn ("PlayerSpawn"); extern int startpos, laststartpos; diff --git a/src/g_level.cpp b/src/g_level.cpp index 0cf5ddb21a..bc0cd378af 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -175,7 +175,7 @@ ELightMode getRealLightmode(FLevelLocals* Level, bool for3d) CVAR(Int, sv_alwaystally, 0, CVAR_SERVERINFO) -static FRandom pr_classchoice ("RandomPlayerClassChoice", false); +static FRandom pr_classchoice ("RandomPlayerClassChoice"); extern level_info_t TheDefaultLevelInfo; extern bool timingdemo; diff --git a/src/g_statusbar/sbarinfo_commands.cpp b/src/g_statusbar/sbarinfo_commands.cpp index 85944b6478..a28d43e191 100644 --- a/src/g_statusbar/sbarinfo_commands.cpp +++ b/src/g_statusbar/sbarinfo_commands.cpp @@ -3225,9 +3225,9 @@ class CommandDrawGem : public SBarInfoCommand int goalValue; private: int chainWiggle; - static FRandom pr_chainwiggle; + static FCRandom pr_chainwiggle; }; -FRandom CommandDrawGem::pr_chainwiggle(true); //use the same method of chain wiggling as heretic. +FCRandom CommandDrawGem::pr_chainwiggle; //use the same method of chain wiggling as heretic. //////////////////////////////////////////////////////////////////////////////// diff --git a/src/gamedata/decallib.cpp b/src/gamedata/decallib.cpp index 2babc3b458..0f6e656b5f 100644 --- a/src/gamedata/decallib.cpp +++ b/src/gamedata/decallib.cpp @@ -60,8 +60,8 @@ static TArray DecalTranslations; // Sometimes two machines in a game will disagree on the state of // decals. I do not know why. -static FRandom pr_decalchoice ("DecalChoice", true); -static FRandom pr_decal ("Decal", true); +static FCRandom pr_decalchoice ("DecalChoice"); +static FCRandom pr_decal ("Decal"); class FDecalGroup : public FDecalBase { diff --git a/src/gamedata/info.cpp b/src/gamedata/info.cpp index 6cff5943ec..67fb87f678 100644 --- a/src/gamedata/info.cpp +++ b/src/gamedata/info.cpp @@ -61,7 +61,7 @@ extern void InitBotStuff(); extern void ClearStrifeTypes(); TArray PClassActor::AllActorClasses; -FRandom FState::pr_statetics("StateTics", false); +FRandom FState::pr_statetics("StateTics"); cycle_t ActionCycles; diff --git a/src/gamedata/textures/animations.cpp b/src/gamedata/textures/animations.cpp index 5cd072b149..619375c46c 100644 --- a/src/gamedata/textures/animations.cpp +++ b/src/gamedata/textures/animations.cpp @@ -56,7 +56,7 @@ FTextureAnimator TexAnim; // PRIVATE DATA DEFINITIONS ------------------------------------------------ -static FRandom pr_animatepictures ("AnimatePics", true); +static FCRandom pr_animatepictures ("AnimatePics"); // CODE -------------------------------------------------------------------- diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index f897db7598..356192ae65 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -62,7 +62,7 @@ #include "doommenu.h" #include "g_game.h" -static FRandom pr_randomspeech("RandomSpeech", true); +static FCRandom pr_randomspeech("RandomSpeech"); static int ConversationMenuY; diff --git a/src/playsim/a_dynlight.cpp b/src/playsim/a_dynlight.cpp index 1470b07961..79d8fe768b 100644 --- a/src/playsim/a_dynlight.cpp +++ b/src/playsim/a_dynlight.cpp @@ -67,7 +67,7 @@ static FMemArena DynLightArena(sizeof(FDynamicLight) * 200); static TArray FreeList; -static FRandom randLight(true); +static FCRandom randLight; extern TArray StateLights; diff --git a/src/playsim/a_specialspot.cpp b/src/playsim/a_specialspot.cpp index b332b78004..b658c18300 100644 --- a/src/playsim/a_specialspot.cpp +++ b/src/playsim/a_specialspot.cpp @@ -39,7 +39,7 @@ #include "a_pickups.h" #include "vm.h" -static FRandom pr_spot ("SpecialSpot", false); +static FRandom pr_spot ("SpecialSpot"); IMPLEMENT_CLASS(DSpotState, false, false) diff --git a/src/playsim/bots/b_func.cpp b/src/playsim/bots/b_func.cpp index fa9f2c80d7..e537bf9f7e 100644 --- a/src/playsim/bots/b_func.cpp +++ b/src/playsim/bots/b_func.cpp @@ -54,7 +54,7 @@ #include "p_checkposition.h" #include "actorinlines.h" -static FRandom pr_botdofire ("BotDoFire", false); +static FRandom pr_botdofire ("BotDoFire"); //Checks TRUE reachability from bot to a looker. diff --git a/src/playsim/bots/b_game.cpp b/src/playsim/bots/b_game.cpp index eb8eb5d1ab..3863ac923b 100644 --- a/src/playsim/bots/b_game.cpp +++ b/src/playsim/bots/b_game.cpp @@ -98,7 +98,7 @@ Everything that is changed is marked (maybe commented) with "Added by MC" #include "i_system.h" // for SHARE_DIR #endif // !_WIN32 && !__APPLE__ -static FRandom pr_botspawn ("BotSpawn", false); +static FRandom pr_botspawn ("BotSpawn"); cycle_t BotThinkCycles, BotSupportCycles; int BotWTG; diff --git a/src/playsim/bots/b_move.cpp b/src/playsim/bots/b_move.cpp index 0922618322..4d91839d8e 100644 --- a/src/playsim/bots/b_move.cpp +++ b/src/playsim/bots/b_move.cpp @@ -53,9 +53,9 @@ #include "p_checkposition.h" #include "actorinlines.h" -static FRandom pr_botopendoor ("BotOpenDoor", false); -static FRandom pr_bottrywalk ("BotTryWalk", false); -static FRandom pr_botnewchasedir ("BotNewChaseDir", false); +static FRandom pr_botopendoor ("BotOpenDoor"); +static FRandom pr_bottrywalk ("BotTryWalk"); +static FRandom pr_botnewchasedir ("BotNewChaseDir"); // borrow some tables from p_enemy.cpp extern dirtype_t opposite[9]; diff --git a/src/playsim/bots/b_think.cpp b/src/playsim/bots/b_think.cpp index deef49aa12..9fba192d58 100644 --- a/src/playsim/bots/b_think.cpp +++ b/src/playsim/bots/b_think.cpp @@ -52,7 +52,7 @@ #include "d_player.h" #include "actorinlines.h" -static FRandom pr_botmove ("BotMove", false); +static FRandom pr_botmove ("BotMove"); //This function is called each tic for each bot, //so this is what the bot does. diff --git a/src/playsim/fragglescript/t_func.cpp b/src/playsim/fragglescript/t_func.cpp index 3a463c3a20..f9fff1b9ef 100644 --- a/src/playsim/fragglescript/t_func.cpp +++ b/src/playsim/fragglescript/t_func.cpp @@ -56,7 +56,7 @@ using namespace FileSys; -static FRandom pr_script("FScript", false); +static FRandom pr_script("FScript"); // functions. FParser::SF_ means Script Function not, well.. heh, me diff --git a/src/playsim/mapthinkers/a_lightning.cpp b/src/playsim/mapthinkers/a_lightning.cpp index 47f6623b11..f6e0f713dd 100644 --- a/src/playsim/mapthinkers/a_lightning.cpp +++ b/src/playsim/mapthinkers/a_lightning.cpp @@ -38,7 +38,7 @@ #include "gi.h" #include -static FRandom pr_lightning ("Lightning", false); +static FRandom pr_lightning ("Lightning"); IMPLEMENT_CLASS(DLightningThinker, false, false) diff --git a/src/playsim/mapthinkers/a_lights.cpp b/src/playsim/mapthinkers/a_lights.cpp index 48acdcd762..06b0403044 100644 --- a/src/playsim/mapthinkers/a_lights.cpp +++ b/src/playsim/mapthinkers/a_lights.cpp @@ -43,10 +43,10 @@ // State. #include "serializer.h" -static FRandom pr_flicker ("Flicker", true); -static FRandom pr_lightflash ("LightFlash", true); -static FRandom pr_strobeflash ("StrobeFlash", true); -static FRandom pr_fireflicker ("FireFlicker", true); +static FCRandom pr_flicker ("Flicker"); +static FCRandom pr_lightflash ("LightFlash"); +static FCRandom pr_strobeflash ("StrobeFlash"); +static FCRandom pr_fireflicker ("FireFlicker"); //----------------------------------------------------------------------------- diff --git a/src/playsim/mapthinkers/a_plats.cpp b/src/playsim/mapthinkers/a_plats.cpp index 0f6fa9ce96..c688295e4e 100644 --- a/src/playsim/mapthinkers/a_plats.cpp +++ b/src/playsim/mapthinkers/a_plats.cpp @@ -37,7 +37,7 @@ #include "p_spec.h" #include "g_levellocals.h" -static FRandom pr_doplat ("DoPlat", false); +static FRandom pr_doplat ("DoPlat"); IMPLEMENT_CLASS(DPlat, false, false) diff --git a/src/playsim/mapthinkers/a_quake.cpp b/src/playsim/mapthinkers/a_quake.cpp index e6fb687fa5..d2529a5f8e 100644 --- a/src/playsim/mapthinkers/a_quake.cpp +++ b/src/playsim/mapthinkers/a_quake.cpp @@ -36,7 +36,7 @@ #include "actorinlines.h" #include -static FRandom pr_quake ("Quake", true); +static FCRandom pr_quake ("Quake"); IMPLEMENT_CLASS(DEarthquake, false, true) diff --git a/src/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index 211b155c29..89aee643d2 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -540,7 +540,7 @@ -FRandom pr_acs ("ACS", false); +FRandom pr_acs ("ACS"); // I imagine this much stack space is probably overkill, but it could // potentially get used with recursive functions. diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index 91bff0bc20..ea7090c1df 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -73,19 +73,19 @@ #include "shadowinlines.h" #include "i_time.h" -static FRandom pr_camissile ("CustomActorfire", false); -static FRandom pr_cabullet ("CustomBullet", false); -static FRandom pr_cwjump ("CustomWpJump", false); -static FRandom pr_cwpunch ("CustomWpPunch", false); -static FRandom pr_grenade ("ThrowGrenade", false); - FRandom pr_crailgun ("CustomRailgun", false); -static FRandom pr_spawndebris ("SpawnDebris", false); -static FRandom pr_spawnitemex ("SpawnItemEx", false); -static FRandom pr_burst ("Burst", false); -static FRandom pr_monsterrefire ("MonsterRefire", false); -static FRandom pr_teleport("A_Teleport", false); -static FRandom pr_bfgselfdamage("BFGSelfDamage", false); - FRandom pr_cajump("CustomJump", false); +static FRandom pr_camissile ("CustomActorfire"); +static FRandom pr_cabullet ("CustomBullet"); +static FRandom pr_cwjump ("CustomWpJump"); +static FRandom pr_cwpunch ("CustomWpPunch"); +static FRandom pr_grenade ("ThrowGrenade"); + FRandom pr_crailgun ("CustomRailgun"); +static FRandom pr_spawndebris ("SpawnDebris"); +static FRandom pr_spawnitemex ("SpawnItemEx"); +static FRandom pr_burst ("Burst"); +static FRandom pr_monsterrefire ("MonsterRefire"); +static FRandom pr_teleport("A_Teleport"); +static FRandom pr_bfgselfdamage("BFGSelfDamage"); + FRandom pr_cajump("CustomJump"); //========================================================================== // @@ -746,7 +746,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_StopSoundEx) // Generic seeker missile function // //========================================================================== -static FRandom pr_seekermissile ("SeekerMissile", false); +static FRandom pr_seekermissile ("SeekerMissile"); enum { SMF_LOOK = 1, diff --git a/src/playsim/p_effect.cpp b/src/playsim/p_effect.cpp index 31b3e3128b..a2d42f7c57 100644 --- a/src/playsim/p_effect.cpp +++ b/src/playsim/p_effect.cpp @@ -65,7 +65,7 @@ CVAR (Int, r_rail_trailsparsity, 1, CVAR_ARCHIVE); CVAR (Bool, r_particles, true, 0); EXTERN_CVAR(Int, r_maxparticles); -FRandom pr_railtrail("RailTrail", true); +FCRandom pr_railtrail("RailTrail"); #define FADEFROMTTL(a) (1.f/(a)) diff --git a/src/playsim/p_enemy.cpp b/src/playsim/p_enemy.cpp index d3a5a66b21..120f37231e 100644 --- a/src/playsim/p_enemy.cpp +++ b/src/playsim/p_enemy.cpp @@ -54,26 +54,26 @@ #include "gi.h" -static FRandom pr_checkmissilerange ("CheckMissileRange", false); -static FRandom pr_opendoor ("OpenDoor", false); -static FRandom pr_trywalk ("TryWalk", false); -static FRandom pr_newchasedir ("NewChaseDir", false); -static FRandom pr_lookformonsters ("LookForMonsters", false); -static FRandom pr_lookforplayers ("LookForPlayers", false); -static FRandom pr_scaredycat ("Anubis", false); - FRandom pr_chase ("Chase", false); - FRandom pr_facetarget ("FaceTarget", false); - FRandom pr_railface ("RailFace", false); -static FRandom pr_look2 ("LookyLooky", false); -static FRandom pr_look3 ("IGotHooky", false); -static FRandom pr_slook ("SlooK", false); -static FRandom pr_dropoff ("Dropoff", false); -static FRandom pr_defect ("Defect", false); -static FRandom pr_avoidcrush("AvoidCrush", false); -static FRandom pr_stayonlift("StayOnLift", false); +static FRandom pr_checkmissilerange ("CheckMissileRange"); +static FRandom pr_opendoor ("OpenDoor"); +static FRandom pr_trywalk ("TryWalk"); +static FRandom pr_newchasedir ("NewChaseDir"); +static FRandom pr_lookformonsters ("LookForMonsters"); +static FRandom pr_lookforplayers ("LookForPlayers"); +static FRandom pr_scaredycat ("Anubis"); + FRandom pr_chase ("Chase"); + FRandom pr_facetarget ("FaceTarget"); + FRandom pr_railface ("RailFace"); +static FRandom pr_look2 ("LookyLooky"); +static FRandom pr_look3 ("IGotHooky"); +static FRandom pr_slook ("SlooK"); +static FRandom pr_dropoff ("Dropoff"); +static FRandom pr_defect ("Defect"); +static FRandom pr_avoidcrush("AvoidCrush"); +static FRandom pr_stayonlift("StayOnLift"); -static FRandom pr_skiptarget("SkipTarget", false); -static FRandom pr_enemystrafe("EnemyStrafe", false); +static FRandom pr_skiptarget("SkipTarget"); +static FRandom pr_enemystrafe("EnemyStrafe"); // movement interpolation is fine for objects that are moved by their own // velocity. But for monsters it is problematic. diff --git a/src/playsim/p_interaction.cpp b/src/playsim/p_interaction.cpp index eed16b87fc..0ae77e914c 100644 --- a/src/playsim/p_interaction.cpp +++ b/src/playsim/p_interaction.cpp @@ -63,12 +63,12 @@ #include "actorinlines.h" #include "d_main.h" -static FRandom pr_botrespawn ("BotRespawn", false); -static FRandom pr_killmobj ("ActorDie", false); -FRandom pr_damagemobj ("ActorTakeDamage", false); -static FRandom pr_lightning ("LightningDamage", false); -static FRandom pr_poison ("PoisonDamage", false); -static FRandom pr_switcher ("SwitchTarget", false); +static FRandom pr_botrespawn ("BotRespawn"); +static FRandom pr_killmobj ("ActorDie"); +FRandom pr_damagemobj ("ActorTakeDamage"); +static FRandom pr_lightning ("LightningDamage"); +static FRandom pr_poison ("PoisonDamage"); +static FRandom pr_switcher ("SwitchTarget"); CVAR (Bool, cl_showsprees, true, CVAR_ARCHIVE) CVAR (Bool, cl_showmultikills, true, CVAR_ARCHIVE) diff --git a/src/playsim/p_lnspec.cpp b/src/playsim/p_lnspec.cpp index c0a3997852..00318dfbb1 100644 --- a/src/playsim/p_lnspec.cpp +++ b/src/playsim/p_lnspec.cpp @@ -95,7 +95,7 @@ static DCeiling::ECrushMode CRUSHTYPE(int a, bool withslowdown) return withslowdown? DCeiling::ECrushMode::crushSlowdown : DCeiling::ECrushMode::crushDoom; } -static FRandom pr_glass ("GlassBreak", false); +static FRandom pr_glass ("GlassBreak"); // There are aliases for the ACS specials that take names instead of numbers. // This table maps them onto the real number-based specials. diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index 197ab55f1f..5892049930 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -103,10 +103,10 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, DVector2 * static void SpawnShootDecal(AActor *t1, AActor *defaults, const FTraceResults &trace); static void SpawnDeepSplash(AActor *t1, const FTraceResults &trace, AActor *puff); -static FRandom pr_tracebleed("TraceBleed", false); -static FRandom pr_checkthing("CheckThing", false); -static FRandom pr_lineattack("LineAttack", false); -static FRandom pr_crunch("DoCrunch", false); +static FRandom pr_tracebleed("TraceBleed"); +static FRandom pr_checkthing("CheckThing"); +static FRandom pr_lineattack("LineAttack"); +static FRandom pr_crunch("DoCrunch"); // keep track of special lines as they are hit, // but don't process them until the move is proven valid diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index bb8d3be1af..0f9a918036 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -122,29 +122,29 @@ EXTERN_CVAR (Int, cl_rockettrails) // PRIVATE DATA DEFINITIONS ------------------------------------------------ -static FRandom pr_explodemissile ("ExplodeMissile", false); -static FRandom pr_reflect ("Reflect", false); -static FRandom pr_nightmarerespawn ("NightmareRespawn", false); -static FRandom pr_botspawnmobj ("BotSpawnActor", false); -static FRandom pr_spawnmapthing ("SpawnMapThing", false); -static FRandom pr_spawnpuff ("SpawnPuff", false); -static FRandom pr_spawnblood ("SpawnBlood", false); -static FRandom pr_splatter ("BloodSplatter", false); -static FRandom pr_takedamage ("TakeDamage", false); -static FRandom pr_splat ("FAxeSplatter", false); -static FRandom pr_ripperblood ("RipperBlood", false); -static FRandom pr_chunk ("Chunk", false); -static FRandom pr_checkmissilespawn ("CheckMissileSpawn", false); -static FRandom pr_missiledamage ("MissileDamage", false); -static FRandom pr_multiclasschoice ("MultiClassChoice", false); -static FRandom pr_rockettrail("RocketTrail", false); -static FRandom pr_uniquetid("UniqueTID", false); +static FRandom pr_explodemissile ("ExplodeMissile"); +static FRandom pr_reflect ("Reflect"); +static FRandom pr_nightmarerespawn ("NightmareRespawn"); +static FRandom pr_botspawnmobj ("BotSpawnActor"); +static FRandom pr_spawnmapthing ("SpawnMapThing"); +static FRandom pr_spawnpuff ("SpawnPuff"); +static FRandom pr_spawnblood ("SpawnBlood"); +static FRandom pr_splatter ("BloodSplatter"); +static FRandom pr_takedamage ("TakeDamage"); +static FRandom pr_splat ("FAxeSplatter"); +static FRandom pr_ripperblood ("RipperBlood"); +static FRandom pr_chunk ("Chunk"); +static FRandom pr_checkmissilespawn ("CheckMissileSpawn"); +static FRandom pr_missiledamage ("MissileDamage"); +static FRandom pr_multiclasschoice ("MultiClassChoice"); +static FRandom pr_rockettrail("RocketTrail"); +static FRandom pr_uniquetid("UniqueTID"); // PUBLIC DATA DEFINITIONS ------------------------------------------------- -FRandom pr_spawnmobj ("SpawnActor", false); -FRandom pr_bounce("Bounce", false); -FRandom pr_spawnmissile("SpawnMissile", false); +FRandom pr_spawnmobj ("SpawnActor"); +FRandom pr_bounce("Bounce"); +FRandom pr_spawnmissile("SpawnMissile"); CUSTOM_CVAR (Float, sv_gravity, 800.f, CVAR_SERVERINFO|CVAR_NOSAVE|CVAR_NOINITCALL) { @@ -7956,7 +7956,7 @@ void AActor::SetTranslation(FName trname) // PROP A_RestoreSpecialPosition // //--------------------------------------------------------------------------- -static FRandom pr_restore("RestorePos", false); +static FRandom pr_restore("RestorePos"); void AActor::RestoreSpecialPosition() { diff --git a/src/playsim/p_sight.cpp b/src/playsim/p_sight.cpp index a2fc76c46c..2cf957c8ce 100644 --- a/src/playsim/p_sight.cpp +++ b/src/playsim/p_sight.cpp @@ -37,8 +37,8 @@ #include "g_levellocals.h" #include "actorinlines.h" -static FRandom pr_botchecksight ("BotCheckSight", false); -static FRandom pr_checksight ("CheckSight", false); +static FRandom pr_botchecksight ("BotCheckSight"); +static FRandom pr_checksight ("CheckSight"); /* ============================================================================== diff --git a/src/playsim/p_spec.cpp b/src/playsim/p_spec.cpp index 385d17f924..3851bd7483 100644 --- a/src/playsim/p_spec.cpp +++ b/src/playsim/p_spec.cpp @@ -100,7 +100,7 @@ #include "c_console.h" #include "p_spec_thinkers.h" -static FRandom pr_actorinspecialsector ("ActorInSpecialSector", false); +static FRandom pr_actorinspecialsector ("ActorInSpecialSector"); EXTERN_CVAR(Bool, cl_predict_specials) EXTERN_CVAR(Bool, forcewater) diff --git a/src/playsim/p_switch.cpp b/src/playsim/p_switch.cpp index 2af3054d31..59b70ec83d 100644 --- a/src/playsim/p_switch.cpp +++ b/src/playsim/p_switch.cpp @@ -49,7 +49,7 @@ #include "actorinlines.h" #include "animations.h" -static FRandom pr_switchanim ("AnimSwitch", true); +static FCRandom pr_switchanim ("AnimSwitch"); class DActiveButton : public DThinker { diff --git a/src/playsim/p_teleport.cpp b/src/playsim/p_teleport.cpp index be398205cc..a198f2b272 100644 --- a/src/playsim/p_teleport.cpp +++ b/src/playsim/p_teleport.cpp @@ -36,8 +36,8 @@ #define FUDGEFACTOR 10 -static FRandom pr_teleport ("Teleport", false); -static FRandom pr_playerteleport("PlayerTeleport", false); +static FRandom pr_teleport ("Teleport"); +static FRandom pr_playerteleport("PlayerTeleport"); CVAR (Bool, telezoom, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); diff --git a/src/playsim/p_things.cpp b/src/playsim/p_things.cpp index 878366d7b5..3391030aac 100644 --- a/src/playsim/p_things.cpp +++ b/src/playsim/p_things.cpp @@ -47,7 +47,7 @@ #include "actorinlines.h" #include "vm.h" -static FRandom pr_leadtarget ("LeadTarget", false); +static FRandom pr_leadtarget ("LeadTarget"); bool FLevelLocals::EV_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, int newtid) { diff --git a/src/playsim/p_user.cpp b/src/playsim/p_user.cpp index bdc9e9caa4..4ed0c0bfd3 100644 --- a/src/playsim/p_user.cpp +++ b/src/playsim/p_user.cpp @@ -95,7 +95,7 @@ #include "s_music.h" #include "d_main.h" -static FRandom pr_skullpop ("SkullPop", false); +static FRandom pr_skullpop ("SkullPop"); // [SP] Allows respawn in single player CVAR(Bool, sv_singleplayerrespawn, false, CVAR_SERVERINFO | CVAR_CHEAT) diff --git a/src/playsim/shadowinlines.h b/src/playsim/shadowinlines.h index 6c0e9176f5..b36b051ac4 100644 --- a/src/playsim/shadowinlines.h +++ b/src/playsim/shadowinlines.h @@ -17,7 +17,7 @@ extern FRandom pr_spawnmissile; extern FRandom pr_facetarget; extern FRandom pr_railface; extern FRandom pr_crailgun; -inline FRandom pr_shadowaimz("VerticalShadowAim", false); +inline FRandom pr_shadowaimz("VerticalShadowAim"); //========================================================================== // diff --git a/src/rendering/r_utility.cpp b/src/rendering/r_utility.cpp index 7311341e63..390e575c5f 100644 --- a/src/rendering/r_utility.cpp +++ b/src/rendering/r_utility.cpp @@ -94,8 +94,8 @@ struct InterpolationViewer // PRIVATE DATA DECLARATIONS ----------------------------------------------- static TArray PastViewers; -static FRandom pr_torchflicker ("TorchFlicker", true); -static FRandom pr_hom(true); +static FCRandom pr_torchflicker ("TorchFlicker"); +static FCRandom pr_hom; bool NoInterpolateView; // GL needs access to this. static TArray InterpolationPath; diff --git a/src/scripting/decorate/thingdef_exp.cpp b/src/scripting/decorate/thingdef_exp.cpp index 831fcf0c6c..f8ac9e91a1 100644 --- a/src/scripting/decorate/thingdef_exp.cpp +++ b/src/scripting/decorate/thingdef_exp.cpp @@ -576,7 +576,7 @@ static FRandom *ParseRNG(FScanner &sc, bool client) } else { - rng = &pr_exrandom; + rng = client ? &M_Random : &pr_exrandom; } return rng; } diff --git a/src/sound/s_doomsound.cpp b/src/sound/s_doomsound.cpp index 4b2d597bca..749b1f5e79 100644 --- a/src/sound/s_doomsound.cpp +++ b/src/sound/s_doomsound.cpp @@ -1163,7 +1163,7 @@ TArray DoomSoundEngine::ReadSound(int lumpnum) // This is overridden to use a synchronized RNG. // //========================================================================== -static FRandom pr_randsound("RandSound", true); +static FCRandom pr_randsound("RandSound"); FSoundID DoomSoundEngine::PickReplacement(FSoundID refid) { diff --git a/src/sound/s_sndseq.cpp b/src/sound/s_sndseq.cpp index cfe8ed9c10..2664477730 100644 --- a/src/sound/s_sndseq.cpp +++ b/src/sound/s_sndseq.cpp @@ -288,7 +288,7 @@ static const hexenseq_t HexenSequences[] = { static int SeqTrans[MAX_SNDSEQS*3]; -static FRandom pr_sndseq ("SndSeq", true); +static FCRandom pr_sndseq ("SndSeq"); // CODE --------------------------------------------------------------------