Users browsing this thread: 1 Guest(s)
How do spells decide which intro to play?

#1
Posts: 377
Threads: 34
Thanks Received: 10
Thanks Given: 7
Joined: Dec 2018
Reputation: 18
Status
Moog
As you know, FF6 has five casting intros: Black, White/Effect, Lore, Blitz, and Swordtech.
But... I can't figure out how the game determines which one to use.  Is it strictly based on which command calls it?  Is it by spell index?  I couldn't find references to the intros in Banks C1 or C2.

It's always bothered me that Effect magic and White magic had the same intro.  I'm looking to set Effect magic to use Lore's intro instead, if such a thing is possible.
  Find
Quote  

#2
Posts: 179
Threads: 3
Thanks Received: 24
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
The spell index determines which intro animation is used. It's set up so that it can only choose from 3 intros (black, white/effect, summon) but you could modify it to make different intros for white and effect magic. Here is the subroutine that handles this. I also put the animation pointer table at the bottom. Strangely, they seem to have included the lore intro in this table ($0FB2), though I don't think it ever gets used. Lore, Blitz, SwdTech, and Rage intros are handled elsewhere.

Code:
C1/AB9F: A0 02 00     LDY #$0002
C1/ABA2: 7B           TDC
C1/ABA3: AA           TAX
C1/ABA4: B1 76        LDA ($76),Y     ; attack number
C1/ABA6: C9 18        CMP #$18
C1/ABA8: 90 11        BCC $ABBB       ; branch if black magic (X = 0)
C1/ABAA: E8           INX
C1/ABAB: E8           INX
C1/ABAC: C9 36        CMP #$36
C1/ABAE: 90 0B        BCC $ABBB       ; branch if white or effect magic (X = 2)
C1/ABB0: E8           INX
C1/ABB1: E8           INX
C1/ABB2: C9 51        CMP #$51
C1/ABB4: 90 05        BCC $ABBB       ; branch if esper (X = 4)
C1/ABB6: 9C C0 62     STZ $62C0       ; don't ignore block graphics
C1/ABB9: 80 2C        BRA $ABE7
C1/ABBB: EE C0 62     INC $62C0       ; ignore block graphics
C1/ABBE: C2 20        REP #$20
C1/ABC0: BF 8E 91 C1  LDA $C1918E,X   ; +$1E = pointer to pre-attack animation data (+$D07FB2)
C1/ABC4: 85 1E        STA $1E
C1/ABC6: 7B           TDC
C1/ABC7: E2 20        SEP #$20
C1/ABC9: 20 B3 9C     JSR $9CB3       ; init battle animation data
C1/ABCC: 20 5B AC     JSR $AC5B       ; execute battle animation
C1/ABCF: 20 89 BC     JSR $BC89       ; get attacker number
C1/ABD2: A5 10        LDA $10
C1/ABD4: 30 0B        BMI $ABE1       ; branch if monster
C1/ABD6: 29 03        AND #$03
C1/ABD8: AA           TAX
C1/ABD9: AD A4 62     LDA $62A4       ;
C1/ABDC: D0 03        BNE $ABE1
C1/ABDE: FE AE 61     INC $61AE,X
C1/ABE1: 9C C0 62     STZ $62C0       ; don't ignore block graphics
C1/ABE4: 20 43 AB     JSR $AB43       ; init single thread animation
C1/ABE7: 20 8B AB     JSR $AB8B       ; reset attacker graphical action
C1/ABEA: 60           RTS

; pointers to pre-attack animation data (black magic, white/effect magic, esper, lore, +$D07FB2)
C1/918E:              .DW $0F88, $0F96, $0FA4, $0FB2
  Find
Quote  
[-] The following 3 users say Thank You to Everything for this post:
  • C-Dude (01-15-2019), madsiur (01-15-2019), Warrax (01-16-2019)

#3
Posts: 377
Threads: 34
Thanks Received: 10
Thanks Given: 7
Joined: Dec 2018
Reputation: 18
Status
Moog
Okay...

So, there are 24 attack magic spells, 21 effect magic spells, 9 healing magic spells, and 27 esper spells, indexed in that order.

That means the branches are marked by the end of the black magic list...
Code:
C1/ABA6: C9 18        CMP #$18
The last black magic index is h17, or rather spell 23.

