aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--constants/map_data_constants.asm7
-rw-r--r--engine/menus/save.asm2
-rw-r--r--home/overworld.asm21
-rw-r--r--home/predef_text.asm10
-rw-r--r--home/text_script.asm2
-rw-r--r--ram/wram.asm15
-rw-r--r--scripts/OaksLab.asm4
-rw-r--r--scripts/ViridianMart.asm4
8 files changed, 35 insertions, 30 deletions
diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm
index 1877e6a0..b28b3d79 100644
--- a/constants/map_data_constants.asm
+++ b/constants/map_data_constants.asm
@@ -4,6 +4,13 @@ DEF MAP_BORDER EQU 3
; connection directions
const_def
+ const EAST_F
+ const WEST_F
+ const SOUTH_F
+ const NORTH_F
+
+; wCurMapConnections
+ const_def
shift_const EAST ; 1
shift_const WEST ; 2
shift_const SOUTH ; 4
diff --git a/engine/menus/save.asm b/engine/menus/save.asm
index b74b9058..1857d6f5 100644
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -372,7 +372,7 @@ ChangeBox::
call GetBoxSRAMLocation
ld de, wBoxDataStart
call CopyBoxToOrFromSRAM ; copy new box from SRAM to WRAM
- ld hl, wMapTextPtr
+ ld hl, wCurMapTextPtr
ld de, wChangeBoxSavedMapTextPointer
ld a, [hli]
ld [de], a
diff --git a/home/overworld.asm b/home/overworld.asm
index 1ebc794b..defa1728 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -910,9 +910,9 @@ LoadTileBlockMap::
add hl, bc
ld c, MAP_BORDER
add hl, bc ; this puts us past the (west) border
- ld a, [wMapDataPtr] ; tile map pointer
+ ld a, [wCurMapDataPtr] ; tile map pointer
ld e, a
- ld a, [wMapDataPtr + 1]
+ ld a, [wCurMapDataPtr + 1]
ld d, a ; de = tile map pointer
ld a, [wCurMapHeight]
ld b, a
@@ -1966,7 +1966,7 @@ RunMapScript::
call RunNPCMovementScript
ld a, [wCurMap] ; current map number
call SwitchToMapRomBank ; change to the ROM bank the map's data is in
- ld hl, wMapScriptPtr
+ ld hl, wCurMapScriptPtr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2035,9 +2035,8 @@ LoadMapHeader::
ld a, [hli]
ld h, [hl]
ld l, a ; hl = base of map header
-; copy the first 10 bytes (the fixed area) of the map data to D367-D370
- ld de, wCurMapTileset
- ld c, $0a
+ ld de, wCurMapHeader
+ ld c, wCurMapHeaderEnd - wCurMapHeader
.copyFixedHeaderLoop
ld a, [hli]
ld [de], a
@@ -2051,25 +2050,25 @@ LoadMapHeader::
ld [wWestConnectedMap], a
ld [wEastConnectedMap], a
; copy connection data (if any) to WRAM
- ld a, [wMapConnections]
+ ld a, [wCurMapConnections]
ld b, a
.checkNorth
- bit 3, b
+ bit NORTH_F, b
jr z, .checkSouth
ld de, wNorthConnectionHeader
call CopyMapConnectionHeader
.checkSouth
- bit 2, b
+ bit SOUTH_F, b
jr z, .checkWest
ld de, wSouthConnectionHeader
call CopyMapConnectionHeader
.checkWest
- bit 1, b
+ bit WEST_F, b
jr z, .checkEast
ld de, wWestConnectionHeader
call CopyMapConnectionHeader
.checkEast
- bit 0, b
+ bit EAST_F, b
jr z, .getObjectDataPointer
ld de, wEastConnectionHeader
call CopyMapConnectionHeader
diff --git a/home/predef_text.asm b/home/predef_text.asm
index b494a2c8..1537ad5b 100644
--- a/home/predef_text.asm
+++ b/home/predef_text.asm
@@ -7,7 +7,7 @@ PrintPredefTextID::
call DisplayTextID
RestoreMapTextPointer::
- ld hl, wMapTextPtr
+ ld hl, wCurMapTextPtr
ldh a, [hSavedMapTextPtr]
ld [hli], a
ldh a, [hSavedMapTextPtr + 1]
@@ -15,14 +15,14 @@ RestoreMapTextPointer::
ret
SetMapTextPointer::
- ld a, [wMapTextPtr]
+ ld a, [wCurMapTextPtr]
ldh [hSavedMapTextPtr], a
- ld a, [wMapTextPtr + 1]
+ ld a, [wCurMapTextPtr + 1]
ldh [hSavedMapTextPtr + 1], a
ld a, l
- ld [wMapTextPtr], a
+ ld [wCurMapTextPtr], a
ld a, h
- ld [wMapTextPtr + 1], a
+ ld [wCurMapTextPtr + 1], a
ret
INCLUDE "data/text_predef_pointers.asm"
diff --git a/home/text_script.asm b/home/text_script.asm
index 9e1ba275..ceae1a0a 100644
--- a/home/text_script.asm
+++ b/home/text_script.asm
@@ -13,7 +13,7 @@ DisplayTextID::
.skipSwitchToMapBank
ld a, 30 ; half a second
ldh [hFrameCounter], a ; used as joypad poll timer
- ld hl, wMapTextPtr
+ ld hl, wCurMapTextPtr
ld a, [hli]
ld h, [hl]
ld l, a ; hl = map text pointer
diff --git a/ram/wram.asm b/ram/wram.asm
index df286676..753a9678 100644
--- a/ram/wram.asm
+++ b/ram/wram.asm
@@ -1795,17 +1795,16 @@ wLastMap:: db
wUnusedD366:: db
+wCurMapHeader::
wCurMapTileset:: db
-
-; blocks
-wCurMapHeight:: db
+wCurMapHeight:: db
wCurMapWidth:: db
+wCurMapDataPtr:: dw
+wCurMapTextPtr:: dw
+wCurMapScriptPtr:: dw
+wCurMapConnections:: db
+wCurMapHeaderEnd::
-wMapDataPtr:: dw
-wMapTextPtr:: dw
-wMapScriptPtr:: dw
-
-wMapConnections:: db
wNorthConnectionHeader:: map_connection_struct wNorth
wSouthConnectionHeader:: map_connection_struct wSouth
wWestConnectionHeader:: map_connection_struct wWest
diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm
index 407ee3e5..30ee93ed 100644
--- a/scripts/OaksLab.asm
+++ b/scripts/OaksLab.asm
@@ -715,9 +715,9 @@ OaksLabCalcRivalMovementScript:
OaksLabLoadTextPointers2Script:
ld hl, OaksLab_TextPointers2
ld a, l
- ld [wMapTextPtr], a
+ ld [wCurMapTextPtr], a
ld a, h
- ld [wMapTextPtr + 1], a
+ ld [wCurMapTextPtr + 1], a
ret
OaksLab_TextPointers:
diff --git a/scripts/ViridianMart.asm b/scripts/ViridianMart.asm
index 2e78a036..8f91afd6 100644
--- a/scripts/ViridianMart.asm
+++ b/scripts/ViridianMart.asm
@@ -14,9 +14,9 @@ ViridianMartCheckParcelDeliveredScript:
ld hl, ViridianMart_TextPointers2
.done
ld a, l
- ld [wMapTextPtr], a
+ ld [wCurMapTextPtr], a
ld a, h
- ld [wMapTextPtr+1], a
+ ld [wCurMapTextPtr+1], a
ret
ViridianMart_ScriptPointers: