Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag585.c
Go to the documentation of this file.
1/*
2 * WSTAG585: Duct Room 01, West Sector.
3 */
4
5#include "common.h"
6#include "field/stage.h"
7
8/* Creates the event object of flags 0x4033 and 0x1C20 */
9void updateStage(StageTask *task, void **children) {
10 switch (task->state) {
11 case TASK_INIT:
12 default:
13 if (FLAGS_00.checkCondition(FLAG(0x40, 0x33), 0) && FLAGS_00.checkCondition(FLAG(0x1C, 0x20), 1)) {
14 children[0] = FIELDSTG_startEvent(0x1CC);
15 }
16 task->nextState(task);
17 break;
18 case TASK_RUN:
19 case TASK_DONE:
20 case TASK_KILL:
21 break;
22 }
23}
24
25#define STAGE_CHILDREN_SIZE 4
27
28/* After event 460, with the player: keeps it from playing again */
29void endEvent460(void) {
30 FLAGS_00.applyAction(FLAG(0x40, 0x33), 1);
31}
32
33#if VERSION_US || VERSION_JP
34#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_06)
35#define EVENT_TEXT_FILE (TEXT_EVENTS_500 - 1)
36#define STAGE_FILE 0x4F5
37#elif VERSION_EU
38#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_06)
39#define EVENT_TEXT_FILE (TEXT_EVENTS_500 - 1)
40#define STAGE_FILE 0x505
41#endif
42/* Sets the stage up: its map, actors, battles and events, playing the ambience ENV_0017 */
63
65 SCRIPT_FOLLOW(1, 2),
66 SCRIPT_PLACE(2, 0xEF, 0x180),
67 SCRIPT_POSE(2, 1, 5),
68 SCRIPT_WAIT(0x1E),
69 SCRIPT_WALK(2, 0x115, 0x16E, 5),
71 SCRIPT_POSE(2, 1, 5),
72 SCRIPT_WAIT(0x1E),
73 SCRIPT_POSE(2, 1, 7),
74 SCRIPT_WAIT(0x3C),
75 SCRIPT_POSE(2, 1, 3),
76 SCRIPT_WAIT(0x3C),
77 SCRIPT_POSE(2, 1, 5),
78 SCRIPT_WAIT(0x3C),
79 SCRIPT_TALK(0, 1, 2, 2),
81 SCRIPT_FOLLOW(0, 2),
82 SCRIPT_WAIT(0x3C),
84};
98AreaBattle area1Battle0 = { 0, 0, MUSIC(1, 0) };
99AreaBattle area1Battle1 = { 0, 0, MUSIC(1, 0) };
100AreaBattle area1Battle2 = { 0, 0, MUSIC(1, 0) };
101AreaBattle area1Battle3 = { 0, 0, MUSIC(1, 0) };
102AreaBattle area1Battle4 = { 0, 0, MUSIC(1, 0) };
103AreaBattle area1Battle5 = { 0, 0, MUSIC(1, 0) };
104AreaBattle area1Battle6 = { 0, 0, MUSIC(1, 0) };
105AreaBattle area1Battle7 = { 0, 0, MUSIC(1, 0) };
111AreaBattle area2Battle0 = { 0, 0, MUSIC(1, 0) };
112AreaBattle area2Battle1 = { 0, 0, MUSIC(1, 0) };
113AreaBattle area2Battle2 = { 0, 0, MUSIC(1, 0) };
114AreaBattle area2Battle3 = { 0, 0, MUSIC(1, 0) };
115AreaBattle area2Battle4 = { 0, 0, MUSIC(1, 0) };
116AreaBattle area2Battle5 = { 0, 0, MUSIC(1, 0) };
117AreaBattle area2Battle6 = { 0, 0, MUSIC(1, 0) };
118AreaBattle area2Battle7 = { 0, 0, MUSIC(1, 0) };
124AreaBattle area3Battle0 = { 0, 0, MUSIC(1, 0) };
125AreaBattle area3Battle1 = { 0, 0, MUSIC(1, 0) };
126AreaBattle area3Battle2 = { 0, 0, MUSIC(1, 0) };
127AreaBattle area3Battle3 = { 0, 0, MUSIC(1, 0) };
128AreaBattle area3Battle4 = { 0, 0, MUSIC(1, 0) };
129AreaBattle area3Battle5 = { 0, 0, MUSIC(1, 0) };
130AreaBattle area3Battle6 = { 0, 0, MUSIC(1, 0) };
131AreaBattle area3Battle7 = { 0, 0, MUSIC(1, 0) };
141 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
142 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
143 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
144 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
145 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
146 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
147 { 0x140, 0x100, 0x176, 0x100, 0xD8, 0, 0x150, 0x1FF },
148};
156 { NULL, actor0Talk0Actions, 0x256 },
157 { NULL, NULL, 0 },
158};
162 &actor0,
163 NULL,
164};
166 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 6, 0, 277, 252, 0, 0 },
167 { 1, 0, 0x40, 6, 0x33, 2, 0, 5, 6, 0, 405, 317, 0, 0 },
168 { 1, 0, 0x40, 6, 0, 1, 0, 0xB, 4, 0, 214, 250, 0, 0 },
169 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
170};
172 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x24D, 0x358, 0x37C, 1, 0, 0, 0 },
173 { { { CODES_END, 0 }, { CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
174};
175void (*stageFuncs[])(void) = {
177};
179 { 460, script460, EVENT_TEXT(7), NULL, endEvent460 },
180 { -1, NULL, 0, NULL, NULL },
181};
#define NULL
Definition common.h:17
signed short s16
Definition common.h:9
unsigned short u16
Definition common.h:10
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_FOLLOW(snap, id)
FIELDSTG_followWithCamera.
Definition field_map.h:171
#define FIELD_MAP_FLOOR0
Some of FieldMap's maps (files): those of the floors the player walks on come first,...
Definition field_map.h:85
#define SCRIPT_WALK(id, x, y, dir)
Actor.setGoal: walks to (x, y), then faces dir.
Definition field_map.h:162
#define SCRIPT_WAIT_BOX
until box 0 closes
Definition field_map.h:167
#define SLOT_EXIT
The kinds of StageSlot (type).
Definition field_map.h:255
#define 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 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 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
#define MUSIC_BATTLE
BATL0000: the maps' random battles (AreaBattle, nearly all of them)
Definition sound.h:76
#define MUSIC_DUM_DUM_FACTORY
ENV_0017: Bullet Valley, the Dum Dum Factory, its Duct Rooms and Operation Room.
Definition sound.h:133
#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,...
#define FLAG_DUCT_ROOM_01_HP_CHIP_FOUND
wstag585: chest that gives the HP Chip, "I got" text; its conditions test it 0; Dum Dum Factory (wsta...
Definition story.h:215
#define SPECIAL_SHOW_ITEM_GET_ICON
an action: the player's icon plays its animation 3 with SOUND_ITEM_GET (FIELD_COMMAND_ICON3); the tal...
Definition story.h:1982
Where an actor's frames go in VRAM: one of the records after the FieldImage (Actor....
Definition field_map.h:114
A battle of an area's BattleList, which can start on the field (see FIELDSTG_startEncounter); FIGHTST...
Definition field_map.h:402
The battles of an area of the map (its cells' value at FieldMap.files[4]), one picked at random.
Definition field_map.h:411
A character of the field (FieldState.actors, a list of pointers up to NULL), which FIELDSTG_updateFie...
Definition field_map.h:194
The battles of a place (FieldState.battles), by area of the map: the fourth area's are also the ones ...
Definition field_map.h:422
An event of the table FieldState.events, up to the first id -1, which FIELDSTG_startEvent starts.
Definition field_map.h:141
void(* setFile)(s32 index, s32 file)
FIELDSTG_setMapFile.
Definition field_map.h:100
void(* setFirstMap)(s32 index)
FIELDSTG_setFirstMap: the map the player starts on (GAME.mapIndex), when the mode is new.
Definition field_map.h:104
s32 sheetEntry
the stage's sprite sheet, loaded before the field starts, or 0
Definition field_map.h:445
FieldEvent * events
up to the first id -1
Definition field_map.h:451
s32 soundBank
SOUND.loadBank's, or 0.
Definition field_map.h:459
StageTile * objects
the map objects, up to the first margin 0
Definition field_map.h:446
s32 imageFile
or an image archive file, or 0
Definition field_map.h:449
FieldBattles * battles
Definition field_map.h:450
Vec2 start
where the player starts
Definition field_map.h:456
StageSlot * slots
up to the first type 0
Definition field_map.h:447
ActorImage * actors
then the actors', from actors[2]
Definition field_map.h:454
s32 mapFile
the file of the map's tiles (FIELDSTG_createMapStreamer)
Definition field_map.h:444
s32 startDir
and its direction
Definition field_map.h:457
s32 textFile
the stage's text file, for the talks
Definition field_map.h:461
union FieldState::@12 images
s32 music
SOUND.playSound's, or 0.
Definition field_map.h:460
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
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
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
u16 actor0Talk0Actions[]
Definition wstag585.c:149
AreaBattle area2Battle7
Definition wstag585.c:118
FieldActorEntry actor0
Definition wstag585.c:160
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag585.c:175
AreaBattle area2Battle6
Definition wstag585.c:117
AreaBattle area1Battle6
Definition wstag585.c:104
void endEvent460(void)
After event 460, with the player: keeps it from playing again.
Definition wstag585.c:29
AreaBattle area0Battle7
Definition wstag585.c:92
AreaBattle area3Battle4
Definition wstag585.c:128
AreaBattle area3Battle3
Definition wstag585.c:127
AreaBattle area0Battle1
Definition wstag585.c:86
AreaBattle area2Battle0
Definition wstag585.c:111
FieldActorEntry * stageActors[]
Definition wstag585.c:161
AreaBattle area1Battle2
Definition wstag585.c:100
AreaBattle area3Battle0
Definition wstag585.c:124
AreaBattle area0Battle6
Definition wstag585.c:91
AreaBattle area3Battle2
Definition wstag585.c:126
FieldTalk actor0Talks[]
Definition wstag585.c:155
AreaBattle area3Battle1
Definition wstag585.c:125
AreaBattle area0Battle3
Definition wstag585.c:88
AreaBattle area3Battle6
Definition wstag585.c:130
ActorImage stageImages[]
Definition wstag585.c:140
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing the ambience ENV_0017.
Definition wstag585.c:43
AreaBattle area2Battle4
Definition wstag585.c:115
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag585.c:165
s16 script460[]
Definition wstag585.c:64
BattleList area3Battles
Definition wstag585.c:132
AreaBattle area3Battle5
Definition wstag585.c:129
AreaBattle area0Battle5
Definition wstag585.c:90
BattleList area1Battles
Definition wstag585.c:106
BattleList area2Battles
Definition wstag585.c:119
AreaBattle area1Battle4
Definition wstag585.c:102
AreaBattle area2Battle2
Definition wstag585.c:113
AreaBattle area1Battle5
Definition wstag585.c:103
StageSlot stageSlots[]
Definition wstag585.c:171
AreaBattle area2Battle1
Definition wstag585.c:112
AreaBattle area1Battle3
Definition wstag585.c:101
AreaBattle area1Battle0
Definition wstag585.c:98
AreaBattle area0Battle0
Definition wstag585.c:85
AreaBattle area0Battle2
Definition wstag585.c:87
#define STAGE_FILE
Definition wstag585.c:40
AreaBattle area2Battle5
Definition wstag585.c:116
AreaBattle area1Battle1
Definition wstag585.c:99
AreaBattle area2Battle3
Definition wstag585.c:114
AreaBattle area0Battle4
Definition wstag585.c:89
#define STAGE_TEXT
Definition wstag585.c:38
AreaBattle area3Battle7
Definition wstag585.c:131
BattleList area0Battles
Definition wstag585.c:93
AreaBattle area1Battle7
Definition wstag585.c:105
FieldBattles stageBattles[]
Definition wstag585.c:137
FieldEvent stageEvents[]
Definition wstag585.c:178
u16 actor0Conditions[]
Definition wstag585.c:159