Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
title.c
Go to the documentation of this file.
1/* The title screen's task, which runs its parts; its images; and the panels'
2 fades */
3
4#include "menus/title.h"
5
6/* Once the fade out ends, starts the chosen mode; returns 1 then */
8 s32 left = 0;
9
10 if (children->fade->isDone(children->fade)) {
11 switch (task->choice) {
12 case 0:
13 break;
14 case 1:
15 left = 1;
21 break;
22 case 2:
23 left = 1;
28 break;
29 case 3:
30#if VERSION_US
32#elif VERSION_EU || VERSION_JP
33 if (LANGUAGE == 0) {
36 } else {
38 }
39 } else {
41 }
42#endif
43 left = 1;
44 break;
45 }
46 }
47 return left;
48}
49
50/* Brings in the titles, the glint, the logo and the menu, then waits for an
51 option; returns 1 once the chosen mode starts */
53 s32 left = 0;
54
55 switch (task->substate) {
56 case 0:
57 default:
58 children->title0->show(children->title0);
59 children->title1->show(children->title1);
60 task->timer = 0;
61 task->setSubstate(task, 2);
62 break;
63 case 1:
64 if (task->timer++ >= 0) {
65 task->timer = 0;
66 children->title1->show(children->title1);
67 task->nextSubstate(task);
68 }
69 break;
70 case 2:
71 if (task->timer >= 10) {
72 task->timer = 0;
74 children->glint->show(children->glint);
75 task->nextSubstate(task);
76 }
77 task->timer += GFX.funcs.getFrameTime();
78 break;
79 case 3:
80 if (task->timer >= 12) {
81 task->timer = 0;
82 task->nextSubstate(task);
83 }
84 task->timer += GFX.funcs.getFrameTime();
85 break;
86 case 4:
87 if (task->timer >= 12) {
88 task->timer = 0;
89 children->logo->show(children->logo);
90 task->nextSubstate(task);
91 }
92 task->timer += GFX.funcs.getFrameTime();
93 break;
94 case 5:
95 if (task->timer >= 12) {
96 task->timer = 0;
97 children->menu->show(children->menu);
98 children->background->animate(children->background);
99 task->nextSubstate(task);
100 }
101 task->timer += GFX.funcs.getFrameTime();
102 break;
103 case 6:
104 task->choice = children->menu->getChoice(children->menu);
105 if (task->choice != 0) {
106 task->nextSubstate(task);
107 children->fade = STDWTITL_startEdgeFadeTask();
108 if (task->choice == 1) {
109#if VERSION_US || VERSION_JP
110 FILE_CACHE.request(0x158);
111#elif VERSION_EU
112 FILE_CACHE.request(0x166);
113#endif
114 }
115 }
116 break;
117 case 7:
118 children->fade->start(children->fade);
119 task->nextSubstate(task);
120 break;
121 case 8:
122 left = STDWTITL_leaveTitle(task, children);
123 break;
124 }
125 return left;
126}
127
128/* The title screen's task: creates its background, title parts, glint, logo and
129 menu (the Alt ones for the European version's language 0), then runs it until an option
130 is taken or it times out; stops the title music when killed */
132 switch (task->state) {
133 case TASK_INIT:
134 default:
135 task->nextState(task);
137#if VERSION_US
138 children->title0 = STDWTITL_startTitle0Task(0);
139 children->title1 = STDWTITL_startTitle1Task(0);
140 children->glint = STDWTITL_startGlintTask(0);
141 children->logo = STDWTITL_startLogoTask(0);
142 children->menu = STDWTITL_startMenuTask(0);
143#elif VERSION_EU || VERSION_JP
144 if (LANGUAGE == 0) {
145 children->title0 = STDWTITL_startTitle0AltTask(0);
146 children->title1 = STDWTITL_startTitle1AltTask(0);
147 children->logo = STDWTITL_startLogoTask(0);
148 children->glint = STDWTITL_startGlintAltTask(0);
149 children->menu = STDWTITL_startMenuTask(0);
150 } else {
151 children->title0 = STDWTITL_startTitle0Task(0);
152 children->title1 = STDWTITL_startTitle1Task(0);
153 children->glint = STDWTITL_startGlintTask(0);
154 children->logo = STDWTITL_startLogoTask(0);
155 children->menu = STDWTITL_startMenuTask(0);
156 }
157#endif
158 task->timer = 0;
159 break;
160 case TASK_RUN:
161 if (STDWTITL_stepTitle(task, children)) {
162 task->setState(task, TASK_KILL);
163 }
164 break;
165 case TASK_DONE:
166 break;
167 case TASK_KILL:
169 break;
170 }
171}
172
173/* Creates the title screen (task), under its title loader parent */
176
178 task->depth = 2;
179 task->parent = parent;
180 return task;
181}
182
183/* Loads the title's images to VRAM: the sprites (by the language in the European
184 version) and the background's four TIM archives */
186 TimLoader loader;
187
188 initTimLoader(&loader);
189#if VERSION_US
190 loader.setImagePos(0x280, 0);
191 loader.setClutPos(0, 0x1F0);
194#elif VERSION_EU || VERSION_JP
195 loader.setImagePos(0x280, STDWTITL_TEXTURE_Y);
196 loader.setClutPos(0, 0x1F0);
199#endif
200 loader.setClutPos(0, 0x1F3);
201 loader.setImagePos(0x300, 0);
203 loader.setImagePos(0x340, 0);
205 loader.setImagePos(0x380, 0);
207 loader.setImagePos(0x3C0, 0);
209}
210
TitleBackgroundTask * STDWTITL_startBackgroundTask(s32 skip)
Creates the title screen's background (task); skip is not used.
Definition background.c:139
signed int s32
Definition common.h:11
TitleImages STDWTITL_titleImages[]
The title's TIM archives and sprite banks; the European version picks one by the language.
Definition title.c:81
s32 STDWTITL_spriteBank
Definition title.c:72
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
EdgeFadeTask * STDWTITL_startEdgeFadeTask(void)
Creates the fade out from the screen's edges (task), once an option is chosen.
Definition edge_fade.c:93
GameState GAME
The save data, the game mode and the methods.
Definition state.c:64
#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
s32 LANGUAGE
The European version's settings, in the small data (.sdata) between file/file_table....
Definition eu_settings.c:13
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
#define MODE_NEW_GAME
Game modes (GameState: mode >> 8 is the overlay) that more than their own overlay asks for.
Definition game_state.h:429
#define MODE_OPENING_2
STDWTITL's second opening movie: LANGUAGE 0 alternates the two, the others play only it.
Definition game_state.h:444
#define MODE_CONTINUE
STGMCARD, to load a game.
Definition game_state.h:436
#define MODE_OPENING
STDWTITL's first movie.
Definition game_state.h:439
GlintTask * STDWTITL_startGlintTask(s32 skip)
Creates the title screen's glint (task); skip: lit from the start.
Definition glint.c:151
GlintTask * STDWTITL_startGlintAltTask(s32 skip)
Creates the title screen's glint (task) for the European version's language 0.
Definition glint.c:75
BattleSetup BATTLE_SETUP
Definition items.c:886
LogoTask * STDWTITL_startLogoTask(s32 skip)
Creates the title screen's logo (task); skip: shown complete from the start.
Definition logo.c:92
MemCardFuncs MEMCARD_FUNCS
Definition memcard.c:468
TitleMenuTask * STDWTITL_startMenuTask(s16 skip)
Creates the title screen's menu (task); skip: the two options shown from the start.
Definition menu.c:209
SlideTask * STDWTITL_startTitle0AltTask(s32 skip)
Creates the first part of the title (task) for the European version's language 0.
Definition slides.c:203
SlideTask * STDWTITL_startTitle1AltTask(s32 skip)
Creates the second part of the title (task) for the European version's language 0.
Definition slides.c:68
SlideTask * STDWTITL_startTitle1Task(s32 skip)
Creates the second part of the title (task)
Definition slides.c:130
SlideTask * STDWTITL_startTitle0Task(s32 skip)
Creates the first part of the title (task)
Definition slides.c:265
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
Definition sound.c:180
void(* clearGauges)(void)
Definition game_state.h:392
s32(* isDone)(struct EdgeFadeTask *task)
Definition title.h:199
void(* start)(struct EdgeFadeTask *task)
Definition title.h:198
void(* request)(s32 file)
Definition file.h:90
void *(* getEntry)(u32 fileAndIndex)
Definition file.h:96
void(* resetPlayTime)()
Definition game_state.h:39
void(* requestMode)(s32 mode, s32 arg)
Definition game_state.h:21
s32(* getPrevMode)()
Definition game_state.h:23
void(* newGame)()
Definition game_state.h:17
GameFuncs funcs
Definition game_state.h:582
s32(* getFrameTime)(void)
Definition gfx.h:32
GfxFuncs funcs
Definition gfx.h:77
void(* show)(struct GlintTask *task)
Definition title.h:145
void(* show)(struct LogoTask *task)
Definition title.h:132
void(* setFileName)(void)
Definition memcard.h:112
void(* show)(struct SlideTask *task)
Definition title.h:158
void(* stopSound)(s32 id)
Definition sound.h:195
short(* playSound)(s32 id)
returns the voice of a key-on
Definition sound.h:187
Uploads TIM images to VRAM (initTimLoader); acts on TIM_LOADER.
Definition gfx.h:325
void(* setClutPos)()
(x, y)
Definition gfx.h:337
void(* setImagePos)()
(x, y)
Definition gfx.h:336
void(* loadArchive)()
(archive): each image 64 halfwords to the right
Definition gfx.h:338
void(* animate)(struct TitleBackgroundTask *task)
Definition title.h:224
SlideTask * title1
Definition title.h:235
TitleBackgroundTask * background
Definition title.h:240
GlintTask * glint
Definition title.h:234
EdgeFadeTask * fade
Definition title.h:228
LogoTask * logo
Definition title.h:238
TitleMenuTask * menu
Definition title.h:239
SlideTask * title0
Definition title.h:236
s32 sprites
sprite bank
Definition title.h:255
s32 images
TIM archive.
Definition title.h:254
The title screen.
Definition title.h:111
void(* show)(struct TitleMenuTask *task)
Definition title.h:182
s32(* getChoice)(struct TitleMenuTask *task)
Definition title.h:184
void(* nextState)(struct TitleTask *task)
Definition title.h:244
s32 state
Definition title.h:244
s32 depth
Definition title.h:249
void(* setSubstate)(struct TitleTask *task, s32 substate)
Definition title.h:244
s32 layerId
Definition title.h:248
s32 timer
Definition title.h:246
s32 substate
Definition title.h:244
void(* setState)(struct TitleTask *task, s32 state)
Definition title.h:244
TitleLoaderTask * parent
Definition title.h:245
void(* nextSubstate)(struct TitleTask *task)
Definition title.h:244
s32 choice
Definition title.h:247
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
Definition task.c:105
void initTimLoader(TimLoader *obj)
Clears a TIM loader, gives it its methods and binds it.
Definition tim_loader.c:119
s32 STDWTITL_leaveTitle(TitleTask *task, TitleChildren *children)
Once the fade out ends, starts the chosen mode; returns 1 then.
Definition title.c:7
s32 STDWTITL_stepTitle(TitleTask *task, TitleChildren *children)
Brings in the titles, the glint, the logo and the menu, then waits for an option; returns 1 once the ...
Definition title.c:52
void STDWTITL_loadTitleImages(void)
Loads the title's images to VRAM: the sprites (by the language in the European version) and the backg...
Definition title.c:185
TitleTask * STDWTITL_startTitleTask(TitleLoaderTask *parent)
Creates the title screen (task), under its title loader parent.
Definition title.c:174
void STDWTITL_tickTitle(TitleTask *task, TitleChildren *children)
The title screen's task: creates its background, title parts, glint, logo and menu (the Alt ones for ...
Definition title.c:131
STDWTITL.PRO: the title screen, the opening movies and a notice screen.
#define STDWTITL_TEXTURE_Y
The VRAM row of the title's sprites (SpriteDrawer.setTexture)
Definition title.h:49
#define STDWTITL_TITLE_LAYER
Definition title.h:30
#define STDWTITL_BACKGROUND(entry)
Definition title.h:43
#define STDWTITL_TITLE_MUSIC
Definition title.h:54