Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag310.c
Go to the documentation of this file.
1/*
2 * WSTAG310: A.o.A Headquarters, Asuka City.
3 */
4
5#include "common.h"
6#include "field/stage.h"
7/* Defined below, after the code that uses them */
15StageEffect *createEffect(s32 x, s32 y, s32 frame);
26
28
30
32
34
35#include "common/tile_six.inc.c"
36
37/* 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 first: the other four) */
39 StageTile *tile;
40 s32 done;
41 s32 i;
42 s32 frame;
43
44 switch (task->state) {
45 case TASK_INIT:
46 default:
47 findTileSix(task);
48 task->mode = 2;
49 task->nextState(task);
50 break;
51 case TASK_RUN:
52 done = 0;
53 for (i = 0; i < 6; i++) {
54 tile = task->tiles[i].tile;
55 switch (task->mode) {
56 case 0:
57 tile->visible = 0;
58 break;
59 case 1:
60 switch (i) {
61 case 0:
62 frame = stepTileAnimation(&task->tiles[0], updateTileSixFrames0, 1, 0);
63 if (frame != 0xFF) {
64 tile->frame = frame;
65 tile->visible = 1;
66 } else {
67 done++;
68 tile->frame = 0;
69 tile->visible = 0;
70 }
71 break;
72 case 1:
73 frame = stepTileAnimation(&task->tiles[1], updateTileSixFrames1, 1, 0);
74 if (frame != 0xFF) {
75 tile->frame = frame;
76 tile->visible = 1;
77 } else {
78 done++;
79 tile->frame = 0;
80 tile->visible = 0;
81 }
82 break;
83 case 2:
84 case 3:
85 case 4:
86 case 5:
87 tile->visible = 0;
88 break;
89 }
90 break;
91 case 2:
92 showLastFourTiles(task, tile, i);
93 break;
94 case 3:
95 switch (i) {
96 case 0:
97 frame = stepTileAnimation(&task->tiles[0], updateTileSixFrames4, 1, 0);
98 if (frame != 0xFF) {
99 tile->frame = frame;
100 tile->visible = 1;
101 } else {
102 done++;
103 tile->frame = 0;
104 tile->visible = 0;
105 }
106 break;
107 case 1:
108 frame = stepTileAnimation(&task->tiles[1], updateTileSixFrames4, 1, 0);
109 if (frame != 0xFF) {
110 tile->frame = frame;
111 tile->visible = 1;
112 } else {
113 done++;
114 tile->frame = 0;
115 tile->visible = 0;
116 }
117 break;
118 case 2:
119 case 3:
120 case 4:
121 case 5:
122 tile->visible = 0;
123 break;
124 }
125 break;
126 }
127 }
128 if (done >= 2) {
129 switch (task->mode) {
130 case 1:
131 task->mode = 2;
132 break;
133 case 3:
134 task->mode = 0;
135 break;
136 }
137 }
138 break;
139 case TASK_DONE:
140 case TASK_KILL:
141 break;
142 }
143}
144
145/* Plays the first two map objects backwards (mode 3) for map 0x359 */
147 if (task != NULL && id == 0x359) {
148 task->tiles[0].anim.index = 0;
150 task->tiles[1].anim.index = 0;
152 task->mode = 3;
153 }
154}
155
156/* Creates the task of the six map objects with id ID, in mode 2 */
159
160 task->mode = 2;
161 return task;
162}
163
165
166/*
167 * stepTileAnimation (common/step_tile_animation.inc.c) for a
168 * StageTileAnimFlag: steps OBJ's animation through FRAMES and returns its
169 * frame, looping at the end or returning 0xFF if once
170 */
172 AnimFrame *frame = &frames[obj->anim.index];
173 s32 dt = GFX.funcs.getFrameTime();
174
175 if (dt > 4) {
176 dt = 4;
177 }
178 if (depth == 0) {
179 obj->anim.timer -= dt;
180 }
181 if (obj->anim.timer <= 0) {
182 frame++;
183 obj->anim.index++;
184 obj->anim.timer += frame->duration;
185 if (once) {
186 if (frame->frame == 0xFF) {
187 return 0xFF;
188 }
189 } else if (frame->frame == 0xFF) {
190 frame = frames;
191 obj->anim.index = 0;
192 obj->anim.timer += frame->duration;
193 }
194 stepTileAnimation2(obj, frames, once, depth + 1);
195 }
196 return frame->frame;
197}
198
199/*
200 * Finds the map objects with animations 11 to 16 and starts the
201 * animations of the first four
202 */
203static inline void findTileSixW(StageTileSixW *task) {
204 StageTile *object;
205
206 for (object = FIELDSTG_state.objects; object->margin != 0; object++) {
207 if (object->anim >= 11 && object->anim <= 16) {
208 switch (object->anim) {
209 case 11:
210 task->tiles[0].tile = object;
211 task->tiles[0].anim.index = 0;
213 break;
214 case 12:
215 task->tiles[1].tile = object;
216 task->tiles[1].anim.index = 0;
218 break;
219 case 13:
220 task->tiles[2].tile = object;
221 task->tiles[2].anim.index = 0;
223 break;
224 case 14:
225 task->tiles[3].tile = object;
226 task->tiles[3].anim.index = 0;
228 break;
229 case 15:
230 task->tiles[4].tile = object;
231 task->tiles[4].anim.index = 0;
232 task->tiles[4].anim.timer = 0;
233 break;
234 case 16:
235 task->tiles[5].tile = object;
236 task->tiles[5].anim.index = 0;
237 task->tiles[5].anim.timer = 0;
238 break;
239 }
240 }
241 }
242}
243
244/*
245 * Mode 2: hides the first two map objects and shows the other four, the
246 * third and fourth with their looping palettes and the last two still
247 */
248static inline void showLastFourTilesW(StageTileSixW *task, StageTile *tile, s32 i) {
249 switch (i) {
250 case 0:
251 case 1:
252 tile->visible = 0;
253 break;
254 case 2:
255 tile->frame = 0x29;
256 tile->clutRow = stepTileAnimation2(&task->tiles[i], updateTileSixWFrames2, 0, 0);
257 tile->visible = 1;
258 break;
259 case 3:
260 tile->frame = 0x11;
261 tile->clutRow = stepTileAnimation2(&task->tiles[i], updateTileSixWFrames3, 0, 0);
262 tile->visible = 1;
263 break;
264 case 4:
265 tile->visible = 1;
266 tile->frame = 0x12;
267 tile->clutRow = 0;
268 break;
269 case 5:
270 tile->visible = 1;
271 tile->frame = 0x13;
272 tile->clutRow = 0;
273 break;
274 }
275}
276
277/* 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 first: the other four) */
279 StageTile *tile;
280 s32 done;
281 s32 i;
282 s32 frame;
283
284 switch (task->state) {
285 case TASK_INIT:
286 default:
287 findTileSixW(task);
288 task->mode = 2;
289 task->nextState(task);
290 break;
291 case TASK_RUN:
292 done = 0;
293 for (i = 0; i < 6; i++) {
294 tile = task->tiles[i].tile;
295 switch (task->mode) {
296 case 0:
297 tile->visible = 0;
298 break;
299 case 1:
300 switch (i) {
301 case 0:
302 frame = stepTileAnimation2(&task->tiles[0], updateTileSixWFrames0, 1, 0);
303 if (frame != 0xFF) {
304 tile->frame = frame;
305 tile->visible = 1;
306 } else {
307 done++;
308 tile->frame = 0;
309 tile->visible = 0;
310 }
311 break;
312 case 1:
313 frame = stepTileAnimation2(&task->tiles[1], updateTileSixWFrames1, 1, 0);
314 if (frame != 0xFF) {
315 tile->frame = frame;
316 tile->visible = 1;
317 } else {
318 done++;
319 tile->frame = 0;
320 tile->visible = 0;
321 }
322 break;
323 case 2:
324 case 3:
325 case 4:
326 case 5:
327 tile->visible = 0;
328 break;
329 }
330 break;
331 case 2:
332 showLastFourTilesW(task, tile, i);
333 break;
334 case 3:
335 switch (i) {
336 case 0:
337 frame = stepTileAnimation2(&task->tiles[0], updateTileSixWFrames4, 1, 0);
338 if (frame != 0xFF) {
339 tile->frame = frame;
340 tile->visible = 1;
341 } else {
342 done++;
343 tile->frame = 0;
344 tile->visible = 0;
345 }
346 break;
347 case 1:
348 frame = stepTileAnimation2(&task->tiles[1], updateTileSixWFrames4, 1, 0);
349 if (frame != 0xFF) {
350 tile->frame = frame;
351 tile->visible = 1;
352 } else {
353 done++;
354 tile->frame = 0;
355 tile->visible = 0;
356 }
357 break;
358 case 2:
359 case 3:
360 case 4:
361 case 5:
362 tile->visible = 0;
363 break;
364 }
365 break;
366 }
367 }
368 if (done >= 2) {
369 switch (task->mode) {
370 case 1:
371 task->mode = 2;
372 break;
373 case 3:
374 task->mode = 0;
375 break;
376 }
377 }
378 break;
379 case TASK_DONE:
380 case TASK_KILL:
381 break;
382 }
383}
384
385/* Plays the first two map objects backwards (mode 3) for map 0x359 */
387 if (task != NULL && id == 0x359) {
388 task->tiles[0].anim.index = 0;
390 task->tiles[1].anim.index = 0;
392 task->mode = 3;
393 }
394}
395
396/* Creates the task of the six map objects with id ID, in mode 2 */
399
400 task->mode = 2;
401 return task;
402}
403
404/*
405 * Creates the second set of six map objects (updateTileSixW) without an id;
406 * nothing in the game calls it
407 */
408void *createTileSixW(void) {
409 return createTask(updateTileSixW, sizeof(StageTileSixW), 0);
410}
411
412/* Creates the stage tasks, the sprite effects and the event object of the story so far */
413void updateStage(StageTask *task, void **children) {
414 s32 i;
415
416 switch (task->state) {
417 case TASK_INIT:
418 default:
419 children[0] = createTileAnims();
420 for (i = 0; i < 2; i++) {
421 if (updateStageSpots[i].kind == 0) {
422 children[3 + i] = createEffect(updateStageSpots[i].x, updateStageSpots[i].y, updateStageSpots[i].frame);
423 }
424 }
425 do {
427 children[5] = FIELDSTG_startEvent(0x2A8);
428 break;
429 }
431 children[5] = FIELDSTG_startEvent(0x2A9);
432 children[1] = createCommand831(0x33F);
433 children[2] = createCommand832(0x340);
434 break;
435 }
437 children[5] = FIELDSTG_startEvent(0x2AA);
438 break;
439 }
441 children[5] = FIELDSTG_startEvent(0x3C1);
442 break;
443 }
444 } while (0);
445 task->nextState(task);
446 break;
447 case TASK_RUN:
448 case TASK_DONE:
449 case TASK_KILL:
450 break;
451 }
452}
453
454#define STAGE_CHILDREN_SIZE 0x18
457
458/* Draws sprite IDX of the effect while it plays (a draw callback) */
459void drawEffect(StageEffect *task, void *arg, s32 idx) {
460 SpriteDrawer drawer;
461 Layer *layer = arg;
462 StageSprite *sprite;
463 s32 y;
464 s32 x;
465 s32 depth;
466
467 if (task->state == TASK_RUN) {
468 sprite = &task->sprites[idx];
469 y = task->y;
470 x = task->x;
471 if (idx == 1) {
472 y -= 0x20;
473 depth = 4;
474 } else {
475 depth = 6;
476 }
477 initSpriteDrawer(&drawer);
478 drawer.setTexture(0x140, 0x100);
479 drawer.setLayer(layer, depth);
480 drawer.setClutRow(sprite->clutRow);
481 drawer.draw(FILE_CACHE.getEntry(FIELDSTG_state.sheetEntry), sprite->frame, x, y);
482 }
483}
484
486
487/* An effect that plays its animation once and ends */
490 s32 done;
491 s32 frame;
492
493 switch (task->state) {
494 case TASK_INIT:
495 default:
496 task->key1 = task->x;
497 task->key2 = task->y;
498 task->anim.index = 0;
500 task->clutAnim.index = 0;
502 task->nextState(task);
503 break;
504 case TASK_RUN:
505 if (task->substate == 0) {
506 task->anim.index = 0;
508 task->clutAnim.index = 0;
510 task->setSubstate(task, 1);
511 }
512 task->sprites[0].frame = task->frame;
513 task->sprites[0].clutRow = stepAnimation(&task->clutAnim, updateEffectFrames1, 0, 0);
514 done = 0;
515 frame = stepAnimation(&task->anim, updateEffectFrames0, 1, 0);
516 switch (frame) {
517 case 0xFF:
518 task->sprites[1].frame = 0;
519 done = 1;
520 break;
521 case 0x12C:
522 task->sprites[1].frame = 0;
523 break;
524 default:
525 task->sprites[1].frame = task->frame + frame;
526 break;
527 }
528 if (done) {
529 task->setState(task, TASK_KILL);
530 }
531 if (task->sprites[0].frame != 0 && isOnScreen(task->x, task->y, 0x20, 0x20)) {
532 layer->addSortedCallback(layer, drawEffect, task, task->y, 0);
533 }
534 if (task->sprites[1].frame != 0 && isOnScreen(task->x, task->y - 0x20, 0x20, 0x40)) {
535 layer->addSortedCallback(layer, drawEffect, task, task->y + 0x12, 1);
536 }
537 break;
538 case TASK_DONE:
539 case TASK_KILL:
540 break;
541 }
542}
543
544/*
545 * Command 852 of the event scripts: the teleport effect at (0x26C, 0xFC) in
546 * event 681, with its sound
547 */
549 StageEffect *task = createTaskWithId(updateEffect, sizeof(StageEffect), 0, id);
550
551 task->x = 0x26C;
552 task->y = 0xFC;
554 task->frame = 0x14;
555 return task;
556}
557
558/*
559 * stepAnimation (common/step_animation.inc.c) under another name: steps ANIM
560 * through FRAMES and returns its frame, looping at the end or returning 0xFF
561 * if once
562 */
563s32 stepAnimation2(AnimState *anim, AnimFrame *frames, s32 once, s32 depth) {
564 AnimFrame *frame = &frames[anim->index];
565 s32 dt = GFX.funcs.getFrameTime();
566
567 if (dt > 4) {
568 dt = 4;
569 }
570 if (depth == 0) {
571 anim->timer -= dt;
572 }
573 if (anim->timer <= 0) {
574 frame++;
575 anim->index++;
576 anim->timer += frame->duration;
577 if (once) {
578 if (frame->frame == 0xFF) {
579 return 0xFF;
580 }
581 } else if (frame->frame == 0xFF) {
582 frame = frames;
583 anim->index = 0;
584 anim->timer += frame->duration;
585 }
586 stepAnimation2(anim, frames, once, depth + 1);
587 }
588 return frame->frame;
589}
590
592
593/*
594 * isOnScreen (common/is_on_screen.inc.c) under another name: whether the
595 * rectangle (x, y, w, h) is in the view of the map's layer
596 */
598 RECT rect;
599 struct Layer *layer = GFX.funcs.getLayer(FIELD_LAYER_MAP);
600
601 layer->getViewRect(layer, &rect);
602 if (x + w < rect.x) {
603 return 0;
604 }
605 if (rect.x + rect.w < x) {
606 return 0;
607 }
608 if (y + h < rect.y) {
609 return 0;
610 }
611 return rect.y + rect.h >= y;
612}
613
614/* An effect that plays its animation each time it is set to TASK_DONE */
617 s32 done;
618 s32 frame;
619
620 switch (task->state) {
621 case TASK_INIT:
622 default:
623 task->key1 = task->x;
624 task->key2 = task->y;
625 task->anim.index = 0;
626 task->anim.timer = effectFrames[0].duration;
627 task->clutAnim.index = 0;
629 task->nextState(task);
630 break;
631 case TASK_RUN:
632 task->sprites[0].frame = task->frame;
633 task->sprites[0].clutRow = stepAnimation2(&task->clutAnim, effectClutFrames, 0, 0);
634 if (task->sprites[0].frame != 0 && isOnScreen2(task->x, task->y, 0x20, 0x20)) {
635 layer->addSortedCallback(layer, drawStageEffect, task, task->y, 0);
636 }
637 break;
638 case TASK_DONE:
639 if (task->substate == 0) {
640 task->anim.index = 0;
641 task->anim.timer = effectFrames[0].duration;
642 task->clutAnim.index = 0;
644 task->setSubstate(task, 1);
645 }
646 task->sprites[0].frame = task->frame;
647 task->sprites[0].clutRow = stepAnimation2(&task->clutAnim, effectClutFrames, 0, 0);
648 done = 0;
649 frame = stepAnimation2(&task->anim, effectFrames, 1, 0);
650 switch (frame) {
651 case 0xFF:
652 task->sprites[1].frame = 0;
653 done = 1;
654 break;
655 case 0x12C:
656 task->sprites[1].frame = 0;
657 break;
658 default:
659 task->sprites[1].frame = task->frame + frame;
660 break;
661 }
662 if (done) {
663 task->setState(task, TASK_RUN);
664 }
665 if (task->sprites[0].frame != 0 && isOnScreen2(task->x, task->y, 0x20, 0x20)) {
666 layer->addSortedCallback(layer, drawStageEffect, task, task->y, 0);
667 }
668 if (task->sprites[1].frame != 0 && isOnScreen2(task->x, task->y - 0x20, 0x20, 0x40)) {
669 layer->addSortedCallback(layer, drawStageEffect, task, task->y + 0x12, 1);
670 }
671 break;
672 case TASK_KILL:
673 break;
674 }
675}
676
677/*
678 * Creates one of the stage's effects (updateStageEffect) at (x, y) with its
679 * sprites' frames from FRAME
680 */
683
684 task->x = x;
685 task->y = y;
686 task->frame = frame;
687 return task;
688}
689
690/*
691 * After event 680, with Guard A, Guard B and Guard C: starts the stage's
692 * event battle 1, sets flag 0x0C13 and keeps it from playing again
693 */
699
700/*
701 * After event 681, with Game Master: starts the stage's event battle 0 and
702 * keeps it from playing again
703 */
708
709/*
710 * After event 682, with Game Master, Lisa, Teddy and Nick: lets events 683
711 * of WSTAG305 and 685 of WSTAG210 start
712 */
713void endEvent682(void) {
714 FLAGS_00.applyAction(FLAG(0x40, 0x50), 1);
715}
716
717/* After event 961, with the player: moves the story on to STORY_ASUKA_HEADQUARTERS */
721
722#if VERSION_US || VERSION_JP
723#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_05)
724#define EVENT_TEXT_FILE (TEXT_EVENTS_300 - 1)
725#define STAGE_FILE 0x334
726#elif VERSION_EU
727#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_05)
728#define EVENT_TEXT_FILE (TEXT_EVENTS_300 - 1)
729#define STAGE_FILE 0x343
730#endif
731/* Sets the stage up: its map, actors, battles and events, playing the ambience ENV_0002 */
751
753 SCRIPT_PLACE(2, 0x58, 0x20C),
754 SCRIPT_POSE(2, 1, 5),
755 SCRIPT_PLACE(0x6C, 0x23B, 0xEB),
756 SCRIPT_POSE(0x6C, 1, 1),
757 SCRIPT_PLACE(0x6D, 0xA1, 0x1B9),
758 SCRIPT_POSE(0x6D, 1, 1),
759 SCRIPT_PLACE(0x6E, 0xFF, 0x1E9),
760 SCRIPT_POSE(0x6E, 1, 1),
761 SCRIPT_PLACE(0x77, 0xEB, 0x1C4),
762 SCRIPT_POSE(0x77, 1, 1),
763 SCRIPT_PLACE(0x110, 0x280, 0x109),
764 SCRIPT_POSE(0x110, 1, 1),
765 SCRIPT_WAIT(0x1E),
766 SCRIPT_WALK(2, 0x78, 0x1FC, 5),
768 SCRIPT_POSE(2, 1, 5),
769 SCRIPT_WAIT(0x1E),
770 SCRIPT_TALK(0, 1, 2, 0),
772 SCRIPT_WAIT(0x1E),
773 SCRIPT_COMMAND(0x323, 0x325, 2),
774 SCRIPT_WAIT(0x3C),
775 SCRIPT_COMMAND(0x323, 0x326, 2),
776 SCRIPT_WAIT(0x1E),
777 SCRIPT_TALK(0, 2, 2, 0),
779 SCRIPT_WAIT(0x1E),
780 SCRIPT_FOLLOW(0, 0x6C),
781 SCRIPT_WAIT(0x78),
782 SCRIPT_WAIT(0x1E),
783 SCRIPT_FOLLOW(0, 2),
784 SCRIPT_WAIT(0x78),
785 SCRIPT_TALK(0, 3, 2, 2),
787 SCRIPT_WAIT(0x1E),
788 SCRIPT_WALK(2, 0xB0, 0x1E0, 5),
790 SCRIPT_POSE(2, 1, 5),
791 SCRIPT_COMMAND(0x323, 0x325, 0x6D),
792 SCRIPT_COMMAND(0x324, 0x325, 0x6E),
793 SCRIPT_COMMAND(0x325, 0x325, 0x77),
794 SCRIPT_WAIT(0x3C),
795 SCRIPT_COMMAND(0x323, 0x326, 0x6D),
796 SCRIPT_COMMAND(0x324, 0x326, 0x6E),
797 SCRIPT_COMMAND(0x325, 0x326, 0x77),
798 SCRIPT_WAIT(0x1E),
799 SCRIPT_WALK(0x6D, 0xB8, 0x1C4, 0),
800 SCRIPT_WALK(0x6E, 0xE7, 0x1DC, 2),
801 SCRIPT_WALK(0x77, 0xD0, 0x1D0, 1),
802 SCRIPT_WAIT_WALK(0x77),
803 SCRIPT_TALK(0, 4, 0x6D, 2),
804 SCRIPT_POSE(0x6D, 1, 0),
805 SCRIPT_POSE(0x6E, 1, 2),
806 SCRIPT_POSE(0x77, 1, 1),
808 SCRIPT_WAIT(0x1E),
809 SCRIPT_TALK(0, 5, 0x6E, 3),
811 SCRIPT_WAIT(0x1E),
812 SCRIPT_TALK(0, 6, 0x77, 2),
814 SCRIPT_WAIT(0x1E),
816};
818 SCRIPT_PLACE(2, 0xB0, 0x1E0),
819 SCRIPT_POSE(2, 1, 5),
820 SCRIPT_PLACE(0x6C, 0x23B, 0xEB),
821 SCRIPT_POSE(0x6C, 1, 1),
822 SCRIPT_PLACE(0x110, 0x280, 0x109),
823 SCRIPT_POSE(0x110, 1, 1),
824 SCRIPT_WAIT(0x78),
825 SCRIPT_TALK(0, 0xA, 2, 0),
827 SCRIPT_WAIT(0x1E),
828 SCRIPT_WALK(2, 0x170, 0x180, 5),
830 SCRIPT_WALK(2, 0x1B0, 0x130, 5),
831 SCRIPT_POSE(0x6C, 1, 5),
833 SCRIPT_POSE(2, 1, 5),
834 SCRIPT_COMMAND(0x323, 0x325, 2),
836 SCRIPT_WAIT(0x3C),
837 SCRIPT_COMMAND(0x323, 0x326, 2),
838 SCRIPT_WAIT(0x1E),
839 SCRIPT_FOLLOW(0, 0x6C),
840 SCRIPT_WAIT(0x3C),
841 SCRIPT_TALK(0, 1, 2, 4),
843 SCRIPT_WAIT(0x1E),
844 SCRIPT_TALK(0, 2, 0x6C, 1),
846 SCRIPT_WAIT(0x1E),
847 SCRIPT_TALK(0, 3, 2, 4),
849 SCRIPT_WAIT(0x1E),
850 SCRIPT_TALK(0, 4, 0x6C, 1),
852 SCRIPT_WAIT(0x1E),
853 SCRIPT_TALK(0, 5, 2, 4),
855 SCRIPT_WAIT(0x1E),
856 SCRIPT_COMMAND(0x354, 0x335, 2),
857 SCRIPT_WAIT(0x3C),
858 SCRIPT_PLACE(0x110, 0, 0),
859 SCRIPT_POSE(0x110, 1, 0),
860 SCRIPT_WAIT(0x1E),
861 SCRIPT_WAIT(0x1E),
862 SCRIPT_FOLLOW(0, 2),
863 SCRIPT_WALK(2, 0x20C, 0x102, 5),
865 SCRIPT_POSE(2, 1, 5),
866 SCRIPT_WAIT(0x1E),
867 SCRIPT_TALK(0, 6, 2, 1),
869 SCRIPT_COMMAND(0x323, 0x325, 0x6C),
870 SCRIPT_WAIT(0x3C),
871 SCRIPT_COMMAND(0x323, 0x326, 2),
872 SCRIPT_WAIT(0x1E),
873 SCRIPT_COMMAND(0x33F, 0x359, 2),
874 SCRIPT_WAIT(0x12),
875 SCRIPT_COMMAND(0x340, 0x359, 2),
876 SCRIPT_WAIT(0x48),
877 SCRIPT_TALK(0, 7, 0x6C, 0),
878 SCRIPT_POSE(0x6C, 1, 1),
880 SCRIPT_WAIT(0x1E),
881 SCRIPT_TALK(0, 8, 2, 1),
883 SCRIPT_WAIT(0x1E),
884 SCRIPT_TALK(0, 9, 0x6C, 0),
886 SCRIPT_WAIT(0x1E),
888};
890 SCRIPT_LOOK_AT(1, 0x20C, 0x108),
891 SCRIPT_PLACE(2, 0x20C, 0x102),
892 SCRIPT_POSE(2, 1, 5),
893 SCRIPT_PLACE(0x65, 0x150, 0x190),
894 SCRIPT_POSE(0x65, 1, 5),
895 SCRIPT_PLACE(0x6C, 0x23B, 0xEB),
896 SCRIPT_POSE(0x6C, 1, 1),
897 SCRIPT_WAIT(0x78),
898 SCRIPT_TALK(0, 1, 0x6C, 0),
900 SCRIPT_WAIT(0x1E),
901 SCRIPT_PLACE(0xC, 0x150, 0x190),
902 SCRIPT_POSE(0xC, 1, 5),
903 SCRIPT_WALK(0x65, 0x170, 0x180, 5),
904 SCRIPT_WAIT_WALK(0x65),
905 SCRIPT_WALK(0xC, 0x170, 0x180, 5),
906 SCRIPT_WALK(0x65, 0x182, 0x16A, 5),
907 SCRIPT_PLACE(0x67, 0x150, 0x190),
908 SCRIPT_POSE(0x67, 1, 5),
909 SCRIPT_WAIT_WALK(0x65),
910 SCRIPT_WALK(0xC, 0x19E, 0x146, 5),
911 SCRIPT_WALK(0x65, 0x1B0, 0x130, 5),
912 SCRIPT_WAIT_WALK(0x65),
913 SCRIPT_WALK(0xC, 0x1B0, 0x130, 5),
914 SCRIPT_WALK(0x65, 0x1D0, 0x120, 5),
915 SCRIPT_WAIT_WALK(0xC),
916 SCRIPT_WALK(0xC, 0x1D0, 0x120, 5),
917 SCRIPT_WALK(0x65, 0x1F0, 0x110, 5),
918 SCRIPT_WAIT_WALK(0x65),
919 SCRIPT_WALK(0xC, 0x1F0, 0x110, 5),
920 SCRIPT_WALK(0x65, 0x200, 0x118, 5),
921 SCRIPT_WAIT_WALK(0xC),
922 SCRIPT_WALK(0xC, 0x1E0, 0x108, 5),
923 SCRIPT_POSE(0x65, 1, 5),
924 SCRIPT_WAIT_WALK(0xC),
925 SCRIPT_TALK(0, 2, 0x65, 1),
926 SCRIPT_POSE(0xC, 1, 5),
927 SCRIPT_POSE(0x65, 1, 4),
929 SCRIPT_COMMAND(0x323, 0x325, 2),
930 SCRIPT_WAIT(0x3C),
931 SCRIPT_POSE(2, 1, 1),
932 SCRIPT_COMMAND(0x323, 0x326, 2),
933 SCRIPT_WAIT(0x1E),
934 SCRIPT_TALK(0, 3, 0xC, 2),
935 SCRIPT_POSE(0xC, 1, 6),
937 SCRIPT_WAIT(0x1E),
938 SCRIPT_WALK(0x67, 0x170, 0x180, 5),
939 SCRIPT_WAIT_WALK(0x67),
940 SCRIPT_WALK(0x67, 0x1B0, 0x130, 5),
941 SCRIPT_WAIT_WALK(0x67),
942 SCRIPT_POSE(0xC, 1, 1),
943 SCRIPT_POSE(0x65, 1, 1),
944 SCRIPT_WALK(0x67, 0x1D0, 0x120, 5),
945 SCRIPT_WAIT_WALK(0x67),
946 SCRIPT_TALK(0, 4, 0x67, 3),
948 SCRIPT_COMMAND(0x323, 0x325, 2),
949 SCRIPT_WAIT(0x3C),
950 SCRIPT_COMMAND(0x323, 0x326, 2),
951 SCRIPT_WAIT(0x1E),
952 SCRIPT_TALK(0, 5, 2, 2),
954 SCRIPT_WAIT(0x1E),
955 SCRIPT_TALK(0, 6, 0x67, 3),
957 SCRIPT_WAIT(0x1E),
958 SCRIPT_TALK(0, 7, 0x65, 3),
959 SCRIPT_POSE(0x65, 1, 4),
961 SCRIPT_WAIT(0x1E),
962 SCRIPT_TALK(0, 8, 0x65, 3),
963 SCRIPT_POSE(2, 1, 5),
964 SCRIPT_POSE(0xC, 1, 5),
965 SCRIPT_POSE(0x65, 1, 5),
967 SCRIPT_WAIT(0x1E),
968 SCRIPT_LEAVE(0x218, 0x64, 0x64, 0),
970};
972 SCRIPT_WAIT(0x1E),
973 SCRIPT_WALK(1, 0x128, 0x1A5, 5),
975 SCRIPT_POSE(1, 1, 5),
976 SCRIPT_WAIT(0x1E),
977 SCRIPT_TALK(0, 1, 1, 0),
978 SCRIPT_POSE(1, 7, 5),
980 SCRIPT_POSE(1, 1, 5),
981 SCRIPT_WAIT(0x1E),
982 SCRIPT_POSE(1, 1, 1),
983 SCRIPT_WAIT(0x1E),
984 SCRIPT_POSE(1, 0x3A, 1),
985 SCRIPT_WAIT(0x78),
986 SCRIPT_POSE(1, 1, 1),
987 SCRIPT_WAIT(0x1E),
988 SCRIPT_PLACE(0x110, 0x40, 0x218),
989 SCRIPT_POSE(0x110, 1, 5),
990 SCRIPT_PLACE(0x111, 0x28, 0x224),
991 SCRIPT_POSE(0x111, 1, 5),
992 SCRIPT_PLACE(0x112, 1, 0x238),
993 SCRIPT_POSE(0x112, 1, 5),
994 SCRIPT_COMMAND(0x323, 0x325, 1),
995 SCRIPT_WAIT(0x1E),
996 SCRIPT_LOOK_AT(1, 0x60, 0x208),
997 SCRIPT_WAIT(0x5A),
998 SCRIPT_WALK(0x112, 0x10, 0x230, 5),
999 SCRIPT_COMMAND(0x323, 0x326, 1),
1000 SCRIPT_WAIT_WALK(0x112),
1001 SCRIPT_POSE(0x110, 1, 4),
1002 SCRIPT_POSE(0x111, 1, 6),
1003 SCRIPT_POSE(0x112, 1, 4),
1004 SCRIPT_WAIT(0x1E),
1005 SCRIPT_POSE(0x110, 1, 5),
1006 SCRIPT_POSE(0x111, 1, 5),
1007 SCRIPT_POSE(0x112, 1, 5),
1008 SCRIPT_WAIT(0x1E),
1009 SCRIPT_POSE(0x110, 1, 6),
1010 SCRIPT_POSE(0x111, 1, 4),
1011 SCRIPT_POSE(0x112, 1, 6),
1012 SCRIPT_WAIT(0x1E),
1013 SCRIPT_POSE(0x110, 1, 5),
1014 SCRIPT_POSE(0x111, 1, 5),
1015 SCRIPT_POSE(0x112, 1, 5),
1016 SCRIPT_WAIT(0x1E),
1017 SCRIPT_COMMAND(0x323, 0x325, 0x110),
1018 SCRIPT_COMMAND(0x324, 0x325, 0x111),
1019 SCRIPT_COMMAND(0x325, 0x325, 0x112),
1020 SCRIPT_WAIT(0x5A),
1021 SCRIPT_COMMAND(0x323, 0x326, 0x110),
1022 SCRIPT_COMMAND(0x324, 0x326, 0x111),
1023 SCRIPT_COMMAND(0x325, 0x326, 0x112),
1024 SCRIPT_WAIT(0x1E),
1025 SCRIPT_POSE(0x110, 1, 1),
1026 SCRIPT_POSE(0x111, 1, 1),
1027 SCRIPT_POSE(0x112, 1, 1),
1028 SCRIPT_WAIT(0x12),
1029 SCRIPT_WALK(0x112, 1, 0x238, 1),
1030 SCRIPT_WAIT_WALK(0x112),
1031 SCRIPT_WALK(0x111, 1, 0x238, 1),
1032 SCRIPT_PLACE(0x112, 0, 0),
1033 SCRIPT_POSE(0x112, 1, 1),
1034 SCRIPT_WAIT_WALK(0x111),
1035 SCRIPT_WALK(0x110, 1, 0x238, 1),
1036 SCRIPT_PLACE(0x111, 0, 0),
1037 SCRIPT_POSE(0x111, 1, 1),
1038 SCRIPT_WAIT_WALK(0x110),
1039 SCRIPT_FOLLOW(1, 1),
1040 SCRIPT_PLACE(0x110, 0, 0),
1041 SCRIPT_POSE(0x110, 1, 1),
1042 SCRIPT_WAIT(0x5A),
1043 SCRIPT_TALK(0, 3, 1, 0),
1044 SCRIPT_POSE(1, 7, 1),
1046 SCRIPT_POSE(1, 1, 1),
1047 SCRIPT_WAIT(0x1E),
1048 SCRIPT_WALK(1, 0x70, 0x200, 1),
1049 SCRIPT_WAIT(0x1E),
1050 SCRIPT_LEAVE(0x218, 0x178, 0xFC, 1),
1051 SCRIPT_END,
1052};
1054 { 51, 8 }, { 52, 8 }, { 53, 8 }, { 54, 8 },
1055 { 55, 8 }, { 56, 8 }, { 57, 8 }, { 75, 40 },
1056 { 255, 0 },
1057};
1059 { 58, 8 }, { 59, 8 }, { 60, 8 }, { 61, 8 },
1060 { 62, 8 }, { 63, 8 }, { 75, 40 }, { 255, 0 },
1061};
1063 { 64, 8 }, { 65, 8 }, { 66, 8 }, { 67, 8 },
1064 { 68, 8 }, { 75, 40 }, { 255, 0 },
1065};
1067 { 69, 8 }, { 70, 8 }, { 71, 8 }, { 72, 8 },
1068 { 73, 8 }, { 74, 8 }, { 75, 40 }, { 255, 0 },
1069};
1071 { 5, 4 }, { 6, 4 }, { 7, 4 }, { 8, 4 },
1072 { 9, 4 }, { 10, 4 }, { 11, 4 }, { 12, 4 },
1073 { 13, 4 }, { 14, 4 }, { 15, 4 }, { 16, 4 },
1074 { 255, 0x3E7 },
1075};
1077 { 28, 4 }, { 29, 4 }, { 30, 4 }, { 31, 4 },
1078 { 32, 4 }, { 33, 4 }, { 34, 4 }, { 35, 4 },
1079 { 36, 4 }, { 37, 4 }, { 38, 4 }, { 39, 4 },
1080 { 255, 0x3E7 },
1081};
1083 { 0, 4 }, { 1, 4 }, { 255, 0 },
1084};
1086 { 0, 12 }, { 1, 12 }, { 2, 12 }, { 3, 12 },
1087 { 4, 12 }, { 5, 12 }, { 6, 12 }, { 7, 12 },
1088 { 8, 12 }, { 9, 12 }, { 10, 12 }, { 11, 12 },
1089 { 12, 12 }, { 13, 12 }, { 255, 0 }, { 16, 4 },
1090 { 15, 4 }, { 14, 4 }, { 13, 4 }, { 12, 4 },
1091 { 11, 4 }, { 10, 4 }, { 9, 4 }, { 8, 4 },
1092 { 7, 4 }, { 6, 4 }, { 5, 4 }, { 255, 0x3E7 },
1093};
1095 { 39, 4 }, { 38, 4 }, { 37, 4 }, { 36, 4 },
1096 { 35, 4 }, { 34, 4 }, { 33, 4 }, { 32, 4 },
1097 { 31, 4 }, { 30, 4 }, { 29, 4 }, { 28, 4 },
1098 { 255, 0x3E7 },
1099};
1101 { 76, 4 }, { 77, 4 }, { 78, 4 }, { 79, 4 },
1102 { 80, 4 }, { 81, 4 }, { 82, 4 }, { 83, 4 },
1103 { 84, 4 }, { 85, 4 }, { 86, 4 }, { 87, 4 },
1104 { 255, 0x3E7 },
1105};
1107 { 88, 4 }, { 89, 4 }, { 90, 4 }, { 91, 4 },
1108 { 92, 4 }, { 93, 4 }, { 94, 4 }, { 95, 4 },
1109 { 96, 4 }, { 97, 4 }, { 98, 4 }, { 99, 4 },
1110 { 255, 0x3E7 },
1111};
1113 { 0, 4 }, { 1, 4 }, { 255, 0 },
1114};
1116 { 0, 12 }, { 1, 12 }, { 2, 12 }, { 3, 12 },
1117 { 4, 12 }, { 5, 12 }, { 6, 12 }, { 7, 12 },
1118 { 8, 12 }, { 9, 12 }, { 10, 12 }, { 255, 0 },
1119 { 87, 4 }, { 86, 4 }, { 85, 4 }, { 84, 4 },
1120 { 83, 4 }, { 82, 4 }, { 81, 4 }, { 80, 4 },
1121 { 79, 4 }, { 78, 4 }, { 77, 4 }, { 76, 4 },
1122 { 255, 0x3E7 },
1123};
1125 { 99, 4 }, { 98, 4 }, { 97, 4 }, { 96, 4 },
1126 { 95, 4 }, { 94, 4 }, { 93, 4 }, { 92, 4 },
1127 { 91, 4 }, { 90, 4 }, { 89, 4 }, { 88, 4 },
1128 { 255, 0x3E7 },
1129};
1131 { 20, 0, 492, 188 },
1132 { 20, 0, 620, 252 },
1133};
1135 { 0, 6 }, { 1, 6 }, { 2, 68 }, { 1, 4 },
1136 { 0, 4 }, { 255, 0 },
1137};
1139 { 0x12C, 18 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
1140 { 4, 6 }, { 5, 4 }, { 6, 4 }, { 7, 4 },
1141 { 5, 4 }, { 6, 4 }, { 7, 4 }, { 5, 4 },
1142 { 6, 4 }, { 7, 4 }, { 5, 4 }, { 6, 4 },
1143 { 7, 4 }, { 4, 4 }, { 3, 4 }, { 2, 4 },
1144 { 1, 4 }, { 255, 0x3E7 },
1145};
1147 { 0, 6 }, { 1, 6 }, { 2, 68 }, { 1, 4 },
1148 { 0, 4 }, { 255, 0 },
1149};
1151 { 0x12C, 18 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
1152 { 4, 6 }, { 5, 4 }, { 6, 4 }, { 7, 4 },
1153 { 5, 4 }, { 6, 4 }, { 7, 4 }, { 5, 4 },
1154 { 6, 4 }, { 7, 4 }, { 5, 4 }, { 6, 4 },
1155 { 7, 4 }, { 4, 4 }, { 3, 4 }, { 2, 4 },
1156 { 1, 4 }, { 255, 0x3E7 },
1157};
1214 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
1215 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
1216 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
1217 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
1218 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
1219 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
1220 { 0x1C0, 0x100, 0x1F6, 0x100, 0x2D8, 0, 0x160, 0x1F0 },
1221 { 0x1C0, 0x100, 0x1F6, 0x120, 0x2D8, 0x20, 0x140, 0x1EF },
1222 { 0x140, 0x100, 0x176, 0x100, 0xD8, 0, 0x150, 0x1EF },
1223 { 0x140, 0x100, 0x176, 0x128, 0xD8, 0x28, 0x160, 0x1EF },
1224 { 0x1C0, 0x100, 0x1F6, 0x140, 0x2D8, 0x40, 0x170, 0x1EF },
1225 { 0x140, 0x100, 0x176, 0x150, 0xD8, 0x50, 0x140, 0x1EE },
1226 { 0x140, 0x100, 0x176, 0x178, 0xD8, 0x78, 0x150, 0x1EE },
1227 { 0x140, 0x100, 0x176, 0x1A0, 0xD8, 0xA0, 0x170, 0x1EE },
1228 { 0x1C0, 0x100, 0x1E2, 0x178, 0x288, 0x78, 0x140, 0x1ED },
1229 { 0x1C0, 0x100, 0x1EA, 0x178, 0x2A8, 0x78, 0x150, 0x1ED },
1230 { 0x1C0, 0x100, 0x1CA, 0x180, 0x228, 0x80, 0x160, 0x1ED },
1231};
1264FieldActorEntry actor4 = { actor4Conditions, NULL, 0x6C, 8, 571, 235, 1 };
1265FieldActorEntry actor5 = { actor5Conditions, NULL, 0x6D, 9, 161, 441, 1 };
1266FieldActorEntry actor6 = { actor6Conditions, NULL, 0x6E, 0xA, 255, 489, 1 };
1267FieldActorEntry actor7 = { actor7Conditions, NULL, 0x77, 0xB, 235, 452, 1 };
1268FieldActorEntry actor8 = { actor8Conditions, NULL, 0x110, 0xC, 640, 265, 1 };
1269FieldActorEntry actor9 = { actor9Conditions, NULL, 0x110, 0xC, 0, 0, 1 };
1270FieldActorEntry actor10 = { actor10Conditions, NULL, 0x111, 0xD, 0, 0, 1 };
1271FieldActorEntry actor11 = { actor11Conditions, NULL, 0x112, 0xE, 0, 0, 1 };
1273 &actor0,
1274 &actor1,
1275 &actor2,
1276 &actor3,
1277 &actor4,
1278 &actor5,
1279 &actor6,
1280 &actor7,
1281 &actor8,
1282 &actor9,
1283 &actor10,
1284 &actor11,
1285 NULL,
1286};
1288 { 1, 1, 0x40, 2, 0x33, 0, 0, 0, 0, 0, 584, 125, 0, 0 },
1289 { 1, 2, 0x40, 2, 0x3A, 0, 0, 0, 0, 0, 592, 144, 0, 0 },
1290 { 1, 3, 0x40, 2, 0x40, 0, 0, 0, 0, 0, 609, 140, 0, 0 },
1291 { 1, 4, 0x40, 2, 0x45, 0, 0, 0, 0, 0, 610, 167, 0, 0 },
1292 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 160, 509, 0, 0 },
1293 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 392, 457, 0, 0 },
1294 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 448, 339, 0, 0 },
1295 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 545, 307, 0, 0 },
1296 { 0, 6, 0x80, 2, 0x1C, 0, 0, 0, 0, 0, 550, 116, 0, 0 },
1297 { 0, 0xC, 0xFF, 2, 0x58, 0, 0, 0, 0, 0, 430, 103, 0, 0 },
1298 { 0, 8, 0x80, 2, 2, 0, 0, 0, 0, 0, 550, 116, 0, 0 },
1299 { 0, 9, 0x80, 2, 3, 0, 0, 0, 0, 0, 550, 116, 0, 0 },
1300 { 0, 0xA, 0x80, 2, 4, 0, 0, 0, 0, 0, 550, 116, 0, 0 },
1301 { 0, 5, 0x80, 2, 5, 0, 0, 0, 0, 0, 550, 116, 0, 0 },
1302 { 0, 7, 0x80, 2, 0x28, 0, 0, 0, 0, 0, 546, 112, 0, 0 },
1303 { 0, 0xE, 0xFF, 2, 0x11, 0, 0, 0, 0, 0, 430, 103, 0, 0 },
1304 { 0, 0xF, 0xFF, 2, 0x12, 0, 0, 0, 0, 0, 430, 103, 0, 0 },
1305 { 0, 0x10, 0xFF, 2, 0x13, 0, 0, 0, 0, 0, 430, 103, 0, 0 },
1306 { 0, 0xB, 0xFF, 2, 0x4C, 0, 0, 0, 0, 0, 430, 103, 0, 0 },
1307 { 0, 0xD, 0xFF, 2, 0x29, 0, 0, 0, 0, 0, 426, 99, 0, 0 },
1308 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 72, 464, 0, 0 },
1309 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 178, 350, 0, 0 },
1310 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 303, 267, 0, 0 },
1311 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 369, 219, 0, 0 },
1312 { 1, 0, 0x40, 4, 0, 0, 0, 0, 0, 0, 392, 328, 386, 0 },
1313 { 1, 0, 0x40, 4, 1, 0, 0, 0, 0, 0, 545, 243, 266, 0 },
1314 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
1315};
1317 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x218, 0x178, 0xFC, 1, 0, 0, 0 },
1318 { { { CODES_END, 0 }, { CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
1319};
1320void (*stageFuncs[])(void) = {
1321 setupStage,
1322};
1324 { 680, script680, EVENT_TEXT(0xA), NULL, endEvent680 },
1325 { 681, script681, EVENT_TEXT(0xB), NULL, endEvent681 },
1326 { 682, script682, EVENT_TEXT(0xC), NULL, endEvent682 },
1327 { 961, script961, EVENT_TEXT(0x14), NULL, endEvent961 },
1328 { -1, NULL, 0, NULL, NULL },
1329};
#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
void * createTileAnims(void)
Creates the updateTileAnims task.
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
void drawStageEffect(StageEffect *task, void *arg, s32 idx)
Draws sprite idx of a StageEffect (the second, the one-shot one, 0x20 higher) on LAYER,...
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 FIELD_LAYER_MAP
the map, its objects and characters, and the menus
Definition field_map.h:20
#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_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
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
#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
s32 isOnScreen(s32 x, s32 y, s32 w, s32 h)
Whether the rectangle (x, y, w, h) is in the view of the map's layer.
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
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
FIELDSTG's start of the stage (StageEntry.init in FIELDSTG_stages): the stage's task,...
s32 stepAnimation(AnimState *anim, AnimFrame *frames, s32 once, s32 depth)
Steps ANIM through FRAMES by the frame time (at most 4) and returns its frame: at the end (frame 0xFF...
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_PRESIDENT_ARRESTED
WSTAG226 (Login Room, Amaterasu City), event 935, after the President of MAGAMI gives himself up (WST...
Definition story.h:136
@ STORY_ASUKA_HEADQUARTERS
WSTAG310 (A.o.A Headquarters, Asuka City), event 961.
Definition story.h:138
@ STORY_GAME_MASTER_CAUGHT
WSTAG305 (Master Room), event 661: the Game Master is caught, but Vemmon takes over the Optical Netwo...
Definition story.h:94
#define FLAG_OPERATION_SIGMA_SEEN
wstag310 event 680: the fusion experiment succeeds and the A.o.A commence Operation Sigma; set at its...
Definition story.h:1454
#define FLAG_ASUKA_AOA_HQ_GUARDS_FOUGHT
wstag310 A.o.A Headquarters (Asuka): set at the end of event 680 (Operation Sigma announced) with the...
Definition story.h:726
#define FLAG_GAME_MASTER_WIN_SEEN
wstag310 event 681: the Game Master's Persiamon loses and Lisa, Teddy and Nick arrive to arrest her; ...
Definition story.h:1457
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 frame
Definition gfx.h:297
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 *(* getEntry)(u32 fileAndIndex)
Definition file.h:96
void(* applyAction)(s32 code, s32 value)
Definition game_state.h:52
s32(* checkCondition)(u16 code, u16 value)
Definition game_state.h:53
s32(* getFrameTime)(void)
Definition gfx.h:32
struct Layer *(* getLayer)(s32 id)
Definition gfx.h:28
GfxFuncs funcs
Definition gfx.h:77
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
Definition gfx.h:128
void(* addSortedCallback)()
Definition gfx.h:160
void(* getViewRect)()
Definition gfx.h:151
short(* playSound)(s32 id)
returns the voice of a key-on
Definition sound.h:187
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
Definition gfx.h:223
void(* setLayer)()
(layer, depth)
Definition gfx.h:245
void(* setClutRow)()
(row)
Definition gfx.h:247
void(* draw)()
(sheet, frame, x, y)
Definition gfx.h:246
void(* setTexture)()
(x, y)
Definition gfx.h:242
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 key2
Definition stage.h:80
s32 x
Definition stage.h:82
s32 frame
Definition stage.h:81
s32 state
Definition stage.h:80
AnimState anim
the one-shot animation
Definition stage.h:84
void(* nextState)(struct StageEffect *task)
Definition stage.h:80
s32 key1
Definition stage.h:80
void(* setSubstate)(struct StageEffect *task, s32 substate)
Definition stage.h:80
StageSprite sprites[2]
drawn at depth 6 and 4
Definition stage.h:86
AnimState clutAnim
Definition stage.h:85
void(* setState)(struct StageEffect *task, s32 state)
Definition stage.h:80
s32 y
Definition stage.h:83
s32 substate
Definition stage.h:80
What the player can trigger on a map (FIELDSTG_updateTriggers): a record of the table at FieldState....
Definition field_map.h:276
A sprite of a StageEffect: its frame (0 for none) and palette row.
Definition stage.h:69
s16 clutRow
Definition stage.h:71
s16 frame
Definition stage.h:70
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
A map object animated while playing is set.
Definition stage.h:423
StageTile * tile
Definition stage.h:424
AnimState anim
Definition stage.h:426
StageTile * tile
Definition stage.h:109
AnimState anim
Definition stage.h:110
StageTileSix with flagged map objects.
Definition stage.h:437
StageTileAnimFlag tiles[6]
Definition stage.h:440
void(* nextState)(struct StageTileSixW *task)
Definition stage.h:438
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...
u16 actor1Conditions[]
Definition wstag310.c:1233
AreaBattle area2Battle7
Definition wstag310.c:1191
FieldActorEntry actor0
Definition wstag310.c:1260
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag310.c:1320
FieldActorEntry actor6
Definition wstag310.c:1266
AnimFrame updateTileAnimsFrames2[]
Definition wstag310.c:1062
u16 actor11Conditions[]
Definition wstag310.c:1259
void updateEffect(StageEffect *task)
An effect that plays its animation once and ends.
Definition wstag310.c:488
AnimFrame updateTileSixWFrames0[]
Definition wstag310.c:1100
AreaBattle area2Battle6
Definition wstag310.c:1190
void updateStageEffect(StageEffect *task)
An effect that plays its animation each time it is set to TASK_DONE.
Definition wstag310.c:615
void * createCommand831(s32 id)
Creates the task of the six map objects with id ID, in mode 2.
Definition wstag310.c:157
u16 actor10Conditions[]
Definition wstag310.c:1258
AnimFrame updateEffectFrames0[]
Definition wstag310.c:1138
void updateTileSixW(StageTileSixW *task)
Animates the map objects with animations 11 to 16 by mode (0: hidden, 1 and 3: the first two once,...
Definition wstag310.c:278
void handleCommand832(StageTileSixW *task, s32 id)
Plays the first two map objects backwards (mode 3) for map 0x359.
Definition wstag310.c:386
AnimFrame effectClutFrames[]
Definition wstag310.c:1146
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
static void showLastFourTilesW(StageTileSixW *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 wstag310.c:248
s16 script961[]
Definition wstag310.c:971
s16 script682[]
Definition wstag310.c:889
s32 isOnScreen2(s32 x, s32 y, s32 w, s32 h)
isOnScreen (common/is_on_screen.inc.c) under another name: whether the rectangle (x,...
Definition wstag310.c:597
AreaBattle area1Battle6
Definition wstag310.c:1177
void endEvent680(void)
After event 680, with Guard A, Guard B and Guard C: starts the stage's event battle 1,...
Definition wstag310.c:694
void endEvent961(void)
After event 961, with the player: moves the story on to STORY_ASUKA_HEADQUARTERS.
Definition wstag310.c:718
FieldActorEntry actor5
Definition wstag310.c:1265
AreaBattle area0Battle7
Definition wstag310.c:1165
FieldActorEntry actor2
Definition wstag310.c:1262
void * createTileSixW(void)
Creates the second set of six map objects (updateTileSixW) without an id; nothing in the game calls i...
Definition wstag310.c:408
AreaBattle area3Battle4
Definition wstag310.c:1201
AreaBattle area3Battle3
Definition wstag310.c:1200
AreaBattle area0Battle1
Definition wstag310.c:1159
AreaBattle area2Battle0
Definition wstag310.c:1184
u16 actor9Conditions[]
Definition wstag310.c:1257
FieldActorEntry * stageActors[]
Definition wstag310.c:1272
AnimFrame updateTileAnimsFrames3[]
Definition wstag310.c:1066
AreaBattle area1Battle2
Definition wstag310.c:1173
AreaBattle area3Battle0
Definition wstag310.c:1197
AreaBattle area0Battle6
Definition wstag310.c:1164
AnimFrame updateTileSixFrames2[]
Definition wstag310.c:1082
AreaBattle area3Battle2
Definition wstag310.c:1199
AreaBattle area3Battle1
Definition wstag310.c:1198
AreaBattle area0Battle3
Definition wstag310.c:1161
FieldActorEntry actor10
Definition wstag310.c:1270
u16 actor4Conditions[]
Definition wstag310.c:1236
FieldActorEntry actor4
Definition wstag310.c:1264
u16 actor3Conditions[]
Definition wstag310.c:1235
StageEffect * createEffect(s32 x, s32 y, s32 frame)
Creates one of the stage's effects (updateStageEffect) at (x, y) with its sprites' frames from FRAME.
Definition wstag310.c:681
AreaBattle area3Battle6
Definition wstag310.c:1203
AnimFrame updateTileAnimsFrames1[]
Definition wstag310.c:1058
FieldActorEntry actor8
Definition wstag310.c:1268
AnimFrame updateTileSixWFrames3[]
Definition wstag310.c:1115
ActorImage stageImages[]
Definition wstag310.c:1213
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing the ambience ENV_0002.
Definition wstag310.c:732
void endEvent682(void)
After event 682, with Game Master, Lisa, Teddy and Nick: lets events 683 of WSTAG305 and 685 of WSTAG...
Definition wstag310.c:713
s16 script680[]
Definition wstag310.c:752
AnimFrame effectFrames[]
Definition wstag310.c:1150
AreaBattle area2Battle4
Definition wstag310.c:1188
StageEffectSpot updateStageSpots[]
Definition wstag310.c:1130
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag310.c:1287
FieldActorEntry actor9
Definition wstag310.c:1269
u16 actor8Conditions[]
Definition wstag310.c:1252
s16 script681[]
Definition wstag310.c:817
u16 actor5Conditions[]
Definition wstag310.c:1237
BattleList area3Battles
Definition wstag310.c:1205
AreaBattle area3Battle5
Definition wstag310.c:1202
AreaBattle area0Battle5
Definition wstag310.c:1163
BattleList area1Battles
Definition wstag310.c:1179
BattleList area2Battles
Definition wstag310.c:1192
AnimFrame updateTileSixFrames3[]
Definition wstag310.c:1085
AreaBattle area1Battle4
Definition wstag310.c:1175
u16 actor6Conditions[]
Definition wstag310.c:1242
AreaBattle area2Battle2
Definition wstag310.c:1186
AreaBattle area1Battle5
Definition wstag310.c:1176
AnimFrame updateTileSixFrames4[]
Definition wstag310.c:1094
FieldActorEntry actor7
Definition wstag310.c:1267
StageSlot stageSlots[]
Definition wstag310.c:1316
AreaBattle area2Battle1
Definition wstag310.c:1185
AnimFrame updateTileSixFrames1[]
Definition wstag310.c:1076
AnimFrame updateEffectFrames1[]
Definition wstag310.c:1134
void * createCommand832(s32 id)
Creates the task of the six map objects with id ID, in mode 2.
Definition wstag310.c:397
AreaBattle area1Battle3
Definition wstag310.c:1174
AnimFrame updateTileSixWFrames1[]
Definition wstag310.c:1106
AreaBattle area1Battle0
Definition wstag310.c:1171
AnimFrame updateTileSixFrames0[]
Definition wstag310.c:1070
s32 stepAnimation2(AnimState *anim, AnimFrame *frames, s32 once, s32 depth)
stepAnimation (common/step_animation.inc.c) under another name: steps ANIM through FRAMES and returns...
Definition wstag310.c:563
FieldActorEntry actor11
Definition wstag310.c:1271
AnimFrame updateTileAnimsFrames0[]
Defined below, after the code that uses them.
Definition wstag310.c:1053
FieldActorEntry actor1
Definition wstag310.c:1261
AreaBattle area0Battle0
Definition wstag310.c:1158
AreaBattle area0Battle2
Definition wstag310.c:1160
#define STAGE_FILE
Definition wstag310.c:729
AreaBattle area2Battle5
Definition wstag310.c:1189
StageEffect * createCommand852(s32 id)
Command 852 of the event scripts: the teleport effect at (0x26C, 0xFC) in event 681,...
Definition wstag310.c:548
AreaBattle area1Battle1
Definition wstag310.c:1172
u16 actor7Conditions[]
Definition wstag310.c:1247
AreaBattle area2Battle3
Definition wstag310.c:1187
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 wstag310.c:38
u16 actor2Conditions[]
Definition wstag310.c:1234
AreaBattle area0Battle4
Definition wstag310.c:1162
#define STAGE_TEXT
Definition wstag310.c:727
AnimFrame updateTileSixWFrames2[]
Definition wstag310.c:1112
void drawEffect(StageEffect *task, void *arg, s32 idx)
Draws sprite IDX of the effect while it plays (a draw callback)
Definition wstag310.c:459
void handleCommand831(StageTileSix *task, s32 id)
Plays the first two map objects backwards (mode 3) for map 0x359.
Definition wstag310.c:146
AreaBattle area3Battle7
Definition wstag310.c:1204
BattleList area0Battles
Definition wstag310.c:1166
AreaBattle area1Battle7
Definition wstag310.c:1178
void endEvent681(void)
After event 681, with Game Master: starts the stage's event battle 0 and keeps it from playing again.
Definition wstag310.c:704
FieldActorEntry actor3
Definition wstag310.c:1263
FieldBattles stageBattles[]
Definition wstag310.c:1210
FieldEvent stageEvents[]
Definition wstag310.c:1323
static void findTileSixW(StageTileSixW *task)
Finds the map objects with animations 11 to 16 and starts the animations of the first four.
Definition wstag310.c:203
u16 actor0Conditions[]
Definition wstag310.c:1232
AnimFrame updateTileSixWFrames4[]
Definition wstag310.c:1124