ref: e0d6e9ca7acf8a23ad70fad405ddf1073dcd4291
parent: d35cfad0de085fab1b0c40c7f0497c9b745cb7b2
author: PikalaxALT <PikalaxALT@gmail.com>
date: Mon Nov 2 07:54:27 EST 2015
Fix NorthMapObjectIndexBuffer etc
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -351,11 +351,11 @@
Function97e08:: ; 97e08
ld hl, wd6de
xor a
-.asm_97e0c
+.loop
ld [hMapObjectIndexBuffer], a
ld a, [hl]
and a
- jr z, .asm_97e19
+ jr z, .skip
push hl
ld b, h
ld c, l
@@ -362,13 +362,13 @@
call Function97e79
pop hl
-.asm_97e19
+.skip
ld de, $0006
add hl, de
ld a, [hMapObjectIndexBuffer]
inc a
cp $4
- jr nz, .asm_97e0c
+ jr nz, .loop
ret
; 97e25
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1209,11 +1209,12 @@
call SetSpriteDirection
ld hl, VramState
bit 6, [hl]
- jr nz, .asm_972b5 ; 0x972b0 $3
- call Function972bc
-.asm_972b5
+ jr nz, .text_state ; 0x972b0 $3
+ call .DisableTextTiles
+.text_state
call UpdateSprites
ret
+
.not_visible
pop de
scf
@@ -1220,17 +1221,17 @@
ret
; 0x972bc
-Function972bc: ; 0x972bc
+.DisableTextTiles: ; 0x972bc
call Function217a
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
-.asm_972c5
+.loop
res 7, [hl]
inc hl
dec bc
ld a, b
or c
- jr nz, .asm_972c5 ; 0x972cb $f8
+ jr nz, .loop ; 0x972cb $f8
ret
; 0x972ce
--- a/home/map.asm
+++ b/home/map.asm
@@ -111,7 +111,7 @@
call Function2198
ld a, $60
hlcoord 0, 0
- ld bc, TileMapEnd - TileMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
ld a, BANK(Function4d15b)
@@ -131,12 +131,12 @@
ld hl, wEnemyMoveStruct
ld b, $5
-.asm_21a5
+.loop
push de
push hl
ld c, $6
-.asm_21a9
+.loop2
push de
push hl
ld a, [de]
@@ -187,7 +187,7 @@
pop de
inc de
dec c
- jp nz, .asm_21a9
+ jp nz, .loop2
pop hl
ld de, $0060
add hl, de
@@ -201,7 +201,7 @@
.asm_2225
dec b
- jp nz, .asm_21a5
+ jp nz, .loop
ret
; 222a
@@ -729,9 +729,9 @@
ld hl, OverworldMap
ld a, [MapWidth]
- ld [hObjectStructIndexBuffer], a
+ ld [hConnectedMapWidth], a
add $6
- ld [hMapObjectIndexBuffer], a
+ ld [hConnectionStripLength], a
ld c, a
ld b, 0
rept 3
@@ -750,7 +750,7 @@
ld b, a
.asm_250c
push hl
- ld a, [hObjectStructIndexBuffer]
+ ld a, [hConnectedMapWidth]
ld c, a
.asm_2510
ld a, [de]
@@ -759,7 +759,7 @@
dec c
jr nz, .asm_2510
pop hl
- ld a, [hMapObjectIndexBuffer]
+ ld a, [hConnectionStripLength]
add l
ld l, a
jr nc, .asm_251e
@@ -794,10 +794,10 @@
ld e, a
ld a, [NorthConnectionStripLocation + 1]
ld d, a
- ld a, [NorthMapObjectIndexBuffer]
- ld [hMapObjectIndexBuffer], a
- ld a, [NorthObjectStructIndexBuffer]
- ld [hObjectStructIndexBuffer], a
+ ld a, [NorthConnectionStripLength]
+ ld [hConnectionStripLength], a
+ ld a, [NorthConnectedMapWidth]
+ ld [hConnectedMapWidth], a
call FillNorthConnectionStrip
.South
@@ -817,10 +817,10 @@
ld e, a
ld a, [SouthConnectionStripLocation + 1]
ld d, a
- ld a, [SouthMapObjectIndexBuffer]
- ld [hMapObjectIndexBuffer], a
- ld a, [SouthObjectStructIndexBuffer]
- ld [hObjectStructIndexBuffer], a
+ ld a, [SouthConnectionStripLength]
+ ld [hConnectionStripLength], a
+ ld a, [SouthConnectedMapWidth]
+ ld [hConnectedMapWidth], a
call FillSouthConnectionStrip
.West
@@ -843,7 +843,7 @@
ld a, [WestConnectionStripLength]
ld b, a
ld a, [WestConnectedMapWidth]
- ld [hMapObjectIndexBuffer], a
+ ld [hConnectionStripLength], a
call FillWestConnectionStrip
.East
@@ -866,7 +866,7 @@
ld a, [EastConnectionStripLength]
ld b, a
ld a, [EastConnectedMapWidth]
- ld [hMapObjectIndexBuffer], a
+ ld [hConnectionStripLength], a
call FillEastConnectionStrip
.Done
@@ -882,7 +882,7 @@
push de
push hl
- ld a, [hMapObjectIndexBuffer]
+ ld a, [hConnectionStripLength]
ld b, a
.x
ld a, [hli]
@@ -892,7 +892,7 @@
jr nz, .x
pop hl
- ld a, [hObjectStructIndexBuffer]
+ ld a, [hConnectedMapWidth]
ld e, a
ld d, 0
add hl, de
@@ -917,7 +917,7 @@
.asm_25f6
ld a, [MapWidth]
add 6
- ld [hObjectStructIndexBuffer], a
+ ld [hConnectedMapWidth], a
push de
@@ -933,13 +933,13 @@
inc de
pop hl
- ld a, [hMapObjectIndexBuffer]
+ ld a, [hConnectionStripLength]
ld e, a
ld d, 0
add hl, de
pop de
- ld a, [hObjectStructIndexBuffer]
+ ld a, [hConnectedMapWidth]
add e
ld e, a
jr nc, .asm_2617
--- a/hram.asm
+++ b/hram.asm
@@ -35,6 +35,9 @@
hMapObjectIndexBuffer EQU $ffaf
hObjectStructIndexBuffer EQU $ffb0
+hConnectionStripLength EQU $ffaf
+hConnectedMapWidth EQU $ffb0
+
hPastLeadingZeroes EQU $ffb3
hStringCmpString1 EQU $ffb1
--- a/wram.asm
+++ b/wram.asm
@@ -1649,9 +1649,9 @@
ds 2
NorthConnectionStripLocation:: ; d1ad
ds 2
-NorthMapObjectIndexBuffer:: ; d1af
+NorthConnectionStripLength:: ; d1af
ds 1
-NorthObjectStructIndexBuffer:: ; d1b0
+NorthConnectedMapWidth:: ; d1b0
ds 1
NorthConnectionStripYOffset:: ; d1b1
ds 1
@@ -1669,9 +1669,9 @@
ds 2
SouthConnectionStripLocation:: ; d1b9
ds 2
-SouthMapObjectIndexBuffer:: ; d1bb
+SouthConnectionStripLength:: ; d1bb
ds 1
-SouthObjectStructIndexBuffer:: ; d1bc
+SouthConnectedMapWidth:: ; d1bc
ds 1
SouthConnectionStripYOffset:: ; d1bd
ds 1
@@ -1927,6 +1927,8 @@
MapStatus:: ; d432
ds 1
MapEventStatus:: ; d433
+; 0: do map events
+; 1: do background events
ds 1
ScriptFlags:: ; d434