cleanup twinrova, optimize action size

This commit is contained in:
scawful
2024-06-30 14:16:11 -04:00
parent 79b73163d4
commit e9f9f04655

View File

@@ -58,61 +58,61 @@ Sprite_Twinrova_Long:
Sprite_Twinrova_CheckIfDead: Sprite_Twinrova_CheckIfDead:
{ {
LDA SprAction, X : CMP.b #$0A : BEQ .not_dead LDA SprAction, X : CMP.b #$0A : BEQ .not_dead
; If health is negative, set back to zero ; If health is negative, set back to zero
LDA SprHealth, X : CMP.b #$C3 : BCC .health_not_negative LDA SprHealth, X : CMP.b #$C3 : BCC .health_not_negative
LDA.b #$00 : STA.w SprHealth, X LDA.b #$00 : STA.w SprHealth, X
.health_not_negative .health_not_negative
LDA SprHealth, X : BNE .not_dead LDA SprHealth, X : BNE .not_dead
PHX PHX
LDA.b #$04 : STA $0DD0, X ; Kill sprite boss style LDA.b #$04 : STA $0DD0, X ; Kill sprite boss style
LDA.b #$0A : STA.w SprAction, X ; Go to Twinrova_Dead stage LDA.b #$0A : STA.w SprAction, X ; Go to Twinrova_Dead stage
LDA.b #$10 : STA.w $0D90, X LDA.b #$10 : STA.w $0D90, X
PLX PLX
.not_dead .not_dead
RTS RTS
} }
; ========================================================= ; =========================================================
Sprite_Twinrova_Prep: Sprite_Twinrova_Prep:
{ {
PHB : PHK : PLB PHB : PHK : PLB
; Kill the sprite if the Maiden is present
LDA.l $7EF3CC : CMP.b #$06 : BNE .prep_twinrova
STZ.w $0DD0, X
; Kill the sprite if the Maiden is present
LDA.l $7EF3CC : CMP.b #$06 : BNE .prep_twinrova
STZ.w $0DD0, X
.prep_twinrova .prep_twinrova
LDA.b #$5A : STA.w SprHealth, X ; Health
LDA.b #$80 : STA $0CAA, X
LDA.b #$04 : STA $0CD2, X ; Bump damage type (4 hearts, green tunic)
LDA $0E60, X : AND.b #$BF : STA $0E60, X ; Not invincible
%SetSpriteSpeedX(15) LDA.b #$5A : STA.w SprHealth, X ; Health
%SetSpriteSpeedX(15) LDA.b #$80 : STA $0CAA, X
LDA.b #$04 : STA $0CD2, X ; Bump damage type (4 hearts, green tunic)
LDA.w $0E60, X : AND.b #$BF : STA.w $0E60, X ; Not invincible
; Blind Boss startup configuration %SetSpriteSpeedX(15)
LDA #$10 : STA $08 %SetSpriteSpeedX(15)
LDA #$10 : STA $09
LDA.b #$60 : STA.w SprTimerC, X ; Blind Boss startup configuration
LDA.b #$01 : STA.w SprMiscB, X LDA.b #$10 : STA $08
LDA.b #$02 : STA.w SprMiscC, X LDA.b #$10 : STA $09
LDA.b #$04 : STA.w SprMiscE, X
LDA.b #$07 : STA.w SprGfx, X
STZ.w $0B69
PLB LDA.b #$60 : STA.w SprTimerC, X
RTL LDA.b #$01 : STA.w SprMiscB, X
LDA.b #$02 : STA.w SprMiscC, X
LDA.b #$04 : STA.w SprMiscE, X
LDA.b #$07 : STA.w SprGfx, X
STZ.w $0B69
PLB
RTL
} }
; ========================================================= ; =========================================================
!AnimSpeed = 8 !AnimSpeed = 8
macro Twinrova_Front() macro Twinrova_Front()
%PlayAnimation(0,1,!AnimSpeed) %PlayAnimation(0,1,!AnimSpeed)
endmacro endmacro
@@ -156,6 +156,9 @@ endmacro
Sprite_Twinrova_Main: Sprite_Twinrova_Main:
{ {
JSL Sprite_PlayerCantPassThrough
JSL Sprite_DamageFlash_Long
LDA.w SprAction, X LDA.w SprAction, X
JSL UseImplicitRegIndexedLocalJumpTable JSL UseImplicitRegIndexedLocalJumpTable
@@ -175,51 +178,51 @@ Sprite_Twinrova_Main:
; 0x00 ; 0x00
Twinrova_Init: Twinrova_Init:
{ {
%ShowUnconditionalMessage($123) %ShowUnconditionalMessage($123)
LDA.w SprTimerD, X : BNE + LDA.w SprTimerD, X : BNE +
LDA.b #$20 : STA.w SprTimerD, X LDA.b #$20 : STA.w SprTimerD, X
%GotoAction(1) %GotoAction(1)
+ +
RTS RTS
} }
; ------------------------------------------------------- ; -------------------------------------------------------
; 0x01 ; 0x01
Twinrova_MoveState: Twinrova_MoveState:
{ {
STZ.w $0360 STZ.w $0360
LDA SprHealth, X : CMP.b #$20 : BCS .phase_1 LDA SprHealth, X : CMP.b #$20 : BCS .phase_1
; ------------------------------------------- ; -------------------------------------------
; Phase 2 ; Phase 2
LDA SprTimerE, X : BNE .kotake LDA SprTimerE, X : BNE .kotake
LDA #$70 : STA.w SprTimerD, X LDA #$70 : STA.w SprTimerD, X
%GotoAction(8) ; Koume Mode %GotoAction(8) ; Koume Mode
RTS RTS
.kotake .kotake
LDA #$70 : STA.w SprTimerD, X LDA #$70 : STA.w SprTimerD, X
%GotoAction(9) ; Kotake Mode %GotoAction(9) ; Kotake Mode
RTS RTS
; --------------------------------------------- ; ---------------------------------------------
.phase_1 .phase_1
LDA $0DA0 : BEQ .not_flashing LDA $0DA0 : BEQ .not_flashing
LDA.b #$30 : STA.w SprTimerD, X LDA.b #$30 : STA.w SprTimerD, X
%GotoAction(7) ; Goto Twinrova_Hurt %GotoAction(7) ; Goto Twinrova_Hurt
RTS RTS
.not_flashing .not_flashing
JSL GetRandomInt : AND.b #$3F : BNE + JSL GetRandomInt : AND.b #$3F : BNE +
LDA.b #$20 : STA.w SprTimerD, X LDA.b #$20 : STA.w SprTimerD, X
STZ $AC ; Set the fire attack STZ $AC ; Set the fire attack
%GotoAction(4) ; Prepare Attack %GotoAction(4) ; Prepare Attack
RTS RTS
+ +
JSL GetRandomInt : AND.b #$3F : BNE ++ JSL GetRandomInt : AND.b #$3F : BNE ++
LDA.b #$20 : STA.w SprTimerD, X LDA.b #$20 : STA.w SprTimerD, X
LDA #$01 : STA $AC ; Set the ice attack LDA #$01 : STA $AC ; Set the ice attack
%GotoAction(4) ; Prepare Attack %GotoAction(4) ; Prepare Attack
RTS RTS
++ ++
JSL GetRandomInt : AND.b #$0F : BEQ .random_strafe JSL GetRandomInt : AND.b #$0F : BEQ .random_strafe
@@ -245,44 +248,38 @@ Sprite_Twinrova_Main:
; 0x02 - Twinrova_MoveForwards ; 0x02 - Twinrova_MoveForwards
Twinrova_MoveForwards: Twinrova_MoveForwards:
{ {
%Twinrova_Front() %Twinrova_Front()
PHX PHX
JSL Sprite_CheckDamageFromPlayerLong JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact() %DoDamageToPlayerSameLayerOnContact()
PLX PLX
JSL Sprite_DamageFlash_Long LDA #$10 ; Set speed
JSL Sprite_FloatTowardPlayer
JSL Sprite_CheckTileCollision
LDA #$10 ; Set speed %GotoAction(1)
JSL Sprite_FloatTowardPlayer RTS
JSL Sprite_CheckTileCollision
JSL Sprite_PlayerCantPassThrough
%GotoAction(1)
RTS
} }
; ------------------------------------------------------- ; -------------------------------------------------------
; 0x03 - Twinrova_MoveBackwards ; 0x03 - Twinrova_MoveBackwards
Twinrova_MoveBackwards: Twinrova_MoveBackwards:
{ {
%Twinrova_Back() %Twinrova_Back()
PHX PHX
JSL Sprite_CheckDamageFromPlayerLong JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact() %DoDamageToPlayerSameLayerOnContact()
PLX PLX
JSL Sprite_DamageFlash_Long LDA #$20
JSL Sprite_FloatTowardPlayer
JSL Sprite_CheckTileCollision
LDA #$20 %GotoAction(1)
JSL Sprite_FloatTowardPlayer RTS
JSL Sprite_CheckTileCollision
JSL Sprite_PlayerCantPassThrough
%GotoAction(1)
RTS
} }
; ------------------------------------------------------- ; -------------------------------------------------------
@@ -294,8 +291,6 @@ Sprite_Twinrova_Main:
LDA #$01 : STA $0360 LDA #$01 : STA $0360
JSL Sprite_PlayerCantPassThrough
LDA $0CAA : AND.b #$03 : STA $0CAA LDA $0CAA : AND.b #$03 : STA $0CAA
LDA SprTimerD, X : BNE + LDA SprTimerD, X : BNE +
LDA $0CAA : ORA.b #$03 : STA $0CAA LDA $0CAA : ORA.b #$03 : STA $0CAA
@@ -313,171 +308,165 @@ Sprite_Twinrova_Main:
; 0x05 ; 0x05
Twinrova_FireAttack: Twinrova_FireAttack:
{ {
%StartOnFrame(4) %StartOnFrame(4)
%Twinrova_Ready() %Twinrova_Ready()
JSR Sprite_Twinrova_FireAttack JSR Sprite_Twinrova_FireAttack
JSL Sprite_PlayerCantPassThrough
; Random chance to release fireball ; Random chance to release fireball
JSL GetRandomInt : AND.b #$3F : BNE ++ JSL GetRandomInt : AND.b #$3F : BNE ++
JSR ReleaseFireballs JSR ReleaseFireballs
++ ++
LDA.w SprTimerD, X : BNE + LDA.w SprTimerD, X : BNE +
%GotoAction(1) %GotoAction(1)
+ +
RTS RTS
} }
; ------------------------------------------------------- ; -------------------------------------------------------
; 0x06 ; 0x06
Twinrova_IceAttack: Twinrova_IceAttack:
{ {
%StartOnFrame(4) %StartOnFrame(4)
%Twinrova_Ready() %Twinrova_Ready()
JSR Sprite_Twinrova_IceAttack JSR Sprite_Twinrova_IceAttack
JSL Sprite_PlayerCantPassThrough
LDA.w SprTimerD, X : BNE + LDA.w SprTimerD, X : BNE +
%GotoAction(1) %GotoAction(1)
+ +
RTS RTS
} }
; ------------------------------------------------------- ; -------------------------------------------------------
; 0x07 ; 0x07
Twinrova_Hurt: Twinrova_Hurt:
{ {
%StartOnFrame(10) %StartOnFrame(10)
%Twinrova_Hurt() %Twinrova_Hurt()
JSL Sprite_DamageFlash_Long ; Check if hurt timer is zero, if not keep flashing hurt animation
JSL Sprite_PlayerCantPassThrough LDA.w SprTimerD, X : BNE .HurtAnimation
; Check if hurt timer is zero, if not keep flashing hurt animation
LDA.w SprTimerD, X : BNE .HurtAnimation
; Determine dodge or retaliate behavior ; Determine dodge or retaliate behavior
JSL GetRandomInt JSL GetRandomInt
AND.b #$07 ; 1 in 8 chance for dodge/retaliate AND.b #$07 ; 1 in 8 chance for dodge/retaliate
BNE .DodgeOrRetaliate BNE .DodgeOrRetaliate
BRA .ResumeNormalState BRA .ResumeNormalState
.DodgeOrRetaliate .DodgeOrRetaliate
; Determine whether to dodge or retaliate ; Determine whether to dodge or retaliate
JSL GetRandomInt JSL GetRandomInt
AND.b #$01 AND.b #$01
BEQ .PerformDodge BEQ .PerformDodge
BRA .PerformRetaliate BRA .PerformRetaliate
.PerformDodge .PerformDodge
JSR DoRandomStrafe JSR DoRandomStrafe
LDA.b #$20 : STA.w SprTimerA, X ; Set timer for dodge duration LDA.b #$20 : STA.w SprTimerA, X ; Set timer for dodge duration
LDA.b #$02 : STA.w SprMiscA, X ; Set state to random strafe LDA.b #$02 : STA.w SprMiscA, X ; Set state to random strafe
RTS
.PerformRetaliate
; Immediate retaliation with fire or ice attack
JSL GetRandomInt
AND.b #$01
BEQ .FireAttack
BRA .IceAttack
.FireAttack
LDA.b #$20 : STA.w SprTimerD, X
STZ $AC ; Set fire attack
%GotoAction(4) ; Prepare Attack
RTS
.IceAttack
LDA.b #$20 : STA.w SprTimerD, X
LDA.b #$01 : STA $AC ; Set ice attack
%GotoAction(4) ; Prepare Attack
RTS
.ResumeNormalState
%GotoAction(1) ; Resume normal movement state
RTS
.HurtAnimation
RTS RTS
.PerformRetaliate
; Immediate retaliation with fire or ice attack
JSL GetRandomInt
AND.b #$01
BEQ .FireAttack
BRA .IceAttack
.FireAttack
LDA.b #$20 : STA.w SprTimerD, X
STZ $AC ; Set fire attack
%GotoAction(4) ; Prepare Attack
RTS
.IceAttack
LDA.b #$20 : STA.w SprTimerD, X
LDA.b #$01 : STA $AC ; Set ice attack
%GotoAction(4) ; Prepare Attack
RTS
.ResumeNormalState
%GotoAction(1) ; Resume normal movement state
RTS
.HurtAnimation
RTS
} }
; ------------------------------------------------------- ; -------------------------------------------------------
; 0x08 ; 0x08
Twinrova_KoumeMode: Twinrova_KoumeMode:
{ {
%StartOnFrame(8) %StartOnFrame(8)
%Show_Koume() %Show_Koume()
PHX PHX
JSL Sprite_CheckDamageFromPlayerLong JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact() %DoDamageToPlayerSameLayerOnContact()
PLX PLX
JSL GetRandomInt : AND.b #$3F : BNE ++ JSL GetRandomInt : AND.b #$3F : BNE ++
JSR AddPitHazard JSR AddPitHazard
JSR Ganon_SpawnFallingTilesOverlord JSR Ganon_SpawnFallingTilesOverlord
++ ++
; Random chance to release fireball ; Random chance to release fireball
JSL GetRandomInt : AND.b #$3F : BNE +++ JSL GetRandomInt : AND.b #$3F : BNE +++
JSL Sprite_SpawnFireball JSL Sprite_SpawnFireball
+++ +++
JSL Sprite_DamageFlash_Long
JSR RageModeMove JSR RageModeMove
LDA SprTimerD, X : BNE + LDA SprTimerD, X : BNE +
LDA #$70 : STA.w SprTimerE, X LDA #$70 : STA.w SprTimerE, X
%GotoAction(1) %GotoAction(1)
+ +
RTS RTS
} }
; ------------------------------------------------------- ; -------------------------------------------------------
; 0x09 ; 0x09
Twinrova_KotakeMode: Twinrova_KotakeMode:
{ {
%StartOnFrame(9) %StartOnFrame(9)
%Show_Kotake() %Show_Kotake()
PHX PHX
JSL Sprite_CheckDamageFromPlayerLong JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact() %DoDamageToPlayerSameLayerOnContact()
PLX PLX
JSL Sprite_IsBelowPlayer JSL Sprite_IsBelowPlayer
CPY #$01 : BEQ .not_below CPY #$01 : BEQ .not_below
JSL GetRandomInt : AND.b #$3F : BNE ++ JSL GetRandomInt : AND.b #$3F : BNE ++
JSL $1DE612 ; Sprite_SpawnLightning JSL $1DE612 ; Sprite_SpawnLightning
LDA #$30 LDA #$30
JSL Sprite_ProjectSpeedTowardsPlayer JSL Sprite_ProjectSpeedTowardsPlayer
++ ++
.not_below .not_below
JSL Sprite_DamageFlash_Long JSR RageModeMove
JSR RageModeMove
JSL GetRandomInt : AND.b #$0F : BNE +++ JSL GetRandomInt : AND.b #$0F : BNE +++
JSR RestoreFloorTile JSR RestoreFloorTile
+++ +++
LDA SprTimerD, X : BNE + LDA SprTimerD, X : BNE +
%GotoAction(1) %GotoAction(1)
+ +
RTS RTS
} }
; ------------------------------------------------------- ; -------------------------------------------------------
; 0x0A ; 0x0A
Twinrova_Dead: Twinrova_Dead:
{ {
%StartOnFrame(11) %StartOnFrame(11)
%Twinrova_Hurt() %Twinrova_Hurt()
RTS RTS
} }
} }
@@ -488,118 +477,118 @@ Sprite_Twinrova_Main:
RageModeMove: RageModeMove:
{ {
; If timer is zero, determine a new movement mode ; If timer is zero, determine a new movement mode
LDA SprTimerA, X : BEQ .DetermineMovementMode LDA SprTimerA, X : BEQ .DetermineMovementMode
; Execute current movement mode ; Execute current movement mode
LDA SprMiscA, X LDA SprMiscA, X
CMP #$01 : BEQ .MoveTowardsPlayer CMP #$01 : BEQ .MoveTowardsPlayer
CMP #$02 : BEQ .RandomStrafe CMP #$02 : BEQ .RandomStrafe
CMP #$03 : BEQ .RandomDodge CMP #$03 : BEQ .RandomDodge
CMP #$04 : BEQ .StayInPlace CMP #$04 : BEQ .StayInPlace
JMP .UpdatePosition JMP .UpdatePosition
.DetermineMovementMode .DetermineMovementMode
; Determine random movement mode with weighted probabilities ; Determine random movement mode with weighted probabilities
JSL GetRandomInt JSL GetRandomInt
AND.b #$0F AND.b #$0F
CMP.b #$05 CMP.b #$05
BCC .SetMoveTowardsPlayer ; 0-5 -> Predictive movement towards player BCC .SetMoveTowardsPlayer ; 0-5 -> Predictive movement towards player
CMP.b #$0A CMP.b #$0A
BCC .SetRandomStrafe ; 6-10 -> Random strafe BCC .SetRandomStrafe ; 6-10 -> Random strafe
CMP.b #$0E CMP.b #$0E
BCC .SetRandomDodge ; 11-14 -> Random dodge BCC .SetRandomDodge ; 11-14 -> Random dodge
; 15 -> Stay in place ; 15 -> Stay in place
LDA.b #$04 : STA.w SprMiscA, X LDA.b #$04 : STA.w SprMiscA, X
LDA.b #$30 : STA.w SprTimerA, X ; Set timer for 48 frames LDA.b #$30 : STA.w SprTimerA, X ; Set timer for 48 frames
RTS RTS
BRA .StayInPlace BRA .StayInPlace
.SetMoveTowardsPlayer .SetMoveTowardsPlayer
LDA.b #$01 : STA.w SprMiscA, X LDA.b #$01 : STA.w SprMiscA, X
LDA.b #$30 : STA.w SprTimerA, X ; Set timer for 48 frames LDA.b #$30 : STA.w SprTimerA, X ; Set timer for 48 frames
BRA .MoveTowardsPlayer BRA .MoveTowardsPlayer
.SetRandomStrafe .SetRandomStrafe
LDA.b #$02 : STA.w SprMiscA, X LDA.b #$02 : STA.w SprMiscA, X
LDA.b #$30 : STA.w SprTimerA, X ; Set timer for 48 frames LDA.b #$30 : STA.w SprTimerA, X ; Set timer for 48 frames
BRA .RandomStrafe BRA .RandomStrafe
.SetRandomDodge .SetRandomDodge
LDA.b #$03 : STA.w SprMiscA, X LDA.b #$03 : STA.w SprMiscA, X
LDA.b #$30 : STA.w SprTimerA, X ; Set timer for 48 frames LDA.b #$30 : STA.w SprTimerA, X ; Set timer for 48 frames
BRA .RandomDodge BRA .RandomDodge
.MoveTowardsPlayer .MoveTowardsPlayer
; Predictive movement towards player with altitude increase ; Predictive movement towards player with altitude increase
JSL Sprite_DirectionToFacePlayer JSL Sprite_DirectionToFacePlayer
JSL Sprite_ApplySpeedTowardsPlayer JSL Sprite_ApplySpeedTowardsPlayer
LDA.b #$10 : STA.w SprHeight, X ; Set height LDA.b #$10 : STA.w SprHeight, X ; Set height
BRA .UpdatePosition BRA .UpdatePosition
.RandomStrafe .RandomStrafe
JSR DoRandomStrafe JSR DoRandomStrafe
BRA .UpdatePosition BRA .UpdatePosition
.RandomDodge .RandomDodge
; Random dodge with controlled movement ; Random dodge with controlled movement
JSL GetRandomInt JSL GetRandomInt
AND.b #$03 AND.b #$03
TAY TAY
LDA VelocityOffsets+4, Y : STA.w SprXSpeed, X LDA VelocityOffsets+4, Y : STA.w SprXSpeed, X
INY INY
LDA VelocityOffsets, Y : STA.w SprYSpeed, X LDA VelocityOffsets, Y : STA.w SprYSpeed, X
LDA.b #$10 : STA.w SprHeight, X ; Set height LDA.b #$10 : STA.w SprHeight, X ; Set height
BRA .UpdatePosition BRA .UpdatePosition
.StayInPlace .StayInPlace
; Stay in place to prepare for attack or other action ; Stay in place to prepare for attack or other action
STZ.w SprXSpeed, X STZ.w SprXSpeed, X
STZ.w SprYSpeed, X STZ.w SprYSpeed, X
LDA.b #$10 : STA.w SprHeight, X ; Set height LDA.b #$10 : STA.w SprHeight, X ; Set height
BRA .UpdatePosition BRA .UpdatePosition
.Evasive .Evasive
; Evasive action if too close to player ; Evasive action if too close to player
JSL GetRandomInt JSL GetRandomInt
AND.b #$03 AND.b #$03
TAY TAY
LDA VelocityOffsets, Y : EOR #$FF : INC : STA.w SprXSpeed, X LDA VelocityOffsets, Y : EOR #$FF : INC : STA.w SprXSpeed, X
INY INY
LDA VelocityOffsets+4, Y : EOR #$FF : INC : STA.w SprYSpeed, X LDA VelocityOffsets+4, Y : EOR #$FF : INC : STA.w SprYSpeed, X
LDA.b #$10 : STA.w SprHeight, X ; Set height LDA.b #$10 : STA.w SprHeight, X ; Set height
BRA .UpdatePosition BRA .UpdatePosition
.UpdatePosition .UpdatePosition
; Handle floaty movement with controlled altitude ; Handle floaty movement with controlled altitude
LDA.w SprHeight, X : CMP #$10 : BNE .CheckGrounded LDA.w SprHeight, X : CMP #$10 : BNE .CheckGrounded
DEC.w SprHeight, X DEC.w SprHeight, X
DEC.w $0F90, X DEC.w $0F90, X
.CheckGrounded .CheckGrounded
; Move sprite ; Move sprite
JSL Sprite_Move JSL Sprite_Move
; Check for tile collision and bounce if necessary ; Check for tile collision and bounce if necessary
JSL Sprite_BounceFromTileCollision JSL Sprite_BounceFromTileCollision
; Reduce the state timer and reset state if necessary ; Reduce the state timer and reset state if necessary
DEC.w SprTimerA, X DEC.w SprTimerA, X
RTS RTS
} }
DoRandomStrafe: DoRandomStrafe:
{ {
; Random strafe with controlled movement ; Random strafe with controlled movement
JSL GetRandomInt JSL GetRandomInt
AND.b #$03 AND.b #$03
TAY TAY
LDA VelocityOffsets, Y : STA.w SprXSpeed, X LDA VelocityOffsets, Y : STA.w SprXSpeed, X
INY INY
LDA VelocityOffsets+4, Y : STA.w SprYSpeed, X LDA VelocityOffsets+4, Y : STA.w SprYSpeed, X
LDA.b #$10 : STA.w SprHeight, X ; Set height LDA.b #$10 : STA.w SprHeight, X ; Set height
RTS RTS
} }
; Velocity offsets table ; Velocity offsets table
@@ -617,31 +606,30 @@ TargetPositions:
; Reused function from TrinexxBreath. ; Reused function from TrinexxBreath.
TrinexxBreath_AltEntry: TrinexxBreath_AltEntry:
{ {
LDA $1A : AND.b #$07 : BNE .no_adjustment LDA $1A : AND.b #$07 : BNE .no_adjustment
JSL GetRandomInt JSL GetRandomInt
AND.b #$03 AND.b #$03
TAY TAY
LDA SpeedAdjustments, Y : CLC : ADC $0D50, X : STA $0D50, X LDA SpeedAdjustments, Y : CLC : ADC $0D50, X : STA $0D50, X
LDA SpeedAdjustments+4, Y : CLC : ADC $0D40, X : STA $0D40, X LDA SpeedAdjustments+4, Y : CLC : ADC $0D40, X : STA $0D40, X
.no_adjustment
.no_adjustment
JSL Sprite_BounceFromTileCollision JSL Sprite_BounceFromTileCollision
LDA $1A : AND.b #$03 : BNE .no_shake LDA $1A : AND.b #$03 : BNE .no_shake
JSL Sprite_IsToRightOfPlayer JSL Sprite_IsToRightOfPlayer
LDA $0D50, X : CMP .x_speed_targets, Y : BEQ .no_shake LDA $0D50, X : CMP .x_speed_targets, Y : BEQ .no_shake
CLC : ADC.w .shake_x, Y : STA $0D50, X CLC : ADC.w .shake_x, Y : STA $0D50, X
.no_shake .no_shake
JSL Sprite_IsBelowPlayer JSL Sprite_IsBelowPlayer
LDA $0D40, X : CMP .x_speed_targets, Y : BEQ .exit LDA $0D40, X : CMP .x_speed_targets, Y : BEQ .exit
CLC : ADC.w .shake_y, Y : STA $0D40, X CLC : ADC.w .shake_y, Y : STA $0D40, X
JSL Sprite_CheckTileCollision : BEQ .exit JSL Sprite_CheckTileCollision : BEQ .exit
JSL Sprite_FloatTowardPlayer JSL Sprite_FloatTowardPlayer
.exit .exit
RTS RTS
.x_speed_targets .x_speed_targets
db 16, -16 db 16, -16
@@ -652,18 +640,19 @@ TrinexxBreath_AltEntry:
.shake_y .shake_y
db 0, -1 db 0, -1
SpeedAdjustments: ; Adjustments for xy speeds (small positive, small negative)
db $02, $FE, $04, $FC ; Adjustments for X speeds (small positive, small negative) SpeedAdjustments:
db $01, $FF, $02, $FE ; Adjustments for Y speeds (small positive, small negative) db $02, $FE, $04, $FC ; X
db $01, $FF, $02, $FE ; Y
} }
Sprite_Twinrova_FireAttack: Sprite_Twinrova_FireAttack:
{ {
JSL Sprite_CheckTileCollision : BNE .no_collision JSL Sprite_CheckTileCollision : BNE .no_collision
JSL Sprite_Move JSL Sprite_Move
.no_collision .no_collision
JSR AddFireGarnish JSR AddFireGarnish
JMP TrinexxBreath_AltEntry JMP TrinexxBreath_AltEntry
} }
; $1DBDD6 - TrinexxFire_AddFireGarnish ; $1DBDD6 - TrinexxFire_AddFireGarnish
@@ -698,11 +687,11 @@ AddFireGarnish:
Sprite_Twinrova_IceAttack: Sprite_Twinrova_IceAttack:
{ {
JSL Sprite_CheckTileCollision : BNE .no_collision JSL Sprite_CheckTileCollision : BNE .no_collision
JSL Sprite_Move JSL Sprite_Move
.no_collision .no_collision
JSR AddIceGarnishV2 JSR AddIceGarnishV2
JMP TrinexxBreath_AltEntry JMP TrinexxBreath_AltEntry
} }
; $1DBD65 - TrinexxBreath_ice_add_ice_garnish ; $1DBD65 - TrinexxBreath_ice_add_ice_garnish