...the end of the white magic list...
Code:
C1/ABAC: C9 36        CMP #$36
The last white magic index is h35, or rather spell 53

...and then the end of the espers list...
Code:
C1/ABB2: C9 51        CMP #$51
The last esper magic index is h50, or rather spell 80

So...
That would mean, I could technically make a quick and dirty change to get the spell list to do mostly what I want.
If I change this line:
Code:
C1/ABAC: C9 36        CMP #$36  ;Replace C9 36 with C9 2D
Then Effect spells would use what the game has marked as the White Magic intro, and Healing spells would share what the game has marked as the Summon intro.  Then I could just shuffle the animations around in FF3usme.
Which solves a lot of problems, but introduces a few one.  Firstly, white magic wouldn't trigger blocking shields (which isn't a problem for me, but might be for other modders).  Second, summons would start with the white magic intro... which just replaces the previous problem with a new one, albeit a less frequent one.

...I wish I understood branches better.  I thought the command was skipping lines, but that would mean
Code:
C1/ABAE: 90 0B        BCC $ABBB       ; branch if white or effect magic (X = 2)
redirects to
Code:
C1/ABC6: 7B           TDC
Which doesn't make sense to me... shouldn't it point to the same spot the Black Magic branch does, since they're skipping over the ignore defense segment?
EDIT: Oh, it's skipping BITS, not lines!  They do point to the same place.  Neat, I learned something!

Anyway, I'm going to try it.  Even if it means White magic shares its intro with Summon magic, it'll still be nice to have the three different spell types have different starts.  Thank you.

EDIT EDIT: Just tried it and it works! Awesome.
Additionally, changing the Summon Cutoff to the end of the White Magic List ensures that they don't share the same intro.
Code:
C1/ABB2: C9 51        CMP #$51  ;Replace C9 51 with C9 36
The Espers just appear instead, which is actually pretty slick.
  Find
Quote  

#4
Posts: 377
Threads: 34
Thanks Received: 10
Thanks Given: 7
Joined: Dec 2018
Reputation: 18
Status
Moog
Okay, I'm running into another problem which is tangential to the one solved earlier in this discussion, but not different enough to warrant a separate thread.  Apologies in advance if this sort of redirect is frowned upon; I'm trying to be efficient with my threads here.

Following the question on splitting the intro animation by spell type, I've gone down the rabbit hole of changing the indexes of the three spell types.  My goal?  To give each 18 spells, instead of the 24/21/9 split they have now.

I can't use MMMMMagic, though, because I don't need extra spells and I DO need spell learning from items, both of which that patch changes.  Also, I can't figure out where to put it in my patching order, so it makes things explode at the moment.


Righty, on to the problems I'm encountering.

Angry  First, spell sorting.  I've changed the spells manually in FF3usme to adjust the indices, so Spell 17 (h11) is the last Black Magic spell and Spell 18 is the first Effect Magic spell.
There's relevant hex to this in bank C2:
Code:
(Generate Lore menus based on known Lores, and generate Magic menus based on spells
 known by ANY character.  C2/568D will eliminate unknown spells and modify costs as
 needed, on a per character basis.)

C2/5551: 08           PHP
C2/5552: A2 1A        LDX #$1A
C2/5554: 9E BA 30     STZ $30BA,X    (set "position of spell" for every Esper to 0,
                                      because the 1-entry Esper menu is always at
                                      Position 0, just before the Magic menu.)
C2/5557: CA           DEX
C2/5558: 10 FA        BPL $5554      (iterate for all 27 Espers)
C2/555A: A9 FF        LDA #$FF
C2/555C: A2 35        LDX #$35
C2/555E: 9D A0 11     STA $11A0,X    (null out a temporary list)
C2/5561: CA           DEX
C2/5562: 10 FA        BPL $555E      (which has 54 entries)
C2/5564: A0 17        LDY #$17       (there are 24 possible known Lores)
C2/5566: A2 02        LDX #$02
C2/5568: 7B           TDC
C2/5569: 38           SEC
C2/556A: 6A           ROR
C2/556B: 90 02        BCC $556F      (have we looped a multiple of 8 times yet?)
C2/556D: 6A           ROR
C2/556E: CA           DEX            (if we're on our 9th/17th, set Bit 7 and repeat
                                      the process again.)
