Mimic rework

This commit is contained in:
aerinon
2023-08-04 11:30:29 -06:00
parent 05409f1875
commit 75545cf568
3 changed files with 82 additions and 78 deletions

View File

@@ -10,8 +10,6 @@ incsrc hooks/bosses_hooks.asm
incsrc hooks/moldorm_hooks.asm
incsrc hooks/mimic_hooks.asm
incsrc hooks/damage_hooks.asm
incsrc hooks/overworld_sprite_hooks.asm

View File

@@ -1,39 +0,0 @@
;Hooks
; sprite_prep.asm (2466) -> SpritePrep_EyegoreTrampoline:
org $0691B6 ; 0311B6 1E:C6FA? ; SpriteActive3_Transfer?
JSL SpritePrep_EyegoreNew ;set eyegore to be only eyegore
; sprite_prep.asm (203) -> dw SpritePrep_DoNothing ; 0xB8 - Dialogue Testing Sprite
org $0687CB ; 0307CB replace debugged sprite create by eyegore
dw #$91B6 ; SpritePrep_Eyegore jump table
; Bank1E.asm (140) -> dw Sprite_DialogueTester ; 0xB8 - debug artifact, dialogue tester
org $1E8BB1
dw #$C795 ;Sprite_Eyegore jump table
; table starts at 6B8F1
org $0DB9A9
db $00 ; sprite B8 needs a damage type
org $06EC08 ; Bank06.asm (4593) - damage calcs
{
JSL resetSprite_Mimic
NOP
}
org $06EDA6 ; Bank06.asm (4876) - .notItemSprite
{
; original
; REP #$20 : ASL #4 : ORA $0CF2 : PHX : REP #$10 : TAX ;C2 20 : 0A 0A 0A 0A : 0D F2 0C : DA : C2 10 : AA
; SEP #$20 ;E2 20
; LDA $7F6000, X : STA $02 ;BF 00 60 7F : 85 02
; SEP #$10
JSL notItemSprite_Mimic ; C2 20 : 0A 0A
;NOP : NOP : NOP : NOP : NOP : NOP : NOP : NOP : NOP ; 0A 0A : 0D F2 0C : DA : C2 10 : AA
;NOP : NOP ; E2 20
;NOP : NOP : NOP : NOP : NOP : NOP ; BF 00 60 7F : 85 02
;NOP ;
}

View File

