FF6 Hacking
Break items for any ability - Printable Version

+- FF6 Hacking (https://www.ff6hacking.com/forums)
+-- Forum: Hacks, Resources and Tutorials (https://www.ff6hacking.com/forums/forum-1.html)
+--- Forum: Jidoor Auction House (https://www.ff6hacking.com/forums/forum-4.html)
+---- Forum: Patches, Bugfixes, Tweaks (https://www.ff6hacking.com/forums/forum-15.html)
+---- Thread: Break items for any ability (/thread-3754.html)



Break items for any ability - Subtraction - 10-01-2018

Normally, the game uses 6 bits to determine what ability an item breaks for (or a weapon procs for). The two most significant bits are used to determine if the weapon procs and if the item is removed from inventory when used. With 6 bits, items can break/proc for magic and some of the esper summons.

This code instead uses two unused bits in the weapon properties byte (0x04 and 0x08) for those flags, allowing the whole byte to be used for the break/proc ability. Items can break for Blow Fish, Bum Rush, Fallen One, Sneeze, you name it.

While the breaks all seem to work, some abilities don't behave properly when procced. In particular, Blitzes and Swdtechs play the wrong animation (somewhere the offset of Pummel is getting added to the animation id, so it plays the animation for Net or whatever). Bio Blast, Flash, Chocobop, H-Bomb, and 7-Flush all played garbled animations. But all of these work fine as breaks.


Code:
hirom

org $C229ED
JSL copy_proc_info
NOP
NOP

org $C23658
LDA $3A7E       ; load spell number

org $C22735
JSL copy_break_info

org $C22743
BMI load_spell_number

org $C2274A
load_spell_number:
LDA $3410        ; load spell number

org $C3F091     ; arbitrary free space
copy_proc_info:
LDA $3BA4,X     ; load weapon properties
AND #$0C        ; get proc, remove from inventory flags
ASL
ASL
ASL
ASL             ; shift them to position the rest of the code expects
STA $3A89       ; store in normal place
LDA $3D34,X     ; load spell number
STA $3A7E       ; store it
RTL

copy_break_info:
PHP             ; need to save carry flag
LDA $D85012,X
STA $3410       ; store spell number
LDA $D85013,X
ASL
ASL
ASL
ASL             ; shift them to position the rest of the code expects
PLP             ; restore carry flag
AND #$C0        ; get proc, remove from inventory flags. This happens after the shift and PLP so that the N flag is set correctly for C2/2743
RTL



RE: Break items for any ability - PowerPanda - 10-01-2018

Not sure how this works, but I've been looking for code that allows Tools to break when used. Could I use this code for that purpose?


RE: Break items for any ability - Subtraction - 10-01-2018

This code won't help you with that, unless you want the tools to do something other than magic or the first few esper summons when they break.

But is making tools breakable not just a matter of setting the usable-in-battle bit? At any rate, Beyond Chaos makes tools breakable (sometimes), so it's a solved problem.


RE: Break items for any ability - PowerPanda - 10-01-2018

It's not a high priority. It won't make v.1, and I haven't even scoped it yet. I was just trying to understand the purpose of what you posted.