-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.asm
6098 lines (5303 loc) · 93.6 KB
/
main.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
INCLUDE "includes.asm"
SECTION "bank1", ROMX, BANK[$1]
PlaceWaitingText:: ; 4000
hlcoord 3, 10
ld b, 1
ld c, 11
ld a, [wBattleMode]
and a
jr z, .notinbattle
call TextBox
jr .proceed
.notinbattle
predef Predef_LinkTextbox
.proceed
hlcoord 4, 11
ld de, .Waiting
call PlaceString
ld c, 50
jp DelayFrames
.Waiting: ; 4025
db "Waiting...!@"
LoadPushOAM:: ; 4031
ld c, hPushOAM - $ff00
ld b, PushOAMEnd - PushOAM
ld hl, PushOAM
.loop
ld a, [hli]
ld [$ff00+c], a
inc c
dec b
jr nz, .loop
ret
PushOAM: ; 403f
ld a, Sprites / $100
ld [rDMA], a
ld a, (SpritesEnd - Sprites) / 4 ; 40
.loop
dec a
jr nz, .loop
ret
PushOAMEnd
INCLUDE "engine/map_objects.asm"
INCLUDE "engine/intro_menu.asm"
ReanchorBGMap_NoOAMUpdate:: ; 6454
call DelayFrame
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
ld a, [hBGMapMode]
push af
xor a
ld [hBGMapMode], a
call .ReanchorBGMap
pop af
ld [hBGMapMode], a
pop af
ld [hOAMUpdate], a
ld hl, VramState
set 6, [hl]
ret
.ReanchorBGMap:
xor a
ld [hLCDCPointer], a
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
call OverworldTextModeSwitch
ld a, VBGMap1 / $100
call .LoadBGMapAddrIntoHRAM
call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
callba LoadOW_BGPal7
callba ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
xor a
ld [hBGMapMode], a
ld [hWY], a
callba HDMATransfer_FillBGMap0WithTile60 ; no need to farcall
ld a, VBGMap0 / $100
call .LoadBGMapAddrIntoHRAM
xor a
ld [wBGMapAnchor], a
ld a, VBGMap0 / $100
ld [wBGMapAnchor + 1], a
xor a
ld [hSCX], a
ld [hSCY], a
call ApplyBGMapAnchorToObjects
ret
.LoadBGMapAddrIntoHRAM: ; 64b9
ld [hBGMapAddress + 1], a
xor a
ld [hBGMapAddress], a
ret
LoadFonts_NoOAMUpdate:: ; 64bf
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
call .LoadGFX
pop af
ld [hOAMUpdate], a
ret
.LoadGFX:
call LoadFontsExtra
ld a, $90
ld [hWY], a
call SafeUpdateSprites
call LoadStandardFont
ret
HDMATransfer_FillBGMap0WithTile60: ; 64db
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
ld a, $60
ld hl, wDecompressScratch
ld bc, wScratchAttrMap - wDecompressScratch
call ByteFill
ld a, wDecompressScratch / $100
ld [rHDMA1], a
ld a, wDecompressScratch % $100
ld [rHDMA2], a
ld a, (VBGMap0 % $8000) / $100
ld [rHDMA3], a
ld a, (VBGMap0 % $8000) % $100
ld [rHDMA4], a
ld a, $3f
ld [hDMATransfer], a
call DelayFrame
pop af
ld [rSVBK], a
ret
INCLUDE "engine/learn.asm"
CheckNickErrors:: ; 669f
; error-check monster nick before use
; must be a peace offering to gamesharkers
; input: de = nick location
push bc
push de
ld b, PKMN_NAME_LENGTH
.checkchar
; end of nick?
ld a, [de]
cp "@" ; terminator
jr z, .end
; check if this char is a text command
ld hl, .textcommands
dec hl
.loop
; next entry
inc hl
; reached end of commands table?
ld a, [hl]
cp a, -1
jr z, .done
; is the current char between this value (inclusive)...
ld a, [de]
cp [hl]
inc hl
jr c, .loop
; ...and this one?
cp [hl]
jr nc, .loop
; replace it with a "?"
ld a, "?"
ld [de], a
jr .loop
.done
; next char
inc de
; reached end of nick without finding a terminator?
dec b
jr nz, .checkchar
; change nick to "?@"
pop de
push de
ld a, "?"
ld [de], a
inc de
ld a, "@"
ld [de], a
.end
; if the nick has any errors at this point it's out of our hands
pop de
pop bc
ret
.textcommands ; 66cf
; table defining which characters are actually text commands
; format:
; ≥ <
db "<START>", $04 + 1
db "<PLAY_G>", $18 + 1
db $1d, "%" + 1
db $35, "<GREEN>" + 1
db "<ENEMY>", "<ENEMY>" + 1
db $49, "<TM>" + 1
db "<ROCKET>", "┘" + 1
db -1 ; end
INCLUDE "engine/math.asm"
ItemAttributes: ; 67c1
INCLUDE "items/item_attributes.asm"
INCLUDE "engine/npc_movement.asm"
INCLUDE "event/happiness_egg.asm"
INCLUDE "event/special.asm"
Predef1: ; 747a
; not used
ret
SECTION "bank2", ROMX, BANK[$2]
INCLUDE "engine/player_object.asm"
INCLUDE "engine/sine.asm"
INCLUDE "engine/predef.asm"
INCLUDE "engine/color.asm"
SECTION "bank3", ROMX, BANK[$3]
CheckTime:: ; c000
ld a, [TimeOfDay]
ld hl, TimeOfDayTable
ld de, 2
call IsInArray
inc hl
ld c, [hl]
ret c
xor a
ld c, a
ret
TimeOfDayTable: ; c012
db MORN, 1 << MORN
db DAY, 1 << DAY
db NITE, 1 << NITE
db NITE, 1 << NITE
db -1
INCLUDE "engine/specials.asm"
INCLUDE "engine/printnum.asm"
INCLUDE "engine/health.asm"
INCLUDE "event/overworld.asm"
INCLUDE "engine/items.asm"
INCLUDE "engine/player_step.asm"
INCLUDE "engine/anim_hp_bar.asm"
INCLUDE "engine/move_mon.asm"
INCLUDE "engine/billspctop.asm"
GetBreedMon1LevelGrowth: ; e698
ld hl, wBreedMon1Stats
ld de, TempMon
ld bc, BOXMON_STRUCT_LENGTH
call CopyBytes
callab CalcLevel
ld a, [wBreedMon1Level]
ld b, a
ld a, d
ld e, a
sub b
ld d, a
ret
GetBreedMon2LevelGrowth: ; e6b3
ld hl, wBreedMon2Stats
ld de, TempMon
ld bc, BOXMON_STRUCT_LENGTH
call CopyBytes
callab CalcLevel
ld a, [wBreedMon2Level]
ld b, a
ld a, d
ld e, a
sub b
ld d, a
ret
BugContest_SetCaughtContestMon: ; e6ce
ld a, [wContestMon]
and a
jr z, .firstcatch
ld [wd265], a
callba DisplayAlreadyCaughtText
callba DisplayCaughtContestMonStats
lb bc, 14, 7
call PlaceYesNoBox
ret c
.firstcatch
call .generatestats
ld a, [TempEnemyMonSpecies]
ld [wd265], a
call GetPokemonName
ld hl, .caughttext
call PrintText
ret
.generatestats ; e6fd
ld a, [TempEnemyMonSpecies]
ld [CurSpecies], a
ld [CurPartySpecies], a
call GetBaseData
xor a
ld bc, PARTYMON_STRUCT_LENGTH
ld hl, wContestMon
call ByteFill
xor a
ld [MonType], a
ld hl, wContestMon
jp GeneratePartyMonStats
.caughttext ; 0xe71d
; Caught @ !
text_jump UnknownText_0x1c10c0
db "@"
INCLUDE "items/item_effects.asm"
KnowsMove: ; f9ea
ld a, MON_MOVES
call GetPartyParamLocation
ld a, [wPutativeTMHMMove]
ld b, a
ld c, NUM_MOVES
.loop
ld a, [hli]
cp b
jr z, .knows_move
dec c
jr nz, .loop
and a
ret
.knows_move
ld hl, .Text_knows
call PrintText
scf
ret
.Text_knows: ; 0xfa06
; knows @ .
text_jump UnknownText_0x1c5ea8
db "@"
SECTION "bank4", ROMX, BANK[$4]
INCLUDE "engine/pack.asm"
INCLUDE "engine/time.asm"
INCLUDE "engine/tmhm.asm"
INCLUDE "engine/namingscreen.asm"
Script_AbortBugContest: ; 0x122c1
checkflag ENGINE_BUG_CONTEST_TIMER
iffalse .finish
setflag ENGINE_DAILY_BUG_CONTEST
special ContestReturnMons
.finish
end
INCLUDE "event/itemball.asm"
INCLUDE "engine/healmachineanim.asm"
INCLUDE "event/whiteout.asm"
INCLUDE "event/forced_movement.asm"
INCLUDE "event/itemfinder.asm"
INCLUDE "engine/startmenu.asm"
INCLUDE "engine/selectmenu.asm"
INCLUDE "event/elevator.asm"
Special_GiveParkBalls: ; 135db
xor a
ld [wContestMon], a
ld a, 20
ld [wParkBallsRemaining], a
callba StartBugContestTimer
ret
BugCatchingContestBattleScript:: ; 0x135eb
writecode VAR_BATTLETYPE, BATTLETYPE_CONTEST
randomwildmon
startbattle
reloadmapafterbattle
copybytetovar wParkBallsRemaining
iffalse BugCatchingContestOutOfBallsScript
end
BugCatchingContestOverScript:: ; 0x135f8
playsound SFX_ELEVATOR_END
opentext
writetext BugCatchingContestText_BeeepTimesUp
waitbutton
jump BugCatchingContestReturnToGateScript
BugCatchingContestOutOfBallsScript: ; 0x13603
playsound SFX_ELEVATOR_END
opentext
writetext BugCatchingContestText_ContestIsOver
waitbutton
BugCatchingContestReturnToGateScript: ; 0x1360b
closetext
jumpstd bugcontestresultswarp
BugCatchingContestText_BeeepTimesUp: ; 0x1360f
; ANNOUNCER: BEEEP! Time's up!
text_jump UnknownText_0x1bd2ca
db "@"
BugCatchingContestText_ContestIsOver: ; 0x13614
; ANNOUNCER: The Contest is over!
text_jump UnknownText_0x1bd2e7
db "@"
RepelWoreOffScript:: ; 0x13619
opentext
writetext .text
waitbutton
closetext
end
.text ; 0x13620
; REPEL's effect wore off.
text_jump UnknownText_0x1bd308
db "@"
HiddenItemScript:: ; 0x13625
opentext
copybytetovar EngineBuffer3
itemtotext 0, 0
writetext .found_text
giveitem ITEM_FROM_MEM
iffalse .bag_full
callasm SetMemEvent
specialsound
itemnotify
jump .finish
.bag_full ; 0x1363e
buttonsound
writetext .no_room_text
waitbutton
.finish ; 13643
closetext
end
.found_text ; 0x13645
; found @ !
text_jump UnknownText_0x1bd321
db "@"
.no_room_text ; 0x1364a
; But has no space left…
text_jump UnknownText_0x1bd331
db "@"
SetMemEvent: ; 1364f
ld hl, EngineBuffer1 ; wd03e (aliases: MenuItemsList, CurFruitTree, CurInput)
ld a, [hli]
ld d, [hl]
ld e, a
ld b, SET_FLAG
call EventFlagAction
ret
CheckFacingTileForStd:: ; 1365b
; Checks to see if the tile you're facing has a std script associated with it. If so, executes the script and returns carry.
ld a, c
ld de, 3
ld hl, .table1
call IsInArray
jr nc, .notintable
ld a, jumpstd_command
ld [wJumpStdScriptBuffer], a
inc hl
ld a, [hli]
ld [wJumpStdScriptBuffer + 1], a
ld a, [hli]
ld [wJumpStdScriptBuffer + 2], a
ld a, BANK(Script_JumpStdFromRAM)
ld hl, Script_JumpStdFromRAM
call CallScript
scf
ret
.notintable
xor a
ret
.table1
dbw $91, magazinebookshelf
dbw $93, pcscript
dbw $94, radio1
dbw $95, townmap
dbw $96, merchandiseshelf
dbw $97, tv
dbw $9d, window
dbw $9f, incenseburner
db -1 ; end
Script_JumpStdFromRAM: ; 0x1369a
jump wJumpStdScriptBuffer
INCLUDE "event/bug_contest_judging.asm"
ApplyPokerusTick: ; 13988
; decreases all pokemon's pokerus counter by b. if the lower nybble reaches zero, the pokerus is cured.
ld hl, PartyMon1PokerusStatus ; PartyMon1 + MON_PKRS
ld a, [PartyCount]
and a
ret z ; make sure it's not wasting time on an empty party
ld c, a
.loop
ld a, [hl]
and $f ; lower nybble is the number of days remaining
jr z, .next ; if already 0, skip
sub b ; subtract the number of days
jr nc, .ok ; max(result, 0)
xor a
.ok
ld d, a ; back up this value because we need to preserve the strain (upper nybble)
ld a, [hl]
and $f0
add d
ld [hl], a ; this prevents a cured pokemon from recontracting pokerus
.next
ld de, PARTYMON_STRUCT_LENGTH
add hl, de
dec c
jr nz, .loop
ret
INCLUDE "event/bug_contest_2.asm"
INCLUDE "unknown/013a47.asm"
GetSquareRoot: ; 13b87
; Return the square root of de in b.
; Rather than calculating the result, we take the index of the
; first value in a table of squares that isn't lower than de.
ld hl, Squares
ld b, 0
.loop
; Make sure we don't go past the end of the table.
inc b
ld a, b
cp $ff
ret z
; Iterate over the table until b**2 >= de.
ld a, [hli]
sub e
ld a, [hli]
sbc d
jr c, .loop
ret
Squares: ; 13b98
root set 1
rept $ff
dw root*root
root set root+1
endr
SECTION "bank5", ROMX, BANK[$5]
INCLUDE "engine/rtc.asm"
INCLUDE "engine/overworld.asm"
INCLUDE "engine/tile_events.asm"
INCLUDE "engine/save.asm"
INCLUDE "engine/spawn_points.asm"
INCLUDE "engine/map_setup.asm"
INCLUDE "engine/pokecenter_pc.asm"
INCLUDE "engine/mart.asm"
INCLUDE "engine/money.asm"
INCLUDE "items/marts.asm"
INCLUDE "event/mom.asm"
INCLUDE "event/daycare.asm"
INCLUDE "event/photo.asm"
INCLUDE "engine/breeding/egg.asm"
SECTION "Tileset Data 1", ROMX, BANK[TILESETS_1]
INCLUDE "tilesets/data_1.asm"
SECTION "Roofs", ROMX, BANK[ROOFS]
INCLUDE "tilesets/roofs.asm"
SECTION "Tileset Data 2", ROMX, BANK[TILESETS_2]
INCLUDE "tilesets/data_2.asm"
SECTION "bank8", ROMX, BANK[$8]
INCLUDE "engine/clock_reset.asm"
SECTION "Tileset Data 3", ROMX, BANK[TILESETS_3]
INCLUDE "tilesets/data_3.asm"
SECTION "bank9", ROMX, BANK[$9]
StringBufferPointers:: ; 24000
dw StringBuffer3
dw StringBuffer4
dw StringBuffer5
dw StringBuffer2
dw StringBuffer1
dw EnemyMonNick
dw BattleMonNick
INCLUDE "engine/menu.asm"
UpdateItemDescription: ; 0x244c3
ld a, [MenuSelection]
ld [CurSpecies], a
hlcoord 0, 12
ld b, 4
ld c, SCREEN_WIDTH - 2
call TextBox
ld a, [MenuSelection]
cp -1
ret z
decoord 1, 14
callba PrintItemDescription
ret
INCLUDE "engine/pokepic.asm"
LoadObjectMasks: ; 2454f
ld hl, wObjectMasks
xor a
ld bc, NUM_OBJECTS
call ByteFill
nop
ld bc, MapObjects
ld de, wObjectMasks
xor a
.loop
push af
push bc
push de
call GetObjectTimeMask
jr c, .next
call CheckObjectFlag
.next
pop de
ld [de], a
inc de
pop bc
ld hl, OBJECT_LENGTH
add hl, bc
ld b, h
ld c, l
pop af
inc a
cp NUM_OBJECTS
jr nz, .loop
ret
CheckObjectFlag: ; 2457d (9:457d)
ld hl, MAPOBJECT_SPRITE
add hl, bc
ld a, [hl]
and a
jr z, .masked
ld hl, MAPOBJECT_EVENT_FLAG
add hl, bc
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
cp -1
jr nz, .check
ld a, e
cp -1
jr z, .unmasked
jr .masked
.check
ld b, CHECK_FLAG
call EventFlagAction
ld a, c
and a
jr nz, .masked
.unmasked
xor a
ret
.masked
ld a, -1
scf
ret
GetObjectTimeMask: ; 245a7 (9:45a7)
call CheckObjectTime
ld a, -1
ret c
xor a
ret
INCLUDE "engine/scrolling_menu.asm"
INCLUDE "engine/switch_items.asm"
PlaceMenuItemName: ; 0x24ab4
push de
ld a, [MenuSelection]
ld [wNamedObjectIndexBuffer], a
call GetItemName
pop hl
call PlaceString
ret
PlaceMenuItemQuantity: ; 0x24ac3
push de
ld a, [MenuSelection]
ld [CurItem], a
callba _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
pop hl
and a
jr nz, .done
ld de, $15
add hl, de
ld [hl], "×"
inc hl
ld de, MenuSelectionQuantity
lb bc, 1, 2
call PrintNum
.done
ret
PlaceMoneyTopRight: ; 24ae8
ld hl, MenuDataHeader_0x24b15
call CopyMenuDataHeader
jr PlaceMoneyDataHeader
PlaceMoneyBottomLeft: ; 24af0
ld hl, MenuDataHeader_0x24b1d
call CopyMenuDataHeader
jr PlaceMoneyDataHeader
PlaceMoneyAtTopLeftOfTextbox: ; 24af8
ld hl, MenuDataHeader_0x24b15
lb de, 0, 11
call OffsetMenuDataHeader
PlaceMoneyDataHeader: ; 24b01
call MenuBox
call MenuBoxCoord2Tile
ld de, SCREEN_WIDTH + 1
add hl, de
ld de, Money
lb bc, PRINTNUM_MONEY | 3, 6
call PrintNum
ret
MenuDataHeader_0x24b15: ; 0x24b15
db $40 ; flags
db 00, 11 ; start coords
db 02, 19 ; end coords
dw NULL
db 1 ; default option
MenuDataHeader_0x24b1d: ; 0x24b1d
db $40 ; flags
db 11, 00 ; start coords
db 13, 08 ; end coords
dw NULL
db 1 ; default option
Special_DisplayCoinCaseBalance: ; 24b25
; Place a text box of size 1x7 at 11, 0.
hlcoord 11, 0
ld b, 1
ld c, 7
call TextBox
hlcoord 12, 0
ld de, CoinString
call PlaceString
hlcoord 17, 1
ld de, ShowMoney_TerminatorString
call PlaceString
ld de, Coins
lb bc, 2, 4
hlcoord 13, 1
call PrintNum
ret
Special_DisplayMoneyAndCoinBalance: ; 24b4e
hlcoord 5, 0
ld b, 3
ld c, 13
call TextBox
hlcoord 6, 1
ld de, MoneyString
call PlaceString
hlcoord 12, 1
ld de, Money
lb bc, PRINTNUM_MONEY | 3, 6
call PrintNum
hlcoord 6, 3
ld de, CoinString
call PlaceString
hlcoord 15, 3
ld de, Coins
lb bc, 2, 4
call PrintNum
ret
MoneyString: ; 24b83
db "MONEY@"
CoinString: ; 24b89
db "COIN@"
ShowMoney_TerminatorString: ; 24b8e
db "@"
Function24b8f: ; 24b8f
; unreferenced, related to safari?
ld hl, Options
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
hlcoord 0, 0
ld b, 3
ld c, 7
call TextBox
hlcoord 1, 1
ld de, wSafariTimeRemaining
lb bc, 2, 3
call PrintNum
hlcoord 4, 1
ld de, .slash_500
call PlaceString
hlcoord 1, 3
ld de, .booru_ko
call PlaceString
hlcoord 5, 3
ld de, wSafariBallsRemaining
lb bc, 1, 2
call PrintNum
pop af
ld [Options], a
ret
.slash_500 ; 24bcf
db "/500@"
.booru_ko ; 24bd4
db "ボール こ@"
StartMenu_DrawBugContestStatusBox: ; 24bdc
hlcoord 0, 0
ld b, 5
ld c, 17
call TextBox
ret
StartMenu_PrintBugContestStatus: ; 24be7
ld hl, Options
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
call StartMenu_DrawBugContestStatusBox
hlcoord 1, 5
ld de, .Balls_EN
call PlaceString
hlcoord 8, 5
ld de, wParkBallsRemaining
lb bc, PRINTNUM_RIGHTALIGN | 1, 2
call PrintNum
hlcoord 1, 1
ld de, .CAUGHT
call PlaceString
ld a, [wContestMon]
and a
ld de, .None
jr z, .no_contest_mon
ld [wd265], a
call GetPokemonName
.no_contest_mon
hlcoord 8, 1
call PlaceString
ld a, [wContestMon]
and a
jr z, .skip_level
hlcoord 1, 3
ld de, .LEVEL
call PlaceString
ld a, [wContestMonLevel]
ld h, b
ld l, c
inc hl
ld c, 3
call Print8BitNumRightAlign
.skip_level
pop af
ld [Options], a
ret
.Balls_JP: ; 24c43
db "ボール こ@"
.CAUGHT: ; 24c4b
db "CAUGHT@"
.Balls_EN: ; 24c52
db "BALLS:@"
.None: ; 24c59
db "None@"
.LEVEL: ; 24c5e
db "LEVEL@"
FindApricornsInBag: ; 24c64
; Checks the bag for Apricorns.
ld hl, Buffer1
xor a
ld [hli], a
dec a
ld bc, 10
call ByteFill
ld hl, .ApricornBalls
.loop
ld a, [hl]
cp -1
jr z, .done
push hl
ld [CurItem], a
ld hl, NumItems
call CheckItem
pop hl
jr nc, .nope
ld a, [hl]
call .addtobuffer
.nope
inc hl
inc hl
jr .loop
.done
ld a, [Buffer1]
and a
ret nz
scf
ret
.addtobuffer ; 24c94
push hl
ld hl, Buffer1
inc [hl]
ld e, [hl]
ld d, 0
add hl, de
ld [hl], a
pop hl
ret
.ApricornBalls: ; 24ca0