diff --git a/assets/xml/code/z_map_disp.xml b/assets/xml/code/z_map_disp.xml new file mode 100644 index 0000000000..e165feb4ee --- /dev/null +++ b/assets/xml/code/z_map_disp.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/gameplay_dangeon_keep.xml b/assets/xml/objects/gameplay_dangeon_keep.xml index 493290604f..b4c92432df 100644 --- a/assets/xml/objects/gameplay_dangeon_keep.xml +++ b/assets/xml/objects/gameplay_dangeon_keep.xml @@ -5,7 +5,11 @@ - + + + + + diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 831dff61e7..49b2eacb92 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -880,7 +880,7 @@ - + @@ -908,7 +908,7 @@ - + @@ -1296,7 +1296,7 @@ - + @@ -1312,7 +1312,7 @@ - + diff --git a/assets/xml/overlays/ovl_En_Mm2.xml b/assets/xml/overlays/ovl_En_Mm2.xml index 81457d8499..979b8fc5a2 100644 --- a/assets/xml/overlays/ovl_En_Mm2.xml +++ b/assets/xml/overlays/ovl_En_Mm2.xml @@ -1,7 +1,7 @@ - + diff --git a/assets/xml/overlays/ovl_Oceff_Wipe7.xml b/assets/xml/overlays/ovl_Oceff_Wipe7.xml index 682bd0c982..4a49fedcb9 100644 --- a/assets/xml/overlays/ovl_Oceff_Wipe7.xml +++ b/assets/xml/overlays/ovl_Oceff_Wipe7.xml @@ -1,6 +1,6 @@ - + diff --git a/include/functions.h b/include/functions.h index b9e5b8e51e..eb6aadf293 100644 --- a/include/functions.h +++ b/include/functions.h @@ -226,114 +226,6 @@ void GetItem_Draw(PlayState* play, s16 drawId); u16 QuestHint_GetTatlTextId(PlayState* play); -// void func_80102E40(void); -// void func_80102E90(void); -// void func_80102EA4(void); -void func_80102EB4(u32 param_1); -void func_80102ED0(u32 param_1); -s32 func_80102EF0(PlayState* play); -// void func_80102F9C(void); -// void func_80103090(void); -// void func_801030B4(void); -// void func_801030F4(void); -// void func_801031D0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_801039EC(void); -// void func_80103A10(void); -// void func_80103A58(void); -// void func_8010439C(void); -// void func_801045AC(void); -// void func_80104AE8(void); -// void func_80104C80(void); -void func_80104CF4(PlayState* play); -// void func_80104F34(void); -s32 func_80105294(void); -s16 func_80105318(void); -// void func_80105328(void); -// void func_8010534C(void); -void func_8010549C(PlayState* play, void* segmentAddress); -void func_8010565C(PlayState* play, u8 num, void* segmentAddress); -void func_80105818(PlayState* play, u32 uParm2, TransitionActorEntry* puParm3); -void func_80105A40(PlayState* play); -void func_80105B34(PlayState* play); -void func_80105C40(s16 arg0); -// void func_80105FE0(void); -// void func_80106408(void); -// void func_80106450(void); -// void func_801064CC(void); -s32 func_80106530(PlayState* play); -// void func_8010657C(void); -void func_80106644(PlayState* play, s16 arg1, s16 arg2, s16 arg3); -// void func_8010683C(void); -// void func_801068B4(void); -// void func_801068D8(void); -void* func_801068FC(PlayState* play, void* arg1, size_t size); -// void func_80106BEC(void); -// void func_80106D08(void); -// void func_80106D5C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -// void func_80107B78(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_80108124(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_80108558(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -// void func_80108A10(void); -// void func_80108A64(void); -void func_80108AF8(PlayState* play); -s32 func_801090B0(s32 arg0); -s32 func_80109124(s16 arg0); -void func_801091F0(PlayState* play); -void func_80109428(PlayState* play); -// void func_801094A0(void); -// void func_801094C8(void); -// void func_801094F8(void); -// void func_80109528(void); -// void func_8010954C(void); -// void func_8010956C(void); -// void func_8010958C(void); -// void func_801095AC(void); -// void func_801095DC(void); -// void func_8010960C(void); -// void func_80109630(void); -// void func_80109650(void); -// void func_80109670(void); -// void func_801096D4(void); -// void func_80109714(void); -// void func_80109754(void); -// void func_801097C8(void); -// void func_8010983C(void); -// void func_801098A0(void); -// void func_80109908(void); -// UNK_TYPE4 func_80109964(s32 param_1); -// void func_8010997C(void); -// void func_801099AC(void); -// void func_801099DC(void); -// void func_80109A00(void); -// void func_80109A20(void); -// void func_80109A40(void); -// void func_80109A98(void); -// void func_80109AD8(void); -// void func_80109B38(void); -// void func_80109BA0(void); -// void func_80109BF4(void); -// void func_80109C38(void); -// void func_80109CBC(void); -// void func_80109D40(void); -// void func_80109DD8(void); -// void func_80109E70(void); -// void func_80109EF8(void); -// void func_80109F78(void); -s32 Map_GetDungeonOrBossAreaIndex(PlayState* play); -s32 Map_IsInDungeonOrBossArea(PlayState* play); -s32 func_8010A0A4(PlayState* play); -// void Map_GetDungeonAreaIndex(PlayState* play); -// void Map_IsInDungeonArea(PlayState* play); -// void Map_GetBossAreaIndex(PlayState* play); -// void Map_IsInBossArea(PlayState* play); -// void func_8010A238(PlayState* play); -// void func_8010A2AC(PlayState* play); -void Minimap_SavePlayerRoomInitInfo(PlayState* play); -void Map_InitRoomData(PlayState* play, s16 room); -void Map_Destroy(PlayState* play); -void Map_Init(PlayState* play); -void Minimap_Draw(PlayState* play); -void Map_Update(PlayState* play); f32 OLib_Vec3fDist(Vec3f* a, Vec3f* b); f32 OLib_Vec3fDistOutDiff(Vec3f* a, Vec3f* b, Vec3f* dest); f32 OLib_Vec3fDistXZ(Vec3f* a, Vec3f* b); diff --git a/include/regs.h b/include/regs.h index ea0a853874..a8a584fcce 100644 --- a/include/regs.h +++ b/include/regs.h @@ -146,7 +146,7 @@ extern RegEditor* gRegEditor; #define R_MOON_CRASH_TIMER_X XREG(81) #define R_PAUSE_OWL_WARP_ALPHA XREG(87) #define R_STORY_FILL_SCREEN_ALPHA XREG(91) -#define R_REVERSE_FLOOR_INDEX XREG(94) +#define R_PLAYER_FLOOR_REVERSE_INDEX XREG(94) // stores what floor the player is on #define R_MINIMAP_DISABLED XREG(95) #define R_ENV_LIGHT1_DIR(i) cREG(3 + (i)) diff --git a/include/z64.h b/include/z64.h index 0123ae2f9a..b0884e7948 100644 --- a/include/z64.h +++ b/include/z64.h @@ -110,7 +110,7 @@ typedef struct PlayState { /* 0x17104 */ AnimationContext animationCtx; /* 0x17D88 */ ObjectContext objectCtx; /* 0x186E0 */ RoomContext roomCtx; - /* 0x18760 */ DoorContext doorCtx; + /* 0x18760 */ TransitionActorList transitionActors; /* 0x18768 */ void (*playerInit)(Player* player, struct PlayState* play, FlexSkeletonHeader* skelHeader); /* 0x1876C */ void (*playerUpdate)(Player* player, struct PlayState* play, Input* input); /* 0x18770 */ void (*unk_18770)(struct PlayState* play, Player* player); diff --git a/include/z64interface.h b/include/z64interface.h index c83630cbf1..518927dd29 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -178,7 +178,7 @@ typedef struct { /* 0x274 */ s16 minimapAlpha; /* 0x276 */ s16 startAlpha; /* 0x278 */ s16 unk_278; - /* 0x27A */ s16 dungeonOrBossAreaMapIndex; + /* 0x27A */ s16 dungeonSceneIndex; /* 0x27C */ s16 mapRoomNum; /* 0x27E */ u8 unk_27E; /* 0x27F */ u8 unk_27F; diff --git a/include/z64map.h b/include/z64map.h index 195344114e..d4936ffb4e 100644 --- a/include/z64map.h +++ b/include/z64map.h @@ -1,6 +1,143 @@ #ifndef Z64MAP_H #define Z64MAP_H +#include "ultra64.h" +#include "z64scene.h" + +struct PlayState; + +/* +Handles the minimap and pause screen dungeon map system. + +z_map_data.c stores MapSpriteInfo and helper functions to "simplify" accessing this data + +Two separate Id systems are used to access data + +mapId +0x000-0x004 fetches minimap sprite data from gameplay_dangeon_keep +0x005-0x039 fetches dungeon map sprite data from map_i_static +0x100-0x161 fetches minimap sprite data from map_grand_static + +mapCompactId +0x000-0x039 fetches dungeon map sprite data from map_i_static +0x03A-0x09B fetches minimap sprite data from map_grand_static +*/ #define FLOOR_INDEX_MAX 4 +#define FLOOR_MIN_Y -32767 + +/* z_map_data */ +#define MAPDATA_GAMEPLAY_DANGEON_KEEP_MAX 5 +#define MAPDATA_MAP_I_MAX 0x3A +#define MAPDATA_MAP_GRAND 0x100 +#define MAPDATA_MAP_GRAND_MAX 0x162 +#define MAPDATA_GET_MAP_GRAND_ID_FROM_COMPACT_ID(id) ((id) + (MAPDATA_MAP_GRAND - MAPDATA_MAP_I_MAX)) +#define MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId) ((mapId) - MAPDATA_MAP_GRAND) + +#define MAPDATA_MID_GAMEPLAY_DANGEON_KEEP 0 +#define MAPDATA_MID_MAP_GRAND_STATIC 1 +#define MAPDATA_MID_MAP_I_STATIC 2 + +#define MAPDATA_CPID_MAP_GRAND_STATIC 0 +#define MAPDATA_CPID_MAP_I_STATIC 1 +#define MAPDATA_CPID_2 2 + +#define MAPDATA_DRAW_0 0 +#define MAPDATA_DRAW_1 1 +#define MAPDATA_DRAW_2 2 +#define MAPDATA_DRAW_3 3 + +/* z_map_disp */ +typedef struct { + /* 0x00 */ MapDataScene* mapDataScene; + /* 0x04 */ s32 curRoom; + /* 0x08 */ s16 minimapBaseX; + /* 0x0A */ s16 minimapBaseY; + /* 0x0C */ s16 minimapCurX; + /* 0x0E */ s16 minimapCurY; + /* 0x10 */ TexturePtr minimapCurTex; // gameplay cur minimap room + /* 0x14 */ s32 prevRoom; + /* 0x18 */ TexturePtr minimapPrevTex; + /* 0x1C */ s16 minimapPrevX; // for room swap animation + /* 0x1E */ s16 minimapPrevY; // for room swap animation + /* 0x20 */ s32 unk20; + /* 0x24 */ s32 swapAnimTimer; + /* 0x28 */ void* texBuff0; + /* 0x2C */ void* texBuff1; + /* 0x30 */ s16 sceneMinX; //scene minBounds.x + /* 0x32 */ s16 sceneMinZ; //scene minBounds.z + /* 0x34 */ s16 sceneWidth; //scene boundsWidth.x + /* 0x36 */ s16 sceneHeight; //scene boundsWidth.z + /* 0x38 */ s16 sceneMidX; //scene boundsMidpoint.x + /* 0x3A */ s16 sceneMidZ; //scene boundsMidpoint.z + /* 0x3C */ s16* roomStoreyList; // list of lowest storey each room crosses + /* 0x40 */ s16 numStoreys; // number of distinct storeys + /* 0x42 */ s16 pauseMapCurStorey; + /* 0x44 */ s16 bottomStorey; // configures what storey 0 is displayed as + /* 0x48 */ s16* storeyYList; // list of min Ys for each storey + /* 0x4C */ s16 timer; + /* 0x50 */ s32 numChests; + /* 0x54 */ MapDataChest* mapDataChests; + /* 0x58 */ s16 bossRoomStorey; + /* 0x5A */ s16 unk5A; +} MapDisp; // size = 0x5C + +typedef struct { + /* 0x000 */ s32 textureCount; + /* 0x004 */ s32 mapI_mapCompactId[ROOM_MAX]; + /* 0x084 */ void* mapI_roomTextures[ROOM_MAX]; + /* 0x104 */ void* roomSprite[ROOM_MAX]; + /* 0x184 */ s32 animTimer; +} PauseDungeonMap; // size = 0x188 + +/* z_map_disp */ +void func_80102EB4(u32 flag); +void func_80102ED0(u32 flag); +s32 MapDisp_CurRoomHasMapI(struct PlayState* play); +void MapDisp_Init(struct PlayState* play); +s32 MapDisp_GetBossIconY(void); +s16 MapDisp_GetBossRoomStorey(void); +void MapDisp_InitMapData(struct PlayState* play, void* segmentAddress); +void MapDisp_InitChestData(struct PlayState* play, s32 num, void* segmentAddress); +void MapDisp_InitTransitionActorData(struct PlayState* play, s32 num, TransitionActorEntry* transitionActorList); +void MapDisp_Destroy(struct PlayState* play); +void MapDisp_Update(struct PlayState* play); +void MapDisp_SwapRooms(s16 nextRoom); +s32 MapDisp_IsMinimapToggleBlocked(struct PlayState* play); +void MapDisp_DrawMinimap(struct PlayState* play, s32 playerInitX, s32 playerInitZ, s32 playerInitDir); +void* MapDisp_AllocDungeonMap(struct PlayState* play, void* heap); +void MapDisp_DrawDungeonFloorSelect(struct PlayState* play); +s32 MapDisp_IsValidStorey(s32 storey); +s32 MapDisp_GetPlayerStorey(s16 checkY); +void MapDisp_DrawDungeonMap(struct PlayState* play); +void MapDisp_UpdateDungeonMap(struct PlayState* play); + +/* z_map_data */ +void MapData_GetMapColor(s32 colorIndex, Color_RGBA8* color); +TexturePtr MapData_GetMapTexGameplayDangeonKeep(s32); +s32 MapData_GetMapCompactId(s32); +s32 MapData_MID_GetType(s32); +s32 MapData_CPID_GetSizeOfMapTex(s32); +void MapData_GetDrawType(s32, s32*); +s32 MapData_GetMapColorIndex(s32); +s32 MapDisp_GetSizeOfMapITex(s32 mapCompactId); +s32 MapData_GetMapIId(s32); +s32 MapData_GetSizeOfMapGrandTex(s32 mapId); +void MapData_GetMapTexDim(s32 mapId, s32* width, s32* height); +void MapData_GetMapTexOffset(s32 mapId, s32* offsetX, s32* offsetY); +void MapData_GetMapScale(s32 mapId, s32 *scale); +void MapData_CPID_GetTexDim(s32 mapCompactId, s32* width, s32* height); +void MapData_CPID_GetTexOffset(s32 mapCompactId, s32* offsetX, s32* offsetY); +s16 MapData_CPID_GetMapScale(s32 mapCompactId); + +/* z_map_exp */ +s32 Map_IsInDungeonOrBossScene(struct PlayState* play); +s32 Map_CurRoomHasMapI(struct PlayState* play); +s32 Map_IsInBossScene(struct PlayState* play); +void Map_SetAreaEntrypoint(struct PlayState* play); +void Map_InitRoomData(struct PlayState* play, s16 room); +void Map_Destroy(struct PlayState* play); +void Map_Init(struct PlayState* play); +void Map_DrawMinimap(struct PlayState* play); +void Map_Update(struct PlayState* play); #endif diff --git a/include/z64pause_menu.h b/include/z64pause_menu.h index fdb63ea100..5fa09399f9 100644 --- a/include/z64pause_menu.h +++ b/include/z64pause_menu.h @@ -139,7 +139,7 @@ typedef struct PauseContext { /* 0x238 */ s16 cursorPoint[PAUSE_PAGE_MAX]; // indexed by PauseMenuPage enum /* 0x242 */ s16 cursorXIndex[PAUSE_PAGE_MAX]; // indexed by PauseMenuPage enum /* 0x24C */ s16 cursorYIndex[PAUSE_PAGE_MAX]; // indexed by PauseMenuPage enum - /* 0x256 */ s16 unk_256; // Uses DungeonItem enum + /* 0x256 */ s16 cursorMapDungeonItem; // Uses DungeonItem enum /* 0x258 */ s16 cursorSpecialPos; /* 0x25A */ s16 pageSwitchInputTimer; // Used to introduce a delay before switching page when arriving on the "scroll left/right" positions while holding stick left/right. /* 0x25C */ u16 namedItem; diff --git a/include/z64save.h b/include/z64save.h index f7d28708bb..45bc64fd9f 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -317,36 +317,36 @@ typedef struct SaveInfo { } SaveInfo; // size = 0xFE8 typedef struct Save { - /* 0x00 */ s32 entrance; // "scene_no" - /* 0x04 */ u8 equippedMask; // "player_mask" - /* 0x05 */ u8 isFirstCycle; // "opening_flag" + /* 0x00 */ s32 entrance; // "scene_no" + /* 0x04 */ u8 equippedMask; // "player_mask" + /* 0x05 */ u8 isFirstCycle; // "opening_flag" /* 0x06 */ u8 unk_06; - /* 0x07 */ u8 linkAge; // "link_age" - /* 0x08 */ s32 cutsceneIndex; // "day_time" - /* 0x0C */ u16 time; // "zelda_time" - /* 0x0E */ u16 owlWarpId; // See `OwlWarpId` enum - /* 0x10 */ s32 isNight; // "asahiru_fg" - /* 0x14 */ s32 timeSpeedOffset; // "change_zelda_time" - /* 0x18 */ s32 day; // "totalday" - /* 0x1C */ s32 eventDayCount; // "eventday" - /* 0x20 */ u8 playerForm; // "player_character" - /* 0x21 */ u8 snowheadCleared; // "spring_flag" - /* 0x22 */ u8 hasTatl; // "bell_flag" + /* 0x07 */ u8 linkAge; // "link_age" + /* 0x08 */ s32 cutsceneIndex; // "day_time" + /* 0x0C */ u16 time; // "zelda_time" + /* 0x0E */ u16 owlWarpId; // See `OwlWarpId` enum + /* 0x10 */ s32 isNight; // "asahiru_fg" + /* 0x14 */ s32 timeSpeedOffset; // "change_zelda_time" + /* 0x18 */ s32 day; // "totalday" + /* 0x1C */ s32 eventDayCount; // "eventday" + /* 0x20 */ u8 playerForm; // "player_character" + /* 0x21 */ u8 snowheadCleared; // "spring_flag" + /* 0x22 */ u8 hasTatl; // "bell_flag" /* 0x23 */ u8 isOwlSave; /* 0x24 */ SaveInfo saveInfo; } Save; // size = 0x100C typedef struct SaveContext { /* 0x0000 */ Save save; - /* 0x100C */ u8 eventInf[8]; // "event_inf" - /* 0x1014 */ u8 unk_1014; // "stone_set_flag" + /* 0x100C */ u8 eventInf[8]; // "event_inf" + /* 0x1014 */ u8 unk_1014; // "stone_set_flag" /* 0x1015 */ u8 bButtonStatus; /* 0x1016 */ u16 jinxTimer; - /* 0x1018 */ s16 rupeeAccumulator; // "lupy_udct" - /* 0x101A */ u8 bottleTimerStates[BOTTLE_MAX]; // See the `BottleTimerState` enum. "bottle_status" + /* 0x1018 */ s16 rupeeAccumulator; // "lupy_udct" + /* 0x101A */ u8 bottleTimerStates[BOTTLE_MAX]; // See the `BottleTimerState` enum. "bottle_status" /* 0x1020 */ OSTime bottleTimerStartOsTimes[BOTTLE_MAX]; // The osTime when the timer starts. "bottle_ostime" /* 0x1050 */ u64 bottleTimerTimeLimits[BOTTLE_MAX]; // The original total time given before the timer expires, in centiseconds (1/100th sec). "bottle_sub" - /* 0x1080 */ u64 bottleTimerCurTimes[BOTTLE_MAX]; // The remaining time left before the timer expires, in centiseconds (1/100th sec). "bottle_time" + /* 0x1080 */ u64 bottleTimerCurTimes[BOTTLE_MAX]; // The remaining time left before the timer expires, in centiseconds (1/100th sec). "bottle_time" /* 0x10B0 */ OSTime bottleTimerPausedOsTimes[BOTTLE_MAX]; // The cumulative osTime spent with the timer paused. "bottle_stop_time" /* 0x10E0 */ u8 pictoPhotoI5[PICTO_PHOTO_COMPRESSED_SIZE]; // buffer containing the pictograph photo, compressed to I5 from I8 /* 0x3CA0 */ s32 fileNum; // "file_no" @@ -367,58 +367,58 @@ typedef struct SaveContext { /* 0x3DC0 */ s16 nayrusLoveTimer; // remnant of OoT, "shield_magic_timer" /* 0x3DC2 */ u8 unk_3DC2; // "pad1" /* 0x3DC8 */ OSTime postmanTimerStopOsTime; // The osTime when the timer stops for the postman minigame. "get_time" - /* 0x3DD0 */ u8 timerStates[TIMER_ID_MAX]; // See the `TimerState` enum. "event_fg" + /* 0x3DD0 */ u8 timerStates[TIMER_ID_MAX]; // See the `TimerState` enum. "event_fg" /* 0x3DD7 */ u8 timerDirections[TIMER_ID_MAX]; // See the `TimerDirection` enum. "calc_flag" /* 0x3DE0 */ u64 timerCurTimes[TIMER_ID_MAX]; // For countdown, the remaining time left. For countup, the time since the start. In centiseconds (1/100th sec). "event_ostime" /* 0x3E18 */ u64 timerTimeLimits[TIMER_ID_MAX]; // The original total time given for the timer to count from, in centiseconds (1/100th sec). "event_sub" /* 0x3E50 */ OSTime timerStartOsTimes[TIMER_ID_MAX]; // The osTime when the timer starts. "func_time" /* 0x3E88 */ u64 timerStopTimes[TIMER_ID_MAX]; // The total amount of time taken between the start and end of the timer, in centiseconds (1/100th sec). "func_end_time" /* 0x3EC0 */ OSTime timerPausedOsTimes[TIMER_ID_MAX]; // The cumulative osTime spent with the timer paused. "func_stop_time" - /* 0x3EF8 */ s16 timerX[TIMER_ID_MAX]; // "event_xp" - /* 0x3F06 */ s16 timerY[TIMER_ID_MAX]; // "event_yp" - /* 0x3F14 */ s16 unk_3F14; // "character_change" - /* 0x3F16 */ u8 seqId; // "old_bgm" - /* 0x3F17 */ u8 ambienceId; // "old_env" - /* 0x3F18 */ u8 buttonStatus[6]; // "button_item" + /* 0x3EF8 */ s16 timerX[TIMER_ID_MAX]; // "event_xp" + /* 0x3F06 */ s16 timerY[TIMER_ID_MAX]; // "event_yp" + /* 0x3F14 */ s16 unk_3F14; // "character_change" + /* 0x3F16 */ u8 seqId; // "old_bgm" + /* 0x3F17 */ u8 ambienceId; // "old_env" + /* 0x3F18 */ u8 buttonStatus[6]; // "button_item" /* 0x3F1E */ u8 hudVisibilityForceButtonAlphasByStatus; // if btn alphas are updated through Interface_UpdateButtonAlphas, instead update them through Interface_UpdateButtonAlphasByStatus "ck_fg" - /* 0x3F20 */ u16 nextHudVisibility; // triggers the hud to change visibility to the requested value. Reset to HUD_VISIBILITY_IDLE when target is reached "alpha_type" - /* 0x3F22 */ u16 hudVisibility; // current hud visibility "prev_alpha_type" + /* 0x3F20 */ u16 nextHudVisibility; // triggers the hud to change visibility to the requested value. Reset to HUD_VISIBILITY_IDLE when target is reached "alpha_type" + /* 0x3F22 */ u16 hudVisibility; // current hud visibility "prev_alpha_type" /* 0x3F24 */ u16 hudVisibilityTimer; // number of frames in the transition to a new hud visibility. Used to step alpha "alpha_count" /* 0x3F26 */ u16 prevHudVisibility; // used to store and recover hud visibility for pause menu and text boxes "last_time_type" - /* 0x3F28 */ s16 magicState; // determines magic meter behavior on each frame "magic_flag" - /* 0x3F2A */ s16 isMagicRequested; // a request to add magic has been given "recovery_magic_flag" - /* 0x3F2C */ s16 magicFlag; // Set to 0 in func_80812D94(), otherwise unused "keep_magic_flag" - /* 0x3F2E */ s16 magicCapacity; // maximum magic available "magic_now_max" - /* 0x3F30 */ s16 magicFillTarget; // target used to fill magic "magic_now_now" - /* 0x3F32 */ s16 magicToConsume; // accumulated magic that is requested to be consumed "magic_used" - /* 0x3F34 */ s16 magicToAdd; // accumulated magic that is requested to be added "magic_recovery" - /* 0x3F36 */ u16 mapIndex; // "scene_ID" - /* 0x3F38 */ u16 minigameStatus; // "yabusame_mode" - /* 0x3F3A */ u16 minigameScore; // "yabusame_total" - /* 0x3F3C */ u16 minigameHiddenScore; // "yabusame_out_ct" - /* 0x3F3E */ u8 unk_3F3E; // "no_save" - /* 0x3F3F */ u8 flashSaveAvailable; // "flash_flag" + /* 0x3F28 */ s16 magicState; // determines magic meter behavior on each frame "magic_flag" + /* 0x3F2A */ s16 isMagicRequested; // a request to add magic has been given "recovery_magic_flag" + /* 0x3F2C */ s16 magicFlag; // Set to 0 in func_80812D94(), otherwise unused "keep_magic_flag" + /* 0x3F2E */ s16 magicCapacity; // maximum magic available "magic_now_max" + /* 0x3F30 */ s16 magicFillTarget; // target used to fill magic "magic_now_now" + /* 0x3F32 */ s16 magicToConsume; // accumulated magic that is requested to be consumed "magic_used" + /* 0x3F34 */ s16 magicToAdd; // accumulated magic that is requested to be added "magic_recovery" + /* 0x3F36 */ u16 mapIndex; // set to enum DungeonSceneIndex when entering a dungeon related scene, or Map_GetMapIndexForOverworld on certain overworld scenes "scene_ID" + /* 0x3F38 */ u16 minigameStatus; // "yabusame_mode" + /* 0x3F3A */ u16 minigameScore; // "yabusame_total" + /* 0x3F3C */ u16 minigameHiddenScore; // "yabusame_out_ct" + /* 0x3F3E */ u8 unk_3F3E; // "no_save" + /* 0x3F3F */ u8 flashSaveAvailable; // "flash_flag" /* 0x3F40 */ SaveOptions options; - /* 0x3F46 */ u16 forcedSeqId; // "NottoriBgm" - /* 0x3F48 */ u8 cutsceneTransitionControl; // "fade_go" - /* 0x3F4A */ u16 nextCutsceneIndex; // "next_daytime" - /* 0x3F4C */ u8 cutsceneTrigger; // "doukidemo" - /* 0x3F4D */ u8 chamberCutsceneNum; // remnant of OoT "Kenjya_no" - /* 0x3F4E */ u16 nextDayTime; // "next_zelda_time" - /* 0x3F50 */ u8 transFadeDuration; // "fade_speed" - /* 0x3F51 */ u8 transWipeSpeed; // "wipe_speed" transition related - /* 0x3F52 */ u16 skyboxTime; // "kankyo_time" - /* 0x3F54 */ u8 dogIsLost; // "dog_event_flag" - /* 0x3F55 */ u8 nextTransitionType; // "next_wipe" - /* 0x3F56 */ s16 worldMapArea; // "area_type" - /* 0x3F58 */ s16 sunsSongState; // "sunmoon_flag" - /* 0x3F5A */ s16 healthAccumulator; // "life_mode" - /* 0x3F5C */ s32 unk_3F5C; // "bet_rupees" - /* 0x3F60 */ u8 screenScaleFlag; // "framescale_flag" - /* 0x3F64 */ f32 screenScale; // "framescale_scale" - /* 0x3F68 */ CycleSceneFlags cycleSceneFlags[120]; // Scene flags that are temporarily stored over the duration of a single 3-day cycle - /* 0x48C8 */ u16 dungeonIndex; // "scene_id_mix" - /* 0x48CA */ u8 masksGivenOnMoon[27]; // bit-packed, masks given away on the Moon. "mask_mask_bit" + /* 0x3F46 */ u16 forcedSeqId; // "NottoriBgm" + /* 0x3F48 */ u8 cutsceneTransitionControl; // "fade_go" + /* 0x3F4A */ u16 nextCutsceneIndex; // "next_daytime" + /* 0x3F4C */ u8 cutsceneTrigger; // "doukidemo" + /* 0x3F4D */ u8 chamberCutsceneNum; // remnant of OoT "Kenjya_no" + /* 0x3F4E */ u16 nextDayTime; // "next_zelda_time" + /* 0x3F50 */ u8 transFadeDuration; // "fade_speed" + /* 0x3F51 */ u8 transWipeSpeed; // "wipe_speed" transition related + /* 0x3F52 */ u16 skyboxTime; // "kankyo_time" + /* 0x3F54 */ u8 dogIsLost; // "dog_event_flag" + /* 0x3F55 */ u8 nextTransitionType; // "next_wipe" + /* 0x3F56 */ s16 worldMapArea; // "area_type" + /* 0x3F58 */ s16 sunsSongState; // "sunmoon_flag" + /* 0x3F5A */ s16 healthAccumulator; // "life_mode" + /* 0x3F5C */ s32 unk_3F5C; // "bet_rupees" + /* 0x3F60 */ u8 screenScaleFlag; // "framescale_flag" + /* 0x3F64 */ f32 screenScale; // "framescale_scale" + /* 0x3F68 */ CycleSceneFlags cycleSceneFlags[120]; // Scene flags that are temporarily stored over the duration of a single 3-day cycle + /* 0x48C8 */ u16 dungeonSceneSharedIndex; // similar to mapIndex, except values correspond to one of the four dungeons "scene_id_mix" + /* 0x48CA */ u8 masksGivenOnMoon[27]; // bit-packed, masks given away on the Moon. "mask_mask_bit" } SaveContext; // size = 0x48C8 typedef enum ButtonStatus { @@ -497,9 +497,16 @@ typedef enum { #define DECREMENT_QUEST_HEART_PIECE_COUNT (gSaveContext.save.saveInfo.inventory.questItems -= (1 << QUEST_HEART_PIECE_COUNT)) #define RESET_HEART_PIECE_COUNT (gSaveContext.save.saveInfo.inventory.questItems ^= (4 << QUEST_HEART_PIECE_COUNT)) -#define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.saveInfo.inventory.dungeonItems[(void)0, dungeonIndex] & gBitFlags[item]) -#define SET_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.saveInfo.inventory.dungeonItems[(void)0, dungeonIndex] |= (u8)gBitFlags[item]) -#define DUNGEON_KEY_COUNT(dungeonIndex) (gSaveContext.save.saveInfo.inventory.dungeonKeys[(void)0, dungeonIndex]) +#define CHECK_DUNGEON_ITEM(item, dungeonSceneIndex) (gSaveContext.save.saveInfo.inventory.dungeonItems[(void)0, dungeonSceneIndex] & gBitFlags[item]) +#define CHECK_DUNGEON_ITEM_ALT(item, dungeonSceneIndex) (gSaveContext.save.saveInfo.inventory.dungeonItems[dungeonSceneIndex] & gBitFlags[item]) +#define SET_DUNGEON_ITEM(item, dungeonSceneIndex) (gSaveContext.save.saveInfo.inventory.dungeonItems[(void)0, dungeonSceneIndex] |= (u8)gBitFlags[item]) +#define DUNGEON_KEY_COUNT(dungeonSceneIndex) (gSaveContext.save.saveInfo.inventory.dungeonKeys[(void)0, dungeonSceneIndex]) +#define GET_DUNGEON_FLOOR_VISITED(sceneId, floor) (gSaveContext.save.saveInfo.permanentSceneFlags[(sceneId)].unk_14 & gBitFlags[floor]) +#define SET_DUNGEON_FLOOR_VISITED(sceneId, floor) (gSaveContext.save.saveInfo.permanentSceneFlags[(sceneId)].unk_14 |= gBitFlags[floor]) +#define GET_ROOM_VISITED(sceneId, room) (((void)0, gSaveContext.save.saveInfo.permanentSceneFlags[(sceneId)].rooms) & (1 << (room))) +#define SET_ROOM_VISITED(sceneId, room) (gSaveContext.save.saveInfo.permanentSceneFlags[(sceneId)].rooms |= gBitFlags[room]) +#define GET_CYCLE_CHEST_OPENED(sceneId, chestFlagId) ((void)0, gSaveContext.cycleSceneFlags[(sceneId)].chest) & (1 << (chestFlagId)); + #define GET_CUR_FORM_BTN_ITEM(btn) ((u8)((btn) == EQUIP_SLOT_B ? BUTTON_ITEM_EQUIP(CUR_FORM, btn) : BUTTON_ITEM_EQUIP(0, btn))) #define GET_CUR_FORM_BTN_SLOT(btn) ((u8)((btn) == EQUIP_SLOT_B ? C_SLOT_EQUIP(CUR_FORM, btn) : C_SLOT_EQUIP(0, btn))) @@ -1673,11 +1680,18 @@ typedef enum { gSaveContext.eventInf[7] = (temp) typedef enum { - /* 0 */ DUNGEON_INDEX_WOODFALL_TEMPLE, - /* 1 */ DUNGEON_INDEX_SNOWHEAD_TEMPLE, - /* 2 */ DUNGEON_INDEX_GREAT_BAY_TEMPLE, - /* 3 */ DUNGEON_INDEX_STONE_TOWER_TEMPLE // Also applies to Inverted Stone Tower Temple -} DungeonIndex; + // These first 4 values are also used represent the index of the temple the player is currently in + /* 0 */ DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE, + /* 1 */ DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE, + /* 2 */ DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE, + /* 3 */ DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE, + + /* 4 */ DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE_INVERTED, + /* 5 */ DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE_BOSS, + /* 6 */ DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE_BOSS, + /* 7 */ DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE_BOSS, + /* 8 */ DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE_BOSS +} DungeonSceneIndex; #define STRAY_FAIRY_TOTAL 25 // total number of stray fairies, including those already in the Great Fairy Fountain #define STRAY_FAIRY_SCATTERED_TOTAL 15 // original number of stray fairies in one dungeon area diff --git a/include/z64scene.h b/include/z64scene.h index 8dd462814a..d2bfc787e0 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -10,6 +10,9 @@ struct GameState; struct PlayState; +#define ROOM_MAX 32 // maximum number of rooms in a scene +#define ROOM_TRANSITION_MAX 48 // maximum number of transition actors in a scene + #define SPAWN_ROT_FLAGS(rotation, flags) (((rotation) << 7) | (flags)) #define ROOM_DRAW_OPA (1 << 0) @@ -107,7 +110,7 @@ typedef struct { /* 0x0 */ u8 code; /* 0x1 */ u8 num; /* 0x4 */ void* segment; -} SCmdTransiActorList; // size = 0x8 +} SCmdTransitionActorList; // size = 0x8 typedef struct { /* 0x0 */ u8 code; @@ -207,13 +210,13 @@ typedef struct { /* 0x0 */ u8 code; /* 0x1 */ u8 data1; /* 0x4 */ void* segment; -} SCmdMinimapSettings; // size = 0x8 +} SCmdMapData; // size = 0x8 typedef struct { /* 0x0 */ u8 code; /* 0x1 */ u8 num; /* 0x4 */ void* segment; -} SCmdMinimapChests; // size = 0x8 +} SCmdMapDataChests; // size = 0x8 typedef enum { /* 0 */ ROOM_SHAPE_TYPE_NORMAL, @@ -373,9 +376,9 @@ typedef struct TransitionActorEntry { } TransitionActorEntry; // size = 0x10 typedef struct { - /* 0x0 */ u8 numTransitionActors; - /* 0x4 */ TransitionActorEntry* transitionActorList; -} DoorContext; // size = 0x8 + /* 0x0 */ u8 count; + /* 0x4 */ TransitionActorEntry* list; +} TransitionActorList; // size = 0x8 typedef struct { /* 0x0 */ s16 id; @@ -474,25 +477,38 @@ typedef struct { } ObjectContext; // size = 0x958 typedef struct { - /* 0x0 */ UNK_TYPE2 unk0; - /* 0x2 */ UNK_TYPE2 unk2; - /* 0x4 */ UNK_TYPE2 unk4; - /* 0x6 */ UNK_TYPE2 unk6; - /* 0x8 */ UNK_TYPE2 unk8; -} MinimapEntry; // size = 0xA + /* 0x0 */ u16 mapId; + /* 0x2 */ s16 centerX; + /* 0x4 */ s16 floorY; + /* 0x6 */ s16 centerZ; + /* 0x8 */ u16 flags; +} MapDataRoom; // size = 0xA + +#define MAP_DATA_NO_MAP 0xFFFF +#define MAP_DATA_ROOM_FLIP_X 1 +#define MAP_DATA_ROOM_FLIP_Y 2 +#define MAP_DATA_ROOM_GET_EXTRA_STOREYS(mapDataRoom) ((((mapDataRoom)->flags) >> 2) & 7) typedef struct { - /* 0x0 */ MinimapEntry* entry; - /* 0x4 */ s16 unk4; -} MinimapList; // size = 0x8 + /* 0x0 */ MapDataRoom* rooms; + /* 0x4 */ s16 scale; +} MapDataScene; // size = 0x8 typedef struct { - /* 0x0 */ UNK_TYPE2 unk0; - /* 0x2 */ UNK_TYPE2 unk2; - /* 0x4 */ UNK_TYPE2 unk4; - /* 0x6 */ UNK_TYPE2 unk6; - /* 0x8 */ UNK_TYPE2 unk8; -} MinimapChest; // size = 0xA + /* 0x0 */ s16 room; + /* 0x2 */ s16 chestFlagId; + /* 0x4 */ s16 x; + /* 0x6 */ s16 y; + /* 0x8 */ s16 z; +} MapDataChest; // size = 0xA + +// TODO: ZAPD updates +typedef SCmdMapData SCmdMinimapSettings; +typedef SCmdMapDataChests SCmdMinimapChests; +typedef MapDataRoom MinimapEntry; +typedef MapDataScene MinimapList; +typedef MapDataChest MinimapChest; +typedef SCmdTransitionActorList SCmdTransiActorList; // TODO: consider merging with bgCamInfo? typedef struct { @@ -502,38 +518,38 @@ typedef struct { } ActorCsCamInfo; // size = 0x8 typedef union { - /* Command: N/A */ SCmdBase base; - /* Command: 0x00 */ SCmdSpawnList spawnList; - /* Command: 0x01 */ SCmdActorList actorList; - /* Command: 0x02 */ SCmdCsCameraList actorCsCamList; - /* Command: 0x03 */ SCmdColHeader colHeader; - /* Command: 0x04 */ SCmdRoomList roomList; - /* Command: 0x05 */ SCmdWindSettings windSettings; - /* Command: 0x06 */ SCmdEntranceList entranceList; - /* Command: 0x07 */ SCmdSpecialFiles specialFiles; - /* Command: 0x08 */ SCmdRoomBehavior roomBehavior; + /* Command: N/A */ SCmdBase base; + /* Command: 0x00 */ SCmdSpawnList spawnList; + /* Command: 0x01 */ SCmdActorList actorList; + /* Command: 0x02 */ SCmdCsCameraList actorCsCamList; + /* Command: 0x03 */ SCmdColHeader colHeader; + /* Command: 0x04 */ SCmdRoomList roomList; + /* Command: 0x05 */ SCmdWindSettings windSettings; + /* Command: 0x06 */ SCmdEntranceList entranceList; + /* Command: 0x07 */ SCmdSpecialFiles specialFiles; + /* Command: 0x08 */ SCmdRoomBehavior roomBehavior; /* Command: 0x09 */ // Unused - /* Command: 0x0A */ SCmdMesh mesh; - /* Command: 0x0B */ SCmdObjectList objectList; - /* Command: 0x0C */ SCmdLightList lightList; - /* Command: 0x0D */ SCmdPathList pathList; - /* Command: 0x0E */ SCmdTransiActorList transiActorList; - /* Command: 0x0F */ SCmdLightSettingList lightSettingList; - /* Command: 0x10 */ SCmdTimeSettings timeSettings; - /* Command: 0x11 */ SCmdSkyboxSettings skyboxSettings; - /* Command: 0x12 */ SCmdSkyboxDisables skyboxDisables; - /* Command: 0x13 */ SCmdExitList exitList; - /* Command: 0x14 */ SCmdEndMarker endMarker; - /* Command: 0x15 */ SCmdSoundSettings soundSettings; - /* Command: 0x16 */ SCmdEchoSettings echoSettings; - /* Command: 0x17 */ SCmdCsScriptList scriptList; - /* Command: 0x18 */ SCmdAltHeaders altHeaders; - /* Command: 0x19 */ SCmdRegionVisited regionVisited; - /* Command: 0x1A */ SCmdTextureAnimations textureAnimations; - /* Command: 0x1B */ SCmdCutsceneList cutsceneList; - /* Command: 0x1C */ SCmdMinimapSettings minimapSettings; + /* Command: 0x0A */ SCmdMesh mesh; + /* Command: 0x0B */ SCmdObjectList objectList; + /* Command: 0x0C */ SCmdLightList lightList; + /* Command: 0x0D */ SCmdPathList pathList; + /* Command: 0x0E */ SCmdTransitionActorList transitionActorList; + /* Command: 0x0F */ SCmdLightSettingList lightSettingList; + /* Command: 0x10 */ SCmdTimeSettings timeSettings; + /* Command: 0x11 */ SCmdSkyboxSettings skyboxSettings; + /* Command: 0x12 */ SCmdSkyboxDisables skyboxDisables; + /* Command: 0x13 */ SCmdExitList exitList; + /* Command: 0x14 */ SCmdEndMarker endMarker; + /* Command: 0x15 */ SCmdSoundSettings soundSettings; + /* Command: 0x16 */ SCmdEchoSettings echoSettings; + /* Command: 0x17 */ SCmdCsScriptList scriptList; + /* Command: 0x18 */ SCmdAltHeaders altHeaders; + /* Command: 0x19 */ SCmdRegionVisited regionVisited; + /* Command: 0x1A */ SCmdTextureAnimations textureAnimations; + /* Command: 0x1B */ SCmdCutsceneList cutsceneList; + /* Command: 0x1C */ SCmdMapData mapData; /* Command: 0x1D */ // Unused - /* Command: 0x1E */ SCmdMinimapChests minimapChests; + /* Command: 0x1E */ SCmdMapDataChests mapDataChests; } SceneCmd; // size = 0x8 // Sets cursor point options on the world map @@ -774,9 +790,9 @@ typedef enum { /* 0x19 */ SCENE_CMD_ID_SET_REGION_VISITED, /* 0x1A */ SCENE_CMD_ID_ANIMATED_MATERIAL_LIST, /* 0x1B */ SCENE_CMD_ID_ACTOR_CUTSCENE_LIST, - /* 0x1C */ SCENE_CMD_ID_MINIMAP_INFO, + /* 0x1C */ SCENE_CMD_ID_MAP_DATA, /* 0x1D */ SCENE_CMD_ID_UNUSED_1D, - /* 0x1E */ SCENE_CMD_ID_MINIMAP_COMPASS_ICON_INFO, + /* 0x1E */ SCENE_CMD_ID_MAP_DATA_CHESTS, /* 0x1F */ SCENE_CMD_MAX } SceneCommandTypeId; @@ -822,13 +838,13 @@ typedef enum { { SCENE_CMD_ID_OBJECT_LIST, numObjects, CMD_PTR(objectList) } #define SCENE_CMD_LIGHT_LIST(numLights, lightList) \ - { SCENE_CMD_ID_LIGHT_LIST, numLights, CMD_PTR(lightList) } + { SCENE_CMD_ID_LIGHT_LIST, numLights, CMD_PTR(lightList) } #define SCENE_CMD_PATH_LIST(pathList) \ { SCENE_CMD_ID_PATH_LIST, 0, CMD_PTR(pathList) } #define SCENE_CMD_TRANSITION_ACTOR_LIST(numTransitionActors, actorList) \ - { SCENE_CMD_ID_TRANSI_ACTOR_LIST, numTransitionActors, CMD_PTR(actorList) } + { SCENE_CMD_ID_TRANSI_ACTOR_LIST, numTransitionActors, CMD_PTR(actorList) } #define SCENE_CMD_ENV_LIGHT_SETTINGS(numLightSettings, lightSettingsList) \ { SCENE_CMD_ID_ENV_LIGHT_SETTINGS, numLightSettings, CMD_PTR(lightSettingsList) } @@ -869,12 +885,14 @@ typedef enum { #define SCENE_CMD_ACTOR_CUTSCENE_LIST(numEntries, actorCutsceneList) \ { SCENE_CMD_ID_ACTOR_CUTSCENE_LIST, numEntries, CMD_PTR(actorCutsceneList) } -#define SCENE_CMD_MINIMAP_INFO(minimapInfo) \ - { SCENE_CMD_ID_MINIMAP_INFO, 0, CMD_PTR(minimapInfo) } +#define SCENE_CMD_MAP_DATA(mapData) \ + { SCENE_CMD_ID_MAP_DATA, 0, CMD_PTR(mapData) } -#define SCENE_CMD_MINIMAP_COMPASS_ICON_INFO(compassIconCount, compassIconInfo) \ - { SCENE_CMD_ID_MINIMAP_COMPASS_ICON_INFO, compassIconCount, CMD_PTR(compassIconInfo) } +#define SCENE_CMD_MAP_DATA_CHESTS(chestCount, chestInfo) \ + { SCENE_CMD_ID_MAP_DATA_CHESTS, chestCount, CMD_PTR(chestInfo) } +#define SCENE_CMD_MINIMAP_INFO SCENE_CMD_MAP_DATA +#define SCENE_CMD_MINIMAP_COMPASS_ICON_INFO SCENE_CMD_MAP_DATA_CHESTS s32 Object_SpawnPersistent(ObjectContext* objectCtx, s16 id); void Object_InitContext(struct GameState* gameState, ObjectContext* objectCtx); @@ -895,8 +913,8 @@ void Scene_CommandMesh(struct PlayState* play, SceneCmd* cmd); void Scene_CommandObjectList(struct PlayState* play, SceneCmd* cmd); void Scene_CommandLightList(struct PlayState* play, SceneCmd* cmd); void Scene_CommandPathList(struct PlayState* play, SceneCmd* cmd); -void Scene_CommandTransiActorList(struct PlayState* play, SceneCmd* cmd); -void Door_InitContext(struct GameState* gameState, DoorContext* doorCtx); +void Scene_CommandTransitionActorList(struct PlayState* play, SceneCmd* cmd); +void Scene_ResetTransitionActorList(GameState* gameState, TransitionActorList* transitionActors); void Scene_CommandEnvLightSettings(struct PlayState* play, SceneCmd* cmd); void Scene_LoadAreaTextures(struct PlayState* play, s32 fileIndex); void Scene_CommandSkyboxSettings(struct PlayState* play, SceneCmd* cmd); @@ -910,9 +928,9 @@ void Scene_CommandEchoSetting(struct PlayState* play, SceneCmd* cmd); void Scene_CommandAltHeaderList(struct PlayState* play, SceneCmd* cmd); void Scene_CommandCutsceneScriptList(struct PlayState* play, SceneCmd* cmd); void Scene_CommandCutsceneList(struct PlayState* play, SceneCmd* cmd); -void Scene_CommandMiniMap(struct PlayState* play, SceneCmd* cmd); +void Scene_CommandMapData(struct PlayState* play, SceneCmd* cmd); void Scene_Command1D(struct PlayState* play, SceneCmd* cmd); -void Scene_CommandMiniMapCompassInfo(struct PlayState* play, SceneCmd* cmd); +void Scene_CommandMapDataChests(struct PlayState* play, SceneCmd* cmd); void Scene_CommandSetRegionVisitedFlag(struct PlayState* play, SceneCmd* cmd); void Scene_CommandAnimatedMaterials(struct PlayState* play, SceneCmd* cmd); void Scene_SetExitFade(struct PlayState* play); diff --git a/spec b/spec index 3a80779952..2144cf439a 100644 --- a/spec +++ b/spec @@ -495,8 +495,6 @@ beginseg include "$(BUILD_DIR)/src/code/z_lights.o" include "$(BUILD_DIR)/src/code/z_malloc.o" include "$(BUILD_DIR)/src/code/z_map_disp.o" - include "$(BUILD_DIR)/data/code/z_map_disp.data.o" - include "$(BUILD_DIR)/data/code/z_map_disp.bss.o" include "$(BUILD_DIR)/src/code/z_map_data.o" include "$(BUILD_DIR)/src/code/z_map_exp.o" include "$(BUILD_DIR)/src/code/z_msgevent.o" diff --git a/src/code/gDPLoadTextureBlock_Runtime.inc.c b/src/code/gDPLoadTextureBlock_Runtime.inc.c new file mode 100644 index 0000000000..f90841564f --- /dev/null +++ b/src/code/gDPLoadTextureBlock_Runtime.inc.c @@ -0,0 +1,62 @@ +#ifndef GDP_LOADTEXTUREBLOCK_RUNTIME_INC_C +#define GDP_LOADTEXTUREBLOCK_RUNTIME_INC_C + +#include "gfx.h" + +static u32 sLoadTextureBlock_siz[] = { + G_IM_SIZ_4b, + G_IM_SIZ_8b, + G_IM_SIZ_16b, + G_IM_SIZ_32b, +}; +static u32 sLoadTextureBlock_siz_LOAD_BLOCK[] = { + G_IM_SIZ_4b_LOAD_BLOCK, + G_IM_SIZ_8b_LOAD_BLOCK, + G_IM_SIZ_16b_LOAD_BLOCK, + G_IM_SIZ_32b_LOAD_BLOCK, +}; +static u32 sLoadTextureBlock_siz_INCR[] = { + G_IM_SIZ_4b_INCR, + G_IM_SIZ_8b_INCR, + G_IM_SIZ_16b_INCR, + G_IM_SIZ_32b_INCR, +}; +static u32 sLoadTextureBlock_siz_SHIFT[] = { + G_IM_SIZ_4b_SHIFT, + G_IM_SIZ_8b_SHIFT, + G_IM_SIZ_16b_SHIFT, + G_IM_SIZ_32b_SHIFT, +}; +static u32 sLoadTextureBlock_siz_BYTES[] = { + G_IM_SIZ_4b_BYTES, + G_IM_SIZ_8b_BYTES, + G_IM_SIZ_16b_BYTES, + G_IM_SIZ_32b_BYTES, +}; +static u32 sLoadTextureBlock_siz_LINE_BYTES[] = { + G_IM_SIZ_4b_LINE_BYTES, + G_IM_SIZ_8b_LINE_BYTES, + G_IM_SIZ_16b_LINE_BYTES, + G_IM_SIZ_32b_LINE_BYTES, +}; + +/** + * Implements a version of gDPLoadTextureBlock using table lookups instead of token pasting, to allow values to be + * passed into `siz` during runtime. + */ +#define gDPLoadTextureBlock_Runtime(pkt, timg, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \ + _DW({ \ + gDPSetTextureImage(pkt, fmt, sLoadTextureBlock_siz_LOAD_BLOCK[siz], 1, timg); \ + gDPSetTile(pkt, fmt, sLoadTextureBlock_siz_LOAD_BLOCK[siz], 0, 0, G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, \ + masks, shifts); \ + gDPLoadSync(pkt); \ + gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + sLoadTextureBlock_siz_INCR[siz]) >> sLoadTextureBlock_siz_SHIFT[siz]) - 1, \ + CALC_DXT(width, sLoadTextureBlock_siz_BYTES[siz])); \ + gDPPipeSync(pkt); \ + gDPSetTile(pkt, fmt, sLoadTextureBlock_siz[siz], (((width)*sLoadTextureBlock_siz_LINE_BYTES[siz]) + 7) >> 3, \ + 0, G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ + ((height)-1) << G_TEXTURE_IMAGE_FRAC); \ + }) +#endif diff --git a/src/code/title_setup.c b/src/code/title_setup.c index 0859c52d47..336d08be8b 100644 --- a/src/code/title_setup.c +++ b/src/code/title_setup.c @@ -32,7 +32,7 @@ void Setup_InitRegs(void) { XREG(90) = 0x1C2; R_STORY_FILL_SCREEN_ALPHA = 0; - R_REVERSE_FLOOR_INDEX = 0; + R_PLAYER_FLOOR_REVERSE_INDEX = 0; R_MINIMAP_DISABLED = false; R_PICTO_FOCUS_BORDER_TOPLEFT_X = 80; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 3b6b48fda2..f47b5146ec 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3413,9 +3413,9 @@ Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play } void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) { - TransitionActorEntry* transitionActorList = play->doorCtx.transitionActorList; + TransitionActorEntry* transitionActorList = play->transitionActors.list; s32 i; - s16 numTransitionActors = play->doorCtx.numTransitionActors; + s16 numTransitionActors = play->transitionActors.count; for (i = 0; i < numTransitionActors; transitionActorList++, i++) { if (transitionActorList->id >= 0) { @@ -3434,7 +3434,7 @@ void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) { transitionActorList->rotY & 0x7F, HALFDAYBIT_ALL, 0) != NULL) { transitionActorList->id = -transitionActorList->id; } - numTransitionActors = play->doorCtx.numTransitionActors; + numTransitionActors = play->transitionActors.count; } } } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index d19f960598..9d74d6d46e 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -160,18 +160,18 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->unk_20C = 936.0f; pauseCtx->roll = -314.0f; - pauseCtx->cursorPoint[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); + pauseCtx->cursorPoint[PAUSE_MAP] = R_PLAYER_FLOOR_REVERSE_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_RIGHT; pauseCtx->pageSwitchInputTimer = 0; pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE; - pauseCtx->cursorItem[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); + pauseCtx->cursorItem[PAUSE_MAP] = R_PLAYER_FLOOR_REVERSE_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); pauseCtx->cursorItem[PAUSE_QUEST] = PAUSE_ITEM_NONE; pauseCtx->cursorItem[PAUSE_MASK] = PAUSE_ITEM_NONE; pauseCtx->cursorSlot[PAUSE_ITEM] = 0; - pauseCtx->cursorSlot[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); + pauseCtx->cursorSlot[PAUSE_MAP] = R_PLAYER_FLOOR_REVERSE_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_YELLOW; pauseCtx->ocarinaSongIndex = -1; diff --git a/src/code/z_map_data.c b/src/code/z_map_data.c index a854a37e70..571613a0dd 100644 --- a/src/code/z_map_data.c +++ b/src/code/z_map_data.c @@ -1,79 +1,622 @@ #include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_801094A0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_801094C8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_801094F8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109528.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_8010954C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_8010956C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_8010958C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_801095AC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_801095DC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_8010960C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109630.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109650.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109670.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_801096D4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109714.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109754.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_801097C8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_8010983C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_801098A0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109908.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109964.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_8010997C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_801099AC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_801099DC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109A00.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109A20.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109A40.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109A98.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109AD8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109B38.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109BA0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109BF4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109C38.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109CBC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109D40.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109DD8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109E70.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109EF8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_data/func_80109F78.s") +#include "z64map.h" +#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" + +typedef struct { + /* 0x0 */ u8 texWidth; + /* 0x1 */ u8 texHeight; + /* 0x2 */ s16 offsetX; + /* 0x4 */ s16 offsetY; + /* 0x6 */ u8 drawType; + /* 0x7 */ u8 colorIndex; + /* 0x8 */ s16 scale; +} MapSpriteInfo; // size = 0xA + +typedef struct { + /* 0x0 */ TexturePtr spriteTex; + /* 0x4 */ u8 width; + /* 0x5 */ u8 height; + /* 0x6 */ u8 offsetX; + /* 0x7 */ u8 offsetY; + /* 0x8 */ u8 drawType; + /* 0x9 */ u8 colorIndex; + /* 0xA */ s16 scale; +} MapSpriteInfo2; // size = 0xC + +static Color_RGBA8 sMapColorTable[] = { + { 255, 255, 255, 255 }, + { 0, 255, 255, 160 }, // Blue + { 100, 255, 255, 255 }, +}; + +static MapSpriteInfo2 sGameplayDangeonKeepInfo[5] = { + { gameplay_dangeon_keep_Tex_0022C8, 96, 85, 48, 42, MAPDATA_DRAW_0, 0, 20 }, + { gameplay_dangeon_keep_Tex_0042C8, 96, 85, 48, 62, MAPDATA_DRAW_0, 0, 20 }, + { gameplay_dangeon_keep_Tex_0052C8, 96, 85, 68, 42, MAPDATA_DRAW_0, 0, 20 }, + { gameplay_dangeon_keep_Tex_0032C8, 96, 85, 48, 62, MAPDATA_DRAW_0, 0, 20 }, + { gameplay_dangeon_keep_Tex_0062C8, 96, 85, 68, 62, MAPDATA_DRAW_0, 0, 20 }, +}; + +static MapSpriteInfo sMapGrandStaticInfo[98] = { + { 96, 85, 48, 42, MAPDATA_DRAW_0, 0, 20 }, { 96, 85, 48, 62, MAPDATA_DRAW_0, 0, 20 }, + { 96, 85, 68, 42, MAPDATA_DRAW_0, 0, 20 }, { 96, 85, 48, 62, MAPDATA_DRAW_0, 0, 20 }, + { 96, 85, 68, 62, MAPDATA_DRAW_0, 0, 20 }, { 80, 72, 40, 35, MAPDATA_DRAW_1, 1, 52 }, + { 96, 85, 49, 43, MAPDATA_DRAW_3, 2, 20 }, { 96, 85, 49, 43, MAPDATA_DRAW_3, 2, 20 }, + { 96, 85, 49, 43, MAPDATA_DRAW_3, 2, 20 }, { 96, 85, 49, 49, MAPDATA_DRAW_3, 2, 20 }, + { 48, 44, 25, 23, MAPDATA_DRAW_3, 2, 20 }, { 96, 85, 49, 43, MAPDATA_DRAW_3, 2, 20 }, + { 48, 46, 25, 24, MAPDATA_DRAW_3, 2, 20 }, { 64, 61, 32, 31, MAPDATA_DRAW_3, 2, 20 }, + { 96, 85, 49, 50, MAPDATA_DRAW_3, 2, 20 }, { 96, 85, 49, 62, MAPDATA_DRAW_3, 2, 20 }, + { 96, 85, 49, 43, MAPDATA_DRAW_3, 2, 20 }, { 48, 80, 21, 41, MAPDATA_DRAW_1, 1, 198 }, + { 32, 128, 17, 87, MAPDATA_DRAW_1, 1, 138 }, { 80, 53, 40, 27, MAPDATA_DRAW_1, 1, 54 }, + { 32, 81, 16, 15, MAPDATA_DRAW_3, 2, 20 }, { 80, 45, 35, 23, MAPDATA_DRAW_3, 2, 20 }, + { 64, 87, 36, 44, MAPDATA_DRAW_3, 2, 20 }, { 64, 51, 31, 23, MAPDATA_DRAW_3, 2, 20 }, + { 80, 79, 40, 40, MAPDATA_DRAW_3, 2, 20 }, { 96, 75, 36, 26, MAPDATA_DRAW_3, 2, 20 }, + { 48, 41, 24, 20, MAPDATA_DRAW_3, 2, 20 }, { 64, 45, 31, 20, MAPDATA_DRAW_3, 2, 20 }, + { 80, 52, 38, 28, MAPDATA_DRAW_3, 2, 20 }, { 48, 45, 23, 20, MAPDATA_DRAW_3, 2, 20 }, + { 48, 59, 25, 37, MAPDATA_DRAW_3, 2, 20 }, { 48, 60, 21, 38, MAPDATA_DRAW_3, 2, 20 }, + { 48, 81, 24, 40, MAPDATA_DRAW_3, 2, 20 }, { 48, 81, 24, 40, MAPDATA_DRAW_3, 2, 20 }, + { 80, 89, 41, 26, MAPDATA_DRAW_3, 2, 20 }, { 80, 53, 39, 26, MAPDATA_DRAW_3, 2, 20 }, + { 64, 78, 37, 36, MAPDATA_DRAW_3, 2, 20 }, { 64, 68, 33, 33, MAPDATA_DRAW_3, 2, 20 }, + { 48, 68, 23, 35, MAPDATA_DRAW_3, 2, 20 }, { 48, 36, 25, 17, MAPDATA_DRAW_3, 2, 20 }, + { 48, 25, 24, 12, MAPDATA_DRAW_3, 2, 20 }, { 64, 75, 24, 37, MAPDATA_DRAW_3, 2, 20 }, + { 32, 53, 17, 26, MAPDATA_DRAW_3, 2, 20 }, { 80, 62, 35, 27, MAPDATA_DRAW_1, 1, 105 }, + { 64, 76, 31, 31, MAPDATA_DRAW_1, 1, 133 }, { 96, 85, 47, 43, MAPDATA_DRAW_3, 2, 20 }, + { 80, 71, 48, 33, MAPDATA_DRAW_1, 1, 180 }, { 80, 87, 44, 44, MAPDATA_DRAW_1, 1, 72 }, + { 64, 65, 31, 36, MAPDATA_DRAW_1, 1, 57 }, { 48, 41, 28, 20, MAPDATA_DRAW_1, 1, 60 }, + { 64, 76, 17, 36, MAPDATA_DRAW_1, 1, 58 }, { 80, 60, 27, 22, MAPDATA_DRAW_1, 1, 83 }, + { 80, 47, 38, 23, MAPDATA_DRAW_1, 1, 69 }, { 80, 60, 40, 38, MAPDATA_DRAW_1, 1, 29 }, + { 48, 19, 17, 8, MAPDATA_DRAW_1, 1, 25 }, { 32, 99, 17, 16, MAPDATA_DRAW_1, 1, 88 }, + { 48, 69, 19, 28, MAPDATA_DRAW_1, 1, 76 }, { 48, 83, 34, 47, MAPDATA_DRAW_1, 1, 104 }, + { 80, 54, 45, 27, MAPDATA_DRAW_1, 1, 61 }, { 80, 92, 35, 50, MAPDATA_DRAW_1, 1, 60 }, + { 48, 75, 24, 37, MAPDATA_DRAW_3, 2, 20 }, { 64, 49, 32, 23, MAPDATA_DRAW_3, 2, 20 }, + { 64, 49, 25, 24, MAPDATA_DRAW_3, 2, 20 }, { 64, 52, 32, 24, MAPDATA_DRAW_3, 2, 34 }, + { 64, 49, 31, 24, MAPDATA_DRAW_3, 2, 34 }, { 32, 33, 18, 14, MAPDATA_DRAW_3, 2, 34 }, + { 48, 50, 25, 25, MAPDATA_DRAW_3, 2, 34 }, { 64, 52, 32, 25, MAPDATA_DRAW_3, 2, 34 }, + { 48, 35, 24, 18, MAPDATA_DRAW_3, 2, 34 }, { 64, 51, 32, 26, MAPDATA_DRAW_3, 2, 34 }, + { 48, 35, 24, 18, MAPDATA_DRAW_3, 2, 34 }, { 48, 53, 24, 28, MAPDATA_DRAW_3, 2, 34 }, + { 64, 53, 33, 25, MAPDATA_DRAW_3, 2, 34 }, { 64, 47, 31, 24, MAPDATA_DRAW_3, 2, 34 }, + { 64, 52, 32, 35, MAPDATA_DRAW_3, 2, 34 }, { 48, 48, 24, 23, MAPDATA_DRAW_3, 2, 34 }, + { 64, 87, 32, 26, MAPDATA_DRAW_3, 2, 34 }, { 48, 30, 24, 14, MAPDATA_DRAW_3, 2, 34 }, + { 80, 74, 40, 36, MAPDATA_DRAW_1, 1, 50 }, { 80, 87, 6, 41, MAPDATA_DRAW_1, 1, 42 }, + { 80, 56, 19, 27, MAPDATA_DRAW_1, 1, 40 }, { 80, 65, 25, 33, MAPDATA_DRAW_1, 1, 40 }, + { 16, 38, 8, 12, MAPDATA_DRAW_1, 1, 47 }, { 80, 78, 46, 33, MAPDATA_DRAW_1, 1, 142 }, + { 80, 55, 32, 29, MAPDATA_DRAW_1, 1, 155 }, { 80, 98, 67, 48, MAPDATA_DRAW_1, 1, 51 }, + { 80, 62, 47, 19, MAPDATA_DRAW_1, 1, 55 }, { 32, 123, 15, 83, MAPDATA_DRAW_1, 1, 140 }, + { 80, 60, 47, 14, MAPDATA_DRAW_1, 1, 170 }, { 48, 77, 18, 59, MAPDATA_DRAW_1, 1, 79 }, + { 80, 64, 35, 30, MAPDATA_DRAW_1, 1, 33 }, { 64, 50, 29, 22, MAPDATA_DRAW_1, 1, 40 }, + { 80, 65, 39, 5, MAPDATA_DRAW_1, 1, 37 }, { 32, 61, 8, 56, MAPDATA_DRAW_1, 1, 35 }, + { 80, 83, 37, 42, MAPDATA_DRAW_1, 1, 95 }, { 80, 27, 30, 21, MAPDATA_DRAW_1, 1, 134 }, + { 80, 23, 122, -18, MAPDATA_DRAW_1, 1, 53 }, { 80, 60, 27, 22, MAPDATA_DRAW_1, 1, 83 }, +}; + +static s32 D_801BF15C[5] = { + 0x50, 0x50, 0x8D, 0x50, 0x50, +}; + +static MapSpriteInfo sMapIStaticInfo[MAPDATA_MAP_I_MAX] = { + { 96, 85, 73, 67, MAPDATA_DRAW_0, 0, 60 }, { 96, 85, 73, 74, MAPDATA_DRAW_0, 0, 60 }, + { 96, 85, 80, 67, MAPDATA_DRAW_0, 0, 60 }, { 96, 85, 73, 67, MAPDATA_DRAW_0, 0, 60 }, + { 96, 85, 80, 74, MAPDATA_DRAW_0, 0, 60 }, { 32, 29, 17, 14, MAPDATA_DRAW_2, 0, 50 }, + { 32, 27, 16, 13, MAPDATA_DRAW_2, 0, 50 }, { 32, 30, 16, 15, MAPDATA_DRAW_2, 0, 50 }, + { 16, 32, 8, 20, MAPDATA_DRAW_2, 0, 50 }, { 16, 12, 8, 6, MAPDATA_DRAW_2, 0, 50 }, + { 32, 27, 16, 13, MAPDATA_DRAW_2, 0, 50 }, { 16, 14, 8, 7, MAPDATA_DRAW_2, 0, 50 }, + { 32, 19, 16, 9, MAPDATA_DRAW_2, 0, 50 }, { 32, 26, 16, 16, MAPDATA_DRAW_2, 0, 50 }, + { 16, 32, 8, 22, MAPDATA_DRAW_2, 0, 50 }, { 32, 27, 16, 13, MAPDATA_DRAW_2, 0, 50 }, + { 16, 35, 9, 5, MAPDATA_DRAW_2, 0, 45 }, { 32, 18, 14, 9, MAPDATA_DRAW_2, 0, 45 }, + { 32, 38, 18, 19, MAPDATA_DRAW_2, 0, 45 }, { 32, 21, 16, 9, MAPDATA_DRAW_2, 0, 45 }, + { 32, 34, 16, 17, MAPDATA_DRAW_2, 0, 45 }, { 48, 32, 19, 11, MAPDATA_DRAW_2, 0, 45 }, + { 32, 17, 16, 8, MAPDATA_DRAW_2, 0, 45 }, { 32, 17, 16, 7, MAPDATA_DRAW_2, 0, 45 }, + { 32, 21, 16, 11, MAPDATA_DRAW_2, 0, 45 }, { 32, 18, 16, 8, MAPDATA_DRAW_2, 0, 45 }, + { 16, 24, 9, 15, MAPDATA_DRAW_2, 0, 45 }, { 16, 25, 7, 16, MAPDATA_DRAW_2, 0, 45 }, + { 32, 35, 16, 17, MAPDATA_DRAW_2, 0, 45 }, { 16, 19, 5, 9, MAPDATA_DRAW_2, 0, 80 }, + { 32, 28, 17, 7, MAPDATA_DRAW_2, 0, 66 }, { 32, 16, 16, 8, MAPDATA_DRAW_2, 0, 66 }, + { 32, 24, 18, 11, MAPDATA_DRAW_2, 0, 66 }, { 32, 21, 16, 10, MAPDATA_DRAW_2, 0, 66 }, + { 16, 21, 8, 11, MAPDATA_DRAW_2, 0, 66 }, { 16, 10, 8, 4, MAPDATA_DRAW_2, 0, 66 }, + { 16, 7, 8, 3, MAPDATA_DRAW_2, 0, 66 }, { 32, 23, 13, 11, MAPDATA_DRAW_2, 0, 66 }, + { 16, 16, 8, 8, MAPDATA_DRAW_2, 0, 66 }, { 16, 17, 8, 7, MAPDATA_DRAW_2, 0, 50 }, + { 16, 23, 9, 10, MAPDATA_DRAW_2, 0, 66 }, { 16, 15, 8, 7, MAPDATA_DRAW_2, 0, 66 }, + { 32, 15, 15, 7, MAPDATA_DRAW_2, 0, 66 }, { 32, 17, 16, 8, MAPDATA_DRAW_2, 0, 90 }, + { 32, 16, 16, 8, MAPDATA_DRAW_2, 0, 90 }, { 16, 10, 8, 5, MAPDATA_DRAW_2, 0, 90 }, + { 16, 17, 8, 8, MAPDATA_DRAW_2, 0, 90 }, { 32, 17, 17, 8, MAPDATA_DRAW_2, 0, 90 }, + { 16, 11, 8, 5, MAPDATA_DRAW_2, 0, 90 }, { 32, 17, 15, 9, MAPDATA_DRAW_2, 0, 90 }, + { 16, 12, 8, 6, MAPDATA_DRAW_2, 0, 90 }, { 16, 18, 9, 9, MAPDATA_DRAW_2, 0, 90 }, + { 32, 17, 17, 8, MAPDATA_DRAW_2, 0, 90 }, { 32, 15, 16, 8, MAPDATA_DRAW_2, 0, 90 }, + { 16, 18, 9, 13, MAPDATA_DRAW_2, 0, 90 }, { 16, 16, 8, 7, MAPDATA_DRAW_2, 0, 90 }, + { 16, 30, 9, 8, MAPDATA_DRAW_2, 0, 90 }, { 16, 9, 9, 4, MAPDATA_DRAW_2, 0, 90 }, +}; + +static s32 sMapIForGameplayDangeonKeep[5] = { + 0x00, 0x01, 0x02, 0x03, 0x04, +}; + +static s32 sMapIForMapGrand[98] = { + MAPDATA_MAP_I_MAX, + 0x01, + 0x02, + 0x03, + 0x04, + MAPDATA_MAP_I_MAX, + 0x05, + 0x06, + 0x07, + 0x08, + 0x09, + 0x0A, + 0x0B, + 0x0C, + 0x0D, + 0x0E, + 0x0F, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + 0x10, + 0x11, + 0x12, + 0x13, + 0x14, + 0x15, + 0x16, + 0x17, + 0x18, + 0x19, + 0x1A, + 0x1B, + 0x1C, + MAPDATA_MAP_I_MAX, + 0x1E, + 0x1F, + 0x20, + 0x21, + 0x22, + 0x23, + 0x24, + 0x25, + 0x26, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + 0x27, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + 0x28, + 0x29, + 0x2A, + 0x2B, + 0x2C, + 0x2D, + 0x2E, + 0x2F, + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, + MAPDATA_MAP_I_MAX, +}; + +void MapData_GetMapColor(s32 colorIndex, Color_RGBA8* color) { + *color = sMapColorTable[colorIndex]; +} + +void MapData_GetMapTexDimGameplayDangeonKeep(s32 mapId, s32* width, s32* height) { + *width = sGameplayDangeonKeepInfo[mapId].width; + *height = sGameplayDangeonKeepInfo[mapId].height; +} + +void MapData_GetMapTexOffsetGameplayDangeonKeep(s32 mapId, s32* offsetX, s32* offsetY) { + *offsetX = sGameplayDangeonKeepInfo[mapId].offsetX; + *offsetY = sGameplayDangeonKeepInfo[mapId].offsetY; +} + +void MapData_GetMapDrawTypeGameplayDangeonKeep(s32 mapId, s32* drawType) { + *drawType = sGameplayDangeonKeepInfo[mapId].drawType; +} + +u8 MapData_GetMapColorIndexGameplayDangeonKeep(s32 mapId) { + return sGameplayDangeonKeepInfo[mapId].colorIndex; +} + +s16 MapData_GetMapGameplayDangeonKeepScale(s32 mapId) { + return sGameplayDangeonKeepInfo[mapId].scale; +} + +TexturePtr MapData_GetMapTexGameplayDangeonKeep(s32 mapId) { + return sGameplayDangeonKeepInfo[mapId].spriteTex; +} + +void MapData_GetMapTexGameplayDangeonKeepDim(s32 mapId, s32* width, s32* height) { + *width = sMapGrandStaticInfo[MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId)].texWidth; + *height = sMapGrandStaticInfo[MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId)].texHeight; +} + +void MapData_GetMapTexGameplayDangeonKeepOffset(s32 mapId, s32* offsetX, s32* offsetY) { + *offsetX = sMapGrandStaticInfo[MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId)].offsetX; + *offsetY = sMapGrandStaticInfo[MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId)].offsetY; +} + +void MapData_GetMapGrandDrawType(s32 mapId, s32* drawType) { + *drawType = sMapGrandStaticInfo[MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId)].drawType; +} + +u8 MapData_GetMapGrandColorIndex(s32 mapId) { + return sMapGrandStaticInfo[MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId)].colorIndex; +} + +s16 MapData_GetMapGrandScale(s32 mapId) { + return sMapGrandStaticInfo[MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId)].scale; +} + +s32 MapData_MapGrandTexSizeTest(s32 mapId) { + s32 endMap = mapId - MAPDATA_MAP_GRAND; + s32 size = 0; + s32 i; + + for (i = 1; i < endMap + 1; i++) { + size += MapData_GetSizeOfMapGrandTex((i - 1) + MAPDATA_MAP_GRAND); + } + return size; +} + +s32 MapData_GetSizeOfMapGrandTex(s32 mapId) { + return (sMapGrandStaticInfo[MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId)].texWidth * + sMapGrandStaticInfo[MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId)].texHeight) / + 2; +} + +s32 MapData_MID_GetType(s32 mapId) { + if ((mapId >= 0) && (mapId < 5)) { + return MAPDATA_MID_GAMEPLAY_DANGEON_KEEP; + } + if ((mapId >= 0x100) && (mapId < 0x162)) { + return MAPDATA_MID_MAP_GRAND_STATIC; + } + return MAPDATA_MID_MAP_I_STATIC; +} + +void MapData_GetMapTexDim(s32 mapId, s32* width, s32* height) { + switch (MapData_MID_GetType(mapId)) { + case MAPDATA_MID_GAMEPLAY_DANGEON_KEEP: + MapData_GetMapTexDimGameplayDangeonKeep(mapId, width, height); + return; + + case MAPDATA_MID_MAP_GRAND_STATIC: + MapData_GetMapTexGameplayDangeonKeepDim(mapId, width, height); + return; + + default: + *width = *height = 0; + return; + } +} + +void MapData_GetMapTexOffset(s32 mapId, s32* offsetX, s32* offsetY) { + switch (MapData_MID_GetType(mapId)) { + case MAPDATA_MID_GAMEPLAY_DANGEON_KEEP: + MapData_GetMapTexOffsetGameplayDangeonKeep(mapId, offsetX, offsetY); + return; + + case MAPDATA_MID_MAP_GRAND_STATIC: + MapData_GetMapTexGameplayDangeonKeepOffset(mapId, offsetX, offsetY); + return; + + default: + *offsetX = *offsetY = 0; + return; + } +} + +void MapData_GetMapScale(s32 mapId, s32* scale) { + switch (MapData_MID_GetType(mapId)) { + default: + *scale = 0; + return; + + case MAPDATA_MID_GAMEPLAY_DANGEON_KEEP: + *scale = MapData_GetMapGameplayDangeonKeepScale(mapId); + return; + + case MAPDATA_MID_MAP_GRAND_STATIC: + *scale = MapData_GetMapGrandScale(mapId); + return; + } +} + +void MapData_GetDrawType(s32 mapId, s32* drawType) { + switch (MapData_MID_GetType(mapId)) { + case MAPDATA_MID_GAMEPLAY_DANGEON_KEEP: + MapData_GetMapDrawTypeGameplayDangeonKeep(mapId, drawType); + return; + + case MAPDATA_MID_MAP_GRAND_STATIC: + MapData_GetMapGrandDrawType(mapId, drawType); + return; + + default: + *drawType = 0; + return; + } +} + +s32 MapData_GetMapColorIndex(s32 mapId) { + switch (MapData_MID_GetType(mapId)) { + case MAPDATA_MID_GAMEPLAY_DANGEON_KEEP: + return MapData_GetMapColorIndexGameplayDangeonKeep(mapId); + + case MAPDATA_MID_MAP_GRAND_STATIC: + return MapData_GetMapGrandColorIndex(mapId); + + default: + return 0; + } +} + +s32 func_80109964(s32 arg0) { + return D_801BF15C[arg0]; +} + +void MapData_GetMapITexDim(s32 mapId, s32* width, s32* height) { + *width = sMapIStaticInfo[mapId].texWidth; + *height = sMapIStaticInfo[mapId].texHeight; +} + +void MapData_GetMapITexOffset(s32 mapId, s32* offsetX, s32* offsetY) { + *offsetX = sMapIStaticInfo[mapId].offsetX; + *offsetY = sMapIStaticInfo[mapId].offsetY; +} + +void MapData_GetMapIDrawType(s32 mapId, s32* drawType) { + *drawType = sMapIStaticInfo[mapId].drawType; +} + +u8 MapData_GetMapIColorIndex(s32 mapId) { + return sMapIStaticInfo[mapId].colorIndex; +} + +s16 MapData_GetMapIScale(s32 mapId) { + return sMapIStaticInfo[mapId].scale; +} + +s32 MapData_MapITexSizeTest(s32 mapId) { + s32 i; + s32 size = 0; + + for (i = 1; i < mapId + 1; i++) { + size += MapDisp_GetSizeOfMapITex(i - 1); + } + + return size; +} + +s32 MapDisp_GetSizeOfMapITex(s32 mapCompactId) { + return (sMapIStaticInfo[mapCompactId].texWidth * sMapIStaticInfo[mapCompactId].texHeight) / 2; +} + +s32 MapData_GetMapIId(s32 mapId) { + switch (MapData_MID_GetType(mapId)) { + case MAPDATA_MID_GAMEPLAY_DANGEON_KEEP: + return sMapIForGameplayDangeonKeep[mapId]; + + case MAPDATA_MID_MAP_GRAND_STATIC: + return sMapIForMapGrand[MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId)]; + + default: + return 0; + } +} + +s32 func_80109B38(s32 mapId) { + if (MapData_GetMapIId(mapId) != MAPDATA_MAP_I_MAX) { + return 1; + } + switch (MapData_MID_GetType(mapId)) { + case MAPDATA_MID_GAMEPLAY_DANGEON_KEEP: + return 2; + + case MAPDATA_MID_MAP_GRAND_STATIC: + return 0; + + default: + return 0; + } +} + +s32 MapData_GetMapCompactId(s32 mapId) { + s32 mapI = MapData_GetMapIId(mapId); + + if (mapI != MAPDATA_MAP_I_MAX) { + return mapI; + } + if ((mapId >= 0x100) && (mapId < 0x162)) { + return mapId - 0xC6; + } + return -1; +} + +s32 MapData_CPID_GetType(s32 mapCompactId) { + if (mapCompactId == -1) { + return MAPDATA_CPID_2; + } + if (mapCompactId < MAPDATA_MAP_I_MAX) { + return MAPDATA_CPID_MAP_I_STATIC; + } + if (mapCompactId >= MAPDATA_MAP_I_MAX) { + return MAPDATA_CPID_MAP_GRAND_STATIC; + } + return MAPDATA_CPID_2; +} + +// Unused +s32 func_80109C38(s32 mapCompactId) { + if (mapCompactId == -1) { + return 0; + } + switch (MapData_CPID_GetType(mapCompactId)) { + case MAPDATA_CPID_MAP_GRAND_STATIC: + return MapData_MapGrandTexSizeTest(MAPDATA_GET_MAP_GRAND_ID_FROM_COMPACT_ID(mapCompactId)); + + case MAPDATA_CPID_MAP_I_STATIC: + return MapData_MapITexSizeTest(mapCompactId); + + case MAPDATA_CPID_2: + return 0; + + default: + return 0; + } +} + +s32 MapData_CPID_GetSizeOfMapTex(s32 mapCompactId) { + if (mapCompactId == -1) { + return 0; + } + switch (MapData_CPID_GetType(mapCompactId)) { + case MAPDATA_CPID_MAP_GRAND_STATIC: + return MapData_GetSizeOfMapGrandTex(MAPDATA_GET_MAP_GRAND_ID_FROM_COMPACT_ID(mapCompactId)); + + case MAPDATA_CPID_MAP_I_STATIC: + return MapDisp_GetSizeOfMapITex(mapCompactId); + + case MAPDATA_CPID_2: + return 0; + + default: + return 0; + } +} + +void MapData_CPID_GetTexDim(s32 mapCompactId, s32* width, s32* height) { + if (mapCompactId == -1) { + *width = *height = 0; + return; + } + switch (MapData_CPID_GetType(mapCompactId)) { + case MAPDATA_CPID_MAP_GRAND_STATIC: + MapData_GetMapTexGameplayDangeonKeepDim(MAPDATA_GET_MAP_GRAND_ID_FROM_COMPACT_ID(mapCompactId), width, + height); + return; + + case MAPDATA_CPID_MAP_I_STATIC: + MapData_GetMapITexDim(mapCompactId, width, height); + return; + + case MAPDATA_CPID_2: + default: + *width = *height = 0; + return; + } +} + +void MapData_CPID_GetTexOffset(s32 mapCompactId, s32* offsetX, s32* offsetY) { + if (mapCompactId == -1) { + *offsetX = *offsetY = 0; + return; + } + switch (MapData_CPID_GetType(mapCompactId)) { + case MAPDATA_CPID_MAP_GRAND_STATIC: + MapData_GetMapTexGameplayDangeonKeepOffset(MAPDATA_GET_MAP_GRAND_ID_FROM_COMPACT_ID(mapCompactId), offsetX, + offsetY); + return; + + case MAPDATA_CPID_MAP_I_STATIC: + MapData_GetMapITexOffset(mapCompactId, offsetX, offsetY); + return; + + case MAPDATA_CPID_2: + default: + *offsetX = *offsetY = 0; + return; + } +} + +// Unused +void MapData_CPID_GetDrawType(s32 mapCompactId, s32* drawType) { + if (mapCompactId == -1) { + *drawType = MAPDATA_DRAW_0; + return; + } + switch (MapData_CPID_GetType(mapCompactId)) { + case MAPDATA_CPID_MAP_GRAND_STATIC: + MapData_GetMapGrandDrawType(MAPDATA_GET_MAP_GRAND_ID_FROM_COMPACT_ID(mapCompactId), drawType); + return; + + case MAPDATA_CPID_MAP_I_STATIC: + MapData_GetMapIDrawType(mapCompactId, drawType); + return; + + case MAPDATA_CPID_2: + default: + *drawType = MAPDATA_DRAW_0; + return; + } +} + +// Unused +u8 MapData_CPID_GetMapColorIndex(s32 mapCompactId) { + if (mapCompactId == -1) { + return 0; + } + switch (MapData_CPID_GetType(mapCompactId)) { + case MAPDATA_CPID_MAP_GRAND_STATIC: + return MapData_GetMapGrandColorIndex(MAPDATA_GET_MAP_GRAND_ID_FROM_COMPACT_ID(mapCompactId)); + + case MAPDATA_CPID_MAP_I_STATIC: + return MapData_GetMapIColorIndex(mapCompactId); + + case MAPDATA_CPID_2: + default: + return 0; + } +} + +s16 MapData_CPID_GetMapScale(s32 mapCompactId) { + if (mapCompactId == -1) { + return 0; + } + switch (MapData_CPID_GetType(mapCompactId)) { + case MAPDATA_CPID_MAP_GRAND_STATIC: + return MapData_GetMapGrandScale(MAPDATA_GET_MAP_GRAND_ID_FROM_COMPACT_ID(mapCompactId)); + + case MAPDATA_CPID_MAP_I_STATIC: + return MapData_GetMapIScale(mapCompactId); + + case MAPDATA_CPID_2: + default: + return 0; + } +} diff --git a/src/code/z_map_disp.c b/src/code/z_map_disp.c index d1f09f440a..6ab61fcf72 100644 --- a/src/code/z_map_disp.c +++ b/src/code/z_map_disp.c @@ -1,109 +1,1828 @@ #include "global.h" +#include "gfx.h" +#include "sys_cmpdma.h" +#include "assets/interface/icon_item_dungeon_static/icon_item_dungeon_static.h" +#include "assets/interface/parameter_static/parameter_static.h" +#include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "overlays/actors/ovl_Door_Shutter/z_door_shutter.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80102E40.s") +void MapDisp_DestroyMapI(PlayState* play); +void MapDisp_InitMapI(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80102E90.s") +#include "gDPLoadTextureBlock_Runtime.inc.c" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80102EA4.s") +static UNK_TYPE4 D_801BEB30[2] = { 0, 0 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80102EB4.s") +static u64 sWhiteSquareTex[] = { +#include "assets/code/z_map_disp/white_square.i4.inc.c" +}; +static MapDisp sMapDisp = { + NULL, -1, 210, 140, 0, 0, NULL, -1, NULL, 0, 0, 0, 0, NULL, NULL, 0, + 0, 0, 0, 0, 0, NULL, 0, 0, 0, NULL, 0, 0, NULL, 0, 0, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80102ED0.s") +MapDataRoom sMapDataRooms[ROOM_MAX]; +MapDataChest sMapDataChests[32]; +static MapDataScene sMapDataScene = { + sMapDataRooms, + 80, +}; +static s32 sSceneNumRooms = 0; // current scene's no. of rooms +static s32 sNumChests = 0; // MinimapChest count +static TransitionActorList sTransitionActorList = { 0, NULL }; +static Color_RGBA8 sMinimapActorCategoryColors[12] = { + { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, { 0, 255, 0, 255 }, { 255, 255, 255, 255 }, + { 255, 255, 255, 255 }, { 255, 0, 0, 255 }, { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, + { 255, 255, 255, 255 }, { 255, 0, 0, 255 }, { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80102EF0.s") +TransitionActorEntry sTransitionActors[ROOM_TRANSITION_MAX]; +PauseDungeonMap sPauseDungeonMap; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80102F9C.s") +void MapDisp_GetMapITexture(void* dst, s32 mapCompactId) { + if (MapDisp_GetSizeOfMapITex(mapCompactId) != 0) { + CmpDma_LoadFile(SEGMENT_ROM_START(map_i_static), mapCompactId, dst, MapDisp_GetSizeOfMapITex(mapCompactId)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80103090.s") +void MapDisp_InitRoomStoreyRecord(PlayState* play, s16* roomStorey) { + *roomStorey = -1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801030B4.s") +void MapDisp_DestroyRoomStoreyRecord(PlayState* play, s16* roomStory) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801030F4.s") +void func_80102EB4(u32 flag) { + sMapDisp.unk20 |= flag; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801031D0.s") +void func_80102ED0(u32 flag) { + sMapDisp.unk20 &= ~flag; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801039EC.s") +s32 MapDisp_CurRoomHasMapI(PlayState* play) { + MapDataRoom* mapDataRoom; + s8 curRoom; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80103A10.s") + if (Map_IsInBossScene(play) == true) { + return true; + } + curRoom = play->roomCtx.curRoom.num; + if (curRoom == -1) { + return false; + } + mapDataRoom = &sMapDisp.mapDataScene->rooms[curRoom]; + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { + return false; + } + if (MapData_GetMapIId(mapDataRoom->mapId) == MAPDATA_MAP_I_MAX) { + return false; + } + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80103A58.s") +/** + * Computes the storey containing checkY and returns the floor Y value. + * @note Only used to check if a chest is on the same storey as the player. + */ +f32 MapDisp_GetStoreyY(f32 checkY) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_8010439C.s") + if ((sMapDisp.storeyYList[sMapDisp.numStoreys - 1] - 80.0f) < checkY) { + return sMapDisp.storeyYList[sMapDisp.numStoreys - 1]; + } + for (i = sMapDisp.numStoreys - 2; i >= 0; i--) { + if (((sMapDisp.storeyYList[i] - 80.0f) < checkY) && (checkY < (sMapDisp.storeyYList[i + 1] + 80.0f))) { + return sMapDisp.storeyYList[i]; + } + } + if (checkY < (sMapDisp.storeyYList[0] + 80.0f)) { + return sMapDisp.storeyYList[0]; + } + return 0.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801045AC.s") +void MapDisp_GetMapTexDim(MapDataRoom* mapDataRoom, s32* width, s32* height) { + MapData_GetMapTexDim(mapDataRoom->mapId, width, height); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80104AE8.s") +void MapDisp_GetMapScale(MapDataRoom* mapDataRoom, s32* scale) { + MapData_GetMapScale(mapDataRoom->mapId, scale); + if (*scale == 0) { + *scale = 20; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80104C80.s") +void MapDisp_GetMapOffset(MapDataRoom* mapDataRoom, s32* offsetX, s32* offsetY) { + s32 width; + s32 height; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80104CF4.s") + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { + *offsetX = 0; + *offsetY = 0; + return; + } + MapDisp_GetMapTexDim(mapDataRoom, &width, &height); + MapData_GetMapTexOffset(mapDataRoom->mapId, offsetX, offsetY); + if (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_X) { + s32 temp = (width / 2); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80104F34.s") + *offsetX = ((width / 2) - *offsetX) + (width / 2); + } + if (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_Y) { + s32 temp = (height / 2); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80105294.s") + *offsetY = (temp - *offsetY) + temp; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80105318.s") +void MapDisp_DrawMinimapRoom(PlayState* play, TexturePtr texture, s32 x, s32 y, s32 room, f32 intensity) { + MapDataRoom* mapDataRoom = &sMapDisp.mapDataScene->rooms[room]; + s32 texWidth; + s32 texHeight; + s32 dtdy; + s32 dsdx; + s32 t; + s32 s; + s16 dsdx_temp; + s16 dtdy_temp; + Color_RGBA8 color; + s32 drawType; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80105328.s") + if ((mapDataRoom->mapId == MAP_DATA_NO_MAP) || (texture == NULL)) { + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_8010534C.s") + MapDisp_GetMapTexDim(mapDataRoom, &texWidth, &texHeight); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_8010549C.s") + OPEN_DISPS(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_8010565C.s") + Gfx_SetupDL39_Overlay(play->state.gfxCtx); + MapData_GetMapColor(MapData_GetMapColorIndex(mapDataRoom->mapId), &color); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, color.r, color.g, color.b, + (s32)(play->interfaceCtx.minimapAlpha * intensity * color.a / 255.0f)); + MapData_GetDrawType(mapDataRoom->mapId, &drawType); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80105818.s") + switch (drawType) { + case MAPDATA_DRAW_1: + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, texture, G_IM_FMT_IA, texWidth, texHeight, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80105A40.s") + case MAPDATA_DRAW_3: + gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, 0, 0, 0, TEXEL0, 0, 0, 0, PRIMITIVE, 0, 0, 0, TEXEL0); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, texture, G_IM_FMT_I, texWidth, texHeight, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80105B34.s") + default: + case MAPDATA_DRAW_0: + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, texture, G_IM_FMT_I, texWidth, texHeight, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80105C40.s") + s = (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_X) ? (texWidth - 1) << 5 : 0; + t = (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_Y) ? 0 : (texHeight - 1) << 5; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80105FE0.s") + dsdx_temp = ((mapDataRoom->flags & MAP_DATA_ROOM_FLIP_X) ? -1 : 1) * (1 << 10); + dtdy_temp = ((mapDataRoom->flags & MAP_DATA_ROOM_FLIP_Y) ? 1 : -1) * (1 << 10); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80106408.s") + dsdx = (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_X) ? dsdx_temp & 0xFFFF : dsdx_temp; + dtdy = (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_Y) ? dtdy_temp : dtdy_temp & 0xFFFF; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80106450.s") + gSPTextureRectangle(OVERLAY_DISP++, x << 2, y << 2, (texWidth + x) << 2, (y + texHeight) << 2, G_TX_RENDERTILE, s, + t, dsdx, dtdy); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801064CC.s") + CLOSE_DISPS(play->state.gfxCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80106530.s") +// Tests if the map data should be rotated 180 degrees +// SCENE_35TAKI is the only scene with data flipped in this manner. +s32 MapDisp_IsDataRotated(PlayState* play) { + if (play->sceneId == SCENE_35TAKI) { + return true; + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_8010657C.s") +s32 MapDisp_CanDrawDoors(PlayState* play) { + if ((gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && (Cutscene_GetSceneLayer(play) != 0)) { + return false; + } + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80106644.s") +void MapDisp_Minimap_DrawActorIcon(PlayState* play, Actor* actor) { + MapDataRoom* mapDataRoom; + s32 posX; + s32 posY; + s32 texOffsetX; + s32 texOffsetY; + s32 texWidth; + s32 texHeight; + f32 scaleFrac; + f32 unused1; + f32 unused2; + Player* player = GET_PLAYER(play); + s32 scale; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_8010683C.s") + // inferred from `MapDisp_Minimap_DrawDoorActor` + unused1 = fabsf(player->actor.world.pos.y - actor->world.pos.y); + unused2 = 1.0f - (1 / 350.0f) * unused1; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801068B4.s") + if (unused2 < 0.0f) { + unused2 = 0.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801068D8.s") + mapDataRoom = &sMapDisp.mapDataScene->rooms[sMapDisp.curRoom]; + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801068FC.s") + MapDisp_GetMapOffset(mapDataRoom, &texOffsetX, &texOffsetY); + MapDisp_GetMapTexDim(mapDataRoom, &texWidth, &texHeight); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80106BEC.s") + scale = sMapDisp.mapDataScene->scale; + if (sMapDisp.mapDataScene->scale == 0) { + scale = 20; + } else if (sMapDisp.mapDataScene->scale == -1) { + s32 scaleTemp; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80106D08.s") + MapDisp_GetMapScale(mapDataRoom, &scaleTemp); + scale = scaleTemp; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80106D5C.s") + scaleFrac = 1.0f / scale; + if (!MapDisp_IsDataRotated(play)) { + posX = (s32)((actor->world.pos.x - mapDataRoom->centerX) * scaleFrac) + sMapDisp.minimapBaseX + + sMapDisp.minimapCurX - sMapDisp.minimapBaseX + texOffsetX; + posY = (s32)((actor->world.pos.z - mapDataRoom->centerZ) * scaleFrac) + sMapDisp.minimapBaseY + + sMapDisp.minimapCurY - sMapDisp.minimapBaseY + texOffsetY; + } else { + posX = -(s32)((actor->world.pos.x - mapDataRoom->centerX) * scaleFrac) + sMapDisp.minimapBaseX + + sMapDisp.minimapCurX - sMapDisp.minimapBaseX + texOffsetX; + posY = -(s32)((actor->world.pos.z - mapDataRoom->centerZ) * scaleFrac) + sMapDisp.minimapBaseY + + sMapDisp.minimapCurY - sMapDisp.minimapBaseY + texOffsetY; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80107B78.s") + if ((posX > 0) && (posX < 0x3FF) && (posY > 0) && (posY < 0x3FF)) { + OPEN_DISPS(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80108124.s") + if ((actor->category == ACTORCAT_PLAYER) && (actor->flags & ACTOR_FLAG_80000000)) { + s16 compassRot; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80108558.s") + Gfx_SetupDL42_Overlay(play->state.gfxCtx); + gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, play->interfaceCtx.minimapAlpha); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); + gDPSetRenderMode(OVERLAY_DISP++, G_RM_AA_DEC_LINE, G_RM_NOOP2); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80108A10.s") + Matrix_Translate(posX - 160.0f, 120.0f - posY, 0.0f, MTXMODE_NEW); + Matrix_RotateXFApply(-1.6f); + compassRot = (s32)(0x7FFF - actor->focus.rot.y) / 1024; + if (MapDisp_IsDataRotated(play)) { + compassRot += 0x7FFF; + } + Matrix_RotateYF(compassRot / 10.0f, MTXMODE_APPLY); + Matrix_Scale(0.4f, 0.4f, 0.4f, MTXMODE_APPLY); + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 0, play->interfaceCtx.minimapAlpha); + gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL); + } else if ((actor->id == ACTOR_EN_BOX) && !Flags_GetTreasure(play, actor->params & 0x1F) && + (MapDisp_GetStoreyY(player->actor.world.pos.y) == MapDisp_GetStoreyY(actor->world.pos.y))) { + Gfx_SetupDL39_Overlay(play->state.gfxCtx); + gDPPipeSync(OVERLAY_DISP++); + gDPSetTextureLUT(OVERLAY_DISP++, G_TT_NONE); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, play->interfaceCtx.minimapAlpha); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, play->interfaceCtx.minimapAlpha); + gDPPipeSync(OVERLAY_DISP++); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80108A64.s") + gDPLoadTextureBlock_Runtime(OVERLAY_DISP++, gMapChestIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80108AF8.s") + gSPTextureRectangle(OVERLAY_DISP++, (posX - 4) << 2, (posY - 4) << 2, (posX + 4) << 2, (posY + 4) << 2, + G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + } else { + Gfx_SetupDL39_Overlay(play->state.gfxCtx); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + if (actor->flags & ACTOR_FLAG_80000000) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMinimapActorCategoryColors[actor->category].r, + sMinimapActorCategoryColors[actor->category].g, + sMinimapActorCategoryColors[actor->category].b, play->interfaceCtx.minimapAlpha); + gSPTextureRectangle(OVERLAY_DISP++, (posX - 1) << 2, (posY - 1) << 2, (posX + 1) << 2, (posY + 1) << 2, + G_TX_RENDERTILE, 0, 0, 0x0001, 0x0001); + } + } + CLOSE_DISPS(play->state.gfxCtx); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801090B0.s") +void MapDisp_Minimap_DrawActors(PlayState* play) { + ActorContext* actorCtx; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80109124.s") + if (play->roomCtx.curRoom.num != -1) { + OPEN_DISPS(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_801091F0.s") + gDPLoadTextureBlock_4b(OVERLAY_DISP++, &sWhiteSquareTex, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_disp/func_80109428.s") + actorCtx = &play->actorCtx; + for (i = 0; i < ACTORCAT_MAX; i++) { + Actor* actor = actorCtx->actorLists[i].first; + + while (actor != NULL) { + if ((actor->update != NULL) && (actor->init == NULL) && + Object_IsLoaded(&play->objectCtx, actor->objectSlot) && + ((actor->id == ACTOR_EN_BOX) || (i == ACTORCAT_PLAYER) || (actor->flags & ACTOR_FLAG_80000000)) && + ((sMapDisp.curRoom == actor->room) || (actor->room == -1))) { + MapDisp_Minimap_DrawActorIcon(play, actor); + } + actor = actor->next; + } + } + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +void MapDisp_Minimap_DrawDoorActor(PlayState* play, Actor* actor) { + MapDataRoom* mapDataRoom; + s32 posX; + s32 posY; + s32 texOffsetX; + s32 texOffsetY; + s32 texWidth; + s32 texHeight; + Player* player = GET_PLAYER(play); + f32 scaleFrac; + f32 yDistFromPlayer = fabsf(player->actor.world.pos.y - actor->world.pos.y); + s32 scale; + f32 yDistAlpha = 1.0f - (1.0f / 350.0f) * yDistFromPlayer; + + if (yDistAlpha < 0.0f) { + yDistAlpha = 0.0f; + } + mapDataRoom = &sMapDisp.mapDataScene->rooms[sMapDisp.curRoom]; + if (mapDataRoom->mapId != MAP_DATA_NO_MAP) { + MapDisp_GetMapOffset(mapDataRoom, &texOffsetX, &texOffsetY); + MapDisp_GetMapTexDim(mapDataRoom, &texWidth, &texHeight); + + scale = sMapDisp.mapDataScene->scale; + if (sMapDisp.mapDataScene->scale == 0) { + scale = 20; + } else if (sMapDisp.mapDataScene->scale == -1) { + s32 scaleTemp; + + MapDisp_GetMapScale(mapDataRoom, &scaleTemp); + scale = scaleTemp; + } + scaleFrac = 1.0f / scale; + if (!MapDisp_IsDataRotated(play)) { + posX = (((s32)((actor->world.pos.x - mapDataRoom->centerX) * scaleFrac) + sMapDisp.minimapBaseX + + sMapDisp.minimapCurX) - + sMapDisp.minimapBaseX) + + texOffsetX; + posY = (((s32)((actor->world.pos.z - mapDataRoom->centerZ) * scaleFrac) + sMapDisp.minimapBaseY + + sMapDisp.minimapCurY) - + sMapDisp.minimapBaseY) + + texOffsetY; + } else { + posX = (((sMapDisp.minimapBaseX - (s32)((actor->world.pos.x - mapDataRoom->centerX) * scaleFrac)) + + sMapDisp.minimapCurX) - + sMapDisp.minimapBaseX) + + texOffsetX; + posY = (((sMapDisp.minimapBaseY - (s32)((actor->world.pos.z - mapDataRoom->centerZ) * scaleFrac)) + + sMapDisp.minimapCurY) - + sMapDisp.minimapBaseY) + + texOffsetY; + } + if ((posX > 0) && (posX < 0x3FF) && (posY > 0) && (posY < 0x3FF)) { + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL39_Overlay(play->state.gfxCtx); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + if ((actor->category == ACTORCAT_DOOR) && MapDisp_CanDrawDoors(play)) { + s32 pad; + + gDPSetPrimColor( + OVERLAY_DISP++, 0, 0, sMinimapActorCategoryColors[actor->category].r, + sMinimapActorCategoryColors[actor->category].g, sMinimapActorCategoryColors[actor->category].b, + (s32)((sMinimapActorCategoryColors[actor->category].a * (1.0f - sMapDisp.swapAnimTimer * 0.05f) * + yDistAlpha * play->interfaceCtx.minimapAlpha) / + 255.0f)); + + scale = sMapDisp.mapDataScene->scale; + if (sMapDisp.mapDataScene->scale == 0) { + scale = 20; + } else if (sMapDisp.mapDataScene->scale == -1) { + s32 scaleTemp; + + MapDisp_GetMapScale(mapDataRoom, &scaleTemp); + scale = scaleTemp; + } + if (scale <= 50) { + gSPTextureRectangle(OVERLAY_DISP++, (posX - 2) << 2, (posY - 2) << 2, (posX + 2) << 2, + (posY + 2) << 2, G_TX_RENDERTILE, 0, 0, 0x0001, 0x0001); + } else { + gSPTextureRectangle(OVERLAY_DISP++, (posX - 1) << 2, (posY - 1) << 2, (posX + 1) << 2, + (posY + 1) << 2, G_TX_RENDERTILE, 0, 0, 0x0001, 0x0001); + } + } + + CLOSE_DISPS(play->state.gfxCtx); + } + } +} + +void MapDisp_Minimap_DrawDoorActors(PlayState* play) { + s32 i; + Actor* actor; + + if (play->roomCtx.curRoom.num != -1) { + OPEN_DISPS(play->state.gfxCtx); + + gDPLoadTextureBlock_4b(OVERLAY_DISP++, &sWhiteSquareTex, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + actor = play->actorCtx.actorLists[ACTORCAT_DOOR].first; + while (actor != NULL) { + if ((actor->update != NULL) && (actor->init == NULL) && + Object_IsLoaded(&play->objectCtx, actor->objectSlot) && + ((sMapDisp.curRoom == actor->room) || (actor->room == -1))) { + MapDisp_Minimap_DrawDoorActor(play, actor); + } + actor = actor->next; + } + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +/** + * @brief Waits for GAMEPLAY_DANGEON_KEEP to load, if it is a current object depenency + * + * @param play + */ +void MapDisp_AwaitGameplayDangeonKeep(PlayState* play) { + s32 objectSlot = Object_GetSlot(&play->objectCtx, GAMEPLAY_DANGEON_KEEP); + + if (objectSlot <= OBJECT_SLOT_NONE) { + sMapDisp.unk20 |= 1; + return; + } + + while (true) { + if (Object_IsLoaded(&play->objectCtx, objectSlot)) { + break; + } + } +} + +void MapDisp_Init(PlayState* play) { + s32 i; + + sMapDisp.mapDataScene = NULL; + sMapDisp.curRoom = -1; + sMapDisp.minimapBaseX = 210; + sMapDisp.minimapBaseY = 140; + sMapDisp.minimapCurX = 210; + sMapDisp.minimapCurY = 140; + sMapDisp.minimapCurTex = NULL; + sMapDisp.prevRoom = -1; + sMapDisp.minimapPrevTex = NULL; + sMapDisp.minimapPrevX = 0; + sMapDisp.minimapPrevY = 0; + sMapDisp.unk20 = 0; + sMapDisp.swapAnimTimer = 0; + + if (!Map_IsInBossScene(play)) { + sSceneNumRooms = play->numRooms; + } + sMapDisp.texBuff0 = THA_AllocTailAlign16(&play->state.tha, 0x4000); + sMapDisp.texBuff1 = THA_AllocTailAlign16(&play->state.tha, 0x4000); + MapDisp_AwaitGameplayDangeonKeep(play); + if (!Map_IsInBossScene(play)) { + sMapDisp.sceneMinX = 0; + sMapDisp.sceneMinZ = 0; + sMapDisp.sceneWidth = 100; + sMapDisp.sceneHeight = 100; + sMapDisp.sceneMidX = TRUNCF_BINANG((f32)sMapDisp.sceneMinX + ((f32)sMapDisp.sceneWidth * 0.5f)); + sMapDisp.sceneMidZ = TRUNCF_BINANG((f32)sMapDisp.sceneMinZ + ((f32)sMapDisp.sceneHeight * 0.5f)); + } + sMapDisp.roomStoreyList = THA_AllocTailAlign16(&play->state.tha, sSceneNumRooms * sizeof(s16)); + + for (i = 0; i < sSceneNumRooms; i++) { + MapDisp_InitRoomStoreyRecord(play, &sMapDisp.roomStoreyList[i]); + } + sMapDisp.storeyYList = THA_AllocTailAlign16(&play->state.tha, ROOM_MAX * sizeof(s16)); + + for (i = 0; i < ROOM_MAX; i++) { + sMapDisp.storeyYList[i] = FLOOR_MIN_Y; + } + MapDisp_InitMapI(play); + sMapDisp.bossRoomStorey = 0; + sMapDisp.unk5A = 0; + if (Map_IsInBossScene(play)) { + MapDisp_InitMapData(play, NULL); + MapDisp_InitChestData(play, 0, NULL); + } +} + +typedef struct { + /* 0x0 */ s16 sceneId; + /* 0x2 */ s16 bottomStorey; +} MapCustomBottomStorey; // size = 0x4 + +void MapDisp_InitSceneFloorData(PlayState* play) { + static MapCustomBottomStorey sCustomBottomStorey[] = { + { SCENE_HAKUGIN, -1 }, { SCENE_HAKUGIN_BS, -1 }, { SCENE_SEA, -2 }, + { SCENE_SEA_BS, -2 }, { SCENE_INISIE_N, -1 }, + }; + s32 i1; + s32 i2; + s32 i3; + s32 storey; + + // init table + for (i1 = 0; i1 < ROOM_MAX; i1++) { + sMapDisp.storeyYList[i1] = FLOOR_MIN_Y; + } + + // for all rooms in scene + for (i2 = 0; i2 < sSceneNumRooms; i2++) { + MapDataRoom* mapDataRoom = &sMapDisp.mapDataScene->rooms[i2]; + + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { + continue; + } + // add item to the table if it is a newish value + for (i1 = 0; i1 < ROOM_MAX; i1++) { + if (sMapDisp.storeyYList[i1] == FLOOR_MIN_Y) { + sMapDisp.storeyYList[i1] = mapDataRoom->floorY; + break; + } else if (fabsf((f32)sMapDisp.storeyYList[i1] - (f32)mapDataRoom->floorY) < 5.0f) { + break; + } + } + } + + // sort the table in ascending order + for (i2 = 0; i2 < sSceneNumRooms; i2++) { + if (sMapDisp.storeyYList[i2] == FLOOR_MIN_Y) { + break; + } + for (i3 = i2 + 1; i3 < sSceneNumRooms; i3++) { + if (sMapDisp.storeyYList[i3] == FLOOR_MIN_Y) { + break; + } + if (sMapDisp.storeyYList[i3] < sMapDisp.storeyYList[i2]) { + s16 swap = sMapDisp.storeyYList[i2]; + + sMapDisp.storeyYList[i2] = sMapDisp.storeyYList[i3]; + sMapDisp.storeyYList[i3] = swap; + } + } + } + + for (i2 = 0; i2 < sSceneNumRooms; i2++) { + MapDataRoom* mapDataRoom = &sMapDisp.mapDataScene->rooms[i2]; + + sMapDisp.roomStoreyList[i2] = -1; + + for (storey = 0; storey < sSceneNumRooms; storey++) { + if (sMapDisp.storeyYList[storey] != FLOOR_MIN_Y) { + if (fabsf((f32)sMapDisp.storeyYList[storey] - (f32)mapDataRoom->floorY) < 5.0f) { + sMapDisp.roomStoreyList[i2] = storey; + break; + } + } + } + } + sMapDisp.numStoreys = 0; + for (i2 = 0; i2 < sSceneNumRooms; i2++) { + if (sMapDisp.storeyYList[i2] != FLOOR_MIN_Y) { + sMapDisp.numStoreys++; + } + } + sMapDisp.bottomStorey = 0; + for (i2 = 0; i2 < ARRAY_COUNT(sCustomBottomStorey); i2++) { + if (play->sceneId == sCustomBottomStorey[i2].sceneId) { + sMapDisp.bottomStorey = sCustomBottomStorey[i2].bottomStorey; + } + } +} + +/** + * Unused result + * @returns the y position to place the boss room skull icon on the pause map. + * The result position is the inverse of what it should be, stacking lower rooms above higher ones + */ +s32 MapDisp_GetBossIconY(void) { + s32 dungeonMapFloorIconPosY[5] = { 67, 81, 95, 109, 123 }; + + if ((sMapDisp.mapDataScene == NULL) || (sMapDisp.bossRoomStorey < 0) || (sMapDisp.bossRoomStorey >= 5) || + (sSceneNumRooms == 0)) { + return 123; + } + return dungeonMapFloorIconPosY[sMapDisp.bossRoomStorey]; +} + +s16 MapDisp_GetBossRoomStorey(void) { + return sMapDisp.bossRoomStorey; +} + +// TransitionActor params test +s32 MapDisp_IsBossDoor(s32 params) { + if (DOORSHUTTER_PARAMS_GET_TYPE((u16)params) == DOORSHUTTER_TYPE_BOSS_DOOR) { + return true; + } + return false; +} + +void MapDisp_InitBossRoomStorey(PlayState* play) { + TransitionActorList* transitionActors = &sTransitionActorList; + s32 storey; + s32 i; + + for (i = 0; i < transitionActors->count; i++) { + if (MapDisp_IsBossDoor(sTransitionActors[i].params)) { + if (ABS_ALT(sTransitionActors[i].id) != ACTOR_EN_HOLL) { + for (storey = 0; storey < sMapDisp.numStoreys; storey++) { + //! FAKE: needed for matching + s32 temp = (sMapDisp.storeyYList[storey] - 5); + + if (((storey == sMapDisp.numStoreys - 1) && + (sTransitionActors[i].pos.y >= (sMapDisp.storeyYList[storey] - 5))) || + ((storey != sMapDisp.numStoreys - 1) && + (sTransitionActors[i].pos.y >= (sMapDisp.storeyYList[storey] - 5)) && + (sTransitionActors[i].pos.y < (sMapDisp.storeyYList[storey + 1] - 5)))) { + sMapDisp.bossRoomStorey = storey; + return; + } + } + } + } + } + sMapDisp.bossRoomStorey = 0; +} + +/** + * @brief Initializes the MapData for the current scene + * + * @param play + * @param segmentAddress + */ +void MapDisp_InitMapData(PlayState* play, void* segmentAddress) { + MapDataScene* mapDataScene; + MapDataRoom* mapDataRooms; + s32 i; + + if (!Map_IsInBossScene(play)) { + sSceneNumRooms = play->numRooms; + mapDataScene = Lib_SegmentedToVirtual(segmentAddress); + sMapDataScene = *mapDataScene; + mapDataRooms = Lib_SegmentedToVirtual(mapDataScene->rooms); + + for (i = 0; i < sSceneNumRooms; i++) { + sMapDataRooms[i] = *mapDataRooms++; + } + + sMapDataScene.rooms = sMapDataRooms; + if (play->colCtx.colHeader != NULL) { + sMapDisp.sceneMinX = play->colCtx.colHeader->minBounds.x; + sMapDisp.sceneMinZ = play->colCtx.colHeader->minBounds.z; + sMapDisp.sceneWidth = play->colCtx.colHeader->maxBounds.x - play->colCtx.colHeader->minBounds.x; + sMapDisp.sceneHeight = play->colCtx.colHeader->maxBounds.z - play->colCtx.colHeader->minBounds.z; + sMapDisp.sceneMidX = sMapDisp.sceneMinX + (sMapDisp.sceneWidth * 0.5f); + sMapDisp.sceneMidZ = sMapDisp.sceneMinZ + (sMapDisp.sceneHeight * 0.5f); + } + } + sMapDisp.mapDataScene = &sMapDataScene; + MapDisp_InitSceneFloorData(play); + MapDisp_InitBossRoomStorey(play); +} + +/** + * @brief Creates a deep copy of chest data from the scene data. + * + * @param play + * @param num + * @param segmentAddress + * @note If a boss scene is loaded, no data is copied. This allows the scene to borrow the main dungeon scene data + * instead. + */ +void MapDisp_InitChestData(PlayState* play, s32 num, void* segmentAddress) { + MapDataChest* mapDataChests; + s32 i; + + if (!Map_IsInBossScene(play)) { + mapDataChests = Lib_SegmentedToVirtual(segmentAddress); + for (i = 0; i < num; mapDataChests++, i++) { + sMapDataChests[i] = *mapDataChests; + } + sNumChests = num; + } + sMapDisp.mapDataChests = sMapDataChests; + sMapDisp.numChests = sNumChests; +} + +/** + * @brief Creates a deep copy of transition actors from the scene data. + * + * @param play + * @param num number of transition actors within the list + * @param transitionActorList pointer to the list of transition actors + * @note If a boss scene is loaded, no data is copied. This allows the scene to borrow the main dungeon scene data + * instead. + */ +void MapDisp_InitTransitionActorData(PlayState* play, s32 num, TransitionActorEntry* transitionActorList) { + s32 i; + + if (!Map_IsInBossScene(play)) { + sTransitionActorList.count = num; + for (i = 0; i < num; i++) { + sTransitionActors[i] = transitionActorList[i]; + } + sTransitionActorList.list = sTransitionActors; + } +} + +void MapDisp_Destroy(PlayState* play) { + s32 i; + + sMapDisp.mapDataScene = NULL; + sMapDisp.curRoom = -1; + sMapDisp.minimapCurX = 210; + sMapDisp.minimapCurY = 140; + sMapDisp.minimapCurTex = NULL; + sMapDisp.prevRoom = -1; + sMapDisp.minimapPrevTex = NULL; + sMapDisp.minimapPrevX = 0; + sMapDisp.minimapPrevY = 0; + sMapDisp.unk20 = 0; + sMapDisp.swapAnimTimer = 0; + sMapDisp.texBuff0 = NULL; + sMapDisp.texBuff1 = NULL; + + for (i = 0; i < sSceneNumRooms; i++) { + MapDisp_DestroyRoomStoreyRecord(play, &sMapDisp.roomStoreyList[i]); + } + + sMapDisp.roomStoreyList = NULL; + sMapDisp.numStoreys = 0; + sMapDisp.pauseMapCurStorey = 0; + sMapDisp.bottomStorey = 0; + sMapDisp.timer = 0; + sMapDisp.storeyYList = NULL; + sMapDisp.numChests = 0; + sMapDisp.mapDataChests = NULL; + MapDisp_DestroyMapI(play); + sMapDisp.unk5A = 0; +} + +void MapDisp_Update(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + s16 currentX; + s16 currentY; + s16 targetX; + s16 targetY; + + if ((sMapDisp.mapDataScene != NULL) && (sSceneNumRooms != 0)) { + sMapDisp.pauseMapCurStorey = DUNGEON_FLOOR_INDEX_0 - pauseCtx->cursorMapDungeonItem; + if (sMapDisp.prevRoom != -1) { + if (sMapDisp.swapAnimTimer > 0) { + targetX = sMapDisp.minimapBaseX; + currentX = sMapDisp.minimapCurX; + if (targetX != currentX) { + sMapDisp.minimapCurX = + TRUNCF_BINANG(((f32)(targetX - currentX) / (f32)sMapDisp.swapAnimTimer) + (f32)currentX); + } + targetY = sMapDisp.minimapBaseY; + currentY = sMapDisp.minimapCurY; + if (targetY != currentY) { + sMapDisp.minimapCurY = + TRUNCF_BINANG(((f32)(targetY - currentY) / (f32)sMapDisp.swapAnimTimer) + (f32)currentY); + } + sMapDisp.swapAnimTimer--; + } else { + sMapDisp.prevRoom = -1; + sMapDisp.swapAnimTimer = 0; + sMapDisp.minimapCurX = sMapDisp.minimapBaseX; + sMapDisp.minimapCurY = sMapDisp.minimapBaseY; + } + } else { + sMapDisp.swapAnimTimer = 0; + } + } +} + +void MapDisp_SwapRooms(s16 nextRoom) { + MapDataRoom* nextMapDataRoom; + MapDataRoom* prevMapDataRoom; + s32 minimapBaseX; + s32 minimapBaseY; + s32 width; + s32 height; + s32 offsetX; + s32 offsetY; + + if ((sMapDisp.mapDataScene != NULL) && (sSceneNumRooms != 0) && (nextRoom != -1)) { + nextMapDataRoom = &sMapDisp.mapDataScene->rooms[nextRoom]; + if ((nextMapDataRoom->mapId < MAPDATA_GAMEPLAY_DANGEON_KEEP_MAX) || + ((nextMapDataRoom->mapId >= MAPDATA_MAP_GRAND) && (nextMapDataRoom->mapId < MAPDATA_MAP_GRAND_MAX)) || + nextMapDataRoom->mapId == MAP_DATA_NO_MAP) { + + sMapDisp.prevRoom = sMapDisp.curRoom; + sMapDisp.curRoom = nextRoom; + sMapDisp.swapAnimTimer = 20; + + sMapDisp.minimapPrevTex = sMapDisp.minimapCurTex; + minimapBaseX = sMapDisp.minimapBaseX; + minimapBaseY = sMapDisp.minimapBaseY; + + nextMapDataRoom = &sMapDisp.mapDataScene->rooms[sMapDisp.curRoom]; + + if (nextMapDataRoom->mapId == MAP_DATA_NO_MAP) { + sMapDisp.minimapPrevY = 0; + sMapDisp.minimapBaseX = 210; + sMapDisp.minimapBaseY = 140; + sMapDisp.minimapCurX = 210; + sMapDisp.minimapCurY = 140; + sMapDisp.minimapCurTex = NULL; + sMapDisp.minimapPrevX = sMapDisp.minimapPrevY; + return; + } + MapDisp_GetMapOffset(nextMapDataRoom, &offsetX, &offsetY); + MapDisp_GetMapTexDim(nextMapDataRoom, &width, &height); + sMapDisp.minimapBaseX = 295 - width; + sMapDisp.minimapBaseY = 220 - height; + if (sMapDisp.prevRoom != -1) { + prevMapDataRoom = &sMapDisp.mapDataScene->rooms[sMapDisp.prevRoom]; + if (prevMapDataRoom->mapId == MAP_DATA_NO_MAP) { + sMapDisp.minimapCurTex = NULL; + sMapDisp.minimapPrevX = sMapDisp.minimapPrevY = 0; + sMapDisp.minimapCurX = sMapDisp.minimapBaseX; + sMapDisp.minimapCurY = sMapDisp.minimapBaseY; + return; + } else { + s32 prevOffsetX; + s32 prevOffsetY; + s32 scale; + s32 pad; + + MapDisp_GetMapOffset(prevMapDataRoom, &prevOffsetX, &prevOffsetY); + scale = sMapDisp.mapDataScene->scale; + if (sMapDisp.mapDataScene->scale == 0) { + scale = 20; + } else if (sMapDisp.mapDataScene->scale == -1) { + s32 scaleTemp; + + MapDisp_GetMapScale(nextMapDataRoom, &scaleTemp); + scale = scaleTemp; + } + sMapDisp.minimapPrevX = + TRUNCF_BINANG(((f32)offsetX + (((f32)prevMapDataRoom->centerX - (f32)nextMapDataRoom->centerX) * + (1.0f / scale))) - + (f32)prevOffsetX); + sMapDisp.minimapPrevY = + TRUNCF_BINANG(((f32)offsetY + (((f32)prevMapDataRoom->centerZ - (f32)nextMapDataRoom->centerZ) * + (1.0f / scale))) - + (f32)prevOffsetY); + sMapDisp.minimapCurX = minimapBaseX - sMapDisp.minimapPrevX; + sMapDisp.minimapCurY = minimapBaseY - sMapDisp.minimapPrevY; + } + } else { + sMapDisp.minimapPrevX = sMapDisp.minimapPrevY = 0; + sMapDisp.minimapCurX = sMapDisp.minimapBaseX; + sMapDisp.minimapCurY = sMapDisp.minimapBaseY; + } + sMapDisp.minimapCurTex = NULL; + + switch (MapData_MID_GetType(nextMapDataRoom->mapId)) { + case MAPDATA_MID_GAMEPLAY_DANGEON_KEEP: + sMapDisp.minimapCurTex = MapData_GetMapTexGameplayDangeonKeep(nextMapDataRoom->mapId); + return; + + case MAPDATA_MID_MAP_GRAND_STATIC: + if (sMapDisp.minimapPrevTex == sMapDisp.texBuff0) { + sMapDisp.minimapCurTex = sMapDisp.texBuff1; + } else { + sMapDisp.minimapCurTex = sMapDisp.texBuff0; + } + if (MapData_GetSizeOfMapGrandTex(nextMapDataRoom->mapId) != 0) { + CmpDma_LoadFile(SEGMENT_ROM_START(map_grand_static), + MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(nextMapDataRoom->mapId), + sMapDisp.minimapCurTex, MapData_GetSizeOfMapGrandTex(nextMapDataRoom->mapId)); + } + break; + + default: + break; + } + } + } +} + +void MapDisp_Minimap_DrawRedCompassIcon(PlayState* play, s32 x, s32 z, s32 rot) { + MapDataRoom* mapDataRoom; + s32 posX; + s32 posY; + s32 texOffsetX; + s32 texOffsetY; + s32 texWidth; + s32 texHeight; + s32 scale; + f32 scaleFrac; + + mapDataRoom = &sMapDisp.mapDataScene->rooms[sMapDisp.curRoom]; + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { + return; + } + + MapDisp_GetMapOffset(mapDataRoom, &texOffsetX, &texOffsetY); + MapDisp_GetMapTexDim(mapDataRoom, &texWidth, &texHeight); + scale = sMapDisp.mapDataScene->scale; + + if (sMapDisp.mapDataScene->scale == 0) { + scale = 20; + } else if (sMapDisp.mapDataScene->scale == -1) { + s32 scaleTemp; + + MapDisp_GetMapScale(mapDataRoom, &scaleTemp); + scale = scaleTemp; + } + + scaleFrac = 1.0f / scale; + if (!MapDisp_IsDataRotated(play)) { + posX = (s32)((x - (f32)mapDataRoom->centerX) * scaleFrac) + sMapDisp.minimapBaseX + + (sMapDisp.minimapCurX - sMapDisp.minimapBaseX) + texOffsetX; + posY = (s32)((z - (f32)mapDataRoom->centerZ) * scaleFrac) + sMapDisp.minimapBaseY + + (sMapDisp.minimapCurY - sMapDisp.minimapBaseY) + texOffsetY; + } else { + posX = -(s32)((x - (f32)mapDataRoom->centerX) * scaleFrac) + sMapDisp.minimapBaseX + + (sMapDisp.minimapCurX - sMapDisp.minimapBaseX) + texOffsetX; + posY = -(s32)((z - (f32)mapDataRoom->centerZ) * scaleFrac) + sMapDisp.minimapBaseY + + (sMapDisp.minimapCurY - sMapDisp.minimapBaseY) + texOffsetY; + } + + if ((posX > 0) && (posX < 0x3FF) && (posY > 0) && (posY < 0x3FF)) { + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL42_Overlay(play->state.gfxCtx); + gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); + gDPSetRenderMode(OVERLAY_DISP++, G_RM_AA_DEC_LINE, G_RM_NOOP2); + Matrix_Translate(posX - 160.0f, 120.0f - posY, 0.0f, MTXMODE_NEW); + Matrix_RotateXFApply(-1.6f); + if (MapDisp_IsDataRotated(play)) { + rot += 0x7FFF; + } + Matrix_RotateYF(rot / 10.0f, MTXMODE_APPLY); + Matrix_Scale(0.4f, 0.4f, 0.4f, MTXMODE_APPLY); + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(OVERLAY_DISP++, 0, 255, 200, 0, 0, play->interfaceCtx.minimapAlpha); + gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL); + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +s32 MapDisp_IsLocationRomaniRanchAltScene(PlayState* play) { + if ((gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && (Cutscene_GetSceneLayer(play) != 0)) { + return true; + } + return false; +} + +s32 MapDisp_CanDisplayMinimap(PlayState* play) { + if ((!Map_CurRoomHasMapI(play) && Inventory_IsMapVisible(play->sceneId)) || + (Map_CurRoomHasMapI(play) && CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.mapIndex))) { + return true; + } + return false; +} + +s32 MapDisp_IsLocationMinimapBlocked(PlayState* play) { + if (((play->csCtx.state != CS_STATE_IDLE) && !MapDisp_IsLocationRomaniRanchAltScene(play)) || + (sMapDisp.unk20 & 2) || Map_IsInBossScene(play)) { + return true; + } + return false; +} + +s32 MapDisp_IsMinimapToggleBlocked(PlayState* play) { + if ((MapDisp_IsLocationMinimapBlocked(play) == true) || !MapDisp_CanDisplayMinimap(play)) { + return true; + } + return false; +} + +s32 MapDisp_AreRoomsSameStorey(s32 curRoom, s32 prevRoom) { + MapDataRoom* mapDataRoom; + s16* roomStoreyList; + + if ((curRoom == -1) || (prevRoom == -1)) { + return false; + } + mapDataRoom = &sMapDisp.mapDataScene->rooms[curRoom]; + roomStoreyList = sMapDisp.roomStoreyList; + if ((roomStoreyList[curRoom] <= roomStoreyList[prevRoom]) && + (roomStoreyList[prevRoom] <= (roomStoreyList[curRoom] + MAP_DATA_ROOM_GET_EXTRA_STOREYS(mapDataRoom)))) { + return true; + } + mapDataRoom = &sMapDisp.mapDataScene->rooms[prevRoom]; + if ((roomStoreyList[prevRoom] <= roomStoreyList[curRoom]) && + (roomStoreyList[curRoom] <= (roomStoreyList[prevRoom] + MAP_DATA_ROOM_GET_EXTRA_STOREYS(mapDataRoom)))) { + return true; + } + return false; +} + +void MapDisp_DrawMinimap(PlayState* play, s32 playerInitX, s32 playerInitZ, s32 playerInitDir) { + PauseContext* pauseCtx = &play->pauseCtx; + + if ((sMapDisp.mapDataScene != NULL) && ((s32)pauseCtx->state <= PAUSE_STATE_OPENING_2) && !R_MINIMAP_DISABLED && + (play->interfaceCtx.minimapAlpha != 0)) { + if (!MapDisp_IsLocationMinimapBlocked(play) && (sSceneNumRooms != 0)) { + if (MapDisp_CanDisplayMinimap(play)) { + MapDisp_DrawMinimapRoom(play, sMapDisp.minimapCurTex, sMapDisp.minimapCurX, sMapDisp.minimapCurY, + sMapDisp.curRoom, 1.0f - (sMapDisp.swapAnimTimer * 0.05f)); + if ((sMapDisp.curRoom != sMapDisp.prevRoom) && + MapDisp_AreRoomsSameStorey(sMapDisp.curRoom, sMapDisp.prevRoom)) { + MapDisp_DrawMinimapRoom(play, sMapDisp.minimapPrevTex, sMapDisp.minimapCurX + sMapDisp.minimapPrevX, + sMapDisp.minimapCurY + sMapDisp.minimapPrevY, sMapDisp.prevRoom, + sMapDisp.swapAnimTimer * 0.05f); + } + MapDisp_Minimap_DrawDoorActors(play); + } + if ((!Map_CurRoomHasMapI(play) || CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.mapIndex)) && + (Map_CurRoomHasMapI(play) || Inventory_IsMapVisible(play->sceneId))) { + if (play->interfaceCtx.minigameState == MINIGAME_STATE_NONE) { + MapDisp_Minimap_DrawRedCompassIcon(play, playerInitX, playerInitZ, playerInitDir); + } + MapDisp_Minimap_DrawActors(play); + } + } + } +} + +void MapDisp_ResetMapI(void) { + s32 i; + + sPauseDungeonMap.textureCount = 0; + for (i = 0; i < ROOM_MAX; i++) { + sPauseDungeonMap.mapI_mapCompactId[i] = 0; + sPauseDungeonMap.mapI_roomTextures[i] = NULL; + sPauseDungeonMap.roomSprite[i] = NULL; + } + + sPauseDungeonMap.animTimer = 0; + sMapDisp.unk20 &= ~1; +} + +void MapDisp_InitMapI(PlayState* play) { + MapDisp_ResetMapI(); +} + +void MapDisp_DestroyMapI(PlayState* play) { + MapDisp_ResetMapI(); +} + +// alloc pause screen dungeon map +void* MapDisp_AllocDungeonMap(PlayState* play, void* heap) { + void* heapNext; + s32 dungeonMapRoomIter; + s32 sceneRoomIter; + + heapNext = heap; + if ((sMapDisp.mapDataScene == NULL) || (sSceneNumRooms == 0)) { + return heapNext; + } + sPauseDungeonMap.textureCount = 0; + + // loop for number of rooms + for (sceneRoomIter = 0; sceneRoomIter < sSceneNumRooms; sceneRoomIter++) { + s32 mapCompactId; + MapDataRoom* mapDataRoom = &sMapDisp.mapDataScene->rooms[sceneRoomIter]; + s32 isDuplicateTexture = false; + + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { + continue; + } + mapCompactId = MapData_GetMapCompactId(mapDataRoom->mapId); + if (mapCompactId == -1) { + continue; + } + // test if the texture reference already exists + for (dungeonMapRoomIter = 0; dungeonMapRoomIter < sPauseDungeonMap.textureCount; dungeonMapRoomIter++) { + if (mapCompactId == sPauseDungeonMap.mapI_mapCompactId[dungeonMapRoomIter]) { + isDuplicateTexture = true; + break; + } + } + if (isDuplicateTexture == false) { + sPauseDungeonMap.mapI_mapCompactId[sPauseDungeonMap.textureCount] = mapCompactId; + sPauseDungeonMap.textureCount++; + } + } + + // fetch all textures from rom + sPauseDungeonMap.mapI_roomTextures[0] = heap; + for (dungeonMapRoomIter = 0; dungeonMapRoomIter < sPauseDungeonMap.textureCount; dungeonMapRoomIter++) { + s32 mapCompactId = sPauseDungeonMap.mapI_mapCompactId[dungeonMapRoomIter]; + + MapDisp_GetMapITexture(sPauseDungeonMap.mapI_roomTextures[dungeonMapRoomIter], mapCompactId); + if (dungeonMapRoomIter + 1 < sPauseDungeonMap.textureCount) { + sPauseDungeonMap.mapI_roomTextures[dungeonMapRoomIter + 1] = + (void*)ALIGN16((uintptr_t)sPauseDungeonMap.mapI_roomTextures[dungeonMapRoomIter] + + MapData_CPID_GetSizeOfMapTex(mapCompactId)); + } else { + heapNext = (void*)((uintptr_t)sPauseDungeonMap.mapI_roomTextures[dungeonMapRoomIter] + + MapData_CPID_GetSizeOfMapTex(mapCompactId)); + } + } + + for (sceneRoomIter = 0; sceneRoomIter < sSceneNumRooms; sceneRoomIter++) { + MapDataRoom* mapDataRoom = &sMapDisp.mapDataScene->rooms[sceneRoomIter]; + s32 foundTexture = false; + s32 mapCompactId; + + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { + sPauseDungeonMap.roomSprite[sceneRoomIter] = NULL; + } else { + mapCompactId = MapData_GetMapCompactId(mapDataRoom->mapId); + for (dungeonMapRoomIter = 0; dungeonMapRoomIter < sPauseDungeonMap.textureCount; dungeonMapRoomIter++) { + if (mapCompactId == sPauseDungeonMap.mapI_mapCompactId[dungeonMapRoomIter]) { + foundTexture = true; + break; + } + } + if (!foundTexture) { + sPauseDungeonMap.roomSprite[sceneRoomIter] = NULL; + } else { + void* dummy = sPauseDungeonMap.mapI_roomTextures[dungeonMapRoomIter]; //! FAKE: + + sPauseDungeonMap.roomSprite[sceneRoomIter] = sPauseDungeonMap.mapI_roomTextures[dungeonMapRoomIter]; + } + } + } + return heapNext; +} + +s32 MapDisp_IsOnStorey(s32 storey, f32 checkY) { + if (storey == 0) { + if ((sMapDisp.storeyYList[0] <= checkY) && ((sMapDisp.numStoreys == 1) || (checkY < sMapDisp.storeyYList[1]))) { + return true; + } + } else if (storey >= (sMapDisp.numStoreys - 1)) { + if (sMapDisp.storeyYList[sMapDisp.numStoreys - 1] <= checkY) { + return true; + } + } else if ((sMapDisp.storeyYList[storey] <= checkY) && (checkY < sMapDisp.storeyYList[storey + 1])) { + return true; + } + return false; +} + +s32 MapDisp_ConvertBossSceneToDungeonScene(s32 sceneId) { + switch (sceneId) { + case SCENE_MITURIN_BS: + return SCENE_MITURIN; + + case SCENE_HAKUGIN_BS: + return SCENE_HAKUGIN; + + case SCENE_SEA_BS: + return SCENE_SEA; + + case SCENE_INISIE_BS: + return SCENE_INISIE_N; + + default: + return sceneId; + } +} + +/** + * @brief Draws the dungeon room sprites for the pause menu dungeon map + * + * @param play + * @param viewX top left x position of the dungeon map view window + * @param viewY top left y posiiton of the dungeon map view window + * @param viewWidth width in pixels of the dungeon map view window + * @param viewHeight height in pixels of the dungeon map view window + * @param scaleFrac ratio to convert world space coordinates to map coordinates + * @param dungeonSceneSharedIndex enum DungeonSceneIndex for retrieving map/compass data + */ +void MapDisp_DrawRooms(PlayState* play, s32 viewX, s32 viewY, s32 viewWidth, s32 viewHeight, f32 scaleFrac, + s32 dungeonSceneSharedIndex) { + static u16 sUnvisitedRoomPal[16] = { + 0x0000, 0x0000, 0xFFC1, 0x07C1, 0x07FF, 0x003F, 0xFB3F, 0xF305, + 0x0453, 0x0577, 0x0095, 0x82E5, 0xFD27, 0x7A49, 0x94A5, 0x0001, + }; // palette 0 + static u16 sVisitedRoomPal[16] = { + 0x0000, 0x027F, 0xFFC1, 0x07C1, 0x07FF, 0x003F, 0xFB3F, 0xF305, + 0x0453, 0x0577, 0x0095, 0x82E5, 0xFD27, 0x7A49, 0x94A5, 0x0001, + }; // palette 1 + static u16 sCurrentRoomPal[16] = { + 0x0000, 0x0623, 0xFFC1, 0x07C1, 0x07FF, 0x003F, 0xFB3F, 0xF305, + 0x0453, 0x0577, 0x0095, 0x82E5, 0xFD27, 0x7A49, 0x94A5, 0x0001, + }; // palette 2 + PauseContext* pauseCtx = &play->pauseCtx; + s32 pad[4]; + s32 i; + s32 green = ((sPauseDungeonMap.animTimer * -120.0f / 40.0f) + 200.0f) * 31.0f / 255.0f; + s32 blue = ((sPauseDungeonMap.animTimer * 115.0f / 40.0f) + 140.0f) * 31.0f / 255.0f; + + sCurrentRoomPal[1] = (green << 6) | (blue << 1) | 1; + + if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, dungeonSceneSharedIndex)) { + s32 requiredScopeTemp; + + sUnvisitedRoomPal[15] = 0xAD5F; + sVisitedRoomPal[15] = 0xAD5F; + sCurrentRoomPal[15] = 0xAD5F; + } else { + sCurrentRoomPal[15] = sVisitedRoomPal[15] = sUnvisitedRoomPal[15] = 0; + } + + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL39_Opa(play->state.gfxCtx); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + gDPLoadTLUT_pal16(POLY_OPA_DISP++, 0, sUnvisitedRoomPal); + gDPLoadTLUT_pal16(POLY_OPA_DISP++, 1, sVisitedRoomPal); + gDPLoadTLUT_pal16(POLY_OPA_DISP++, 2, sCurrentRoomPal); + gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16); + + for (i = 0; i < sSceneNumRooms; i++) { + s32 texWidth; + s32 texHeight; + s32 offsetX; + s32 offsetY; + MapDataRoom* mapDataRoom; + TexturePtr roomTexture; + s32 s; + s32 t; + s32 dsdx; + s32 dtdy; + s32 texPosX; + s32 texPosY; + s32 spE8; + s32 two = 2; + + mapDataRoom = &sMapDisp.mapDataScene->rooms[i]; + if ((mapDataRoom->mapId == MAP_DATA_NO_MAP) || (mapDataRoom->mapId >= MAPDATA_MAP_GRAND_MAX)) { + continue; + } + + if ((sMapDisp.pauseMapCurStorey < sMapDisp.roomStoreyList[i]) || + ((sMapDisp.roomStoreyList[i] + MAP_DATA_ROOM_GET_EXTRA_STOREYS(mapDataRoom)) < + sMapDisp.pauseMapCurStorey)) { + continue; + } + + roomTexture = sPauseDungeonMap.roomSprite[i]; + if (roomTexture == NULL) { + continue; + } + + spE8 = MapData_GetMapCompactId(mapDataRoom->mapId); + if (spE8 == -1) { + continue; + } + + MapData_CPID_GetTexDim(spE8, &texWidth, &texHeight); + MapData_CPID_GetTexOffset(spE8, &offsetX, &offsetY); + + if (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_X) { + offsetX = ((texWidth / 2) - offsetX) + (texWidth / 2); + s = (texWidth - 1) << 5; + dsdx = 0xFC00; + } else { + s = 0; + dsdx = 0x400; + } + + if (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_Y) { + s32 requiredScopeTemp; + + offsetY = ((texHeight / 2) - offsetY) + (texHeight / 2); + t = (texHeight - 1) << 5; + dtdy = 0xFC00; + } else { + t = 0; + dtdy = 0x400; + } + + texPosX = + ((mapDataRoom->centerX - (f32)sMapDisp.sceneMidX) * scaleFrac - offsetX) + ((viewWidth / two) + viewX); + texPosY = + ((mapDataRoom->centerZ - (f32)sMapDisp.sceneMidZ) * scaleFrac - offsetY) + ((viewHeight / two) + viewY); + + if (i == play->roomCtx.curRoom.num) { + if (Map_IsInBossScene(play)) { + gDPLoadTextureBlock_4b(POLY_OPA_DISP++, roomTexture, G_IM_FMT_CI, texWidth, texHeight, 1, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + } else { + gDPLoadTextureBlock_4b(POLY_OPA_DISP++, roomTexture, G_IM_FMT_CI, texWidth, texHeight, 2, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + } + } else if (GET_ROOM_VISITED(Play_GetOriginalSceneId(MapDisp_ConvertBossSceneToDungeonScene(play->sceneId)), + i)) { + gDPLoadTextureBlock_4b(POLY_OPA_DISP++, roomTexture, G_IM_FMT_CI, texWidth, texHeight, 1, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + } else if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, dungeonSceneSharedIndex)) { + gDPLoadTextureBlock_4b(POLY_OPA_DISP++, roomTexture, G_IM_FMT_CI, texWidth, texHeight, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + } else { + continue; + } + gSPTextureRectangle(POLY_OPA_DISP++, (texPosX << 2), (texPosY << 2), (texPosX + texWidth) << 2, + (texPosY + texHeight) << 2, 0, s, t, dsdx, dtdy); + gDPPipeSync(POLY_OPA_DISP++); + } + + gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_NONE); + + CLOSE_DISPS(play->state.gfxCtx); +} + +/** + * @brief Draws the chests for the pause menu dungeon map + * + * @param play + * @param viewX top left x position of the dungeon map view window + * @param viewY top left y posiiton of the dungeon map view window + * @param viewWidth width in pixels of the dungeon map view window + * @param viewHeight height in pixels of the dungeon map view window + * @param scaleFrac ratio to convert world space coordinates to map coordinates + * @param dungeonSceneSharedIndex enum DungeonSceneIndex for retrieving map/compass data + */ +void MapDisp_DrawChests(PlayState* play, s32 viewX, s32 viewY, s32 viewWidth, s32 viewHeight, f32 scaleFrac) { + s32 pad[23]; + MapDataChest* mapDataChests = sMapDisp.mapDataChests; + s32 room; + MapDataRoom* mapDataRoom; + s32 texPosX; + s32 texPosY; + s32 i; + s32 isChestOpen; + s32 offsetX = 4; + s32 offsetZ = 4; + + if (mapDataChests == NULL) { + return; + } + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_NONE); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, play->pauseCtx.alpha); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); + gDPPipeSync(POLY_OPA_DISP++); + + gDPLoadTextureBlock_Runtime(POLY_OPA_DISP++, gMapChestIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + + for (i = 0; i < sMapDisp.numChests; i++) { + room = mapDataChests[i].room; + mapDataRoom = &sMapDisp.mapDataScene->rooms[room]; + + switch (play->sceneId) { + case SCENE_MITURIN_BS: + isChestOpen = GET_CYCLE_CHEST_OPENED(SCENE_MITURIN, mapDataChests[i].chestFlagId); + break; + + case SCENE_HAKUGIN_BS: + isChestOpen = GET_CYCLE_CHEST_OPENED(SCENE_HAKUGIN, mapDataChests[i].chestFlagId); + break; + + case SCENE_SEA_BS: + isChestOpen = GET_CYCLE_CHEST_OPENED(SCENE_SEA, mapDataChests[i].chestFlagId); + break; + + case SCENE_INISIE_BS: + isChestOpen = GET_CYCLE_CHEST_OPENED(SCENE_INISIE_N, mapDataChests[i].chestFlagId); + break; + + default: + isChestOpen = Flags_GetTreasure(play, mapDataChests[i].chestFlagId); + break; + } + + if ((sMapDisp.pauseMapCurStorey < sMapDisp.roomStoreyList[room]) || + ((sMapDisp.roomStoreyList[room] + MAP_DATA_ROOM_GET_EXTRA_STOREYS(mapDataRoom)) < + sMapDisp.pauseMapCurStorey) || + (isChestOpen != 0)) { + continue; + } + + if (!MapDisp_IsOnStorey((s32)sMapDisp.pauseMapCurStorey, (f32)mapDataChests[i].y)) { + continue; + } + + texPosX = + (s32)((((mapDataChests[i].x - (f32)sMapDisp.sceneMidX) * scaleFrac) - offsetX) + ((viewWidth / 2) + viewX)); + texPosY = (s32)((((mapDataChests[i].z - (f32)sMapDisp.sceneMidZ) * scaleFrac) - offsetZ) + + ((viewHeight / 2) + viewY)); + + gSPTextureRectangle(POLY_OPA_DISP++, texPosX << 2, texPosY << 2, (texPosX + 8) << 2, (texPosY + 8) << 2, + G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +/** + * @brief Draws the room exit points for the pause menu dungeon map + * + * @param play + * @param viewX top left x position of the dungeon map view window + * @param viewY top left y posiiton of the dungeon map view window + * @param viewWidth width in pixels of the dungeon map view window + * @param viewHeight height in pixels of the dungeon map view window + * @param scaleFrac ratio to convert world space coordinates to map coordinates + * @param dungeonSceneSharedIndex enum DungeonSceneIndex for retrieving map/compass data + */ +void MapDisp_DrawRoomExits(PlayState* play, s32 viewX, s32 viewY, s32 viewWidth, s32 viewHeight, f32 scaleFrac, + s32 dungeonSceneSharedIndex) { + PauseContext* pauseCtx = &play->pauseCtx; + TransitionActorList* transitionActors = &sTransitionActorList; + s32 texPosX; + s32 texPosY; + s32 i; + s8 roomA; + s8 roomB; + + if (transitionActors->count != 0) { + OPEN_DISPS(play->state.gfxCtx); + + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPLoadTextureBlock_4b(POLY_OPA_DISP++, &sWhiteSquareTex, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + for (i = 0; i < transitionActors->count; i++) { + if (MapDisp_IsOnStorey(sMapDisp.pauseMapCurStorey, sTransitionActors[i].pos.y)) { + if ((ABS_ALT(sTransitionActors[i].id) != ACTOR_EN_HOLL) && + !MapDisp_IsBossDoor(sTransitionActors[i].params)) { + roomA = sTransitionActors[i].sides[0].room; + roomB = sTransitionActors[i].sides[1].room; + if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.mapIndex) || (roomA < 0) || + GET_ROOM_VISITED(Play_GetOriginalSceneId(MapDisp_ConvertBossSceneToDungeonScene(play->sceneId)), + roomA) || + (roomB < 0) || + GET_ROOM_VISITED(Play_GetOriginalSceneId(MapDisp_ConvertBossSceneToDungeonScene(play->sceneId)), + roomB)) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + texPosX = ((f32)sTransitionActors[i].pos.x - sMapDisp.sceneMidX) * scaleFrac + + ((viewWidth / 2) + viewX); + texPosY = ((f32)sTransitionActors[i].pos.z - sMapDisp.sceneMidZ) * scaleFrac + + ((viewHeight / 2) + viewY); + gSPTextureRectangle(POLY_OPA_DISP++, ((texPosX - 1) << 2), ((texPosY - 1) << 2), + ((texPosX + 1) << 2), ((texPosY + 1) << 2), G_TX_RENDERTILE, 0, 0, 1 << 10, + 1 << 10); + } + } + } + } + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +/** + * @brief Draws the boss room icon for the pause menu dungeon map. + * + * @param play + * @param viewX top left x position of the dungeon map view window + * @param viewY top left y posiiton of the dungeon map view window + * @param viewWidth width in pixels of the dungeon map view window + * @param viewHeight height in pixels of the dungeon map view window + * @param scaleFrac ratio to convert world space coordinates to map coordinates + * @param dungeonSceneSharedIndex enum DungeonSceneIndex for retrieving map/compass data + */ +void MapDisp_DrawBossIcon(PlayState* play, s32 viewX, s32 viewY, s32 viewWidth, s32 viewHeight, f32 scaleFrac, + s32 dungeonSceneSharedIndex) { + s32 i; + TransitionActorList* transitionActorList = &sTransitionActorList; + s32 offsetX = 4; + s32 offsetZ = 4; + s32 texPosX; + s32 texPosY; + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_NONE); + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_AA_DEC_LINE, G_RM_NOOP2); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, play->pauseCtx.alpha); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); + gDPPipeSync(POLY_OPA_DISP++); + + if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, dungeonSceneSharedIndex)) { + gDPLoadTextureBlock_Runtime(POLY_OPA_DISP++, gMapBossIconTex, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + + for (i = 0; i < transitionActorList->count; i++) { + if (!MapDisp_IsBossDoor(sTransitionActors[i].params)) { + continue; + } + if (!MapDisp_IsOnStorey(sMapDisp.pauseMapCurStorey, sTransitionActors[i].pos.y)) { + continue; + } + if (ABS_ALT(sTransitionActors[i].id) == ACTOR_EN_HOLL) { + continue; + } + + texPosX = ((((f32)sTransitionActors[i].pos.x - sMapDisp.sceneMidX) * scaleFrac) - offsetX) + + ((viewWidth / 2) + viewX); + texPosY = ((((f32)sTransitionActors[i].pos.z - sMapDisp.sceneMidZ) * scaleFrac) - offsetZ) + + ((viewHeight / 2) + viewY); + gSPTextureRectangle(POLY_OPA_DISP++, texPosX << 2, texPosY << 2, (texPosX + 8) << 2, (texPosY + 8) << 2, + G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +TexturePtr MapDisp_GetDungeonMapFloorTexture(s32 floorNumber) { + static TexturePtr sDungeonMapFloorTextures[] = { + gDungeonMap1FButtonTex, gDungeonMap2FButtonTex, gDungeonMap3FButtonTex, gDungeonMap4FButtonTex, + gDungeonMap5FButtonTex, gDungeonMap6FButtonTex, gDungeonMap7FButtonTex, gDungeonMap8FButtonTex, + gDungeonMapB1ButtonTex, gDungeonMapB2ButtonTex, gDungeonMapB3ButtonTex, gDungeonMapB4ButtonTex, + gDungeonMapB5ButtonTex, gDungeonMapB6ButtonTex, gDungeonMapB7ButtonTex, gDungeonMapB8ButtonTex, + }; + if ((floorNumber >= 0) && (floorNumber < 8)) { + return sDungeonMapFloorTextures[floorNumber]; + } + if ((floorNumber >= -8) && (floorNumber < 0)) { + return sDungeonMapFloorTextures[7 + -floorNumber]; + } + return gDungeonMapBlankFloorButtonTex; +} + +/** + * @brief Tests if the dungeon map on the Map screen should be drawn. + * + * @param play + * @return true if the map should be drawn, else false. + */ +s32 MapDisp_SkipDrawDungeonMap(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + + if (pauseCtx->pageIndex != PAUSE_MAP) { + return true; + } + if ((pauseCtx->state == PAUSE_STATE_SAVEPROMPT) || IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { + return true; + } + if ((pauseCtx->state != PAUSE_STATE_MAIN) || (pauseCtx->mainState != PAUSE_MAIN_STATE_IDLE)) { + return true; + } + if (pauseCtx->alpha == 0) { + return true; + } + return false; +} + +void MapDisp_DrawDungeonFloorSelect(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + s32 texULY; + s32 texLRY; + s16 texULX; + s16 texLRX; + s32 pad; + s32 storey; + s32 dungeonSceneSharedIndex = 0; + + if ((sMapDisp.mapDataScene != NULL) && (sSceneNumRooms != 0) && !MapDisp_SkipDrawDungeonMap(play)) { + if (Map_IsInBossScene(play)) { + switch (play->sceneId) { + case SCENE_MITURIN_BS: + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE; + break; + + case SCENE_HAKUGIN_BS: + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE; + break; + + case SCENE_SEA_BS: + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE; + break; + + case SCENE_INISIE_BS: + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE; + break; + + default: + break; + } + } else { + dungeonSceneSharedIndex = gSaveContext.mapIndex; + } + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL39_Opa(play->state.gfxCtx); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 200, pauseCtx->alpha); + + // Draw unlocked storeys + for (storey = 0; storey < sMapDisp.numStoreys; storey++) { + if (GET_DUNGEON_FLOOR_VISITED( + Play_GetOriginalSceneId(MapDisp_ConvertBossSceneToDungeonScene(play->sceneId)), 4 - storey) || + CHECK_DUNGEON_ITEM_ALT(DUNGEON_MAP, dungeonSceneSharedIndex)) { + gDPLoadTextureBlock(POLY_OPA_DISP++, MapDisp_GetDungeonMapFloorTexture(sMapDisp.bottomStorey + storey), + G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSPTextureRectangle(POLY_OPA_DISP++, 81 << 2, (125 - storey * 15) << 2, 105 << 2, + ((125 - storey * 15) + 16) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + } + } + gDPPipeSync(POLY_OPA_DISP++); + + // Draw currently selected storey + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 150, 150, 255, pauseCtx->alpha); + gDPLoadTextureBlock( + POLY_OPA_DISP++, + MapDisp_GetDungeonMapFloorTexture((sMapDisp.bottomStorey - pauseCtx->cursorMapDungeonItem) + 8), + G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + texULX = 80; + texLRX = 106; + texULY = (5 + (pauseCtx->cursorMapDungeonItem * 0xF)); + texLRY = texULY + 16; + if ((pauseCtx->cursorSpecialPos == 0) && (pauseCtx->cursorXIndex[1] == 0)) { + texLRX++; + texULX--; + texLRY += 4; + texULY -= 4; + gSPTextureRectangle(POLY_OPA_DISP++, texULX << 2, texULY << 2, texLRX << 2, (texLRY) << 2, G_TX_RENDERTILE, + 0, 0, 0x036E, 0x02AA); + } else { + gSPTextureRectangle(POLY_OPA_DISP++, (texULX + 1) << 2, texULY << 2, (texLRX - 1) << 2, texLRY << 2, + G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + } + Gfx_SetupDL42_Opa(play->state.gfxCtx); + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +s32 MapDisp_IsValidStorey(s32 storey) { + if ((sMapDisp.mapDataScene == NULL) || (sSceneNumRooms == 0)) { + return false; + } + if ((storey < 0) || (storey > 5)) { + return false; + } + if (sMapDisp.storeyYList[storey] != FLOOR_MIN_Y) { + return true; + } + return false; +} + +s32 MapDisp_GetPlayerStorey(s16 checkY) { + s32 i; + + if ((sMapDisp.mapDataScene == NULL) || (sSceneNumRooms == 0)) { + return -1; + } + if (sMapDisp.numStoreys <= 1) { + return 0; + } + if ((sMapDisp.storeyYList[1] - 5) >= checkY) { + return 0; + } + for (i = 1; i < sMapDisp.numStoreys; i++) { + if (((sMapDisp.storeyYList[i] - 5) < checkY) && ((sMapDisp.storeyYList[i + 1] - 5) >= checkY)) { + return i; + } + } + return sMapDisp.numStoreys - 1; +} + +typedef struct { + /* 0x0 */ s16 sceneId; + /* 0x4 */ s32 offsetX; + /* 0x8 */ s32 offsetY; +} MapCustomPosOffset; // size = 0xC + +/** + * Draws the dungeon map within the pause menu's Map screen. + * + * @param play + */ +void MapDisp_DrawDungeonMap(PlayState* play) { + static MapCustomPosOffset sCustomMapOffset[] = { + { SCENE_MITURIN, 0, -10 }, + { SCENE_MITURIN_BS, 0, -10 }, + }; + MapDataRoom* mapDataRoom; + f32 scaleFrac; + s32 scale; + s32 var_v0; + s32 dungeonSceneSharedIndex = 0; + s32 offsetX = 0; + s32 offsetY = 0; + + if (MapDisp_SkipDrawDungeonMap(play)) { + return; + } + + if (Map_IsInBossScene(play)) { + switch (play->sceneId) { + case SCENE_MITURIN_BS: + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE; + break; + + case SCENE_HAKUGIN_BS: + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE; + break; + + case SCENE_SEA_BS: + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE; + break; + + case SCENE_INISIE_BS: + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE; + break; + + default: + break; + } + } else { + dungeonSceneSharedIndex = gSaveContext.mapIndex; + } + + mapDataRoom = sMapDisp.mapDataScene->rooms; + if ((mapDataRoom->mapId == MAP_DATA_NO_MAP) || (mapDataRoom->mapId >= MAPDATA_MAP_GRAND_MAX)) { + return; + } + + var_v0 = MapData_GetMapCompactId(mapDataRoom->mapId); + if (var_v0 == -1) { + return; + } + + scale = MapData_CPID_GetMapScale(var_v0); + if (scale == 0) { + scale = 80; + } + + for (var_v0 = 0; var_v0 < ARRAY_COUNT(sCustomMapOffset); var_v0++) { + if (play->sceneId == sCustomMapOffset[var_v0].sceneId) { + offsetX = sCustomMapOffset[var_v0].offsetX; + offsetY = sCustomMapOffset[var_v0].offsetY; + } + } + + scaleFrac = 1.0f / scale; + + MapDisp_DrawRooms(play, offsetX + 144, offsetY + 85, 120, 100, scaleFrac, dungeonSceneSharedIndex); + MapDisp_DrawRoomExits(play, offsetX + 144, offsetY + 85, 120, 100, scaleFrac, dungeonSceneSharedIndex); + MapDisp_DrawBossIcon(play, offsetX + 144, offsetY + 85, 120, 100, scaleFrac, dungeonSceneSharedIndex); + + if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, dungeonSceneSharedIndex)) { + MapDisp_DrawChests(play, offsetX + 144, offsetY + 85, 120, 100, scaleFrac); + } +} + +void MapDisp_UpdateDungeonMap(PlayState* play) { + sMapDisp.timer++; + if (!(sMapDisp.unk20 & 1)) { + sPauseDungeonMap.animTimer++; + if (sPauseDungeonMap.animTimer > 40) { + sMapDisp.unk20 |= 1; + } + } else { + sPauseDungeonMap.animTimer--; + if (sPauseDungeonMap.animTimer < 0) { + sMapDisp.unk20 &= ~1; + } + } +} diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 49e525b9dd..fa2c42a9b3 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -1,19 +1,26 @@ #include "global.h" -s16 sMinimapInitPosX = 0; -s16 sMinimapInitPosZ = 0; -s16 sMinimapInitDir = 0; - -s32 sDungeonAndBossSceneIds[] = { - SCENE_MITURIN, SCENE_HAKUGIN, SCENE_SEA, SCENE_INISIE_N, SCENE_INISIE_R, - SCENE_MITURIN_BS, SCENE_HAKUGIN_BS, SCENE_SEA_BS, SCENE_INISIE_BS, -}; +s16 sPlayerInitPosX = 0; +s16 sPlayerInitPosZ = 0; +s16 sPlayerInitDir = 0; /** - * If the current scene is a dungeon or boss scene, this function returns an index - * indicating which one it is. Otherwise, it returns -1. + * Gets the mapIndex for the current dungeon scene + * @return the current scene's DungeonSceneIndex, or -1 if it isn't a dungeon or boss scene. */ -s32 Map_GetDungeonOrBossAreaIndex(PlayState* play) { +s32 Map_GetDungeonSceneIndex(PlayState* play) { + static s32 sDungeonAndBossSceneIds[] = { + SCENE_MITURIN, // DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE + SCENE_HAKUGIN, // DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE + SCENE_SEA, // DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE + SCENE_INISIE_N, // DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE + SCENE_INISIE_R, // Play_GetOriginalSceneId converts play->sceneId to SCENE_INISIE_N, returning + // DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE + SCENE_MITURIN_BS, // DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE_BOSS + SCENE_HAKUGIN_BS, // DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE_BOSS + SCENE_SEA_BS, // DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE_BOSS + SCENE_INISIE_BS, // DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE_BOSS + }; s32 i; for (i = 0; i < ARRAY_COUNT(sDungeonAndBossSceneIds); i++) { @@ -26,33 +33,38 @@ s32 Map_GetDungeonOrBossAreaIndex(PlayState* play) { } /** - * Returns true if the current scene is a dungeon or boss scene, false otherwise. + * Tests if the current scene is in a dungeon or boss scene. + * @return true if the current scene is a dungeon or boss scene, false otherwise. */ -s32 Map_IsInDungeonOrBossArea(PlayState* play) { - if (Map_GetDungeonOrBossAreaIndex(play) == -1) { +s32 Map_IsInDungeonOrBossScene(PlayState* play) { + if (Map_GetDungeonSceneIndex(play) == -1) { return false; } return true; } -s32 func_8010A0A4(PlayState* play) { - if ((Map_GetDungeonOrBossAreaIndex(play) == -1) || !func_80102EF0(play)) { +s32 Map_CurRoomHasMapI(PlayState* play) { + if ((Map_GetDungeonSceneIndex(play) == -1) || !MapDisp_CurRoomHasMapI(play)) { return false; } return true; } -s32 sDungeonSceneIds[] = { - SCENE_MITURIN, SCENE_HAKUGIN, SCENE_SEA, SCENE_INISIE_N, SCENE_INISIE_R, -}; - /** - * If the current scene is a dungeon scene, this function returns an index - * indicating which one it is. Otherwise, it returns -1. + * Tests if the current scene is a dungeon scene, excluding boss scenes. + * @return -1 if not a dungeon scene, else returns the DungeonSceneIndex of the dungeon scene */ -s32 Map_GetDungeonAreaIndex(PlayState* play) { +s32 Map_GetDungeonSceneIndexForDungeon(PlayState* play) { + static s32 sDungeonSceneIds[] = { + SCENE_MITURIN, // DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE + SCENE_HAKUGIN, // DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE + SCENE_SEA, // DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE + SCENE_INISIE_N, // DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE + SCENE_INISIE_R, // Play_GetOriginalSceneId converts play->sceneId to SCENE_INISIE_N, returning + // DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE + }; s32 i; for (i = 0; i < ARRAY_COUNT(sDungeonSceneIds); i++) { @@ -65,28 +77,29 @@ s32 Map_GetDungeonAreaIndex(PlayState* play) { } /** - * Returns true if the current scene is a dungeon scene, false otherwise. + * Test if the current scene is a dungeon scene, excluding boss rooms + * @return true if the current scene is a dungeon scene, false otherwise. */ -s32 Map_IsInDungeonArea(PlayState* play) { - if (Map_GetDungeonAreaIndex(play) == -1) { +s32 Map_IsInDungeonScene(PlayState* play) { + if (Map_GetDungeonSceneIndexForDungeon(play) == -1) { return false; } return true; } -s32 sBossSceneIds[] = { - SCENE_MITURIN_BS, // DUNGEON_INDEX_WOODFALL_TEMPLE - SCENE_HAKUGIN_BS, // DUNGEON_INDEX_SNOWHEAD_TEMPLE - SCENE_SEA_BS, // DUNGEON_INDEX_GREAT_BAY_TEMPLE - SCENE_INISIE_BS, // DUNGEON_INDEX_STONE_TOWER_TEMPLE -}; - /** - * If the current scene is a boss scene, this function returns an index - * indicating which one it is. Otherwise, it returns -1. + * Tests if the current scene is a boss scene. + * @return -1 if not a boss scene, else returns the DungeonSceneIndex corresponding to that boss scene's primary dungeon + * scene */ -s32 Map_GetBossAreaIndex(PlayState* play) { +s32 Map_GetDungeonSceneIndexForBoss(PlayState* play) { + static s32 sBossSceneIds[] = { + SCENE_MITURIN_BS, // DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE + SCENE_HAKUGIN_BS, // DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE + SCENE_SEA_BS, // DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE + SCENE_INISIE_BS, // DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE + }; s32 i; for (i = 0; i < ARRAY_COUNT(sBossSceneIds); i++) { @@ -99,27 +112,33 @@ s32 Map_GetBossAreaIndex(PlayState* play) { } /** - * Returns true if the current scene is a boss scene, false otherwise. + * Checks if the current scene is a boss scene. + * @return true if the current scene is a boss scene, false otherwise. */ -s32 Map_IsInBossArea(PlayState* play) { - if (Map_GetBossAreaIndex(play) == -1) { +s32 Map_IsInBossScene(PlayState* play) { + if (Map_GetDungeonSceneIndexForBoss(play) == -1) { return false; } return true; } -s32 D_801BF5A4[] = { - SCENE_22DEKUCITY, - SCENE_KOEPONARACE, - SCENE_F01, -}; - -s32 func_8010A238(PlayState* play) { +/** + * Intended to check if the current scene is an overworld scene with a minimap. + * The implementation is incomplete due to a complete rewrite of z_map_exp.c and other map systems, making the function + * obsolete. + * @return -1 if not in the list, else returns the MapIndex for the overworld scene + */ +s32 Map_GetMapIndexForOverworld(PlayState* play) { + static s32 sSceneIds[] = { + SCENE_22DEKUCITY, + SCENE_KOEPONARACE, + SCENE_F01, + }; s32 i; - for (i = 0; i < ARRAY_COUNT(D_801BF5A4); i++) { - if (Play_GetOriginalSceneId(play->sceneId) == D_801BF5A4[i]) { + for (i = 0; i < ARRAY_COUNT(sSceneIds); i++) { + if (Play_GetOriginalSceneId(play->sceneId) == sSceneIds[i]) { return i; } } @@ -127,8 +146,14 @@ s32 func_8010A238(PlayState* play) { return -1; } -s32 func_8010A2AC(PlayState* play) { - if (func_8010A238(play) == -1) { +/** + * Intended to check if the current scene is an overworld scene with a minimap. + * The implementation is incomplete due to a complete rewrite of z_map_exp.c and other map systems, making the function + * obsolete. + * @return true if the current scene is in the set, false otherwise. + */ +s32 Map_IsInOverworldSceneWithMapIndex(PlayState* play) { + if (Map_GetMapIndexForOverworld(play) == -1) { return false; } @@ -136,29 +161,28 @@ s32 func_8010A2AC(PlayState* play) { } /** - * When a room is loaded, this function is used to save the player's position and rotation - * so that the red arrow on the minimap can be drawn correctly. + * Sets the position and rotation of where the player has entered the area. + * Used to draw the red marker on the minimap. */ -void Minimap_SavePlayerRoomInitInfo(PlayState* play) { +void Map_SetAreaEntrypoint(PlayState* play) { Player* player = GET_PLAYER(play); - sMinimapInitPosX = player->actor.world.pos.x; - sMinimapInitPosZ = player->actor.world.pos.z; - sMinimapInitDir = (0x7FFF - player->actor.shape.rot.y) / 0x400; + sPlayerInitPosX = player->actor.world.pos.x; + sPlayerInitPosZ = player->actor.world.pos.z; + sPlayerInitDir = (0x7FFF - player->actor.shape.rot.y) / 0x400; } void Map_InitRoomData(PlayState* play, s16 room) { s32 mapIndex = gSaveContext.mapIndex; InterfaceContext* interfaceCtx = &play->interfaceCtx; - func_80105C40(room); + MapDisp_SwapRooms(room); if (room >= 0) { - if (Map_IsInDungeonOrBossArea(play)) { - gSaveContext.save.saveInfo.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].rooms |= - gBitFlags[room]; + if (Map_IsInDungeonOrBossScene(play)) { + SET_ROOM_VISITED(Play_GetOriginalSceneId(play->sceneId), room); interfaceCtx->mapRoomNum = room; - interfaceCtx->dungeonOrBossAreaMapIndex = mapIndex; + interfaceCtx->dungeonSceneIndex = mapIndex; } } else { interfaceCtx->mapRoomNum = 0; @@ -170,50 +194,52 @@ void Map_InitRoomData(PlayState* play, s16 room) { } void Map_Destroy(PlayState* play) { - func_80105A40(play); + MapDisp_Destroy(play); } void Map_Init(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; - s32 dungeonIndex; + s32 dungeonSceneSharedIndex; - func_80105C40(play->roomCtx.curRoom.num); + MapDisp_SwapRooms(play->roomCtx.curRoom.num); interfaceCtx->unk_278 = -1; - interfaceCtx->dungeonOrBossAreaMapIndex = -1; + interfaceCtx->dungeonSceneIndex = -1; interfaceCtx->mapSegment = THA_AllocTailAlign16(&play->state.tha, 0x1000); - if (func_8010A2AC(play)) { - gSaveContext.mapIndex = func_8010A238(play); + + //! This block does pretty much nothing, as z_map_exp.c and other map systems were heavily rewritten after OoT to no + //! longer need mapIndex to retrieve minimap data. + if (Map_IsInOverworldSceneWithMapIndex(play)) { + gSaveContext.mapIndex = Map_GetMapIndexForOverworld(play); return; } - if (Map_IsInDungeonOrBossArea(play)) { - dungeonIndex = Map_GetDungeonOrBossAreaIndex(play); - gSaveContext.mapIndex = dungeonIndex; + if (Map_IsInDungeonOrBossScene(play)) { + gSaveContext.mapIndex = dungeonSceneSharedIndex = Map_GetDungeonSceneIndex(play); switch (play->sceneId) { case SCENE_MITURIN_BS: - dungeonIndex = DUNGEON_INDEX_WOODFALL_TEMPLE; + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE; break; case SCENE_HAKUGIN_BS: - dungeonIndex = DUNGEON_INDEX_SNOWHEAD_TEMPLE; + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE; break; case SCENE_SEA_BS: - dungeonIndex = DUNGEON_INDEX_GREAT_BAY_TEMPLE; + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE; break; case SCENE_INISIE_BS: - dungeonIndex = DUNGEON_INDEX_STONE_TOWER_TEMPLE; + dungeonSceneSharedIndex = DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE; break; } - gSaveContext.dungeonIndex = dungeonIndex; + gSaveContext.dungeonSceneSharedIndex = dungeonSceneSharedIndex; Map_InitRoomData(play, play->roomCtx.curRoom.num); } } -void Minimap_Draw(PlayState* play) { - func_80106644(play, sMinimapInitPosX, sMinimapInitPosZ, sMinimapInitDir); +void Map_DrawMinimap(PlayState* play) { + MapDisp_DrawMinimap(play, sPlayerInitPosX, sPlayerInitPosZ, sPlayerInitDir); } s16 sLastRoomNum = 99; @@ -227,7 +253,7 @@ void Map_Update(PlayState* play) { s32 pad2; if ((play->pauseCtx.state <= PAUSE_STATE_OPENING_2) && (CHECK_BTN_ALL(controller->press.button, BTN_L)) && - !Play_InCsMode(play) && !func_80106530(play)) { + !Play_InCsMode(play) && !MapDisp_IsMinimapToggleBlocked(play)) { if (!R_MINIMAP_DISABLED) { Audio_PlaySfx(NA_SE_SY_CAMERA_ZOOM_UP); } else { @@ -237,22 +263,21 @@ void Map_Update(PlayState* play) { R_MINIMAP_DISABLED ^= 1; } - func_80105B34(play); + MapDisp_Update(play); if (!IS_PAUSED(&play->pauseCtx)) { - if (Map_IsInDungeonArea(play)) { - floor = func_80109124(player->actor.world.pos.y); + if (Map_IsInDungeonScene(play)) { + floor = MapDisp_GetPlayerStorey(player->actor.world.pos.y); if (floor != -1) { - gSaveContext.save.saveInfo.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].unk_14 |= - gBitFlags[FLOOR_INDEX_MAX - floor]; - R_REVERSE_FLOOR_INDEX = FLOOR_INDEX_MAX - floor; + SET_DUNGEON_FLOOR_VISITED(Play_GetOriginalSceneId(play->sceneId), FLOOR_INDEX_MAX - floor); + R_PLAYER_FLOOR_REVERSE_INDEX = FLOOR_INDEX_MAX - floor; if (interfaceCtx->mapRoomNum != sLastRoomNum) { sLastRoomNum = interfaceCtx->mapRoomNum; } } - } else if (Map_IsInBossArea(play)) { - func_80105294(); - R_REVERSE_FLOOR_INDEX = FLOOR_INDEX_MAX - func_80105318(); + } else if (Map_IsInBossScene(play)) { + MapDisp_GetBossIconY(); + R_PLAYER_FLOOR_REVERSE_INDEX = FLOOR_INDEX_MAX - MapDisp_GetBossRoomStorey(); } } } diff --git a/src/code/z_message.c b/src/code/z_message.c index 5068553b19..8cb55ef1f0 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -930,21 +930,22 @@ void Message_DrawItemIcon(PlayState* play, Gfx** gfxP) { } else if (msgCtx->itemId == ITEM_STRAY_FAIRIES) { msgCtx->unk12016 = 0x18; gDPPipeSync(gfx++); - gDPSetPrimColor(gfx++, 0, 0, sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonIndex)].r, - sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonIndex)].g, - sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonIndex)].b, msgCtx->textColorAlpha); - gDPSetEnvColor(gfx++, sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonIndex)].r, - sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonIndex)].g, - sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonIndex)].b, 0); + gDPSetPrimColor(gfx++, 0, 0, sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonSceneSharedIndex)].r, + sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonSceneSharedIndex)].g, + sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonSceneSharedIndex)].b, + msgCtx->textColorAlpha); + gDPSetEnvColor(gfx++, sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonSceneSharedIndex)].r, + sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonSceneSharedIndex)].g, + sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonSceneSharedIndex)].b, 0); gDPLoadTextureBlock_4b(gfx++, gStrayFairyGlowingCircleIconTex, G_IM_FMT_I, 32, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPTextureRectangle(gfx++, msgCtx->unk12010 << 2, msgCtx->unk12012 << 2, (msgCtx->unk12010 + msgCtx->unk12014) << 2, (msgCtx->unk12012 + msgCtx->unk12016) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); gDPSetPrimColor(gfx++, 0, 0, 255, 255, 255, msgCtx->textColorAlpha); - gDPLoadTextureBlock(gfx++, sStrayFairyIconTextures[((void)0, gSaveContext.dungeonIndex)], G_IM_FMT_RGBA, - G_IM_SIZ_32b, 32, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, - G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(gfx++, sStrayFairyIconTextures[((void)0, gSaveContext.dungeonSceneSharedIndex)], + G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); } else if ((msgCtx->itemId >= ITEM_SONG_SONATA) && (msgCtx->itemId <= ITEM_SONG_SUN)) { index = msgCtx->itemId - ITEM_SONG_SONATA; gDPSetPrimColor(gfx++, 0, 0, D_801CFE04[index], D_801CFE1C[index], D_801CFE34[index], msgCtx->textColorAlpha); @@ -2134,7 +2135,7 @@ void Message_LoadOwlWarpText(PlayState* play, s32* offset, f32* arg2, s16* decod s16 owlWarpId; s16 i; - if (func_8010A0A4(play) || (play->sceneId == SCENE_SECOM)) { + if (Map_CurRoomHasMapI(play) || (play->sceneId == SCENE_SECOM)) { owlWarpId = OWL_WARP_ENTRANCE; } else { owlWarpId = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; @@ -2463,7 +2464,8 @@ void Message_Decode(PlayState* play) { Message_LoadTime(play, curChar, &charTexIndex, &spC0, &decodedBufPos); } else if (curChar == 0x21C) { digits[0] = digits[1] = 0; - digits[2] = gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex]; + digits[2] = + gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonSceneSharedIndex]; while (digits[2] >= 100) { digits[0]++; @@ -3121,7 +3123,7 @@ void Message_OpenText(PlayState* play, u16 textId) { if (msgCtx) {} textId = 0xC9; } else if (textId == 0x11) { - if (gSaveContext.save.saveInfo.inventory.strayFairies[((void)0, gSaveContext.dungeonIndex)] == 0xF) { + if (gSaveContext.save.saveInfo.inventory.strayFairies[((void)0, gSaveContext.dungeonSceneSharedIndex)] == 0xF) { textId = 0xF3; } } else if ((textId == 0x92) && (play->sceneId == SCENE_KOEPONARACE)) { @@ -5687,7 +5689,7 @@ void Message_Update(PlayState* play) { if (sLastPlayedSong == OCARINA_SONG_SOARING) { if (interfaceCtx->restrictions.songOfSoaring == 0) { - if (func_8010A0A4(play) || (play->sceneId == SCENE_SECOM)) { + if (Map_CurRoomHasMapI(play) || (play->sceneId == SCENE_SECOM)) { Message_StartTextbox(play, 0x1B93, NULL); play->msgCtx.ocarinaMode = OCARINA_MODE_1B; sLastPlayedSong = 0xFF; diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index 286548216d..4a3e495753 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -280,7 +280,7 @@ void Message_LoadOwlWarpTextNES(PlayState* play, s32* offset, f32* arg2, s16* de s16 owlWarpId; s16 stringLimit; - if (func_8010A0A4(play) || (play->sceneId == SCENE_SECOM)) { + if (Map_CurRoomHasMapI(play) || (play->sceneId == SCENE_SECOM)) { owlWarpId = OWL_WARP_ENTRANCE; } else { owlWarpId = play->pauseCtx.cursorPoint[PAUSE_WORLD_MAP]; @@ -1310,7 +1310,8 @@ void Message_DecodeNES(PlayState* play) { Message_LoadTimeNES(play, curChar, &charTexIndex, &spA4, &decodedBufPos); } else if (curChar == MESSAGE_STRAY_FAIRIES) { digits[0] = digits[1] = 0; - digits[2] = gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex]; + digits[2] = + gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonSceneSharedIndex]; while (digits[2] >= 100) { digits[0]++; @@ -1332,18 +1333,24 @@ void Message_DecodeNES(PlayState* play) { } } - if ((gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 1) || - (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 21)) { + if ((gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonSceneSharedIndex] == + 1) || + (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonSceneSharedIndex] == + 21)) { Message_LoadCharNES(play, 's', &charTexIndex, &spA4, decodedBufPos); decodedBufPos++; Message_LoadCharNES(play, 't', &charTexIndex, &spA4, decodedBufPos); - } else if ((gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 2) || - (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 22)) { + } else if ((gSaveContext.save.saveInfo.inventory + .strayFairies[(void)0, gSaveContext.dungeonSceneSharedIndex] == 2) || + (gSaveContext.save.saveInfo.inventory + .strayFairies[(void)0, gSaveContext.dungeonSceneSharedIndex] == 22)) { Message_LoadCharNES(play, 'n', &charTexIndex, &spA4, decodedBufPos); decodedBufPos++; Message_LoadCharNES(play, 'd', &charTexIndex, &spA4, decodedBufPos); - } else if ((gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 3) || - (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] == 23)) { + } else if ((gSaveContext.save.saveInfo.inventory + .strayFairies[(void)0, gSaveContext.dungeonSceneSharedIndex] == 3) || + (gSaveContext.save.saveInfo.inventory + .strayFairies[(void)0, gSaveContext.dungeonSceneSharedIndex] == 23)) { Message_LoadCharNES(play, 'r', &charTexIndex, &spA4, decodedBufPos); decodedBufPos++; Message_LoadCharNES(play, 'd', &charTexIndex, &spA4, decodedBufPos); diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 3660f923d5..f9b6d9cfb8 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -6428,7 +6428,7 @@ void Interface_Draw(PlayState* play) { } Magic_DrawMeter(play); - Minimap_Draw(play); + Map_DrawMinimap(play); if ((R_PAUSE_BG_PRERENDER_STATE != 2) && (R_PAUSE_BG_PRERENDER_STATE != 3)) { Target_Draw(&play->actorCtx.targetCtx, play); diff --git a/src/code/z_play.c b/src/code/z_play.c index 085f7f8a04..054bfe8e25 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1575,7 +1575,7 @@ void Play_InitScene(PlayState* this, s32 spawn) { this->numSetupActors = 0; Object_InitContext(&this->state, &this->objectCtx); LightContext_Init(this, &this->lightCtx); - Door_InitContext(&this->state, &this->doorCtx); + Scene_ResetTransitionActorList(&this->state, &this->transitionActors); Room_Init(this, &this->roomCtx); gSaveContext.worldMapArea = 0; Scene_ExecuteCommands(this, this->sceneSegment); @@ -1975,7 +1975,7 @@ s32 func_8016A02C(GameState* thisx, Actor* actor, s16* yaw) { return false; } - transitionActor = &this->doorCtx.transitionActorList[(u16)actor->params >> 10]; + transitionActor = &this->transitionActors.list[(u16)actor->params >> 10]; frontRoom = transitionActor->sides[0].room; if (frontRoom == transitionActor->sides[1].room) { return false; diff --git a/src/code/z_room.c b/src/code/z_room.c index 1e8700e095..3478446306 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -502,11 +502,11 @@ size_t Room_AllocateAndLoad(PlayState* play, RoomContext* roomCtx) { } } - if ((u32)play->doorCtx.numTransitionActors != 0) { + if ((u32)play->transitionActors.count != 0) { RomFile* roomList = play->roomList; - TransitionActorEntry* transitionActor = &play->doorCtx.transitionActorList[0]; + TransitionActorEntry* transitionActor = &play->transitionActors.list[0]; - for (j = 0; j < play->doorCtx.numTransitionActors; j++) { + for (j = 0; j < play->transitionActors.count; j++) { frontRoom = transitionActor->sides[0].room; backRoom = transitionActor->sides[1].room; frontRoomSize = (frontRoom < 0) ? 0 : roomList[frontRoom].vromEnd - roomList[frontRoom].vromStart; @@ -620,7 +620,7 @@ void func_8012EBF8(PlayState* play, RoomContext* roomCtx) { Actor_SpawnTransitionActors(play, &play->actorCtx); if (roomCtx->curRoom.num > -1) { Map_InitRoomData(play, roomCtx->curRoom.num); - Minimap_SavePlayerRoomInitInfo(play); + Map_SetAreaEntrypoint(play); } Audio_SetEnvReverb(play->roomCtx.curRoom.echo); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index bb7aec7375..cbcea15cbd 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -334,15 +334,15 @@ void Scene_CommandPathList(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x0E: Transition Actor List -void Scene_CommandTransiActorList(PlayState* play, SceneCmd* cmd) { - play->doorCtx.numTransitionActors = cmd->transiActorList.num; - play->doorCtx.transitionActorList = Lib_SegmentedToVirtual(cmd->transiActorList.segment); - func_80105818(play, play->doorCtx.numTransitionActors, play->doorCtx.transitionActorList); +void Scene_CommandTransitionActorList(PlayState* play, SceneCmd* cmd) { + play->transitionActors.count = cmd->transitionActorList.num; + play->transitionActors.list = Lib_SegmentedToVirtual(cmd->transitionActorList.segment); + MapDisp_InitTransitionActorData(play, play->transitionActors.count, play->transitionActors.list); } // Init function for the transition system. -void Door_InitContext(GameState* state, DoorContext* doorCtx) { - doorCtx->numTransitionActors = 0; +void Scene_ResetTransitionActorList(GameState* state, TransitionActorList* transitionActors) { + transitionActors->count = 0; } // SceneTableEntry Header Command 0x0F: Environment Light Settings List @@ -495,19 +495,19 @@ void Scene_CommandCutsceneList(PlayState* play, SceneCmd* cmd) { CutsceneManager_Init(play, Lib_SegmentedToVirtual(cmd->cutsceneList.segment), cmd->cutsceneList.num); } -// SceneTableEntry Header Command 0x1C: Mini Maps -void Scene_CommandMiniMap(PlayState* play, SceneCmd* cmd) { - func_80104CF4(play); - func_8010549C(play, cmd->minimapSettings.segment); +// SceneTableEntry Header Command 0x1C: Map Data +void Scene_CommandMapData(PlayState* play, SceneCmd* cmd) { + MapDisp_Init(play); + MapDisp_InitMapData(play, cmd->mapData.segment); } // SceneTableEntry Header Command 0x1D: Undefined void Scene_Command1D(PlayState* play, SceneCmd* cmd) { } -// SceneTableEntry Header Command 0x1E: Minimap Compass Icon Info -void Scene_CommandMiniMapCompassInfo(PlayState* play, SceneCmd* cmd) { - func_8010565C(play, cmd->minimapChests.num, cmd->minimapChests.segment); +// SceneTableEntry Header Command 0x1E: Map Data Chests +void Scene_CommandMapDataChests(PlayState* play, SceneCmd* cmd) { + MapDisp_InitChestData(play, cmd->mapDataChests.num, cmd->mapDataChests.segment); } // SceneTableEntry Header Command 0x19: Sets Region Visited Flag @@ -565,7 +565,7 @@ void (*sSceneCmdHandlers[SCENE_CMD_MAX])(PlayState*, SceneCmd*) = { Scene_CommandObjectList, // SCENE_CMD_ID_OBJECT_LIST Scene_CommandLightList, // SCENE_CMD_ID_LIGHT_LIST Scene_CommandPathList, // SCENE_CMD_ID_PATH_LIST - Scene_CommandTransiActorList, // SCENE_CMD_ID_TRANSI_ACTOR_LIST + Scene_CommandTransitionActorList, // SCENE_CMD_ID_TRANSI_ACTOR_LIST Scene_CommandEnvLightSettings, // SCENE_CMD_ID_ENV_LIGHT_SETTINGS Scene_CommandTimeSettings, // SCENE_CMD_ID_TIME_SETTINGS Scene_CommandSkyboxSettings, // SCENE_CMD_ID_SKYBOX_SETTINGS @@ -579,9 +579,9 @@ void (*sSceneCmdHandlers[SCENE_CMD_MAX])(PlayState*, SceneCmd*) = { Scene_CommandSetRegionVisitedFlag, // SCENE_CMD_ID_SET_REGION_VISITED Scene_CommandAnimatedMaterials, // SCENE_CMD_ID_ANIMATED_MATERIAL_LIST Scene_CommandCutsceneList, // SCENE_CMD_ID_ACTOR_CUTSCENE_LIST - Scene_CommandMiniMap, // SCENE_CMD_ID_MINIMAP_INFO + Scene_CommandMapData, // SCENE_CMD_ID_MAP_DATA Scene_Command1D, // SCENE_CMD_ID_UNUSED_1D - Scene_CommandMiniMapCompassInfo, // SCENE_CMD_ID_MINIMAP_COMPASS_ICON_INFO + Scene_CommandMapDataChests, // SCENE_CMD_ID_MAP_DATA_CHESTS }; /** diff --git a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c index 2dc79979be..5beb414993 100644 --- a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c +++ b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c @@ -101,7 +101,7 @@ void BgOpenShutter_Destroy(Actor* thisx, PlayState* play) { BgOpenShutter* this = THIS; s32 transition = DOOR_GET_TRANSITION_ID(thisx); - play->doorCtx.transitionActorList[transition].id = -play->doorCtx.transitionActorList[transition].id; + play->transitionActors.list[transition].id = -play->transitionActors.list[transition].id; DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->slidingDoor.dyna.bgId); } diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 4cf3b0bae5..314ede2736 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -140,7 +140,7 @@ void DoorShutter_SetupAction(DoorShutter* this, DoorShutterActionFunc actionFunc s32 func_808A0900(DoorShutter* this, PlayState* play) { TransitionActorEntry* transitionEntry = - &play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(&this->slidingDoor.dyna.actor)]; + &play->transitionActors.list[DOOR_GET_TRANSITION_ID(&this->slidingDoor.dyna.actor)]; s8 frontRoom = transitionEntry->sides[0].room; if (frontRoom == transitionEntry->sides[1].room) { @@ -156,31 +156,31 @@ s32 DoorShutter_SetupDoor(DoorShutter* this, PlayState* play) { ShutterObjectInfo* sp24 = &D_808A2180[this->unk_163]; s32 doorType = this->doorType; - if (doorType != 4) { + if (doorType != DOORSHUTTER_TYPE_4) { if (func_808A0900(this, play)) { - if ((doorType == 7) || (doorType == 6)) { - doorType = 1; - } else if (doorType == 5) { - doorType = 3; + if ((doorType == DOORSHUTTER_TYPE_7) || (doorType == DOORSHUTTER_TYPE_6)) { + doorType = DOORSHUTTER_TYPE_1; + } else if (doorType == DOORSHUTTER_TYPE_BOSS_DOOR) { + doorType = DOORSHUTTER_TYPE_3; } else { - doorType = 0; + doorType = DOORSHUTTER_TYPE_0; } } } - if (doorType == 0) { + if (doorType == DOORSHUTTER_TYPE_0) { this->unk_164 = sp24->index1; } else { this->unk_164 = sp24->index2; } - if (doorType == 1) { + if (doorType == DOORSHUTTER_TYPE_1) { if (!Flags_GetClear(play, this->slidingDoor.dyna.actor.room)) { DoorShutter_SetupAction(this, func_808A0F88); this->unk_168 = 1.0f; return true; } - } else if ((doorType == 2) || (doorType == 7)) { + } else if ((doorType == DOORSHUTTER_TYPE_2) || (doorType == DOORSHUTTER_TYPE_7)) { if (!Flags_GetSwitch(play, DOORSHUTTER_GET_SWITCH_FLAG(&this->slidingDoor.dyna.actor))) { DoorShutter_SetupAction(this, func_808A1548); this->unk_168 = 1.0f; @@ -188,7 +188,7 @@ s32 DoorShutter_SetupDoor(DoorShutter* this, PlayState* play) { } DoorShutter_SetupAction(this, func_808A1618); return false; - } else if (doorType == 3) { + } else if (doorType == DOORSHUTTER_TYPE_3) { DoorShutter_SetupAction(this, func_808A1080); this->unk_168 = 1.0f; return false; @@ -204,7 +204,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) { s32 i; Actor_ProcessInitChain(&this->slidingDoor.dyna.actor, sInitChain); - this->doorType = DOORSHUTTER_GET_380(&this->slidingDoor.dyna.actor); + this->doorType = DOORSHUTTER_GET_TYPE(&this->slidingDoor.dyna.actor); sp24 = D_808A2240[this->doorType]; if (sp24 < 0) { @@ -242,7 +242,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) { DoorShutter_SetupAction(this, DoorShutter_SetupType); this->unk_163 = sp24; - if ((this->doorType == 4) || (this->doorType == 5)) { + if ((this->doorType == DOORSHUTTER_TYPE_4) || (this->doorType == DOORSHUTTER_TYPE_BOSS_DOOR)) { if (!Flags_GetSwitch(play, DOORSHUTTER_GET_SWITCH_FLAG(&this->slidingDoor.dyna.actor))) { this->unk_166 = 10; } @@ -257,8 +257,7 @@ void DoorShutter_Destroy(Actor* thisx, PlayState* play) { if (this->slidingDoor.dyna.actor.room >= 0) { s32 transitionActorId = DOOR_GET_TRANSITION_ID(&this->slidingDoor.dyna.actor); - play->doorCtx.transitionActorList[transitionActorId].id = - -play->doorCtx.transitionActorList[transitionActorId].id; + play->transitionActors.list[transitionActorId].id = -play->transitionActors.list[transitionActorId].id; } } @@ -314,7 +313,7 @@ void func_808A0F88(DoorShutter* this, PlayState* play) { if (Flags_GetClear(play, this->slidingDoor.dyna.actor.room) || Flags_GetClearTemp(play, this->slidingDoor.dyna.actor.room)) { this->csId = this->slidingDoor.dyna.actor.csId; - if (this->doorType == 7) { + if (this->doorType == DOORSHUTTER_TYPE_7) { if (this->csId != CS_ID_NONE) { this->csId = CutsceneManager_GetAdditionalCsId(this->csId); } @@ -347,7 +346,7 @@ void func_808A1090(DoorShutter* this, PlayState* play) { this->slidingDoor.dyna.actor.velocity.y = 0.0f; if (this->unk_166 != 0) { Flags_SetSwitch(play, DOORSHUTTER_GET_SWITCH_FLAG(&this->slidingDoor.dyna.actor)); - if (this->doorType != 5) { + if (this->doorType != DOORSHUTTER_TYPE_BOSS_DOOR) { DUNGEON_KEY_COUNT(gSaveContext.mapIndex) = DUNGEON_KEY_COUNT(gSaveContext.mapIndex) - 1; Actor_PlaySfx(&this->slidingDoor.dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } else { @@ -370,14 +369,14 @@ void func_808A1090(DoorShutter* this, PlayState* play) { player->doorTimer = 0; } - if (this->doorType == 6) { + if (this->doorType == DOORSHUTTER_TYPE_6) { if (gSaveContext.save.saveInfo.playerData.healthCapacity < (DOORSHUTTER_GET_1F(&this->slidingDoor.dyna.actor) * 0x10)) { player->doorType = PLAYER_DOORTYPE_TALKING; this->slidingDoor.dyna.actor.textId = 0x14FC; } } else if (this->unk_166 != 0) { - if (this->doorType == 5) { + if (this->doorType == DOORSHUTTER_TYPE_BOSS_DOOR) { if (!CHECK_DUNGEON_ITEM(DUNGEON_BOSS_KEY, gSaveContext.mapIndex)) { player->doorType = PLAYER_DOORTYPE_TALKING; this->slidingDoor.dyna.actor.textId = 0x1803; @@ -507,7 +506,7 @@ void func_808A1684(DoorShutter* this, PlayState* play) { f32 phi_f0; if ((DECR(this->unk_166) == 0) && (play->roomCtx.status == 0) && func_808A1340(this, play)) { - if (this->doorType == 5) { + if (this->doorType == DOORSHUTTER_TYPE_BOSS_DOOR) { phi_f0 = 20.0f; } else { phi_f0 = 50.0f; @@ -541,8 +540,8 @@ void func_808A1784(DoorShutter* this, PlayState* play) { } else if (func_808A1478(this, play, 0.0f)) { u8 doorType = this->doorType; - if ((doorType != 0) && (doorType != 1) && - (((doorType != 7) && (doorType != 6)) || !func_808A0900(this, play))) { + if ((doorType != DOORSHUTTER_TYPE_0) && (doorType != DOORSHUTTER_TYPE_1) && + (((doorType != DOORSHUTTER_TYPE_7) && (doorType != DOORSHUTTER_TYPE_6)) || !func_808A0900(this, play))) { DoorShutter_SetupAction(this, func_808A1618); } else { DoorShutter_SetupAction(this, func_808A1090); @@ -560,7 +559,7 @@ void func_808A1884(DoorShutter* this, PlayState* play) { Actor_OffsetOfPointInActorCoords(&this->slidingDoor.dyna.actor, &sp44, &player->actor.world.pos); this->slidingDoor.dyna.actor.room = - play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(&this->slidingDoor.dyna.actor)] + play->transitionActors.list[DOOR_GET_TRANSITION_ID(&this->slidingDoor.dyna.actor)] .sides[(sp44.z < 0.0f) ? 0 : 1] .room; @@ -700,7 +699,7 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) { if (sp44->unk_04 != 0) { TransitionActorEntry* transitionEntry = - &play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(&this->slidingDoor.dyna.actor)]; + &play->transitionActors.list[DOOR_GET_TRANSITION_ID(&this->slidingDoor.dyna.actor)]; if ((play->roomCtx.prevRoom.num >= 0) || (transitionEntry->sides[0].room == transitionEntry->sides[1].room)) { @@ -713,7 +712,7 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) { } else if (this->slidingDoor.dyna.actor.room == transitionEntry->sides[0].room) { Matrix_RotateYF(M_PIf, MTXMODE_APPLY); } - } else if (this->doorType == 5) { + } else if (this->doorType == DOORSHUTTER_TYPE_BOSS_DOOR) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_808A22DC[this->slidingDoor.unk_15E])); } @@ -729,7 +728,8 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) { if (this->unk_166 != 0) { Matrix_Scale(0.01f, 0.01f, 0.025f, MTXMODE_APPLY); - Actor_DrawDoorLock(play, this->unk_166, (this->doorType == 5) ? DOORLOCK_BOSS : DOORLOCK_NORMAL); + Actor_DrawDoorLock(play, this->unk_166, + (this->doorType == DOORSHUTTER_TYPE_BOSS_DOOR) ? DOORLOCK_BOSS : DOORLOCK_NORMAL); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h index d1ccd19559..964390cb0f 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h @@ -8,9 +8,21 @@ struct DoorShutter; typedef void (*DoorShutterActionFunc)(struct DoorShutter*, PlayState*); +typedef enum DoorShutterType { + /* 0 */ DOORSHUTTER_TYPE_0, + /* 1 */ DOORSHUTTER_TYPE_1, + /* 2 */ DOORSHUTTER_TYPE_2, + /* 3 */ DOORSHUTTER_TYPE_3, + /* 4 */ DOORSHUTTER_TYPE_4, + /* 5 */ DOORSHUTTER_TYPE_BOSS_DOOR, + /* 6 */ DOORSHUTTER_TYPE_6, + /* 7 */ DOORSHUTTER_TYPE_7 +} DoorShutterType; + #define DOORSHUTTER_GET_1F(thisx) ((thisx)->params & 0x1F) #define DOORSHUTTER_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) -#define DOORSHUTTER_GET_380(thisx) (((thisx)->params >> 7) & 7) +#define DOORSHUTTER_GET_TYPE(thisx) (((thisx)->params >> 7) & 7) +#define DOORSHUTTER_PARAMS_GET_TYPE(params) (((params) >> 7) & 7) typedef struct DoorShutter { /* 0x000 */ SlidingDoorActor slidingDoor; diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index 245dcbea53..c997ccc0d8 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -133,7 +133,7 @@ void DoorSpiral_Init(Actor* thisx, PlayState* play) { s32 transitionId = DOOR_GET_TRANSITION_ID(thisx); s8 objectSlot; - if (this->actor.room != play->doorCtx.transitionActorList[transitionId].sides[0].room) { + if (this->actor.room != play->transitionActors.list[transitionId].sides[0].room) { Actor_Kill(&this->actor); return; } @@ -154,7 +154,7 @@ void DoorSpiral_Init(Actor* thisx, PlayState* play) { void DoorSpiral_Destroy(Actor* thisx, PlayState* play) { s32 transitionId = DOOR_GET_TRANSITION_ID(thisx); - play->doorCtx.transitionActorList[transitionId].id = -play->doorCtx.transitionActorList[transitionId].id; + play->transitionActors.list[transitionId].id = -play->transitionActors.list[transitionId].id; } void func_809A2DB0(DoorSpiral* this, PlayState* play) { @@ -215,7 +215,7 @@ void func_809A2FF8(DoorSpiral* this, PlayState* play) { player->doorDirection = this->direction; player->doorActor = &this->actor; transitionId = DOOR_GET_TRANSITION_ID(&this->actor); - player->doorNext = (play->doorCtx.transitionActorList[transitionId].params >> 0xA); + player->doorNext = (play->transitionActors.list[transitionId].params >> 0xA); func_80122F28(player); } } diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 33e922133d..e0a2f9f7c4 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -397,7 +397,7 @@ void EnDoor_Destroy(Actor* thisx, PlayState* play) { if (this->doorType != ENDOOR_TYPE_FRAMED) { TransitionActorEntry* transitionEntry = - &play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(&this->knobDoor.dyna.actor)]; + &play->transitionActors.list[DOOR_GET_TRANSITION_ID(&this->knobDoor.dyna.actor)]; if (transitionEntry->id < 0) { transitionEntry->id = -transitionEntry->id; @@ -646,7 +646,7 @@ s32 EnDoor_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* transitionEntry = NULL; if (this->doorType != ENDOOR_TYPE_FRAMED) { - transitionEntry = &play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(&this->knobDoor.dyna.actor)]; + transitionEntry = &play->transitionActors.list[DOOR_GET_TRANSITION_ID(&this->knobDoor.dyna.actor)]; } rot->z += this->knobDoor.dyna.actor.world.rot.y; diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.h b/src/overlays/actors/ovl_En_Door/z_en_door.h index fc0ee7ac68..9133cf484b 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -25,7 +25,7 @@ * | | * | Text offset | Half day bit index * |-------------|-------------------- - * | 0 0 0 0 | 0 0 0 + * | 0 0 0 0 | 0 0 0 * | 4 | 3 * | * diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 2072963867..5af1a43e54 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -107,8 +107,8 @@ void EnElforg_Init(Actor* thisx, PlayState* play) { break; } - if (Map_IsInDungeonOrBossArea(play)) { - this->area = gSaveContext.dungeonIndex + STRAY_FAIRY_AREA_WOODFALL; + if (Map_IsInDungeonOrBossScene(play)) { + this->area = gSaveContext.dungeonSceneSharedIndex + STRAY_FAIRY_AREA_WOODFALL; } else { this->area = STRAY_FAIRY_GET_NON_DUNGEON_AREA(thisx); } @@ -497,11 +497,11 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { return; } - if (Map_IsInDungeonOrBossArea(play)) { - gSaveContext.save.saveInfo.inventory.strayFairies[gSaveContext.dungeonIndex]++; + if (Map_IsInDungeonOrBossScene(play)) { + gSaveContext.save.saveInfo.inventory.strayFairies[gSaveContext.dungeonSceneSharedIndex]++; // You found a Stray Fairy! Message_StartTextbox(play, 0x11, NULL); - if (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] >= + if (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonSceneSharedIndex] >= STRAY_FAIRY_SCATTERED_TOTAL) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index f5d55a5e3c..b81196a4fb 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -130,7 +130,7 @@ void EnHoll_Destroy(Actor* thisx, PlayState* play) { if (!EN_HOLL_IS_SCENE_CHANGER(this)) { u32 enHollId = EN_HOLL_GET_ID(&this->actor); - play->doorCtx.transitionActorList[enHollId].id = -play->doorCtx.transitionActorList[enHollId].id; + play->transitionActors.list[enHollId].id = -play->transitionActors.list[enHollId].id; if (this == sInstancePlayingSound) { sInstancePlayingSound = NULL; } @@ -183,7 +183,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { if (sLoadingPlaneDistance < playerDistFromCentralPlane) { if ((play->roomCtx.prevRoom.num >= 0) && (play->roomCtx.status == 0)) { - this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[this->playerSide].room; + this->actor.room = play->transitionActors.list[enHollId].sides[this->playerSide].room; if (play->roomCtx.prevRoom.num == this->actor.room) { EnHoll_ChangeRooms(play); } @@ -196,7 +196,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->unk_1878C(play); } else { - this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[this->playerSide ^ 1].room; + this->actor.room = play->transitionActors.list[enHollId].sides[this->playerSide ^ 1].room; if (play->roomCtx.prevRoom.num < 0) { Room_StartRoomTransition(play, &play->roomCtx, this->actor.room); if (this == sInstancePlayingSound) { @@ -236,7 +236,7 @@ void EnHoll_TransparentIdle(EnHoll* this, PlayState* play) { playerDistFromCentralPlane > EN_HOLL_LOADING_PLANE_DISTANCE) { s32 enHollId = EN_HOLL_GET_ID(&this->actor); s32 playerSide = (transformedPlayerPos.z < 0.0f) ? EN_HOLL_BEHIND : EN_HOLL_BEFORE; - TransitionActorEntry* transitionActorEntry = &play->doorCtx.transitionActorList[enHollId]; + TransitionActorEntry* transitionActorEntry = &play->transitionActors.list[enHollId]; s8 room = transitionActorEntry->sides[playerSide].room; this->actor.room = room; @@ -264,7 +264,7 @@ void EnHoll_VerticalBgCoverIdle(EnHoll* this, PlayState* play) { s32 enHollId = EN_HOLL_GET_ID(&this->actor); s32 playerSide = (this->actor.playerHeightRel > 0.0f) ? EN_HOLL_ABOVE : EN_HOLL_BELOW; - this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[playerSide].room; + this->actor.room = play->transitionActors.list[enHollId].sides[playerSide].room; if ((this->actor.room != play->roomCtx.curRoom.num) && Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { @@ -288,7 +288,7 @@ void EnHoll_VerticalIdle(EnHoll* this, PlayState* play) { s32 enHollId = EN_HOLL_GET_ID(&this->actor); s32 playerSide = (this->actor.playerHeightRel > 0.0f) ? EN_HOLL_ABOVE : EN_HOLL_BELOW; - this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[playerSide].room; + this->actor.room = play->transitionActors.list[enHollId].sides[playerSide].room; if ((this->actor.room != play->roomCtx.curRoom.num) && Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { this->actionFunc = EnHoll_RoomTransitionIdle; diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index cb8ebefaf6..ba2eb7cc1e 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -3,6 +3,7 @@ * Overlay: ovl_En_Kusa * Description: Grass / Bush */ + #include "prevent_bss_reordering.h" #include "z_en_kusa.h" #include "objects/object_kusa/object_kusa.h" diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index 3bb3be7f7b..5f15c41cf1 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -4,7 +4,6 @@ * Description: Switch-Activated Geyser */ -#include "prevent_bss_reordering.h" #include "z_obj_hunsui.h" #include "objects/object_hunsui/object_hunsui.h" diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 8f4728b24f..358f503942 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -6336,7 +6336,7 @@ void Player_Door_Staircase(PlayState* play, Player* this, Actor* door) { Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_SCENE0); this->cv.doorBgCamIndex = - play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(&doorStaircase->actor)].sides[0].bgCamIndex; + play->transitionActors.list[DOOR_GET_TRANSITION_ID(&doorStaircase->actor)].sides[0].bgCamIndex; Actor_DeactivateLens(play); this->floorSfxOffset = NA_SE_PL_WALK_CONCRETE - SFX_FLAG; } @@ -6382,7 +6382,7 @@ void Player_Door_Sliding(PlayState* play, Player* this, Actor* door) { } if (doorSliding->dyna.actor.category == ACTORCAT_DOOR) { - this->cv.doorBgCamIndex = play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(&doorSliding->dyna.actor)] + this->cv.doorBgCamIndex = play->transitionActors.list[DOOR_GET_TRANSITION_ID(&doorSliding->dyna.actor)] .sides[this->doorDirection > 0 ? 0 : 1] .bgCamIndex; Actor_DeactivateLens(play); @@ -6481,7 +6481,7 @@ void Player_Door_Knob(PlayState* play, Player* this, Actor* door) { mainCam = Play_GetCamera(play, CAM_ID_MAIN); Camera_ChangeDoorCam(mainCam, &knobDoor->dyna.actor, - play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(&knobDoor->dyna.actor)] + play->transitionActors.list[DOOR_GET_TRANSITION_ID(&knobDoor->dyna.actor)] .sides[(this->doorDirection > 0) ? 0 : 1] .bgCamIndex, 0.0f, this->av1.actionVar1, 26.0f * D_8085C3E8, 10.0f * D_8085C3E8); @@ -6529,7 +6529,7 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { if ((this->doorType < PLAYER_DOORTYPE_FAKE) && (doorActor->category == ACTORCAT_DOOR) && ((this->doorType != PLAYER_DOORTYPE_HANDLE) || (ENDOOR_GET_TYPE(doorActor) != ENDOOR_TYPE_FRAMED))) { - s8 roomNum = play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(doorActor)] + s8 roomNum = play->transitionActors.list[DOOR_GET_TRANSITION_ID(doorActor)] .sides[(this->doorDirection > 0) ? 0 : 1] .room; @@ -10904,7 +10904,7 @@ void Player_Init(Actor* thisx, PlayState* play) { } } - Minimap_SavePlayerRoomInitInfo(play); + Map_SetAreaEntrypoint(play); func_80841A50(play, this); this->unk_3CF = 0; R_PLAY_FILL_SCREEN_ON = 0; @@ -13747,7 +13747,7 @@ void Player_Action_1(Player* this, PlayState* play) { } else if (this->av2.actionVar2 < 0) { if (Room_StartRoomTransition(play, &play->roomCtx, this->av1.actionVar1)) { Map_InitRoomData(play, play->roomCtx.curRoom.num); - Minimap_SavePlayerRoomInitInfo(play); + Map_SetAreaEntrypoint(play); this->av2.actionVar2 = 5; } } else if (this->av2.actionVar2 > 0) { @@ -15211,7 +15211,7 @@ void Player_Action_35(Player* this, PlayState* play) { TransitionActorEntry* temp_v1_4; // sp50 s32 roomNum; - temp_v1_4 = &play->doorCtx.transitionActorList[this->doorNext]; + temp_v1_4 = &play->transitionActors.list[this->doorNext]; roomNum = temp_v1_4->sides[0].room; R_PLAY_FILL_SCREEN_ALPHA = 255; @@ -15279,7 +15279,7 @@ void Player_Action_35(Player* this, PlayState* play) { (Play_GetCamera(play, CAM_ID_MAIN)->stateFlags & CAM_STATE_4))) { if (this->unk_397 == 4) { Map_InitRoomData(play, play->roomCtx.curRoom.num); - Minimap_SavePlayerRoomInitInfo(play); + Map_SetAreaEntrypoint(play); } R_PLAY_FILL_SCREEN_ON = 0; diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c index ed4af43e82..8edfe04ae9 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c @@ -4,6 +4,7 @@ * Description: Entering name on a new file, selecting options from the options menu */ +#include "prevent_bss_reordering.h" #include "z_file_select.h" #include "z64rumble.h" #include "misc/title_static/title_static.h" diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c index c6afc184b1..83fac4918d 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c @@ -52,7 +52,7 @@ void KaleidoScope_DrawDungeonStrayFairyCount(PlayState* play) { 1 << 10); // Get digits for current number of stray fairies collected - counterDigits[1] = gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex]; + counterDigits[1] = gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonSceneSharedIndex]; counterDigits[0] = counterDigits[1] / 10; counterDigits[1] -= (s16)(counterDigits[0] * 10); @@ -81,10 +81,10 @@ TexturePtr sDungeonItemTextures[] = { }; TexturePtr sDungeonTitleTextures[] = { - gPauseWoodfallTitleENGTex, // DUNGEON_INDEX_WOODFALL_TEMPLE - gPauseSnowheadTitleENGTex, // DUNGEON_INDEX_SNOWHEAD_TEMPLE - gPauseGreatBayTitleENGTex, // DUNGEON_INDEX_GREAT_BAY_TEMPLE - gPauseStoneTowerTitleENGTex, // DUNGEON_INDEX_STONE_TOWER_TEMPLE + gPauseWoodfallTitleENGTex, // DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE + gPauseSnowheadTitleENGTex, // DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE + gPauseGreatBayTitleENGTex, // DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE + gPauseStoneTowerTitleENGTex, // DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE }; s16 sDungeonMapFloorIconPosY[] = { 67, 81, 95, 109, 123 }; @@ -97,30 +97,30 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { static s16 sStrayFairyIconAlpha = 255; static f32 sStrayFairyIconScale = 100.0f; static TexturePtr sStrayFairyIconTextures[][4] = { - // DUNGEON_INDEX_WOODFALL_TEMPLE + // DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE { gStrayFairyWoodfallIconTex, gDungeonStrayFairyWoodfallIconTex, gStrayFairyWoodfallIconTex, gDungeonStrayFairyWoodfallIconTex }, - // DUNGEON_INDEX_SNOWHEAD_TEMPLE + // DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE { gStrayFairySnowheadIconTex, gDungeonStrayFairySnowheadIconTex, gStrayFairySnowheadIconTex, gDungeonStrayFairySnowheadIconTex }, - // DUNGEON_INDEX_GREAT_BAY_TEMPLE + // DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE { gStrayFairyGreatBayIconTex, gDungeonStrayFairyGreatBayIconTex, gStrayFairyGreatBayIconTex, gDungeonStrayFairyGreatBayIconTex }, - // DUNGEON_INDEX_STONE_TOWER_TEMPLE + // DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE { gStrayFairyStoneTowerIconTex, gDungeonStrayFairyStoneTowerIconTex, gStrayFairyStoneTowerIconTex, gDungeonStrayFairyStoneTowerIconTex }, }; static u8 sStrayFairyIconPrimColors[][3] = { - { 255, 110, 160 }, // DUNGEON_INDEX_WOODFALL_TEMPLE - { 90, 255, 100 }, // DUNGEON_INDEX_SNOWHEAD_TEMPLE - { 120, 255, 255 }, // DUNGEON_INDEX_GREAT_BAY_TEMPLE - { 245, 245, 90 }, // DUNGEON_INDEX_STONE_TOWER_TEMPLE + { 255, 110, 160 }, // DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE + { 90, 255, 100 }, // DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE + { 120, 255, 255 }, // DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE + { 245, 245, 90 }, // DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE }; static u8 sStrayFairyIconEnvColors[][3] = { - { 255, 255, 255 }, // DUNGEON_INDEX_WOODFALL_TEMPLE - { 255, 255, 255 }, // DUNGEON_INDEX_SNOWHEAD_TEMPLE - { 255, 255, 255 }, // DUNGEON_INDEX_GREAT_BAY_TEMPLE - { 225, 170, 0 }, // DUNGEON_INDEX_STONE_TOWER_TEMPLE + { 255, 255, 255 }, // DUNGEON_SCENE_INDEX_WOODFALL_TEMPLE + { 255, 255, 255 }, // DUNGEON_SCENE_INDEX_SNOWHEAD_TEMPLE + { 255, 255, 255 }, // DUNGEON_SCENE_INDEX_GREAT_BAY_TEMPLE + { 225, 170, 0 }, // DUNGEON_SCENE_INDEX_STONE_TOWER_TEMPLE }; static s32 sStrayFairyIconRectS[] = { 1 << 10, // mirror texture horizontally @@ -159,8 +159,8 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA); // QUAD_MAP_PAGE_DUNGEON_TITLE - POLY_OPA_DISP = - Gfx_DrawTexQuadIA8(POLY_OPA_DISP, sDungeonTitleTextures[((void)0, gSaveContext.dungeonIndex)], 128, 16, 0); + POLY_OPA_DISP = Gfx_DrawTexQuadIA8( + POLY_OPA_DISP, sDungeonTitleTextures[((void)0, gSaveContext.dungeonSceneSharedIndex)], 128, 16, 0); gDPPipeSync(POLY_OPA_DISP++); @@ -196,13 +196,15 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor( - POLY_OPA_DISP++, 0, 0, sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonIndex)][0], - sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonIndex)][1], - sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonIndex)][2], sStrayFairyIconAlpha); - gDPSetEnvColor(POLY_OPA_DISP++, sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonIndex)][0], - sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonIndex)][1], - sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonIndex)][2], 0); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, + sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonSceneSharedIndex)][0], + sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonSceneSharedIndex)][1], + sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonSceneSharedIndex)][2], + sStrayFairyIconAlpha); + gDPSetEnvColor(POLY_OPA_DISP++, + sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonSceneSharedIndex)][0], + sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonSceneSharedIndex)][1], + sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonSceneSharedIndex)][2], 0); scale = sStrayFairyIconScale / 100.0f; @@ -246,7 +248,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { gDPLoadTextureBlock( POLY_OPA_DISP++, - sStrayFairyIconTextures[((void)0, gSaveContext.dungeonIndex)][sStrayFairyIconIndex], + sStrayFairyIconTextures[((void)0, gSaveContext.dungeonSceneSharedIndex)][sStrayFairyIconIndex], G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 24, 0, G_TX_MIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPTextureRectangle(POLY_OPA_DISP++, 54 << 2, 140 << 2, 86 << 2, 164 << 2, G_TX_RENDERTILE, @@ -256,7 +258,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { Gfx_SetupDL42_Opa(play->state.gfxCtx); } } - } else if (CHECK_DUNGEON_ITEM(i, gSaveContext.dungeonIndex)) { + } else if (CHECK_DUNGEON_ITEM(i, gSaveContext.dungeonSceneSharedIndex)) { gDPLoadTextureBlock(POLY_OPA_DISP++, sDungeonItemTextures[i], G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); @@ -268,7 +270,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { } } - func_80108AF8(play); + MapDisp_DrawDungeonFloorSelect(play); if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { // If (pauseCtx->state == PAUSE_STATE_MAIN), then the other conditions are redundant and always return @@ -283,12 +285,13 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { // Draw Player's face next to the dungeon floor icon currently in. POLY_OPA_DISP = Gfx_DrawTexRectRGBA16(POLY_OPA_DISP, gQuestIconLinkHumanFaceTex, 16, 16, 62, - sDungeonMapFloorIconPosY[R_REVERSE_FLOOR_INDEX], 16, 16, 1 << 10, 1 << 10); + sDungeonMapFloorIconPosY[R_PLAYER_FLOOR_REVERSE_INDEX], 16, 16, 1 << 10, 1 << 10); - if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.dungeonIndex)) { - POLY_OPA_DISP = Gfx_DrawTexRectRGBA16(POLY_OPA_DISP, gDungeonMapSkullTex, 16, 16, 108, - sDungeonMapFloorIconPosY[FLOOR_INDEX_MAX - func_80105318()], 16, - 16, 1 << 10, 1 << 10); + // Draw skull face next to the dungeon floor icon the boss is located at. + if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.dungeonSceneSharedIndex)) { + POLY_OPA_DISP = Gfx_DrawTexRectRGBA16( + POLY_OPA_DISP, gDungeonMapSkullTex, 16, 16, 108, + sDungeonMapFloorIconPosY[FLOOR_INDEX_MAX - MapDisp_GetBossRoomStorey()], 16, 16, 1 << 10, 1 << 10); } gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); @@ -320,8 +323,8 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { KaleidoScope_MoveCursorFromSpecialPos(play); pauseCtx->cursorXIndex[PAUSE_MAP] = 0; - pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->unk_256; - pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256; + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorMapDungeonItem; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->cursorMapDungeonItem; } else if (pauseCtx->cursorSpecialPos == 0) { if (pauseCtx->cursorXIndex[PAUSE_MAP] == 0) { pauseCtx->cursorXIndex[PAUSE_MAP] = 1; @@ -337,7 +340,8 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); break; } - if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], + gSaveContext.dungeonSceneSharedIndex)) { break; } } @@ -349,11 +353,11 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { KaleidoScope_MoveCursorFromSpecialPos(play); pauseCtx->cursorXIndex[PAUSE_MAP] = 1; pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_MAP; - if (!CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.dungeonIndex)) { + if (!CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.dungeonSceneSharedIndex)) { pauseCtx->cursorPoint[PAUSE_MAP]--; // DUNGEON_COMPASS - if (!CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.dungeonIndex)) { + if (!CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.dungeonSceneSharedIndex)) { pauseCtx->cursorPoint[PAUSE_MAP]--; // DUNGEON_BOSS_KEY - if (!CHECK_DUNGEON_ITEM(DUNGEON_BOSS_KEY, gSaveContext.dungeonIndex)) { + if (!CHECK_DUNGEON_ITEM(DUNGEON_BOSS_KEY, gSaveContext.dungeonSceneSharedIndex)) { pauseCtx->cursorSlot[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; } @@ -366,8 +370,8 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); } else if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES) { pauseCtx->cursorXIndex[PAUSE_MAP] = 0; - pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->unk_256; - pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256; + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorMapDungeonItem; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->cursorMapDungeonItem; } else { while (true) { pauseCtx->cursorPoint[PAUSE_MAP]--; @@ -376,7 +380,8 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; break; } - if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], + gSaveContext.dungeonSceneSharedIndex)) { break; } } @@ -385,9 +390,8 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { } else if ((pauseCtx->cursorSpecialPos == 0) && (pauseCtx->stickAdjY > 30)) { if (pauseCtx->cursorPoint[PAUSE_MAP] >= DUNGEON_FLOOR_INDEX_4) { for (i = pauseCtx->cursorPoint[PAUSE_MAP] - (DUNGEON_FLOOR_INDEX_4 + 1); i >= 0; i--) { - if ((gSaveContext.save.saveInfo.permanentSceneFlags[(void)0, gSaveContext.dungeonIndex].unk_14 & - gBitFlags[i]) || - func_801090B0(FLOOR_INDEX_MAX - i)) { + if (GET_DUNGEON_FLOOR_VISITED(((void)0, gSaveContext.dungeonSceneSharedIndex), i) || + MapDisp_IsValidStorey(FLOOR_INDEX_MAX - i)) { pauseCtx->cursorPoint[PAUSE_MAP] = i + DUNGEON_FLOOR_INDEX_4; pauseCtx->cursorShrinkRate = 4.0f; break; @@ -395,8 +399,8 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { } } else if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES) { pauseCtx->cursorXIndex[PAUSE_MAP] = 0; - pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->unk_256; - pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256; + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorMapDungeonItem; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->cursorMapDungeonItem; } else { pauseCtx->cursorSlot[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; @@ -406,9 +410,8 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { (pauseCtx->cursorPoint[PAUSE_MAP] <= DUNGEON_FLOOR_INDEX_1)) { for (i = pauseCtx->cursorPoint[PAUSE_MAP] - (DUNGEON_FLOOR_INDEX_4 - 1); i <= DUNGEON_FLOOR_INDEX_0; i++) { - if ((gSaveContext.save.saveInfo.permanentSceneFlags[(void)0, gSaveContext.dungeonIndex].unk_14 & - gBitFlags[i]) || - func_801090B0(FLOOR_INDEX_MAX - i)) { + if (GET_DUNGEON_FLOOR_VISITED(((void)0, gSaveContext.dungeonSceneSharedIndex), i) || + MapDisp_IsValidStorey(FLOOR_INDEX_MAX - i)) { pauseCtx->cursorPoint[PAUSE_MAP] = i + DUNGEON_FLOOR_INDEX_4; pauseCtx->cursorShrinkRate = 4.0f; break; @@ -429,7 +432,8 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); break; } - if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], + gSaveContext.dungeonSceneSharedIndex)) { break; } } @@ -448,7 +452,7 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { } if ((pauseCtx->cursorXIndex[PAUSE_MAP] == 0) && (pauseCtx->cursorSpecialPos == 0)) { - pauseCtx->unk_256 = pauseCtx->cursorPoint[PAUSE_MAP]; + pauseCtx->cursorMapDungeonItem = pauseCtx->cursorPoint[PAUSE_MAP]; } if (pauseCtx->cursorSpecialPos == 0) { @@ -457,7 +461,7 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { pauseCtx->itemDescriptionOn = true; func_801514B0(play, 0x17AF, 1); } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) && (msgCtx->msgLength == 0) && - CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonSceneSharedIndex)) { pauseCtx->itemDescriptionOn = true; func_801514B0(play, 0x17AC + pauseCtx->cursorPoint[PAUSE_MAP], 1); } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index c595ad73ac..3d3a8c52fd 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -7,6 +7,7 @@ #include "z_kaleido_scope.h" #include "sys_cmpdma.h" +#include "z64map.h" #include "z64skybox.h" #include "z64view.h" @@ -565,7 +566,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { KaleidoScope_DrawDungeonMap(play); Gfx_SetupDL42_Opa(gfxCtx); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - func_801091F0(play); + MapDisp_DrawDungeonMap(play); } else { KaleidoScope_DrawWorldMap(play); } @@ -662,7 +663,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - func_801091F0(play); + MapDisp_DrawDungeonMap(play); } else { Matrix_RotateYF(R_PAUSE_WORLD_MAP_YAW / 1000.0f, MTXMODE_NEW); @@ -2837,7 +2838,7 @@ void KaleidoScope_Update(PlayState* play) { s16 stepA; s16 stickAdjX = input->rel.stick_x; - func_80109428(play); + MapDisp_UpdateDungeonMap(play); pauseCtx->stickAdjX = input->rel.stick_x; pauseCtx->stickAdjY = input->rel.stick_y; @@ -2854,8 +2855,9 @@ void KaleidoScope_Update(PlayState* play) { sUnpausedButtonStatus[EQUIP_SLOT_A] = gSaveContext.buttonStatus[EQUIP_SLOT_A]; pauseCtx->cursorXIndex[PAUSE_MAP] = 0; - pauseCtx->cursorSlot[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; - pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256 = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; + pauseCtx->cursorSlot[PAUSE_MAP] = R_PLAYER_FLOOR_REVERSE_INDEX + DUNGEON_FLOOR_INDEX_4; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->cursorMapDungeonItem = + R_PLAYER_FLOOR_REVERSE_INDEX + DUNGEON_FLOOR_INDEX_4; sPauseCursorLeftX = -175; sPauseCursorRightX = 155; @@ -2878,12 +2880,12 @@ void KaleidoScope_Update(PlayState* play) { CmpDma_LoadAllFiles(SEGMENT_ROM_START(icon_item_24_static_yar), pauseCtx->iconItem24Segment, size1); pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size1); - if (func_8010A0A4(play)) { + if (Map_CurRoomHasMapI(play)) { size_t size = SEGMENT_ROM_SIZE(icon_item_dungeon_static); DmaMgr_RequestSync(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_dungeon_static), size); iconItemLangSegment = - func_801068FC(play, (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size), size); + MapDisp_AllocDungeonMap(play, (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size)); sInDungeonScene = true; } else { size_t size; @@ -3181,8 +3183,8 @@ void KaleidoScope_Update(PlayState* play) { break; case PAUSE_STATE_GAMEOVER_2: - pauseCtx->cursorSlot[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; - pauseCtx->cursorPoint[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; + pauseCtx->cursorSlot[PAUSE_MAP] = R_PLAYER_FLOOR_REVERSE_INDEX + DUNGEON_FLOOR_INDEX_4; + pauseCtx->cursorPoint[PAUSE_MAP] = R_PLAYER_FLOOR_REVERSE_INDEX + DUNGEON_FLOOR_INDEX_4; sPauseCursorLeftX = -175; sPauseCursorRightX = 155; pauseCtx->roll = -434.0f; @@ -3431,8 +3433,9 @@ void KaleidoScope_Update(PlayState* play) { sUnpausedButtonStatus[EQUIP_SLOT_A] = gSaveContext.buttonStatus[EQUIP_SLOT_A]; pauseCtx->cursorXIndex[PAUSE_MAP] = 0; - pauseCtx->cursorSlot[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; - pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256 = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; + pauseCtx->cursorSlot[PAUSE_MAP] = R_PLAYER_FLOOR_REVERSE_INDEX + DUNGEON_FLOOR_INDEX_4; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->cursorMapDungeonItem = + R_PLAYER_FLOOR_REVERSE_INDEX + DUNGEON_FLOOR_INDEX_4; sPauseCursorLeftX = -175; sPauseCursorRightX = 155; diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 7868c70f8f..8415819b77 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -545,7 +545,8 @@ 0x801BE960 : "z_lib", 0x801BE990 : "z_lifemeter", 0x801BEAB0 : "z_lights", - 0x801BEAD0 : "z_map_disp", # z_map_data is somewhere in here + 0x801BEAD0 : "z_map_disp", + 0x801BED40 : "z_map_data", 0x801BF550 : "z_map_exp", 0x801BF5C0 : "z_msgevent", 0x801BF6C0 : "z_parameter", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index ca850d8048..5ad93e571f 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1901,113 +1901,113 @@ 0x80102DBC:("ZeldaArena_Init",), 0x80102DEC:("ZeldaArena_Cleanup",), 0x80102E10:("ZeldaArena_IsInitialized",), - 0x80102E40:("func_80102E40",), - 0x80102E90:("func_80102E90",), - 0x80102EA4:("func_80102EA4",), + 0x80102E40:("MapDisp_GetMapITexture",), + 0x80102E90:("MapDisp_InitRoomStoreyRecord",), + 0x80102EA4:("MapDisp_DestroyRoomStoreyRecord",), 0x80102EB4:("func_80102EB4",), 0x80102ED0:("func_80102ED0",), - 0x80102EF0:("func_80102EF0",), - 0x80102F9C:("func_80102F9C",), - 0x80103090:("func_80103090",), - 0x801030B4:("func_801030B4",), - 0x801030F4:("func_801030F4",), - 0x801031D0:("func_801031D0",), - 0x801039EC:("func_801039EC",), - 0x80103A10:("func_80103A10",), - 0x80103A58:("func_80103A58",), - 0x8010439C:("func_8010439C",), - 0x801045AC:("func_801045AC",), - 0x80104AE8:("func_80104AE8",), - 0x80104C80:("func_80104C80",), - 0x80104CF4:("func_80104CF4",), - 0x80104F34:("func_80104F34",), - 0x80105294:("func_80105294",), - 0x80105318:("func_80105318",), - 0x80105328:("func_80105328",), - 0x8010534C:("func_8010534C",), - 0x8010549C:("func_8010549C",), - 0x8010565C:("func_8010565C",), - 0x80105818:("func_80105818",), - 0x80105A40:("func_80105A40",), - 0x80105B34:("func_80105B34",), - 0x80105C40:("func_80105C40",), - 0x80105FE0:("func_80105FE0",), - 0x80106408:("func_80106408",), - 0x80106450:("func_80106450",), - 0x801064CC:("func_801064CC",), - 0x80106530:("func_80106530",), - 0x8010657C:("func_8010657C",), - 0x80106644:("func_80106644",), - 0x8010683C:("func_8010683C",), - 0x801068B4:("func_801068B4",), - 0x801068D8:("func_801068D8",), - 0x801068FC:("func_801068FC",), - 0x80106BEC:("func_80106BEC",), - 0x80106D08:("func_80106D08",), - 0x80106D5C:("func_80106D5C",), - 0x80107B78:("func_80107B78",), - 0x80108124:("func_80108124",), - 0x80108558:("func_80108558",), - 0x80108A10:("func_80108A10",), - 0x80108A64:("func_80108A64",), - 0x80108AF8:("func_80108AF8",), - 0x801090B0:("func_801090B0",), - 0x80109124:("func_80109124",), - 0x801091F0:("func_801091F0",), - 0x80109428:("func_80109428",), - 0x801094A0:("func_801094A0",), + 0x80102EF0:("MapDisp_CurRoomHasMapI",), + 0x80102F9C:("MapDisp_GetStoreyY",), + 0x80103090:("MapDisp_GetMapTexDim",), + 0x801030B4:("MapDisp_GetMapScale",), + 0x801030F4:("MapDisp_GetMapOffset",), + 0x801031D0:("MapDisp_DrawMinimapRoom",), + 0x801039EC:("MapDisp_IsDataRotated",), + 0x80103A10:("MapDisp_CanDrawDoors",), + 0x80103A58:("MapDisp_Minimap_DrawActorIcon",), + 0x8010439C:("MapDisp_Minimap_DrawActors",), + 0x801045AC:("MapDisp_Minimap_DrawDoorActor",), + 0x80104AE8:("MapDisp_Minimap_DrawDoorActors",), + 0x80104C80:("MapDisp_AwaitGameplayDangeonKeep",), + 0x80104CF4:("MapDisp_Init",), + 0x80104F34:("MapDisp_InitSceneFloorData",), + 0x80105294:("MapDisp_GetBossIconY",), + 0x80105318:("MapDisp_GetBossRoomStorey",), + 0x80105328:("MapDisp_IsBossDoor",), + 0x8010534C:("MapDisp_InitBossRoomStorey",), + 0x8010549C:("MapDisp_InitMapData",), + 0x8010565C:("MapDisp_InitChestData",), + 0x80105818:("MapDisp_InitTransitionActorData",), + 0x80105A40:("MapDisp_Destroy",), + 0x80105B34:("MapDisp_Update",), + 0x80105C40:("MapDisp_SwapRooms",), + 0x80105FE0:("MapDisp_Minimap_DrawRedCompassIcon",), + 0x80106408:("MapDisp_IsLocationRomaniRanchAltScene",), + 0x80106450:("MapDisp_CanDisplayMinimap",), + 0x801064CC:("MapDisp_IsLocationMinimapBlocked",), + 0x80106530:("MapDisp_IsMinimapToggleBlocked",), + 0x8010657C:("MapDisp_AreRoomsSameStorey",), + 0x80106644:("MapDisp_DrawMinimap",), + 0x8010683C:("MapDisp_ResetMapI",), + 0x801068B4:("MapDisp_InitMapI",), + 0x801068D8:("MapDisp_DestroyMapI",), + 0x801068FC:("MapDisp_AllocDungeonMap",), + 0x80106BEC:("MapDisp_IsOnStorey",), + 0x80106D08:("MapDisp_ConvertBossSceneToDungeonScene",), + 0x80106D5C:("MapDisp_DrawRooms",), + 0x80107B78:("MapDisp_DrawChests",), + 0x80108124:("MapDisp_DrawRoomExits",), + 0x80108558:("MapDisp_DrawBossIcon",), + 0x80108A10:("MapDisp_GetDungeonMapFloorTexture",), + 0x80108A64:("MapDisp_SkipDrawDungeonMap",), + 0x80108AF8:("MapDisp_DrawDungeonFloorSelect",), + 0x801090B0:("MapDisp_IsValidStorey",), + 0x80109124:("MapDisp_GetPlayerStorey",), + 0x801091F0:("MapDisp_DrawDungeonMap",), + 0x80109428:("MapDisp_UpdateDungeonMap",), + 0x801094A0:("MapData_GetMapColor",), 0x801094C8:("func_801094C8",), - 0x801094F8:("func_801094F8",), - 0x80109528:("func_80109528",), - 0x8010954C:("func_8010954C",), + 0x801094F8:("MapData_GetMapTexOffsetGameplayDangeonKeep",), + 0x80109528:("MapData_GetMapDrawTypeGameplayDangeonKeep",), + 0x8010954C:("MapData_GetMapColorIndexGameplayDangeonKeep",), 0x8010956C:("func_8010956C",), - 0x8010958C:("func_8010958C",), - 0x801095AC:("func_801095AC",), - 0x801095DC:("func_801095DC",), - 0x8010960C:("func_8010960C",), - 0x80109630:("func_80109630",), - 0x80109650:("func_80109650",), - 0x80109670:("func_80109670",), - 0x801096D4:("func_801096D4",), - 0x80109714:("func_80109714",), - 0x80109754:("func_80109754",), - 0x801097C8:("func_801097C8",), - 0x8010983C:("func_8010983C",), - 0x801098A0:("func_801098A0",), - 0x80109908:("func_80109908",), + 0x8010958C:("MapData_GetMapTexGameplayDangeonKeep",), + 0x801095AC:("MapData_GetMapTexGameplayDangeonKeepDim",), + 0x801095DC:("MapData_GetMapTexGameplayDangeonKeepOffset",), + 0x8010960C:("MapData_GetMapGrandDrawType",), + 0x80109630:("MapData_GetMapGrandColorIndex",), + 0x80109650:("MapData_GetMapGrandScale",), + 0x80109670:("MapData_MapGrandTexSizeTest",), + 0x801096D4:("MapData_GetSizeOfMapGrandTex",), + 0x80109714:("MapData_MID_GetType",), + 0x80109754:("MapData_GetMapTexDim",), + 0x801097C8:("MapData_GetMapTexOffset",), + 0x8010983C:("MapData_GetMapScale",), + 0x801098A0:("MapData_GetDrawType",), + 0x80109908:("MapData_GetMapColorIndex",), 0x80109964:("func_80109964",), - 0x8010997C:("func_8010997C",), - 0x801099AC:("func_801099AC",), - 0x801099DC:("func_801099DC",), - 0x80109A00:("func_80109A00",), - 0x80109A20:("func_80109A20",), - 0x80109A40:("func_80109A40",), - 0x80109A98:("func_80109A98",), - 0x80109AD8:("func_80109AD8",), + 0x8010997C:("MapData_GetMapITexDim",), + 0x801099AC:("MapData_GetMapITexOffset",), + 0x801099DC:("MapData_GetMapIDrawType",), + 0x80109A00:("MapData_GetMapIColorIndex",), + 0x80109A20:("MapData_GetMapIScale",), + 0x80109A40:("MapData_MapITexSizeTest",), + 0x80109A98:("MapDisp_GetSizeOfMapITex",), + 0x80109AD8:("MapData_GetMapIId",), 0x80109B38:("func_80109B38",), - 0x80109BA0:("func_80109BA0",), - 0x80109BF4:("func_80109BF4",), + 0x80109BA0:("MapData_GetMapCompactId",), + 0x80109BF4:("MapData_CPID_GetType",), 0x80109C38:("func_80109C38",), - 0x80109CBC:("func_80109CBC",), - 0x80109D40:("func_80109D40",), - 0x80109DD8:("func_80109DD8",), - 0x80109E70:("func_80109E70",), - 0x80109EF8:("func_80109EF8",), - 0x80109F78:("func_80109F78",), - 0x8010A000:("Map_GetDungeonOrBossAreaIndex",), - 0x8010A074:("Map_IsInDungeonOrBossAreaArea",), - 0x8010A0A4:("func_8010A0A4",), - 0x8010A0F0:("Map_GetDungeonAreaIndex",), - 0x8010A164:("Map_IsInDungeonArea",), - 0x8010A194:("Map_GetBossAreaIndex",), - 0x8010A208:("Map_IsInBossArea",), - 0x8010A238:("func_8010A238",), - 0x8010A2AC:("func_8010A2AC",), - 0x8010A2DC:("Minimap_SavePlayerRoomInitInfo",), + 0x80109CBC:("MapData_CPID_GetSizeOfMapTex",), + 0x80109D40:("MapData_CPID_GetTexDim",), + 0x80109DD8:("MapData_CPID_GetTexOffset",), + 0x80109E70:("MapData_CPID_GetDrawType",), + 0x80109EF8:("MapData_CPID_GetMapColorIndex",), + 0x80109F78:("MapData_CPID_GetMapScale",), + 0x8010A000:("Map_GetDungeonSceneIndex",), + 0x8010A074:("Map_IsInDungeonOrBossSceneArea",), + 0x8010A0A4:("Map_CurRoomHasMapI",), + 0x8010A0F0:("Map_GetDungeonSceneIndexForDungeon",), + 0x8010A164:("Map_IsInDungeonScene",), + 0x8010A194:("Map_GetDungeonSceneIndexForBoss",), + 0x8010A208:("Map_IsInBossScene",), + 0x8010A238:("Map_GetMapIndexForOverworld",), + 0x8010A2AC:("Map_IsInOverworldSceneWithMapIndex",), + 0x8010A2DC:("Map_SetAreaEntrypoint",), 0x8010A33C:("Map_InitRoomData",), 0x8010A410:("Map_Destroy",), 0x8010A430:("Map_Init",), - 0x8010A54C:("Minimap_Draw",), + 0x8010A54C:("Map_DrawMinimap",), 0x8010A580:("Map_Update",), 0x8010A760:("MsgEvent_CheckWeekEventReg",), 0x8010A7CC:("MsgEvent_CheckGoron",), @@ -2434,8 +2434,8 @@ 0x8012FC18:("Scene_CommandObjectList",), 0x8012FDA4:("Scene_CommandLightList",), 0x8012FE2C:("Scene_CommandPathList",), - 0x8012FE5C:("Scene_CommandTransiActorList",), - 0x8012FEBC:("Door_InitContext",), + 0x8012FE5C:("Scene_CommandTransitionActorList",), + 0x8012FEBC:("Scene_ResetTransitionActorList",), 0x8012FECC:("Scene_CommandEnvLightSettings",), 0x8012FF10:("Scene_LoadAreaTextures",), 0x8012FF8C:("Scene_CommandSkyboxSettings",), @@ -2449,9 +2449,9 @@ 0x80130454:("Scene_CommandAltHeaderList",), 0x801304CC:("Scene_CommandCutsceneScriptList",), 0x80130500:("Scene_CommandCutsceneList",), - 0x80130540:("Scene_CommandMiniMap",), + 0x80130540:("Scene_CommandMapData",), 0x80130578:("Scene_Command1D",), - 0x80130588:("Scene_CommandMiniMapCompassInfo",), + 0x80130588:("Scene_CommandMapDataChests",), 0x801305B0:("Scene_CommandSetRegionVisitedFlag",), 0x80130674:("Scene_CommandAnimatedMaterials",), 0x801306A4:("Scene_SetExitFade",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 2fc14db916..1055a990a4 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -979,52 +979,34 @@ 0x801BEA70:("sHeartDDTextures","UNK_TYPE1","",0x1), 0x801BEAB0:("sPosBindFuncs","LightsPosBindFunc","[3]",0xc), 0x801BEABC:("sDirBindFuncs","LightsBindFunc","[3]",0xc), - 0x801BEAD4:("D_801BEAD4","UNK_TYPE4","",0x4), - 0x801BEAD8:("D_801BEAD8","UNK_TYPE4","",0x4), - 0x801BEAE0:("D_801BEAE0","UNK_TYPE1","",0x1), - 0x801BEAF4:("D_801BEAF4","UNK_TYPE4","",0x4), - 0x801BEAF8:("D_801BEAF8","UNK_TYPE4","",0x4), - 0x801BEB04:("D_801BEB04","UNK_TYPE4","",0x4), - 0x801BEB08:("D_801BEB08","UNK_TYPE4","",0x4), - 0x801BEB14:("D_801BEB14","UNK_TYPE4","",0x4), - 0x801BEB18:("D_801BEB18","UNK_TYPE4","",0x4), - 0x801BEB24:("D_801BEB24","UNK_TYPE4","",0x4), - 0x801BEB28:("D_801BEB28","UNK_TYPE4","",0x4), - 0x801BEB38:("D_801BEB38","UNK_TYPE1","",0x1), - 0x801BEBB8:("D_801BEBB8","UNK_TYPE4","",0x4), - 0x801BEBD8:("D_801BEBD8","UNK_TYPE4","",0x4), - 0x801BEBF8:("D_801BEBF8","UNK_TYPE2","",0x2), - 0x801BEBFA:("D_801BEBFA","UNK_TYPE2","",0x2), - 0x801BEBFC:("D_801BEBFC","UNK_TYPE2","",0x2), - 0x801BEC10:("D_801BEC10","UNK_TYPE2","",0x2), - 0x801BEC14:("D_801BEC14","UNK_PTR","",0x4), - 0x801BEC1C:("D_801BEC1C","UNK_TYPE4","",0x4), - 0x801BEC20:("D_801BEC20","UNK_TYPE4","",0x4), - 0x801BEC24:("D_801BEC24","UNK_TYPE1","",0x1), - 0x801BEC2C:("D_801BEC2C","UNK_TYPE1","",0x1), - 0x801BEC5C:("D_801BEC5C","UNK_TYPE2","",0x2), - 0x801BEC5E:("D_801BEC5E","UNK_TYPE2","",0x2), - 0x801BEC70:("D_801BEC70","UNK_TYPE4","",0x4), - 0x801BEC84:("D_801BEC84","UNK_TYPE1","",0x1), - 0x801BECA4:("D_801BECA4","UNK_TYPE1","",0x1), - 0x801BECC4:("D_801BECC4","UNK_TYPE1","",0x1), - 0x801BECE4:("D_801BECE4","UNK_TYPE1","",0x1), - 0x801BED00:("D_801BED00","UNK_TYPE1","",0x1), - 0x801BED24:("D_801BED24","UNK_TYPE2","",0x2), - 0x801BED3C:("D_801BED3C","UNK_TYPE1","",0x1), - 0x801BED40:("D_801BED40","UNK_TYPE1","",0x1), - 0x801BED4C:("D_801BED4C","UNK_TYPE1","",0x1), - 0x801BED54:("D_801BED54","UNK_TYPE1","",0x1), - 0x801BED55:("D_801BED55","UNK_TYPE1","",0x1), - 0x801BED56:("D_801BED56","UNK_TYPE1","",0x1), - 0x801BED88:("D_801BED88","UNK_TYPE1","",0x1), - 0x801BEFC8:("D_801BEFC8","UNK_TYPE1","",0x1), - 0x801BF15C:("D_801BF15C","UNK_TYPE1","",0x1), - 0x801BF170:("D_801BF170","UNK_TYPE1","",0x1), - 0x801BF176:("D_801BF176","UNK_TYPE1","",0x1), - 0x801BF177:("D_801BF177","UNK_TYPE1","",0x1), - 0x801BF178:("D_801BF178","UNK_TYPE1","",0x1), - 0x801BF3B4:("D_801BF3B4","UNK_TYPE1","",0x1), + 0x801BEAD0:("D_801BEAD0","s32","[4]",0x10), + 0x801BEAE0:("D_801BEAE0","s32","[4]",0x10), + 0x801BEAF0:("D_801BEAF0","u32","[4]",0x10), + 0x801BEB00:("D_801BEB00","s32","[4]",0x10), + 0x801BEB10:("D_801BEB10","u32","[4]",0x10), + 0x801BEB20:("D_801BEB20","u32","[4]",0x10), + 0x801BEB38:("sWhiteSquareTex","UNK_TYPE1","",0x1), + 0x801BEBB8:("sMapDisp","MapDisp","",0x5C), + 0x801BEC14:("sMapDataScene","MinimapList","",0x8), + 0x801BEC1C:("sSceneNumRooms","s32","",0x4), + 0x801BEC20:("sNumChests","s32","",0x4), + 0x801BEC24:("D_801BEC24","UNK_TYPE1","",0x8), + 0x801BEC2C:("D_801BEC2C","Color_RGBA8","[12]",0x30), + 0x801BEC5C:("sCustomLowestFloor","MapCustomLowestFloor","[5]",0x14), + 0x801BEC70:("D_801BEC70","UNK_TYPE4","",0x14), + 0x801BEC84:("D_801BEC84","u16","[16]",0x10), + 0x801BECA4:("D_801BECA4","u16","[16]",0x10), + 0x801BECC4:("D_801BECC4","u16","[16]",0x10), + 0x801BECE4:("D_801BECE4","UNK_TYPE1","",0x1C), + 0x801BED00:("D_801BED00","UNK_TYPE1","",0x24), + 0x801BED24:("D_801BED24","UNK_TYPE2","",0x18), + 0x801BED40:("sMapColorTable","Color_RGBA8","",0xC), + 0x801BED4C:("sGameplayDangeonKeepInfo","MapSpriteInfo2","",0x3C), + 0x801BED88:("sMapGrandStaticInfo","MapSpriteInfo","",0x3D4), + 0x801BF15C:("D_801BF15C","s32","",0x14), + 0x801BF170:("sMapIStaticInfo","MapSpriteInfo","",0x244), + 0x801BF3B4:("sMapIForGameplayDangeonKeep","s32","",0x14), + 0x801BF3C8:("sMapIForMapGrand","s32","",0x188), 0x801BF550:("D_801BF550","UNK_TYPE2","",0x2), 0x801BF554:("D_801BF554","UNK_TYPE2","",0x2), 0x801BF558:("D_801BF558","UNK_TYPE2","",0x2), @@ -3908,14 +3890,10 @@ 0x801F4F6A:("D_801F4F6A","UNK_TYPE1","",0x1), 0x801F4F70:("sLightsBuffer","LightsBuffer","",0x188), 0x801F5100:("sZeldaArena","Arena","",0x24), - 0x801F5130:("D_801F5130","UNK_TYPE1","",0x1), - 0x801F5270:("D_801F5270","UNK_TYPE1","",0x1), - 0x801F528E:("D_801F528E","UNK_TYPE1","",0x1), - 0x801F53B0:("D_801F53B0","UNK_TYPE1","",0x1), - 0x801F56B0:("D_801F56B0","UNK_TYPE1","",0x1), - 0x801F5730:("D_801F5730","UNK_TYPE1","",0x1), - 0x801F57B4:("D_801F57B4","UNK_TYPE1","",0x1), - 0x801F5834:("D_801F5834","UNK_TYPE1","",0x1), + 0x801F5130:("sMapDataRooms","UNK_TYPE1","",0x1), + 0x801F5270:("sMapDataChests","UNK_TYPE1","",0x140), + 0x801F53B0:("sTransitionActors","UNK_TYPE1","",0x1), + 0x801F56B0:("sPauseDungeonMap","PauseDungeonMap","",0x188), 0x801F5840:("gNMIBuffer","s32*","",0x4), 0x801F5850:("sPostmanTimerInput","UNK_TYPE1","",0x1), 0x801F58B0:("D_801F58B0","struct_801F58B0","[3][3]",0xFC), diff --git a/tools/namefixer.py b/tools/namefixer.py index 750cef6eef..e137a0d286 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -13,8 +13,8 @@ # if the occurence is the whole word # for example, if there is a space before and an open parenthesis after, # like for a function call: ` func_8002E4B4(` -# -# Custom behaviour can be enabled by using a tuple as the value (see +# +# Custom behaviour can be enabled by using a tuple as the value (see # explanation in replace_single below) wordReplace = { # Functions @@ -936,17 +936,20 @@ "func_800E8EA0": "Actor_ContinueText", "func_800B90F4": "Actor_DeactivateLens", - "func_8010A000": "Map_GetDungeonOrBossAreaIndex", - "func_8010A074": "Map_IsInDungeonOrBossArea", - "func_8010A0F0": "Map_GetDungeonAreaIndex", - "func_8010A164": "Map_IsInDungeonArea", - "func_8010A194": "Map_GetBossAreaIndex", - "func_8010A208": "Map_IsInBossArea", + "func_8010A000": "Map_GetDungeonSceneIndex", + "func_8010A074": "Map_IsInDungeonOrBossScene", + "func_8010A0F0": "Map_GetDungeonSceneIndexForDungeon", + "func_8010A164": "Map_IsInDungeonScene", + "Map_IsInDungeonArea": "Map_IsInDungeonScene", + "func_8010A194": "Map_GetDungeonSceneIndexForBoss", + "func_8010A208": "Map_IsInBossScene", + "Map_IsInBossArea": "Map_IsInBossScene", "func_8010A2DC": "Minimap_SavePlayerRoomInitInfo", "func_8010A33C": "Map_InitRoomData", "func_8010A410": "Map_Destroy", "func_8010A430": "Map_Init", - "func_8010A54C": "Minimap_Draw", + "func_8010A54C": "Map_DrawMinimap", + "Minimap_Draw": "Map_DrawMinimap", "func_8010A580": "Map_Update", "Entrance_CreateIndex": "Entrance_Create", @@ -1047,7 +1050,7 @@ "func_8012CA38": "Gfx_SetupDL59_Opa", "Game_SetFramerateDivisor": "GameState_SetFramerateDivisor", - + "DmaMgr_SendRequestImpl": "DmaMgr_RequestAsync", "DmaMgr_SendRequest0": "DmaMgr_RequestSync", @@ -1300,6 +1303,7 @@ "play->actorCtx.targetCtx.unk4C": "play->actorCtx.targetCtx.lockOnIndex", "play->actorCtx.targetCtx.unk50": "play->actorCtx.targetCtx.lockOnTriangleSets", "play->actorCtx.targetCtx.unk8C": "play->actorCtx.targetCtx.nextTarget", + "play->doorCtx.transitionActorList": "play->transitionActors.list", "play->nextEntranceIndex": "play->nextEntrance", "play->sceneNum": "play->sceneId", "play->pauseCtx.unk_1F0": "play->pauseCtx.bombersNotebookOpen", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 1515fb69d6..398f98bde9 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1415,113 +1415,113 @@ asm/non_matchings/code/z_malloc/ZeldaArena_Check.s,ZeldaArena_Check,0x80102D98,0 asm/non_matchings/code/z_malloc/ZeldaArena_Init.s,ZeldaArena_Init,0x80102DBC,0xC asm/non_matchings/code/z_malloc/ZeldaArena_Cleanup.s,ZeldaArena_Cleanup,0x80102DEC,0x9 asm/non_matchings/code/z_malloc/ZeldaArena_IsInitialized.s,ZeldaArena_IsInitialized,0x80102E10,0xC -asm/non_matchings/code/z_map_disp/func_80102E40.s,func_80102E40,0x80102E40,0x14 -asm/non_matchings/code/z_map_disp/func_80102E90.s,func_80102E90,0x80102E90,0x5 -asm/non_matchings/code/z_map_disp/func_80102EA4.s,func_80102EA4,0x80102EA4,0x4 +asm/non_matchings/code/z_map_disp/MapDisp_GetMapITexture.s,MapDisp_GetMapITexture,0x80102E40,0x14 +asm/non_matchings/code/z_map_disp/MapDisp_InitRoomStoreyRecord.s,MapDisp_InitRoomStoreyRecord,0x80102E90,0x5 +asm/non_matchings/code/z_map_disp/MapDisp_DestroyRoomStoreyRecord.s,MapDisp_DestroyRoomStoreyRecord,0x80102EA4,0x4 asm/non_matchings/code/z_map_disp/func_80102EB4.s,func_80102EB4,0x80102EB4,0x7 asm/non_matchings/code/z_map_disp/func_80102ED0.s,func_80102ED0,0x80102ED0,0x8 -asm/non_matchings/code/z_map_disp/func_80102EF0.s,func_80102EF0,0x80102EF0,0x2B -asm/non_matchings/code/z_map_disp/func_80102F9C.s,func_80102F9C,0x80102F9C,0x3D -asm/non_matchings/code/z_map_disp/func_80103090.s,func_80103090,0x80103090,0x9 -asm/non_matchings/code/z_map_disp/func_801030B4.s,func_801030B4,0x801030B4,0x10 -asm/non_matchings/code/z_map_disp/func_801030F4.s,func_801030F4,0x801030F4,0x37 -asm/non_matchings/code/z_map_disp/func_801031D0.s,func_801031D0,0x801031D0,0x207 -asm/non_matchings/code/z_map_disp/func_801039EC.s,func_801039EC,0x801039EC,0x9 -asm/non_matchings/code/z_map_disp/func_80103A10.s,func_80103A10,0x80103A10,0x12 -asm/non_matchings/code/z_map_disp/func_80103A58.s,func_80103A58,0x80103A58,0x251 -asm/non_matchings/code/z_map_disp/func_8010439C.s,func_8010439C,0x8010439C,0x84 -asm/non_matchings/code/z_map_disp/func_801045AC.s,func_801045AC,0x801045AC,0x14F -asm/non_matchings/code/z_map_disp/func_80104AE8.s,func_80104AE8,0x80104AE8,0x66 -asm/non_matchings/code/z_map_disp/func_80104C80.s,func_80104C80,0x80104C80,0x1D -asm/non_matchings/code/z_map_disp/func_80104CF4.s,func_80104CF4,0x80104CF4,0x90 -asm/non_matchings/code/z_map_disp/func_80104F34.s,func_80104F34,0x80104F34,0xD8 -asm/non_matchings/code/z_map_disp/func_80105294.s,func_80105294,0x80105294,0x21 -asm/non_matchings/code/z_map_disp/func_80105318.s,func_80105318,0x80105318,0x4 -asm/non_matchings/code/z_map_disp/func_80105328.s,func_80105328,0x80105328,0x9 -asm/non_matchings/code/z_map_disp/func_8010534C.s,func_8010534C,0x8010534C,0x54 -asm/non_matchings/code/z_map_disp/func_8010549C.s,func_8010549C,0x8010549C,0x70 -asm/non_matchings/code/z_map_disp/func_8010565C.s,func_8010565C,0x8010565C,0x6F -asm/non_matchings/code/z_map_disp/func_80105818.s,func_80105818,0x80105818,0x8A -asm/non_matchings/code/z_map_disp/func_80105A40.s,func_80105A40,0x80105A40,0x3D -asm/non_matchings/code/z_map_disp/func_80105B34.s,func_80105B34,0x80105B34,0x43 -asm/non_matchings/code/z_map_disp/func_80105C40.s,func_80105C40,0x80105C40,0xE8 -asm/non_matchings/code/z_map_disp/func_80105FE0.s,func_80105FE0,0x80105FE0,0x10A -asm/non_matchings/code/z_map_disp/func_80106408.s,func_80106408,0x80106408,0x12 -asm/non_matchings/code/z_map_disp/func_80106450.s,func_80106450,0x80106450,0x1F -asm/non_matchings/code/z_map_disp/func_801064CC.s,func_801064CC,0x801064CC,0x19 -asm/non_matchings/code/z_map_disp/func_80106530.s,func_80106530,0x80106530,0x13 -asm/non_matchings/code/z_map_disp/func_8010657C.s,func_8010657C,0x8010657C,0x32 -asm/non_matchings/code/z_map_disp/func_80106644.s,func_80106644,0x80106644,0x7E -asm/non_matchings/code/z_map_disp/func_8010683C.s,func_8010683C,0x8010683C,0x1E -asm/non_matchings/code/z_map_disp/func_801068B4.s,func_801068B4,0x801068B4,0x9 -asm/non_matchings/code/z_map_disp/func_801068D8.s,func_801068D8,0x801068D8,0x9 -asm/non_matchings/code/z_map_disp/func_801068FC.s,func_801068FC,0x801068FC,0xBC -asm/non_matchings/code/z_map_disp/func_80106BEC.s,func_80106BEC,0x80106BEC,0x47 -asm/non_matchings/code/z_map_disp/func_80106D08.s,func_80106D08,0x80106D08,0x15 -asm/non_matchings/code/z_map_disp/func_80106D5C.s,func_80106D5C,0x80106D5C,0x387 -asm/non_matchings/code/z_map_disp/func_80107B78.s,func_80107B78,0x80107B78,0x16B -asm/non_matchings/code/z_map_disp/func_80108124.s,func_80108124,0x80108124,0x10D -asm/non_matchings/code/z_map_disp/func_80108558.s,func_80108558,0x80108558,0x12E -asm/non_matchings/code/z_map_disp/func_80108A10.s,func_80108A10,0x80108A10,0x15 -asm/non_matchings/code/z_map_disp/func_80108A64.s,func_80108A64,0x80108A64,0x25 -asm/non_matchings/code/z_map_disp/func_80108AF8.s,func_80108AF8,0x80108AF8,0x16E -asm/non_matchings/code/z_map_disp/func_801090B0.s,func_801090B0,0x801090B0,0x1D -asm/non_matchings/code/z_map_disp/func_80109124.s,func_80109124,0x80109124,0x33 -asm/non_matchings/code/z_map_disp/func_801091F0.s,func_801091F0,0x801091F0,0x8E -asm/non_matchings/code/z_map_disp/func_80109428.s,func_80109428,0x80109428,0x1E -asm/non_matchings/code/z_map_data/func_801094A0.s,func_801094A0,0x801094A0,0xA +asm/non_matchings/code/z_map_disp/MapDisp_CurRoomHasMapI.s,MapDisp_CurRoomHasMapI,0x80102EF0,0x2B +asm/non_matchings/code/z_map_disp/MapDisp_GetStoreyY.s,MapDisp_GetStoreyY,0x80102F9C,0x3D +asm/non_matchings/code/z_map_disp/MapDisp_GetMapTexDim.s,MapDisp_GetMapTexDim,0x80103090,0x9 +asm/non_matchings/code/z_map_disp/MapDisp_GetMapScale.s,MapDisp_GetMapScale,0x801030B4,0x10 +asm/non_matchings/code/z_map_disp/MapDisp_GetMapOffset.s,MapDisp_GetMapOffset,0x801030F4,0x37 +asm/non_matchings/code/z_map_disp/MapDisp_DrawMinimapRoom.s,MapDisp_DrawMinimapRoom,0x801031D0,0x207 +asm/non_matchings/code/z_map_disp/MapDisp_IsDataRotated.s,MapDisp_IsDataRotated,0x801039EC,0x9 +asm/non_matchings/code/z_map_disp/MapDisp_CanDrawDoors.s,MapDisp_CanDrawDoors,0x80103A10,0x12 +asm/non_matchings/code/z_map_disp/MapDisp_Minimap_DrawActorIcon.s,MapDisp_Minimap_DrawActorIcon,0x80103A58,0x251 +asm/non_matchings/code/z_map_disp/MapDisp_Minimap_DrawActors.s,MapDisp_Minimap_DrawActors,0x8010439C,0x84 +asm/non_matchings/code/z_map_disp/MapDisp_Minimap_DrawDoorActor.s,MapDisp_Minimap_DrawDoorActor,0x801045AC,0x14F +asm/non_matchings/code/z_map_disp/MapDisp_Minimap_DrawDoorActors.s,MapDisp_Minimap_DrawDoorActors,0x80104AE8,0x66 +asm/non_matchings/code/z_map_disp/MapDisp_AwaitGameplayDangeonKeep.s,MapDisp_AwaitGameplayDangeonKeep,0x80104C80,0x1D +asm/non_matchings/code/z_map_disp/MapDisp_Init.s,MapDisp_Init,0x80104CF4,0x90 +asm/non_matchings/code/z_map_disp/MapDisp_InitSceneFloorData.s,MapDisp_InitSceneFloorData,0x80104F34,0xD8 +asm/non_matchings/code/z_map_disp/MapDisp_GetBossIconY.s,MapDisp_GetBossIconY,0x80105294,0x21 +asm/non_matchings/code/z_map_disp/MapDisp_GetBossRoomStorey.s,MapDisp_GetBossRoomStorey,0x80105318,0x4 +asm/non_matchings/code/z_map_disp/MapDisp_IsBossDoor.s,MapDisp_IsBossDoor,0x80105328,0x9 +asm/non_matchings/code/z_map_disp/MapDisp_InitBossRoomStorey.s,MapDisp_InitBossRoomStorey,0x8010534C,0x54 +asm/non_matchings/code/z_map_disp/MapDisp_InitMapData.s,MapDisp_InitMapData,0x8010549C,0x70 +asm/non_matchings/code/z_map_disp/MapDisp_InitChestData.s,MapDisp_InitChestData,0x8010565C,0x6F +asm/non_matchings/code/z_map_disp/MapDisp_InitTransitionActorData.s,MapDisp_InitTransitionActorData,0x80105818,0x8A +asm/non_matchings/code/z_map_disp/MapDisp_Destroy.s,MapDisp_Destroy,0x80105A40,0x3D +asm/non_matchings/code/z_map_disp/MapDisp_Update.s,MapDisp_Update,0x80105B34,0x43 +asm/non_matchings/code/z_map_disp/MapDisp_SwapRooms.s,MapDisp_SwapRooms,0x80105C40,0xE8 +asm/non_matchings/code/z_map_disp/MapDisp_Minimap_DrawRedCompassIcon.s,MapDisp_Minimap_DrawRedCompassIcon,0x80105FE0,0x10A +asm/non_matchings/code/z_map_disp/MapDisp_IsLocationRomaniRanchAltScene.s,MapDisp_IsLocationRomaniRanchAltScene,0x80106408,0x12 +asm/non_matchings/code/z_map_disp/MapDisp_CanDisplayMinimap.s,MapDisp_CanDisplayMinimap,0x80106450,0x1F +asm/non_matchings/code/z_map_disp/MapDisp_IsLocationMinimapBlocked.s,MapDisp_IsLocationMinimapBlocked,0x801064CC,0x19 +asm/non_matchings/code/z_map_disp/MapDisp_IsMinimapToggleBlocked.s,MapDisp_IsMinimapToggleBlocked,0x80106530,0x13 +asm/non_matchings/code/z_map_disp/MapDisp_AreRoomsSameStorey.s,MapDisp_AreRoomsSameStorey,0x8010657C,0x32 +asm/non_matchings/code/z_map_disp/MapDisp_DrawMinimap.s,MapDisp_DrawMinimap,0x80106644,0x7E +asm/non_matchings/code/z_map_disp/MapDisp_ResetMapI.s,MapDisp_ResetMapI,0x8010683C,0x1E +asm/non_matchings/code/z_map_disp/MapDisp_InitMapI.s,MapDisp_InitMapI,0x801068B4,0x9 +asm/non_matchings/code/z_map_disp/MapDisp_DestroyMapI.s,MapDisp_DestroyMapI,0x801068D8,0x9 +asm/non_matchings/code/z_map_disp/MapDisp_AllocDungeonMap.s,MapDisp_AllocDungeonMap,0x801068FC,0xBC +asm/non_matchings/code/z_map_disp/MapDisp_IsOnStorey.s,MapDisp_IsOnStorey,0x80106BEC,0x47 +asm/non_matchings/code/z_map_disp/MapDisp_ConvertBossSceneToDungeonScene.s,MapDisp_ConvertBossSceneToDungeonScene,0x80106D08,0x15 +asm/non_matchings/code/z_map_disp/MapDisp_DrawRooms.s,MapDisp_DrawRooms,0x80106D5C,0x387 +asm/non_matchings/code/z_map_disp/MapDisp_DrawChests.s,MapDisp_DrawChests,0x80107B78,0x16B +asm/non_matchings/code/z_map_disp/MapDisp_DrawRoomExits.s,MapDisp_DrawRoomExits,0x80108124,0x10D +asm/non_matchings/code/z_map_disp/MapDisp_DrawBossIcon.s,MapDisp_DrawBossIcon,0x80108558,0x12E +asm/non_matchings/code/z_map_disp/MapDisp_GetDungeonMapFloorTexture.s,MapDisp_GetDungeonMapFloorTexture,0x80108A10,0x15 +asm/non_matchings/code/z_map_disp/MapDisp_SkipDrawDungeonMap.s,MapDisp_SkipDrawDungeonMap,0x80108A64,0x25 +asm/non_matchings/code/z_map_disp/MapDisp_DrawDungeonFloorSelect.s,MapDisp_DrawDungeonFloorSelect,0x80108AF8,0x16E +asm/non_matchings/code/z_map_disp/MapDisp_IsValidStorey.s,MapDisp_IsValidStorey,0x801090B0,0x1D +asm/non_matchings/code/z_map_disp/MapDisp_GetPlayerStorey.s,MapDisp_GetPlayerStorey,0x80109124,0x33 +asm/non_matchings/code/z_map_disp/MapDisp_DrawDungeonMap.s,MapDisp_DrawDungeonMap,0x801091F0,0x8E +asm/non_matchings/code/z_map_disp/MapDisp_UpdateDungeonMap.s,MapDisp_UpdateDungeonMap,0x80109428,0x1E +asm/non_matchings/code/z_map_data/MapData_GetMapColor.s,MapData_GetMapColor,0x801094A0,0xA asm/non_matchings/code/z_map_data/func_801094C8.s,func_801094C8,0x801094C8,0xC -asm/non_matchings/code/z_map_data/func_801094F8.s,func_801094F8,0x801094F8,0xC -asm/non_matchings/code/z_map_data/func_80109528.s,func_80109528,0x80109528,0x9 -asm/non_matchings/code/z_map_data/func_8010954C.s,func_8010954C,0x8010954C,0x8 +asm/non_matchings/code/z_map_data/MapData_GetMapTexOffsetGameplayDangeonKeep.s,MapData_GetMapTexOffsetGameplayDangeonKeep,0x801094F8,0xC +asm/non_matchings/code/z_map_data/MapData_GetMapDrawTypeGameplayDangeonKeep.s,MapData_GetMapDrawTypeGameplayDangeonKeep,0x80109528,0x9 +asm/non_matchings/code/z_map_data/MapData_GetMapColorIndexGameplayDangeonKeep.s,MapData_GetMapColorIndexGameplayDangeonKeep,0x8010954C,0x8 asm/non_matchings/code/z_map_data/func_8010956C.s,func_8010956C,0x8010956C,0x8 -asm/non_matchings/code/z_map_data/func_8010958C.s,func_8010958C,0x8010958C,0x8 +asm/non_matchings/code/z_map_data/MapData_GetMapTexGameplayDangeonKeep.s,MapData_GetMapTexGameplayDangeonKeep,0x8010958C,0x8 asm/non_matchings/code/z_map_data/func_801095AC.s,func_801095AC,0x801095AC,0xC -asm/non_matchings/code/z_map_data/func_801095DC.s,func_801095DC,0x801095DC,0xC -asm/non_matchings/code/z_map_data/func_8010960C.s,func_8010960C,0x8010960C,0x9 -asm/non_matchings/code/z_map_data/func_80109630.s,func_80109630,0x80109630,0x8 -asm/non_matchings/code/z_map_data/func_80109650.s,func_80109650,0x80109650,0x8 -asm/non_matchings/code/z_map_data/func_80109670.s,func_80109670,0x80109670,0x19 -asm/non_matchings/code/z_map_data/func_801096D4.s,func_801096D4,0x801096D4,0x10 -asm/non_matchings/code/z_map_data/func_80109714.s,func_80109714,0x80109714,0x10 +asm/non_matchings/code/z_map_data/MapData_GetMapTexGameplayDangeonKeepOffset.s,MapData_GetMapTexGameplayDangeonKeepOffset,0x801095DC,0xC +asm/non_matchings/code/z_map_data/MapData_GetMapGrandDrawType.s,MapData_GetMapGrandDrawType,0x8010960C,0x9 +asm/non_matchings/code/z_map_data/MapData_GetMapGrandColorIndex.s,MapData_GetMapGrandColorIndex,0x80109630,0x8 +asm/non_matchings/code/z_map_data/MapData_GetMapGrandScale.s,MapData_GetMapGrandScale,0x80109650,0x8 +asm/non_matchings/code/z_map_data/MapData_MapGrandTexSizeTest.s,MapData_MapGrandTexSizeTest,0x80109670,0x19 +asm/non_matchings/code/z_map_data/MapData_GetSizeOfMapGrandTex.s,MapData_GetSizeOfMapGrandTex,0x801096D4,0x10 +asm/non_matchings/code/z_map_data/MapData_MID_GetType.s,MapData_MID_GetType,0x80109714,0x10 asm/non_matchings/code/z_map_data/func_80109754.s,func_80109754,0x80109754,0x1D -asm/non_matchings/code/z_map_data/func_801097C8.s,func_801097C8,0x801097C8,0x1D +asm/non_matchings/code/z_map_data/MapData_GetMapTexOffset.s,MapData_GetMapTexOffset,0x801097C8,0x1D asm/non_matchings/code/z_map_data/func_8010983C.s,func_8010983C,0x8010983C,0x19 -asm/non_matchings/code/z_map_data/func_801098A0.s,func_801098A0,0x801098A0,0x1A -asm/non_matchings/code/z_map_data/func_80109908.s,func_80109908,0x80109908,0x17 +asm/non_matchings/code/z_map_data/MapData_GetDrawType.s,MapData_GetDrawType,0x801098A0,0x1A +asm/non_matchings/code/z_map_data/MapData_GetMapColorIndex.s,MapData_GetMapColorIndex,0x80109908,0x17 asm/non_matchings/code/z_map_data/func_80109964.s,func_80109964,0x80109964,0x6 -asm/non_matchings/code/z_map_data/func_8010997C.s,func_8010997C,0x8010997C,0xC -asm/non_matchings/code/z_map_data/func_801099AC.s,func_801099AC,0x801099AC,0xC -asm/non_matchings/code/z_map_data/func_801099DC.s,func_801099DC,0x801099DC,0x9 -asm/non_matchings/code/z_map_data/func_80109A00.s,func_80109A00,0x80109A00,0x8 -asm/non_matchings/code/z_map_data/func_80109A20.s,func_80109A20,0x80109A20,0x8 -asm/non_matchings/code/z_map_data/func_80109A40.s,func_80109A40,0x80109A40,0x16 -asm/non_matchings/code/z_map_data/func_80109A98.s,func_80109A98,0x80109A98,0x10 -asm/non_matchings/code/z_map_data/func_80109AD8.s,func_80109AD8,0x80109AD8,0x18 +asm/non_matchings/code/z_map_data/MapData_GetMapITexDim.s,MapData_GetMapITexDim,0x8010997C,0xC +asm/non_matchings/code/z_map_data/MapData_GetMapITexOffset.s,MapData_GetMapITexOffset,0x801099AC,0xC +asm/non_matchings/code/z_map_data/MapData_GetMapIDrawType.s,MapData_GetMapIDrawType,0x801099DC,0x9 +asm/non_matchings/code/z_map_data/MapData_GetMapIColorIndex.s,MapData_GetMapIColorIndex,0x80109A00,0x8 +asm/non_matchings/code/z_map_data/MapData_GetMapIScale.s,MapData_GetMapIScale,0x80109A20,0x8 +asm/non_matchings/code/z_map_data/MapData_MapITexSizeTest.s,MapData_MapITexSizeTest,0x80109A40,0x16 +asm/non_matchings/code/z_map_data/MapDisp_GetSizeOfMapITex.s,MapDisp_GetSizeOfMapITex,0x80109A98,0x10 +asm/non_matchings/code/z_map_data/MapData_GetMapIId.s,MapData_GetMapIId,0x80109AD8,0x18 asm/non_matchings/code/z_map_data/func_80109B38.s,func_80109B38,0x80109B38,0x1A -asm/non_matchings/code/z_map_data/func_80109BA0.s,func_80109BA0,0x80109BA0,0x15 -asm/non_matchings/code/z_map_data/func_80109BF4.s,func_80109BF4,0x80109BF4,0x11 +asm/non_matchings/code/z_map_data/MapData_GetMapCompactId.s,MapData_GetMapCompactId,0x80109BA0,0x15 +asm/non_matchings/code/z_map_data/MapData_CPID_GetType.s,MapData_CPID_GetType,0x80109BF4,0x11 asm/non_matchings/code/z_map_data/func_80109C38.s,func_80109C38,0x80109C38,0x21 asm/non_matchings/code/z_map_data/func_80109CBC.s,func_80109CBC,0x80109CBC,0x21 -asm/non_matchings/code/z_map_data/func_80109D40.s,func_80109D40,0x80109D40,0x26 -asm/non_matchings/code/z_map_data/func_80109DD8.s,func_80109DD8,0x80109DD8,0x26 -asm/non_matchings/code/z_map_data/func_80109E70.s,func_80109E70,0x80109E70,0x22 -asm/non_matchings/code/z_map_data/func_80109EF8.s,func_80109EF8,0x80109EF8,0x20 -asm/non_matchings/code/z_map_data/func_80109F78.s,func_80109F78,0x80109F78,0x22 -asm/non_matchings/code/z_map_exp/Map_GetDungeonOrBossAreaIndex.s,Map_GetDungeonOrBossAreaIndex,0x8010A000,0x1D -asm/non_matchings/code/z_map_exp/Map_IsInDungeonOrBossArea.s,Map_IsInDungeonOrBossArea,0x8010A074,0xC -asm/non_matchings/code/z_map_exp/func_8010A0A4.s,func_8010A0A4,0x8010A0A4,0x13 -asm/non_matchings/code/z_map_exp/Map_GetDungeonAreaIndex.s,Map_GetDungeonAreaIndex,0x8010A0F0,0x1D -asm/non_matchings/code/z_map_exp/Map_IsInDungeonArea.s,Map_IsInDungeonArea,0x8010A164,0xC -asm/non_matchings/code/z_map_exp/Map_GetBossAreaIndex.s,Map_GetBossAreaIndex,0x8010A194,0x1D -asm/non_matchings/code/z_map_exp/Map_IsInBossArea.s,Map_IsInBossArea,0x8010A208,0xC -asm/non_matchings/code/z_map_exp/func_8010A238.s,func_8010A238,0x8010A238,0x1D -asm/non_matchings/code/z_map_exp/func_8010A2AC.s,func_8010A2AC,0x8010A2AC,0xC -asm/non_matchings/code/z_map_exp/Minimap_SavePlayerRoomInitInfo.s,Minimap_SavePlayerRoomInitInfo,0x8010A2DC,0x18 +asm/non_matchings/code/z_map_data/MapData_CPID_GetTexDim.s,MapData_CPID_GetTexDim,0x80109D40,0x26 +asm/non_matchings/code/z_map_data/MapData_CPID_GetTexOffset.s,MapData_CPID_GetTexOffset,0x80109DD8,0x26 +asm/non_matchings/code/z_map_data/MapData_CPID_GetDrawType.s,MapData_CPID_GetDrawType,0x80109E70,0x22 +asm/non_matchings/code/z_map_data/MapData_CPID_GetMapColorIndex.s,MapData_CPID_GetMapColorIndex,0x80109EF8,0x20 +asm/non_matchings/code/z_map_data/MapData_CPID_GetMapScale.s,MapData_CPID_GetMapScale,0x80109F78,0x22 +asm/non_matchings/code/z_map_exp/Map_GetDungeonSceneIndex.s,Map_GetDungeonSceneIndex,0x8010A000,0x1D +asm/non_matchings/code/z_map_exp/Map_IsInDungeonOrBossScene.s,Map_IsInDungeonOrBossScene,0x8010A074,0xC +asm/non_matchings/code/z_map_exp/Map_CurRoomHasMapI.s,Map_CurRoomHasMapI,0x8010A0A4,0x13 +asm/non_matchings/code/z_map_exp/Map_GetDungeonSceneIndexForDungeon.s,Map_GetDungeonSceneIndexForDungeon,0x8010A0F0,0x1D +asm/non_matchings/code/z_map_exp/Map_IsInDungeonScene.s,Map_IsInDungeonScene,0x8010A164,0xC +asm/non_matchings/code/z_map_exp/Map_GetDungeonSceneIndexForBoss.s,Map_GetDungeonSceneIndexForBoss,0x8010A194,0x1D +asm/non_matchings/code/z_map_exp/Map_IsInBossScene.s,Map_IsInBossScene,0x8010A208,0xC +asm/non_matchings/code/z_map_exp/Map_GetMapIndexForOverworld.s,Map_GetMapIndexForOverworld,0x8010A238,0x1D +asm/non_matchings/code/z_map_exp/Map_IsInOverworldSceneWithMapIndex.s,Map_IsInOverworldSceneWithMapIndex,0x8010A2AC,0xC +asm/non_matchings/code/z_map_exp/Map_SetAreaEntrypoint.s,Map_SetAreaEntrypoint,0x8010A2DC,0x18 asm/non_matchings/code/z_map_exp/Map_InitRoomData.s,Map_InitRoomData,0x8010A33C,0x35 asm/non_matchings/code/z_map_exp/Map_Destroy.s,Map_Destroy,0x8010A410,0x8 asm/non_matchings/code/z_map_exp/Map_Init.s,Map_Init,0x8010A430,0x47 -asm/non_matchings/code/z_map_exp/Minimap_Draw.s,Minimap_Draw,0x8010A54C,0xD +asm/non_matchings/code/z_map_exp/Map_DrawMinimap.s,Map_DrawMinimap,0x8010A54C,0xD asm/non_matchings/code/z_map_exp/Map_Update.s,Map_Update,0x8010A580,0x78 asm/non_matchings/code/z_msgevent/MsgEvent_CheckWeekEventReg.s,MsgEvent_CheckWeekEventReg,0x8010A760,0x1B asm/non_matchings/code/z_msgevent/MsgEvent_CheckGoron.s,MsgEvent_CheckGoron,0x8010A7CC,0x12 @@ -1948,7 +1948,7 @@ asm/non_matchings/code/z_scene/Scene_CommandMesh.s,Scene_CommandMesh,0x8012FBE8, asm/non_matchings/code/z_scene/Scene_CommandObjectList.s,Scene_CommandObjectList,0x8012FC18,0x63 asm/non_matchings/code/z_scene/Scene_CommandLightList.s,Scene_CommandLightList,0x8012FDA4,0x22 asm/non_matchings/code/z_scene/Scene_CommandPathList.s,Scene_CommandPathList,0x8012FE2C,0xC -asm/non_matchings/code/z_scene/Scene_CommandTransiActorList.s,Scene_CommandTransiActorList,0x8012FE5C,0x18 +asm/non_matchings/code/z_scene/Scene_CommandTransitionActorList.s,Scene_CommandTransitionActorList,0x8012FE5C,0x18 asm/non_matchings/code/z_scene/Door_InitContext.s,Door_InitContext,0x8012FEBC,0x4 asm/non_matchings/code/z_scene/Scene_CommandEnvLightSettings.s,Scene_CommandEnvLightSettings,0x8012FECC,0x11 asm/non_matchings/code/z_scene/Scene_LoadAreaTextures.s,Scene_LoadAreaTextures,0x8012FF10,0x1F @@ -1963,9 +1963,9 @@ asm/non_matchings/code/z_scene/Scene_CommandEchoSetting.s,Scene_CommandEchoSetti asm/non_matchings/code/z_scene/Scene_CommandAltHeaderList.s,Scene_CommandAltHeaderList,0x80130454,0x1E asm/non_matchings/code/z_scene/Scene_CommandCutsceneScriptList.s,Scene_CommandCutsceneScriptList,0x801304CC,0xD asm/non_matchings/code/z_scene/Scene_CommandCutsceneList.s,Scene_CommandCutsceneList,0x80130500,0x10 -asm/non_matchings/code/z_scene/Scene_CommandMiniMap.s,Scene_CommandMiniMap,0x80130540,0xE +asm/non_matchings/code/z_scene/Scene_CommandMapData.s,Scene_CommandMapData,0x80130540,0xE asm/non_matchings/code/z_scene/Scene_Command1D.s,Scene_Command1D,0x80130578,0x4 -asm/non_matchings/code/z_scene/Scene_CommandMiniMapCompassInfo.s,Scene_CommandMiniMapCompassInfo,0x80130588,0xA +asm/non_matchings/code/z_scene/Scene_CommandMapDataChests.s,Scene_CommandMapDataChests,0x80130588,0xA asm/non_matchings/code/z_scene/Scene_CommandSetRegionVisitedFlag.s,Scene_CommandSetRegionVisitedFlag,0x801305B0,0x31 asm/non_matchings/code/z_scene/Scene_CommandAnimatedMaterials.s,Scene_CommandAnimatedMaterials,0x80130674,0xC asm/non_matchings/code/z_scene/Scene_SetExitFade.s,Scene_SetExitFade,0x801306A4,0x11