Commit graph

19 commits

Author SHA1 Message Date
toaster
845fe12b52 Conversion to using gamedata_t
A small piece of (STJr/SRB2!1756).
Due to how RR currently handles time attack records and how it WILL handle unlocks, it's not currently feasible to split everything such that you can have two independent gamedata_t... but what's done so far is certainly more sane and less dependent on global variables
Other minor refactors:
- M_UpdateUnlockablesAndExtraEmblems and M_SilentUpdateUnlockablesAndEmblems are now one function with a boolean for loudness
- Unlock prints are currently living in the console, since the cecho stuff was a little broken
2022-11-30 13:19:21 +00:00
Sally Coolatta
492c068cdd Try some things to reduce rng biases
- Don't clamp all RNG calls to [0, FRACUNIT-1]. Only does this for P_RandomFixed now.
- Use rejection sampling for any clamped RNG calls, to remove modulo bias.
- Because of this, P_RandomRange ranges >= FRACUNIT are no longer undefined behavior.
- Added P_Random/M_Random to grab RNG output directly.
- Shuffle M_Random's RNG as well, since OS rand can be [0,INT32_MAX] instead of [0,UINT32_MAX].
2022-11-12 09:48:59 -05:00
Sally Coolatta
3e4edc534d Remove strange RNG sync hack
Previously it was using P_SetRandSeed, which sets both initial and current seed to the same thing, since it's meant for level load init. It first set all RNG seeds to the current seed, and then it set all of the seeds to their initial value. The comment about this just says its "stupid and hacky", and I have no idea how it even worked before.

Now we send over both init seed and current seed independently and set them both. Hopefully this will fix the desyncs.
2022-09-25 07:02:39 -04:00
Sally Coolatta
a60d4a13a1 RNG classes, take 2
Redone version of my old branch
2022-09-19 00:04:57 -04:00
James R
2274129f57 Update copyright year to 2020 2020-02-19 14:08:45 -08:00
Steel Titanium
9a48bc65ec Update copyright statements for changed names 2020-01-06 17:16:27 -05:00
Steel Titanium
a5cdb0a4b3 Update copyright date on source files 2019-12-06 13:49:42 -05:00
mazmazz
c91b2b4456 Update source copyrights to 2018 2018-11-25 07:35:38 -05:00
Inuyasha
f07585191b copyright dates/statements updated and such
(no actual SLOC changes)
2016-05-17 17:42:11 -07:00
Inuyasha
fbce35d27e cast P_Random(Key/Range) PRNG calls to INT64 to preserve old behavior
(it's still technically "undefined" behavior anyway)
2016-05-11 13:54:40 -07:00
Inuyasha
8e753c1886 compilation fix for DEBUGRANDOM 2016-04-27 17:17:35 -07:00
Inuyasha
480f9be51f gotta start compensating for xorshift's needs 2016-03-29 16:27:57 -07:00
Inuyasha
3dc4cfc229 Simplicity is a virute... don't overcomplicate things. 2016-03-29 16:27:56 -07:00
Inuyasha
a3e940fe65 Compensate for insufficient RAND_MAX values. 2016-03-29 16:27:56 -07:00
Inuyasha
ac03ce39c8 *_Random is now *_RandomByte.
P_RandomChance is now a macro for something that should happen a
certain percentage of time.

P_SignedRandom was moved to a macro. Nobody cared.

# Conflicts:
#	src/p_inter.c
2016-03-29 16:27:55 -07:00
Inuyasha
ce2c2de58a P_Random now using a variant of xorshift
This actually passes most diehard tests, as opposed to the old RNG.
It's also similarly fast.

Internally the PRNG generates a fixed point number from [0,1) now,
which makes P_RandomKey and P_RandomRange much easier to
calculate. P_Random is just a simple shift, as well.

Also, the lack of floating point math in P_RandomKey and
P_RandomRange now is probably for the best.
2016-03-29 16:27:25 -07:00
Alam Ed Arias
404b5f666c SRB2 2.1.12 release 2014-11-11 19:55:07 -05:00
Alam Ed Arias
a03da73115 SRB2 2.1.2 release 2014-03-17 08:13:16 -04:00
Alam Ed Arias
b93cb1b65a SRB2 2.1 release 2014-03-15 13:11:35 -04:00