pokecrystal/engine/town_map.asm

174 lines
2.1 KiB
NASM
Raw Normal View History

2015-11-16 21:01:45 +00:00
2015-11-17 02:07:26 +00:00
_TownMap: ; 9191c
ld hl, Options
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
ld a, [hInMenu]
push af
ld a, $1
ld [hInMenu], a
ld a, [VramState]
push af
xor a
ld [VramState], a
2015-11-16 21:01:45 +00:00
2015-11-12 04:38:57 +00:00
call ClearBGPalettes
call ClearTileMap
call ClearSprites
2015-11-17 02:07:26 +00:00
call DisableLCD
call Function90c4e
callba ClearSpriteAnims
2015-11-17 02:07:26 +00:00
ld a, 8
call SkipMusic
ld a, $e3
ld [rLCDC], a
call Function90d56
ld [wd002], a
ld [wd003], a
2015-11-12 04:38:57 +00:00
xor a
ld [hBGMapMode], a
2015-11-17 02:07:26 +00:00
call Function91a04
call Function3200
ld a, [wd002]
call Function9106a
ld a, [wd003]
call Function91098
ld a, c
ld [wd004], a
ld a, b
ld [wd005], a
ld b, SCGB_02
2015-11-12 04:38:57 +00:00
call GetSGBLayout
call SetPalettes
2015-11-17 02:07:26 +00:00
ld a, [hCGB]
and a
jr z, .sgb
ld a, $e4
call Functioncf8
2015-11-12 04:38:57 +00:00
call DelayFrame
2015-11-17 02:07:26 +00:00
.sgb
2015-11-12 04:38:57 +00:00
ld a, [wd002]
2015-11-17 02:07:26 +00:00
cp KANTO_LANDMARK
jr nc, .kanto
ld d, KANTO_LANDMARK - 1
ld e, 1
call Function919b0
jr .resume
2015-11-12 04:38:57 +00:00
2015-11-17 02:07:26 +00:00
.kanto
call Function910e8
call Function919b0
.resume
pop af
ld [VramState], a
2015-11-12 04:38:57 +00:00
pop af
ld [hInMenu], a
2015-11-17 02:07:26 +00:00
pop af
ld [Options], a
2015-11-12 04:38:57 +00:00
call ClearBGPalettes
ret
2015-11-17 02:07:26 +00:00
; 919b0
Function919b0: ; 919b0
.loop
call JoyTextDelay
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
ret nz
2015-11-12 04:38:57 +00:00
ld hl, hJoyLast
ld a, [hl]
and D_UP
2015-11-17 02:07:26 +00:00
jr nz, .pressed_up
2015-11-12 04:38:57 +00:00
ld a, [hl]
and D_DOWN
2015-11-17 02:07:26 +00:00
jr nz, .pressed_down
.loop2
push de
callba PlaySpriteAnimations
2015-11-17 02:07:26 +00:00
pop de
call DelayFrame
jr .loop
2015-11-12 04:38:57 +00:00
2015-11-17 02:07:26 +00:00
.pressed_up
ld hl, wd003
2015-11-12 04:38:57 +00:00
ld a, [hl]
cp d
2015-11-17 02:07:26 +00:00
jr c, .okay
2015-11-12 04:38:57 +00:00
ld a, e
dec a
ld [hl], a
2015-11-17 02:07:26 +00:00
.okay
2015-11-12 04:38:57 +00:00
inc [hl]
2015-11-17 02:07:26 +00:00
jr .next
2015-11-12 04:38:57 +00:00
2015-11-17 02:07:26 +00:00
.pressed_down
ld hl, wd003
2015-11-12 04:38:57 +00:00
ld a, [hl]
cp e
2015-11-17 02:07:26 +00:00
jr nz, .okay2
2015-11-12 04:38:57 +00:00
ld a, d
inc a
ld [hl], a
2015-11-17 02:07:26 +00:00
.okay2
2015-11-12 04:38:57 +00:00
dec [hl]
2015-11-17 02:07:26 +00:00
.next
push de
2015-11-12 04:38:57 +00:00
ld a, [wd003]
2015-11-17 02:07:26 +00:00
call Function910b4
2015-11-12 04:38:57 +00:00
ld a, [wd004]
ld c, a
2015-11-17 02:07:26 +00:00
ld a, [wd005]
2015-11-12 04:38:57 +00:00
ld b, a
ld a, [wd003]
2015-11-17 02:07:26 +00:00
call Function910d4
2015-11-12 04:38:57 +00:00
pop de
2015-11-17 02:07:26 +00:00
jr .loop2
; 91a04
2015-11-12 04:38:57 +00:00
2015-11-17 02:07:26 +00:00
Function91a04: ; 91a04
2015-11-12 04:38:57 +00:00
ld a, [wd002]
cp KANTO_LANDMARK
2015-11-17 02:07:26 +00:00
jr nc, .kanto
ld e, $0
jr .okay
2015-11-12 04:38:57 +00:00
.kanto
2015-11-17 02:07:26 +00:00
ld e, $1
2015-11-12 04:38:57 +00:00
2015-11-17 02:07:26 +00:00
.okay
callba PokegearMap
2015-11-17 02:07:26 +00:00
ld a, $7
ld bc, 6
hlcoord 1, 0
2015-11-12 04:38:57 +00:00
call ByteFill
hlcoord 0, 0
2015-11-17 02:07:26 +00:00
ld [hl], $6
hlcoord 7, 0
ld [hl], $17
hlcoord 7, 1
ld [hl], $16
hlcoord 7, 2
ld [hl], $26
ld a, $7
ld bc, NAME_LENGTH
hlcoord 8, 2
call ByteFill
hlcoord 19, 2
ld [hl], $17
ld a, [wd003]
call Function910b4
callba TownMapPals
2015-11-16 21:01:45 +00:00
ret
2015-11-17 02:07:26 +00:00
; 91a53