Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
welcome.c
Go to the documentation of this file.
1/* The welcome message the screen opens with */
2
3#include "menus/player_name.h"
4
5/* The welcome's task: brings its panel in through the CLUT rows, types the
6 welcome text (cross turns the pages, an arrow after it blinks while it
7 waits), then takes the panel out the same way and ends */
9 SpriteDrawer sprite;
10
11 switch (task->state) {
12 case TASK_INIT:
13 default:
14 windows->text = createTextWindow(0x1001, 1, 0x42, 0x3B);
15 windows->text->setLines(windows->text, 3);
16 windows->arrow = createTextWindow(0x1001, 1, 0x42, 0x3B);
17 task->nextState(task);
18 task->setSubstate(task, 1);
19 windows->arrow->setString(windows->arrow, FILE_CACHE.load(TEXT_FILE(TEXT_ONLINE)), 2);
20 windows->arrow->setPalette(windows->arrow, PALETTE_BLUE);
21 windows->arrow->setVisible(windows->arrow, 0);
22 windows->text->setTypeSound(windows->text, 0x800454C4);
23 task->step = GFX.funcs.getTime();
24 break;
25 case TASK_RUN:
26 switch (task->substate) {
27 case 1:
28 default:
29 if (GFX.funcs.getTime() - task->step > 5) {
30 task->step = GFX.funcs.getTime();
31 task->clutRow++;
32 if (task->clutRow >= 4) {
33 task->clutRow = 3;
34 task->setSubstate(task, 2);
35 task->step = GFX.funcs.getTime();
36 windows->text->setString(windows->text, FILE_CACHE.load(TEXT_FILE(TEXT_ONLINE)), 1);
37 windows->text->setPalette(windows->text, PALETTE_BLUE);
38 windows->text->setTypeDelay(windows->text, 6);
39 windows->arrow->setVisible(windows->arrow, 1);
40 }
41 }
42 break;
43 case 2:
44 if (windows->text->isFinished(windows->text) != 0) {
45 task->setSubstate(task, 3);
46 task->step = GFX.funcs.getTime();
47 task->clutRow = 4;
48 windows->arrow->setVisible(windows->arrow, 0);
49 windows->text->setVisible(windows->text, 0);
50 break;
51 }
52 windows->arrow->setPos(windows->arrow, windows->text->cursorX + 0x42, windows->text->cursorY + 0x3B);
53 if (windows->text->isWaitingForButton(windows->text) != 0) {
54 if (windows->arrow->isVisible(windows->arrow) != 0) {
55 if (GFX.funcs.getTime() - task->step > 16) {
56 task->step = GFX.funcs.getTime();
57 windows->arrow->setVisible(windows->arrow, 0);
58 }
59 } else if (GFX.funcs.getTime() - task->step > 8) {
60 task->step = GFX.funcs.getTime();
61 windows->arrow->setVisible(windows->arrow, 1);
62 }
63 } else {
64 windows->arrow->setVisible(windows->arrow, 1);
65 task->step = GFX.funcs.getTime();
66 }
68 windows->text->showPage(windows->text);
69 }
70 break;
71 case 3:
72 if (GFX.funcs.getTime() - task->step > 5) {
73 task->clutRow++;
74 if (task->clutRow >= 8) {
75 task->clutRow = 7;
76 task->setState(task, TASK_KILL);
77 }
78 }
79 break;
80 }
81 initSpriteDrawer(&sprite);
82 sprite.setLayerId(0x1001, 5);
83 sprite.setTexture(0x280, 0x100);
84 sprite.draw(FILE_CACHE.getEntry(PLNMET_MENU), 0x38, 0x4B, 0xB8);
85 sprite.setClutRow(task->clutRow);
86 sprite.draw(FILE_CACHE.getEntry(PLNMET_MENU), 0xF, 0x38, 0x2F);
87 break;
88 case TASK_DONE:
89 case TASK_KILL:
90 break;
91 }
92}
93
94/* Creates the welcome (task), the first thing the screen shows */
97
98 task->screen = screen;
99 return task;
100}
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
#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
#define TEXT_FILE(file)
Definition file.h:190
#define TEXT_ONLINE
NAMEET: the Digimon Online registration.
Definition file.h:220
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
#define PAD_CROSS
Definition pad.h:31
#define PAD_PRESSED(button)
One button of pad 1: newly pressed, auto-repeated while held, or held.
Definition pad.h:140
STPLNMET.PRO: the player's name entry (MODE_PLAYER_NAME).
#define PLNMET_MENU
sprite bank
Definition player_name.h:36
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
void *(* load)(u32 file)
Definition file.h:92
void *(* getEntry)(u32 fileAndIndex)
Definition file.h:96
s32(* getTime)(void)
Definition gfx.h:31
GfxFuncs funcs
Definition gfx.h:77
TextWindow * arrow
follows the text, blinks while it waits
Definition player_name.h:78
TextWindow * text
Definition player_name.h:77
The welcome to Digimon Online and its registration (STPLNMET_createWelcome)
Definition player_name.h:69
void(* setState)(struct NameDialog *task, s32 state)
Definition player_name.h:70
void(* nextState)(struct NameDialog *task)
Definition player_name.h:70
void(* setSubstate)(struct NameDialog *task, s32 substate)
Definition player_name.h:70
struct PlayerNameScreen * screen
Definition player_name.h:71
The main task of the screen (STPLNMET_createScreen)
Definition player_name.h:82
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
Definition gfx.h:223
void(* setLayerId)()
(id, depth)
Definition gfx.h:244
void(* setClutRow)()
(row)
Definition gfx.h:247
void(* draw)()
(sheet, frame, x, y)
Definition gfx.h:246
void(* setTexture)()
(x, y)
Definition gfx.h:242
s32(* isWaitingForButton)()
Definition text.h:188
s16 cursorX
Definition text.h:147
void(* setPalette)(struct TextWindow *obj, u8 arg)
Definition text.h:174
s32(* isFinished)()
s32: callers don't truncate the result to a byte
Definition text.h:186
s32(* isVisible)()
s32: callers don't truncate the result to a byte
Definition text.h:187
void(* setTypeSound)()
Definition text.h:180
void(* setTypeDelay)()
Definition text.h:172
void(* setLines)()
no prototype: callers would truncate u8 args
Definition text.h:184
u16 cursorY
Definition text.h:148
void(* setPos)(struct TextWindow *obj, s16 x, s16 y)
Definition text.h:173
void(* setString)()
Definition text.h:165
void(* showPage)()
Definition text.h:170
void(* setVisible)(struct TextWindow *obj, u8 arg)
Definition text.h:177
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
Definition task.c:105
#define PALETTE_BLUE
a light blue: what is highlighted or current
Definition text.h:113
TextWindow * createTextWindow(s16 layerId, s16 style, s16 x, s16 y)
A text window on a layer, in a font style, at (x, y)
void STPLNMET_updateWelcome(NameDialog *task, NameDialogWindows *windows)
The welcome's task: brings its panel in through the CLUT rows, types the welcome text (cross turns th...
Definition welcome.c:8
NameDialog * STPLNMET_createWelcome(PlayerNameScreen *screen)
Creates the welcome (task), the first thing the screen shows.
Definition welcome.c:95