Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag785.c
Go to the documentation of this file.
1/*
2 * WSTAG785: Online Center, Kusanagi City (the Real World). MAGAMI's Online
3 * Center, where Junior registers before the Chamber Room.
4 */
5
6#include "common.h"
7#include "field/stage.h"
8/* Defined below, after the code that uses them */
13
14/* The file of the marks, which the versions number differently */
15#if VERSION_US || VERSION_JP
16#define MARKS 0x1B9
17#elif VERSION_EU
18#define MARKS 0x1C7
19#endif
20
22
23/* Plays the animations of map objects 4/3 then 2 (with 1 looping); starts at 2 when done is set */
25 StageTile *object;
26 StageTile *tile;
27 s32 frame;
28
29 switch (task->state) {
30 case TASK_INIT:
31 default:
32 for (object = FIELDSTG_state.objects; object->margin != 0; object++) {
33 switch (object->anim) {
34 case 1:
35 task->tiles[3] = object;
36 break;
37 case 2:
38 task->tiles[2] = object;
39 break;
40 case 3:
41 task->tiles[1] = object;
42 break;
43 case 4:
44 task->tiles[0] = object;
45 break;
46 }
47 }
48 task->anim2.index = 0;
50 if (task->done == 0) {
51 task->anim.index = 0;
53 task->nextState(task);
54 } else {
55 task->setState(task, TASK_DONE);
56 }
57 break;
58 case TASK_RUN:
59 switch (task->substate) {
60 case 0:
61 default:
62 tile = task->tiles[0];
63 frame = stepAnimation(&task->anim, updateTileSetFrames1, 1, 0);
64 if (frame == 0xFF) {
65 task->setSubstate(task, 1);
66 tile->visible = 0;
67 task->anim.index = 0;
69 } else {
70 tile->clutRow = frame;
71 tile->visible = 1;
72 }
73 break;
74 case 1:
75 tile = task->tiles[1];
76 tile->clutRow = stepAnimation(&task->anim, updateTileSetFrames2, 0, 0);
77 tile->visible = 1;
78 break;
79 case 2:
80 break;
81 }
82 tile = task->tiles[3];
83 tile->clutRow = stepAnimation(&task->anim2, updateTileSetFrames0, 0, 0);
84 tile->visible = 1;
85 break;
86 case TASK_DONE:
87 if (task->substate == 0) {
88 task->anim.index = 0;
90 task->anim2.index = 0;
92 task->nextSubstate(task);
93 }
94 tile = task->tiles[2];
95 tile->clutRow = stepAnimation(&task->anim, updateTileSetFrames3, 0, 0);
96 tile->visible = 1;
97 tile = task->tiles[3];
98 tile->clutRow = stepAnimation(&task->anim2, updateTileSetFrames0, 0, 0);
99 tile->visible = 1;
100 break;
101 case TASK_KILL:
102 break;
103 }
104}
105
106/* Creates the task of updateTileSet already done */
109
110 task->done = 1;
111 return task;
112}
113
114/*
115 * Command 835 of the event scripts: the map objects of event 1, where the
116 * Account Clerk sets up the accounts (updateTileSet)
117 */
119 return createTaskWithId(updateTileSet, sizeof(StageTileSet), 0, arg);
120}
121
122/* Draws frame FRAME of file MARKS over the character */
123void drawActorMark(StageActorMark *task, s32 frame) {
124 SpriteDrawer drawer;
125 s32 pos[2];
126
127 pos[0] = task->actor->pos.x >> 8;
128 pos[1] = (task->actor->pos.y >> 8) - 0x18;
129 initSpriteDrawer(&drawer);
130 drawer.setLayerId(FIELD_LAYER_MAP, 2);
131 drawer.setTexture(0x140, 0x100);
132 drawer.draw(FILE_CACHE.getEntry(MARKS << 16 | 1), frame, pos[0], pos[1]);
133}
134
135/* Shows the mark over the character: opens (0x32-0x34), stays by kind, closes (0x36-0x37) */
137 s32 frame;
138
139 switch (task->state) {
140 case TASK_INIT:
141 default:
142 task->nextState(task);
143 break;
144 case TASK_RUN:
145 switch (task->substate) {
146 case 0:
147 default:
148 frame = 0x32;
149 task->step += GFX.funcs.getFrameTime();
150 if (task->step < 4) {
151 break;
152 }
153 task->nextSubstate(task);
154 /* fallthrough */
155 case 1:
156 frame = 0x33;
157 task->step += GFX.funcs.getFrameTime();
158 if (task->step < 4) {
159 break;
160 }
161 task->nextSubstate(task);
162 /* fallthrough */
163 case 2:
164 frame = 0x34;
165 task->step += GFX.funcs.getFrameTime();
166 if (task->step < 4) {
167 break;
168 }
169 task->nextSubstate(task);
170 /* fallthrough */
171 case 3:
172 switch (task->kind) {
173 case 0:
174 default:
175 frame = 0x35;
176 break;
177 case 1:
178 frame = ((task->step >> 3) & 1) + 0x38;
179 task->step += GFX.funcs.getFrameTime();
180 break;
181 case 2:
182 frame = 0x3C;
183 break;
184 case 3:
185 frame = 0x3D;
186 break;
187 }
188 break;
189 }
190 drawActorMark(task, frame);
191 break;
192 case TASK_DONE:
193 switch (task->substate) {
194 case 0:
195 default:
196 frame = 0x36;
197 task->step += GFX.funcs.getFrameTime();
198 if (task->step < 4) {
199 break;
200 }
201 task->nextSubstate(task);
202 /* fallthrough */
203 case 1:
204 frame = 0x37;
205 task->step += GFX.funcs.getFrameTime();
206 if (task->step < 4) {
207 break;
208 }
209 task->nextState(task);
210 break;
211 }
212 drawActorMark(task, frame);
213 break;
214 case TASK_KILL:
215 break;
216 }
217}
218
219/* Command 807 of the event scripts: the mark over a character in event 1 (updateActorMark) */
221 return createTaskWithId(updateActorMark, sizeof(StageActorMark), 0, arg);
222}
223
224/* Map objects 0x328/0x329 set the kind and the character (actor of key KEY), 0x32A ends it */
225void handleCommand807(void *arg, s32 id, s32 key) {
226 StageActorMark *task = arg;
227
228 switch (id) {
229 case 0x328:
230 task->kind = 2;
231 break;
232 case 0x329:
233 task->kind = 3;
234 break;
235 case 0x32A:
236 task->setState(task, TASK_DONE);
237 break;
238 }
239 switch (id) {
240 case 0x328:
241 case 0x329:
243 break;
244 }
245}
246
247/* Creates the event object of story progress 0 or 1 (with an object for 1) */
248void updateStage(StageTask *task, void **children) {
249 switch (task->state) {
250 case TASK_INIT:
251 default:
252 switch (GAME.progress) {
253 case STORY_START:
254 children[0] = FIELDSTG_startEvent(1);
255 break;
257 children[1] = createTileSet();
258 children[0] = FIELDSTG_startEvent(3);
259 break;
260 }
261 task->nextState(task);
262 children[1] = NULL;
263 break;
264 case TASK_RUN:
265 case TASK_DONE:
266 case TASK_KILL:
267 break;
268 }
269}
270
271#define STAGE_CHILDREN_SIZE 0x8
273
274/* After event 1, with Junior, Teddy, Account Clerk and Ivy: moves the story on to STORY_ACCOUNT_REGISTERED */
278
279const CVECTOR stageColor = { 0x80, 0x80, 0x80, 0x00 };
280#if VERSION_US || VERSION_JP
281#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
282#define EVENT_TEXT_FILE (TEXT_EVENTS_700 - 1)
283#define STAGE_FILE 0x1B9
284#define STAGE_ARCHIVE 0x3D2
285#elif VERSION_EU
286#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
287#define EVENT_TEXT_FILE (TEXT_EVENTS_700 - 1)
288#define STAGE_FILE 0x1C7
289#define STAGE_ARCHIVE 0x3E2
290#endif
291/* Sets the stage up: its map, actors and events, playing ON_CNBGM */
309
311 SCRIPT_LOOK_AT(1, 0x1E0, 0x150),
312 SCRIPT_PLACE(1, 0x280, 0x100),
313 SCRIPT_POSE(1, 1, 1),
314 SCRIPT_PLACE(0xB, 0x2A0, 0xF0),
315 SCRIPT_POSE(0xB, 1, 1),
316 SCRIPT_PLACE(0xC, 0x2C0, 0xE0),
317 SCRIPT_POSE(0xC, 1, 1),
318 SCRIPT_PLACE(0xD, 0x14A, 0x121),
319 SCRIPT_POSE(0xD, 1, 1),
320 SCRIPT_PLACE(0xE, 0x185, 0x126),
321 SCRIPT_POSE(0xE, 3, 7),
322 SCRIPT_PLACE(0xF, 0x136, 0xFC),
323 SCRIPT_POSE(0xF, 3, 2),
324 SCRIPT_WAIT(0x1E),
325 SCRIPT_WALK(1, 0x1E0, 0x150, 1),
326 SCRIPT_WALK(0xB, 0x200, 0x140, 1),
327 SCRIPT_WALK(0xC, 0x220, 0x130, 1),
329 SCRIPT_FOLLOW(1, 1),
330 SCRIPT_WALK(1, 0x1D0, 0x158, 1),
331 SCRIPT_WALK(0xB, 0x1E0, 0x140, 1),
332 SCRIPT_WALK(0xC, 0x210, 0x138, 1),
334 SCRIPT_POSE(1, 0x3A, 1),
335 SCRIPT_POSE(0xB, 0x3A, 3),
336 SCRIPT_POSE(0xC, 0x3A, 5),
337 SCRIPT_WAIT(0x3C),
338 SCRIPT_TALK(0, 1, 1, 0),
339 SCRIPT_POSE(1, 1, 1),
341 SCRIPT_POSE(1, 0x3A, 1),
342 SCRIPT_POSE(0xC, 1, 3),
343 SCRIPT_WAIT(0x1E),
344 SCRIPT_COMMAND(0x323, 0x325, 0xC),
345 SCRIPT_WAIT(0x3C),
346 SCRIPT_COMMAND(0x323, 0x326, 1),
347 SCRIPT_WAIT(0x1E),
348 SCRIPT_WALK(0xC, 0x200, 0x130, 3),
349 SCRIPT_WAIT_WALK(0xC),
350 SCRIPT_FOLLOW(0, 0xC),
351 SCRIPT_TALK(0, 2, 0xC, 0),
352 SCRIPT_POSE(0xB, 0x3A, 3),
353 SCRIPT_POSE(0xC, 7, 2),
355 SCRIPT_POSE(0xB, 0x3B, 3),
356 SCRIPT_POSE(0xC, 0x3B, 3),
357 SCRIPT_WAIT(0x3C),
358 SCRIPT_POSE(1, 1, 5),
359 SCRIPT_WAIT(0x78),
360 SCRIPT_FOLLOW(0, 1),
361 SCRIPT_POSE(1, 0x2A, 5),
362 SCRIPT_WAIT(0x78),
363 SCRIPT_POSE(1, 1, 5),
364 SCRIPT_WAIT(0x1E),
365 SCRIPT_FOLLOW(0, 1),
366 SCRIPT_TALK(0, 3, 1, 0),
367 SCRIPT_POSE(1, 7, 5),
369 SCRIPT_POSE(1, 0x2A, 5),
370 SCRIPT_POSE(0xB, 1, 1),
371 SCRIPT_POSE(0xC, 1, 1),
372 SCRIPT_COMMAND(0x323, 0x325, 0xC),
373 SCRIPT_COMMAND(0x324, 0x325, 0xB),
374 SCRIPT_WAIT(0x5A),
375 SCRIPT_POSE(1, 1, 5),
376 SCRIPT_COMMAND(0x323, 0x326, 1),
377 SCRIPT_COMMAND(0x324, 0x326, 1),
378 SCRIPT_WAIT(0x1E),
379 SCRIPT_POSE(1, 1, 5),
380 SCRIPT_POSE(0xB, 1, 1),
381 SCRIPT_POSE(0xC, 1, 1),
382 SCRIPT_WAIT(0x1E),
383 SCRIPT_POSE(0xB, 9, 1),
384 SCRIPT_POSE(0xC, 9, 1),
385 SCRIPT_WAIT_ANIM(0xC),
386 SCRIPT_POSE(0xB, 1, 1),
387 SCRIPT_POSE(0xC, 1, 1),
388 SCRIPT_WAIT(0x1E),
389 SCRIPT_WALK(1, 0x170, 0x158, 3),
390 SCRIPT_WALK(0xB, 0x170, 0x158, 3),
391 SCRIPT_WALK(0xC, 0x170, 0x158, 3),
393 SCRIPT_WALK(1, 0x124, 0x12E, 5),
394 SCRIPT_WAIT_WALK(0xB),
395 SCRIPT_WALK(0xB, 0x144, 0x13E, 5),
396 SCRIPT_WAIT_WALK(0xC),
397 SCRIPT_WALK(0xC, 0x164, 0x14E, 5),
398 SCRIPT_WAIT_WALK(0xB),
399 SCRIPT_POSE(1, 1, 5),
400 SCRIPT_POSE(0xB, 1, 5),
401 SCRIPT_POSE(0xC, 1, 5),
402 SCRIPT_POSE(0xD, 1, 1),
403 SCRIPT_WAIT(0x1E),
404 SCRIPT_POSE(0xD, 9, 1),
405 SCRIPT_WAIT_ANIM(0xD),
406 SCRIPT_POSE(0xD, 1, 1),
407 SCRIPT_WAIT(0x1E),
408 SCRIPT_FOLLOW(0, 0xD),
409 SCRIPT_TALK(0, 4, 0xD, 0),
410 SCRIPT_POSE(0xD, 7, 1),
412 SCRIPT_POSE(0xD, 1, 1),
413 SCRIPT_WAIT(0x1E),
414 SCRIPT_POSE(1, 9, 5),
415 SCRIPT_POSE(0xB, 9, 5),
416 SCRIPT_POSE(0xC, 9, 5),
418 SCRIPT_POSE(1, 1, 5),
419 SCRIPT_POSE(0xB, 1, 5),
420 SCRIPT_POSE(0xC, 1, 5),
421 SCRIPT_WAIT(0x1E),
422 SCRIPT_FOLLOW(0, 0xD),
423 SCRIPT_TALK(0, 5, 0xD, 0),
424 SCRIPT_POSE(0xD, 7, 1),
426 SCRIPT_POSE(0xD, 1, 1),
427 SCRIPT_WAIT(0x1E),
428 SCRIPT_FOLLOW(0, 0xB),
429 SCRIPT_COMMAND(0x323, 0x325, 1),
430 SCRIPT_COMMAND(0x324, 0x325, 0xB),
431 SCRIPT_COMMAND(0x325, 0x325, 0xC),
432 SCRIPT_WAIT(0x5A),
433 SCRIPT_COMMAND(0x323, 0x326, 1),
434 SCRIPT_COMMAND(0x324, 0x326, 1),
435 SCRIPT_COMMAND(0x325, 0x326, 1),
436 SCRIPT_WAIT(0x1E),
437 SCRIPT_FOLLOW(0, 0xD),
438 SCRIPT_TALK(0, 6, 0xD, 0),
439 SCRIPT_POSE(0xD, 7, 1),
441 SCRIPT_POSE(0xD, 1, 1),
442 SCRIPT_WAIT(0x1E),
443 SCRIPT_POSE(1, 9, 5),
444 SCRIPT_POSE(0xB, 9, 5),
445 SCRIPT_POSE(0xC, 9, 5),
447 SCRIPT_TALK(0, 7, 0xD, 0),
448 SCRIPT_POSE(1, 1, 5),
449 SCRIPT_POSE(0xB, 1, 5),
450 SCRIPT_POSE(0xC, 1, 5),
451 SCRIPT_POSE(0xD, 7, 1),
453 SCRIPT_POSE(0xD, 1, 1),
454 SCRIPT_WAIT(0x1E),
455 SCRIPT_FOLLOW(0, 1),
456 SCRIPT_POSE(1, 0x29, 5),
457 SCRIPT_POSE(0xB, 9, 5),
458 SCRIPT_POSE(0xC, 9, 5),
459 SCRIPT_COMMAND(0x323, 0x327, 1),
460 SCRIPT_WAIT_ANIM(0xB),
461 SCRIPT_POSE(1, 0x29, 1),
462 SCRIPT_POSE(0xB, 1, 5),
463 SCRIPT_POSE(0xC, 1, 5),
464 SCRIPT_WAIT(0x78),
465 SCRIPT_POSE(0xB, 1, 3),
466 SCRIPT_POSE(0xC, 1, 3),
467 SCRIPT_WAIT(0x1E),
468 SCRIPT_FOLLOW(0, 0xB),
469 SCRIPT_POSE(0xB, 0x39, 3),
470 SCRIPT_WAIT_ANIM(0xB),
471 SCRIPT_POSE(0xB, 1, 3),
472 SCRIPT_WAIT(0x1E),
473 SCRIPT_POSE(1, 0x29, 1),
474 SCRIPT_WALK(0xB, 0xF4, 0x166, 5),
475 SCRIPT_WAIT_WALK(0xB),
476 SCRIPT_POSE(1, 1, 1),
477 SCRIPT_POSE(0xB, 1, 5),
478 SCRIPT_POSE(0xC, 1, 1),
479 SCRIPT_COMMAND(0x323, 0x326, 1),
480 SCRIPT_WAIT(0x1E),
481 SCRIPT_WALK(1, 0x104, 0x13E, 1),
482 SCRIPT_WALK(0xC, 0x144, 0x15E, 1),
484 SCRIPT_WAIT(0x1E),
485 SCRIPT_TALK(0, 8, 0xB, 1),
486 SCRIPT_POSE(0xB, 7, 5),
488 SCRIPT_POSE(0xB, 1, 5),
489 SCRIPT_WAIT(0x1E),
490 SCRIPT_FOLLOW(0, 1),
491 SCRIPT_TALK(0, 9, 1, 0),
492 SCRIPT_POSE(1, 7, 1),
493 SCRIPT_POSE(0xB, 1, 5),
494 SCRIPT_POSE(0xC, 0x3B, 1),
495 SCRIPT_COMMAND(0x327, 0x328, 0xC),
497 SCRIPT_POSE(1, 1, 1),
498 SCRIPT_POSE(0xB, 0x39, 5),
499 SCRIPT_POSE(0xC, 1, 1),
500 SCRIPT_COMMAND(0x327, 0x32A, 1),
501 SCRIPT_WAIT_ANIM(0xB),
502 SCRIPT_POSE(0xB, 1, 5),
503 SCRIPT_WAIT(0x1E),
504 SCRIPT_FOLLOW(0, 0xB),
505 SCRIPT_TALK(0, 0xA, 0xB, 1),
506 SCRIPT_POSE(0xB, 7, 5),
508 SCRIPT_POSE(0xB, 1, 5),
509 SCRIPT_WAIT(0x1E),
510 SCRIPT_FOLLOW(0, 1),
511 SCRIPT_TALK(0, 0xB, 1, 0),
512 SCRIPT_POSE(1, 7, 1),
513 SCRIPT_COMMAND(0x327, 0x329, 0xC),
515 SCRIPT_POSE(1, 1, 1),
516 SCRIPT_COMMAND(0x327, 0x32A, 1),
517 SCRIPT_WAIT(0x1E),
518 SCRIPT_FOLLOW(0, 0xB),
519 SCRIPT_POSE(0xB, 1, 1),
520 SCRIPT_WAIT(0x1E),
521 SCRIPT_POSE(0xB, 0x39, 1),
522 SCRIPT_WAIT_ANIM(0xB),
523 SCRIPT_POSE(0xB, 1, 1),
524 SCRIPT_WAIT(0x1E),
525 SCRIPT_POSE(0xB, 1, 5),
526 SCRIPT_WAIT(0x1E),
527 SCRIPT_TALK(0, 0xC, 0xB, 1),
528 SCRIPT_POSE(0xB, 7, 5),
530 SCRIPT_POSE(0xB, 1, 5),
531 SCRIPT_WAIT(0x1E),
532 SCRIPT_POSE(1, 0x29, 1),
533 SCRIPT_WALK(0xB, 0x144, 0x13E, 5),
534 SCRIPT_WALK(0xC, 0x164, 0x14E, 5),
535 SCRIPT_COMMAND(0x323, 0x327, 1),
536 SCRIPT_WAIT_WALK(0xB),
537 SCRIPT_POSE(0xB, 1, 5),
538 SCRIPT_POSE(0xC, 1, 5),
539 SCRIPT_WAIT(0x1E),
540 SCRIPT_POSE(0xB, 1, 1),
541 SCRIPT_POSE(0xC, 1, 1),
542 SCRIPT_WAIT(0x1E),
543 SCRIPT_TALK(0, 0xD, 0xB, 0),
544 SCRIPT_POSE(0xB, 7, 1),
546 SCRIPT_POSE(1, 1, 1),
547 SCRIPT_POSE(0xB, 1, 1),
548 SCRIPT_COMMAND(0x323, 0x326, 1),
549 SCRIPT_WAIT(0x1E),
550 SCRIPT_COMMAND(0x323, 0x325, 1),
551 SCRIPT_WAIT(0x3C),
552 SCRIPT_WALK(1, 0x124, 0x12E, 5),
553 SCRIPT_POSE(0xB, 1, 5),
554 SCRIPT_POSE(0xC, 1, 5),
555 SCRIPT_COMMAND(0x323, 0x326, 1),
557 SCRIPT_POSE(1, 1, 5),
558 SCRIPT_WAIT(0x1E),
559 SCRIPT_TALK(0, 0xE, 0xD, 0),
560 SCRIPT_POSE(0xD, 7, 1),
562 SCRIPT_POSE(0xD, 1, 1),
563 SCRIPT_WAIT(0x1E),
564 SCRIPT_POSE(1, 0x29, 5),
565 SCRIPT_POSE(0xB, 9, 5),
566 SCRIPT_POSE(0xC, 9, 5),
567 SCRIPT_COMMAND(0x323, 0x327, 1),
568 SCRIPT_WAIT_ANIM(0xB),
569 SCRIPT_POSE(0xB, 1, 5),
570 SCRIPT_POSE(0xC, 1, 5),
571 SCRIPT_WAIT(0x3C),
572 SCRIPT_POSE(0xB, 1, 3),
573 SCRIPT_WAIT(0x1E),
574 SCRIPT_TALK(0, 0xF, 0xB, 0),
575 SCRIPT_POSE(0xB, 7, 3),
577 SCRIPT_POSE(1, 1, 5),
578 SCRIPT_POSE(0xB, 1, 3),
579 SCRIPT_COMMAND(0x323, 0x326, 1),
580 SCRIPT_WAIT(0x1E),
581 SCRIPT_POSE(1, 0x2E, 5),
583 SCRIPT_POSE(1, 1, 5),
584 SCRIPT_WAIT(0x1E),
585 SCRIPT_POSE(1, 9, 5),
587 SCRIPT_POSE(1, 1, 5),
588 SCRIPT_POSE(0xB, 1, 5),
589 SCRIPT_POSE(0xC, 1, 5),
590 SCRIPT_WAIT(0x1E),
591 SCRIPT_TALK(0, 0x10, 0xD, 0),
592 SCRIPT_POSE(0xD, 7, 1),
594 SCRIPT_POSE(1, 9, 5),
595 SCRIPT_POSE(0xB, 9, 5),
596 SCRIPT_POSE(0xC, 9, 5),
597 SCRIPT_POSE(0xD, 1, 1),
599 SCRIPT_POSE(1, 1, 5),
600 SCRIPT_POSE(0xB, 1, 5),
601 SCRIPT_POSE(0xC, 1, 5),
602 SCRIPT_POSE(0xD, 2, 1),
603 SCRIPT_COMMAND(0x343, 0x335, 1),
604 SCRIPT_WAIT(0x96),
605 SCRIPT_LEAVE(0x500, 0x64, 0x64, 0),
607};
609 SCRIPT_FOLLOW(1, 0xB),
610 SCRIPT_PLACE(1, 0x124, 0x12E),
611 SCRIPT_POSE(1, 1, 5),
612 SCRIPT_POSE(2, 1, 1),
613 SCRIPT_PLACE(0xB, 0x144, 0x13E),
614 SCRIPT_POSE(0xB, 1, 5),
615 SCRIPT_PLACE(0xC, 0x164, 0x14E),
616 SCRIPT_POSE(0xC, 1, 5),
617 SCRIPT_PLACE(0xD, 0x14A, 0x121),
618 SCRIPT_POSE(0xD, 1, 1),
619 SCRIPT_PLACE(0xE, 0x185, 0x126),
620 SCRIPT_POSE(0xE, 1, 7),
621 SCRIPT_PLACE(0xF, 0x136, 0xFC),
622 SCRIPT_POSE(0xF, 1, 2),
623 SCRIPT_WAIT(0x78),
624 SCRIPT_TALK(0, 1, 0xD, 0),
626 SCRIPT_POSE(1, 1, 7),
627 SCRIPT_POSE(0xB, 1, 3),
628 SCRIPT_POSE(0xC, 1, 3),
629 SCRIPT_WAIT(0x1E),
630 SCRIPT_TALK(0, 2, 1, 0),
631 SCRIPT_POSE(1, 7, 7),
633 SCRIPT_WAIT(0x1E),
634 SCRIPT_WALK(1, 0xB3, 0xF5, 1),
636 SCRIPT_POSE(1, 1, 1),
637 SCRIPT_POSE(0xB, 1, 3),
638 SCRIPT_POSE(0xC, 1, 3),
639 SCRIPT_WAIT(0x1E),
640 SCRIPT_TALK(1, 4, 0xC, 1),
641 SCRIPT_TALK(0, 3, 0xB, 2),
642 SCRIPT_WALK(1, 0x3D, 0x12F, 1),
643 SCRIPT_POSE(0xB, 7, 2),
644 SCRIPT_POSE(0xC, 7, 2),
646 SCRIPT_LEAVE(0x2D9, 0x64, 0x64, 0),
648};
650 { 0, 4 }, { 1, 4 }, { 2, 4 }, { 3, 4 },
651 { 4, 4 }, { 5, 4 }, { 6, 4 }, { 7, 4 },
652 { 8, 4 }, { 9, 4 }, { 10, 4 }, { 11, 4 },
653 { 12, 4 }, { 13, 4 }, { 255, 0x3E7 },
654};
656 { 0, 4 }, { 1, 4 }, { 2, 4 }, { 3, 4 },
657 { 4, 4 }, { 5, 4 }, { 6, 4 }, { 7, 4 },
658 { 8, 4 }, { 9, 4 }, { 10, 4 }, { 11, 4 },
659 { 255, 0 },
660};
662 { 0, 8 }, { 1, 8 }, { 2, 8 }, { 3, 8 },
663 { 4, 8 }, { 5, 8 }, { 255, 0 },
664};
666 { 0, 8 }, { 1, 8 }, { 2, 8 }, { 3, 8 },
667 { 4, 8 }, { 5, 8 }, { 255, 0 },
668};
670 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
671 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
672 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
673 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
674 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
675 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
676 { 0x180, 0x100, 0x19C, 0x11F, 0x170, 0x1F, 0x140, 0x1F1 },
677 { 0x180, 0x100, 0x1A4, 0x129, 0x190, 0x29, 0x160, 0x1F1 },
678 { 0x180, 0x100, 0x1AC, 0x129, 0x1B0, 0x29, 0x170, 0x1F1 },
679 { 0x140, 0x100, 0x176, 0x138, 0xD8, 0x38, 0x140, 0x1F0 },
680 { 0x180, 0x100, 0x1B6, 0x110, 0x1D8, 0x10, 0x160, 0x1F0 },
681 { 0x180, 0x100, 0x194, 0x11F, 0x150, 0x1F, 0x170, 0x1F0 },
682};
708 &actor0,
709 &actor1,
710 &actor2,
711 &actor3,
712 &actor4,
713 &actor5,
714 &actor6,
715 &actor7,
716 &actor8,
717 &actor9,
718 &actor10,
719 &actor11,
720 NULL,
721};
723 { 0, 1, 0x64, 2, 0x4A, 2, 0, 5, 8, 0, 299, 232, 0, 0 },
724 { 1, 0, 0x40, 2, 0x51, 2, 0, 0xB, 0xA, 0, 156, 254, 0, 0 },
725 { 1, 0, 0x40, 2, 0x51, 2, 0, 0xB, 0xA, 0, 236, 358, 0, 0 },
726 { 1, 0, 0x40, 2, 0x51, 2, 0, 0xB, 0xA, 0, 398, 358, 0, 0 },
727 { 1, 0, 0x64, 2, 0x4B, 2, 0, 5, 8, 0, 369, 246, 0, 0 },
728 { 0, 4, 0x64, 2, 0x46, 2, 0, 0xD, 4, 0, 299, 232, 0, 0 },
729 { 0, 3, 0x64, 2, 0x47, 2, 0, 0xB, 8, 0, 299, 232, 0, 0 },
730 { 0, 2, 0x64, 2, 0x48, 2, 0, 5, 8, 0, 299, 232, 0, 0 },
731 { 1, 0, 0x64, 2, 0x49, 2, 0, 5, 8, 0, 369, 246, 0, 0 },
732 { 1, 0, 0x40, 2, 0x50, 0, 0, 0, 0, 0, 156, 254, 0, 0 },
733 { 1, 0, 0x40, 2, 0x50, 0, 0, 0, 0, 0, 236, 358, 0, 0 },
734 { 1, 0, 0x40, 2, 0x50, 0, 0, 0, 0, 0, 398, 358, 0, 0 },
735 { 1, 0, 0x64, 2, 0x52, 2, 0, 3, 8, 0, 404, 239, 0, 0 },
736 { 1, 0, 0x40, 4, 0, 0, 0, 0, 0, 0, 402, 400, 408, 0 },
737 { 1, 0, 0x40, 4, 0xC, 0, 0, 0, 0, 0, 241, 400, 407, 0 },
738 { 1, 0, 0x40, 4, 0xD, 0, 0, 0, 0, 0, 160, 295, 303, 0 },
739 { 1, 0, 0x40, 4, 0xE, 0, 0, 0, 0, 0, 289, 244, 265, 0 },
740 { 1, 0, 0x40, 4, 0xF, 0, 0, 0, 0, 0, 289, 262, 292, 0 },
741 { 1, 0, 0x40, 4, 0x10, 0, 0, 0, 0, 0, 305, 272, 300, 0 },
742 { 1, 0, 0x40, 4, 0x11, 0, 0, 0, 0, 0, 321, 279, 308, 0 },
743 { 1, 0, 0x40, 4, 0x12, 0, 0, 0, 0, 0, 337, 286, 316, 0 },
744 { 1, 0, 0x40, 4, 0x13, 0, 0, 0, 0, 0, 353, 298, 324, 0 },
745 { 1, 0, 0x40, 4, 0x14, 0, 0, 0, 0, 0, 369, 289, 316, 0 },
746 { 1, 0, 0x40, 4, 0x15, 0, 0, 0, 0, 0, 385, 281, 308, 0 },
747 { 1, 0, 0x40, 4, 0x16, 0, 0, 0, 0, 0, 399, 273, 300, 0 },
748 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
749};
750void (*stageFuncs[])(void) = {
752};
754 { 1, script1, EVENT_TEXT(1), NULL, endEvent1 },
755 { 3, script3, EVENT_TEXT(2), NULL, NULL },
756 { -1, NULL, 0, NULL, NULL },
757};
#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
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
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 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 FIELD_TASK_ACTOR
every character (FIELDSTG_createActor)
Definition field_map.h:26
#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 SCRIPT_WAIT(frames)
Definition field_map.h:166
#define SCRIPT_WAIT_ANIM(id)
until its animation ends
Definition field_map.h:169
#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 CODES_END
Definition game_state.h:83
#define PROGRESS(n)
GAME.progress is n.
Definition game_state.h:69
TaskRegistry TASK_REGISTRY
Definition registry.c:122
#define MUSIC_ONLINE_CENTER
ON_CNBGM: MAGAMI's Online Center.
Definition sound.h:101
#define MUSIC_BANK(music)
The sound bank of a music, which a stage loads for it (FieldState.soundBank)
Definition sound.h:148
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...
@ STORY_START
a new game; WSTAG780's event 0, where Junior meets Ivy and Teddy at the Online Center in the real wor...
Definition story.h:23
@ STORY_ACCOUNT_REGISTERED
WSTAG785, event 1: the account is registered, and the clerk sends Junior to the Chamber Room.
Definition story.h:26
Where an actor's frames go in VRAM: one of the records after the FieldImage (Actor....
Definition field_map.h:114
Vec2 pos
Definition field_map.h:336
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
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
CVECTOR spriteColor
the field's sprites' color, unless cd is 0
Definition field_map.h:458
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
s32(* getFrameTime)(void)
Definition gfx.h:32
GfxFuncs funcs
Definition gfx.h:77
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(* setLayerId)()
(id, depth)
Definition gfx.h:244
void(* draw)()
(sheet, frame, x, y)
Definition gfx.h:246
void(* setTexture)()
(x, y)
Definition gfx.h:242
A sprite drawn over a character (FIELDSTG's actor found by its key)
Definition stage.h:602
void(* setState)(struct StageActorMark *task, s32 state)
Definition stage.h:603
Actor * actor
Definition stage.h:605
void(* nextState)(struct StageActorMark *task)
Definition stage.h:603
void(* nextSubstate)(struct StageActorMark *task)
Definition stage.h:603
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
The map objects with animations 4 to 1, animated.
Definition stage.h:593
AnimState anim2
animation 1's, looping
Definition stage.h:598
void(* setState)(struct StageTileSet *task, s32 state)
Definition stage.h:594
void(* setSubstate)(struct StageTileSet *task, s32 substate)
Definition stage.h:594
s32 state
Definition stage.h:594
s32 substate
Definition stage.h:594
AnimState anim
Definition stage.h:597
void(* nextState)(struct StageTileSet *task)
Definition stage.h:594
StageTile * tiles[4]
animations 4, 3, 2 and 1
Definition stage.h:596
void(* nextSubstate)(struct StageTileSet *task)
Definition stage.h:594
s32 done
start in TASK_DONE
Definition stage.h:595
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
void *(* find)(s32 id, s32 key1, s32 key2)
Definition task.h:18
TaskFuncs funcs
Definition task.h:76
Definition gfx.h:352
s32 y
Definition gfx.h:354
s32 x
Definition gfx.h:353
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
u16 actor1Conditions[]
Definition wstag785.c:684
FieldActorEntry actor0
Definition wstag785.c:695
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag785.c:750
FieldActorEntry actor6
Definition wstag785.c:701
u16 actor11Conditions[]
Definition wstag785.c:694
void handleCommand807(void *arg, s32 id, s32 key)
Map objects 0x328/0x329 set the kind and the character (actor of key KEY), 0x32A ends it.
Definition wstag785.c:225
void endEvent1(void)
After event 1, with Junior, Teddy, Account Clerk and Ivy: moves the story on to STORY_ACCOUNT_REGISTE...
Definition wstag785.c:275
#define MARKS
The file of the marks, which the versions number differently.
Definition wstag785.c:18
u16 actor10Conditions[]
Definition wstag785.c:693
void * createCommand807(s32 arg)
Command 807 of the event scripts: the mark over a character in event 1 (updateActorMark)
Definition wstag785.c:220
AnimFrame updateTileSetFrames2[]
Definition wstag785.c:655
FieldActorEntry actor5
Definition wstag785.c:700
FieldActorEntry actor2
Definition wstag785.c:697
const CVECTOR stageColor
the color the setup copies to FIELDSTG_state.spriteColor
Definition wstag785.c:279
void drawActorMark(StageActorMark *task, s32 frame)
Draws frame FRAME of file MARKS over the character.
Definition wstag785.c:123
u16 actor9Conditions[]
Definition wstag785.c:692
FieldActorEntry * stageActors[]
Definition wstag785.c:707
StageTileSet * createTileSet(void)
Creates the task of updateTileSet already done.
Definition wstag785.c:107
void * createCommand835(s32 arg)
Command 835 of the event scripts: the map objects of event 1, where the Account Clerk sets up the acc...
Definition wstag785.c:118
s16 script1[]
Definition wstag785.c:310
void updateActorMark(StageActorMark *task)
Shows the mark over the character: opens (0x32-0x34), stays by kind, closes (0x36-0x37)
Definition wstag785.c:136
#define STAGE_ARCHIVE
Definition wstag785.c:289
FieldActorEntry actor10
Definition wstag785.c:705
u16 actor4Conditions[]
Definition wstag785.c:687
FieldActorEntry actor4
Definition wstag785.c:699
u16 actor3Conditions[]
Definition wstag785.c:686
FieldActorEntry actor8
Definition wstag785.c:703
ActorImage stageImages[]
Definition wstag785.c:669
void setupStage(void)
Sets the stage up: its map, actors and events, playing ON_CNBGM.
Definition wstag785.c:292
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag785.c:722
FieldActorEntry actor9
Definition wstag785.c:704
u16 actor8Conditions[]
Definition wstag785.c:691
u16 actor5Conditions[]
Definition wstag785.c:688
s16 script3[]
Definition wstag785.c:608
u16 actor6Conditions[]
Definition wstag785.c:689
AnimFrame updateTileSetFrames1[]
Defined below, after the code that uses them.
Definition wstag785.c:649
FieldActorEntry actor7
Definition wstag785.c:702
FieldActorEntry actor11
Definition wstag785.c:706
FieldActorEntry actor1
Definition wstag785.c:696
#define STAGE_FILE
Definition wstag785.c:288
u16 actor7Conditions[]
Definition wstag785.c:690
void updateTileSet(StageTileSet *task)
Plays the animations of map objects 4/3 then 2 (with 1 looping); starts at 2 when done is set.
Definition wstag785.c:24
u16 actor2Conditions[]
Definition wstag785.c:685
AnimFrame updateTileSetFrames3[]
Definition wstag785.c:661
#define STAGE_TEXT
Definition wstag785.c:286
AnimFrame updateTileSetFrames0[]
Definition wstag785.c:665
FieldActorEntry actor3
Definition wstag785.c:698
FieldEvent stageEvents[]
Definition wstag785.c:753
u16 actor0Conditions[]
Definition wstag785.c:683