Setting up for faster PRNG experimentation.

This commit is contained in:
Mari the Deer 2025-06-25 14:30:48 +02:00
commit 4374d54f27
11 changed files with 129 additions and 92 deletions

View file

@ -3,6 +3,8 @@
Class SWWMHandler : EventHandler
{
Mixin SWWMUIRandom;
transient int lastlock;
transient int lastpickuptic[MAXPLAYERS]; // these two are mostly used
transient int lastnuggettic[MAXPLAYERS]; // to avoid deafening players

View file

@ -5,7 +5,6 @@ extend Class SWWMHandler
transient ui int kcode, klinger;
transient ui String kstr, klingerstr;
transient ui bool kfail;
transient ui int rss;
ui bool nostalgic;
ui Font CheatFont;
@ -456,23 +455,6 @@ extend Class SWWMHandler
return false;
}
private ui int GetUIRandom()
{
return (rss = (rss<<1)*35447+(rss/87));
}
private ui double RandomShiver()
{
int sd = GetUIRandom();
return ((abs(sd)%11)-5)*.1;
}
private ui int RandomFall()
{
int sd = GetUIRandom();
return ((abs(sd)%22)+10);
}
private ui void CheatOverlay( RenderEvent e )
{
// cheat input
@ -488,7 +470,7 @@ extend Class SWWMHandler
int width = (CheatFont.StringWidth(chstr)+3*(tlen-1));
double xx = int(Screen.GetWidth()-width*scl)/2;
double yy = int(Screen.GetHeight()-CheatFont.GetHeight()*scl)/2;
rss = (kcode>4)?gametic:klinger;
SetUIRandom((kcode>4)?gametic:klinger);
for ( int i=0, pos=0; i<tlen; i++ )
{
int ch;