Users browsing this thread: 1 Guest(s)
Roster palettes

#1
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
Greetings.

I wanted to change the palettes for the roster characters. I found two interesting addresses, related to OAM:

D8/E945 Sprite animation
D8/EA5C Sprite

The data format for Terra (only the roster character) is:

Code:
Terra sprite (idle)
D8/EA5C 02                   number of tiles
D8/EA5D 80 01 00 39          tile: upper body
D8/EA61 80 11 02 39          tile: lower body
Terra sprite (active)
D8/EA65 02                   number of tiles
D8/EA66 80 00 04 39          tile: upper body
D8/EA6A 80 10 06 39          tile: lower body

All other characters follow the same pattern. D8/EA5C is Terra, D8/EA6E is locke, etc...

The format of the tiles is four bytes: X position, Y position, tile index and the miscellaneous byte. The miscellaneous byte has many flags, including the palette for the tiles. The formated miscellaneous bytes with the palettes is:

Code:
misc. byte    palette     default character
#$31          00          None (bugged)
#$33          01          None (bugged)
#$35          02          Celes, Sabin, Edgar
#$37          03          Locke
#$39          04          Terra
#$3B          05          Gogo, Kefka, Relm, Strago
#$3D          06          Cyan, Shadow, Setzer
#$3F          07          Moogle, Umaro

As example, Terra has four tiles with the miscellaneous byte #$39. Hers palette is 04. If you change the value of the miscellaneous byte, it change hers palette as well. Please, note that the roster palette ID is different from the NPC palette ID.

Does anyone know a better way to change the palettes for the roster? I believe the data is OAM related and I may not be able to change the palette only by code. I can surely change the palette for all tiles for all characters, but I prefer something more optimized.
  Find
Quote  
[-] The following 1 user says Thank You to HatZen08 for this post:
  • SSJ Rick (12-20-2013)

#2
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
The OAM data applies to shop, loading screen and saving screen only. For those case, I think you are stuck with the OAM data you've found.

I'm not quite sure to understand your question... You would like to have a table of 14 palettes numbers and use this instead of the OAM data (as for palette)?

I'm not sure exactly where in bank C3 the palette number is extracted from the misc byte... All I know is that there's a pointer table for OAM data (see here) and then the OAM pointer is stored in $32C9. You can see an example of this in the C3/1903 routine. From there, I don't know what happens as I have never traced the code...

Again, I'm not sure what you mean and I feel a bit like a guy who's trying to show a sailor how to sail...

Edit: Good job on your patches! Amazing work.
  Find
Quote  

#3
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
I was pondering about a unified palette for specific graphics ID. As example, the C2/CE2B table has the palette for all characters, relative only to battle graphics:
Code:
Battle characters palette:
C2/CE2B 02 Terra
C2/CE2C 01 Locke
C2/CE2D 04 Cyan
C2/CE2E 04 Shadow
C2/CE2F 00 Edgar
C2/CE30 00 Sabin
C2/CE31 00 Celes
C2/CE32 03 Strago
C2/CE33 03 Relm
C2/CE34 04 Setzer
C2/CE35 05 Mog
C2/CE36 03 Gau
C2/CE37 03 Gogo
C2/CE38 05 Umaro
C2/CE39 01 Soldier
C2/CE3A 00 Imp
C2/CE3B 00 Leo
C2/CE3C 03 Banon
C2/CE3D 06 Morphed Terra
C2/CE3E 01 Merchant (soldier portrait)
C2/CE3F 00 Ghost
C2/CE40 03 Kefka (terra portrait)
C2/CE41 03 ????
C2/CE42 00 ????

As example, let's suppose I want to change Terra's sprite. With only one byte change (CE2B), I can change the palette for hers battle graphics. However, it won't change hers NPC palettes.

For Terra's NPCs, their palettes are scattered in the events script. Generally, it is a combination of opcodes #$37 (set graphic) and #$43 (set palette). To synchronize Terra's battle palette with their NPC versions, it is necessary to track down the events script with their respective opcodes and change them. It can be really annoying.