C2/556F: 3C 29 1D     BIT $1D29,X    (is current Lore known?)
C2/5572: F0 10        BEQ $5584      (branch if not)
C2/5574: EE 87 3A     INC $3A87      (increment number of known Lores)
C2/5577: 48           PHA
C2/5578: 98           TYA            (A = Lore ID)
C2/5579: 69 37        ADC #$37       (turn it into a position relative to Esper menu,
                                      which immediately precedes the Magic menu.)
C2/557B: 99 0F 31     STA $310F,Y    (save to "list of positions of each lore")
C2/557E: 69 54        ADC #$54       (so now we've converted our 0-23 Lore ID into a
                                      raw spell ID, as Condemned [8Bh] is the first
                                      Lore.)
C2/5580: 99 6A 30     STA $306A,Y    (save spell ID to "list of known Lores")
C2/5583: 68           PLA
C2/5584: 88           DEY
C2/5585: 10 E3        BPL $556A      (iterate 24 times, going through the Lores in
                                      reverse order)
C2/5587: A2 06        LDX #$06
C2/5589: BD D8 3E     LDA $3ED8,X    (get current character)
C2/558C: C9 0C        CMP #$0C
C2/558E: B0 1E        BCS $55AE      (branch if it's Gogo or Umaro or temporary
                                      chars)
