Users browsing this thread: 1 Guest(s)
Usable Magic for all Characters
author: B-Run
Apply to FF3us
Download
This patch gives every character a usable magic list to pull from, as well as allows each character to learn magic via espers/equipment. All of the magic lists are shared with the first twelve actors (Terra and Co.). On the flipside, I overwrote Gogo's magic code in order to create this patch, meaning Gogo no longer learns everyone's magic.
Actors above 0B will share the magic lists with one of the other characters. Notable actors who can now learn Magic:
-Gogo shares a magic list and learning with Terra.
-Umaro shares a magic list and learning with Locke.
-Bannon shares a magic list and learning with Cyan.
-Leo shares a magic list and learning with Shadow.
-Wedge shares a magic list and learning with Relm.
-Vicks shares a magic list and learning with Setzer.
-Kefka shares a magic list and learning with Sabin, Celes, Strago, Relm, or Setzer (depending on which instance of Kefka is used).
Note: This patch does not add magic to each actors menu, you must do that yourself with an editor. This patch also does not allow all actors to be reequipped. This is only for magic lists.
Here are the changes in the code:
Now for how it gets used.
Thanks to Madsiur for help finding and understanding code and Angelo26 for the disassemblies of the Battle and Menu banks and pointing me to a patch maker!
Feel free to use this in your own hacks, simply give credit where credit is due. Please contact me if you find any bugs. Hope this helps!
Apply to FF3us
Download
This patch gives every character a usable magic list to pull from, as well as allows each character to learn magic via espers/equipment. All of the magic lists are shared with the first twelve actors (Terra and Co.). On the flipside, I overwrote Gogo's magic code in order to create this patch, meaning Gogo no longer learns everyone's magic.
Actors above 0B will share the magic lists with one of the other characters. Notable actors who can now learn Magic:
-Gogo shares a magic list and learning with Terra.
-Umaro shares a magic list and learning with Locke.
-Bannon shares a magic list and learning with Cyan.
-Leo shares a magic list and learning with Shadow.
-Wedge shares a magic list and learning with Relm.
-Vicks shares a magic list and learning with Setzer.
-Kefka shares a magic list and learning with Sabin, Celes, Strago, Relm, or Setzer (depending on which instance of Kefka is used).
Note: This patch does not add magic to each actors menu, you must do that yourself with an editor. This patch also does not allow all actors to be reequipped. This is only for magic lists.
Here are the changes in the code:
Code:
This is where the magic happens, literally. This is where Gogo's magic population used to occur.
C3/50C4: C90C CMP #$0C
C3/50C6: 9006 BCC $50CE (branch if less than #$0C)
C3/50C8: E90C SBC #$0C (else, subtract #$0C)
C3/50CA: C90C CMP #$0C
C3/50CC: B0FA BCS $50C8 (if still greater than #$0C, subtract again)
C3/50CE: 60 RTS
This is the subroutine when called from the C2 bank.
C3/50CF: C90C CMP #$0C
C3/50D1: 9006 BCC $50D9 (branch if less than #$0C)
C3/50D3: E90C SBC #$0C (else, subtract #$0C)
C3/50D5: C90C CMP #$0C
C3/50D7: B0FA BCS $50D3 (if still greater than #$0C, subtract again)
C3/50D9: 6B RTS
C3/50DA: EA NOP (Filling out the rest of Gogo's old magic block)
...
C3/50EB: EA NOP
Now for how it gets used.
Code:
Determine if a character actually knows magic [MENU]
C3/0D2B: AD691A LDA $1A69 (from C3/0CB7)
C3/0D2E: 0D6A1A ORA $1A6A
C3/0D31: 0D6B1A ORA $1A6B
C3/0D34: 0D6C1A ORA $1A6C
C3/0D37: D027 BNE $0D60 (branch if you have at least one esper)
C3/0D39: A667 LDX $67
C3/0D3B: 7B TDC
C3/0D3C: BD0000 LDA $0000,X (character ID)
C3/0D3F: 20C450 JSR $50C4 (Reduce character ID)
C3/0D42: EA NOP
C3/0D43: EA NOP
C3/0D44: EA NOP
C3/0D45: 8D0242 STA $4202 (reduced actor ID as multiplier A)
C3/0D48: A936 LDA #$36
C3/0D4A: 8D0342 STA $4203 (#$36 as multiplier B)
C3/0D4D: A03600 LDY #$0036 (TAY?)
C3/0D50: AE1642 LDX $4216 (load character * spell total)
C3/0D53: BD6E1A LDA $1A6E,X (load spell at X)
C3/0D56: C9FF CMP #$FF (learned it?)
C3/0D58: F006 BEQ $0D63 (branch if so)
C3/0D5A: E8 INX
C3/0D5B: 88 DEY
C3/0D5C: D0F5 BNE $0D56 (branch if we haven't checked every spell)
C3/0D5E: 18 CLC (used by C3/0C6C, says that this character doesn't know magic)
C3/0D5F: 60 RTS
C3/0D60: 38 SEC (flag MP as ok to display)
C3/0D61: 60 RTS
C3/0D62: EA NOP
C3/0D63: EA NOP
C3/0D64: EA NOP
Code:
Get spell's learned amount [MENU]
C3/50A2: 85E0 STA $E0
C3/50A4: 20DD4E JSR $4EDD
C3/50A7: B90000 LDA $0000,Y
C3/50AA: 20C450 JSR $50C4 (Reduce character ID)
C3/50AD: 8D0242 STA $4202
C3/50B0: A936 LDA #$36
C3/50B2: 8D0342 STA $4203
C3/50B5: 7B TDC
C3/50B6: A5E0 LDA $E0
C3/50B8: C220 REP #$20 (16 bit memory/accum.)
C3/50BA: 6D1642 ADC $4216
C3/50BD: AA TAX
C3/50BE: E220 SEP #$20 (8 bit memory/accum.)
C3/50C0: BD6E1A LDA $1A6E,X
C3/50C3: 60 RTS
Code:
Relevant code for looking up magic [BATTLE]
C2/56C9: BD D8 3E LDA $3ED8,X (character ID)
C2/56CC: 22CF50C3 JSR $C3/50CF (reduce character ID)
C2/56D0: C8 INY
C2/56D1: C8 INY (Y = 2)
C2/56D2: EA NOP
C2/56D3: EA NOP
C2/56D4: C8 INY
C2/56D5: C8 INY (Y = 4)
C2/56D6: EB XBA
C2/56D7: A9 36 LDA #$36
C2/56D9: 20 81 47 JSR $4781
C2/56DC: C2 21 REP #$21 (Set 16-bit A, clear Carry)
C2/56DE: 69 6E 1A ADC #$1A6E
C2/56E1: 85 F0 STA $F0
Code:
Learning Magic [BATTLE]
C2/5E59: B9 D8 3E LDA $3ED8,Y (Which character it is)
C2/5E5C: 22CF50C3 JSR $C3/50CF(reduce character ID)
C2/5E60: 20 83 62 JSR $6283 (Stores address for spells known by character in $F4)
C2/5E63: BE 10 30 LDX $3010,Y (get offset to character info block)
C2/5E66: 5A PHY
C2/5E67: 20 EF 5F JSR $5FEF (Cursed Shield check)
C2/5E6A: BD 1E 16 LDA $161E,X (Esper equipped)
C2/5E6D: 30 03 BMI $5E72 (Branch if no esper equipped)
C2/5E6F: 20 2A 60 JSR $602A (Learn spells taught by esper)
C2/5E72: 7A PLY
C2/5E73: 88 DEY
C2/5E74: 88 DEY
C2/5E75: 10 9C BPL $5E13 (Check next character)
Code:
Populating battle magic list
C2/5589: BD D8 3E LDA $3ED8,X (Character ID)
C2/558C: 22 CF 50 C3 JSR $C3/50CF (Reduce character ID)
C2/5590: EB XBA
C2/5591: A9 36 LDA #$36
C2/5593: 20 81 47 JSR $4781
C2/5596: C2 21 REP #$21
C2/5598: 69 6E ADC #$6E
C2/559A: 1A INC
C2/559B: F0 STA $F0 (Characters magic list address)
Thanks to Madsiur for help finding and understanding code and Angelo26 for the disassemblies of the Battle and Menu banks and pointing me to a patch maker!
Feel free to use this in your own hacks, simply give credit where credit is due. Please contact me if you find any bugs. Hope this helps!
07-14-2012, 09:49 PM
can you make a patch for a headered rom?
seeing as how most patches use headered roms, this might conflict with many other patches
seeing as how most patches use headered roms, this might conflict with many other patches
"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
(07-14-2012, 09:49 PM)Poco Loco Wrote: can you make a patch for a headered rom?
seeing as how most patches use headered roms, this might conflict with many other patches
Well it won'T conflict with other patches but with the game itself if it's apply to a headered ROM, but worst thing the person who wants to apply this patch can remove the header, apply the patch and put a new header after. How many people work with headered ROM? I thought many people were finding headers a pain because you always have to calculate +200 bytes whatever you do. I always keep the header but in the end it's a personal preference.
07-15-2012, 12:20 PM
very true
"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
07-16-2012, 11:10 AM
updated with headered verision.
I can see this being useful in a class system where you use up all those unused actors and give each class different stats. You could put each character's classes every 12 (or change the SBC to reduce down to whatever number of characters you want), that way your magic could carry over from class to class.
example 1:
0-B: base class
C-18: White Mage
19-24: Black Mage
25-30: Fighter
31-3C: Black Belt
etc...
example 2 (for only 4 characters (FF5 style):
0-3: Base Class
4-7: White Mage
5-B: Black Mage
C-F: Fighter
16-19: Black Belt
etc...
Using fewer actual characters obviously affords you more jobs to use. It wouldn't be too hard to put make spells for sale rather than learned by espers, that way we could separate who learns them and with what class. It might even be possible to chop up Magic into Bl.Magic and Wh.Magic and Rd.Magic (gray).
The next step would be to make things like swdtech/blitz/lore available by level/bit/other, in a way that allows multiple people to have different amounts of each ability, that way you don't need to use SRAM for anything other than level of that particular class for each character. Then just apply gogo's menu selection and you have a fully functioning class system...
Unfortunately, that's not the direction I'm going with my patch, but just some food for thought for anyone else. It wouldn't be that difficult.
I can see this being useful in a class system where you use up all those unused actors and give each class different stats. You could put each character's classes every 12 (or change the SBC to reduce down to whatever number of characters you want), that way your magic could carry over from class to class.
example 1:
0-B: base class
C-18: White Mage
19-24: Black Mage
25-30: Fighter
31-3C: Black Belt
etc...
example 2 (for only 4 characters (FF5 style):
0-3: Base Class
4-7: White Mage
5-B: Black Mage
C-F: Fighter
16-19: Black Belt
etc...
Using fewer actual characters obviously affords you more jobs to use. It wouldn't be too hard to put make spells for sale rather than learned by espers, that way we could separate who learns them and with what class. It might even be possible to chop up Magic into Bl.Magic and Wh.Magic and Rd.Magic (gray).
The next step would be to make things like swdtech/blitz/lore available by level/bit/other, in a way that allows multiple people to have different amounts of each ability, that way you don't need to use SRAM for anything other than level of that particular class for each character. Then just apply gogo's menu selection and you have a fully functioning class system...
Unfortunately, that's not the direction I'm going with my patch, but just some food for thought for anyone else. It wouldn't be that difficult.
07-28-2012, 02:05 PM
Found a bug where Magic only correctly displays when the original actor is a part of the battle as well. As in, if actor 02 and actor 0E are in the battle together, they will both have magic list 02. If actor 0E is in battle and 02 isn't there, no magic will be displayed. Magic learning still works after battle, and magic from the menu will still work regardless... its just in battle that the problem happens. Also, if 0E has an esper equipped (thus activating the Magic menu) but actor 02 isn't around, the Magic menu will be blank. There's something wrong with the way the list is populated, but still trying to track down exactly where it's happening. I will post updated patches once I find a solution.
08-03-2012, 03:51 PM
Fixed. After a couple weeks of off-and-on searching, downloading a debugger (super useful) and searching all over the dissasemblies for C0, C1, C2, and C3... it was all one tiny little place that uses ADC to get to the magic starting address instead of outright loading it.
On the plus-side... i learned a TON about how magic works in the game. Apparently the magic list for battle is stored for each character in the battle, including the players equipped esper, their magic list, and a lore list (per character). All of the lists get populated with all magic that is known by anyone in the battle (I'm guessing this is since Gogo doesn't learn his own). Then the game goes back and blanks out the spells that are NOT known by each character, leaving them with their individual lists. Crazy stuff. Here's a neat little table:
Anyway, the updated patches are up for anyone who wants them.
Code:
C2/5589: BD D8 3E LDA $3ED8,X
C2/558C: 22 CF 50 C3 JSR $C3/50CF***
C2/5590: EB XBA
C2/5591: A9 36 LDA #$36
C2/5593: 20 81 47 JSR $4781
C2/5596: C2 21 REP #$21
C2/5598: 69 6E ADC #$6E
C2/559A: 1A INC
C2/559B: F0 STA $F0
*** - My changes
On the plus-side... i learned a TON about how magic works in the game. Apparently the magic list for battle is stored for each character in the battle, including the players equipped esper, their magic list, and a lore list (per character). All of the lists get populated with all magic that is known by anyone in the battle (I'm guessing this is since Gogo doesn't learn his own). Then the game goes back and blanks out the spells that are NOT known by each character, leaving them with their individual lists. Crazy stuff. Here's a neat little table:
Code:
Battle Magic Data
$208E - battle magic list 1
$21CA - battle magic list 2
$2306 - battle magic list 3
$2442 - battle magic list 4
spell offsets (4 bytes each)
$0 - Esper
$1-$36 - Magic list
$37-$4E - Lore list
spell bytes
1-Spell-ID
2-Unknown [related to spell availability]
3-Targetting
4-Spell-MP cost
Anyway, the updated patches are up for anyone who wants them.
11-26-2014, 04:20 PM
Can you have the new actors with magic list populate from specific other characters? It appears like changing some of the code you can at the very least move the list, but I am not sure if what I am trying to do is possible with a few simple changes.
What I would want to do, if possible, is to have Bannon's magic populate from Relm, and Leo populate from Celes.
Would this be time extensive and annoying to accomplish, or would it just be a few simple changes?
Btw, this really is an awesome IPS!
What I would want to do, if possible, is to have Bannon's magic populate from Relm, and Leo populate from Celes.
Would this be time extensive and annoying to accomplish, or would it just be a few simple changes?
Btw, this really is an awesome IPS!
11-26-2014, 07:28 PM
(This post was last modified: 11-26-2014, 07:29 PM by GrayShadows.)
Hmm. It should be pretty simple, actually -- you just need to code an exception in before it SBCs. So, like:
There's not enough code to repeat this in the next iteration of the code, but that can be gotten around by calling this from C2 instead:
Unless I've miscounted, that should leave you enough space to add three exceptions in the existing space -- these two and one more. Any more than that and you'd have to move the code somewhere else with more available space.
ETA: And just to note, while I've left the original disasm addresses in the code I C&P'd from the original patch, obviously the addresses of any code /after/ the bits I inserted would be changed, thus the RTS originally at $50CE no longer being at $50CE, etc.
Code:
C3/50C4: C90C CMP #$0C
C3/50C6: 9006 BCC $50CE (branch if less than #$0C)
CMP [Banon ID]
BNE NextCharCheck
LDA [Relm ID]
BRA [RTS at end of code snippet - $50CE in original patch code]
NextCharCheck:
CMP [Leo ID]
BNE RestOfCode
LDA [Celes ID]
BRA [RTS at end of code snippet - $50CE in original patch code]
RestOfCode:
C3/50C8: E90C SBC #$0C (else, subtract #$0C)
C3/50CA: C90C CMP #$0C
C3/50CC: B0FA BCS $50C8 (if still greater than #$0C, subtract again)
C3/50CE: 60 RTS
There's not enough code to repeat this in the next iteration of the code, but that can be gotten around by calling this from C2 instead:
Code:
C3/50E8 20C450 JSR $50C4
C3/50EB 6B RTS
Unless I've miscounted, that should leave you enough space to add three exceptions in the existing space -- these two and one more. Any more than that and you'd have to move the code somewhere else with more available space.
ETA: And just to note, while I've left the original disasm addresses in the code I C&P'd from the original patch, obviously the addresses of any code /after/ the bits I inserted would be changed, thus the RTS originally at $50CE no longer being at $50CE, etc.
11-27-2014, 06:23 AM
This is very nice! Now I'm gonna try to work on a small hack that makes Leo and Banon into partially full party members using this and the Guest Adder!
If you ever feel useless, just remember that Umaro has an MP stat.
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)