Whitespace housekeeping

This commit is contained in:
scawful
2024-09-29 18:10:13 -04:00
parent 87634efca0
commit 863b3eaf5d
4 changed files with 34 additions and 50 deletions

View File

@@ -760,9 +760,9 @@ ANC0MISCB = $0385
AnciTimerA = $0C68 ; This is a timer, value is decreased by 1 every frame AnciTimerA = $0C68 ; This is a timer, value is decreased by 1 every frame
AnciY = $0BFA ; Position Y of the ancilla (Up to Down) AnciY = $0BFA ; Position Y of the ancilla (Up to Down)
AnciX = $0C04 ; Position X of the ancilla (Left to Right) AnciX = $0C04 ; Position X of the ancilla (Left to Right)
AnciYH = $0C0E ; High (often determine the room) Position Y of the ancilla (Up to Down) AnciYH = $0C0E ; High (often determine the room) Position Y of the ancilla (Up to Down)
AnciXH = $0C18 ; High (often determine the room) Position X of the ancilla (Left to Right) AnciXH = $0C18 ; High (often determine the room) Position X of the ancilla (Left to Right)
AnciXSpeed = $0C22 ; Y Speed of the ancilla can go negative to go up AnciXSpeed = $0C22 ; Y Speed of the ancilla can go negative to go up
AnciYSpeed = $0C2C ; X Speed of the ancilla can go negative to go left AnciYSpeed = $0C2C ; X Speed of the ancilla can go negative to go left
AnciLayer = $0C7C ; return the floor where the ancilla is AnciLayer = $0C7C ; return the floor where the ancilla is

View File

@@ -60,13 +60,13 @@ Sprite_Wolfos_Prep:
.outdoors .outdoors
; Check if the wolfos has been defeated ; Check if the wolfos has been defeated
LDA.l $7EF303 : CMP.b #$01 : BNE .spawn_wolfos LDA.l $7EF303 : CMP.b #$01 : BNE .spawn_wolfos
STZ.w SprState, X ; Don't spawn the sprite STZ.w SprState, X ; Don't spawn the sprite
PLB PLB
RTL RTL
.spawn_wolfos .spawn_wolfos
LDA.b #$40 : STA.w SprTimerA, X LDA.b #$40 : STA.w SprTimerA, X
LDA.b #$80 : STA.w $0CAA, X ; Sprite persist LDA.b #$80 : STA.w $0CAA, X ; Sprite persist
LDA.b #$08 : STA.w $0E40, X ; Nbr Oam Entries LDA.b #$08 : STA.w $0E40, X ; Nbr Oam Entries
PLB PLB
RTL RTL
@@ -77,7 +77,7 @@ Sprite_Wolfos_CheckIfDefeated:
LDA.b $1B : BNE .indoors LDA.b $1B : BNE .indoors
LDA.w SprHealth, X : CMP.b #$04 : BCS .not_defeated LDA.w SprHealth, X : CMP.b #$04 : BCS .not_defeated
LDA.b #$06 : STA.w SprAction, X ; Set to defeated LDA.b #$06 : STA.w SprAction, X ; Set to defeated
LDA.b #$09 : STA.w SprState, X LDA.b #$09 : STA.w SprState, X
LDA.b #$40 : STA.w SprHealth, X ; Refill the health of the sprite LDA.b #$40 : STA.w SprHealth, X ; Refill the health of the sprite
STZ.w SprMiscD, X STZ.w SprMiscD, X
RTS RTS
@@ -90,7 +90,7 @@ Sprite_Wolfos_CheckIfDefeated:
macro Wolfos_Move() macro Wolfos_Move()
JSL Sprite_DamageFlash_Long JSL Sprite_DamageFlash_Long
JSL Sprite_CheckDamageFromPlayer : BCC + JSL Sprite_CheckDamageFromPlayer : BCC +
+ +
JSL Sprite_PlayerCantPassThrough JSL Sprite_PlayerCantPassThrough

View File

