Users browsing this thread: 1 Guest(s)
Conditional Battle Palettes

#1
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
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.
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.
  Find
Quote  
[-] The following 1 user says Thank You to B-Run for this post:
  • Gi Nattak (05-30-2013)

#2
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Woo-hoo! Thank you very much Edrin! I will be trying this out tonight. =)

One other place I wanted a sprite battle palette change, would be for Edgar in the battle with the tentacles in the WoR, so he would remain in his 'Gerad' palette for the battle then afterwords switched back to his original one. Seems like using this code but for Edgar and using different event bits would work for that as well eh?


We are born, live, die and then do the same thing over again.
Quote  

#3
Posts: 831
Threads: 41
Thanks Received: 16
Thanks Given: 12
Joined: Nov 2009
Reputation: 18
Status
None
I would assume it would be trickier for edgar...on second thought, no...as long as you find an event bit related an event with Gerad in it, it should be fine and adding a couple more lines of code.

Great job, Edrin :p
Quote  

#4
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
updated for Kefka and Gerad.
  Find
Quote  
[-] The following 1 user says Thank You to B-Run for this post:
  • Gi Nattak (05-31-2013)

#5
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
I finally got around to testing this out in my hack, and I realize I must have forgotten to say that I need Kefka to be on palette 1 and Gerad palette 4. >_< I see it has them using the same palette here for the conditional. I hope there is an easy tweak to the code that can be done to have it like that instead? I tried adding an A901 under the 'is this kefka' line, but it still read the palette code after it which I changed to A904 for Gerad. If it matters any, Kefka's palette change happens before Gerads.

Besides that it works like a charm!


We are born, live, die and then do the same thing over again.
Quote  

#6
Posts: 2,769
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
nice job

that'll be really interesting especially with kefka man hell yeah its gonna be great


"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  

#7
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
Fixed, I just did it by logic, I didn't plug it back in and test but it should work. If not let me know.
  Find
Quote  
[-] The following 1 user says Thank You to B-Run for this post:
  • Gi Nattak (06-29-2013)

#8
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Works perfect, thank you very much sir! =)

I notice one little thing here to edit you may have forgotten to change:
XX/0018: A901 LDA #$04 (Set palette ID to 01)

Should be listed as A904 (Set palette ID to 04)
Thanks to the correct LDA #$04 though I was able to tell right away XD


We are born, live, die and then do the same thing over again.
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite