summaryrefslogtreecommitdiff
path: root/engine/pinball_game/map_move.asm
blob: 4c302112e4574ea9bc484cfdb81e3d4fd4d21a6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
HandleMapModeCollision: ; 0x301ce
	ld a, [wCurrentStage]
	call CallInFollowingTable
HandleMapModeCollisionPointerTable: ; 0x301d4
	padded_dab HandleRedMapModeCollision ; STAGE_RED_FIELD_TOP
	padded_dab HandleRedMapModeCollision ; STAGE_RED_FIELD_BOTTOM
	padded_dab HandleRedMapModeCollision
	padded_dab HandleRedMapModeCollision
	padded_dab HandleBlueMapModeCollision ; STAGE_BLUE_FIELD_TOP
	padded_dab HandleBlueMapModeCollision ; STAGE_BLUE_FIELD_BOTTOM

StartMapMoveMode: ; 0x301ec
	ld a, [wInSpecialMode]
	and a
	ret nz
	ld a, $1
	ld [wInSpecialMode], a
	ld a, SPECIAL_MODE_MAP_MOVE
	ld [wSpecialMode], a
	xor a
	ld [wSpecialModeState], a
	ld bc, $0030  ; 30 seconds
	callba StartTimer
	ld a, [wCurrentStage]
	bit 0, a
	jr z, .asm_3021b
	ld a, [wMapMoveDirection]
	add $12
	call LoadBillboardTileData
.asm_3021b
	ld a, [wCurrentStage]
	rst JumpTable  ; calls JumpToFuncInTable
CallTable_3021f: ; 0x3021f
	dw Func_311b4 ; STAGE_RED_FIELD_TOP
	dw Func_311b4 ; STAGE_RED_FIELD_BOTTOM
	dw DoNothing_31324
	dw DoNothing_31324
	dw Func_31326 ; STAGE_BLUE_FIELD_TOP
	dw Func_31326 ; STAGE_BLUE_FIELD_BOTTOM

ConcludeMapMoveMode: ; 0x3022b
	xor a
	ld [wBottomTextEnabled], a ;turn text off
	call FillBottomMessageBufferWithBlackTile ;clear text
	xor a
	ld [wInSpecialMode], a
	ld [wSpecialMode], a ;no longer in special modes
	callba StopTimer
	ld a, [wCurrentStage]
	rst JumpTable  ; calls JumpToFuncInTable
CallTable_30247: ; 0x30247
	dw Func_31234 ; STAGE_RED_FIELD_TOP
	dw Func_31234 ; STAGE_RED_FIELD_BOTTOM
	dw DoNothing_31325
	dw DoNothing_31325
	dw Func_313c3 ; STAGE_BLUE_FIELD_TOP
	dw Func_313c3 ; STAGE_BLUE_FIELD_TOP

INCLUDE "engine/pinball_game/billboard_tiledata.asm"

LoadScrollingMapNameText: ; 0x3118f
; Loads the scrolling message that displays the current map's name.
; Input: bc = pointer to prefix scrolling text
	push bc
	call FillBottomMessageBufferWithBlackTile
	call EnableBottomText
	ld a, [wCurrentMap]
	sla a
	ld c, a
	ld b, $0
	ld hl, MapNames
	add hl, bc
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	ld hl, wScrollingText2
	call LoadScrollingText
	pop de
	ld hl, wScrollingText1
	call LoadScrollingText
	ret

Func_311b4: ; 0x311b4
	ld a, [wMapMoveDirection]
	and a
	jr nz, .asm_311ce
	ld a, $80
	ld [wIndicatorStates], a
	ld [wIndicatorStates + 2], a
	xor a
	ld [wIndicatorStates + 1], a
	ld [wIndicatorStates + 3], a
	ld [wIndicatorStates + 4], a
	jr .asm_311e2

.asm_311ce
	ld a, $80
	ld [wIndicatorStates + 1], a
	ld [wIndicatorStates + 3], a
	xor a
	ld [wIndicatorStates], a
	ld [wIndicatorStates + 2], a
	ld [wIndicatorStates + 4], a
	jr .asm_311e2

.asm_311e2
	ld a, $2
	callba _LoadDiglettGraphics
	ld a, $5
	callba _LoadDiglettGraphics
	ld a, $6a
	ld [wStageCollisionMap + $f0], a
	ld a, $6b
	ld [wStageCollisionMap + $110], a
	ld a, $66
	ld [wStageCollisionMap + $e3], a
	ld a, $67
	ld [wStageCollisionMap + $103], a
	callba Func_107b0
	ld a, $4
	ld [wd7ad], a
	ld de, MUSIC_HURRY_UP_BLUE ; Either MUSIC_HURRY_UP_BLUE or MUSIC_HURRY_UP_RED. They have the same id in their respective audio Banks.
	call PlaySong
	ld a, [wCurrentStage]
	bit 0, a
	ret z
	callba ClearAllRedIndicators
	ret

Func_31234: ; 0x31234
	callba ResetIndicatorStates
	callba OpenSlotCave
	callba SetLeftAndRightAlleyArrowIndicatorStates_RedField
	callba Func_107e9
	ld a, [wCurrentStage]
	bit 0, a
	ret z
	callba ClearAllRedIndicators
	callba LoadSlotCaveCoverGraphics_RedField
	callba LoadMapBillboardTileData
	ret

ChooseNextMap_RedField: ; 0x31282
; Picks the next map to perform a map move.
; Also records which maps have been visited.
	ld a, [wNumMapMoves]
	inc a
	cp $6
	jr c, .dontReset
	ld a, $ff
	ld [wVisitedMaps], a
	ld [wVisitedMaps + 1], a
	ld [wVisitedMaps + 2], a
	ld [wVisitedMaps + 3], a
	ld [wVisitedMaps + 4], a
	ld [wVisitedMaps + 5], a
	xor a
.dontReset
	ld [wNumMapMoves], a
	cp $3
	jr c, .chooseMapFromArea1
	cp $5
	jr c, .chooseMapFromArea2
	ld a, INDIGO_PLATEAU
	ld [wCurrentMap], a
	ld [wVisitedMaps + 5], a
	ret

.chooseMapFromArea1
	call GenRandom
	and $7
	cp $7
	jr nc, .chooseMapFromArea1
	ld c, a
	ld b, $0
	ld hl, FirstMapMoveSet_RedField
	add hl, bc
	ld c, [hl]
	ld hl, wVisitedMaps
	ld a, [wNumMapMoves]
	and a
	jr z, .asm_312d4
	ld b, a
.asm_312cd
	ld a, [hli]
	cp c
	jr z, .chooseMapFromArea1
	dec b
	jr nz, .asm_312cd
.asm_312d4
	ld a, c
	ld [wCurrentMap], a
	ld a, [wNumMapMoves]
	ld c, a
	ld b, $0
	ld hl, wVisitedMaps
	add hl, bc
	ld a, [wCurrentMap]
	ld [hl], a
	ret

.chooseMapFromArea2
	call GenRandom
	and $3
	ld c, a
	ld b, $0
	ld hl, SecondMapMoveSet_RedField
	add hl, bc
	ld c, [hl]
	ld hl, wVisitedMaps + 3
	ld a, [wNumMapMoves]
	sub $3
	jr z, .asm_31306
	ld b, a
.asm_312ff
	ld a, [hli]
	cp c
	jr z, .chooseMapFromArea2
	dec b
	jr nz, .asm_312ff
.asm_31306
	ld a, c
	ld [wCurrentMap], a
	ld a, [wNumMapMoves]
	ld c, a
	ld b, $0
	ld hl, wVisitedMaps
	add hl, bc
	ld a, [wCurrentMap]
	ld [hl], a
	ret

FirstMapMoveSet_RedField:
	db PALLET_TOWN
	db VIRIDIAN_FOREST
	db PEWTER_CITY
	db CERULEAN_CITY
	db VERMILION_SEASIDE
	db ROCK_MOUNTAIN
	db LAVENDER_TOWN

SecondMapMoveSet_RedField:
	db CYCLING_ROAD
	db SAFARI_ZONE
	db SEAFOAM_ISLANDS
	db CINNABAR_ISLAND

DoNothing_31324: ; 0x31324
	ret

DoNothing_31325: ; 0x31325
	ret

Func_31326: ; 0x31326
	ld a, [wMapMoveDirection]
	and a
	jr nz, .asm_3134c
	ld a, $80
	ld [wIndicatorStates], a
	ld [wIndicatorStates + 2], a
	xor a
	ld [wIndicatorStates + 1], a
	ld [wIndicatorStates + 3], a
	ld [wIndicatorStates + 4], a
	ld a, $3
	callba _LoadPsyduckOrPoliwagGraphics
	jr .asm_31382

.asm_3134c
	ld a, $80
	ld [wIndicatorStates + 1], a
	ld [wIndicatorStates + 3], a
	xor a
	ld [wIndicatorStates], a
	ld [wIndicatorStates + 2], a
	ld [wIndicatorStates + 4], a
	ld a, $1
	callba _LoadPsyduckOrPoliwagGraphics
	ld a, $6
	callba _LoadPsyduckOrPoliwagGraphics
	ld a, $7
	callba LoadPsyduckOrPoliwagNumberGraphics
.asm_31382
	ld a, [wCurrentStage]
	bit 0, a
	jr z, .asm_3139d
	ld a, $54
	ld [wStageCollisionMap + $e3], a
	ld a, $55
	ld [wStageCollisionMap + $103], a
	ld a, $52
	ld [wStageCollisionMap + $f0], a
	ld a, $53
	ld [wStageCollisionMap + $110], a
.asm_3139d
	ld a, $1
	ld [wd644], a
	callba CloseSlotCave
	ld de, MUSIC_HURRY_UP_BLUE ; Either MUSIC_HURRY_UP_BLUE or MUSIC_HURRY_UP_RED. They have the same id in their respective audio Banks.
	call PlaySong
	ld a, [wCurrentStage]
	bit 0, a
	ret z
	callba Func_1c2cb
	ret

Func_313c3: ; 0x313c3
	callba ResetIndicatorStates
	callba OpenSlotCave
	callba SetLeftAndRightAlleyArrowIndicatorStates_BlueField
	ld a, $0
	ld [wd644], a
	ld a, [wCurrentStage]
	bit 0, a
	ret z
	callba Func_1c2cb
	callba LoadSlotCaveCoverGraphics_BlueField
	callba LoadMapBillboardTileData
	ret

ChooseNextMap_BlueField: ; 0x3140b
; Picks the next map to perform a map move.
; Also records which maps have been visited.
	ld a, [wNumMapMoves]
	inc a
	cp $6
	jr c, .dontReset
	ld a, $ff
	ld [wVisitedMaps], a
	ld [wVisitedMaps + 1], a
	ld [wVisitedMaps + 2], a
	ld [wVisitedMaps + 3], a
	ld [wVisitedMaps + 4], a
	ld [wVisitedMaps + 5], a
	xor a
.dontReset
	ld [wNumMapMoves], a
	cp $3
	jr c, .chooseMapFromArea1
	cp $5
	jr c, .chooseMapFromArea2
	ld a, INDIGO_PLATEAU
	ld [wCurrentMap], a
	ld [wVisitedMaps + 5], a
	ret

.chooseMapFromArea1
	call GenRandom
	and $7
	cp $7
	jr nc, .chooseMapFromArea1
	ld c, a
	ld b, $0
	ld hl, FirstMapMoveSet_BlueField
	add hl, bc
	ld c, [hl]
	ld hl, wVisitedMaps
	ld a, [wNumMapMoves]
	and a
	jr z, .asm_3145e
	ld b, a
.asm_31457
	ld a, [hli]
	cp c
	jr z, .chooseMapFromArea1
	dec b
	jr nz, .asm_31457
.asm_3145e
	ld a, c
	ld [wCurrentMap], a
	ld a, [wNumMapMoves]
	ld c, a
	ld b, $0
	ld hl, wVisitedMaps
	add hl, bc
	ld a, [wCurrentMap]
	ld [hl], a
	ret

.chooseMapFromArea2
	call GenRandom
	and $3
	ld c, a
	ld b, $0
	ld hl, SecondMapMoveSet_BlueField
	add hl, bc
	ld c, [hl]
	ld hl, wVisitedMaps + 3
	ld a, [wNumMapMoves]
	sub $3
	jr z, .asm_31490
	ld b, a
.asm_31489
	ld a, [hli]
	cp c
	jr z, .chooseMapFromArea2
	dec b
	jr nz, .asm_31489
.asm_31490
	ld a, c
	ld [wCurrentMap], a
	ld a, [wNumMapMoves]
	ld c, a
	ld b, $0
	ld hl, wVisitedMaps
	add hl, bc
	ld a, [wCurrentMap]
	ld [hl], a
	ret

FirstMapMoveSet_BlueField:
	db VIRIDIAN_CITY
	db VIRIDIAN_FOREST
	db MT_MOON
	db CERULEAN_CITY
	db VERMILION_STREETS
	db ROCK_MOUNTAIN
	db CELADON_CITY

SecondMapMoveSet_BlueField:
	db FUCHSIA_CITY
	db SAFARI_ZONE
	db SAFFRON_CITY
	db CINNABAR_ISLAND

HandleRedMapModeCollision: ; 0x314ae
	ld a, [wTimerActive]
	and a
	ld a, [wSpecialModeCollisionID]
	jr z, .asm_314d0
	cp SPECIAL_COLLISION_LEFT_TRIGGER
	jp z, OpenRedMapMoveSlotFromLeft
	cp SPECIAL_COLLISION_STARYU_ALLEY_TRIGGER
	jp z, OpenRedMapMoveSlotFromLeft
	cp SPECIAL_COLLISION_RIGHT_TRIGGER
	jp z, OpenRedMapMoveSlotFromRight
	cp SPECIAL_COLLISION_BELLSPROUT
	jp z, OpenRedMapMoveSlotFromRight
	cp SPECIAL_COLLISION_SLOT_HOLE
	jp z, ResolveSucsessfulRedMapMove
.asm_314d0
	cp SPECIAL_COLLISION_NOTHING
	jr z, .asm_314d6
	scf
	ret

.asm_314d6
	call UpdateMapMove_RedField
	ld a, [wSpecialModeState]
	call CallInFollowingTable
PointerTable_314df: ; 0xd13df
	padded_dab Func_314ef
	padded_dab Func_314f1
	padded_dab Func_314f3
	padded_dab Func_31505

Func_314ef: ; 0x314ef
	scf
	ret

Func_314f1: ; 0x314f1
	scf
	ret

Func_314f3: ; 0x314f3
	callba ConcludeMapMoveMode
	ld de, MUSIC_BLUE_FIELD ; Either MUSIC_BLUE_FIELD or MUSIC_RED_FIELD. They have the same id in their respective audio Banks.
	call PlaySong
	scf
	ret

Func_31505: ; 0x31505
	ld a, [wBottomTextEnabled]
	and a
	ret nz
	call FillBottomMessageBufferWithBlackTile
	callba ConcludeMapMoveMode
	ld de, MUSIC_BLUE_FIELD ; Either MUSIC_BLUE_FIELD or MUSIC_RED_FIELD. They have the same id in their respective audio Banks.
	call PlaySong
	scf
	ret

