Skip to content

Commit

Permalink
Add a vertical passage between MineNorth and MineSouth
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsteele committed Oct 29, 2024
1 parent a27251a commit 23b8ee7
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 48 deletions.
2 changes: 1 addition & 1 deletion src/chr.asm
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ _chr_begin:
chr_inc "upgrade_opsync"
chr_res $06
chr_inc "minicore1"
chr_res $06
chr_res $05
chr_inc "minicore2"
chr_inc "paper"
END_CHR_BANK
Expand Down
2 changes: 1 addition & 1 deletion src/minimap.asm
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ _Finish:
.byte $fd
.ENDPROC
.PROC DataA_Pause_MinimapQuestMarkerTiles_u8_arr
.byte $f0, $a9, $ed, '?', '?', $ee, '?', '?'
.byte $f0, $a9, $aa, '?', '?', $ee, '?', '?'
.byte '?', '?', '?', '?', '?', $ef, '?', '?'
.byte '?', '?', '?', '?', '?', $f9, '?', '?'
.byte $f4, '?', '?', '?', '?', '?', $fe, '?'
Expand Down
4 changes: 2 additions & 2 deletions src/minimap.bg
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ ALCFCHBFBGAACKAAAAAABBCEBEAEBJCDBOAAAABMAAAABMAA
CKAABBCFCHBDAKAHAEBECDALCEAECLAECEAFAHAJAHBEAJAG
AMBECDAAAACBAFAIAHCEBFBNAAAACKAAAAAAAAAAAABMAAAA
ALCDBBADAAAABBBFBHAECFCGAAABAOBFBGAAABAFAHBLBHBD
BOABCLAFAGAACBCFCHAFAHBFBIBHANCFCGAAABBEAECFCHCD
CBBEAOADAAAAAAAAAAAAAACCCICGCKAAAAAAAACBAFAHBFBG
BOABCLAFAGAACBCFCHAFAHBFBIBHANCFCGAAABBEAECFCNCD
CBBEAOADAAAAAAAAAAAAAACCCICGCKAAAAAAAACBAFAHBLBG
BBCDAAAAAABBAFAHAEBDAAAAAAAACKAABBAFAGABBEAECFCJ
CAAAAAABBECEAEAFAGCBADAAAAABBLBHCEBEBFBHCDAAAAAP
AAAAAAABCEAFAIAIAIAGAAAAAAAACCCHAECECFCHAFAGAAAA
2 changes: 2 additions & 0 deletions src/program.inc
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@
TempleFoyerCarriage
TempleNaveLowerCarriage
TempleNaveUpperCarriage
;; TODO: Sort these in alphabetically once it won't disrupt playtesting.
MineNorthHoist
NUM_VALUES
.ENDENUM

Expand Down
146 changes: 132 additions & 14 deletions src/rooms/mine_north.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,35 @@
.INCLUDE "../flag.inc"
.INCLUDE "../machine.inc"
.INCLUDE "../machines/conveyor.inc"
.INCLUDE "../machines/hoist.inc"
.INCLUDE "../macros.inc"
.INCLUDE "../platform.inc"
.INCLUDE "../ppu.inc"
.INCLUDE "../program.inc"
.INCLUDE "../room.inc"

.IMPORT DataA_Room_Mine_sTileset
.IMPORT FuncA_Machine_ConveyorWriteReg
.IMPORT FuncA_Machine_Error
.IMPORT FuncA_Machine_HoistMoveTowardGoal
.IMPORT FuncA_Machine_HoistTryMove
.IMPORT FuncA_Machine_ReachedGoal
.IMPORT FuncA_Machine_WriteToLever
.IMPORT FuncA_Objects_DrawConveyorMachine
.IMPORT FuncA_Objects_DrawGirderPlatform
.IMPORT FuncA_Objects_DrawHoistMachine
.IMPORT FuncA_Objects_DrawHoistPulley
.IMPORT FuncA_Objects_DrawHoistRopeToPulley
.IMPORT FuncA_Objects_MoveShapeLeftByA
.IMPORT FuncA_Room_ResetLever
.IMPORT Func_Noop
.IMPORT Func_TryPushAvatarHorz
.IMPORT Ppu_ChrObjMine
.IMPORT Ram_MachineGoalHorz_u8_arr
.IMPORT Ram_MachineGoalVert_u8_arr
.IMPORT Ram_MachineState1_byte_arr
.IMPORT Ram_MachineState2_byte_arr
.IMPORT Ram_PlatformTop_i16_0_arr
.IMPORTZP Zp_AvatarPlatformIndex_u8
.IMPORTZP Zp_AvatarPushDelta_i8
.IMPORTZP Zp_AvatarSubX_u8
Expand All @@ -67,6 +78,29 @@ kConveyorPushMax = $190

