Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
country_select.h
Go to the documentation of this file.
1#ifndef CNTY_SEL_H
2#define CNTY_SEL_H
3
4/*
5 * CNTY_SEL.PRO: the country select screen.
6 *
7 * A background scrolls diagonally, three panels open one after the other and
8 * a highlighted option blinks until Start is pressed. Then the option flashes,
9 * the panels close, the screen fades to black and the game moves on to
10 * MODE_OPENING. The USA version doesn't store the choice; the European one
11 * sets the language from it (LANGUAGE), and moves on to MODE_OPENING_2 for
12 * any language but 0.
13 */
14
15#include "engine/game.h"
16
17/*
18 * The screen's tasks use the engine states (task.h); the owner sets TASK_DONE
19 * to make a task fade out, flash, or open/close its panel.
20 */
21
22/* The screen's file, read with FILE_CACHE.getEntry: the discs number
23 their files differently */
24#if VERSION_US || VERSION_JP
25#define CNTY_SEL_FILE 0x892
26#elif VERSION_EU
27#define CNTY_SEL_FILE 0x8A3
28#endif
29#define CNTY_SEL_SPRITES (CNTY_SEL_FILE << 16) /* sprite bank */
30#define CNTY_SEL_IMAGES (CNTY_SEL_FILE << 16 | 1) /* TIM archive for VRAM */
31
32/* Sprites in the sprite bank */
33#define SPRITE_BACKGROUND 0
34#define SPRITE_RIGHT_PANEL 1
35#define SPRITE_TOP_PANEL 2
36#define SPRITE_LEFT_PANEL 3
37#define SPRITE_OPTIONS 4 /* one per option */
38
39/* Draw layer of the screen */
40#define CNTY_SEL_LAYER 0x100
41
42/* Sounds (SOUND.playSound) */
43#define CNTY_SEL_SOUND_BANK 0x21
44#define CNTY_SEL_MUSIC MUSIC(0x21, 2)
45
46/* A linear tween of a panel's scale */
47typedef struct PanelTween {
48 /* 0x0 */ s32 duration;
49 /* 0x4 */ s16 to;
50 /* 0x6 */ s16 from;
52
53typedef struct LeftPanelTween {
54 /* 0x0 */ s32 duration;
55 /* 0x4 */ s16 to;
56 /* 0x6 */ s16 from;
57 /* 0x8 */ s32 pad; /* 0 in both tweens; never read: the tweens are 0xC bytes apart */
59
60/* The scrolling background, which also fades the screen out */
66
67/* The highlighted option */
68typedef struct CursorTask {
70 /* 0x50 */ s32 blink;
71 /* 0x54 */ s16 selection;
72 /* 0x56 */ s16 frame;
73 /* 0x58 */ AnimState anim;
74 /* 0x5C */ void (*setSelection)(struct CursorTask *task, s16 selection);
76
77/* A panel that opens and closes by scaling */
78typedef struct PanelTask {
80 /* 0x50 */ s16 phase; /* 0: opening, 1: closing */
81 /* 0x52 */ s16 time;
82 /* 0x54 */ s16 scaleX;
83 /* 0x56 */ s16 scaleY;
84} PanelTask;
85
86typedef struct MenuChildren {
87 /* 0x00 */ CursorTask *cursor;
88 /* 0x04 */ PanelTask *rightPanel;
89 /* 0x08 */ PanelTask *topPanel;
90 /* 0x0C */ PanelTask *leftPanel;
93
94/* The screen's controller */
100
101/* CountryMenuTask substates (Task.substate) in TASK_RUN */
118
119extern RECT CNTY_SEL_screenRect;
120extern RECT CNTY_SEL_vramRect;
121extern RECT CNTY_SEL_fadeRect;
126#if VERSION_EU
127extern u8 CNTY_SEL_languages[];
128#endif
129
130void CNTY_SEL_tickScreen(Task *task, CountryMenuTask **menu);
133void CNTY_SEL_drawFade(s32 level);
136s16 CNTY_SEL_stepAnimation(AnimState *anim, AnimFrame *frames, s32 depth);
138void CNTY_SEL_setCursorSelection(CursorTask *task, s16 selection);
153void CNTY_SEL_tickMenu(CountryMenuTask *task, MenuChildren *children);
155
156#endif /* CNTY_SEL_H */
signed int s32
Definition common.h:11
signed short s16
Definition common.h:9
unsigned char u8
Definition common.h:8
CountryMenuTask * CNTY_SEL_startMenuTask(void)
Creates the screen's controller (task), which starts the background and panels.
PanelTask * CNTY_SEL_startLeftPanelTask(void)
Creates the left panel (task), closed.
void CNTY_SEL_setCursorSelection(CursorTask *task, s16 selection)
Moves the highlight to option selection (CursorTask.setSelection)
s32 CNTY_SEL_getTopPanelScale(PanelTask *task, s32 phase)
The top panel's height scale on the current frame of its opening (phase 0) or closing (1)
void CNTY_SEL_tickTopPanel(PanelTask *task)
The top panel's task: draws it; each TASK_DONE from the controller opens it, the next one closes it.
PanelTask * CNTY_SEL_startTopPanelTask(void)
Creates the top panel (task), closed.
PanelTween CNTY_SEL_rightPanelTweens[]
MenuStep
CountryMenuTask substates (Task.substate) in TASK_RUN.
@ MENU_FADE_OUT
@ MENU_WAIT_FLASH
@ MENU_OPEN_RIGHT_PANEL
@ MENU_SELECT
@ MENU_CLOSE_PANELS
@ MENU_WAIT_LEFT_PANEL
@ MENU_OPEN_LEFT_PANEL
@ MENU_OPEN_TOP_PANEL
@ MENU_SHOW_CURSOR
@ MENU_EXIT
@ MENU_WAIT_FADE
@ MENU_WAIT_PANELS
@ MENU_WAIT_RIGHT_PANEL
@ MENU_WAIT_TOP_PANEL
s32 CNTY_SEL_getRightPanelScale(PanelTask *task, s32 phase)
The right panel's width scale on the current frame of its opening (phase 0) or closing (1)
RECT CNTY_SEL_screenRect
void CNTY_SEL_drawLeftPanel(PanelTask *task)
Draws the left panel, with its own CLUT, its width scaled from the screen's left edge.
void CNTY_SEL_tickRightPanel(PanelTask *task)
The right panel's task: draws it; each TASK_DONE from the controller opens it, the next one closes it...
void CNTY_SEL_tickBackground(CountryBackgroundTask *task)
The background's task: scrolls and draws it; when done, keeps it scrolling while the screen fades to ...
void CNTY_SEL_tickMenu(CountryMenuTask *task, MenuChildren *children)
The screen's controller: opens the panels one after the other and lets the player pick an option with...
PanelTask * CNTY_SEL_startRightPanelTask(void)
Creates the right panel (task), closed.
void CNTY_SEL_drawTopPanel(PanelTask *task)
Draws the top panel, its height scaled from its top edge.
u8 CNTY_SEL_languages[]
The language of each option.
void CNTY_SEL_drawBackground(CountryBackgroundTask *task)
Draws the background, moved diagonally by half its scroll.
CountryBackgroundTask * CNTY_SEL_startBackgroundTask(void)
Creates the scrolling background (task)
s32 CNTY_SEL_getFadeLevel(s32 time)
How dark the fade-out is on its frame time: 0 to 255 over 30 frames.
void CNTY_SEL_tickCursor(CursorTask *task)
The highlighted option's task: blinks it through 8 CLUT rows, 4 frames each; when done (Start pressed...
void CNTY_SEL_drawFade(s32 level)
Darkens the whole screen by level (0 to 255, 255 is black)
RECT CNTY_SEL_vramRect
s16 CNTY_SEL_stepAnimation(AnimState *anim, AnimFrame *frames, s32 depth)
Advances anim by the frames elapsed and returns the frame to show (0xFF at the end)
s32 CNTY_SEL_getLeftPanelScale(PanelTask *task, s32 phase)
The left panel's width scale on the current frame of its opening (phase 0) or closing (1)
CursorTask * CNTY_SEL_startCursorTask(void)
Creates the highlighted option (task), once the panels are open.
void CNTY_SEL_drawRightPanel(PanelTask *task)
Draws the right panel, its width scaled from the screen's right edge.
void CNTY_SEL_drawCursor(CursorTask *task)
Draws the highlighted option, in the colors of the CLUT row of its current frame.
void CNTY_SEL_tickLeftPanel(PanelTask *task)
The left panel's task: draws it; each TASK_DONE from the controller opens it, the next one closes it.
PanelTween CNTY_SEL_topPanelTweens[]
Opening (0) and closing (1) tweens of each panel's scale.
AnimFrame CNTY_SEL_cursorFlash[]
Sprite frames of the chosen option once Start is pressed.
void CNTY_SEL_tickScreen(Task *task, CountryMenuTask **menu)
The mode's root task: once the sound bank is loaded, sets up the display and the layer,...
LeftPanelTween CNTY_SEL_leftPanelTweens[]
RECT CNTY_SEL_fadeRect
A little larger than the screen.
#define TASK_HEADER(Type)
Definition task.h:39
One frame of a sprite animation; frame 0xFF ends it (or loops it)
Definition gfx.h:296
The scrolling background, which also fades the screen out.
The screen's controller.
The highlighted option.
AnimState anim
void(* setSelection)(struct CursorTask *task, s16 selection)
s32 pad
0 in both tweens; never read: the tweens are 0xC bytes apart
PanelTask * rightPanel
PanelTask * topPanel
CountryBackgroundTask * background
CursorTask * cursor
PanelTask * leftPanel
A panel that opens and closes by scaling.
s16 phase
0: opening, 1: closing
A linear tween of a panel's scale.
Any task, seen through its header.
Definition task.h:62