gamestabled / OoT3D_Randomizer

Other
201 stars 42 forks source link

Updates for graphic overrides and item table #712

Closed HylianFreddy closed 9 months ago

HylianFreddy commented 10 months ago

This PR doesn't add any new features, but it introduces a couple of changes to slightly improve the addition of more custom items to the Randomizer. A couple of graphical fixes are also included. This branch is the base for some new settings I'm currently working on.

Remove GraphicID

The randomizer's rItemTable currently contains a column, graphicId, used to override the index into the game's gDrawItemTable when obtaining an item, in order to change the GetItem model. Separately, the item table also contains all the values that are returned by the gDrawItemTable: this set of values is used to draw overworld and shop models. To reduce the complexity, I have removed the graphicId from the table and replaced some patches so that, instead of overriding the index into gDrawItemTable, the Randomizer will override the access to it, returning the set of values from the rItemTable.

This means that adding custom items won't require finding an unused entry in the gDrawItemTable and editing it for the new item. It also prevents running out of unused entries in the future (there aren't many left).

To improve readability of the Item Table, I also added an entry to the GetItemID enum for each item row, so it's easier to see what items the rows correspond to. The chest type is also written with enum values now.

Group model editing functions

The code to edit models and textures for the creation of custom items is currently duplicated across models.c, shops.c and item_override.c. I moved it to generic editing functions in custom_models.c.

Fix billboard models rotation

For overworld item models, I fixed the rotation of the secondary models used to display 2D images, by making them always follow the camera orientation (for example the fairy orb inside the bottle). Similarly, the flame on the blue fire shop model should now always revolve correctly around the candle.