;;;=========================================================================;;;

;;; The machine index for the MineNorthHoist machine in this room.
kHoistMachineIndex = 1

;;; The platform indices for the MineNorthHoist machine and its pulley and
;;; girder.
kHoistPlatformIndex = 7
kHoistPulleyPlatformIndex = 8
kHoistGirderPlatformIndex = 9

;;; The initial and maximum permitted values for the hoist's Z-goal.
kHoistInitGoalZ = 6
kHoistMaxGoalZ = 9

;;; The minimum and initial room pixel position for the top edge of the hoist
;;; girder.
.LINECONT +
kHoistGirderMinPlatformTop = $00d8
kHoistGirderInitPlatformTop = \
kHoistGirderMinPlatformTop + kBlockHeightPx * kHoistInitGoalZ
.LINECONT +

;;;=========================================================================;;;

;;; Defines room-specific state data for this particular room.
.STRUCT sState
;; The current states of the room's two levers.
Expand All @@ -88,7 +122,7 @@ kConveyorPushMax = $190
d_byte MinimapStartRow_u8, 9
d_byte MinimapStartCol_u8, 21
d_addr TerrainData_ptr, _TerrainData
d_byte NumMachines_u8, 1
d_byte NumMachines_u8, 2
d_addr Machines_sMachine_arr_ptr, _Machines_sMachine_arr
d_byte Chr18Bank_u8, <.bank(Ppu_ChrObjMine)
d_addr Ext_sRoomExt_ptr, _Ext_sRoomExt
Expand Down Expand Up @@ -126,7 +160,26 @@ _Machines_sMachine_arr:
d_addr TryAct_func_ptr, FuncA_Machine_Error
d_addr Tick_func_ptr, FuncA_Machine_MineNorthConveyor_Tick
d_addr Draw_func_ptr, FuncA_Objects_DrawConveyorMachine
d_addr Reset_func_ptr, FuncA_Room_MineNorthConveyor_Reset
d_addr Reset_func_ptr, FuncC_Mine_NorthConveyor_Reset
D_END
.assert * - :- = kHoistMachineIndex * .sizeof(sMachine), error
D_STRUCT sMachine
d_byte Code_eProgram, eProgram::MineNorthHoist
d_byte Breaker_eFlag, 0
d_byte Flags_bMachine, bMachine::FlipH | bMachine::MoveV
d_byte Status_eDiagram, eDiagram::HoistLeft
d_word ScrollGoalX_u16, $110
d_byte ScrollGoalY_u8, $c0
d_byte RegNames_u8_arr4, 0, 0, 0, "Z"
d_byte MainPlatform_u8, kHoistPlatformIndex
d_addr Init_func_ptr, FuncC_Mine_NorthHoist_InitReset
d_addr ReadReg_func_ptr, FuncC_Mine_NorthHoist_ReadReg
d_addr WriteReg_func_ptr, Func_Noop
d_addr TryMove_func_ptr, FuncA_Machine_MineNorthHoist_TryMove
d_addr TryAct_func_ptr, FuncA_Machine_Error
d_addr Tick_func_ptr, FuncA_Machine_MineNorthHoist_Tick
d_addr Draw_func_ptr, FuncC_Mine_NorthHoist_Draw
d_addr Reset_func_ptr, FuncC_Mine_NorthHoist_InitReset
D_END
.assert * - :- <= kMaxMachines * .sizeof(sMachine), error
_Platforms_sPlatform_arr:
Expand Down Expand Up @@ -181,6 +234,30 @@ _Platforms_sPlatform_arr:
d_word Left_i16, $01b0
d_word Top_i16, $00a8
D_END
.assert * - :- = kHoistPlatformIndex * .sizeof(sPlatform), error
D_STRUCT sPlatform
d_byte Type_ePlatform, ePlatform::Solid
d_word WidthPx_u16, kHoistMachineWidthPx
d_byte HeightPx_u8, kHoistMachineHeightPx
d_word Left_i16, $01e0
d_word Top_i16, $00c0
D_END
.assert * - :- = kHoistPulleyPlatformIndex * .sizeof(sPlatform), error
D_STRUCT sPlatform
d_byte Type_ePlatform, ePlatform::Zone
d_word WidthPx_u16, $08
d_byte HeightPx_u8, $08
d_word Left_i16, $01c8
d_word Top_i16, $00b0
D_END
.assert * - :- = kHoistGirderPlatformIndex * .sizeof(sPlatform), error
D_STRUCT sPlatform
d_byte Type_ePlatform, ePlatform::Solid
d_word WidthPx_u16, $08
d_byte HeightPx_u8, $08
d_word Left_i16, $01c4
d_word Top_i16, kHoistGirderInitPlatformTop
D_END
;; Terrain spikes:
D_STRUCT sPlatform
d_byte Type_ePlatform, ePlatform::Harm
Expand All @@ -189,13 +266,6 @@ _Platforms_sPlatform_arr:
d_word Left_i16, $00d0
d_word Top_i16, $015e
D_END
D_STRUCT sPlatform
d_byte Type_ePlatform, ePlatform::Harm
d_word WidthPx_u16, $20
d_byte HeightPx_u8, $08
d_word Left_i16, $01d0
d_word Top_i16, $0166
D_END
.assert * - :- <= kMaxPlatforms * .sizeof(sPlatform), error
.byte ePlatform::None
_Actors_sActor_arr:
Expand Down Expand Up @@ -235,6 +305,12 @@ _Devices_sDevice_arr:
d_byte Target_byte, kConveyorMachineIndex
D_END
D_STRUCT sDevice
d_byte Type_eDevice, eDevice::ConsoleFloor
d_byte BlockRow_u8, 16
d_byte BlockCol_u8, 31
d_byte Target_byte, kHoistMachineIndex
D_END
D_STRUCT sDevice
d_byte Type_eDevice, eDevice::Paper
d_byte BlockRow_u8, 3
d_byte BlockCol_u8, 18
Expand Down Expand Up @@ -273,6 +349,12 @@ _Passages_sPassage_arr:
d_byte SpawnBlock_u8, 11
d_byte SpawnAdjust_byte, $f1
D_END
D_STRUCT sPassage
d_byte Exit_bPassage, ePassage::Bottom | 1
d_byte Destination_eRoom, eRoom::MineSouth
d_byte SpawnBlock_u8, 27
d_byte SpawnAdjust_byte, $e1
D_END
.assert * - :- <= kMaxPassages * .sizeof(sPassage), error
.ENDPROC

