RetroKoH/Chris
retrokoh.bsky.social
RetroKoH/Chris
@retrokoh.bsky.social
Programmer in 68k and Z80 assembly, Python, and Game Maker. Sonic Retro since 2010.
Poorly worded on my part. The animal doesn't normally have said pointer. My mod adds that. When the capsule spawns the animals, it gives the animals that pointer, by loading its own RAM address into the new animal's RAM at $3C and $3D. The animal uses that upon despawn to find the capsule.
November 21, 2024 at 1:59 AM
Here is the new version, but how does it work?

$3F is an animal counter. For every animal the capsule spawns, this counter ticks up by 1. The animal has a pointer to this capsule, and when it despawns, it uses the pointer to decrement the capsule's counter.

This just checks if it's 0 or not.
November 20, 2024 at 5:39 PM
Here is the original routine. As you may notice from the Bugfix lines, it didn't traverse through object RAM properly, only covering half of object RAM, starting at the first reserved space AFTER Sonic's RAM.

We changed it to iterate through only the dynamic RAM, as that's where the animals are.
November 20, 2024 at 5:31 PM
S1Fixed will see a minor optimization to the Prison Capsule's code. In Sonic 1, the capsule runs through the entirety of object RAM (incorrectly BTW) to see if all animals are gone before triggering EoL.

Fixed will have it simply count them as they spawn and despawn, a more efficient routine.
November 20, 2024 at 5:30 PM