diff --git a/src/chr.asm b/src/chr.asm index 0bf72540..5ac8c12d 100644 --- a/src/chr.asm +++ b/src/chr.asm @@ -564,10 +564,10 @@ _chr_begin: chr_inc "steam_pipes" chr_inc "volcanic1" chr_inc "volcanic2" - chr_res $07 + chr_inc "terrain_boss_lava", kTileIdBgTerrainBossLavaFirst chr_inc "arch" chr_inc "boiler" - chr_inc "terrain_boss_lava" + chr_inc "terrain_boss_lava_hurt", kTileIdBgTerrainBossLavaHurtFirst END_CHR_BANK .ENDPROC diff --git a/src/rooms/boss_lava.asm b/src/rooms/boss_lava.asm index 5d00935f..20263bc0 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_PpuTransfer_arr .IMPORTZP Zp_Active_sIrq .IMPORTZP Zp_Buffered_sIrq .IMPORTZP Zp_Chr04Bank_u8 @@ -105,6 +106,7 @@ .IMPORTZP Zp_NextIrq_int_ptr .IMPORTZP Zp_PointX_i16 .IMPORTZP Zp_PointY_i16 +.IMPORTZP Zp_PpuTransferLen_u8 .IMPORTZP Zp_RoomScrollY_u8 .IMPORTZP Zp_RoomState .IMPORTZP Zp_ShapePosX_i16 @@ -179,8 +181,8 @@ kBossBodyInitTopY = kBossZoneTopY + kBlockHeightPx * kBossInitGoalY ;;; The tile row/col in the lower nametable for the top-left corner of the ;;; boss's BG tiles. -kBossBgStartRow = 7 -kBossBgStartCol = 0 +kBossBgStartRow = 8 +kBossBgStartCol = 2 ;;; The PPU addresses for the start (left) of each row of the boss's BG tiles. .LINECONT + @@ -192,6 +194,10 @@ Ppu_BossRow2Start = Ppu_Nametable3_sName + sName::Tiles_u8_arr + \ kScreenWidthTiles * (kBossBgStartRow + 2) + kBossBgStartCol Ppu_BossRow3Start = Ppu_Nametable3_sName + sName::Tiles_u8_arr + \ kScreenWidthTiles * (kBossBgStartRow + 3) + kBossBgStartCol +.ASSERT kBossBgStartRow .mod 4 = 0, error +.ASSERT (kBossBgStartCol + 2) .mod 4 = 0, error +Ppu_BossBodyAttrs = Ppu_Nametable3_sName + sName::Attrs_u8_arr64 + \ + (kBossBgStartRow / 4) * 8 + ((kBossBgStartCol + 2) / 4) .LINECONT - ;;; Modes that the boss in this room can be in. @@ -279,7 +285,7 @@ _Ext_sRoomExt: d_addr Devices_sDevice_arr_ptr, _Devices_sDevice_arr d_addr Passages_sPassage_arr_ptr, 0 d_addr Enter_func_ptr, FuncA_Room_BossLava_EnterRoom - d_addr FadeIn_func_ptr, FuncA_Terrain_BossLava_FadeInRoom + d_addr FadeIn_func_ptr, FuncC_Boss_Lava_FadeInRoom d_addr Tick_func_ptr, FuncA_Room_BossLava_TickRoom d_addr Draw_func_ptr, FuncC_Boss_Lava_DrawRoom D_END @@ -506,6 +512,11 @@ _CheckForHitTail: sta Zp_RoomState + sState::BossCooldown_u8 lda #eSample::BossHurtE ; param: eSample to play jsr Func_PlaySfxSample + ;; Decrement boss health (if nonzero). + lda Zp_RoomState + sState::BossHealth_u8 + beq @done + dec Zp_RoomState + sState::BossHealth_u8 + jsr FuncC_Boss_Lava_TransferBossBodyTiles @done: _CoolDown: lda Zp_RoomState + sState::BossCooldown_u8 @@ -648,11 +659,11 @@ _BossHurt: ldx #kBossTailPlatformIndex ; param: platform index jmp Func_MovePlatformHorz ; preserves X @doneVibrate: - ;; At the end of the hurt animation, decrement the boss's health. If its - ;; health is now zero, kill the boss. Otherwise, start scuttling. - dec Zp_RoomState + sState::BossHealth_u8 + ;; At the end of the hurt animation, if boss's health is now zero, kill the + ;; boss. Otherwise, start scuttling. + lda Zp_RoomState + sState::BossHealth_u8 bne _StartScuttling ; boss is not dead yet - lda #eBossMode::Dead + .assert eBossMode::Dead = 0, error sta Zp_RoomState + sState::Current_eBossMode rts _StartScuttling: @@ -1063,37 +1074,101 @@ _ValvePipePlatformIndex_u8_arr4: .SEGMENT "PRGA_Terrain" -.PROC DataA_Terrain_BossLavaInitTransfer_arr +.PROC DataA_Terrain_BossLavaLegsTransfer_arr .assert kBossFullWidthTiles = 8, error .assert kBossHeightTiles = 4, error .assert kTileIdBgAnimBossLavaFirst = $50, error + ;; Nametable attributes to color body injuries red: + .byte kPpuCtrlFlagsHorz + .dbyt Ppu_BossBodyAttrs ; transfer destination + .byte 1 + .byte $55 ;; Row 0: .byte kPpuCtrlFlagsHorz .dbyt Ppu_BossRow0Start ; transfer destination .byte 8 - .byte $50, $54, $58, $b8, $b9, $5c, $60, $64 + .byte $50, $54, $58, $00, $00, $5c, $60, $64 ;; Row 1: .byte kPpuCtrlFlagsHorz .dbyt Ppu_BossRow1Start ; transfer destination .byte 8 - .byte $51, $55, $59, $ba, $bb, $5d, $61, $65 + .byte $51, $55, $59, $00, $00, $5d, $61, $65 ;; Row 2: .byte kPpuCtrlFlagsHorz .dbyt Ppu_BossRow2Start ; transfer destination .byte 8 - .byte $52, $56, $5a, $bc, $bd, $5e, $62, $66 + .byte $52, $56, $5a, $00, $00, $5e, $62, $66 ;; Row 3: .byte kPpuCtrlFlagsHorz .dbyt Ppu_BossRow3Start ; transfer destination .byte 8 - .byte $53, $57, $5b, $be, $bf, $5f, $63, $67 + .byte $53, $57, $5b, $00, $00, $5f, $63, $67 +.ENDPROC + +;;;=========================================================================;;; + +.SEGMENT "PRGC_Boss" + +.PROC DataC_Boss_BossLavaBodyTransfer_arr + .assert kBossFullWidthTiles = 8, error + .assert kBossHeightTiles = 4, error + .assert kTileIdBgTerrainBossLavaFirst = $a8, error + ;; Col 3: + .byte kPpuCtrlFlagsVert + .dbyt Ppu_BossRow0Start + 3 ; transfer destination + .byte 4 + .byte $a8, $aa, $ac, $ae + ;; Col 4: + .byte kPpuCtrlFlagsVert + .dbyt Ppu_BossRow0Start + 4 ; transfer destination + .byte 4 + .byte $a9, $ab, $ad, $af +.ENDPROC + +;;; @prereq PRGA_Terrain is loaded. +.PROC FuncC_Boss_Lava_FadeInRoom + jsr FuncA_Terrain_FadeInShortRoomWithLava + ;; Transfer BG tiles for the boss's legs. + ldax #DataA_Terrain_BossLavaLegsTransfer_arr ; param: data pointer + ldy #.sizeof(DataA_Terrain_BossLavaLegsTransfer_arr) ; param: data length + jsr Func_BufferPpuTransfer + ;; Transfer BG tiles for the boss's body. + fall FuncC_Boss_Lava_TransferBossBodyTiles .ENDPROC -.PROC FuncA_Terrain_BossLava_FadeInRoom - ldax #DataA_Terrain_BossLavaInitTransfer_arr ; param: data pointer - ldy #.sizeof(DataA_Terrain_BossLavaInitTransfer_arr) ; param: data length +;;; Buffers a PPU transfer to draw the BG tiles for the lava boss's body, +;;; taking its current health into account. Note that this is called from both +;;; room fade-in and boss tick functions, so no particular PRGA bank is +;;; guaranteed to be loaded. +.PROC FuncC_Boss_Lava_TransferBossBodyTiles + ;; Buffer a transfer for the boss's body at full health. + ldax #DataC_Boss_BossLavaBodyTransfer_arr ; param: data pointer + ldy #.sizeof(DataC_Boss_BossLavaBodyTransfer_arr) ; param: data length jsr Func_BufferPpuTransfer - jmp FuncA_Terrain_FadeInShortRoomWithLava + ;; For each point of damage on the boss, alter one of the body tiles in the + ;; transfer buffer to be injured. + lda #kBossInitHealth + sub Zp_RoomState + sState::BossHealth_u8 + tax + bpl @continue ; unconditional + @loop: + lda Zp_PpuTransferLen_u8 + sub _OffsetFromEnd_u8_arr, x + tay + lda Ram_PpuTransfer_arr, y + .linecont + + .assert kTileIdBgTerrainBossLavaHurtFirst = \ + kTileIdBgTerrainBossLavaFirst | $10, error + ora #$10 + .linecont - + sta Ram_PpuTransfer_arr, y + @continue: + dex + bpl @loop + rts +_OffsetFromEnd_u8_arr: +: .byte 4, 10, 1, 12, 2, 11, 3, 9 + .assert * - :- = kBossInitHealth, error .ENDPROC ;;;=========================================================================;;; diff --git a/src/rooms/boss_lava.inc b/src/rooms/boss_lava.inc index de8180d6..829df93a 100644 --- a/src/rooms/boss_lava.inc +++ b/src/rooms/boss_lava.inc @@ -20,6 +20,10 @@ ;;; BG tile IDs for animating the lava boss's legs. kTileIdBgAnimBossLavaFirst = $50 +;;; BG tile IDs for the lava boss's body, with and without injuries. +kTileIdBgTerrainBossLavaHurtFirst = $b8 +kTileIdBgTerrainBossLavaFirst = $a8 + ;;; OBJ tile IDs for drawing the lava boss. kTileIdObjBossLavaJawsFirst = $d0 diff --git a/src/tiles/shadow1.ahi b/src/tiles/shadow1.ahi index 91931155..2eb2b4a4 100644 --- a/src/tiles/shadow1.ahi +++ b/src/tiles/shadow1.ahi @@ -2,41 +2,41 @@ ahi1 f0 p1 i16 w8 h8 0004;0;54;ECEEEC;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0 -03333333 -31111111 -31333333 -31311133 -31311333 -31313333 -31333333 -31333333 - -33333330 -11111113 -33333313 -33111313 -33311313 -33331313 -33333313 -33333313 - -31333333 -31333333 -31313333 -31311333 -31311133 -31333333 -31111111 -03333333 - -33333313 -33333313 -33331313 -33311313 -33111313 -33333313 -11111113 -33333330 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 31333333 13333333 diff --git a/src/tiles/terrain_boss_lava_hurt.ahi b/src/tiles/terrain_boss_lava_hurt.ahi new file mode 100644 index 00000000..63eef87c --- /dev/null +++ b/src/tiles/terrain_boss_lava_hurt.ahi @@ -0,0 +1,75 @@ +ahi1 f0 p1 i8 w8 h8 + +;0;982220;ECEEEC;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0 + +11333313 +13333313 +13323311 +13223331 +33233223 +31122323 +13332333 +33333333 + +31333311 +31333221 +11332231 +13222331 +33323333 +33223113 +33233331 +33233333 + +33333333 +33133333 +33113223 +32223233 +33323233 +33122333 +31332233 +11333133 + +33333333 +33333133 +33331133 +33331333 +33331223 +33222133 +33323313 +33132311 + +13333133 +13333333 +33222333 +32233223 +33332233 +33113333 +33113333 +13333113 + +33133331 +33332231 +33322333 +33222233 +33333233 +33331133 +33331133 +31133331 + +11323113 +11223333 +13233113 +32231113 +32321113 +33333333 +30113303 +00000003 + +31133311 +33332311 +31132331 +31112223 +31112322 +33333333 +30331103 +30000000 diff --git a/src/tiles/terrain_shared_1.ahi b/src/tiles/terrain_shared_1.ahi index 40c95d5e..88045bd0 100644 --- a/src/tiles/terrain_shared_1.ahi +++ b/src/tiles/terrain_shared_1.ahi @@ -38,41 +38,41 @@ ahi1 f0 p1 i16 w8 h8 00000000 00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 - -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 - -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 - -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 +03333333 +31111111 +31333333 +31311133 +31311333 +31313333 +31333333 +31333333 + +33333330 +11111113 +33333313 +33111313 +33311313 +33331313 +33333313 +33333313 + +31333333 +31333333 +31313333 +31311333 +31311133 +31333333 +31111111 +03333333 + +33333313 +33333313 +33331313 +33311313 +33111313 +33333313 +11111113 +33333330 00000000 00000000 diff --git a/src/tiles/terrain_teleport.ahi b/src/tiles/terrain_teleport.ahi index ec551e80..a4c929f4 100644 --- a/src/tiles/terrain_teleport.ahi +++ b/src/tiles/terrain_teleport.ahi @@ -47,32 +47,32 @@ ahi1 f0 p1 i60 w8 h8 00000000 00000000 -33333330 -11111113 -33333313 -33111313 -33311313 -33331313 -33333313 -33333313 - -31333333 -31333333 -31313333 -31311333 -31311133 -31333333 -31111111 -03333333 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 -33333313 -33333313 -33331313 -33311313 -33111313 -33333313 -11111113 -33333330 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 00000000 00000000 diff --git a/src/tiles/volcanic2.ahi b/src/tiles/volcanic2.ahi index eb61ec68..58ae1e0d 100644 --- a/src/tiles/volcanic2.ahi +++ b/src/tiles/volcanic2.ahi @@ -1,4 +1,4 @@ -ahi1 f0 p1 i9 w8 h8 +ahi1 f0 p1 i8 w8 h8 00080;0;54;ECEEEC;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0 @@ -38,14 +38,14 @@ ahi1 f0 p1 i9 w8 h8 20022000 20022000 -33333330 -11111113 -33333313 -33111313 -33311313 -33331313 -33333313 -33333313 +31333333 +31333333 +31113311 +03313313 +00013311 +00013311 +00013333 +00001333 33333313 33331313 @@ -73,12 +73,3 @@ ahi1 f0 p1 i9 w8 h8 00020000 00000000 00000000 - -31333333 -31333333 -31113311 -03313313 -00013311 -00013311 -00013333 -00001333 diff --git a/src/tilesets/lava.bg b/src/tilesets/lava.bg index 961e3210..8663163e 100644 --- a/src/tilesets/lava.bg +++ b/src/tilesets/lava.bg @@ -10,18 +10,18 @@ >arch CMCN CICJ DCDDEPEOEOEP HB AB AA - COCPCECFCKCLFCFD FIHD AD ACENEMEMEN + COCPCECFCKCLFCFD FEHD AD ACENEMEMEN EI EIEI EI EJELELEJEJ EJ ELEL GA ICIDGAGB EKEIEIEKEK EK EIEI EL ELEL EL IAIBGB ICIDGBGA EDECEDECFAECEDFB FH FG EL EL FHFG BABA BB BB BGBH BGBABABH BE BABABB BB BEBF BEBABABF BB BJ -EAEBEBEAEDECEDFEEEEFEFEEEEEFEFEEEDECEDECEAEBEAEBEDECEAEBED BMBN +EAEBEBEAEDECEDDFEEEFEFEEEEEFEFEEEDECEDECEAEBEAEBEDECEAEBED BMBN ECEDECEDECEDECFFEGEHEHEGEHEGEGEHFAEDECFBFAEDECFBFAFBFAFBEC BOBP BBECEDBBEDECBABAEDECBFECBBECBGBABBECBABCEDHAHBECBABKBJECEDECBJEC BBEDECBBBABAECEDBEBABBEDBHEDECEDBDEDECEDECHCHDEDECEDBHEDBABKBBED -BABABHECHAHBEDECEDECEDBB HAED ED FEECBEBABHECEDBBEBBJBJECBBEC -BABABABAHCHDBFBEBABFECBGFIHCFAFIECAGAHEDBBEDECEDBABHECBBBGBABGBK -DADB DADBDADBDA DBDA DBDADB BBFE +BABABHECHAHBEDECEDECEDBB HAED ED DFECBEBABHECEDBBEBBJBJECBBEC +BABABABAHCHDBFBEBABFECBGFEHCFAFEECDGDHEDBBEDECEDBABHECBBBGBABGBK +DADB DADBDADBDA DBDA DBDADB BBDF DBDA DB DADBDADBDADB DA DBDA BBFF diff --git a/src/tilesets/shadow.bg b/src/tilesets/shadow.bg index 14a57608..291b24d6 100644 --- a/src/tilesets/shadow.bg +++ b/src/tilesets/shadow.bg @@ -17,7 +17,7 @@ EEEIEIEFEJ EJ EGEH EGEIEIEH EEEF EJEJ EJ EJEGEIEIEH EEEF EEEIEIEF EJEJ EGEH GAGBGEGF GC GF GE GFEIGEEJ GCGFGGGH GAGIGB GE GF GGGJGH GGGIGB -DADKDKDBDADBDIDJDADKDKDBDIDFDEDJDIDFDEDJDKDKDEDFDIDJDKDKDADBDEDF -DCDLDLDDDIDJDCDDDIDHDGDJDCDLDLDDDIDHDGDJDGDHDLDLDIDJDLDLDCDDDGDH -EK EKEKEKEMENDBDADCDD -EL ELELELEOEPDDDCDADB +IEDKDKIFIEIFDIDJIEDKDKIFDIDFDEDJDIDFDEDJDKDKDEDFDIDJDKDKIEIFDEDF +IGDLDLIHDIDJIGIHDIDHDGDJIGDLDLIHDIDHDGDJDGDHDLDLDIDJDLDLIGIHDGDH +EK EKEKEKEMENIFIEIGIH +EL ELELELEOEPIHIGIEIF