Remove mappable doors stuff

This commit is contained in:
2026-01-18 07:57:41 -06:00
parent a3bc7dea0e
commit 798ee3fdd0
10 changed files with 63 additions and 736 deletions

View File

@@ -22,8 +22,6 @@ StartDoubleWrite:
; what we wrote over
LDA.l DRMode
BEQ .draw
LDA.l DungeonMapMode
BNE .draw
INC.w $020D ; next subsubmode
PLA : PLA : PLA ; pull our jump to here off the stack

View File

@@ -30,18 +30,15 @@ DrawLoot:
STA.w $021B
LDA.l DRMode
BEQ +
LDA.l DungeonMapMode
BNE +
BRA .skip
+
BNE .skip
REP #$30
PHX : PHY
STZ.b $0E
LDX.w DungeonID
JSL LoadDungeonMapRoomPointer
LDA.l DungeonMapRoomPointers, X
STA.b $72
SEP #$20
@@ -73,65 +70,52 @@ DrawLoot:
DrawSingleFloorLoot:
REP #$20
AND.w #$00FF
INC A
ASL A
%ADD_MapMode()
TAX
LDA.l MapDrawingData_floor_data_offset, X
DEC A
LDA.l DungeonMapFloorToDataOffset, X
CLC : ADC.w #$0018 ; get to end of floor
TAY
%LDX_MapMode()
SEP #$20
LDA.l MapDrawingData_column_count, X
DEC A
LDA.b #$04
STA.b $06
LDA.l MapDrawingData_row_count, X
DEC A
LDA.b #$04
STA.b $07
.next_row
REP #$20
LDA.w GFXStripes
TAX
CLC : ADC.w #$0034
CLC : ADC.w #$0030
STA.w GFXStripes
PHX
%LDX_MapMode()
SEP #$20
LDA.b $07
CPX.w #$0002
BNE +
ASL A
+
CLC : ADC.b $07
REP #$20
AND.w #$00FF
ASL #5
CLC : ADC.l MapDrawingData_bg1_grid_start, X
CLC : ADC.w #$1092
ADC.b $0E
XBA
PLX
STA.w GFXStripes+$02, X
CLC : ADC.w #$2000
STA.w GFXStripes+$1A, X
LDA.w #$1300
STA.w GFXStripes+$04, X
STA.w GFXStripes+$1C, X
LDA.w #$1500
STA.w GFXStripes+$04, X
STA.w GFXStripes+$1E, X
TXA
CLC : ADC.w #$0018
CLC : ADC.w #$0016
TAX
.next_room
REP #$20
LDA.b [$72], Y ; get room id
LDA.b ($72), Y ; get room id
PHY
AND.w #$00FF
@@ -153,49 +137,24 @@ DrawSingleFloorLoot:
LDA.l LootTypeIcons+2, X
STA.w GFXStripes+$02, Y
LDA.l LootTypeIcons+4, X
STA.w GFXStripes+$1A, Y
STA.w GFXStripes+$18, Y
LDA.l LootTypeIcons+6, X
STA.w GFXStripes+$1C, Y
STA.w GFXStripes+$1A, Y
TYX
PLY
DEY : DEX #4
LDA.l DungeonMapMode
BEQ +
LDA.b $06
AND.w #$00FF
BEQ +
; skip a column if in 4x3 mode and it's not the last column
LDA.w #$0300
STA.w GFXStripes+$02, X
STA.w GFXStripes+$1C, X
DEX : DEX
+
SEP #$20
DEC.b $06
BPL .next_room
LDA.l DungeonMapMode
BNE +
; draw an extra empty tile at the end to make up for width differences between modes
LDA.b #$03
STZ.w GFXStripes+$02, X
STA.w GFXStripes+$03, X
STZ.w GFXStripes+$1C, X
STA.w GFXStripes+$1D, X
+
DEC.b $07
BMI .done
LDA.b #$00
XBA
%LDX_MapMode()
LDA.l MapDrawingData_column_count, X
DEC A
LDA.b #$04
STA.b $06
JMP .next_row

View File

@@ -5,18 +5,11 @@ DrawNonexistentRoom:
STA.l $7F0002, X
STA.l $7F0040, X
STA.l $7F0042, X
FinishRoom:
PHX
%LDX_MapMode()
PLA
CLC : ADC.l MapDrawingData_column_spacing, X
TAX
JML $8AE7F6
JML $8AE7F2
NormalDrawDungeonMapRoom:
JSL DrawDungeonMapRoom
JMP FinishRoom
JML $8AE7F2
; $CA has room_id
; $0E has quadrant flags
@@ -66,14 +59,6 @@ DrawDungeonMapRoom:
PLX
LDA.l DungeonMapMode
BEQ +
LDA.b $0A
CMP.w #$0003
BCS +
JSL ClearAdjacentConnections
+
LDA.b $0A : BNE + : LDA.w #$0F00 : BRA ++
+ DEC A : BNE + : LDA.w #$174F : BRA ++
+ DEC A : BNE + : LDA.w #$174F : BRA ++
@@ -150,7 +135,7 @@ DrawEntrances:
LDA.b $06 : PHA
LDX.w DungeonID
JSL LoadDungeonMapRoomPointer
LDA.l DungeonMapRoomPointers, X
STA.b $72
SEP #$20
@@ -181,23 +166,18 @@ DrawSingleFloorEntrances:
ASL A
TAX
%ADD_MapMode()
LDA.l MapDrawingData_floor_data_offset, X
LDA.l DungeonMapFloorToDataOffset, X
TAY
STZ.b $06
%LDX_MapMode()
.next_room
REP #$20
LDA.b [$72], Y ; get room id
LDA.b ($72), Y ; get room id
AND.w #$00FF
CMP.w #$000F ; $0F = empty room
BEQ +
PHX
JSR DrawSingleRoomEntrances
PLX
+
INY
@@ -205,13 +185,13 @@ DrawSingleFloorEntrances:
SEP #$20
INC.b $06
LDA.b $06
CMP.l MapDrawingData_column_count, X
CMP.b #$05
BCC .next_room
STZ.b $06
- INC.b $07
LDA.b $07
CMP.l MapDrawingData_row_count, X
CMP.b #$05
BCC .next_room
.done
@@ -233,8 +213,7 @@ macro DrawSingleEntrance(offset)
?+
CLC : ADC.b $06
ASL #3
CLC : ADC.b #<offset>
CLC : ADC.l MapDrawingData_sprite_offset_x_base, X
CLC : ADC.b #$90+<offset>
STA.w OAMBuffer+0, Y
PHX
@@ -245,13 +224,10 @@ macro DrawSingleEntrance(offset)
?+
CLC : ADC.b $07
ASL #3
PHA
LDA.b $02
%ADD_MapMode()
LDX.b $02
PLA
CLC : ADC.l MapDrawingData_sprite_offset_y_base, X
CLC : ADC.l DungeonMapRoomMarkerYBase, X
PLX
CLC : ADC.b #$08
CLC : ADC.w $0213
@@ -271,8 +247,6 @@ DrawSingleRoomEntrances:
STA.b $0E
PHY
%LDY_MapMode()
SEP #$10
LDX.b #$FE

View File

