05-30-2013, 10:06 PM
Per the request of Gi Nattak, here is how to add a condition to setting your battle palettes (in this case, Kefka in the WoR and Edgar as Gerad).
All you need is 35 free bytes of code.
Then you just have to call this instead of simply calling the battle palette data from the table.
Replace:
with this:
That's all there is to it. You can set as many conditionals as you want, based on any data in the RAM, create a separate table for your characters to look from, or statically set each one with only minor changes to the code. If anyone wants a specific condition, let me know, but I would encourage you to try tweaking the code first yourself.
It's good to be ASM-ing again.
All you need is 35 free bytes of code.
Code:
XX/0000: AD941E LDA $1E94 (load event bits)
XX/0003: 2910 AND #$10 (in WoR?)
XX/0005: F017 BEQ $001E (Branch if it isn't)
XX/0007: E01500 CPX #$0015 (is this Kefka?)
XX/000A: F00F BEQ $001C (Branch if it is)
XX/000C: E00400 CPX #$0004 (is this Edgar?)
XX/000F: D00D BNE $001E (Branch if it isn't)
XX/0012: AD981E LDA $1E94 (load event bits)
XX/0014: 2940 AND #$40 (have we recruited Edgar?)
XX/0016: D006 BNE $000E (Branch if not)
XX/0018: A901 LDA #$04 (Set palette ID to 01)
XX/001A: 6B RTL
XX/001B: A901 LDA #$01 (Set palette ID to 01)
XX/001D: 6B RTL
XX/001E: BF2BCEC2 LDA $C2CE2B,X (Pull palette ID from table in C2 for sprite X)
XX/0022: 6B RTL
Then you just have to call this instead of simply calling the battle palette data from the table.
Replace:
Code:
C1/3E20: BF2BCEC2 LDA $C2CE2B,X (Pull palette ID from table in C2 for sprite X)
with this:
Code:
C1/3E20: 22XXXXXX JSR $XXXXXX (Where $XX/XXXX is the location of the code we just entered)
That's all there is to it. You can set as many conditionals as you want, based on any data in the RAM, create a separate table for your characters to look from, or statically set each one with only minor changes to the code. If anyone wants a specific condition, let me know, but I would encourage you to try tweaking the code first yourself.
It's good to be ASM-ing again.