Advertisement
mzxrules

Untitled

Dec 1st, 2018
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.59 KB | None | 0 0
  1. in order to understand everything about wrong warp, you have to understand how half the game engine works. but since your article is only interested in the basics, i'll cover that instead. rather than point out every error all at once, it'd be easier to give a quick explanation as to how things sort of work first, and then point out the errors.
  2.  
  3. To start, some simple engine stuff. The biggest unit of Hyrule that can be loaded into memory is the Scene. Hyrule Field is one scene, Kokiri Forest is one scene, Market (Day) is one, Market (Night) is one, all the different grottos are one etc. Scenes are defined by a scene file that contains almost all the data necessary to define a scene: Link's spawns, a list of room files to load (and within the room files are definitions for actor spawns, graphics), most collision, map exits, sometimes there's cutscene data, stuff like that.
  4.  
  5. Most important to the wrong warp topic though is something called a Scene Setup, and this is a key element missing from your explanation. Scene setups are different loadouts of the same scene. Basically, each one is capable of defining it's own set of Link Spawns, actor spawns, exits, cutscene, etc. The big quirk with scene setups is that having more than one is optional. The way it's implemented is that there's a header command that will appear at the very start of the scene file that basically says "hey, this scene has alternate headers located at x". If it doesn't exist, the game won't try to look up a specific setup, which prevents a chance for the the game to crash.
  6.  
  7. With few exceptions, scene setups index 0 to 3 are reserved for Child Day, Child Night, Adult Day, and Adult Night setups respectively, and setups 4 through 16 (the max) are reserved for cutscenes that require their own scene setup.
  8.  
  9. Now, the core of the wrong warp glitch revolves around Zelda64's spawn mechanics. When simplified, the game does these two things: it resolves what scene and what "spawn" to load, and then once the scene is loaded into memory it resolves what scene setup to use.
  10.  
  11. For the first part, you have the Entrance Table. It is a list of 0x614 records, each record storing a scene index, a "spawn" index, and some other bits for handling the transition between scenes. In order to fetch data from this table, the game uses two core variables: what I call the Base Entrance Index, and the Scene Setup index. The base entrance index more or less represents a logical entrance point into the game world, while the scene setup index is added to the base, giving you a final entrance index used to look up data from the entrance table. The layout of the entrance table is somewhat arbitrary, but for the most part it follows these two rules:
  12.  
  13. For every base entrance index used by the game, there exists 4 sequential records for Child Day, Child Night, Adult Day, and Adult Night spawns.
  14.  
  15. If a scene has cutscene setups, the base entrance index that maps to "spawn" 0 for that scene will have records for scene setups 4+ (i.e., as many scene setups as the scene defines)
  16.  
  17. In most cases, the scene setup index is calulated based on the state of Link's Age, the time of day, and a variable known as the cutscene number. The cutscene number is a value that ranges between 0xFFF0-0xFFFC to represent cutscenes stored in scene setups 4-16, 0xFFFD for a non-scene setup cutscene, and 0x0000 for no cutscene. If the cutscene number is between 0xFFF0 and 0xFFFC, the scene setup is set based on that rightmost digit. Otherwise it will be set between the range 0-3 per above.
  18.  
  19. With that, we finally get to the part where we see Ganondoor in action.
  20.  
  21. When you touch the blue warp without trying to do any shenanigans, the warp will eventually set your base entrance index to 0x00EE, and your cutscene number variable to 0xFFF1, which computes to a scene setup index of 4+1 = 5, and a final entrance index lookup of 0x00F3. The record in the entrance table at index 0x00F3 stores Kokiri Forest, spawn 0, and the scene setup number being 5 means that a cutscene setup in Kokiri Forest is loaded. Lastly, because the cutscene number is set between the range 0xFFF0 and 0xFFFF, a cutscene is played.
  22.  
  23. When you perform Ganondoor, opening the door in the boss room sets your base entrance index is set to 0x0252 which represents spawning in the basement of the Deku Tree, and then if you time it correctly the blue warp sets the cutscene number to 0xFFF1. I should point out that the blue warp still sets the 0x00EE value as well, but it writes it to the intermediate "next base entrance index" variable after the 0x0252 has already been copied over.
  24.  
  25.  
  26.  
  27. With that done, here are the mistakes made:
  28.  
  29. - "It does this by using a table of every single possible combination of time, Link’s age, and cutscenes"
  30.  
  31. This statement is not totally correct. If the entrance table contained every possible combination of time, link's age, and cutscenes, the lookup overflowing into the next set of records (or multiple sets of records) wouldn't occur
  32.  
  33. - "serial table"
  34.  
  35. The word serial is a bit weird here. Not technically incorrect but it also not a phrase I've heard in computer science. If you were to replace the word, sequential would be a little better. However, dropping the word altogether and describing what the table actually represents ("an entrance table") would be best.
  36.  
  37. - "These are stored in a table within the game, which, [...] we can’t [...] alter. Well, most of the time."
  38. - "Unless we somehow managed to mess with the internal table that deals with locations and cutscenes…"
  39.  
  40. This point is incorrect. The entrance table is never modified, the variables used to reference it are.
  41.  
  42.  
  43. - "When entering a location, the game has four possible outcomes. First, it loads the regular child scene (think walking into Kakariko Village for the first time). If the player is Adult Link, it adds 2 to this scene. If you enter during the Night, it adds 1. On top of this, if the criteria for a cutscene in this particular scene is met, 4 is added to this counter to skip over the regular entries."
  44.  
  45. This paragraph is all sorts of mixed up. The first sentence is wrong even by your own explanation, as the way you've written it suggests that there's 8? possible combinations. Scene index, scene setup, entrance index all somehow add to one singular "scene" variable. You continue to use "scene" incorrectly later on.
  46.  
  47. - "if we open this door at the same time the game tries to load the medallion cutscene…"
  48.  
  49. You get the Kokiri Emerald here, not a medallion.
  50.  
  51. - "(this cutscene is labelled 0xFFF1 in our table)"
  52.  
  53. There is no table for cutscenes. Ok there is one, but it doesn't apply here at all. 0xFFF1 as I mentioned before is a possible state for the cutscene number variable. In the context of setting up cutscenes, the value 0xFFF1 basically means "load cutscene 1 defined in the next scene you spawn in, and play it".
  54.  
  55. There is a deeper importance to this that I haven't explained yet, one that a lot of casual viewers of speedruns are rarely ever aware of (though with more modern tools like "gz", better known as the practice rom, I think this is changing somewhat). Every wrong warp plays a cutscene, and if your wrong warp spawns you in a scene that doesn't define scene setup cutscenes, then the "cutscene" that plays becomes dependent on the previous cutscene watched. And that's the part where you really start to need to learn how half the game works :)
  56.  
  57.  
  58.  
  59.  
  60. oh, and on a final note, the Ass Chest glitch. You can actually manipulate the reward the Herudo gives you by manipulating what memory address the Gerudo instance is allocated to. Although I wasn't the first to discover Ass Chest, I was the one to discover that bit.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement