Created
August 27, 2020 20:41
-
-
Save flamewing/bd45c651685f2375fe1df41018c70732 to your computer and use it in GitHub Desktop.
Pseudo-c++ for Sonic 1 loop code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Sonic::Handle_Loops() { | |
if (v_zone != id_SLZ && v_zone != id_GHZ) { | |
return; | |
} | |
uint8_t chunk = get_chunk(obX, obY); | |
if (chunk == v_256roll1 || chunk == v_256roll2) { | |
// Roll tunnels, not relevant here | |
Handle_Roll_Tunnels(); | |
} else { | |
if (chunk != v_256loop1 && chunk != v_256loop2) { | |
move_to_high_plane(); | |
} else if (chunk == v_256loop2 && is_on_air()) { | |
move_to_high_plane(); | |
} else if ((obX % 256) < 0x2C) { | |
move_to_high_plane(); | |
} else if ((obX % 256) >= 0xE0) { | |
move_to_low_plane(); | |
} else if (is_on_high_plane()) { | |
if (!(obAngle == 0 || obAngle > 0x80)) { | |
move_to_low_plane(); | |
} | |
} else if (obAngle > 0x80) { | |
move_to_high_plane(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment