Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag460.c
Go to the documentation of this file.
1/*
2 * WSTAG460: Reliability Spot, South Sector. Where the Qing Long Chief welcomes
3 * the player.
4 */
5
6#include "common.h"
7#include "field/stage.h"
8/* Defined below, after the code that uses them */
11extern u16 wandererSpeeds[];
12extern u16 angleTangents[];
15extern u8 tileDuoObjectFrames[2][2];
16void *createTileSoloTask(void);
17void *createTileDuoTask(void);
21void fadeOutTileSolo(StageTileSolo *task, s32 command, s32 arg);
22void fadeOutTileDuo(StageTileDuo *task, s32 command, s32 arg);
23StageWanderer *createWandererTask(s32 tileAnim, s32 speedIndex, s32 start);
24
25/* Creates the tiles and the seven wanderers; in TASK_DONE makes them all hide and goes back to TASK_RUN */
26void updateCommand830(StageTask *task, void **children) {
27 switch (task->state) {
28 case TASK_INIT:
29 default:
30 children[0] = createTileSoloTask();
31 children[1] = createTileDuoTask();
32 children[2] = createWandererTask(1, 0, 0);
33 children[3] = createWandererTask(2, 0, 0);
34 children[4] = createWandererTask(3, 0, 0);
35 children[5] = createWandererTask(4, 1, 0);
36 children[6] = createWandererTask(5, 1, 0);
37 children[7] = createWandererTask(6, 1, 0);
38 children[8] = createWandererTask(7, 1, 0);
39 task->nextState(task);
40 break;
41 case TASK_RUN:
42 break;
43 case TASK_DONE:
44 fadeOutTileSolo(children[0], 0, 0);
45 fadeOutTileDuo(children[1], 0, 0);
46 fadeOutWanderer(children[2], 0, 0);
47 fadeOutWanderer(children[3], 0, 0);
48 fadeOutWanderer(children[4], 0, 0);
49 fadeOutWanderer(children[5], 0, 0);
50 fadeOutWanderer(children[6], 0, 0);
51 fadeOutWanderer(children[7], 0, 0);
52 fadeOutWanderer(children[8], 0, 0);
53 task->setState(task, TASK_RUN);
54 break;
55 case TASK_KILL:
56 break;
57 }
58}
59
60/* Sets the task to TASK_DONE when the id is 0x34C */
61void handleCommand830(Task *task, s32 id) {
62 if (task != NULL && id == 0x34C) {
63 task->setState(task, TASK_DONE);
64 }
65}
66
67/* Creates the task of updateCommand830 with the given id */
69 return createTaskWithId(updateCommand830, 0x50, 0x24, id);
70}
71
73
74/* Shows the map object with animation 10 (animated) while mode isn't 0, and hides it by a one-shot animation wait frames after mode 2 */
76 StageTile *object;
77 StageTile *tile;
78 StageTile *fading;
79 s32 frame;
80
81 switch (task->state) {
82 case TASK_INIT:
83 default:
84 task->tile.anim.index = 0;
86 task->tile.anim.index = 0;
88 task->mode = 1;
89 for (object = FIELDSTG_state.objects; object->margin != 0; object++) {
90 if (object->anim == 10) {
91 task->tile.tile = object;
92 }
93 }
94 task->nextState(task);
95 break;
96 case TASK_RUN:
97 tile = task->tile.tile;
98 if (task->mode != 0) {
99 tile->visible = 1;
100 tile->frame = 0x3C;
102 } else {
103 tile->visible = 0;
104 }
105 if (task->mode == 2) {
106 if (--task->wait <= 0) {
107 task->setState(task, TASK_DONE);
108 }
109 }
110 break;
111 case TASK_DONE:
112 if (task->substate == 0) {
113 task->tile.anim.index = 0;
115 task->setSubstate(task, 1);
116 }
117 fading = task->tile.tile;
118 frame = stepTileAnimation(&task->tile, updateTileSoloFrames1, 1, 0);
119 switch (frame) {
120 case 0x12C:
121 fading->visible = 0;
122 break;
123 case 0xFF:
124 fading->visible = 0;
125 task->mode = 0;
126 task->setState(task, TASK_RUN);
127 break;
128 default:
129 fading->visible = 1;
130 fading->frame = 0x3D;
131 fading->clutRow = frame;
132 break;
133 }
134 break;
135 case TASK_KILL:
136 break;
137 }
138}
139
140/* Makes the StageTileSolo hide in 20 frames; command and arg, a script
141 command handler's (ScriptCommand.handle), are 0 from the stage and unread */
142void fadeOutTileSolo(StageTileSolo *task, s32 command, s32 arg) {
143 if (task != NULL) {
144 task->mode = 2;
145 task->wait = 0x14;
146 }
147}
148
149/*
150 * Creates the color-cycling map object by the Digi-Egg of Sincerity
151 * (updateTileSolo) with an id; nothing in the game calls it
152 */
153void *createTileSolo(s32 arg) {
154 return createTaskWithId(updateTileSolo, sizeof(StageTileSolo), 0, arg);
155}
156
157/*
158 * Creates the color-cycling map object by the Digi-Egg of Sincerity
159 * (updateTileSolo), the one with animation 10
160 */
162 return createTask(updateTileSolo, sizeof(StageTileSolo), 0);
163}
164
166
167/*
168 * Cycles the colors of the map objects with animations 8 and 9 by the Digi-
169 * Egg of Sincerity while mode isn't 0, and ends wait frames after mode 2
170 */
172 StageTile *tile;
173 StageTile *object;
174 StageTile *fading;
175 s32 i;
176 s32 j;
177 s32 frame;
178
179 switch (task->state) {
180 case TASK_INIT:
181 default:
182 task->tiles[0].anim.index = 0;
184 task->tiles[1].anim.index = 0;
186 task->mode = 1;
187 for (object = FIELDSTG_state.objects; object->margin != 0; object++) {
188 switch (object->anim) {
189 case 8:
190 task->tiles[0].tile = object;
191 break;
192 case 9:
193 task->tiles[1].tile = object;
194 break;
195 }
196 }
197 task->nextState(task);
198 break;
199 case TASK_RUN:
200 for (i = 0; i < 2; i++) {
201 tile = task->tiles[i].tile;
202 if (task->mode != 0) {
203 tile->visible = 1;
204 tile->clutRow = stepTileAnimation2(&task->tiles[i], updateTileDuoFrames0[i], 0, 0);
205 tile->frame = tileDuoObjectFrames[0][i];
206 } else {
207 tile->visible = 0;
208 }
209 }
210 if (task->mode == 2) {
211 if (--task->wait <= 0) {
212 task->setState(task, TASK_DONE);
213 }
214 }
215 break;
216 case TASK_DONE:
217 if (task->substate == 0) {
218 task->tiles[0].anim.index = 0;
220 task->tiles[1].anim.index = 0;
222 task->setSubstate(task, 1);
223 }
224 for (j = 0; j < 2; j++) {
225 fading = task->tiles[j].tile;
226 frame = stepTileAnimation2(&task->tiles[j], updateTileDuoFrames1[j], 1, 0);
227 switch (frame) {
228 case 0x12C:
229 fading->visible = 0;
230 break;
231 case 0xFF:
232 fading->visible = 0;
233 task->mode = 0;
234 task->setState(task, TASK_RUN);
235 break;
236 default:
237 fading->visible = 1;
238 fading->frame = tileDuoObjectFrames[1][j];
239 fading->clutRow = frame;
240 break;
241 }
242 }
243 break;
244 case TASK_KILL:
245 break;
246 }
247}
248
249/* Makes the StageTileDuo hide in 150 frames (command and arg as fadeOutTileSolo's) */
250void fadeOutTileDuo(StageTileDuo *task, s32 command, s32 arg) {
251 if (task != NULL) {
252 task->mode = 2;
253 task->wait = 0x96;
254 }
255}
256
258
260
262
263/* Whether the wanderer is more than dist from home (in x + y) */
265 s32 dx = task->posX - task->homeX;
266 s32 dy = task->posY - task->homeY;
267
268 if (dx < 0) {
269 dx = -dx;
270 }
271 if (dy < 0) {
272 dy = -dy;
273 }
274 return dist < dx + dy;
275}
276
277#include "common/get_angle.inc.c"
278
279/* Moves the wanderer, turning it every period frames */
281 s32 dx;
282 s32 dy;
283
284 task->timer += GFX.funcs.getFrameTime();
285 if (task->period < task->timer) {
286 if (isFarFromHome(task, 0x1E)) {
287 task->angle = ((getAngle(task->homeX - task->posX, task->homeY - task->posY) - 0x40) << 4) & 0xFFF;
288 } else {
289 task->angle = (RANDOM.next() & 0xFF) << 4;
290 }
291 task->timer -= task->period;
292 task->timer += (RANDOM.next() & 0xF) - 7;
293 }
294 dx = rsin(task->angle) * task->speed / 4096;
295 dy = rcos(task->angle) * task->speed / 4096;
296 task->x += dx;
297 task->y += dy;
298 task->posX = task->x >> 8;
299 task->posY = task->y >> 8;
300}
301
302/* Wanders; when done, plays the animation of updateWandererFrames1 once and hides */
304 StageTile *tile;
305 StageTile *object;
306 StageTile *fading;
307 s32 frame;
308
309 switch (task->state) {
310 case TASK_INIT:
311 default:
312 task->tile.anim.index = task->start;
314 task->mode = 1;
315 for (object = FIELDSTG_state.objects; object->margin != 0; object++) {
316 if (object->anim == task->tileAnim) {
317 task->tile.tile = object;
318 task->homeX = object->x;
319 task->homeY = object->y;
320 task->x = object->x << 8;
321 task->y = object->y << 8;
322 }
323 }
324 task->period = 0x28;
325 task->timer = task->start;
326 task->speed = wandererSpeeds[task->speedIndex];
327 task->angle = (RANDOM.next() & 0xFF) << 4;
328 task->nextState(task);
329 break;
330 case TASK_RUN:
331 if (task->mode != 0) {
332 moveWanderer(task);
333 }
334 tile = task->tile.tile;
335 if (task->mode != 0) {
336 tile->visible = 1;
338 tile->x = task->posX;
339 tile->y = task->posY;
340 } else {
341 tile->visible = 0;
342 }
343 if (task->mode == 3) {
344 task->speed -= 4;
345 if (task->speed <= 0x10) {
346 task->setState(task, TASK_DONE);
347 }
348 }
349 if (task->mode == 2) {
350 if (--task->wait <= 0) {
351 task->mode = 3;
352 }
353 }
354 break;
355 case TASK_DONE:
356 if (task->substate == 0) {
357 task->tile.anim.index = 0;
359 task->setSubstate(task, 1);
360 }
361 moveWanderer(task);
362 fading = task->tile.tile;
363 frame = stepTileAnimation3(&task->tile, updateWandererFrames1, 1, 0);
364 switch (frame) {
365 case 0x12C:
366 fading->visible = 0;
367 break;
368 case 0xFF:
369 fading->visible = 0;
370 task->mode = 0;
371 task->setState(task, TASK_RUN);
372 break;
373 default:
374 fading->visible = 1;
375 fading->clutRow = frame;
376 fading->x = task->posX;
377 fading->y = task->posY;
378 break;
379 }
380 break;
381 case TASK_KILL:
382 break;
383 }
384}
385
386/* Makes the wanderer wait 60 frames, then slow down and finish */
388 if (task != NULL) {
389 task->mode = 2;
390 task->wait = 0x3C;
391 }
392}
393
394/*
395 * Creates one of the map objects that wander by the Digi-Egg of Sincerity
396 * (updateWanderer) with an id; nothing in the game calls it
397 */
398void *createWanderer(s32 arg) {
399 return createTaskWithId(updateWanderer, sizeof(StageWanderer), 0, arg);
400}
401
402/* Creates a wanderer of the map object with the given animation */
405
406 task->start = start;
407 task->speedIndex = speedIndex;
408 task->tileAnim = tileAnim;
409 return task;
410}
411
412/* Creates the task of updateCommand830 (id 0x33E) before progress 0xF */
413void updateStage(StageTask *task, void **children) {
414 switch (task->state) {
415 case TASK_INIT:
416 default:
417 task->nextState(task);
419 children[0] = createCommand830(0x33E);
420 }
421 break;
422 case TASK_RUN:
423 case TASK_DONE:
424 case TASK_KILL:
425 break;
426 }
427}
428
429#define STAGE_CHILDREN_SIZE 4
431
432/*
433 * After event 370, with the player: moves the story on to STORY_DE_SINCERITY and
434 * gives the player the DE Sincerity
435 */
436void endEvent370(void) {
438 FLAGS_00.applyAction(ITEM(0, 0x10), 1);
439}
440
441#if VERSION_US || VERSION_JP
442#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_06)
443#define EVENT_TEXT_FILE (TEXT_EVENTS_400 - 1)
444#define STAGE_FILE 0x354
445#define STAGE_ARCHIVE 0x44F
446#elif VERSION_EU
447#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_06)
448#define EVENT_TEXT_FILE (TEXT_EVENTS_400 - 1)
449#define STAGE_FILE 0x363
450#define STAGE_ARCHIVE 0x45F
451#endif
452/* Sets the stage up: its map, actors and events, playing BGM_0014 */
471
473 SCRIPT_FOLLOW(0, 2),
474 SCRIPT_WALK(2, 0x70, 0x188, 3),
475 SCRIPT_PLACE(0x82, 0x60, 0x16F),
476 SCRIPT_POSE(0x82, 1, 7),
479 SCRIPT_POSE(2, 1, 3),
480 SCRIPT_WAIT(0x1E),
481 SCRIPT_COMMAND(0x323, 0x325, 2),
482 SCRIPT_WAIT(0x3C),
483 SCRIPT_COMMAND(0x323, 0x326, 2),
484 SCRIPT_WAIT(0x1E),
485 SCRIPT_TALK(0, 1, 2, 3),
487 SCRIPT_WAIT(0x1E),
488 SCRIPT_PLACE(0x82, 0, 0),
489 SCRIPT_POSE(0x82, 1, 7),
491 SCRIPT_WAIT(0x1E),
492 SCRIPT_TALK(0, 2, 2, 3),
494 SCRIPT_COMMAND(0x33E, 0x34C, 2),
495 SCRIPT_WAIT(0xD2),
496 SCRIPT_TALK(0, 3, 2, 3),
498 SCRIPT_POSE(2, 1, 7),
499 SCRIPT_WAIT(0x1E),
500 SCRIPT_WALK(2, 0xB0, 0x1A8, 7),
501 SCRIPT_WAIT(0x3C),
502 SCRIPT_LEAVE(0x235, 0x470, 0xE0, 7),
504};
506 { 0, 8 }, { 1, 8 }, { 2, 8 }, { 3, 8 },
507 { 4, 8 }, { 5, 8 }, { 6, 8 }, { 7, 8 },
508 { 8, 8 }, { 9, 8 }, { 10, 8 }, { 11, 8 },
509 { 12, 8 }, { 13, 8 }, { 14, 8 }, { 255, 0 },
510};
512 { 0, 8 }, { 1, 8 }, { 2, 8 }, { 3, 8 },
513 { 4, 8 }, { 5, 8 }, { 6, 8 }, { 7, 8 },
514 { 8, 8 }, { 9, 8 }, { 10, 8 }, { 11, 8 },
515 { 255, 0x3E7 },
516};
518 { 0, 8 }, { 1, 8 }, { 2, 8 }, { 3, 8 },
519 { 4, 8 }, { 5, 8 }, { 6, 8 }, { 7, 8 },
520 { 8, 8 }, { 9, 8 }, { 10, 8 }, { 11, 8 },
521 { 12, 8 }, { 13, 8 }, { 14, 8 }, { 255, 0 },
522};
524 { 0, 6 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
525 { 4, 6 }, { 5, 6 }, { 6, 6 }, { 7, 6 },
526 { 8, 6 }, { 9, 6 }, { 10, 6 }, { 11, 6 },
527 { 255, 0x3E7 },
528};
530 { 0, 8 }, { 1, 8 }, { 2, 8 }, { 3, 8 },
531 { 4, 8 }, { 5, 8 }, { 6, 8 }, { 7, 8 },
532 { 8, 8 }, { 9, 8 }, { 10, 8 }, { 11, 8 },
533 { 12, 8 }, { 13, 8 }, { 14, 8 }, { 255, 0 },
534};
536 { 0, 6 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
537 { 4, 6 }, { 5, 6 }, { 6, 6 }, { 7, 6 },
538 { 8, 6 }, { 9, 6 }, { 10, 6 }, { 11, 6 },
539 { 255, 0x3E7 },
540};
548 { 62, 63 },
549 { 64, 65 },
550};
552 { 0, 4 }, { 1, 4 }, { 2, 4 }, { 3, 4 },
553 { 4, 4 }, { 5, 4 }, { 4, 4 }, { 3, 4 },
554 { 2, 4 }, { 1, 4 }, { 255, 0 },
555};
557 { 0, 4 }, { 1, 4 }, { 2, 4 }, { 3, 4 },
558 { 4, 4 }, { 5, 4 }, { 6, 8 }, { 7, 8 },
559 { 8, 8 }, { 9, 8 }, { 10, 8 }, { 255, 0x3E7 },
560};
562 96, 80, 72, 64,
563};
565 0, 0x648, 0xC93, 0x12E2, 0x1936, 0x1F92, 0x259F, 0x2C6B,
566 0x32EB, 0x39C7, 0x401F, 0x46D7, 0x4DA7, 0x5491, 0x5B98, 0x62BF,
567 0x6A09, 0x7179, 0x7913, 0x80DB, 0x88B5, 0x9105, 0x9970, 0xA21B,
568 0xAB0D, 0xB44A, 0xBDDC, 0xC7C8, 0xD217, 0xDCD2, 0xE805, 0xF3BA,
569 0xFFFE, 0xFFFF,
570};
572 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
573 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
574 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
575 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
576 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
577 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
578 { 0, 0, 0, 0, 0, 0, 0, 0 },
579 { 0x140, 0x100, 0x17A, 0x1D8, 0xE8, 0xD8, 0x170, 0x1F1 },
580};
582 { NULL, NULL, 0x33A },
583 { NULL, NULL, 0 },
584};
586FieldActorEntry actor0 = { NULL, actor0Talks, 0x3F, 4, 250, 109, 1 };
587FieldActorEntry actor1 = { actor1Conditions, NULL, 0x82, 5, 96, 367, 7 };
589 &actor0,
590 &actor1,
591 NULL,
592};
594 { 0, 8, 0xFF, 2, 0x3E, 0, 0, 0, 0, 0, 46, 288, 0, 0 },
595 { 0, 3, 0x40, 2, 0xD, 0, 0, 0, 0, 0, 52, 288, 0, 0 },
596 { 0, 2, 0x40, 2, 0xD, 0, 0, 0, 0, 0, 154, 262, 0, 0 },
597 { 0, 1, 0x40, 2, 0xD, 0, 0, 0, 0, 0, 174, 359, 0, 0 },
598 { 0, 7, 0x40, 2, 0xE, 0, 0, 0, 0, 0, 103, 297, 0, 0 },
599 { 0, 5, 0x40, 2, 0xE, 0, 0, 0, 0, 0, 117, 236, 0, 0 },
600 { 0, 6, 0x40, 2, 0xE, 0, 0, 0, 0, 0, 217, 300, 0, 0 },
601 { 1, 0, 0x40, 2, 0x32, 2, 0, 1, 0xC, 0, 48, 288, 0, 0 },
602 { 1, 0, 0x40, 2, 0x32, 2, 0, 1, 0xC, 0, 160, 280, 0, 0 },
603 { 1, 0, 0x40, 2, 0x33, 2, 0, 1, 0xC, 0, 104, 248, 0, 0 },
604 { 1, 0, 0x40, 2, 0x33, 2, 0, 1, 0xC, 0, 233, 263, 0, 0 },
605 { 1, 0, 0x40, 2, 0x33, 2, 0, 1, 0xC, 0, 233, 335, 0, 0 },
606 { 0, 0xA, 0xFF, 6, 0x3C, 0, 0, 0, 0, 0, 50, 239, 0, 0 },
607 { 0, 9, 0xFF, 6, 0x3F, 0, 0, 0, 0, 0, 46, 288, 0, 0 },
608 { 1, 0, 0x40, 4, 0, 0, 0, 0, 0, 0, 240, 72, 135, 0 },
609 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
610};
612 { { { PROGRESS(STORY_TEDDY_FOUND), 1 }, { CODES_END, 0 } }, SLOT_EVENT, 0x172, 0, 0, 0, 0, 0, 0 },
613 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_DOWN, 0xE, 0xEF, 0xA8, 0, 0, 0, 0 },
614 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_UP, 0xE, 0xDF, 0x190, 0, 0, 0, 0 },
615 { { { CODES_END, 0 }, { CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
616};
617void (*stageFuncs[])(void) = {
619};
621 { 370, script370, EVENT_TEXT(0x28), NULL, endEvent370 },
622 { -1, NULL, 0, NULL, NULL },
623};
#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
unsigned char u8
Definition common.h:8
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
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
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 SLOT_CLIMB_UP
Definition field_map.h:256
#define SCRIPT_WAIT_WALK(id)
until the character gets to its goal
Definition field_map.h:168
#define FIELD_COMMAND_HALT_PARTNERS
The field commands, which an event script hands FIELD_TASK_COMMANDS as the first argument of a pose c...
Definition field_map.h:41
#define SCRIPT_END
The commands of an event script (FieldEvent.script), as FIELDSTG_runEvent reads them: a halfword kind...
Definition field_map.h:156
#define SCRIPT_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 FIELD_COMMAND_ICON3
its substate 3, with ITEM_GET
Definition field_map.h:44
#define SLOT_CLIMB_DOWN
Definition field_map.h:257
#define SLOT_EVENT
starts the event arg
Definition field_map.h:262
#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 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 CODES_END
Definition game_state.h:83
#define ITEM(kind, id)
an item, in the bag or equipped; kind (bits 9-11) isn't read, and the scripts set it after the item's...
Definition game_state.h:80
#define PROGRESS(n)
GAME.progress is n.
Definition game_state.h:69
s32 getAngle(s32 x, s32 y)
The angle of (x, y), 0x100 a turn, from the stage's table of tangents angleTangents.
Random RANDOM
Definition random.c:533
#define MUSIC_RELIABILITY_SPOT
BGM_0014: the Reliability Spot.
Definition sound.h:90
#define MUSIC_BANK(music)
The sound bank of a music, which a stage loads for it (FieldState.soundBank)
Definition sound.h:148
Task * start(void)
The mode's entry point (MODE_ENTRY_POINTS): starts its root task (update_scene.inc....
Definition start.inc.c:3
FIELDSTG's start of the stage (StageEntry.init in FIELDSTG_stages): the stage's task,...
s32 stepTileAnimation3(StageTileAnim *obj, AnimFrame *frames, s32 once, s32 depth)
stepTileAnimation under a third name: steps OBJ's animation through FRAMES by the frame time (at most...
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_TEDDY_FOUND
WSTAG212, event 352: Teddy is found; MAGAMI is part of the A.o.A, and the player sets off to beat the...
Definition story.h:67
@ STORY_DE_SINCERITY
WSTAG460 (Reliability Spot), event 370: the Qing Long Chief, asked for the Digi-Egg of Knowledge,...
Definition story.h:70
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 character of the field (FieldState.actors, a list of pointers up to NULL), which FIELDSTG_updateFie...
Definition field_map.h:194
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
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
What a character says (FIELDSTG_runActorAction): the first whose conditions hold, or the last,...
Definition field_map.h:176
void(* applyAction)(s32 code, s32 value)
Definition game_state.h:52
s32(* getFrameTime)(void)
Definition gfx.h:32
GfxFuncs funcs
Definition gfx.h:77
s32(* next)(void)
0 to RANDOM_COUNT - 1
Definition random.h:15
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
void(* setState)(struct StageTask *task, s32 state)
Definition stage.h:27
StageTile * tile
Definition stage.h:109
AnimState anim
Definition stage.h:110
Two map objects (animations 8 and 9) shown while mode isn't 0, and hidden by a one-shot animation wai...
Definition stage.h:179
void(* nextState)(struct StageTileDuo *task)
Definition stage.h:180
s32 state
Definition stage.h:180
StageTileAnim tiles[2]
Definition stage.h:183
s32 substate
Definition stage.h:180
void(* setSubstate)(struct StageTileDuo *task, s32 substate)
Definition stage.h:180
void(* setState)(struct StageTileDuo *task, s32 state)
Definition stage.h:180
StageTileDuo with one map object.
Definition stage.h:359
void(* setState)(struct StageTileSolo *task, s32 state)
Definition stage.h:360
StageTileAnim tile
Definition stage.h:363
void(* setSubstate)(struct StageTileSolo *task, s32 substate)
Definition stage.h:360
s32 substate
Definition stage.h:360
void(* nextState)(struct StageTileSolo *task)
Definition stage.h:360
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
A map object that wanders around where it starts, animated, turning every period frames: towards home...
Definition stage.h:134
s32 start
the first frame and timer
Definition stage.h:139
u8 tileAnim
the map object (FieldState.objects) it moves
Definition stage.h:137
s32 x
8.8
Definition stage.h:143
s16 posX
x and y >> 8
Definition stage.h:145
void(* nextState)(struct StageWanderer *task)
Definition stage.h:135
void(* setSubstate)(struct StageWanderer *task, s32 substate)
Definition stage.h:135
s32 substate
Definition stage.h:135
s16 angle
0x1000 a turn
Definition stage.h:150
s16 mode
0: hidden, 1: wandering, 2: waiting, 3: slowing down
Definition stage.h:136
u8 speedIndex
Definition stage.h:138
StageTileAnim tile
Definition stage.h:151
s16 period
frames between turns
Definition stage.h:148
void(* setState)(struct StageWanderer *task, s32 state)
Definition stage.h:135
Any task, seen through its header.
Definition task.h:62
void(* setState)(struct Task *task, s32 state)
Definition task.h:63
Definition gfx.h:352
void * 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
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
AnimFrame updateTileDuoFrames1_0[]
Definition wstag460.c:523
u16 actor1Conditions[]
Definition wstag460.c:585
FieldActorEntry actor0
Definition wstag460.c:586
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag460.c:617
void handleCommand830(Task *task, s32 id)
Sets the task to TASK_DONE when the id is 0x34C.
Definition wstag460.c:61
s16 script370[]
Definition wstag460.c:472
void fadeOutTileSolo(StageTileSolo *task, s32 command, s32 arg)
Makes the StageTileSolo hide in 20 frames; command and arg, a script command handler's (ScriptCommand...
Definition wstag460.c:142
void updateTileDuo(StageTileDuo *task)
Cycles the colors of the map objects with animations 8 and 9 by the Digi- Egg of Sincerity while mode...
Definition wstag460.c:171
void moveWanderer(StageWanderer *task)
Moves the wanderer, turning it every period frames.
Definition wstag460.c:280
u16 wandererSpeeds[]
Definition wstag460.c:561
FieldActorEntry * stageActors[]
Definition wstag460.c:588
AnimFrame * updateTileDuoFrames0[]
Definition wstag460.c:541
void * createTileDuoTask(void)
Creates the updateTileDuo task.
s32 isFarFromHome(StageWanderer *task, s32 dist)
Whether the wanderer is more than dist from home (in x + y)
Definition wstag460.c:264
AnimFrame updateTileDuoFrames0_1[]
Definition wstag460.c:529
FieldTalk actor0Talks[]
Definition wstag460.c:581
#define STAGE_ARCHIVE
Definition wstag460.c:450
void updateWanderer(StageWanderer *task)
Wanders; when done, plays the animation of updateWandererFrames1 once and hides.
Definition wstag460.c:303
AnimFrame updateTileDuoFrames0_0[]
Definition wstag460.c:517
void updateTileSolo(StageTileSolo *task)
Shows the map object with animation 10 (animated) while mode isn't 0, and hides it by a one-shot anim...
Definition wstag460.c:75
StageWanderer * createWandererTask(s32 tileAnim, s32 speedIndex, s32 start)
Creates a wanderer of the map object with the given animation.
Definition wstag460.c:403
ActorImage stageImages[]
Definition wstag460.c:571
void setupStage(void)
Sets the stage up: its map, actors and events, playing BGM_0014.
Definition wstag460.c:453
void updateCommand830(StageTask *task, void **children)
Creates the tiles and the seven wanderers; in TASK_DONE makes them all hide and goes back to TASK_RUN...
Definition wstag460.c:26
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag460.c:593
void fadeOutWanderer()
u16 angleTangents[]
Definition wstag460.c:564
AnimFrame updateTileDuoFrames1_1[]
Definition wstag460.c:535
u8 tileDuoObjectFrames[2][2]
Definition wstag460.c:547
void * createWanderer(s32 arg)
Creates one of the map objects that wander by the Digi-Egg of Sincerity (updateWanderer) with an id; ...
Definition wstag460.c:398
StageSlot stageSlots[]
Definition wstag460.c:611
FieldActorEntry actor1
Definition wstag460.c:587
#define STAGE_FILE
Definition wstag460.c:449
AnimFrame updateTileSoloFrames0[]
Definition wstag460.c:505
AnimFrame * updateTileDuoFrames1[]
Definition wstag460.c:544
AnimFrame updateTileSoloFrames1[]
Definition wstag460.c:511
void * createTileSoloTask(void)
Creates the color-cycling map object by the Digi-Egg of Sincerity (updateTileSolo),...
Definition wstag460.c:161
#define STAGE_TEXT
Definition wstag460.c:447
void * createCommand830(s32 id)
Creates the task of updateCommand830 with the given id.
Definition wstag460.c:68
void endEvent370(void)
After event 370, with the player: moves the story on to STORY_DE_SINCERITY and gives the player the D...
Definition wstag460.c:436
void * createTileSolo(s32 arg)
Creates the color-cycling map object by the Digi-Egg of Sincerity (updateTileSolo) with an id; nothin...
Definition wstag460.c:153
AnimFrame updateWandererFrames1[]
Definition wstag460.c:556
AnimFrame updateWandererFrames0[]
Defined below, after the code that uses them.
Definition wstag460.c:551
FieldEvent stageEvents[]
Definition wstag460.c:620
void fadeOutTileDuo()