Expand All @@ -292,11 +374,7 @@ _RegL:
rts
.ENDPROC

;;;=========================================================================;;;

.SEGMENT "PRGA_Room"

.PROC FuncA_Room_MineNorthConveyor_Reset
.PROC FuncC_Mine_NorthConveyor_Reset
lda #0
sta Ram_MachineGoalHorz_u8_arr + kConveyorMachineIndex ; conveyor gear
ldx #kLeverUpperDeviceIndex ; param: device index
Expand All @@ -305,6 +383,33 @@ _RegL:
jmp FuncA_Room_ResetLever
.ENDPROC

.PROC FuncC_Mine_NorthHoist_InitReset
lda #kHoistInitGoalZ
sta Ram_MachineGoalVert_u8_arr + kHoistMachineIndex
rts
.ENDPROC

.PROC FuncC_Mine_NorthHoist_ReadReg
lda Ram_PlatformTop_i16_0_arr + kHoistGirderPlatformIndex
sub #<(kHoistGirderMinPlatformTop - kTileHeightPx)
div #kBlockHeightPx
rts
.ENDPROC

.PROC FuncC_Mine_NorthHoist_Draw
ldx #kHoistPulleyPlatformIndex ; param: platform index
ldy Ram_PlatformTop_i16_0_arr + kHoistGirderPlatformIndex ; param: rope
jsr FuncA_Objects_DrawHoistPulley
ldx #kHoistGirderPlatformIndex ; param: platform index
jsr FuncA_Objects_DrawGirderPlatform
lda #3 ; param: offset
jsr FuncA_Objects_MoveShapeLeftByA
ldx #kHoistPulleyPlatformIndex ; param: platform index
jsr FuncA_Objects_DrawHoistRopeToPulley
lda Ram_PlatformTop_i16_0_arr + kHoistGirderPlatformIndex ; param: rope
jmp FuncA_Objects_DrawHoistMachine
.ENDPROC

