pokecrystal-board/engine/town_map.asm

172 lines
2.1 KiB
NASM
Raw Normal View History

2015-11-16 13:01:45 -08:00
2015-11-16 18:07:26 -08: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 13:01:45 -08:00
2015-11-11 20:38:57 -08:00
call ClearBGPalettes
call ClearTileMap
call ClearSprites
2015-11-16 18:07:26 -08:00
call DisableLCD
call Function90c4e
callba ClearSpriteAnims
2015-11-16 18:07:26 -08:00
ld a, 8
call SkipMusic
ld a, $e3
ld [rLCDC], a
call Function90d56
ld [wd002], a
ld [wd003], a
2015-11-11 20:38:57 -08:00
xor a
ld [hBGMapMode], a
2015-11-16 18:07:26 -08:00
call Function91a04
2015-12-11 13:59:40 -08:00
call WaitBGMap2
2015-11-16 18:07:26 -08:00
ld a, [wd002]
call Function9106a
ld a, [wd003]
call Function91098
ld a, c
ld [wd004], a
ld a, b
ld [wd005], a
2015-12-28 07:57:04 -08:00
ld b, SCGB_POKEGEAR_PALS
2015-11-11 20:38:57 -08:00
call GetSGBLayout
call SetPalettes
2015-11-16 18:07:26 -08:00
ld a, [hCGB]
and a
2016-01-05 05:46:37 -08:00
jr z, .dmg
ld a, %11100100
2015-12-09 08:38:40 -08:00
call DmgToCgbObjPal0
2015-11-11 20:38:57 -08:00
call DelayFrame
2016-01-05 05:46:37 -08:00
.dmg
2015-11-11 20:38:57 -08:00
ld a, [wd002]
2015-11-16 18:07:26 -08:00
cp KANTO_LANDMARK
jr nc, .kanto
ld d, KANTO_LANDMARK - 1
ld e, 1
2016-01-05 05:46:37 -08:00
call .loop
2015-11-16 18:07:26 -08:00
jr .resume
2015-11-11 20:38:57 -08:00
2015-11-16 18:07:26 -08:00
.kanto
2016-01-05 05:46:37 -08:00
call TownMap_GetKantoLandmarkLimits
call .loop
2015-11-16 18:07:26 -08:00
.resume
pop af
ld [VramState], a
2015-11-11 20:38:57 -08:00
pop af
ld [hInMenu], a
2015-11-16 18:07:26 -08:00
pop af
ld [Options], a
2015-11-11 20:38:57 -08:00
call ClearBGPalettes
ret
2015-11-16 18:07:26 -08:00
.loop
call JoyTextDelay
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
ret nz
2015-11-11 20:38:57 -08:00
ld hl, hJoyLast
ld a, [hl]
and D_UP
2015-11-16 18:07:26 -08:00
jr nz, .pressed_up
2015-11-11 20:38:57 -08:00
ld a, [hl]
and D_DOWN
2015-11-16 18:07:26 -08:00
jr nz, .pressed_down
.loop2
push de
callba PlaySpriteAnimations
2015-11-16 18:07:26 -08:00
pop de
call DelayFrame
jr .loop
2015-11-11 20:38:57 -08:00
2015-11-16 18:07:26 -08:00
.pressed_up
ld hl, wd003
2015-11-11 20:38:57 -08:00
ld a, [hl]
cp d
2015-11-16 18:07:26 -08:00
jr c, .okay
2015-11-11 20:38:57 -08:00
ld a, e
dec a
ld [hl], a
2015-11-16 18:07:26 -08:00
.okay
2015-11-11 20:38:57 -08:00
inc [hl]
2015-11-16 18:07:26 -08:00
jr .next
2015-11-11 20:38:57 -08:00
2015-11-16 18:07:26 -08:00
.pressed_down
ld hl, wd003
2015-11-11 20:38:57 -08:00
ld a, [hl]
cp e
2015-11-16 18:07:26 -08:00
jr nz, .okay2
2015-11-11 20:38:57 -08:00
ld a, d
inc a
ld [hl], a
2015-11-16 18:07:26 -08:00
.okay2
2015-11-11 20:38:57 -08:00
dec [hl]
2015-11-16 18:07:26 -08:00
.next
push de
2015-11-11 20:38:57 -08:00
ld a, [wd003]
2015-11-16 18:07:26 -08:00
call Function910b4
2015-11-11 20:38:57 -08:00
ld a, [wd004]
ld c, a
2015-11-16 18:07:26 -08:00
ld a, [wd005]
2015-11-11 20:38:57 -08:00
ld b, a
ld a, [wd003]
2015-11-16 18:07:26 -08:00
call Function910d4
2015-11-11 20:38:57 -08:00
pop de
2015-11-16 18:07:26 -08:00
jr .loop2
; 91a04
2015-11-11 20:38:57 -08:00
2015-11-16 18:07:26 -08:00
Function91a04: ; 91a04
2015-11-11 20:38:57 -08:00
ld a, [wd002]
cp KANTO_LANDMARK
2015-11-16 18:07:26 -08:00
jr nc, .kanto
ld e, $0
jr .okay
2015-11-11 20:38:57 -08:00
.kanto
2015-11-16 18:07:26 -08:00
ld e, $1
2015-11-11 20:38:57 -08:00
2015-11-16 18:07:26 -08:00
.okay
callba PokegearMap
2015-11-16 18:07:26 -08:00
ld a, $7
ld bc, 6
hlcoord 1, 0
2015-11-11 20:38:57 -08:00
call ByteFill
hlcoord 0, 0
2015-11-16 18:07:26 -08: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 13:01:45 -08:00
ret
2015-11-16 18:07:26 -08:00
; 91a53