Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag954.c
Go to the documentation of this file.
1/*
2 * WSTAG954: Tyranno Valley, East Sector, in the extra chapter. The European
3 * version's: in its extra chapter (STORY_EXTRA), mode 666 starts it instead of
4 * WSTAG406.
5 */
6
7#include "common.h"
8#include "field/stage.h"
9/* Defined below, after the code that uses them */
11
13
15
17
18/* Creates the stage's object (its second child) */
19void updateStage(StageTask *task, void **children) {
20 switch (task->state) {
21 case TASK_INIT:
22 default:
23 children[1] = createTileAnims();
24 task->nextState(task);
25 break;
26 case TASK_RUN:
27 case TASK_DONE:
28 case TASK_KILL:
29 break;
30 }
31}
32
33#define STAGE_CHILDREN_SIZE 0x8
35
36#if VERSION_EU
37#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_09)
38#define STAGE_FILE 0x923
39#define STAGE_FILE_8 0x256
40#elif VERSION_JP
41#define STAGE_TEXT 0x89B
42#define STAGE_FILE 0x8FB
43#define STAGE_FILE_8 0x247
44#endif
45/* Sets the stage up: its map, actors and battles, playing the ambience ENV_0007 */
65
67 { 50, 8 }, { 51, 4 }, { 52, 8 }, { 53, 4 },
68 { 54, 8 }, { 55, 4 }, { 56, 8 }, { 57, 16 },
69 { 58, 4 }, { 59, 8 }, { 60, 4 }, { 61, 8 },
70 { 62, 8 }, { 63, 12 }, { 64, 20 }, { 65, 4 },
71 { 66, 8 }, { 67, 4 }, { 68, 8 }, { 69, 8 },
72 { 70, 8 }, { 71, 8 }, { 72, 8 }, { 73, 4 },
73 { 74, 8 }, { 75, 4 }, { 76, 8 }, { 77, 8 },
74 { 78, 8 }, { 79, 8 }, { 80, 8 }, { 81, 12 },
75 { 82, 8 }, { 83, 30 }, { 255, 0 },
76};
78 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
79 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
80 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
81 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
82 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
83 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
84 { 0x180, 0x100, 0x19C, 0x148, 0x170, 0x48, 0x170, 0x1FF },
85 { 0x180, 0x100, 0x1AA, 0x120, 0x1A8, 0x20, 0x150, 0x1FE },
86 { 0x180, 0x100, 0x1B2, 0x120, 0x1C8, 0x20, 0x160, 0x1FE },
87};
114 { NULL, NULL, 0x92 },
115 { NULL, NULL, 0 },
116};
118 { NULL, NULL, 0x49 },
119 { NULL, NULL, 0 },
120};
129 { actor3Talk0Conditions, NULL, 0x8F },
131 { actor3Talk2Conditions, NULL, 0x91 },
132 { NULL, NULL, 0 },
133};
134u16 actor1Conditions[] = { ITEM(0, 0x192), 0, CODES_END };
135u16 actor2Conditions[] = { ITEM(0, 0x192), 1, CODES_END };
136FieldActorEntry actor0 = { NULL, actor0Talks, 0x2D, 4, 764, 1138, 5 };
139FieldActorEntry actor3 = { NULL, actor3Talks, 0x92, 6, 924, 323, 1 };
141 &actor0,
142 &actor1,
143 &actor2,
144 &actor3,
145 NULL,
146};
148 { 1, 1, 0xE6, 2, 0x32, 0, 0, 0, 0, 0, 966, 364, 0, 0 },
149 { 1, 0, 0x40, 2, 0x54, 2, 0, 2, 6, 0, 931, 293, 0, 0 },
150 { 1, 0, 0x40, 2, 1, 1, 1, 6, 8, 0, 179, 400, 0, 0 },
151 { 1, 0, 0x40, 2, 1, 1, 1, 6, 8, 0, 602, 1071, 0, 0 },
152 { 1, 0, 0xC8, 6, 7, 0, 0, 0, 0, 0, 745, 598, 0, 0 },
153 { 1, 0, 0x40, 4, 0, 0, 0, 0, 0, 0, 298, 442, 505, 0 },
154 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
155};
157 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x299, 0x648, 0xD0, 1, 0, 0, 0 },
158 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_UP, 8, 0xF0, 0x4D8, 0, 0, 0, 0 },
159 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_DOWN, 8, 0x100, 0x450, 0, 0, 0, 0 },
160 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_UP, 9, 0x102, 0x420, 0, 0, 0, 0 },
161 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_DOWN, 9, 0xF2, 0x388, 0, 0, 0, 0 },
162 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_UP, 6, 0x1D2, 0x4C8, 0, 0, 0, 0 },
163 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_DOWN, 6, 0x1C2, 0x460, 0, 0, 0, 0 },
164 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_UP, 0xF, 0x1AF, 0x428, 0, 0, 0, 0 },
165 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_DOWN, 0xF, 0x1BF, 0x330, 0, 0, 0, 0 },
166 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_DROP, 0x16, 0, 0, 0, 0, 0, 0 },
167 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_UP, 9, 0x330, 0x208, 0, 0, 0, 0 },
168 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_CLIMB_DOWN, 9, 0x340, 0x170, 0, 0, 0, 0 },
169 { { { CODES_END, 0 }, { CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
170};
171void (*stageFuncs[])(void) = {
173};
200AreaBattle area2Battle0 = { 0, 0, MUSIC(1, 0) };
201AreaBattle area2Battle1 = { 0, 0, MUSIC(1, 0) };
202AreaBattle area2Battle2 = { 0, 0, MUSIC(1, 0) };
203AreaBattle area2Battle3 = { 0, 0, MUSIC(1, 0) };
204AreaBattle area2Battle4 = { 0, 0, MUSIC(1, 0) };
205AreaBattle area2Battle5 = { 0, 0, MUSIC(1, 0) };
206AreaBattle area2Battle6 = { 0, 0, MUSIC(1, 0) };
207AreaBattle area2Battle7 = { 0, 0, MUSIC(1, 0) };
214AreaBattle area3Battle1 = { 0, 0, MUSIC(1, 0) };
215AreaBattle area3Battle2 = { 0, 0, MUSIC(1, 0) };
216AreaBattle area3Battle3 = { 0, 0, MUSIC(1, 0) };
217AreaBattle area3Battle4 = { 0, 0, MUSIC(1, 0) };
218AreaBattle area3Battle5 = { 0, 0, MUSIC(1, 0) };
219AreaBattle area3Battle6 = { 0, 0, MUSIC(1, 0) };
220AreaBattle area3Battle7 = { 0, 0, MUSIC(1, 0) };
#define NULL
Definition common.h:17
unsigned short u16
Definition common.h:10
void * createTileAnims(void)
Creates the updateTileAnims task.
#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.
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 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_CLIMB_DOWN
Definition field_map.h:257
#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 FIELD_MAP_TRIGGERS
a cell's value: a direction (3 bits) and a StageSlot (5)
Definition field_map.h:88
#define SLOT_DROP
Definition field_map.h:258
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 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 CARD_BATTLE(opponent, kind)
action: startCardBattle
Definition game_state.h:73
#define MUSIC_BATTLE
BATL0000: the maps' random battles (AreaBattle, nearly all of them)
Definition sound.h:76
#define MUSIC_TYRANNO_VALLEY
ENV_0007: Tyranno Valley, Snow Mountain, Kulon Mine and the Battle Gate.
Definition sound.h:123
#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
#define MUSIC_BOSS_1
BOSS_001: the Digimon Arena's, the cities', the dungeons' and the A.o.A's boss battles.
Definition sound.h:109
FIELDSTG's start of the stage (StageEntry.init in FIELDSTG_stages): the stage's task,...
#define FLAG_XUAN_WU_LEADER_FOUGHT
wstag954 (extra chapter): the Xuan Wu Leader sees the 5 Epic Items and starts a battle; set with the ...
Definition story.h:974
#define SPECIAL_HAS_FIVE_EPIC_ITEMS
the European and Japanese versions: the player has the Muramasa, Super Nova, Punishment,...
Definition story.h:1678
#define FLAG_CARD_BATTLE_WON
set by updateModeFlags on the way back from a card battle: 1 if the player won it (FLAGS_00....
Definition story.h:166
#define FLAG_CARD_BATTLE_ENDED
set by updateModeFlags on the way back from a card battle; the talks that follow one test it and clea...
Definition story.h:169
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
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
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
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 actor1Conditions[]
Definition wstag954.c:134
AreaBattle area2Battle7
Definition wstag954.c:207
FieldActorEntry actor0
Definition wstag954.c:136
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag954.c:171
FieldTalk actor2Talks[]
Definition wstag954.c:121
AreaBattle area2Battle6
Definition wstag954.c:206
u16 actor2Talk1Conditions[]
Definition wstag954.c:90
AreaBattle area1Battle6
Definition wstag954.c:193
AreaBattle area0Battle7
Definition wstag954.c:181
FieldActorEntry actor2
Definition wstag954.c:138
u16 actor3Talk0Conditions[]
Definition wstag954.c:101
#define STAGE_FILE_8
Definition wstag954.c:39
AreaBattle area3Battle4
Definition wstag954.c:217
AreaBattle area3Battle3
Definition wstag954.c:216
AreaBattle area0Battle1
Definition wstag954.c:175
AreaBattle area2Battle0
Definition wstag954.c:200
FieldActorEntry * stageActors[]
Definition wstag954.c:140
u16 actor2Talk3Conditions[]
Definition wstag954.c:99
AreaBattle area1Battle2
Definition wstag954.c:189
AreaBattle area3Battle0
Definition wstag954.c:213
AreaBattle area0Battle6
Definition wstag954.c:180
FieldTalk actor1Talks[]
Definition wstag954.c:117
AreaBattle area3Battle2
Definition wstag954.c:215
u16 actor2Talk1Actions[]
Definition wstag954.c:91
FieldTalk actor0Talks[]
Definition wstag954.c:113
AreaBattle area3Battle1
Definition wstag954.c:214
AreaBattle area0Battle3
Definition wstag954.c:177
u16 actor3Talk2Conditions[]
Definition wstag954.c:108
u16 actor3Talk1Conditions[]
Definition wstag954.c:102
u16 actor2Talk0Actions[]
Definition wstag954.c:89
u16 actor2Talk2Conditions[]
Definition wstag954.c:97
AreaBattle area3Battle6
Definition wstag954.c:219
u16 actor2Talk3Actions[]
Definition wstag954.c:100
ActorImage stageImages[]
Definition wstag954.c:77
void setupStage(void)
Sets the stage up: its map, actors and battles, playing the ambience ENV_0007.
Definition wstag954.c:46
AreaBattle area2Battle4
Definition wstag954.c:204
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag954.c:147
AnimFrame updateTileAnimsFrames[]
Defined below, after the code that uses them.
Definition wstag954.c:66
FieldTalk actor3Talks[]
Definition wstag954.c:128
u16 actor3Talk1Actions[]
Definition wstag954.c:107
BattleList area3Battles
Definition wstag954.c:221
AreaBattle area3Battle5
Definition wstag954.c:218
AreaBattle area0Battle5
Definition wstag954.c:179
BattleList area1Battles
Definition wstag954.c:195
BattleList area2Battles
Definition wstag954.c:208
u16 actor2Talk0Conditions[]
Definition wstag954.c:88
AreaBattle area1Battle4
Definition wstag954.c:191
u16 actor2Talk2Actions[]
Definition wstag954.c:98
AreaBattle area2Battle2
Definition wstag954.c:202
AreaBattle area1Battle5
Definition wstag954.c:192
StageSlot stageSlots[]
Definition wstag954.c:156
AreaBattle area2Battle1
Definition wstag954.c:201
AreaBattle area1Battle3
Definition wstag954.c:190
AreaBattle area1Battle0
Definition wstag954.c:187
FieldActorEntry actor1
Definition wstag954.c:137
AreaBattle area0Battle0
Definition wstag954.c:174
AreaBattle area0Battle2
Definition wstag954.c:176
#define STAGE_FILE
Definition wstag954.c:38
AreaBattle area2Battle5
Definition wstag954.c:205
AreaBattle area1Battle1
Definition wstag954.c:188
AreaBattle area2Battle3
Definition wstag954.c:203
u16 actor2Conditions[]
Definition wstag954.c:135
AreaBattle area0Battle4
Definition wstag954.c:178
#define STAGE_TEXT
Definition wstag954.c:37
AreaBattle area3Battle7
Definition wstag954.c:220
BattleList area0Battles
Definition wstag954.c:182
AreaBattle area1Battle7
Definition wstag954.c:194
FieldActorEntry actor3
Definition wstag954.c:139
FieldBattles stageBattles[]
Definition wstag954.c:226