This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
oakslab.asm
1260 lines (1140 loc) · 21.8 KB
/
oakslab.asm
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
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
OaksLabScript:
CheckEvent EVENT_PALLET_AFTER_GETTING_POKEBALLS_2
call nz, OaksLabScript_1d076
ld a, $1
ld [wAutoTextBoxDrawingControl], a
xor a
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld hl, OaksLabScriptPointers
ld a, [wOaksLabCurScript]
jp CallFunctionInTable
OaksLabScriptPointers:
dw OaksLabScript0
dw OaksLabScript1
dw OaksLabScript2
dw OaksLabScript3
dw OaksLabScript4
dw OaksLabScript5
dw OaksLabScript6
dw OaksLabScript7
dw OaksLabScript8
dw OaksLabScript9
dw OaksLabScript10
dw OaksLabScript11
dw OaksLabScript12
dw OaksLabScript13
dw OaksLabScript14
dw OaksLabScript15
dw OaksLabScript16
dw OaksLabScript17
dw OaksLabScript18
OaksLabScript0:
CheckEvent EVENT_OAK_APPEARED_IN_PALLET
ret z
ld a, [wNPCMovementScriptFunctionNum]
and a
ret nz
ld a, HS_OAKS_LAB_OAK_2
ld [wMissableObjectIndex], a
predef ShowObject
ld hl, wd72e
res 4, [hl]
ld a, $1
ld [wOaksLabCurScript], a
ret
OaksLabScript1:
ld a, $8
ld [H_SPRITEINDEX], a
ld de, OakEntryMovement
call MoveSprite
ld a, $2
ld [wOaksLabCurScript], a
ret
OakEntryMovement:
db NPC_MOVEMENT_UP
db NPC_MOVEMENT_UP
db NPC_MOVEMENT_UP
db $FF
OaksLabScript2:
ld a, [wd730]
bit 0, a
ret nz
ld a, HS_OAKS_LAB_OAK_2
ld [wMissableObjectIndex], a
predef HideObject
ld a, HS_OAKS_LAB_OAK_1
ld [wMissableObjectIndex], a
predef ShowObject
ld a, $3
ld [wOaksLabCurScript], a
ret
OaksLabScript3:
call Delay3
ld hl, wSimulatedJoypadStatesEnd
ld de, PlayerEntryMovementRLE
call DecodeRLEList
dec a
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
ld a, $1
ld [H_SPRITEINDEX], a
xor a
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $5
ld [H_SPRITEINDEX], a
xor a
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $4
ld [wOaksLabCurScript], a
ret
PlayerEntryMovementRLE:
db D_UP,$8
db $ff
OaksLabScript4:
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
SetEvent EVENT_FOLLOWED_OAK_INTO_LAB
SetEvent EVENT_FOLLOWED_OAK_INTO_LAB_2
ld a, $1
ld [H_SPRITEINDEX], a
ld a, SPRITE_FACING_UP
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
call UpdateSprites
ld hl, wFlags_D733
res 1, [hl]
call PlayDefaultMusic
ld a, $5
ld [wOaksLabCurScript], a
ret
OaksLabScript5:
ld a, $fc
ld [wJoyIgnore], a
ld a, $11
ld [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld a, $12
ld [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld a, $13
ld [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld a, $14
ld [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_OAK_ASKED_TO_CHOOSE_MON
xor a
ld [wJoyIgnore], a
ld a, $6
ld [wOaksLabCurScript], a
ret
OaksLabScript6:
ld a, [wYCoord]
cp $6
ret nz
ld a, $5
ld [H_SPRITEINDEX], a
xor a ; SPRITE_FACING_DOWN
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $1
ld [H_SPRITEINDEX], a
xor a
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
call UpdateSprites
ld a, $c
ld [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
ld a, D_UP
ld [wSimulatedJoypadStatesEnd], a
call StartSimulatingJoypadStates
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
ld a, $7
ld [wOaksLabCurScript], a
ret
OaksLabScript7:
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
call Delay3
ld a, $6
ld [wOaksLabCurScript], a
ret
OaksLabScript8:
ld a, [wPlayerStarter]
cp STARTER1
jr z, .Charmander
cp STARTER2
jr z, .Squirtle
jr .Bulbasaur
.Charmander
ld de, .MiddleBallMovement1
ld a, [wYCoord]
cp $4 ; is the player standing below the table?
jr z, .asm_1ccf3
ld de, .MiddleBallMovement2
jr .asm_1ccf3
.MiddleBallMovement1
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_UP
db $FF
.MiddleBallMovement2
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db $FF
.Squirtle
ld de, .RightBallMovement1
ld a, [wYCoord]
cp $4 ; is the player standing below the table?
jr z, .asm_1ccf3
ld de, .RightBallMovement2
jr .asm_1ccf3
.RightBallMovement1
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_UP
db $FF
.RightBallMovement2
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db $FF
.Bulbasaur
ld de, .LeftBallMovement1
ld a, [wXCoord]
cp $9 ; is the player standing to the right of the table?
jr nz, .asm_1ccf3
push hl
ld a, $1
ld [H_SPRITEINDEX], a
ld a, $4
ld [H_SPRITEDATAOFFSET], a
call GetPointerWithinSpriteStateData1
push hl
ld [hl], $4c
inc hl
inc hl
ld [hl], $0
pop hl
inc h
ld [hl], $8
inc hl
ld [hl], $9
ld de, .LeftBallMovement2 ; the rival is not currently onscreen, so account for that
pop hl
jr .asm_1ccf3
.LeftBallMovement1
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_RIGHT ; not yet terminated!
.LeftBallMovement2
db NPC_MOVEMENT_RIGHT
db $FF
.asm_1ccf3
ld a, $1
ld [H_SPRITEINDEX], a
call MoveSprite
ld a, $9
ld [wOaksLabCurScript], a
ret
OaksLabScript9:
ld a, [wd730]
bit 0, a
ret nz
ld a, $fc
ld [wJoyIgnore], a
ld a, $1
ld [H_SPRITEINDEX], a
ld a, SPRITE_FACING_UP
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $d
ld [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, [wRivalStarterBallSpriteIndex]
cp $2
jr nz, .asm_1cd28
ld a, HS_STARTER_BALL_1
jr .asm_1cd32
.asm_1cd28
cp $3
jr nz, .asm_1cd30
ld a, HS_STARTER_BALL_2
jr .asm_1cd32
.asm_1cd30
ld a, HS_STARTER_BALL_3
.asm_1cd32
ld [wMissableObjectIndex], a
predef HideObject
call Delay3
;Change starter based on version
IF DEF(_RED)
ld a, PIKACHU
ENDC
IF DEF(_BLUE)
ld a, EEVEE
ENDC
ld [wRivalStarter], a
ld [wcf91], a
ld [wd11e], a
call GetMonName
;Pick and save the rival's team offset
call Random
and %00000011
;only 0-2 are needed
cp $3
jp nz, .RivalTeamDone
dec a
.RivalTeamDone
ld [wRivalTeamOff], a
ld a, $1
ld [H_SPRITEINDEX], a
ld a, SPRITE_FACING_UP
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $e
ld [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_STARTER
xor a
ld [wJoyIgnore], a
ld a, $a
ld [wOaksLabCurScript], a
ret
OaksLabScript10:
ld a, [wYCoord]
cp $6
ret nz
ld a, $1
ld [H_SPRITEINDEX], a
xor a ; SPRITE_FACING_DOWN
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
ld c, BANK(Music_MeetRival)
ld a, MUSIC_MEET_RIVAL
call PlayMusic
ld a, $f
ld [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $1
ld [hNPCPlayerRelativePosPerspective], a
ld a, $1
swap a
ld [hNPCSpriteOffset], a
predef CalcPositionOfPlayerRelativeToNPC
ld a, [hNPCPlayerYDistance]
dec a
ld [hNPCPlayerYDistance], a
predef FindPathToPlayer
ld de, wNPCMovementDirections2
ld a, $1
ld [H_SPRITEINDEX], a
call MoveSprite
ld a, $b
ld [wOaksLabCurScript], a
ret
OaksLabScript11:
ld a, [wd730]
bit 0, a
ret nz
; define which team rival uses, and fight it
ld a, OPP_SONY1
ld [wCurOpponent], a
ld a, [wRivalStarter]
cp STARTER2
jr nz, .NotSquirtle
ld a, $1
jr .done
.NotSquirtle
cp STARTER3
jr nz, .Charmander
ld a, $2
jr .done
.Charmander
ld a, $3
.done
ld [wTrainerNo], a
ld a, $1
ld [wSpriteIndex], a
call GetSpritePosition1
ld hl, OaksLabText_1d3be
ld de, OaksLabText_1d3c3
call SaveEndBattleTextPointers
ld hl, wd72d
set 6, [hl]
set 7, [hl]
xor a
ld [wJoyIgnore], a
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
ld a, $c
ld [wOaksLabCurScript], a
ret
OaksLabScript12:
ld a, $f0
ld [wJoyIgnore], a
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
call UpdateSprites
ld a, $1
ld [wSpriteIndex], a
call SetSpritePosition1
ld a, $1
ld [H_SPRITEINDEX], a
xor a ; SPRITE_FACING_DOWN
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
predef HealParty
SetEvent EVENT_BATTLED_RIVAL_IN_OAKS_LAB
ld a, $d
ld [wOaksLabCurScript], a
ret
OaksLabScript13:
ld c, 20
call DelayFrames
ld a, $10
ld [hSpriteIndexOrTextID], a
call DisplayTextID
callba Music_RivalAlternateStart
ld a, $1
ld [H_SPRITEINDEX], a
ld de, .RivalExitMovement
call MoveSprite
ld a, [wXCoord]
cp $4
; move left or right depending on where the player is standing
jr nz, .moveLeft
ld a, NPC_MOVEMENT_RIGHT
jr .next
.moveLeft
ld a, NPC_MOVEMENT_LEFT
.next
ld [wNPCMovementDirections], a
ld a, $e
ld [wOaksLabCurScript], a
ret
.RivalExitMovement
db $E0 ; change sprite facing direction
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db $FF
OaksLabScript14:
ld a, [wd730]
bit 0, a
jr nz, .asm_1ce8c
ld a, HS_OAKS_LAB_RIVAL
ld [wMissableObjectIndex], a
predef HideObject
xor a
ld [wJoyIgnore], a
call PlayDefaultMusic ; reset to map music
ld a, $12
ld [wOaksLabCurScript], a
jr .done
; make the player keep facing the rival as he walks away
.asm_1ce8c
ld a, [wNPCNumScriptedSteps]
cp $5
jr nz, .asm_1cea8
ld a, [wXCoord]
cp $4
jr nz, .asm_1cea1
ld a, SPRITE_FACING_RIGHT
ld [wSpriteStateData1 + 9], a
jr .done
.asm_1cea1
ld a, SPRITE_FACING_LEFT
ld [wSpriteStateData1 + 9], a
jr .done
.asm_1cea8
cp $4
ret nz
xor a ; ld a, SPRITE_FACING_DOWN
ld [wSpriteStateData1 + 9], a
.done
ret
OaksLabScript15:
xor a
ld [hJoyHeld], a
call EnableAutoTextBoxDrawing
ld a, $ff
ld [wNewSoundID], a
call PlaySound
callba Music_RivalAlternateStart
ld a, $15
ld [hSpriteIndexOrTextID], a
call DisplayTextID
call OaksLabScript_1d02b
ld a, HS_OAKS_LAB_RIVAL
ld [wMissableObjectIndex], a
predef ShowObject
ld a, [wNPCMovementDirections2Index]
ld [wSavedNPCMovementDirections2Index], a
ld b, 0
ld c, a
ld hl, wNPCMovementDirections2
ld a, NPC_MOVEMENT_UP
call FillMemory
ld [hl], $ff
ld a, $1
ld [H_SPRITEINDEX], a
ld de, wNPCMovementDirections2
call MoveSprite
ld a, $10
ld [wOaksLabCurScript], a
ret
OaksLabScript_1cefd:
ld a, $1
ld [H_SPRITEINDEX], a
ld a, SPRITE_FACING_UP
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $8
ld [H_SPRITEINDEX], a
xor a ; SPRITE_FACING_DOWN
ld [hSpriteFacingDirection], a
jp SetSpriteFacingDirectionAndDelay
OaksLabScript16:
ld a, [wd730]
bit 0, a
ret nz
call EnableAutoTextBoxDrawing
call PlayDefaultMusic
ld a, $fc
ld [wJoyIgnore], a
call OaksLabScript_1cefd
ld a, $16
ld [hSpriteIndexOrTextID], a
call DisplayTextID
call DelayFrame
call OaksLabScript_1cefd
ld a, $17
ld [hSpriteIndexOrTextID], a
call DisplayTextID
call DelayFrame
call OaksLabScript_1cefd
ld a, $18
ld [hSpriteIndexOrTextID], a
call DisplayTextID
call DelayFrame
ld a, $19
ld [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld a, HS_POKEDEX_1
ld [wMissableObjectIndex], a
predef HideObject
ld a, HS_POKEDEX_2
ld [wMissableObjectIndex], a
predef HideObject
call OaksLabScript_1cefd
ld a, $1a
ld [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $1
ld [H_SPRITEINDEX], a
ld a, SPRITE_FACING_RIGHT
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
call Delay3
ld a, $1b
ld [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_POKEDEX
SetEvent EVENT_OAK_GOT_PARCEL
ld a, HS_LYING_OLD_MAN
ld [wMissableObjectIndex], a
predef HideObject
ld a, HS_OLD_MAN
ld [wMissableObjectIndex], a
predef ShowObject
ld a, [wSavedNPCMovementDirections2Index]
ld b, 0
ld c, a
ld hl, wNPCMovementDirections2
xor a ; NPC_MOVEMENT_DOWN
call FillMemory
ld [hl], $ff
ld a, $ff
ld [wNewSoundID], a
call PlaySound
callba Music_RivalAlternateStart
ld a, $1
ld [H_SPRITEINDEX], a
ld de, wNPCMovementDirections2
call MoveSprite
ld a, $11
ld [wOaksLabCurScript], a
ret
OaksLabScript17:
ld a, [wd730]
bit 0, a
ret nz
call PlayDefaultMusic
ld a, HS_OAKS_LAB_RIVAL
ld [wMissableObjectIndex], a
predef HideObject
SetEvent EVENT_1ST_ROUTE22_RIVAL_BATTLE
ResetEventReuseHL EVENT_2ND_ROUTE22_RIVAL_BATTLE
SetEventReuseHL EVENT_ROUTE22_RIVAL_WANTS_BATTLE
ld a, HS_ROUTE_22_RIVAL_1
ld [wMissableObjectIndex], a
predef ShowObject
ld a, $5
ld [wPalletTownCurScript], a
xor a
ld [wJoyIgnore], a
ld a, $12
ld [wOaksLabCurScript], a
ret
OaksLabScript18:
ret
OaksLabScript_RemoveParcel:
ld hl, wBagItems
ld bc, $0000
.loop
ld a, [hli]
cp $ff
ret z
cp OAKS_PARCEL
jr z, .foundParcel
inc hl
inc c
jr .loop
.foundParcel
ld hl, wNumBagItems
ld a, c
ld [wWhichPokemon], a
ld a, $1
ld [wItemQuantity], a
jp RemoveItemFromInventory
OaksLabScript_1d02b:
ld a, $7c
ld [$ffeb], a
ld a, $8
ld [$ffee], a
ld a, [wYCoord]
cp $3
jr nz, .asm_1d045
ld a, $4
ld [wNPCMovementDirections2Index], a
ld a, $30
ld b, $b
jr .asm_1d068
.asm_1d045
cp $1
jr nz, .asm_1d054
ld a, $2
ld [wNPCMovementDirections2Index], a
ld a, $30
ld b, $9
jr .asm_1d068
.asm_1d054
ld a, $3
ld [wNPCMovementDirections2Index], a
ld b, $a
ld a, [wXCoord]
cp $4
jr nz, .asm_1d066
ld a, $40
jr .asm_1d068
.asm_1d066
ld a, $20
.asm_1d068
ld [$ffec], a
ld a, b
ld [$ffed], a
ld a, $1
ld [wSpriteIndex], a
call SetSpritePosition1
ret
OaksLabScript_1d076:
ld hl, OaksLabTextPointers2
ld a, l
ld [wMapTextPtr], a
ld a, h
ld [wMapTextPtr+1], a
ret
OaksLabTextPointers:
dw OaksLabText1
dw OaksLabText2
dw OaksLabText3
dw OaksLabText4
dw OaksLabText5
dw OaksLabText6
dw OaksLabText7
dw OaksLabText8
dw OaksLabText9
dw OaksLabText10
dw OaksLabText11
dw OaksLabText12
dw OaksLabText13
dw OaksLabText14
dw OaksLabText15
dw OaksLabText16
dw OaksLabText17
dw OaksLabText18
dw OaksLabText19
dw OaksLabText20
dw OaksLabText21
dw OaksLabText22
dw OaksLabText23
dw OaksLabText24
dw OaksLabText25
dw OaksLabText26
dw OaksLabText27
OaksLabTextPointers2:
dw OaksLabText1
dw OaksLabText2
dw OaksLabText3
dw OaksLabText4
dw OaksLabText5
dw OaksLabText6
dw OaksLabText7
dw OaksLabText8
dw OaksLabText9
dw OaksLabText10
dw OaksLabText11
OaksLabText1:
TX_ASM
CheckEvent EVENT_FOLLOWED_OAK_INTO_LAB_2
jr nz, .asm_1d0de
ld hl, OaksLabGaryText1
call PrintText
jr .asm_1d0f0
.asm_1d0de
bit 2, a
jr nz, .asm_1d0ea
ld hl, OaksLabText40
call PrintText
jr .asm_1d0f0
.asm_1d0ea
ld hl, OaksLabText41
call PrintText
.asm_1d0f0
jp TextScriptEnd
OaksLabGaryText1:
TX_FAR _OaksLabGaryText1
db "@"
OaksLabText40:
TX_FAR _OaksLabText40
db "@"
OaksLabText41:
TX_FAR _OaksLabText41
db "@"
OaksLabText2:
TX_ASM
ld a, STARTER2
ld [wRivalStarterTemp], a
ld a, $3
ld [wRivalStarterBallSpriteIndex], a
ld a, STARTER1
ld b, $2
jr OaksLabScript_1d133
OaksLabText3:
TX_ASM
ld a, STARTER3
ld [wRivalStarterTemp], a
ld a, $4
ld [wRivalStarterBallSpriteIndex], a
ld a, STARTER2
ld b, $3
jr OaksLabScript_1d133
OaksLabText4:
TX_ASM
ld a, STARTER1
ld [wRivalStarterTemp], a
ld a, $2
ld [wRivalStarterBallSpriteIndex], a
ld a, STARTER3
ld b, $4
OaksLabScript_1d133:
ld [wcf91], a
ld [wd11e], a
ld a, b
ld [wSpriteIndex], a
CheckEvent EVENT_GOT_STARTER
jp nz, OaksLabScript_1d22d
CheckEventReuseA EVENT_OAK_ASKED_TO_CHOOSE_MON
jr nz, OaksLabScript_1d157
ld hl, OaksLabText39
call PrintText
jp TextScriptEnd
OaksLabText39:
TX_FAR _OaksLabText39
db "@"
OaksLabScript_1d157:
;Short-circuit if we picked the "wrong" ball
ld a, [wSpriteIndex]
cp $3
jr nz, OaksLabLookAtCharmander
ld a, $5
ld [H_SPRITEINDEX], a
ld a, $9
ld [H_SPRITEDATAOFFSET], a
call GetPointerWithinSpriteStateData1
ld [hl], SPRITE_FACING_DOWN
ld a, $1
ld [H_SPRITEINDEX], a
ld a, $9
ld [H_SPRITEDATAOFFSET], a
call GetPointerWithinSpriteStateData1
ld [hl], SPRITE_FACING_RIGHT
ld hl, wd730
set 6, [hl]
predef StarterDex
ld hl, wd730
res 6, [hl]
call ReloadMapData
ld c, 10
call DelayFrames
jr OaksLabLookAtSquirtle
OaksLabLookAtCharmander:
ld hl, OaksLabCharmanderText
call PrintText
jp TextScriptEnd
OaksLabCharmanderText:
TX_FAR _OaksLabCharmanderText
db "@"
OaksLabLookAtSquirtle:
ld hl, OaksLabSquirtleText
jr OaksLabMonChoiceMenu
OaksLabSquirtleText:
TX_FAR _OaksLabSquirtleText
db "@"
OaksLabLookAtBulbasaur:
ld hl, OaksLabBulbasaurText
jr OaksLabMonChoiceMenu
OaksLabBulbasaurText:
TX_FAR _OaksLabBulbasaurText
db "@"
OaksLabMonChoiceMenu:
call PrintText
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
call YesNoChoice ; yes/no menu
ld a, [wCurrentMenuItem]
and a
jr nz, OaksLabMonChoiceEnd
ld a, [wcf91]
ld [wPlayerStarter], a
ld [wd11e], a
call GetMonName
ld a, [wSpriteIndex]
cp $2
jr nz, .asm_1d1db
ld a, HS_STARTER_BALL_1
jr .asm_1d1e5
.asm_1d1db
cp $3
jr nz, .asm_1d1e3
ld a, HS_STARTER_BALL_2
jr .asm_1d1e5
.asm_1d1e3
ld a, HS_STARTER_BALL_3
.asm_1d1e5
ld [wMissableObjectIndex], a
predef HideObject
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld hl, OaksLabMonEnergeticText
call PrintText
ld hl, OaksLabReceivedMonText
call PrintText
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
ld a, 5
ld [wCurEnemyLVL], a
ld a, [wcf91]
ld [wd11e], a
call AddPartyMon
ld hl, wd72e
set 3, [hl]
ld a, $fc
ld [wJoyIgnore], a
ld a, $8
ld [wOaksLabCurScript], a
OaksLabMonChoiceEnd:
jp TextScriptEnd
OaksLabMonEnergeticText:
TX_FAR _OaksLabMonEnergeticText
db "@"
OaksLabReceivedMonText:
TX_FAR _OaksLabReceivedMonText
TX_SFX_KEY_ITEM
db "@"
OaksLabScript_1d22d:
ld a, $5
ld [H_SPRITEINDEX], a
ld a, $9
ld [H_SPRITEDATAOFFSET], a
call GetPointerWithinSpriteStateData1
ld [hl], $0
ld hl, OaksLabLastMonText
call PrintText
jp TextScriptEnd
OaksLabLastMonText:
TX_FAR _OaksLabLastMonText
db "@"
OaksLabText32:
OaksLabText5:
TX_ASM
CheckEvent EVENT_PALLET_AFTER_GETTING_POKEBALLS
jr nz, .asm_1d266
ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
ld a, [wNumSetBits]
cp 2
jr c, .asm_1d279
CheckEvent EVENT_GOT_POKEDEX
jr z, .asm_1d279
.asm_1d266
ld hl, OaksLabText_1d31d
call PrintText
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a