øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1210.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index5db9-3.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&board=8.260e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index5db9-3.html.zx:'h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈà•¤<úOKtext/htmlISO-8859-1gzip@øÕ<úÿÿÿÿÿÿÿÿWed, 11 Mar 2020 00:04:34 GMT0ó°° ®0®P®€§²ð®9'h^ÿÿÿÿÿÿÿÿz!<ú Change the moogle suit graphic & palette?

Author Topic: Change the moogle suit graphic & palette?  (Read 4145 times)

Tzepish

  • Siren
  • *
  • Posts: 71
  • Gender: Male
    • View Profile
Change the moogle suit graphic & palette?
« on: September 08, 2009, 01:08:09 AM »
The moogle suit changes the wearer's graphic and palette to the moogle...  does anyone know how it does this?  Is it possible to point it to a different graphic/palette?  Is it possible to add this feature to a different item?

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Change the moogle suit graphic & palette?
« Reply #1 on: September 08, 2009, 01:24:04 AM »
That code is here:

Code: [Select]
C2/2872: A5 C9        LDA $C9 ($11C9)
C2/2874: C9 9F        CMP #$9F          (Moogle Suit in character's Armor slot?)
C2/2876: D0 0B        BNE $2883         (if not, branch)
C2/2878: 8A           TXA
C2/2879: 0A           ASL
C2/287A: 0A           ASL
C2/287B: 0A           ASL
C2/287C: 0A           ASL
C2/287D: A8           TAY
C2/287E: A9 0A        LDA #$0A
C2/2880: 99 AE 2E     STA $2EAE,Y       (Use Mog's sprite?)

There's nothing here about palette, and I'm not sure where that is. :hmm:

119 bugs fixed and counting.

Tzepish

  • Siren
  • *
  • Posts: 71
  • Gender: Male
    • View Profile
Re: Change the moogle suit graphic & palette?
« Reply #2 on: September 08, 2009, 02:05:54 AM »
I wonder if it's the same as the crazy, apparently hard-coded load screen / party formation screen palettes...

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Change the moogle suit graphic & palette?
« Reply #3 on: November 05, 2010, 02:10:17 PM »
I've got an idea from this post, I'd like to edit four pieces of armor that will allow some characters to become General Leo, Kefka, the imperial soldier and a ghost in battle (namely changing their battle sprites).

From the code,

Code: [Select]
C2/2872: A5 C9        LDA $C9 ($11C9)
C2/2874: C9 9F        CMP #$9F          (Moogle Suit in character's Armor slot?)
C2/2876: D0 0B        BNE $2883         (if not, branch)
C2/2878: 8A           TXA
C2/2879: 0A           ASL
C2/287A: 0A           ASL
C2/287B: 0A           ASL
C2/287C: 0A           ASL
C2/287D: A8           TAY
C2/287E: A9 0A        LDA #$0A
C2/2880: 99 AE 2E     STA $2EAE,Y       (Use Mog's sprite?)

I've tried to add the code in another part of the ROM (since I think there's no room for additional code) like this:

Code: [Select]
A5 C9        LDA $C9 ($11C9)
C9 9E        CMP #$9E          (Chocobo Suit in character's Armor slot?)
D0 0B        BNE $2883         (if not, branch)
8A           TXA
0A           ASL
0A           ASL
0A           ASL
0A           ASL
A8           TAY
A9 0E        LDA #$0E
99 AE 2E     STA $2EAE,Y       (Use Soldier's sprite)

But it didn't work for me. Any suggestions on how can I make this work?
« Last Edit: November 05, 2010, 04:33:01 PM by angelo26 »

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Change the moogle suit graphic & palette?
« Reply #4 on: November 05, 2010, 02:25:45 PM »
You changed the comment, but you didn't change what piece of armor to look for. You're still checking for the Moogle Suit.

119 bugs fixed and counting.

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Change the moogle suit graphic & palette?
« Reply #5 on: November 05, 2010, 02:35:41 PM »
I see what you mean. But I actually tested the code for it to look for Chocobo Suit yesterday, which should be 9E, and it worked perfectly.

But my idea is to have the game check for 4 pieces of equipment, including the moogle suit.

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Change the moogle suit graphic & palette?
« Reply #6 on: November 05, 2010, 03:45:52 PM »
Well, you obviously can't do that with just one CMP, so you need to insert a hook for that code to check multiple pieces of equipment.

119 bugs fixed and counting.

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Change the moogle suit graphic & palette?
« Reply #7 on: November 06, 2010, 11:41:11 AM »
If I include multiple CMP's, then I would need to include multiple LDA's and Multiple STA's as well, right?

How would I go into telling the game "Look for data supposed to be in the C2 bank somewhere else in the rom"? Is that with pointers?

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Change the moogle suit graphic & palette?
« Reply #8 on: November 06, 2010, 03:42:17 PM »
If I include multiple CMP's, then I would need to include multiple LDA's and Multiple STA's as well, right?
If you're smart about it, you only need the one STA. You will never need more than one LDA, since you're loading from the same address every time anyway.

Quote
How would I go into telling the game "Look for data supposed to be in the C2 bank somewhere else in the rom"?
This is not data, this is code. You should read up on some tutorials, or just try experimenting.

Quote
Is that with pointers?
No, it's a JSR, or a JMP, or maybe even if a BRL, if you're brave.

119 bugs fixed and counting.

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Change the moogle suit graphic & palette?
« Reply #9 on: November 11, 2010, 02:58:56 PM »
Ok I think I've figured out how to do this, please correct me if I'm wrong.

I need to use JSR so the game will read extra code that I've written in another address, for example, F0 0E 00. Then I will need a RTS to return to the C2 Bank?

I'm thinking the code should look like this:
Code: [Select]
C2/2872: A5 C9        LDA $C9 ($11C9)
C2/2874: 00 0E F0    JSR  $F00E           
NOP all code from C2/2877 TO C2/2880
C2/2882: ??              RTS (Guessing 60 goes here)? (NOT SURE)

Then in the F0 Bank:

C9 9D        CMP #$9D         
D0 0B        BNE $2883         (if not, branch)
8A             TXA
0A             ASL
0A             ASL
0A             ASL
0A             ASL
A8             TAY
A9 0D        LDA #$0D
99 AE 2E     STA $2EAE,Y     

C9 9E        CMP #$9E          (Chocobo Suit in character's Armor slot?)
D0 0B        BNE $2883         (if not, branch)
8A             TXA
0A             ASL
0A             ASL
0A             ASL
0A             ASL
A8             TAY
A9 0E        LDA #$0E
99 AE 2E     STA $2EAE,Y


C9 9F        CMP #$9F          (Moogle Suit in character's Armor slot?)
D0 0B        BNE $2883         (if not, branch)
8A             TXA
0A             ASL
0A             ASL
0A             ASL
0A             ASL
A8             TAY
A9 0F        LDA #$0F
99 AE 2E     STA $2EAE,Y

C9 A0        CMP #$A0         
D0 0B        BNE $2883         (if not, branch)
8A             TXA
0A             ASL
0A             ASL
0A             ASL
0A             ASL
A8             TAY
A9 10        LDA #$10
99 AE 2E     STA $2EAE,Y


The RTS needs to be at the end of the added code in the F0 bank, or does it need to be in the C2 bank as I wrote it?

Thanks for the help Lenophis!

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Change the moogle suit graphic & palette?
« Reply #10 on: November 11, 2010, 04:15:43 PM »
You don't need to go to bank F0, but you can if you want. There should still be some free space in C2 to do what you want. That said, your JSR is not changing banks, so you're actually going here:
Code: [Select]
C2/F00E: 60      RTS

C2/F00F: A903    LDA #$03
C2/F011: 8526    STA $26
C2/F013: A903    LDA #$03
C2/F015: 20F8F4  JSR $F4F8
C2/F018: A904    LDA #$04
C2/F01A: 20E6F6  JSR $F6E6
C2/F01D: 4CEBF9  JMP $F9EB
Which is not good. If you want to change banks, you need the JSL instruction. JSL also needs an RTL so the stack doesn't get thrown out of whack, too. But if you decide to stick to C2, JSR/RTS will work.

Quote
The RTS needs to be at the end of the added code in the F0 bank, or does it need to be in the C2 bank as I wrote it?
It needs to be at the end of your new code, wherever it is.

Quote
I'm thinking the code should look like this:
That looks correct, and it should work.

119 bugs fixed and counting.

angelo26

  • Guard Leader
  • *
  • Posts: 44
    • View Profile
Re: Change the moogle suit graphic & palette?
« Reply #11 on: November 14, 2010, 10:20:13 PM »
Thanks Lenophis! I got it working (FINALLY!!) with a JSL and RTL.


So it means that with a JSR and RTS I can only jump to code in the same bank, right? and if I use JSL I can  jump to code in any address in the ROM, right?

I first thought that when since I need to specify the exact address in the rom for the JSL (like F0 10 00), then RTL would need the address to return to (C2/2A??), but I looked at some code in the C2 bank and I only had to put 6B to return to the C2 bank from the F0 bank. Any idea why is it that way?

Thanks a lot again  :laugh:

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Change the moogle suit graphic & palette?
« Reply #12 on: November 15, 2010, 07:09:07 AM »
So it means that with a JSR and RTS I can only jump to code in the same bank, right? and if I use JSL I can  jump to code in any address in the ROM, right?
You catch on fast. :wink:

Quote
I first thought that when since I need to specify the exact address in the rom for the JSL (like F0 10 00), then RTL would need the address to return to (C2/2A??), but I looked at some code in the C2 bank and I only had to put 6B to return to the C2 bank from the F0 bank. Any idea why is it that way?
The JSR and JSL instructions will push the return address to the stack, and RTS and RTL will pull those addresses from the stack. RTS pulls two bytes, and RTL pulls three. Likewise, JSR pushes 2, and JSL pushes 3. JSL includes the bank, which is why it can go anywhere, while JSR is restricted to the bank it is currently in.

119 bugs fixed and counting.