Users browsing this thread: 3 Guest(s)
Excluding Weapons from Use With Genji Glove
08-24-2018, 06:23 PM
(This post was last modified: 08-25-2018, 09:35 PM by PowerPanda.)
Thank you for replying, Madsiur, but after 2 days of messing around with it, I GOT IT! The trick was that the list item was no longer in the Y accumulator at the point where I was trying to do my check. I needed to store the value earlier on in the code, then check against it later. So, I scrolled up in the code to where it stores the item class for the list item to $F6, then added another 8-byte chunk that stored the value for the "Dual Wield" flag to $F7. Once I had that value safely stored away, I was able to change the accumulator to the equipped item, do all the normal checks, and then check the dual wield flag of the equipped item against $F7.
I have tried this with every combination I can think of, and it seems to be working as intended. I have also tested this with the Gauntlet, and both effects work in tandem with one another. Now, to dig into the Optimize routine and the C2 re-equip. Semi-final code is as follows. Note that due to Novalia Spirit's optimization, I was able to make all of these additions and still save 13 bytes.
I have tried this with every combination I can think of, and it seems to be working as intended. I have also tested this with the Gauntlet, and both effects work in tandem with one another. Now, to dig into the Optimize routine and the C2 re-equip. Semi-final code is as follows. Note that due to Novalia Spirit's optimization, I was able to make all of these additions and still save 13 bytes.
Code:
;Determine if gear list entry is disabled
C3/9A56: 5A PHY ...
C3/9A57: AA TAX Gear List Slot
C3/9A58: BF 8A 9D 7E LDA $7E9D8A,X Inventory Slot
C3/9A5C: AA TAX Index it
C3/9A5D: BD 69 18 LDA $1869,X Item in slot
C3/9A60: 20 21 83 JSR $8321 Compute Index
C3/9A63: AE 34 21 LDX $2134 Load it
C3/9A66: BF 00 50 D8 LDA $D85000,X Get Item Properties 00
C3/9A6A: 29 07 AND #$07 Get Class
C3/9A6C: 85 F6 STA $F6 Save it to F6
C3/9A6E BF 13 50 D8 LDA $D85013,X Get Item Properties 13
C3/9A72 29 04 AND #$04 Check Dual Wield Flag
C3/9A74 85 F7 STA $F7 Save it to F7
C3/9A76: 7A PLY ...
C3/9A77: A5 5F LDA $5F Check Slot
C3/9A79: C9 02 CMP #$02 Head or Body?
C3/9A7B: B0 55 BCS $9AD2 If so, jump to 9AD2
C3/9A7D: C9 01 CMP #$01 L-Hand/Relic 2?
C3/9A7F: F0 05 BEQ $9A86 if no, branch to R-Hand
;Fork: For L-Hand
C3/9A81: B9 20 00 LDA $0020,Y Check Left Hand's Item
C3/9A84: 80 03 BRA $C39A81 skip next line
;Fork: For R-Hand
C3/9A86: B9 1E 00 LDA $001E,Y Check Right Hand's Item
C3/9A89: C9 FF CMP #$FF is it empty?
C3/9A8B: F0 23 BEQ $9AC3 if so, jump to $9AB0 (enable)
C3/9A8D: 20 21 83 JSR $8321 compute index
C3/9A90: AE 34 21 LDX $2134 load it
C3/9A93: BF 00 50 D8 LDA $D85000,X Check properties
C3/9A97: 29 07 AND #$07 Get Class
C3/9A99: C9 03 CMP #$03 Is it a Shield?
C3/9A9B: F0 28 BEQ $9AC5 if so, branch to duplicate check
; Genji Glove/Dual Wield check
C3/9A9D: AD D8 11 LDA $11D8 Check character properties
C3/9AA0: 29 10 AND #$10 check for "allow weapon in each hand"
C3/9AA2: F0 21 BEQ $9AC5 If not, branch to duplicate check
C3/9AA4: BF 13 50 D8 LDA $D85013,X Check Weapon Properties
C3/9AA8: 29 04 AND #$04 Is Dual Wield enabled?
C3/9AAA: F0 19 BEQ $9AC5 If not, branch to duplicate check
C3/9AAC: C5 F7 CMP $F7 Is Dual Wield enabled on list item?
C3/9AAE: D0 15 BNE $9AC5 If not, branch to duplicate check
C3/9AB0: 38 SEC allow item
C3/9AB1: 60 RTS end
C3/9AB2-9AC4 EA NOP ($13 bytes)
;Fork: Duplicate Check
C3/9AC5: BF 00 50 D8 LDA $D85000,X Load item in hand
C3/9AC9: 29 07 AND #$07 get item class
C3/9ACB: C5 F6 CMP $F6 is it the same as the list item?
C3/9ACD: F0 02 BEQ $9AD1 if so, branch to $9AD1 (deny)
C3/9ACF: 38 SEC allow item
C3/9AD0: 60 RTS end
C3/9AD1: 18 SEC deny item
C3/9AD2: 60 RTS end
Projects:
FFVI: Divergent Paths (Completed) - a complete storyline and gameplay hack of FF6 that adds Leo as a playable character
The following 3 users say Thank You to PowerPanda for this post:
• madsiur (08-24-2018), Robo Jesus (05-20-2019), Warrax (08-25-2018)
• madsiur (08-24-2018), Robo Jesus (05-20-2019), Warrax (08-25-2018)
« Next Oldest | Next Newest »
Users browsing this thread: 3 Guest(s)