2013-09-07 21:14:26 -07:00
|
|
|
; Functions dealing with rendering and interacting with maps.
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function210f:: ; 210f
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, $c7e8
|
|
|
|
ld bc, $0018
|
|
|
|
ld a, $0
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
; 211b
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function211b:: ; 211b
|
2013-09-07 21:14:26 -07:00
|
|
|
push hl
|
|
|
|
ld hl, $dbf7
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
or h
|
|
|
|
ld a, [hl]
|
|
|
|
jr nz, .asm_2128
|
|
|
|
ld a, $ff
|
|
|
|
|
|
|
|
.asm_2128
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 212a
|
|
|
|
|
2014-03-03 19:53:43 -08:00
|
|
|
GetCurrentMapTrigger:: ; 212a
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [MapGroup]
|
|
|
|
ld b, a
|
|
|
|
ld a, [MapNumber]
|
|
|
|
ld c, a
|
|
|
|
xor a
|
|
|
|
ld [$dbf7], a
|
|
|
|
ld [$dbf8], a
|
2014-03-03 19:53:43 -08:00
|
|
|
call GetMapTrigger
|
2013-09-07 21:14:26 -07:00
|
|
|
ret c
|
|
|
|
ld a, e
|
|
|
|
ld [$dbf7], a
|
|
|
|
ld a, d
|
|
|
|
ld [$dbf8], a
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
; 2147
|
|
|
|
|
2014-03-03 19:53:43 -08:00
|
|
|
GetMapTrigger:: ; 2147
|
2013-09-07 21:14:26 -07:00
|
|
|
push bc
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
2014-03-03 19:53:43 -08:00
|
|
|
ld a, BANK(MapTriggers)
|
2013-09-07 21:14:26 -07:00
|
|
|
rst Bankswitch
|
|
|
|
|
2014-03-03 19:53:43 -08:00
|
|
|
ld hl, MapTriggers
|
2013-09-07 21:14:26 -07:00
|
|
|
.asm_2151
|
|
|
|
push hl
|
|
|
|
ld a, [hli]
|
|
|
|
cp $ff
|
|
|
|
jr z, .asm_2167
|
|
|
|
cp b
|
|
|
|
jr nz, .asm_2160
|
|
|
|
ld a, [hli]
|
|
|
|
cp c
|
|
|
|
jr nz, .asm_2160
|
|
|
|
jr .asm_216a
|
|
|
|
|
|
|
|
.asm_2160
|
|
|
|
pop hl
|
|
|
|
ld de, $0004
|
|
|
|
add hl, de
|
|
|
|
jr .asm_2151
|
|
|
|
|
|
|
|
.asm_2167
|
|
|
|
scf
|
|
|
|
jr .asm_216d
|
|
|
|
|
|
|
|
.asm_216a
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
|
|
|
|
.asm_216d
|
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
ld a, b
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 2173
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2173:: ; 2173
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function217a
|
|
|
|
call Functiondb1
|
|
|
|
ret
|
|
|
|
; 217a
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function217a:: ; 217a
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [TilesetBlocksBank]
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
call Function2198
|
|
|
|
ld a, $60
|
|
|
|
ld hl, TileMap
|
2013-12-11 18:42:56 -08:00
|
|
|
ld bc, TileMapEnd - TileMap
|
2013-09-07 21:14:26 -07:00
|
|
|
call ByteFill
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2014-03-03 02:43:25 -08:00
|
|
|
ld a, BANK(Function4d15b)
|
2013-09-07 21:14:26 -07:00
|
|
|
rst Bankswitch
|
2014-03-03 02:43:25 -08:00
|
|
|
call Function4d15b
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 2198
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2198:: ; 2198
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [$d194]
|
|
|
|
ld e, a
|
|
|
|
ld a, [$d195]
|
|
|
|
ld d, a
|
|
|
|
ld hl, EnemyMoveAnimation
|
|
|
|
ld b, $5
|
|
|
|
|
|
|
|
.asm_21a5
|
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
ld c, $6
|
|
|
|
|
|
|
|
.asm_21a9
|
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
ld a, [de]
|
|
|
|
and a
|
|
|
|
jr nz, .asm_21b2
|
|
|
|
ld a, [$d19d]
|
|
|
|
|
|
|
|
.asm_21b2
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
add a
|
|
|
|
ld l, a
|
|
|
|
ld h, $0
|
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
|
|
|
ld a, [TilesetBlocksAddress]
|
|
|
|
add l
|
|
|
|
ld l, a
|
|
|
|
ld a, [TilesetBlocksAddress + 1]
|
|
|
|
adc h
|
|
|
|
ld h, a
|
|
|
|
|
|
|
|
rept 3
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
|
|
|
|
ld a, e
|
|
|
|
add 20
|
|
|
|
ld e, a
|
|
|
|
jr nc, .next\@
|
|
|
|
inc d
|
|
|
|
.next\@
|
|
|
|
endr
|
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
|
|
|
|
pop hl
|
|
|
|
ld de, $0004
|
|
|
|
add hl, de
|
|
|
|
pop de
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jp nz, .asm_21a9
|
|
|
|
pop hl
|
|
|
|
ld de, $0060
|
|
|
|
add hl, de
|
|
|
|
pop de
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapWidth]
|
2013-09-07 21:14:26 -07:00
|
|
|
add $6
|
|
|
|
add e
|
|
|
|
ld e, a
|
|
|
|
jr nc, .asm_2225
|
|
|
|
inc d
|
|
|
|
|
|
|
|
.asm_2225
|
|
|
|
dec b
|
|
|
|
jp nz, .asm_21a5
|
|
|
|
ret
|
|
|
|
; 222a
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function222a:: ; 222a
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, $fa
|
|
|
|
ld [$ff9f], a
|
2014-01-26 19:07:19 -08:00
|
|
|
callba RunMapSetupScript
|
2013-09-07 21:14:26 -07:00
|
|
|
xor a
|
|
|
|
ld [$ff9f], a
|
|
|
|
ret
|
|
|
|
; 2238
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2238:: ; 2238
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function2252
|
|
|
|
ret nc
|
|
|
|
push bc
|
|
|
|
callba Function149af
|
|
|
|
pop bc
|
|
|
|
ret nc
|
|
|
|
call Function22a7
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 224a
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function224a:: ; 224a
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function2252
|
|
|
|
ret nc
|
|
|
|
call Function22a7
|
|
|
|
ret
|
|
|
|
; 2252
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2252:: ; 2252
|
2013-09-07 21:14:26 -07:00
|
|
|
callba Function1499a
|
|
|
|
ret nc
|
|
|
|
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
|
|
|
|
call Function2c52
|
|
|
|
call Function2266
|
|
|
|
|
|
|
|
pop de
|
|
|
|
ld a, d
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 2266
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2266:: ; 2266
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [MapY]
|
|
|
|
sub $4
|
|
|
|
ld e, a
|
|
|
|
ld a, [MapX]
|
|
|
|
sub $4
|
|
|
|
ld d, a
|
|
|
|
ld a, [$dbfb]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld c, a
|
|
|
|
ld hl, $dbfc
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
.asm_227e
|
|
|
|
push hl
|
|
|
|
ld a, [hli]
|
|
|
|
cp e
|
|
|
|
jr nz, .asm_2289
|
|
|
|
ld a, [hli]
|
|
|
|
cp d
|
|
|
|
jr nz, .asm_2289
|
|
|
|
jr .asm_2296
|
|
|
|
|
|
|
|
.asm_2289
|
|
|
|
pop hl
|
|
|
|
ld a, $5
|
|
|
|
add l
|
|
|
|
ld l, a
|
|
|
|
jr nc, .asm_2291
|
|
|
|
inc h
|
|
|
|
|
|
|
|
.asm_2291
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_227e
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_2296
|
|
|
|
pop hl
|
|
|
|
call Function22a3
|
|
|
|
ret nc
|
|
|
|
ld a, [$dbfb]
|
|
|
|
inc a
|
|
|
|
sub c
|
|
|
|
ld c, a
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 22a3
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function22a3:: ; 22a3
|
2013-09-07 21:14:26 -07:00
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 22a7
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function22a7:: ; 22a7
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
|
|
|
|
call Function2c52
|
|
|
|
call Function22b4
|
|
|
|
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 22b4
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function22b4:: ; 22b4
|
2013-09-07 21:14:26 -07:00
|
|
|
push bc
|
|
|
|
ld hl, $dbfc
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld a, c
|
|
|
|
dec a
|
|
|
|
ld bc, $0005
|
|
|
|
call AddNTimes
|
|
|
|
ld bc, $0002
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
cp $ff
|
|
|
|
jr nz, .asm_22d0
|
|
|
|
ld hl, $dcac
|
|
|
|
ld a, [hli]
|
|
|
|
|
|
|
|
.asm_22d0
|
|
|
|
pop bc
|
|
|
|
ld [$d146], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [$d147], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [$d148], a
|
|
|
|
ld a, c
|
|
|
|
ld [$d149], a
|
|
|
|
ld a, [MapGroup]
|
|
|
|
ld [$d14a], a
|
|
|
|
ld a, [MapNumber]
|
|
|
|
ld [$d14b], a
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 22ee
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
CheckOutdoorMap:: ; 22ee
|
2013-09-07 21:14:26 -07:00
|
|
|
cp ROUTE
|
|
|
|
ret z
|
|
|
|
cp TOWN
|
|
|
|
ret
|
|
|
|
; 22f4
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
CheckIndoorMap:: ; 22f4
|
2013-09-07 21:14:26 -07:00
|
|
|
cp INDOOR
|
|
|
|
ret z
|
|
|
|
cp CAVE
|
|
|
|
ret z
|
|
|
|
cp DUNGEON
|
|
|
|
ret z
|
|
|
|
cp GATE
|
|
|
|
ret
|
|
|
|
; 2300
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2300:: ; 2300
|
2013-09-07 21:14:26 -07:00
|
|
|
cp INDOOR
|
|
|
|
ret z
|
|
|
|
cp GATE
|
|
|
|
ret z
|
|
|
|
cp $5
|
|
|
|
ret
|
|
|
|
; 2309
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2309:: ; 2309
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function2326
|
|
|
|
call Function2c52
|
|
|
|
call Function234f
|
|
|
|
xor a
|
|
|
|
call Function2336
|
|
|
|
ret
|
|
|
|
; 2317
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2317:: ; 2317
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function2326
|
|
|
|
call Function2c52
|
|
|
|
call Function234f
|
|
|
|
ld a, $1
|
|
|
|
call Function2336
|
|
|
|
ret
|
|
|
|
; 2326
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2326:: ; 2326
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function2c3d
|
2013-12-11 18:42:56 -08:00
|
|
|
call SwitchToMapBank
|
2013-09-07 21:14:26 -07:00
|
|
|
call GetSecondaryMapHeaderPointer
|
|
|
|
call Function235c
|
|
|
|
call Function2368
|
|
|
|
ret
|
|
|
|
; 2336
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2336:: ; 2336
|
2013-09-07 21:14:26 -07:00
|
|
|
push af
|
2013-10-04 19:03:34 -07:00
|
|
|
ld hl, MapEventHeaderPointer
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
call Function23da
|
|
|
|
call Function23f1
|
|
|
|
call Function2408
|
|
|
|
pop af
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
call Function241f
|
|
|
|
ret
|
|
|
|
; 234f
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function234f:: ; 234f
|
2013-10-04 19:03:34 -07:00
|
|
|
ld hl, MapScriptHeaderPointer
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
call Function23ac
|
|
|
|
call Function23c3
|
|
|
|
ret
|
|
|
|
; 235c
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function235c:: ; 235c
|
2013-09-07 21:14:26 -07:00
|
|
|
ld de, $d19d
|
|
|
|
ld c, $c
|
|
|
|
.asm_2361
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_2361
|
|
|
|
ret
|
|
|
|
; 2368
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2368:: ; 2368
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, $ff
|
|
|
|
ld [NorthConnectedMapGroup], a
|
|
|
|
ld [SouthConnectedMapGroup], a
|
|
|
|
ld [WestConnectedMapGroup], a
|
|
|
|
ld [EastConnectedMapGroup], a
|
|
|
|
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapConnections]
|
2013-09-07 21:14:26 -07:00
|
|
|
ld b, a
|
|
|
|
|
|
|
|
bit 3, b
|
|
|
|
jr z, .asm_2384
|
|
|
|
ld de, NorthMapConnection
|
|
|
|
call GetMapConnection
|
|
|
|
.asm_2384
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
bit 2, b
|
|
|
|
jr z, .asm_238e
|
|
|
|
ld de, SouthMapConnection
|
|
|
|
call GetMapConnection
|
|
|
|
.asm_238e
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
bit 1, b
|
|
|
|
jr z, .asm_2398
|
|
|
|
ld de, WestMapConnection
|
|
|
|
call GetMapConnection
|
|
|
|
.asm_2398
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
bit 0, b
|
|
|
|
jr z, .asm_23a2
|
|
|
|
ld de, EastMapConnection
|
|
|
|
call GetMapConnection
|
|
|
|
.asm_23a2
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
ret
|
|
|
|
; 23a3
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetMapConnection:: ; 23a3
|
2013-09-07 21:14:26 -07:00
|
|
|
; Load map connection struct at hl into de.
|
|
|
|
ld c, SouthMapConnection - NorthMapConnection
|
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
; 23ac
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function23ac:: ; 23ac
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld c, a
|
|
|
|
ld [$dc07], a
|
|
|
|
ld a, l
|
|
|
|
ld [$dc08], a
|
|
|
|
ld a, h
|
|
|
|
ld [$dc09], a
|
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld bc, $0004
|
|
|
|
call AddNTimes
|
|
|
|
ret
|
|
|
|
; 23c3
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function23c3:: ; 23c3
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld c, a
|
|
|
|
ld [$dc0a], a
|
|
|
|
ld a, l
|
|
|
|
ld [$dc0b], a
|
|
|
|
ld a, h
|
|
|
|
ld [$dc0c], a
|
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld bc, $0003
|
|
|
|
call AddNTimes
|
|
|
|
ret
|
|
|
|
; 23da
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function23da:: ; 23da
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld c, a
|
|
|
|
ld [$dbfb], a
|
|
|
|
ld a, l
|
|
|
|
ld [$dbfc], a
|
|
|
|
ld a, h
|
|
|
|
ld [$dbfd], a
|
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld bc, $0005
|
|
|
|
call AddNTimes
|
|
|
|
ret
|
|
|
|
; 23f1
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function23f1:: ; 23f1
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld c, a
|
|
|
|
ld [$dbfe], a
|
|
|
|
ld a, l
|
|
|
|
ld [$dbff], a
|
|
|
|
ld a, h
|
|
|
|
ld [$dc00], a
|
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld bc, $0008
|
|
|
|
call AddNTimes
|
|
|
|
ret
|
|
|
|
; 2408
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2408:: ; 2408
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld c, a
|
|
|
|
ld [$dc01], a
|
|
|
|
ld a, l
|
|
|
|
ld [$dc02], a
|
|
|
|
ld a, h
|
|
|
|
ld [$dc03], a
|
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld bc, $0005
|
|
|
|
call AddNTimes
|
|
|
|
ret
|
|
|
|
; 241f
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function241f:: ; 241f
|
2013-09-07 21:14:26 -07:00
|
|
|
push hl
|
|
|
|
call Function2471
|
|
|
|
pop de
|
|
|
|
ld hl, $d72e
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [$dc04], a
|
|
|
|
ld a, e
|
|
|
|
ld [$dc05], a
|
|
|
|
ld a, d
|
|
|
|
ld [$dc06], a
|
|
|
|
ld a, [$dc04]
|
|
|
|
call Function2457
|
|
|
|
ld a, [$dc04]
|
|
|
|
ld c, a
|
|
|
|
ld a, $10
|
|
|
|
sub c
|
|
|
|
jr z, .asm_2454
|
|
|
|
ld bc, $0001
|
|
|
|
add hl, bc
|
|
|
|
ld bc, $0010
|
|
|
|
.asm_244a
|
|
|
|
ld [hl], $0
|
|
|
|
inc hl
|
|
|
|
ld [hl], $ff
|
|
|
|
dec hl
|
|
|
|
add hl, bc
|
|
|
|
dec a
|
|
|
|
jr nz, .asm_244a
|
|
|
|
|
|
|
|
.asm_2454
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
ret
|
|
|
|
; 2457
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2457:: ; 2457
|
2013-09-07 21:14:26 -07:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld c, a
|
|
|
|
.asm_245a
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
ld a, $ff
|
|
|
|
ld [hli], a
|
|
|
|
ld b, $d
|
|
|
|
.asm_2461
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hli], a
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_2461
|
|
|
|
pop hl
|
|
|
|
ld bc, $0010
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_245a
|
|
|
|
ret
|
|
|
|
; 2471
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2471:: ; 2471
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, $d4fe
|
|
|
|
ld bc, $01e0
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ld hl, $d4fe
|
|
|
|
ld de, $0028
|
|
|
|
ld c, $c
|
|
|
|
xor a
|
|
|
|
.asm_2484
|
|
|
|
ld [hl], a
|
|
|
|
add hl, de
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_2484
|
|
|
|
ret
|
|
|
|
; 248a
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function248a:: ; 248a
|
2013-10-04 19:03:34 -07:00
|
|
|
call GetMapScriptHeaderBank
|
2013-09-07 21:14:26 -07:00
|
|
|
rst Bankswitch
|
|
|
|
|
2013-10-04 19:03:34 -07:00
|
|
|
ld hl, MapEventHeaderPointer
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
ld a, [WarpNumber]
|
|
|
|
dec a
|
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
|
|
|
ld a, $5
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hli]
|
|
|
|
ld [YCoord], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [XCoord], a
|
|
|
|
ld a, [hli]
|
|
|
|
cp $ff
|
|
|
|
jr nz, .asm_24b3
|
|
|
|
call Function24ba
|
|
|
|
|
|
|
|
.asm_24b3
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function10486d
|
2013-09-07 21:14:26 -07:00
|
|
|
ret
|
|
|
|
; 24ba
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function24ba:: ; 24ba
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [$d149]
|
|
|
|
ld [$dcac], a
|
|
|
|
ld a, [$d14a]
|
|
|
|
ld [BackupMapGroup], a
|
|
|
|
ld a, [$d14b]
|
|
|
|
ld [BackupMapNumber], a
|
|
|
|
ret
|
|
|
|
; 24cd
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function24cd:: ; 24cd
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, OverworldMap
|
2013-12-11 18:42:56 -08:00
|
|
|
ld bc, OverworldMapEnd - OverworldMap
|
|
|
|
ld a, 0
|
2013-09-07 21:14:26 -07:00
|
|
|
call ByteFill
|
|
|
|
call Function24e4
|
|
|
|
call FillMapConnections
|
|
|
|
ld a, $1
|
|
|
|
call Function263b
|
|
|
|
ret
|
|
|
|
; 24e4
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function24e4:: ; 24e4
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, OverworldMap
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapWidth]
|
2013-09-07 21:14:26 -07:00
|
|
|
ld [hConnectedMapWidth], a
|
|
|
|
add $6
|
|
|
|
ld [hConnectionStripLength], a
|
|
|
|
ld c, a
|
2013-12-11 18:42:56 -08:00
|
|
|
ld b, 0
|
2013-09-07 21:14:26 -07:00
|
|
|
add hl, bc
|
|
|
|
add hl, bc
|
|
|
|
add hl, bc
|
2013-12-11 18:42:56 -08:00
|
|
|
ld c, 3
|
2013-09-07 21:14:26 -07:00
|
|
|
add hl, bc
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapBlockDataBank]
|
2013-09-07 21:14:26 -07:00
|
|
|
rst Bankswitch
|
|
|
|
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapBlockDataPointer]
|
2013-09-07 21:14:26 -07:00
|
|
|
ld e, a
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapBlockDataPointer+1]
|
2013-09-07 21:14:26 -07:00
|
|
|
ld d, a
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapHeight]
|
2013-09-07 21:14:26 -07:00
|
|
|
ld b, a
|
|
|
|
.asm_250c
|
|
|
|
push hl
|
|
|
|
ld a, [hConnectedMapWidth]
|
|
|
|
ld c, a
|
|
|
|
.asm_2510
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_2510
|
|
|
|
pop hl
|
|
|
|
ld a, [hConnectionStripLength]
|
|
|
|
add l
|
|
|
|
ld l, a
|
|
|
|
jr nc, .asm_251e
|
|
|
|
inc h
|
|
|
|
.asm_251e
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_250c
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 2524
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
FillMapConnections:: ; 2524
|
2013-09-07 21:14:26 -07:00
|
|
|
|
|
|
|
; North
|
|
|
|
ld a, [NorthConnectedMapGroup]
|
|
|
|
cp $ff
|
|
|
|
jr z, .South
|
|
|
|
ld b, a
|
|
|
|
ld a, [NorthConnectedMapNumber]
|
|
|
|
ld c, a
|
|
|
|
call GetAnyMapBlockdataBank
|
|
|
|
|
|
|
|
ld a, [NorthConnectionStripPointer]
|
|
|
|
ld l, a
|
|
|
|
ld a, [NorthConnectionStripPointer + 1]
|
|
|
|
ld h, a
|
|
|
|
ld a, [NorthConnectionStripLocation]
|
|
|
|
ld e, a
|
|
|
|
ld a, [NorthConnectionStripLocation + 1]
|
|
|
|
ld d, a
|
|
|
|
ld a, [NorthConnectionStripLength]
|
|
|
|
ld [hConnectionStripLength], a
|
|
|
|
ld a, [NorthConnectedMapWidth]
|
|
|
|
ld [hConnectedMapWidth], a
|
|
|
|
call FillNorthConnectionStrip
|
|
|
|
|
|
|
|
.South
|
|
|
|
ld a, [SouthConnectedMapGroup]
|
|
|
|
cp $ff
|
|
|
|
jr z, .West
|
|
|
|
ld b, a
|
|
|
|
ld a, [SouthConnectedMapNumber]
|
|
|
|
ld c, a
|
|
|
|
call GetAnyMapBlockdataBank
|
|
|
|
|
|
|
|
ld a, [SouthConnectionStripPointer]
|
|
|
|
ld l, a
|
|
|
|
ld a, [SouthConnectionStripPointer + 1]
|
|
|
|
ld h, a
|
|
|
|
ld a, [SouthConnectionStripLocation]
|
|
|
|
ld e, a
|
|
|
|
ld a, [SouthConnectionStripLocation + 1]
|
|
|
|
ld d, a
|
|
|
|
ld a, [SouthConnectionStripLength]
|
|
|
|
ld [hConnectionStripLength], a
|
|
|
|
ld a, [SouthConnectedMapWidth]
|
|
|
|
ld [hConnectedMapWidth], a
|
|
|
|
call FillSouthConnectionStrip
|
|
|
|
|
|
|
|
.West
|
|
|
|
ld a, [WestConnectedMapGroup]
|
|
|
|
cp $ff
|
|
|
|
jr z, .East
|
|
|
|
ld b, a
|
|
|
|
ld a, [WestConnectedMapNumber]
|
|
|
|
ld c, a
|
|
|
|
call GetAnyMapBlockdataBank
|
|
|
|
|
|
|
|
ld a, [WestConnectionStripPointer]
|
|
|
|
ld l, a
|
|
|
|
ld a, [WestConnectionStripPointer + 1]
|
|
|
|
ld h, a
|
|
|
|
ld a, [WestConnectionStripLocation]
|
|
|
|
ld e, a
|
|
|
|
ld a, [WestConnectionStripLocation + 1]
|
|
|
|
ld d, a
|
|
|
|
ld a, [WestConnectionStripLength]
|
|
|
|
ld b, a
|
|
|
|
ld a, [WestConnectedMapWidth]
|
|
|
|
ld [hConnectionStripLength], a
|
|
|
|
call FillWestConnectionStrip
|
|
|
|
|
|
|
|
.East
|
|
|
|
ld a, [EastConnectedMapGroup]
|
|
|
|
cp $ff
|
|
|
|
jr z, .Done
|
|
|
|
ld b, a
|
|
|
|
ld a, [EastConnectedMapNumber]
|
|
|
|
ld c, a
|
|
|
|
call GetAnyMapBlockdataBank
|
|
|
|
|
|
|
|
ld a, [EastConnectionStripPointer]
|
|
|
|
ld l, a
|
|
|
|
ld a, [EastConnectionStripPointer + 1]
|
|
|
|
ld h, a
|
|
|
|
ld a, [EastConnectionStripLocation]
|
|
|
|
ld e, a
|
|
|
|
ld a, [EastConnectionStripLocation + 1]
|
|
|
|
ld d, a
|
|
|
|
ld a, [EastConnectionStripLength]
|
|
|
|
ld b, a
|
|
|
|
ld a, [EastConnectedMapWidth]
|
|
|
|
ld [hConnectionStripLength], a
|
|
|
|
call FillEastConnectionStrip
|
|
|
|
|
|
|
|
.Done
|
|
|
|
ret
|
|
|
|
; 25d3
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
FillNorthConnectionStrip::
|
|
|
|
FillSouthConnectionStrip:: ; 25d3
|
2013-09-07 21:14:26 -07:00
|
|
|
|
|
|
|
ld c, 3
|
|
|
|
.y
|
|
|
|
push de
|
|
|
|
|
|
|
|
push hl
|
|
|
|
ld a, [hConnectionStripLength]
|
|
|
|
ld b, a
|
|
|
|
.x
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec b
|
|
|
|
jr nz, .x
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
ld a, [hConnectedMapWidth]
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
pop de
|
|
|
|
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapWidth]
|
2013-09-07 21:14:26 -07:00
|
|
|
add 6
|
|
|
|
add e
|
|
|
|
ld e, a
|
|
|
|
jr nc, .asm_25f2
|
|
|
|
inc d
|
|
|
|
.asm_25f2
|
|
|
|
dec c
|
|
|
|
jr nz, .y
|
|
|
|
ret
|
|
|
|
; 25f6
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
FillWestConnectionStrip::
|
|
|
|
FillEastConnectionStrip:: ; 25f6
|
2013-09-07 21:14:26 -07:00
|
|
|
|
|
|
|
.asm_25f6
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapWidth]
|
2013-09-07 21:14:26 -07:00
|
|
|
add 6
|
|
|
|
ld [hConnectedMapWidth], a
|
|
|
|
|
|
|
|
push de
|
|
|
|
|
|
|
|
push hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
ld a, [hConnectionStripLength]
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
pop de
|
|
|
|
|
|
|
|
ld a, [hConnectedMapWidth]
|
|
|
|
add e
|
|
|
|
ld e, a
|
|
|
|
jr nc, .asm_2617
|
|
|
|
inc d
|
|
|
|
.asm_2617
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_25f6
|
|
|
|
ret
|
|
|
|
; 261b
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function261b:: ; 261b
|
2013-09-07 21:14:26 -07:00
|
|
|
ld [$d432], a
|
|
|
|
ret
|
|
|
|
; 261f
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
CallScript:: ; 261f
|
2013-09-07 21:14:26 -07:00
|
|
|
; Call a script at a:hl.
|
|
|
|
|
|
|
|
ld [ScriptBank], a
|
|
|
|
ld a, l
|
|
|
|
ld [ScriptPos], a
|
|
|
|
ld a, h
|
|
|
|
ld [ScriptPos + 1], a
|
|
|
|
|
|
|
|
ld a, $ff
|
|
|
|
ld [ScriptRunning], a
|
|
|
|
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 2631
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2631:: ; 2631
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [ScriptRunning]
|
|
|
|
and a
|
|
|
|
ret nz
|
2013-10-04 19:03:34 -07:00
|
|
|
call GetMapScriptHeaderBank
|
2013-09-07 21:14:26 -07:00
|
|
|
jr CallScript
|
|
|
|
; 263b
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function263b:: ; 263b
|
2013-09-07 21:14:26 -07:00
|
|
|
ld b, a
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
call Function2c52
|
|
|
|
call Function2653
|
|
|
|
jr nc, .done
|
|
|
|
|
2013-10-04 19:03:34 -07:00
|
|
|
call GetMapScriptHeaderBank
|
2013-09-07 21:14:26 -07:00
|
|
|
ld b, a
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
call Function2674
|
|
|
|
|
|
|
|
.done
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 2653
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2653:: ; 2653
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [$dc0a]
|
|
|
|
ld c, a
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld hl, $dc0b
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
or h
|
|
|
|
ret z
|
|
|
|
ld de, $0003
|
|
|
|
.asm_2664
|
|
|
|
ld a, [hl]
|
|
|
|
cp b
|
|
|
|
jr z, .asm_266e
|
|
|
|
add hl, de
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_2664
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_266e
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 2674
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2674:: ; 2674
|
2013-09-07 21:14:26 -07:00
|
|
|
callba Unknown_0x974f3
|
|
|
|
ld a, [ScriptMode]
|
|
|
|
push af
|
|
|
|
ld hl, ScriptFlags
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
set 1, [hl]
|
|
|
|
callba Function96c56
|
|
|
|
callba ScriptEvents
|
|
|
|
pop af
|
|
|
|
ld [ScriptFlags], a
|
|
|
|
pop af
|
|
|
|
ld [ScriptMode], a
|
|
|
|
ret
|
|
|
|
; 269a
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function269a:: ; 269a
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, b
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
push hl
|
|
|
|
call SpeechTextBox
|
|
|
|
call Function2e31
|
|
|
|
ld a, 1
|
|
|
|
ld [hOAMUpdate], a
|
|
|
|
call Function321c
|
|
|
|
pop hl
|
|
|
|
call PrintTextBoxText
|
|
|
|
xor a
|
|
|
|
ld [hOAMUpdate], a
|
2013-12-11 18:42:56 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 26b7
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function26b7:: ; 26b7
|
2013-09-07 21:14:26 -07:00
|
|
|
; Call a:de.
|
|
|
|
|
|
|
|
ld [hBuffer], a
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
ld a, [hBuffer]
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
call .de
|
|
|
|
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
|
|
|
|
.de
|
|
|
|
push de
|
|
|
|
ret
|
|
|
|
; 26c7
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function26c7:: ; 26c7
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
ld a, b
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
ld a, c
|
|
|
|
call Function19e9
|
|
|
|
|
|
|
|
pop hl
|
|
|
|
ld a, h
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 26d4
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetScriptByte:: ; 0x26d4
|
2013-09-07 21:14:26 -07:00
|
|
|
; Return byte at ScriptBank:ScriptPos in a.
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
ld a, [ScriptBank]
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
ld hl, ScriptPos
|
|
|
|
ld c, [hl]
|
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
|
|
|
|
|
|
|
ld a, [bc]
|
|
|
|
|
|
|
|
inc bc
|
|
|
|
ld [hl], b
|
|
|
|
dec hl
|
|
|
|
ld [hl], c
|
|
|
|
|
|
|
|
ld b, a
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
ld a, b
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 0x26ef
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
ObjectEvent:: ; 0x26ef
|
2013-09-07 21:14:26 -07:00
|
|
|
jumptextfaceplayer ObjectEventText
|
|
|
|
; 0x26f2
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
ObjectEventText::
|
2013-09-07 21:14:26 -07:00
|
|
|
TX_FAR _ObjectEventText
|
|
|
|
db "@"
|
|
|
|
; 0x26f7
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
BGEvent:: ; 26f7
|
2013-09-07 21:14:26 -07:00
|
|
|
jumptext BGEventText
|
|
|
|
; 26fa
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
BGEventText:: ; 26fa
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c46fc
|
2013-09-07 21:14:26 -07:00
|
|
|
db "@"
|
|
|
|
; 26ff
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
CoordinatesEvent:: ; 26ff
|
2013-09-07 21:14:26 -07:00
|
|
|
jumptext CoordinatesEventText
|
|
|
|
; 2702
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
CoordinatesEventText:: ; 2702
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c4706
|
2013-09-07 21:14:26 -07:00
|
|
|
db "@"
|
|
|
|
; 2707
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2707:: ; 2707
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hConnectionStripLength]
|
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
|
|
|
ld hl, $d81e
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
ret
|
|
|
|
; 2712
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2712:: ; 2712
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hConnectionStripLength]
|
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
|
|
|
ld hl, $d81e
|
|
|
|
add hl, de
|
|
|
|
ld [hl], $ff
|
|
|
|
ret
|
|
|
|
; 271e
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function271e:: ; 271e
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hConnectionStripLength]
|
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
|
|
|
ld hl, $d81e
|
|
|
|
add hl, de
|
|
|
|
ld [hl], $0
|
|
|
|
ret
|
|
|
|
; 272a
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function272a:: ; 272a
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, TileMap
|
|
|
|
ld de, BGMapBuffer
|
|
|
|
call Function27b7
|
|
|
|
ld c, $28
|
|
|
|
call Functiondbd
|
|
|
|
ld a, [$d152]
|
|
|
|
ld e, a
|
|
|
|
ld a, [$d153]
|
|
|
|
ld d, a
|
|
|
|
call Function27d3
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapUpdate], a
|
|
|
|
ret
|
|
|
|
; 2748
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2748:: ; 2748
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, $c5e0
|
|
|
|
ld de, BGMapBuffer
|
|
|
|
call Function27b7
|
|
|
|
ld c, $28
|
|
|
|
call Functiondbd
|
|
|
|
ld a, [$d152]
|
|
|
|
ld l, a
|
|
|
|
ld a, [$d153]
|
|
|
|
ld h, a
|
|
|
|
ld bc, $0200
|
|
|
|
add hl, bc
|
|
|
|
ld a, h
|
|
|
|
and $3
|
|
|
|
or $98
|
|
|
|
ld e, l
|
|
|
|
ld d, a
|
|
|
|
call Function27d3
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapUpdate], a
|
|
|
|
ret
|
|
|
|
; 2771
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2771:: ; 2771
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, TileMap
|
|
|
|
ld de, BGMapBuffer
|
|
|
|
call Function27c0
|
|
|
|
ld c, $24
|
|
|
|
call Functiondbd
|
|
|
|
ld a, [$d152]
|
|
|
|
ld e, a
|
|
|
|
ld a, [$d153]
|
|
|
|
ld d, a
|
|
|
|
call Function27f8
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapUpdate], a
|
|
|
|
ret
|
|
|
|
; 278f
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function278f:: ; 278f
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, $c4b2
|
|
|
|
ld de, BGMapBuffer
|
|
|
|
call Function27c0
|
|
|
|
ld c, $24
|
|
|
|
call Functiondbd
|
|
|
|
ld a, [$d152]
|
|
|
|
ld e, a
|
|
|
|
and $e0
|
|
|
|
ld b, a
|
|
|
|
ld a, e
|
|
|
|
add $12
|
|
|
|
and $1f
|
|
|
|
or b
|
|
|
|
ld e, a
|
|
|
|
ld a, [$d153]
|
|
|
|
ld d, a
|
|
|
|
call Function27f8
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapUpdate], a
|
|
|
|
ret
|
|
|
|
; 27b7
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function27b7:: ; 27b7
|
2013-09-07 21:14:26 -07:00
|
|
|
ld c, $28
|
|
|
|
.asm_27b9
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_27b9
|
|
|
|
ret
|
|
|
|
; 27c0
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function27c0:: ; 27c0
|
2013-09-07 21:14:26 -07:00
|
|
|
ld c, $12
|
|
|
|
.asm_27c2
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, $13
|
|
|
|
add l
|
|
|
|
ld l, a
|
|
|
|
jr nc, .asm_27cf
|
|
|
|
inc h
|
|
|
|
|
|
|
|
.asm_27cf
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_27c2
|
|
|
|
ret
|
|
|
|
; 27d3
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function27d3:: ; 27d3
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, BGMapBufferPtrs
|
|
|
|
push de
|
|
|
|
call .asm_27df
|
|
|
|
pop de
|
|
|
|
ld a, $20
|
|
|
|
add e
|
|
|
|
ld e, a
|
|
|
|
|
|
|
|
.asm_27df
|
|
|
|
ld c, $a
|
|
|
|
.asm_27e1
|
|
|
|
ld a, e
|
|
|
|
ld [hli], a
|
|
|
|
ld a, d
|
|
|
|
ld [hli], a
|
|
|
|
ld a, e
|
|
|
|
inc a
|
|
|
|
inc a
|
|
|
|
and $1f
|
|
|
|
ld b, a
|
|
|
|
ld a, e
|
|
|
|
and $e0
|
|
|
|
or b
|
|
|
|
ld e, a
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_27e1
|
|
|
|
ld a, $14
|
|
|
|
ld [$ffdc], a
|
|
|
|
ret
|
|
|
|
; 27f8
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function27f8:: ; 27f8
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, BGMapBufferPtrs
|
|
|
|
ld c, $12
|
|
|
|
.asm_27fd
|
|
|
|
ld a, e
|
|
|
|
ld [hli], a
|
|
|
|
ld a, d
|
|
|
|
ld [hli], a
|
|
|
|
ld a, $20
|
|
|
|
add e
|
|
|
|
ld e, a
|
|
|
|
jr nc, .asm_280e
|
|
|
|
inc d
|
|
|
|
ld a, d
|
|
|
|
and $3
|
|
|
|
or $98
|
|
|
|
ld d, a
|
|
|
|
|
|
|
|
.asm_280e
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_27fd
|
|
|
|
ld a, $12
|
|
|
|
ld [$ffdc], a
|
|
|
|
ret
|
|
|
|
; 2816
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2816:: ; 2816
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, BGMapBuffer
|
|
|
|
ld bc, $0078
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
; 2821
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2821:: ; 2821
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, TilesetAddress
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld a, [TilesetBank]
|
|
|
|
ld e, a
|
|
|
|
ld a, [rSVBK]
|
|
|
|
push af
|
|
|
|
ld a, $6
|
|
|
|
ld [rSVBK], a
|
|
|
|
ld a, e
|
|
|
|
ld de, $d000
|
|
|
|
call FarDecompress
|
|
|
|
ld hl, $d000
|
|
|
|
ld de, VTiles2
|
|
|
|
ld bc, $0600
|
|
|
|
call CopyBytes
|
|
|
|
ld a, [rVBK]
|
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [rVBK], a
|
|
|
|
ld hl, $d600
|
|
|
|
ld de, VTiles2
|
|
|
|
ld bc, $0600
|
|
|
|
call CopyBytes
|
|
|
|
pop af
|
|
|
|
ld [rVBK], a
|
|
|
|
pop af
|
|
|
|
ld [rSVBK], a
|
|
|
|
ld a, [$d199]
|
|
|
|
cp $1
|
|
|
|
jr z, .asm_286f
|
|
|
|
cp $2
|
|
|
|
jr z, .asm_286f
|
|
|
|
cp $4
|
|
|
|
jr z, .asm_286f
|
|
|
|
jr .asm_2875
|
|
|
|
|
|
|
|
.asm_286f
|
2013-10-10 23:31:51 -07:00
|
|
|
callba LoadMapGroupRoof
|
2013-09-07 21:14:26 -07:00
|
|
|
|
|
|
|
.asm_2875
|
|
|
|
xor a
|
|
|
|
ld [hTileAnimFrame], a
|
|
|
|
ret
|
|
|
|
; 2879
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2879:: ; 2879
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, $d194
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld de, $dcb9
|
|
|
|
ld c, $5
|
|
|
|
ld b, $6
|
|
|
|
.asm_2886
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
.asm_2888
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_2888
|
|
|
|
pop hl
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapWidth]
|
2013-09-07 21:14:26 -07:00
|
|
|
add $6
|
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_2886
|
|
|
|
ret
|
|
|
|
; 289d
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function289d:: ; 289d
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, $d194
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld de, $dcb9
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapWidth]
|
2013-09-07 21:14:26 -07:00
|
|
|
add $6
|
|
|
|
ld [hConnectionStripLength], a
|
|
|
|
ld a, [$d151]
|
|
|
|
and a
|
|
|
|
jr z, .asm_28cb
|
|
|
|
cp $1
|
|
|
|
jr z, .asm_28c0
|
|
|
|
cp $2
|
|
|
|
jr z, .asm_28d4
|
|
|
|
cp $3
|
|
|
|
jr z, .asm_28da
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_28c0
|
|
|
|
ld de, $dcbf
|
|
|
|
ld a, [hConnectionStripLength]
|
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
|
|
|
add hl, bc
|
|
|
|
jr .asm_28ce
|
|
|
|
|
|
|
|
.asm_28cb
|
|
|
|
ld de, $dcb9
|
|
|
|
|
|
|
|
.asm_28ce
|
|
|
|
ld b, $6
|
|
|
|
ld c, $4
|
2014-01-26 19:07:19 -08:00
|
|
|
jr Function28f7
|
2013-09-07 21:14:26 -07:00
|
|
|
|
|
|
|
.asm_28d4
|
|
|
|
ld de, $dcba
|
|
|
|
inc hl
|
|
|
|
jr .asm_28dd
|
|
|
|
|
|
|
|
.asm_28da
|
|
|
|
ld de, $dcb9
|
|
|
|
|
|
|
|
.asm_28dd
|
|
|
|
ld b, $5
|
|
|
|
ld c, $5
|
2014-01-26 19:07:19 -08:00
|
|
|
jr Function28f7
|
2013-09-07 21:14:26 -07:00
|
|
|
|
2014-01-26 19:07:19 -08:00
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function28e3:: ; 28e3
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, $d194
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapWidth]
|
2013-09-07 21:14:26 -07:00
|
|
|
add $6
|
|
|
|
ld [hConnectionStripLength], a
|
|
|
|
ld de, $dcb9
|
|
|
|
ld b, $6
|
|
|
|
ld c, $5
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function28f7:: ; 28f7
|
2013-09-07 21:14:26 -07:00
|
|
|
.asm_28f7
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
.asm_28fa
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hli], a
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_28fa
|
|
|
|
pop de
|
|
|
|
ld a, e
|
|
|
|
add $6
|
|
|
|
ld e, a
|
|
|
|
jr nc, .asm_2908
|
|
|
|
inc d
|
|
|
|
|
|
|
|
.asm_2908
|
|
|
|
pop hl
|
|
|
|
ld a, [hConnectionStripLength]
|
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_28f7
|
|
|
|
ret
|
|
|
|
; 2914
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2914:: ; 2914
|
2013-09-07 21:14:26 -07:00
|
|
|
xor a
|
|
|
|
ld [TilePermissions], a
|
|
|
|
call Function296c
|
|
|
|
call Function294d
|
|
|
|
ld a, [MapX]
|
|
|
|
ld d, a
|
|
|
|
ld a, [MapY]
|
|
|
|
ld e, a
|
|
|
|
call Function2a3c
|
|
|
|
ld [StandingTile], a
|
|
|
|
call Function29ff
|
|
|
|
ret nz
|
|
|
|
ld a, [StandingTile]
|
|
|
|
and 7
|
|
|
|
ld hl, .data_2945
|
|
|
|
add l
|
|
|
|
ld l, a
|
|
|
|
ld a, 0
|
|
|
|
adc h
|
|
|
|
ld h, a
|
|
|
|
ld a, [hl]
|
|
|
|
ld hl, TilePermissions
|
|
|
|
or [hl]
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 2945
|
|
|
|
|
|
|
|
.data_2945 ; 2945
|
|
|
|
db 1, 2, 4, 8, 9, 10, 5, 6
|
|
|
|
; 294d
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function294d:: ; 294d
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [MapX]
|
|
|
|
ld d, a
|
|
|
|
ld a, [MapY]
|
|
|
|
ld e, a
|
|
|
|
push de
|
|
|
|
inc e
|
|
|
|
call Function2a3c
|
|
|
|
ld [TileDown], a
|
|
|
|
call Function298b
|
|
|
|
pop de
|
|
|
|
dec e
|
|
|
|
call Function2a3c
|
|
|
|
ld [TileUp], a
|
|
|
|
call Function29a8
|
|
|
|
ret
|
|
|
|
; 296c
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function296c:: ; 296c
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [MapX]
|
|
|
|
ld d, a
|
|
|
|
ld a, [MapY]
|
|
|
|
ld e, a
|
|
|
|
push de
|
|
|
|
dec d
|
|
|
|
call Function2a3c
|
|
|
|
ld [TileLeft], a
|
|
|
|
call Function29e2
|
|
|
|
pop de
|
|
|
|
inc d
|
|
|
|
call Function2a3c
|
|
|
|
ld [TileRight], a
|
|
|
|
call Function29c5
|
|
|
|
ret
|
|
|
|
; 298b
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function298b:: ; 298b
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function29ff
|
|
|
|
ret nz
|
|
|
|
ld a, [TileDown]
|
|
|
|
and $7
|
|
|
|
cp $2
|
|
|
|
jr z, .asm_299f
|
|
|
|
cp $6
|
|
|
|
jr z, .asm_299f
|
|
|
|
cp $7
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
.asm_299f
|
|
|
|
ld a, [TilePermissions]
|
|
|
|
or $8
|
|
|
|
ld [TilePermissions], a
|
|
|
|
ret
|
|
|
|
; 29a8
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function29a8:: ; 29a8
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function29ff
|
|
|
|
ret nz
|
|
|
|
ld a, [TileUp]
|
|
|
|
and $7
|
|
|
|
cp $3
|
|
|
|
jr z, .asm_29bc
|
|
|
|
cp $4
|
|
|
|
jr z, .asm_29bc
|
|
|
|
cp $5
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
.asm_29bc
|
|
|
|
ld a, [TilePermissions]
|
|
|
|
or $4
|
|
|
|
ld [TilePermissions], a
|
|
|
|
ret
|
|
|
|
; 29c5
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function29c5:: ; 29c5
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function29ff
|
|
|
|
ret nz
|
|
|
|
ld a, [TileRight]
|
|
|
|
and $7
|
|
|
|
cp $1
|
|
|
|
jr z, .asm_29d9
|
|
|
|
cp $5
|
|
|
|
jr z, .asm_29d9
|
|
|
|
cp $7
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
.asm_29d9
|
|
|
|
ld a, [TilePermissions]
|
|
|
|
or $1
|
|
|
|
ld [TilePermissions], a
|
|
|
|
ret
|
|
|
|
; 29e2
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function29e2:: ; 29e2
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function29ff
|
|
|
|
ret nz
|
|
|
|
ld a, [TileLeft]
|
|
|
|
and $7
|
|
|
|
cp $0
|
|
|
|
jr z, .asm_29f6
|
|
|
|
cp $4
|
|
|
|
jr z, .asm_29f6
|
|
|
|
cp $6
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
.asm_29f6
|
|
|
|
ld a, [TilePermissions]
|
|
|
|
or $2
|
|
|
|
ld [TilePermissions], a
|
|
|
|
ret
|
|
|
|
; 29ff
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function29ff:: ; 29ff
|
2013-09-07 21:14:26 -07:00
|
|
|
and $f0
|
|
|
|
cp $b0
|
|
|
|
ret z
|
|
|
|
cp $c0
|
|
|
|
ret
|
|
|
|
; 2a07
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetFacingTileCoord:: ; 2a07
|
2013-09-07 21:14:26 -07:00
|
|
|
; Return map coordinates in (d, e) and tile id in a
|
|
|
|
; of the tile the player is facing.
|
|
|
|
|
|
|
|
ld a, [PlayerDirection]
|
|
|
|
and %1100
|
|
|
|
srl a
|
|
|
|
srl a
|
|
|
|
ld l, a
|
|
|
|
ld h, 0
|
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
|
|
|
ld de, .Directions
|
|
|
|
add hl, de
|
|
|
|
|
|
|
|
ld d, [hl]
|
|
|
|
inc hl
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
|
|
|
|
ld a, [MapX]
|
|
|
|
add d
|
|
|
|
ld d, a
|
|
|
|
ld a, [MapY]
|
|
|
|
add e
|
|
|
|
ld e, a
|
|
|
|
ld a, [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Directions
|
|
|
|
; x, y
|
|
|
|
db 0, 1
|
|
|
|
dw TileDown
|
|
|
|
db 0, -1
|
|
|
|
dw TileUp
|
|
|
|
db -1, 0
|
|
|
|
dw TileLeft
|
|
|
|
db 1, 0
|
|
|
|
dw TileRight
|
|
|
|
; 2a3c
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2a3c:: ; 2a3c
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function2a66
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .asm_2a63
|
|
|
|
ld l, a
|
|
|
|
ld h, $0
|
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
|
|
|
ld a, [TilesetCollisionAddress]
|
|
|
|
ld c, a
|
|
|
|
ld a, [$d1e1]
|
|
|
|
ld b, a
|
|
|
|
add hl, bc
|
|
|
|
rr d
|
|
|
|
jr nc, .asm_2a56
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
.asm_2a56
|
|
|
|
rr e
|
|
|
|
jr nc, .asm_2a5c
|
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
.asm_2a5c
|
|
|
|
ld a, [TilesetCollisionBank]
|
|
|
|
call GetFarByte
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_2a63
|
|
|
|
ld a, $ff
|
|
|
|
ret
|
|
|
|
; 2a66
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2a66:: ; 2a66
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapWidth]
|
2013-09-07 21:14:26 -07:00
|
|
|
add $6
|
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
|
|
|
ld hl, $c801
|
|
|
|
add hl, bc
|
|
|
|
ld a, e
|
|
|
|
srl a
|
|
|
|
jr z, .asm_2a84
|
|
|
|
and a
|
|
|
|
.asm_2a78
|
|
|
|
srl a
|
|
|
|
jr nc, .asm_2a7d
|
|
|
|
add hl, bc
|
|
|
|
|
|
|
|
.asm_2a7d
|
|
|
|
sla c
|
|
|
|
rl b
|
|
|
|
and a
|
|
|
|
jr nz, .asm_2a78
|
|
|
|
|
|
|
|
.asm_2a84
|
|
|
|
ld c, d
|
|
|
|
srl c
|
|
|
|
ld b, $0
|
|
|
|
add hl, bc
|
|
|
|
ret
|
|
|
|
; 2a8b
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
CheckFacingSign:: ; 2a8b
|
2013-09-07 21:14:26 -07:00
|
|
|
call GetFacingTileCoord
|
|
|
|
ld b, a
|
|
|
|
ld a, d
|
|
|
|
sub 4
|
|
|
|
ld d, a
|
|
|
|
ld a, e
|
|
|
|
sub 4
|
|
|
|
ld e, a
|
|
|
|
ld a, [$dc01]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld c, a
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
call Function2c52
|
|
|
|
call Function2aaa
|
|
|
|
pop hl
|
|
|
|
ld a, h
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 2aaa
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2aaa:: ; 2aaa
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, $dc02
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
.asm_2ab0
|
|
|
|
push hl
|
|
|
|
ld a, [hli]
|
|
|
|
cp e
|
|
|
|
jr nz, .asm_2abb
|
|
|
|
ld a, [hli]
|
|
|
|
cp d
|
|
|
|
jr nz, .asm_2abb
|
|
|
|
jr .asm_2ac8
|
|
|
|
|
|
|
|
.asm_2abb
|
|
|
|
pop hl
|
|
|
|
ld a, 5
|
|
|
|
add l
|
|
|
|
ld l, a
|
|
|
|
jr nc, .asm_2ac3
|
|
|
|
inc h
|
|
|
|
|
|
|
|
.asm_2ac3
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_2ab0
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_2ac8
|
|
|
|
pop hl
|
|
|
|
ld de, EngineBuffer1
|
|
|
|
ld bc, 5
|
|
|
|
call CopyBytes
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 2ad4
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2ad4:: ; 2ad4
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [$dbfe]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld c, a
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
call Function2c52
|
|
|
|
call Function2ae7
|
|
|
|
pop hl
|
|
|
|
ld a, h
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 2ae7
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2ae7:: ; 2ae7
|
2013-09-07 21:14:26 -07:00
|
|
|
ld hl, $dbff
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
call Function211b
|
|
|
|
ld b, a
|
|
|
|
ld a, [MapX]
|
|
|
|
sub $4
|
|
|
|
ld d, a
|
|
|
|
ld a, [MapY]
|
|
|
|
sub $4
|
|
|
|
ld e, a
|
|
|
|
.asm_2afd
|
|
|
|
push hl
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr z, .asm_2b06
|
|
|
|
cp $ff
|
|
|
|
jr nz, .asm_2b10
|
|
|
|
|
|
|
|
.asm_2b06
|
|
|
|
ld a, [hli]
|
|
|
|
cp e
|
|
|
|
jr nz, .asm_2b10
|
|
|
|
ld a, [hli]
|
|
|
|
cp d
|
|
|
|
jr nz, .asm_2b10
|
|
|
|
jr .asm_2b1d
|
|
|
|
|
|
|
|
.asm_2b10
|
|
|
|
pop hl
|
|
|
|
ld a, $8
|
|
|
|
add l
|
|
|
|
ld l, a
|
|
|
|
jr nc, .asm_2b18
|
|
|
|
inc h
|
|
|
|
|
|
|
|
.asm_2b18
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_2afd
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_2b1d
|
|
|
|
pop hl
|
|
|
|
ld de, EngineBuffer1
|
|
|
|
ld bc, $0008
|
|
|
|
call CopyBytes
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 2b29
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
FadeToMenu:: ; 2b29
|
2013-09-07 21:14:26 -07:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call Function1d6e
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function8c084
|
2013-09-07 21:14:26 -07:00
|
|
|
call ClearSprites
|
|
|
|
call Function2ed3
|
|
|
|
ret
|
|
|
|
; 2b3c
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2b3c:: ; 2b3c
|
2013-09-07 21:14:26 -07:00
|
|
|
call WhiteBGMap
|
|
|
|
call Function2bae
|
|
|
|
call Function1ad2
|
|
|
|
call Function1d7d
|
|
|
|
call Functiond90
|
|
|
|
jr Function2b5c
|
|
|
|
; 2b4d
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2b4d:: ; 2b4d
|
2013-09-07 21:14:26 -07:00
|
|
|
call WhiteBGMap
|
|
|
|
call Function1d7d
|
|
|
|
call Function2bae
|
|
|
|
call Function1ad2
|
|
|
|
call Functiond90
|
|
|
|
; 2b5c
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2b5c:: ; 2b5c
|
2013-09-07 21:14:26 -07:00
|
|
|
ld b, $9
|
|
|
|
call GetSGBLayout
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function49409
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function3200
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function8c079
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function2ee4
|
|
|
|
ret
|
|
|
|
; 2b74
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2b74:: ; 0x2b74
|
2013-09-07 21:14:26 -07:00
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [$c2ce], a
|
|
|
|
call WhiteBGMap
|
|
|
|
call ClearSprites
|
|
|
|
call Function2bae
|
|
|
|
ld hl, $c590 ; tile 0, 12
|
|
|
|
ld bc, $0412
|
|
|
|
call TextBox
|
|
|
|
ld hl, VramState
|
|
|
|
set 0, [hl]
|
|
|
|
call Function1ad2
|
|
|
|
call Function3200
|
|
|
|
ld b, $9
|
|
|
|
call GetSGBLayout
|
|
|
|
callba Function49409
|
|
|
|
call UpdateTimePals
|
|
|
|
call DelayFrame
|
|
|
|
ld a, $1
|
|
|
|
ld [$ffde], a
|
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
; 0x2bae
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2bae:: ; 2bae
|
2013-09-07 21:14:26 -07:00
|
|
|
call DisableLCD
|
|
|
|
call ClearSprites
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function14168
|
2013-09-07 21:14:26 -07:00
|
|
|
call Functione51
|
|
|
|
call Functione5f
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
ld a, [MapGroup]
|
|
|
|
ld b, a
|
|
|
|
ld a, [MapNumber]
|
|
|
|
ld c, a
|
2013-12-11 18:42:56 -08:00
|
|
|
call SwitchToAnyMapBank
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function8c001
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function2173
|
|
|
|
call Function2821
|
|
|
|
ld a, $9
|
|
|
|
call Function3cb4
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
call EnableLCD
|
|
|
|
ret
|
|
|
|
; 2be5
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetMapHeaderPointer:: ; 2be5
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [MapGroup]
|
|
|
|
ld b, a
|
|
|
|
ld a, [MapNumber]
|
|
|
|
ld c, a
|
|
|
|
; 2bed
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetAnyMapHeaderPointer:: ; 0x2bed
|
2013-09-07 21:14:26 -07:00
|
|
|
; Prior to calling this function, you must have switched banks so that
|
|
|
|
; MapGroupPointers is visible.
|
|
|
|
|
|
|
|
; inputs:
|
|
|
|
; b = map group, c = map number
|
|
|
|
; XXX de = ???
|
|
|
|
|
|
|
|
; outputs:
|
|
|
|
; hl points to the map header
|
|
|
|
push bc ; save map number for later
|
|
|
|
|
|
|
|
; get pointer to map group
|
|
|
|
dec b
|
|
|
|
ld c, b
|
|
|
|
ld b, $0
|
|
|
|
ld hl, MapGroupPointers
|
|
|
|
add hl, bc
|
|
|
|
add hl, bc
|
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
pop bc ; restore map number
|
|
|
|
|
|
|
|
; find the cth map header
|
|
|
|
dec c
|
|
|
|
ld b, $0
|
|
|
|
ld a, OlivineGym_MapHeader - OlivinePokeCenter1F_MapHeader
|
|
|
|
call AddNTimes
|
|
|
|
ret
|
|
|
|
; 0x2c04
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetMapHeaderMember:: ; 0x2c04
|
2013-09-07 21:14:26 -07:00
|
|
|
; Extract data from the current map's header.
|
|
|
|
|
|
|
|
; inputs:
|
|
|
|
; de = offset of desired data within the mapheader
|
|
|
|
|
|
|
|
; outputs:
|
|
|
|
; bc = data from the current map's header
|
|
|
|
; (e.g., de = $0003 would return a pointer to the secondary map header)
|
|
|
|
|
|
|
|
ld a, [MapGroup]
|
|
|
|
ld b, a
|
|
|
|
ld a, [MapNumber]
|
|
|
|
ld c, a
|
|
|
|
; fallthrough
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetAnyMapHeaderMember:: ; 0x2c0c
|
2013-09-07 21:14:26 -07:00
|
|
|
; bankswitch
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
ld a, BANK(MapGroupPointers)
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
call GetAnyMapHeaderPointer
|
|
|
|
add hl, de
|
|
|
|
ld c, [hl]
|
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
|
|
|
|
|
|
|
; bankswitch back
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 0x2c1c
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
SwitchToMapBank:: ; 2c1c
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [MapGroup]
|
|
|
|
ld b, a
|
|
|
|
ld a, [MapNumber]
|
|
|
|
ld c, a
|
|
|
|
; 2c24
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
SwitchToAnyMapBank:: ; 2c24
|
2013-12-11 18:42:56 -08:00
|
|
|
call GetAnyMapBank
|
2013-09-07 21:14:26 -07:00
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 2c29
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetMapBank:: ; 2c29
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [MapGroup]
|
|
|
|
ld b, a
|
|
|
|
ld a, [MapNumber]
|
|
|
|
ld c, a
|
|
|
|
; 2c31
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetAnyMapBank:: ; 2c31
|
2013-09-07 21:14:26 -07:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
ld de, $0000
|
|
|
|
call GetAnyMapHeaderMember
|
|
|
|
ld a, c
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 2c3d
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2c3d:: ; 2c3d
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
ld a, $25
|
|
|
|
rst Bankswitch
|
|
|
|
call GetMapHeaderPointer
|
|
|
|
ld de, $d198
|
|
|
|
ld bc, $0005
|
|
|
|
call CopyBytes
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 2c52
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2c52:: ; 2c52
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapScriptHeaderBank]
|
2013-09-07 21:14:26 -07:00
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
; 2c57
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetMapScriptHeaderBank:: ; 2c57
|
2013-10-04 19:03:34 -07:00
|
|
|
ld a, [MapScriptHeaderBank]
|
2013-09-07 21:14:26 -07:00
|
|
|
ret
|
|
|
|
; 2c5b
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetAnyMapBlockdataBank:: ; 2c5b
|
2013-09-07 21:14:26 -07:00
|
|
|
; Return the blockdata bank for group b map c.
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
|
|
|
|
push bc
|
|
|
|
ld de, 3 ; second map header pointer
|
|
|
|
call GetAnyMapHeaderMember
|
|
|
|
ld l, c
|
|
|
|
ld h, b
|
|
|
|
pop bc
|
|
|
|
|
|
|
|
push hl
|
|
|
|
ld de, 0 ; second map header bank
|
|
|
|
call GetAnyMapHeaderMember
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
ld de, 3 ; blockdata bank
|
|
|
|
add hl, de
|
|
|
|
ld a, c
|
|
|
|
call GetFarByte
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 2c7d
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetSecondaryMapHeaderPointer:: ; 0x2c7d
|
2013-09-07 21:14:26 -07:00
|
|
|
; returns the current map's secondary map header pointer in hl.
|
|
|
|
push bc
|
|
|
|
push de
|
|
|
|
ld de, $0003 ; secondary map header pointer (offset within header)
|
|
|
|
call GetMapHeaderMember
|
|
|
|
ld l, c
|
|
|
|
ld h, b
|
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 2c8a
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetMapPermission:: ; 2c8a
|
2013-09-07 21:14:26 -07:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
ld de, 2
|
|
|
|
call GetMapHeaderMember
|
|
|
|
ld a, c
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 2c98
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2c98:: ; 2c98
|
2013-09-07 21:14:26 -07:00
|
|
|
ret
|
|
|
|
; 2c99
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetAnyMapPermission:: ; 2c99
|
2013-09-07 21:14:26 -07:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
ld de, $0002
|
|
|
|
call GetAnyMapHeaderMember
|
|
|
|
ld a, c
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 2ca7
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetAnyMapTileset:: ; 2ca7
|
2013-09-07 21:14:26 -07:00
|
|
|
ld de, $0001
|
|
|
|
call GetAnyMapHeaderMember
|
|
|
|
ld a, c
|
|
|
|
ret
|
|
|
|
; 2caf
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetWorldMapLocation:: ; 0x2caf
|
2013-09-07 21:14:26 -07:00
|
|
|
; given a map group/id in bc, return its location on the Pokégear map.
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
ld de, 5
|
|
|
|
call GetAnyMapHeaderMember
|
|
|
|
ld a, c
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 0x2cbd
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2cbd:: ; 2cbd
|
2013-09-07 21:14:26 -07:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld de, $0006
|
|
|
|
call GetMapHeaderMember
|
|
|
|
ld a, c
|
|
|
|
cp $64
|
|
|
|
jr z, .asm_2cee
|
|
|
|
bit 7, c
|
|
|
|
jr nz, .asm_2cda
|
2013-10-01 17:47:54 -07:00
|
|
|
callba Function8b342
|
2013-09-07 21:14:26 -07:00
|
|
|
ld e, c
|
|
|
|
ld d, $0
|
|
|
|
.asm_2cd7
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_2cda
|
|
|
|
ld a, [StatusFlags2]
|
|
|
|
bit 0, a
|
|
|
|
jr z, .asm_2ce6
|
|
|
|
ld de, $0056
|
|
|
|
jr .asm_2cd7
|
|
|
|
|
|
|
|
.asm_2ce6
|
|
|
|
ld a, c
|
|
|
|
and $7f
|
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
|
|
|
jr .asm_2cd7
|
|
|
|
|
|
|
|
.asm_2cee
|
|
|
|
ld a, [StatusFlags2]
|
|
|
|
bit 7, a
|
|
|
|
jr z, .asm_2cfa
|
|
|
|
ld de, $0048
|
|
|
|
jr .asm_2cd7
|
|
|
|
|
|
|
|
.asm_2cfa
|
|
|
|
ld de, $0026
|
|
|
|
jr .asm_2cd7
|
|
|
|
; 2cff
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2cff:: ; 2cff
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function2d0d
|
|
|
|
and $f
|
|
|
|
ret
|
|
|
|
; 2d05
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2d05:: ; 2d05
|
2013-09-07 21:14:26 -07:00
|
|
|
call Function2d0d
|
|
|
|
and $f0
|
|
|
|
swap a
|
|
|
|
ret
|
|
|
|
; 2d0d
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2d0d:: ; 2d0d
|
2013-09-07 21:14:26 -07:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld de, $0007
|
|
|
|
call GetMapHeaderMember
|
|
|
|
ld a, c
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 2d19
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function2d19:: ; 2d19
|
2013-09-07 21:14:26 -07:00
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld de, $0008
|
|
|
|
call GetMapHeaderMember
|
|
|
|
ld a, c
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
; 2d27
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
LoadTilesetHeader:: ; 2d27
|
2013-09-07 21:14:26 -07:00
|
|
|
push hl
|
|
|
|
push bc
|
2013-12-11 14:23:33 -08:00
|
|
|
|
|
|
|
ld hl, Tilesets
|
|
|
|
ld bc, Tileset01 - Tileset00
|
2013-09-07 21:14:26 -07:00
|
|
|
ld a, [$d199]
|
|
|
|
call AddNTimes
|
2013-12-11 14:23:33 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
ld de, TilesetBank
|
2013-12-11 14:23:33 -08:00
|
|
|
ld bc, Tileset01 - Tileset00
|
|
|
|
|
|
|
|
ld a, BANK(Tilesets)
|
2013-09-07 21:14:26 -07:00
|
|
|
call FarCopyBytes
|
2013-12-11 14:23:33 -08:00
|
|
|
|
2013-09-07 21:14:26 -07:00
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 2d43
|
|
|
|
|