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
|
HandleRedEvoModeCollision: ; 0x20581
ld a, [wSpecialModeCollisionID]
cp SPECIAL_COLLISION_VOLTORB
jp z, HandleVoltorbCollision_EvolutionMode
cp SPECIAL_COLLISION_STARYU_ALLEY_TRIGGER
jp z, HandleStaryuAlleyTriggerCollision_EvolutionMode
cp SPECIAL_COLLISION_BELLSPROUT
jp z, HandleBellsproutCollision_EvolutionMode
cp SPECIAL_COLLISION_STARYU
jp z, HandleStaryuCollision_EvolutionMode
cp SPECIAL_COLLISION_LEFT_DIGLETT
jp z, HandleLeftDiglettCollision_EvolutionMode
cp SPECIAL_COLLISION_RIGHT_DIGLETT
jp z, HandleRightDiglettCollision_EvolutionMode
cp SPECIAL_COLLISION_LEFT_BONUS_MULTIPLIER
jp z, HandleLeftBonusMultiplierCollision_EvolutionMode_RedField
cp SPECIAL_COLLISION_RIGHT_BONUS_MULTIPLIER
jp z, HandleRightBonusMultiplierCollision_EvolutionMode_RedField
cp SPECIAL_COLLISION_BALL_UPGRADE
jp z, HandleBallUpgradeCollision_EvolutionMode_RedField
cp SPECIAL_COLLISION_SPINNER
jp z, HandleSpinnerCollision_EvolutionMode_RedField
cp SPECIAL_COLLISION_SLOT_HOLE
jp z, HandleSlotCaveCollision_EvolutionMode_RedField
cp SPECIAL_COLLISION_RIGHT_TRIGGER
jp z, HandleRightTriggerCollision_EvolutionMode_RedField
cp SPECIAL_COLLISION_LEFT_TRIGGER
jp z, HandleLeftTriggerCollision_EvolutionMode_RedField
cp SPECIAL_COLLISION_NOTHING
jr z, .noCollision
scf
ret
.noCollision
call CheckIfEvolutionModeTimerExpired_RedField
ld a, [wSpecialModeState]
call CallInFollowingTable
EvolutionModeCallTable_RedField: ; 0x205d4
padded_dab HandleEvolutionMode_RedField
padded_dab CompleteEvolutionMode_RedField
padded_dab FailEvolutionMode_RedField
HandleEvolutionMode_RedField: ; 0x205e0
; 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_205f0
add $c
.asm_205f0
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 Func_20651
ld a, [wd558]
ld [wIndicatorStates + 2], a
ld a, [wd559]
ld [wIndicatorStates + 3], a
ld [wIndicatorStates + 10], a
ld a, [wCurrentStage]
bit 0, a
callba nz, ClearAllRedIndicators
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_2064f
ld a, BANK(StageRedFieldBottomOBJPalette6)
ld hl, StageRedFieldBottomOBJPalette6
ld de, $0070
ld bc, $0008
call Func_7dc
.asm_2064f
scf
ret
Func_20651: ; 0x20651
ld a, [wCurrentStage]
bit 0, a
jr z, .asm_20681
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
.asm_20681
ld a, [wd554]
inc a
ld [wd554], a
cp $1
jr nz, .asm_20693
lb de, $07, $28
call PlaySoundEffect
ret
.asm_20693
cp $2
jr nz, .asm_2069e
lb de, $07, $44
call PlaySoundEffect
ret
.asm_2069e
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 + 10], a
ld [wIndicatorStates + 8], a
ld [wIndicatorStates + 13], a
ld [wIndicatorStates + 14], a
ld [wIndicatorStates + 11], a
ld [wIndicatorStates + 12], 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_20700
ld a, BANK(StageRedFieldBottomOBJPalette7)
ld hl, StageRedFieldBottomOBJPalette7
ld de, $0078
ld bc, $0008
call Func_7dc
.asm_20700
callba LoadSlotCaveCoverGraphics_RedField
ret
CompleteEvolutionMode_RedField: ; 0x2070b
callba RestoreBallSaverAfterCatchEmMode
callba PlaceEvolutionInParty
callba ConcludeEvolutionMode
ld de, MUSIC_RED_FIELD
call PlaySong
ld hl, wNumPokemonEvolvedInBallBonus
call Increment_Max100
callba SetPokemonOwnedFlag
ld a, [wPreviousNumPokeballs]
cp $3
ret z
add $2
cp $3
jr c, .asm_2074d
ld a, $3
.asm_2074d
ld [wNumPokeballs], a
ld a, $80
ld [wPokeballBlinkingCounter], a
scf
ret
FailEvolutionMode_RedField: ; 0x20757
ld a, [wBottomTextEnabled]
and a
ret nz
call FillBottomMessageBufferWithBlackTile
callba RestoreBallSaverAfterCatchEmMode
callba ConcludeEvolutionMode
ld de, MUSIC_RED_FIELD
call PlaySong
scf
ret
CheckIfEvolutionModeTimerExpired_RedField: ; 0x2077b
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_RedField
.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 + 10], a
ld [wIndicatorStates + 8], a
ld [wIndicatorStates + 13], a
ld [wIndicatorStates + 14], a
ld [wIndicatorStates + 11], a
ld [wIndicatorStates + 12], 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_207f5
callba ClearAllRedIndicators
callba LoadSlotCaveCoverGraphics_RedField
.asm_207f5
callba StopTimer
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld hl, wScrollingText1
ld de, EvolutionFailedText
call LoadScrollingText
ret
HandleVoltorbCollision_EvolutionMode: ; 0x2080f
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_RedField
jp EvolutionTrinketNotFound_RedField
.disabled
scf
ret
HandleStaryuAlleyTriggerCollision_EvolutionMode: ; 0x20839
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 2]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 2], a
ld a, [wd563]
and a
ld a, $0
ld [wd563], a
jp nz, CreateEvolutionTrinket_RedField
jp EvolutionTrinketNotFound_RedField
.disabled
scf
ret
HandleBellsproutCollision_EvolutionMode: ; 0x2085a
ld bc, $0007
ld de, $5000
call AddBCDEToJackpot
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_RedField
jp EvolutionTrinketNotFound_RedField
.disabled
scf
ret
HandleStaryuCollision_EvolutionMode: ; 0x20887
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 8]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 8], a
ld a, [wd561]
and a
ld a, $0
ld [wd561], a
jp nz, CreateEvolutionTrinket_RedField
jp EvolutionTrinketNotFound_RedField
.disabled
scf
ret
HandleLeftDiglettCollision_EvolutionMode: ; 0x208a8
ld a, [wEvolutionObjectsDisabled]
and a
jr nz, .disabled
ld a, [wIndicatorStates + 13]
and a
jr z, .disabled
xor a
ld [wIndicatorStates + 13], a ;flick off indicator
ld a, [wd55d]
and a
ld a, $0
ld [wd55d], a ;make ??? 0
jp nz, CreateEvolutionTrinket_RedField
jp EvolutionTrinketNotFound_RedField
.disabled
scf
ret
HandleRightDiglettCollision_EvolutionMode: ; 0x208c9
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_RedField
jp EvolutionTrinketNotFound_RedField
.disabled
scf
ret
HandleLeftBonusMultiplierCollision_EvolutionMode_RedField: ; 0x208ea
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_RedField
jp EvolutionTrinketNotFound_RedField
.disabled
scf
ret
HandleRightBonusMultiplierCollision_EvolutionMode_RedField: ; 0x2090b
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_RedField
jp EvolutionTrinketNotFound_RedField
.disabled
scf
ret
HandleBallUpgradeCollision_EvolutionMode_RedField: ; 0x2092c
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_RedField
jp EvolutionTrinketNotFound_RedField
.disabled
scf
ret
HandleSpinnerCollision_EvolutionMode_RedField: ; 0x2094d
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_RedField
jp EvolutionTrinketNotFound_RedField
.disabled
scf
ret
CreateEvolutionTrinket_RedField: ; 0x20977
lb de, $07, $46
call PlaySoundEffect
call ChooseNextEvolutionTrinketLocation_RedField
ld a, [wCurrentEvolutionType]
ld [hl], a
ld [wEvolutionObjectsDisabled], a
ld a, [wIndicatorStates + 2]
ld [wd558], a
ld a, [wIndicatorStates + 3]
ld [wd559], a
xor a
ld [wIndicatorStates + 2], a
ld [wIndicatorStates + 3], a
ld [wIndicatorStates + 10], a
ld a, [wCurrentStage]
bit 0, a
callba nz, ClearAllRedIndicators
ld a, [hGameBoyColorFlag]
and a
jr z, .asm_209bf
ld a, BANK(EvolutionTrinketPalettes)
ld hl, EvolutionTrinketPalettes
ld de, $0070
ld bc, $0010
call Func_7dc
.asm_209bf
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_RedField: ; 0x209eb
lb de, $07, $47
call PlaySoundEffect
ld a, $1
ld [wEvolutionObjectsDisabled], a
ld a, $80
ld [wIndicatorStates], a
ld [wIndicatorStates + 1], a
ld a, [wIndicatorStates + 2]
ld [wd558], a
ld a, [wIndicatorStates + 3]
ld [wd559], a
xor a
ld [wIndicatorStates + 2], a
ld [wIndicatorStates + 3], a
ld [wIndicatorStates + 10], a
ld a, [wCurrentStage]
bit 0, a
callba nz, ClearAllRedIndicators
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_20a50
ld de, ItemNotFoundText
.asm_20a50
call LoadScrollingText
scf
ret
EndEvolutionTrinketCooldown_RedField: ; 0x20a55
ld a, [wEvolutionObjectsDisabled]
and a
jr z, .evolutionObjectsEnabled
ld a, [wIndicatorStates + 1]
and a
jr z, .evolutionObjectsEnabled
jr RecoverPokemon_RedField
.evolutionObjectsEnabled
scf
ret
HandleRightTriggerCollision_EvolutionMode_RedField: ; 0x20a65
ld a, [wEvolutionObjectsDisabled]
and a
jr z, .evolutionObjectsEnabled
ld a, [wIndicatorStates + 1]
and a
jr z, .evolutionObjectsEnabled
ld bc, TenThousandPoints
callba AddBigBCD6FromQueue
jr RecoverPokemon_RedField
.evolutionObjectsEnabled
scf
ret
HandleLeftTriggerCollision_EvolutionMode_RedField: ; 0x20a82
ld a, [wEvolutionObjectsDisabled]
and a
jr z, .evolutionObjectsEnabled
ld a, [wIndicatorStates]
and a
jr z, .evolutionObjectsEnabled
ld bc, TenThousandPoints
callba AddBigBCD6FromQueue
jr RecoverPokemon_RedField
.evolutionObjectsEnabled
scf
ret
RecoverPokemon_RedField:
xor a
ld [wIndicatorStates], a
ld [wIndicatorStates + 1], a
ld [wEvolutionObjectsDisabled], a
ld a, [wd558]
ld [wIndicatorStates + 2], a
ld a, [wd559]
ld [wIndicatorStates + 3], a
ld [wIndicatorStates + 10], a
ld a, [wCurrentStage]
bit 0, a
callba nz, ClearAllRedIndicators
ld a, [hGameBoyColorFlag]
and a
jr z, .asm_20ada
ld a, BANK(StageRedFieldBottomOBJPalette6)
ld hl, StageRedFieldBottomOBJPalette6
ld de, $0070
ld bc, $0008
call Func_7dc
.asm_20ada
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld a, [wCurrentEvolutionType]
cp EVO_EXPERIENCE
ld de, PokemonRecoveredText
jr z, .asm_20aed
ld de, TryNextPlaceText
.asm_20aed
ld hl, wScrollingText1
call LoadScrollingText
scf
ret
ChooseNextEvolutionTrinketLocation_RedField: ; 0x20af5
ld a, $11
call RandomRange
ld c, a
ld b, $0
ld hl, wd566
add hl, bc
ret
HandleSlotCaveCollision_EvolutionMode_RedField: ; 0x20b02
ld a, [wCurrentEvolutionMon]
cp $ff
jr nz, .asm_20b0c
ld a, [wCurrentCatchEmMon]
.asm_20b0c
ld c, a
ld b, $0
sla c
rl b
add c
ld c, a
jr nc, .asm_20b18
inc b
.asm_20b18
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_20b80
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_20b80
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
|