Cleanup Minecart
This commit is contained in:
@@ -67,15 +67,13 @@ Right = $03
|
||||
Sprite_Minecart_Long:
|
||||
{
|
||||
PHB : PHK : PLB
|
||||
|
||||
JSR Sprite_Minecart_DrawTop ; Draws the top half behind Link
|
||||
JSR Sprite_Minecart_DrawBottom ; Draw the bottom half in front of Link
|
||||
JSL Sprite_CheckActive ; Check if game is not paused
|
||||
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
|
||||
JSR Sprite_Minecart_Main ; Call the main sprite code
|
||||
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
|
||||
JSR Sprite_Minecart_Main
|
||||
.SpriteIsNotActive
|
||||
PLB ; Get back the databank we stored previously
|
||||
RTL ; Go back to original code
|
||||
PLB
|
||||
RTL
|
||||
}
|
||||
|
||||
; =========================================================
|
||||
@@ -123,7 +121,6 @@ Sprite_Minecart_Prep:
|
||||
LDA.b #West : STA !MinecartDirection
|
||||
LDA.b #Left : STA !SpriteDirection, X
|
||||
%GotoAction(0) ; Minecart_WaitHoriz
|
||||
|
||||
.done
|
||||
PLB
|
||||
RTL
|
||||
@@ -169,7 +166,7 @@ endmacro
|
||||
; the cart is facing and sets the velocity of the cart
|
||||
; based on the direction it is facing.
|
||||
|
||||
HandleToss:
|
||||
Minecart_HandleToss:
|
||||
{
|
||||
; Check links facing direction $2F and apply velocity
|
||||
LDA $2F : CMP.b #$00 : BEQ .toss_north
|
||||
@@ -205,19 +202,19 @@ HandleToss:
|
||||
RTS
|
||||
}
|
||||
|
||||
HandleLiftAndToss:
|
||||
Minecart_HandleLiftAndToss:
|
||||
{
|
||||
JSR CheckIfPlayerIsOn : BCC .not_tossing
|
||||
LDA.w LinkCarryOrToss : CMP.b #$02 : BNE .not_tossing
|
||||
JSR HandleToss
|
||||
JSR Minecart_HandleToss
|
||||
.not_tossing
|
||||
JSL Sprite_CheckIfLifted
|
||||
JSL Sprite_Move
|
||||
JSR HandleTossedCart
|
||||
JSR Minecart_HandleTossedCart
|
||||
RTS
|
||||
}
|
||||
|
||||
HandleTossedCart:
|
||||
Minecart_HandleTossedCart:
|
||||
{
|
||||
LDA.w SprMiscG, X : BEQ .not_tossed
|
||||
LDA.w SprHeight, X : BEQ .low_enough
|
||||
@@ -282,7 +279,7 @@ Sprite_Minecart_Main:
|
||||
|
||||
.not_ready
|
||||
.lifting
|
||||
JSR HandleLiftAndToss
|
||||
JSR Minecart_HandleLiftAndToss
|
||||
JSL ThrownSprite_TileAndSpriteInteraction_long
|
||||
RTS
|
||||
}
|
||||
@@ -309,7 +306,6 @@ Sprite_Minecart_Main:
|
||||
LDA #$01 : STA !SpriteDirection, X
|
||||
%GotoAction(4) ; Minecart_MoveSouth
|
||||
RTS
|
||||
|
||||
.opposite_direction
|
||||
STA.w !MinecartDirection
|
||||
LDA #$00 : STA !SpriteDirection, X
|
||||
@@ -318,7 +314,7 @@ Sprite_Minecart_Main:
|
||||
|
||||
.not_ready
|
||||
.lifting
|
||||
JSR HandleLiftAndToss
|
||||
JSR Minecart_HandleLiftAndToss
|
||||
JSL ThrownSprite_TileAndSpriteInteraction_long
|
||||
RTS
|
||||
}
|
||||
@@ -329,7 +325,6 @@ Sprite_Minecart_Main:
|
||||
{
|
||||
%PlayAnimation(2,3,8)
|
||||
%InitMovement()
|
||||
|
||||
LDA $36 : BNE .fast_speed
|
||||
LDA.b #-!MinecartSpeed : STA.w SprYSpeed, X
|
||||
JMP .continue
|
||||
@@ -344,7 +339,6 @@ Sprite_Minecart_Main:
|
||||
JSR CheckForPlayerInput
|
||||
%HandlePlayerCamera()
|
||||
%MoveCart()
|
||||
|
||||
RTS
|
||||
}
|
||||
|
||||
@@ -354,12 +348,11 @@ Sprite_Minecart_Main:
|
||||
{
|
||||
%PlayAnimation(0,1,8)
|
||||
%InitMovement()
|
||||
|
||||
LDA $36 : BNE .fast_speed
|
||||
LDA.b #!MinecartSpeed : STA $0D50, X
|
||||
JMP .continue
|
||||
.fast_speed
|
||||
LDA.b #!DoubleSpeed : STA $0D50, X
|
||||
LDA.b #!DoubleSpeed : STA.w SprXSpeed, X
|
||||
.continue
|
||||
JSL Sprite_MoveHoriz
|
||||
|
||||
@@ -369,7 +362,6 @@ Sprite_Minecart_Main:
|
||||
JSR CheckForPlayerInput
|
||||
%HandlePlayerCamera()
|
||||
%MoveCart()
|
||||
|
||||
RTS
|
||||
}
|
||||
|
||||
@@ -379,7 +371,6 @@ Sprite_Minecart_Main:
|
||||
{
|
||||
%PlayAnimation(2,3,8)
|
||||
%InitMovement()
|
||||
|
||||
LDA $36 : BNE .fast_speed
|
||||
LDA.b #!MinecartSpeed : STA.w SprYSpeed, X
|
||||
JMP .continue
|
||||
@@ -394,7 +385,6 @@ Sprite_Minecart_Main:
|
||||
JSR CheckForPlayerInput
|
||||
%HandlePlayerCamera()
|
||||
%MoveCart()
|
||||
|
||||
RTS
|
||||
}
|
||||
|
||||
@@ -406,10 +396,10 @@ Sprite_Minecart_Main:
|
||||
%InitMovement()
|
||||
|
||||
LDA $36 : BNE .fast_speed
|
||||
LDA.b #-!MinecartSpeed : STA $0D50, X
|
||||
LDA.b #-!MinecartSpeed : STA.w SprXSpeed, X
|
||||
JMP .continue
|
||||
.fast_speed
|
||||
LDA.b #-!DoubleSpeed : STA $0D50, X
|
||||
LDA.b #-!DoubleSpeed : STA.w SprXSpeed, X
|
||||
.continue
|
||||
JSL Sprite_MoveHoriz
|
||||
|
||||
@@ -419,7 +409,6 @@ Sprite_Minecart_Main:
|
||||
JSR CheckForPlayerInput
|
||||
%HandlePlayerCamera()
|
||||
%MoveCart()
|
||||
|
||||
RTS
|
||||
}
|
||||
|
||||
@@ -429,7 +418,6 @@ Sprite_Minecart_Main:
|
||||
Minecart_Release:
|
||||
{
|
||||
%StopCart()
|
||||
|
||||
LDA.w SprTimerD, X : BNE .not_ready
|
||||
LDA #$40 : STA.w SprTimerA, X
|
||||
LDA.w !SpriteDirection, X : CMP.b #$00 : BEQ .vert
|
||||
@@ -545,15 +533,15 @@ HandleTileDirections:
|
||||
JMP .done
|
||||
.check_direction
|
||||
LDA.w SprSubtype, X
|
||||
ASL #2 ; Multiply by 4 (shifting left by 2 bits) to offset rows in the lookup table
|
||||
ASL #2 ; Multiply by 4 to offset rows in the lookup table
|
||||
STA $07 ; Store the action index in $07
|
||||
|
||||
LDA $0FA5 ; Load the tile type
|
||||
SEC : SBC.b #$B2 ; Subtract $B2 to normalize the tile type to 0 to 3
|
||||
CLC : ADC.w $07 ; Add the action index to the tile type offset to get the composite index
|
||||
TAY ; Transfer to Y to use as an offset for the rows
|
||||
; Subtract $B2 to normalize the tile type to 0 to 3
|
||||
LDA.w SPRTILE : SEC : SBC.b #$B2
|
||||
; Add action index to tile type offset for the composite index
|
||||
; Transfer to Y to use as an offset for the rows
|
||||
CLC : ADC.w $07 : TAY
|
||||
LDA.w .DirectionTileLookup, Y : TAY
|
||||
|
||||
CPY #$01 : BEQ .move_north
|
||||
CPY #$02 : BEQ .move_east
|
||||
CPY #$03 : BEQ .move_south
|
||||
@@ -682,7 +670,6 @@ CheckSpritePresence:
|
||||
CPX.b #$00 : BNE .x_loop
|
||||
.done
|
||||
PLX
|
||||
|
||||
RTS
|
||||
}
|
||||
|
||||
@@ -939,27 +926,18 @@ Sprite_Minecart_DrawBottom:
|
||||
RoomTag_ShutterDoorRequiresCart:
|
||||
{
|
||||
LDA.w !LinkInCart : BEQ .no_cart
|
||||
#_01C49E: REP #$30
|
||||
|
||||
#_01C4A0: LDX.w #$0000
|
||||
#_01C4A3: CPX.w $0468
|
||||
#_01C4A6: BEQ .exit
|
||||
|
||||
#_01C4A8: STZ.w $0468
|
||||
|
||||
#_01C4AB: STZ.w $068E
|
||||
#_01C4AE: STZ.w $0690
|
||||
|
||||
#_01C4B1: SEP #$30
|
||||
|
||||
#_01C4B3: LDA.b #$1B ; SFX3.1B
|
||||
#_01C4B5: STA.w $012F
|
||||
|
||||
#_01C4B8: LDA.b #$05
|
||||
#_01C4BA: STA.b $11
|
||||
REP #$30
|
||||
LDX.w #$0000 : CPX.w $0468 : BEQ .exit
|
||||
STZ.w $0468
|
||||
STZ.w $068E
|
||||
STZ.w $0690
|
||||
SEP #$30
|
||||
|
||||
; SFX3.1B
|
||||
LDA.b #$1B : STA.w $012F
|
||||
LDA.b #$05 : STA.b $11
|
||||
.exit
|
||||
#_01C4BC: SEP #$30
|
||||
SEP #$30
|
||||
.no_cart
|
||||
JML $01CC5A
|
||||
}
|
||||
@@ -970,8 +948,7 @@ pushpc
|
||||
org $01CC08
|
||||
RoomTag_Holes3:
|
||||
JML RoomTag_ShutterDoorRequiresCart
|
||||
; #_01CC08: LDA.b #$06
|
||||
; #_01CC0A: BRA RoomTag_TriggerHoles
|
||||
; LDA.b #$06 : BRA RoomTag_TriggerHoles
|
||||
|
||||
pullpc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user