Randomzier: Fix starting rupee item collection (#2645)

* When rupees are given as starting items, they still modify `gSaveContext.rupeeAccumulator`, which means that if you make a new file, start it, and reload without saving, or exit SoH before starting the new file, those rupees were lost. This adds a check for `gPlayState` being NULL, and if it is, adds those initial rupees to the rupee count directly.

* Update soh/src/code/z_parameter.c

Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>

---------

Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
This commit is contained in:
Malkierian 2023-03-22 17:59:08 -07:00 committed by GitHub
parent 533ee9379a
commit e76b990c8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3084,7 +3084,11 @@ s32 Health_ChangeBy(PlayState* play, s16 healthChange) {
} }
void Rupees_ChangeBy(s16 rupeeChange) { void Rupees_ChangeBy(s16 rupeeChange) {
if (gPlayState == NULL) {
gSaveContext.rupees += rupeeChange;
} else {
gSaveContext.rupeeAccumulator += rupeeChange; gSaveContext.rupeeAccumulator += rupeeChange;
}
if (rupeeChange > 0) { if (rupeeChange > 0) {
gSaveContext.sohStats.count[COUNT_RUPEES_COLLECTED] += rupeeChange; gSaveContext.sohStats.count[COUNT_RUPEES_COLLECTED] += rupeeChange;