From e76b990c8a37d4877ebd4aef9ab8093450e9a0c1 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Wed, 22 Mar 2023 17:59:08 -0700 Subject: [PATCH] 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> --- soh/src/code/z_parameter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index c5bbb38ca..1b44f67d5 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -3084,7 +3084,11 @@ s32 Health_ChangeBy(PlayState* play, s16 healthChange) { } void Rupees_ChangeBy(s16 rupeeChange) { - gSaveContext.rupeeAccumulator += rupeeChange; + if (gPlayState == NULL) { + gSaveContext.rupees += rupeeChange; + } else { + gSaveContext.rupeeAccumulator += rupeeChange; + } if (rupeeChange > 0) { gSaveContext.sohStats.count[COUNT_RUPEES_COLLECTED] += rupeeChange;