diff --git a/src/boss.asm b/src/boss.asm index 3474084..bbf4e84 100644 --- a/src/boss.asm +++ b/src/boss.asm @@ -17,6 +17,7 @@ ;;; with Annalog. If not, see . ;;; ;;;=========================================================================;;; +.INCLUDE "actor.inc" .INCLUDE "audio.inc" .INCLUDE "boss.inc" .INCLUDE "device.inc" @@ -34,7 +35,9 @@ .IMPORT Func_DivMod .IMPORT Func_FindEmptyActorSlot .IMPORT Func_GetRandomByte +.IMPORT Func_InitActorDefault .IMPORT Func_InitActorSmokeExplosion +.IMPORT Func_InitActorSmokeParticle .IMPORT Func_IsFlagSet .IMPORT Func_LockDoorDevice .IMPORT Func_MarkRoomSafe @@ -47,6 +50,7 @@ .IMPORT Func_SetMachineIndex .IMPORT Func_ShakeRoom .IMPORT Func_UnlockDoorDevice +.IMPORT Ram_ActorType_eActor_arr .IMPORT Ram_DeviceAnim_u8_arr .IMPORT Ram_DeviceTarget_byte_arr .IMPORT Ram_DeviceType_eDevice_arr @@ -222,6 +226,7 @@ _BossBattle: jsr Func_SetFlag jsr Func_MarkRoomSafe jsr FuncA_Room_DisableAllMachinesAndConsoles + jsr FuncA_Room_ExpireAllBossProjectiles ;; Turn off the boss music. lda #eMusic::Silence sta Zp_Next_sAudioCtrl + sAudioCtrl::Music_eMusic @@ -441,6 +446,47 @@ _DisableConsoles: rts .ENDPROC +;;; Expires all boss-fired projectiles, either turning them to smoke or just +;;; removing them. +.PROC FuncA_Room_ExpireAllBossProjectiles + ldx #kMaxActors - 1 +_Loop: + jsr _MaybeExpireActor ; preserves X + dex + .assert kMaxActors <= $80, error + bpl _Loop + rts +_MaybeExpireActor: + lda Ram_ActorType_eActor_arr, x + cmp #eActor::ProjFireball + beq _ExpireFireball + cmp #eActor::ProjBreakfire + beq _ExpireBreakfire + cmp #eActor::ProjBreakball + beq _ExpireBreakball + cmp #eActor::ProjFlamestrike + beq _ExpireFlamestrike + cmp #eActor::ProjSpine + beq _ExpireSpine + cmp #eActor::ProjBreakbomb + beq _ExpireBreakbomb + rts +_ExpireBreakbomb: +_ExpireFireball: +_ExpireSpine: + ldy #eActor::SmokeParticle ; param: actor type + jmp Func_InitActorDefault ; preserves X +_ExpireBreakfire: + lda #$c0 ; param: angle ($c0 = up) + jmp Func_InitActorSmokeParticle ; preserves X +_ExpireBreakball: + jmp Func_InitActorSmokeExplosion ; preserves X +_ExpireFlamestrike: + lda #eActor::None + sta Ram_ActorType_eActor_arr, x + rts +.ENDPROC + ;;;=========================================================================;;; .SEGMENT "PRGA_Objects" diff --git a/src/rooms/boss_lava.asm b/src/rooms/boss_lava.asm index d37a723..1c08b8c 100644 --- a/src/rooms/boss_lava.asm +++ b/src/rooms/boss_lava.asm @@ -98,6 +98,7 @@ .IMPORT Ram_MachineGoalHorz_u8_arr .IMPORT Ram_Oam_sObj_arr64 .IMPORT Ram_PlatformLeft_i16_0_arr +.IMPORT Ram_PlatformType_ePlatform_arr .IMPORT Ram_PpuTransfer_arr .IMPORTZP Zp_Active_sIrq .IMPORTZP Zp_Buffered_sIrq @@ -665,6 +666,8 @@ _BossHurt: bne _StartScuttling ; boss is not dead yet .assert eBossMode::Dead = 0, error sta Zp_RoomState + sState::Current_eBossMode + lda #ePlatform::Zone + sta Ram_PlatformType_ePlatform_arr + kBossBodyPlatformIndex rts _StartScuttling: lda #eBossMode::Scuttling @@ -976,7 +979,12 @@ _RegR: .PROC FuncA_Room_BossLava_EnterRoom ldax #DataC_Boss_Lava_sBoss ; param: sBoss ptr jsr FuncA_Room_InitBoss ; sets Z if boss is alive - bne _BossIsDead + beq _BossIsAlive +_BossIsDead: + ;; Remove the boss's body. + lda #ePlatform::Zone + sta Ram_PlatformType_ePlatform_arr + kBossBodyPlatformIndex + rts _BossIsAlive: lda #kBossInitHealth sta Zp_RoomState + sState::BossHealth_u8 @@ -988,7 +996,6 @@ _BossIsAlive: lda #kBossInitGoalX sta Zp_RoomState + sState::BossGoalX_u8 .assert kBossInitGoalY = 0, error -_BossIsDead: rts .ENDPROC