Housekeeping, whitespace cleanup

This commit is contained in:
scawful
2024-11-09 21:26:39 -05:00
parent 6b3118b14b
commit e3056ca827
10 changed files with 257 additions and 263 deletions

View File

@@ -47,32 +47,32 @@ Lanmola_FinishInitialization:
PHB : PHK : PLB
LDA.l .starting_delay, X : STA $0DF0, X
LDA.b #$FF : STA $0F70, X
PHX
LDY.b #$3F
LDA $7EEA00, X : TAX ;.sprite_regions
LDA.b #$FF
.reset_extended_sprites
STA $7FFE00, X
INX
DEY : BPL .reset_extended_sprites
PLX
LDA.b #$07 : STA $7FF81E, X
JSL Sprite_Lanmola_Init_DataLONG
PLB
RTL
.starting_delay
@@ -84,11 +84,11 @@ Lanmola_FinishInitialization:
Sprite_Lanmola:
{
;JSR Sprite2_CheckIfActivePermissive
LDA $0D80, X
JSL UseImplicitRegIndexedLocalJumpTable
dw Lanmola_Wait ;0x00
dw Lanmola_Mound ;0x01
dw Lanmola_Fly ;0x02
@@ -105,14 +105,14 @@ Lanmola_Wait: ;0x00
LDA $0DF0, X : BNE .delay ; ORA $0F00, X :
LDA.b #$7F : STA $0DF0, X
INC $0D80, X
;Play rumbling sound
LDA.b #$35 : JSL Sound_SetSfx2PanLong
.delay
RTS
}
@@ -126,37 +126,37 @@ Lanmola_Mound: ;0x01
LDA $0DF0, X : BNE .return
JSL Lanmola_SpawnShrapnel
LDA.b #$13 : STA $012D
TXY
JSL GetRandomInt : AND.b #$07 : TAX
LDA $7EEAA8, X : STA $0DA0, Y ; Get random X pos to have the lanmola fly to. ;.randXPos
JSL GetRandomInt : AND.b #$07 : TAX
LDA $7EEAB0, X : STA $0DB0, Y ; Get random Y pos to have the lanmola fly to. ;.randYPos
TYX
INC $0D80, X
LDA.b #$18 : STA $0F80, X
STZ $0EC0, X
STZ $0ED0, X
; ALTERNATE ENTRY POINT
.Lanmola_SetScatterSandPosition
LDA.w SprXH, X : STA $0DC0, X
LDA.w SprYH, X : STA $0EB0, X
LDA.w SprX, X : STA $0DE0, X
LDA.w SprY, X : STA $0E70, X
LDA.b #$4A : STA $0E00, X
.return
RTS
}
@@ -170,31 +170,31 @@ Lanmola_Fly: ;0x02
JSR Sprite2_CheckDamage
JSR Sprite2_MoveAltitude
; Slowly decrease the Y speed when first coming out of the ground
LDA $0EC0, X : BNE .notRising
LDA $0F80, X : SEC : SBC.b #$01 : STA $0F80, X : BNE .beta
LDA $0F80, X : SEC : SBC.b #$01 : STA $0F80, X : BNE .beta
INC $0EC0, X
.beta
BRA .dontSwitchDirections
.notRising
; Use the Y speed to bob up and down
LDA $1A : AND.b #$01 : BNE .dontSwitchDirections ; Every other frame.
TXY
LDA $0ED0, X : AND.b #$01 : TAX
LDA $0F80, Y : CLC : ADC $7EEA9C, X : STA $0F80, Y : CMP $7EEA9E, X : BNE .dontSwitchDirections2 ;.y_speed_slope ;.y_speeds
TYX : INC $0ED0, X ; Switch direction
.dontSwitchDirections2
TYX
.dontSwitchDirections
LDA $0DA0, X : STA $04
LDA.w SprXH, X : STA $05
LDA $0DB0, X : STA $06
@@ -203,29 +203,29 @@ Lanmola_Fly: ;0x02
LDA.w SprXH, X : STA $01
LDA.w SprY, X : STA $02
LDA.w SprYH, X : STA $03
REP #$20
; If our position is 0x0002 away from the random X and Y pos we chose earlier go to the next stage.
LDA $00 : SEC : SBC $04 : CLC : ADC.w #$0002 : CMP.w #$0004 : BCS .notCloseEnough
LDA $02 : SEC : SBC $06 : CLC : ADC.w #$0002 : CMP.w #$0004 : SEP #$20 : BCS .notCloseEnough
INC $0D80, X
.notCloseEnough
SEP #$20
LDA.b #$0A
JSL Sprite_ProjectSpeedTowardsEntityLong
LDA $00 : STA $0D40, X
LDA $01 : STA $0D50, X
JSR Sprite2_Move
.return
RTS
}
@@ -240,22 +240,22 @@ Lanmola_Dive: ;0x03
JSR Sprite2_CheckDamage
JSR Sprite2_Move
JSR Sprite2_MoveAltitude
LDA $0F80, X : CMP.b #$EC : BMI .alpha
SEC : SBC.b #$01 : STA $0F80, X
.alpha
; If we are under the ground go to the reset stage
LDA $0F70, X : BPL .notUnderGroundYet
INC $0D80, X
LDA.b #$80 : STA $0DF0, X
JSR Lanmola_Mound_Lanmola_SetScatterSandPosition
.notUnderGroundYet
RTS
}
@@ -266,20 +266,20 @@ Lanmola_Reset: ;0x04
JSR Lanmola_Draw
JSL Lanmola_DrawDirtLONG
JSL CheckIfActive : BCS Lanmola_Dive_notUnderGroundYet
LDA $0DF0, X : BNE .wait
STZ $0D80, X ; Go back to wait phase
TXY
JSL GetRandomInt : AND.b #$07 : TAX
LDA $7EEAA8, X : STA.w SprX, Y ; Get random X pos to have the lanmola fly to. ;.randXPos
JSL GetRandomInt : AND.b #$07 : TAX
LDA $7EEAB0, X : STA.w SprY, Y ; Get random Y pos to have the lanmola fly to. ;.randYPos
TYX
.wait
RTS
}
@@ -315,13 +315,13 @@ Lanmola_Death: ;0x05
PLX
.timerNotDone
LDA $0DF0, X : CMP.b #$20 : BCC Lanmola_Reset_wait
CMP.b #$A0 : BCS Lanmola_Reset_wait
AND.b #$0F : BNE Lanmola_Reset_wait
TXY
LDA $7FF81E, X : TAX
LDA $0E80, Y : SEC : SBC $7EEAA0, X ;.dataDeath
PHY : TXY : PLX
@@ -337,35 +337,35 @@ Lanmola_Death: ;0x05
LDA $0A : SEC : SBC $E2 : STA $0A
LDA $0C : SEC : SBC $E8 : STA $0C
SEP #$20
PLX
; Spawn a sprite that instantly dies as a boss explosion.
LDA.b #$00 : JSL Sprite_SpawnDynamically : BMI .spawn_failed
LDA.b #$0B : STA $0AAA
LDA.b #$04 : STA $0DD0, Y
LDA.b #$1F : STA $0DF0, Y : STA $0D90, Y
LDA $0A : STA.w SprX, Y
LDA $0B : STA.w SprXH, Y
LDA $0C : STA.w SprY, Y
LDA $0D : STA.w SprYH, Y
LDA.b #$03 : STA $0E40, Y
LDA.b #$0C : STA $0F50, Y
LDA.b #$0C : JSL Sound_SetSfx2PanLong
LDA $7FF81E, X : BMI .beta
DEC A : STA $7FF81E, X
.beta
.spawn_failed
.return
RTS
}
@@ -374,31 +374,31 @@ Lanmola_Death: ;0x05
Lanmola_Draw:
{
JSL Lanmola_MoveSegment
LDA $0B89, X : STA $03
LDA $7FF81E, X : BPL .beta
RTS
.beta
PHX
STA $0F
LDA $0D40, X : ASL A : ROL A : AND.b #$01 : TAX
LDA $7EEA06, X : STA $0C ;.data2
LDA $7EEA04, X : TAY ;.data1
LDX $0F
.loopBody
PHX : STX $0D
LDA $02 : CLC : ADC $04 : TAX
LDA $02 : SEC : SBC.b #$08 : AND.b #$3F : STA $02
LDA $7FFC00, X : STA $0A
@@ -442,7 +442,7 @@ Lanmola_Draw:
.on_screen_y1
PHY : TXY : PLX
LDA $08 : CLC : ADC.w #$000A : SEC : SBC $E8 : STA ($90), Y ;Shadow Y byte
CLC : ADC.w #$0010 : CMP.w #$0100
SEP #$20
@@ -468,25 +468,25 @@ Lanmola_Draw:
PLX
PHY
LDA $7FFF00, X : TAX
LDY $0D
LDA $0F : CMP.b #$07 : BNE .dontDrawTail
CPY.b #$00 : BNE .dontDrawTail
LDA $7EEA18, X ;.chrTail
BRA .notHead
.dontDrawTail
LDA.b #$C6
CPY $0F : BNE .notHead
LDA $7EEA08, X ;.chrHead
.notHead
PLY : INY : STA ($90), Y ;Body chr
PHY
@@ -501,20 +501,20 @@ Lanmola_Draw:
INY
LDA $7EEA28, X : ORA $03 : STA ($90), Y ;Body properties ;.propertiesBody
TYA : PHY : LSR #2 : TAY
CLC : ADC.b #$08 : TAX
LDA.b #$02 : ORA $37 : STA ($92), Y ;Body size and extra X bit
PHY : TXY : PLX : STA ($92), Y ;Shadow size and extra X bit
PLA : CLC : ADC $0C : TAY
PLX : DEX : BMI .bodyDone
JMP .loopBody
.bodyDone
PLX
RTS
@@ -529,15 +529,15 @@ Lanmola_DrawMound:
PHX
LDA $0DF0, X : LSR #3 : TAX
LDA $7EEA54, X : TAX ;.frameMound
LDY.b #$00
REP #$20
LDA $0FDA : SEC : SBC $E8 : STA $02
LDA $0FD8 : SEC : SBC $E2 : STA ($90), Y
STZ $37
BPL .notNegative
INC $37
@@ -553,20 +553,20 @@ Lanmola_DrawMound:
CLC : ADC.w #$0010 : CMP.w #$0100
BCC .on_screen_y
.out_of_boundsx
LDA.w #$00F0 : STA ($90), Y
LDA.w #$00F0 : STA ($90), Y
.on_screen_y
SEP #$20
LDA $7EEA48, X : INY : STA ($90), Y ;.chrMound
LDA $7EEA4E, X : INY : STA ($90), Y ;.propertiesMound
TYA : LSR #2 : TAY
LDA.b #$02 : ORA $37 : STA ($92), Y ;.sizesMound
PLX
RTS
}
@@ -581,40 +581,40 @@ Sprite_Shrapnel:
{
; This sprite manifests as a boulder outdoors, and as shrapnel indoors.
LDA $1B : BEQ $5B ;Boulder_Main
; Check if we can draw.
LDA $0FC6 : CMP.b #$03 : BCS .invalid_gfx_loaded
JSL $06DBF8 ;Sprite_PrepAndDrawSingleSmallLong
.invalid_gfx_loaded
;JSR $E8A2 ;Sprite4_CheckIfActive
JSL CheckIfActive : BCC .active
RTS
.active
LDA $1A : ASL #2 : AND.b #$C0 : STA $0F50, X ; : ORA.b #$00
JSR $E948 ;Sprite4_MoveXyz
TXA : EOR $1A : AND.b #$03 : BNE .noTileCollision
REP #$20
LDA $0FD8 : SEC : SBC $22 : CLC : ADC.w #$0004
CMP.w #$0010 : BCS .player_not_close
LDA $0FDA : SEC : SBC $20 : CLC : ADC.w #$FFFC
CMP.w #$000C : BCS .player_not_close
SEP #$20
JSL $06F41F ;Sprite_AttemptDamageToPlayerPlusRecoilLong
.player_not_close
SEP #$20
;JSR $8094 : BEQ .noTileCollision ;Sprite4_CheckTileCollision
@@ -626,10 +626,10 @@ Sprite_Shrapnel:
STZ $0DD0, X
.timerNotDone
RTS
}
; ==============================================================================
assert pc() <= $1DD02A
assert pc() <= $1DD02A