C2/5590: EB           XBA
C2/5591: A9 36        LDA #$36
C2/5593: 20 81 47     JSR $4781      (16-bit A = 54 * character ID)
C2/5596: C2 21        REP #$21
C2/5598: 69 6E 1A     ADC #$1A6E
C2/559B: F0           STA $F0        (save address to list of spells this character
                                      knows and doesn't know)
C2/559D: E2 20        SEP #$20
C2/559F: A0 35        LDY #$35
C2/55A1: B1 F0        LDA ($F0),Y    (what % of spell is known)
C2/55A3: C9 FF        CMP #$FF       (does this character know the current spell?)
C2/55A5: D0 04        BNE $55AB      (branch if not)
C2/55A7: 98           TYA
C2/55A8: 99 34 30     STA $3034,Y    (if they do, set this entry in our "spells known
                                      by any character" list to the spell ID/position)
                                     (can be seen as a "list of positions by spell ID"
                                      or a "list of spell IDs by position".  C2/55BA,
                                      55DA, and 55DB treat it as former.  C2/55F0 loop
                                      will transform it to latter.)
C2/55AB: 88           DEY            (go to next spell)
C2/55AC: 10 F3        BPL $55A1      (loop 54 times, through this list of character's
                                      known/unknown spells)
C2/55AE: CA           DEX
C2/55AF: CA           DEX
C2/55B0: 10 D7        BPL $5589      (loop for all 4 characters in party)
C2/55B2: AD 54 1D     LDA $1D54      (info from Config screen)
                                     (Bit 7 = Controller: 0 = Single, 1 = Multiple
                                      Bit 6 = ???
                                      Bits 3-5 = Window Color adjustment cursor:
                                        000b = Font, 001b = 1st Window component,
                                        010b = 2nd Window component, 011b = 3rd ' ' ,
                                        100b = 4th ' ' , 101b = 5th ' ' ,
                                        110b = 6th ' ' , 111b = 6th ' '
                                      Bits 0-2 = Magic Order:
                                        000b = Healing, Attack, Effect (HAE) ,
                                        001b = HEA , 010b = AEH, 011b = AHE ,
                                        100b = EHA , 101b = EAH )
C2/55B5: 29 07        AND #$07       (isolate Magic Order)
C2/55B7: AA           TAX
C2/55B8: A0 35        LDY #$35
C2/55BA: B9 34 30     LDA $3034,Y    (get original zero-based position of spell)
C2/55BD: C9 18        CMP #$18       (compare to 24.  if it's 0-23, it's Attack
                                      magic [Black].)                                          [I think I need to change this to h12, to represent the first 18 spells]
C2/55BF: B0 06        BCS $55C7      (branch if it's 24 or higher)
C2/55C1: 7F 4B 57 C2  ADC $C2574B,X  (add spell position to amount to adjust Attack
                                      spells' positioning based on current
                                      Magic Order)
C2/55C5: 80 12        BRA $55D9
C2/55C7: C9 2D        CMP #$2D       (compare to 45.  if it's 24-44, it's Effect
                                      magic [Gray].)                                         [I think I need to change this to h24, to represent the first 36 spells]
C2/55C9: B0 06        BCS $55D1      (branch if it's 45 or higher)
C2/55CB: 7F 51 57 C2  ADC $C25751,X  (add spell position to amount to adjust Effect
                                      spells' positioning based on current
                                      Magic Order)
C2/55CF: 80 08        BRA $55D9
C2/55D1: C9 36        CMP #$36       (compare to 54.  if it's 45-53, it's Healing
                                      magic [White].)                                         [This can stay]
C2/55D3: B0 0B        BCS $55E0      (branch if it's 54 or higher, which means it's
                                      not learned, or not a Magic spell at all.)
C2/55D5: 7F 57 57 C2  ADC $C25757,X  (add spell position to amount to adjust Healing
                                      spells' positioning based on current
                                      Magic Order)
C2/55D9: DA           PHX            (preserve Magic Order value)
C2/55DA: AA           TAX            (X = position of spell in menu)
C2/55DB: 98           TYA            (A = spell ID)
C2/55DC: 9D A0 11     STA $11A0,X    (save to our new, reordered list of "spells
                                      known by any character")
C2/55DF: FA           PLX            (get Magic Order)
C2/55E0: 88           DEY
C2/55E1: 10 D7        BPL $55BA      (loop for all 54 spell IDs)
C2/55E3: A9 FF        LDA #$FF
C2/55E5: A2 35        LDX #$35
C2/55E7: 9D 34 30     STA $3034,X
C2/55EA: CA           DEX
C2/55EB: 10 FA        BPL $55E7      (null out the Magic portion of our other temporary
                                      list)
C2/55ED: 7B           TDC
C2/55EE: AA           TAX
C2/55EF: A8           TAY
C2/55F0: BD A0 11     LDA $11A0,X
C2/55F3: 1A           INC
C2/55F4: D0 0C        BNE $5602
C2/55F6: BD A1 11     LDA $11A1,X
C2/55F9: 1A           INC
C2/55FA: D0 06        BNE $5602
C2/55FC: BD A2 11     LDA $11A2,X
C2/55FF: 1A           INC
C2/5600: F0 15        BEQ $5617      (if these three consecutive entries in spell list were
                                      all null, skip copying all three to other list.  but
                                      if any have a spell, then copy all three.  this was
                                      designed to skip one row at a time in FF6j so a given
                                      spell would always stay in the same column, but the
                                      list was changed to 2 columns in FF3us without this
                                      code being adjusted, so the list winds up hard to
                                      follow.)
C2/5602: BD A0 11     LDA $11A0,X
C2/5605: 99 34 30     STA $3034,Y    (copy 1st spell ID from one list to another)
C2/5608: BD A1 11     LDA $11A1,X
C2/560B: 99 35 30     STA $3035,Y    (copy 2nd spell ID from one list to another)
C2/560E: BD A2 11     LDA $11A2,X
C2/5611: 99 36 30     STA $3036,Y    (copy 3rd spell ID from one list to another)
C2/5614: C8           INY
C2/5615: C8           INY
C2/5616: C8           INY
C2/5617: E8           INX
C2/5618: E8           INX
C2/5619: E8           INX
C2/561A: E0 36        CPX #$36
C2/561C: 90 D2        BCC $55F0      (iterate 18 times, or cover 54 spell entries)
C2/561E: A2 35        LDX #$35
C2/5620: BD 34 30     LDA $3034,X    (get entry from our reordered, condensed list
                                      of "spells known by any character")
C2/5623: C9 FF        CMP #$FF
C2/5625: F0 06        BEQ $562D      (branch if null)
C2/5627: A8           TAY            (Y = spell ID)
C2/5628: 8A           TXA            (A = position in list)
C2/5629: 1A           INC            (now make it 1-based, because position 0 will
                                      correspond to an equipped Esper.)
C2/562A: 99 84 30     STA $3084,Y    (save to "list of positions of each spell")
C2/562D: CA           DEX
C2/562E: 10 F0        BPL $5620      (iterate 54 times)
C2/5630: C2 10        REP #$10
C2/5632: A2 4D 00     LDX #$004D     (77.  78 = 54 Magic spells + 24 Lores.)
C2/5635: 7B           TDC
C2/5636: BD 34 30     LDA $3034,X    (get spell ID)
C2/5639: C9 FF        CMP #$FF
C2/563B: F0 4B        BEQ $5688      (branch to next slot if null)
C2/563D: 48           PHA            (save spell ID)
C2/563E: A8           TAY
C2/563F: B9 84 30     LDA $3084,Y    (get position of spell relative to Esper menu)
C2/5642: C2 20        REP #$20
C2/5644: 0A           ASL
C2/5645: 0A           ASL            (there's 4 bytes per spell entry)
C2/5646: E2 20        SEP #$20
C2/5648: A8           TAY            (offset relative to Esper menu)
C2/5649: A3 01        LDA $01,S      (get spell ID)
C2/564B: C9 8B        CMP #$8B       (are we at least at Condemned, the first lore?)
C2/564D: 90 02        BCC $5651      (branch if not)
C2/564F: E9 8B        SBC #$8B       (if we are, turn it into a 0-23 Lore ID, rather
                                      than a raw spell ID)
C2/5651: 99 8E 20     STA $208E,Y    (output spell or Lore ID to 1st character's menu,
                                      Byte 1 of 4 for this slot)
C2/5654: 99 CA 21     STA $21CA,Y    (' ' 2nd character's menu)
C2/5657: 99 06 23     STA $2306,Y    (' ' 3rd character's menu)
C2/565A: 99 42 24     STA $2442,Y    (' ' 4th character's menu)
C2/565D: 68           PLA            (get spell ID)
C2/565E: 20 23 57     JSR $5723      (from spell data, put aiming byte in bottom half
                                      of A, and MP cost in top half)
C2/5661: 99 90 20     STA $2090,Y    (save aiming byte in 1st character's menu, Byte
                                      3 of 4 for this slot)
C2/5664: 99 CC 21     STA $21CC,Y    (' ' 2nd character's menu)
C2/5667: 99 08 23     STA $2308,Y    (' ' 3rd character's menu)
C2/566A: 99 44 24     STA $2444,Y    (' ' 4th character's menu)
C2/566D: EB           XBA            (get MP cost)
C2/566E: E0 44 00     CPX #$0044     (are we pointing at Step Mine's menu slot?)
C2/5671: D0 09        BNE $567C      (branch if not)
C2/5673: AD 64 18     LDA $1864      (minutes portion of time played, from when main
                                      menu was last visited.  or seconds remaining,
                                      if we're in a timed area.)
C2/5676: C9 1E        CMP #$1E       (set Carry if >= 30 minutes)
C2/5678: AD 63 18     LDA $1863      (hours portion of time played, from when main
                                      menu was last visited.  or minutes remaining,
                                      if we're in a timed area.)
C2/567B: 2A           ROL            (MP Cost = [hours * 2] + [minutes DIV 30] or
                                      unintended [minutes remaining * 2] +
                                      [seconds remaining DIV 30])
C2/567C: 99 91 20     STA $2091,Y    (save MP cost in 1st character's menu, Byte
                                      4 of 4 for this slot)
C2/567F: 99 CD 21     STA $21CD,Y    (' ' 2nd character's menu)
C2/5682: 99 09 23     STA $2309,Y    (' ' 3rd character's menu)
C2/5685: 99 45 24     STA $2445,Y    (' ' 4th character's menu)
C2/5688: CA           DEX
C2/5689: 10 AA        BPL $5635      (iterate 78 times, for all Magic and Lore menu
                                      slots)
C2/568B: 28           PLP
C2/568C: 60           RTS


[AND]

(For Spells 0 - 23 : Attack, Black)
C2/574B: 09  (Healing, Attack, Effect (HAE))
C2/574C: 1E  (Healing, Effect, Attack (HEA))
C2/574D: 00  (Attack, Effect, Healing (AEH))
C2/574E: 00  (Attack, Healing, Effect (AHE))
C2/574F: 1E  (Effect, Healing, Attack (EHA))
C2/5750: 15  (Effect, Attack, Healing (EAH))

(For Spells 24 - 44 : Effect, Gray)
C2/5751: 09  (Healing, Attack, Effect (HAE))
C2/5752: F1  (Healing, Effect, Attack (HEA))  [Move back hF?  That's 15 spots...  ...Why?]
C2/5753: 00  (Attack, Effect, Healing (AEH))
C2/5754: 09  (Attack, Healing, Effect (AHE))
C2/5755: E8  (Effect, Healing, Attack (EHA))  [Move back h18?  That's 24 spots...  That's the black magic count, that makes sense.]
C2/5756: E8  (Effect, Attack, Healing (EAH))  [Move back h18?]

(For Spells 45 - 53 : White, Healing)
C2/5757: D3  (Healing, Attack, Effect (HAE))  [Move back h2D? That's... 45 spots!  Okay, that's both black and effect count.]
C2/5758: D3  (Healing, Effect, Attack (HEA))
C2/5759: 00  (Attack, Effect, Healing (AEH))
C2/575A: EB  (Attack, Healing, Effect (AHE))  [Move back h15? That's 21 slots... the effect magic count.  That makes sense.]
C2/575B: E8  (Effect, Healing, Attack (EHA))  [Move back h18?  24 slots, so it puts it before attack magic.]
C2/575C: 00  (Effect, Attack, Healing (EAH)) 

[I need to change these to 12s, 24s, EEs, and DCs... but what's with C2/5752?]

Of that, the lines I've tried changing are:
Code:
C2/55BD: C9 12        CMP #$18       (compare to 24.  if it's 0-17, it's Attack
                                      magic [Black].)                                          [Changed this to h12, to represent the first 18 spells]
C2/55BF: B0 06        BCS $55C7      (branch if it's 18 or higher)  [Now 18 or higher]

C2/55C7: C9 24        CMP #$2D       (compare to 36.  if it's 18-35, it's Effect
                                      magic [Gray].)                                         [Changed this to h24, to represent the first 36 spells]
C2/55C9: B0 06        BCS $55D1      (branch if it's 36 or higher) [Now 36 or higher]

C2/55D1: C9 36        CMP #$36       (compare to 54.  if it's 36-53, it's Healing
                                      magic [White].)                                         [Unchanged]
C2/55D3: B0 0B        BCS $55E0      (branch if it's 54 or higher, which means it's
                                      not learned, or not a Magic spell at all.)

[Okay, so I'm reworking the lists so that each is exactly 18 spells long.  The shifts are going to change accordingly.]
(For Spells 0 - ...17? : Attack, Black)              [Defaults to the first set]
C2/574B: 12  (Healing, Attack, Effect (HAE))  [Move forward h12, or 18 spells so Attack comes after Healing.]
C2/574C: 24  (Healing, Effect, Attack (HEA))  [Move forward h24, or 36 spells so Attack comes after Healing and Effect]
C2/574D: 00  (Attack, Effect, Healing (AEH))  [Don't move Attack]
C2/574E: 00  (Attack, Healing, Effect (AHE))  [Don't move Attack]
C2/574F: 24  (Effect, Healing, Attack (EHA))  [Move forward h24, or 36 spells so Attack comes after Healing and Effect]
C2/5750: 12  (Effect, Attack, Healing (EAH))  [Move forward h12, or 18 spells so Attack comes after the first set.]

(For Spells 18?? - 35?? : Effect, Gray)            [Defaults to the second set]
C2/5751: 12  (Healing, Attack, Effect (HAE))  [Move forward h12, or 18 spells so Effect comes after the second set.]
C2/5752: 00  (Healing, Effect, Attack (HEA))  [Something tells me Effect shouldn't move at all in this case.]
C2/5753: 00  (Attack, Effect, Healing (AEH))  [Default]
C2/5754: 12  (Attack, Healing, Effect (AHE))  [Move forward h12, so Effect comes after the second set.]
C2/5755: EE  (Effect, Healing, Attack (EHA))  [Move back h12, so Effect ends up first.]
C2/5756: EE  (Effect, Attack, Healing (EAH))  [Move back h12]

(For Spells 36?? - 53 : White, Healing)           [Defaults to the third set]
C2/5757: DC  (Healing, Attack, Effect (HAE))  [Move back h24? That's 36 slots.  So Healing is moving back 36 slots, Effect is moving forward 18, and Attack 18.]
C2/5758: DC  (Healing, Effect, Attack (HEA))  [Healing moves back h24.  Attack moves forward h24.]
C2/5759: 00  (Attack, Effect, Healing (AEH))  [Default]
C2/575A: EE  (Attack, Healing, Effect (AHE))  [Move back h12.]
C2/575B: EE  (Effect, Healing, Attack (EHA))  [Move back h12.]
C2/575C: 00  (Effect, Attack, Healing (EAH))  [Default]
But... as far as I can tell, those changes do nothing.  My first 6 Effect spells (18-23, formerly Black spells) still sort with Black magic, and my first 9 White spells (36-44, formerly Effect spells) still sort with Effect magic.
I've searched the entire rom in a hex editor, and haven't found any other checks for spell ID for this purpose.  There were a few C918s (if checking for spells, this would have been a black magic index check) for other purposes and one C92D (if checking for spells, this would have been a gray magic index check), but the only C936 in the ENTIRE ROM was in this spell/lore list gathering section.  So I can't figure out how the heck the game decides where the black magic, gray magic, and white magic sorting takes place, since the place the documentation states doesn't affect it.

Surprised The second and perhaps most interesting problem I encountered was with menu casting.  While FF3usme certainly allows me to set which spells can be cast outside of combat, what those spells do appears to be hardcoded to the spell slot.
Who are the culprits?  Warp, Imp, the Cure spells, Antidote, Remedy, and the Life spells.
What happens?  Well, if a spell is marked as usable from the menu, but located in a slot that was formerly not usable, then it can't be cast.  Attempting to do so will simply cause a 'bzzt', blocking the cast and achieving nothing.  If a spell is marked as usable and is in a slot formerly occupied by a different spell, then when cast from the menu... it casts the other spell!
For instance, what was formerly Cure1 was changed Life1 when I manually changed the spell slots.  However, when cast from the menu, it heals as if Cure 1 and does not restrict casting on living targets (I didn't try it on dead targets, but I bet it doesn't work).
I couldn't find anything checking for the specific spell to cast from a menu in the available documentation, though disassemblies I've found seem focused on the drawing aspect of menus, rather than controlling what happens within.

Kappa! The third and final problem I'm encountering is that changing the indices of certain spells has catastrophic effects on their function.
Imp has a hard-coded check for graying out all but one spell:
Code:
(Set Carry if spell should be disabled due to unavailability, or because
 caster is an Imp and the spell isn't Imp.  If none of these factors
 disable the spell, check the MP cost.)

C2/57AA: BD 00 00     LDA $0000,X    (get spell # from menu)
C2/57AD: 30 0A        BMI $57B9      (branch if undefined)
C2/57AF: EB           XBA
C2/57B0: A5 EF        LDA $EF
C2/57B2: 10 07        BPL $57BB      (branch if character not an Imp)
C2/57B4: EB           XBA
C2/57B5: C9 23        CMP #$23                                    [New Imp spell is h17]
C2/57B7: F0 02        BEQ $57BB      (branch if spell is Imp)
C2/57B9: 38           SEC            (spell will be unavailable)
C2/57BA: 60           RTS
which is easy enough to fix by changing C2/57B5.
Likewise, Life3's effect actually calls for a cast of Life1, meaning if you put a different spell in Life1's spot, it'll cast that instead!
For me, that spell was Drain.  I know there's probably something fun that could be done with that, like making a death cast Demi or something.
Again, there's a specific call for that problem that's easily fixed:
Code:
(Prepare Life 3 revival)

C2/0799: 29 FB        AND #$FB
C2/079B: 9D F9 3E     STA $3EF9,X    (clear Life 3 status)
C2/079E: BD 19 30     LDA $3019,X
C2/07A1: 1C 2F 2F     TRB $2F2F      (remove from bitfield of remaining enemies?)
C2/07A4: A9 30        LDA #$30       (Life spell ID)                    [Life is now spell 45, or 2D]  [Change to A92D]  [Life2 is spell 46, or 2E]  [Make Life2?]
C2/07A6: 85 B8        STA $B8
C2/07A8: A9 26        LDA #$26       (command #$26)
C2/07AA: 4C 91 4E     JMP $4E91      (queue it, in global Special Action queue)
By changing C2/07A4, I can change which spell the Life3 status will trigger when called.  Again, an easy fix.
However...
There's one spell that refuses to play nice, and that spell is Quick.
If the Quick special effect is assigned to any other spell slot than its default, it does nothing.  I had the corresponding ??? flag for Quick checked; didn't make a difference.  And, unlike the other situations described above, there are no checks for Quick's default spell ID as far as I can find.


So... has anybody else run into problems like these?  Are there any good ways to fix them, or effectively hide them from the player?
  Find
Quote  

#5
Posts: 179
Threads: 3
Thanks Received: 24
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
Have you looked at bank C3 at all? That's where all the menu code is. There is an excellent disassembly from Novalia Spirit available on RHDN. I'd recommend searching banks C1 and C3 for references to $1D54, and then focus on instances that follow with AND #$07. That's where the menu setting for the magic order is stored in RAM.

There's a table at C3/4F49 that you will need to change. There is also code at C3/2C14 and C3/514D that will need to be modified with your new spell indices.

I'm surprised your changes to spell sorting didn't work in the battle menu. It looks like you've changed the right thing. I'm also surprised that Quick doesn't work. I don't see anything else to change other than what you've already done.
  Find
Quote  
[-] The following 1 user says Thank You to Everything for this post:
  • C-Dude (01-19-2019)

#6
Posts: 377
Threads: 34
Thanks Received: 10
Thanks Given: 7
Joined: Dec 2018
Reputation: 18
Status
Moog
(01-18-2019, 11:13 PM)Everything Wrote: Have you looked at bank C3 at all? That's where all the menu code is. There is an excellent disassembly from Novalia Spirit available on RHDN. I'd recommend searching banks C1 and C3 for references to $1D54, and then focus on instances that follow with AND #$07. That's where the menu setting for the magic order is stored in RAM.

There's a table at C3/4F49 that you will need to change. There is also code at C3/2C14 and C3/514D that will need to be modified with your new spell indices.

I'm surprised your changes to spell sorting didn't work in the battle menu. It looks like you've changed the right thing. I'm also surprised that Quick doesn't work. I don't see anything else to change other than what you've already done.

Maybe the C3 file I found is out of date.  I looked up "Novalia Spirit" on RHDN and downloaded the collection, which had a BUNCH of files in it (as opposed to the one file for C3 I had before), so I'm guessing that was the case.

I've mostly been searching for comments, instead of specific bits of code.  I'll look through this new C3 repository I just downloaded and see if I can figure out what I'm missing.

Yeah, the code changes I made in the previous post didn't impact battle sorting at all.  I wonder if it's just for Gogo, or if the menu settings are overriding them.
Thanks for the heads up on where to look; I'll edit this post if I figure out what I'm doing wrong.

EDIT: Ooh, this is promising... I bet this is the culprit.  Thanks for the address, I'm going to fiddle with this for a while.
Code:
Starting spell for each Magic type, sorted based on Mag.Order
C3/4F49:    2D 00 18 FF    ; 1: Cure, Fire, Scan  [24 00 12?]
C3/4F4D:    2D 18 00 FF    ; 2: Cure, Scan, Fire
C3/4F51:    00 18 2D FF    ; 3: Fire, Scan, Cure
C3/4F55:    00 2D 18 FF    ; 4: Fire, Cure, Scan
C3/4F59:    18 2D 00 FF    ; 5: Scan, Cure, Fire
C3/4F5D:    18 00 2D FF    ; 6: Scan, Fire, Cure
EDIT!: Yay!  This and the block that comes after it fixes the sorting, both in menu and in battle.  Strange that the one in with battle commands doesn't seem to contribute.

Still need to sort out menu casting issues, Quick, and now Imp (I just tried, and even though it's not grayed out, it won't cast when in the wrong slot...).  Going to see what I can find in these new documents.
EDIT: AHA! Imp was hiding another hard-coded call in the battle loop.  Sneaky.  C2/3217.  All that's left is fixing Quick... Scratch that, I'm a goof.  My spell test file didn't have the property set.
You solved all the problems, Everything.  You rule!
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite