Skip to content

Fix: Shopsanity not always spawning objects for items on the shelf#2247

Merged
briaguya0 merged 1 commit intoHarbourMasters:develop-bradleyfrom
Archez:fix-shop-object-spawn
Dec 24, 2022
Merged

Fix: Shopsanity not always spawning objects for items on the shelf#2247
briaguya0 merged 1 commit intoHarbourMasters:develop-bradleyfrom
Archez:fix-shop-object-spawn

Conversation

@Archez
Copy link
Contributor

@Archez Archez commented Dec 23, 2022

Previously a fix was added to solve the "sold out" object not spawning in the kokiri shop, meaning the girla actor would get killed and its item on the shelf was empty. This fix was attempting to solve an issue where the "sold out" object was reporting as "loaded" even though it wasn't. A new issue for bugs in a bottle in the kokiri shop was displaying the same object issue.

The problem was due to improper use of Object_IsLoaded(). We were checking if the object was loaded, and if so grabbing it's index, otherwise spawning the object. We were passing in the objectId into Object_IsLoaded(), but what should actually be passed in is an objectBankIdx. Most of the objectId's were performing an OOB access and coincidentally reporting false (aside from sold out, and now bugs in a bottle).

Instead, I've updated the logic to fetch the object bank index based on the objectId with Object_GetIndex() and if its -1 then we know we need to spawn it with Object_Spawn().

Confirmed this fixes #2243 and also still loads the "sold out" object.

image

Repro spoiler:
27-61-94-50-20.txt

Build Artifacts

@briaguya0 briaguya0 merged commit d215c76 into HarbourMasters:develop-bradley Dec 24, 2022
@Archez Archez deleted the fix-shop-object-spawn branch December 24, 2022 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants