Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
menu.h
Go to the documentation of this file.
1#ifndef DW3_MENU_H
2#define DW3_MENU_H
3
4/* The inn and the field menu (menu/) */
5
6#include "common.h"
7#include <sys/types.h>
8#include <libgte.h>
9#include <libgpu.h>
10#include "engine/task.h"
11#include "engine/gfx.h"
12#include "engine/text.h"
13
14/*
15 * Opens or closes a menu panel: level goes 0 -> ONE in `duration` frames
16 * (or back at twice the speed), and the panel is drawn scaled by it.
17 */
24
25/* Moves a value towards a target in fixed point, as the menu overlays'
26 startLerp and updateLerp do */
27typedef struct MenuLerp {
28 /* 0x00 */ s32 duration;
29 /* 0x04 */ s32 pad4; /* never read or written */
30 /* 0x08 */ s32 value;
31 /* 0x0C */ s32 fixed; /* value << 8 */
32 /* 0x10 */ s32 target;
33 /* 0x14 */ s32 step;
34 /* 0x18 */ s32 active;
35} MenuLerp;
36
37/* A vertical scroll bar, as the menu overlays (STSTATUS, STGDGLAB) draw one */
38typedef struct ScrollBar {
40 /* 0x50 */ s32 layer;
41 /* 0x54 */ s32 depth;
42 /* 0x58 */ s32 x;
43 /* 0x5C */ s32 y;
44 /* 0x60 */ s32 width;
45 /* 0x64 */ s32 size; /* of the thumb, in fixed point */
46 /* 0x68 */ s32 hasCount;
47 /* 0x6C */ s32 pageSize;
48 /* 0x70 */ s32 count;
49 /* 0x74 */ s32 pos;
50 /* 0x78 */ s32 hasRange;
51 /* 0x7C */ s32 top;
52 /* 0x80 */ s32 bottom;
53 /* 0x84 */ s32 pad84; /* never read or written */
54 /* 0x88 */ s32 posStep; /* fixed point */
55 /* 0x8C */ void (*setX)(struct ScrollBar *bar, s32 x, s32 width);
56 /* 0x90 */ void (*setRange)(struct ScrollBar *bar, s32 top, s32 bottom);
57 /* 0x94 */ void (*setCount)(struct ScrollBar *bar, s32 pageSize, s32 count);
58 /* 0x98 */ void (*setPos)(struct ScrollBar *bar, s32 pos);
59} ScrollBar;
60
61/*
62 * The inn: pay INNS[inn].price per party member to restore HP, MP and
63 * status, with a fade to black and a jingle. `step` is set when the money
64 * is not enough.
65 */
66typedef struct Inn {
68 /* 0x50 */ s32 layerId;
69 /* 0x54 */ s32 depth;
70 /* 0x58 */ s32 inn;
71 /* 0x5C */ s32 choice; /* 0 yes, 1 no */
72 /* 0x60 */ s32 count; /* party members */
73 /* 0x64 */ s32 music;
74 /* 0x68 */ s32 time;
75 /* 0x6C */ PanelAnim panels[3];
76} Inn;
77
78typedef struct InnChildren {
79 /* 0x00 */ struct ScreenFade *fade;
80 /* 0x04 */ TextWindow *windows[6];
81 /* 0x1C */ Cursor *cursor;
83
84/* One party member in the field menu: name and five stats */
85typedef struct PartnerPage {
86 /* 0x00 */ TextWindow *name;
87 /* 0x04 */ TextWindow *labels[5];
88 /* 0x18 */ TextWindow *values[5];
90
91/* The children of the field menu */
92typedef struct FieldMenuWindows {
93 /* 0x00 */ TextWindow *title;
95 /* 0x08 */ TextWindow *money;
96 /* 0x0C */ TextWindow *options[6];
97 /* 0x24 */ struct Cursor *cursor;
98 /* 0x28 */ PartnerPage pages[3];
100
101/* Where a window goes, and the string it shows */
102typedef struct WindowPos {
103 /* 0x0 */ s32 string;
104 /* 0x4 */ s16 x;
105 /* 0x6 */ s16 pad6; /* 0 in every layout; nothing reads it */
106 /* 0x8 */ s16 y;
107} WindowPos;
108
109/*
110 * The menu opened on the field: the three party members' pages, a list of
111 * options (FIELD_MENU_OPTIONS, one more when the player has item 0x192)
112 * and the money. Picking an option switches to MODE_STATUS with the choice
113 * in FIELD_MENU_CHOICE; from MODE_STATUS, cancelling goes back to
114 * GAME.fieldMode. `step` tells whether a mode change follows (0) or not.
115 */
116typedef struct FieldMenu {
118 /* 0x50 */ s32 layerId;
119 /* 0x54 */ s32 depth;
120 /* 0x58 */ s32 cursor;
121 /* 0x5C */ s32 count;
122 /* 0x60 */ s32 extraOption;
123 /* 0x64 */ s32 option2Enabled;
124 /* 0x68 */ s32 fadeRow;
125 /* 0x6C */ s32 time;
126 /* 0x70 */ PanelAnim panels[3];
127} FieldMenu;
128
129/* What the field menu picked, for STSTATUS (MODE_STATUS) */
130typedef struct FieldMenuChoice {
131 /* 0x0 */ s32 option;
132 /* 0x4 */ s32 extra; /* the list had the extra option: STSTATUS_screens' row */
134
136
137void innStartPanel(PanelAnim *panel, s32 open);
139void healParty(void);
140void updateInnMenu(Inn *task, InnChildren *data);
141void updateInn(struct Inn *task, struct InnChildren *data);
142Inn *createInn(s32 layerId);
143void startPanel(PanelAnim *panel, s32 open);
146void showPartnerPage(void *menu, FieldMenuWindows *win, s32 page, s32 show);
147s32 getFieldZone(void);
149FieldMenu *createFieldMenu(s32 layerId, s32 cursor);
150
151#endif /* DW3_MENU_H */
signed int s32
Definition common.h:11
signed short s16
Definition common.h:9
s32 updatePanel(PanelAnim *panel)
Advances a panel animation; 1 once it has finished.
Definition field_menu.c:21
void showPartnerPage(void *menu, FieldMenuWindows *win, s32 page, s32 show)
Fills a party member's page of the field menu (name and five stats), or hides it.
Definition field_menu.c:87
void updateInnMenu(Inn *task, InnChildren *data)
The inn's menu (INN_*): open the panels and ask (price x party size), then close, pay and sleep,...
Definition inn.c:158
s32 innUpdatePanel(PanelAnim *panel)
Moves a panel's level one frame on; 1 once it is fully open or closed.
Definition inn.c:36
void innStartPanel(PanelAnim *panel, s32 open)
Starts opening or closing a menu panel, with its sound.
Definition inn.c:22
s32 getFieldZone(void)
The field's stages by mode: -1 from MODE_NEW_GAME (where the field menu greys out option 2),...
Definition field_menu.c:124
Inn * createInn(s32 layerId)
Starts the inn of the current game mode on a layer.
Definition inn.c:343
void createFieldMenuWindows(FieldMenu *task, FieldMenuWindows *win)
Creates the field menu's windows: the title, the options, the cursor, the money and the pages.
Definition field_menu.c:59
FieldMenu * createFieldMenu(s32 layerId, s32 cursor)
Opens the field menu on a layer with the cursor on an option.
Definition field_menu.c:426
FieldMenuChoice FIELD_MENU_CHOICE
menu/field_menu.c's
Definition game_bss.c:21
void startPanel(PanelAnim *panel, s32 open)
Starts opening (open != 0) or closing a panel.
Definition field_menu.c:7
void updateInn(struct Inn *task, struct InnChildren *data)
The inn task: creates its windows, then runs the menu and draws the panels at their levels.
Definition inn.c:266
void healParty(void)
Restores HP, MP and status of the party (the inn)
Definition inn.c:56
void updateFieldMenu(FieldMenu *task, FieldMenuWindows *win)
Runs the field menu: opens its panels, moves the cursor and switches mode on a choice.
Definition field_menu.c:324
The task system and its registry (task/)
#define TASK_HEADER(Type)
Definition task.h:39
long open(char *name, unsigned long mode)
The kernel's file functions (libapi.h); the sim: device is the PC's.
Display, drawing layers, the drawing helpers and the screen fade (gfx/)
A menu cursor: a text window showing one of the CURSOR_FRAMES glyphs.
Definition text.h:19
What the field menu picked, for STSTATUS (MODE_STATUS)
Definition menu.h:130
s32 extra
the list had the extra option: STSTATUS_screens' row
Definition menu.h:132
The children of the field menu.
Definition menu.h:92
PartnerPage pages[3]
Definition menu.h:98
TextWindow * options[6]
Definition menu.h:96
TextWindow * title
Definition menu.h:93
TextWindow * moneyLabel
Definition menu.h:94
struct Cursor * cursor
Definition menu.h:97
TextWindow * money
Definition menu.h:95
The menu opened on the field: the three party members' pages, a list of options (FIELD_MENU_OPTIONS,...
Definition menu.h:116
s32 option2Enabled
Definition menu.h:123
PanelAnim panels[3]
Definition menu.h:126
s32 extraOption
Definition menu.h:122
s32 fadeRow
Definition menu.h:124
s32 layerId
Definition menu.h:118
s32 depth
Definition menu.h:119
s32 time
Definition menu.h:125
s32 count
Definition menu.h:121
s32 cursor
Definition menu.h:120
TextWindow * windows[6]
Definition menu.h:80
struct ScreenFade * fade
Definition menu.h:79
Cursor * cursor
Definition menu.h:81
The inn: pay INNS[inn].price per party member to restore HP, MP and status, with a fade to black and ...
Definition menu.h:66
s32 choice
0 yes, 1 no
Definition menu.h:71
s32 count
party members
Definition menu.h:72
s32 inn
Definition menu.h:70
s32 depth
Definition menu.h:69
s32 layerId
Definition menu.h:68
PanelAnim panels[3]
Definition menu.h:75
s32 music
Definition menu.h:73
s32 time
Definition menu.h:74
Moves a value towards a target in fixed point, as the menu overlays' startLerp and updateLerp do.
Definition menu.h:27
s32 active
Definition menu.h:34
s32 pad4
never read or written
Definition menu.h:29
s32 target
Definition menu.h:32
s32 value
Definition menu.h:30
s32 fixed
value << 8
Definition menu.h:31
s32 step
Definition menu.h:33
s32 duration
Definition menu.h:28
Opens or closes a menu panel: level goes 0 -> ONE in duration frames (or back at twice the speed),...
Definition menu.h:18
s32 step
Definition menu.h:20
s32 level
Definition menu.h:21
s32 active
Definition menu.h:22
s32 duration
Definition menu.h:19
One party member in the field menu: name and five stats.
Definition menu.h:85
TextWindow * values[5]
Definition menu.h:88
TextWindow * labels[5]
Definition menu.h:87
TextWindow * name
Definition menu.h:86
Fades the whole screen to black and back with a subtractive rectangle.
Definition gfx.h:361
A vertical scroll bar, as the menu overlays (STSTATUS, STGDGLAB) draw one.
Definition menu.h:38
s32 pos
Definition menu.h:49
void(* setCount)(struct ScrollBar *bar, s32 pageSize, s32 count)
Definition menu.h:57
s32 layer
Definition menu.h:40
void(* setPos)(struct ScrollBar *bar, s32 pos)
Definition menu.h:58
s32 top
Definition menu.h:51
s32 pageSize
Definition menu.h:47
void(* setRange)(struct ScrollBar *bar, s32 top, s32 bottom)
Definition menu.h:56
s32 pad84
never read or written
Definition menu.h:53
s32 size
of the thumb, in fixed point
Definition menu.h:45
s32 hasRange
Definition menu.h:50
s32 depth
Definition menu.h:41
s32 width
Definition menu.h:44
s32 count
Definition menu.h:48
s32 posStep
fixed point
Definition menu.h:54
s32 bottom
Definition menu.h:52
s32 hasCount
Definition menu.h:46
s32 y
Definition menu.h:43
s32 x
Definition menu.h:42
void(* setX)(struct ScrollBar *bar, s32 x, s32 width)
Definition menu.h:55
A text window (createTextWindow): up to six text buffers (0 is shown, 1-5 are "work" buffers that con...
Definition text.h:131
Where a window goes, and the string it shows.
Definition menu.h:102
s16 y
Definition menu.h:106
s16 pad6
0 in every layout; nothing reads it
Definition menu.h:105
s32 string
Definition menu.h:103
s16 x
Definition menu.h:104
Text windows, the cursor, the message and talk boxes, the font and the text helpers (text/)