Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for graphic overrides and item table #712

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

HylianFreddy
Copy link
Collaborator

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.

Override access to gDrawItemTable instead of index, update rItemTable to drop graphicId

Remove extra GetItemRow function

Move editing functions for item models to reduce code duplication

Rewrite custom items explanation
@gymnast86 gymnast86 merged commit e4d4603 into gamestabled:main Jan 30, 2024
2 checks passed
@HylianFreddy HylianFreddy deleted the model_improvements branch February 10, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants