Skip to content

Commit

Permalink
Make Lava boss easier by scuttling more and adding side platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsteele committed Oct 8, 2024
1 parent 3d00cf3 commit e0690ba
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 46 deletions.
123 changes: 80 additions & 43 deletions src/rooms/boss_lava.asm
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,23 @@ kPaletteObjBossLava = 1
;;; Defines room-specific state data for this particular room.
.STRUCT sState
;; The current states of the room's two levers.
LeverLeft_u8 .byte
LeverRight_u8 .byte
LeverLeft_u8 .byte
LeverRight_u8 .byte
;; What mode the boss is in.
Current_eBossMode .byte
Current_eBossMode .byte
;; Mode-specific parameter/counter for the current boss mode.
BossModeParam_byte .byte
;; How many more blaster hits are needed before the boss dies.
BossHealth_u8 .byte
BossHealth_u8 .byte
;; Timer that ticks down each frame when nonzero. Used to time transitions
;; between boss modes.
BossCooldown_u8 .byte
BossCooldown_u8 .byte
;; The goal position for the boss within its zone, in blocks.
BossGoalX_u8 .byte ; 0-9
BossGoalY_u8 .byte ; 0-3
BossGoalX_u8 .byte ; 0-9
BossGoalY_u8 .byte ; 0-3
;; How open the boss's jaws are (0 = fully closed, kBossJawsOpenFrames =
;; fully open).
BossJawsOpen_u8 .byte
BossJawsOpen_u8 .byte
.ENDSTRUCT
.ASSERT .sizeof(sState) <= kRoomStateSize, error

Expand Down Expand Up @@ -414,6 +416,14 @@ _Platforms_sPlatform_arr:
d_word Left_i16, kBossBodyInitCenterX - kBossTailWidthPx / 2
d_word Top_i16, kBossBodyInitTopY - kBossTailHeightPx
D_END
;; Girders:
D_STRUCT sPlatform
d_byte Type_ePlatform, ePlatform::Solid
d_word WidthPx_u16, $90
d_byte HeightPx_u8, $10
d_word Left_i16, $0038
d_word Top_i16, $00b0
D_END
;; Lava:
D_STRUCT sPlatform
d_byte Type_ePlatform, ePlatform::Kill
Expand Down Expand Up @@ -571,13 +581,24 @@ _BossFiresprayWindup:
sta Zp_RoomState + sState::Current_eBossMode
lda #$31
sta Zp_RoomState + sState::BossCooldown_u8
jsr Func_GetRandomByte ; returns A
sta Zp_RoomState + sState::BossModeParam_byte
@done:
rts
_BossFlamestrikePrepare:
jsr FuncC_Boss_Lava_BossCloseJaws
;; Wait until the boss is in position.
jsr FuncC_Boss_Lava_BossMoveTowardGoal ; sets C when goal is reached
bcc @done
;; Wait until no other flamestrike projectile exists.
ldx #kMaxActors - 1
@loop:
lda Ram_ActorType_eActor_arr, x
cmp #eActor::ProjFlamestrike
beq @done
dex
.assert kMaxActors <= $80, error
bpl @loop
;; Change modes to shoot the flamestrike.
lda #eBossMode::FlamestrikeShoot
sta Zp_RoomState + sState::Current_eBossMode
Expand Down Expand Up @@ -629,16 +650,16 @@ _BossFlamestrikeRetreat:
lda Zp_RoomState + sState::BossCooldown_u8
beq _StartFirespray
rts
_StartFlamestrike:
;; Choose a random valid position for firing a flamestrike.
_StartFirespray:
;; Choose a random valid position for shooting a fireball spray.
jsr Func_GetRandomByte ; returns A
and #$03
add #3
and #$07
add #1
sta Zp_RoomState + sState::BossGoalX_u8
lda #2
lda #1
sta Zp_RoomState + sState::BossGoalY_u8
;; Change modes to move to the firing position and shoot a flamestrike.
lda #eBossMode::FlamestrikePrepare
;; Change modes to move to the firing position and shoot a fireball spray.
lda #eBossMode::FiresprayPrepare
sta Zp_RoomState + sState::Current_eBossMode
rts
_BossHurt:
Expand Down Expand Up @@ -670,6 +691,12 @@ _BossHurt:
sta Ram_PlatformType_ePlatform_arr + kBossBodyPlatformIndex
rts
_StartScuttling:
;; Choose a random number of times to scuttle, from 2-5.
jsr Func_GetRandomByte ; returns A
mod #4
add #2
sta Zp_RoomState + sState::BossModeParam_byte
_StartNextScuttle:
lda #eBossMode::Scuttling
sta Zp_RoomState + sState::Current_eBossMode
;; Pick a new goal position.
Expand All @@ -683,34 +710,6 @@ _StartScuttling:
sta Zp_RoomState + sState::BossGoalY_u8
_Return:
rts
_StartFirespray:
;; Choose a random valid position for shooting a fireball spray.
jsr Func_GetRandomByte ; returns A
and #$07
add #1
sta Zp_RoomState + sState::BossGoalX_u8
lda #1
sta Zp_RoomState + sState::BossGoalY_u8
;; Change modes to move to the firing position and shoot a fireball spray.
lda #eBossMode::FiresprayPrepare
sta Zp_RoomState + sState::Current_eBossMode
rts
_BossScuttling:
;; Wait for cooldown.
lda Zp_RoomState + sState::BossCooldown_u8
bne FuncC_Boss_Lava_BossOpenJaws
;; Close jaws while scuttling.
jsr FuncC_Boss_Lava_BossCloseJaws
;; Move towards the goal.
jsr FuncC_Boss_Lava_BossMoveTowardGoal ; sets C when goal is reached
bcc @done ; hasn't reached goal yet
;; Set a cooldown before proceeding to the next goal position.
lda #kBossScuttleCooldown
sta Zp_RoomState + sState::BossCooldown_u8
.assert kBossScuttleCooldown > 0, error
bne _StartFlamestrike ; unconditional TODO: only flamestrike sometimes
@done:
rts
_BossFiresprayShoot:
;; Only shoot every eight frames.
lda Zp_RoomState + sState::BossCooldown_u8
Expand All @@ -726,14 +725,50 @@ _BossFiresprayShoot:
jsr Func_SetActorCenterToPoint ; preserves X
lda Zp_RoomState + sState::BossCooldown_u8
mul #2 ; clears the carry bit
bit Zp_RoomState + sState::BossModeParam_byte
bmi @sweepRightToLeft
@sweepLeftToRight:
adc #$10 ; param: aim angle
bne @shootFireball ; unconditional
@sweepRightToLeft:
rsub #$70 ; param: aim angle
@shootFireball:
jsr Func_InitActorProjFireball
jsr Func_PlaySfxShootFire
;; When the last fireball is fired, change modes.
lda Zp_RoomState + sState::BossCooldown_u8
beq _StartScuttling
@done:
rts
_BossScuttling:
;; Wait for cooldown.
lda Zp_RoomState + sState::BossCooldown_u8
bne FuncC_Boss_Lava_BossOpenJaws
;; Close jaws while scuttling.
jsr FuncC_Boss_Lava_BossCloseJaws
;; Move towards the goal.
jsr FuncC_Boss_Lava_BossMoveTowardGoal ; sets C when goal is reached
bcc _Return ; hasn't reached goal yet
;; Set a cooldown before proceeding to the next goal position.
lda #kBossScuttleCooldown
sta Zp_RoomState + sState::BossCooldown_u8
dec Zp_RoomState + sState::BossModeParam_byte
beq _StartFlamestrike
lda #60
sta Zp_RoomState + sState::BossCooldown_u8
bne _StartNextScuttle ; unconditional
_StartFlamestrike:
;; Choose a random valid position for firing a flamestrike.
jsr Func_GetRandomByte ; returns A
and #$03
add #3
sta Zp_RoomState + sState::BossGoalX_u8
lda #2
sta Zp_RoomState + sState::BossGoalY_u8
;; Change modes to move to the firing position and shoot a flamestrike.
lda #eBossMode::FlamestrikePrepare
sta Zp_RoomState + sState::Current_eBossMode
rts
.ENDPROC

