Fix ice trap chests lacking smoke by object loading#2568
Conversation
|
Could you use the same seed for GTG and walk in to the maze room from the lava room? If this is done incorrectly the game will crash during the room transition. Also walk back and forth then try to go elsewhere in GTG to make sure it isn't filling up object slots permanently? |
|
|
So that video shows that the object may still not get loaded due to the way en_holl works? That chest you opened in the maze didn't have the effect. Is that part still non-trivial to fix? |
Exactly, if the It seems mostly like a vanilla quirk of esthetic consequences that probably no one will ever see in actual gameplay. It should be fully possible to load on-demand on chest opening (or ice trap item pickup) and then unload, which would also fix this and would be good for any future new traps that need an object (so they can co-exist in the same room). |
|
Just some further testing - chest ice traps and enemy spawns with object load (and unload) as needed. |
|
We should definitely compare this solution to the original proposed solution in #2169 first and see if the occuring crashes are no longer gonna be an issue with the new approach. |
|
That version of the fix used the function to load the object using the "make this object and everything before it persistent between room loads" function. This creates a new function that only temporarily loads the object. I tried something similar in the on-console randomizer here: https://github.com/flagrama/N64-OoT-Randomizer-Patches/blob/ae72149cbad4bf00ce7081c40e1e9b0c820efa34/src/code/z_scene.c.patch#L9-L34 though somewhat clumsier that does work as long as the object is manually unloaded when the chest despawns. The fact that running back and forth in GTG was tested for this PR means that is handled properly already. You can still see the problematic function Kirox used referenced in the linked patch before the linked section. That function should only ever be called on scene load, not randomly when opening a chest. The new function is fine. See #1912 (comment) for my comments on the old PR, but on the bug instead of the PR itself. |
|
I took a deeper look into the previous fix now and actually, I wonder if it was the synchronous DMA request causing crashing. (Non-persistent objects on room load, and objects in this fix, load asynchronously through I've had one crash recently due to objects, on unloading (because I treated all |
|
@fenhl can you add the needs review status back please, or at least hold on this for now since 9.1 is coming soon. There are some concerns which I will try here as well but I want to thoroughly test the following:
Also I dont fully understand, does this actually still crash? or was that only due to the debugger menu? |
|
This PR has seen the basic testing to ensure the fix works as intended, plus testing to ensure it doesn't cause the same side effect as the previous attempt. I consider that enough testing for inclusion in Dev. Any further testing can be done while it's on Dev. It will spend an entire release cycle there, which should be more than enough time. |
|
I looked into the previous fix GTG crash a final time, confirming that there was no manipulation or extra loading of persistent objects in any way, and that was not an issue at all. The problem was the The game did not crash with the SoT block not visible (i.e. not drawn), matching the initial (very detailed and helpful) report on Discord. The SoT object was slot 12* in Lava room. When entering Maze room, the object is unloaded before the SoT actor is fully deleted. This is no problem in vanilla because the final object 9 in Maze room does not reach the memory space of slot 12 in Lava room. However, adding As the asynchronous DMA (normally used for non-persistent objects) has a frame delay from taking the object slot to actually DMA loading the object, it does not present any problems. This also explains why the previous fix does work for loading Like Like dropped objects. (Here to the contrary, async load would not work as it is currently set up, because the current fix object load is called from I did two changes to the function:
|
|
@rrealmuto still has concerns, I've asked them to talk to you directly. |
|
Concerns seem to have been resolved, merging. |
Ice trap chests load OBJECT_FZ on spawn, if unopened. Fixes #1912.
For ice traps to have smoke effect the object
OBJECT_FZ(related to Freezard actor) must be loaded. Objects are normally loaded on room-to-room basis depending on the room's object list. Vanilla ice traps are thus in rooms that load this object. Randomized ice trap chests will not have the smoke effect unless they spawn in a room that hasOBJECT_FZloaded for some reason (because in vanilla it has Freezards, ice traps, or other reason).Non-persistent objects are loaded on room load from this object list, and cleared on next room load. Max number is 19. The object context is updated every frame.
This fix makes the chest actor
EnBoxload theOBJECT_FZinEnBox_Initif its new get item ID isGI_ICE_TRAPand it has not been opened before.Object_LoadExtrato find ifOBJECT_FZis already loaded, or else, an available object slotfunc_800982FCto fill the slot with dataObject_LoadExtrais not restricted to chests, it can be called by anything that needs to load an extra object. It's surely possible to make unloading possible too.Testing
Tested on Ares recent nightly build, Project64 3.0.1 and Mupen64plus 2.8.
Looks like this: https://www.youtube.com/watch?v=bXqP-y3l_TE
The testing number printing code can be found here
(I had a very impactful, sly bug related to object loading (due to a typo) that crashed hard on Ares and Mupen64, but ran fine on Project64 - in case that says anything about bug finding potential in this type of case.)