Refactor/RNG system (#476)

* Extract rng manipulation to its own file

* clang format

* Get CPU cycles since game start to use for RNG

* change a few things

* clang format

* Implement suggestions from @ricfehr3

* clang format

* Fix rebase issue

* clang format

* Create RngInfo struct to hold seed and step

* clang format

* Make a note about rng_restore system not having been tested properly yet

* Apply suggestions from @ricfehr3

Co-authored-by: Rickey <ric@rf3.xyz>

* clang format

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
Co-authored-by: Rickey <ric@rf3.xyz>
This commit is contained in:
Geralt
2026-05-21 19:47:48 -07:00
committed by GitHub
co-authored by Rickey MathisMartin31
parent e3f680d6d0
commit c2844a5d32
14 changed files with 162 additions and 57 deletions
+2 -1
View File
@@ -5,6 +5,7 @@
#include "game_variables.h"
#include "graphic_utils.h"
#include "pool.h"
#include "random.h"
#include "soundbank.h"
#include "util.h"
@@ -330,7 +331,7 @@ void sprite_object_set_focus(SpriteObject* sprite_object, bool focus)
play_sfx(
SFX_CARD_FOCUS,
MM_BASE_PITCH_RATE + get_rand() % CARD_FOCUS_SFX_PITCH_OFFSET_RANGE,
MM_BASE_PITCH_RATE + rng_get_u32() % CARD_FOCUS_SFX_PITCH_OFFSET_RANGE,
SFX_DEFAULT_VOLUME
);
sprite_object->ty = sprite_object->ty + int2fx((focus ? -1 : 1) * SPRITE_FOCUS_RAISE_PX);