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
|
HandleBlueEvoModeCollision: ; 0x20bae
ld a, [wSpecialModeCollisionID]
cp SPECIAL_COLLISION_SHELLDER
jp z, HandleShellderCollision_EvolutionMode
cp SPECIAL_COLLISION_LEFT_TRIGGER
jp z, HandleLeftTriggerCollision_EvolutionMode_BlueField
cp SPECIAL_COLLISION_CLOYSTER
jp z, HandleCloysterCollision_EvolutionMode
cp SPECIAL_COLLISION_SLOWPOKE
jp z, HandleSlowpokeCollision_EvolutionMode
cp SPECIAL_COLLISION_POLIWAG
jp z, HandlePoliwagCollision_EvolutionMode
cp SPECIAL_COLLISION_PSYDUCK
jp z, HandlePsyduckCollision_EvolutionMode
cp SPECIAL_COLLISION_LEFT_BONUS_MULTIPLIER
jp z, HandleLeftBonusMultiplierCollision_EvolutionMode_BlueField
cp SPECIAL_COLLISION_RIGHT_BONUS_MULTIPLIER
jp z, HandleRightBonusMultiplierCollision_EvolutionMode_BlueField
cp SPECIAL_COLLISION_BALL_UPGRADE
jp z, HandleBallUpgradeCollision_EvolutionMode_BlueField
cp SPECIAL_COLLISION_SPINNER
jp z, HandleSpinnerCollision_EvolutionMode_BlueField
cp SPECIAL_COLLISION_SLOT_HOLE
jp z, HandleSlotCaveCollision_EvolutionMode_BlueField
cp SPECIAL_COLLISION_RIGHT_TRIGGER
jp z, HandleRightTriggerCollision_EvolutionMode_BlueField
cp SPECIAL_COLLISION_NOTHING
jr z, .noCollision
scf
ret
.noCollision
call CheckIfEvolutionModeTimerExpired_BlueField
ld a, [wSpecialModeState]
call CallInFollowingTable
EvolutionModeCallTable_BlueField: ; 0x20bfc
padded_dab HandleEvolutionMode_BlueField
padded_dab CompleteEvolutionMode_BlueField
padded_dab FailEvolutionMode_BlueField
HandleEvolutionMode_BlueField: ; 0x20c08
; Handles the logic for what happens when an evolution trinket is collected.
ld a, [wCurrentStage]
ld b, a
ld a, [wCollidedPointIndex]
and a
ret z
dec a
bit 0, b
jr z, .asm_20c18
add $c
.asm_20c18
ld c, a
ld b, $0
ld hl, wd566
add hl, bc
ld a, [hl]
and a
ret z
xor a
ld [hl], a
ld [wEvolutionObjectsDisabled], a
call ProgressEvolution
ld a, [wd558]
ld [wIndicatorStates], a
ld a, [wd559]
ld [wIndicatorStates + 3], a
ld a, [wCurrentStage]
bit 0, a
callba nz, Func_1c2cb
ld bc, OneMillionPoints
callba AddBigBCD6FromQueue
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld de, YeahYouGotItText
ld hl, wScrollingText1
call LoadScrollingText
ld a, [hGameBoyColorFlag]
and a
jr z, .asm_20c74
ld a, BANK(StageBlueFieldBottomOBJPalette6)
ld hl, StageBlueFieldBottomOBJPalette6
ld de, $0070
ld bc, $0008
call Func_7dc
.asm_20c74
scf
ret
ProgressEvolution: ; 0x20c76
ld a, [wCurrentStage]
bit 0, a
jr z, .top
ld a, [wCurrentEvolutionType]
dec a
ld c, a
ld b, $0
swap c
sla c
ld hl, EvolutionProgressIconsGfx
add hl, bc
ld a, [wd554]
ld c, a
ld b, $0
swap c
sla c
push hl
ld hl, vTilesSH tile $2e
add hl, bc
ld d, h
ld e, l
pop hl
ld bc, $0020
ld a, BANK(EvolutionProgressIconsGfx)
call LoadVRAMData
.top
ld a, [wd554]
inc a
ld [wd554], a
cp $1
jr nz, .asm_20cb8
lb de, $07, $28
call PlaySoundEffect
ret
.asm_20cb8
cp $2
jr nz, .asm_20cc3
lb de, $07, $44
call PlaySoundEffect
ret
.asm_20cc3
cp $3
ret nz
lb de, $07, $45
call PlaySoundEffect
ld a, $1
ld [wSlotIsOpen], a
ld a, $80
ld [wIndicatorStates + 4], a
xor a
ld [wIndicatorStates + 9], a
ld [wIndicatorStates + 2], a
ld [wIndicatorStates + 3], a
ld [wIndicatorStates + 8], a
ld [wIndicatorStates + 13], a
ld [wIndicatorStates + 14], a
ld [wIndicatorStates + 11], a
ld [wIndicatorStates + 12], a
ld [wIndicatorStates + 10], a
ld [wIndicatorStates + 6], a
ld [wIndicatorStates + 7], a
ld [wd558], a
ld [wd559], a
ld a, [wCurrentStage]
bit 0, a
ret z
ld a, BANK(StageSharedBonusSlotGlowGfx)
ld hl, StageSharedBonusSlotGlowGfx + $60
ld de, vTilesOB tile $20
ld bc, $00e0
call LoadVRAMData
ld a, [hGameBoyColorFlag]
and a
jr z, .asm_20d25
ld a, BANK(StageBlueFieldBottomOBJPalette7)
ld hl, StageBlueFieldBottomOBJPalette7
ld de, $0078
ld bc, $0008
call Func_7dc
.asm_20d25
callba LoadSlotCaveCoverGraphics_BlueField
ret
CompleteEvolutionMode_BlueField: ; 0x20d30
callba RestoreBallSaverAfterCatchEmMode
callba PlaceEvolutionInParty
callba ConcludeEvolutionMode
ld de, MUSIC_BLUE_FIELD
call PlaySong
ld hl, wNumPokemonEvolvedInBallBonus
call Increment_Max100
callba SetPokemonOwnedFlag
ld a, [wPreviousNumPokeballs]
cp $3
ret z
add $2
cp $3
jr c, .DontClampBalls
ld a, $3
.DontClampBalls
ld [wNumPokeballs], a
ld a, $80
ld [wPokeballBlinkingCounter], a
scf
ret
FailEvolutionMode_BlueField: ; 0x20d7c
ld a, [wBottomTextEnabled]
and a
ret nz
call FillBottomMessageBufferWithBlackTile
callba RestoreBallSaverAfterCatchEmMode
callba ConcludeEvolutionMode
ld de, MUSIC_BLUE_FIELD
call PlaySong
scf
ret
CheckIfEvolutionModeTimerExpired_BlueField: ; 0x20da0
ld hl, wEvolutionTrinketCooldownFrames
ld a, [hli]
ld c, a
ld b, [hl]
or b
jr z, .cooldownNotEnding
dec bc
ld a, b
ld [hld], a
ld [hl], c
or c
jr nz, .cooldownNotEnding
call EndEvolutionTrinketCooldown_BlueField
.cooldownNotEnding
callba PlayLowTimeSfx
ld a, [wTimeRanOut]
and a
ret z
xor a
ld [wTimeRanOut], a
ld a, $2
ld [wSpecialModeState], a
xor a
ld [wSlotIsOpen], a
ld hl, wIndicatorStates
ld [wIndicatorStates + 4], a
ld [wIndicatorStates + 9], a
ld [wIndicatorStates + 2], a
ld [wIndicatorStates + 3], a
ld [wIndicatorStates + 8], a
ld [wIndicatorStates + 13], a
ld [wIndicatorStates + 14], a
ld [wIndicatorStates + 11], a
ld [wIndicatorStates + 12], a
ld [wIndicatorStates + 10], a
ld [wIndicatorStates + 6], a
ld [wIndicatorStates + 7], a
ld [wd558], a
ld [wd559], a
ld [wEvolutionObjectsDisabled], a
ld a, [wCurrentStage]
bit 0, a
jr z, .asm_20e1a
callba Func_1c2cb
callba LoadSlotCaveCoverGraphics_BlueField
.asm_20e1a
callba StopTimer
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld hl, wScrollingText1
ld de, EvolutionFailedText
call LoadScrollingText
ret
HandleShellderCollision_EvolutionMode: ; 0x20e34
ld bc, $0001
ld de, $5000
call AddBCDEToJackpot
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 9]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 9], a
ld a, [wd55c]
and a
ld a, $0
ld [wd55c], a
jp nz, CreateEvolutionTrinket_BlueField
jp EvolutionTrinketNotFound_BlueField
.disabled
scf
ret
HandleCloysterCollision_EvolutionMode: ; 0x20e5e
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 3]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 3], a
ld [wIndicatorStates + 10], a
ld a, [wd562]
and a
ld a, $0
ld [wd562], a
jp nz, CreateEvolutionTrinket_BlueField
jp EvolutionTrinketNotFound_BlueField
.disabled
scf
ret
HandleSlowpokeCollision_EvolutionMode: ; 0x20e82
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 8]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 8], a
ld [wIndicatorStates + 2], a
ld a, [wd561]
and a
ld a, $0
ld [wd561], a
jp nz, CreateEvolutionTrinket_BlueField
jp EvolutionTrinketNotFound_BlueField
.disabled
scf
ret
HandlePoliwagCollision_EvolutionMode: ; 0x20ea6
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 13]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 13], a
ld a, [wd55d]
and a
ld a, $0
ld [wd55d], a
jp nz, CreateEvolutionTrinket_BlueField
jp EvolutionTrinketNotFound_BlueField
.disabled
scf
ret
HandlePsyduckCollision_EvolutionMode: ; 0x20ec7
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 14]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 14], a
ld a, [wd55e]
and a
ld a, $0
ld [wd55e], a
jp nz, CreateEvolutionTrinket_BlueField
jp EvolutionTrinketNotFound_BlueField
.disabled
scf
ret
HandleLeftBonusMultiplierCollision_EvolutionMode_BlueField: ; 0x20ee8
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 11]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 11], a
ld a, [wd55f]
and a
ld a, $0
ld [wd55f], a
jp nz, CreateEvolutionTrinket_BlueField
jp EvolutionTrinketNotFound_BlueField
.disabled
scf
ret
HandleRightBonusMultiplierCollision_EvolutionMode_BlueField: ; 0x20f09
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 12]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 12], a
ld a, [wd560]
and a
ld a, $0
ld [wd560], a
jp nz, CreateEvolutionTrinket_BlueField
jp EvolutionTrinketNotFound_BlueField
.disabled
scf
ret
HandleBallUpgradeCollision_EvolutionMode_BlueField: ; 0x20f2a
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 6]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 6], a
ld a, [wd565]
and a
ld a, $0
ld [wd565], a
jp nz, CreateEvolutionTrinket_BlueField
jp EvolutionTrinketNotFound_BlueField
.disabled
scf
ret
HandleSpinnerCollision_EvolutionMode_BlueField: ; 0x20f4b
ld bc, $0000
ld de, $1500
call AddBCDEToJackpot
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 7]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 7], a
ld a, [wd564]
and a
ld a, $0
ld [wd564], a
jp nz, CreateEvolutionTrinket_BlueField
jp EvolutionTrinketNotFound_BlueField
.disabled
scf
ret
CreateEvolutionTrinket_BlueField: ; 0x20f75
; Makes an evolution trinket appear somewhere randomly on the pinball table.
lb de, $07, $46
call PlaySoundEffect
call ChooseNextEvolutionTrinketLocation_BlueField
ld a, [wCurrentEvolutionType]
ld [hl], a
ld [wEvolutionObjectsDisabled], a
ld a, [wIndicatorStates]
ld [wd558], a
ld a, [wIndicatorStates + 3]
ld [wd559], a
ld a, [wIndicatorStates + 2]
ld [wIndicatorState2Backup], a
xor a
ld [wIndicatorStates], a
ld [wIndicatorStates + 2], a
ld [wIndicatorStates + 3], a
ld a, [wCurrentStage]
bit 0, a
callba nz, Func_1c2cb
ld a, [hGameBoyColorFlag]
and a
jr z, .asm_20fc3
ld a, BANK(EvolutionTrinketPalettes)
ld hl, EvolutionTrinketPalettes
ld de, $0070
ld bc, $0010
call Func_7dc
.asm_20fc3
ld bc, ThreeHundredThousandPoints
callba AddBigBCD6FromQueue
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld a, [wCurrentEvolutionType]
dec a
ld c, a
ld b, $0
sla c
ld hl, EvolutionTypeGetTextPointers
add hl, bc
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
ld hl, wScrollingText1
call LoadScrollingText
scf
ret
EvolutionTrinketNotFound_BlueField: ; 0x20fef
; Shows that an evolution trinket isn't available from hitting whichever object that generated this event.
; Disables the ability to find more evolution trinkets for several seconds.
lb de, $07, $47
call PlaySoundEffect
ld a, $1
ld [wEvolutionObjectsDisabled], a
ld a, [wIndicatorStates]
ld [wd558], a
ld a, $80
ld [wIndicatorStates], a
ld [wIndicatorStates + 1], a
ld a, [wIndicatorStates + 3]
ld [wd559], a
ld a, [wIndicatorStates + 2]
ld [wIndicatorState2Backup], a
xor a
ld [wIndicatorStates + 2], a
ld [wIndicatorStates + 3], a
ld a, [wCurrentStage]
bit 0, a
callba nz, Func_1c2cb
ld a, $58
ld [wEvolutionTrinketCooldownFrames], a
ld a, $2
ld [wEvolutionTrinketCooldownFrames + 1], a
ld bc, ThreeHundredThousandPoints
callba AddBigBCD6FromQueue
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld hl, wScrollingText1
ld a, [wCurrentEvolutionType]
cp EVO_EXPERIENCE
ld de, PokemonIsTiredText
jr z, .asm_21057
ld de, ItemNotFoundText
.asm_21057
call LoadScrollingText
scf
ret
HandleRightTriggerCollision_EvolutionMode_BlueField: ; 0x2105c
ld a, [wEvolutionObjectsDisabled]
and a
jr z, .evolutionObjectsEnabled
ld a, [wIndicatorStates + 1]
and a
jr z, .evolutionObjectsEnabled
ld bc, TenThousandPoints
callba AddBigBCD6FromQueue
jr RecoverPokemon_BlueField
.evolutionObjectsEnabled
scf
ret
EndEvolutionTrinketCooldown_BlueField: ; 0x21079
ld a, [wEvolutionObjectsDisabled]
and a
jr z, .evolutionObjectsEnabled
ld a, [wIndicatorStates + 1]
and a
jr z, .evolutionObjectsEnabled
jr RecoverPokemon_BlueField
.evolutionObjectsEnabled
scf
ret
HandleLeftTriggerCollision_EvolutionMode_BlueField: ; 0x21089
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates]
and a
jr z, .asm_210a8
xor a
ld [wIndicatorStates], a
ld a, [wd563]
and a
ld a, $0
ld [wd563], a
jp nz, CreateEvolutionTrinket_BlueField
jp EvolutionTrinketNotFound_BlueField
.asm_210a8
scf
ret
.disabled
ld a, [wEvolutionObjectsDisabled]
and a
jr z, .evolutionObjectsEnabled
ld a, [wIndicatorStates]
and a
jr z, .evolutionObjectsEnabled
ld bc, TenThousandPoints
callba AddBigBCD6FromQueue
jr RecoverPokemon_BlueField
.evolutionObjectsEnabled
scf
ret
RecoverPokemon_BlueField:
xor a
ld [wIndicatorStates + 1], a
ld [wEvolutionObjectsDisabled], a
ld a, [wd558]
ld [wIndicatorStates], a
ld a, [wd559]
ld [wIndicatorStates + 3], a
ld a, [wIndicatorState2Backup]
ld [wIndicatorStates + 2], a
ld a, [wCurrentStage]
bit 0, a
callba nz, Func_1c2cb
ld a, [hGameBoyColorFlag]
and a
jr z, .asm_21102
ld a, BANK(StageBlueFieldBottomOBJPalette6)
ld hl, StageBlueFieldBottomOBJPalette6
ld de, $0070
ld bc, $0008
call Func_7dc
.asm_21102
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld a, [wCurrentEvolutionType]
cp EVO_EXPERIENCE
ld de, PokemonRecoveredText
jr z, .asm_21115
ld de, TryNextPlaceText
.asm_21115
ld hl, wScrollingText1
call LoadScrollingText
scf
ret
ChooseNextEvolutionTrinketLocation_BlueField: ; 0x2111d
ld a, $11
call RandomRange
ld c, a
ld b, $0
ld hl, wd566
add hl, bc
ret
HandleSlotCaveCollision_EvolutionMode_BlueField: ; 0x2112a
ld a, [wCurrentEvolutionMon]
cp $ff
jr nz, .asm_21134
ld a, [wCurrentCatchEmMon]
.asm_21134
ld c, a
ld b, $0
sla c
rl b
add c
ld c, a
jr nc, .asm_21140
inc b
.asm_21140
push bc
ld hl, MonBillboardPicPointers
add hl, bc
ld a, Bank(MonBillboardPicPointers)
call ReadByteFromBank
inc hl
ld c, a
ld a, Bank(MonBillboardPicPointers)
call ReadByteFromBank
inc hl
ld b, a
ld a, Bank(MonBillboardPicPointers)
call ReadByteFromBank
ld h, b
ld l, c
ld de, vTilesSH tile $10
ld bc, $0180
call LoadOrCopyVRAMData
pop bc
ld a, [hGameBoyColorFlag]
and a
jr z, .asm_211a8
push bc
ld hl, MonBillboardPaletteMapPointers
add hl, bc
ld a, Bank(MonBillboardPaletteMapPointers)
call ReadByteFromBank
inc hl
ld e, a
ld a, Bank(MonBillboardPaletteMapPointers)
call ReadByteFromBank
inc hl
ld d, a
ld a, Bank(MonBillboardPaletteMapPointers)
call ReadByteFromBank
hlCoord 7, 4, vBGMap
call LoadBillboardPaletteMap
pop bc
ld hl, MonBillboardPalettePointers
add hl, bc
ld a, Bank(MonBillboardPalettePointers)
call ReadByteFromBank
inc hl
ld e, a
ld a, Bank(MonBillboardPalettePointers)
call ReadByteFromBank
inc hl
ld d, a
ld a, Bank(MonBillboardPalettePointers)
call ReadByteFromBank
ld bc, $10b0
ld hl, rBGPI
call Func_8e1
.asm_211a8
callba ShowMonEvolvedText
call MainLoopUntilTextIsClear
ld de, MUSIC_NOTHING
call PlaySong
rst AdvanceFrame
lb de, $2d, $26
call PlaySoundEffect
callba ShowJackpotText
call MainLoopUntilTextIsClear
ld a, $1
ld [wSpecialModeState], a
scf
ret
|