more DarkLink formatting

This commit is contained in:
scawful
2024-06-06 21:22:30 -04:00
parent 38bb68ee72
commit 34d5b704ce

View File

@@ -47,25 +47,23 @@ Sprite_DarkLink_Long:
RTL ; Go back to original code RTL ; Go back to original code
.NotGanon .NotGanon
LDA.w SprAction, X : CMP.b #$01 : BNE .normaldraw LDA.w SprAction, X : CMP.b #$01 : BNE .normal_draw
; JSR Sprite_DarkLink_Draw ; Call the draw code ; JSR Sprite_DarkLink_Draw ; Call the draw code
.sworddraw .sword_draw
JSR Sprite_DarkLink_Draw_Sprite_SwordAttack_Draw JSR Sprite_DarkLink_Draw_Sprite_SwordAttack_Draw
BRA .skipnormaldraw BRA .skipnormal_draw
.normaldraw .normal_draw
CMP.b #$09 : BEQ .sworddraw CMP.b #$09 : BEQ .sword_draw
LDA.w SprSubtype, X : BNE .skipnormaldraw LDA.w SprSubtype, X : BNE .skipnormal_draw
JSR Sprite_DarkLink_Draw JSR Sprite_DarkLink_Draw
.skipnormaldraw .skipnormal_draw
LDA.w SprAction, X : CMP.b #11 : BCS .notdying LDA.w SprAction, X : CMP.b #11 : BCS .notdying
LDA.w SprHealth, X : CMP.b #$10 : BCS .notdying LDA.w SprHealth, X : CMP.b #$10 : BCS .notdying
LDA.w SprMiscC, X : BNE + LDA.w SprMiscC, X : BNE +
; check if action is 00 otherwise wait ; check if action is 00 otherwise wait
LDA.w SprAction, X : BNE .notdying LDA.w SprAction, X : BNE .notdying
; enraging instead %GotoAction(15) ; enraging instead
%GotoAction(15)
BRA .SpriteIsNotActive BRA .SpriteIsNotActive
+ +
@@ -78,7 +76,6 @@ Sprite_DarkLink_Long:
BRA .SpriteIsNotActive BRA .SpriteIsNotActive
.notdying .notdying
JSL Sprite_CheckActive ; Check if game is not paused JSL Sprite_CheckActive ; Check if game is not paused
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
@@ -98,10 +95,9 @@ Sprite_DarkLink_Prep:
REP #$20 ; P is still on stack, so we don't even need to fix this REP #$20 ; P is still on stack, so we don't even need to fix this
LDX #$20 LDX #$20
-- --
LDA dlinkPal, X : STA $7EC600, X LDA DarkLink_Palette, X : STA $7EC600, X
DEX : DEX : BNE -- DEX : DEX : BNE --
INC $15 ; Refresh Palettes INC $15 ; Refresh Palettes
SEP #$20 SEP #$20
PLB PLB
@@ -111,27 +107,26 @@ Sprite_DarkLink_Prep:
LDA #$CF : STA.w SprTimerA, X ; wait timer before falling LDA #$CF : STA.w SprTimerA, X ; wait timer before falling
LDA #$7F : STA.w SprHeight, X LDA #$7F : STA.w SprHeight, X
%GotoAction(4)
LDA #$78 : STA.w SprX, X LDA #$78 : STA.w SprX, X
LDA #$58 : STA.w SprY, X LDA #$58 : STA.w SprY, X
LDA #$00 : STA.w SprMiscE, X LDA #$00 : STA.w SprMiscE, X
LDA #$00 : STA.w SprMiscC, X ; Enraging LDA #$00 : STA.w SprMiscC, X ; Enraging
LDA #$50 : STA.w SprHealth, X LDA #$50 : STA.w SprHealth, X
%GotoAction(4)
RTL RTL
} }
dlinkPal: DarkLink_Palette:
dw #$7FFF, #$14A5, #$2108, #$294A, #$1CF5, #$7E4E, #$3DEF, #$6FF4 dw #$7FFF, #$14A5, #$2108, #$294A, #$1CF5, #$7E4E, #$3DEF, #$6FF4
; ========================================================= ; =========================================================
Sprite_DarkLink_Main: Sprite_DarkLink_Main:
{ {
LDA.w SprAction, X; Load the SprAction LDA.w SprAction, X : JSL UseImplicitRegIndexedLocalJumpTable
JSL UseImplicitRegIndexedLocalJumpTable; Goto the SprAction we are currently in
dw Handler dw Handler
dw SwordSlash dw SwordSlash
dw JumpBack dw JumpBack
@@ -157,14 +152,13 @@ Sprite_DarkLink_Main:
RTS RTS
+ +
LDA.w SprMiscF, X : BNE .nodamage LDA.w SprMiscF, X : BNE .no_damage
JSL Sprite_CheckDamageFromPlayer : BCC .nodamage JSL Sprite_CheckDamageFromPlayer : BCC .no_damage
LDA.w SprTimerA, X : BNE .alreadytakingdamage LDA.w SprTimerA, X : BNE .already_taking_damage
LDA.w $02B2 : CMP #$03 : BNE .notmoredamage LDA.w $02B2 : CMP #$03 : BNE .not_more_damage
LDA.w SprHealth, X : SEC : SBC #$04 : STA.w SprHealth, X LDA.w SprHealth, X : SEC : SBC #$04 : STA.w SprHealth, X
.notmoredamage .not_more_damage
.alreadytakingdamage .already_taking_damage
LDA #$20 LDA #$20
JSL Sprite_ApplySpeedTowardsPlayer JSL Sprite_ApplySpeedTowardsPlayer
@@ -175,7 +169,7 @@ Sprite_DarkLink_Main:
LDA #$26 : STA.w $012E LDA #$26 : STA.w $012E
%GotoAction(8) %GotoAction(8)
RTS RTS
.nodamage .no_damage
JSL Sprite_CheckDamageToPlayer JSL Sprite_CheckDamageToPlayer
@@ -222,9 +216,7 @@ Sprite_DarkLink_Main:
.skipdirections .skipdirections
JSR SpawnSwordDamage JSR SpawnSwordDamage
%GotoAction(1) %GotoAction(1)
++ ++
REP #$20 REP #$20
@@ -431,6 +423,7 @@ Sprite_DarkLink_Main:
Bomb: Bomb:
{
TYX ; get back sprite index TYX ; get back sprite index
;second guess itself because it can spawn too many bombs ;second guess itself because it can spawn too many bombs
@@ -448,8 +441,10 @@ Sprite_DarkLink_Main:
STA $0E00, Y STA $0E00, Y
.spawn_failed .spawn_failed
RTS RTS
}
BombThrow: BombThrow:
{
TYX ; get back sprite index TYX ; get back sprite index
;second guess itself because it can spawn too many bombs ;second guess itself because it can spawn too many bombs
@@ -473,9 +468,11 @@ Sprite_DarkLink_Main:
.spawn_failed .spawn_failed
RTS RTS
}
Cape: Cape:
{
TYX ; get back sprite index TYX ; get back sprite index
LDA.w SprMiscF, X : BNE + LDA.w SprMiscF, X : BNE +
LDA $1A : AND #$01 : BNE .nocape ; 50/50 chances LDA $1A : AND #$01 : BNE .nocape ; 50/50 chances
@@ -496,11 +493,12 @@ Sprite_DarkLink_Main:
LDA speedTableX, Y : STA SprXSpeed, X LDA speedTableX, Y : STA SprXSpeed, X
LDA speedTableY, Y : STA SprYSpeed, X LDA speedTableY, Y : STA SprYSpeed, X
RTS RTS
}
JumpAttack: JumpAttack:
{
TYX ; get back sprite index TYX ; get back sprite index
LDA #$20 LDA #$20
JSL Sprite_ApplySpeedTowardsPlayer JSL Sprite_ApplySpeedTowardsPlayer
@@ -512,11 +510,11 @@ Sprite_DarkLink_Main:
; that one is popping the RTS to end sprite entirely ; that one is popping the RTS to end sprite entirely
;PLA : PLA ;PLA : PLA
RTS RTS
}
SpawnSwordDamage: SpawnSwordDamage:
{
LDA #24 : STA.w SprTimerC, X LDA #24 : STA.w SprTimerC, X
LDA.w SprMiscC, X : BEQ + LDA.w SprMiscC, X : BEQ +
LDA #15 : STA.w SprTimerC, X ;faster if enraged LDA #15 : STA.w SprTimerC, X ;faster if enraged
@@ -525,7 +523,7 @@ Sprite_DarkLink_Main:
LDA #$03 : STA.w $012E LDA #$03 : STA.w $012E
LDA #$C1 ; SET THE RIGHT SPRITE ID!! ======================CHANGE======================== LDA #$C1 ; SPRID
JSL Sprite_SpawnDynamically JSL Sprite_SpawnDynamically
JSL Sprite_SetSpawnedCoords JSL Sprite_SetSpawnedCoords
PHX PHX
@@ -536,9 +534,9 @@ Sprite_DarkLink_Main:
LDA.w SprX, X : CLC : ADC.w DirOffsetX, Y : STA.w SprX, X LDA.w SprX, X : CLC : ADC.w DirOffsetX, Y : STA.w SprX, X
LDA.w SprY, X : CLC : ADC.w DirOffsetY, Y : STA.w SprY, X LDA.w SprY, X : CLC : ADC.w DirOffsetY, Y : STA.w SprY, X
PLX PLX
RTS RTS
}
DirOffsetX: DirOffsetX:
db $00, $00, $0E, $F2 db $00, $00, $0E, $F2
@@ -548,12 +546,12 @@ Sprite_DarkLink_Main:
SwordSlash: SwordSlash:
{ {
JSL Sprite_CheckDamageFromPlayer : BCC .nodamage JSL Sprite_CheckDamageFromPlayer : BCC .no_damage
LDA.w SprTimerA, X : BNE .alreadytakingdamage LDA.w SprTimerA, X : BNE .already_taking_damage
LDA.w $02B2 : CMP #$03 : BNE .notmoredamage LDA.w $02B2 : CMP #$03 : BNE .not_more_damage
LDA.w SprHealth, X : SEC : SBC #$04 : STA.w SprHealth, X LDA.w SprHealth, X : SEC : SBC #$04 : STA.w SprHealth, X
.notmoredamage .not_more_damage
.alreadytakingdamage .already_taking_damage
LDA #$05 : STA.w $012E ; clinking sound LDA #$05 : STA.w $012E ; clinking sound
LDA #$20 LDA #$20
@@ -576,7 +574,7 @@ Sprite_DarkLink_Main:
RTS RTS
.nodamage .no_damage
;LDA.w SprTimerD, X : BEQ + ;LDA.w SprTimerD, X : BEQ +
@@ -770,8 +768,6 @@ Sprite_DarkLink_Main:
LDA.b #$1F : STA $012C LDA.b #$1F : STA $012C
.nomessage .nomessage
; IF health is a certain level spawn crumbling tiles ; IF health is a certain level spawn crumbling tiles
;2, 3, 4, 5 ;2, 3, 4, 5
LDA.w SprMiscC, X : BEQ .tilesAreFallingAlready LDA.w SprMiscC, X : BEQ .tilesAreFallingAlready
@@ -807,12 +803,12 @@ Sprite_DarkLink_Main:
WalkAction: WalkAction:
{ {
JSL Sprite_CheckDamageFromPlayer : BCC .nodamage JSL Sprite_CheckDamageFromPlayer : BCC .no_damage
LDA.w SprTimerA, X : BNE .alreadytakingdamage LDA.w SprTimerA, X : BNE .already_taking_damage
LDA.w $02B2 : CMP #$03 : BNE .notmoredamage LDA.w $02B2 : CMP #$03 : BNE .not_more_damage
LDA.w SprHealth, X : SEC : SBC #$04 : STA.w SprHealth, X LDA.w SprHealth, X : SEC : SBC #$04 : STA.w SprHealth, X
.notmoredamage .not_more_damage
.alreadytakingdamage .already_taking_damage
LDA #$20 LDA #$20
JSL Sprite_ApplySpeedTowardsPlayer JSL Sprite_ApplySpeedTowardsPlayer
@@ -823,10 +819,9 @@ Sprite_DarkLink_Main:
%GotoAction(8) %GotoAction(8)
RTS RTS
.nodamage .no_damage
JSL Sprite_CheckDamageToPlayer JSL Sprite_CheckDamageToPlayer
LDA.w SprTimerA, X : BNE + LDA.w SprTimerA, X : BNE +
JSL GetRandomInt : AND #$3F : CLC : ADC #$50 JSL GetRandomInt : AND #$3F : CLC : ADC #$50
@@ -835,7 +830,6 @@ Sprite_DarkLink_Main:
+ +
STZ $02 ; x direction if non zero = negative STZ $02 ; x direction if non zero = negative
STZ $03 ; y direction STZ $03 ; y direction
@@ -873,10 +867,8 @@ Sprite_DarkLink_Main:
+ +
DEC.w SprYSpeed, X DEC.w SprYSpeed, X
.next .next
LDA.w SprXSpeed, X : BPL + LDA.w SprXSpeed, X : BPL +
INC.w SprXSpeed, X INC.w SprXSpeed, X
BRA .done BRA .done
@@ -929,8 +921,6 @@ Sprite_DarkLink_Main:
CMP #$10 : BCS + ; only check for damage if sword has reached halfway CMP #$10 : BCS + ; only check for damage if sword has reached halfway
JSL Sprite_CheckDamageToPlayer JSL Sprite_CheckDamageToPlayer
+ +
RTS RTS
} }
@@ -962,6 +952,7 @@ Sprite_DarkLink_Main:
db $00, $02, $01, $03 db $00, $02, $01, $03
DeadDespawn: DeadDespawn:
{
LDA.w SprTimerB, X : BNE + LDA.w SprTimerB, X : BNE +
LDA.b #45 : STA.w SprFrame, X LDA.b #45 : STA.w SprFrame, X
@@ -979,8 +970,10 @@ Sprite_DarkLink_Main:
+ +
RTS RTS
}
OpenDoor: OpenDoor:
{
INC.w SprMiscF, X INC.w SprMiscF, X
;LDA #$1A : STA.b $11 ; ganon open door routine ;LDA #$1A : STA.b $11 ; ganon open door routine
; handled by the room tag? ; handled by the room tag?
@@ -989,14 +982,15 @@ Sprite_DarkLink_Main:
%GotoAction(14) %GotoAction(14)
RTS RTS
}
Dead: Dead:
{
RTS RTS
}
Enraging: Enraging:
{
PHX PHX
REP #$20 ; P is still on stack, so we don't even need to fix this REP #$20 ; P is still on stack, so we don't even need to fix this
LDX #$20 LDX #$20
@@ -1017,7 +1011,7 @@ Sprite_DarkLink_Main:
%GotoAction(00) %GotoAction(00)
RTS RTS
}
dlinkPalRed: dlinkPalRed:
dw #$7FFF, #$14A5, #$2108, #$294A, #$1CF5, #$7E4E, #$001D, #$6FF4 dw #$7FFF, #$14A5, #$2108, #$294A, #$1CF5, #$7E4E, #$001D, #$6FF4
@@ -1546,60 +1540,62 @@ GanonInit:
Sprite_Ganon_Main: Sprite_Ganon_Main:
{ {
LDA.w SprAction, X; Load the SprAction LDA.w SprAction, X : JSL UseImplicitRegIndexedLocalJumpTable
JSL UseImplicitRegIndexedLocalJumpTable; Goto the SprAction we are currently in
dw Wait dw Wait
dw ShowMessage dw ShowMessage
dw Fall dw Fall
dw FellWait dw FellWait
dw FadingAwait dw FadingAwait
Wait: Wait:
{
JSR ApplyDarkLinkGraphics
LDA.w SprTimerA, X : BNE .wait LDA.w SprTimerA, X : BNE .wait
LDA.b #$30 : STA.w SprTimerA, X LDA.b #$30 : STA.w SprTimerA, X
%ShowUnconditionalMessage($46) %ShowUnconditionalMessage($46)
%GotoAction(1) %GotoAction(1)
.wait .wait
RTS RTS
}
ShowMessage: ShowMessage:
{
LDA.w SprTimerA, X : BNE .wait LDA.w SprTimerA, X : BNE .wait
LDA.b #$90 : STA.w SprTimerA, X LDA.b #$90 : STA.w SprTimerA, X
%GotoAction(2) %GotoAction(2)
.wait .wait
RTS RTS
}
Fall: Fall:
{
LDA.w SprTimerA, X : BNE .wait LDA.w SprTimerA, X : BNE .wait
LDA.b #$50 : STA.w SprTimerA, X LDA.b #$50 : STA.w SprTimerA, X
LDA #$01 : STA.w SprFrame, X LDA #$01 : STA.w SprFrame, X
INC.w SprMiscA, X INC.w SprMiscA, X
%GotoAction(3) %GotoAction(3)
.wait .wait
RTS RTS
}
FellWait: FellWait:
{
LDA.w SprTimerA, X : BNE .wait LDA.w SprTimerA, X : BNE .wait
LDA.b #$30 : STA.w SprTimerA, X LDA.b #$30 : STA.w SprTimerA, X
%GotoAction(4) %GotoAction(4)
.wait .wait
RTS RTS
}
FadingAwait: FadingAwait:
{
LDA.w SprTimerA, X : BNE .wait LDA.w SprTimerA, X : BNE .wait
STZ.w SprState, X STZ.w SprState, X
.wait .wait
RTS RTS
} }
}
; ========================================================= ; =========================================================