Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag927.c
Go to the documentation of this file.
1/*
2 * WSTAG927: Digimon Arena, Amaterasu City, in the extra chapter. The European
3 * version's: in its extra chapter (STORY_EXTRA), mode 632 starts it instead of
4 * WSTAG233.
5 */
6
7#include "common.h"
8#include "field/stage.h"
9/* Defined below, after the code that uses them */
12
14
16
18
19/* Creates an object and the event object of flag 0x100C */
20void updateStage(StageTask *task, void **children) {
21 switch (task->state) {
22 case TASK_INIT:
23 default:
24 children[0] = createTileAnims();
26 children[1] = FIELDSTG_startEvent(0x648);
27 }
29 children[1] = FIELDSTG_startEvent(0x64A);
30 }
31 task->nextState(task);
32 break;
33 case TASK_RUN:
34 case TASK_DONE:
35 case TASK_KILL:
36 break;
37 }
38}
39
40#define STAGE_CHILDREN_SIZE 0x8
42
43/* After event 1608, with Kurt: starts the stage's event battle 0 and keeps it from playing again */
48
49#if VERSION_EU
50#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_08)
51#define STAGE_FILE 0x8ED
52#define STAGE_FILE_8 0x346
53#elif VERSION_JP
54#define STAGE_TEXT 0x89A
55#define STAGE_FILE 0x8AA
56#define STAGE_FILE_8 0x337
57#endif
58/* Sets the stage up: its map, actors, battles and events, playing KANRIBGM */
76
77/* Defined below, after the tables that use them */
78extern s16 script1608[];
79extern s16 script1610[];
80
82 { 50, 18 }, { 44, 6 }, { 50, 60 }, { 44, 6 },
83 { 45, 6 }, { 46, 6 }, { 44, 6 }, { 51, 78 },
84 { 44, 6 }, { 45, 6 }, { 46, 6 }, { 44, 6 },
85 { 52, 60 }, { 44, 6 }, { 52, 18 }, { 44, 6 },
86 { 45, 6 }, { 46, 6 }, { 44, 6 }, { 255, 0 },
87};
89 { 56, 60 }, { 47, 6 }, { 56, 18 }, { 47, 6 },
90 { 48, 6 }, { 49, 6 }, { 47, 6 }, { 57, 78 },
91 { 47, 6 }, { 48, 6 }, { 49, 6 }, { 47, 6 },
92 { 58, 18 }, { 47, 6 }, { 58, 60 }, { 47, 6 },
93 { 48, 6 }, { 49, 6 }, { 47, 6 }, { 255, 0 },
94};
96 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
97 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
98 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
99 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
100 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
101 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
102 { 0x140, 0x100, 0x178, 0x1B8, 0xE0, 0xB8, 0x170, 0x1F4 },
103};
104FieldActorEntry actor0 = { NULL, NULL, 0x68, 4, 0, 0, 1 };
106 &actor0,
107 NULL,
108};
110 { 1, 0, 0x40, 2, 0x41, 2, 0, 5, 8, 0, 350, 180, 0, 0 },
111 { 1, 0, 0x40, 2, 0x45, 2, 0, 5, 8, 0, 314, 180, 0, 0 },
112 { 1, 2, 0x58, 2, 0x38, 0, 0, 0, 0, 0, 229, 79, 0, 0 },
113 { 1, 1, 0x58, 2, 0x32, 0, 0, 0, 0, 0, 395, 79, 0, 0 },
114 { 1, 0, 0x40, 2, 0x3E, 1, 0x3E, 0x40, 8, 0, 354, 185, 0, 0 },
115 { 1, 0, 0x40, 2, 0x42, 1, 0x42, 0x44, 8, 0, 318, 185, 0, 0 },
116 { 1, 0, 0x40, 2, 0x46, 2, 0, 3, 4, 0, 206, 186, 0, 0 },
117 { 1, 0, 0x40, 2, 0x46, 2, 0, 3, 4, 0, 370, 138, 0, 0 },
118 { 1, 0, 0x40, 2, 0x47, 2, 0, 3, 4, 0, 238, 170, 0, 0 },
119 { 1, 0, 0x40, 2, 0x47, 2, 0, 3, 4, 0, 402, 154, 0, 0 },
120 { 1, 0, 0x40, 2, 0x48, 2, 0, 3, 4, 0, 270, 154, 0, 0 },
121 { 1, 0, 0x40, 2, 0x48, 2, 0, 3, 4, 0, 434, 170, 0, 0 },
122 { 1, 0, 0x40, 2, 0x49, 2, 0, 3, 4, 0, 302, 138, 0, 0 },
123 { 1, 0, 0x40, 2, 0x49, 2, 0, 3, 4, 0, 466, 186, 0, 0 },
124 { 1, 0, 0x40, 6, 0x36, 2, 0, 5, 6, 0, 387, 77, 0, 0 },
125 { 1, 0, 0x40, 6, 0x37, 2, 0, 5, 6, 0, 395, 79, 0, 0 },
126 { 1, 0, 0x40, 6, 0x3C, 2, 0, 5, 6, 0, 229, 77, 0, 0 },
127 { 1, 0, 0x40, 6, 0x3D, 2, 0, 5, 6, 0, 229, 79, 0, 0 },
128 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
129};
130void (*stageFuncs[])(void) = {
132};
133#define EVENT_TEXT_FILE EXTRA_TEXT
135 { 1608, script1608, EVENT_TEXT(4), NULL, endEvent1608 },
136 { 1610, script1610, EVENT_TEXT(5), NULL, NULL },
137 { -1, NULL, 0, NULL, NULL },
138};
140 SCRIPT_FOLLOW(0, 2),
141 SCRIPT_PLACE(2, 0xC0, 0x158),
142 SCRIPT_POSE(2, 1, 5),
143 SCRIPT_PLACE(0x68, 0x180, 0xF8),
144 SCRIPT_POSE(0x68, 1, 1),
145 SCRIPT_WAIT(0x78),
146 SCRIPT_COMMAND(0x323, 0x325, 2),
147 SCRIPT_WAIT(0x3C),
148 SCRIPT_COMMAND(0x323, 0x326, 2),
149 SCRIPT_WAIT(0x1E),
150 SCRIPT_POSE(2, 1, 7),
151 SCRIPT_WAIT(0x1E),
152 SCRIPT_POSE(2, 1, 3),
153 SCRIPT_WAIT(0x1E),
154 SCRIPT_POSE(2, 1, 5),
155 SCRIPT_WAIT(0x1E),
156 SCRIPT_TALK(0, 1, 2, 1),
158 SCRIPT_WALK(2, 0x140, 0x118, 5),
160 SCRIPT_POSE(2, 1, 5),
161 SCRIPT_COMMAND(0x323, 0x325, 2),
162 SCRIPT_WAIT(0x3C),
163 SCRIPT_COMMAND(0x323, 0x326, 2),
164 SCRIPT_WAIT(0x1E),
165 SCRIPT_TALK(0, 2, 0x68, 0),
167 SCRIPT_WAIT(0x1E),
168 SCRIPT_TALK(0, 3, 2, 1),
170 SCRIPT_WAIT(0x1E),
171 SCRIPT_TALK(0, 4, 0x68, 0),
173 SCRIPT_WAIT(0x1E),
174 SCRIPT_TALK(0, 5, 2, 1),
176 SCRIPT_WAIT(0x1E),
177 SCRIPT_TALK(0, 6, 0x68, 0),
179 SCRIPT_WAIT(0x1E),
181};
183 SCRIPT_FOLLOW(0, 2),
184 SCRIPT_PLACE(2, 0x140, 0x118),
185 SCRIPT_POSE(2, 1, 5),
186 SCRIPT_PLACE(0x68, 0x180, 0xF8),
187 SCRIPT_POSE(0x68, 1, 1),
188 SCRIPT_WAIT(0x78),
189 SCRIPT_TALK(0, 1, 2, 1),
191 SCRIPT_WAIT(0x1E),
192 SCRIPT_TALK(0, 2, 0x68, 0),
194 SCRIPT_WAIT(0x1E),
195 SCRIPT_TALK(0, 3, 2, 1),
197 SCRIPT_WAIT(0x1E),
198 SCRIPT_TALK(0, 4, 0x68, 0),
200 SCRIPT_WAIT(0x1E),
201 SCRIPT_COMMAND(0x323, 0x325, 2),
202 SCRIPT_WAIT(0x3C),
203 SCRIPT_COMMAND(0x323, 0x326, 2),
204 SCRIPT_WAIT(0x1E),
205 SCRIPT_TALK(0, 5, 2, 1),
207 SCRIPT_WAIT(0x1E),
208 SCRIPT_TALK(0, 6, 0x68, 0),
210 SCRIPT_WAIT(0x1E),
211 SCRIPT_TALK(0, 7, 2, 1),
213 SCRIPT_POSE(2, 1, 1),
214 SCRIPT_WAIT(0x1E),
215 SCRIPT_WALK(2, 0xC0, 0x158, 1),
216 SCRIPT_WAIT(0x3C),
217 SCRIPT_LEAVE(0x277, 0x12F, 0x168, 5),
219};
220AreaBattle area0Battle0 = { 0, 0, MUSIC(1, 0) };
221AreaBattle area0Battle1 = { 0, 0, MUSIC(1, 0) };
222AreaBattle area0Battle2 = { 0, 0, MUSIC(1, 0) };
223AreaBattle area0Battle3 = { 0, 0, MUSIC(1, 0) };
224AreaBattle area0Battle4 = { 0, 0, MUSIC(1, 0) };
225AreaBattle area0Battle5 = { 0, 0, MUSIC(1, 0) };
226AreaBattle area0Battle6 = { 0, 0, MUSIC(1, 0) };
227AreaBattle area0Battle7 = { 0, 0, MUSIC(1, 0) };
233AreaBattle area1Battle0 = { 0, 0, MUSIC(1, 0) };
234AreaBattle area1Battle1 = { 0, 0, MUSIC(1, 0) };
235AreaBattle area1Battle2 = { 0, 0, MUSIC(1, 0) };
236AreaBattle area1Battle3 = { 0, 0, MUSIC(1, 0) };
237AreaBattle area1Battle4 = { 0, 0, MUSIC(1, 0) };
238AreaBattle area1Battle5 = { 0, 0, MUSIC(1, 0) };
239AreaBattle area1Battle6 = { 0, 0, MUSIC(1, 0) };
240AreaBattle area1Battle7 = { 0, 0, MUSIC(1, 0) };
246AreaBattle area2Battle0 = { 0, 0, MUSIC(1, 0) };
247AreaBattle area2Battle1 = { 0, 0, MUSIC(1, 0) };
248AreaBattle area2Battle2 = { 0, 0, MUSIC(1, 0) };
249AreaBattle area2Battle3 = { 0, 0, MUSIC(1, 0) };
250AreaBattle area2Battle4 = { 0, 0, MUSIC(1, 0) };
251AreaBattle area2Battle5 = { 0, 0, MUSIC(1, 0) };
252AreaBattle area2Battle6 = { 0, 0, MUSIC(1, 0) };
253AreaBattle area2Battle7 = { 0, 0, MUSIC(1, 0) };
260AreaBattle area3Battle1 = { 0, 0, MUSIC(1, 0) };
261AreaBattle area3Battle2 = { 0, 0, MUSIC(1, 0) };
262AreaBattle area3Battle3 = { 0, 0, MUSIC(1, 0) };
263AreaBattle area3Battle4 = { 0, 0, MUSIC(1, 0) };
264AreaBattle area3Battle5 = { 0, 0, MUSIC(1, 0) };
265AreaBattle area3Battle6 = { 0, 0, MUSIC(1, 0) };
266AreaBattle area3Battle7 = { 0, 0, MUSIC(1, 0) };
#define NULL
Definition common.h:17
signed short s16
Definition common.h:9
void * createTileAnims(void)
Creates the updateTileAnims task.
GameFlags FLAGS_00
The flag bitset FLAGS_00 and the event functions.
Definition events.c:701
#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_LEAVE(mode, x, y, dir)
FIELDSTG_leaveField; ends the event.
Definition field_map.h:170
#define SCRIPT_COMMAND(id, command, arg)
the same word for a script command's id: FIELDSTG_setEventPose creates its task if none runs and hand...
Definition field_map.h:161
#define SCRIPT_FOLLOW(snap, id)
FIELDSTG_followWithCamera.
Definition field_map.h:171
#define FIELD_MAP_FLOOR0
Some of FieldMap's maps (files): those of the floors the player walks on come first,...
Definition field_map.h:85
#define SCRIPT_WALK(id, x, y, dir)
Actor.setGoal: walks to (x, y), then faces dir.
Definition field_map.h:162
#define SCRIPT_WAIT_BOX
until box 0 closes
Definition field_map.h:167
#define 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_PLACE(id, x, y)
puts a character at (x, y)
Definition field_map.h:157
#define SCRIPT_TALK(box, entry, id, kind)
box of the event's boxes shows the event text's entry: a talk box at the corner kind next to the char...
Definition field_map.h:165
FieldMap FIELDSTG_map
Definition fieldstg.c:3660
FieldState FIELDSTG_state
Definition fieldstg.c:2641
#define EVENT_BATTLE(id)
action: FIELDSTG_battleFuncs.startEventBattle
Definition game_state.h:72
#define MUSIC_ADMIN_CENTER
KANRIBGM: the cities' Main Lobby, Admin Center, Digimon Arena, Master Room.
Definition sound.h:79
#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_LAST_BOSS_1
LASTB_01: the extra chapter's last battle (WSTAG927, the Digimon Arena)
Definition sound.h:111
#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,...
#define FLAG_KURT_ARENA_WIN_SEEN
wstag927 (extra chapter) event 1608: the player beat Kurt and is the new strongest tamer; set at its ...
Definition story.h:962
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
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
ActorImage * actors
then the actors', from actors[2]
Definition field_map.h:454
s32 mapFile
the file of the map's tiles (FIELDSTG_createMapStreamer)
Definition field_map.h:444
s32 startDir
and its direction
Definition field_map.h:457
s32 textFile
the stage's text file, for the talks
Definition field_map.h:461
union FieldState::@12 images
s32 music
SOUND.playSound's, or 0.
Definition field_map.h:460
void(* applyAction)(s32 code, s32 value)
Definition game_state.h:52
s32(* checkCondition)(u16 code, u16 value)
Definition game_state.h:53
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
An object of a map, which FIELDSTG draws: a record of the table at FieldState.objects,...
Definition field_map.h:208
Definition gfx.h:352
AreaBattle area2Battle7
Definition wstag927.c:253
FieldActorEntry actor0
Definition wstag927.c:104
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag927.c:130
AreaBattle area2Battle6
Definition wstag927.c:252
s16 script1608[]
Defined below, after the tables that use them.
Definition wstag927.c:139
AreaBattle area1Battle6
Definition wstag927.c:239
AreaBattle area0Battle7
Definition wstag927.c:227
#define STAGE_FILE_8
Definition wstag927.c:52
AreaBattle area3Battle4
Definition wstag927.c:263
AreaBattle area3Battle3
Definition wstag927.c:262
AreaBattle area0Battle1
Definition wstag927.c:221
AreaBattle area2Battle0
Definition wstag927.c:246
FieldActorEntry * stageActors[]
Definition wstag927.c:105
AreaBattle area1Battle2
Definition wstag927.c:235
AreaBattle area3Battle0
Definition wstag927.c:259
AreaBattle area0Battle6
Definition wstag927.c:226
AreaBattle area3Battle2
Definition wstag927.c:261
s16 script1610[]
Definition wstag927.c:182
AreaBattle area3Battle1
Definition wstag927.c:260
AreaBattle area0Battle3
Definition wstag927.c:223
AreaBattle area3Battle6
Definition wstag927.c:265
AnimFrame updateTileAnimsFrames1[]
Definition wstag927.c:88
ActorImage stageImages[]
Definition wstag927.c:95
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing KANRIBGM.
Definition wstag927.c:59
AreaBattle area2Battle4
Definition wstag927.c:250
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag927.c:109
BattleList area3Battles
Definition wstag927.c:267
AreaBattle area3Battle5
Definition wstag927.c:264
AreaBattle area0Battle5
Definition wstag927.c:225
BattleList area1Battles
Definition wstag927.c:241
BattleList area2Battles
Definition wstag927.c:254
AreaBattle area1Battle4
Definition wstag927.c:237
AreaBattle area2Battle2
Definition wstag927.c:248
AreaBattle area1Battle5
Definition wstag927.c:238
void endEvent1608(void)
After event 1608, with Kurt: starts the stage's event battle 0 and keeps it from playing again.
Definition wstag927.c:44
AreaBattle area2Battle1
Definition wstag927.c:247
AreaBattle area1Battle3
Definition wstag927.c:236
AreaBattle area1Battle0
Definition wstag927.c:233
AnimFrame updateTileAnimsFrames0[]
Defined below, after the code that uses them.
Definition wstag927.c:81
AreaBattle area0Battle0
Definition wstag927.c:220
AreaBattle area0Battle2
Definition wstag927.c:222
#define STAGE_FILE
Definition wstag927.c:51
AreaBattle area2Battle5
Definition wstag927.c:251
AreaBattle area1Battle1
Definition wstag927.c:234
AreaBattle area2Battle3
Definition wstag927.c:249
AreaBattle area0Battle4
Definition wstag927.c:224
#define STAGE_TEXT
Definition wstag927.c:50
AreaBattle area3Battle7
Definition wstag927.c:266
BattleList area0Battles
Definition wstag927.c:228
AreaBattle area1Battle7
Definition wstag927.c:240
FieldBattles stageBattles[]
Definition wstag927.c:272
FieldEvent stageEvents[]
Definition wstag927.c:134