;;;=========================================================================;;;

.SEGMENT "PRGA_Machine"
Expand Down Expand Up @@ -382,4 +487,17 @@ _MotionOffset_i8_arr10:
.byte <-9, 0, 9
.ENDPROC

.PROC FuncA_Machine_MineNorthHoist_TryMove
lda #kHoistMaxGoalZ ; param: max goal vert
jmp FuncA_Machine_HoistTryMove
.ENDPROC

.PROC FuncA_Machine_MineNorthHoist_Tick
ldx #kHoistGirderPlatformIndex ; param: platform index
ldya #kHoistGirderMinPlatformTop ; param: min platform top
jsr FuncA_Machine_HoistMoveTowardGoal ; returns C
jcs FuncA_Machine_ReachedGoal
rts
.ENDPROC

;;;=========================================================================;;;
22 changes: 11 additions & 11 deletions src/rooms/mine_north.bg
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ EMEMEH AM ACEGEMEM
EMEMED GAGB EAELEOEM
EMEMEHDEDBDFEGEKFAFBFBFHDCDADADADDDCDDFGFHDCDADADADADDFGFBFCELEMEMEM
EMEPEHDCDADDECEFEFEFEFEDDEDBDBDBDBDBDFECEDDEDFDEDBDBDFFDEFEFEFEJEMEM
EMEMEHAO DNDJEAEMEM
EMEMEH AN AP DNEGENEM
EMEMEKEB AN AP ECEJEM
EMEMEHAO BH EAEMEM
EMEMEH AN AP BGFLEGENEM
EMEMEKEB AN GKECEJEM
EMEMEPED AM AO AN EGEM
EMEMEMEH AN AM EGEM
EMEMEIEDDGFGFBFHDCDADADADADDFGFHDADADDDCDADADDFGFBFH AC EGEM
EMEPEHDEDFECEJEHDEDBDBDBDBDFECEDDEDBDBDBDBDBDFECEJEKGFGB EGEM
EFEFED EGEKEB AN AP EGENEMEH GKECEF
AN ECEFED AB EGEMEMEH
AO CACBCN GAGB EAELEMEOEKEB
GGGGGGGB CKGAGGGGGGELEHBMBMBMFMBMBMBMBMBMBMEGEMEMEMEMEH EAEEEE
EMEMEMEKEEEEEEELEMEOEMEMEMFPFPFPFPFPFPFPFPFPFPEOEMEOEMEPEKBNBNELEMEM
EMEMEMEMEOEMEMEMEMEMEMEMEOEMEMEMEMEMEMEOEMEMEMEMEMEMEMEMEMEMEOEMEMEM
EMEMEIEDDGFGFBFHDCDADADADADDFGFHDADADDDCDADADDFGFBFH AC ABEGEM
EMEPEHDEDFECEJEHDEDBDBDBDBDFECEDDEDBDBDBDBDBDFECEJEKGGGB GAELEM
EFEFED EGEKEB AN AP EGEMEMEH ECEFEF
AN ECEFED AB EGEOEIED FM
AO CACBCN GAGB EAELEIED FO
GGGGGGGB CKGAGGGGGGELEHBMBMBMFMBMBMBMBMBMBMEGEMEH AN EAEEEEEEEE
EMEMEMEKEEEEEEELEMEOEMEMEMFPFPFPFPFPFPFPFPFPFPEOEMEH EGENEOEMEM
EMEMEMEMEOEMEMEMEMEMEMEMEOEMEMEMEMEMEMEOEMEMEMEMEMEKEB EAELEMEMEMEM
12 changes: 9 additions & 3 deletions src/rooms/mine_south.asm
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ _Actors_sActor_arr:
D_END
D_STRUCT sActor
d_byte Type_eActor, eActor::BadWasp
d_word PosX_i16, $0070
d_word PosY_i16, $0030
d_byte Param_byte, (bBadWasp::ThetaMask & $c0) | (bBadWasp::DeltaMask & 2)
d_word PosX_i16, $0068
d_word PosY_i16, $0034
d_byte Param_byte, (bBadWasp::ThetaMask & $40) | (bBadWasp::DeltaMask & -2)
D_END
D_STRUCT sActor
d_byte Type_eActor, eActor::BadWasp
Expand Down Expand Up @@ -270,6 +270,12 @@ _Passages_sPassage_arr:
d_byte SpawnAdjust_byte, 0
D_END
D_STRUCT sPassage
d_byte Exit_bPassage, ePassage::Top | 0
d_byte Destination_eRoom, eRoom::MineNorth
d_byte SpawnBlock_u8, 10
d_byte SpawnAdjust_byte, $01
D_END
D_STRUCT sPassage
d_byte Exit_bPassage, ePassage::Bottom | 1
d_byte Destination_eRoom, eRoom::MinePit
d_byte SpawnBlock_u8, 25
Expand Down
14 changes: 7 additions & 7 deletions src/rooms/mine_south.bg
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
>mine_5
>mine_6