View File

@@ -1,4 +1,3 @@
org $01C742
JSL Ancilla_SpawnFallingPrize
@@ -49,18 +48,18 @@ Lanmola_DrawDirt:
LDA $0D40, X : ASL A : ROL A : ASL A : EOR $0D80, X : AND.b #$02 : BEQ .nu
LDA.b #$08 : JSL OAM_AllocateFromRegionB
BRA .xi
.nu
LDA.b #$08 : JSL OAM_AllocateFromRegionC
.xi
LDY.b #$00
LDA $0E00, X : LSR #2 : AND.b #$03 : EOR.b #$03 : ASL A : STA $06
LDA $0DC0, X : XBA
LDA $0DE0, X
LDA $0DE0, X
REP #$20 : SEC : SBC $E2 : STA $00 : SEP #$20
STZ $37
@@ -72,14 +71,14 @@ Lanmola_DrawDirt:
LDA $0EB0, X : XBA
LDA $0E70, X
REP #$20 : SEC : SBC $E8 : STA $02 : SEP #$20
PHX
LDX.b #$01
.dirtLoop
PHX
TXA : CLC : ADC $06 : ASL : TAX
REP #$20
@@ -104,7 +103,7 @@ Lanmola_DrawDirt:
BCC .on_screen_y
.out_of_bounds3
SEP #$20
LDA.b #$F0 : STA ($90), Y
LDA.b #$F0 : STA ($90), Y
.on_screen_y
@@ -112,19 +111,19 @@ Lanmola_DrawDirt:
LDA $7EEA84, X : INY : STA ($90), Y ;dirt chr ;.chrDirt
LDA $7EEA8C, X : INY : STA ($90), Y ;dirt properties ;.propertiesDirt
PHY
TYA : LSR #2 : TAY
LDA $7EEA94, X : ORA $37 : ORA $36 : STA ($92), Y ;.sizesDirt
PLY : INY
PLX : DEX : BPL .dirtLoop
PLX
RTS
}
@@ -153,7 +152,7 @@ Sprite_Lanmola_Init_Data:
INX : CPX.b #$B8 : BCC .loop
PLX
PLX
RTS
@@ -175,7 +174,7 @@ Sprite_Lanmola_Init_Data:
;$7EEA18
.chrTail
db $CC, $E4, $CA, $E6, $C8, $E6, $CA, $E4, $CC, $E4, $CA, $E6, $C8, $E6, $CA, $E4
db $CC, $E4, $CA, $E6, $C8, $E6, $CA, $E4, $CC, $E4, $CA, $E6, $C8, $E6, $CA, $E4
;$7EEA28
.propertiesBody
@@ -207,7 +206,7 @@ Sprite_Lanmola_Init_Data:
.chrMound
db $EE, $EE, $EC, $EC, $CE, $CE
;db $EE, $EE, $EC, $EC, $CE, $CE
;$7EEA4E
.propertiesMound
; db $39, $79, $39, $79, $39, $79
@@ -228,14 +227,14 @@ Sprite_Lanmola_Init_Data:
.yDirt
dw $0000, $0000, $FFFF, $FFFF, $FFFF, $FFFF, $0003, $0003
;db $00, $00, $FF, $FF, $FF, $FF, $03, $03
;$7EEA84
.chrDirt
db $E8, $E8, $E8, $E8, $EA, $EA, $EA, $EA
;$7EEA8C
.propertiesDirt
db $39, $79, $39, $79, $39, $79, $39, $79
db $39, $79, $39, $79, $39, $79, $39, $79
;db $00, $40, $00, $40, $00, $40, $00, $40
;$7EEA94
@@ -256,7 +255,7 @@ Sprite_Lanmola_Init_Data:
;$7EEAA8
.randXPos
db $58, $50, $60, $70, $80, $90, $A0, $98
db $58, $50, $60, $70, $80, $90, $A0, $98
;$7EEAB0
.randYPos
@@ -281,16 +280,16 @@ Lanmola_MoveSegment:
SEP #$20
PLX
LDA $0D40, X : SEC : SBC $0F80, X : STA $00
LDA $0D50, X : STA $01
JSL Sprite_ConvertVelocityToAngle : STA $0F
LDA $7EEA00, X : STA $04 ;.sprite_regions
PHX
; Store the current position, angle, and hieght of the sprite
; Store the current position, angle, and hieght of the sprite
; so that we can set the other segments to them later.
LDA.w SprXH, X : PHA ;high x
LDA.w SprYH, X : PHA ;high y
@@ -299,11 +298,11 @@ Lanmola_MoveSegment:
LDA $0F70, X : PHA ;height
LDA $0F : PHA ;angle
LDA $0E80, X : STA $02 : STA $05
CLC : ADC $04 : TAX
PLA : STA $7FFF00, X ;angle
PLA : STA $7FFE00, X ;height
@@ -311,9 +310,9 @@ Lanmola_MoveSegment:
PLA : STA $7FFC00, X ;lower x
PLA : STA $7EE900, X ;high y
PLA : STA $7EE800, X ;high x
PLX
LDA $0DD0, X : CMP.b #$09 : BNE .notActive
LDA $11 : ORA $0FC1 : BNE .notActive
LDA $10 : CMP #$0E : BEQ .notActive
@@ -321,7 +320,7 @@ Lanmola_MoveSegment:
CMP #$09 : BEQ .notActive ;in medallion cut scene
CMP #$0A : BEQ .notActive ;in medallion cut scene
LDA $05 : INC A : AND.b #$3F : STA $0E80, X
.notActive
RTL
@@ -335,7 +334,7 @@ SetShrapnelTimer:
JSL GetRandomInt ; replaced code
RTL
RTL
}
; =========================================================