@@ -1,3 +1,49 @@
pushpc
org $0691B6
JSL SpritePrep_EyegoreNew
org $068839 ; 0xEF
dw #$91B6 ; New sprite_prep
dw #$91B6 ; New sprite_prep
;org $069468 ; These need to go else where
;dw #$BFF7 ; SpriteModule_Active_Bank1E_bounce
;dw #$BFF7 ; SpriteModule_Active_Bank1E_bounce
;org $1E8B21
;JSL FixVectorForMimics
;org $1E8BBB ; New vectors for mimics
;dw #$C795
;dw #$C795
org $0DB818
SpritePrep_LoadProperties:
org $1EC6FA
SpritePrep_Eyegore_become_mimic:
;org $06EC08 ; Sprite_AttemptZapDamage
;JSL resetSprite_Mimic : NOP
org $06ED9E ; Sprite_ApplyCalculatedDamage, skip high sprite id early exit
JSL IsItReallyAMimic : NOP
org $06EDA6 ; Sprite_ApplyCalculatedDamage .not_absorbable
JSL notItemSprite_Mimic
pullpc
;FixVectorForMimics:
; CMP.w $#00EF : BCC .end
; SBC.w #$0032 ; this puts the vector at the unused bytes at UNREACHABLE_1E8BBB
; .end
; AND.w #$00FF ; what we wrote over
; ASL A
;RTL
; replace SpritePrep_Eyegore if flag is on
SpritePrep_EyegoreNew:
{
@@ -7,62 +53,61 @@ SpritePrep_EyegoreNew:
RTL
.new
LDA $0E20, X : CMP.b #$B8 : BEQ .mimic ;If sprite id == debugger sprite
JSL $1EC71A ; 0xF471A set eyegore to be only eyegore (.not_goriya?)
LDA $0E20, X : CMP.b #$EF : BCS .mimic ;If sprite id >= EF (unused somaria platform)
; seems unnecessary it's just an rtl?
; JSL $1EC71A ; 0xF471A set eyegore to be only eyegore (.not_goriya?)
RTL
.mimic
LDA #$83 : STA $0E20, X : JSL $0DB818 ; 0x6B818 Sprite_LoadProperties of green eyegore
LDA #$B8 : STA $0E20, X ; set the sprite back to mimic
LDA $0CAA, X : AND #$FB : ORA #$80 : STA $0CAA, X ; STZ $0CAA, X
;INC $0DA0, X
JSL $1EC70D ;0xF470D set eyegore to be mimic (.is_goriya?)
SBC.b #$6C : STA $0E20, X : JSL SpritePrep_LoadProperties ; pretending to be $83 or $84
JSL SpritePrep_Eyegore_become_mimic
; LDA.w $0E20, X : ADC #$6C : STA $0E20, X ; set the sprite back to special mimic
; todo? unsure about this code - seems unnecessary
; LDA $0CAA, X : AND #$FB : ORA #$80 : STA $0CAA, X ; STZ $0CAA, X
RTL
}
resetSprite_Mimic:
{
LDA !ENABLE_MIMIC_OVERRIDE : BEQ .notMimic ; skip to what it would have done normally
;resetSprite_Mimic:
; LDA !ENABLE_MIMIC_OVERRIDE : BEQ .notMimic ; skip to what it would have done normally
;
; LDA $0E20, X
; CMP.b #$EF : BCC .notMimic
; LDA $0E20, X : SBC.b #$6C : STA $0E20, X ; overwrite the sprite id with eyegore id
;
;.notMimic
; restore code
; LDA $0E20, X : CMP.b #$7A
;RTL
LDA $0E20, X
CMP.b #$B8 : BNE .notMimic
LDA #$83 : STA $0E20, X ; overwrite the sprite id with green eyegore id
IsItReallyAMimic:
LDA !ENABLE_MIMIC_OVERRIDE : BEQ .continue
LDA.w $0E20,X : CMP.b #$EF : BEQ .is_mimic
CMP.b #$F0 : BNE .continue
.notMimic
; restore code
LDA $0E20, X
CMP.b #$7A
.is_mimic
CLC : RTL
.continue ; code we hijacked
LDA.w $0E20,X
CMP.b #$D8
RTL
}
; this is just for killable thieves now
notItemSprite_Mimic:
{
; if we set killable thief we want to update the sprite id so it can be killed
; if we set killable thief we want to update the sprite id so it can be killed
LDA $0E20, X
CMP.l !KILLABLE_THIEVES_ID : BEQ .changeSpriteId ; thief #$C4 (default is B8/dialog tester)
CMP.l !KILLABLE_THIEVES_ID : BNE .continue ; thief #$C4 (default is B8/dialog tester)
; if we don't have mimic code turned on we want to skip, but we also need to reload the sprite id because we just smoked it with this LDA
LDA !ENABLE_MIMIC_OVERRIDE : BEQ .reloadSpriteIdAndSkipMimic ; skip to what it would have done normally
; LDA !ENABLE_MIMIC_OVERRIDE : BEQ .reloadSpriteIdAndSkipMimic ; skip to what it would have done normally
LDA $0E20, X ; I hate assembly
CMP.b #$B8 : BNE .continue ; "mimic" (dialogue test sprite we hijacked). skip to vanilla behavior if it's not a "mimic"
; LDA $0E20, X ; I hate assembly
; CMP.b #$EF : BCC .continue
; SBC.b #$6C : BRA .continue
.changeSpriteId
LDA #$83 ; load green eyegore sprite id so we can kill the thing
JMP .continue
.reloadSpriteIdAndSkipMimic
LDA $0E20, X
.continue
; restore code
REP #$20 : ASL #2
;REP #$20 : ASL #4 : ORA $0CF2 : PHX : REP #$10 : TAX
;SEP #$20
;LDA $7F6000, X : STA $02
;SEP #$10
RTL
}