HackerN64 / HackerSM64

A Super Mario 64 decompilation repo based on CrashOveride95/ultrasm64 that aims to provide a flexible, easy-to-use base for creating romhacks.
328 stars 146 forks source link

Refactor `fish.inc.c` to remove `ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS` in favor of a param #493

Open Tubular-Bells opened 1 year ago

Tubular-Bells commented 1 year ago

There are currently 5 separate #ifdef ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS checks in src/game/behaviors/fish.inc.c. This results in a lot of ugly code duplication, and makes the Secret Aquarium fish behavior unusable in hacks without vanilla level checks. This problem is mentioned in the fish.inc.c file already (in the form of TODO comments), but I'm adding it to the issue tracker because there isn't one yet.

someone2639 commented 11 months ago

Do you (or anyone reading this) have an idea on how this should be tackled? I looked at the file and nothing sprung to mind that could be done cleanly with a param.

Tubular-Bells commented 5 months ago

Would it be possible to store the information about which "mode" the fish spawner should be in in the oBehParam? You would obviously want it to default to the non-Secret Aquarium behavior as to not break existing stuff. This should also make it possible to have both kinds of behaviors present in a single level. Using oBehParams like this admittedly feels a little hacky, but it is consistent with the current implementation of things like warp floors.

Arceveti commented 5 months ago

Here's how I did it on one of my old dev branches.