Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag795.c
Go to the documentation of this file.
1/*
2 * WSTAG795: Magasta B1F, Undersea Base. The terrorists' base in the Real
3 * World, where the 180 seconds run out and the player is digitized back.
4 */
5
6#include "common.h"
7#include "field/stage.h"
8#if VERSION_US || VERSION_JP
9#define TIMER_SHEET 0x6E6
10#elif VERSION_EU
11#define TIMER_SHEET 0x6F6
12#endif
13
14/* Defined below, after the code that uses them */
15extern s16 timerDigitX[];
20
22
23/* Shows the first map object animated while running; when done, both */
25 StageTile *tile;
26 StageTile *object;
27 s32 i;
28 s32 frame;
29
30 switch (task->state) {
31 case TASK_INIT:
32 default:
33 for (object = FIELDSTG_state.objects; object->margin != 0; object++) {
34 switch (object->anim) {
35 case 1:
36 task->anims[0].anim.index = 0;
37 task->anims[0].anim.timer = (u8)updateTilePairFrames[0]->duration;
38 task->anims[0].tile = object;
39 break;
40 case 2:
41 task->anims[1].anim.index = 0;
42 task->anims[1].anim.timer = (u8)updateTilePairFrames[2]->duration;
43 task->anims[1].tile = object;
44 break;
45 }
46 }
47 task->playing = 0;
48 if (task->done == 0) {
49 task->nextState(task);
50 } else {
51 task->anims[0].anim.index = 0;
52 task->anims[0].anim.timer = (u8)updateTilePairFrames_1[0].duration;
53 task->setState(task, TASK_DONE);
54 }
55 break;
56 case TASK_RUN:
57 for (i = 0; i < 2; i++) {
58 tile = task->anims[i].tile;
59 switch (i) {
60 case 0:
61 tile->visible = 1;
62 tile->frame = 0x46;
63 tile->clutRow = stepTileAnimation(&task->anims[0], updateTilePairFrames_0, 0, 0);
64 break;
65 case 1:
66 tile->visible = 0;
67 break;
68 }
69 }
70 break;
71 case TASK_DONE:
72 for (i = 0; i < 2; i++) {
73 tile = task->anims[i].tile;
74 switch (i) {
75 case 0:
76 tile->visible = 1;
77 if (task->playing) {
78 frame = stepTileAnimation(&task->anims[0], updateTilePairFrames_1, 1, 0);
79 if (frame == 0xFF) {
80 tile->frame = 0x50;
81 task->playing = 0;
82 } else {
83 tile->frame = frame;
84 }
85 } else {
86 tile->frame = 0x50;
87 }
88 tile->clutRow = 0;
89 break;
90 case 1:
91 tile->visible = 1;
92 tile->frame = 0x51;
93 tile->clutRow = stepTileAnimation(&task->anims[1], updateTilePairFrames_2, 0, 0);
94 break;
95 }
96 }
97 break;
98 case TASK_KILL:
99 break;
100 }
101}
102
103/* Plays the first map object's one-shot animation when the event of map object 0x35B happens */
105 if (task != NULL && id == 0x35B) {
106 task->playing = 1;
107 task->anims[0].anim.index = 0;
108 task->anims[0].anim.timer = (u8)updateTilePairFrames_1[0].duration;
109 task->setState(task, TASK_DONE);
110 }
111}
112
113/* Creates the control panel's map objects of event 840 (updateTilePair) with an id */
114void *createTilePair(s32 arg) {
115 return createTaskWithId(updateTilePair, sizeof(StageTilePair), 0, arg);
116}
117
118/* Creates the tile pair object, started in TASK_DONE */
121
122 task->done = 1;
123 return task;
124}
125
127
128/* The timer: counts GAME.countdown down while nothing stops it, then starts event 0x5E1 */
129void updateTimer(StageTask *task, void **children) {
130 u8 *countdown;
131
132 switch (task->state) {
133 case TASK_RUN:
136 break;
137 }
138 drawTimer(task);
139 countdown = GAME.countdown;
140 if (countdown[0] != 0 || countdown[1] != 0 || countdown[2] != 0) {
141 countdown[3] -= GFX.funcs.getFrameTime();
142 if (countdown[3] > 60) {
143 countdown[2]--;
144 countdown[3] += 60;
146 }
147 COUNTDOWN_BORROW(countdown);
148 break;
149 }
150 children[0] = FIELDSTG_startEvent(0x5E1);
151 /* fallthrough */
152 case TASK_INIT:
153 default:
154 task->nextState(task);
155 break;
156 case TASK_DONE:
157 case TASK_KILL:
158 break;
159 }
160}
161
163
164/* Creates the timer, one of two objects by flag 0x4063, and the event object of story progress 0x20 */
165void updateStage(StageTask *task, void **children) {
166 switch (task->state) {
167 case TASK_INIT:
168 default:
169 children[0] = createTimer();
170 if (FLAGS_00.checkCondition(FLAG(0x40, 0x63), 0)) {
171 children[1] = createTilePair(0x344);
172 } else {
173 children[1] = createTilePairDone();
174 }
175 task->nextState(task);
177 children[2] = FIELDSTG_startEvent(0x33E);
178 }
179 break;
180 case TASK_RUN:
181 case TASK_DONE:
182 case TASK_KILL:
183 break;
184 }
185}
186
187#define STAGE_CHILDREN_SIZE 0xC
189
190/* After event 830, with the player: keeps it from playing again */
194
195/*
196 * After event 840, with the player: lets event 850 of WSTAG800 start and
197 * keeps it from playing again
198 */
199void endEvent840(void) {
200 FLAGS_00.applyAction(FLAG(0x1C, 5), 1);
201 FLAGS_00.applyAction(FLAG(0x40, 0x63), 1);
202}
203
204#if VERSION_US || VERSION_JP
205#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
206#define EVENT_TEXT_FILE (TEXT_EVENTS_700 - 1)
207#define STAGE_FILE 0x6E6
208#define STAGE_FILE_8 0x711
209#elif VERSION_EU
210#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
211#define EVENT_TEXT_FILE (TEXT_EVENTS_700 - 1)
212#define STAGE_FILE 0x6F6
213#define STAGE_FILE_8 0x721
214#endif
215/* Sets the stage up: its map, actors, battles and events, playing BGM_0011 */
236
238 SCRIPT_PLACE(2, 0x45F, 0x37D),
239 SCRIPT_POSE(2, 1, 1),
240 SCRIPT_WAIT(0x78),
241 SCRIPT_COMMAND(0x323, 0x325, 2),
242 SCRIPT_WAIT(0x5A),
243 SCRIPT_COMMAND(0x323, 0x326, 2),
244 SCRIPT_WAIT(0x1E),
245 SCRIPT_POSE(2, 1, 7),
246 SCRIPT_WAIT(0x1E),
247 SCRIPT_POSE(2, 1, 1),
248 SCRIPT_WAIT(0x1E),
249 SCRIPT_POSE(2, 1, 7),
250 SCRIPT_WAIT(0x1E),
251 SCRIPT_POSE(2, 1, 1),
252 SCRIPT_WAIT(0x1E),
253 SCRIPT_TALK(0, 1, 2, 2),
254 SCRIPT_POSE(2, 7, 1),
256 SCRIPT_POSE(2, 1, 1),
257 SCRIPT_WAIT(0x1E),
259 /* after the end, the original's padding up to a word, which isn't zeros */
260#if VERSION_US
261 0x31A8,
262#elif VERSION_JP
263 0x240,
264#endif
265};
267 SCRIPT_WALK(2, 0x1C1, 0x387, 5),
270 SCRIPT_WAIT(0x1E),
271 SCRIPT_COMMAND(0x323, 0x325, 2),
272 SCRIPT_WAIT(0x5A),
273 SCRIPT_COMMAND(0x323, 0x326, 2),
274 SCRIPT_WAIT(0x1E),
275 SCRIPT_TALK(0, 1, 2, 0),
276 SCRIPT_POSE(2, 7, 5),
278 SCRIPT_POSE(2, 1, 5),
279 SCRIPT_WAIT(0x1E),
281 SCRIPT_WAIT(0x1E),
282 SCRIPT_COMMAND(0x344, 0x35B, 2),
283 SCRIPT_WAIT(0x78),
284 SCRIPT_POSE(2, 1, 5),
285 SCRIPT_WAIT(0x3C),
286 SCRIPT_POSE(2, 1, 1),
288 SCRIPT_WAIT(0x1E),
289 SCRIPT_POSE(2, 1, 7),
290 SCRIPT_WAIT(0x1E),
291 SCRIPT_POSE(2, 1, 1),
292 SCRIPT_WAIT(0x1E),
293 SCRIPT_POSE(2, 1, 7),
294 SCRIPT_WAIT(0x1E),
295 SCRIPT_POSE(2, 1, 1),
296 SCRIPT_WAIT(0x1E),
297 SCRIPT_TALK(0, 2, 2, 0),
298 SCRIPT_POSE(2, 7, 1),
300 SCRIPT_POSE(2, 1, 1),
301 SCRIPT_WAIT(0x1E),
302 SCRIPT_WALK(2, 0x1A0, 0x379, 3),
304 SCRIPT_POSE(2, 1, 3),
305 SCRIPT_WAIT(0x1E),
306 SCRIPT_POSE(2, 1, 1),
307 SCRIPT_WAIT(0x1E),
309 /* after the end, the original's padding up to a word, which isn't zeros */
310#if VERSION_US
311 0x31A8,
312#endif
313};
315 SCRIPT_WAIT(0x1E),
316 SCRIPT_COMMAND(0x323, 0x325, 2),
317 SCRIPT_WAIT(0x5A),
318 SCRIPT_COMMAND(0x323, 0x326, 2),
319 SCRIPT_WAIT(0x1E),
320 SCRIPT_POSE(2, 1, 0),
321 SCRIPT_WAIT(0x1E),
322 SCRIPT_TALK(0, 1, 2, 2),
323 SCRIPT_POSE(2, 7, 0),
325 SCRIPT_POSE(2, 1, 0),
326 SCRIPT_WAIT(0x1E),
327 SCRIPT_LEAVE(0x26D, 1, 1, 1),
329};
331 { 0, 8 }, { 1, 8 }, { 255, 0 },
332};
334 { 71, 4 }, { 72, 4 }, { 73, 4 }, { 74, 4 },
335 { 75, 4 }, { 76, 4 }, { 77, 4 }, { 78, 4 },
336 { 79, 4 }, { 80, 4 }, { 255, 0 },
337};
339 { 0, 6 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
340 { 4, 6 }, { 5, 6 }, { 255, 0 },
341};
346 226, 253, 0x118, 0,
347};
361AreaBattle area1Battle0 = { 0, 0, MUSIC(1, 0) };
362AreaBattle area1Battle1 = { 0, 0, MUSIC(1, 0) };
363AreaBattle area1Battle2 = { 0, 0, MUSIC(1, 0) };
364AreaBattle area1Battle3 = { 0, 0, MUSIC(1, 0) };
365AreaBattle area1Battle4 = { 0, 0, MUSIC(1, 0) };
366AreaBattle area1Battle5 = { 0, 0, MUSIC(1, 0) };
367AreaBattle area1Battle6 = { 0, 0, MUSIC(1, 0) };
368AreaBattle area1Battle7 = { 0, 0, MUSIC(1, 0) };
374AreaBattle area2Battle0 = { 0, 0, MUSIC(1, 0) };
375AreaBattle area2Battle1 = { 0, 0, MUSIC(1, 0) };
376AreaBattle area2Battle2 = { 0, 0, MUSIC(1, 0) };
377AreaBattle area2Battle3 = { 0, 0, MUSIC(1, 0) };
378AreaBattle area2Battle4 = { 0, 0, MUSIC(1, 0) };
379AreaBattle area2Battle5 = { 0, 0, MUSIC(1, 0) };
380AreaBattle area2Battle6 = { 0, 0, MUSIC(1, 0) };
381AreaBattle area2Battle7 = { 0, 0, MUSIC(1, 0) };
387AreaBattle area3Battle0 = { 0, 0, MUSIC(1, 0) };
388AreaBattle area3Battle1 = { 0, 0, MUSIC(1, 0) };
389AreaBattle area3Battle2 = { 0, 0, MUSIC(1, 0) };
390AreaBattle area3Battle3 = { 0, 0, MUSIC(1, 0) };
391AreaBattle area3Battle4 = { 0, 0, MUSIC(1, 0) };
392AreaBattle area3Battle5 = { 0, 0, MUSIC(1, 0) };
393AreaBattle area3Battle6 = { 0, 0, MUSIC(1, 0) };
394AreaBattle area3Battle7 = { 0, 0, MUSIC(1, 0) };
404 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
405 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
406 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
407 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
408 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
409 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
410 { 0x140, 0x100, 0x14C, 0x19A, 0x30, 0x9A, 0x140, 0x1F9 },
411 { 0x140, 0x100, 0x140, 0x1A2, 0, 0xA2, 0x150, 0x1F9 },
412 { 0x140, 0x100, 0x152, 0x1B9, 0x48, 0xB9, 0x160, 0x1F9 },
413 { 0x140, 0x100, 0x158, 0x1B9, 0x60, 0xB9, 0x170, 0x1F9 },
414 { 0x140, 0x100, 0x15E, 0x1B9, 0x78, 0xB9, 0x140, 0x1F8 },
415 { 0x140, 0x100, 0x164, 0x1B9, 0x90, 0xB9, 0x150, 0x1F8 },
416 { 0x140, 0x100, 0x146, 0x1BA, 0x18, 0xBA, 0x160, 0x1F8 },
417 { 0x140, 0x100, 0x14C, 0x1BA, 0x30, 0xBA, 0x170, 0x1F8 },
418 { 0x140, 0x100, 0x16A, 0x1C0, 0xA8, 0xC0, 0x140, 0x1F7 },
419 { 0x140, 0x100, 0x170, 0x1C0, 0xC0, 0xC0, 0x150, 0x1F7 },
420 { 0x140, 0x100, 0x176, 0x1C0, 0xD8, 0xC0, 0x160, 0x1F7 },
421 { 0x140, 0x100, 0x140, 0x1C2, 0, 0xC2, 0x170, 0x1F7 },
422};
440 { NULL, actor0Talk0Actions, 0x201 },
441 { NULL, NULL, 0 },
442};
444 { NULL, actor1Talk0Actions, 0x191 },
445 { NULL, NULL, 0 },
446};
448 { NULL, actor2Talk0Actions, 0x17E },
449 { NULL, NULL, 0 },
450};
452 { NULL, actor3Talk0Actions, 0x191 },
453 { NULL, NULL, 0 },
454};
456 { NULL, actor4Talk0Actions, 0x191 },
457 { NULL, NULL, 0 },
458};
460 { NULL, actor5Talk0Actions, 0x1F2 },
461 { NULL, NULL, 0 },
462};
464 { NULL, actor6Talk0Actions, 0x1FF },
465 { NULL, NULL, 0 },
466};
468 { NULL, actor7Talk0Actions, 0x191 },
469 { NULL, NULL, 0 },
470};
472 { NULL, actor8Talk0Actions, 0x17D },
473 { NULL, NULL, 0 },
474};
476 { NULL, actor9Talk0Actions, 0x1E9 },
477 { NULL, NULL, 0 },
478};
480 { NULL, actor10Talk0Actions, 0x1F1 },
481 { NULL, NULL, 0 },
482};
484 { NULL, actor11Talk0Actions, 0x18F },
485 { NULL, NULL, 0 },
486};
488u16 actor1Conditions[] = { FLAG(2, 0x3A), 0, CODES_END };
490u16 actor3Conditions[] = { FLAG(2, 0x3C), 0, CODES_END };
491u16 actor4Conditions[] = { FLAG(2, 0x3D), 0, CODES_END };
494u16 actor7Conditions[] = { FLAG(2, 0x40), 0, CODES_END };
505FieldActorEntry actor6 = { actor6Conditions, actor6Talks, 0x52, 0xA, 784, 366, 1 };
506FieldActorEntry actor7 = { actor7Conditions, actor7Talks, 0x53, 0xB, 432, 478, 1 };
507FieldActorEntry actor8 = { actor8Conditions, actor8Talks, 0x54, 0xC, 672, 1047, 1 };
508FieldActorEntry actor9 = { actor9Conditions, actor9Talks, 0x55, 0xD, 335, 527, 1 };
512 &actor0,
513 &actor1,
514 &actor2,
515 &actor3,
516 &actor4,
517 &actor5,
518 &actor6,
519 &actor7,
520 &actor8,
521 &actor9,
522 &actor10,
523 &actor11,
524 NULL,
525};
527 { 1, 0, 0x40, 2, 0x38, 2, 0, 5, 4, 0, 153, 151, 0, 0 },
528 { 1, 0, 0x40, 2, 0x38, 2, 0, 5, 4, 0, 166, 158, 0, 0 },
529 { 1, 0, 0x40, 2, 0x38, 2, 0, 5, 4, 0, 185, 167, 0, 0 },
530 { 1, 0, 0x40, 2, 0x38, 2, 0, 5, 4, 0, 198, 174, 0, 0 },
531 { 1, 0, 0x40, 2, 0x38, 2, 0, 5, 4, 0, 217, 183, 0, 0 },
532 { 1, 0, 0x40, 2, 0x38, 2, 0, 5, 4, 0, 230, 190, 0, 0 },
533 { 1, 0, 0x40, 2, 0x38, 2, 0, 5, 4, 0, 249, 200, 0, 0 },
534 { 1, 0, 0x40, 2, 0x38, 2, 0, 5, 4, 0, 262, 206, 0, 0 },
535 { 1, 2, 0x64, 6, 0x51, 0, 0, 0, 0, 0, 414, 834, 0, 0 },
536 { 1, 1, 0x64, 6, 0x46, 0, 0, 0, 0, 0, 414, 834, 0, 0 },
537 { 1, 0, 0x40, 6, 0x37, 2, 0, 5, 6, 0, 1117, 845, 0, 0 },
538 { 1, 0, 0x40, 6, 0x32, 1, 0x32, 0x36, 6, 0, 1121, 849, 0, 0 },
539 { 1, 0, 0x40, 6, 0x38, 2, 0, 5, 4, 0, 226, 115, 0, 0 },
540 { 1, 0, 0x40, 6, 0x38, 2, 0, 5, 4, 0, 239, 122, 0, 0 },
541 { 1, 0, 0x40, 6, 0x38, 2, 0, 5, 4, 0, 258, 131, 0, 0 },
542 { 1, 0, 0x40, 6, 0x38, 2, 0, 5, 4, 0, 271, 137, 0, 0 },
543 { 1, 0, 0x40, 6, 0x38, 2, 0, 5, 4, 0, 289, 147, 0, 0 },
544 { 1, 0, 0x40, 6, 0x38, 2, 0, 5, 4, 0, 303, 154, 0, 0 },
545 { 1, 0, 0x40, 6, 0x38, 2, 0, 5, 4, 0, 322, 163, 0, 0 },
546 { 1, 0, 0x40, 6, 0x38, 2, 0, 5, 4, 0, 335, 170, 0, 0 },
547 { 1, 0x64, 0x7A, 6, 0, 0, 0, 0, 0, 0, 142, 67, 0, 0 },
548 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
549};
551 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x2DB, 0x208, 0xCC, 7, 0, 0, 0 },
552 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x2DB, 0x168, 0x11C, 7, 0, 0, 0 },
553 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x2DB, 0x128, 0x19C, 7, 0, 0, 0 },
554 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x2DB, 0x128, 0x35C, 7, 0, 0, 0 },
555 { { { FLAG(0x1C, 0xA), 1 }, { CODES_END, 0 } }, SLOT_EXIT, 0x2DC, 0x2B4, 0x198, 3, 0x64, 0, 0 },
556 { { { PROGRESS(STORY_REAL_WORLD), 1 }, { FLAG(0x40, 0x63), 0 } }, SLOT_EVENT, 0x348, 0, 0, 0, 0, 0, 0 },
557 { { { CODES_END, 0 }, { CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
558};
559void (*stageFuncs[])(void) = {
561};
563 { 830, script830, EVENT_TEXT(0x1A), NULL, endEvent830 },
564 { 840, script840, EVENT_TEXT(0x1B), NULL, endEvent840 },
565 { 1505, script1505, EVENT_TEXT(0x25), NULL, NULL },
566 { -1, NULL, 0, NULL, NULL },
567};
#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
void * createTimer(void)
Creates the updateTimer task.
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
void drawTimer(StageTask *task)
Draws the timer: its frame and the three digits of GAME.countdown, from the sprites of the stage's TI...
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 COUNTDOWN_BORROW(c)
Carries the borrow down the digits of GAME.countdown, the timer of the timed stages: a units digit th...
Definition stage.h:36
#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 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 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 FIELD_COMMAND_PLAY_SWITCH03
Definition field_map.h:67
#define SCRIPT_WAIT_BOX
until box 0 closes
Definition field_map.h:167
#define SLOT_EXIT
The kinds of StageSlot (type).
Definition field_map.h:255
#define FIELD_MAP_AREAS
a cell's value: its battle area (FieldBattles), or 0
Definition field_map.h:87
#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_COMMAND_PLAY_COMCD103
Definition field_map.h:74
#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
#define FLAG(group, id)
The codes of the (code, value) pairs that FLAGS_00 checks as conditions and applies as actions (event...
Definition game_state.h:68
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
Definition sound.c:180
#define SOUND_COUNT
SYSTEM10: a number counts up or down.
Definition sound.h:45
#define MUSIC_BATTLE
BATL0000: the maps' random battles (AreaBattle, nearly all of them)
Definition sound.h:76
#define MUSIC_MAGASTA
BGM_0011: the Undersea Base (Magasta), and the Deeper Crevice's gondola.
Definition sound.h:87
#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
FIELDSTG's start of the stage (StageEntry.init in FIELDSTG_stages): the stage's task,...
s32 stepTileAnimation(StageTileAnim *obj, AnimFrame *frames, s32 once, s32 depth)
Steps OBJ's animation through FRAMES by the frame time (at most 4) and returns its frame: at the end ...
#define FLAG_MAGASTA_B1F_VENOM_FANG_FOUND
wstag795: chest that gives the Venom Fang, "I got" text; its conditions test it 0
Definition story.h:366
#define FLAG_MAGASTA_B1F_TRIHORN_FOUND
wstag795: chest that gives the Trihorn, "I got" text; its conditions test it 0
Definition story.h:347
@ STORY_REAL_WORLD
WSTAG750 (the emergency Matrix Chamber), event 820: back in the real world, for 180 seconds.
Definition story.h:121
#define FLAG_MAGASTA_B1F_POWER_CHARGE_FOUND
wstag795: chest that gives the Power Charge, "I got" text; its conditions test it 0
Definition story.h:350
#define FLAG_MAGASTA_B1F_HIGH_SECURITY_FOUND
wstag795: chest that gives the High Security, "I got" text; its conditions test it 0
Definition story.h:369
#define FLAG_MAGASTA_B1F_GREY_SWORD_FOUND
wstag795: chest that gives the Grey Sword, "I got" text; its conditions test it 0
Definition story.h:353
#define FLAG_MAGASTA_B1F_TENJINMARU_FOUND
wstag795: chest that gives the Tenjinmaru, "I got" text; its conditions test it 0 (the US text says 3...
Definition story.h:363
#define FLAG_MAGASTA_B1F_SUPER_CHARGE_FOUND
wstag795: chest that gives the Super Charge, "I got" text; its conditions test it 0
Definition story.h:359
#define FLAG_MAGASTA_BUTTON_PRESSED
wstag795 event 830: the player pushes a button on a control panel in Magasta B1F; set at its end,...
Definition story.h:1430
#define FLAG_MAGASTA_B1F_ROYAL_SPEAR_FOUND
wstag795: chest that gives the Royal Spear, "I got" text; its conditions test it 0
Definition story.h:356
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 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 frozen
no control, triggers or encounters for the player: while the area name banner shows (FIELDSTG_createB...
Definition field_map.h:466
s32 sheetEntry
the stage's sprite sheet, loaded before the field starts, or 0
Definition field_map.h:445
s32 busy
an event, a warp, a launch or a battle has the player
Definition field_map.h:468
s32 battleStarting
an encounter started (FIELDSTG_startEncounter)
Definition field_map.h:469
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
s32 menuOpen
the field menu (START) or the inn (FIELDSTG_openInn) is open: the pad doesn't move the player
Definition field_map.h:464
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 acting
the player talks, climbs, slides or searches
Definition field_map.h:470
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(* checkCondition)(u16 code, u16 value)
Definition game_state.h:53
u8 countdown[4]
Definition game_state.h:572
s32(* getFrameTime)(void)
Definition gfx.h:32
GfxFuncs funcs
Definition gfx.h:77
short(* playSound)(s32 id)
returns the voice of a key-on
Definition sound.h:187
What the player can trigger on a map (FIELDSTG_updateTriggers): a record of the table at FieldState....
Definition field_map.h:276
The task a stage starts (startStage), updated by its updateStage.
Definition stage.h:26
void(* nextState)(struct StageTask *task)
Definition stage.h:27
s32 state
Definition stage.h:27
StageTile * tile
Definition stage.h:109
AnimState anim
Definition stage.h:110
Animates the map objects with animations 1 and 2: the first alone while running, both when done.
Definition stage.h:190
StageTileAnim anims[2]
Definition stage.h:194
s32 done
start in TASK_DONE
Definition stage.h:193
s32 playing
the second animation of the first map object
Definition stage.h:192
void(* nextState)(struct StageTilePair *task)
Definition stage.h:191
void(* setState)(struct StageTilePair *task, s32 state)
Definition stage.h:191
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
u16 actor1Conditions[]
Definition wstag795.c:488
u16 actor0Talk0Actions[]
Definition wstag795.c:423
AreaBattle area2Battle7
Definition wstag795.c:381
u16 actor6Talk0Actions[]
Definition wstag795.c:429
FieldActorEntry actor0
Definition wstag795.c:499
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag795.c:559
FieldActorEntry actor6
Definition wstag795.c:505
AnimFrame * updateTilePairFrames[]
Definition wstag795.c:342
u16 actor11Conditions[]
Definition wstag795.c:498
FieldTalk actor2Talks[]
Definition wstag795.c:447
AreaBattle area2Battle6
Definition wstag795.c:380
u16 actor10Conditions[]
Definition wstag795.c:497
void updateTilePair(StageTilePair *task)
Shows the first map object animated while running; when done, both.
Definition wstag795.c:24
void * createTilePairDone(void)
Creates the tile pair object, started in TASK_DONE.
Definition wstag795.c:119
FieldTalk actor5Talks[]
Definition wstag795.c:459
AreaBattle area1Battle6
Definition wstag795.c:367
FieldActorEntry actor5
Definition wstag795.c:504
AreaBattle area0Battle7
Definition wstag795.c:355
FieldActorEntry actor2
Definition wstag795.c:501
#define STAGE_FILE_8
Definition wstag795.c:213
AreaBattle area3Battle4
Definition wstag795.c:391
AreaBattle area3Battle3
Definition wstag795.c:390
AreaBattle area0Battle1
Definition wstag795.c:349
AreaBattle area2Battle0
Definition wstag795.c:374
u16 actor9Conditions[]
Definition wstag795.c:496
FieldActorEntry * stageActors[]
Definition wstag795.c:511
u16 actor7Talk0Actions[]
Definition wstag795.c:430
AreaBattle area1Battle2
Definition wstag795.c:363
AreaBattle area3Battle0
Definition wstag795.c:387
s16 script830[]
Definition wstag795.c:237
AreaBattle area0Battle6
Definition wstag795.c:354
FieldTalk actor1Talks[]
Definition wstag795.c:443
AreaBattle area3Battle2
Definition wstag795.c:389
AnimFrame updateTilePairFrames_2[]
Definition wstag795.c:338
FieldTalk actor0Talks[]
Definition wstag795.c:439
AreaBattle area3Battle1
Definition wstag795.c:388
AreaBattle area0Battle3
Definition wstag795.c:351
void endEvent830(void)
After event 830, with the player: keeps it from playing again.
Definition wstag795.c:191
FieldActorEntry actor10
Definition wstag795.c:509
u16 actor2Talk0Actions[]
Definition wstag795.c:425
FieldTalk actor4Talks[]
Definition wstag795.c:455
u16 actor4Conditions[]
Definition wstag795.c:491
FieldActorEntry actor4
Definition wstag795.c:503
u16 actor3Conditions[]
Definition wstag795.c:490
AreaBattle area3Battle6
Definition wstag795.c:393
FieldTalk actor11Talks[]
Definition wstag795.c:483
FieldActorEntry actor8
Definition wstag795.c:507
ActorImage stageImages[]
Definition wstag795.c:403
s16 script1505[]
Definition wstag795.c:314
FieldTalk actor6Talks[]
Definition wstag795.c:463
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing BGM_0011.
Definition wstag795.c:216
AreaBattle area2Battle4
Definition wstag795.c:378
u16 actor10Talk0Actions[]
Definition wstag795.c:433
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag795.c:526
FieldActorEntry actor9
Definition wstag795.c:508
u16 actor8Conditions[]
Definition wstag795.c:495
u16 actor5Conditions[]
Definition wstag795.c:492
FieldTalk actor10Talks[]
Definition wstag795.c:479
FieldTalk actor3Talks[]
Definition wstag795.c:451
FieldTalk actor9Talks[]
Definition wstag795.c:475
BattleList area3Battles
Definition wstag795.c:395
void handleCommand836(StageTilePair *task, s32 id)
Plays the first map object's one-shot animation when the event of map object 0x35B happens.
Definition wstag795.c:104
AreaBattle area3Battle5
Definition wstag795.c:392
AreaBattle area0Battle5
Definition wstag795.c:353
BattleList area1Battles
Definition wstag795.c:369
void updateTimer(StageTask *task, void **children)
The timer: counts GAME.countdown down while nothing stops it, then starts event 0x5E1.
Definition wstag795.c:129
u16 actor5Talk0Actions[]
Definition wstag795.c:428
BattleList area2Battles
Definition wstag795.c:382
s16 timerDigitX[]
Defined below, after the code that uses them.
Definition wstag795.c:345
AreaBattle area1Battle4
Definition wstag795.c:365
u16 actor6Conditions[]
Definition wstag795.c:493
AreaBattle area2Battle2
Definition wstag795.c:376
AreaBattle area1Battle5
Definition wstag795.c:366
FieldActorEntry actor7
Definition wstag795.c:506
StageSlot stageSlots[]
Definition wstag795.c:550
void endEvent840(void)
After event 840, with the player: lets event 850 of WSTAG800 start and keeps it from playing again.
Definition wstag795.c:199
AreaBattle area2Battle1
Definition wstag795.c:375
u16 actor1Talk0Actions[]
Definition wstag795.c:424
AnimFrame updateTilePairFrames_1[]
Definition wstag795.c:333
u16 actor8Talk0Actions[]
Definition wstag795.c:431
AreaBattle area1Battle3
Definition wstag795.c:364
AreaBattle area1Battle0
Definition wstag795.c:361
AnimFrame updateTilePairFrames_0[]
Definition wstag795.c:330
FieldActorEntry actor11
Definition wstag795.c:510
FieldActorEntry actor1
Definition wstag795.c:500
AreaBattle area0Battle0
Definition wstag795.c:348
u16 actor9Talk0Actions[]
Definition wstag795.c:432
AreaBattle area0Battle2
Definition wstag795.c:350
#define STAGE_FILE
Definition wstag795.c:212
AreaBattle area2Battle5
Definition wstag795.c:379
u16 actor4Talk0Actions[]
Definition wstag795.c:427
AreaBattle area1Battle1
Definition wstag795.c:362
u16 actor11Talk0Actions[]
Definition wstag795.c:434
u16 actor7Conditions[]
Definition wstag795.c:494
AreaBattle area2Battle3
Definition wstag795.c:377
u16 actor2Conditions[]
Definition wstag795.c:489
FieldTalk actor7Talks[]
Definition wstag795.c:467
void * createTilePair(s32 arg)
Creates the control panel's map objects of event 840 (updateTilePair) with an id.
Definition wstag795.c:114
AreaBattle area0Battle4
Definition wstag795.c:352
#define STAGE_TEXT
Definition wstag795.c:210
u16 actor3Talk0Actions[]
Definition wstag795.c:426
FieldTalk actor8Talks[]
Definition wstag795.c:471
AreaBattle area3Battle7
Definition wstag795.c:394
BattleList area0Battles
Definition wstag795.c:356
AreaBattle area1Battle7
Definition wstag795.c:368
FieldActorEntry actor3
Definition wstag795.c:502
FieldBattles stageBattles[]
Definition wstag795.c:400
s16 script840[]
Definition wstag795.c:266
FieldEvent stageEvents[]
Definition wstag795.c:562
u16 actor0Conditions[]
Definition wstag795.c:487