ref: 418878d9329caa45c8f3fa0c5798770d95234f90
parent: d461689704c05c878ef094e34dd7b6fd6fb4b445
author: yenatch <[email protected]>
date: Wed Dec 11 16:42:56 EST 2013
more map attribute getters and some cleanup in home/map.asm
--- a/home/map.asm
+++ b/home/map.asm
@@ -96,6 +96,7 @@
Function217a: ; 217a
ld a, [hROMBank]
push af
+
ld a, [TilesetBlocksBank]
rst Bankswitch
@@ -102,15 +103,15 @@
call Function2198
ld a, $60
ld hl, TileMap
- ld bc, $0168
+ ld bc, TileMapEnd - TileMap
call ByteFill
+
ld a, $13
rst Bankswitch
-
call $515b
+
pop af
rst Bankswitch
-
ret
; 2198
@@ -412,7 +413,7 @@
Function2326: ; 2326
call Function2c3d
- call Function2c1c
+ call SwitchToMapBank
call GetSecondaryMapHeaderPointer
call Function235c
call Function2368
@@ -473,26 +474,26 @@
jr z, .asm_2384
ld de, NorthMapConnection
call GetMapConnection
-
.asm_2384
+
bit 2, b
jr z, .asm_238e
ld de, SouthMapConnection
call GetMapConnection
-
.asm_238e
+
bit 1, b
jr z, .asm_2398
ld de, WestMapConnection
call GetMapConnection
-
.asm_2398
+
bit 0, b
jr z, .asm_23a2
ld de, EastMapConnection
call GetMapConnection
-
.asm_23a2
+
ret
; 23a3
@@ -712,8 +713,8 @@
Function24cd: ; 24cd
ld hl, OverworldMap
- ld bc, $0514
- ld a, $0
+ ld bc, OverworldMapEnd - OverworldMap
+ ld a, 0
call ByteFill
call Function24e4
call FillMapConnections
@@ -727,6 +728,7 @@
Function24e4: ; 24e4
ld a, [hROMBank]
push af
+
ld hl, OverworldMap
ld a, [MapWidth]
ld [hConnectedMapWidth], a
@@ -733,11 +735,11 @@
add $6
ld [hConnectionStripLength], a
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
add hl, bc
add hl, bc
- ld c, $3
+ ld c, 3
add hl, bc
ld a, [MapBlockDataBank]
rst Bankswitch
@@ -764,13 +766,12 @@
ld l, a
jr nc, .asm_251e
inc h
-
.asm_251e
dec b
jr nz, .asm_250c
+
pop af
rst Bankswitch
-
ret
; 2524
@@ -1052,6 +1053,7 @@
Function269a: ; 269a
ld a, [hROMBank]
push af
+
ld a, b
rst Bankswitch
@@ -1065,9 +1067,9 @@
call PrintTextBoxText
xor a
ld [hOAMUpdate], a
+
pop af
rst Bankswitch
-
ret
; 26b7
@@ -2012,7 +2014,7 @@
ld b, a
ld a, [MapNumber]
ld c, a
- call Function2c24
+ call SwitchToAnyMapBank
callba Function8c001
call Function2173
call Function2821
@@ -2102,7 +2104,7 @@
; 0x2c1c
-Function2c1c: ; 2c1c
+SwitchToMapBank: ; 2c1c
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
@@ -2109,14 +2111,14 @@
ld c, a
; 2c24
-Function2c24: ; 2c24
- call Function2c31
+SwitchToAnyMapBank: ; 2c24
+ call GetAnyMapBank
rst Bankswitch
ret
; 2c29
-Function2c29: ; 2c29
+GetMapBank: ; 2c29
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
@@ -2123,7 +2125,7 @@
ld c, a
; 2c31
-Function2c31: ; 2c31
+GetAnyMapBank: ; 2c31
push hl
push de
ld de, $0000
@@ -2220,7 +2222,7 @@
ret
; 2c99
-Function2c99: ; 2c99
+GetAnyMapPermission: ; 2c99
push hl
push de
push bc
@@ -2233,7 +2235,7 @@
ret
; 2ca7
-Function2ca7: ; 2ca7
+GetAnyMapTileset: ; 2ca7
ld de, $0001
call GetAnyMapHeaderMember
ld a, c
--- a/main.asm
+++ b/main.asm
@@ -106615,7 +106615,7 @@
ld b, a
ld a, [$d148]
ld c, a
- call Function2c99
+ call GetAnyMapPermission
call CheckIndoorMap
ret nz
ld a, [$d14a]
@@ -106644,7 +106644,7 @@
ld b, a
ld a, [$d148]
ld c, a
- call Function2c99
+ call GetAnyMapPermission
call CheckIndoorMap
ret nz
ld a, [$d147]
@@ -106651,7 +106651,7 @@
ld b, a
ld a, [$d148]
ld c, a
- call Function2ca7
+ call GetAnyMapTileset
ld a, c
cp $7
jr z, .asm_104743
--- a/wram.asm
+++ b/wram.asm
@@ -377,7 +377,7 @@
TileMap: ; c4a0
; 20x18 grid of 8x8 tiles
ds 360
-
+TileMapEnd:
SECTION "BattleMons",WRAM0[$c608]