Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag820.c
Go to the documentation of this file.
1/*
2 * WSTAG820: Control Room, Spy Satellite. Where the player faces Lord
3 * Megadeath, then Snatchmon.
4 */
5
6#include "common.h"
7#include "field/stage.h"
8/* Defined below, after the code that uses them */
12
14
15/* Shows the map object with animation 1, animated once, then hides it and kills itself */
17 StageTile *object;
18 StageTile *tile;
19 s32 frame;
20
21 switch (task->state) {
22 case TASK_INIT:
23 default:
24 task->nextState(task);
25 for (object = FIELDSTG_state.objects; object->margin != 0; object++) {
26 if (object->anim == 1) {
27 task->obj.tile = object;
28 }
29 }
30 task->obj.anim.index = 0;
32 break;
33 case TASK_RUN:
34 tile = task->obj.tile;
35 tile->visible = 1;
36 frame = stepAnimationOnce(&task->obj, updateTileTaskFrames, 0);
37 if (frame != 0xFF) {
38 tile->frame = frame;
39 } else {
40 tile->visible = 0;
41 task->setState(task, TASK_KILL);
42 }
43 break;
44 case TASK_DONE:
45 case TASK_KILL:
46 break;
47 }
48}
49
50/* Creates the task of updateTileTask with the given id, with a sound */
52 void *task = createTaskWithId(updateTileTask, sizeof(StageTileTask), 0, id);
53
55 return task;
56}
57
58/* Creates the stage's four objects and the event object of story progress 0x29 that applies */
59void updateStage(StageTask *task, void **children) {
60 s32 i;
61
62 switch (task->state) {
63 case TASK_INIT:
64 default:
65 for (i = 0; i < 4; i++) {
66 if (updateStageSpots[i].kind == 0) {
67 children[i + 1] = createStageEffect(updateStageSpots[i].x, updateStageSpots[i].y, updateStageSpots[i].frame);
68 } else if (updateStageSpots[i].kind == 2) {
69 children[i + 1] = createStageEffectWithId(0x34D);
70 }
71 }
72 do {
74 children[0] = FIELDSTG_startEvent(0x424);
75 break;
76 }
78 children[0] = FIELDSTG_startEvent(0x42E);
79 break;
80 }
81 } while (0);
82 task->nextState(task);
83 break;
84 case TASK_RUN:
85 case TASK_DONE:
86 case TASK_KILL:
87 break;
88 }
89}
90
91#define STAGE_CHILDREN_SIZE 0x14
98
99/* Creates the StageEffect of updateStageEffect at (0x1CC, 0x1B4) with frame 0x3C */
102
103 task->x = 0x1CC;
104 task->y = 0x1B4;
105 task->frame = 0x3C;
106 return task;
107}
108
109/* Sets the task to TASK_DONE when the id is 0x335 */
110void handleCommand845(Task *task, s32 id) {
111 if (task != NULL && id == 0x335) {
112 task->setState(task, TASK_DONE);
113 }
114}
115
116/*
117 * After event 1060, with the player: starts the stage's event battle 0 and
118 * keeps it from playing again
119 */
124
125/* After event 1070, with the player: keeps it from playing again */
129
130/*
131 * After event 1080, with Snatchmon: moves the story on to
132 * STORY_MOVIE_BATTLES and starts the stage's event battle 1
133 */
138
139#if VERSION_US || VERSION_JP
140#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
141#define EVENT_TEXT_FILE (TEXT_EVENTS_800 - 1)
142#define STAGE_FILE 0x705
143#elif VERSION_EU
144#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
145#define EVENT_TEXT_FILE (TEXT_EVENTS_800 - 1)
146#define STAGE_FILE 0x715
147#endif
148/* Sets the stage up: its map, actors, battles and events, playing the ambience ENV_0206 */
168
170 SCRIPT_PLACE(1, 0x310, 0x228),
171 SCRIPT_POSE(1, 1, 3),
172 SCRIPT_PLACE(0x188, 0x242, 0x191),
173 SCRIPT_POSE(0x188, 1, 3),
174 SCRIPT_WAIT(0x1E),
175 SCRIPT_WALK(1, 0x2C8, 0x204, 3),
177 SCRIPT_WALK(1, 0x2A8, 0x1DD, 3),
179 SCRIPT_POSE(1, 1, 3),
180 SCRIPT_COMMAND(0x323, 0x325, 1),
181 SCRIPT_WAIT(0x3C),
182 SCRIPT_COMMAND(0x323, 0x326, 1),
183 SCRIPT_WAIT(0x1E),
184 SCRIPT_WALK(1, 0x288, 0x1B6, 3),
186 SCRIPT_WALK(1, 0x278, 0x1AE, 3),
188 SCRIPT_POSE(1, 1, 3),
189 SCRIPT_POSE(0x188, 1, 7),
190 SCRIPT_WAIT(0x3C),
191 SCRIPT_TALK(0, 1, 0xD5, 4),
193 SCRIPT_WAIT(0x1E),
194 SCRIPT_TALK(0, 2, 1, 3),
196 SCRIPT_WAIT(0x3C),
197 SCRIPT_TALK(0, 3, 0xD5, 4),
199 SCRIPT_WAIT(0x1E),
200 SCRIPT_TALK(0, 4, 1, 3),
201 SCRIPT_POSE(1, 7, 3),
203 SCRIPT_POSE(1, 1, 3),
204 SCRIPT_WAIT(0x3C),
205 SCRIPT_TALK(0, 5, 0xD5, 4),
207 SCRIPT_WAIT(0x1E),
208 SCRIPT_COMMAND(0x323, 0x325, 1),
209 SCRIPT_WAIT(0x3C),
210 SCRIPT_COMMAND(0x323, 0x326, 1),
211 SCRIPT_WAIT(0x1E),
212 SCRIPT_TALK(0, 6, 1, 3),
213 SCRIPT_POSE(1, 7, 3),
215 SCRIPT_POSE(1, 1, 3),
216 SCRIPT_WAIT(0x3C),
217 SCRIPT_TALK(0, 7, 0xD5, 4),
219 SCRIPT_WAIT(0x1E),
220 SCRIPT_TALK(0, 8, 1, 3),
221 SCRIPT_POSE(1, 7, 3),
223 SCRIPT_POSE(1, 1, 3),
224 SCRIPT_WAIT(0x1E),
225 SCRIPT_TALK(0, 9, 0xD5, 4),
227 SCRIPT_WAIT(0x1E),
228 SCRIPT_TALK(0, 0xA, 1, 3),
229 SCRIPT_POSE(1, 0xC, 3),
231 SCRIPT_POSE(1, 1, 3),
232 SCRIPT_WAIT(0x3C),
233 SCRIPT_TALK(0, 0xB, 0xD5, 4),
235 SCRIPT_WAIT(0x1E),
236 SCRIPT_TALK(0, 0xC, 1, 3),
237 SCRIPT_POSE(1, 0xC, 3),
239 SCRIPT_WAIT(0x1E),
241};
243 SCRIPT_PLACE(2, 0x278, 0x1AE),
244 SCRIPT_POSE(2, 1, 3),
245 SCRIPT_PLACE(0x188, 0x242, 0x191),
246 SCRIPT_POSE(0x188, 1, 7),
247 SCRIPT_WAIT(0x78),
248 SCRIPT_TALK(0, 1, 2, 3),
249 SCRIPT_POSE(2, 7, 3),
251 SCRIPT_POSE(2, 1, 3),
252 SCRIPT_WAIT(0x3C),
253 SCRIPT_TALK(0, 2, 0xD5, 4),
255 SCRIPT_WAIT(0x1E),
256 SCRIPT_POSE(0x188, 1, 1),
257 SCRIPT_WAIT(0x1E),
258 SCRIPT_LOOK_AT(0, 0x242, 0x1AA),
259 SCRIPT_POSE(2, 1, 2),
260 SCRIPT_WALK(0x188, 0x1DF, 0x1C0, 1),
261 SCRIPT_WAIT_WALK(0x188),
262 SCRIPT_POSE(0x188, 1, 7),
263 SCRIPT_WAIT(0x1E),
265 SCRIPT_COMMAND(0x34D, 0x335, 2),
266 SCRIPT_WAIT(0x48),
267 SCRIPT_PLACE(0x188, 0, 0),
268 SCRIPT_POSE(0x188, 1, 1),
269 SCRIPT_COMMAND(0x323, 0x325, 2),
270 SCRIPT_WAIT(0x3C),
271 SCRIPT_COMMAND(0x323, 0x326, 2),
272 SCRIPT_WAIT(0x1E),
273 SCRIPT_TALK(0, 3, 2, 1),
274 SCRIPT_POSE(2, 1, 2),
276 SCRIPT_WAIT(0x1E),
277 SCRIPT_FOLLOW(0, 2),
278 SCRIPT_POSE(2, 1, 3),
279 SCRIPT_WAIT(0x3C),
281};
283 SCRIPT_LOOK_AT(1, 0x180, 0x100),
284 SCRIPT_WALK(2, 0x180, 0x100, 3),
285 SCRIPT_PLACE(0xD5, 0x150, 0xE8),
286 SCRIPT_POSE(0xD5, 1, 3),
287 SCRIPT_PLACE(0xD7, 0xF9, 0xB1),
288 SCRIPT_POSE(0xD7, 1, 7),
289 SCRIPT_PLACE(0xD8, 0x119, 0x76),
290 SCRIPT_POSE(0xD8, 1, 7),
291 SCRIPT_PLACE(0xD9, 0x78, 0xC5),
292 SCRIPT_POSE(0xD9, 1, 7),
293 SCRIPT_PLACE(0xDA, 0x79, 0x75),
294 SCRIPT_POSE(0xDA, 1, 7),
296 SCRIPT_WAIT(0x1E),
297 SCRIPT_POSE(2, 1, 3),
298 SCRIPT_WAIT(0x1E),
299 SCRIPT_COMMAND(0x323, 0x325, 2),
300 SCRIPT_WAIT(0x3C),
301 SCRIPT_COMMAND(0x323, 0x326, 2),
302 SCRIPT_WAIT(0x1E),
303 SCRIPT_LOOK_AT(0, 0xF8, 0xBC),
304 SCRIPT_WAIT(0x5A),
305 SCRIPT_TALK(0, 0x17, 0xD5, 4),
308 SCRIPT_WAIT(0x1E),
309 SCRIPT_WAIT(0x3C),
310 SCRIPT_POSE(0xD7, 0x50, 7),
311 SCRIPT_POSE(0xD8, 0x50, 7),
312 SCRIPT_POSE(0xD9, 0x50, 7),
313 SCRIPT_POSE(0xDA, 0x50, 7),
315 SCRIPT_WAIT_ANIM(0xD7),
316 SCRIPT_PLACE(0xD7, 0, 0),
317 SCRIPT_POSE(0xD7, 1, 0),
318 SCRIPT_PLACE(0xD8, 0, 0),
319 SCRIPT_POSE(0xD8, 1, 0),
320 SCRIPT_PLACE(0xD9, 0, 0),
321 SCRIPT_POSE(0xD9, 1, 0),
322 SCRIPT_PLACE(0xDA, 0, 0),
323 SCRIPT_POSE(0xDA, 1, 0),
324 SCRIPT_WAIT(0x3C),
325 SCRIPT_LOOK_AT(0, 0x120, 0xCE),
326 SCRIPT_WAIT(0x3C),
327 SCRIPT_PLACE(0xD6, 0x120, 0xCE),
328 SCRIPT_POSE(0xD6, 0x4F, 7),
330 SCRIPT_WAIT_ANIM(0xD6),
331 SCRIPT_POSE(0xD6, 1, 7),
332 SCRIPT_WAIT(0x1E),
333 SCRIPT_TALK(0, 1, 0xD6, 2),
335 SCRIPT_POSE(0xD5, 1, 7),
336 SCRIPT_WAIT(0x1E),
337 SCRIPT_FOLLOW(0, 0xD5),
338 SCRIPT_TALK(0, 2, 0xD5, 4),
340 SCRIPT_COMMAND(0x323, 0x325, 2),
341 SCRIPT_WAIT(0x3C),
342 SCRIPT_COMMAND(0x323, 0x326, 2),
343 SCRIPT_WAIT(0x1E),
344 SCRIPT_TALK(0, 3, 2, 1),
345 SCRIPT_POSE(2, 7, 3),
347 SCRIPT_POSE(2, 1, 3),
348 SCRIPT_WAIT(0x1E),
349 SCRIPT_LOOK_AT(0, 0x120, 0xCE),
350 SCRIPT_WAIT(0x3C),
351 SCRIPT_TALK(0, 4, 0xD6, 2),
353 SCRIPT_WAIT(0x1E),
354 SCRIPT_POSE(0xD5, 1, 3),
355 SCRIPT_WAIT(0x1E),
356 SCRIPT_TALK(0, 5, 0xD5, 4),
358 SCRIPT_WAIT(0x1E),
359 SCRIPT_TALK(0, 6, 0xD6, 2),
361 SCRIPT_COMMAND(0x323, 0x325, 2),
362 SCRIPT_WAIT(0x3C),
363 SCRIPT_COMMAND(0x323, 0x326, 2),
364 SCRIPT_WAIT(0x1E),
365 SCRIPT_TALK(0, 7, 0xD5, 4),
367 SCRIPT_WAIT(0x1E),
368 SCRIPT_TALK(0, 8, 0xD6, 2),
370 SCRIPT_WAIT(0x1E),
371 SCRIPT_TALK(0, 9, 0xD5, 4),
373 SCRIPT_LOOK_AT(0, 0x150, 0xE8),
374 SCRIPT_WAIT(0x3C),
375 SCRIPT_TALK(0, 0xA, 0xD5, 4),
376 SCRIPT_POSE(0xD5, 0x52, 1),
377 SCRIPT_POSE(0xD6, 0x51, 7),
379 SCRIPT_WAIT_ANIM(0xD5),
380 SCRIPT_PLACE(0xD5, 0, 0),
381 SCRIPT_POSE(0xD5, 1, 0),
382 SCRIPT_POSE(0xD6, 1, 7),
383 SCRIPT_WAIT(0x5A),
384 SCRIPT_TALK(0, 0xB, 2, 1),
385 SCRIPT_POSE(2, 7, 3),
387 SCRIPT_POSE(2, 1, 3),
388 SCRIPT_WAIT(0x1E),
389 SCRIPT_TALK(0, 0xC, 0xD6, 1),
391 SCRIPT_WAIT(0x1E),
392 SCRIPT_POSE(0xD6, 0x57, 7),
394 SCRIPT_WAIT_ANIM(0xD6),
395 SCRIPT_PLACE(0xD6, 0, 0),
396 SCRIPT_POSE(0xD6, 1, 0),
397 SCRIPT_WAIT(0x3C),
398 SCRIPT_COMMAND(0x323, 0x325, 2),
399 SCRIPT_WAIT(0x3C),
400 SCRIPT_COMMAND(0x323, 0x326, 2),
401 SCRIPT_WAIT(0x1E),
402 SCRIPT_LOOK_AT(0, 0xE0, 0x86),
403 SCRIPT_WALK(2, 0x120, 0xD0, 3),
405 SCRIPT_POSE(2, 1, 3),
406 SCRIPT_PLACE(0xD6, 0xC2, 0x74),
407 SCRIPT_POSE(0xD6, 0x4F, 7),
409 SCRIPT_WAIT_ANIM(0xD6),
410 SCRIPT_POSE(0xD6, 1, 7),
411 SCRIPT_WAIT(0x3C),
413 SCRIPT_WAIT(0x5A),
414 SCRIPT_COMMAND(0x323, 0x325, 2),
415 SCRIPT_WAIT(0x5A),
416 SCRIPT_COMMAND(0x323, 0x326, 2),
418 SCRIPT_WAIT(0x1E),
419 SCRIPT_TALK(0, 0xD, 2, 0),
421 SCRIPT_WAIT(0x1E),
422 SCRIPT_TALK(0, 0xE, 0xD6, 1),
424 SCRIPT_WAIT(0x1E),
425 SCRIPT_TALK(0, 0xF, 2, 0),
427 SCRIPT_WAIT(0x1E),
428 SCRIPT_TALK(0, 0x10, 0xD6, 1),
430 SCRIPT_WAIT(0x1E),
431 SCRIPT_COMMAND(0x323, 0x325, 2),
432 SCRIPT_WAIT(0x3C),
433 SCRIPT_COMMAND(0x323, 0x326, 2),
434 SCRIPT_WAIT(0x1E),
435 SCRIPT_TALK(0, 0x11, 2, 0),
436 SCRIPT_POSE(2, 7, 3),
438 SCRIPT_POSE(2, 1, 3),
439 SCRIPT_WAIT(0x1E),
440 SCRIPT_TALK(0, 0x12, 0xD6, 1),
442 SCRIPT_WAIT(0x1E),
443 SCRIPT_TALK(0, 0x13, 2, 0),
444 SCRIPT_POSE(2, 7, 3),
446 SCRIPT_POSE(2, 1, 3),
447 SCRIPT_WAIT(0x1E),
448 SCRIPT_TALK(0, 0x14, 0xD6, 1),
450 SCRIPT_WAIT(0x1E),
451 SCRIPT_TALK(0, 0x15, 2, 0),
452 SCRIPT_POSE(2, 7, 3),
454 SCRIPT_POSE(2, 1, 3),
455 SCRIPT_WAIT(0x1E),
456 SCRIPT_TALK(0, 0x16, 0xD6, 1),
458 SCRIPT_WAIT(0x1E),
460 SCRIPT_WAIT(0x5A),
461 SCRIPT_COMMAND(0x323, 0x325, 2),
462 SCRIPT_WAIT(0x3C),
463 SCRIPT_COMMAND(0x323, 0x326, 2),
464 SCRIPT_COMMAND(0x355, 0x335, 2),
465 SCRIPT_WAIT(0x1E),
467 SCRIPT_WAIT(0x3C),
468 SCRIPT_PLACE(2, 0, 0),
469 SCRIPT_POSE(2, 1, 3),
470 SCRIPT_WAIT(0x3C),
472 SCRIPT_WAIT(6),
474 SCRIPT_WAIT(0x1E),
476};
478 { 61, 6 }, { 62, 6 }, { 63, 6 }, { 64, 6 },
479 { 65, 4 }, { 66, 4 }, { 67, 4 }, { 65, 4 },
480 { 66, 4 }, { 67, 4 }, { 65, 4 }, { 66, 4 },
481 { 67, 4 }, { 65, 4 }, { 66, 4 }, { 67, 4 },
482 { 65, 4 }, { 66, 4 }, { 67, 4 }, { 65, 4 },
483 { 66, 4 }, { 67, 4 }, { 65, 4 }, { 66, 4 },
484 { 67, 4 }, { 65, 4 }, { 66, 4 }, { 67, 4 },
485 { 65, 4 }, { 66, 4 }, { 67, 4 }, { 64, 6 },
486 { 63, 6 }, { 62, 6 }, { 61, 6 }, { 255, 0x3E7 },
487};
489 { 60, 2, 0x1CC, 0x1B4 },
490 { 60, 0, 0x1CC, 0x1B4 },
491 { 60, 0, 0x28C, 0x155 },
492 { 44, 0, 0x16C, 242 },
493};
495 { 0, 6 }, { 1, 6 }, { 2, 68 }, { 1, 4 },
496 { 0, 4 }, { 255, 0 },
497};
499 { 0x12C, 18 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
500 { 4, 6 }, { 5, 4 }, { 6, 4 }, { 7, 4 },
501 { 5, 4 }, { 6, 4 }, { 7, 4 }, { 5, 4 },
502 { 6, 4 }, { 7, 4 }, { 5, 4 }, { 6, 4 },
503 { 7, 4 }, { 4, 4 }, { 3, 4 }, { 2, 4 },
504 { 1, 4 }, { 255, 0x3E7 },
505};
506AreaBattle area0Battle0 = { 0, 0, MUSIC(1, 0) };
507AreaBattle area0Battle1 = { 0, 0, MUSIC(1, 0) };
508AreaBattle area0Battle2 = { 0, 0, MUSIC(1, 0) };
509AreaBattle area0Battle3 = { 0, 0, MUSIC(1, 0) };
510AreaBattle area0Battle4 = { 0, 0, MUSIC(1, 0) };
511AreaBattle area0Battle5 = { 0, 0, MUSIC(1, 0) };
512AreaBattle area0Battle6 = { 0, 0, MUSIC(1, 0) };
513AreaBattle area0Battle7 = { 0, 0, MUSIC(1, 0) };
519AreaBattle area1Battle0 = { 0, 0, MUSIC(1, 0) };
520AreaBattle area1Battle1 = { 0, 0, MUSIC(1, 0) };
521AreaBattle area1Battle2 = { 0, 0, MUSIC(1, 0) };
522AreaBattle area1Battle3 = { 0, 0, MUSIC(1, 0) };
523AreaBattle area1Battle4 = { 0, 0, MUSIC(1, 0) };
524AreaBattle area1Battle5 = { 0, 0, MUSIC(1, 0) };
525AreaBattle area1Battle6 = { 0, 0, MUSIC(1, 0) };
526AreaBattle area1Battle7 = { 0, 0, MUSIC(1, 0) };
532AreaBattle area2Battle0 = { 0, 0, MUSIC(1, 0) };
533AreaBattle area2Battle1 = { 0, 0, MUSIC(1, 0) };
534AreaBattle area2Battle2 = { 0, 0, MUSIC(1, 0) };
535AreaBattle area2Battle3 = { 0, 0, MUSIC(1, 0) };
536AreaBattle area2Battle4 = { 0, 0, MUSIC(1, 0) };
537AreaBattle area2Battle5 = { 0, 0, MUSIC(1, 0) };
538AreaBattle area2Battle6 = { 0, 0, MUSIC(1, 0) };
539AreaBattle area2Battle7 = { 0, 0, MUSIC(1, 0) };
549AreaBattle area3Battle4 = { 0, 0, MUSIC(1, 0) };
550AreaBattle area3Battle5 = { 0, 0, MUSIC(1, 0) };
551AreaBattle area3Battle6 = { 0, 0, MUSIC(1, 0) };
552AreaBattle area3Battle7 = { 0, 0, MUSIC(1, 0) };
562 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
563 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
564 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
565 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
566 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
567 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
568 { 0x140, 0x100, 0x14A, 0x178, 0x28, 0x78, 0x160, 0x1FC },
569 { 0x140, 0x100, 0x152, 0x100, 0x48, 0, 0x170, 0x1FC },
570 { 0x140, 0x100, 0x140, 0x100, 0, 0, 0x140, 0x1FB },
571 { 0x140, 0x100, 0x14A, 0x158, 0x28, 0x58, 0x150, 0x1FB },
572 { 0x140, 0x100, 0x15A, 0x1C0, 0x68, 0xC0, 0x160, 0x1FB },
573 { 0x140, 0x100, 0x170, 0x198, 0xC0, 0x98, 0x170, 0x1FB },
574 { 0x140, 0x100, 0x16A, 0x1C0, 0xA8, 0xC0, 0x140, 0x1FA },
575 { 0x140, 0x100, 0x162, 0x100, 0x88, 0, 0x150, 0x1F9 },
576};
590FieldActorEntry actor1 = { actor1Conditions, NULL, 0xD5, 5, 336, 232, 3 };
592FieldActorEntry actor3 = { actor3Conditions, NULL, 0xD7, 7, 249, 177, 7 };
593FieldActorEntry actor4 = { actor4Conditions, NULL, 0xD8, 8, 281, 118, 7 };
594FieldActorEntry actor5 = { actor5Conditions, NULL, 0xD9, 9, 120, 197, 7 };
595FieldActorEntry actor6 = { actor6Conditions, NULL, 0xDA, 0xA, 121, 117, 7 };
596FieldActorEntry actor7 = { actor7Conditions, NULL, 0x188, 0xB, 578, 401, 7 };
598 &actor0,
599 &actor1,
600 &actor2,
601 &actor3,
602 &actor4,
603 &actor5,
604 &actor6,
605 &actor7,
606 NULL,
607};
609 { 0, 1, 0x40, 2, 0x3D, 0, 0, 0, 0, 0, 268, 164, 208, 0 },
610 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
611};
613 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x2DE, 0xA0, 0x7C, 7, 0, 0, 0 },
614 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_LAUNCH, 0x2DF, 0x180, 0xFE, 3, 0, 0, 0 },
615 { { { FLAG(0x40, 0xA5), 0 }, { CODES_END, 0 } }, SLOT_EVENT, 0x438, 0, 0, 0, 0, 0, 0 },
616 { { { CODES_END, 0 }, { CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
617};
618void (*stageFuncs[])(void) = {
620};
622 { 1060, script1060, EVENT_TEXT(0xF), NULL, endEvent1060 },
623 { 1070, script1070, EVENT_TEXT(0x10), NULL, endEvent1070 },
624 { 1080, script1080, EVENT_TEXT(0x11), NULL, endEvent1080 },
625 { -1, NULL, 0, NULL, NULL },
626};
#define NULL
Definition common.h:17
signed int s32
Definition common.h:11
signed short s16
Definition common.h:9
unsigned short u16
Definition common.h:10
StageEffect * createStageEffect(s32 x, s32 y, s32 frame)
Creates a StageEffect at (x, y) with its sprites' frames from FRAME.
GameFlags FLAGS_00
The flag bitset FLAGS_00 and the event functions.
Definition events.c:701
GameState GAME
The save data, the game mode and the methods.
Definition state.c:64
#define TASK_RUN
Definition task.h:35
#define TASK_KILL
Definition task.h:37
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
Definition task.h:34
#define TASK_DONE
Definition task.h:36
EventTask * FIELDSTG_startEvent(s32 id)
Starts the event id of FieldState.events: its script, start and end, and its text; the player stands ...
Definition event.c:250
The stage overlays (AAA/PRO/WSTAG###.PRO), loaded at 0x800A4CA4 on top of FIELDSTG.
#define EVENT_TEXT(n)
An entry of the stage's events' text file, for FieldEvent.text.
Definition stage.h:732
void updateStage()
The names every stage defines, each its own (config/<version>/stages/<stage>.txt).
#define FIELD_COMMAND_PLAY_BM_ERASE
Definition field_map.h:58
#define FIELD_COMMAND_PLAY_DEMO_BGM
Definition field_map.h:53
#define SCRIPT_WAIT_WALK(id)
until the character gets to its goal
Definition field_map.h:168
#define FIELD_COMMAND_HALT_PARTNERS
The field commands, which an event script hands FIELD_TASK_COMMANDS as the first argument of a pose c...
Definition field_map.h:41
#define SCRIPT_END
The commands of an event script (FieldEvent.script), as FIELDSTG_runEvent reads them: a halfword kind...
Definition field_map.h:156
#define SCRIPT_LOOK_AT(snap, x, y)
FIELDSTG_pointCamera.
Definition field_map.h:172
#define SLOT_LAUNCH
sends the player flying (FIELDSTG_launchActor)
Definition field_map.h:267
#define SCRIPT_COMMAND(id, command, arg)
the same word for a script command's id: FIELDSTG_setEventPose creates its task if none runs and hand...
Definition field_map.h:161
#define SCRIPT_FOLLOW(snap, id)
FIELDSTG_followWithCamera.
Definition field_map.h:171
#define FIELD_COMMAND_STOP_CAMERA_SHAKE
Definition field_map.h:63
#define FIELD_MAP_FLOOR0
Some of FieldMap's maps (files): those of the floors the player walks on come first,...
Definition field_map.h:85
#define FIELD_COMMAND_SHAKE_CAMERA
Definition field_map.h:62
#define FIELD_COMMAND_PLAY_SN_ENTRY
Definition field_map.h:68
#define SLOT_EVENT
starts the event arg
Definition field_map.h:262
#define FIELD_COMMAND_PLAY_PLAYER11
Definition field_map.h:60
#define SCRIPT_WALK(id, x, y, dir)
Actor.setGoal: walks to (x, y), then faces dir.
Definition field_map.h:162
#define SCRIPT_WAIT_BOX
until box 0 closes
Definition field_map.h:167
#define SLOT_EXIT
The kinds of StageSlot (type).
Definition field_map.h:255
#define FIELD_COMMAND_STOP_PLAYER11
Definition field_map.h:61
#define SCRIPT_POSE(id, set, dir)
Actor.setPose: its animation set, facing dir.
Definition field_map.h:158
#define FIELD_MAP_TRIGGERS
a cell's value: a direction (3 bits) and a StageSlot (5)
Definition field_map.h:88
#define SCRIPT_WAIT(frames)
Definition field_map.h:166
#define SCRIPT_WAIT_ANIM(id)
until its animation ends
Definition field_map.h:169
#define FIELD_COMMAND_PLAY_TELEPORT
Definition field_map.h:70
#define FIELD_COMMAND_PLAY_LD_ERASE
Definition field_map.h:59
#define FIELD_TASK_COMMANDS
script command 813 (FIELDSTG_startCommandTask): the field commands
Definition field_map.h:33
#define FIELD_COMMAND_PLAY_SN_ERASE
Definition field_map.h:69
#define SCRIPT_PLACE(id, x, y)
puts a character at (x, y)
Definition field_map.h:157
#define SCRIPT_TALK(box, entry, id, kind)
box of the event's boxes shows the event text's entry: a talk box at the corner kind next to the char...
Definition field_map.h:165
FieldMap FIELDSTG_map
Definition fieldstg.c:3660
FieldState FIELDSTG_state
Definition fieldstg.c:2641
#define EVENT_BATTLE(id)
action: FIELDSTG_battleFuncs.startEventBattle
Definition game_state.h:72
#define CODES_END
Definition game_state.h:83
#define PROGRESS(n)
GAME.progress is n.
Definition game_state.h:69
#define FLAG(group, id)
The codes of the (code, value) pairs that FLAGS_00 checks as conditions and applies as actions (event...
Definition game_state.h:68
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
Definition sound.c:180
#define MUSIC_LAST_BOSS_2
LASTB_02: Lord Megadeath's second form (WSTAG820, fighter 0x1D3's entrance)
Definition sound.h:112
#define SOUND_TELEPORT
TELEPORT.
Definition sound.h:47
#define MUSIC(bank, n)
A field's or a battle's music (FieldState.music, Battle.music): track (SEP) n of the first sequence o...
Definition sound.h:70
#define MUSIC_SATELLITE_CONTROL_ROOM
ENV_0206: the Spy Satellite's Control Room.
Definition sound.h:145
#define MUSIC_LAST_BOSS
LASTBOSS: Lord Megadeath's battle (WSTAG820)
Definition sound.h:110
#define MUSIC_BANK(music)
The sound bank of a music, which a stage loads for it (FieldState.soundBank)
Definition sound.h:148
#define MUSIC_BOSS_1
BOSS_001: the Digimon Arena's, the cities', the dungeons' and the A.o.A's boss battles.
Definition sound.h:109
FIELDSTG's start of the stage (StageEntry.init in FIELDSTG_stages): the stage's task,...
s32 stepAnimationOnce(StageTileAnim *obj, AnimFrame *frames, s32 depth)
Steps OBJ's animation through FRAMES by the frame time (at most 4) and returns its frame,...
@ STORY_GUNSLINGER
WSTAG810 (Gunslinger 1F), event 1035.
Definition story.h:143
@ STORY_MOVIE_BATTLES
WSTAG820, event 1080, with Snatchmon: each encounter plays MODE_BATTLE_MOVIE first.
Definition story.h:146
#define FLAG_SNATCHMON_APPEARS_SEEN
wstag820 event 1070: Snatchmon appears and questions Lord Megadeath's orders; set at its end,...
Definition story.h:1520
#define FLAG_MEGADEATH_WIN_SEEN
wstag820 event 1060: beaten, Lord Megadeath calls it a test and brings out Snatchmon; set at its end,...
Definition story.h:1517
Where an actor's frames go in VRAM: one of the records after the FieldImage (Actor....
Definition field_map.h:114
One frame of a sprite animation; frame 0xFF ends it (or loops it)
Definition gfx.h:296
s16 duration
Definition gfx.h:298
s16 index
Definition gfx.h:302
s16 timer
Definition gfx.h:303
A battle of an area's BattleList, which can start on the field (see FIELDSTG_startEncounter); FIGHTST...
Definition field_map.h:402
The battles of an area of the map (its cells' value at FieldMap.files[4]), one picked at random.
Definition field_map.h:411
A character of the field (FieldState.actors, a list of pointers up to NULL), which FIELDSTG_updateFie...
Definition field_map.h:194
The battles of a place (FieldState.battles), by area of the map: the fourth area's are also the ones ...
Definition field_map.h:422
An event of the table FieldState.events, up to the first id -1, which FIELDSTG_startEvent starts.
Definition field_map.h:141
void(* setFile)(s32 index, s32 file)
FIELDSTG_setMapFile.
Definition field_map.h:100
void(* setFirstMap)(s32 index)
FIELDSTG_setFirstMap: the map the player starts on (GAME.mapIndex), when the mode is new.
Definition field_map.h:104
s32 sheetEntry
the stage's sprite sheet, loaded before the field starts, or 0
Definition field_map.h:445
FieldEvent * events
up to the first id -1
Definition field_map.h:451
s32 soundBank
SOUND.loadBank's, or 0.
Definition field_map.h:459
StageTile * objects
the map objects, up to the first margin 0
Definition field_map.h:446
s32 imageFile
or an image archive file, or 0
Definition field_map.h:449
FieldBattles * battles
Definition field_map.h:450
Vec2 start
where the player starts
Definition field_map.h:456
StageSlot * slots
up to the first type 0
Definition field_map.h:447
ActorImage * actors
then the actors', from actors[2]
Definition field_map.h:454
s32 mapFile
the file of the map's tiles (FIELDSTG_createMapStreamer)
Definition field_map.h:444
s32 startDir
and its direction
Definition field_map.h:457
s32 textFile
the stage's text file, for the talks
Definition field_map.h:461
union FieldState::@12 images
s32 music
SOUND.playSound's, or 0.
Definition field_map.h:460
void(* applyAction)(s32 code, s32 value)
Definition game_state.h:52
s32(* checkCondition)(u16 code, u16 value)
Definition game_state.h:53
short(* playSound)(s32 id)
returns the voice of a key-on
Definition sound.h:187
A sprite effect a stage creates at (x, y) with the given frame, by kind.
Definition stage.h:290
A sprite at (x, y) from the stage's sheet (FieldState.sheetEntry) with an animated palette,...
Definition stage.h:79
s32 x
Definition stage.h:82
s32 frame
Definition stage.h:81
s32 y
Definition stage.h:83
What the player can trigger on a map (FIELDSTG_updateTriggers): a record of the table at FieldState....
Definition field_map.h:276
The task a stage starts (startStage), updated by its updateStage.
Definition stage.h:26
void(* nextState)(struct StageTask *task)
Definition stage.h:27
s32 state
Definition stage.h:27
StageTile * tile
Definition stage.h:109
AnimState anim
Definition stage.h:110
A map object, animated.
Definition stage.h:353
void(* setState)(struct StageTileTask *task, s32 state)
Definition stage.h:354
void(* nextState)(struct StageTileTask *task)
Definition stage.h:354
StageTileAnim obj
Definition stage.h:355
An object of a map, which FIELDSTG draws: a record of the table at FieldState.objects,...
Definition field_map.h:208
u8 anim
which of a stage's animations sets frame (1-3); FIELDSTG finds objects by it (its lift,...
Definition field_map.h:210
Any task, seen through its header.
Definition task.h:62
void(* setState)(struct Task *task, s32 state)
Definition task.h:63
Definition gfx.h:352
void * createTaskWithId(void(*update)(), s32 size, s32 childrenSize, s32 id)
Allocates a zeroed task of size bytes (header included) with room for childrenSize / 4 child tasks.
Definition task.c:80
void updateStageEffect(StageEffect *task)
An effect that plays its animation each time it is set to TASK_DONE.
Definition wstag310.c:615
u16 actor1Conditions[]
Definition wstag820.c:578
AreaBattle area2Battle7
Definition wstag820.c:539
FieldActorEntry actor0
Definition wstag820.c:589
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag820.c:618
FieldActorEntry actor6
Definition wstag820.c:595
AreaBattle area2Battle6
Definition wstag820.c:538
s16 script1080[]
Definition wstag820.c:282
AnimFrame effectClutFrames[]
Definition wstag820.c:494
void handleCommand845(Task *task, s32 id)
Sets the task to TASK_DONE when the id is 0x335.
Definition wstag820.c:110
AnimFrame updateTileTaskFrames[]
Definition wstag820.c:477
AreaBattle area1Battle6
Definition wstag820.c:525
FieldActorEntry actor5
Definition wstag820.c:594
AreaBattle area0Battle7
Definition wstag820.c:513
FieldActorEntry actor2
Definition wstag820.c:591
AreaBattle area3Battle4
Definition wstag820.c:549
AreaBattle area3Battle3
Definition wstag820.c:548
AreaBattle area0Battle1
Definition wstag820.c:507
AreaBattle area2Battle0
Definition wstag820.c:532
FieldActorEntry * stageActors[]
Definition wstag820.c:597
AreaBattle area1Battle2
Definition wstag820.c:521
void * createCommand853(s32 id)
Creates the task of updateTileTask with the given id, with a sound.
Definition wstag820.c:51
AreaBattle area3Battle0
Definition wstag820.c:545
AreaBattle area0Battle6
Definition wstag820.c:512
AreaBattle area3Battle2
Definition wstag820.c:547
AreaBattle area3Battle1
Definition wstag820.c:546
AreaBattle area0Battle3
Definition wstag820.c:509
u16 actor4Conditions[]
Definition wstag820.c:581
FieldActorEntry actor4
Definition wstag820.c:593
u16 actor3Conditions[]
Definition wstag820.c:580
AreaBattle area3Battle6
Definition wstag820.c:551
ActorImage stageImages[]
Definition wstag820.c:561
void endEvent1070(void)
After event 1070, with the player: keeps it from playing again.
Definition wstag820.c:126
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing the ambience ENV_0206.
Definition wstag820.c:149
AnimFrame effectFrames[]
Definition wstag820.c:498
AreaBattle area2Battle4
Definition wstag820.c:536
StageEffectSpot updateStageSpots[]
Defined below, after the code that uses them.
Definition wstag820.c:488
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag820.c:608
u16 actor5Conditions[]
Definition wstag820.c:582
BattleList area3Battles
Definition wstag820.c:553
s16 script1060[]
Definition wstag820.c:169
AreaBattle area3Battle5
Definition wstag820.c:550
AreaBattle area0Battle5
Definition wstag820.c:511
BattleList area1Battles
Definition wstag820.c:527
BattleList area2Battles
Definition wstag820.c:540
void * createStageEffectWithId(s32 arg)
Creates the StageEffect of updateStageEffect at (0x1CC, 0x1B4) with frame 0x3C.
Definition wstag820.c:100
AreaBattle area1Battle4
Definition wstag820.c:523
u16 actor6Conditions[]
Definition wstag820.c:583
AreaBattle area2Battle2
Definition wstag820.c:534
AreaBattle area1Battle5
Definition wstag820.c:524
FieldActorEntry actor7
Definition wstag820.c:596
StageSlot stageSlots[]
Definition wstag820.c:612
AreaBattle area2Battle1
Definition wstag820.c:533
AreaBattle area1Battle3
Definition wstag820.c:522
void updateTileTask(StageTileTask *task)
Shows the map object with animation 1, animated once, then hides it and kills itself.
Definition wstag820.c:16
AreaBattle area1Battle0
Definition wstag820.c:519
FieldActorEntry actor1
Definition wstag820.c:590
AreaBattle area0Battle0
Definition wstag820.c:506
AreaBattle area0Battle2
Definition wstag820.c:508
#define STAGE_FILE
Definition wstag820.c:146
AreaBattle area2Battle5
Definition wstag820.c:537
AreaBattle area1Battle1
Definition wstag820.c:520
u16 actor7Conditions[]
Definition wstag820.c:584
AreaBattle area2Battle3
Definition wstag820.c:535
u16 actor2Conditions[]
Definition wstag820.c:579
AreaBattle area0Battle4
Definition wstag820.c:510
void endEvent1080(void)
After event 1080, with Snatchmon: moves the story on to STORY_MOVIE_BATTLES and starts the stage's ev...
Definition wstag820.c:134
#define STAGE_TEXT
Definition wstag820.c:144
AreaBattle area3Battle7
Definition wstag820.c:552
BattleList area0Battles
Definition wstag820.c:514
AreaBattle area1Battle7
Definition wstag820.c:526
void endEvent1060(void)
After event 1060, with the player: starts the stage's event battle 0 and keeps it from playing again.
Definition wstag820.c:120
FieldActorEntry actor3
Definition wstag820.c:592
FieldBattles stageBattles[]
Definition wstag820.c:558
FieldEvent stageEvents[]
Definition wstag820.c:621
s16 script1070[]
Definition wstag820.c:242
u16 actor0Conditions[]
Definition wstag820.c:577