142 lines
4.6 KiB
NASM
142 lines
4.6 KiB
NASM
;--------------------------------------------------------------------------------
|
|
!ANCILLA_DAMAGE = "$06EC84"
|
|
; start with X = sprite index, A = ancilla type index
|
|
;--------------------------------------------------------------------------------
|
|
Ganon_CheckAncillaVulnerability:
|
|
PHA
|
|
LDA $0EE0, X : BNE .not_vulnerable_pla
|
|
PLA
|
|
PHX : PHA
|
|
LDA.l GanonVulnerabilityItem
|
|
TAX : PLA
|
|
CMP.l Ganon_CheckByAncilla, X : BNE +
|
|
PLX : BRA .vulnerable
|
|
+
|
|
PLX : PHA
|
|
LDA.l GanonVulnerabilityItem
|
|
CMP #$01 : BEQ .silver_arrows
|
|
CMP #$11 : BEQ .somaria
|
|
BRA .not_vulnerable_pla
|
|
.silver_arrows
|
|
PLA : CMP #$09 : BNE .not_vulnerable
|
|
LDA BowEquipment : CMP.b #$03 : !BGE +
|
|
LDA #$09 : BRA .not_vulnerable
|
|
+
|
|
BRA .vulnerable
|
|
.hammer
|
|
BRA .not_vulnerable_pla ; NYI
|
|
.golden_bee
|
|
BRA .not_vulnerable_pla ; NYI
|
|
.somaria
|
|
PLA : CMP #$01 : BEQ .vulnerable
|
|
CMP #$2C : BEQ .vulnerable
|
|
BRA .vulnerable
|
|
.vulnerable
|
|
PHX
|
|
LDA.l GanonVulnerabilityItem
|
|
TAX
|
|
LDA.l Ganon_IFrameDuration, X
|
|
PLX
|
|
STA $0EE0, X ; give the poor pig some iframes
|
|
LDA #$20 : STA $0F10, X
|
|
LDA #$09
|
|
RTL
|
|
.not_vulnerable_pla
|
|
PLA
|
|
.not_vulnerable
|
|
PHX : TAX
|
|
LDA.l !ANCILLA_DAMAGE, X
|
|
PLX
|
|
RTL
|
|
; end with X = sprite index, A = damage class
|
|
;--------------------------------------------------------------------------------
|
|
!ANCILLA_CHECK_SPRITE_DAMAGE_PRESET_CLASS = "$06ECE6"
|
|
;--------------------------------------------------------------------------------
|
|
Ganon_CheckPowderVulnerability: ; we know it's powder
|
|
LDA.l GanonVulnerabilityItem : CMP #$05 : BNE .normal ; ganon not vulnerable to powder
|
|
LDA $0E20, X : CMP #$D7 : BNE .normal ; not stunned ganon
|
|
LDA $0EE0, X : BNE .normal ; ganon has iframes
|
|
LDA.l Ganon_IFrameDuration+$05
|
|
STA $0EE0, X ; give the poor pig some iframes
|
|
LDA #$20 : STA $0F10, X
|
|
LDA #$09
|
|
BRA .done
|
|
.normal
|
|
LDA.b #$0A
|
|
.done
|
|
JSL.l !ANCILLA_CHECK_SPRITE_DAMAGE_PRESET_CLASS
|
|
RTL
|
|
;--------------------------------------------------------------------------------
|
|
Ganon_CheckBeeVulnerability: ; we know it's a bee
|
|
; X is bee sprite index
|
|
; Y is target sprite index
|
|
LDA.l GanonVulnerabilityItem : CMP #$10 : BNE .normal ; ganon not vulnerable to bee
|
|
LDA $0E20, Y : CMP #$D7 : BNE .normal ; not stunned ganon
|
|
LDA $0EE0, Y : BNE .normal ; ganon has iframes
|
|
LDA.l Ganon_IFrameDuration+$10
|
|
STA $0EE0, Y ; give the poor pig some iframes
|
|
LDA #$20 : STA $0F10, Y
|
|
LDA #$09
|
|
BRA .done
|
|
.normal
|
|
LDA.l SpecialWeapons : CMP.b #$06 : BNE .regular_bee
|
|
LDA.w $0ED0, X
|
|
BRA .done
|
|
.regular_bee
|
|
LDA.b #$01
|
|
.done
|
|
TYX
|
|
JSL.l !ANCILLA_CHECK_SPRITE_DAMAGE_PRESET_CLASS
|
|
RTL
|
|
;--------------------------------------------------------------------------------
|
|
Ganon_CheckInvincible:
|
|
LDA $04C5 : CMP.b #$02 : BEQ .not_transparent
|
|
LDA $0E20, X : CMP #$D7 : BNE .transparent ; non-stunned ganon
|
|
LDA $0301 : AND.b #$0A : BEQ .transparent ; normal behavior if not hammer
|
|
LDA.l GanonVulnerabilityItem : CMP #$0C : BNE .transparent ; ganon not vulnerable to hammer
|
|
.not_transparent
|
|
LDA #$00 : RTL
|
|
.transparent
|
|
LDA #$01 : RTL
|
|
; return non-zero A if ganon should be invincible
|
|
;--------------------------------------------------------------------------------
|
|
Ganon_CheckHammerVulnerability: ; we know it's hammer
|
|
LDA.l GanonVulnerabilityItem : CMP #$0C : BNE .normal ; ganon not vulnerable to hammer
|
|
LDA $0E20, X : CMP #$D7 : BNE .normal ; not stunned ganon
|
|
LDA $0EE0, X : BNE .normal ; ganon has iframes
|
|
LDA.l Ganon_IFrameDuration+$0C
|
|
STA $0EE0, X ; give the poor pig some iframes
|
|
LDA #$20 : STA $0F10, X
|
|
LDA #$09 : STA $0CF2 ; set damage class to silver
|
|
SEC : RTL
|
|
.normal
|
|
CLC : RTL
|
|
; return carry set bit if stunned Ganon and Ganon vulnerable to hammer
|
|
;--------------------------------------------------------------------------------
|
|
CheckBeeBoss:
|
|
; Y is sprite index
|
|
LDA.l SpecialWeapons : CMP #$06 : BNE .not_bee_mode
|
|
LDA #$00 : RTL
|
|
.not_bee_mode
|
|
LDA.l GanonVulnerabilityItem : CMP #$10 : BNE .normal ; ganon not vulnerable to bee
|
|
LDA $0E20, Y : CMP #$D7 : BNE .normal ; not stunned ganon
|
|
LDA #$00 : RTL
|
|
.normal
|
|
LDA $0B6B, Y : AND.b #$02
|
|
RTL
|
|
; return non-zero A if entity is a boss (and bee should not attack)
|
|
;--------------------------------------------------------------------------------
|
|
Ganon_CheckByAncilla:
|
|
db #$00 ; default behavior--we shouldn't be checking the table here anyway
|
|
db #$00, #$05, #$1F, #$07, #$00
|
|
db #$02, #$0B, #$19, #$18, #$1C
|
|
db #$00, #$00, #$00, #$00, #$00
|
|
db #$00, #$00, #$31, #$00, #$00
|
|
Ganon_IFrameDuration:
|
|
db #$00 ; default behavior--we shouldn't be here anyway
|
|
db #$00, #$00, #$00, #$34, #$00
|
|
db #$00, #$00, #$00, #$00, #$00
|
|
db #$00, #$00, #$00, #$00, #$00
|
|
db #$00, #$00, #$00, #$00, #$00
|
|
;--------------------------------------------------------------------------------
|