Users browsing this thread: 16 Guest(s)
Breakable Tools - Need Help
07-05-2021, 02:36 PM
(This post was last modified: 07-05-2021, 02:38 PM by PowerPanda.)
Divergent Paths has been out for several weeks now, and ther is one pretty big bug that is affecting the game, having to do with the breakable Tools asm that Subtraction helpfully coded for me. Gi Nattak figured out a way to reproduce it, and I have been able to refine that method, but I can't figure out how to fix it. Here is the ASM Code:
Here is the bug, and how to reproduce it:
1. Before the battle, sort your inventory. This step isn't necessary, but it makes it easier to find the glitched items in step 3.
2. You must use Tools 12 times. It doesn't matter if the Tool is a breakable one or not, but if a Tool breaks, it doesn't count towards the 12 count. So, your best bet is to use the Debilitator. It also doesn't matter whether Edgar or Gogo is the one that uses Tools, so bring Gogo along to make this go faster.
3. After using the Debilitator 12 times, you will still have the Debilitator, but you will also have 1-2 glitched items in your inventory. We've seen this be either "Dirk: 01" or "Cat Hood: 96, Scimitar: ,6". These items will be lit up as if you can use them as an item. If you get the Scimitar, it will also be classified as a "Tool", and will show up in your Tool menu. Basically, garbage items.
4. At this point, use any Tool. Regardless of whether it breaks or not, it will be deducted from your inventory. This includes the unbreakable tools (Debilitator and Air Anchor), which cannot be obtained again in the game.
5. Finish the battle. The glitched items will still be in your inventory.
The bug, as far as I can tell, is in the section of code labeled "no_break", since it doesn't occur when the Tool breaks. In fact, a Tool breaking most often doesn't count towards the 12 uses, but sometimes it actually resets the 12 count. I looked through the code, and thought that issue might be that the "SEP #$20", setting the X/Y accumulators back to 8-bit, never occurs on the "no_break" branch. I tried adding that into the "no_break" section of code, both at the beginning and the end, but it did not seem to affect this issue.
Any insight would be immensely helpful. I did not intend to ever do a Divergent Paths v1.1, but this bug is big enough that it's necessary.
Code:
check_command:
CMP #$09
BEQ check_command_end
CMP #$01
BEQ check_command_end
CMP #$08
check_command_end:
RTS
org $C1710F
JSL check_command
NOP
NOP
NOP
org $C21887
JSR check_break
NOP
org $C24DA7
JSR check_command_c2
NOP
NOP
NOP
org $C26490 ; freespace
check_command_c2:
CMP #$09
BEQ check_command_c2_end
CMP #$01
BEQ check_command_c2_end
CMP #$08
check_command_c2_end:
RTS
check_break:
PHA
PHP
JSR $2B63 ; Multiply A by 30, size of item data block
REP #$10 ; Set 16-bit X and Y
TAX
LDA $D85012,X ; equipment spell byte. Bit 7: 1 = remove from inventory upon usage, 0 = nope
BPL no_break ; if the flag is not set, this tool never breaks
JSR $4B5A
AND #$2A ; 1/42 chance of breaking
BNE no_break
LDA #$08
BIT $3EBB ; Check bit 4 of $3EBB (loaded from 1DD0 at the beginning of battle).
BNE no_break ; If set, tools can't be broken (set via event with B8 3B. Clear with B9 3B)
LDA #$44 ; "Orge Nix broke!" dialog. Works for most tools but gets clobbered by the Air Anchor "Move and you're dust!"
STA $3401
SEP #$10 ; Set 8-bit X and Y
TYX
LDA #$FF
STA $32F4,X ; null item index to add to inventory. This means the item will stay deducted from your inventory.
LDA $3018,X
BRA check_break_end
no_break:
LDA #$10
TSB $B1 ; set flag to re-add item to inventory at the end of the character's turn
check_break_end:
TSB $3A8C ; flag character to have any applicable item in $32F4,X added back to inventory when turn is over.
PLP
PLA
SBC #$A2 ; carry was clear, so subtract 163
STA $B6 ; save unique Tool index. 0 = NoiseBlaster, 1 = Bio Blaster, etc.
RTS
Here is the bug, and how to reproduce it:
1. Before the battle, sort your inventory. This step isn't necessary, but it makes it easier to find the glitched items in step 3.
2. You must use Tools 12 times. It doesn't matter if the Tool is a breakable one or not, but if a Tool breaks, it doesn't count towards the 12 count. So, your best bet is to use the Debilitator. It also doesn't matter whether Edgar or Gogo is the one that uses Tools, so bring Gogo along to make this go faster.
3. After using the Debilitator 12 times, you will still have the Debilitator, but you will also have 1-2 glitched items in your inventory. We've seen this be either "Dirk: 01" or "Cat Hood: 96, Scimitar: ,6". These items will be lit up as if you can use them as an item. If you get the Scimitar, it will also be classified as a "Tool", and will show up in your Tool menu. Basically, garbage items.
4. At this point, use any Tool. Regardless of whether it breaks or not, it will be deducted from your inventory. This includes the unbreakable tools (Debilitator and Air Anchor), which cannot be obtained again in the game.
5. Finish the battle. The glitched items will still be in your inventory.
The bug, as far as I can tell, is in the section of code labeled "no_break", since it doesn't occur when the Tool breaks. In fact, a Tool breaking most often doesn't count towards the 12 uses, but sometimes it actually resets the 12 count. I looked through the code, and thought that issue might be that the "SEP #$20", setting the X/Y accumulators back to 8-bit, never occurs on the "no_break" branch. I tried adding that into the "no_break" section of code, both at the beginning and the end, but it did not seem to affect this issue.
Any insight would be immensely helpful. I did not intend to ever do a Divergent Paths v1.1, but this bug is big enough that it's necessary.
Projects:
FFVI: Divergent Paths (Completed) - a complete storyline and gameplay hack of FF6 that adds Leo as a playable character
« Next Oldest | Next Newest »
Users browsing this thread: 16 Guest(s)