Backport terrorpin ai fix from enemizer. (and fix a bug with it.)

This commit is contained in:
CaitSith2
2020-08-05 08:48:25 -07:00
parent dad73fc883
commit a892ff39b2
4 changed files with 33 additions and 0 deletions

View File

@@ -213,6 +213,7 @@ incsrc elder.asm
incsrc toast.asm
incsrc darkroomitems.asm
incsrc multiworld.asm
incsrc terrorpin.asm
warnpc $A58000
;org $228000 ; contrib area

View File

@@ -2560,3 +2560,12 @@ CheckIfReading:
CPX #$04
RTS
;================================================================================
;================================================================================
; Terrorpin AI fix
;--------------------------------------------------------------------------------
org $1EB2B1 ; sprite_terrorpin.asm(57) : AND.b #$03 : STA $0DE0, X ; 5 bytes
JSL FixTerrorpin ; 4 bytes
NOP ; 1 byte
;--------------------------------------------------------------------------------

View File

@@ -1824,6 +1824,10 @@ org $30E36D ; PC 0x18636D
;BerserkerMulti.world Seed GUID
db #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00
org $30E37D ; PC 0x18637D
Enable_TerrorPin_AI_Fix:
db #$01
;--------------------------------------------------------------------------------
; 0x186380 - 187FFF (unused)
;--------------------------------------------------------------------------------

19
terrorpin.asm Normal file
View File

@@ -0,0 +1,19 @@
;================================================================================
; Terrorpin AI Fixes
;================================================================================
FixTerrorpin:
{
PHA ;save A so that checking the option doesn't smoke A
LDA.b Enable_TerrorPin_AI_Fix : BNE .new ; check if option is on
PLA ;restore A
; do the old code that smokes A
AND.b #$03 : STA $0DE0, X
RTL
.new
PLA ; Restore A
PHA ; save A so the orignal code doesn't kill it
AND.b #$03 : STA $0DE0, X ; restore what we overwrote
PLA ; restore A so the AND/BNE in the original code actually does something
RTL
}