@@ -1,8 +1,6 @@
CheckSwitchMap:
LDA.l DRMode
BEQ .not_fancy_door_map
LDA.l DungeonMapMode
BNE .not_fancy_door_map
; fancy door map
SEP #$20
@@ -160,10 +158,6 @@ SkipMapSprites:
LDA.l DRMode
BEQ +
LDA.l DungeonMapMode
BEQ .no_vanilla_draw
JML $8AEADE
.no_vanilla_draw
JSL DrawDoorsMapSprites
JML $8AEAFC
+
@@ -265,10 +259,7 @@ DrawDungeonLabel:
TAY
LDA.l DRMode
BEQ .not_doors
LDA.l DungeonMapMode
BEQ .doors
.not_doors
BNE .doors
JMP .skip_doors
.doors
@@ -347,30 +338,25 @@ StartCurrentRoomSearch:
RTL
FindCurrentRoom:
PHX
TYA
%ADD_MapMode()
LDA.l MapDrawingData_floor_data_offset, X
LDA.w DungeonMapFloorToDataOffset, Y
STA.b $0C
LDY.w #$0000
%LDX_MapMode()
SEP #$20
.next_room_check
CPY.b $0C
BCS .not_found
LDA.b [$72], Y
LDA.b ($04), Y
INY
CMP.b $0E
BEQ .found
LDA.b $00
CMP.l MapDrawingData_floor_pixel_column_wrap, X
CMP.b #$40
BCS .next_row
CLC : ADC.l MapDrawingData_supertile_pixel_spacing, X
CLC : ADC.b #$10
STA.b $00
BRA .next_room_check
@@ -378,9 +364,9 @@ FindCurrentRoom:
STZ.b $00
LDA.b $02
CMP.l MapDrawingData_floor_pixel_row_wrap, X
CMP.b #$40
BCS .next_floor
CLC : ADC.l MapDrawingData_supertile_pixel_spacing, X
CLC : ADC.b #$10
STA.b $02
BRA .next_room_check
@@ -389,9 +375,7 @@ FindCurrentRoom:
BRA .next_room_check
.found
PLX
JML $8AE891
.not_found
PLX
JML $8AE8CD

View File

@@ -177,53 +177,10 @@ org $8AE21C
JSL DrawMountain
BRA + : NOP #9 : +
;================================================================================
; Custom Door Rando Maps
;--------------------------------------------------------------------------------
org $8AE590
JSL PrepDrawRow
BRA + : NOP #5 : +
org $8AE5F2
JSR LoadDungeonMapRoomPointer_0A
STA.b $72
org $8AE600
LDA.b [$72], Y
org $8AE634
JSR LoadDungeonMapRoomPointer_0A
STA.b $72
org $8AE63B
LDA.b [$72], Y
org $8AE867
JSR LoadDungeonMapRoomPointer_0A
STA.b $72
org $8AE872
LDA.b [$72], Y
org $8AE8DD
JSR LoadDungeonMapRoomPointer_0A
org $8AE8E4
STA.b $72
org $8AE8F9
LDA.b [$72], Y
org $8AEBC6
JSL GetLocationMarkerLeft
NOP
;================================================================================
; Draw Wacky Door Rando Layouts
;--------------------------------------------------------------------------------
org $8AE3D7
LDA.l DungeonMapMode
BNE .normal
LDA.l DRMode
BEQ .normal

View File

@@ -26,7 +26,6 @@ endmacro
pullpc
incsrc mappable_doors.asm
incsrc current_room_map.asm
incsrc draw_rooms.asm
incsrc map_bg3.asm
@@ -38,3 +37,5 @@ incsrc data/doors_display.asm
incsrc data/spiral_stairs.asm
incsrc data/fall_warps.asm
incsrc data/split_room.asm
incsrc data/doors_connections.asm

View File

