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

View File

@@ -1,24 +1,21 @@
pushpc pushpc
org $06FFF8 ; New Jumptable for sprites org $06FFF8 ; New Jumptable for sprites
NewMainSprFunction: NewMainSprFunction:
JSL SpriteActiveExp_MainLong JSL SpriteActiveExp_MainLong
RTS RTS
org $068EB9 org $068EB9
NewSprPrepFunction: NewSprPrepFunction:
JSL Sprite_PrepExp_Long JSL Sprite_PrepExp_Long
RTS RTS
pullpc pullpc
SpriteActiveExp_MainLong: SpriteActiveExp_MainLong:
{ {
PHB : PHK : PLB PHB : PHK : PLB
JSL NewSprTable JSL NewSprTable
PLB PLB
RTL RTL
} }
@@ -34,7 +31,7 @@ NewSprTable:
LDA NewSprRoutinesLong, Y ; Load sprite Address LDA NewSprRoutinesLong, Y ; Load sprite Address
STA $06 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 LDA NewSprRoutinesLong+2, Y
STA $08 STA $08
SEP #$30 SEP #$30
@@ -46,11 +43,8 @@ NewSprTable:
Sprite_PrepExp_Long: Sprite_PrepExp_Long:
{ {
PHB : PHK : PLB PHB : PHK : PLB
JSL NewSprPrepTable JSL NewSprPrepTable
PLB PLB
RTL RTL
} }