Fix Gyigas' battle poisoning bug(s)

This commit is contained in:
Lorenzo Carletti 2020-08-21 00:57:45 +02:00
parent 2ad223a8cb
commit 95fe2f6d90
4 changed files with 38 additions and 1 deletions

View File

@ -18,7 +18,8 @@ English names:
- Jeff: 7A 95 96 96
- Poo: 80 9F 9F
0x2020C70: enemy data slots in-battle? separated by 0x94 bytes
0x2020C70: party character slots in battle. 0x94 bytes long
0x2021110: enemy slots in battle. 0x94 bytes long
0x2025038: enemy count (initial, not current)
0x20251D8: item drop
0x3000A00: Current PSI list when displaying a PSI window?

Binary file not shown.

27
src/m2-bugfixes.asm Normal file
View File

@ -0,0 +1,27 @@
//==============================================================================
//Fixes the issue where Gyigas could take damage from poison
dee6c_fix_poison_gyigas:
push {lr}
add r0,#0x44
ldrh r0,[r0,#0] // Get the enemy's identifier
lsr r1,r0,#3 // Divide it by 8
lsl r2,r1,#3
sub r0,r0,r2 // Get the division's rest
ldr r2,=#status_damage_table
add r2,r2,r1
ldrb r1,[r2,#0] // Get the byte that contains this entity's data
mov r2,#1
lsl r2,r0
and r2,r1 // If this is not 0, the enemy shouldn't take damage
cmp r2,#0
bne @@end
ldr r0,[r6,#0] // Proceed normally
mov r1,r4
bl 0x80E9CFC
@@end:
pop {pc}
//==============================================================================

View File

@ -1701,6 +1701,11 @@ nop
//Choose character table based on alphabet loaded in
.org 0x80C7578 :: bl c7578_load_letters
//==============================================================================
// Fix Gyigas' poison bug
//==============================================================================
.org 0x80DEE6C :: bl dee6c_fix_poison_gyigas
//==============================================================================
// Move stuff around in order to make space for the code
//==============================================================================
@ -1852,6 +1857,9 @@ flyover_tea:
flyover_coffee:
.include "data/flyover-coffee.asm"
status_damage_table:
.incbin "data/status_damage_immune_table.bin"
m2InsaneCultist:
.incbin "data/m2-insane-cultist.bin"
@ -1961,6 +1969,7 @@ disclaimer_map:
.include "syscalls.asm"
.include "m2-vwf.asm"
.include "m2-vwf-entries.asm"
.include "m2-bugfixes.asm"
.include "m2-formatting.asm"
.include "m2-customcodes.asm"
.include "m2-compiled.asm"