@@ -11,8 +11,6 @@ LoadStripes:
RTL
.dungeon_map
LDA.l DungeonMapMode
BNE .4x3
LDA.l DRMode
BNE .6x6
@@ -25,15 +23,6 @@ LoadStripes:
STA.b $02
RTL
.4x3
LDA.b #BG3DungeonMap4x3Stripes>>0
STA.b $00
LDA.b #BG3DungeonMap4x3Stripes>>8
STA.b $01
LDA.b #BG3DungeonMap4x3Stripes>>16
STA.b $02
RTL
.6x6
LDA.b #BG3DungeonMap6x6Stripes>>0
STA.b $00
@@ -57,7 +46,8 @@ LoadLastHUDPalette:
SEP #$20
RTL
macro VanillaCommonMapStripes()
BG3DungeonMap5x5Stripes:
; vanilla stuff
dw $4260, $0100, $2100
dw $4360, $0E40, $2101
dw $4B60, $0100, $6100
@@ -79,11 +69,7 @@ macro VanillaCommonMapStripes()
dw $0D60, $3EC0, $2111
dw $1E60, $3EC0, $2111
dw $1F60, $3EC0, $2111
endmacro
BG3DungeonMap5x5Stripes:
%VanillaCommonMapStripes()
; left edge of map border, from vanilla
dw $4E60, $0100, $2100
dw $4F60, $1A40, $2101
@@ -133,59 +119,6 @@ endmacro
db $FF
BG3DungeonMap4x3Stripes:
%VanillaCommonMapStripes()
; left edge of map border, adjusted from vanilla
dw $4D60, $0100, $2100
dw $4E60, $1C40, $2101
dw $6D60, $2EC0, $2110
dw $6D63, $0100, $A100
dw $6E63, $1C40, $A101
; horizontal borders
dw $B160, $1440, $1D11
dw $1161, $1440, $1D11
dw $7161, $1440, $1D11
dw $D161, $1440, $1D11
dw $3162, $1440, $1D11
dw $9162, $1440, $1D11
dw $F162, $1440, $1D11
dw $5163, $1440, $1D11
; vertical borders
dw $B060, $12C0, $1D11
dw $BC60, $12C0, $1D11
dw $3062, $12C0, $1D11
dw $3C62, $12C0, $1D11
macro TopOfDoorSquares(start)
; silly Big Endian
db <start>>>8, <start>, $00, $15
dw $5D4C, $1D4C, $1D11, $5D4C, $1D4C, $1D11, $5D4C, $1D4C, $1D11, $5D4C, $1D4C
endmacro
macro BottomOfDoorSquares(start)
; silly Big Endian
db <start>>>8, <start>, $00, $15
dw $DD4C, $9D4C, $1D11, $DD4C, $9D4C, $1D11, $DD4C, $9D4C, $1D11, $DD4C, $9D4C
endmacro
macro FullDoorRow(start)
%TopOfDoorSquares(<start>)
%BottomOfDoorSquares(<start>+$20)
endmacro
; top grid
%FullDoorRow($60D1)
%FullDoorRow($6131)
%FullDoorRow($6191)
%FullDoorRow($6251)
%FullDoorRow($62B1)
%FullDoorRow($6311)
db $FF
BG3DungeonMap6x6Stripes:
; vanilla
dw $4260, $0100, $2100

View File

