Decompile z_map_exp.c (2 non matchings left) (#104)

Also documented the map data table (not decompiled yet however), and added a DungeonItem enum to use with gSaveContext.dungeonItems reads/writes.
This commit is contained in:
Roman971
2020-05-01 17:09:20 +02:00
committed by GitHub
parent 9f1c996db5
commit 9f98210488
36 changed files with 894 additions and 1998 deletions
+9 -12
View File
@@ -922,7 +922,7 @@ void func_800788CC(u16 sfxId);
void func_80078914(Vec3f* arg0, u16 sfxId);
void Health_InitData(GlobalContext* globalCtx);
void Health_UpdateData(GlobalContext* globalCtx);
void Interface_DrawHealth(GlobalContext* globalCtx);
void Health_Draw(GlobalContext* globalCtx);
void Health_HandleCriticalAlarm(GlobalContext* globalCtx);
void Lights_InitPositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue,
s16 radius, u32 type);
@@ -994,17 +994,14 @@ s16 func_800800F8(GlobalContext* globalCtx, s16 arg1, s16 arg2, Actor* actor, s1
// ? func_800803F0(?);
// ? func_80080480(?);
void func_80080788(UNK_TYPE, UNK_TYPE);
// ? func_800807A0(?);
// ? func_800807FC(?);
// ? func_800808FC(?);
// ? func_80080AB4(?);
// ? func_80080E04(?);
// ? func_80080F44(?);
void func_80080F68(GlobalContext* globalCtx);
// ? func_80081240(?);
void Interface_DrawMinimap(GlobalContext* globalCtx);
// ? func_80082248(?);
void func_8008226C(GlobalContext* globalCtx);
void Map_SavePlayerInitialInfo(GlobalContext* globalCtx);
void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor);
void Map_InitData(GlobalContext* globalCtx, s16 room);
void Map_InitRoomData(GlobalContext* globalCtx, s16 room);
void Map_Destroy(GlobalContext* globalCtx);
void Map_Init(GlobalContext* globalCtx);
void Minimap_Draw(GlobalContext* globalCtx);
void Map_Update(GlobalContext* globalCtx);
void Interface_ChangeAlpha(u16 alphaType);
void Interface_SetSceneRestrictions(GlobalContext* globalCtx);
void Inventory_SwapAgeEquipment(void);
+13
View File
@@ -69,8 +69,21 @@
#define R_MAGIC_BAR_LARGE_Y XREG(50)
#define R_MAGIC_FILL_X XREG(51)
#define R_B_LABEL_DD WREG(0)
#define R_OW_MINIMAP_X WREG(29)
#define R_OW_MINIMAP_Y WREG(30)
#define R_MINIMAP_TOGGLED WREG(31)
#define R_B_LABEL_X(i) WREG(40 + i)
#define R_B_LABEL_Y(i) WREG(43 + i)
#define R_DGN_MINIMAP_X WREG(68)
#define R_DGN_MINIMAP_Y WREG(69)
#define R_MAP_INDEX VREG(11)
#define R_MAP_TEX_INDEX_BASE VREG(12)
#define R_MAP_TEX_INDEX VREG(13)
#define R_COMPASS_SCALE_X VREG(14)
#define R_COMPASS_SCALE_Y VREG(15)
#define R_COMPASS_OFFSET_X VREG(16)
#define R_COMPASS_OFFSET_Y VREG(17)
#define R_MINIMAP_COLOR(i) VREG(18 + i)
#define R_ITEM_AMMO_X(i) VREG(64 + i)
#define R_ITEM_AMMO_Y(i) VREG(68 + i)
#define R_ITEM_ICON_WIDTH(i) VREG(76 + i)
+3 -8
View File
@@ -36,7 +36,7 @@ extern u32 D_03012B20;
//extern ? D_04003238;
extern u32 D_04004298;
//extern ? D_04006020;
//extern ? D_0400C820;
extern Gfx D_0400C820[];
extern u32 D_0400CB70;
extern u32 D_04010130;
//extern ? D_04015720;
@@ -421,12 +421,7 @@ extern s16 D_80120130;
//extern ? D_8012396C;
//extern ? D_80123978;
//extern ? D_801239D4;
//extern ? D_80123A50;
//extern ? D_80123A54;
//extern ? D_80123A58;
//extern ? D_80123A5C;
//extern ? D_80123A60;
//extern ? D_801257F8;
extern MapData gMapDataTable;
//extern ? D_80125870;
extern s16 gSpoilingItems[3];
extern s16 gSpoilingItemReverts[3];
@@ -3443,7 +3438,7 @@ extern u8 D_8015FD70;
//extern ? D_8015FDAE;
//extern ? D_8015FDB0;
//extern ? D_8015FDF8;
//extern ? D_8015FFD0;
extern MapData* gMapData;
//extern ? D_80160001;
//extern ? D_80160004;
//extern ? D_80160005;
+42 -14
View File
@@ -59,8 +59,8 @@ typedef struct {
/* 0x08 */ u32 clear;
/* 0x0C */ u32 collect;
/* 0x10 */ u32 unk;
/* 0x14 */ u32 rooms1;
/* 0x18 */ u32 rooms2;
/* 0x14 */ u32 rooms;
/* 0x18 */ u32 floors;
} SaveSceneFlags; // size = 0x1C
typedef struct {
@@ -186,7 +186,7 @@ typedef struct {
/* 0x13F6 */ s16 unk_13F6;
/* 0x13F8 */ s16 unk_13F8;
/* 0x13FA */ u16 eventInf[4]; // "event_inf"
/* 0x1402 */ u16 dungeonIndex;
/* 0x1402 */ u16 mapIndex; // intended for maps/minimaps but commonly used as the dungeon index
/* 0x1404 */ u16 minigameState;
/* 0x1406 */ u16 minigameScore; // "yabusame_total"
/* 0x1408 */ char unk_1408[0x0001];
@@ -439,13 +439,6 @@ typedef struct {
/* 0x016A */ s16 unk_16A; // unknown if used
} Camera; // size = 0x16C
typedef struct {
/* 0x0000 */ Camera cameras[4];
/* 0x05B0 */ Camera* cameraPtrs[4];
/* 0x05C0 */ s16 activeCamera;
/* 0x05C2 */ s16 nextCamera;
} CameraContext; // size = 0x5C4
typedef struct {
/* 0x00 */ u8 musicSeq;
/* 0x01 */ u8 nighttimeSFX;
@@ -631,7 +624,7 @@ typedef struct {
/* 0x0134 */ void* do_actionSegment;
/* 0x0138 */ void* icon_itemSegment;
/* 0x013C */ void* mapSegment;
/* 0x0140 */ char unk_140[0x20];
/* 0x0140 */ u8 unk_140[32];
/* 0x0160 */ DmaRequest dmaRequest_160;
/* 0x0180 */ DmaRequest dmaRequest_180;
/* 0x01A0 */ char unk_1A0[0x20];
@@ -673,9 +666,10 @@ typedef struct {
/* 0x0252 */ u16 magicAlpha; // also Rupee and Key counters alpha
/* 0x0254 */ u16 minimapAlpha;
/* 0x0256 */ s16 startAlpha;
/* 0x0258 */ char unk_258[0x004];
/* 0x025C */ s16 roomNum;
/* 0x025E */ char unk_25E[0x002];
/* 0x0258 */ s16 unk_258;
/* 0x025A */ s16 unk_25A;
/* 0x025C */ s16 mapRoomNum;
/* 0x025E */ s16 mapPaletteNum; // "map_palete_no"
/* 0x0260 */ u8 unk_260;
/* 0x0261 */ u8 unk_261;
struct {
@@ -1202,6 +1196,40 @@ typedef struct PreNMIContext {
/* 0xA8 */ UNK_TYPE unk_A8;
} PreNMIContext; // size = 0xAC
// All arrays pointed in this struct are indexed by "map indexes"
// In dungeons, the map index corresponds to the dungeon index (which also indexes keys, items, etc)
// In overworld areas, the map index corresponds to the overworld area index (spot 00, 01, etc)
typedef struct {
/* 0x00 */ s16 (*floorTexIndexOffset)[8]; // dungeon texture index offset by floor
/* 0x04 */ s16* bossFloor; // floor the boss is on
/* 0x08 */ s16 (*roomPalette)[32]; // map palette by room
/* 0x0C */ s16* maxPaletteCount; // max number of palettes in a same floor
/* 0x10 */ s16 (*paletteRoom)[8][14]; // room by palette by floor
/* 0x14 */ s16 (*roomCompassOffsetX)[44]; // dungeon compass icon X offset by room
/* 0x18 */ s16 (*roomCompassOffsetY)[44]; // dungeon compass icon Y offset by room
/* 0x1C */ u8* dgnMinimapCount; // number of room minimaps
/* 0x20 */ u16* dgnMinimapTexIndexOffset; // dungeon minimap texture index offset
/* 0x24 */ u16* owMinimapTexSize;
/* 0x28 */ u16* owMinimapTexOffset;
/* 0x2C */ s16* owMinimapPosX;
/* 0x30 */ s16* owMinimapPosY;
/* 0x34 */ s16 (*owCompassInfo)[4]; // [X scale, Y scale, X offset, Y offset]
/* 0x38 */ s16* dgnMinimapTexIndexBase; // dungeon minimap texture index base
/* 0x3C */ s16 (*dgnCompassInfo)[4]; // [X scale, Y scale, X offset, Y offset]
/* 0x40 */ s16* owMinimapWidth;
/* 0x44 */ s16* owMinimapHeight;
/* 0x48 */ s16* owEntranceIconPosX; // "dungeon entrance" icon X pos
/* 0x4C */ s16* owEntranceIconPosY; // "dungeon entrance" icon Y pos
/* 0x50 */ u16* owEntranceFlag; // flag in inf_table[26] based on which entrance icons are shown (0xFFFF = always shown)
/* 0x54 */ f32 (*floorCoordY)[8]; // Y coordinate of each floor
/* 0x58 */ u16* switchEntryCount; // number of "room switch" entries, which correspond to the next 3 arrays
/* 0x5C */ u8 (*switchFromRoom)[51]; // room to come from
/* 0x60 */ u8 (*switchFromFloor)[51]; // floor to come from
/* 0x64 */ u8 (*switchToRoom)[51]; // room to go to
/* 0x68 */ UNK_PTR unk_68;
/* 0x6C */ UNK_PTR unk_6C;
} MapData; // size = 0x70
typedef struct {
/* 0x00 */ s8 chestFlag; // chest icon is only displayed if this flag is not set for the current room
/* 0x01 */ u8 x, y; // coordinates to place the icon (top-left corner), relative to the minimap texture
+6
View File
@@ -47,6 +47,12 @@ typedef enum {
/* 0x18 */ QUEST_HEART_PIECE
} QuestItem;
typedef enum {
/* 0x00 */ DUNGEON_KEY_BOSS,
/* 0x01 */ DUNGEON_COMPASS,
/* 0x02 */ DUNGEON_MAP
} DungeonItem;
typedef enum {
/* 0x00 */ SLOT_STICK,
/* 0x01 */ SLOT_NUT,