The main concept is to change the code of the #$43 opcode (events script – change palette). If the NPC graphic is Terra, it will ignore hers defined palette in the opcode and use CE2B instead. The same logic applies for all other characters with battle graphics.

I did some experiments and I believe I have a good chance to implement the concept. I can also try to change the loading of NPC for the maps with the same logic. However, the roster code is being difficult. The palette, apparently, is hard coded with the OAM structure.

If possible, I wish to synchronize the roster palettes with the battle palettes. If it isn't possible, I will forget about it and try to synchronize the palettes for battle characters and their NPC versions. In the worst scenario, the roster palettes must be managed manually by hex-editing.

Thanks for the hints. I am busy now but I will check it later.
  Find
Quote  

#4
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
That would be really cool if you achieve synchronization.
  Find
Quote  

#5
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
Have you tried using a debugger to find out where the code is read from? It's most likely a block load instead of pulling from the specific byte.

I know from my dabblings in OAM that there are several layers of pointers to even get to the OAM data so it's not going to be even a little straightforward. Also each screen that uses OAM has its own loading code so it will need to be changed in several places, though I imagine you ought to be able to have a single transforming subroutine.

Here's the pointer list to the pointer list for OAM, so maybe searching for that address will help you find something.

Code:
D8/E917: Pointers to pointers! used to make calling simple since different characters have a different number of OAM instances
45 E9 - Terra
57 E9 - Locke
69 E9 - Cyan
7B E9 - Shadow
8D E9 - Edgar
9F E9 - Sabin
B1 E9 - Celes
C3 E9 - Strago
D5 E9 - Relm
E7 E9 - Setzer
F9 E9 - Mog
0B EA - Gau
1D EA - Gogo
2F EA - Umaro
41 EA - Soldier
44 EA - Imp
47 EA - Leo
4A EA - Bannon
4D EA - Esper Terra
50 EA - Merchant
53 EA - Ghost
56 EA - Kefka
59 EA - Soldier 2

And here are the actual pointers that point to the OAM:
Code:
OAM pointers for various things: (there are the various instances called, shop menues, save, etc...)(byte 3?)
D8/E945 - Terra
5C EA 10 - Save Screen
5C EA 10 - Pary Select
5C EA FF - Unknown/Unused
5C EA 10 - Shop
65 EA 10 - Shop Fanfare
5C EA FF - Unknown/Unused

D8/E957 - Locke
6E EA 10 - Save Screen
6E EA 10 - Party Select
6E EA FF - Unknown/Unused
6E EA 10 - Shop77
EA 10 - Shop Fanfare
6E EA FF - Unknown/Unused

D8/E969 - Cyan
80 EA 10 - Save Screen
80 EA 10 - Pary Select
80 EA FF - Unknown/Unused
80 EA 10 - Shop
89 EA 10 - Shop Fanfare
80 EA FF - Unknown/Unused

D8/E97B - Shadow
92 EA 10 - Save Screen
92 EA 10 - Pary Select
92 EA FF - Unknown/Unused92
EA 10 - Shop
9B EA 10 - Shop Fanfare
92 EA FF - Unknown/Unused

D8/E98D - Edgar
A4 EA 10 - Save Screen
A4 EA 10 - Pary Select
A4 EA FF - Unknown/Unused
A4 EA 10 - Shop
AD EA 10 - Shop Fanfare
A4 EA FF - Unknown/Unused

D8/E99F - Sabin
B6 EA 10 - Save Screen
B6 EA 10 - Pary Select
B6 EA FF - Unknown/Unused
B6 EA 10 - Shop
BF EA 10 - Shop Fanfare
B6 EA FF - Unknown/Unused

D8/E9B1 - Celes
C8 EA 10 - Save Screen
C8 EA 10 - Pary Select
C8 EA FF - Unknown/Unused
C8 EA 10 - Shop
D1 EA 10 - Shop Fanfare
C8 EA FF - Unknown/Unused

D8/E9C3 - Strago
DA EA 10 - Save Screen
DA EA 10 - Pary Select
DA EA FF - Unknown/Unused
DA EA 10 - Shop
E3 EA 10 - Shop Fanfare
DA EA FF - Unknown/Unused

