Add comments and cleanup Minecart, Mineswitch, switch_track
This commit is contained in:
@@ -1,6 +1,25 @@
|
|||||||
; =========================================================
|
; =========================================================
|
||||||
; Minecart Sprite Properties
|
; Minecart Sprite
|
||||||
; =========================================================
|
;
|
||||||
|
; Used in Goron Mines along with the SwitchTrack and
|
||||||
|
; Mineswitch sprite. Makes use of custom collision with
|
||||||
|
; somaria track corner tiles.
|
||||||
|
;
|
||||||
|
; The cart begins in an inactive state, horizontal or vertical
|
||||||
|
; and is activated by the player when they stand on the hitbox
|
||||||
|
; and press the B button. Based on the subtype of the cart,
|
||||||
|
; it will move in that direction until it encounters one of the
|
||||||
|
; following scenarions:
|
||||||
|
;
|
||||||
|
; Somaria Stop Tile - Halt the cart and set its next direction
|
||||||
|
; Somaria Corner Track - Switch directions based on cart direction
|
||||||
|
; and corner tiletype.
|
||||||
|
; Somaria Any Track - Switch direction based on player input
|
||||||
|
; Dungeon Transition - Switch to Minecart follower and transition
|
||||||
|
; to the next room in a dungeon, spawning
|
||||||
|
; a new minecart sprite in the room at Link's
|
||||||
|
; location and configuring the direction to move
|
||||||
|
; in automatically (no B button to activate)
|
||||||
|
|
||||||
!SPRID = Sprite_Minecart
|
!SPRID = Sprite_Minecart
|
||||||
!NbrTiles = 08 ; Number of tiles used in a frame
|
!NbrTiles = 08 ; Number of tiles used in a frame
|
||||||
@@ -39,27 +58,28 @@
|
|||||||
!MinecartSpeed = 20
|
!MinecartSpeed = 20
|
||||||
!DoubleSpeed = 30
|
!DoubleSpeed = 30
|
||||||
|
|
||||||
North = $00
|
; SprSubtype and Minecart movement direction
|
||||||
East = $01
|
|
||||||
South = $02
|
|
||||||
West = $03
|
|
||||||
; nesw
|
; nesw
|
||||||
; 0 - north
|
; 0 - north
|
||||||
; 1 - east
|
; 1 - east
|
||||||
; 2 - south
|
; 2 - south
|
||||||
; 3 - west
|
; 3 - west
|
||||||
|
North = $00
|
||||||
|
East = $01
|
||||||
|
South = $02
|
||||||
|
West = $03
|
||||||
!MinecartDirection = $012B
|
!MinecartDirection = $012B
|
||||||
|
|
||||||
|
; Sprite Facing Direction
|
||||||
|
; udlr
|
||||||
|
; 0 - up
|
||||||
|
; 1 - down
|
||||||
|
; 2 - left
|
||||||
|
; 3 - right
|
||||||
Up = $00
|
Up = $00
|
||||||
Down = $01
|
Down = $01
|
||||||
Left = $02
|
Left = $02
|
||||||
Right = $03
|
Right = $03
|
||||||
; $0DE0[0x10] - (Sprite) ;functions
|
|
||||||
; udlr
|
|
||||||
; 0 - up
|
|
||||||
; 1 - down
|
|
||||||
; 2 - left
|
|
||||||
; 3 - right
|
|
||||||
!SpriteDirection = $0DE0
|
!SpriteDirection = $0DE0
|
||||||
|
|
||||||
; =========================================================
|
; =========================================================
|
||||||
@@ -67,8 +87,8 @@ Right = $03
|
|||||||
Sprite_Minecart_Long:
|
Sprite_Minecart_Long:
|
||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
JSR Sprite_Minecart_DrawTop ; Draws the top half behind Link
|
JSR Sprite_Minecart_DrawTop ; Draw behind Link
|
||||||
JSR Sprite_Minecart_DrawBottom ; Draw the bottom half in front of Link
|
JSR Sprite_Minecart_DrawBottom ; Draw in front of Link
|
||||||
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
|
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
|
||||||
JSR Sprite_Minecart_Main
|
JSR Sprite_Minecart_Main
|
||||||
.SpriteIsNotActive
|
.SpriteIsNotActive
|
||||||
@@ -77,6 +97,9 @@ Sprite_Minecart_Long:
|
|||||||
}
|
}
|
||||||
|
|
||||||
; =========================================================
|
; =========================================================
|
||||||
|
; The subtype of the minecart determines the direction it
|
||||||
|
; will move in, so if the subtype is 0 the cart will move
|
||||||
|
; north and start in WaitVert mode.
|
||||||
|
|
||||||
Sprite_Minecart_Prep:
|
Sprite_Minecart_Prep:
|
||||||
{
|
{
|
||||||
@@ -86,24 +109,23 @@ Sprite_Minecart_Prep:
|
|||||||
STZ.w SprMiscG, X ; Clear the active tossing flag
|
STZ.w SprMiscG, X ; Clear the active tossing flag
|
||||||
|
|
||||||
; If the subtype is > 4, then it's an active cart
|
; If the subtype is > 4, then it's an active cart
|
||||||
LDA.w SprSubtype, X : CMP.b #$04 : BCC .continue
|
LDA.w SprSubtype, X : CMP.b #$04 : BCC +
|
||||||
LDA.w SprSubtype, X : SEC : SBC.b #$03 : STA.w SprSubtype, X
|
LDA.w SprSubtype, X : SEC : SBC.b #$03 : STA.w SprSubtype, X
|
||||||
LDA.b #$01 : STA.w SprMiscF, X ; Set the auto-move flag
|
LDA.b #$01 : STA.w SprMiscF, X ; Set the auto-move flag
|
||||||
.continue
|
+
|
||||||
LDA #$00 : STA $0CAA, X ; Sprite persist in dungeon
|
|
||||||
LDA #$04 : STA $0E40, X ; Nbr Oam Entries
|
|
||||||
LDA #$40 : STA $0E60, x ; Impervious props
|
|
||||||
LDA #$E0 : STA $0F60, X ; Persist
|
|
||||||
LDA #$00 : STA.w SprBump, X ; No bump damage
|
|
||||||
LDA #$00 : STA $0B6B, X ; Set interactive hitbox?
|
|
||||||
|
|
||||||
|
LDA #$04 : STA.w SprNbrOAM, X ; Nbr Oam Entries
|
||||||
|
LDA #$40 : STA.w SprGfxProps, X ; Impervious props
|
||||||
|
LDA #$E0 : STA.w SprHitbox, X ; Persist outside camera
|
||||||
|
STZ.w SprDefl, X ; Sprite persist in dungeon
|
||||||
|
STZ.w SprBump, X ; No bump damage
|
||||||
|
STZ.w SprTileDie, X ; Set interactive hitbox
|
||||||
STZ.w !MinecartDirection
|
STZ.w !MinecartDirection
|
||||||
|
|
||||||
LDA.w SprSubtype, X : CMP.b #$00 : BEQ .north
|
LDA.w SprSubtype, X : CMP.b #$00 : BEQ .north
|
||||||
CMP.b #$01 : BEQ .east
|
CMP.b #$01 : BEQ .east
|
||||||
CMP.b #$02 : BEQ .south
|
CMP.b #$02 : BEQ .south
|
||||||
CMP.b #$03 : BEQ .west
|
CMP.b #$03 : BEQ .west
|
||||||
|
|
||||||
.north
|
.north
|
||||||
%GotoAction(1) ; Minecart_WaitVert
|
%GotoAction(1) ; Minecart_WaitVert
|
||||||
JMP .done
|
JMP .done
|
||||||
@@ -113,8 +135,8 @@ Sprite_Minecart_Prep:
|
|||||||
%GotoAction(0) ; Minecart_WaitHoriz
|
%GotoAction(0) ; Minecart_WaitHoriz
|
||||||
JMP .done
|
JMP .done
|
||||||
.south
|
.south
|
||||||
LDA #$02 : STA !MinecartDirection
|
LDA.b #South : STA !MinecartDirection
|
||||||
LDA #$01 : STA !SpriteDirection, X
|
LDA.b #Down : STA !SpriteDirection, X
|
||||||
%GotoAction(1) ; Minecart_WaitVert
|
%GotoAction(1) ; Minecart_WaitVert
|
||||||
JMP .done
|
JMP .done
|
||||||
.west
|
.west
|
||||||
@@ -122,8 +144,8 @@ Sprite_Minecart_Prep:
|
|||||||
LDA.b #Left : STA !SpriteDirection, X
|
LDA.b #Left : STA !SpriteDirection, X
|
||||||
%GotoAction(0) ; Minecart_WaitHoriz
|
%GotoAction(0) ; Minecart_WaitHoriz
|
||||||
.done
|
.done
|
||||||
PLB
|
PLB
|
||||||
RTL
|
RTL
|
||||||
}
|
}
|
||||||
|
|
||||||
; =========================================================
|
; =========================================================
|
||||||
@@ -132,10 +154,8 @@ macro HandlePlayerCamera()
|
|||||||
LDA $22 : SEC : SBC $3F : STA $31
|
LDA $22 : SEC : SBC $3F : STA $31
|
||||||
LDA $20 : SEC : SBC $3E : STA $30
|
LDA $20 : SEC : SBC $3E : STA $30
|
||||||
PHX
|
PHX
|
||||||
|
|
||||||
JSL Link_HandleMovingAnimation_FullLongEntry
|
JSL Link_HandleMovingAnimation_FullLongEntry
|
||||||
JSL HandleIndoorCameraAndDoors
|
JSL HandleIndoorCameraAndDoors
|
||||||
|
|
||||||
JSL Link_CancelDash
|
JSL Link_CancelDash
|
||||||
PLX
|
PLX
|
||||||
endmacro
|
endmacro
|
||||||
@@ -202,6 +222,25 @@ Minecart_HandleToss:
|
|||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Minecart_HandleTossedCart:
|
||||||
|
{
|
||||||
|
LDA.w SprMiscG, X : BEQ .not_tossed
|
||||||
|
LDA.w SprHeight, X : BEQ .low_enough
|
||||||
|
DEC.w SprHeight, X
|
||||||
|
RTS
|
||||||
|
.low_enough
|
||||||
|
|
||||||
|
LDA.w SprTimerC, X : BNE .not_tossed
|
||||||
|
LDA.w SprX, X : AND.b #$F8 : STA.w SprX, X
|
||||||
|
LDA.w SprY, X : AND.b #$F8 : STA.w SprY, X
|
||||||
|
STZ.w SprMiscG, X
|
||||||
|
STZ.w SprYSpeed, X
|
||||||
|
STZ.w SprXSpeed, X
|
||||||
|
STZ.w SprHeight, X
|
||||||
|
.not_tossed
|
||||||
|
RTS
|
||||||
|
}
|
||||||
|
|
||||||
Minecart_HandleLiftAndToss:
|
Minecart_HandleLiftAndToss:
|
||||||
{
|
{
|
||||||
JSR CheckIfPlayerIsOn : BCC .not_tossing
|
JSR CheckIfPlayerIsOn : BCC .not_tossing
|
||||||
@@ -211,25 +250,7 @@ Minecart_HandleLiftAndToss:
|
|||||||
JSL Sprite_CheckIfLifted
|
JSL Sprite_CheckIfLifted
|
||||||
JSL Sprite_Move
|
JSL Sprite_Move
|
||||||
JSR Minecart_HandleTossedCart
|
JSR Minecart_HandleTossedCart
|
||||||
RTS
|
JSL ThrownSprite_TileAndSpriteInteraction_long
|
||||||
}
|
|
||||||
|
|
||||||
Minecart_HandleTossedCart:
|
|
||||||
{
|
|
||||||
LDA.w SprMiscG, X : BEQ .not_tossed
|
|
||||||
LDA.w SprHeight, X : BEQ .low_enough
|
|
||||||
DEC.w SprHeight, X
|
|
||||||
RTS
|
|
||||||
.low_enough
|
|
||||||
|
|
||||||
LDA.w SprTimerC, X : BNE .not_tossed
|
|
||||||
LDA.w SprX, X : AND.b #$F8 : STA.w SprX, X
|
|
||||||
LDA.w SprY, X : AND.b #$F8 : STA.w SprY, X
|
|
||||||
STZ.w SprMiscG, X
|
|
||||||
STZ.w SprYSpeed, X
|
|
||||||
STZ.w SprXSpeed, X
|
|
||||||
STZ.w SprHeight, X
|
|
||||||
.not_tossed
|
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,17 +291,14 @@ Sprite_Minecart_Main:
|
|||||||
LDA #$02 : STA !SpriteDirection, X
|
LDA #$02 : STA !SpriteDirection, X
|
||||||
%GotoAction(5) ; Minecart_MoveWest
|
%GotoAction(5) ; Minecart_MoveWest
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.opposite_direction
|
.opposite_direction
|
||||||
STA.w !MinecartDirection
|
STA.w !MinecartDirection
|
||||||
LDA #$03 : STA !SpriteDirection, X
|
LDA #$03 : STA !SpriteDirection, X
|
||||||
%GotoAction(3) ; Minecart_MoveEast
|
%GotoAction(3) ; Minecart_MoveEast
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.not_ready
|
.not_ready
|
||||||
.lifting
|
.lifting
|
||||||
JSR Minecart_HandleLiftAndToss
|
JSR Minecart_HandleLiftAndToss
|
||||||
JSL ThrownSprite_TileAndSpriteInteraction_long
|
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,11 +329,9 @@ Sprite_Minecart_Main:
|
|||||||
LDA #$00 : STA !SpriteDirection, X
|
LDA #$00 : STA !SpriteDirection, X
|
||||||
%GotoAction(2) ; Minecart_MoveNorth
|
%GotoAction(2) ; Minecart_MoveNorth
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.not_ready
|
.not_ready
|
||||||
.lifting
|
.lifting
|
||||||
JSR Minecart_HandleLiftAndToss
|
JSR Minecart_HandleLiftAndToss
|
||||||
JSL ThrownSprite_TileAndSpriteInteraction_long
|
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,10 +343,10 @@ Sprite_Minecart_Main:
|
|||||||
%InitMovement()
|
%InitMovement()
|
||||||
LDA $36 : BNE .fast_speed
|
LDA $36 : BNE .fast_speed
|
||||||
LDA.b #-!MinecartSpeed : STA.w SprYSpeed, X
|
LDA.b #-!MinecartSpeed : STA.w SprYSpeed, X
|
||||||
JMP .continue
|
JMP +
|
||||||
.fast_speed
|
.fast_speed
|
||||||
LDA.b #-!DoubleSpeed : STA.w SprYSpeed, X
|
LDA.b #-!DoubleSpeed : STA.w SprYSpeed, X
|
||||||
.continue
|
+
|
||||||
JSL Sprite_MoveVert
|
JSL Sprite_MoveVert
|
||||||
|
|
||||||
; Get direction of the cart (0 to 3)
|
; Get direction of the cart (0 to 3)
|
||||||
@@ -350,10 +366,10 @@ Sprite_Minecart_Main:
|
|||||||
%InitMovement()
|
%InitMovement()
|
||||||
LDA $36 : BNE .fast_speed
|
LDA $36 : BNE .fast_speed
|
||||||
LDA.b #!MinecartSpeed : STA $0D50, X
|
LDA.b #!MinecartSpeed : STA $0D50, X
|
||||||
JMP .continue
|
JMP +
|
||||||
.fast_speed
|
.fast_speed
|
||||||
LDA.b #!DoubleSpeed : STA.w SprXSpeed, X
|
LDA.b #!DoubleSpeed : STA.w SprXSpeed, X
|
||||||
.continue
|
+
|
||||||
JSL Sprite_MoveHoriz
|
JSL Sprite_MoveHoriz
|
||||||
|
|
||||||
; Get direction of the cart (0 to 3)
|
; Get direction of the cart (0 to 3)
|
||||||
@@ -373,10 +389,10 @@ Sprite_Minecart_Main:
|
|||||||
%InitMovement()
|
%InitMovement()
|
||||||
LDA $36 : BNE .fast_speed
|
LDA $36 : BNE .fast_speed
|
||||||
LDA.b #!MinecartSpeed : STA.w SprYSpeed, X
|
LDA.b #!MinecartSpeed : STA.w SprYSpeed, X
|
||||||
JMP .continue
|
JMP +
|
||||||
.fast_speed
|
.fast_speed
|
||||||
LDA.b #!DoubleSpeed : STA.w SprYSpeed, X
|
LDA.b #!DoubleSpeed : STA.w SprYSpeed, X
|
||||||
.continue
|
+
|
||||||
JSL Sprite_MoveVert
|
JSL Sprite_MoveVert
|
||||||
|
|
||||||
; Get direction of the cart (0 to 3)
|
; Get direction of the cart (0 to 3)
|
||||||
@@ -397,10 +413,10 @@ Sprite_Minecart_Main:
|
|||||||
|
|
||||||
LDA $36 : BNE .fast_speed
|
LDA $36 : BNE .fast_speed
|
||||||
LDA.b #-!MinecartSpeed : STA.w SprXSpeed, X
|
LDA.b #-!MinecartSpeed : STA.w SprXSpeed, X
|
||||||
JMP .continue
|
JMP +
|
||||||
.fast_speed
|
.fast_speed
|
||||||
LDA.b #-!DoubleSpeed : STA.w SprXSpeed, X
|
LDA.b #-!DoubleSpeed : STA.w SprXSpeed, X
|
||||||
.continue
|
+
|
||||||
JSL Sprite_MoveHoriz
|
JSL Sprite_MoveHoriz
|
||||||
|
|
||||||
; Get direction of the cart (0 to 3)
|
; Get direction of the cart (0 to 3)
|
||||||
@@ -470,13 +486,13 @@ HandleTileDirections:
|
|||||||
|
|
||||||
.stop_north
|
.stop_north
|
||||||
; Set the new direction to north and flip the cart's orientation
|
; Set the new direction to north and flip the cart's orientation
|
||||||
LDA.b #South : STA.w SprSubtype, X : STA.w !MinecartDirection
|
LDA.b #South : STA.w SprSubtype, X : STA.w !MinecartDirection
|
||||||
LDA #$01 : STA !SpriteDirection, X
|
LDA.b #Down : STA !SpriteDirection, X
|
||||||
JMP .go_vert
|
JMP .go_vert
|
||||||
.stop_south
|
.stop_south
|
||||||
; Set the new direction to south and flip the cart's orientation
|
; Set the new direction to south and flip the cart's orientation
|
||||||
LDA.b #North : STA.w SprSubtype, X : STZ.w !MinecartDirection
|
LDA.b #North : STA.w SprSubtype, X : STZ.w !MinecartDirection
|
||||||
LDA #$00 : STA !SpriteDirection, X
|
LDA.b #Up : STA !SpriteDirection, X
|
||||||
; -----------------------------------------------
|
; -----------------------------------------------
|
||||||
.go_vert
|
.go_vert
|
||||||
%SetTimerA($40)
|
%SetTimerA($40)
|
||||||
@@ -486,13 +502,13 @@ HandleTileDirections:
|
|||||||
RTS
|
RTS
|
||||||
.stop_east
|
.stop_east
|
||||||
; Set the new direction to east and flip the cart's orientation
|
; Set the new direction to east and flip the cart's orientation
|
||||||
LDA.b #West : STA.w SprSubtype, X : STA.w !MinecartDirection
|
LDA.b #West : STA.w SprSubtype, X : STA.w !MinecartDirection
|
||||||
LDA #$02 : STA !SpriteDirection, X
|
LDA.b #Left : STA !SpriteDirection, X
|
||||||
JMP .go_horiz
|
JMP .go_horiz
|
||||||
.stop_west
|
.stop_west
|
||||||
; Set the new direction to west and flip the cart's orientation
|
; Set the new direction to west and flip the cart's orientation
|
||||||
LDA.b #East : STA.w SprSubtype, X : STA.w !MinecartDirection
|
LDA.b #East : STA.w SprSubtype, X : STA.w !MinecartDirection
|
||||||
LDA #$03 : STA !SpriteDirection, X
|
LDA.b #Right : STA !SpriteDirection, X
|
||||||
; -----------------------------------------------
|
; -----------------------------------------------
|
||||||
.go_horiz
|
.go_horiz
|
||||||
%SetTimerA($40)
|
%SetTimerA($40)
|
||||||
|
|||||||
@@ -37,16 +37,12 @@
|
|||||||
Sprite_LeverSwitch_Long:
|
Sprite_LeverSwitch_Long:
|
||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
|
JSR Sprite_LeverSwitch_Draw
|
||||||
JSR Sprite_LeverSwitch_Draw ; Call the draw code
|
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
|
||||||
JSL Sprite_CheckActive ; Check if game is not paused
|
JSR Sprite_LeverSwitch_Main
|
||||||
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
|
|
||||||
|
|
||||||
JSR Sprite_LeverSwitch_Main ; Call the main sprite code
|
|
||||||
|
|
||||||
.SpriteIsNotActive
|
.SpriteIsNotActive
|
||||||
PLB ; Get back the databank we stored previously
|
PLB
|
||||||
RTL ; Go back to original code
|
RTL
|
||||||
}
|
}
|
||||||
|
|
||||||
; =========================================================
|
; =========================================================
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
; =========================================================
|
; =========================================================
|
||||||
; Sprite Properties
|
; Switch Track sprite
|
||||||
; =========================================================
|
|
||||||
|
|
||||||
!SPRID = Sprite_SwitchTrack
|
!SPRID = Sprite_SwitchTrack
|
||||||
!NbrTiles = 02 ; Number of tiles used in a frame
|
!NbrTiles = 02 ; Number of tiles used in a frame
|
||||||
@@ -11,7 +10,7 @@
|
|||||||
!DeathAnimation = 00 ; 00 = normal death, 01 = no death animation
|
!DeathAnimation = 00 ; 00 = normal death, 01 = no death animation
|
||||||
!ImperviousAll = 00 ; 00 = Can be attack, 01 = attack will clink on it
|
!ImperviousAll = 00 ; 00 = Can be attack, 01 = attack will clink on it
|
||||||
!SmallShadow = 00 ; 01 = small shadow, 00 = no shadow
|
!SmallShadow = 00 ; 01 = small shadow, 00 = no shadow
|
||||||
!Shadow = 00 ; 00 = don't draw shadow, 01 = draw a shadow
|
!Shadow = 00 ; 00 = don't draw shadow, 01 = draw a shadow
|
||||||
!Palette = 00 ; Unused in this template (can be 0 to 7)
|
!Palette = 00 ; Unused in this template (can be 0 to 7)
|
||||||
!Hitbox = 00 ; 00 to 31, can be viewed in sprite draw tool
|
!Hitbox = 00 ; 00 to 31, can be viewed in sprite draw tool
|
||||||
!Persist = 01 ; 01 = your sprite continue to live offscreen
|
!Persist = 01 ; 01 = your sprite continue to live offscreen
|
||||||
@@ -37,16 +36,12 @@
|
|||||||
Sprite_RotatingTrack_Long:
|
Sprite_RotatingTrack_Long:
|
||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
|
JSR Sprite_RotatingTrack_Draw
|
||||||
JSR Sprite_RotatingTrack_Draw ; Call the draw code
|
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
|
||||||
JSL Sprite_CheckActive ; Check if game is not paused
|
JSR Sprite_RotatingTrack_Main
|
||||||
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
|
|
||||||
|
|
||||||
JSR Sprite_RotatingTrack_Main ; Call the main sprite code
|
|
||||||
|
|
||||||
.SpriteIsNotActive
|
.SpriteIsNotActive
|
||||||
PLB ; Get back the databank we stored previously
|
PLB
|
||||||
RTL ; Go back to original code
|
RTL
|
||||||
}
|
}
|
||||||
|
|
||||||
; =========================================================
|
; =========================================================
|
||||||
@@ -54,10 +49,8 @@ Sprite_RotatingTrack_Long:
|
|||||||
Sprite_RotatingTrack_Prep:
|
Sprite_RotatingTrack_Prep:
|
||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
|
|
||||||
LDA.b #$80 : STA $0CAA, X
|
LDA.b #$80 : STA $0CAA, X
|
||||||
LDA.w SprSubtype, X : STA.w SprAction,X
|
LDA.w SprSubtype, X : STA.w SprAction,X
|
||||||
|
|
||||||
PLB
|
PLB
|
||||||
RTL
|
RTL
|
||||||
}
|
}
|
||||||
@@ -76,7 +69,7 @@ Sprite_RotatingTrack_Main:
|
|||||||
{
|
{
|
||||||
LDA.w SprAction, X
|
LDA.w SprAction, X
|
||||||
JSL UseImplicitRegIndexedLocalJumpTable
|
JSL UseImplicitRegIndexedLocalJumpTable
|
||||||
|
|
||||||
dw TopLeftToTopRight
|
dw TopLeftToTopRight
|
||||||
dw TopRightToBottomRight
|
dw TopRightToBottomRight
|
||||||
dw BottomRightToBottomLeft
|
dw BottomRightToBottomLeft
|
||||||
@@ -145,59 +138,58 @@ Sprite_RotatingTrack_Main:
|
|||||||
|
|
||||||
Sprite_RotatingTrack_Draw:
|
Sprite_RotatingTrack_Draw:
|
||||||
{
|
{
|
||||||
JSL Sprite_PrepOamCoord
|
JSL Sprite_PrepOamCoord
|
||||||
JSL Sprite_OAM_AllocateDeferToPlayer
|
JSL Sprite_OAM_AllocateDeferToPlayer
|
||||||
|
|
||||||
LDA $0DC0, X : CLC : ADC $0D90, X : TAY;Animation Frame
|
LDA $0DC0, X : CLC : ADC $0D90, X : TAY;Animation Frame
|
||||||
LDA .start_index, Y : STA $06
|
LDA .start_index, Y : STA $06
|
||||||
|
|
||||||
|
PHX
|
||||||
PHX
|
LDX .nbr_of_tiles, Y ;amount of tiles -1
|
||||||
LDX .nbr_of_tiles, Y ;amount of tiles -1
|
LDY.b #$00
|
||||||
LDY.b #$00
|
|
||||||
.nextTile
|
.nextTile
|
||||||
|
|
||||||
PHX ; Save current Tile Index?
|
PHX ; Save current Tile Index?
|
||||||
|
|
||||||
TXA : CLC : ADC $06 ; Add Animation Index Offset
|
|
||||||
|
|
||||||
PHA ; Keep the value with animation index offset?
|
TXA : CLC : ADC $06 ; Add Animation Index Offset
|
||||||
|
|
||||||
ASL A : TAX
|
PHA ; Keep the value with animation index offset?
|
||||||
|
|
||||||
REP #$20
|
ASL A : TAX
|
||||||
|
|
||||||
LDA $00 : STA ($90), Y
|
REP #$20
|
||||||
AND.w #$0100 : STA $0E
|
|
||||||
INY
|
|
||||||
LDA $02 : STA ($90), Y
|
|
||||||
CLC : ADC #$0010 : CMP.w #$0100
|
|
||||||
SEP #$20
|
|
||||||
BCC .on_screen_y
|
|
||||||
|
|
||||||
LDA.b #$F0 : STA ($90), Y ;Put the sprite out of the way
|
LDA $00 : STA ($90), Y
|
||||||
STA $0E
|
AND.w #$0100 : STA $0E
|
||||||
|
INY
|
||||||
|
LDA $02 : STA ($90), Y
|
||||||
|
CLC : ADC #$0010 : CMP.w #$0100
|
||||||
|
SEP #$20
|
||||||
|
BCC .on_screen_y
|
||||||
|
|
||||||
|
LDA.b #$F0 : STA ($90), Y ;Put the sprite out of the way
|
||||||
|
STA $0E
|
||||||
.on_screen_y
|
.on_screen_y
|
||||||
|
|
||||||
PLX ; Pullback Animation Index Offset (without the *2 not 16bit anymore)
|
PLX ; Pullback Animation Index Offset (without the *2 not 16bit anymore)
|
||||||
INY
|
INY
|
||||||
LDA .chr, X : STA ($90), Y
|
LDA .chr, X : STA ($90), Y
|
||||||
INY
|
INY
|
||||||
LDA .properties, X : STA ($90), Y
|
LDA .properties, X : STA ($90), Y
|
||||||
|
|
||||||
PHY
|
PHY
|
||||||
|
|
||||||
TYA : LSR #2 : TAY
|
|
||||||
|
|
||||||
LDA.b #$02 : ORA $0F : STA ($92), Y ; store size in oam buffer
|
|
||||||
|
|
||||||
PLY : INY
|
|
||||||
|
|
||||||
PLX : DEX : BPL .nextTile
|
|
||||||
|
|
||||||
PLX
|
TYA : LSR #2 : TAY
|
||||||
|
|
||||||
RTS
|
LDA.b #$02 : ORA $0F : STA ($92), Y ; store size in oam buffer
|
||||||
|
|
||||||
|
PLY : INY
|
||||||
|
|
||||||
|
PLX : DEX : BPL .nextTile
|
||||||
|
|
||||||
|
PLX
|
||||||
|
|
||||||
|
RTS
|
||||||
|
|
||||||
|
|
||||||
.start_index
|
.start_index
|
||||||
@@ -214,4 +206,4 @@ Sprite_RotatingTrack_Draw:
|
|||||||
db $3D
|
db $3D
|
||||||
db $FD
|
db $FD
|
||||||
db $BD
|
db $BD
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user