Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag311.c
Go to the documentation of this file.
1/*
2 * WSTAG311: A.o.A Headquarters, Amaterasu City. On the Amaterasu server; its
3 * Asuka server twin is WSTAG310.
4 */
5
6#include "common.h"
7#include "field/stage.h"
8/* Defined below, after the code that uses them */
24
26
28
30
32
33#include "common/tile_six.inc.c"
34
35/* Animates the map objects with animations 5 to 10 by mode (0: hidden, 1 and 3: the first two once, then mode 2 or 0; 2: the other four) */
37 StageTile *tile;
38 s32 done;
39 s32 i;
40 s32 frame;
41
42 switch (task->state) {
43 case TASK_INIT:
44 default:
45 findTileSix(task);
46 task->mode = 0;
47 task->nextState(task);
48 break;
49 case TASK_RUN:
50 done = 0;
51 for (i = 0; i < 6; i++) {
52 tile = task->tiles[i].tile;
53 switch (task->mode) {
54 case 0:
55 tile->visible = 0;
56 break;
57 case 1:
58 switch (i) {
59 case 0:
60 frame = stepTileAnimation(&task->tiles[0], updateTileSixFrames0, 1, 0);
61 if (frame != 0xFF) {
62 tile->frame = frame;
63 tile->visible = 1;
64 } else {
65 done++;
66 tile->frame = 0;
67 tile->visible = 0;
68 }
69 break;
70 case 1:
71 frame = stepTileAnimation(&task->tiles[1], updateTileSixFrames1, 1, 0);
72 if (frame != 0xFF) {
73 tile->frame = frame;
74 tile->visible = 1;
75 } else {
76 done++;
77 tile->frame = 0;
78 tile->visible = 0;
79 }
80 break;
81 case 2:
82 case 3:
83 case 4:
84 case 5:
85 tile->visible = 0;
86 break;
87 }
88 break;
89 case 2:
90 showLastFourTiles(task, tile, i);
91 break;
92 case 3:
93 switch (i) {
94 case 0:
95 frame = stepTileAnimation(&task->tiles[0], updateTileSixFrames4, 1, 0);
96 if (frame != 0xFF) {
97 tile->frame = frame;
98 tile->visible = 1;
99 } else {
100 done++;
101 tile->frame = 0;
102 tile->visible = 0;
103 }
104 break;
105 case 1:
106 frame = stepTileAnimation(&task->tiles[1], updateTileSixFrames4, 1, 0);
107 if (frame != 0xFF) {
108 tile->frame = frame;
109 tile->visible = 1;
110 } else {
111 done++;
112 tile->frame = 0;
113 tile->visible = 0;
114 }
115 break;
116 case 2:
117 case 3:
118 case 4:
119 case 5:
120 tile->visible = 0;
121 break;
122 }
123 break;
124 }
125 }
126 if (done >= 2) {
127 switch (task->mode) {
128 case 1:
129 task->mode = 2;
130 break;
131 case 3:
132 task->mode = 0;
133 break;
134 }
135 }
136 break;
137 case TASK_DONE:
138 case TASK_KILL:
139 break;
140 }
141}
142
143/* Restarts the first two map objects' animations for mode 1 (id 0) or 3 (id 1) */
145 if (task != NULL) {
146 switch (id) {
147 case 0:
148 task->tiles[0].anim.index = 0;
150 task->tiles[1].anim.index = 0;
152 task->mode = 1;
153 break;
154 case 1:
155 task->tiles[0].anim.index = 0;
156 task->tiles[0].anim.timer = updateTileSixFrames3[15].duration; /* the animation after updateTileSixFrames3's */
157 task->tiles[1].anim.index = 0;
159 task->mode = 3;
160 break;
161 }
162 }
163}
164
165/*
166 * Creates the first set of six map objects (updateTileSix) with an id;
167 * nothing in the game calls it
168 */
170 return createTaskWithId(updateTileSix, sizeof(StageTileSix), 0, arg);
171}
172
174
176
177/*
178 * Finds the map objects with animations 11 to 16 and starts the
179 * animations of the first four
180 */
181static inline void findTileSixW(StageTileSix *task) {
182 StageTile *object;
183
184 for (object = FIELDSTG_state.objects; object->margin != 0; object++) {
185 if (object->anim >= 11 && object->anim <= 16) {
186 switch (object->anim) {
187 case 11:
188 task->tiles[0].tile = object;
189 task->tiles[0].anim.index = 0;
191 break;
192 case 12:
193 task->tiles[1].tile = object;
194 task->tiles[1].anim.index = 0;
196 break;
197 case 13:
198 task->tiles[2].tile = object;
199 task->tiles[2].anim.index = 0;
201 break;
202 case 14:
203 task->tiles[3].tile = object;
204 task->tiles[3].anim.index = 0;
206 break;
207 case 15:
208 task->tiles[4].tile = object;
209 task->tiles[4].anim.index = 0;
210 task->tiles[4].anim.timer = 0;
211 break;
212 case 16:
213 task->tiles[5].tile = object;
214 task->tiles[5].anim.index = 0;
215 task->tiles[5].anim.timer = 0;
216 break;
217 }
218 }
219 }
220}
221
222/*
223 * Mode 2: hides the first two map objects and shows the other four, the
224 * third and fourth with their looping palettes and the last two still
225 */
226static inline void showLastFourTilesW(StageTileSix *task, StageTile *tile, s32 i) {
227 switch (i) {
228 case 0:
229 case 1:
230 tile->visible = 0;
231 break;
232 case 2:
233 tile->frame = 0x29;
234 tile->clutRow = stepTileAnimation2(&task->tiles[i], updateTileSixWFrames2, 0, 0);
235 tile->visible = 1;
236 break;
237 case 3:
238 tile->frame = 0x11;
239 tile->clutRow = stepTileAnimation2(&task->tiles[i], updateTileSixWFrames3, 0, 0);
240 tile->visible = 1;
241 break;
242 case 4:
243 tile->visible = 1;
244 tile->frame = 0x12;
245 tile->clutRow = 0;
246 break;
247 case 5:
248 tile->visible = 1;
249 tile->frame = 0x13;
250 tile->clutRow = 0;
251 break;
252 }
253}
254
255/* Animates the map objects with animations 11 to 16 by mode (0: hidden, 1 and 3: the first two once, then mode 2 or 0; 2: the other four) */
257 StageTile *tile;
258 s32 done;
259 s32 i;
260 s32 frame;
261
262 switch (task->state) {
263 case TASK_INIT:
264 default:
265 findTileSixW(task);
266 task->mode = 0;
267 task->nextState(task);
268 break;
269 case TASK_RUN:
270 done = 0;
271 for (i = 0; i < 6; i++) {
272 tile = task->tiles[i].tile;
273 switch (task->mode) {
274 case 0:
275 tile->visible = 0;
276 break;
277 case 1:
278 switch (i) {
279 case 0:
280 frame = stepTileAnimation2(&task->tiles[0], updateTileSixWFrames0, 1, 0);
281 if (frame != 0xFF) {
282 tile->frame = frame;
283 tile->visible = 1;
284 } else {
285 done++;
286 tile->frame = 0;
287 tile->visible = 0;
288 }
289 break;
290 case 1:
291 frame = stepTileAnimation2(&task->tiles[1], updateTileSixWFrames1, 1, 0);
292 if (frame != 0xFF) {
293 tile->frame = frame;
294 tile->visible = 1;
295 } else {
296 done++;
297 tile->frame = 0;
298 tile->visible = 0;
299 }
300 break;
301 case 2:
302 case 3:
303 case 4:
304 case 5:
305 tile->visible = 0;
306 break;
307 }
308 break;
309 case 2:
310 showLastFourTilesW(task, tile, i);
311 break;
312 case 3:
313 switch (i) {
314 case 0:
315 frame = stepTileAnimation2(&task->tiles[0], updateTileSixWFrames4, 1, 0);
316 if (frame != 0xFF) {
317 tile->frame = frame;
318 tile->visible = 1;
319 } else {
320 done++;
321 tile->frame = 0;
322 tile->visible = 0;
323 }
324 break;
325 case 1:
326 frame = stepTileAnimation2(&task->tiles[1], updateTileSixWFrames4, 1, 0);
327 if (frame != 0xFF) {
328 tile->frame = frame;
329 tile->visible = 1;
330 } else {
331 done++;
332 tile->frame = 0;
333 tile->visible = 0;
334 }
335 break;
336 case 2:
337 case 3:
338 case 4:
339 case 5:
340 tile->visible = 0;
341 break;
342 }
343 break;
344 }
345 }
346 if (done >= 2) {
347 switch (task->mode) {
348 case 1:
349 task->mode = 2;
350 break;
351 case 3:
352 task->mode = 0;
353 break;
354 }
355 }
356 break;
357 case TASK_DONE:
358 case TASK_KILL:
359 break;
360 }
361}
362
363/* Restarts the first two map objects' animations for mode 1 (id 0) or 3 (id 1) */
365 if (task != NULL) {
366 switch (id) {
367 case 0:
368 task->tiles[0].anim.index = 0;
370 task->tiles[1].anim.index = 0;
372 task->mode = 1;
373 break;
374 case 1:
375 task->tiles[0].anim.index = 0;
376 task->tiles[0].anim.timer = updateTileSixWFrames3[12].duration; /* the animation after updateTileSixWFrames3's */
377 task->tiles[1].anim.index = 0;
379 task->mode = 3;
380 break;
381 }
382 }
383}
384
385/*
386 * Creates the second set of six map objects (updateTileSixW) with an id;
387 * nothing in the game calls it
388 */
390 return createTaskWithId(updateTileSixW, sizeof(StageTileSix), 0, arg);
391}
392
393/*
394 * Creates the second set of six map objects (updateTileSixW) without an id;
395 * nothing in the game calls it
396 */
397void *createTileSixW(void) {
398 return createTask(updateTileSixW, sizeof(StageTileSix), 0);
399}
400
401/* Creates the stage helper task, the sprite effects and the event object of the story so far */
402void updateStage(StageTask *task, void **children) {
403 s32 i;
404
405 switch (task->state) {
406 case TASK_INIT:
407 default:
408 children[0] = createTileAnims();
409 for (i = 0; i < 3; i++) {
410 if (updateStageSpots[i].kind == 0 || (updateStageSpots[i].kind == 2 && GAME.progress >= STORY_OPERATION_SIGMA)) {
411 children[3 + i] = createStageEffect(updateStageSpots[i].x, updateStageSpots[i].y, updateStageSpots[i].frame);
412 }
413 }
414 switch (GAME.progress) {
417 children[6] = FIELDSTG_startEvent(0x3A3);
419 children[6] = FIELDSTG_startEvent(0x3A4);
420 } else if (FLAGS_00.checkCondition(FLAG(0x40, 0x5F), 0)) {
421 children[6] = FIELDSTG_startEvent(0x3A5);
423 children[6] = FIELDSTG_startEvent(0x3A6);
424 }
425 break;
428 break;
429 }
430 task->nextState(task);
431 break;
432 case TASK_RUN:
433 case TASK_DONE:
434 case TASK_KILL:
435 break;
436 }
437}
438
439#define STAGE_CHILDREN_SIZE 0x1C
446
447/* Creates the effect of frame 0x2A at (0x10F, 0x19B), playing, with a sound */
450
451 task->x = 0x10F;
452 task->y = 0x19B;
454 task->frame = 0x2A;
455 task->setState(task, TASK_DONE);
456 return task;
457}
458
459/*
460 * After event 931, with Royal Guard: starts the stage's event battle 1, sets
461 * flag 0x0C33 (which decides whether actors 4 to 6 appear) and keeps it from
462 * playing again
463 */
469
470/*
471 * After event 932, with Chief Officer: starts the stage's event battle 0 and
472 * keeps it from playing again
473 */
478
479/* After event 933, with Chief Officer, Nick, Lisa and Teddy: keeps it from playing again */
480void endEvent933(void) {
481 FLAGS_00.applyAction(FLAG(0x40, 0x5F), 1);
482}
483
484/* After event 934, with Teddy and Nick: keeps it from playing again */
488
489/* After event 981, with the player: keeps it from playing again */
493
494/* After event 982, with the player: moves the story on to STORY_OPERATION_SIGMA */
498
499#if VERSION_US || VERSION_JP
500#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_03)
501#define EVENT_TEXT_FILE (TEXT_EVENTS_300 - 1)
502#define STAGE_FILE 0x52D
503#elif VERSION_EU
504#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_03)
505#define EVENT_TEXT_FILE (TEXT_EVENTS_300 - 1)
506#define STAGE_FILE 0x53D
507#endif
508/* Sets the stage up: its map, actors, battles and events, playing the ambience ENV_0002 */
528
530 SCRIPT_PLACE(2, 0x58, 0x20C),
531 SCRIPT_POSE(2, 1, 5),
532 SCRIPT_WAIT(0x78),
533 SCRIPT_COMMAND(0x323, 0x325, 2),
534 SCRIPT_WAIT(0x5A),
535 SCRIPT_COMMAND(0x323, 0x326, 2),
536 SCRIPT_WAIT(0x1E),
537 SCRIPT_WALK(2, 0xD0, 0x1D0, 5),
539 SCRIPT_POSE(2, 1, 5),
540 SCRIPT_WAIT(0x1E),
541 SCRIPT_POSE(0xD2, 1, 7),
542 SCRIPT_POSE(0xD3, 1, 3),
543 SCRIPT_WAIT(0x1E),
544 SCRIPT_WAIT(0x1E),
545 SCRIPT_TALK(0, 1, 0xD4, 2),
547 SCRIPT_WAIT(0x1E),
548 SCRIPT_POSE(2, 1, 5),
549 SCRIPT_WAIT(0x1E),
550 SCRIPT_POSE(2, 1, 3),
551 SCRIPT_WAIT(0x1E),
552 SCRIPT_POSE(2, 1, 5),
553 SCRIPT_WAIT(0x1E),
554 SCRIPT_POSE(2, 1, 7),
555 SCRIPT_WAIT(0x1E),
556 SCRIPT_POSE(2, 1, 5),
557 SCRIPT_WAIT(0x1E),
558 SCRIPT_TALK(0, 2, 2, 0),
559 SCRIPT_POSE(2, 7, 5),
561 SCRIPT_POSE(2, 1, 5),
562 SCRIPT_WAIT(0x1E),
563 SCRIPT_TALK(0, 3, 0xD3, 0),
565 SCRIPT_WAIT(0x1E),
566 SCRIPT_TALK(0, 4, 0xD2, 2),
568 SCRIPT_WAIT(0x1E),
570};
572 SCRIPT_PLACE(2, 0xD0, 0x1D0),
573 SCRIPT_POSE(2, 1, 5),
574 SCRIPT_PLACE(0x102, 0x1D0, 0x120),
575 SCRIPT_POSE(0x102, 1, 1),
576 SCRIPT_WAIT(0x78),
577 SCRIPT_TALK(0, 8, 2, 0),
579 SCRIPT_WAIT(0x1E),
580 SCRIPT_WALK(2, 0x150, 0x190, 5),
582 SCRIPT_POSE(2, 1, 5),
583 SCRIPT_COMMAND(0x323, 0x325, 2),
585 SCRIPT_WAIT(0x3C),
586 SCRIPT_COMMAND(0x323, 0x326, 2),
587 SCRIPT_WAIT(0x1E),
588 SCRIPT_LOOK_AT(0, 0x170, 0x160),
589 SCRIPT_TALK(0, 1, 0x102, 1),
591 SCRIPT_WAIT(0x1E),
592 SCRIPT_FOLLOW(0, 2),
593 SCRIPT_WALK(0x102, 0x1B0, 0x130, 1),
594 SCRIPT_WAIT_WALK(0x102),
595 SCRIPT_WALK(0x102, 0x170, 0x180, 1),
596 SCRIPT_WAIT_WALK(0x102),
597 SCRIPT_POSE(0x102, 1, 1),
598 SCRIPT_WAIT(0x1E),
599 SCRIPT_TALK(0, 2, 2, 1),
600 SCRIPT_POSE(2, 7, 5),
602 SCRIPT_POSE(2, 1, 5),
603 SCRIPT_WAIT(0x1E),
604 SCRIPT_TALK(0, 3, 0x102, 2),
606 SCRIPT_WAIT(0x1E),
607 SCRIPT_TALK(0, 4, 2, 1),
608 SCRIPT_POSE(2, 7, 5),
610 SCRIPT_POSE(2, 1, 5),
611 SCRIPT_WAIT(0x1E),
612 SCRIPT_TALK(0, 5, 0x102, 2),
614 SCRIPT_WAIT(0x1E),
615 SCRIPT_TALK(0, 6, 2, 1),
616 SCRIPT_POSE(2, 7, 5),
618 SCRIPT_POSE(2, 1, 5),
619 SCRIPT_WAIT(0x1E),
620 SCRIPT_TALK(0, 7, 0x102, 2),
622 SCRIPT_WAIT(0x1E),
624};
626 SCRIPT_LOOK_AT(1, 0x150, 0x1A0),
627 SCRIPT_PLACE(2, 0x150, 0x190),
628 SCRIPT_POSE(2, 1, 5),
629 SCRIPT_PLACE(0x102, 0x170, 0x180),
630 SCRIPT_POSE(0x102, 1, 1),
631 SCRIPT_WAIT(0x78),
632 SCRIPT_TALK(0, 1, 0x102, 0),
634 SCRIPT_WAIT(0x1E),
635 SCRIPT_COMMAND(0x323, 0x325, 2),
636 SCRIPT_WAIT(0x3C),
637 SCRIPT_COMMAND(0x323, 0x326, 2),
638 SCRIPT_WAIT(0x1E),
639 SCRIPT_TALK(0, 2, 2, 3),
641 SCRIPT_PLACE(0x67, 0xA0, 0x1E8),
642 SCRIPT_POSE(0x67, 1, 5),
643 SCRIPT_WAIT(0x1E),
644 SCRIPT_PLACE(0xC, 0xA0, 0x1E8),
645 SCRIPT_POSE(0xC, 1, 5),
646 SCRIPT_WALK(0x67, 0xC0, 0x1D8, 5),
647 SCRIPT_WAIT_WALK(0x67),
648 SCRIPT_WALK(0xC, 0xC0, 0x1D8, 5),
649 SCRIPT_PLACE(0x65, 0xA0, 0x1E8),
650 SCRIPT_POSE(0x65, 1, 5),
651 SCRIPT_WALK(0x67, 0xE0, 0x1C8, 5),
652 SCRIPT_WAIT_WALK(0x67),
653 SCRIPT_POSE(0xC, 1, 5),
654 SCRIPT_COMMAND(0x323, 0x325, 0x67),
655 SCRIPT_WAIT(0x3C),
656 SCRIPT_COMMAND(0x323, 0x326, 0x67),
657 SCRIPT_WAIT(0x1E),
658 SCRIPT_TALK(0, 3, 0x67, 2),
660 SCRIPT_COMMAND(0x323, 0x325, 2),
661 SCRIPT_WAIT(0x3C),
662 SCRIPT_COMMAND(0x323, 0x326, 2),
663 SCRIPT_WAIT(0x1E),
664 SCRIPT_TALK(0, 0xF, 2, 3),
665 SCRIPT_POSE(2, 7, 1),
667 SCRIPT_POSE(2, 1, 1),
668 SCRIPT_WALK(0xC, 0x110, 0x1B0, 5),
669 SCRIPT_WALK(0x65, 0xF0, 0x1C0, 5),
670 SCRIPT_WALK(0x67, 0x130, 0x1A0, 5),
671 SCRIPT_WAIT_WALK(0x67),
672 SCRIPT_WALK(0xC, 0x130, 0x1A0, 5),
673 SCRIPT_WALK(0x65, 0x110, 0x1B0, 5),
674 SCRIPT_WALK(0x67, 0x110, 0x190, 3),
675 SCRIPT_WAIT_WALK(0x67),
676 SCRIPT_WALK(0xC, 0x150, 0x1B0, 7),
677 SCRIPT_WALK(0x65, 0x130, 0x1A0, 5),
678 SCRIPT_POSE(0x67, 1, 5),
679 SCRIPT_WAIT_WALK(0x65),
680 SCRIPT_POSE(2, 1, 5),
681 SCRIPT_POSE(0xC, 1, 5),
682 SCRIPT_POSE(0x65, 1, 5),
683 SCRIPT_WAIT(0x1E),
684 SCRIPT_TALK(0, 0x11, 0x65, 1),
686 SCRIPT_WAIT(0x1E),
687 SCRIPT_TALK(0, 4, 0x102, 0),
688 SCRIPT_POSE(2, 1, 5),
690 SCRIPT_WAIT(0x1E),
691 SCRIPT_TALK(0, 5, 0x65, 1),
693 SCRIPT_WAIT(0x1E),
694 SCRIPT_TALK(0, 6, 0x102, 0),
696 SCRIPT_COMMAND(0x323, 0x325, 2),
697 SCRIPT_COMMAND(0x324, 0x325, 0x65),
698 SCRIPT_COMMAND(0x325, 0x325, 0xC),
699 SCRIPT_COMMAND(0x326, 0x325, 0x67),
700 SCRIPT_WAIT(0x3C),
701 SCRIPT_COMMAND(0x323, 0x326, 2),
702 SCRIPT_COMMAND(0x324, 0x326, 0x65),
703 SCRIPT_COMMAND(0x325, 0x326, 0xC),
704 SCRIPT_COMMAND(0x326, 0x326, 0x67),
705 SCRIPT_WAIT(0x1E),
706 SCRIPT_TALK(0, 7, 0x65, 1),
707 SCRIPT_POSE(2, 1, 1),
708 SCRIPT_POSE(0xC, 1, 3),
709 SCRIPT_POSE(0x67, 1, 7),
711 SCRIPT_WAIT(0x1E),
712 SCRIPT_TALK(1, 0x12, 0xC, 3),
713 SCRIPT_TALK(0, 9, 0x67, 0),
714 SCRIPT_POSE(0xC, 7, 3),
716 SCRIPT_WALK(2, 0x130, 0x184, 3),
717 SCRIPT_POSE(0xC, 1, 3),
719 SCRIPT_POSE(2, 1, 7),
720 SCRIPT_WALK(0x102, 0x150, 0x190, 1),
721 SCRIPT_WAIT_WALK(0x102),
722 SCRIPT_POSE(0x102, 1, 1),
723 SCRIPT_WAIT(0x1E),
724 SCRIPT_POSE(2, 1, 1),
725 SCRIPT_POSE(0xC, 1, 1),
726 SCRIPT_WALK(0x65, 0x40, 0x21A, 1),
727 SCRIPT_POSE(0x67, 1, 1),
728 SCRIPT_WALK(0x102, 0x40, 0x21A, 1),
729 SCRIPT_WAIT(0x5A),
730 SCRIPT_FOLLOW(0, 2),
731 SCRIPT_COMMAND(0x323, 0x325, 0x67),
732 SCRIPT_WAIT(0x3C),
733 SCRIPT_POSE(2, 1, 0),
734 SCRIPT_COMMAND(0x323, 0x326, 0x67),
735 SCRIPT_WAIT(0x1E),
736 SCRIPT_TALK(0, 0xC, 0x67, 2),
737 SCRIPT_POSE(0x67, 1, 7),
739 SCRIPT_PLACE(0x65, 0, 0),
740 SCRIPT_POSE(0x65, 1, 0),
741 SCRIPT_PLACE(0x102, 0, 0),
742 SCRIPT_POSE(0x102, 1, 0),
743 SCRIPT_WAIT(0x1E),
744 SCRIPT_TALK(0, 8, 0xC, 2),
745 SCRIPT_POSE(0xC, 1, 3),
747 SCRIPT_WALK(0x67, 0x130, 0x1A0, 7),
748 SCRIPT_WAIT_WALK(0x67),
749 SCRIPT_WALK(0xC, 0x130, 0x1A0, 3),
750 SCRIPT_WALK(0x67, 0x150, 0x190, 5),
751 SCRIPT_WAIT_WALK(0xC),
752 SCRIPT_POSE(2, 1, 7),
753 SCRIPT_WALK(0xC, 0x150, 0x190, 5),
754 SCRIPT_WALK(0x67, 0x170, 0x180, 5),
755 SCRIPT_WAIT_WALK(0xC),
756 SCRIPT_WALK(2, 0x150, 0x190, 5),
757 SCRIPT_WALK(0xC, 0x170, 0x180, 5),
758 SCRIPT_WALK(0x67, 0x1B0, 0x130, 5),
760 SCRIPT_TALK(0, 0xA, 2, 1),
761 SCRIPT_POSE(2, 7, 5),
763 SCRIPT_POSE(2, 1, 5),
764 SCRIPT_WAIT(0x1E),
765 SCRIPT_TALK(0, 0xB, 0xC, 0),
766 SCRIPT_POSE(0xC, 7, 1),
768 SCRIPT_POSE(0xC, 1, 1),
769 SCRIPT_POSE(0x67, 1, 1),
770 SCRIPT_WAIT(0x1E),
771 SCRIPT_FOLLOW(0, 0xC),
772 SCRIPT_TALK(0, 0x10, 0x67, 1),
774 SCRIPT_WAIT(0x1E),
775 SCRIPT_COMMAND(0x323, 0x325, 2),
776 SCRIPT_COMMAND(0x324, 0x325, 0xC),
777 SCRIPT_WAIT(0x3C),
778 SCRIPT_COMMAND(0x323, 0x326, 2),
779 SCRIPT_COMMAND(0x324, 0x326, 0xC),
780 SCRIPT_WAIT(0x1E),
781 SCRIPT_TALK(0, 0xD, 0xC, 0),
782 SCRIPT_POSE(0xC, 1, 5),
784 SCRIPT_FOLLOW(0, 2),
785 SCRIPT_WAIT(0x1E),
786 SCRIPT_WALK(0xC, 0x1B0, 0x130, 5),
787 SCRIPT_WALK(0x67, 0x218, 0xFC, 5),
788 SCRIPT_WAIT_WALK(0xC),
789 SCRIPT_TALK(0, 0xE, 2, 2),
790 SCRIPT_WALK(0xC, 0x21A, 0xFC, 5),
792 SCRIPT_WAIT(0x1E),
793#if VERSION_US
794 SCRIPT_LEAVE(0xE06, 0x150, 0x190, 5),
795#elif VERSION_EU || VERSION_JP
796 SCRIPT_LEAVE(0xE07, 0x150, 0x190, 5),
797#endif
799};
801 SCRIPT_LOOK_AT(1, 0x140, 0x188),
802 SCRIPT_PLACE(2, 0x150, 0x190),
803 SCRIPT_POSE(2, 1, 5),
804 SCRIPT_PLACE(0xC, 0x1EE, 0x114),
805 SCRIPT_POSE(0xC, 1, 1),
806 SCRIPT_PLACE(0x67, 0x1EE, 0x114),
807 SCRIPT_POSE(0x67, 1, 1),
808 SCRIPT_WAIT(0x78),
809 SCRIPT_WALK(0xC, 0x1B0, 0x130, 1),
810 SCRIPT_COMMAND(0x323, 0x325, 2),
811 SCRIPT_WAIT(0x3C),
812 SCRIPT_COMMAND(0x323, 0x326, 2),
813 SCRIPT_WAIT(0x1E),
814 SCRIPT_TALK(0, 1, 0xC, 1),
815 SCRIPT_POSE(0xC, 7, 1),
817 SCRIPT_POSE(0xC, 1, 1),
818 SCRIPT_WAIT(0x1E),
819 SCRIPT_WALK(0xC, 0x170, 0x180, 1),
820 SCRIPT_WAIT_WALK(0xC),
821 SCRIPT_TALK(0, 8, 0xC, 0),
822 SCRIPT_POSE(0xC, 7, 1),
824 SCRIPT_POSE(0xC, 1, 1),
825 SCRIPT_WAIT(0x1E),
826 SCRIPT_TALK(0, 2, 2, 3),
827 SCRIPT_POSE(2, 7, 5),
829 SCRIPT_POSE(2, 1, 5),
830 SCRIPT_WALK(0x67, 0x1B0, 0x130, 1),
831 SCRIPT_WAIT_WALK(0x67),
832 SCRIPT_WALK(2, 0x140, 0x188, 5),
833 SCRIPT_WALK(0xC, 0x150, 0x190, 1),
834 SCRIPT_WALK(0x67, 0x170, 0x180, 1),
835 SCRIPT_WAIT_WALK(0xC),
836 SCRIPT_WALK(0xC, 0x160, 0x198, 5),
837 SCRIPT_WAIT_WALK(0xC),
838 SCRIPT_TALK(0, 3, 0x67, 0),
840 SCRIPT_WAIT(0x1E),
841 SCRIPT_POSE(2, 1, 7),
842 SCRIPT_POSE(0xC, 1, 3),
843 SCRIPT_WALK(0x67, 0x150, 0x190, 1),
844 SCRIPT_WAIT_WALK(0x67),
845 SCRIPT_POSE(2, 1, 1),
846 SCRIPT_POSE(0xC, 1, 1),
847 SCRIPT_WALK(0x67, 0x70, 0x200, 1),
848 SCRIPT_WAIT(0x5A),
849 SCRIPT_TALK(0, 4, 0xC, 1),
850 SCRIPT_POSE(2, 1, 7),
851 SCRIPT_POSE(0xC, 7, 3),
853 SCRIPT_POSE(0xC, 1, 3),
854 SCRIPT_WAIT(0x1E),
855 SCRIPT_TALK(0, 5, 2, 2),
856 SCRIPT_POSE(2, 7, 7),
858 SCRIPT_POSE(2, 1, 7),
859 SCRIPT_WAIT(0x1E),
860 SCRIPT_TALK(0, 6, 0xC, 1),
861 SCRIPT_POSE(0xC, 7, 3),
863 SCRIPT_POSE(0xC, 1, 3),
864 SCRIPT_WAIT(0x1E),
865 SCRIPT_TALK(0, 7, 2, 2),
866 SCRIPT_POSE(2, 7, 7),
868 SCRIPT_POSE(2, 1, 7),
869 SCRIPT_WAIT(0x1E),
870 SCRIPT_WALK(2, 0x150, 0x190, 1),
872 SCRIPT_WALK(2, 0x130, 0x1A0, 1),
873 SCRIPT_WALK(0xC, 0x150, 0x190, 1),
875 SCRIPT_WALK(2, 0x80, 0x1F8, 1),
876 SCRIPT_WALK(0xC, 0x80, 0x1F8, 1),
877 SCRIPT_WAIT(0x3C),
878 SCRIPT_LEAVE(0x276, 0x58, 0x1CC, 5),
880};
882 SCRIPT_PLACE(1, 0x58, 0x20C),
883 SCRIPT_POSE(1, 1, 5),
884 SCRIPT_WAIT(0x1E),
885 SCRIPT_WALK(1, 0xEA, 0x1C3, 5),
887 SCRIPT_POSE(1, 1, 3),
888 SCRIPT_WAIT(0x1E),
889 SCRIPT_POSE(1, 1, 5),
890 SCRIPT_WAIT(0x1E),
891 SCRIPT_POSE(1, 0x3A, 7),
892 SCRIPT_WAIT(0x3C),
893 SCRIPT_TALK(0, 1, 1, 1),
894 SCRIPT_POSE(1, 1, 7),
896 SCRIPT_WAIT(0x1E),
897 SCRIPT_POSE(1, 1, 5),
898 SCRIPT_WAIT(0x1E),
899 SCRIPT_COMMAND(0x323, 0x325, 1),
900 SCRIPT_COMMAND(0x346, 0x335, 0x346),
901 SCRIPT_WAIT(0x3C),
902 SCRIPT_COMMAND(0x323, 0x326, 1),
903 SCRIPT_WAIT(0x1E),
904 SCRIPT_TALK(0, 5, 1, 3),
905 SCRIPT_POSE(1, 7, 5),
906 SCRIPT_PLACE(0xD5, 0x122, 0x1A7),
907 SCRIPT_POSE(0xD5, 1, 1),
909 SCRIPT_POSE(1, 1, 5),
910 SCRIPT_WAIT(0x1E),
911 SCRIPT_WAIT(0x3C),
912 SCRIPT_TALK(0, 2, 0xD5, 4),
914 SCRIPT_TALK(0, 3, 1, 1),
915 SCRIPT_POSE(1, 0xC, 5),
917 SCRIPT_WAIT(0x1E),
918 SCRIPT_TALK(0, 4, 0xD5, 4),
920 SCRIPT_WAIT(0x1E),
921#if VERSION_US
922 SCRIPT_LEAVE(0xE07, 0xEA, 0x1C3, 5),
923#elif VERSION_EU || VERSION_JP
924 SCRIPT_LEAVE(0xE08, 0xEA, 0x1C3, 5),
925#endif
927};
929 SCRIPT_PLACE(1, 0xEA, 0x1C3),
930 SCRIPT_POSE(1, 1, 5),
931 SCRIPT_PLACE(0xD5, 0x122, 0x1A7),
932 SCRIPT_POSE(0xD5, 1, 1),
933 SCRIPT_WAIT(0x78),
934 SCRIPT_TALK(0, 1, 0xD5, 4),
936 SCRIPT_WAIT(0x1E),
937 SCRIPT_TALK(0, 2, 1, 1),
938 SCRIPT_POSE(1, 0xC, 5),
940 SCRIPT_WAIT(0x1E),
941 SCRIPT_TALK(0, 3, 0xD5, 4),
943 SCRIPT_WAIT(0x1E),
944 SCRIPT_TALK(0, 4, 1, 1),
946 SCRIPT_WAIT(0x1E),
947 SCRIPT_TALK(0, 5, 0xD5, 4),
949 SCRIPT_WAIT(0x1E),
950 SCRIPT_COMMAND(0x346, 0x335, 1),
951 SCRIPT_WAIT(0x3C),
952 SCRIPT_PLACE(0xD5, 0, 0),
953 SCRIPT_POSE(0xD5, 1, 1),
954 SCRIPT_WAIT(0x3C),
955 SCRIPT_WAIT(0x3C),
956 SCRIPT_TALK(0, 6, 1, 1),
958 SCRIPT_POSE(1, 1, 5),
959 SCRIPT_WAIT(0x1E),
960 SCRIPT_WAIT(0x1E),
961 SCRIPT_LEAVE(0x288, 0xEA, 0x1C3, 5),
963};
965 { 51, 8 }, { 52, 8 }, { 53, 8 }, { 54, 8 },
966 { 55, 8 }, { 56, 8 }, { 57, 8 }, { 75, 40 },
967 { 255, 0 },
968};
970 { 58, 8 }, { 59, 8 }, { 60, 8 }, { 61, 8 },
971 { 62, 8 }, { 63, 8 }, { 75, 40 }, { 255, 0 },
972};
974 { 64, 8 }, { 65, 8 }, { 66, 8 }, { 67, 8 },
975 { 68, 8 }, { 75, 40 }, { 255, 0 },
976};
978 { 69, 8 }, { 70, 8 }, { 71, 8 }, { 72, 8 },
979 { 73, 8 }, { 74, 8 }, { 75, 40 }, { 255, 0 },
980};
982 { 5, 4 }, { 6, 4 }, { 7, 4 }, { 8, 4 },
983 { 9, 4 }, { 10, 4 }, { 11, 4 }, { 12, 4 },
984 { 13, 4 }, { 14, 4 }, { 15, 4 }, { 16, 4 },
985 { 255, 0x3E7 },
986};
988 { 28, 4 }, { 29, 4 }, { 30, 4 }, { 31, 4 },
989 { 32, 4 }, { 33, 4 }, { 34, 4 }, { 35, 4 },
990 { 36, 4 }, { 37, 4 }, { 38, 4 }, { 39, 4 },
991 { 255, 0x3E7 },
992};
994 { 0, 4 }, { 1, 4 }, { 255, 0 },
995};
997 { 0, 12 }, { 1, 12 }, { 2, 12 }, { 3, 12 },
998 { 4, 12 }, { 5, 12 }, { 6, 12 }, { 7, 12 },
999 { 8, 12 }, { 9, 12 }, { 10, 12 }, { 11, 12 },
1000 { 12, 12 }, { 13, 12 }, { 255, 0 }, { 16, 4 },
1001 { 15, 4 }, { 14, 4 }, { 13, 4 }, { 12, 4 },
1002 { 11, 4 }, { 10, 4 }, { 9, 4 }, { 8, 4 },
1003 { 7, 4 }, { 6, 4 }, { 5, 4 }, { 255, 0x3E7 },
1004};
1006 { 39, 4 }, { 38, 4 }, { 37, 4 }, { 36, 4 },
1007 { 35, 4 }, { 34, 4 }, { 33, 4 }, { 32, 4 },
1008 { 31, 4 }, { 30, 4 }, { 29, 4 }, { 28, 4 },
1009 { 255, 0x3E7 },
1010};
1012 { 76, 4 }, { 77, 4 }, { 78, 4 }, { 79, 4 },
1013 { 80, 4 }, { 81, 4 }, { 82, 4 }, { 83, 4 },
1014 { 84, 4 }, { 85, 4 }, { 86, 4 }, { 87, 4 },
1015 { 255, 0x3E7 },
1016};
1018 { 88, 4 }, { 89, 4 }, { 90, 4 }, { 91, 4 },
1019 { 92, 4 }, { 93, 4 }, { 94, 4 }, { 95, 4 },
1020 { 96, 4 }, { 97, 4 }, { 98, 4 }, { 99, 4 },
1021 { 255, 0x3E7 },
1022};
1024 { 0, 4 }, { 1, 4 }, { 255, 0 },
1025};
1027 { 0, 12 }, { 1, 12 }, { 2, 12 }, { 3, 12 },
1028 { 4, 12 }, { 5, 12 }, { 6, 12 }, { 7, 12 },
1029 { 8, 12 }, { 9, 12 }, { 10, 12 }, { 255, 0 },
1030 { 87, 4 }, { 86, 4 }, { 85, 4 }, { 84, 4 },
1031 { 83, 4 }, { 82, 4 }, { 81, 4 }, { 80, 4 },
1032 { 79, 4 }, { 78, 4 }, { 77, 4 }, { 76, 4 },
1033 { 255, 0x3E7 },
1034};
1036 { 99, 4 }, { 98, 4 }, { 97, 4 }, { 96, 4 },
1037 { 95, 4 }, { 94, 4 }, { 93, 4 }, { 92, 4 },
1038 { 91, 4 }, { 90, 4 }, { 89, 4 }, { 88, 4 },
1039 { 255, 0x3E7 },
1040};
1042 { 20, 0, 492, 188 },
1043 { 20, 0, 620, 252 },
1044 { 42, 2, 271, 411 },
1045};
1047 { 0, 6 }, { 1, 6 }, { 2, 68 }, { 1, 4 },
1048 { 0, 4 }, { 255, 0 },
1049};
1051 { 0x12C, 18 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
1052 { 4, 6 }, { 5, 4 }, { 6, 4 }, { 7, 4 },
1053 { 5, 4 }, { 6, 4 }, { 7, 4 }, { 5, 4 },
1054 { 6, 4 }, { 7, 4 }, { 5, 4 }, { 6, 4 },
1055 { 7, 4 }, { 4, 4 }, { 3, 4 }, { 2, 4 },
1056 { 1, 4 }, { 255, 0x3E7 },
1057};
1114 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
1115 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
1116 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
1117 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
1118 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
1119 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
1120 { 0x1C0, 0x100, 0x1D2, 0x1D8, 0x248, 0xD8, 0x160, 0x1EE },
1121 { 0x1C0, 0x100, 0x1DA, 0x1D8, 0x268, 0xD8, 0x170, 0x1EE },
1122 { 0x140, 0x100, 0x176, 0x100, 0xD8, 0, 0x140, 0x1ED },
1123 { 0x140, 0x100, 0x176, 0x128, 0xD8, 0x28, 0x150, 0x1ED },
1124 { 0x1C0, 0x100, 0x1DE, 0x1A8, 0x278, 0xA8, 0x160, 0x1ED },
1125 { 0x1C0, 0x100, 0x1E8, 0x1A8, 0x2A0, 0xA8, 0x170, 0x1ED },
1126 { 0x1C0, 0x100, 0x1F2, 0x1A8, 0x2C8, 0xA8, 0x140, 0x1EC },
1127 { 0x180, 0x100, 0x19C, 0x198, 0x170, 0x98, 0x150, 0x1EC },
1128 { 0x180, 0x100, 0x1A6, 0x1D0, 0x198, 0xD0, 0x160, 0x1EC },
1129};
1155FieldActorEntry actor4 = { actor4Conditions, NULL, 0xD2, 8, 161, 441, 1 };
1156FieldActorEntry actor5 = { actor5Conditions, NULL, 0xD3, 9, 255, 489, 1 };
1157FieldActorEntry actor6 = { actor6Conditions, NULL, 0xD4, 0xA, 235, 452, 1 };
1158FieldActorEntry actor7 = { actor7Conditions, NULL, 0xD5, 0xB, 0, 0, 1 };
1159FieldActorEntry actor8 = { actor8Conditions, NULL, 0x102, 0xC, 464, 288, 1 };
1161 &actor0,
1162 &actor1,
1163 &actor2,
1164 &actor3,
1165 &actor4,
1166 &actor5,
1167 &actor6,
1168 &actor7,
1169 &actor8,
1170 NULL,
1171};
1173 { 1, 1, 0x40, 2, 0x33, 0, 0, 0, 0, 0, 584, 125, 0, 0 },
1174 { 1, 2, 0x40, 2, 0x3A, 0, 0, 0, 0, 0, 592, 144, 0, 0 },
1175 { 1, 3, 0x40, 2, 0x40, 0, 0, 0, 0, 0, 609, 140, 0, 0 },
1176 { 1, 4, 0x40, 2, 0x45, 0, 0, 0, 0, 0, 610, 167, 0, 0 },
1177 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 160, 509, 0, 0 },
1178 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 392, 457, 0, 0 },
1179 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 448, 339, 0, 0 },
1180 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 545, 307, 0, 0 },
1181 { 0, 6, 0x80, 2, 0x1C, 0, 0, 0, 0, 0, 550, 116, 0, 0 },
1182 { 0, 0xC, 0xFF, 2, 0x58, 0, 0, 0, 0, 0, 430, 103, 0, 0 },
1183 { 0, 8, 0x80, 2, 2, 0, 0, 0, 0, 0, 550, 116, 0, 0 },
1184 { 0, 9, 0x80, 2, 3, 0, 0, 0, 0, 0, 550, 116, 0, 0 },
1185 { 0, 0xA, 0x80, 2, 4, 0, 0, 0, 0, 0, 550, 116, 0, 0 },
1186 { 0, 5, 0x80, 2, 5, 0, 0, 0, 0, 0, 550, 116, 0, 0 },
1187 { 0, 7, 0x80, 2, 0x28, 0, 0, 0, 0, 0, 546, 112, 0, 0 },
1188 { 0, 0xE, 0xFF, 2, 0x11, 0, 0, 0, 0, 0, 430, 103, 0, 0 },
1189 { 0, 0xF, 0xFF, 2, 0x12, 0, 0, 0, 0, 0, 430, 103, 0, 0 },
1190 { 0, 0x10, 0xFF, 2, 0x13, 0, 0, 0, 0, 0, 430, 103, 0, 0 },
1191 { 0, 0xB, 0xFF, 2, 0x4C, 0, 0, 0, 0, 0, 430, 103, 0, 0 },
1192 { 0, 0xD, 0xFF, 2, 0x29, 0, 0, 0, 0, 0, 426, 99, 0, 0 },
1193 { 0, 0, 0x40, 6, 0x2A, 0, 0, 0, 0, 0, 271, 411, 0, 0 },
1194 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 72, 464, 0, 0 },
1195 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 178, 350, 0, 0 },
1196 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 303, 267, 0, 0 },
1197 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 369, 219, 0, 0 },
1198 { 1, 0, 0x40, 4, 0, 0, 0, 0, 0, 0, 392, 328, 386, 0 },
1199 { 1, 0, 0x40, 4, 1, 0, 0, 0, 0, 0, 545, 243, 266, 0 },
1200 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
1201};
1203 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x287, 0x178, 0xFC, 1, 0, 0, 0 },
1204 { { { PROGRESS(STORY_OPERATION_SIGMA), 1 }, { CODES_END, 0 } }, SLOT_LAUNCH_OUT, 0x2DD, 0xE0, 0x418, 5, 0, 0, 0 },
1205 { { { CODES_END, 0 }, { CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
1206};
1207void (*stageFuncs[])(void) = {
1208 setupStage,
1209};
1211 { 931, script931, EVENT_TEXT(0x10), NULL, endEvent931 },
1212 { 932, script932, EVENT_TEXT(0x11), NULL, endEvent932 },
1213 { 933, script933, EVENT_TEXT(0x12), NULL, endEvent933 },
1214 { 934, script934, EVENT_TEXT(0x13), NULL, endEvent934 },
1215 { 981, script981, EVENT_TEXT(0x18), NULL, endEvent981 },
1216 { 982, script982, EVENT_TEXT(0x19), NULL, endEvent982 },
1217 { -1, NULL, 0, NULL, NULL },
1218};
#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.
void * createTileAnims(void)
Creates the updateTileAnims task.
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_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 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 SCRIPT_LEAVE(mode, x, y, dir)
FIELDSTG_leaveField; ends the event.
Definition field_map.h:170
#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_MAP_FLOOR0
Some of FieldMap's maps (files): those of the floors the player walks on come first,...
Definition field_map.h:85
#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_LAUNCH_OUT
the same, then leaves for mode arg
Definition field_map.h:268
#define SLOT_EXIT
The kinds of StageSlot (type).
Definition field_map.h:255
#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 FIELD_TASK_COMMANDS
script command 813 (FIELDSTG_startCommandTask): the field commands
Definition field_map.h:33
#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_BATTLE
BATL0000: the maps' random battles (AreaBattle, nearly all of them)
Definition sound.h:76
#define MUSIC_AOA_HEADQUARTERS
ENV_0002: the A.o.A Headquarters.
Definition sound.h:118
#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_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 stepTileAnimation(StageTileAnim *obj, AnimFrame *frames, s32 once, s32 depth)
Steps OBJ's animation through FRAMES by the frame time (at most 4) and returns its frame: at the end ...
@ STORY_OPERATION_SIGMA
WSTAG311 (A.o.A Headquarters, Amaterasu City), event 982, after event 981, where the A....
Definition story.h:141
@ STORY_AMATERASU_BRIDGE
WSTAG206 (Amaterasu Bridge), event 922: an Attacker holds the bridge.
Definition story.h:133
@ STORY_ASUKA_HEADQUARTERS
WSTAG310 (A.o.A Headquarters, Asuka City), event 961.
Definition story.h:138
#define FLAG_VEMMON_AT_HQ_SEEN
wstag311 event 934: looking for the Matrix System, the player finds Vemmon there; set at its end,...
Definition story.h:1493
#define FLAG_CHIEF_OFFICER_MEETING_SEEN
wstag311 event 931: the MAGAMI President asks to be called Chief Officer; set at its end,...
Definition story.h:1490
#define FLAG_CHIEF_OFFICER_ARREST_SEEN
wstag311 event 932: the Chief Officer turns himself in and Nick arrests him; set at its end,...
Definition story.h:1499
#define FLAG_ROYAL_GUARDS_FOUGHT
wstag311 A.o.A Headquarters (Amaterasu): set at the end of event 931 (the Chief Officer) with the bat...
Definition story.h:788
#define FLAG_DIGITIZE_WAVE_PLAN_SEEN
wstag311 event 981: the real goal was Gunslinger, the Digitize Wave will launch from Ragnarok; set at...
Definition story.h:1502
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
void(* setState)(struct StageEffect *task, s32 state)
Definition stage.h:80
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
Six map objects, animated by mode.
Definition stage.h:430
void(* nextState)(struct StageTileSix *task)
Definition stage.h:431
StageTileAnim tiles[6]
Definition stage.h:433
s32 state
Definition stage.h:431
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
Definition gfx.h:352
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
Definition task.c:105
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
The parts of updateTileSix, the same in WSTAG310 and WSTAG311.
static void findTileSix(StageTileSix *task)
Finds the map objects with animations 5 to 10 and starts the animations of the first four.
Definition tile_six.inc.c:7
static void showLastFourTiles(StageTileSix *task, StageTile *tile, s32 i)
Mode 2: hides the first two map objects and shows the other four, the third and fourth with their loo...
void updateStageEffect(StageEffect *task)
An effect that plays its animation each time it is set to TASK_DONE.
Definition wstag310.c:615
s32 stepTileAnimation2(StageTileAnimFlag *obj, AnimFrame *frames, s32 once, s32 depth)
stepTileAnimation (common/step_tile_animation.inc.c) for a StageTileAnimFlag: steps OBJ's animation t...
Definition wstag310.c:171
u16 actor1Conditions[]
Definition wstag311.c:1131
AreaBattle area2Battle7
Definition wstag311.c:1091
FieldActorEntry actor0
Definition wstag311.c:1151
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag311.c:1207
FieldActorEntry actor6
Definition wstag311.c:1157
StageEffectSpot updateStageSpots[]
Definition wstag311.c:1041
AreaBattle area2Battle6
Definition wstag311.c:1090
s16 script981[]
Definition wstag311.c:881
s16 script982[]
Definition wstag311.c:928
StageEffect * createCommand838(s32 id)
Creates the effect of frame 0x2A at (0x10F, 0x19B), playing, with a sound.
Definition wstag311.c:448
void endEvent981(void)
After event 981, with the player: keeps it from playing again.
Definition wstag311.c:490
AnimFrame effectClutFrames[]
Definition wstag311.c:1046
AreaBattle area1Battle6
Definition wstag311.c:1077
FieldActorEntry actor5
Definition wstag311.c:1156
void endEvent982(void)
After event 982, with the player: moves the story on to STORY_OPERATION_SIGMA.
Definition wstag311.c:495
AreaBattle area0Battle7
Definition wstag311.c:1065
FieldActorEntry actor2
Definition wstag311.c:1153
void * createTileSixW(void)
Creates the second set of six map objects (updateTileSixW) without an id; nothing in the game calls i...
Definition wstag311.c:397
AreaBattle area3Battle4
Definition wstag311.c:1101
AreaBattle area3Battle3
Definition wstag311.c:1100
AnimFrame updateTileAnimsFrames2[]
Definition wstag311.c:973
AreaBattle area0Battle1
Definition wstag311.c:1059
AreaBattle area2Battle0
Definition wstag311.c:1084
FieldActorEntry * stageActors[]
Definition wstag311.c:1160
static void findTileSixW(StageTileSix *task)
Finds the map objects with animations 11 to 16 and starts the animations of the first four.
Definition wstag311.c:181
AreaBattle area1Battle2
Definition wstag311.c:1073
AreaBattle area3Battle0
Definition wstag311.c:1097
s16 script931[]
Definition wstag311.c:529
AreaBattle area0Battle6
Definition wstag311.c:1064
AreaBattle area3Battle2
Definition wstag311.c:1099
AreaBattle area3Battle1
Definition wstag311.c:1098
void endEvent931(void)
After event 931, with Royal Guard: starts the stage's event battle 1, sets flag 0x0C33 (which decides...
Definition wstag311.c:464
AreaBattle area0Battle3
Definition wstag311.c:1061
u16 actor4Conditions[]
Definition wstag311.c:1134
FieldActorEntry actor4
Definition wstag311.c:1155
u16 actor3Conditions[]
Definition wstag311.c:1133
AreaBattle area3Battle6
Definition wstag311.c:1103
AnimFrame updateTileAnimsFrames1[]
Definition wstag311.c:969
AnimFrame updateTileSixFrames3[]
Definition wstag311.c:996
FieldActorEntry actor8
Definition wstag311.c:1159
void restartTileSix(StageTileSix *task, s32 id)
Restarts the first two map objects' animations for mode 1 (id 0) or 3 (id 1)
Definition wstag311.c:144
ActorImage stageImages[]
Definition wstag311.c:1113
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing the ambience ENV_0002.
Definition wstag311.c:509
AnimFrame updateTileSixFrames0[]
Definition wstag311.c:981
AnimFrame effectFrames[]
Definition wstag311.c:1050
AreaBattle area2Battle4
Definition wstag311.c:1088
AnimFrame updateTileSixFrames4[]
Definition wstag311.c:1005
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag311.c:1172
s16 script934[]
Definition wstag311.c:800
u16 actor8Conditions[]
Definition wstag311.c:1150
AnimFrame updateTileSixFrames1[]
Definition wstag311.c:987
u16 actor5Conditions[]
Definition wstag311.c:1139
BattleList area3Battles
Definition wstag311.c:1105
AnimFrame updateTileSixFrames2[]
Definition wstag311.c:993
AreaBattle area3Battle5
Definition wstag311.c:1102
static void showLastFourTilesW(StageTileSix *task, StageTile *tile, s32 i)
Mode 2: hides the first two map objects and shows the other four, the third and fourth with their loo...
Definition wstag311.c:226
AreaBattle area0Battle5
Definition wstag311.c:1063
BattleList area1Battles
Definition wstag311.c:1079
AnimFrame updateTileSixWFrames1[]
Definition wstag311.c:1017
BattleList area2Battles
Definition wstag311.c:1092
s16 script932[]
Definition wstag311.c:571
AnimFrame updateTileSixWFrames4[]
Definition wstag311.c:1035
void * createTileSixWithId(s32 arg)
Creates the first set of six map objects (updateTileSix) with an id; nothing in the game calls it.
Definition wstag311.c:169
AreaBattle area1Battle4
Definition wstag311.c:1075
AnimFrame updateTileSixWFrames3[]
Definition wstag311.c:1026
u16 actor6Conditions[]
Definition wstag311.c:1144
AreaBattle area2Battle2
Definition wstag311.c:1086
AreaBattle area1Battle5
Definition wstag311.c:1076
FieldActorEntry actor7
Definition wstag311.c:1158
AnimFrame updateTileSixWFrames0[]
Definition wstag311.c:1011
StageSlot stageSlots[]
Definition wstag311.c:1202
AreaBattle area2Battle1
Definition wstag311.c:1085
AreaBattle area1Battle3
Definition wstag311.c:1074
AreaBattle area1Battle0
Definition wstag311.c:1071
AnimFrame updateTileAnimsFrames3[]
Definition wstag311.c:977
void restartTileSixW(StageTileSix *task, s32 id)
Restarts the first two map objects' animations for mode 1 (id 0) or 3 (id 1)
Definition wstag311.c:364
AnimFrame updateTileAnimsFrames0[]
Defined below, after the code that uses them.
Definition wstag311.c:964
FieldActorEntry actor1
Definition wstag311.c:1152
AreaBattle area0Battle0
Definition wstag311.c:1058
AreaBattle area0Battle2
Definition wstag311.c:1060
#define STAGE_FILE
Definition wstag311.c:506
AreaBattle area2Battle5
Definition wstag311.c:1089
void * createTileSixWWithId(s32 arg)
Creates the second set of six map objects (updateTileSixW) with an id; nothing in the game calls it.
Definition wstag311.c:389
AreaBattle area1Battle1
Definition wstag311.c:1072
void updateTileSixW(StageTileSix *task)
Animates the map objects with animations 11 to 16 by mode (0: hidden, 1 and 3: the first two once,...
Definition wstag311.c:256
u16 actor7Conditions[]
Definition wstag311.c:1149
AreaBattle area2Battle3
Definition wstag311.c:1087
s16 script933[]
Definition wstag311.c:625
void updateTileSix(StageTileSix *task)
Animates the map objects with animations 5 to 10 by mode (0: hidden, 1 and 3: the first two once,...
Definition wstag311.c:36
u16 actor2Conditions[]
Definition wstag311.c:1132
AnimFrame updateTileSixWFrames2[]
Definition wstag311.c:1023
void endEvent934(void)
After event 934, with Teddy and Nick: keeps it from playing again.
Definition wstag311.c:485
AreaBattle area0Battle4
Definition wstag311.c:1062
#define STAGE_TEXT
Definition wstag311.c:504
void endEvent933(void)
After event 933, with Chief Officer, Nick, Lisa and Teddy: keeps it from playing again.
Definition wstag311.c:480
AreaBattle area3Battle7
Definition wstag311.c:1104
BattleList area0Battles
Definition wstag311.c:1066
AreaBattle area1Battle7
Definition wstag311.c:1078
void endEvent932(void)
After event 932, with Chief Officer: starts the stage's event battle 0 and keeps it from playing agai...
Definition wstag311.c:474
FieldActorEntry actor3
Definition wstag311.c:1154
FieldBattles stageBattles[]
Definition wstag311.c:1110
FieldEvent stageEvents[]
Definition wstag311.c:1210
u16 actor0Conditions[]
Definition wstag311.c:1130