diff --git a/include/z64map.h b/include/z64map.h index e91b53666..3b3d35004 100644 --- a/include/z64map.h +++ b/include/z64map.h @@ -26,8 +26,10 @@ mapCompactId #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) @@ -88,8 +90,8 @@ typedef struct { } PauseDungeonMap; // size = 0x188 /* z_map_disp */ -void func_80102EB4(u32 param_1); -void func_80102ED0(u32 param_1); +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); diff --git a/include/z64scene.h b/include/z64scene.h index f7709aa88..6562d3261 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -116,8 +116,6 @@ typedef struct { /* 0x4 */ void* segment; } SCmdTransitionActorList; // size = 0x8 -#define SCmdTransiActorList SCmdTransitionActorList - typedef struct { /* 0x0 */ u8 code; /* 0x1 */ u8 num; @@ -504,10 +502,13 @@ typedef struct { /* 0x2 */ s16 centerX; /* 0x4 */ s16 floorY; /* 0x6 */ s16 centerZ; - /* 0x8 */ u16 flags; // 1 = mirror x, 2 = mirror y + /* 0x8 */ u16 flags; } MapDataRoom; // size = 0xA -#define MAP_DATA_ROOM_GET_EXTRA_STOREYS(e) ((((e)->flags) >> 2) & 7) +#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 */ MapDataRoom* rooms; @@ -523,11 +524,12 @@ typedef struct { } MapDataChest; // size = 0xA // TODO: ZAPD updates -#define SCmdMinimapSettings SCmdMapData -#define SCmdMinimapChests SCmdMapDataChests -#define MinimapEntry MapDataRoom -#define MinimapList MapDataScene -#define MinimapChest MapDataChest +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 { @@ -810,9 +812,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; @@ -905,15 +907,17 @@ 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) } // TODO: ZAPD Capatability #define SCENE_CMD_MISC_SETTINGS SCENE_CMD_SET_REGION_VISITED #define SCENE_CMD_CUTSCENE_LIST SCENE_CMD_CUTSCENE_SCRIPT_LIST +#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); @@ -949,9 +953,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/src/code/z_map_data.c b/src/code/z_map_data.c index 3d09648ce..571613a0d 100644 --- a/src/code/z_map_data.c +++ b/src/code/z_map_data.c @@ -30,11 +30,11 @@ static Color_RGBA8 sMapColorTable[] = { }; 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 }, + { 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] = { @@ -230,8 +230,6 @@ static s32 sMapIForMapGrand[98] = { MAPDATA_MAP_I_MAX, }; -s32 MapDisp_GetSizeOfMapITex(s32 mapCompactId); - void MapData_GetMapColor(s32 colorIndex, Color_RGBA8* color) { *color = sMapColorTable[colorIndex]; } diff --git a/src/code/z_map_disp.c b/src/code/z_map_disp.c index 423252675..8d6694295 100644 --- a/src/code/z_map_disp.c +++ b/src/code/z_map_disp.c @@ -73,10 +73,9 @@ 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, }; -extern s16 D_801BEBFA; // sMapDisp.pauseMapCurStorey -static MapDataRoom sMapDataRooms[ROOM_MAX]; -static MapDataChest sMapDataChests[32]; +MapDataRoom sMapDataRooms[ROOM_MAX]; +MapDataChest sMapDataChests[32]; static MapDataScene sMapDataScene = { sMapDataRooms, 80, @@ -84,14 +83,14 @@ static MapDataScene sMapDataScene = { static s32 sSceneNumRooms = 0; // current scene's no. of rooms static s32 sNumChests = 0; // MinimapChest count static TransitionActorList sTransitionActorList = { 0, NULL }; -static Color_RGBA8 sMinimapActorColors[12] = { +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 }, -}; // cat colors +}; -static TransitionActorEntry sTransitionActors[ROOM_TRANSITION_MAX]; -static PauseDungeonMap sPauseDungeonMap; +TransitionActorEntry sTransitionActors[ROOM_TRANSITION_MAX]; +PauseDungeonMap sPauseDungeonMap; void MapDisp_GetMapITexture(void* dst, s32 mapCompactId) { if (MapDisp_GetSizeOfMapITex(mapCompactId) != 0) { @@ -106,12 +105,12 @@ void MapDisp_InitRoomStoreyRecord(PlayState* play, s16* roomStorey) { void MapDisp_DestroyRoomStoreyRecord(PlayState* play, s16* roomStory) { } -void func_80102EB4(u32 param_1) { - sMapDisp.unk20 |= param_1; +void func_80102EB4(u32 flag) { + sMapDisp.unk20 |= flag; } -void func_80102ED0(u32 param_1) { - sMapDisp.unk20 &= ~param_1; +void func_80102ED0(u32 flag) { + sMapDisp.unk20 &= ~flag; } s32 MapDisp_CurRoomHasMapI(PlayState* play) { @@ -126,7 +125,7 @@ s32 MapDisp_CurRoomHasMapI(PlayState* play) { return false; } mapDataRoom = &sMapDisp.mapDataScene->rooms[curRoom]; - if (mapDataRoom->mapId == 0xFFFF) { + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { return false; } if (MapData_GetMapIId(mapDataRoom->mapId) == MAPDATA_MAP_I_MAX) { @@ -171,19 +170,19 @@ void MapDisp_GetMapOffset(MapDataRoom* mapDataRoom, s32* offsetX, s32* offsetY) s32 width; s32 height; - if (mapDataRoom->mapId == 0xFFFF) { + 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 & 1) { + if (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_X) { s32 temp = (width / 2); *offsetX = ((width / 2) - *offsetX) + (width / 2); } - if (mapDataRoom->flags & 2) { + if (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_Y) { s32 temp = (height / 2); *offsetY = (temp - *offsetY) + temp; @@ -203,7 +202,7 @@ void MapDisp_DrawMinimapRoom(PlayState* play, TexturePtr texture, s32 x, s32 y, Color_RGBA8 color; s32 drawType; - if ((mapDataRoom->mapId == 0xFFFF) || (texture == NULL)) { + if ((mapDataRoom->mapId == MAP_DATA_NO_MAP) || (texture == NULL)) { return; } @@ -241,14 +240,14 @@ void MapDisp_DrawMinimapRoom(PlayState* play, TexturePtr texture, s32 x, s32 y, break; } - s = (mapDataRoom->flags & 1) ? (texWidth - 1) << 5 : 0; - t = (mapDataRoom->flags & 2) ? 0 : (texHeight - 1) << 5; + s = (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_X) ? (texWidth - 1) << 5 : 0; + t = (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_Y) ? 0 : (texHeight - 1) << 5; - dsdx_temp = ((mapDataRoom->flags & 1) ? -1 : 1) * (1 << 10); - dtdy_temp = ((mapDataRoom->flags & 2) ? 1 : -1) * (1 << 10); + 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); - dsdx = (mapDataRoom->flags & 1) ? dsdx_temp & 0xFFFF : dsdx_temp; - dtdy = (mapDataRoom->flags & 2) ? dtdy_temp : dtdy_temp & 0xFFFF; + 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; gSPTextureRectangle(OVERLAY_DISP++, x << 2, y << 2, (texWidth + x) << 2, (y + texHeight) << 2, G_TX_RENDERTILE, s, t, dsdx, dtdy); @@ -295,7 +294,7 @@ void MapDisp_Minimap_DrawActorIcon(PlayState* play, Actor* actor) { } mapDataRoom = &sMapDisp.mapDataScene->rooms[sMapDisp.curRoom]; - if (mapDataRoom->mapId == 0xFFFF) { + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { return; } @@ -369,9 +368,9 @@ void MapDisp_Minimap_DrawActorIcon(PlayState* play, Actor* actor) { 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, sMinimapActorColors[actor->category].r, - sMinimapActorColors[actor->category].g, sMinimapActorColors[actor->category].b, - play->interfaceCtx.minimapAlpha); + 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); } @@ -394,17 +393,14 @@ void MapDisp_Minimap_DrawActors(PlayState* play) { for (i = 0; i < ACTORCAT_MAX; i++) { Actor* actor = actorCtx->actorLists[i].first; - if (actor != NULL) { - do { - 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; - } while (actor != NULL); + 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; } } @@ -430,7 +426,7 @@ void MapDisp_Minimap_DrawDoorActor(PlayState* play, Actor* actor) { yDistAlpha = 0.0f; } mapDataRoom = &sMapDisp.mapDataScene->rooms[sMapDisp.curRoom]; - if (mapDataRoom->mapId != 0xFFFF) { + if (mapDataRoom->mapId != MAP_DATA_NO_MAP) { MapDisp_GetMapOffset(mapDataRoom, &texOffsetX, &texOffsetY); MapDisp_GetMapTexDim(mapDataRoom, &texWidth, &texHeight); @@ -473,9 +469,9 @@ void MapDisp_Minimap_DrawDoorActor(PlayState* play, Actor* actor) { s32 pad; gDPSetPrimColor( - OVERLAY_DISP++, 0, 0, sMinimapActorColors[actor->category].r, - sMinimapActorColors[actor->category].g, sMinimapActorColors[actor->category].b, - (s32)((sMinimapActorColors[actor->category].a * (1.0f - sMapDisp.swapAnimTimer * 0.05f) * + 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)); @@ -513,15 +509,13 @@ void MapDisp_Minimap_DrawDoorActors(PlayState* play) { 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; - if (actor != NULL) { - do { - 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; - } while (actor != NULL); + 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); @@ -619,7 +613,7 @@ void MapDisp_InitSceneFloorData(PlayState* play) { for (i2 = 0; i2 < sSceneNumRooms; i2++) { MapDataRoom* mapDataRoom = &sMapDisp.mapDataScene->rooms[i2]; - if (mapDataRoom->mapId == 0xFFFF) { + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { continue; } // add item to the table if it is a newish value @@ -848,14 +842,14 @@ void MapDisp_Destroy(PlayState* play) { } void MapDisp_Update(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; s16 currentX; s16 currentY; s16 targetX; s16 targetY; if ((sMapDisp.mapDataScene != NULL) && (sSceneNumRooms != 0)) { - //! FAKE: D_801BEBFA should be sMapDisp.pauseMapCurStorey - D_801BEBFA = DUNGEON_FLOOR_INDEX_0 - play->pauseCtx.cursorMapDungeonItem; + sMapDisp.pauseMapCurStorey = DUNGEON_FLOOR_INDEX_0 - pauseCtx->cursorMapDungeonItem; if (sMapDisp.prevRoom != -1) { if (sMapDisp.swapAnimTimer > 0) { targetX = sMapDisp.minimapBaseX; @@ -895,8 +889,9 @@ void MapDisp_SwapRooms(s16 nextRoom) { if ((sMapDisp.mapDataScene != NULL) && (sSceneNumRooms != 0) && (nextRoom != -1)) { nextMapDataRoom = &sMapDisp.mapDataScene->rooms[nextRoom]; - if ((nextMapDataRoom->mapId < 5) || ((nextMapDataRoom->mapId >= 0x100) && (nextMapDataRoom->mapId < 0x162)) || - nextMapDataRoom->mapId == 0xFFFF) { + 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; @@ -908,7 +903,7 @@ void MapDisp_SwapRooms(s16 nextRoom) { nextMapDataRoom = &sMapDisp.mapDataScene->rooms[sMapDisp.curRoom]; - if (nextMapDataRoom->mapId == 0xFFFF) { + if (nextMapDataRoom->mapId == MAP_DATA_NO_MAP) { sMapDisp.minimapPrevY = 0; sMapDisp.minimapBaseX = 210; sMapDisp.minimapBaseY = 140; @@ -924,7 +919,7 @@ void MapDisp_SwapRooms(s16 nextRoom) { sMapDisp.minimapBaseY = 220 - height; if (sMapDisp.prevRoom != -1) { prevMapDataRoom = &sMapDisp.mapDataScene->rooms[sMapDisp.prevRoom]; - if (prevMapDataRoom->mapId == 0xFFFF) { + if (prevMapDataRoom->mapId == MAP_DATA_NO_MAP) { sMapDisp.minimapCurTex = NULL; sMapDisp.minimapPrevX = sMapDisp.minimapPrevY = 0; sMapDisp.minimapCurX = sMapDisp.minimapBaseX; @@ -976,7 +971,8 @@ void MapDisp_SwapRooms(s16 nextRoom) { sMapDisp.minimapCurTex = sMapDisp.texBuff0; } if (MapData_GetSizeOfMapGrandTex(nextMapDataRoom->mapId) != 0) { - CmpDma_LoadFile(SEGMENT_ROM_START(map_grand_static), nextMapDataRoom->mapId - 0x100, + 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; @@ -1000,7 +996,7 @@ void MapDisp_Minimap_DrawRedCompassIcon(PlayState* play, s32 x, s32 z, s32 rot) f32 scaleFrac; mapDataRoom = &sMapDisp.mapDataScene->rooms[sMapDisp.curRoom]; - if (mapDataRoom->mapId == 0xFFFF) { + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { return; } @@ -1087,7 +1083,7 @@ s32 MapDisp_IsMinimapToggleBlocked(PlayState* play) { s32 MapDisp_AreRoomsSameStorey(s32 curRoom, s32 prevRoom) { MapDataRoom* mapDataRoom; - s16* roomStoreyList; // Can be removed, but adds readability + s16* roomStoreyList; if ((curRoom == -1) || (prevRoom == -1)) { return false; @@ -1174,7 +1170,7 @@ void* MapDisp_AllocDungeonMap(PlayState* play, void* heap) { MapDataRoom* mapDataRoom = &sMapDisp.mapDataScene->rooms[sceneRoomIter]; s32 isDuplicateTexture = false; - if (mapDataRoom->mapId == 0xFFFF) { + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { continue; } mapCompactId = MapData_GetMapCompactId(mapDataRoom->mapId); @@ -1215,7 +1211,7 @@ void* MapDisp_AllocDungeonMap(PlayState* play, void* heap) { s32 foundTexture = false; s32 mapCompactId; - if (mapDataRoom->mapId == 0xFFFF) { + if (mapDataRoom->mapId == MAP_DATA_NO_MAP) { sPauseDungeonMap.roomSprite[sceneRoomIter] = NULL; } else { mapCompactId = MapData_GetMapCompactId(mapDataRoom->mapId); @@ -1340,7 +1336,7 @@ void MapDisp_DrawRooms(PlayState* play, s32 viewX, s32 viewY, s32 viewWidth, s32 s32 two = 2; mapDataRoom = &sMapDisp.mapDataScene->rooms[i]; - if ((mapDataRoom->mapId == 0xFFFF) || (mapDataRoom->mapId >= 0x162)) { + if ((mapDataRoom->mapId == MAP_DATA_NO_MAP) || (mapDataRoom->mapId >= MAPDATA_MAP_GRAND_MAX)) { continue; } @@ -1363,7 +1359,7 @@ void MapDisp_DrawRooms(PlayState* play, s32 viewX, s32 viewY, s32 viewWidth, s32 MapData_CPID_GetTexDim(spE8, &texWidth, &texHeight); MapData_CPID_GetTexOffset(spE8, &offsetX, &offsetY); - if (mapDataRoom->flags & 1) { + if (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_X) { offsetX = ((texWidth / 2) - offsetX) + (texWidth / 2); s = (texWidth - 1) << 5; dsdx = 0xFC00; @@ -1372,7 +1368,7 @@ void MapDisp_DrawRooms(PlayState* play, s32 viewX, s32 viewY, s32 viewWidth, s32 dsdx = 0x400; } - if (mapDataRoom->flags & 2) { + if (mapDataRoom->flags & MAP_DATA_ROOM_FLIP_Y) { s32 requiredScopeTemp; offsetY = ((texHeight / 2) - offsetY) + (texHeight / 2); @@ -1833,7 +1829,7 @@ void MapDisp_DrawDungeonMap(PlayState* play) { } mapDataRoom = sMapDisp.mapDataScene->rooms; - if ((mapDataRoom->mapId == 0xFFFF) || (mapDataRoom->mapId >= 0x162)) { + if ((mapDataRoom->mapId == MAP_DATA_NO_MAP) || (mapDataRoom->mapId >= MAPDATA_MAP_GRAND_MAX)) { return; } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 074a4891a..bb284aede 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -495,7 +495,7 @@ void Scene_CommandCutsceneList(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x1C: Map Data -void Scene_CommandMiniMap(PlayState* play, SceneCmd* cmd) { +void Scene_CommandMapData(PlayState* play, SceneCmd* cmd) { MapDisp_Init(play); MapDisp_InitMapData(play, cmd->mapData.segment); } @@ -505,7 +505,7 @@ void Scene_Command1D(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x1E: Map Data Chests -void Scene_CommandMiniMapCompassInfo(PlayState* play, SceneCmd* cmd) { +void Scene_CommandMapDataChests(PlayState* play, SceneCmd* cmd) { MapDisp_InitChestData(play, cmd->mapDataChests.num, cmd->mapDataChests.segment); } @@ -578,9 +578,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/tools/disasm/functions.txt b/tools/disasm/functions.txt index 7cfeca2dc..8eecd7f07 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -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 f9a855b5a..c13eedca6 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -993,10 +993,7 @@ 0x801BEB10:("D_801BEB10","u32","[4]",0x10), 0x801BEB20:("D_801BEB20","u32","[4]",0x10), 0x801BEB38:("sWhiteSquareTex","UNK_TYPE1","",0x1), - 0x801BEBB8:("sMapDisp","UNK_TYPE4","",0x40), - 0x801BEBF8:("D_801BEBF8","UNK_TYPE2","",0x2), - 0x801BEBFA:("D_801BEBFA","UNK_TYPE2","",0x2), - 0x801BEBFC:("D_801BEBFC","UNK_TYPE2","",0x18), + 0x801BEBB8:("sMapDisp","MapDisp","",0x5C), 0x801BEC14:("sMapDataScene","MinimapList","",0x8), 0x801BEC1C:("sSceneNumRooms","s32","",0x4), 0x801BEC20:("sNumChests","s32","",0x4), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 8bcd16927..462c3611b 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -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 diff --git a/undefined_syms.txt b/undefined_syms.txt index 47434ee04..5741567fc 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -629,8 +629,4 @@ D_0E0002C8 = 0x0E0002C8; // segment 0x0F -D_0F000000 = 0x0F000000; - -// z_map_disp -// fake symbol -D_801BEBFA = 0x801BEBFA; \ No newline at end of file +D_0F000000 = 0x0F000000; \ No newline at end of file