Let's see, where to start...
I recently changed the position of the palette table for the overworld sprites so I could add some new palettes, some of them related to the secret base decorations in Emerald. It's went very smoothly so far; up until the decoration placement.
In the menus and while placing, the palettes for the dolls are just fine, work perfectly, but after placing them they change almost randomly, sometimes even taking the guise of a totally different sprite after placement! After a while, I found out what was causing this. This is an example of the sprite data the dolls use.
Code:
FF FF 25 11 FF 11 80 00 10 00 10 00 XX 00 00 00 FC 94 50 08 4C 95 50 08 AC 90 50 08 04 7C 50 08 A8 C6 2E 08
I've read a lot of tutorials and the comparision to the original data is pretty damn close to what Emerald originally used. There's two differences.
The 25 after the starter bytes. This is the byte used for the palette index, which I of course changed for the new sprites to use the new palettes I inputted. Works perfectly.
The XX is what's different from the original. If I use a value under 40, then the sprite "transforms" into the sprite two slots below it when the doll is placed. If I use a value 40 or higher, then the sprite's palette changes after placing it. If I use a value that ends with 0, then the palette is kept but the player's palette is overwritten with something else, and the player stays like that until the offending sprite is out of memory. If I use a value ending in A, then the palette is kept with no adverse side effects.
It seems like I could just use that and be done with it, right? Well, you see, my new doll sprites use two palettes. Half of them use 24, the other half use 25. When XA is used for both dolls using 24 and 25 as a palette index, then when both dolls are placed in the secret base, then the dolls with 24 as a palette index suddenly start using 25 as their index instead. This is obviously not desirable.
What I'm asking is how can I have the dolls use their extended palette indexes and keep it after being placed? I know it has to do with 13th byte in the sprite data, which I've read relates to OAM, but I have no clue how that works at all. I've tried pretty much all 255 different values and haven't gotten anywhere really so I was wondering if anyone could enlighten me on what this value does and how it effects the dolls in the secret bases so I could fix them. Thanks!