mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 21:51:09 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
a4076ffe38
5 changed files with 62 additions and 5 deletions
|
@ -1993,7 +1993,19 @@ static void D_DoomInit()
|
|||
|
||||
SetLanguageIDs ();
|
||||
|
||||
rngseed = I_MakeRNGSeed();
|
||||
const char *v = Args->CheckValue("-rngseed");
|
||||
if (v)
|
||||
{
|
||||
rngseed = staticrngseed = atoi(v);
|
||||
use_staticrng = true;
|
||||
Printf("D_DoomInit: Static RNGseed %d set.\n", rngseed);
|
||||
}
|
||||
else
|
||||
{
|
||||
rngseed = I_MakeRNGSeed();
|
||||
use_staticrng = false;
|
||||
}
|
||||
|
||||
FRandom::StaticClearRandom ();
|
||||
|
||||
Printf ("M_LoadDefaults: Load system defaults.\n");
|
||||
|
|
|
@ -408,9 +408,11 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
|
|||
|
||||
if (!savegamerestore)
|
||||
{
|
||||
if (!netgame)
|
||||
{ // [RH] Change the random seed for each new single player game
|
||||
rngseed = rngseed + 1;
|
||||
if (!netgame && !demorecording && !demoplayback)
|
||||
{
|
||||
// [RH] Change the random seed for each new single player game
|
||||
// [ED850] The demo already sets the RNG.
|
||||
rngseed = use_staticrng ? staticrngseed : (rngseed + 1);
|
||||
}
|
||||
FRandom::StaticClearRandom ();
|
||||
P_ClearACSVars(true);
|
||||
|
|
|
@ -89,8 +89,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut)
|
|||
|
||||
sec->SetLightLevel(0);
|
||||
|
||||
newheight = sec->FindLowestFloorSurrounding (&spot);
|
||||
fixed_t oldtheight = sec->floorplane.Zat0();
|
||||
newheight = sec->FindLowestFloorSurrounding(&spot);
|
||||
sec->floorplane.d = sec->floorplane.PointToDist (spot, newheight);
|
||||
fixed_t newtheight = sec->floorplane.Zat0();
|
||||
sec->ChangePlaneTexZ(sector_t::floor, newtheight - oldtheight);
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
|
|
|
@ -96,6 +96,42 @@ FRandom M_Random;
|
|||
// Global seed. This is modified predictably to initialize every RNG.
|
||||
DWORD rngseed;
|
||||
|
||||
// Static RNG marker. This is only used when the RNG is set for each new game.
|
||||
DWORD staticrngseed;
|
||||
bool use_staticrng;
|
||||
|
||||
// Allows checking or staticly setting the global seed.
|
||||
CCMD(rngseed)
|
||||
{
|
||||
if (argv.argc() == 1)
|
||||
{
|
||||
Printf("Usage: rngseed get|set|clear\n");
|
||||
return;
|
||||
}
|
||||
if (stricmp(argv[1], "get") == 0)
|
||||
{
|
||||
Printf("rngseed is %d\n", rngseed);
|
||||
}
|
||||
else if (stricmp(argv[1], "set") == 0)
|
||||
{
|
||||
if (argv.argc() == 2)
|
||||
{
|
||||
Printf("You need to specify a value to set\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
staticrngseed = atoi(argv[2]);
|
||||
use_staticrng = true;
|
||||
Printf("Static rngseed %d will be set for next game\n", staticrngseed);
|
||||
}
|
||||
}
|
||||
else if (stricmp(argv[1], "clear") == 0)
|
||||
{
|
||||
use_staticrng = false;
|
||||
Printf("Static rngseed cleared\n");
|
||||
}
|
||||
}
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
FRandom *FRandom::RNGList;
|
||||
|
|
|
@ -215,6 +215,10 @@ private:
|
|||
|
||||
extern DWORD rngseed; // The starting seed (not part of state)
|
||||
|
||||
extern DWORD staticrngseed; // Static rngseed that can be set by the user
|
||||
extern bool use_staticrng;
|
||||
|
||||
|
||||
// M_Random can be used for numbers that do not affect gameplay
|
||||
extern FRandom M_Random;
|
||||
|
||||
|
|
Loading…
Reference in a new issue