Fix bug with Sprite_SelectNewDirection data bank long jump

This commit is contained in:
scawful
2024-11-27 13:41:02 -05:00
parent 834da79237
commit c11e112a40
3 changed files with 23 additions and 41 deletions

View File

@@ -168,34 +168,30 @@ Sprite_BounceOffWall:
Sprite_InvertSpeed_XY:
JSL Sprite_InvertSpeed_Y
; =========================================================
Sprite_InvertSpeed_X:
LDA.w SprXSpeed, X
EOR.b #$FF
INC A
STA.w SprXSpeed, X
RTL
; =========================================================
Sprite_InvertSpeed_Y:
LDA.w SprYSpeed,X
EOR.b #$FF
INC A
STA.w SprYSpeed,X
RTL
; =========================================================
Sprite_SelectNewDirection:
{
PHB : PHK : PLB
JSL GetRandomInt : AND.b #$07 : TAY
LDA.w .speed_x, Y : STA.w SprXSpeed, X
LDA.w .speed_y, Y : STA.w SprYSpeed, X
LDA.w .timers, Y : STA.w SprTimerA, X
PLB
RTL
.speed_x
@@ -277,9 +273,7 @@ DragPlayer:
Sprite_DamageFlash_Long:
{
PHB : PHK : PLB
JSR Sprite_Damage_Flash
PLB
RTL
}
@@ -292,15 +286,14 @@ Sprite_Damage_Flash:
; Change the palette to the next in the cycle
LDA.w SprFlash, X : INC : CMP.b #$08 : BNE .dontReset
LDA.b #$00
.dontReset
STA.w SprFlash, X
BRA .flash
.dontFlash
.dontFlash
STZ.w SprFlash, X
.flash
.flash
RTS
}
@@ -324,13 +317,10 @@ Link_CheckNewY_ButtonPress_Long:
Link_SetupHitBox:
{
LDA.b #$08 : STA $02 : STA $03
LDA $22 : CLC : ADC.b #$04 : STA $00
LDA $23 : ADC.b #$00 : STA $08
LDA $20 : ADC.b #$08 : STA $01
LDA $21 : ADC.b #$00 : STA $09
RTL
}
@@ -343,15 +333,11 @@ Sprite_SetupHitBox:
PHY
LDA.w SprHitbox, X : AND.b #$1F : TAY
LDA.w SprX, X : CLC : ADC.w .offset_x_low, Y : STA.b $04
LDA.w SprXH, X : ADC.w .offset_x_high, Y : STA.b $0A
LDA.w SprY, X : CLC : ADC.w .offset_y_low, Y
PHP
SEC : SBC.w SprHeight, X : STA.b $05
LDA.w SprYH, X : SBC.b #$00
PLP
ADC.w .offset_y_high, Y : STA.b $0B
@@ -876,6 +862,7 @@ MovieEffect:
}
Sprite_CheckIfRecoiling:
{
PHB : PHK : PLB
LDA.w $0EA0, X : BEQ .exit
@@ -948,5 +935,6 @@ Sprite_CheckIfRecoiling:
PLB
RTL
.masks
.masks
db $03, $01, $00, $00, $0C, $03
}

View File

@@ -1,24 +1,21 @@
pushpc
org $06FFF8 ; New Jumptable for sprites
NewMainSprFunction:
JSL SpriteActiveExp_MainLong
RTS
JSL SpriteActiveExp_MainLong
RTS
org $068EB9
NewSprPrepFunction:
JSL Sprite_PrepExp_Long
RTS
JSL Sprite_PrepExp_Long
RTS
pullpc
SpriteActiveExp_MainLong:
{
PHB : PHK : PLB
JSL NewSprTable
PLB
RTL
}
@@ -34,7 +31,7 @@ NewSprTable:
LDA NewSprRoutinesLong, Y ; Load sprite Address
STA $06
SEP #$20 ; Previously SEP #$30 -_- (that's fine for sprites below ~0x40 over that it will crash)
SEP #$20
LDA NewSprRoutinesLong+2, Y
STA $08
SEP #$30
@@ -46,11 +43,8 @@ NewSprTable:
Sprite_PrepExp_Long:
{
PHB : PHK : PLB
JSL NewSprPrepTable
PLB
RTL
}