Final Fantasy IV Research & Development / Re: Chillyfeez's Mods, hacks, research notes, etc.
« on: April 10, 2016, 01:55:05 PM »This is kind of a "User Options" sort of mod.
This allows you to scroll through all of the available (individual) targets in battle by pressing Y.
I developed this because I am working on a boss battle that involves seven different "Special" size monsters, which are scattered all over the screen. Since there isn't a natural formation that accommodates this particular arrangement of monsters, it's kind of hard sometimes to target a specific monster on the field. So I devised this mod so that the player can simply hit Y to scroll through available targets. Each Y press moves the target selection up by 1, instead of relying on using the D-Pad to move the cursor to where the game thinks the next monster should be. I was thinking this might come in handy for any battle that has a large number of monsters, but especially for a situation like mine.
If you want to use this assembly, by the way, bear in mind that for my purposes I used some free space realized by creating a new (shorter than what it was replacing) song. So inserting the bulk of this assembly where I did will likely cause problems, but you shouldn't have too hard a time finding a place to absorb the 53 bytes in question.
$02/B086 20 FC FF JSR $FFFC [$02:FFFC] ;Normally this says "JSR $AE27" which is the routine that looks for D-Pad input
$02/FFFC 5C BD 80 08 JMP $0880BD[$08:80BD] ;Jump to custom assembly. NOTE: BY DEFAULT THERE IS MUSIC DATA AT 880BD. I have a custom song there, so this is empty space for me, but you shouldn't have too hard a time finding 53 free bytes somewhere, and as this is a long jump, it can be anywhere at all.
$08/80BD A5 38 LDA $38 [$00:0038] ;Load "Controller Input 2" (up/down/left/right/select/start/Y/B)
$08/80BF 85 1C STA $1C [$00:001C] ;Store into 1C (probably not needed as a matter of fact)
$08/80C1 C9 40 CMP #$40 ;Compare with 40 (Y pressed without any other buttons)
$08/80C3 F0 04 BEQ $04 [$80C9] ;If Y is being pressed (by itself) then skip the next op
$08/80C5 5C 27 AE 02 JMP $02AE27[$02:AE27] ;Jump to regular D-Pad input routine
$08/80C9 AD 8D EF LDA $EF8D [$7E:EF8D] ;Load currently highlighted target (which can be 00-07 for monsters, 08-0C for characters, FF for all monsters or 0D for all characters)
$08/80CC 1A INC A ;Increase value by 1
$08/80CD C9 0D CMP #$0D ;Is the adjusted value 0D?
$08/80CF 90 01 BCC $01 [$80D2] ;If less than 0D, skip the next op
$08/80D1 7B TDC ;Transfer direct page (essentially, load 00 into A)
$08/80D2 8D 8D EF STA $EF8D [$7E:EF8D] ;store new value into Current Target
$08/80D5 C9 08 CMP #$08 ;Is the value 08 or higher?
$08/80D7 90 0F BCC $0F [$80E8] ;If not, skip to 80E8
$08/80D9 38 SEC
$08/80DA E9 08 SBC #$08 ;Subtract 8
$08/80DC AA TAX ;Transfer A to X
$08/80DD BD C5 29 LDA $29C5,x[$7E:29C5]
$08/80E0 C9 FF CMP #$FF ;Is there a targetable character in that slot?
$08/80E2 F0 E5 BEQ $E5 [$80C9] ;If not, jump back up to the beginning of the routine to try again
$08/80E4 5C F1 AE 02 JMP $02AEF1[$02:AEF1] ;Jump to the end of the D-Pad input routine (RTS)
$08/80E8 AA TAX ;Transfer A to X
$08/80E9 BD 23 F1 LDA $F123,x[$7E:F123]
$08/80EC C9 FF CMP #$FF ;Is there a targetable monster in that slot?
$08/80EE F0 D9 BEQ $D9 [$80C9] ;If not, jump back up to the beginning of the routine to try again
$08/80F0 80 F2 BRA $F2 [$80E4] ;Jump to the end of the D-Pad input routine (RTS)
And then there's this, which makes pressing the Y button make a sound (cuz it seemed weird for it to do something but not make noise)
$02/B90C 29 4F AND #$4F ;Normally, this says "AND #$0F" thus only making a sound for a D-Pad button, this change makes it so Y returns true as wellEnjoy!
We have EVEN MORE themes now, but some old ones are gone...