Fix bug with uncollected silver rupees getting killed when room is cleared.

This commit is contained in:
Christopher Leggett 2024-04-16 19:44:53 -04:00
parent 4a25a07a72
commit f02cb56d0c
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79
2 changed files with 12 additions and 0 deletions

View File

@ -1194,6 +1194,10 @@ void RegisterSilverRupeeShuffle() {
if (actor->id == ACTOR_EN_G_SWITCH) {
auto* silverRupee = reinterpret_cast<EnGSwitch*>(actor);
if (silverRupee->type == ENGSWITCH_SILVER_RUPEE) {
// Override any Actor_Kill calls from the vanilla silver rupee init function.
silverRupee->actor.update = EnGSwitch_Update;
silverRupee->actor.flags = ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED;
Actor_SetScale(&silverRupee->actor, 0.03f);
Rando::Position randoPos = {static_cast<SceneID>(gPlayState->sceneNum), ResourceMgr_IsSceneMasterQuest(gPlayState->sceneNum) ? RCQUEST_MQ : RCQUEST_VANILLA, actor->world.pos};
silverRupee->rc = Rando::StaticData::silverRupeeMap.at(randoPos);
Rando::Location* loc = Rando::StaticData::GetLocation(silverRupee->rc);

View File

@ -8,6 +8,14 @@ struct EnGSwitch;
typedef void (*EnGSwitchActionFunc)(struct EnGSwitch*, PlayState*);
#ifdef __cplusplus
extern "C" {
#endif
void EnGSwitch_Update(Actor* thisx, PlayState* play);
#ifdef __cplusplus
}
#endif
typedef enum {
/* 0 */ GSWITCH_NONE,
/* 1 */ GSWITCH_APPEAR,