EMEMEMEPEMEIEFEFEFEFEFEFEFEFEJEIEFEFEFEFEFEFEFEFEFEFEJEMEPEMEMEPEM
EMEMEIEFEFED CL CK ECEDAFAFAFAFAFAFAFAFAFAFECEFEFEFEJEMEM
EFEFED AP CP CM DNEGEOEM
AM CL CK AM ANECEFEJ
CL CK AN AP BABB EG
EMEMEMEPEMEIEFEFEFED ECEFEFEJEIEFEFEFEFEFEFEFEFEFEFEJEMEPEMEMEPEM
EMEMEIEFEFEDCM CN CM ECEDAFAFAFAFAFAFAFAFAFAFECEFEFEFEJEMEM
EFEFED CKAP GKGNGL DNEGEOEM
AMCG CP CK AM ANECEFEJ
FM CL CK AN AP BABB EG
EEEEEB AN CP CO AM BABB EG
EMEPEH GAGGGB AO BABB EG
EMEMEKEEEB ECEFED CI AN BABB EG
EMEMEPEIED CN AN CGCJ BABB AM EG
EMEMEIED AN EAEB CECF FI EG
EMEMEPEIED CMDPDL AN CGCJ BABB AM EG
EMEMEIED AN EAEBDL CECF FI EG
EMEMEH ECED CGCH GAGGGGGFGB AO EG
EMEMEH CECF EAEEEB ECEFEFEJEH EG
EMEPEH AO CGCH ECEJEKEEEB AP EGEH EG
Expand Down
11 changes: 10 additions & 1 deletion src/tiles/minicore1.ahi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ahi1 f0 p1 i10 w8 h8
ahi1 f0 p1 i11 w8 h8

0008;0;54;ECEEEC;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0

Expand Down Expand Up @@ -91,3 +91,12 @@ ahi1 f0 p1 i10 w8 h8
30300303
33000033
33333333

33333333
33000030
30300300
30033000
30033000
30300300
33000030
33333333
16 changes: 8 additions & 8 deletions src/tiles/minimap3.ahi
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ ahi1 f0 p1 i16 w8 h8
00000000
33300333

33333333
33000030
30300300
30033000
30033000
30300300
33000030
33333333
00000003
00000003
00000003
00000000
00000000
00000003
00000003
33300333

33333333
33000030
Expand Down

0 comments on commit 23b8ee7

Please sign in to comment.