- use the native implementation for Duke.rnd.

This ensures that results are consistent.
This commit is contained in:
Christoph Oelckers 2023-05-01 09:00:55 +02:00
parent fc45636215
commit 8aaa8b4113
2 changed files with 9 additions and 4 deletions

View file

@ -251,6 +251,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, setnextmap, setnextmap)
return 0;
}
DEFINE_ACTION_FUNCTION_NATIVE(_Duke, rnd, rnd)
{
PARAM_PROLOGUE;
PARAM_INT(v);
ACTION_RETURN_BOOL(rnd(v));
return 0;
}
DEFINE_GLOBAL_UNSIZED(dlevel)
DEFINE_GLOBAL(camsprite)

View file

@ -182,10 +182,7 @@ struct Duke native
static native bool isshootableswitch(TextureID tex);
static native bool CheckSprite(class<DukeActor> tex);
static native bool setnextmap(bool checksecret);
static int rnd(int val)
{
return (random(0, 255) >= (255 - (val)));
}
static native int rnd(int val);
static void PlayBonusMusic()
{