UpdateMapMove_RedField: ; 0x3151f handle map move timer and fail when it expires
	ld a, $50
	ld [wLeftDiglettAnimationController], a
	ld [wRightDiglettAnimationController], a
	callba PlayLowTimeSfx
	ld a, [wTimeRanOut] ;if ??? is 0, quit, else make it zero (this only truns once per something?) and handle a failed map move
	and a
	ret z
	xor a
	ld [wTimeRanOut], a
	ld a, $3
	ld [wSpecialModeState], a
	xor a
	ld [wSlotIsOpen], a ;close slot and indicators
	ld [wIndicatorStates], a
	ld [wIndicatorStates + 1], a
	ld [wIndicatorStates + 2], a
	ld [wIndicatorStates + 3], a
	ld [wIndicatorStates + 4], a
	ld a, [wCurrentStage]
	bit 0, a
	jr z, .asm_31577 ;if on stage without flippers(the tops), jump
	callba ClearAllRedIndicators ;clear indicators
	callba LoadSlotCaveCoverGraphics_RedField
	callba LoadMapBillboardTileData
.asm_31577
	callba StopTimer ;stop the timer
	call FillBottomMessageBufferWithBlackTile
	call EnableBottomText
	ld hl, wScrollingText1
	ld de, MapMoveFailedText
	call LoadScrollingText
	ret

OpenRedMapMoveSlotFromLeft: ; 0x31591
	ld a, [wMapMoveDirection]
	and a
	jr nz, .NotApplicibleOrCompleted
	ld a, [wIndicatorStates]
	and a
	jr z, .NotApplicibleOrCompleted
	xor a
	ld [wIndicatorStates], a
	ld [wIndicatorStates + 2], a
	ld a, $80
	ld [wIndicatorStates + 4], a
	ld a, $1
	ld [wSlotIsOpen], a
	ld [wSpecialModeState], a
.NotApplicibleOrCompleted
	scf
	ret

OpenRedMapMoveSlotFromRight: ; 0x315b3
	ld a, [wMapMoveDirection]
	and a
	jr z, .NotApplicibleOrCompleted
	ld a, [wIndicatorStates + 1]
	and a
	jr z, .NotApplicibleOrCompleted
	xor a
	ld [wIndicatorStates + 1], a
	ld [wIndicatorStates + 3], a
	ld a, $80
	ld [wIndicatorStates + 4], a
	ld a, $1
	ld [wSlotIsOpen], a
	ld [wSpecialModeState], a
.NotApplicibleOrCompleted
	scf
	ret

ResolveSucsessfulRedMapMove: ; 0x315d5
	ld de, MUSIC_NOTHING
	call PlaySong
	rst AdvanceFrame
	callba ChooseNextMap_RedField
	callba LoadMapBillboardTileData
	lb de, $25, $25
	call PlaySoundEffect
	ld bc, ArrivedAtMapText
	callba LoadScrollingMapNameText
.asm_31603
	callba UpdateBottomText
	rst AdvanceFrame
	ld a, [wBottomTextEnabled]
	and a
	jr nz, .asm_31603
	ld a, $2
	ld [wSpecialModeState], a
	scf
	ret

HandleBlueMapModeCollision: ; 0x3161b
	ld a, [wTimerActive]
	and a
	ld a, [wSpecialModeCollisionID]
	jr z, .asm_3163d
	cp SPECIAL_COLLISION_LEFT_TRIGGER
	jp z, Func_31708
	cp SPECIAL_COLLISION_SLOWPOKE
	jp z, Func_31708
	cp SPECIAL_COLLISION_RIGHT_TRIGGER
	jp z, Func_3172a
	cp SPECIAL_COLLISION_CLOYSTER
	jp z, Func_3172a
	cp SPECIAL_COLLISION_SLOT_HOLE
	jp z, Func_3174c
.asm_3163d
	cp SPECIAL_COLLISION_NOTHING
	jr z, .asm_31643
	scf
	ret

.asm_31643
	call UpdateMapMove_BlueField
	ld a, [wSpecialModeState]
	call CallInFollowingTable
