add ancillae collision to portal rod sprites

This commit is contained in:
scawful
2024-06-18 20:24:56 -04:00
parent 59bbc4b3ee
commit 85ae27a046
2 changed files with 44 additions and 1 deletions

View File

@@ -48,8 +48,45 @@ LinkItem_PortalRod:
warnpc $07A568
; Ancilla_CheckSpriteCollision
org $088DC3
JSL Ancilla_HandlePortalCollision : NOP
pullpc
Ancilla_HandlePortalCollision:
{
LDA.w $0E20, Y : CMP.b #$03 : BNE .not_portal_arrow
; Check if Y is the orange or blue portal
LDA.w SprSubtype, Y : CMP.b #$02 : BEQ .blue_portal
CMP.b #$01 : BEQ .orange_portal
.orange_portal
PHY
LDY.w $0632 ; Blue Sprite ID
LDA.w SprX, Y : CLC : ADC.b #$10 : STA.w ANC0XL, X
LDA.w SprY, Y : STA.w ANC0YL, X
LDA.w SprXH, Y : STA.w ANC0XH, X
LDA.w SprYH, Y : STA.w ANC0YH, X
PLY
JMP .continue
.blue_portal
PHY
LDY.w $0633 ; Orange Sprite ID
LDA.w SprX, Y : STA.w ANC0XL, X
LDA.w SprY, Y : CLC : ADC.b #$10 : STA.w ANC0YL, X
LDA.w SprXH, Y : STA.w ANC0XH, X
LDA.w SprYH, Y : STA.w ANC0YH, X
PLY
.continue
LDA.b #$08
RTL
.not_portal_arrow
; Restore arrow deflection sprite code from $088DC3
LDA.w $0B6B,Y : AND.b #$08
RTL
}
macro SpawnPortal(x_offset, y_offset)
REP #$20
LDA $22 : CLC : ADC.w #<x_offset>

View File

@@ -61,7 +61,9 @@ Sprite_Portal_Prep:
; Persist outside of camera
LDA #$00 : STA $0CAA, X
LDA SprHitbox, X : AND.b #$20 : STA SprHitbox, X
LDA SprHitbox, X : AND.b #$C0 : STA SprHitbox, X
STZ.w $0B6B, X
LDA.b #$FF : STA.w $0BA0, X
PLB
RTL
@@ -114,6 +116,7 @@ Sprite_Portal_Main:
TXA : STA OrangeSpriteIndex
LDA $0D00, X : STA OrangePortal_X
LDA $0D10, X : STA OrangePortal_Y
LDA.b #$01 : STA.w SprSubtype, X
%GotoAction(2)
RTS
@@ -122,6 +125,7 @@ Sprite_Portal_Main:
TXA : STA BlueSpriteIndex
LDA $0D00, X : STA BluePortal_X
LDA $0D10, X : STA BluePortal_Y
LDA.b #$02 : STA.w SprSubtype, X
%GotoAction(1)
RTS
@@ -305,6 +309,7 @@ CheckForDismissPortal:
PHX
LDA BlueSpriteIndex : TAX
STZ.w $0DD0, X
DEC.w $06FE
PLX
JMP .return
@@ -313,6 +318,7 @@ CheckForDismissPortal:
PHX
LDA OrangeSpriteIndex : TAX
STZ.w $0DD0, X
DEC.w $06FE
PLX
.return