Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag934.c
Go to the documentation of this file.
1/*
2 * WSTAG934: Cargo Tower, Amaterasu City, in the extra chapter. The European
3 * version's: in its extra chapter (STORY_EXTRA), mode 639 starts it instead of
4 * WSTAG261.
5 */
6
7#include "common.h"
8#define STAGE_TWEEN /* stageFuncs is a StageFuncs (stage.h) */
9#include "field/stage.h"
10/* Defined below, after the code that uses them */
11extern s16 tileLiftShake[];
12
14
15/* Runs a script command of the lift's: moves it up or down */
16void handleTileLift(Lift *task, s32 id) {
17 if (task != NULL) {
18 switch (id) {
19 case LIFT_UP:
20 task->setState(task, TASK_DONE);
21 task->raised = 0;
22 break;
23 case LIFT_DOWN:
24 task->setState(task, TASK_DONE);
25 task->raised = 1;
26 break;
27 }
28 }
29}
30
31/* Creates the lift (updateTileLift), raised when flag 0x1C3D is set; nothing in the game calls it */
33 Lift *task = createTaskWithId(updateTileLift, sizeof(Lift), 0, id);
34
36 task->raised = 1;
37 } else {
38 task->raised = 0;
39 }
40 return task;
41}
42
44
45/* Creates the stage task (updateStage) of the given owner */
46StageTask *startStage(void *owner) {
47 StageTask *task = createTask(updateStage, 0x58, 8);
48
49 task->owner = owner;
51 return task;
52}
53
54/* the color the setup copies to FIELDSTG_state.spriteColor */
55const CVECTOR stageColor = { 0x80, 0x80, 0x80, 0 };
56
57#if VERSION_EU
58#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_08)
59#define STAGE_FILE 0x8FB
60#define STAGE_FILE_8 0x1AC
61#elif VERSION_JP
62#define STAGE_TEXT 0x89A
63#define STAGE_FILE 0x8BF
64#define STAGE_FILE_8 0x19E
65#endif
66/* Sets the stage up: its map and actors, playing the ambience ENV_0204 */
86
89
91 1, 2, 1, 0, -1, -2, -1, 0,
92 0x3E8,
93 /* after the end, the original's padding up to a word, which isn't zeros */
94#if VERSION_EU
95 5,
96#elif VERSION_JP
97 0x404,
98#endif
99};
101 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
102 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
103 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
104 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
105 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
106 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
107 { 0x180, 0x100, 0x18C, 0x1DD, 0x130, 0xDD, 0x160, 0x1FE },
108 { 0x1C0, 0x100, 0x1EA, 0x13C, 0x2A8, 0x3C, 0x170, 0x1FE },
109};
112u16 actor1Talk1Conditions[] = { FLAG(0, 0), 1, ITEM(0, 0x192), 0, CODES_END };
114u16 actor1Talk2Conditions[] = { FLAG(0, 0), 1, ITEM(0, 0x192), 1, CODES_END };
116 { NULL, NULL, 0x41 },
117 { NULL, NULL, 0 },
118};
125FieldActorEntry actor0 = { NULL, actor0Talks, 0x2D, 4, 271, 361, 5 };
126FieldActorEntry actor1 = { NULL, actor1Talks, 0x67, 5, 191, 400, 3 };
128 &actor0,
129 &actor1,
130 NULL,
131};
133 { 1, 1, 0x44, 2, 0x52, 2, 0, 1, 4, 0, 312, 282, 0, 0 },
134 { 1, 2, 0x40, 2, 0x4A, 1, 0x4A, 0x51, 4, 0, 135, 358, 0, 0 },
135 { 1, 0, 0x40, 6, 0x3E, 1, 0x3E, 0x43, 4, 0, 357, 161, 0, 0 },
136 { 1, 0, 0x40, 6, 1, 0, 0, 0, 0, 0, 192, 417, 0, 0 },
137 { 1, 0, 0x40, 6, 2, 1, 2, 7, 4, 0, 357, 161, 0, 0 },
138 { 1, 3, 0xCD, 6, 0, 0, 0, 0, 0, 0, 160, 338, 0, 0 },
139 { 1, 0, 0x40, 0xA, 0x44, 1, 0x44, 0x49, 4, 0, 357, 241, 0, 0 },
140 { 1, 0, 0x40, 0xA, 8, 1, 8, 0xD, 4, 0, 357, 241, 0, 0 },
141 { 1, 0, 0x40, 0xA, 0xF, 1, 0xF, 0x13, 4, 0, 62, 326, 0, 0 },
142 { 1, 0, 0x48, 0xA, 0x14, 0, 0, 0, 0, 0, 128, 202, 0, 0 },
143 { 1, 0, 0x49, 0xA, 0x15, 0, 0, 0, 0, 0, 200, 183, 0, 0 },
144 { 1, 0, 0x40, 4, 0x32, 1, 0x32, 0x37, 4, 0, 357, 161, 200, 0 },
145 { 1, 0, 0x40, 8, 0x38, 1, 0x38, 0x3D, 4, 0, 357, 241, 280, 0 },
146 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
147};
149 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x271, 0x368, 0xF4, 1, 0, 0, 0 },
150 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_EXIT, 0x281, 0x2FE, 0xA5, 1, 0, 0, 0 },
151 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_MAP, 1, 0, 0, 0, 0, 0, 0 },
152 { { { CODES_END, 0 }, { CODES_END, 0 } }, SLOT_DEPTH, 8, 0, 0, 0, 0, 0, 0 },
153 { { { CODES_END, 0 }, { CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
154};
#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
GameFlags FLAGS_00
The flag bitset FLAGS_00 and the event functions.
Definition events.c:701
#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_DEPTH
the player's depth, arg
Definition field_map.h:259
#define SLOT_MAP
the map the player is on, arg (FieldMap.setMap)
Definition field_map.h:260
#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_MAP_FLOOR1
Definition field_map.h:86
#define LIFT_DOWN
and back down to the objects' place on the map
Definition field_map.h:236
#define LIFT_UP
The lift: the map objects 3 (always shown) and 2 (shown while it moves), which move 0x7F pixels up or...
Definition field_map.h:235
#define SLOT_EXIT
The kinds of StageSlot (type).
Definition field_map.h:255
#define FIELD_MAP_TRIGGERS
a cell's value: a direction (3 bits) and a StageSlot (5)
Definition field_map.h:88
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_CARGO_TOWER
ENV_0204: the Cargo Tower.
Definition sound.h:143
#define MUSIC_BANK(music)
The sound bank of a music, which a stage loads for it (FieldState.soundBank)
Definition sound.h:148
void startTween(PanelAnim *tween, s32 up)
Starts the menu stage's tween (stageFuncs.start) with its sound: up, from 0 to ONE over its duration,...
#define FLAG_LIFT_RAISED
lift.c / wstag261 Cargo Tower: "There's a switch here! Let's push it." sets it, "let's go downstairs"...
Definition story.h:1245
#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 character of the field (FieldState.actors, a list of pointers up to NULL), which FIELDSTG_updateFie...
Definition field_map.h:194
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
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
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
What a character says (FIELDSTG_runActorAction): the first whose conditions hold, or the last,...
Definition field_map.h:176
s32(* checkCondition)(u16 code, u16 value)
Definition game_state.h:53
void(* setState)(struct Lift *task, s32 state)
Definition field_map.h:239
s16 raised
the objects are 0x7F up from their place, and the next move takes them down (LIFT_DOWN; flag 0x1C3D a...
Definition field_map.h:241
The table of a stage's functions: its setup, then the menu stages' tween (startTween and updateTween)...
Definition stage.h:95
void(* setup)(void)
fills FIELDSTG_state
Definition stage.h:96
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 * owner
Definition stage.h:28
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
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
void updateTileLift(Lift *task)
The lift: moves the map objects of animations 3 and 2 (shown only while it moves) and the player 0x7F...
s32 updateTween(PanelAnim *tween)
Steps the tween (stageFuncs.update): whether it has ended.
FieldActorEntry actor0
Definition wstag934.c:125
Lift * createTileLift(s32 id)
Creates the lift (updateTileLift), raised when flag 0x1C3D is set; nothing in the game calls it.
Definition wstag934.c:32
u16 actor1Talk1Conditions[]
Definition wstag934.c:112
const CVECTOR stageColor
the color the setup copies to FIELDSTG_state.spriteColor
Definition wstag934.c:55
#define STAGE_FILE_8
Definition wstag934.c:60
FieldActorEntry * stageActors[]
Definition wstag934.c:127
FieldTalk actor1Talks[]
Definition wstag934.c:119
u16 actor1Talk0Conditions[]
Definition wstag934.c:110
FieldTalk actor0Talks[]
Definition wstag934.c:115
ActorImage stageImages[]
Definition wstag934.c:100
u16 actor1Talk1Actions[]
Definition wstag934.c:113
void setupStage(void)
Sets the stage up: its map and actors, playing the ambience ENV_0204.
Definition wstag934.c:67
StageTask * startStage(void *owner)
Creates the stage task (updateStage) of the given owner.
Definition wstag934.c:46
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag934.c:132
void handleTileLift(Lift *task, s32 id)
Runs a script command of the lift's: moves it up or down.
Definition wstag934.c:16
s16 tileLiftShake[]
Defined below, after the code that uses them.
Definition wstag934.c:90
StageSlot stageSlots[]
Definition wstag934.c:148
u16 actor1Talk0Actions[]
Definition wstag934.c:111
u16 actor1Talk2Conditions[]
Definition wstag934.c:114
FieldActorEntry actor1
Definition wstag934.c:126
#define STAGE_FILE
Definition wstag934.c:59
#define STAGE_TEXT
Definition wstag934.c:58
StageFuncs stageFuncs
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag934.c:155