@@ -55,7 +55,8 @@ Sprite_Octorok_Long:
Sprite_Octorok_Prep: Sprite_Octorok_Prep:
{ {
PHB : PHK : PLB PHB : PHK : PLB
; TODO Check if the sprite is placed in water
PLB PLB
RTL RTL
@@ -110,7 +111,7 @@ Sprite_Octorok_Move:
JSL Sprite_CheckDamageFromPlayer JSL Sprite_CheckDamageFromPlayer
JSL Sprite_CheckDamageToPlayer JSL Sprite_CheckDamageToPlayer
; Set the SprAction based on the direction ; Set the SprAction based on the direction
LDA.w SprMiscC, X : AND.b #$03 : TAY : LDA.w .direction, Y : STA.w SprAction, X LDA.w SprMiscC, X : AND.b #$03 : TAY : LDA.w .direction, Y : STA.w SprAction, X
LDA.w SprMiscF, X : AND.b #$01 : BNE .octorok_used_barrage LDA.w SprMiscF, X : AND.b #$01 : BNE .octorok_used_barrage
@@ -188,7 +189,7 @@ Octorock_ShootEmUp:
LDA.w SprMiscD, X : BEQ .continue LDA.w SprMiscD, X : BEQ .continue
LDA.w SprTimerD, X : BNE .four_ways LDA.w SprTimerD, X : BNE .four_ways
LDA.b #$01 : STA.w SprMiscD, X LDA.b #$01 : STA.w SprMiscD, X
.continue .continue
JSL GetRandomInt : AND.b #$1F : BNE .single_shot JSL GetRandomInt : AND.b #$1F : BNE .single_shot
.four_ways .four_ways

View File

@@ -11,7 +11,7 @@
!DeathAnimation = 00 ; 00 = normal death, 01 = no death animation !DeathAnimation = 00 ; 00 = normal death, 01 = no death animation
!ImperviousAll = 01 ; 00 = Can be attack, 01 = attack will clink on it !ImperviousAll = 01 ; 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 = 14 ; 00 to 31, can be viewed in sprite draw tool !Hitbox = 14 ; 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
@@ -30,7 +30,7 @@
!ImpervSwordHammer = 00 ; 01 = Impervious to sword and hammer attacks !ImpervSwordHammer = 00 ; 01 = Impervious to sword and hammer attacks
!Boss = 00 ; 00 = normal sprite, 01 = sprite is a boss !Boss = 00 ; 00 = normal sprite, 01 = sprite is a boss
%Set_Sprite_Properties(Sprite_Minecart_Prep, Sprite_Minecart_Long) %Set_Sprite_Properties(Sprite_Minecart_Prep, Sprite_Minecart_Long)
; ========================================================= ; =========================================================
@@ -55,7 +55,7 @@ Down = $01
Left = $02 Left = $02
Right = $03 Right = $03
; $0DE0[0x10] - (Sprite) ;functions ; $0DE0[0x10] - (Sprite) ;functions
; udlr ; udlr
; 0 - up ; 0 - up
; 1 - down ; 1 - down
; 2 - left ; 2 - left
@@ -93,11 +93,11 @@ Sprite_Minecart_Prep:
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 .continue
LDA #$00 : STA $0CAA, X ; Sprite persist in dungeon LDA #$00 : STA $0CAA, X ; Sprite persist in dungeon
LDA #$04 : STA $0E40, X ; Nbr Oam Entries LDA #$04 : STA $0E40, X ; Nbr Oam Entries
LDA #$40 : STA $0E60, x ; Impervious props LDA #$40 : STA $0E60, x ; Impervious props
LDA #$E0 : STA $0F60, X ; Persist LDA #$E0 : STA $0F60, X ; Persist
LDA #$00 : STA.w SprBump, X ; No bump damage LDA #$00 : STA.w SprBump, X ; No bump damage
LDA #$00 : STA $0B6B, X ; Set interactive hitbox? LDA #$00 : STA $0B6B, X ; Set interactive hitbox?
STZ.w !MinecartDirection STZ.w !MinecartDirection
@@ -134,13 +134,13 @@ Sprite_Minecart_Prep:
macro HandlePlayerCamera() 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
macro InitMovement() macro InitMovement()
@@ -181,7 +181,7 @@ HandleToss:
LDA #$00 : STA.w SprSubtype, X : STA !SpriteDirection, X LDA #$00 : STA.w SprSubtype, X : STA !SpriteDirection, X
%GotoAction(1) ; Minecart_WaitVert %GotoAction(1) ; Minecart_WaitVert
JMP .continue JMP .continue
.toss_south .toss_south
LDA.b #!DoubleSpeed : STA.w SprYSpeed, X LDA.b #!DoubleSpeed : STA.w SprYSpeed, X
LDA #$02 : STA.w SprSubtype, X LDA #$02 : STA.w SprSubtype, X
LDA #$01 : STA !SpriteDirection, X LDA #$01 : STA !SpriteDirection, X
@@ -465,14 +465,13 @@ HandleTileDirections:
LDA.w SprX, X : AND #$F8 : STA.b $02 : LDA.w SprXH, X : STA.b $03 LDA.w SprX, X : AND #$F8 : STA.b $02 : LDA.w SprXH, X : STA.b $03
; Fetch tile attributes based on current coordinates ; Fetch tile attributes based on current coordinates
LDA.b #$00 : JSL Sprite_GetTileAttr : LDA $0FA5 LDA.b #$00 : JSL Sprite_GetTileAttr : LDA $0FA5
CMP.b #$02 : BNE .not_out_of_bounds CMP.b #$02 : BNE .not_out_of_bounds
; If the tile is out of bounds, release the cart ; If the tile is out of bounds, release the cart
LDA #$40 : STA.w SprTimerD, X LDA #$40 : STA.w SprTimerD, X
%GotoAction(6) ; Minecart_Release %GotoAction(6) ; Minecart_Release
RTS RTS
.not_out_of_bounds .not_out_of_bounds
; Check if the tile is a stop tile ; Check if the tile is a stop tile
CMP.b #$B7 : BEQ .stop_north CMP.b #$B7 : BEQ .stop_north
@@ -486,12 +485,10 @@ HandleTileDirections:
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 #$01 : 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 #$00 : STA !SpriteDirection, X
; ----------------------------------------------- ; -----------------------------------------------
.go_vert .go_vert
%SetTimerA($40) %SetTimerA($40)
@@ -499,18 +496,15 @@ HandleTileDirections:
%GotoAction(1) ; Minecart_WaitVert %GotoAction(1) ; Minecart_WaitVert
JSL Link_ResetProperties_A JSL Link_ResetProperties_A
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 #$02 : 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 #$03 : STA !SpriteDirection, X
; ----------------------------------------------- ; -----------------------------------------------
.go_horiz .go_horiz
%SetTimerA($40) %SetTimerA($40)
@@ -549,7 +543,6 @@ HandleTileDirections:
.inverse_vert_velocity .inverse_vert_velocity
LDA.b #-!MinecartSpeed : STA.w SprYSpeed, X LDA.b #-!MinecartSpeed : STA.w SprYSpeed, X
JMP .done JMP .done
.check_direction .check_direction
LDA.w SprSubtype, X 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 (shifting left by 2 bits) to offset rows in the lookup table
@@ -612,19 +605,18 @@ HandleTileDirections:
} }
; ========================================================= ; =========================================================
; Check for the switch_track sprite and move based on the ; Check for the switch_track sprite and move based on the
; state of that sprite. ; state of that sprite.
HandleDynamicSwitchTileDirections: HandleDynamicSwitchTileDirections:
{ {
; Find out if the sprite $B0 is in the room ; Find out if the sprite $B0 is in the room
JSR CheckSpritePresence : BCC .no_b0 JSR CheckSpritePresence : BCC .no_b0
PHX PHX
LDA $02 : TAX LDA $02 : TAX
JSL Link_SetupHitBox JSL Link_SetupHitBox
JSL Sprite_SetupHitBox ; X is now the ID of the sprite $B0 JSL Sprite_SetupHitBox ; X is now the ID of the sprite $B0
PLX PLX
JSL CheckIfHitBoxesOverlap : BCC .no_b0 JSL CheckIfHitBoxesOverlap : BCC .no_b0
LDA !MinecartDirection : CMP.b #$00 : BEQ .east_or_west LDA !MinecartDirection : CMP.b #$00 : BEQ .east_or_west
CMP.b #$01 : BEQ .north_or_south CMP.b #$01 : BEQ .north_or_south
@@ -674,7 +666,6 @@ CheckSpritePresence:
LDX.b #$10 LDX.b #$10
.x_loop .x_loop
DEX DEX
LDY.b #$04 LDY.b #$04
.y_loop .y_loop
DEY DEY
@@ -706,13 +697,12 @@ CheckForPlayerInput:
; Fetch tile attributes based on current coordinates ; Fetch tile attributes based on current coordinates
LDA.b #$00 : JSL Sprite_GetTileAttr LDA.b #$00 : JSL Sprite_GetTileAttr
; Load the tile index ; Load the tile index
LDA $0FA5 : CLC : CMP.b #$B6 : BEQ .can_input LDA $0FA5 : CLC : CMP.b #$B6 : BEQ .can_input
CMP.b #$BD : BEQ .can_input CMP.b #$BD : BEQ .can_input
BRA .cant_input BRA .cant_input
.can_input .can_input
LDY !SpriteDirection, X LDY !SpriteDirection, X
LDA $F0 : AND .d_pad_press, Y : STA $00 : AND.b #$08 : BEQ .not_pressing_up LDA $F0 : AND .d_pad_press, Y : STA $00 : AND.b #$08 : BEQ .not_pressing_up
LDA.b #$00 : STA !SpriteDirection, X ; Moving Up LDA.b #$00 : STA !SpriteDirection, X ; Moving Up
@@ -762,14 +752,14 @@ CheckIfPlayerIsOn:
LDA $22 : SEC : SBC #$0009 : CMP $0FD8 : BCS .right LDA $22 : SEC : SBC #$0009 : CMP $0FD8 : BCS .right
LDA $20 : CLC : ADC #$0012 : CMP $0FDA : BCC .up LDA $20 : CLC : ADC #$0012 : CMP $0FDA : BCC .up
LDA $20 : SEC : SBC #$0012 : CMP $0FDA : BCS .down LDA $20 : SEC : SBC #$0012 : CMP $0FDA : BCS .down
SEP #$21 SEP #$21
RTS ; Return with carry set RTS ; Return with carry set
.left .left
.right .right
.up .up
.down .down
SEP #$20 SEP #$20
CLC CLC
RTS ; Return with carry cleared RTS ; Return with carry cleared
} }
@@ -816,12 +806,9 @@ Sprite_Minecart_DrawTop:
INY INY
LDA .properties, X : STA ($90), Y LDA .properties, X : STA ($90), Y
PHY PHY
TYA : LSR #2 : TAY TYA : LSR #2 : TAY
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
PLY : INY PLY : INY
PLX : DEX : BPL .nextTile PLX : DEX : BPL .nextTile
@@ -879,7 +866,6 @@ Sprite_Minecart_DrawBottom:
.nextTile .nextTile
PHX ; Save current Tile Index? PHX ; Save current Tile Index?
TXA : CLC : ADC $06 ; Add Animation Index Offset TXA : CLC : ADC $06 ; Add Animation Index Offset
PHA ; Keep the value with animation index offset? PHA ; Keep the value with animation index offset?
@@ -906,14 +892,10 @@ Sprite_Minecart_DrawBottom:
INY INY
LDA .properties, X : STA ($90), Y LDA .properties, X : STA ($90), Y
PHY PHY
TYA : LSR #2 : TAY TYA : LSR #2 : TAY
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
PLY : INY PLY : INY
PLX : DEX : BPL .nextTile PLX : DEX : BPL .nextTile
PLX PLX
@@ -991,4 +973,5 @@ JML RoomTag_ShutterDoorRequiresCart
; #_01CC08: LDA.b #$06 ; #_01CC08: LDA.b #$06
; #_01CC0A: BRA RoomTag_TriggerHoles ; #_01CC0A: BRA RoomTag_TriggerHoles
pullpc pullpc