;;; Moves the boss towards its goal position (as specified by BossGoalX_u8 and
Expand Down Expand Up @@ -996,6 +1031,8 @@ _BossIsAlive:
lda #kBossInitGoalX
sta Zp_RoomState + sState::BossGoalX_u8
.assert kBossInitGoalY = 0, error
lda #2
sta Zp_RoomState + sState::BossModeParam_byte
rts
.ENDPROC

Expand Down
2 changes: 1 addition & 1 deletion src/rooms/boss_lava.bg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ EC EO
EJ CM BM CN EO
ED AC BEBO BFAC EO
ECAB EAFPEAEAEAEBGNEA ABEO
ECEA ECFHFJFDEPFCGMEC AKGCEO
ECEA CKECFHFJFDEPFCGMECCLAKGCEO
ECEJ EMEIECECFAEJEIEJ DMGLEO
BPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBN
BPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBN
4 changes: 2 additions & 2 deletions src/tilesets/lava.bg
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
COCPCECFCKCLFCFD FEHD AD ACENEMEMEN
EI EIEI EI EJELELEJEJ EJ ELEL GA ICIDGAGB
EKEIEIEKEK EK EIEI EL ELEL EL IAIBGB ICIDGBGA
EDECEDECFAECEDFBJRJQJPJO JEJF JE FH FG
EL EL JRJQJPJO JEJF JR FHFG
EDECEDECFAECEDFBJRJQJPJO JEJF JE EFEE FH FG
EL EL JRJQJPJO JEJF JR EHEG FHFG
BABA BB BB BGBH BGBABABH BE
BABABB BB BEBF BEBABABF BB BJ
EAEBEBEAEDECEDDFEEEFEFEEEEEFEFEEEDECEDECEAEBEAEBEDECEAEBED BMBN
Expand Down

0 comments on commit e0690ba

Please sign in to comment.