PointerTable_3164c: ; 0x3164c
	padded_dab Func_3165c
	padded_dab Func_3165e
	padded_dab Func_31660
	padded_dab Func_31672

Func_3165c: ; 0x3165c
	scf
	ret

Func_3165e: ; 0x3165e
	scf
	ret

Func_31660: ; 0x31660
	callba ConcludeMapMoveMode
	ld de, MUSIC_BLUE_FIELD ; Either MUSIC_BLUE_FIELD or MUSIC_RED_FIELD. They have the same id in their respective audio Banks.
	call PlaySong
	scf
	ret

Func_31672: ; 0x31672
	ld a, [wBottomTextEnabled] ;if text is off
	and a
	ret nz
	call FillBottomMessageBufferWithBlackTile
	callba ConcludeMapMoveMode
	ld de, MUSIC_BLUE_FIELD ; Either MUSIC_BLUE_FIELD or MUSIC_RED_FIELD. They have the same id in their respective audio Banks.
	call PlaySong
	scf
	ret

UpdateMapMove_BlueField: ; 0x3168c
	ld a, $50
	ld [wLeftMapMovePoliwagAnimationCounter], a
	ld [wRightMapMovePsyduckFrame], a
	ld a, $3
	ld [wPsyduckState], a
	ld a, $1
	ld [wPoliwagState], a
	callba PlayLowTimeSfx
	ld a, [wTimeRanOut]
	and a
	ret z
	xor a
	ld [wTimeRanOut], a
	ld a, $3
	ld [wSpecialModeState], a
	xor a
	ld [wSlotIsOpen], a
	ld [wIndicatorStates], a
	ld [wIndicatorStates + 1], a
	ld [wIndicatorStates + 2], a
	ld [wIndicatorStates + 3], a
	ld [wIndicatorStates + 4], a
	ld a, [wCurrentStage]
	bit 0, a
	jr z, .asm_316ee
	callba Func_1c2cb
	callba LoadSlotCaveCoverGraphics_BlueField
	callba LoadMapBillboardTileData
.asm_316ee
	callba StopTimer
	call FillBottomMessageBufferWithBlackTile
	call EnableBottomText
	ld hl, wScrollingText1
	ld de, MapMoveFailedText
	call LoadScrollingText
	ret

Func_31708: ; 0x31708
	ld a, [wMapMoveDirection]
	and a
	jr nz, .asm_31728
	ld a, [wIndicatorStates]
	and a
	jr z, .asm_31728
	xor a
	ld [wIndicatorStates], a
	ld [wIndicatorStates + 2], a
	ld a, $80
	ld [wIndicatorStates + 4], a
	ld a, $1
	ld [wSlotIsOpen], a
	ld [wSpecialModeState], a
.asm_31728
	scf
	ret

Func_3172a: ; 0x3172a
	ld a, [wMapMoveDirection]
	and a
	jr z, .asm_3174a
	ld a, [wIndicatorStates + 1]
	and a
	jr z, .asm_3174a
	xor a
	ld [wIndicatorStates + 1], a
	ld [wIndicatorStates + 3], a
	ld a, $80
	ld [wIndicatorStates + 4], a
	ld a, $1
	ld [wSlotIsOpen], a
	ld [wSpecialModeState], a
.asm_3174a
	scf
	ret

Func_3174c: ; 0x3174c
	ld de, MUSIC_NOTHING
	call PlaySong
	rst AdvanceFrame
	callba ChooseNextMap_BlueField
	callba LoadMapBillboardTileData
	lb de, $25, $25
	call PlaySoundEffect
	ld bc, ArrivedAtMapText
	callba LoadScrollingMapNameText
.asm_3177a
	callba UpdateBottomText
	rst AdvanceFrame
	ld a, [wBottomTextEnabled]
	and a
	jr nz, .asm_3177a
	ld a, $2
	ld [wSpecialModeState], a
	scf
	ret