From 91d3592737af27781d505e7f131e4095725d13b5 Mon Sep 17 00:00:00 2001 From: "Matthew D. Steele" Date: Wed, 27 Mar 2024 10:03:35 -0400 Subject: [PATCH] Add baddies and a paper to FactoryAccess/FactoryBridge rooms --- src/dialog.asm | 2 + src/dialog.inc | 22 ++++++++++- src/paper.asm | 4 +- src/rooms/factory_access.asm | 14 ++++++- src/rooms/factory_bridge.asm | 73 +++++++++++++++++++++++++++++++++--- src/rooms/temple_pit.asm | 4 +- 6 files changed, 107 insertions(+), 12 deletions(-) diff --git a/src/dialog.asm b/src/dialog.asm index 0e2d1267..3c0ee0bc 100644 --- a/src/dialog.asm +++ b/src/dialog.asm @@ -78,6 +78,7 @@ .IMPORT DataA_Dialog_MermaidVillageFarmer_sDialog .IMPORT DataA_Dialog_MermaidVillageGuard_sDialog .IMPORT DataA_Dialog_PaperJerome01_sDialog +.IMPORT DataA_Dialog_PaperJerome07_sDialog .IMPORT DataA_Dialog_PaperJerome08_sDialog .IMPORT DataA_Dialog_PaperJerome09_sDialog .IMPORT DataA_Dialog_PaperJerome10_sDialog @@ -482,6 +483,7 @@ _Finish: d_entry t, MermaidVillageFarmer, DataA_Dialog_MermaidVillageFarmer_sDialog d_entry t, MermaidVillageGuard, DataA_Dialog_MermaidVillageGuard_sDialog d_entry t, PaperJerome01, DataA_Dialog_PaperJerome01_sDialog + d_entry t, PaperJerome07, DataA_Dialog_PaperJerome07_sDialog d_entry t, PaperJerome08, DataA_Dialog_PaperJerome08_sDialog d_entry t, PaperJerome09, DataA_Dialog_PaperJerome09_sDialog d_entry t, PaperJerome10, DataA_Dialog_PaperJerome10_sDialog diff --git a/src/dialog.inc b/src/dialog.inc index d6232ee7..d7791126 100644 --- a/src/dialog.inc +++ b/src/dialog.inc @@ -20,14 +20,31 @@ ;;; A sDialog struct is a variable-length sequence of one or more entries, with ;;; each entry consisting of one of the following: ;;; * The 1-byte kDialogEntryDone constant, indicating the end of the dialog. -;;; * The 1-byte kDialogEntryFunc constant, followed by a pointer to a -;;; function that will return YA with a pointer to another sDialog struct. +;;; * The 1-byte kDialogEntryCutscene constant, followed by an eCutscene +;;; value, indicating that dialog should end and the specified cutscene +;;; should begin. ;;; * A 1-byte ePortrait value, followed by a 16-bit word encoding a banked ;;; pointer to a pane of dialog text within one of the PRGA_Text? segments. ;;; The top 3 bits of the word hold the PRGA bank number (which must be ;;; 0-7), and the bottom 13 bits of the word hold the bottom 13 bits of the ;;; pointer (the top 3 bits of the pointer can be omitted, since they ;;; will always be %101 given that the address is within PRGA). +;;; * The 1-byte kDialogEntryGoto constant, followed by a pointer to another +;;; sDialog struct to jump to. +;;; * The 1-byte kDialogEntryFunc constant, followed by a pointer to a +;;; function that will return YA with a pointer to another sDialog struct +;;; to jump to. +;;; * The 1-byte kDialogEntryBranch constant, followed by a pointer to +;;; another sDialog struct, and then an eFlag. If the flag is set, dialog +;;; will jump to the other sDialog struct, otherwise it will continue to +;;; the next entry. As a special case, if the eFlag value is 0, the branch +;;; will instead be taken if they player answered "YES" to the previous +;;; YES/NO dialog question. +;;; * The 1-byte kDialogEntryCall constant, followed by a pointer to a +;;; function to call before continuing to the next entry. +;;; * The 1-byte kDialogEntryQuest constant, followed by an eFlag to set +;;; (while playing the "new quest" sound effect, if the flag was previously +;;; clear) before continuing to the next entry. ;;;=========================================================================;;; @@ -121,6 +138,7 @@ kDialogEntryCutscene = $ff ; ends the dialog and starts a new cutscene MermaidVillageFarmer MermaidVillageGuard PaperJerome01 + PaperJerome07 PaperJerome08 PaperJerome09 PaperJerome10 diff --git a/src/paper.asm b/src/paper.asm index 3ba9dcd3..318a6a7a 100644 --- a/src/paper.asm +++ b/src/paper.asm @@ -193,7 +193,7 @@ Ram_CollectedPapers_u8_arr: .res kPaperGridCols d_byte eFlag::PaperJerome04, 0 ; TODO d_byte eFlag::PaperJerome05, 0 ; TODO d_byte eFlag::PaperJerome06, 0 ; TODO - d_byte eFlag::PaperJerome07, 0 ; TODO + d_byte eFlag::PaperJerome07, eDialog::PaperJerome07 d_byte eFlag::PaperJerome08, eDialog::PaperJerome08 d_byte eFlag::PaperJerome09, eDialog::PaperJerome09 d_byte eFlag::PaperJerome10, eDialog::PaperJerome10 @@ -245,7 +245,7 @@ Ram_CollectedPapers_u8_arr: .res kPaperGridCols d_byte eFlag::PaperJerome04, $ff ; TODO d_byte eFlag::PaperJerome05, $ff ; TODO d_byte eFlag::PaperJerome06, $ff ; TODO - d_byte eFlag::PaperJerome07, $ff ; TODO + d_byte eFlag::PaperJerome07, eArea::Factory ; room: FactoryBridge d_byte eFlag::PaperJerome08, eArea::Crypt ; room: CryptCenter d_byte eFlag::PaperJerome09, eArea::Mine ; room: MineNorth d_byte eFlag::PaperJerome10, eArea::Lava ; room: LavaWest diff --git a/src/rooms/factory_access.asm b/src/rooms/factory_access.asm index 95c05da8..8496e86e 100644 --- a/src/rooms/factory_access.asm +++ b/src/rooms/factory_access.asm @@ -24,6 +24,7 @@ .INCLUDE "../machine.inc" .INCLUDE "../machines/rotor.inc" .INCLUDE "../macros.inc" +.INCLUDE "../oam.inc" .INCLUDE "../platform.inc" .INCLUDE "../program.inc" .INCLUDE "../room.inc" @@ -145,7 +146,18 @@ _Platforms_sPlatform_arr: .assert * - :- <= kMaxPlatforms * .sizeof(sPlatform), error .byte ePlatform::None _Actors_sActor_arr: -: ;; TODO: add some baddies +: D_STRUCT sActor + d_byte Type_eActor, eActor::BadGrub + d_word PosX_i16, $00c0 + d_word PosY_i16, $0108 + d_byte Param_byte, 0 + D_END + D_STRUCT sActor + d_byte Type_eActor, eActor::BadGrub + d_word PosX_i16, $00d8 + d_word PosY_i16, $0138 + d_byte Param_byte, bObj::FlipH + D_END .assert * - :- <= kMaxActors * .sizeof(sActor), error .byte eActor::None _Devices_sDevice_arr: diff --git a/src/rooms/factory_bridge.asm b/src/rooms/factory_bridge.asm index 724ba873..d65e1a0b 100644 --- a/src/rooms/factory_bridge.asm +++ b/src/rooms/factory_bridge.asm @@ -18,16 +18,20 @@ ;;;=========================================================================;;; .INCLUDE "../actor.inc" +.INCLUDE "../actors/bird.inc" +.INCLUDE "../charmap.inc" .INCLUDE "../device.inc" +.INCLUDE "../dialog.inc" +.INCLUDE "../flag.inc" .INCLUDE "../macros.inc" +.INCLUDE "../oam.inc" .INCLUDE "../platform.inc" .INCLUDE "../room.inc" .IMPORT DataA_Room_Factory_sTileset -.IMPORT Data_Empty_sDevice_arr .IMPORT Data_Empty_sPlatform_arr .IMPORT Func_Noop -.IMPORT Ppu_ChrObjFactory +.IMPORT Ppu_ChrObjSewer ;;;=========================================================================;;; @@ -44,7 +48,7 @@ d_addr TerrainData_ptr, _TerrainData d_byte NumMachines_u8, 0 d_addr Machines_sMachine_arr_ptr, 0 - d_byte Chr18Bank_u8, <.bank(Ppu_ChrObjFactory) + d_byte Chr18Bank_u8, <.bank(Ppu_ChrObjSewer) d_addr Ext_sRoomExt_ptr, _Ext_sRoomExt D_END _Ext_sRoomExt: @@ -52,7 +56,7 @@ _Ext_sRoomExt: d_addr Terrain_sTileset_ptr, DataA_Room_Factory_sTileset d_addr Platforms_sPlatform_arr_ptr, Data_Empty_sPlatform_arr d_addr Actors_sActor_arr_ptr, _Actors_sActor_arr - d_addr Devices_sDevice_arr_ptr, Data_Empty_sDevice_arr + d_addr Devices_sDevice_arr_ptr, _Devices_sDevice_arr d_addr Passages_sPassage_arr_ptr, _Passages_sPassage_arr d_addr Enter_func_ptr, Func_Noop d_addr FadeIn_func_ptr, Func_Noop @@ -63,9 +67,41 @@ _TerrainData: : .incbin "out/rooms/factory_bridge.room" .assert * - :- = 18 * 15, error _Actors_sActor_arr: -: ;; TODO: add some baddies +: D_STRUCT sActor + d_byte Type_eActor, eActor::BadGrub + d_word PosX_i16, $0060 + d_word PosY_i16, $0058 + d_byte Param_byte, bObj::FlipH + D_END + D_STRUCT sActor + d_byte Type_eActor, eActor::BadToad + d_word PosX_i16, $00c8 + d_word PosY_i16, $0060 + d_byte Param_byte, 0 + D_END + D_STRUCT sActor + d_byte Type_eActor, eActor::BadBird + d_word PosX_i16, $00e8 + d_word PosY_i16, $0098 + d_byte Param_byte, bBadBird::FlipH | $7f + D_END + D_STRUCT sActor + d_byte Type_eActor, eActor::BadBird + d_word PosX_i16, $0038 + d_word PosY_i16, $00b8 + d_byte Param_byte, 0 | $7f + D_END .assert * - :- <= kMaxActors * .sizeof(sActor), error .byte eActor::None +_Devices_sDevice_arr: +: D_STRUCT sDevice + d_byte Type_eDevice, eDevice::Paper + d_byte BlockRow_u8, 12 + d_byte BlockCol_u8, 12 + d_byte Target_byte, eFlag::PaperJerome07 + D_END + .assert * - :- <= kMaxDevices * .sizeof(sDevice), error + .byte eDevice::None _Passages_sPassage_arr: : D_STRUCT sPassage d_byte Exit_bPassage, ePassage::Western | 0 @@ -83,3 +119,30 @@ _Passages_sPassage_arr: .ENDPROC ;;;=========================================================================;;; + +.SEGMENT "PRGA_Dialog" + +.EXPORT DataA_Dialog_PaperJerome07_sDialog +.PROC DataA_Dialog_PaperJerome07_sDialog + dlg_Text Paper, DataA_Text1_PaperJerome07_Page1_u8_arr + dlg_Text Paper, DataA_Text1_PaperJerome07_Page2_u8_arr + dlg_Done +.ENDPROC + +;;;=========================================================================;;; + +.SEGMENT "PRGA_Text1" + +.PROC DataA_Text1_PaperJerome07_Page1_u8_arr + .byte "Day 7: At least, that$" + .byte "was the idea. Clearly,$" + .byte "it failed.#" +.ENDPROC + +.PROC DataA_Text1_PaperJerome07_Page2_u8_arr + .byte "A cautionary tale, if$" + .byte "only there were anyone$" + .byte "left to caution.#" +.ENDPROC + +;;;=========================================================================;;; diff --git a/src/rooms/temple_pit.asm b/src/rooms/temple_pit.asm index 8195d8bc..66450647 100644 --- a/src/rooms/temple_pit.asm +++ b/src/rooms/temple_pit.asm @@ -108,8 +108,8 @@ _Passages_sPassage_arr: .PROC DataA_Text0_PaperJerome34_Page1_u8_arr .byte "Day 34: Our technology$" - .byte "is amazing, but don't$" - .byte "forget, we're all$" + .byte "is amazing, but lest$" + .byte "we forget, we're all$" .byte "still just mortals.#" .ENDPROC