summaryrefslogtreecommitdiff
path: root/include/asm/macros/script.inc
blob: 8ef4bd87f95e6ea1a31a29793db6e60127e27e49 (plain)
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
.macro warpLocation id:req
    .byte 0x01
    .byte 0x00
    .2byte \id
    .4byte 0x00, 0x00, 0x00
.endm

.macro warpDungeon id:req
    .byte 0x02
    .byte 0x00
    .2byte \id
    .4byte 0x00, 0x00, 0x00
.endm

.macro warpFriendArea time:req
    .byte 0x02
    .byte 0x00
    .2byte \time
    .4byte 0x00, 0x00, 0x00
.endm

.macro ConfirmDungeonRules
    .byte 0x05
    .4byte 0x00, 0x00, 0x00
    .byte 0x00, 0x00, 0x00
.endm

.macro changeTileset id:req
    .byte 0x08, 0x00, 0x00, 0x00
    .2byte \id
    .4byte 0x00, 0x00
    .2byte 0x00
.endm

@ Start Scene? Run Call?
.macro StartSceneRunCall id:req
    .byte 0x0C
    .byte \id
    .byte 0xFF, 0xFF
    .4byte 0x00, 0x00, 0x00
.endm

.macro RunCall id:req
    .byte 0x0D
    .byte \id
    .byte 0xFF, 0xFF
    .4byte 0x00, 0x00, 0x00
.endm

.macro triggerCutscene id:req
    .byte 0x1B
    .byte 0x00
    .2byte \id
    .4byte 0x00, 0x00, 0x00
.endm

.macro fadeOut arg0:req time:req arg2:req
    .byte 0x23
    .byte \arg0
    .2byte \time
    .4byte \arg2
    .4byte 0x00, 0x00
.endm

.macro fadeColorOut arg0:req arg1:req time:req color:req
    .byte 0x27
    .byte \arg0
    .2byte \arg1
    .4byte \time
    .4byte \color
    .4byte 0x00
.endm

.macro fadeColorIn arg0:req arg1:req time:req color:req
    .byte 0x28
    .byte \arg0
    .2byte \arg1
    .4byte \time
    .4byte \color
    .4byte 0x00
.endm

.macro loadData type:req charac:req source:req
    .byte 0x2D
    .byte \type
    .2byte \charac
    .2byte \source
    .4byte 0x00, 0x00
    .2byte 0x00
.endm

@ Face Locations
.set bottomL, 0x2
.set bottomR, 0x3
.set insetTopL, 0xE
.set insetTopR, 0xF

.set previousLoc, 0x15

.macro selectFace loc:req charac:req face:req
    .byte 0x2E
    .byte \loc
    .2byte \charac
    .4byte \face
    .4byte 0x00, 0x00
.endm

.macro closeTextBox
    .byte 0x30
    .4byte 0x00, 0x00, 0x00
    .byte 0x00, 0x00, 0x00
.endm

.macro scrollTextBox character:req textPtr:req
    .byte 0x33, 0x00
    .2byte \character
    .4byte 0x00, 0x00
    .4byte \textPtr
.endm

.macro PicNameTextBox character:req textPtr:req
    .byte 0x34, 0x00
    .2byte \character
    .4byte 0x00, 0x00
    .4byte \textPtr
.endm

.macro quickCloseTextBox character:req textPtr:req
    .byte 0x36, 0x00
    .2byte \character
    .4byte 0x00, 0x00
    .4byte \textPtr
.endm

@ Is it always 0xff, 0xff?
.macro floatingText textPtr:req
    .byte 0x37, 0x00
    .byte 0xff, 0xff
    .4byte 0x00, 0x00
    .4byte \textPtr
.endm

.macro fadeFloatingText time:req textPtr:req
    .byte 0x39, 0x00
    .2byte \time
    .4byte 0x00, 0x00
    .4byte \textPtr
.endm

.macro YesNoTextBox eventID:req character:req textPtr:req
    .byte 0x3A, 0x00
    .2byte \eventID
    .2byte \character
    .2byte 0x00
    .4byte 0x00
    .4byte \textPtr
.endm

.macro showName arg0:req
    .byte 0x3B
    .byte \arg0
    .2byte 0x00
    .4byte 0x00, 0x00, 0x00
.endm

@ TODO: 0x3C has a lot of different cases...

.macro renamePoke id:req
    .byte 0x3D, 0x00, 0x00, 0x00
    .byte \id, 0x00, 0x00, 0x00
    .4byte 0x00, 0x00
.endm

.macro renameTeam
    .byte 0x3D, 0x00, 0x00, 0x00
    .4byte 0x00, 0x00, 0x00
.endm

.macro abruptStopMusic
    .byte 0x42
    .4byte 0x00, 0x00, 0x00
    .byte 0x00, 0x00, 0x00
.endm

.macro fadeMusic time:req
    .byte 0x43
    .byte 0x00
    .2byte \time
    .4byte 0x00, 0x00, 0x00
.endm

.macro PlayMusic id:req
    .byte 0x44
    .byte 0x00
    .2byte 0x0
    .2byte \id
    .2byte 0x00
    .4byte 0x00, 0x00
.endm

.macro fadeInMusic id:req time:req
    .byte 0x45, 0x00
    .2byte \id
    .2byte \time
    .4byte 0x00, 0x00
    .2byte 0x00
.endm

@ Also seen referred to as StopSng
.macro pushR14
    .byte 0x47
    .4byte 0x00, 0x00, 0x00
    .byte 0x00, 0x00, 0x00
.endm

.macro fadeMusicOut time:req
    .byte 0x48
    .byte 0x00
    .2byte \time
    .4byte 0x00, 0x00, 0x00
.endm

.macro playSound id:req
    .byte 0x4C
    .byte 0x00, 0x00, 0x00
    .2byte \id
    .4byte 0x00, 0x00
    .2byte 0x00
.endm

.macro stopSound id:req
    .byte 0x4D
    .byte 0x00, 0x00, 0x00
    .2byte \id
    .4byte 0x00, 0x00
    .2byte 0x00
.endm

.macro setAnimation anim:req
    .byte 0x54
    .byte 0x00
    .2byte \anim
    .4byte 0x00, 0x00, 0x00
.endm

.macro warpToLoc id:req
    .byte 0x5B, 0x00
    .2byte 0x00
    .byte \id
    .byte 0x00, 0x00, 0x00
    .4byte 0x00, 0x00
.endm

@ move to prefined location along grid
.macro gridMoveTo speed:req id:req
    .byte 0x6B, 0x00
    .2byte \speed
    .byte \id
    .4byte 0x00, 0x00
    .byte 0x00, 0x00, 0x00
.endm

.macro changeSpriteZ speed:req targetHeight:req
    .byte 0x70, 0x00
    .byte \speed
    .3byte \targetHeight
    .4byte 0x00, 0x00
    .2byte 0x00
.endm

@ Rotation Directions
.set CW, 1
.set CCW, 2
.set shortestDir, 0xA

@ Cardinal Directions / Facing Directions
.set south,      0
.set southeast,  1
.set east,       2
.set northeast,  3
.set north,      4
.set northwest,  5
.set west,       6
.set southwest,  7

.macro setFaceDir delay:req faceDir:req
    .byte 0x8B
    .byte \delay
    .byte \faceDir
    .byte 0x00
    .4byte 0x00, 0x00, 0x00
.endm

.macro rotate time:req rotDir:req faceDir:req
    .byte 0x91
    .byte \time
    .byte \rotDir
    .byte 0x00
    .byte \faceDir
    .byte 0x00
    .4byte 0x00, 0x00
    .2byte 0x00
.endm

.macro initVariableTextBox arg0:req arg1:req speaker:req
    .byte 0xCF
    .byte \arg0
    .byte \arg1
    .byte 0x00
    .4byte \speaker
    .4byte 0x00, 0x00
.endm

.macro variableTextBox version:req textPtr:req
    .byte 0xD0, 0x00
    .2byte \version
    .4byte 0x00, 0x00
    .4byte \textPtr
.endm

.macro elseTextBox textPtr:req
    .byte 0xD1, 0x00
    .4byte 0x00, 0x00
    .byte 0x00, 0x00
    .4byte \textPtr
.endm

.macro pause time:req
    .byte 0xDB
    .byte 0x00
    .2byte \time
    .4byte 0x00, 0x00, 0x00
.endm

@ Wait for sound to finish playing?
.macro waitSound id:req
    .byte 0xE2
    .byte 0x00
    .2byte \id
    .4byte 0x00, 0x00, 0x00
.endm

.macro waitFlag flagnum:req
    .byte 0xE3
    .byte 0x00
    .2byte \flagnum
    .4byte 0x00, 0x00, 0x00
.endm

.macro setFlag flagnum:req
    .byte 0xE4
    .byte 0x00
    .2byte \flagnum
    .4byte 0x00, 0x00, 0x00
.endm

.macro goTo id:req
    .byte 0xE5
    .byte 0x00
    .byte \id
    .byte 0x00
    .4byte 0x00, 0x00, 0x00
.endm

@ Loop at label until end of scene
.macro loopLabel id:req
    .byte 0xE7, 0x00
    .byte \id, 0x00
    .4byte 0x00, 0x00, 0x00
.endm

.macro executeScript scriptNum:req
    .byte 0xE8
    .byte 0x00
    .2byte \scriptNum
    .4byte 0x00, 0x00, 0x00
.endm

.macro MsgEnd arg0:req
    .byte 0xE9
    .byte 0x00
    .2byte \arg0
    .4byte 0x00, 0x00, 0x00
.endm

.macro endFuncContinueScript
    .byte 0xEE
    .4byte 0x00, 0x00, 0x00
    .byte 0x00, 0x00, 0x00
.endm

.macro endFuncandScript
    .byte 0xEF
    .4byte 0x00, 0x00, 0x00
    .byte 0x00, 0x00, 0x00
.endm

.macro closeThread
    .byte 0xF0
    .4byte 0x00, 0x00, 0x00
    .byte 0x00, 0x00, 0x00
.endm

.macro closeThreadRemoveObject
    .byte 0xF1
    .4byte 0x00, 0x00, 0x00
    .byte 0x00, 0x00, 0x00
.endm

@ Set label for loop
.macro label id:req
    .byte 0xF4, 0x00
    .byte \id, 0x00
    .4byte 0x00, 0x00, 0x00
.endm