User:DavidJCobb/Blocking Events in Legend of Zelda: Ocarina of Time
Let's start with some basic terminology. A blocking event is something that prevents anything else from happening until it ends. In the context of Legend of Zelda: Ocarina of Time, it refers to an event that takes away the player's control over Link until it ends. Most message boxes, and all cinemas, are examples.
The "Steps" Of A Blocking Event
These are the "steps" that the game will go through when a blocking event happens. Note that as I am neither a Nintendo employee nor a ROM hacker, I have constructed this list solely based on my analyses of several glitches.
- Stop Link's (lateral)1 movement, "lock" the player's control over him, and prevent or defer any changes to his state (taking damage, responding to water, etc.).
- Check if Link is underwater.
- If he is underwater, force him into the idle underwater pose.
- If he is not underwater, force him into the idle standing pose.
- Run the blocking event. (If it's a message box, display it; if it's a cinema, play it, etc.) Schedule Link's "unlocking" to occur when the event ends (when the message box is closed, when the cinema ends, etc.)
1 His vertical movement continues; keep reading to see what I mean.
When Things Go Bad
Sinking
There are several flaws with the sequence of steps above, and at least one of them is obvious. The first is that the game only checks whether or not Link is underwater, and if he isn't, the game assumes he's standing on solid ground. But what if he's in midair? Well, if a blocking event occurs while Link is in midair, then he will shift into the standing pose and start to fall straight down (his lateral (horizontal) movement was stopped in "Step" 1, but not his vertical movement). This, combined with "Step" 1 in the sequence above (prevent any changes to Link's state, such as responding to water), can create additional oddities such as causing Link to sink in water.
Then, we have a not-so-obvious flaw: the Ladder Lock glitch.
The Ladder Lock Glitch
The Ladder Lock glitch, and its associated glitch, are the result of another flaw in the sequence. For some reason, if Link is on a ladder, the game cannot revoke the player's control over him, lock his state, or stop his movement -- the entirety of "Step" 1 fails, but instead of throwing an error or causing a crash, it fails in such a way as to cause it to be deferred until later.
Then, the player climbs off of the ladder while the (no-longer-)blocking event is running. And then the player ends the blocking event -- and here's where the real problem starts.
For whatever reason, the game isn't set up to "unlock" Link after the blocking event; instead, it takes another route and just "schedules" Link to be "unlocked" when the event ends. And for whatever reason, now that the blocking event has ended, the game, having previously failed to execute "Step" 1, executes it now, out of order. And this is what the problem is.
There are two possible interpretations as to what happens next. The first interpretation states that the game is now waiting for the blocking event to end so that it can "unlock" Link, but since the event has already ended, it would actually have to end again to trigger the "unlocking" code. Since it can't end a second time (due to the definition of the word "end"), the game ends up waiting forever.
The second interpretation states that the game "unlocked" Link, and then ran "Step" 1 out of order, so it's not even waiting to "unlock" Link: it doesn't even plan to.
The observable result from which both of these interpretations originate is the same: the game hasn't crashed, but it might as well have, because you're never gonna regain control over Link until you reset it.
The Guard Freeze Glitch
The Guard Freeze glitch has a result (and explanation) very similar to that of the Ladder Lock glitch. But there are differences. I'm gonna save some time and not retype a summary of that glitch; please actually click the link and read it before continuing to read here.
For starters, "Step" 1 is executed properly and at the right time in the Guard Freeze glitch. What happens in this glitch is that you're actually replacing the blocking event with your own blocking event: your playing a song on the Ocarina (the blocking event isn't when you play the song, it's when the song is repeated for you with a fancy background after you play it); or your whipping out a trade item. Both events will replace the castle guard's message box.
The end result is similar to that of the Ladder Lock glitch: the game is waiting for you to close the message box so that it can "unlock" Link, but since the message box never even showed up to begin with, you can't close the message box, and so the game will wait forever.
The Skulltula Stuffup Glitch
The Skulltula Stuffup glitch may reveal yet another quirk in the game's implementation of blocking events. The glitch (which, like the previous one, I won't bother to summarize here) seems to be caused by the game being unable to execute "Step" 1 of the sequence above while Adult Link is hovering (with the Hover Boots). Unfortunately, I can't think of a way to test this theory; the obvious way to test it would be to perform the Ladder Lock glitch, substituting the Hover Boots for a ladder, but that glitch only works as Child Link, whereas this glitch only works as Adult Link.