-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathgame.h
359 lines (313 loc) · 7.58 KB
/
game.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
#ifndef GAME_H
#define GAME_H
#include "global.h"
#include "area.h"
#include "structures.h"
/**
* Change the light level of the room.
*
* @param level The new light level.
*/
void ChangeLightLevel(s32 level);
/**
* Set the dislayed popup state
*
* @param type The popup type.
* @param choice_idx The choice index.
*/
void SetPopupState(u32 type, u32 choice_idx);
/**
* Check if an area is overworld (not dungeon or inside).
*
* @param area The area to check.
* @return True if the area is overworld.
*/
bool32 CheckAreaOverworld(u32 area);
/**
* Check if the current area is overworld.
*
* @return True if the current area is overworld.
*/
bool32 AreaIsOverworld(void);
/**
* Check if the current area is a dungeon.
*
* @return True if the current area is a dungeon.
*/
bool32 AreaIsDungeon(void);
/**
* Check if the current area has enemies.
*
* @return True if the current area has enemies.
*/
bool32 AreaHasEnemies(void);
/**
* Check if the current area has no enemies.
*
* @return True if the current area has no enemies.
*/
bool32 AreaHasNoEnemies(void);
/**
* Check if the current area has a map
*
* @return True if the current area has a map.
*/
bool32 AreaHasMap(void);
/**
* Check if current area has keys.
*
* @return True if the current area has keys.
*/
bool32 AreaHasKeys(void);
#ifndef EU
/**
* This function was introduced to allow warping from indoor areas (palace of winds).
*
* @return True if the current area allows warping.
*/
u32 AreaAllowsWarp(void);
/**
* Related to a music bug?
*/
void sub_08052878(void);
#endif
/**
* Modify the number of keys the player has for the current dungeon.
*/
void ModDungeonKeys(s32 keys);
/**
* Check if the player has at least one small key for the current dungeon.
*
* @return True if the player has a small key.
*/
bool32 HasDungeonSmallKey(void);
/**
* Check if the player has the big key for the current dungeon.
*
* @return True if the player has the big key.
*/
bool32 HasDungeonBigKey(void);
/**
* Check if the player has the compass for the current dungeon.
*
* @return True if the player has the compass.
*/
bool32 HasDungeonCompass(void);
/**
* Check if the player has the map for the current dungeon.
*
* @return True if the player has the map.
*/
bool32 HasDungeonMap(void);
/**
* @brief Check if item is a sword.
*
* @param item The item to check.
* @return True if the item is a sword.
*/
bool32 ItemIsSword(u32 item);
/**
* Check if item is a shield.
*
* @return True if the item is a shield.
*/
bool32 ItemIsShield(u32 item);
/**
* @brief Get the index of the bottle containing the specified item.
*
* @param item The item to check.
* @return Bottle index, or 0 if the item is not in a bottle.
*/
u32 GetBottleContaining(u32 item);
/**
* Put an item in A or B slot.
*
* @param item The item to put.
*/
void PutItemOnSlot(u32 item);
/**
* Force equip an item.
*
* @param item The item to equip.
* @param slot The slot to equip the item in.
*/
void ForceEquipItem(u32 item, /*EquipSlot*/ u32 slot);
/**
* Get item price.
*
* @param item The item to get the price of.
* @return The price of the item.
*/
s32 GetItemPrice(u32 item);
/**
* Get the item purchase enquiry message.
*
* @param item The item to get the message for.
* @return The message index.
*/
u32 GetSaleItemConfirmMessageID(u32 item);
/**
* Automatically load overworld graphics groups.
*/
void LoadGfxGroups(void);
/**
* Load an auxiliary room (no player present).
*
* @param area Area index.
* @param room Room index.
*/
void LoadAuxiliaryRoom(u32 area, u32 room);
/**
* Initialize a loaded room.
*/
void InitRoom(void);
/**
* Initialize a parachute room.
*/
void InitParachuteRoom(void);
/**
* Register a manager for room changes.
*
* @param mgr Manager to register.
* @param onEnter Room enter callback.
* @param onExit Room exit callback.
*/
void RegisterTransitionManager(void* mgr, void (*onEnter)(void*), void (*onExit)(void*));
/**
* Call the room exit callback.
*/
void RoomExitCallback(void);
/**
* Restore the game task from a subtask.
*
* @param a1
*/
void RestoreGameTask(bool32 loadGfx);
/**
* Check if an Ezlo message can be displayed.
*
* @return True if an Ezlo message can be displayed.
*/
bool32 CanDispEzloMessage(void);
/**
* Display an Ezlo message.
*/
void DisplayEzloMessage(void);
/**
* Set the player's world map position.
*
* @param area Area index.
* @param room Room index.
* @param x X position.
* @param y Y position.
*/
void SetWorldMapPos(u32 area, u32 room, u32 x, u32 y);
/**
* Set the player's dungeon map position.
*
* @param area Area index.
* @param room Room index.
* @param x X position.
* @param y Y position.
*/
void SetDungeonMapPos(u32 area, u32 room, u32 x, u32 y);
/**
* Get flag bank offset for area
*
* @param idx Area index.
* @return Flag bank offset.
*/
u32 GetFlagBankOffset(u32 idx);
/**
* Retrieve information about the current room.
*
* @return RoomResInfo object.
*/
RoomResInfo* GetCurrentRoomInfo(void);
void sub_08052EA0(void);
void sub_08053250(void);
void sub_080533CC(void);
void StartDarkNutTimer(void);
void sub_080534AC(void);
void InitBiggoronTimer(void);
/** Game tasks states */
typedef enum {
GAMETASK_TRANSITION, /* transition from fileselect task */
GAMETASK_INIT,
GAMETASK_MAIN,
GAMETASK_EXIT, /* gameover task or reset */
} EGameTaskState;
/** game task main substates */
typedef enum {
GAMEMAIN_INITROOM,
GAMEMAIN_CHANGEROOM,
GAMEMAIN_UPDATE,
GAMEMAIN_CHANGEAREA,
GAMEMAIN_MINISHPORTAL, /* moments after viewing portal cutscene */
GAMEMAIN_BARRELUPDATE, /* barrel in deepwood shrine */
GAMEMAIN_RESERVED,
GAMEMAIN_SUBTASK,
} EGameMainState;
typedef struct {
u8 minX;
u8 minY;
u8 maxX;
u8 maxY;
u8 windcrestId; /**< Id to set in gSave.windcrests when the user entered a room in the boundaries specified above.*/
// u8 pad;
u16 textIndex; /**< The text to show for this area.*/
} OverworldLocation;
extern const OverworldLocation gOverworldLocations[];
typedef struct {
const Font* font;
u16 width;
u16 height;
u16 transitionTimer;
u16 fadeSpeed;
} struct_080FCCB4;
typedef struct {
u16 itemPrice;
u16 unused;
u16 saleItemConfirmMessageId;
u16 gotItemMessageId;
} struct_080FD964;
extern const struct_080FD964 gUnk_080FD964[];
// Defined in gameUtils.c
extern void ResetTmpFlags(void);
extern void UpdateFakeScroll(void);
extern void UpdatePlayerMapCoords(void);
extern void CreateMiscManager(void);
extern void CheckAreaDiscovery(void);
extern void UpdateTimerCallbacks(void);
extern void DecreasePortalTimer(void);
extern bool32 CheckRoomExit(void);
extern bool32 CheckGameOver(void);
extern void InitializePlayer(void);
extern void LoadRoomBgm(void);
extern void sub_0805329C(void);
extern void UpdatePlayerRoomStatus(void);
extern void sub_08054524(void);
extern void sub_08052FF4(u32 area, u32 room);
extern void InitScriptData(void);
extern void LoadItemGfx(void);
// Defined in playerUtils.c
extern void CloneMapData(void);
extern void InitializeCamera(void);
extern void ForceSetPlayerState(u32);
extern void sub_080186D4(void);
extern void sub_0806F364(void);
extern void UpdateRoomTracker(void);
extern void GenerateAreaHint(void);
extern void sub_0801AE44(bool32 loadGfx);
extern void sub_080ADE24(void);
extern void CleanUpGFXSlots(void);
void sub_08051F9C(u32 a1, u32 a2, u32 a3, u32 a4);
extern void UpdateBgAnimations(void);
extern void UpdateScroll(void);
extern void sub_08018710(u32);
extern void sub_0806F38C(void);
extern void sub_08052010(void);
void ModArrows(s32);
bool32 ItemIsBottle(u32);
void ModShells(s32);
#endif // GAME_H