I finally got around to fixing that stupid Jesus Mode code. It's been broke since I made it. I only tested the thing in Kokiri forest as young link. Using it anywhere else made Link jump WAY up in the air when he hit the water. Annoying. Today I finally got around to looking at the code again to figure out WTF.
The original code did some fun FPU maths to approximate the correct "ground" coordinate based on the water level. As it turns out, the water level is always the same, no matter where you go: 32.0.
However, the ground level (ground's Y-coordinate) does not match. In Kokiri Forest, the code sets the coordinate to -12.0 which is perfect for walking on water in that area. In the Great Deku Tree, the Y-coordinate must be set to -896.0! Seriously, what the fuck?
After several hours trying to figure this thing out, I eventually came to realize that the water level doesn't change because it's the actual point of reference for the collision detection. Magically, right next to the ground level is the water level offset... I don't know what else to call it, but the closer that offset is to 0, the closer Link is to the water level. Basically what we want is that ... when it hits 0 (or below), we want to bump the ground level up so that the water level offset remains exactly at 0. Since I couldn't find any reliable way to convert the water level point of reference (or offset) to a proper ground coordinate, I decided the next best thing would be just adding the water level offset to the ground level when the water level offset is below 0. (Yeah, I also won't have any idea what the hell any of this means when I come back and reread it later.)
Anyway, that's all the new code does. If I'm lucky, it will also work as adult Link, but I'll never know until someone can test it.
But here it is, in all its glory, and 8 lines shorter than the original. Hooray optimization and bug fixes++!
Except, it does have one bug I noticed.
Exiting the Great Deku Tree makes Link jump a bit. I think that probably happens because you exit the Great Deku Tree at a position lower than the water level in the area (but this should not matter -- the water is in a totally different part of the map. This game is not like Mario 64, where the water level is the same everywhere in the map. The game engine is more advanced. It's actually the same game engine between the two games, just Zelda's is greatly updated... *sigh*) Maybe that can be fixed somehow, too. But it's going to add a few more lines to the code again, crap.
Code:
Jesus Mode v2.0
81021CC0 0800
81021CC2 00CC
81000330 3C08
81000332 801E
81000334 2508
81000336 AA30
81000338 1510
8100033A 000C
8100033C 3C08
8100033E 4200
81000340 4488
81000342 4000
81000344 8E08
81000346 0668
81000348 C50C
8100034A 002C
8100034C C604
8100034E 0084
81000350 4608
81000352 2280
81000354 460A
81000356 603E
81000358 4500
8100035A 0004
8100035C C608
8100035E 0080
81000360 4608
81000362 003E
81000364 4503
81000366 0001
81000368 4604
8100036A 4000
8100036C 0800
8100036E 8732
81000370 4602
81000372 003E