KydrogBoss Ascend and Descend, multi phase control

This commit is contained in:
scawful
2024-02-19 09:00:50 -05:00
parent 7ac23267ef
commit 88485333f3

View File

@@ -5,8 +5,8 @@
; RAM Addresses ; RAM Addresses
; ============================================================================= ; =============================================================================
!OffspringCount = $AC ;0x01 !ConsecutiveHits = $AC ;0x01
!CurrentDraw = $7A ;0x01 !KydrogPhase = $7A ;0x01
!WalkSpeed = 10 ;0x01 !WalkSpeed = 10 ;0x01
;============================================================================== ;==============================================================================
@@ -14,7 +14,7 @@
;============================================================================== ;==============================================================================
!SPRID = $CB ; The sprite ID you are overwriting (HEX) !SPRID = $CB ; The sprite ID you are overwriting (HEX)
!NbrTiles = 10 ; Number of tiles used in a frame !NbrTiles = 11 ; Number of tiles used in a frame
!Harmless = 00 ; 00 = Sprite is Harmful, 01 = Sprite is Harmless !Harmless = 00 ; 00 = Sprite is Harmful, 01 = Sprite is Harmless
!HVelocity = 00 ; Is your sprite going super fast? put 01 if it is !HVelocity = 00 ; Is your sprite going super fast? put 01 if it is
!Health = 00 ; Number of Health the sprite have !Health = 00 ; Number of Health the sprite have
@@ -22,7 +22,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 = 01 ; 00 = don't draw shadow, 01 = draw a shadow
!Palette = 00 ; Unused in this KydrogBoss (can be 0 to 7) !Palette = 00 ; Unused in this KydrogBoss (can be 0 to 7)
!Hitbox = 03 ; 00 to 31, can be viewed in sprite draw tool !Hitbox = 03 ; 00 to 31, can be viewed in sprite draw tool
!Persist = 00 ; 01 = your sprite continue to live offscreen !Persist = 00 ; 01 = your sprite continue to live offscreen
@@ -50,6 +50,7 @@ Sprite_KydrogBoss_Long:
PHB : PHK : PLB PHB : PHK : PLB
JSR Sprite_KydrogBoss_Draw ; Call the draw code JSR Sprite_KydrogBoss_Draw ; Call the draw code
; JSL Sprite_DrawShadow
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
@@ -69,19 +70,23 @@ Sprite_KydrogBoss_CheckIfDead:
LDA $0D80, X : CMP.b #$09 : BEQ .not_dead LDA $0D80, X : CMP.b #$09 : BEQ .not_dead
; If health is negative, set back to zero ; If health is negative, set back to zero
LDA $0E50, X : CMP.b #$44 : BCC .healthNotNegative LDA $0E50, X : CMP.b #$C3 : BCC .healthNotNegative
LDA.b #$00 : STA $0E50, X LDA.b #$00 : STA $0E50, X
.healthNotNegative .healthNotNegative
LDA $0E50, X : BNE .not_dead LDA $0E50, X : BNE .not_dead
PHX PHX
LDA.b #$04 : STA $0DD0, X ;kill sprite boss style LDA.b #$04 : STA $0DD0, X ;kill sprite boss style
LDA.b #$09 : STA $0D80, X ;go to KydrogBoss_Death stage LDA.b #$09 : STA $0D80, X ;go to KydrogBoss_Death stage
STZ.w $0D90,X
LDA.b #$E0 : STA.w $0DF0,X
PLX PLX
.not_dead .not_dead
RTS RTS
} }
@@ -91,18 +96,14 @@ Sprite_KydrogBoss_Prep:
{ {
PHB : PHK : PLB PHB : PHK : PLB
LDA.b #$40 : STA $0E50, X ;health LDA #$00 : STA !KydrogPhase
LDA.b #$80 : STA $0E50, X ; health
LDA.b #$80 : STA $0CAA, X LDA.b #$80 : STA $0CAA, X
LDA.b #$03 : STA $0F60, X ; hitbox settings LDA.b #$03 : STA $0F60, X ; hitbox settings
LDA.b #$0F : STA $0CD2, X ; bump damage type (4 hearts, green tunic) LDA.b #$04 : STA $0CD2, X ; bump damage type
LDA $0E60, X : AND.b #$BF : STA $0E60, X ; Not invincible
; Make the sprite take damage from a sword
; LDA $0CAA, X : AND.b #$FB : STA $0CAA, X
; Make the sprite not invincible
LDA $0E60, X : AND.b #$BF : STA $0E60, X
JSR KydrogBoss_Set_Damage ; Set the damage table JSR KydrogBoss_Set_Damage ; Set the damage table
@@ -110,18 +111,22 @@ Sprite_KydrogBoss_Prep:
%SetSpriteSpeedX(15) %SetSpriteSpeedX(15)
%SetHarmless(00) %SetHarmless(00)
LDA #$60 : STA SprTimerD, X LDA #$80 : STA SprTimerD, X ; intro timer
PLB PLB
RTL RTL
} }
;============================================================================== ;==============================================================================
pushpc
org $1ECD97
LDA.b #$0A
pullpc
macro StopIfTooClose() macro StopIfTooClose()
LDA $0E : CMP.b #$0030 : BCS + LDA $0E : CMP.b #$0020 : BCS +
CLC CLC
LDA $0F : CMP.b #$0030 : BCS + LDA $0F : CMP.b #$0020 : BCS +
LDA.b #$20 : STA.w SprTimerD, X ; set timer E to 0x20 LDA.b #$20 : STA.w SprTimerD, X ; set timer E to 0x20
%GotoAction(7) %GotoAction(7)
RTS RTS
@@ -129,13 +134,24 @@ macro StopIfTooClose()
endmacro endmacro
macro RandomStalfosOffspring() macro RandomStalfosOffspring()
JSL GetRandomInt : AND.b #$7F : BNE + JSL GetNumberSpawnStalfos
PHX : JSR Sprite_Offspring_Spawn : PLX LDA $00 : CMP.b #$04 : BCS .too_many_stalfos
+
JSL GetRandomInt : AND.b #$7F : BNE + JSL GetRandomInt : AND.b #$3F : BNE +
PHX : JSR Sprite_Offspring_Spawn : PLX
+
JSL GetRandomInt : AND.b #$3F : BNE ++
PHX : JSR Sprite_Offspring_SpawnHead : PLX PHX : JSR Sprite_Offspring_SpawnHead : PLX
+ ++
.too_many_stalfos
endmacro
macro BounceBasedOnPhase()
LDA !KydrogPhase : CMP #$00 : BEQ .phase_one
LDA #$10 : STA $08 : LDA #$20 : STA $09
.phase_one
JSL Sprite_BounceTowardPlayer
endmacro endmacro
Sprite_KydrogBoss_Main: Sprite_KydrogBoss_Main:
@@ -154,6 +170,10 @@ Sprite_KydrogBoss_Main:
dw KydrogBoss_SummonStalfos ; 08 dw KydrogBoss_SummonStalfos ; 08
dw KydrogBoss_Death ; 09 dw KydrogBoss_Death ; 09
dw KydrogBoss_Ascend ; 0A
dw KydrogBoss_Descend ; 0B
dw KydrogBoss_Abscond ; 0C
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
KydrogBoss_Init: KydrogBoss_Init:
@@ -175,19 +195,25 @@ Sprite_KydrogBoss_Main:
KydrogBoss_WalkState: KydrogBoss_WalkState:
{ {
JSR CheckForNextPhase
LDA $0DA0 : BEQ .not_flashing LDA $0DA0 : BEQ .not_flashing
LDA.b #$20 : STA.w SprTimerD, X LDA.b #$20 : STA.w SprTimerD, X
%GotoAction(6) ; Goto KydrogBoss_TakeDamage %GotoAction(6) ; Goto KydrogBoss_TakeDamage
RTS RTS
.not_flashing .not_flashing
; LDA !OffspringCount : CMP.b #$05 : BCS .no_offspring
JSL GetRandomInt : AND.b #$0F : BNE .not_taunting JSL GetRandomInt : AND.b #$0F : BNE .not_taunting
LDA.b #$10 : STA.w SprTimerD, X LDA.b #$10 : STA.w SprTimerD, X
%GotoAction(8) ; Goto KydrogBoss_TauntPlayer %GotoAction(8) ; Goto KydrogBoss_TauntPlayer
RTS RTS
.not_taunting .not_taunting
; JSL GetRandomInt : AND.b #$0F : BNE .not_absconding
; LDA.b #$20 : STA.w SprTimerD, X
; %GotoAction(12) ; Goto KydrogBoss_Abscond
; RTS
; .not_absconding
LDA #$50 : STA $09, X LDA #$50 : STA $09, X
JSL Sprite_DirectionToFacePlayer JSL Sprite_DirectionToFacePlayer
TYA : CMP.b #$02 : BCC .WalkRight TYA : CMP.b #$02 : BCC .WalkRight
@@ -227,7 +253,7 @@ Sprite_KydrogBoss_Main:
PLX PLX
JSL Sprite_DamageFlash_Long JSL Sprite_DamageFlash_Long
JSL Sprite_BounceTowardPlayer %BounceBasedOnPhase()
%RandomStalfosOffspring() %RandomStalfosOffspring()
@@ -247,7 +273,7 @@ Sprite_KydrogBoss_Main:
PLX PLX
JSL Sprite_DamageFlash_Long JSL Sprite_DamageFlash_Long
JSL Sprite_BounceTowardPlayer %BounceBasedOnPhase()
%RandomStalfosOffspring() %RandomStalfosOffspring()
@@ -267,7 +293,7 @@ Sprite_KydrogBoss_Main:
PLX PLX
JSL Sprite_DamageFlash_Long JSL Sprite_DamageFlash_Long
JSL Sprite_BounceTowardPlayer %BounceBasedOnPhase()
%RandomStalfosOffspring() %RandomStalfosOffspring()
@@ -287,7 +313,7 @@ Sprite_KydrogBoss_Main:
PLX PLX
JSL Sprite_DamageFlash_Long JSL Sprite_DamageFlash_Long
JSL Sprite_BounceTowardPlayer %BounceBasedOnPhase()
%RandomStalfosOffspring() %RandomStalfosOffspring()
@@ -302,6 +328,15 @@ Sprite_KydrogBoss_Main:
%StartOnFrame(12) %StartOnFrame(12)
%PlayAnimation(12, 14, 8) %PlayAnimation(12, 14, 8)
INC !ConsecutiveHits
LDA !ConsecutiveHits : CMP #$10 : BCC .continue
STZ !ConsecutiveHits
LDA.b #$28 ; SFX3.28
JSL $0DBB8A ; SpriteSFX_QueueSFX3WithPan
%GotoAction($0A) ; Goto KydrogBoss_Ascend
RTS
.continue
PHX PHX
JSL Sprite_CheckDamageFromPlayerLong JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact() %DoDamageToPlayerSameLayerOnContact()
@@ -315,6 +350,13 @@ Sprite_KydrogBoss_Main:
%GotoAction(1) %GotoAction(1)
+ +
JSL GetRandomInt : AND.b #$1F : BNE ++
LDA.b #$28 ; SFX3.28
JSL $0DBB8A ; SpriteSFX_QueueSFX3WithPan
%GotoAction($0A) ; Goto KydrogBoss_Ascend
++
RTS RTS
} }
@@ -352,22 +394,11 @@ Sprite_KydrogBoss_Main:
JSL Sprite_DamageFlash_Long JSL Sprite_DamageFlash_Long
%RandomStalfosOffspring()
LDA.w SprTimerD, X : BNE + LDA.w SprTimerD, X : BNE +
JSL GetRandomInt : AND.b #$3F : BNE .no_stalfos
PHX
JSR Sprite_Offspring_Spawn
PLX
.no_stalfos
JSR Kydrog_ThrowBoneAtPlayer JSR Kydrog_ThrowBoneAtPlayer
CLC
JSL GetRandomInt : AND.b #$3F : BNE .finish_summon
JSR Sprite_Offspring_SpawnHead
; .offspring_stalfos
;
.finish_summon
%GotoAction(1) %GotoAction(1)
+ +
RTS RTS
@@ -377,9 +408,10 @@ Sprite_KydrogBoss_Main:
KydrogBoss_Death: ;0x09 KydrogBoss_Death: ;0x09
{ {
%StartOnFrame(0)
%PlayAnimation(0, 0, 10)
; %StartOnFrame(0) JSL $09EF56 ; Kill friends
; %PlayAnimation(0, 0, 10)
; Change the palette to the next in the cycle for the leg ; Change the palette to the next in the cycle for the leg
LDA $0DA0, X : INC : CMP.b #$08 : BNE .dontReset LDA $0DA0, X : INC : CMP.b #$08 : BNE .dontReset
@@ -391,183 +423,118 @@ Sprite_KydrogBoss_Main:
RTS RTS
} }
KydrogBoss_Ascend: ; 0x0A
{
%StartOnFrame(17)
%PlayAnimation(17, 17, 10)
%RandomStalfosOffspring()
; Increase the Z for a bit until he is off screen
LDA SprHeight, X : CLC : ADC.b #$04
STA SprHeight, X : CMP.b #$B0 : BCC .not_off_screen
;
LDA #$40 : STA SprTimerD, X
%GotoAction($0B)
.not_off_screen
RTS RTS
}
KydrogBoss_Descend:
{
%StartOnFrame(17)
%PlayAnimation(17, 17, 10)
%RandomStalfosOffspring()
LDA SprTimerD, X : BEQ .no_track_player
LDA $20 : STA SprY, X
LDA $22 : STA SprX, X
; PHX : JSL $01F3EC : PLX ; Light Torch
LDA SprTimerD, X : BNE .wait_a_second
.no_track_player
; Decrease the Z for a bit until he is at level with Link
LDA SprHeight, X : SEC : SBC.b #$04 : STA SprHeight, X
CMP.b #$04 : BCS .not_off_screen
%GotoAction(1)
.not_off_screen
.wait_a_second
RTS
}
KydrogBoss_Abscond: ; 0x0C
{
%StartOnFrame(13)
%PlayAnimation(13, 13, 10)
JSL GetRandomInt : AND.b #$3F : BNE +
LDA.b $0D50 : CLC : ADC.b #$08 : STA $0D50
LDA.b $0D70 : CLC : ADC.b #$02 : STA $0D70
LDA SprTimerD, X : BNE .not_done
%GotoAction(1)
RTS
+
LDA.b $0D40 : CLC : ADC.b #$08 : STA $0D40
LDA.b $0D60 : CLC : ADC.b #$02 : STA $0D60
LDA SprTimerD, X : BNE .not_done
%GotoAction(1)
.not_done
JSL Sprite_Move
RTS
}
} }
;============================================================================== ; =============================================================================
Sprite_KydrogBoss_Draw: CheckForNextPhase:
{ {
JSL Sprite_PrepOamCoord LDA !KydrogPhase : CMP.b #$00 : BEQ .phase_one
JSL Sprite_OAM_AllocateDeferToPlayer CMP.b #$01 : BEQ .phase_two
CMP.b #$02 : BEQ .phase_three
LDA $0DC0, X : CLC : ADC $0D90, X : ASL : TAY ; Animation Frame CMP.b #$03 : BEQ .phase_four
REP #$20
LDA .start_index, Y : STA $06 ; Needs to be 16 bit ; Y = 00, 02, 04, 06
SEP #$20
; Store Palette thing
LDA $0DA0, X : STA $08
PHX ; Store Sprite ID
REP #$20
LDA .nbr_of_tiles, Y ;amount of tiles -1 ; doesn't need to be 16 bit ;Y = 00, 02, 04, 06
REP #$30
TAX
LDY.w #$0000
.nextTile
REP #$30
PHX ; Save current tile index
TXA : CLC : ADC $06 ; Add Animation Index Offset
PHA ; Keep the value with animation index offset
ASL A : TAX ; *2 for the X and Y position
REP #$30 ; X and Y position must be 16 bit
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
AND.w #$0100 : STA $0E
INY
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100
SEP #$20 ; change A back to 8bit but not X and Y
BCC .on_screen_y
LDA.b #$F0 : STA ($90), Y ; Put the sprite out of the way
STA $0E
.on_screen_y
PLX ; Pullback Animation Index Offset
; so X here is (nbr of tiles + animation index)
INY
LDA .chr, X : STA ($90), Y
INY
; Set palette flash modifier
LDA .properties, X : ORA $08 : STA ($90), Y
REP #$30
PHY
TYA : LSR #2 : TAY ; divide Y by 4
SEP #$20 ;set A back to 8bit but not X and Y
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
PLY : INY
PLX : DEX : BPL .nextTile
SEP #$30
PLX
RTS RTS
;============================================================================== .phase_one
; Check for phase two
LDA SprHealth,X : CMP.b #$60 : BCC .phase_two
RTS
.phase_two
LDA SprHealth,X : CMP.b #$40 : BCC .phase_three
LDA !KydrogPhase : CMP.b #$01 : BEQ .return
; LDA #$80 : STA $0E50, X
LDA #$01 : STA $0D80, X
STA !KydrogPhase
INC $0DA0, X
PHX : JSL $01F4A1 : PLX ; Extinguish torch
RTS
.phase_three
LDA SprHealth,X : CMP.b #$20 : BCC .phase_four
LDA !KydrogPhase : CMP.b #$02 : BEQ .return
; LDA #$80 : STA $0E50, X
LDA #$02 : STA $0D80, X
STA !KydrogPhase
PHX : JSL $01F4A1 : PLX ; Extinguish torch
RTS
.phase_four
LDA #$80 : STA $0E50, X
LDA #$03 : STA $0D80, X
STA !KydrogPhase
PHX : JSL $01F4A1 : PLX ; Extinguish torch
.return
RTS
.start_index
dw $00, $0B, $15, $1F, $27, $2D, $35, $3D, $43, $4C, $57, $66, $71, $7A, $87, $91, $99, $A1
.nbr_of_tiles
dw 10, 9, 9, 7, 5, 7, 7, 5, 8, 10, 14, 10, 8, 12, 9, 7, 7, 6
.x_offsets
dw -8, 8, 8, 0, 8, 0, -8, -8, 16, 16, -8
dw -8, 8, -8, 0, 16, 16, -8, 16, 0, 8
dw -8, 8, 0, 16, -8, -8, -8, 16, 0, 8
dw 0, 0, 16, 8, 0, 16, 16, 16
dw 16, 0, 0, 16, 16, 0
dw 0, 16, 8, 16, 0, 16, 12, 0
dw 4, -4, 12, 4, -4, -4, 4, -4
dw 4, -12, 4, -12, -4, 16
dw 4, -4, 4, -4, -4, 12, 12, -4, 12
dw 0, 8, 8, 0, 0, 8, -8, -8, -8, 16, 16
dw 0, 8, 8, 0, 8, 0, 0, 8, 8, -8, -8, -8, 16, 16, 16
dw 0, 8, 8, 0, 0, 8, 16, 16, 16, -8, -8
dw -8, -8, 8, 16, 8, 8, 16, 0, 8
dw 0, -8, 8, 8, -8, -8, 0, 8, 0, 8, 16, 16, 16
dw -8, 16, 8, 8, 16, 0, 16, -8, 0, 8
dw -8, 8, -8, -8, 8, 8, -8, 16
dw -8, 8, 0, 8, -8, 8, -8, 16
dw -12, 4, 12, -4, 0, 16, 8
.y_offsets
dw -20, -20, -4, 4, 4, 12, 4, 12, 4, 12, -4
dw -19, -19, 4, 4, 4, 12, -4, -4, -3, -3
dw -20, -20, 4, 4, 4, 12, -4, -4, -4, -4
dw -20, -4, -4, -4, 4, 4, 12, -20
dw -20, -4, 4, -4, 4, -20
dw -20, -20, -4, -4, 4, 4, 12, -4
dw -20, -20, -4, -4, -4, -12, 4, 4
dw -20, -20, -4, -4, 4, 0
dw -20, -20, -4, -4, 4, 0, 8, -12, -4
dw -20, -20, -12, 0, -4, -4, -8, 0, 8, 0, -8
dw -20, -20, -12, -4, -4, 0, 8, 0, 8, 0, 8, -8, 0, 8, -8
dw -20, -20, -12, 0, -4, -4, -8, 0, 8, 0, -8
dw -24, -8, -24, -8, -8, 0, 0, 8, 8
dw -8, -24, -24, -8, -8, 0, 8, 8, 0, 0, 0, 8, -8
dw -16, -16, -16, -8, -8, 0, 0, 0, -24, -24
dw 0, 0, -16, -24, -16, -24, -16, -16
dw 0, 0, -8, -8, -24, -24, -8, -8
dw -4, -4, -20, -20, 12, 12, 12
.chr
db $87, $87, $A7, $80, $81, $A4, $93, $A3, $96, $A6, $A7
db $87, $87, $B3, $80, $92, $A2, $83, $83, $A8, $A8
db $87, $87, $80, $B2, $A1, $B1, $83, $83, $A8, $A8
db $C9, $E9, $EB, $EA, $C0, $C2, $D2, $CB
db $CE, $EC, $C3, $EE, $C5, $CC
db $C9, $CB, $FA, $FB, $C6, $C8, $D8, $E9
db $C9, $CB, $E9, $EA, $EB, $DB, $E1, $E0
db $CC, $CE, $EC, $EE, $E3, $E5
db $C9, $CB, $FA, $FB, $E6, $E8, $F8, $DE, $E9
db $89, $89, $99, $8E, $A9, $A9, $82, $92, $A2, $B3, $83
db $89, $89, $99, $A9, $A9, $8D, $9D, $8D, $9D, $8C, $9C, $83, $A1, $B1, $82
db $89, $89, $99, $8E, $A9, $A9, $83, $93, $A3, $B2, $83
db $45, $65, $45, $65, $66, $77, $75, $BD, $BE
db $6F, $4E, $4E, $6F, $47, $57, $7C, $7D, $AA, $AB, $6E, $7E, $83
db $84, $84, $85, $95, $5D, $AA, $6D, $6D, $8A, $8A
db $AC, $AE, $50, $40, $50, $40, $52, $52
db $AC, $AE, $63, $63, $42, $42, $60, $60
db $68, $6A, $4B, $49, $70, $72, $71
.properties
db $3B, $7B, $7B, $3B, $3B, $3B, $3B, $3B, $3B, $3B, $3B
db $3B, $7B, $3B, $3B, $3B, $3B, $3B, $7B, $3B, $7B
db $3B, $7B, $7B, $3B, $3B, $3B, $3B, $7B, $3B, $7B
db $3B, $3B, $3B, $3B, $3B, $3B, $3B, $3B
db $3B, $3B, $3B, $3B, $3B, $3B
db $3B, $3B, $3B, $3B, $3B, $3B, $3B, $3B
db $7B, $7B, $7B, $7B, $7B, $7B, $3B, $3B
db $7B, $7B, $7B, $7B, $3B, $3B
db $7B, $7B, $7B, $7B, $3B, $3B, $3B, $7B, $7B
db $3B, $7B, $7B, $3B, $3B, $7B, $7B, $7B, $7B, $7B, $7B
db $3B, $7B, $7B, $3B, $7B, $3B, $3B, $7B, $7B, $3B, $3B, $3B, $7B, $7B, $3B
db $3B, $7B, $7B, $7B, $3B, $7B, $7B, $7B, $7B, $7B, $3B
db $3B, $3B, $7B, $7B, $7B, $3B, $7B, $3B, $3B
db $3B, $3B, $7B, $7B, $3B, $3B, $3B, $3B, $3B, $3B, $3B, $3B, $7B
db $3B, $7B, $7B, $7B, $3B, $3B, $3B, $7B, $3B, $7B
db $3B, $3B, $3B, $3B, $7B, $7B, $3B, $7B
db $3B, $3B, $3B, $7B, $3B, $7B, $3B, $7B
db $3B, $3B, $3B, $3B, $3B, $3B, $3B
.sizes
db $02, $02, $02, $00, $00, $02, $00, $00, $00, $00, $02
db $02, $02, $00, $02, $00, $00, $00, $00, $00, $00
db $02, $02, $02, $00, $00, $00, $00, $00, $00, $00
db $02, $00, $00, $00, $02, $00, $00, $00
db $02, $02, $02, $02, $00, $02
db $02, $00, $00, $00, $02, $00, $00, $00
db $02, $00, $00, $00, $00, $00, $02, $02
db $02, $02, $02, $02, $02, $00
db $02, $00, $00, $00, $02, $00, $00, $00, $00
db $02, $00, $00, $02, $00, $00, $00, $00, $00, $00, $00
db $02, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
db $02, $00, $00, $02, $00, $00, $00, $00, $00, $00, $00
db $02, $02, $02, $00, $00, $00, $00, $00, $00
db $00, $02, $02, $00, $02, $02, $00, $00, $00, $00, $00, $00, $00
db $02, $00, $00, $00, $00, $02, $00, $00, $00, $00
db $02, $02, $02, $02, $02, $02, $00, $00
db $02, $02, $02, $00, $02, $02, $00, $00
db $02, $02, $02, $02, $00, $00, $00
} }
; ============================================================================= ; =============================================================================
@@ -596,7 +563,7 @@ KydrogBoss_Set_Damage:
.loop .loop
LDA .damageProperties, X : STA $7F6880, X LDA .damageProperties, X : STA $7F6CB0, X
INX : CPX.b #$10 : BNE .loop INX : CPX.b #$10 : BNE .loop
@@ -605,7 +572,7 @@ KydrogBoss_Set_Damage:
RTS RTS
.damageProperties .damageProperties
db $00, $01, $01, $01, $01, $01, $01, $00, $05, $01, $00, $01, $01, $01, $00, $01 db $00, $01, $01, $01, $01, $01, $01, $00, $04, $01, $00, $01, $02, $01, $00, $01
;BA D1 D2 D3 D4 D5 AR HS BM SA PD FR IR BB ET QU ;BA D1 D2 D3 D4 D5 AR HS BM SA PD FR IR BB ET QU
} }
@@ -650,7 +617,7 @@ Sprite_Damage_Flash:
Sprite_Offspring_SpawnHead: Sprite_Offspring_SpawnHead:
{ {
JSL GetRandomInt : AND.b #$3F : BNE .normal_head JSL GetRandomInt : AND.b #$3F : BNE .normal_head
LDA.b #$04 : BRA .alt_entry LDA.b #$02 : BRA .alt_entry
.normal_head .normal_head
LDA.b #$7C LDA.b #$7C
.alt_entry .alt_entry
@@ -661,7 +628,6 @@ Sprite_Offspring_SpawnHead:
Sprite_Offspring_Spawn: Sprite_Offspring_Spawn:
{ {
; LDA !OffspringCount : CMP.b #$05 : BCS .return
JSL GetRandomInt : AND.b #$3F : BNE .normal_stalfos JSL GetRandomInt : AND.b #$3F : BNE .normal_stalfos
LDA.b #$85 : BRA .alt_entry LDA.b #$85 : BRA .alt_entry
.normal_stalfos .normal_stalfos
@@ -693,8 +659,6 @@ Sprite_Offspring_Spawn:
STZ $0D60, X STZ $0D60, X
STZ $0D70, X STZ $0D70, X
; INC !OffspringCount
PLX PLX
.return .return
@@ -714,6 +678,9 @@ Kydrog_ThrowBoneAtPlayer:
TYX TYX
LDA SprX, X : CLC : ADC.b #$10 : STA SprX, X
LDA SprY, X : SEC : SBC.b #$04 : STA SprY, X
LDA.b #$20 : JSL Sprite_ApplySpeedTowardsPlayer LDA.b #$20 : JSL Sprite_ApplySpeedTowardsPlayer
LDA.b #$21 : STA $0E40, X : STA $0BA0, X LDA.b #$21 : STA $0E40, X : STA $0BA0, X
@@ -748,19 +715,206 @@ Kydrog_ThrowBoneAtPlayer:
GetNumberSpawnStalfos: GetNumberSpawnStalfos:
{ {
PHX PHX
STZ $00 STZ.w $00
LDX.b #$10 LDX.b #$10
.loop
.x_loop
DEX DEX
LDA $0E20, X : CMP.b #$skull : BNE .notSkull
LDA $0DD0, X : CMP.b #$09 : BNE .notSkull LDY.b #$04
.y_loop
DEY
LDA $0E20, X : CMP.w .stalfos_ids, Y : BEQ .increment_count
BRA .not_a_skull
.increment_count
LDA $0DD0, X : CMP.b #$00 : BEQ .not_a_skull
INC $00 INC $00
.notSkull .not_a_skull
CPX.b #$00 : BNE .loop CPY.b #$00 : BNE .y_loop
CPX.b #$00 : BNE .x_loop
PLX PLX
RTL RTL
.stalfos_ids
db $7C, $02, $A7, $85
}
;==============================================================================
Sprite_KydrogBoss_Draw:
{
JSL Sprite_PrepOamCoord
JSL Sprite_OAM_AllocateDeferToPlayer
; JSL OAM_AllocateFromRegionE
LDA $0DC0, X : CLC : ADC $0D90, X : ASL : TAY ; Animation Frame
REP #$20
LDA .start_index, Y : STA $06 ; Needs to be 16 bit ; Y = 00, 02, 04, 06
SEP #$20
; Store Palette thing
LDA $0DA0, X : STA $08
PHX ; Store Sprite ID
REP #$20
LDA .nbr_of_tiles, Y ;amount of tiles -1 ; doesn't need to be 16 bit ;Y = 00, 02, 04, 06
REP #$30
TAX
LDY.w #$0000
.nextTile
REP #$30
PHX ; Save current tile index
TXA : CLC : ADC $06 ; Add Animation Index Offset
PHA ; Keep the value with animation index offset
ASL A : TAX ; *2 for the X and Y position
REP #$30 ; X and Y position must be 16 bit
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
AND.w #$0100 : STA $0E
INY
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100
SEP #$20 ; change A back to 8bit but not X and Y
BCC .on_screen_y
LDA.b #$F0 : STA ($90), Y ; Put the sprite out of the way
STA $0E
.on_screen_y
PLX ; Pullback Animation Index Offset
; so X here is (nbr of tiles + animation index)
INY
LDA .chr, X : STA ($90), Y
INY
; Set palette flash modifier
LDA .properties, X : ORA $08 : STA ($90), Y
REP #$30
PHY
TYA : LSR #2 : TAY ; divide Y by 4
SEP #$20 ;set A back to 8bit but not X and Y
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
PLY : INY
PLX : DEX : BPL .nextTile
SEP #$30
PLX
RTS
.start_index
dw $00, $0B, $15, $1F, $27, $2D, $35, $3D, $43, $4C, $57, $66, $71, $7A, $87, $91, $99, $A1
.nbr_of_tiles
dw 10, 9, 9, 7, 5, 7, 7, 5, 8, 10, 14, 10, 8, 12, 9, 7, 7, 6
.x_offsets
dw -8, 8, 8, 0, 8, 0, -8, -8, 16, 16, -8
dw -8, 8, -8, 0, 16, 16, -8, 16, 0, 8
dw -8, 8, 0, 16, -8, -8, -8, 16, 0, 8
dw 0, 0, 16, 8, 0, 16, 16, 16
dw 16, 0, 0, 16, 16, 0
dw 0, 16, 8, 16, 0, 16, 12, 0
dw 4, -4, 12, 4, -4, -4, 4, -4
dw 4, -12, 4, -12, -4, 16
dw 4, -4, 4, -4, -4, 12, 12, -4, 12
dw 0, 8, 8, 0, 0, 8, -8, -8, -8, 16, 16
dw 0, 8, 8, 0, 8, 0, 0, 8, 8, -8, -8, -8, 16, 16, 16
dw 0, 8, 8, 0, 0, 8, 16, 16, 16, -8, -8
dw -8, -8, 8, 16, 8, 8, 16, 0, 8
dw 0, -8, 8, 8, -8, -8, 0, 8, 0, 8, 16, 16, 16
dw -8, 16, 8, 8, 16, 0, 16, -8, 0, 8
dw -8, 8, -8, -8, 8, 8, -8, 16
dw -8, 8, 0, 8, -8, 8, -8, 16
dw -12, 4, 12, -4, 0, 16, 8
.y_offsets
dw -20, -20, -4, 4, 4, 12, 4, 12, 4, 12, -4
dw -19, -19, 4, 4, 4, 12, -4, -4, -3, -3
dw -20, -20, 4, 4, 4, 12, -4, -4, -4, -4
dw -20, -4, -4, -4, 4, 4, 12, -20
dw -20, -4, 4, -4, 4, -20
dw -20, -20, -4, -4, 4, 4, 12, -4
dw -20, -20, -4, -4, -4, -12, 4, 4
dw -20, -20, -4, -4, 4, 0
dw -20, -20, -4, -4, 4, 0, 8, -12, -4
dw -20, -20, -12, 0, -4, -4, -8, 0, 8, 0, -8
dw -20, -20, -12, -4, -4, 0, 8, 0, 8, 0, 8, -8, 0, 8, -8
dw -20, -20, -12, 0, -4, -4, -8, 0, 8, 0, -8
dw -24, -8, -24, -8, -8, 0, 0, 8, 8
dw -8, -24, -24, -8, -8, 0, 8, 8, 0, 0, 0, 8, -8
dw -16, -16, -16, -8, -8, 0, 0, 0, -24, -24
dw 0, 0, -16, -24, -16, -24, -16, -16
dw 0, 0, -8, -8, -24, -24, -8, -8
dw -4, -4, -20, -20, 12, 12, 12
.chr
db $87, $87, $A7, $80, $81, $A4, $93, $A3, $96, $A6, $A7
db $87, $87, $B3, $80, $92, $A2, $83, $83, $A8, $A8
db $87, $87, $80, $B2, $A1, $B1, $83, $83, $A8, $A8
db $C9, $E9, $EB, $EA, $C0, $C2, $D2, $CB
db $CE, $EC, $C3, $EE, $C5, $CC
db $C9, $CB, $FA, $FB, $C6, $C8, $D8, $E9
db $C9, $CB, $E9, $EA, $EB, $DB, $E1, $E0
db $CC, $CE, $EC, $EE, $E3, $E5
db $C9, $CB, $FA, $FB, $E6, $E8, $F8, $DE, $E9
db $89, $89, $99, $8E, $A9, $A9, $82, $92, $A2, $B3, $83
db $89, $89, $99, $A9, $A9, $8D, $9D, $8D, $9D, $8C, $9C, $83, $A1, $B1, $82
db $89, $89, $99, $8E, $A9, $A9, $83, $93, $A3, $B2, $83
db $45, $65, $45, $65, $66, $77, $75, $BD, $BE
db $6F, $4E, $4E, $6F, $47, $57, $7C, $7D, $AA, $AB, $6E, $7E, $83
db $84, $84, $85, $95, $5D, $AA, $6D, $6D, $8A, $8A
db $AC, $AE, $50, $40, $50, $40, $52, $52
db $AC, $AE, $63, $63, $42, $42, $60, $60
db $68, $6A, $4B, $49, $70, $72, $71
.properties
db $3B, $7B, $7B, $3B, $3B, $3B, $3B, $3B, $3B, $3B, $3B
db $3B, $7B, $3B, $3B, $3B, $3B, $3B, $7B, $3B, $7B
db $3B, $7B, $7B, $3B, $3B, $3B, $3B, $7B, $3B, $7B
db $3B, $3B, $3B, $3B, $3B, $3B, $3B, $3B
db $3B, $3B, $3B, $3B, $3B, $3B
db $3B, $3B, $3B, $3B, $3B, $3B, $3B, $3B
db $7B, $7B, $7B, $7B, $7B, $7B, $3B, $3B
db $7B, $7B, $7B, $7B, $3B, $3B
db $7B, $7B, $7B, $7B, $3B, $3B, $3B, $7B, $7B
db $3B, $7B, $7B, $3B, $3B, $7B, $7B, $7B, $7B, $7B, $7B
db $3B, $7B, $7B, $3B, $7B, $3B, $3B, $7B, $7B, $3B, $3B, $3B, $7B, $7B, $3B
db $3B, $7B, $7B, $7B, $3B, $7B, $7B, $7B, $7B, $7B, $3B
db $3B, $3B, $7B, $7B, $7B, $3B, $7B, $3B, $3B
db $3B, $3B, $7B, $7B, $3B, $3B, $3B, $3B, $3B, $3B, $3B, $3B, $7B
db $3B, $7B, $7B, $7B, $3B, $3B, $3B, $7B, $3B, $7B
db $3B, $3B, $3B, $3B, $7B, $7B, $3B, $7B
db $3B, $3B, $3B, $7B, $3B, $7B, $3B, $7B
db $3B, $3B, $3B, $3B, $3B, $3B, $3B
.sizes
db $02, $02, $02, $00, $00, $02, $00, $00, $00, $00, $02
db $02, $02, $00, $02, $00, $00, $00, $00, $00, $00
db $02, $02, $02, $00, $00, $00, $00, $00, $00, $00
db $02, $00, $00, $00, $02, $00, $00, $00
db $02, $02, $02, $02, $00, $02
db $02, $00, $00, $00, $02, $00, $00, $00
db $02, $00, $00, $00, $00, $00, $02, $02
db $02, $02, $02, $02, $02, $00
db $02, $00, $00, $00, $02, $00, $00, $00, $00
db $02, $00, $00, $02, $00, $00, $00, $00, $00, $00, $00
db $02, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
db $02, $00, $00, $02, $00, $00, $00, $00, $00, $00, $00
db $02, $02, $02, $00, $00, $00, $00, $00, $00
db $00, $02, $02, $00, $02, $02, $00, $00, $00, $00, $00, $00, $00
db $02, $00, $00, $00, $00, $02, $00, $00, $00, $00
db $02, $02, $02, $02, $02, $02, $00, $00
db $02, $02, $02, $00, $02, $02, $00, $00
db $02, $02, $02, $02, $00, $00, $00
} }