@@ -1,474 +0,0 @@
MapDrawingData:
.floor_data_offset
dw $0000, $0000
dw $0019, $000C
dw $0032, $0018
dw $004B, $0024
dw $0064, $0030
dw $007D, $003C
dw $0096, $0048
dw $00AF, $0054
dw $00C8, $0060
.row_data_offset
dw $0000, $0000
dw $0005, $0004
dw $000A, $0008
dw $000F, $000C
dw $0014, $0010
.corner_tile_address
dw $00E2, $0160
dw $00F8, $0178
dw $03A2, $03A0
dw $03B8, $03B8
.row_tile_address
dw $00E4, $0162
dw $03A4, $03A2
.row_tile_length
dw $0014, $0016
.column_tile_address
dw $0122, $01A0
dw $0138, $01B8
.column_tile_length
dw $0280, $0200
.floor_label_address
dw $035E, $035C
.row_start_address
dw $0124, $01A2
dw $01A4, $0262
dw $0224, $0322
dw $02A4, $03D2
dw $0324, $04A2
.column_count
dw $0005, $0004
.column_spacing
dw $0004, $0006
.row_count
dw $0005, $0003
.bg1_grid_start
dw $1091, $10D1
.sprite_offset_x_base
dw $0090, $0088
.sprite_offset_y_base
dw $001F, $002F
dw $007F, $008F
.entrance_sprite_offset_y_base
dw $0087, $0097
.supertile_pixel_spacing
dw $0010, $0018
.floor_pixel_column_wrap
dw $0040, $0048
.floor_pixel_row_wrap
dw $0040, $0030
CustomMapDrawingData:
.column_wrap
dw $0003
.column_count
dw $0004
.row_wrap
dw $0002
.floor_connection_data_offset
dw $0000
dw $0011
dw $0022
dw $0033
dw $0044
dw $0055
dw $0066
dw $0077
dw $0088
.row_connection_data_offset
dw $0000
dw $0007
dw $000E
dw $0015
macro LDA_MapMode()
LDA.l DungeonMapMode
ASL A
endmacro
macro LDX_MapMode()
%LDA_MapMode()
TAX
endmacro
macro LDY_MapMode()
%LDA_MapMode()
TAY
endmacro
macro ADD_MapMode()
CLC : ADC.l DungeonMapMode
ASL A
TAX
endmacro
macro Map_LDA(addr, label)
pushpc
org <addr>
JSR LDA_<label>
pullpc
if not(defined("LDA_<label>"))
!LDA_<label> = 1
LDA_<label>:
PHX
%LDX_MapMode()
LDA.l MapDrawingData_<label>, X
PLX
RTS
endif
endmacro
macro Map_LDAY(addr, label)
pushpc
org <addr>
JSR LDA_Y_<label>
pullpc
if not(defined("LDA_Y_<label>"))
!LDA_Y_<label> = 1
LDA_Y_<label>:
PHX
TYA
%ADD_MapMode()
LDA.l MapDrawingData_<label>, X
PLX
RTS
endif
endmacro
macro Map_LDAX(addr, label)
pushpc
org <addr>
JSR LDA_X_<label>
pullpc
if not(defined("LDA_X_<label>"))
!LDA_X_<label> = 1
LDA_X_<label>:
PHX
TXA
%ADD_MapMode()
LDA.l MapDrawingData_<label>, X
PLX
RTS
endif
endmacro
macro Map_CMP(addr, label)
pushpc
org <addr>
JSR CMP_<label>
pullpc
if not(defined("CMP_<label>"))
!CMP_<label> = 1
CMP_<label>:
PHX
PHA
%LDX_MapMode()
PLA
CMP.l MapDrawingData_<label>, X
BEQ .z_flag_set
.z_flag_clear
PLX
REP #$02
RTS
.z_flag_set
PLX
SEP #$02
RTS
endif
endmacro
macro Map_ADD(addr, label)
pushpc
org <addr>
JSR ADD_<label>
pullpc
if not(defined("ADD_<label>"))
!ADD_<label> = 1
ADD_<label>:
PHX
PHA
%LDX_MapMode()
PLA
CLC : ADC.l MapDrawingData_<label>, X
PLX
RTS
endif
endmacro
macro Map_ADDY(addr, label)
pushpc
org <addr>
JSR ADD_Y_<label>
pullpc
if not(defined("ADD_Y_<label>"))
!ADD_Y_<label> = 1
ADD_Y_<label>:
PHX
PHA
TYA
%ADD_MapMode()
PLA
CLC : ADC.l MapDrawingData_<label>, X
PLX
RTS
endif
endmacro
pushpc
org $8AE5DA
ADC.b $02 ; swap position of load and add for ease
org $8AE652 ; steal some space from the old map-drawing code we're no longer using
LoadDungeonMapRoomPointer_0A:
JSL LoadDungeonMapRoomPointer
RTS
%Map_LDAY($8AE45F, corner_tile_address)
%Map_LDAY($8AE489, row_tile_address)
%Map_CMP($8AE4B0, row_tile_length)
%Map_LDAY($8AE4C1, column_tile_address)
%Map_CMP($8AE4EA, column_tile_length)
%Map_LDA($8AE54A, floor_label_address)
%Map_LDAX($8AE5D7, row_data_offset)
%Map_LDAY($8AE5F7, floor_data_offset)
%Map_CMP($8AE5A2, row_count)
%Map_CMP($8AE7FA, column_count)
%Map_ADD($8AE896, sprite_offset_x_base)
%Map_ADDY($8AE8B5, sprite_offset_y_base)
%Map_ADD($8AE952, sprite_offset_y_base)
%Map_ADDY($8AEBDB, sprite_offset_y_base)
warnpc $8AE7F6
padbyte $EA
pad $8AE7F6
pullpc
incsrc data/doors_connections.asm
LoadDungeonMapRoomPointer:
LDA.l DungeonMapMode
BEQ .normal
LDA.w #bank(CustomMapPointers)
STA.b $74
LDA.l CustomMapPointers, X
RTL
.normal
LDA.w #bank(DungeonMapRoomPointers)
STA.b $74
LDA.l DungeonMapRoomPointers, X
RTL
PrepDrawRow:
%ADD_MapMode()
LDA.l MapDrawingData_row_start_address, X
CLC : ADC.b $06
AND.w #$0FFF
TAX
LDA.l DungeonMapMode
BEQ .done
JSR DrawRowOfRoomConnections
.done
RTL
ClearAdjacentConnections:
; Left
LDA.b $02
BEQ +
LDA.b $0E
BIT.w #$000A
BNE +
LDA.w #$0F00
STA.l $7F0000-$02, X
STA.l $7F0040-$02, X
+
; Top
LDA.b $00
BEQ +
LDA.b $0E
BIT.w #$000C
BNE +
LDA.w #$0F00
STA.l $7F0000-$40, X
STA.l $7F0002-$40, X
+
; Right
LDA.b $02
CMP.l CustomMapDrawingData_column_wrap
BCS +
LDA.b $0E
BIT.w #$0005
BNE +
LDA.w #$0F00
STA.l $7F0000+$04, X
STA.l $7F0040+$04, X
+
; Bottom
LDA.b $00
CMP.l CustomMapDrawingData_row_wrap
BCS +
LDA.b $0E
BIT.w #$0003
BNE +
LDA.w #$0F00
STA.l $7F0000+$80, X
STA.l $7F0002+$80, X
+
RTL
DrawRowOfRoomConnections:
PHB : PHK : PLB
PHX
LDX.w DungeonID
LDA.l DoorConnectionPointers, X
STA.b $04
LDA.l DungeonMapFloorCountData, X
AND.w #$000F
CLC : ADC.w DungeonMapCurrentFloor
AND.w #$00FF
ASL A
TAX
LDA.l CustomMapDrawingData_floor_connection_data_offset, X
CLC : ADC.b $04
STA.b $04
LDA.b $00
ASL A
TAX
LDA.l CustomMapDrawingData_row_connection_data_offset, X
CLC : ADC.b $04
STA.b $04
STZ.b $02
PLX : PHX
LDY.w #$0000
.next_horizontal
LDA.b ($04), Y
AND.w #$00FF
JSR DrawHorizontalConnector
INY
INX #6
INC.b $02
LDA.b $02
CMP.l CustomMapDrawingData_column_wrap
BCC .next_horizontal
LDA.b $00
CMP.l CustomMapDrawingData_row_wrap
BCS .done
PLX : PHX
STZ.b $02
.next_vertical
LDA.b ($04), Y
AND.w #$00FF
JSR DrawVerticalConnector
INY
INX #6
INC.b $02
LDA.b $02
CMP.l CustomMapDrawingData_column_count
BCC .next_vertical
.done
PLX
PLB
RTS
; A = connector index
; X = address
DrawHorizontalConnector:
PHY
ASL A : ASL A
TAY
LDA.w DoorConnectionTiles+0, Y
BEQ +
ORA.w #$1404
STA.l $7F0004, X
+
LDA.w DoorConnectionTiles+2, Y
BEQ +
ORA.w #$1404
STA.l $7F0044, X
+
PLY
RTS
; A = connector index
; X = address
DrawVerticalConnector:
PHY
ASL A : ASL A
TAY
LDA.w DoorConnectionTiles+0, Y
BEQ +
ORA.w #$1400
STA.l $7F0080, X
+
LDA.w DoorConnectionTiles+2, Y
BEQ +
ORA.w #$1400
STA.l $7F0082, X
+
PLY
RTS
GetLocationMarkerLeft:
LDA.b LinkQuadrantH
BEQ +
LDA.b #$F8
+
CLC : ADC.w $0215
AND.b #$F8
RTL

View File

@@ -200,9 +200,3 @@ ItemSources:
; $B9FF11
AlwaysShowCompass:
db $01
; $B9FF12
; $0000 - vanilla 5x5 maps
; $0001 - special DR 4x3 maps
DungeonMapMode:
dw $0000

View File

@@ -295,6 +295,7 @@ WorldMap_CalculateOAMCoordinates = $8AC3B1
WorldMap_HandleSpriteBlink = $8AC52E
WorldMapIcon_AdjustCoordinate = $8AC59B
WorldMap_DarkWorldTilemap = $8AD739
DungeonMapRoomMarkerYBase = $8AE803
DungeonMapBossRooms = $8AE817
DungeonMapFloorCountData = $8AF5E9
DungeonMapFloorToDataOffset = $8AF605