diff --git a/engine/events_2.asm b/engine/events_2.asm index 1849bbbf8..16739d9f3 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -351,24 +351,24 @@ Function97df9:: ; 97df9 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 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 diff --git a/engine/scripting.asm b/engine/scripting.asm index 4461c8fe4..5a3895038 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -1209,28 +1209,29 @@ ApplyPersonFacing: ; 0x9728b 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 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 diff --git a/home/map.asm b/home/map.asm index fa60ac299..a15e32893 100644 --- a/home/map.asm +++ b/home/map.asm @@ -111,7 +111,7 @@ Function217a:: ; 217a 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 @@ Function2198:: ; 2198 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 @@ endr 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 @@ endr .asm_2225 dec b - jp nz, .asm_21a5 + jp nz, .loop ret ; 222a @@ -729,9 +729,9 @@ ChangeMap:: ; 24e4 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 @@ endr 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 @@ endr 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 @@ FillMapConnections:: ; 2524 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 @@ FillMapConnections:: ; 2524 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 @@ FillMapConnections:: ; 2524 ld a, [WestConnectionStripLength] ld b, a ld a, [WestConnectedMapWidth] - ld [hMapObjectIndexBuffer], a + ld [hConnectionStripLength], a call FillWestConnectionStrip .East @@ -866,7 +866,7 @@ FillMapConnections:: ; 2524 ld a, [EastConnectionStripLength] ld b, a ld a, [EastConnectedMapWidth] - ld [hMapObjectIndexBuffer], a + ld [hConnectionStripLength], a call FillEastConnectionStrip .Done @@ -882,7 +882,7 @@ FillSouthConnectionStrip:: ; 25d3 push de push hl - ld a, [hMapObjectIndexBuffer] + ld a, [hConnectionStripLength] ld b, a .x ld a, [hli] @@ -892,7 +892,7 @@ FillSouthConnectionStrip:: ; 25d3 jr nz, .x pop hl - ld a, [hObjectStructIndexBuffer] + ld a, [hConnectedMapWidth] ld e, a ld d, 0 add hl, de @@ -917,7 +917,7 @@ FillEastConnectionStrip:: ; 25f6 .asm_25f6 ld a, [MapWidth] add 6 - ld [hObjectStructIndexBuffer], a + ld [hConnectedMapWidth], a push de @@ -933,13 +933,13 @@ FillEastConnectionStrip:: ; 25f6 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 diff --git a/hram.asm b/hram.asm index 2f53b577d..d0bd382e2 100644 --- a/hram.asm +++ b/hram.asm @@ -35,6 +35,9 @@ hInMenu EQU $ffaa hMapObjectIndexBuffer EQU $ffaf hObjectStructIndexBuffer EQU $ffb0 +hConnectionStripLength EQU $ffaf +hConnectedMapWidth EQU $ffb0 + hPastLeadingZeroes EQU $ffb3 hStringCmpString1 EQU $ffb1 diff --git a/wram.asm b/wram.asm index 0e5ae19f7..0cb0e5ce2 100644 --- a/wram.asm +++ b/wram.asm @@ -1649,9 +1649,9 @@ NorthConnectionStripPointer:: ; d1ab 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 @@ SouthConnectionStripPointer:: ; d1b7 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 @@ wd431:: ds 1 MapStatus:: ; d432 ds 1 MapEventStatus:: ; d433 +; 0: do map events +; 1: do background events ds 1 ScriptFlags:: ; d434