SRB2/src/hardware
Inuyasha b288d8a399 Merge branch 'bp_random2' into 'next'
xorshift* PRNG

This needs testing to ensure I didn't mess anything up switching function names around.

Our PRNG sucks. This is probably obvious. I wish I had known better at the time I implemented it, but oh well.

The replacement is an xorshift* PRNG variant with period 2^32 - 1 (meaning that the PRNG state will loop after four billion calls ... that's not likely to happen), versus the old PRNG's period of about 2^22 (?). The output is also much more random and less predictable; the old PRNG would fall into a predictable loop of output after about 4000 numbers were generated, which isn't much.

The PRNG here also outputs numbers as fixed point from [0,1) (that's 0 to FRACUNIT-1, in other words) instead of single bytes at a time. This makes it much easier to calculate things for, say, P_RandomRange and P_RandomKey. A new macro, P_RandomChance(p), is now in use that returns true _p_ percent of the time, where _p_ is a fixed_t probability from 0 (0%) to FRACUNIT (100%).

This doesn't affect netgames at all; the code for seed saving and restoring is identical (aside from a check to prevent seed being set to 0, which breaks xorshift PRNGs). Demos break, but A: _duh_ and B: they're already broken by all the changes to physics to accommodate slopes.

P_Random is deprecated in Lua, as the function was renamed to P_RandomByte. Aside from that, nothing special.

See merge request !64
2016-04-24 18:03:13 -04:00
..
r_minigl SRB2 2.1 release 2014-03-15 13:11:35 -04:00
r_opengl Merge branch 'master' of http://git.magicalgirl.moe/STJr/SRB2 into pub_next 2016-01-29 16:01:57 -08:00
s_ds3d change SDL into HAVE_SDL 2014-07-25 19:10:24 -04:00
s_fmod change SDL into HAVE_SDL 2014-07-25 19:10:24 -04:00
s_openal change SDL into HAVE_SDL 2014-07-25 19:10:24 -04:00
hw3dsdrv.h change SDL into HAVE_SDL 2014-07-25 19:10:24 -04:00
hw3sound.c *_Random is now *_RandomByte. 2016-03-29 16:27:55 -07:00
hw3sound.h SRB2 2.1 release 2014-03-15 13:11:35 -04:00
hw_bsp.c SRB2 2.1 release 2014-03-15 13:11:35 -04:00
hw_cache.c Fix hardware / r_opengl warnings. 2014-11-02 01:31:38 -04:00
hw_data.h change SDL into HAVE_SDL 2014-07-25 19:10:24 -04:00
hw_defs.h OpenGL Screen Flip 2014-04-07 17:08:04 +01:00
hw_dll.h SRB2 2.1 release 2014-03-15 13:11:35 -04:00
hw_draw.c V_DrawFill in OGL now consistent with software 2016-04-06 18:33:38 -07:00
hw_drv.h Virtual resolutions in OpenGL 2014-11-13 18:06:38 -06:00
hw_glide.h SRB2 2.1 release 2014-03-15 13:11:35 -04:00
hw_glob.h Well, we don't need "experimental" slopes anymore either 2016-03-09 01:09:21 -08:00
hw_light.c *_Random is now *_RandomByte. 2016-03-29 16:27:55 -07:00
hw_light.h SRB2 2.1 release 2014-03-15 13:11:35 -04:00
hw_main.c Merge branch 'master' into next 2016-03-30 20:15:08 -04:00
hw_main.h Disable the corona-related consvars unless ALAM_LIGHTING macro is enabled 2016-04-21 18:50:30 +01:00
hw_md2.c Merge branch 'master' into next 2016-03-30 20:15:08 -04:00
hw_md2.h Colour Changing MD2s 2016-02-09 18:04:59 +00:00
hw_trick.c Redwall sky gone 2014-03-24 17:29:14 +00:00
hws_data.h SRB2 2.1 release 2014-03-15 13:11:35 -04:00