pret / pokeplatinum

Decompilation of Pokémon Platinum
164 stars 56 forks source link

Document Sprite Resource / Util (Cell Actor Part 3) #244

Closed Fexty12573 closed 2 weeks ago

Fexty12573 commented 3 weeks ago

This is yet another resource "manager". This time specifically for sprite resources. A SpriteResource can hold any of

It contains the raw file data and the unpacked data, obtained using the NNS_G2dGetUnpacked* functions, as well as some additional info in case of palettes and tiles.

Resources can (as usual...) be added to a collection: SpriteResourceCollection. A sprite resource collection can only hold resources of one type. I.e. only sprites or only palettes, etc. It provides methods for loading resources from NARCs

Another type in this is SpriteResourceTable, which is similar to a collection but it's a table deserialized directly from a file or a NARC. It, by itself, then contains further references to either other files or NARCs which contain the actual resources. All entries from such a table can be added directly to a sprite resource collection as well, via SpriteResourceCollection_AddTable[Ex].

I now realized that this is most likely gonna be a 6 part PR, instead of 4. This file is mostly utility functions used by a more abstract system. However, there are two more files with utility functions like that. One is for handling VRAM transfers and the other I'm not sure yet.

I am also now debating going back to the cell actor PR and adjusting the terminology there (cell -> sprite) but I first need to see if there is a more concrete "Sprite" type elsewhere.

lhearachel commented 3 weeks ago

Now that #176 has been merged, make sure to clean up your merge conflicts and run your code through the formatting utility.