Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
wstag926.c
Go to the documentation of this file.
1/*
2 * WSTAG926: Arena Front Desk, Amaterasu City, in the extra chapter. The
3 * European version's: in its extra chapter (STORY_EXTRA), mode 631 starts it
4 * instead of WSTAG231.
5 */
6
7#include "common.h"
8#include "field/stage.h"
9
12
13#if VERSION_EU
14#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_08)
15#define STAGE_FILE 0x8EB
16#define STAGE_FILE_8 0x1A0
17#elif VERSION_JP
18#define STAGE_TEXT 0x89A
19#define STAGE_FILE 0x8A7
20#define STAGE_FILE_8 0x192
21#endif
22/* Sets the stage up: its map, actors and events, playing KANRIBGM */
41
42/* Shows the map object with animation 1 and moves it and the player down a pixel a frame for 150 frames */
44 StageTile *object;
45 StageTile *tile;
46 Actor *player;
47
48 switch (task->state) {
49 case TASK_INIT:
50 default:
51 task->nextState(task);
52 for (object = FIELDSTG_state.objects; object->margin != 0; object++) {
53 if (object->anim == 1) {
54 task->tile = object;
55 object->y--;
56 object->visible = 1;
57 }
58 }
59 task->timer = 0;
60 break;
61 case TASK_RUN:
62 tile = task->tile;
64 tile->y++;
65 task->timer++;
66 player->pos.y += 0x100;
67 if (task->timer >= 0x96) {
68 task->setState(task, TASK_KILL);
69 }
70 break;
71 case TASK_DONE:
72 case TASK_KILL:
73 break;
74 }
75}
76
77/*
78 * Command 854 of the event scripts: the lift that takes the player down to
79 * the Arena in event 1606 (updateTileTimer)
80 */
82 return createTaskWithId(updateTileTimer, sizeof(StageTileTimer), 0, arg);
83}
84
85/* Defined below, after the tables that use them */
86extern s16 script1606[];
87
89 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
90 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
91 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
92 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
93 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
94 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
95 { 0x140, 0x100, 0x174, 0x148, 0xD0, 0x48, 0x170, 0x1FF },
96 { 0x140, 0x100, 0x15C, 0x161, 0x70, 0x61, 0x160, 0x1FE },
97 { 0x140, 0x100, 0x16C, 0x161, 0xB0, 0x61, 0x170, 0x1FE },
98};
112 { actor0Talk0Conditions, NULL, 0x27 },
114 { actor0Talk2Conditions, NULL, 0x29 },
115 { NULL, NULL, 0 },
116};
118 { NULL, NULL, 0x2A },
119 { NULL, NULL, 0 },
120};
121FieldActorEntry actor0 = { NULL, actor0Talks, 0x20, 4, 272, 344, 7 };
122FieldActorEntry actor1 = { NULL, NULL, 0x24, 5, 240, 329, 3 };
123FieldActorEntry actor2 = { NULL, actor2Talks, 0x175, 6, 203, 218, 3 };
125 &actor0,
126 &actor1,
127 &actor2,
128 NULL,
129};
131 { 1, 0, 0x40, 2, 3, 0, 0, 0, 0, 0, 192, 256, 0, 0 },
132 { 1, 0, 0x40, 6, 0x32, 2, 0, 1, 4, 0, 144, 104, 0, 0 },
133 { 1, 0, 0x40, 6, 0x32, 2, 0, 1, 4, 0, 168, 92, 0, 0 },
134 { 1, 0, 0x40, 6, 0x32, 2, 0, 1, 4, 0, 224, 64, 0, 0 },
135 { 1, 0, 0x40, 6, 0x33, 2, 0, 0xB, 8, 0, 127, 112, 0, 0 },
136 { 1, 0, 0x40, 6, 0x33, 2, 0, 0xB, 8, 0, 127, 144, 0, 0 },
137 { 1, 0, 0x40, 6, 0x33, 2, 0, 0xB, 8, 0, 159, 96, 0, 0 },
138 { 1, 0, 0x40, 6, 0x33, 2, 0, 0xB, 8, 0, 159, 128, 0, 0 },
139 { 1, 0, 0x40, 6, 0x33, 2, 0, 0xB, 8, 0, 191, 80, 0, 0 },
140 { 1, 0, 0x40, 6, 0x33, 2, 0, 0xB, 8, 0, 191, 112, 0, 0 },
141 { 1, 0, 0x40, 6, 0x33, 2, 0, 0xB, 8, 0, 223, 64, 0, 0 },
142 { 1, 0, 0x40, 6, 0x33, 2, 0, 0xB, 8, 0, 223, 96, 0, 0 },
143 { 1, 0, 0x40, 6, 0x34, 2, 0, 0xB, 8, 0, 196, 289, 0, 0 },
144 { 1, 0, 0x40, 6, 0x34, 2, 0, 0xB, 8, 0, 226, 274, 0, 0 },
145 { 1, 0, 0x40, 6, 0x35, 2, 0, 0xB, 8, 0, 212, 266, 0, 0 },
146 { 1, 0, 0x40, 6, 0x35, 2, 0, 0xB, 8, 0, 212, 281, 0, 0 },
147 { 1, 0, 0x40, 6, 0x36, 2, 0, 0xB, 8, 0, 196, 275, 0, 0 },
148 { 1, 0, 0x40, 6, 0x36, 2, 0, 0xB, 8, 0, 226, 260, 0, 0 },
149 { 1, 0, 0x40, 6, 0x37, 1, 0x37, 0x39, 0xA, 0, 200, 290, 0, 0 },
150 { 1, 1, 0x40, 6, 2, 0, 0, 0, 0, 0, 256, 336, 0, 0 },
151 { 1, 0, 0x40, 4, 0x3A, 1, 0x3A, 0x3C, 0xA, 0, 256, 286, 315, 0 },
152 { 1, 0, 0x40, 4, 0, 0, 0, 0, 0, 0, 304, 312, 329, 0 },
153 { 1, 0, 0x40, 4, 1, 0, 0, 0, 0, 0, 256, 280, 315, 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, 0x273, 0x200, 0x11C, 1, 0, 0, 0 },
158 { { { CODES_END, 0 }, { CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
159};
160void (*stageFuncs[])(void) = {
162};
163#define EVENT_TEXT_FILE EXTRA_TEXT
165 { 1606, script1606, EVENT_TEXT(3), NULL, NULL },
166 { -1, NULL, 0, NULL, NULL },
167};
169 SCRIPT_WALK(2, 0x12F, 0x168, 3),
170 SCRIPT_POSE(0x20, 1, 7),
173 SCRIPT_POSE(2, 1, 3),
174 SCRIPT_WAIT(0x1E),
175 SCRIPT_TALK(0, 1, 0x20, 0),
177 SCRIPT_WAIT(0x1E),
178 SCRIPT_TALK(0, 2, 2, 2),
179 SCRIPT_POSE(2, 7, 3),
181 SCRIPT_POSE(2, 1, 3),
182 SCRIPT_WAIT(0x1E),
183 SCRIPT_TALK(0, 3, 0x20, 0),
185 SCRIPT_WAIT(0x1E),
186 SCRIPT_COMMAND(0x323, 0x325, 2),
187 SCRIPT_WAIT(0x5A),
188 SCRIPT_COMMAND(0x323, 0x326, 2),
189 SCRIPT_WAIT(0x1E),
190 SCRIPT_TALK(0, 4, 2, 2),
191 SCRIPT_POSE(2, 7, 3),
193 SCRIPT_POSE(2, 1, 3),
194 SCRIPT_WAIT(0x1E),
195 SCRIPT_POSE(2, 1, 0),
196 SCRIPT_WAIT(0x3C),
197 SCRIPT_COMMAND(0x356, 0x349, 2),
198 SCRIPT_WAIT(0x30),
199 SCRIPT_LEAVE(0x278, 0xC0, 0x158, 5),
201};
#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
#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.
#define EVENT_TEXT(n)
An entry of the stage's events' text file, for FieldEvent.text.
Definition stage.h:732
#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 FIELD_TASK_ACTOR
every character (FIELDSTG_createActor)
Definition field_map.h:26
#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 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_TASK_COMMANDS
script command 813 (FIELDSTG_startCommandTask): the field commands
Definition field_map.h:33
#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 START_EVENT(index)
action: FIELDSTG_startListedEvent
Definition game_state.h:81
#define CODES_END
Definition game_state.h:83
TaskRegistry TASK_REGISTRY
Definition registry.c:122
#define MUSIC_ADMIN_CENTER
KANRIBGM: the cities' Main Lobby, Admin Center, Digimon Arena, Master Room.
Definition sound.h:79
#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 SPECIAL_FOUR_LEADERS_FOUGHT
the European and Japanese versions: FLAG_CHINRON_LEADER_FOUGHT, FLAG_ZHU_QUE_LEADER_FOUGHT,...
Definition story.h:1976
#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
A character on the field (FIELDSTG_createActor): the player (kind 0) and the other characters.
Definition field_map.h:334
Vec2 pos
Definition field_map.h:336
A character of the field (FieldState.actors, a list of pointers up to NULL), which FIELDSTG_updateFie...
Definition field_map.h:194
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
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 map object with animation 1 and a frame counter.
Definition stage.h:376
void(* nextState)(struct StageTileTimer *task)
Definition stage.h:377
void(* setState)(struct StageTileTimer *task, s32 state)
Definition stage.h:377
StageTile * tile
Definition stage.h:378
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
void *(* find)(s32 id, s32 key1, s32 key2)
Definition task.h:18
TaskFuncs funcs
Definition task.h:76
Definition gfx.h:352
s32 y
Definition gfx.h:354
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
FieldActorEntry actor0
Definition wstag926.c:121
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Definition wstag926.c:160
u16 actor0Talk0Conditions[]
Definition wstag926.c:99
FieldTalk actor2Talks[]
Definition wstag926.c:117
void * createCommand854(s32 arg)
Command 854 of the event scripts: the lift that takes the player down to the Arena in event 1606 (upd...
Definition wstag926.c:81
u16 actor0Talk1Conditions[]
Definition wstag926.c:100
FieldActorEntry actor2
Definition wstag926.c:123
#define STAGE_FILE_8
Definition wstag926.c:16
FieldActorEntry * stageActors[]
Definition wstag926.c:124
u16 actor0Talk1Actions[]
Definition wstag926.c:105
FieldTalk actor0Talks[]
Definition wstag926.c:111
ActorImage stageImages[]
Definition wstag926.c:88
void setupStage(void)
Sets the stage up: its map, actors and events, playing KANRIBGM.
Definition wstag926.c:23
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
Definition wstag926.c:130
s16 script1606[]
Defined below, after the tables that use them.
Definition wstag926.c:168
u16 actor0Talk2Conditions[]
Definition wstag926.c:106
StageSlot stageSlots[]
Definition wstag926.c:156
void updateTileTimer(StageTileTimer *task)
Shows the map object with animation 1 and moves it and the player down a pixel a frame for 150 frames...
Definition wstag926.c:43
FieldActorEntry actor1
Definition wstag926.c:122
#define STAGE_FILE
Definition wstag926.c:15
#define STAGE_TEXT
Definition wstag926.c:14
FieldEvent stageEvents[]
Definition wstag926.c:164