That's what I watched. But, Flotonic's a genious, & he must learn how to dumb his tuts down for regular people! It's complex, I might figure it out eventually. Files and Actors and Groups, Oh my!A guide to hex editing your map filesWhile the Utility of Time is the main method you'll be using when editing maps, there are a few times when its abilities fall short. In these cases, you don't really have a choice but to hex edit the map file directly. The main time you'll be doing this is when adding actors or groups to the map. This guide will cover that.
What are groups, anyways?Groups are the actual data for the actors. If a group's number is on a room's group list, the game will load that group when loading the room. If an actor's group is not on the group list, the game will not have the data for the actor, and will not load it. With a few exceptions, all actors must have their corresponding group on the group list if you want them to work.
The exceptions mentioned above are actors in groups "0000" through "0003". Many scenes have some or all of these groups pre-loaded into them. Dungeons nearly always have all 4 of those groups. As such, groups "0000" through "0003" do not need to appear on the group list for their actors to work.
WARNING: Some versions of UoT display the group list as being 1 longer than it actually is. If your version does this, keep in mind that the last group it displays is not actually on the list, and may in fact be part of the actor data.
Getting to know your map filesThe first 4 lines of the map file are the header. This tells the game what properties the room has and where the various pieces of room data are. We are only concerned with the last 2 lines for the purposes of this tutorial. The example above is the first room of the Forest Temple.
The 8 bytes highlighted in blue tell the game where vertex data is located. You can tell it's the vertex data because it begins with 0A. It's generally best to let UoT edit these. The most important thing to notice is the part after "03 00", which tells you where the vertex data starts. In this map, vertex data starts at offset "D0".
The 8 bytes highlighted in green tell the game where group list is located. You can tell it's the group list because it begins with "0B". The byte after "0B" tells the game how many groups there are, and the bytes after "03 00" tell the game where group list starts. In this map, there are 7 groups, and the first group is located at offset "40".
The 8 bytes highlighted in yellow tell the game where actor list is located. You can tell it's the actor list because it begins with "01". The byte after "01" tells the game how many actors are in the room, and the bytes after "03 00" tell the game where the actor list starts. In this map, there are 8 actors, and the first actor is located at offset "50".
After the header comes the group data, highlighted in orange, starting at offset "40" just as the header said. Each group is 2 bytes long. In this map, the groups are
0072 0073 000E 00A4 005D 0024 015C
Which are Forest Temple Objects, Forest Temple Textures, Chests, Torches, Bubbles, Skulltulas, and Collectible Heart, respectively.
Next comes the actor data, highlighted in red, starting at offset "50", again just as the header said. Actors are 16 bytes long, consisting of 8 pairs of bytes. Their format is as follows:
Actor# X pos. Y pos. Z pos. X rot. Y rot. Z rot. Actor Var.
This room has 5 Skullwalltulas ("0095"), a big Skulltula ("0037"), a chest ("000A"), and a switch ("012A").
Lastly, after the actor data is the vertex data, in red text, starting at D0 as the header said. The vertex data is more complicated to edit than the other two, and again is best left to UoT.
Adding Groups to your mapThere are two methods to add groups to a map. One method is used when you want to take a map with 8 or fewer groups and give it 12 or more groups. The second method should be used in all other situations, and is the one we will be discussing.
The first thing we're going to do is to move the group list so it starts at offset "3A". To do this, remove the 6 bytes that precede the group list, and insert 6 blank bytes after the group list.
WARNING: It is very important that you insert the 6 blank bytes BEFORE the start of the actor list. Further, not all maps start their actor list on a new line like this one does. If you are unsure where the actor list begins, consult the header as detailed above.
Next, we will need to tell the game that the group list starts in a new location. So you will need to change the "40" at the end of the group section to "3A".
Lastly, you will need to tell the game that the group list now has however many groups you want there to be. In this case, there will be 10 groups in the room, so change "07" to "0A".
And that's it! Now, you can go into UoT and change the extra blank bytes into the groups you want.
WARNING: Adding too many groups to a map will cause the game to freeze when loading the room. How many is too many depends on both the map and which groups are on the list. If you encounter this problem, see if there are any groups you're not using and remove them from the list.
Adding Actors to your mapAdding actors also has two methods. One lets you add at most 1 or 2 actors to your map (how many depends on the map in question). The other allows you to add as many actors as you want to a map. This section will deal with the latter.
The first step is to copy and paste the room's current actor list onto the end of your map file. As mentioned before, the location of the actor list can be found by consulting the header. Once you've done that, add 1 new line to the end of the file for each actor you wish to add.
Next, find the offset where you pasted the room's current actor list. take this value and place it after the "03" in the actor section of the header. Additionally, change the number of actors (found after "01" in the same section) to the new number. In this case, we change the offset to DB90 and the number of actors to 11 ("0B")
Now you are done hex editing the map file. You can change and move your newly-added actors by opening the map in UoT. However, because you changed the size of the map file, we are not entirely done. We will need to inform the scene file and the main file table that the map is now larger.
WARNING: When UoT injects a file into the ROM, it always replaces the file's last byte with "00". The best way to avoid this is to make sure that your last actor has a variable that ends in "00". If this is impossible, you will have to hex edit the ROM itself to fix the error.
First, go to your scene file and open it up in your hex editor. You should see two columns of "FF"s. Those actually represent doors, but that's a topic for another guide. After the doors are the offsets of the maps. That's what we're looking for. Each map takes up 8 bytes--4 for the start offset and 4 for the end offset.
The map offsets are thankfully in the same order as the maps. So, in this case, we want the very first one. Take note of what the end offset is ("02 16 CB 90"), then add "10" to it for each line you added to the end of the file. In this case, add "B0" to get "02 16 CC 40". Save your scene file and use UoT to inject it and your map into your ROM.
WARNING: Make sure that you haven't added so many actors that you run into the next file. If your end offset is larger than the start offset of the next map file, you have too many actors.
The nest step is to edit the main file table. Open your ROM in the hex editor, and search for the end offset you took note of earlier. Do the same thing to it as you did in the last step.
The final step is to fix the game's checksum. Open the ROM in GZRT and use the checksum fixing tool to do so.
Adding actors through file optimizationThis is the other method mentioned above. While it's really only good for 1 or 2 actors, it doesn't change the size of the map file, meaning you don't have to do all that stuff with editing the scene and file table. So if you only need that 1 extra actor for your room, this is a good way to do it.
Firstly, go through the steps outlined in adding groups, where you move the group list to start at "3A". Next, find where the Vertex data starts and delete all blank bytes between the end of the actor list and the start of the vertex data. Now insert the same number of blank bytes you just deleted at the beginning of the actor list.
If all goes well, your actor list should now start on a new line, the vertex data should start immediately after it, and there should be a large number of blank bytes between the groups and the actors. If these blank bytes form a full line, you can insert an actor there. You may need to remove groups to achieve a full line. Once you've added your actor(s), change the number of actors and the offset of the actor list accordingly.
For example, in the above, we could change the number of actors to 9, starting at offset "50". Or, if we could reduce the number of groups to 3, we could increase the number of actors to 10, starting at offset "40".
WARNING: UoT sometimes has trouble changing the actor number of the very first actor on the list. If you run into this problem, simply open the map in your hex editor and change the actor number yourself.
You can further optimize your file by letting the actor and group list share data. For example, in the map below, the fact that the Lizafos actor number ("0025") is the same as the Torch Slug group number is used. Additionally, by placing the Lizafos at X position 11 ("000B"), the Wallmaster group can be added to the room.