-
Notifications
You must be signed in to change notification settings - Fork 831
/
Copy pathevents.asm
1068 lines (897 loc) · 16.7 KB
/
events.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
; ScriptCommandTable indexes (see engine/overworld/scripting.asm)
const_def
const scall_command ; $00
MACRO scall
db scall_command
dw \1 ; pointer
ENDM
const farscall_command ; $01
MACRO farscall
db farscall_command
dba \1
ENDM
const memcall_command ; $02
MACRO memcall
db memcall_command
dw \1 ; pointer
ENDM
const sjump_command ; $03
MACRO sjump
db sjump_command
dw \1 ; pointer
ENDM
const farsjump_command ; $04
MACRO farsjump
db farsjump_command
dba \1
ENDM
const memjump_command ; $05
MACRO memjump
db memjump_command
dw \1 ; pointer
ENDM
const ifequal_command ; $06
MACRO ifequal
db ifequal_command
db \1 ; byte
dw \2 ; pointer
ENDM
const ifnotequal_command ; $07
MACRO ifnotequal
db ifnotequal_command
db \1 ; byte
dw \2 ; pointer
ENDM
const iffalse_command ; $08
MACRO iffalse
db iffalse_command
dw \1 ; pointer
ENDM
const iftrue_command ; $09
MACRO iftrue
db iftrue_command
dw \1 ; pointer
ENDM
const ifgreater_command ; $0a
MACRO ifgreater
db ifgreater_command
db \1 ; byte
dw \2 ; pointer
ENDM
const ifless_command ; $0b
MACRO ifless
db ifless_command
db \1 ; byte
dw \2 ; pointer
ENDM
const jumpstd_command ; $0c
MACRO jumpstd
db jumpstd_command
dw (\1StdScript - StdScripts) / 3
ENDM
const callstd_command ; $0d
MACRO callstd
db callstd_command
dw (\1StdScript - StdScripts) / 3
ENDM
const callasm_command ; $0e
MACRO callasm
db callasm_command
dba \1
ENDM
const special_command ; $0f
MACRO special
db special_command
dw (\1Special - SpecialsPointers) / 3
ENDM
const memcallasm_command ; $10
MACRO memcallasm
db memcallasm_command
dw \1 ; asm
ENDM
const checkmapscene_command ; $11
MACRO checkmapscene
db checkmapscene_command
map_id \1 ; map
ENDM
const setmapscene_command ; $12
MACRO setmapscene
db setmapscene_command
map_id \1 ; map
db \2 ; scene_id
ENDM
const checkscene_command ; $13
MACRO checkscene
db checkscene_command
ENDM
const setscene_command ; $14
MACRO setscene
db setscene_command
db \1 ; scene_id
ENDM
const setval_command ; $15
MACRO setval
db setval_command
db \1 ; value
ENDM
const addval_command ; $16
MACRO addval
db addval_command
db \1 ; value
ENDM
const random_command ; $17
MACRO random
db random_command
db \1 ; input
ENDM
const checkver_command ; $18
MACRO checkver
db checkver_command
ENDM
const readmem_command ; $19
MACRO readmem
db readmem_command
dw \1 ; address
ENDM
const writemem_command ; $1a
MACRO writemem
db writemem_command
dw \1 ; address
ENDM
const loadmem_command ; $1b
MACRO loadmem
db loadmem_command
dw \1 ; address
db \2 ; value
ENDM
const readvar_command ; $1c
MACRO readvar
db readvar_command
db \1 ; variable_id
ENDM
const writevar_command ; $1d
MACRO writevar
db writevar_command
db \1 ; variable_id
ENDM
const loadvar_command ; $1e
MACRO loadvar
if STRIN("\1", "VAR_") != 1
; LEGACY: Support for the old name of "loadmem"
loadmem \1, \2
else
db loadvar_command
db \1 ; variable_id
db \2 ; value
endc
ENDM
const giveitem_command ; $1f
MACRO giveitem
if _NARG == 1
giveitem \1, 1
else
db giveitem_command
db \1 ; item
db \2 ; quantity
endc
ENDM
const takeitem_command ; $20
MACRO takeitem
if _NARG == 1
takeitem \1, 1
else
db takeitem_command
db \1 ; item
db \2 ; quantity
endc
ENDM
const checkitem_command ; $21
MACRO checkitem
db checkitem_command
db \1 ; item
ENDM
const givemoney_command ; $22
MACRO givemoney
db givemoney_command
db \1 ; account
bigdt \2 ; money
ENDM
const takemoney_command ; $23
MACRO takemoney
db takemoney_command
db \1 ; account
bigdt \2 ; money
ENDM
const checkmoney_command ; $24
MACRO checkmoney
db checkmoney_command
db \1 ; account
bigdt \2 ; money
ENDM
const givecoins_command ; $25
MACRO givecoins
db givecoins_command
dw \1 ; coins
ENDM
const takecoins_command ; $26
MACRO takecoins
db takecoins_command
dw \1 ; coins
ENDM
const checkcoins_command ; $27
MACRO checkcoins
db checkcoins_command
dw \1 ; coins
ENDM
const addcellnum_command ; $28
MACRO addcellnum
db addcellnum_command
db \1 ; person
ENDM
const delcellnum_command ; $29
MACRO delcellnum
db delcellnum_command
db \1 ; person
ENDM
const checkcellnum_command ; $2a
MACRO checkcellnum
db checkcellnum_command
db \1 ; person
ENDM
const checktime_command ; $2b
MACRO checktime
db checktime_command
db \1 ; time
ENDM
const checkpoke_command ; $2c
MACRO checkpoke
db checkpoke_command
db \1 ; pkmn
ENDM
const givepoke_command ; $2d
MACRO givepoke
if _NARG == 2
givepoke \1, \2, NO_ITEM, FALSE
elif _NARG == 3
givepoke \1, \2, \3, FALSE
elif _NARG == 5
givepoke \1, \2, \3, TRUE, \4, \5
else
db givepoke_command
db \1 ; pokemon
db \2 ; level
db \3 ; item
db \4 ; trainer
if \4
dw \5 ; nickname_pointer
dw \6 ; ot_name_pointer
endc
endc
ENDM
const giveegg_command ; $2e
MACRO giveegg
db giveegg_command
db \1 ; pkmn
db \2 ; level
ENDM
const givepokemail_command ; $2f
MACRO givepokemail
db givepokemail_command
dw \1 ; pointer
ENDM
const checkpokemail_command ; $30
MACRO checkpokemail
db checkpokemail_command
dw \1 ; pointer
ENDM
const checkevent_command ; $31
MACRO checkevent
db checkevent_command
dw \1 ; event_flag
ENDM
const clearevent_command ; $32
MACRO clearevent
db clearevent_command
dw \1 ; event_flag
ENDM
const setevent_command ; $33
MACRO setevent
db setevent_command
dw \1 ; event_flag
ENDM
const checkflag_command ; $34
MACRO checkflag
db checkflag_command
dw \1 ; engine_flag
ENDM
const clearflag_command ; $35
MACRO clearflag
db clearflag_command
dw \1 ; engine_flag
ENDM
const setflag_command ; $36
MACRO setflag
db setflag_command
dw \1 ; engine_flag
ENDM
const wildon_command ; $37
MACRO wildon
db wildon_command
ENDM
const wildoff_command ; $38
MACRO wildoff
db wildoff_command
ENDM
const xycompare_command ; $39
MACRO xycompare
db xycompare_command
dw \1 ; pointer
ENDM
const warpmod_command ; $3a
MACRO warpmod
db warpmod_command
db \1 ; warp_id
map_id \2 ; map
ENDM
const blackoutmod_command ; $3b
MACRO blackoutmod
db blackoutmod_command
map_id \1 ; map
ENDM
const warp_command ; $3c
MACRO warp
db warp_command
map_id \1 ; map
db \2 ; x
db \3 ; y
ENDM
const getmoney_command ; $3d
MACRO getmoney
db getmoney_command
db \2 ; account
db \1 ; string_buffer
ENDM
const getcoins_command ; $3e
MACRO getcoins
db getcoins_command
db \1 ; string_buffer
ENDM
const getnum_command ; $3f
MACRO getnum
db getnum_command
db \1 ; string_buffer
ENDM
const getmonname_command ; $40
MACRO getmonname
db getmonname_command
db \2 ; pokemon
db \1 ; string_buffer
ENDM
const getitemname_command ; $41
MACRO getitemname
db getitemname_command
db \2 ; item
db \1 ; string_buffer
ENDM
const getcurlandmarkname_command ; $42
MACRO getcurlandmarkname
db getcurlandmarkname_command
db \1 ; string_buffer
ENDM
const gettrainername_command ; $43
MACRO gettrainername
db gettrainername_command
db \2 ; trainer_group
db \3 ; trainer_id
db \1 ; string_buffer
ENDM
const getstring_command ; $44
MACRO getstring
db getstring_command
dw \2 ; text_pointer
db \1 ; string_buffer
ENDM
const itemnotify_command ; $45
MACRO itemnotify
db itemnotify_command
ENDM
const pocketisfull_command ; $46
MACRO pocketisfull
db pocketisfull_command
ENDM
const opentext_command ; $47
MACRO opentext
db opentext_command
ENDM
const reanchormap_command ; $48
MACRO reanchormap
if _NARG == 0
reanchormap 0
else
db reanchormap_command
db \1 ; dummy
endc
ENDM
const closetext_command ; $49
MACRO closetext
db closetext_command
ENDM
const writeunusedbyte_command ; $4a
MACRO writeunusedbyte
db writeunusedbyte_command
db \1 ; byte
ENDM
const farwritetext_command ; $4b
MACRO farwritetext
db farwritetext_command
dba \1
ENDM
const writetext_command ; $4c
MACRO writetext
db writetext_command
dw \1 ; text_pointer
ENDM
const repeattext_command ; $4d
MACRO repeattext
db repeattext_command
db \1 ; byte
db \2 ; byte
ENDM
const yesorno_command ; $4e
MACRO yesorno
db yesorno_command
ENDM
const loadmenu_command ; $4f
MACRO loadmenu
db loadmenu_command
dw \1 ; menu_header
ENDM
const closewindow_command ; $50
MACRO closewindow
db closewindow_command
ENDM
const jumptextfaceplayer_command ; $51
MACRO jumptextfaceplayer
db jumptextfaceplayer_command
dw \1 ; text_pointer
ENDM
const farjumptext_command ; $52
MACRO farjumptext
db farjumptext_command
dba \1
ENDM
const jumptext_command ; $53
MACRO jumptext
db jumptext_command
dw \1 ; text_pointer
ENDM
const waitbutton_command ; $54
MACRO waitbutton
db waitbutton_command
ENDM
const promptbutton_command ; $55
MACRO promptbutton
db promptbutton_command
ENDM
const pokepic_command ; $56
MACRO pokepic
db pokepic_command
db \1 ; pokemon
ENDM
const closepokepic_command ; $57
MACRO closepokepic
db closepokepic_command
ENDM
const _2dmenu_command ; $58
MACRO _2dmenu
db _2dmenu_command
ENDM
const verticalmenu_command ; $59
MACRO verticalmenu
db verticalmenu_command
ENDM
const loadpikachudata_command ; $5a
MACRO loadpikachudata
db loadpikachudata_command
ENDM
const randomwildmon_command ; $5b
MACRO randomwildmon
db randomwildmon_command
ENDM
const loadtemptrainer_command ; $5c
MACRO loadtemptrainer
db loadtemptrainer_command
ENDM
const loadwildmon_command ; $5d
MACRO loadwildmon
db loadwildmon_command
db \1 ; pokemon
db \2 ; level
ENDM
const loadtrainer_command ; $5e
MACRO loadtrainer
db loadtrainer_command
db \1 ; trainer_group
db \2 ; trainer_id
ENDM
const startbattle_command ; $5f
MACRO startbattle
db startbattle_command
ENDM
const reloadmapafterbattle_command ; $60
MACRO reloadmapafterbattle
db reloadmapafterbattle_command
ENDM
const catchtutorial_command ; $61
MACRO catchtutorial
db catchtutorial_command
db \1 ; byte
ENDM
const trainertext_command ; $62
MACRO trainertext
db trainertext_command
db \1 ; text_id
ENDM
const trainerflagaction_command ; $63
MACRO trainerflagaction
db trainerflagaction_command
db \1 ; action
ENDM
const winlosstext_command ; $64
MACRO winlosstext
db winlosstext_command
dw \1 ; win_text_pointer
dw \2 ; loss_text_pointer
ENDM
const scripttalkafter_command ; $65
MACRO scripttalkafter
db scripttalkafter_command
ENDM
const endifjustbattled_command ; $66
MACRO endifjustbattled
db endifjustbattled_command
ENDM
const checkjustbattled_command ; $67
MACRO checkjustbattled
db checkjustbattled_command
ENDM
const setlasttalked_command ; $68
MACRO setlasttalked
db setlasttalked_command
db \1 ; object id
ENDM
const applymovement_command ; $69
MACRO applymovement
db applymovement_command
db \1 ; object id
dw \2 ; data
ENDM
const applymovementlasttalked_command ; $6a
MACRO applymovementlasttalked
db applymovementlasttalked_command
dw \1 ; data
ENDM
const faceplayer_command ; $6b
MACRO faceplayer
db faceplayer_command
ENDM
const faceobject_command ; $6c
MACRO faceobject
db faceobject_command
db \1 ; object1
db \2 ; object2
ENDM
const variablesprite_command ; $6d
MACRO variablesprite
db variablesprite_command
db \1 - SPRITE_VARS ; byte
db \2 ; sprite
ENDM
const disappear_command ; $6e
MACRO disappear
db disappear_command
db \1 ; object id
ENDM
const appear_command ; $6f
MACRO appear
db appear_command
db \1 ; object id
ENDM
const follow_command ; $70
MACRO follow
db follow_command
db \1 ; object2
db \2 ; object1
ENDM
const stopfollow_command ; $71
MACRO stopfollow
db stopfollow_command
ENDM
const moveobject_command ; $72
MACRO moveobject
db moveobject_command
db \1 ; object id
db \2 ; x
db \3 ; y
ENDM
const writeobjectxy_command ; $73
MACRO writeobjectxy
db writeobjectxy_command
db \1 ; object id
ENDM
const loademote_command ; $74
MACRO loademote
db loademote_command
db \1 ; bubble
ENDM
const showemote_command ; $75
MACRO showemote
db showemote_command
db \1 ; bubble
db \2 ; object id
db \3 ; time
ENDM
const turnobject_command ; $76
MACRO turnobject
db turnobject_command
db \1 ; object id
db \2 ; facing
ENDM
const follownotexact_command ; $77
MACRO follownotexact
db follownotexact_command
db \1 ; object2
db \2 ; object1
ENDM
const earthquake_command ; $78
MACRO earthquake
db earthquake_command
db \1 ; param
ENDM
const changemapblocks_command ; $79
MACRO changemapblocks
db changemapblocks_command
dba \1 ; map_data_pointer
ENDM
const changeblock_command ; $7a
MACRO changeblock
db changeblock_command
db \1 ; x
db \2 ; y
db \3 ; block
ENDM
const reloadmap_command ; $7b
MACRO reloadmap
db reloadmap_command
ENDM
const refreshmap_command ; $7c
MACRO refreshmap
db refreshmap_command
ENDM
const writecmdqueue_command ; $7d
MACRO writecmdqueue
db writecmdqueue_command
dw \1 ; queue_pointer
ENDM
const delcmdqueue_command ; $7e
MACRO delcmdqueue
db delcmdqueue_command
db \1 ; byte
ENDM
const playmusic_command ; $7f
MACRO playmusic
db playmusic_command
dw \1 ; music_pointer
ENDM
const encountermusic_command ; $80
MACRO encountermusic
db encountermusic_command
ENDM
const musicfadeout_command ; $81
MACRO musicfadeout
db musicfadeout_command
dw \1 ; music
db \2 ; fadetime
ENDM
const playmapmusic_command ; $82
MACRO playmapmusic
db playmapmusic_command
ENDM
const dontrestartmapmusic_command ; $83
MACRO dontrestartmapmusic
db dontrestartmapmusic_command
ENDM
const cry_command ; $84
MACRO cry
db cry_command
dw \1 ; cry_id
ENDM
const playsound_command ; $85
MACRO playsound
db playsound_command
dw \1 ; sound_pointer
ENDM
const waitsfx_command ; $86
MACRO waitsfx
db waitsfx_command
ENDM
const warpsound_command ; $87
MACRO warpsound
db warpsound_command
ENDM
const specialsound_command ; $88
MACRO specialsound
db specialsound_command
ENDM
const autoinput_command ; $89
MACRO autoinput
db autoinput_command
dba \1
ENDM
const newloadmap_command ; $8a
MACRO newloadmap
db newloadmap_command
db \1 ; which_method
ENDM
const pause_command ; $8b
MACRO pause
db pause_command
db \1 ; length
ENDM
const deactivatefacing_command ; $8c
MACRO deactivatefacing
db deactivatefacing_command
db \1 ; time
ENDM
const sdefer_command ; $8d
MACRO sdefer
db sdefer_command
dw \1 ; pointer
ENDM
const warpcheck_command ; $8e
MACRO warpcheck
db warpcheck_command
ENDM
const stopandsjump_command ; $8f
MACRO stopandsjump
db stopandsjump_command
dw \1 ; pointer
ENDM
const endcallback_command ; $90
MACRO endcallback
db endcallback_command
ENDM
const end_command ; $91
MACRO end
db end_command
ENDM
const reloadend_command ; $92
MACRO reloadend
db reloadend_command
db \1 ; which_method
ENDM
const endall_command ; $93
MACRO endall
db endall_command
ENDM
const pokemart_command ; $94
MACRO pokemart
db pokemart_command
db \1 ; dialog_id
dw \2 ; mart_id
ENDM
const elevator_command ; $95
MACRO elevator
db elevator_command
dw \1 ; floor_list_pointer
ENDM
const trade_command ; $96
MACRO trade
db trade_command
db \1 ; trade_id
ENDM
const askforphonenumber_command ; $97
MACRO askforphonenumber
db askforphonenumber_command
db \1 ; number
ENDM
const phonecall_command ; $98
MACRO phonecall
db phonecall_command
dw \1 ; caller_name
ENDM
const hangup_command ; $99
MACRO hangup
db hangup_command
ENDM
const describedecoration_command ; $9a
MACRO describedecoration
db describedecoration_command
db \1 ; byte
ENDM
const fruittree_command ; $9b
MACRO fruittree
db fruittree_command
db \1 ; tree_id
ENDM
const specialphonecall_command ; $9c
MACRO specialphonecall
db specialphonecall_command
dw \1 ; call_id
ENDM
const checkphonecall_command ; $9d
MACRO checkphonecall
db checkphonecall_command
ENDM
const verbosegiveitem_command ; $9e
MACRO verbosegiveitem
if _NARG == 1
verbosegiveitem \1, 1
else
db verbosegiveitem_command
db \1 ; item
db \2 ; quantity
endc
ENDM
const verbosegiveitemvar_command ; $9f
MACRO verbosegiveitemvar
db verbosegiveitemvar_command
db \1 ; item
db \2 ; var