Fix Sprite_CheckForPresence and Sprite_SetupHitBox

This commit is contained in:
scawful
2024-12-15 16:15:24 -05:00
parent 3c1a8d7298
commit be4a5d9b8c

View File

@@ -319,30 +319,29 @@ Sprite_Damage_Flash:
} }
; $00 - ID of the sprite to check ; $00 - ID of the sprite to check
; $01 - Current sprite index
; $02 - Index of the sprite found ; $02 - Index of the sprite found
Sprite_CheckForPresence: Sprite_CheckForPresence:
{ {
STX $01
PHX PHX
CLC CLC
LDX.b #$10 LDX.b #$10
.x_loop .x_loop
DEX DEX
LDY.b #$04
.y_loop
DEY
LDA $0E20, X : CMP.b $00 : BEQ .set_flag LDA $0E20, X : CMP.b $00 : BEQ .set_flag
BRA .not_b0 BRA .continue
.set_flag .set_flag
CPX.b $01 : BEQ .continue
SEC ; Set flag indicating sprite is present SEC ; Set flag indicating sprite is present
STX.w $02 STX.w $02
BRA .done BRA .done
.not_b0 .continue
CPY.b #$00 : BNE .y_loop
CPX.b #$00 : BNE .x_loop CPX.b #$00 : BNE .x_loop
.done .done
PLX PLX
RTS RTL
} }
@@ -399,9 +398,9 @@ Sprite_SetupHitBox:
PLB PLB
RTL RTL
Sprite_SetupHitBox_Alt: .Alt:
PHB : PHK : PLB PHB : PHK : PLB
LDA.w SprHeight, X : BMI .too_high LDA.w SprHeight, X : BMI .too_high2
PHY PHY
LDA.w SprHitbox, X : AND.b #$1F : TAY LDA.w SprHitbox, X : AND.b #$1F : TAY
LDA.w SprX, X : CLC : ADC.w .offset_x_low, Y : STA.b pos1_x_low LDA.w SprX, X : CLC : ADC.w .offset_x_low, Y : STA.b pos1_x_low
@@ -419,7 +418,7 @@ Sprite_SetupHitBox_Alt:
PLB PLB
RTL RTL
.too_high .too_high2
LDA.b #$80 : STA.b pos1_x_high LDA.b #$80 : STA.b pos1_x_high
PLB PLB
RTL RTL