D8/E9D5 - Relm
EC EA 10 - Save Screen
EC EA 10 - Pary Select
EC EA FF - Unknown/Unused
EC EA 10 - Shop
F5 EA 10 - Shop Fanfare
EC EA FF - Unknown/Unused

D8/E9E7 - Setzer
FE EA 10 - Save Screen
FE EA 10 - Pary Select
FE EA FF - Unknown/Unused
FE EA 10 - Shop
07 EB 10 - Shop Fanfare
FE EA FF - Unknown/Unused

D8/E9F9 - Mog
10 EB 10 - Save Screen
10 EB 10 - Pary Select
10 EB FF - Unknown/Unused
10 EB 10 - Shop
19 EB 10 - Shop Fanfare
10 EB FF - Unknown/Unused

D8/EA0B - Gau
22 EB 10 - Save Screen
22 EB 10 - Pary Select
22 EB FF - Unknown/Unused
22 EB 10 - Shop
2B EB 10 - Shop Fanfare
22 EB FF - Unknown/Unused

D8/EA1D - Gogo
34 EB 10 - Save Screen
34 EB 10 - Pary Select
34 EB FF - Unknown/Unused
34 EB 10 - Shop
3D EB 10 - Shop Fanfare
34 EB FF - Unknown/Unused

D8/EA2F - Umaro
46 EB 10 - Save Screen
46 EB 10 - Pary Select
46 EB FF - Unknown/Unused
46 EB 10 - Shop
4F EB 10 - Shop Fanfare
46 EB FF - Unknown/Unused

D8/EA41 - Soldier
58 EB FE - Save Screen

D8/EA44 - Imp
61 EB FE - Save Screen

D8/EA47 - Leo
6A EB FE - Save Screen

D8/EA4A - Bannon
73 EB FE - Save Screen

D8/EA4D - Esper Terra
7C EB FE - Save Screen

D8/EA50 - Merchant
85 EB FE - Save Screen

D8/EA53 - Ghost
8E EB FE - Save Screen

D8/EA56 - Kefka
97 EB FE - Save Screen

D8/EA59 - Soldier 2
A0 EB FE - Save Screen

Happy Hacking!
  Find
Quote  

#6
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
I finished a beta version for this patch here: (click for link). The palettes are now synchronized with the C2/CE2B table of palettes. Everything looks fine for a new game, by now. However, specific sprites don't get along with different palettes instead of their own. Without sprite editing, the effective number of palettes available for these specific sprites will be too narrow.

Unfortunately, for the party leader palettes, they won't be updated with a different saved game. After the event scripts set the palettes, it is never updated again except for another event script. The game loading won't update the already set palettes with different values. However, if the game was saved after a new game with the alterations, everything looks fine.

I will check if I can update the party leader palettes, somehow, in the game save loading.
  Find
Quote  
[-] The following 2 users say Thank You to HatZen08 for this post:
  • madsiur (07-02-2018), SSJ Rick (12-20-2013)

#7
Posts: 2,768
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
very nice work


"Sometimes ninjas do wrong to each other, and in dat way the force of tha earf' comes around da moon - and at that presence, da dirt, it overshadows the grass, so you're like, I can't cut dis grass, there's no sun comin' through. So in order to enable each other the two fruits have to look each other in da eye and understand we can only be right, as da ripe is wrong, you know what I mean?"

-HNIC
Quote  

#8
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
I've read over this a few times but just now downloaded it. I liked the concept (hell who wouldn't) but I just started putting pieces together.

If you can synchronize OAM palettes with battle palettes... what if there were 160 battle palettes? Could it still load and handle them? (Course some editing would be required, as I see it, it is only set up to handle the normal ranges.)

Worst case, even if the game can't handle loading up this way on the map, hopefully I can get it to match OAM data palettes from the battle palette list. Best case, if adjusted to handle an extended list of battle palettes, this MIGHT allow for a palette per character everywhere, not just battle, for the time being I'm just shooting for OAM palettes to match up though.


The only true wisdom is knowing you know nothing.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite