forked from zeldaret/oot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathz64interface.h
281 lines (250 loc) · 9.77 KB
/
z64interface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
#ifndef Z64INTERFACE_H
#define Z64INTERFACE_H
#include "z64dma.h"
#include "z64view.h"
struct PlayState;
extern u8 _icon_item_staticSegmentRomStart[];
extern u8 _icon_item_24_staticSegmentRomStart[];
// An "item icon" (gItemIcon*Tex) is 32x32 rgba32
#define ITEM_ICON_WIDTH 32
#define ITEM_ICON_HEIGHT 32
#define ITEM_ICON_SIZE (ITEM_ICON_WIDTH * ITEM_ICON_HEIGHT * 4) // The size in bytes of an item icon
/**
* Get the VROM address of the item icon for the specified item.
*
* @param itemId An ItemId value in the range `ITEM_DEKU_STICK`..`ITEM_FISHING_POLE`
*/
#define GET_ITEM_ICON_VROM(itemId) ((uintptr_t)_icon_item_staticSegmentRomStart + ((itemId)*ITEM_ICON_SIZE))
// A "quest icon" (gQuestIcon*Tex) is 24x24 rgba32
#define QUEST_ICON_WIDTH 24
#define QUEST_ICON_HEIGHT 24
#define QUEST_ICON_SIZE (QUEST_ICON_WIDTH * QUEST_ICON_HEIGHT * 4) // The size in bytes of a quest icon
/**
* Get the VROM address of the quest icon for the specified item.
*
* @param itemId An ItemId value in the range `ITEM_MEDALLION_FOREST`..`ITEM_MAGIC_JAR_BIG`
*/
#define GET_QUEST_ICON_VROM(itemId) \
((uintptr_t)_icon_item_24_staticSegmentRomStart + (((itemId)-ITEM_MEDALLION_FOREST) * QUEST_ICON_SIZE))
typedef enum DoAction {
/* 0x00 */ DO_ACTION_ATTACK,
/* 0x01 */ DO_ACTION_CHECK,
/* 0x02 */ DO_ACTION_ENTER,
/* 0x03 */ DO_ACTION_RETURN,
/* 0x04 */ DO_ACTION_OPEN,
/* 0x05 */ DO_ACTION_JUMP,
/* 0x06 */ DO_ACTION_DECIDE,
/* 0x07 */ DO_ACTION_DIVE,
/* 0x08 */ DO_ACTION_FASTER,
/* 0x09 */ DO_ACTION_THROW,
/* 0x0A */ DO_ACTION_NONE, // in do_action_static, the texture at this position is NAVI, however this value is in practice the "No Action" value
/* 0x0B */ DO_ACTION_CLIMB,
/* 0x0C */ DO_ACTION_DROP,
/* 0x0D */ DO_ACTION_DOWN,
/* 0x0E */ DO_ACTION_SAVE,
/* 0x0F */ DO_ACTION_SPEAK,
/* 0x10 */ DO_ACTION_NEXT,
/* 0x11 */ DO_ACTION_GRAB,
/* 0x12 */ DO_ACTION_STOP,
/* 0x13 */ DO_ACTION_PUTAWAY,
/* 0x14 */ DO_ACTION_REEL,
/* 0x15 */ DO_ACTION_1,
/* 0x16 */ DO_ACTION_2,
/* 0x17 */ DO_ACTION_3,
/* 0x18 */ DO_ACTION_4,
/* 0x19 */ DO_ACTION_5,
/* 0x1A */ DO_ACTION_6,
/* 0x1B */ DO_ACTION_7,
/* 0x1C */ DO_ACTION_8,
/* 0x1D */ DO_ACTION_MAX
} DoAction;
// TODO extract this information from the texture definitions themselves
#define DO_ACTION_TEX_WIDTH 48
#define DO_ACTION_TEX_HEIGHT 16
#define DO_ACTION_TEX_SIZE ((DO_ACTION_TEX_WIDTH * DO_ACTION_TEX_HEIGHT) / 2) // (sizeof(gCheckDoActionENGTex))
typedef struct InterfaceContext {
/* 0x0000 */ View view;
/* 0x0128 */ Vtx* actionVtx;
/* 0x012C */ Vtx* beatingHeartVtx;
/* 0x0130 */ u8* parameterSegment;
/* 0x0134 */ u8* doActionSegment;
/* 0x0138 */ u8* iconItemSegment;
/* 0x013C */ u8* mapSegment;
/* 0x0140 */ u8 mapPalette[32];
/* 0x0160 */ DmaRequest dmaRequest_160;
/* 0x0180 */ DmaRequest dmaRequest_180;
/* 0x01A0 */ char unk_1A0[0x20];
/* 0x01C0 */ OSMesgQueue loadQueue;
/* 0x01D8 */ OSMesg loadMsg;
/* 0x01DC */ Viewport viewport;
/* 0x01EC */ s16 unk_1EC;
/* 0x01EE */ u16 unk_1EE;
/* 0x01F0 */ u16 unk_1F0;
/* 0x01F4 */ f32 unk_1F4;
/* 0x01F8 */ s16 naviCalling;
/* 0x01FA */ s16 unk_1FA;
/* 0x01FC */ s16 unk_1FC;
/* 0x01FE */ s16 heartColorOscillator;
/* 0x0200 */ s16 heartColorOscillatorDirection;
/* 0x0202 */ s16 beatingHeartPrim[3];
/* 0x0208 */ s16 beatingHeartEnv[3];
/* 0x020E */ s16 heartsPrimR[2];
/* 0x0212 */ s16 heartsPrimG[2];
/* 0x0216 */ s16 heartsPrimB[2];
/* 0x021A */ s16 heartsEnvR[2];
/* 0x021E */ s16 heartsEnvG[2];
/* 0x0222 */ s16 heartsEnvB[2];
/* 0x0226 */ s16 unk_226; // Used only in unused functions
/* 0x0228 */ s16 unk_228; // Used only in unused functions
/* 0x022A */ s16 beatingHeartOscillator;
/* 0x022C */ s16 beatingHeartOscillatorDirection;
/* 0x022E */ s16 unk_22E;
/* 0x0230 */ s16 lensMagicConsumptionTimer; // When lens is active, 1 unit of magic is consumed every time the timer reaches 0
/* 0x0232 */ s16 counterDigits[4]; // used for key and rupee counters
/* 0x023A */ u8 numHorseBoosts;
/* 0x023C */ u16 unk_23C;
/* 0x023E */ u16 hbaAmmo; // ammo while playing the horseback archery minigame
/* 0x0240 */ u16 unk_240;
/* 0x0242 */ u16 unk_242;
/* 0x0224 */ u16 unk_244; // screen fill alpha?
/* 0x0246 */ u16 aAlpha; // also carrots alpha
/* 0x0248 */ u16 bAlpha; // also HBA score alpha
/* 0x024A */ u16 cLeftAlpha;
/* 0x024C */ u16 cDownAlpha;
/* 0x024E */ u16 cRightAlpha;
/* 0x0250 */ u16 healthAlpha; // also max C-Up alpha
/* 0x0252 */ u16 magicAlpha; // also Rupee and Key counters alpha
/* 0x0254 */ u16 minimapAlpha;
/* 0x0256 */ s16 startAlpha;
/* 0x0258 */ s16 unk_258;
/* 0x025A */ s16 unk_25A;
/* 0x025C */ s16 mapRoomNum;
/* 0x025E */ s16 mapPaletteIndex; // "map_palete_no"
/* 0x0260 */ u8 unk_260;
/* 0x0261 */ u8 unk_261;
struct {
/* 0x0262 */ u8 hGauge; // "h_gage"; unknown?
/* 0x0263 */ u8 bButton; // "b_button"
/* 0x0264 */ u8 aButton; // "a_button"
/* 0x0265 */ u8 bottles; // "c_bottle"
/* 0x0266 */ u8 tradeItems; // "c_warasibe"
/* 0x0267 */ u8 hookshot; // "c_hook"
/* 0x0268 */ u8 ocarina; // "c_ocarina"
/* 0x0269 */ u8 warpSongs; // "c_warp"
/* 0x026A */ u8 sunsSong; // "m_sunmoon"
/* 0x026B */ u8 farores; // "m_wind"
/* 0x026C */ u8 dinsNayrus; // "m_magic"; din's fire and nayru's love
/* 0x026D */ u8 all; // "another"; enables all item restrictions
} restrictions;
} InterfaceContext; // size = 0x270
/**
* Button HUD positions and colors
*/
#define A_BUTTON_X 186
#define A_BUTTON_Y 9
#if !PLATFORM_GC
#define A_BUTTON_R 90
#define A_BUTTON_G 90
#define A_BUTTON_B 255
#else
#define A_BUTTON_R 0
#define A_BUTTON_G 200
#define A_BUTTON_B 50
#endif
#define B_BUTTON_X 160
#define B_BUTTON_Y 17
#if !PLATFORM_GC
#define B_BUTTON_R 0
#define B_BUTTON_G 150
#define B_BUTTON_B 0
#else
#define B_BUTTON_R 255
#define B_BUTTON_G 30
#define B_BUTTON_B 30
#endif
#define C_LEFT_BUTTON_X 227
#define C_LEFT_BUTTON_Y 18
#define C_DOWN_BUTTON_X 249
#define C_DOWN_BUTTON_Y 34
#define C_RIGHT_BUTTON_X 271
#define C_RIGHT_BUTTON_Y 18
#define C_UP_BUTTON_X 254
#define C_UP_BUTTON_Y 16
#if !PLATFORM_GC
#define START_BUTTON_R 200
#define START_BUTTON_G 0
#define START_BUTTON_B 0
#else
#define START_BUTTON_R 120
#define START_BUTTON_G 120
#define START_BUTTON_B 120
#endif
/**
* These are the colors for the hearts in the interface. The prim color is the red color of the heart
* for the base hearts, while the prim color for the double defense hearts is the white outline. The
* env color for the base hearts is the purple-ish outline, while the env color for the double defense
* hearts is the red color of the hearts.
*/
#define HEARTS_PRIM_R 255
#define HEARTS_PRIM_G 70
#define HEARTS_PRIM_B 50
#define HEARTS_ENV_R 50
#define HEARTS_ENV_G 40
#define HEARTS_ENV_B 60
#define HEARTS_DD_PRIM_R 255
#define HEARTS_DD_PRIM_G 255
#define HEARTS_DD_PRIM_B 255
#define HEARTS_DD_ENV_R 200
#define HEARTS_DD_ENV_G 0
#define HEARTS_DD_ENV_B 0
/**
* The burn and drown colors listed here are unused. Prerelease footage of the game confirms that at one
* point in development the orange color was to be used while taking damage from hot environments.
* Based on this, we can assume that the blue heart color was to be used while drowning.
* In the final game these environments only have a timer and do not damage you continuously.
*/
#define HEARTS_BURN_PRIM_R 255
#define HEARTS_BURN_PRIM_G 190
#define HEARTS_BURN_PRIM_B 0
#define HEARTS_BURN_ENV_R 255
#define HEARTS_BURN_ENV_G 0
#define HEARTS_BURN_ENV_B 0
#define HEARTS_DROWN_PRIM_R 100
#define HEARTS_DROWN_PRIM_G 100
#define HEARTS_DROWN_PRIM_B 255
#define HEARTS_DROWN_ENV_R 0
#define HEARTS_DROWN_ENV_G 0
#define HEARTS_DROWN_ENV_B 255
void Interface_ChangeHudVisibilityMode(u16 hudVisibilityMode);
void Interface_SetSceneRestrictions(struct PlayState* play);
void Inventory_SwapAgeEquipment(void);
void Interface_InitHorsebackArchery(struct PlayState* play);
void func_800849EC(struct PlayState* play);
void Interface_LoadItemIcon1(struct PlayState* play, u16 button);
void Interface_LoadItemIcon2(struct PlayState* play, u16 button);
void func_80084BF4(struct PlayState* play, u16 flag);
u8 Item_Give(struct PlayState* play, u8 item);
u8 Item_CheckObtainability(u8 item);
void Inventory_DeleteItem(u16 item, u16 invSlot);
s32 Inventory_ReplaceItem(struct PlayState* play, u16 oldItem, u16 newItem);
s32 Inventory_HasEmptyBottle(void);
s32 Inventory_HasSpecificBottle(u8 bottleItem);
void Inventory_UpdateBottleItem(struct PlayState* play, u8 item, u8 button);
s32 Inventory_ConsumeFairy(struct PlayState* play);
void Interface_SetDoAction(struct PlayState* play, u16 action);
void Interface_SetNaviCall(struct PlayState* play, u16 naviCallState);
void Interface_LoadActionLabelB(struct PlayState* play, u16 action);
s32 Health_ChangeBy(struct PlayState* play, s16 amount);
void Rupees_ChangeBy(s16 rupeeChange);
void Inventory_ChangeAmmo(s16 item, s16 ammoChange);
void Magic_Fill(struct PlayState* play);
void Magic_Reset(struct PlayState* play);
s32 Magic_RequestChange(struct PlayState* play, s16 amount, s16 type);
void Interface_SetSubTimer(s16 seconds);
void Interface_SetSubTimerToFinalSecond(struct PlayState* play);
void Interface_SetTimer(s16 seconds);
void Interface_Draw(struct PlayState* play);
void Interface_Update(struct PlayState* play);
void Interface_Destroy(struct PlayState* play);
void Interface_Init(struct PlayState* play);
#endif