2020-10-03 17:22:44 +02:00
|
|
|
|
#include "global.h"
|
2022-11-02 00:17:11 +01:00
|
|
|
|
#include "terminal.h"
|
2022-06-06 21:37:25 +02:00
|
|
|
|
#include "assets/objects/gameplay_keep/gameplay_keep.h"
|
|
|
|
|
#include "assets/textures/parameter_static/parameter_static.h"
|
2024-09-07 01:43:23 -07:00
|
|
|
|
#if PLATFORM_N64
|
|
|
|
|
#include "n64dd.h"
|
|
|
|
|
#endif
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2020-05-01 17:09:20 +02:00
|
|
|
|
MapData* gMapData;
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s16 sPlayerInitialPosX = 0;
|
|
|
|
|
s16 sPlayerInitialPosZ = 0;
|
|
|
|
|
s16 sPlayerInitialDirection = 0;
|
|
|
|
|
s16 sEntranceIconMapIndex = 0;
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
void Map_SavePlayerInitialInfo(PlayState* play) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2021-01-18 16:04:04 -05:00
|
|
|
|
sPlayerInitialPosX = player->actor.world.pos.x;
|
|
|
|
|
sPlayerInitialPosZ = player->actor.world.pos.z;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
sPlayerInitialDirection = (s16)((0x7FFF - player->actor.shape.rot.y) / 0x400);
|
|
|
|
|
}
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
void Map_SetPaletteData(PlayState* play, s16 room) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s32 mapIndex = gSaveContext.mapIndex;
|
2022-05-21 14:23:43 -04:00
|
|
|
|
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
2021-05-03 01:15:16 +02:00
|
|
|
|
s16 paletteIndex = gMapData->roomPalette[mapIndex][room];
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2020-05-01 17:09:20 +02:00
|
|
|
|
if (interfaceCtx->mapRoomNum == room) {
|
2021-05-03 01:15:16 +02:00
|
|
|
|
interfaceCtx->mapPaletteIndex = paletteIndex;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF(VT_FGCOL(YELLOW));
|
2024-08-24 17:47:45 +02:00
|
|
|
|
PRINTF(T("PALETEセット 【 i=%x : room=%x 】Room_Inf[%d][4]=%x ( map_palete_no = %d )\n",
|
|
|
|
|
"PALETE Set 【 i=%x : room=%x 】Room_Inf[%d][4]=%x ( map_palete_no = %d )\n"),
|
|
|
|
|
paletteIndex, room, mapIndex, gSaveContext.save.info.sceneFlags[mapIndex].rooms,
|
|
|
|
|
interfaceCtx->mapPaletteIndex);
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF(VT_RST);
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2021-05-03 01:15:16 +02:00
|
|
|
|
interfaceCtx->mapPalette[paletteIndex * 2] = 2;
|
|
|
|
|
interfaceCtx->mapPalette[paletteIndex * 2 + 1] = 0xBF;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
void Map_SetFloorPalettesData(PlayState* play, s16 floor) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s32 mapIndex = gSaveContext.mapIndex;
|
2022-05-21 14:23:43 -04:00
|
|
|
|
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s16 room;
|
|
|
|
|
s16 i;
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2020-05-01 17:09:20 +02:00
|
|
|
|
for (i = 0; i < 16; i++) {
|
2021-05-03 01:15:16 +02:00
|
|
|
|
interfaceCtx->mapPalette[i] = 0;
|
|
|
|
|
interfaceCtx->mapPalette[i + 16] = 0;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
2020-12-03 21:55:01 +00:00
|
|
|
|
if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, mapIndex)) {
|
2021-05-03 01:15:16 +02:00
|
|
|
|
interfaceCtx->mapPalette[30] = 0;
|
|
|
|
|
interfaceCtx->mapPalette[31] = 1;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-07-31 16:44:47 -07:00
|
|
|
|
switch (play->sceneId) {
|
2022-11-26 22:15:41 +01:00
|
|
|
|
case SCENE_DEKU_TREE:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN:
|
|
|
|
|
case SCENE_JABU_JABU:
|
|
|
|
|
case SCENE_FOREST_TEMPLE:
|
|
|
|
|
case SCENE_FIRE_TEMPLE:
|
|
|
|
|
case SCENE_WATER_TEMPLE:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE:
|
|
|
|
|
case SCENE_BOTTOM_OF_THE_WELL:
|
|
|
|
|
case SCENE_ICE_CAVERN:
|
|
|
|
|
case SCENE_DEKU_TREE_BOSS:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN_BOSS:
|
|
|
|
|
case SCENE_JABU_JABU_BOSS:
|
|
|
|
|
case SCENE_FOREST_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_FIRE_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_WATER_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE_BOSS:
|
2020-05-01 17:09:20 +02:00
|
|
|
|
for (i = 0; i < gMapData->maxPaletteCount[mapIndex]; i++) {
|
|
|
|
|
room = gMapData->paletteRoom[mapIndex][floor][i];
|
2023-08-13 21:24:26 +02:00
|
|
|
|
if ((room != 0xFF) && (gSaveContext.save.info.sceneFlags[mapIndex].rooms & gBitFlags[room])) {
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Map_SetPaletteData(play, room);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
void Map_InitData(PlayState* play, s16 room) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s32 mapIndex = gSaveContext.mapIndex;
|
2022-05-21 14:23:43 -04:00
|
|
|
|
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s16 extendedMapIndex;
|
|
|
|
|
|
2022-07-31 16:44:47 -07:00
|
|
|
|
switch (play->sceneId) {
|
2022-11-26 22:15:41 +01:00
|
|
|
|
case SCENE_HYRULE_FIELD:
|
|
|
|
|
case SCENE_KAKARIKO_VILLAGE:
|
|
|
|
|
case SCENE_GRAVEYARD:
|
|
|
|
|
case SCENE_ZORAS_RIVER:
|
|
|
|
|
case SCENE_KOKIRI_FOREST:
|
|
|
|
|
case SCENE_SACRED_FOREST_MEADOW:
|
|
|
|
|
case SCENE_LAKE_HYLIA:
|
|
|
|
|
case SCENE_ZORAS_DOMAIN:
|
|
|
|
|
case SCENE_ZORAS_FOUNTAIN:
|
|
|
|
|
case SCENE_GERUDO_VALLEY:
|
|
|
|
|
case SCENE_LOST_WOODS:
|
|
|
|
|
case SCENE_DESERT_COLOSSUS:
|
|
|
|
|
case SCENE_GERUDOS_FORTRESS:
|
|
|
|
|
case SCENE_HAUNTED_WASTELAND:
|
|
|
|
|
case SCENE_HYRULE_CASTLE:
|
|
|
|
|
case SCENE_DEATH_MOUNTAIN_TRAIL:
|
|
|
|
|
case SCENE_DEATH_MOUNTAIN_CRATER:
|
|
|
|
|
case SCENE_GORON_CITY:
|
|
|
|
|
case SCENE_LON_LON_RANCH:
|
|
|
|
|
case SCENE_OUTSIDE_GANONS_CASTLE:
|
2020-05-01 17:09:20 +02:00
|
|
|
|
extendedMapIndex = mapIndex;
|
2022-11-26 22:15:41 +01:00
|
|
|
|
if (play->sceneId == SCENE_GRAVEYARD) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
if (CHECK_QUEST_ITEM(QUEST_SONG_NOCTURNE)) {
|
|
|
|
|
extendedMapIndex = 0x14;
|
|
|
|
|
}
|
2022-11-26 22:15:41 +01:00
|
|
|
|
} else if (play->sceneId == SCENE_LAKE_HYLIA) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !CHECK_QUEST_ITEM(QUEST_MEDALLION_WATER)) {
|
|
|
|
|
extendedMapIndex = 0x15;
|
|
|
|
|
}
|
2022-11-26 22:15:41 +01:00
|
|
|
|
} else if (play->sceneId == SCENE_GERUDO_VALLEY) {
|
2022-05-20 19:54:47 +02:00
|
|
|
|
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
extendedMapIndex = 0x16;
|
|
|
|
|
}
|
2022-11-26 22:15:41 +01:00
|
|
|
|
} else if (play->sceneId == SCENE_GERUDOS_FORTRESS) {
|
2022-05-20 19:54:47 +02:00
|
|
|
|
if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
extendedMapIndex = 0x17;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF(VT_FGCOL(BLUE));
|
|
|
|
|
PRINTF("KKK=%d\n", extendedMapIndex);
|
|
|
|
|
PRINTF(VT_RST);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
sEntranceIconMapIndex = extendedMapIndex;
|
2024-01-09 04:59:03 -08:00
|
|
|
|
DMA_REQUEST_SYNC(interfaceCtx->mapSegment,
|
|
|
|
|
(uintptr_t)_map_grand_staticSegmentRomStart +
|
|
|
|
|
gMapData->owMinimapTexOffset[extendedMapIndex],
|
|
|
|
|
gMapData->owMinimapTexSize[mapIndex], "../z_map_exp.c", 309);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
interfaceCtx->unk_258 = mapIndex;
|
|
|
|
|
break;
|
2022-11-26 22:15:41 +01:00
|
|
|
|
case SCENE_DEKU_TREE:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN:
|
|
|
|
|
case SCENE_JABU_JABU:
|
|
|
|
|
case SCENE_FOREST_TEMPLE:
|
|
|
|
|
case SCENE_FIRE_TEMPLE:
|
|
|
|
|
case SCENE_WATER_TEMPLE:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE:
|
|
|
|
|
case SCENE_BOTTOM_OF_THE_WELL:
|
|
|
|
|
case SCENE_ICE_CAVERN:
|
|
|
|
|
case SCENE_DEKU_TREE_BOSS:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN_BOSS:
|
|
|
|
|
case SCENE_JABU_JABU_BOSS:
|
|
|
|
|
case SCENE_FOREST_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_FIRE_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_WATER_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE_BOSS:
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF(VT_FGCOL(YELLOW));
|
2024-08-24 17:47:45 +02:00
|
|
|
|
PRINTF(T("デクの樹ダンジョンMAP テクスチャDMA(%x) scene_id_offset=%d VREG(30)=%d\n",
|
|
|
|
|
"Deku Tree Dungeon MAP Texture DMA(%x) scene_id_offset=%d VREG(30)=%d\n"),
|
|
|
|
|
room, mapIndex, VREG(30));
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF(VT_RST);
|
2024-09-07 01:43:23 -07:00
|
|
|
|
|
|
|
|
|
#if PLATFORM_N64
|
|
|
|
|
if ((B_80121220 != NULL) && (B_80121220->unk_28 != NULL) && B_80121220->unk_28(play)) {
|
|
|
|
|
} else {
|
|
|
|
|
DmaMgr_RequestSync(play->interfaceCtx.mapSegment,
|
|
|
|
|
(uintptr_t)_map_i_staticSegmentRomStart +
|
|
|
|
|
((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * MAP_I_TEX_SIZE),
|
|
|
|
|
MAP_I_TEX_SIZE);
|
|
|
|
|
}
|
|
|
|
|
#else
|
2024-01-09 04:59:03 -08:00
|
|
|
|
DMA_REQUEST_SYNC(play->interfaceCtx.mapSegment,
|
|
|
|
|
(uintptr_t)_map_i_staticSegmentRomStart +
|
|
|
|
|
((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * MAP_I_TEX_SIZE),
|
|
|
|
|
MAP_I_TEX_SIZE, "../z_map_exp.c", 346);
|
2024-09-07 01:43:23 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
2020-05-01 17:09:20 +02:00
|
|
|
|
R_COMPASS_OFFSET_X = gMapData->roomCompassOffsetX[mapIndex][room];
|
|
|
|
|
R_COMPASS_OFFSET_Y = gMapData->roomCompassOffsetY[mapIndex][room];
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Map_SetFloorPalettesData(play, VREG(30));
|
2024-08-24 17:47:45 +02:00
|
|
|
|
PRINTF(T("MAP 各階ONチェック\n", "MAP Individual Floor ON Check\n"));
|
2020-05-01 17:09:20 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
void Map_InitRoomData(PlayState* play, s16 room) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s32 mapIndex = gSaveContext.mapIndex;
|
2022-05-21 14:23:43 -04:00
|
|
|
|
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF("*******\n*******\nroom_no=%d (%d)(%d)\n*******\n*******\n", room, mapIndex,
|
|
|
|
|
play->sceneId);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
|
|
|
|
if (room >= 0) {
|
2022-07-31 16:44:47 -07:00
|
|
|
|
switch (play->sceneId) {
|
2022-11-26 22:15:41 +01:00
|
|
|
|
case SCENE_DEKU_TREE:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN:
|
|
|
|
|
case SCENE_JABU_JABU:
|
|
|
|
|
case SCENE_FOREST_TEMPLE:
|
|
|
|
|
case SCENE_FIRE_TEMPLE:
|
|
|
|
|
case SCENE_WATER_TEMPLE:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE:
|
|
|
|
|
case SCENE_BOTTOM_OF_THE_WELL:
|
|
|
|
|
case SCENE_ICE_CAVERN:
|
|
|
|
|
case SCENE_DEKU_TREE_BOSS:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN_BOSS:
|
|
|
|
|
case SCENE_JABU_JABU_BOSS:
|
|
|
|
|
case SCENE_FOREST_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_FIRE_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_WATER_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE_BOSS:
|
2023-08-13 21:24:26 +02:00
|
|
|
|
gSaveContext.save.info.sceneFlags[mapIndex].rooms |= gBitFlags[room];
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF("ROOM_INF=%d\n", gSaveContext.save.info.sceneFlags[mapIndex].rooms);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
interfaceCtx->mapRoomNum = room;
|
|
|
|
|
interfaceCtx->unk_25A = mapIndex;
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Map_SetPaletteData(play, room);
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF(VT_FGCOL(YELLOW));
|
2024-08-24 17:47:45 +02:00
|
|
|
|
PRINTF(T("部屋部屋=%d\n", "Room Room = %d\n"), room);
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF(VT_RST);
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Map_InitData(play, room);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
interfaceCtx->mapRoomNum = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-20 11:51:35 -05:00
|
|
|
|
if (gSaveContext.sunsSongState != SUNSSONG_SPEED_TIME) {
|
|
|
|
|
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
void Map_Destroy(PlayState* play) {
|
|
|
|
|
MapMark_ClearPointers(play);
|
2024-09-07 01:43:23 -07:00
|
|
|
|
|
|
|
|
|
#if PLATFORM_N64
|
|
|
|
|
if ((B_80121220 != NULL) && (B_80121220->unk_24 != NULL)) {
|
|
|
|
|
B_80121220->unk_24();
|
|
|
|
|
}
|
|
|
|
|
if ((B_80121220 != NULL) && (B_80121220->unk_1C != NULL)) {
|
|
|
|
|
B_80121220->unk_1C(&gMapData);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-05-01 17:09:20 +02:00
|
|
|
|
gMapData = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
void Map_Init(PlayState* play) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s32 mapIndex = gSaveContext.mapIndex;
|
2022-05-21 14:23:43 -04:00
|
|
|
|
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
|
|
|
|
gMapData = &gMapDataTable;
|
|
|
|
|
|
2024-09-07 01:43:23 -07:00
|
|
|
|
#if PLATFORM_N64
|
|
|
|
|
if ((B_80121220 != NULL) && (B_80121220->unk_18 != NULL)) {
|
|
|
|
|
B_80121220->unk_18(&gMapData);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-05-01 17:09:20 +02:00
|
|
|
|
interfaceCtx->unk_258 = -1;
|
|
|
|
|
interfaceCtx->unk_25A = -1;
|
|
|
|
|
|
2024-01-09 04:59:03 -08:00
|
|
|
|
interfaceCtx->mapSegment = GAME_STATE_ALLOC(&play->state, 0x1000, "../z_map_exp.c", 457);
|
2024-08-24 17:47:45 +02:00
|
|
|
|
PRINTF(T("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n",
|
|
|
|
|
"\n\n\nMAP texture initialization scene_data_ID=%d\nmapSegment=%x\n\n"),
|
|
|
|
|
play->sceneId, interfaceCtx->mapSegment);
|
2021-04-29 14:39:46 -04:00
|
|
|
|
ASSERT(interfaceCtx->mapSegment != NULL, "parameter->mapSegment != NULL", "../z_map_exp.c", 459);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2022-07-31 16:44:47 -07:00
|
|
|
|
switch (play->sceneId) {
|
2022-11-26 22:15:41 +01:00
|
|
|
|
case SCENE_HYRULE_FIELD:
|
|
|
|
|
case SCENE_KAKARIKO_VILLAGE:
|
|
|
|
|
case SCENE_GRAVEYARD:
|
|
|
|
|
case SCENE_ZORAS_RIVER:
|
|
|
|
|
case SCENE_KOKIRI_FOREST:
|
|
|
|
|
case SCENE_SACRED_FOREST_MEADOW:
|
|
|
|
|
case SCENE_LAKE_HYLIA:
|
|
|
|
|
case SCENE_ZORAS_DOMAIN:
|
|
|
|
|
case SCENE_ZORAS_FOUNTAIN:
|
|
|
|
|
case SCENE_GERUDO_VALLEY:
|
|
|
|
|
case SCENE_LOST_WOODS:
|
|
|
|
|
case SCENE_DESERT_COLOSSUS:
|
|
|
|
|
case SCENE_GERUDOS_FORTRESS:
|
|
|
|
|
case SCENE_HAUNTED_WASTELAND:
|
|
|
|
|
case SCENE_HYRULE_CASTLE:
|
|
|
|
|
case SCENE_DEATH_MOUNTAIN_TRAIL:
|
|
|
|
|
case SCENE_DEATH_MOUNTAIN_CRATER:
|
|
|
|
|
case SCENE_GORON_CITY:
|
|
|
|
|
case SCENE_LON_LON_RANCH:
|
|
|
|
|
case SCENE_OUTSIDE_GANONS_CASTLE:
|
|
|
|
|
mapIndex = play->sceneId - SCENE_HYRULE_FIELD;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
R_MAP_INDEX = gSaveContext.mapIndex = mapIndex;
|
|
|
|
|
R_COMPASS_SCALE_X = gMapData->owCompassInfo[mapIndex][0];
|
|
|
|
|
R_COMPASS_SCALE_Y = gMapData->owCompassInfo[mapIndex][1];
|
|
|
|
|
R_COMPASS_OFFSET_X = gMapData->owCompassInfo[mapIndex][2];
|
|
|
|
|
R_COMPASS_OFFSET_Y = gMapData->owCompassInfo[mapIndex][3];
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Map_InitData(play, mapIndex);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
R_OW_MINIMAP_X = gMapData->owMinimapPosX[mapIndex];
|
|
|
|
|
R_OW_MINIMAP_Y = gMapData->owMinimapPosY[mapIndex];
|
|
|
|
|
break;
|
2022-11-26 22:15:41 +01:00
|
|
|
|
case SCENE_DEKU_TREE:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN:
|
|
|
|
|
case SCENE_JABU_JABU:
|
|
|
|
|
case SCENE_FOREST_TEMPLE:
|
|
|
|
|
case SCENE_FIRE_TEMPLE:
|
|
|
|
|
case SCENE_WATER_TEMPLE:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE:
|
|
|
|
|
case SCENE_BOTTOM_OF_THE_WELL:
|
|
|
|
|
case SCENE_ICE_CAVERN:
|
|
|
|
|
case SCENE_GANONS_TOWER:
|
|
|
|
|
case SCENE_GERUDO_TRAINING_GROUND:
|
|
|
|
|
case SCENE_THIEVES_HIDEOUT:
|
|
|
|
|
case SCENE_INSIDE_GANONS_CASTLE:
|
|
|
|
|
case SCENE_GANONS_TOWER_COLLAPSE_INTERIOR:
|
|
|
|
|
case SCENE_INSIDE_GANONS_CASTLE_COLLAPSE:
|
|
|
|
|
case SCENE_TREASURE_BOX_SHOP:
|
|
|
|
|
case SCENE_DEKU_TREE_BOSS:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN_BOSS:
|
|
|
|
|
case SCENE_JABU_JABU_BOSS:
|
|
|
|
|
case SCENE_FOREST_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_FIRE_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_WATER_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE_BOSS:
|
|
|
|
|
mapIndex = (play->sceneId >= SCENE_DEKU_TREE_BOSS) ? play->sceneId - SCENE_DEKU_TREE_BOSS : play->sceneId;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
R_MAP_INDEX = gSaveContext.mapIndex = mapIndex;
|
2022-11-26 22:15:41 +01:00
|
|
|
|
if ((play->sceneId <= SCENE_ICE_CAVERN) || (play->sceneId >= SCENE_DEKU_TREE_BOSS)) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
R_COMPASS_SCALE_X = gMapData->dgnCompassInfo[mapIndex][0];
|
|
|
|
|
R_COMPASS_SCALE_Y = gMapData->dgnCompassInfo[mapIndex][1];
|
|
|
|
|
R_COMPASS_OFFSET_X = gMapData->dgnCompassInfo[mapIndex][2];
|
|
|
|
|
R_COMPASS_OFFSET_Y = gMapData->dgnCompassInfo[mapIndex][3];
|
2022-05-10 21:51:38 +02:00
|
|
|
|
R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE = gMapData->dgnTexIndexBase[mapIndex];
|
2024-09-07 01:43:23 -07:00
|
|
|
|
#if PLATFORM_N64
|
|
|
|
|
if ((B_80121220 != NULL) && (B_80121220->unk_20 != NULL)) {
|
|
|
|
|
B_80121220->unk_20(gMapData);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Map_InitRoomData(play, play->roomCtx.curRoom.num);
|
|
|
|
|
MapMark_Init(play);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
void Minimap_DrawCompassIcons(PlayState* play) {
|
2020-08-30 18:51:46 +02:00
|
|
|
|
s32 pad;
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-08-30 18:51:46 +02:00
|
|
|
|
s16 tempX, tempZ;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_map_exp.c", 565);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
if (play->interfaceCtx.minimapAlpha >= 0xAA) {
|
2022-06-03 15:25:48 -07:00
|
|
|
|
Gfx_SetupDL_42Overlay(play->state.gfxCtx);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2020-10-29 17:31:09 -04:00
|
|
|
|
gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
|
|
|
|
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
|
2020-05-01 17:09:20 +02:00
|
|
|
|
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
2020-10-29 17:31:09 -04:00
|
|
|
|
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
|
|
|
|
|
gDPSetCombineMode(OVERLAY_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2021-01-18 16:04:04 -05:00
|
|
|
|
tempX = player->actor.world.pos.x;
|
|
|
|
|
tempZ = player->actor.world.pos.z;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
tempX /= R_COMPASS_SCALE_X;
|
|
|
|
|
tempZ /= R_COMPASS_SCALE_Y;
|
|
|
|
|
Matrix_Translate((R_COMPASS_OFFSET_X + tempX) / 10.0f, (R_COMPASS_OFFSET_Y - tempZ) / 10.0f, 0.0f, MTXMODE_NEW);
|
|
|
|
|
Matrix_Scale(0.4f, 0.4f, 0.4f, MTXMODE_APPLY);
|
|
|
|
|
Matrix_RotateX(-1.6f, MTXMODE_APPLY);
|
2020-08-30 18:51:46 +02:00
|
|
|
|
tempX = (0x7FFF - player->actor.shape.rot.y) / 0x400;
|
|
|
|
|
Matrix_RotateY(tempX / 10.0f, MTXMODE_APPLY);
|
2024-01-09 04:59:03 -08:00
|
|
|
|
gSPMatrix(OVERLAY_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_map_exp.c", 585),
|
2020-05-01 17:09:20 +02:00
|
|
|
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
|
|
|
|
|
2020-10-29 17:31:09 -04:00
|
|
|
|
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 0, 255);
|
2021-01-24 18:36:40 -06:00
|
|
|
|
gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
|
|
|
|
tempX = sPlayerInitialPosX;
|
|
|
|
|
tempZ = sPlayerInitialPosZ;
|
|
|
|
|
tempX /= R_COMPASS_SCALE_X;
|
|
|
|
|
tempZ /= R_COMPASS_SCALE_Y;
|
|
|
|
|
Matrix_Translate((R_COMPASS_OFFSET_X + tempX) / 10.0f, (R_COMPASS_OFFSET_Y - tempZ) / 10.0f, 0.0f, MTXMODE_NEW);
|
|
|
|
|
Matrix_Scale(VREG(9) / 100.0f, VREG(9) / 100.0f, VREG(9) / 100.0f, MTXMODE_APPLY);
|
|
|
|
|
Matrix_RotateX(VREG(52) / 10.0f, MTXMODE_APPLY);
|
|
|
|
|
Matrix_RotateY(sPlayerInitialDirection / 10.0f, MTXMODE_APPLY);
|
2024-01-09 04:59:03 -08:00
|
|
|
|
gSPMatrix(OVERLAY_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_map_exp.c", 603),
|
2020-05-01 17:09:20 +02:00
|
|
|
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
|
|
|
|
|
2020-10-29 17:31:09 -04:00
|
|
|
|
gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, 200, 0, 0, 255);
|
2021-01-24 18:36:40 -06:00
|
|
|
|
gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_map_exp.c", 607);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
void Minimap_Draw(PlayState* play) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s32 pad[2];
|
2022-05-21 14:23:43 -04:00
|
|
|
|
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s32 mapIndex = gSaveContext.mapIndex;
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_map_exp.c", 626);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2023-09-06 17:14:15 +02:00
|
|
|
|
if (play->pauseCtx.state <= PAUSE_STATE_INIT) {
|
2022-07-31 16:44:47 -07:00
|
|
|
|
switch (play->sceneId) {
|
2022-11-26 22:15:41 +01:00
|
|
|
|
case SCENE_DEKU_TREE:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN:
|
|
|
|
|
case SCENE_JABU_JABU:
|
|
|
|
|
case SCENE_FOREST_TEMPLE:
|
|
|
|
|
case SCENE_FIRE_TEMPLE:
|
|
|
|
|
case SCENE_WATER_TEMPLE:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE:
|
|
|
|
|
case SCENE_BOTTOM_OF_THE_WELL:
|
|
|
|
|
case SCENE_ICE_CAVERN:
|
2021-06-15 12:29:10 -05:00
|
|
|
|
if (!R_MINIMAP_DISABLED) {
|
2022-06-03 15:25:48 -07:00
|
|
|
|
Gfx_SetupDL_39Overlay(play->state.gfxCtx);
|
2020-11-19 15:49:08 -06:00
|
|
|
|
gDPSetCombineLERP(OVERLAY_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0,
|
|
|
|
|
TEXEL0, 0, PRIMITIVE, 0);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2020-12-03 21:55:01 +00:00
|
|
|
|
if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, mapIndex)) {
|
2020-10-29 17:31:09 -04:00
|
|
|
|
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 255, 255, interfaceCtx->minimapAlpha);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2022-11-17 02:57:02 +00:00
|
|
|
|
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->mapSegment, G_IM_FMT_I, MAP_I_TEX_WIDTH,
|
|
|
|
|
MAP_I_TEX_HEIGHT, 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);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2020-10-29 17:31:09 -04:00
|
|
|
|
gSPTextureRectangle(OVERLAY_DISP++, R_DGN_MINIMAP_X << 2, R_DGN_MINIMAP_Y << 2,
|
2022-11-17 02:57:02 +00:00
|
|
|
|
(R_DGN_MINIMAP_X + MAP_I_TEX_WIDTH) << 2,
|
|
|
|
|
(R_DGN_MINIMAP_Y + MAP_I_TEX_HEIGHT) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10,
|
|
|
|
|
1 << 10);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-03 21:55:01 +00:00
|
|
|
|
if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, mapIndex)) {
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position
|
2022-06-03 15:25:48 -07:00
|
|
|
|
Gfx_SetupDL_39Overlay(play->state.gfxCtx);
|
2022-05-21 14:23:43 -04:00
|
|
|
|
MapMark_Draw(play);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_L) && !Play_InCsMode(play)) {
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF("Game_play_demo_mode_check=%d\n", Play_InCsMode(play));
|
2020-05-01 17:09:20 +02:00
|
|
|
|
// clang-format off
|
2022-07-30 07:05:27 -06:00
|
|
|
|
if (!R_MINIMAP_DISABLED) { Audio_PlaySfxGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4,
|
2022-04-29 21:06:08 +02:00
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultReverb);
|
|
|
|
|
} else {
|
2022-07-30 07:05:27 -06:00
|
|
|
|
Audio_PlaySfxGeneral(NA_SE_SY_CAMERA_ZOOM_DOWN, &gSfxDefaultPos, 4,
|
2022-04-29 21:06:08 +02:00
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultReverb);
|
|
|
|
|
}
|
2020-05-01 17:09:20 +02:00
|
|
|
|
// clang-format on
|
2021-06-15 12:29:10 -05:00
|
|
|
|
R_MINIMAP_DISABLED ^= 1;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
2022-11-26 22:15:41 +01:00
|
|
|
|
case SCENE_HYRULE_FIELD:
|
|
|
|
|
case SCENE_KAKARIKO_VILLAGE:
|
|
|
|
|
case SCENE_GRAVEYARD:
|
|
|
|
|
case SCENE_ZORAS_RIVER:
|
|
|
|
|
case SCENE_KOKIRI_FOREST:
|
|
|
|
|
case SCENE_SACRED_FOREST_MEADOW:
|
|
|
|
|
case SCENE_LAKE_HYLIA:
|
|
|
|
|
case SCENE_ZORAS_DOMAIN:
|
|
|
|
|
case SCENE_ZORAS_FOUNTAIN:
|
|
|
|
|
case SCENE_GERUDO_VALLEY:
|
|
|
|
|
case SCENE_LOST_WOODS:
|
|
|
|
|
case SCENE_DESERT_COLOSSUS:
|
|
|
|
|
case SCENE_GERUDOS_FORTRESS:
|
|
|
|
|
case SCENE_HAUNTED_WASTELAND:
|
|
|
|
|
case SCENE_HYRULE_CASTLE:
|
|
|
|
|
case SCENE_DEATH_MOUNTAIN_TRAIL:
|
|
|
|
|
case SCENE_DEATH_MOUNTAIN_CRATER:
|
|
|
|
|
case SCENE_GORON_CITY:
|
|
|
|
|
case SCENE_LON_LON_RANCH:
|
|
|
|
|
case SCENE_OUTSIDE_GANONS_CASTLE:
|
2021-06-15 12:29:10 -05:00
|
|
|
|
if (!R_MINIMAP_DISABLED) {
|
2022-06-03 15:25:48 -07:00
|
|
|
|
Gfx_SetupDL_39Overlay(play->state.gfxCtx);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2020-10-29 17:31:09 -04:00
|
|
|
|
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
2020-11-19 15:49:08 -06:00
|
|
|
|
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2),
|
|
|
|
|
interfaceCtx->minimapAlpha);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2020-10-29 17:31:09 -04:00
|
|
|
|
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->mapSegment, G_IM_FMT_IA,
|
2020-05-01 17:09:20 +02:00
|
|
|
|
gMapData->owMinimapWidth[mapIndex], gMapData->owMinimapHeight[mapIndex], 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);
|
|
|
|
|
|
2020-10-29 17:31:09 -04:00
|
|
|
|
gSPTextureRectangle(OVERLAY_DISP++, R_OW_MINIMAP_X << 2, R_OW_MINIMAP_Y << 2,
|
2020-05-01 17:09:20 +02:00
|
|
|
|
(R_OW_MINIMAP_X + gMapData->owMinimapWidth[mapIndex]) << 2,
|
|
|
|
|
(R_OW_MINIMAP_Y + gMapData->owMinimapHeight[mapIndex]) << 2, G_TX_RENDERTILE, 0,
|
2021-06-15 12:29:10 -05:00
|
|
|
|
0, 1 << 10, 1 << 10);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2022-11-26 22:15:41 +01:00
|
|
|
|
if (((play->sceneId != SCENE_KAKARIKO_VILLAGE) && (play->sceneId != SCENE_KOKIRI_FOREST) &&
|
|
|
|
|
(play->sceneId != SCENE_ZORAS_FOUNTAIN)) ||
|
2020-05-01 17:09:20 +02:00
|
|
|
|
(LINK_AGE_IN_YEARS != YEARS_ADULT)) {
|
|
|
|
|
if ((gMapData->owEntranceFlag[sEntranceIconMapIndex] == 0xFFFF) ||
|
|
|
|
|
((gMapData->owEntranceFlag[sEntranceIconMapIndex] != 0xFFFF) &&
|
2023-08-13 21:24:26 +02:00
|
|
|
|
(gSaveContext.save.info.infTable[INFTABLE_1AX_INDEX] &
|
2022-04-29 20:19:48 +02:00
|
|
|
|
gBitFlags[gMapData->owEntranceFlag[mapIndex]]))) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2021-06-15 12:29:10 -05:00
|
|
|
|
gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, 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);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
|
2020-10-29 17:31:09 -04:00
|
|
|
|
gSPTextureRectangle(OVERLAY_DISP++,
|
2020-05-01 17:09:20 +02:00
|
|
|
|
gMapData->owEntranceIconPosX[sEntranceIconMapIndex] << 2,
|
|
|
|
|
gMapData->owEntranceIconPosY[sEntranceIconMapIndex] << 2,
|
|
|
|
|
(gMapData->owEntranceIconPosX[sEntranceIconMapIndex] + 8) << 2,
|
|
|
|
|
(gMapData->owEntranceIconPosY[sEntranceIconMapIndex] + 8) << 2,
|
2021-06-15 12:29:10 -05:00
|
|
|
|
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-26 22:15:41 +01:00
|
|
|
|
if ((play->sceneId == SCENE_ZORAS_FOUNTAIN) &&
|
2023-08-13 21:24:26 +02:00
|
|
|
|
(gSaveContext.save.info.infTable[INFTABLE_1AX_INDEX] & gBitFlags[INFTABLE_1A9_SHIFT])) {
|
2021-06-15 12:29:10 -05:00
|
|
|
|
gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, 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,
|
2020-05-01 17:09:20 +02:00
|
|
|
|
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
|
|
|
|
|
2022-02-20 14:22:29 +01:00
|
|
|
|
gSPTextureRectangle(OVERLAY_DISP++, 270 << 2, 154 << 2, 278 << 2, 162 << 2, G_TX_RENDERTILE, 0,
|
|
|
|
|
0, 1 << 10, 1 << 10);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_L) && !Play_InCsMode(play)) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
// clang-format off
|
2022-07-30 07:05:27 -06:00
|
|
|
|
if (!R_MINIMAP_DISABLED) { Audio_PlaySfxGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4,
|
2022-04-29 21:06:08 +02:00
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultReverb);
|
|
|
|
|
} else {
|
2022-07-30 07:05:27 -06:00
|
|
|
|
Audio_PlaySfxGeneral(NA_SE_SY_CAMERA_ZOOM_DOWN, &gSfxDefaultPos, 4,
|
2022-04-29 21:06:08 +02:00
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultReverb);
|
|
|
|
|
}
|
2020-05-01 17:09:20 +02:00
|
|
|
|
// clang-format on
|
2021-06-15 12:29:10 -05:00
|
|
|
|
R_MINIMAP_DISABLED ^= 1;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_map_exp.c", 782);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s16 Map_GetFloorTextIndexOffset(s32 mapIndex, s32 floor) {
|
|
|
|
|
return gMapData->floorTexIndexOffset[mapIndex][floor];
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 14:23:43 -04:00
|
|
|
|
void Map_Update(PlayState* play) {
|
2020-08-23 23:50:30 +02:00
|
|
|
|
static s16 sLastRoomNum = 99;
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s32 mapIndex = gSaveContext.mapIndex;
|
2022-05-21 14:23:43 -04:00
|
|
|
|
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
s16 floor;
|
|
|
|
|
s16 i;
|
|
|
|
|
|
2023-09-06 17:14:15 +02:00
|
|
|
|
if (!IS_PAUSED(&play->pauseCtx)) {
|
2022-07-31 16:44:47 -07:00
|
|
|
|
switch (play->sceneId) {
|
2022-11-26 22:15:41 +01:00
|
|
|
|
case SCENE_DEKU_TREE:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN:
|
|
|
|
|
case SCENE_JABU_JABU:
|
|
|
|
|
case SCENE_FOREST_TEMPLE:
|
|
|
|
|
case SCENE_FIRE_TEMPLE:
|
|
|
|
|
case SCENE_WATER_TEMPLE:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE:
|
|
|
|
|
case SCENE_BOTTOM_OF_THE_WELL:
|
|
|
|
|
case SCENE_ICE_CAVERN:
|
2021-05-03 01:15:16 +02:00
|
|
|
|
interfaceCtx->mapPalette[30] = 0;
|
2020-12-03 21:55:01 +00:00
|
|
|
|
if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, mapIndex)) {
|
2021-05-03 01:15:16 +02:00
|
|
|
|
interfaceCtx->mapPalette[31] = 1;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
} else {
|
2021-05-03 01:15:16 +02:00
|
|
|
|
interfaceCtx->mapPalette[31] = 0;
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (floor = 0; floor < 8; floor++) {
|
2021-01-18 16:04:04 -05:00
|
|
|
|
if (player->actor.world.pos.y > gMapData->floorCoordY[mapIndex][floor]) {
|
2020-05-01 17:09:20 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-13 21:24:26 +02:00
|
|
|
|
gSaveContext.save.info.sceneFlags[mapIndex].floors |= gBitFlags[floor];
|
2021-02-14 00:49:40 +00:00
|
|
|
|
VREG(30) = floor;
|
|
|
|
|
if (R_MAP_TEX_INDEX != (R_MAP_TEX_INDEX_BASE + Map_GetFloorTextIndexOffset(mapIndex, floor))) {
|
|
|
|
|
R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE + Map_GetFloorTextIndexOffset(mapIndex, floor);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (interfaceCtx->mapRoomNum != sLastRoomNum) {
|
2024-08-24 17:47:45 +02:00
|
|
|
|
PRINTF(T("現在階=%d 現在部屋=%x 部屋数=%d\n",
|
|
|
|
|
"Current floor = %d Current room = %x Number of rooms = %d\n"),
|
|
|
|
|
floor, interfaceCtx->mapRoomNum, gMapData->switchEntryCount[mapIndex]);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
sLastRoomNum = interfaceCtx->mapRoomNum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < gMapData->switchEntryCount[mapIndex]; i++) {
|
|
|
|
|
if ((interfaceCtx->mapRoomNum == gMapData->switchFromRoom[mapIndex][i]) &&
|
|
|
|
|
(floor == gMapData->switchFromFloor[mapIndex][i])) {
|
|
|
|
|
interfaceCtx->mapRoomNum = gMapData->switchToRoom[mapIndex][i];
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF(VT_FGCOL(YELLOW));
|
2024-08-24 17:47:45 +02:00
|
|
|
|
PRINTF(T("階層切替=%x\n", "Layer switching = %x\n"), interfaceCtx->mapRoomNum);
|
2024-01-12 07:38:13 -08:00
|
|
|
|
PRINTF(VT_RST);
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Map_InitData(play, interfaceCtx->mapRoomNum);
|
2021-09-20 11:51:35 -05:00
|
|
|
|
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
|
2022-05-21 14:23:43 -04:00
|
|
|
|
Map_SavePlayerInitialInfo(play);
|
2020-05-01 17:09:20 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VREG(10) = interfaceCtx->mapRoomNum;
|
|
|
|
|
break;
|
2022-11-26 22:15:41 +01:00
|
|
|
|
case SCENE_DEKU_TREE_BOSS:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN_BOSS:
|
|
|
|
|
case SCENE_JABU_JABU_BOSS:
|
|
|
|
|
case SCENE_FOREST_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_FIRE_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_WATER_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE_BOSS:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE_BOSS:
|
|
|
|
|
VREG(30) = gMapData->bossFloor[play->sceneId - SCENE_DEKU_TREE_BOSS];
|
|
|
|
|
R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE +
|
|
|
|
|
gMapData->floorTexIndexOffset[play->sceneId - SCENE_DEKU_TREE_BOSS][VREG(30)];
|
2020-05-01 17:09:20 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|