diff --git a/assets/xml/interface/icon_item_dungeon_static.xml b/assets/xml/interface/icon_item_dungeon_static.xml new file mode 100644 index 0000000000..04ba393383 --- /dev/null +++ b/assets/xml/interface/icon_item_dungeon_static.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/interface/icon_item_field_static.xml b/assets/xml/interface/icon_item_field_static.xml new file mode 100644 index 0000000000..8fe3a92996 --- /dev/null +++ b/assets/xml/interface/icon_item_field_static.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/interface/icon_item_jpn_static.xml b/assets/xml/interface/icon_item_jpn_static.xml new file mode 100644 index 0000000000..aff93d07e1 --- /dev/null +++ b/assets/xml/interface/icon_item_jpn_static.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/interface/parameter_static.xml b/assets/xml/interface/parameter_static.xml index 7532a95b88..e5e0808c0f 100644 --- a/assets/xml/interface/parameter_static.xml +++ b/assets/xml/interface/parameter_static.xml @@ -127,6 +127,7 @@ + diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index 255ae9eb48..1c8ba6b5bc 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -401,7 +401,7 @@ There remains one thing we need to fix before trying to compile it, namely `*(&g ```C /* 0x0EF8 */ u8 weekEventReg[100]; // "week_event_reg" - /* 0x0F5C */ u32 mapsVisited; // "area_arrival" + /* 0x0F5C */ u32 regionsVisited; // "area_arrival" ``` so it's somewhere in `weekEventReg`. `0xF37 - 0xEF8 = 0x3F = 63`, and it's a byte array, so the access is actually `gSaveContext.save.weekEventReg[63] & 0x80`. Now it will compile. We also don't use `!= 0` for flag comparisons: just `if (gSaveContext.save.weekEventReg[63] & 0x80)` will do. diff --git a/include/PR/gbi.h b/include/PR/gbi.h index 2c29420ea5..632ca3cafc 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -3572,7 +3572,7 @@ _DW({ \ #define gDPLoadTextureBlock(pkt, timg, fmt, siz, width, height, \ pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ +_DW({ \ gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ 0 , cmt, maskt, shiftt, cms, masks, shifts); \ @@ -3588,7 +3588,7 @@ _DW({ \ gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ ((height)-1) << G_TEXTURE_IMAGE_FRAC); \ -} +}) #define gDPLoadTextureBlockYuv(pkt, timg, fmt, siz, width, height, \ pal, cms, cmt, masks, maskt, shifts, shiftt) \ diff --git a/include/functions.h b/include/functions.h index e3d16014f9..adbbd6a267 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1675,8 +1675,8 @@ void func_80106644(PlayState* play, s16 arg1, s16 arg2, s16 arg3); // 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(void); -// void func_801090B0(void); +void func_80108AF8(PlayState* play); +s32 func_801090B0(s32 arg0); s32 func_80109124(s16 arg0); // void func_801091F0(void); // void func_80109428(void); @@ -1808,15 +1808,15 @@ Vec3f* OLib_Vec3fDiffDegF(Vec3f* dest, Vec3f* a, Vec3f* b); Vec3s* OLib_Vec3fDiffBinAng(Vec3s* dest, Vec3f* a, Vec3f* b); void OLib_DbCameraVec3fDiff(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); void OLib_DbCameraVec3fSum(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); -// void func_8010CB80(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10); -Gfx* func_8010CD98(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); +Gfx* func_8010CB80(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); +Gfx* func_8010CD98(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); // void func_8010CFBC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14); // void func_8010D2D4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11); // void func_8010D480(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14, UNK_TYPE4 param_15, UNK_TYPE4 param_16); -Gfx* func_8010D7D0(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); +Gfx* func_8010D7D0(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); // void func_8010D9F4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14); -Gfx* func_8010DC58(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, u16 i); -// void func_8010DE38(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6); +Gfx* func_8010DC58(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, u16 i); +Gfx* func_8010DE38(Gfx* gfx, TexturePtr texture, s32 fmt, s16 textureWidth, s16 textureHeight, u16 point); // void func_8010E028(void); void Interface_StartTimer(s16 timerId, s16 seconds); void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState); @@ -2059,7 +2059,7 @@ void Inventory_ChangeEquipment(s16 value); u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment); void Inventory_ChangeUpgrade(s16 upgrade, u32 value); s32 Inventory_IsMapVisible(s16 sceneId); -void Inventory_SetMapVisibility(s16 tingleIndex); +void Inventory_SetWorldMapCloudVisibility(s16 tingleIndex); void Inventory_SaveDekuPlaygroundHighScore(s16 timerId); void Inventory_IncrementSkullTokenCount(s16 sceneIndex); s16 Inventory_GetSkullTokenCount(s16 sceneIndex); @@ -2101,7 +2101,7 @@ void Scene_HeaderCmdActorCutsceneList(PlayState* play, SceneCmd* cmd); void Scene_HeaderCmdMiniMap(PlayState* play, SceneCmd* cmd); void Scene_HeaderCmd1D(PlayState* play, SceneCmd* cmd); void Scene_HeaderCmdMiniMapCompassInfo(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd); void Scene_HeaderCmdAnimatedMaterials(PlayState* play, SceneCmd* cmd); void Scene_SetExitFade(PlayState* play); s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header); @@ -2363,7 +2363,7 @@ void Message_FindMessageNES(PlayState* play, u16 textId); // void Message_LoadLocalizedRupeesNES(void); // void Message_LoadRupeesNES(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); // void Message_LoadTimeNES(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -// void Message_LoadAreaTextNES(void); +// void Message_LoadOwlWarpTextNES(void); // void func_80159438(void); void func_8015966C(PlayState* play, UNK_PTR puParm2, UNK_TYPE arg3); // void func_8015A144(void); diff --git a/include/regs.h b/include/regs.h index a5feea70e9..b8467e2398 100644 --- a/include/regs.h +++ b/include/regs.h @@ -54,6 +54,9 @@ #define R_PLAY_FILL_SCREEN_ALPHA MREG(68) #define R_C_UP_ICON_X YREG(88) #define R_C_UP_ICON_Y YREG(89) +#define R_PAUSE_WORLD_MAP_YAW YREG(24) +#define R_PAUSE_WORLD_MAP_Y_OFFSET YREG(25) +#define R_PAUSE_WORLD_MAP_DEPTH YREG(26) #define R_MAGIC_FILL_COLOR(i) ZREG(0 + i) #define R_C_BTN_COLOR(i) ZREG(39 + i) #define R_B_BTN_COLOR(i) ZREG(43 + i) @@ -76,8 +79,13 @@ #define R_A_ICON_X XREG(20) #define R_A_BTN_COLOR(i) XREG(22 + i) #define R_MAGIC_CONSUME_TIMER_GIANTS_MASK XREG(41) +#define R_PAUSE_DBG_MAP_CLOUD_ON XREG(50) +#define R_PAUSE_DBG_MAP_CLOUD_X XREG(52) +#define R_PAUSE_DBG_MAP_CLOUD_Y XREG(53) #define R_MOON_CRASH_TIMER_Y XREG(80) #define R_MOON_CRASH_TIMER_X XREG(81) +#define R_PAUSE_OWLWARP_ALPHA XREG(87) +#define R_REVERSE_FLOOR_INDEX XREG(94) #define R_MINIMAP_DISABLED XREG(95) #define R_B_LABEL_DD WREG(0) #define R_OW_MINIMAP_X WREG(29) diff --git a/include/z64.h b/include/z64.h index 93e12e177e..4c600e982c 100644 --- a/include/z64.h +++ b/include/z64.h @@ -439,7 +439,7 @@ typedef struct { /* 0x238 */ s16 cursorPoint[5]; /* 0x242 */ s16 cursorXIndex[5]; /* 0x24C */ s16 cursorYIndex[5]; - /* 0x256 */ s16 unk_256; + /* 0x256 */ s16 unk_256; // Uses DungeonItem enum /* 0x258 */ s16 cursorSpecialPos; /* 0x25A */ s16 pageSwitchTimer; /* 0x25C */ u16 unk_25C; @@ -472,8 +472,8 @@ typedef struct { /* 0x2BA */ s16 equipAnimScale; // scale of item icon while moving being equipped to c-button /* 0x2BC */ s16 equipAnimShrinkRate; // rate the scale is shrinking for the item icon while moving being equipped to c-button /* 0x2BE */ s16 unk_2BE[5]; - /* 0x2C8 */ u16 unk_2C8; - /* 0x2CA */ s16 unk_2CA; + /* 0x2C8 */ u16 unk_2C8; // Uses PauseMenuPage enum for Owl Warp. Never set. + /* 0x2CA */ s16 unk_2CA; // Uses OwlStatueId enum for Owl Warp. Never set. } PauseContext; // size = 0x2D0 typedef struct { diff --git a/include/z64item.h b/include/z64item.h index d8a2185cc1..7c6b719ca4 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -65,6 +65,19 @@ typedef enum { /* 0x1C */ QUEST_HEART_PIECE_COUNT = 0x1C } QuestItem; +typedef enum { + /* -1 */ DUNGEON_NONE = -1, + /* 0 */ DUNGEON_BOSS_KEY, + /* 1 */ DUNGEON_COMPASS, + /* 2 */ DUNGEON_MAP, + /* 3 */ DUNGEON_STRAY_FAIRIES, + /* 4 */ DUNGEON_FLOOR_INDEX_4, // Top Floor + /* 5 */ DUNGEON_FLOOR_INDEX_3, + /* 6 */ DUNGEON_FLOOR_INDEX_2, + /* 7 */ DUNGEON_FLOOR_INDEX_1, + /* 8 */ DUNGEON_FLOOR_INDEX_0 // Bottom Floor +} DungeonItem; + typedef enum { /* 0x00 */ SLOT_OCARINA, /* 0x01 */ SLOT_BOW, @@ -550,6 +563,6 @@ typedef enum { /* 0x74 */ GID_PICTO_BOX, /* 0x75 */ GID_MASK_FIERCE_DEITY, /* 0x76 */ GID_MAX -} GetItemDrawID; +} GetItemDrawId; #endif diff --git a/include/z64save.h b/include/z64save.h index 41329f082c..816e42390a 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -272,8 +272,8 @@ typedef struct Save { /* 0x0EF0 */ u32 lotteryCodeGuess; // Lottery code chosen by player (only uses lower three hex digits) /* 0x0EF4 */ u32 shootingGalleryHighScores; // High scores for both shooting galleries. Town uses lower 16 bits, Swamp uses higher 16 bits. /* 0x0EF8 */ u8 weekEventReg[100]; // "week_event_reg" - /* 0x0F5C */ u32 mapsVisited; // "area_arrival" - /* 0x0F60 */ u32 mapsVisible; // "cloud_clear" + /* 0x0F5C */ u32 regionsVisited; // "area_arrival" + /* 0x0F60 */ u32 worldMapCloudVisibility; // "cloud_clear" /* 0x0F64 */ u8 unk_F64; // "oca_rec_flag" has scarecrows song /* 0x0F65 */ u8 unk_F65; // "oca_rec_flag8" scarecrows song set? /* 0x0F66 */ u8 scarecrowSpawnSong[128]; diff --git a/include/z64scene.h b/include/z64scene.h index bfe5032822..a31c7a0916 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -174,9 +174,9 @@ typedef struct { typedef struct { /* 0x0 */ u8 code; - /* 0x1 */ u8 cameraMovement; - /* 0x4 */ u32 area; -} SCmdMiscSettings; // size = 0x8 + /* 0x1 */ u8 sceneCsCount; + /* 0x4 */ void* segment; +} SCmdCutsceneList; // size = 0x8 typedef struct { /* 0x0 */ u8 code; @@ -186,9 +186,8 @@ typedef struct { typedef struct { /* 0x0 */ u8 code; - /* 0x1 */ u8 data1; - /* 0x4 */ u32 data2; -} SCmdWorldMapVisited; // size = 0x8 + /* 0x1 */ UNK_TYPE1 pad[7]; +} SCmdRegionVisited; // size = 0x8 typedef struct { /* 0x0 */ u8 code; @@ -524,9 +523,9 @@ typedef union { /* Command: 0x14 */ SCmdEndMarker endMarker; /* Command: 0x15 */ SCmdSoundSettings soundSettings; /* Command: 0x16 */ SCmdEchoSettings echoSettings; - /* Command: 0x17 */ SCmdMiscSettings miscSettings; + /* Command: 0x17 */ SCmdCutsceneList cutsceneList; /* Command: 0x18 */ SCmdAltHeaders altHeaders; - /* Command: 0x19 */ SCmdWorldMapVisited worldMapVisited; + /* Command: 0x19 */ SCmdRegionVisited regionVisited; /* Command: 0x1A */ SCmdTextureAnimations textureAnimations; /* Command: 0x1B */ SCmdCutsceneActorList cutsceneActorList; /* Command: 0x1C */ SCmdMinimapSettings minimapSettings; @@ -534,6 +533,49 @@ typedef union { /* Command: 0x1E */ SCmdMinimapChests minimapChests; } SceneCmd; // size = 0x8 +// Sets cursor point options on the world map +typedef enum { + /* 0x0 */ REGION_GREAT_BAY, + /* 0x1 */ REGION_ZORA_HALL, + /* 0x2 */ REGION_ROMANI_RANCH, + /* 0x3 */ REGION_DEKU_PALACE, + /* 0x4 */ REGION_WOODFALL, + /* 0x5 */ REGION_CLOCK_TOWN, + /* 0x6 */ REGION_SNOWHEAD, + /* 0x7 */ REGION_IKANA_GRAVEYARD, + /* 0x8 */ REGION_IKANA_CANYON, + /* 0x9 */ REGION_GORON_VILLAGE, + /* 0xA */ REGION_STONE_TOWER, + /* 0xB */ REGION_MAX +} RegionId; + +// Sets warp points for owl statues +typedef enum { + /* 0x0 */ OWL_WARP_GREAT_BAY_COAST, + /* 0x1 */ OWL_WARP_ZORA_CAPE, + /* 0x2 */ OWL_WARP_SNOWHEAD, + /* 0x3 */ OWL_WARP_MOUNTAIN_VILLAGE, + /* 0x4 */ OWL_WARP_CLOCK_TOWN, + /* 0x5 */ OWL_WARP_MILK_ROAD, + /* 0x6 */ OWL_WARP_WOODFALL, + /* 0x7 */ OWL_WARP_SOUTHERN_SWAMP, + /* 0x8 */ OWL_WARP_IKANA_CANYON, + /* 0x9 */ OWL_WARP_STONE_TOWER, + /* 0xA */ OWL_WARP_ENTRANCE, // Special index for warping to the entrance of a scene + /* 0xB */ OWL_WARP_MAX +} OwlWarpId; + +// Sets cloud visibility on the world map +typedef enum { + /* 0 */ TINGLE_MAP_CLOCK_TOWN, + /* 1 */ TINGLE_MAP_WOODFALL, + /* 2 */ TINGLE_MAP_SNOWHEAD, + /* 3 */ TINGLE_MAP_ROMANI_RANCH, + /* 4 */ TINGLE_MAP_GREAT_BAY, + /* 5 */ TINGLE_MAP_STONE_TOWER, + /* 6 */ TINGLE_MAP_MAX +} TingleMapId; + typedef enum { /* 0x00 */ SCENE_20SICHITAI2, // Southern Swamp (Clear) /* 0x01 */ SCENE_UNSET_1, @@ -811,7 +853,7 @@ typedef enum { /* 0x16 */ SCENE_CMD_ID_ECHO_SETTINGS, /* 0x17 */ SCENE_CMD_ID_CUTSCENE_LIST, /* 0x18 */ SCENE_CMD_ID_ALTERNATE_HEADER_LIST, - /* 0x19 */ SCENE_CMD_ID_MISC_SETTINGS, + /* 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, @@ -900,8 +942,9 @@ typedef enum { #define SCENE_CMD_ALTERNATE_HEADER_LIST(alternateHeaderList) \ { SCENE_CMD_ID_ALTERNATE_HEADER_LIST, 0, CMD_PTR(alternateHeaderList) } -#define SCENE_CMD_MISC_SETTINGS() \ - { SCENE_CMD_ID_MISC_SETTINGS, 0, CMD_W(0) } +#define SCENE_CMD_MISC_SETTINGS SCENE_CMD_SET_REGION_VISITED // TODO: ZAPD Capatability +#define SCENE_CMD_SET_REGION_VISITED() \ + { SCENE_CMD_ID_SET_REGION_VISITED, 0, CMD_W(0) } #define SCENE_CMD_ANIMATED_MATERIAL_LIST(matAnimList) \ { SCENE_CMD_ID_ANIMATED_MATERIAL_LIST, 0, CMD_PTR(matAnimList) } diff --git a/spec b/spec index 855295643c..5d664c713f 100644 --- a/spec +++ b/spec @@ -293,14 +293,16 @@ beginseg name "icon_item_field_static" compress romalign 0x1000 - include "build/baserom/icon_item_field_static.o" + include "build/assets/interface/icon_item_field_static/icon_item_field_static.o" + number 12 endseg beginseg name "icon_item_dungeon_static" compress romalign 0x1000 - include "build/baserom/icon_item_dungeon_static.o" + include "build/assets/interface/icon_item_dungeon_static/icon_item_dungeon_static.o" + number 12 endseg beginseg @@ -315,7 +317,8 @@ beginseg name "icon_item_jpn_static" compress romalign 0x1000 - include "build/baserom/icon_item_jpn_static.o" + include "build/assets/interface/icon_item_jpn_static/icon_item_jpn_static.o" + number 13 endseg beginseg diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index 278ef0830d..eb70cfbc8d 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -96,7 +96,7 @@ u32 gGsFlagsShift[] = { }; // TODO: use symbols for these icon textures once textures are properly in C -void* gItemIcons[] = { +TexturePtr gItemIcons[] = { 0x08000000, // ITEM_OCARINA 0x08001000, // ITEM_BOW 0x08002000, // ITEM_ARROW_FIRE @@ -249,7 +249,7 @@ u8 gItemSlots[] = { SLOT_LENS, // ITEM_LENS SLOT_HOOKSHOT, // ITEM_HOOKSHOT SLOT_SWORD_GREAT_FAIRY, // ITEM_SWORD_GREAT_FAIRY - SLOT_BOTTLE_1, // + SLOT_BOTTLE_1, // ITEM_LONGSHOT SLOT_BOTTLE_1, // ITEM_BOTTLE SLOT_BOTTLE_1, // ITEM_POTION_RED SLOT_BOTTLE_1, // ITEM_POTION_GREEN @@ -365,8 +365,8 @@ s16 gItemPrices[] = { }; // Used to map scene indexes to their region in Termina -u16 gSceneIdsPerRegion[11][27] = { - // Great Bay +u16 gSceneIdsPerRegion[REGION_MAX][27] = { + // REGION_GREAT_BAY { SCENE_30GYOSON, SCENE_LABO, @@ -378,15 +378,15 @@ u16 gSceneIdsPerRegion[11][27] = { SCENE_PIRATE, SCENE_35TAKI, SCENE_KINDAN2, - -1, + 0xFFFF, }, - // Zora Hall + // REGION_ZORA_HALL { SCENE_33ZORACITY, SCENE_BANDROOM, - -1, + 0xFFFF, }, - // Romani Ranch + // REGION_ROMANI_RANCH { SCENE_F01, SCENE_ROMANYMAE, @@ -394,17 +394,17 @@ u16 gSceneIdsPerRegion[11][27] = { SCENE_F01C, SCENE_F01_B, SCENE_KOEPONARACE, - -1, + 0xFFFF, }, - // Deku Palace + // REGION_DEKU_PALACE { SCENE_22DEKUCITY, SCENE_DEKU_KING, SCENE_26SARUNOMORI, SCENE_DANPEI, - -1, + 0xFFFF, }, - // Southern Swamp + // REGION_WOODFALL { SCENE_20SICHITAI, SCENE_20SICHITAI2, @@ -412,21 +412,18 @@ u16 gSceneIdsPerRegion[11][27] = { SCENE_WITCH_SHOP, SCENE_21MITURINMAE, SCENE_KINSTA1, - -1, + 0xFFFF, }, - // Clock Town + // REGION_CLOCK_TOWN { - SCENE_00KEIKOKU, SCENE_TENMON_DAI, SCENE_13HUBUKINOMITI, - SCENE_24KEMONOMITI, SCENE_SYATEKI_MORI, SCENE_IKANAMAE, - SCENE_TOWN, SCENE_SYATEKI_MIZU, SCENE_BOWLING, - SCENE_TAKARAYA, SCENE_YADOYA, SCENE_SONCHONOIE, - SCENE_MILK_BAR, SCENE_ICHIBA, SCENE_BOMYA, - SCENE_AYASHIISHOP, SCENE_8ITEMSHOP, SCENE_DOUJOU, - SCENE_POSTHOUSE, SCENE_TAKARAKUJI, SCENE_BACKTOWN, - SCENE_CLOCKTOWER, SCENE_INSIDETOWER, SCENE_OKUJOU, - SCENE_ALLEY, SCENE_DEKUTES, -1, + SCENE_00KEIKOKU, SCENE_TENMON_DAI, SCENE_13HUBUKINOMITI, SCENE_24KEMONOMITI, SCENE_SYATEKI_MORI, + SCENE_IKANAMAE, SCENE_TOWN, SCENE_SYATEKI_MIZU, SCENE_BOWLING, SCENE_TAKARAYA, + SCENE_YADOYA, SCENE_SONCHONOIE, SCENE_MILK_BAR, SCENE_ICHIBA, SCENE_BOMYA, + SCENE_AYASHIISHOP, SCENE_8ITEMSHOP, SCENE_DOUJOU, SCENE_POSTHOUSE, SCENE_TAKARAKUJI, + SCENE_BACKTOWN, SCENE_CLOCKTOWER, SCENE_INSIDETOWER, SCENE_OKUJOU, SCENE_ALLEY, + SCENE_DEKUTES, 0xFFFF, }, - // Snowhead + // REGION_SNOWHEAD { SCENE_10YUKIYAMANOMURA, SCENE_10YUKIYAMANOMURA2, @@ -437,15 +434,15 @@ u16 gSceneIdsPerRegion[11][27] = { SCENE_GORON_HAKA, SCENE_17SETUGEN, SCENE_17SETUGEN2, - -1, + 0xFFFF, }, - // Ikana Graveyard + // REGION_IKANA_GRAVEYARD { SCENE_BOTI, SCENE_DANPEI2TEST, - -1, + 0xFFFF, }, - // Ikana Canyon + // REGION_IKANA_CANYON { SCENE_CASTLE, SCENE_IKNINSIDE, @@ -456,21 +453,21 @@ u16 gSceneIdsPerRegion[11][27] = { SCENE_REDEAD, SCENE_TOUGITES, SCENE_HAKASHITA, - -1, + 0xFFFF, }, - // Goron Village + // REGION_GORON_VILLAGE { SCENE_11GORONNOSATO, SCENE_11GORONNOSATO2, SCENE_16GORON_HOUSE, SCENE_GORONSHOP, - -1, + 0xFFFF, }, - // Stone Tower + // REGION_STONE_TOWER { SCENE_F40, SCENE_F41, - -1, + 0xFFFF, }, }; @@ -553,9 +550,9 @@ s32 Inventory_IsMapVisible(s16 sceneId) { return false; } -static u16 sSceneIdsPerTingleMap[6][12] = { +static u16 sSceneIdsPerTingleMap[TINGLE_MAP_MAX][12] = { { - // Clock Town Tingle Map + // TINGLE_MAP_CLOCK_TOWN SCENE_00KEIKOKU, SCENE_BOTI, SCENE_13HUBUKINOMITI, @@ -566,20 +563,20 @@ static u16 sSceneIdsPerTingleMap[6][12] = { SCENE_BACKTOWN, SCENE_CLOCKTOWER, SCENE_ALLEY, - -1, + 0xFFFF, }, { - // Woodfall Tingle Map + // TINGLE_MAP_WOODFALL SCENE_20SICHITAI, SCENE_20SICHITAI2, SCENE_21MITURINMAE, SCENE_22DEKUCITY, SCENE_DEKU_KING, SCENE_KINSTA1, - -1, + 0xFFFF, }, { - // Snowhead Tingle Map + // TINGLE_MAP_SNOWHEAD SCENE_10YUKIYAMANOMURA, SCENE_10YUKIYAMANOMURA2, SCENE_11GORONNOSATO, @@ -590,20 +587,20 @@ static u16 sSceneIdsPerTingleMap[6][12] = { SCENE_GORONRACE, SCENE_17SETUGEN, SCENE_17SETUGEN2, - -1, + 0xFFFF, }, { - // Romani Ranch Tingle Map + // TINGLE_MAP_ROMANI_RANCH SCENE_F01, SCENE_ROMANYMAE, SCENE_OMOYA, SCENE_F01C, SCENE_F01_B, SCENE_KOEPONARACE, - -1, + 0xFFFF, }, { - // Great Bay Tingle Map + // TINGLE_MAP_GREAT_BAY SCENE_30GYOSON, SCENE_SINKAI, SCENE_31MISAKI, @@ -611,28 +608,28 @@ static u16 sSceneIdsPerTingleMap[6][12] = { SCENE_KAIZOKU, SCENE_33ZORACITY, SCENE_35TAKI, - -1, + 0xFFFF, }, { - // Stone Tower Tingle Map + // TINGLE_MAP_STONE_TOWER SCENE_F40, SCENE_F41, SCENE_CASTLE, SCENE_IKANA, SCENE_REDEAD, - -1, + 0xFFFF, }, }; /** - * Map visibility is achieved by purchasing a tingle map + * Removing clouds from the World Map is achieved by purchasing a tingle map */ -void Inventory_SetMapVisibility(s16 tingleIndex) { +void Inventory_SetWorldMapCloudVisibility(s16 tingleIndex) { s16 i = 0; s16 index = 0; u16(*tingleMapSceneIds)[] = &sSceneIdsPerTingleMap[tingleIndex]; - if ((tingleIndex >= 0) && (tingleIndex < 6)) { + if ((tingleIndex >= 0) && (tingleIndex < TINGLE_MAP_MAX)) { while (true) { if ((*tingleMapSceneIds)[i] == 0xFFFF) { break; @@ -665,21 +662,21 @@ void Inventory_SetMapVisibility(s16 tingleIndex) { } if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[0]) { - gSaveContext.save.mapsVisible |= 3; + gSaveContext.save.worldMapCloudVisibility |= 3; } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[1]) { - gSaveContext.save.mapsVisible |= 0x1C; + gSaveContext.save.worldMapCloudVisibility |= 0x1C; } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[2]) { - gSaveContext.save.mapsVisible |= 0xE0; + gSaveContext.save.worldMapCloudVisibility |= 0xE0; } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[3]) { - gSaveContext.save.mapsVisible |= 0x100; + gSaveContext.save.worldMapCloudVisibility |= 0x100; } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[4]) { - gSaveContext.save.mapsVisible |= 0x1E00; + gSaveContext.save.worldMapCloudVisibility |= 0x1E00; } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[5]) { - gSaveContext.save.mapsVisible |= 0x6000; + gSaveContext.save.worldMapCloudVisibility |= 0x6000; } } - XREG(95) = 0; + R_MINIMAP_DISABLED = false; } /** diff --git a/src/code/title_setup.c b/src/code/title_setup.c index dad3c6458b..641160ea8b 100644 --- a/src/code/title_setup.c +++ b/src/code/title_setup.c @@ -23,13 +23,13 @@ void Setup_SetRegs(void) { XREG(77) = 0x3C; XREG(78) = 0x2F; XREG(79) = 0x62; - XREG(87) = 0; + R_PAUSE_OWLWARP_ALPHA = 0; XREG(88) = 0x56; XREG(89) = 0x258; XREG(90) = 0x1C2; XREG(91) = 0; - XREG(94) = 0; - XREG(95) = 0; + R_REVERSE_FLOOR_INDEX = 0; + R_MINIMAP_DISABLED = false; YREG(32) = 0x50; YREG(33) = 0x3C; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index a8ef010916..5069b94a8d 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -861,10 +861,11 @@ void TitleCard_Draw(GameState* gameState, TitleCardContext* titleCtx) { OPEN_DISPS(gameState->gfxCtx); - height = (width * height > TMEM_SIZE) ? TMEM_SIZE / width : height; - spB4 = spB8 + (height * 4); + if (width * height > TMEM_SIZE) { + height = TMEM_SIZE / width; + } - if (1) {} + spB4 = spB8 + (height * 4); OVERLAY_DISP = func_8012C014(OVERLAY_DISP); diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 0109dc4ab6..2f2e3c3881 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -22,19 +22,19 @@ void func_800F4A10(PlayState* play) { pauseCtx->unk_27E = -40; for (i = 0; i < ARRAY_COUNT(pauseCtx->worldMapPoints); i++) { - pauseCtx->worldMapPoints[i] = 0; + pauseCtx->worldMapPoints[i] = false; } if (pauseCtx->state == 1) { - for (i = 0; i < 11; i++) { - if ((gSaveContext.save.mapsVisited >> i) & 1) { - pauseCtx->worldMapPoints[i] = 1; + for (i = 0; i < REGION_MAX; i++) { + if ((gSaveContext.save.regionsVisited >> i) & 1) { + pauseCtx->worldMapPoints[i] = true; } } } else { - for (i = 9; i >= 0; i--) { + for (i = OWL_WARP_STONE_TOWER; i >= OWL_WARP_GREAT_BAY_COAST; i--) { if ((gSaveContext.save.playerData.owlActivationFlags >> i) & 1) { - pauseCtx->worldMapPoints[i] = 1; + pauseCtx->worldMapPoints[i] = true; pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = i; } } @@ -57,9 +57,9 @@ void func_800F4A10(PlayState* play) { YREG(21) = -0x0622; YREG(22) = -0x0C44; YREG(23) = 0x0622; - YREG(24) = -0x0622; - YREG(25) = -0x005A; - YREG(26) = -0x3840; + R_PAUSE_WORLD_MAP_YAW = -0x622; + R_PAUSE_WORLD_MAP_Y_OFFSET = -90; + R_PAUSE_WORLD_MAP_DEPTH = -14400; } void KaleidoSetup_Update(PlayState* play) { @@ -124,18 +124,18 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->unk_20C = 936.0f; pauseCtx->unk_220 = -314.0f; - pauseCtx->cursorPoint[PAUSE_MAP] = XREG(94) + 3; + pauseCtx->cursorPoint[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_RIGHT; pauseCtx->pageSwitchTimer = 0; pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE; - pauseCtx->cursorItem[PAUSE_MAP] = XREG(94) + 3; + pauseCtx->cursorItem[PAUSE_MAP] = R_REVERSE_FLOOR_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] = XREG(94) + 3; + pauseCtx->cursorSlot[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); pauseCtx->cursorColorSet = 2; pauseCtx->unk_2A0 = -1; diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 2b5eb1aac9..57f51a20ae 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -245,14 +245,14 @@ void Map_Update(PlayState* play) { if (floor != -1) { gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].unk_14 |= gBitFlags[FLOOR_INDEX_MAX - floor]; - XREG(94) = FLOOR_INDEX_MAX - floor; + R_REVERSE_FLOOR_INDEX = FLOOR_INDEX_MAX - floor; if (interfaceCtx->mapRoomNum != sLastRoomNum) { sLastRoomNum = interfaceCtx->mapRoomNum; } } } else if (Map_IsInBossArea(play)) { func_80105294(); - XREG(94) = FLOOR_INDEX_MAX - func_80105318(); + R_REVERSE_FLOOR_INDEX = FLOOR_INDEX_MAX - func_80105318(); } } } diff --git a/src/code/z_message.c b/src/code/z_message.c index fc61660197..d278b46d14 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -256,34 +256,33 @@ void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D304.s") -extern u16 D_801D0188[][9]; -extern s16 D_801D0250[]; +extern u16 D_801D0188[OWL_WARP_MAX][9]; +extern s16 D_801D0250[OWL_WARP_MAX]; void func_8014D62C(PlayState* play, s32* arg1, f32* arg2, s16* arg3) { MessageContext* msgCtx = &play->msgCtx; PauseContext* pauseCtx = &play->pauseCtx; - s16 temp_s6; + s16 stringLimit; s16 temp_s1 = *arg3; s32 temp_s2 = *arg1; f32 sp3C = *arg2; - s16 phi_v0; + s16 owlWarpId; s16 phi_s0; - if ((func_8010A0A4(play) != 0) || (play->sceneId == SCENE_SECOM)) { - phi_v0 = 0xA; + if (func_8010A0A4(play) || (play->sceneId == SCENE_SECOM)) { + owlWarpId = OWL_WARP_ENTRANCE; } else { - phi_v0 = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + owlWarpId = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; } + stringLimit = D_801D0250[owlWarpId]; - temp_s6 = D_801D0250[phi_v0]; - - for (phi_s0 = 0; phi_s0 < temp_s6; phi_s0++, temp_s1++, temp_s2 += 0x80) { - msgCtx->decodedBuffer.wchar[temp_s1] = D_801D0188[phi_v0][phi_s0]; - Font_LoadChar(play, D_801D0188[phi_v0][phi_s0], temp_s2); + for (phi_s0 = 0; phi_s0 < stringLimit; phi_s0++, temp_s1++, temp_s2 += 0x80) { + msgCtx->decodedBuffer.wchar[temp_s1] = D_801D0188[owlWarpId][phi_s0]; + Font_LoadChar(play, D_801D0188[owlWarpId][phi_s0], temp_s2); } temp_s1--; - sp3C += (temp_s6 - 1) * (16.0f * msgCtx->unk12098); + sp3C += (stringLimit - 1) * (16.0f * msgCtx->unk12098); *arg3 = temp_s1; *arg1 = temp_s2; diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index fef293b46f..fb8dbfcbf0 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -17,31 +17,43 @@ u8 D_801D06F0[4][8] = { { "rupee(s)" }, //EN // rupeesTextLength u8 D_801D0710[4] = {8,8,5,8}; -//TextArea -char D_801D0714[11][16] = { - "Great Bay Coast", - "Zora Cape", - "Snowhead", - "Mountain Village", - "Clock Town", - "Milk Road", - "Woodfall", - "Southern Swamp", - "Ikana Canyon", - "Stone Tower", - "Entrance" - }; +// sOwlWarpText +char D_801D0714[OWL_WARP_MAX][16] = { + "Great Bay Coast", // OWL_WARP_GREAT_BAY_COAST + "Zora Cape", // OWL_WARP_ZORA_CAPE + "Snowhead", // OWL_WARP_SNOWHEAD + "Mountain Village", // OWL_WARP_MOUNTAIN_VILLAGE + "Clock Town", // OWL_WARP_CLOCK_TOWN + "Milk Road", // OWL_WARP_MILK_ROAD + "Woodfall", // OWL_WARP_WOODFALL + "Southern Swamp", // OWL_WARP_SOUTHERN_SWAMP + "Ikana Canyon", // OWL_WARP_IKANA_CANYON + "Stone Tower", // OWL_WARP_STONE_TOWER + "Entrance", // OWL_WARP_ENTRANCE +}; -//TextAreaLength -s16 D_801D07C4[11] = {15,9,8,16,10,9,8,14,12,11,8}; +// sOwlWarpTextLength +s16 D_801D07C4[OWL_WARP_MAX] = { + 15, // OWL_WARP_GREAT_BAY_COAST + 9, // OWL_WARP_ZORA_CAPE + 8, // OWL_WARP_SNOWHEAD + 16, // OWL_WARP_MOUNTAIN_VILLAGE + 10, // OWL_WARP_CLOCK_TOWN + 9, // OWL_WARP_MILK_ROAD + 8, // OWL_WARP_WOODFALL + 14, // OWL_WARP_SOUTHERN_SWAMP + 12, // OWL_WARP_IKANA_CANYON + 11, // OWL_WARP_STONE_TOWER + 8, // OWL_WARP_ENTRANCE +}; #endif extern f32 D_801D0470[159]; extern u8 D_801D06F0[4][8]; extern u8 D_801D0710[4]; -extern u8 D_801D0714[11][16]; -extern s16 D_801D07C4[11]; +extern u8 D_801D0714[OWL_WARP_MAX][16]; +extern s16 D_801D07C4[OWL_WARP_MAX]; void Message_FindMessageNES(PlayState* play, u16 textId) { MessageContext* msgCtx = &play->msgCtx; @@ -244,28 +256,28 @@ void Message_LoadTimeNES(PlayState* play, u8 arg1, s32* offset, f32* arg3, s16* *arg3 = f; } -void Message_LoadAreaTextNES(PlayState* play, s32* offset, f32* arg2, s16* decodedBufPos) { +void Message_LoadOwlWarpTextNES(PlayState* play, s32* offset, f32* arg2, s16* decodedBufPos) { MessageContext* msgCtx = &play->msgCtx; s16 p = *decodedBufPos; s32 o = *offset; f32 f = *arg2; s16 i; u8 currentChar; - s16 currentArea; + s16 owlWarpId; s16 stringLimit; - if ((func_8010A0A4(play) != 0) || (play->sceneId == SCENE_SECOM)) { - currentArea = 10; + if (func_8010A0A4(play) || (play->sceneId == SCENE_SECOM)) { + owlWarpId = OWL_WARP_ENTRANCE; } else { - currentArea = play->pauseCtx.cursorPoint[PAUSE_WORLD_MAP]; + owlWarpId = play->pauseCtx.cursorPoint[PAUSE_WORLD_MAP]; } - stringLimit = D_801D07C4[currentArea]; + stringLimit = D_801D07C4[owlWarpId]; for (i = 0; i < stringLimit; i++) { - msgCtx->decodedBuffer.schar[p] = D_801D0714[currentArea][i]; + msgCtx->decodedBuffer.schar[p] = D_801D0714[owlWarpId][i]; currentChar = msgCtx->decodedBuffer.schar[p]; if (currentChar != ' ') { - Font_LoadCharNES(play, D_801D0714[currentArea][i], o); + Font_LoadCharNES(play, D_801D0714[owlWarpId][i], o); o += FONT_CHAR_TEX_SIZE; } currentChar = msgCtx->decodedBuffer.schar[p]; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 5704760f17..7528ba15a5 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -468,8 +468,8 @@ void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) { // SceneTableEntry Header Command 0x17: Cutscene List void Scene_HeaderCmdCutsceneList(PlayState* play, SceneCmd* cmd) { - play->csCtx.sceneCsCount = cmd->base.data1; - play->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->base.data2); + play->csCtx.sceneCsCount = cmd->cutsceneList.sceneCsCount; + play->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->cutsceneList.segment); } // SceneTableEntry Header Command 0x1B: Actor Cutscene List @@ -492,8 +492,8 @@ void Scene_HeaderCmdMiniMapCompassInfo(PlayState* play, SceneCmd* cmd) { func_8010565C(play, cmd->minimapChests.num, cmd->minimapChests.segment); } -// SceneTableEntry Header Command 0x1A: Sets Area Visited Flag -void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd) { +// SceneTableEntry Header Command 0x19: Sets Region Visited Flag +void Scene_HeaderCmdSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd) { s16 j = 0; s16 i = 0; @@ -502,7 +502,7 @@ void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd) { i++; j = 0; - if (i == ARRAY_COUNT(gSceneIdsPerRegion)) { + if (i == REGION_MAX) { break; } } @@ -514,8 +514,9 @@ void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd) { j++; } - if (i < ARRAY_COUNT(gSceneIdsPerRegion)) { - gSaveContext.save.mapsVisited = (gBitFlags[i] | gSaveContext.save.mapsVisited) | gSaveContext.save.mapsVisited; + if (i < REGION_MAX) { + gSaveContext.save.regionsVisited = + (gBitFlags[i] | gSaveContext.save.regionsVisited) | gSaveContext.save.regionsVisited; } } @@ -561,7 +562,7 @@ s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header) { Scene_HeaderCmdEchoSetting, Scene_HeaderCmdCutsceneList, Scene_HeaderCmdAltHeaderList, - Scene_HeaderCmdSetAreaVisitedFlag, + Scene_HeaderCmdSetRegionVisitedFlag, Scene_HeaderCmdAnimatedMaterials, Scene_HeaderCmdActorCutsceneList, Scene_HeaderCmdMiniMap, 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 23874e37ae..e5c712a5b6 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -374,7 +374,7 @@ void func_808A1090(DoorShutter* this, PlayState* play) { } } else if (this->unk_166 != 0) { if (this->doorType == 5) { - if (!CHECK_DUNGEON_ITEM(0, gSaveContext.mapIndex)) { + if (!CHECK_DUNGEON_ITEM(DUNGEON_BOSS_KEY, gSaveContext.mapIndex)) { player->doorType = -1; this->actor.textId = 0x1803; } diff --git a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c index d45cc854c0..fbc74cb10b 100644 --- a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c +++ b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c @@ -406,6 +406,8 @@ void func_80BB5AAC(EnTanron1* this, PlayState* play) { Matrix_RotateXS(ptr->unk_18 * -1, MTXMODE_APPLY); Matrix_Scale(1.0f, ptr->unk_2C, 1.0f, MTXMODE_APPLY); + if (1) {} + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001900); } 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 6e23e8f6fc..5f4c136e08 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 @@ -1,108 +1,974 @@ /* * File: z_kaleido_map.c * Overlay: ovl_kaleido_scope - * Description: + * Description: Pause Menu: Map Page */ #include "z_kaleido_scope.h" +#include "interface/parameter_static/parameter_static.h" +#include "interface/icon_item_field_static/icon_item_field_static.h" +#include "interface/icon_item_dungeon_static/icon_item_dungeon_static.h" +#include "interface/icon_item_jpn_static/icon_item_jpn_static.h" -extern UNK_TYPE D_02001360; -extern UNK_TYPE D_020044A0; -extern UNK_TYPE D_02004AA0; -extern UNK_TYPE D_0200B998; -extern UNK_TYPE D_08062000; -extern UNK_TYPE D_08064340; -extern UNK_TYPE D_0B000000; -extern UNK_TYPE D_0C000000; -extern UNK_TYPE D_0C006C00; +extern s16 D_8082B7F0[]; +extern s16 D_8082B838[]; -s32 D_8082B4A0[] = { 0x09003600, 0x09003F00, 0x09004800 }; +extern TexturePtr D_09007500; // gPlayerFace -s32 D_8082B4AC[] = { - 0x0D000000, - 0x0D000800, - 0x0D001000, - 0x0D001800, +#define WORLD_MAP_IMAGE_TEX_WIDTH 216 +#define WORLD_MAP_IMAGE_TEX_HEIGHT 128 + +void KaleidoScope_DrawDungeonStrayFairyCount(PlayState* play) { + s16 counterDigits[2]; + s16 rectLeft; + s16 digitIndex; + + OPEN_DISPS(play->state.gfxCtx); + + // Get digits for max number of stray fairies + counterDigits[1] = 15; + counterDigits[0] = counterDigits[1] / 10; + counterDigits[1] -= (s16)(counterDigits[0] * 10); + + // Draw max number of stray fairies + for (rectLeft = 116, digitIndex = 0; digitIndex < 2; digitIndex++, rectLeft += 8) { + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 255); + + POLY_OPA_DISP = func_8010D7D0(POLY_OPA_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[digitIndex]), 8, + 16, rectLeft + 1, 146, 8, 16, 1 << 10, 1 << 10); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + gSPTextureRectangle(POLY_OPA_DISP++, rectLeft * 4, 145 << 2, (rectLeft + 8) * 4, 161 << 2, G_TX_RENDERTILE, 0, + 0, 1 << 10, 1 << 10); + } + + // Draw Counter slash + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 255); + + POLY_OPA_DISP = + func_8010D7D0(POLY_OPA_DISP, gStrayFairyMapCounterSlashTex, 8, 16, 107, 146, 8, 16, 1 << 10, 1 << 10); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + gSPTextureRectangle(POLY_OPA_DISP++, 106 << 2, 145 << 2, 114 << 2, 161 << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, + 1 << 10); + + // Get digits for current number of stray fairies collected + counterDigits[1] = gSaveContext.save.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex]; + counterDigits[0] = counterDigits[1] / 10; + counterDigits[1] -= (s16)(counterDigits[0] * 10); + + // Draw digits for current number of stray fairies collected + for (rectLeft = 88, digitIndex = 0; digitIndex < 2; digitIndex++, rectLeft += 8) { + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 255); + + POLY_OPA_DISP = func_8010D7D0(POLY_OPA_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[digitIndex]), 8, + 16, rectLeft + 1, 146, 8, 16, 1 << 10, 1 << 10); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + gSPTextureRectangle(POLY_OPA_DISP++, rectLeft * 4, 145 << 2, (rectLeft + 8) * 4, 161 << 2, G_TX_RENDERTILE, 0, + 0, 1 << 10, 1 << 10); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +TexturePtr sDungeonItemTextures[] = { + 0x09003600, // `gBossKeyIconTex`: DUNGEON_BOSS_KEY + 0x09003F00, // `gCompassIconTex`: DUNGEON_COMPASS + 0x09004800, // `gDungeonMapIconTex`: DUNGEON_MAP }; -s16 D_8082B4BC[] = { - 0x0043, - 0x0051, - 0x005F, - 0x006D, +TexturePtr sDungeonTitleTextures[] = { + gPauseWoodfallTitleENGTex, // DUNGEON_INDEX_WOODFALL_TEMPLE + gPauseSnowheadTitleENGTex, // DUNGEON_INDEX_SNOWHEAD_TEMPLE + gPauseGreatBayTitleENGTex, // DUNGEON_INDEX_GREAT_BAY_TEMPLE + gPauseStoneTowerTitleENGTex, // DUNGEON_INDEX_STONE_TOWER_TEMPLE }; -s16 D_8082B4C4 = 0x7B; -s16 D_8082B4C8 = 30; -s16 D_8082B4CC = 0; -s16 D_8082B4D0 = 0xF; -s16 D_8082B4D4 = 0; -s16 D_8082B4D8 = 0xFF; -f32 D_8082B4DC = 100.0f; +s16 sDungeonMapFloorIconPosY[] = { 67, 81, 95, 109, 123 }; -s32 D_8082B4E0[] = { - 0x02008998, 0x0C001B80, 0x02008998, 0x0C001B80, 0x02009598, 0x0C002780, 0x02009598, 0x0C002780, - 0x0200A198, 0x0C003380, 0x0200A198, 0x0C003380, 0x0200AD98, 0x0C003F80, 0x0200AD98, 0x0C003F80, +void KaleidoScope_DrawDungeonMap(PlayState* play) { + static s16 sStrayFairyIconTimer = 30; + static s16 sStrayFairyIconIndex = 0; + static s16 sStrayFairyIconAlphaScaleTimer = 15; + static s16 sStrayFairyIconAlphaScaleState = 0; + static s16 sStrayFairyIconAlpha = 255; + static f32 sStrayFairyIconScale = 100.0f; + static TexturePtr sStrayFairyIconTextures[][4] = { + // DUNGEON_INDEX_WOODFALL_TEMPLE + { gStrayFairyWoodfallIconTex, gDungeonStrayFairyWoodfallIconTex, gStrayFairyWoodfallIconTex, + gDungeonStrayFairyWoodfallIconTex }, + // DUNGEON_INDEX_SNOWHEAD_TEMPLE + { gStrayFairySnowheadIconTex, gDungeonStrayFairySnowheadIconTex, gStrayFairySnowheadIconTex, + gDungeonStrayFairySnowheadIconTex }, + // DUNGEON_INDEX_GREAT_BAY_TEMPLE + { gStrayFairyGreatBayIconTex, gDungeonStrayFairyGreatBayIconTex, gStrayFairyGreatBayIconTex, + gDungeonStrayFairyGreatBayIconTex }, + // DUNGEON_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 + }; + 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 + }; + static s32 sStrayFairyIconRectS[] = { + 1 << 10, // mirror texture horizontally + 0, // default + 0, // default + 0 // default + }; + PauseContext* pauseCtx = &play->pauseCtx; + s16 i; + s16 j; + f32 scale; + + OPEN_DISPS(play->state.gfxCtx); + + j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4); + KaleidoScope_SetCursorVtx(pauseCtx, j, pauseCtx->mapPageVtx); + + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + if (pauseCtx->cursorSpecialPos == 0) { + if (pauseCtx->cursorPoint[PAUSE_MAP] <= DUNGEON_STRAY_FAIRIES) { + pauseCtx->cursorItem[PAUSE_MAP] = ITEM_KEY_BOSS + pauseCtx->cursorPoint[PAUSE_MAP]; + } + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP]; + } + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[60], 16, 0); + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA); + + POLY_OPA_DISP = + func_8010DC58(POLY_OPA_DISP, sDungeonTitleTextures[((void)0, gSaveContext.dungeonIndex)], 128, 16, 0); + + gDPPipeSync(POLY_OPA_DISP++); + + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + // Loop over dungeonItems (i) and vtxIndex (j) + for (i = DUNGEON_BOSS_KEY, j = 4; i <= DUNGEON_STRAY_FAIRIES; i++, j += 4) { + if (i == DUNGEON_STRAY_FAIRIES) { + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->unk_200 == 0)) { + // If (pauseCtx->state == 6), then the other conditions are redundant and + // always return true + if ((pauseCtx->state == 6) && (pauseCtx->state != 7) && + !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f); + + if (!sStrayFairyIconAlphaScaleState) { + sStrayFairyIconAlpha -= 6; + sStrayFairyIconScale -= 1.0f; + } else { + sStrayFairyIconAlpha += 6; + sStrayFairyIconScale += 1.0f; + } + + sStrayFairyIconAlphaScaleTimer--; + if (sStrayFairyIconAlphaScaleTimer == 0) { + sStrayFairyIconAlphaScaleState ^= 1; + sStrayFairyIconAlphaScaleTimer = 15; + } + + func_8012C8AC(play->state.gfxCtx); + + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, + 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); + + scale = sStrayFairyIconScale / 100.0f; + + Matrix_Translate(-83.0f, -29.0f, -128.0f, MTXMODE_NEW); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + pauseCtx->mapPageVtx[76].v.ob[0] = pauseCtx->mapPageVtx[78].v.ob[0] = -16; + + pauseCtx->mapPageVtx[77].v.ob[0] = pauseCtx->mapPageVtx[79].v.ob[0] = + pauseCtx->mapPageVtx[76].v.ob[0] + 32; + + pauseCtx->mapPageVtx[76].v.ob[1] = pauseCtx->mapPageVtx[77].v.ob[1] = 12; + + pauseCtx->mapPageVtx[78].v.ob[1] = pauseCtx->mapPageVtx[79].v.ob[1] = + pauseCtx->mapPageVtx[76].v.ob[1] - 24; + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[76], 4, 0); + + POLY_OPA_DISP = + func_8010DE38(POLY_OPA_DISP, gStrayFairyGlowingCircleIconTex, G_IM_FMT_I, 32, 24, 0); + KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); + func_8012C628(play->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, sStrayFairyIconAlpha); + + sStrayFairyIconTimer--; + + if (sStrayFairyIconTimer == 0) { + sStrayFairyIconIndex = (sStrayFairyIconIndex + 1) & 3; + sStrayFairyIconTimer = 34; + } + + gDPLoadTextureBlock( + POLY_OPA_DISP++, + sStrayFairyIconTextures[((void)0, gSaveContext.dungeonIndex)][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, + sStrayFairyIconRectS[sStrayFairyIconIndex], 0, 1 << 10, 1 << 10); + + KaleidoScope_DrawDungeonStrayFairyCount(play); + func_8012C8AC(play->state.gfxCtx); + } + } + } else if (CHECK_DUNGEON_ITEM(i, gSaveContext.dungeonIndex)) { + 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); + + gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0); + } + } + + func_80108AF8(play); + + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->unk_200 == 0)) { + // If (pauseCtx->state == 6), then the other conditions are redundant and always return + // true + if ((pauseCtx->state == 6) && (pauseCtx->state != 7) && + !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + + func_8012C628(play->state.gfxCtx); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + // Draw Player's face next to the dungeon floor icon currently in. + POLY_OPA_DISP = func_8010CB80(POLY_OPA_DISP, &D_09007500, 16, 16, 62, + sDungeonMapFloorIconPosY[R_REVERSE_FLOOR_INDEX], 16, 16, 1 << 10, 1 << 10); + + if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.dungeonIndex)) { + POLY_OPA_DISP = func_8010CB80(POLY_OPA_DISP, gDungeonMapSkullTex, 16, 16, 108, + sDungeonMapFloorIconPosY[FLOOR_INDEX_MAX - func_80105318()], 16, 16, + 1 << 10, 1 << 10); + } + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + func_8012C8AC(play->state.gfxCtx); + } + } + + gDPPipeSync(POLY_OPA_DISP++); + + gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void KaleidoScope_UpdateDungeonCursor(PlayState* play) { + s32 pad; + PauseContext* pauseCtx = &play->pauseCtx; + MessageContext* msgCtx = &play->msgCtx; + s16 i; + s16 oldCursorPoint; + + if (pauseCtx->state == 6) { + if ((pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { + pauseCtx->cursorColorSet = 0; + oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MAP]; + if (pauseCtx->stickAdjX > 30) { + pauseCtx->unk_298 = 4.0f; + if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { + func_80821A04(play); + pauseCtx->cursorXIndex[PAUSE_MAP] = 0; + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->unk_256; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256; + } else if (pauseCtx->cursorSpecialPos == 0) { + if (pauseCtx->cursorXIndex[PAUSE_MAP] == 0) { + pauseCtx->cursorXIndex[PAUSE_MAP] = 1; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + } else { + if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES) { + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_NONE; + } + + while (true) { + pauseCtx->cursorPoint[PAUSE_MAP]++; + if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + break; + } + if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + break; + } + } + } + } + } else if (pauseCtx->stickAdjX < -30) { + pauseCtx->unk_298 = 4.0f; + if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) { + func_80821A04(play); + pauseCtx->cursorXIndex[PAUSE_MAP] = 1; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_MAP; + if (!CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.dungeonIndex)) { + pauseCtx->cursorPoint[PAUSE_MAP]--; // DUNGEON_COMPASS + if (!CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.dungeonIndex)) { + pauseCtx->cursorPoint[PAUSE_MAP]--; // DUNGEON_BOSS_KEY + if (!CHECK_DUNGEON_ITEM(DUNGEON_BOSS_KEY, gSaveContext.dungeonIndex)) { + pauseCtx->cursorSlot[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + } + } + } else { + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP]; + } + } else if (pauseCtx->cursorSpecialPos == 0) { + if (pauseCtx->cursorXIndex[PAUSE_MAP] == 0) { + 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; + } else { + while (true) { + pauseCtx->cursorPoint[PAUSE_MAP]--; + if (pauseCtx->cursorPoint[PAUSE_MAP] <= DUNGEON_NONE) { + pauseCtx->cursorSlot[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + break; + } + if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + break; + } + } + } + } + } 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.permanentSceneFlags[(void)0, gSaveContext.dungeonIndex].unk_14 & + gBitFlags[i]) || + func_801090B0(FLOOR_INDEX_MAX - i)) { + pauseCtx->cursorPoint[PAUSE_MAP] = i + DUNGEON_FLOOR_INDEX_4; + pauseCtx->unk_298 = 4.0f; + break; + } + } + } 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; + } else { + pauseCtx->cursorSlot[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + } + } else if ((pauseCtx->cursorSpecialPos == 0) && (pauseCtx->stickAdjY < -30)) { + if ((pauseCtx->cursorPoint[PAUSE_MAP] >= DUNGEON_FLOOR_INDEX_4) && + (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.permanentSceneFlags[(void)0, gSaveContext.dungeonIndex].unk_14 & + gBitFlags[i]) || + func_801090B0(FLOOR_INDEX_MAX - i)) { + pauseCtx->cursorPoint[PAUSE_MAP] = i + DUNGEON_FLOOR_INDEX_4; + pauseCtx->unk_298 = 4.0f; + break; + } + } + + } else if (pauseCtx->cursorXIndex[PAUSE_MAP] == 0) { + pauseCtx->cursorXIndex[PAUSE_MAP] = 1; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + } else { + if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES) { + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_NONE; + } + + while (true) { + pauseCtx->cursorPoint[PAUSE_MAP]++; + if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_FLOOR_INDEX_4) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + break; + } + if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + break; + } + } + } + } + if ((pauseCtx->cursorPoint[PAUSE_MAP] <= DUNGEON_STRAY_FAIRIES) && (pauseCtx->cursorSpecialPos == 0)) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_A] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + } else if (gSaveContext.buttonStatus[EQUIP_SLOT_A] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_DISABLED; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + + if ((pauseCtx->cursorXIndex[PAUSE_MAP] == 0) && (pauseCtx->cursorSpecialPos == 0)) { + pauseCtx->unk_256 = pauseCtx->cursorPoint[PAUSE_MAP]; + } + + if (pauseCtx->cursorSpecialPos == 0) { + if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) && (msgCtx->msgLength == 0) && + (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES)) { + 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)) { + pauseCtx->itemDescriptionOn = true; + func_801514B0(play, 0x17AC + pauseCtx->cursorPoint[PAUSE_MAP], 1); + } + } + + if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_MAP]) { + play_sound(NA_SE_SY_CURSOR); + } + } + } +} + +TexturePtr sCloudTextures[] = { + gWorldMapClockTownCloud1Tex, // TINGLE_MAP_CLOCK_TOWN + gWorldMapClockTownCloud2Tex, // TINGLE_MAP_CLOCK_TOWN + gWorldMapWoodfallCloud1Tex, // TINGLE_MAP_WOODFALL + gWorldMapWoodfallCloud2Tex, // TINGLE_MAP_WOODFALL + gWorldMapWoodfallCloud3Tex, // TINGLE_MAP_WOODFALL + gWorldMapSnowheadCloud1Tex, // TINGLE_MAP_SNOWHEAD + gWorldMapSnowheadCloud2Tex, // TINGLE_MAP_SNOWHEAD + gWorldMapSnowheadCloud3Tex, // TINGLE_MAP_SNOWHEAD + gWorldMapRomaniRanchCloudTex, // TINGLE_MAP_ROMANI_RANCH + gWorldMapGreatBayCloud1Tex, // TINGLE_MAP_GREAT_BAY + gWorldMapGreatBayCloud2Tex, // TINGLE_MAP_GREAT_BAY + gWorldMapGreatBayCloud3Tex, // TINGLE_MAP_GREAT_BAY + gWorldMapGreatBayCloud4Tex, // TINGLE_MAP_GREAT_BAY + gWorldMapStoneTowerCloud1Tex, // TINGLE_MAP_STONE_TOWER + gWorldMapStoneTowerCloud2Tex, // TINGLE_MAP_STONE_TOWER }; -s32 D_8082B520[] = { - 0xFF6EA05A, - 0xFF6478FF, - 0xFFF5F55A, +s16 sWorldMapDotPrimColors[][3] = { + { 0, 0, 255 }, + { 255, 255, 0 }, +}; +s16 sWorldMapDotEnvColors[][3] = { + { 255, 255, 0 }, + { 0, 0, 255 }, }; -s32 D_8082B52C[] = { - 0xFFFFFFFF, - 0xFFFFFFFF, - 0xFFE1AA00, +s16 sWorldMapCursorsRectLeft[REGION_MAX] = { + 86, // REGION_GREAT_BAY + 104, // REGION_ZORA_HALL + 145, // REGION_ROMANI_RANCH + 153, // REGION_DEKU_PALACE + 163, // REGION_WOODFALL + 159, // REGION_CLOCK_TOWN + 157, // REGION_SNOWHEAD + 199, // REGION_IKANA_GRAVEYARD + 208, // REGION_IKANA_CANYON + 210, // REGION_GORON_VILLAGE + 218, // REGION_STONE_TOWER }; -s32 D_8082B538[] = { - 0x00000400, - 0x00000000, - 0x00000000, - 0x00000000, +s16 sWorldMapCursorsRectTop[REGION_MAX] = { + 127, // REGION_GREAT_BAY + 153, // REGION_ZORA_HALL + 138, // REGION_ROMANI_RANCH + 171, // REGION_DEKU_PALACE + 146, // REGION_WOODFALL + 119, // REGION_CLOCK_TOWN + 77, // REGION_SNOWHEAD + 106, // REGION_IKANA_GRAVEYARD + 120, // REGION_IKANA_CANYON + 73, // REGION_GORON_VILLAGE + 99, // REGION_STONE_TOWER }; -s16 D_8082B548[] = { - 0x0C00, 0x8418, 0x0C00, 0x9098, 0x0C01, 0x2898, 0x0C01, 0x35D8, 0x0C01, 0x4318, - 0x0C00, 0xDE58, 0x0C00, 0xEB58, 0x0C00, 0xFAA8, 0x0C00, 0x9858, 0x0C00, 0x9E58, - 0x0C00, 0xAE58, 0x0C00, 0xBE58, 0x0C00, 0xCE58, 0x0C01, 0x09F8, 0x0C01, 0x1958, +s16 sGreatFairySpawnRegions[] = { + REGION_CLOCK_TOWN, REGION_WOODFALL, REGION_SNOWHEAD, REGION_GREAT_BAY, REGION_IKANA_CANYON, + REGION_CLOCK_TOWN, REGION_WOODFALL, REGION_SNOWHEAD, REGION_GREAT_BAY, REGION_IKANA_CANYON, }; -s16 D_8082B584[] = { - 0x0000, 0x0000, 0x00FF, 0x00FF, 0x00FF, 0x0000, +void KaleidoScope_DrawWorldMap(PlayState* play) { + s16 sceneId; + s16 t; + s16 n; + s16 j; + s16 k; + s16 i; + PauseContext* pauseCtx = &play->pauseCtx; + s16 rectLeft; + s16 rectRight; + + OPEN_DISPS(play->state.gfxCtx); + + KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx); + + // Draw the world map image + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->state == 6) && + ((pauseCtx->unk_200 == 0) || (pauseCtx->unk_200 == 3)) && YREG(6) && (pauseCtx->state != 7) && + !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + + // Draw the world map image flat + // Because it is flat, the texture is loaded by filling it in 8 rows at a time. + // 8 is chosen because it is smaller than `TMEM_SIZE / 2 / textureWidth` and divides the texture's height. + // Each loaded chunk must have `size <= TMEM_SIZE / 2` + // because the texture is color-indexed, so the TLUT uses the other half of TMEM. + + func_8012C628(play->state.gfxCtx); + + gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT); + gDPLoadTLUT_pal256(POLY_OPA_DISP++, gWorldMapImageTLUT); + gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + // Process the 128 rows of pixels for gWorldMapImageTex, 8 rows at a time over 16 iterations + // Loop over yPos (t), textureIndex (j) + for (t = 62, j = 0; j < 16; j++, t += 8) { + gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + j * (WORLD_MAP_IMAGE_TEX_WIDTH * 8), + G_IM_FMT_CI, G_IM_SIZ_8b, WORLD_MAP_IMAGE_TEX_WIDTH, 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); + + rectLeft = 51 << 2; + rectRight = rectLeft + (WORLD_MAP_IMAGE_TEX_WIDTH << 2); + gSPTextureRectangle(POLY_OPA_DISP++, rectLeft, t << 2, rectRight, (t << 2) + (8 << 2), G_TX_RENDERTILE, 0, + 0, 1 << 10, 1 << 10); + } + + func_8012C8AC(play->state.gfxCtx); + + } else { + // Draw the world map angled + // Because it is at an angle, vertices are used to place it. + // The structure of the loops here is to satisfy the constraints of both TMEM and the size of the vertex cache. + // - Each loop iteration loads 9 rows, because 9 is the largest number smaller than + // `TMEM_SIZE / 2 / textureWidth`. + // - Each loop is at most 8 iterations long because each row uses 4 vertices and the vertex cache has size + // `32 = 8 * 4`. + // . + // Hence there is one loop of length 8, one of length 6, and then the remaining `128 - (8 + 6) * 9 = 2` rows are + // drawn at the end. + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT); + gDPLoadTLUT_pal256(POLY_OPA_DISP++, gWorldMapImageTLUT); + gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + // Set the vertices for the first 8 quads attached to the world map texture. + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[204], 8 * 4, 0); + + // Process the first 72 rows of pixels for gWorldMapImageTex, 9 rows at a time over 8 iterations + // Loop over quadIndex of this loop (i), quadIndex of the entire texture (k), vtxIndex (j) + for (i = 0, k = 0, j = 0; i < 8; i++, k++, j += 4) { + gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + k * (WORLD_MAP_IMAGE_TEX_WIDTH * 9), + G_IM_FMT_CI, G_IM_SIZ_8b, WORLD_MAP_IMAGE_TEX_WIDTH, 9, 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); + + gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0); + } + + // Set the vertices for the last 7 quads attached to the world map texture: + // 6 quads with a height of 9, 1 quad with a height of 2 + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[236], (6 + 1) * 4, 0); + + // Process the next 54 rows of pixels for gWorldMapImageTex, 9 rows at a time over 6 iterations + // Loop over quadIndex of this loop (i), quadIndex of the entire texture (k), vtxIndex (j) + for (i = 0, j = 0; i < 6; i++, k++, j += 4) { + gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + k * (WORLD_MAP_IMAGE_TEX_WIDTH * 9), + G_IM_FMT_CI, G_IM_SIZ_8b, WORLD_MAP_IMAGE_TEX_WIDTH, 9, 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); + + gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0); + } + + // Process the last 2 rows of pixels for gWorldMapImageTex + gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + k * (WORLD_MAP_IMAGE_TEX_WIDTH * 9), G_IM_FMT_CI, + G_IM_SIZ_8b, WORLD_MAP_IMAGE_TEX_WIDTH, 2, 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); + + gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0); + } + + func_8012C8AC(play->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + + gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP); + + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, + ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 215, 235, 235, pauseCtx->alpha); + gDPSetEnvColor(POLY_OPA_DISP++, 40, 60, 100, 0); + + // Draw clouds over the world map + // Iterate over cloud bits (n) + for (n = 0; n < 15; n++) { + if (!(((void)0, gSaveContext.save.worldMapCloudVisibility) & gBitFlags[n])) { + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[60 + n * 4], 4, 0); + + POLY_OPA_DISP = func_8010DC58(POLY_OPA_DISP, sCloudTextures[n], D_8082B7F0[n], D_8082B838[n], 0); + } + } + + if ((pauseCtx->state >= 0x15) && (pauseCtx->state <= 0x19)) { + gDPPipeSync(POLY_OPA_DISP++); + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, R_PAUSE_OWLWARP_ALPHA); + gDPFillRectangle(POLY_OPA_DISP++, 50, 62, 270, 190); + } + + func_8012C8AC(play->state.gfxCtx); + + if (!((pauseCtx->state >= 0x15) && (pauseCtx->state <= 0x19))) { + // Browsing the world map regions on the pause menu + gDPLoadTextureBlock(POLY_OPA_DISP++, gWorldMapDotTex, 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); + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWorldMapDotPrimColors[0][0], sWorldMapDotPrimColors[0][1], + sWorldMapDotPrimColors[0][2], pauseCtx->alpha); + gDPSetEnvColor(POLY_OPA_DISP++, sWorldMapDotEnvColors[0][0], sWorldMapDotEnvColors[0][1], + sWorldMapDotEnvColors[0][2], 0); + + if (R_PAUSE_DBG_MAP_CLOUD_ON) { + gSaveContext.save.worldMapCloudVisibility |= (u16)~0x8000; + + pauseCtx->mapPageVtx[120].v.ob[0] = pauseCtx->mapPageVtx[122].v.ob[0] = R_PAUSE_DBG_MAP_CLOUD_X; + + pauseCtx->mapPageVtx[121].v.ob[0] = pauseCtx->mapPageVtx[123].v.ob[0] = + pauseCtx->mapPageVtx[120].v.ob[0] + 8; + + pauseCtx->mapPageVtx[120].v.ob[1] = pauseCtx->mapPageVtx[121].v.ob[1] = R_PAUSE_DBG_MAP_CLOUD_Y; + + pauseCtx->mapPageVtx[122].v.ob[1] = pauseCtx->mapPageVtx[123].v.ob[1] = + pauseCtx->mapPageVtx[120].v.ob[1] - 8; + } + + // Loop over RegionId (i), unused vtxIndex (j), unused (k) + for (i = 0, j = 0; i < REGION_MAX; i++, k++, j += 4) { + if (pauseCtx->worldMapPoints[i]) { + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[120 + i * 4], 4, 0); + gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); + } + } + + } else { + // Selecting an owl warp + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPLoadTextureBlock(POLY_OPA_DISP++, gWorldMapOwlFaceTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 12, 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); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + if (R_PAUSE_DBG_MAP_CLOUD_ON) { + gSaveContext.save.worldMapCloudVisibility |= (u16)~0x8000; + + pauseCtx->mapPageVtx[164].v.ob[0] = pauseCtx->mapPageVtx[166].v.ob[0] = R_PAUSE_DBG_MAP_CLOUD_X; + + pauseCtx->mapPageVtx[165].v.ob[0] = pauseCtx->mapPageVtx[167].v.ob[0] = + pauseCtx->mapPageVtx[164].v.ob[0] + 24; + + pauseCtx->mapPageVtx[164].v.ob[1] = pauseCtx->mapPageVtx[165].v.ob[1] = R_PAUSE_DBG_MAP_CLOUD_Y; + + pauseCtx->mapPageVtx[166].v.ob[1] = pauseCtx->mapPageVtx[167].v.ob[1] = + pauseCtx->mapPageVtx[164].v.ob[1] - 12; + } + + // Loop over OwlWarpId (i), unused vtxIndex (j), unused (k) + for (i = 0, j = 0; i < OWL_WARP_ENTRANCE; i++, k++, j += 4) { + if (pauseCtx->worldMapPoints[i]) { + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[164 + i * 4], 4, 0); + gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); + } + } + } + + // Find and draw Player's face at the current region based on the current scene + // If (pauseCtx->state == 6), then the other pauseCtx->state conditions are redundant + // and always return true + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->unk_200 == 0) && (pauseCtx->state == 6) && + (pauseCtx->state != 7) && !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + j = 0; + n = 0; + + sceneId = play->sceneId; + + // Map grottos/shrines to sceneId's to be used in different regions + if (sceneId == SCENE_KAKUSIANA) { + if (play->roomCtx.curRoom.num == 5) { + sceneId = SCENE_11GORONNOSATO; + } else if ((play->roomCtx.curRoom.num == 6) || (play->roomCtx.curRoom.num == 8) || + (play->roomCtx.curRoom.num == 12)) { + sceneId = SCENE_22DEKUCITY; + } else { + sceneId = Entrance_GetSceneIdAbsolute(((void)0, gSaveContext.respawn[RESPAWN_MODE_UNK_3].entrance)); + } + } + + // Find the regionId that player is currently in + // Loop over regionId (n) and regionIdIndex (j) + while (true) { + if ((gSceneIdsPerRegion[n][j] == 0xFFFF)) { + n++; + j = 0; + if (n == REGION_MAX) { + n = 0; + + // Special case for fairy fountains + if (sceneId == SCENE_YOUSEI_IZUMI) { + j = play->curSpawn; + n = sGreatFairySpawnRegions[j]; + break; + } + + while (true) { + if (gSceneIdsPerRegion[n][j] == 0xFFFF) { + n++; + if (n == REGION_MAX) { + break; + } + j = 0; + if (Entrance_GetSceneIdAbsolute( + ((void)0, gSaveContext.respawn[RESPAWN_MODE_UNK_3].entrance)) == + gSceneIdsPerRegion[n][j]) { + break; + } + } + j++; + } + break; + } + } + + if (sceneId == gSceneIdsPerRegion[n][j]) { + break; + } + j++; + } + + // Draw Player's face at the current region + if (n != REGION_MAX) { + KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); + func_8012C628(play->state.gfxCtx); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + POLY_OPA_DISP = func_8010CB80(POLY_OPA_DISP, &D_09007500, 16, 16, sWorldMapCursorsRectLeft[n], + sWorldMapCursorsRectTop[n], 16, 16, 1 << 10, 1 << 10); + } + } + + gDPPipeSync(POLY_OPA_DISP++); + + CLOSE_DISPS(play->state.gfxCtx); +} + +u16 sOwlWarpPauseItems[] = { + 0xAF, // OWL_WARP_GREAT_BAY_COAST + 0xB3, // OWL_WARP_ZORA_CAPE + 0xAA, // OWL_WARP_SNOWHEAD + 0xB1, // OWL_WARP_MOUNTAIN_VILLAGE + 0xA9, // OWL_WARP_CLOCK_TOWN + 0xB2, // OWL_WARP_MILK_ROAD + 0xA8, // OWL_WARP_WOODFALL + 0xB0, // OWL_WARP_SOUTHERN_SWAMP + 0xAC, // OWL_WARP_IKANA_CANYON + 0xAE, // OWL_WARP_STONE_TOWER }; -s16 D_8082B590[] = { - 0x00FF, 0x00FF, 0x0000, 0x0000, 0x0000, 0x00FF, -}; +void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { + static u16 sStickAdjTimer = 0; // unused timer that counts up every frame. Resets on reading a stickAdj. + PauseContext* pauseCtx = &play->pauseCtx; + s16 oldCursorPoint; -s16 D_8082B59C[] = { - 0x0056, 0x0068, 0x0091, 0x0099, 0x00A3, 0x009F, 0x009D, 0x00C7, 0x00D0, 0x00D2, 0x00DA, 0x0000, -}; + if ((pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { + pauseCtx->cursorColorSet = 0; + oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; -s16 D_8082B5B4[] = { - 0x007F, 0x0099, 0x008A, 0x00AB, 0x0092, 0x0077, 0x004D, 0x006A, 0x0078, 0x0049, 0x0063, 0x0000, -}; + if (gSaveContext.buttonStatus[EQUIP_SLOT_A] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_DISABLED; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } -s16 D_8082B5CC[] = { - 0x0005, 0x0004, 0x0006, 0x0000, 0x0008, 0x0005, 0x0004, 0x0006, 0x0000, 0x0008, -}; + if (pauseCtx->cursorSpecialPos == 0) { + if (pauseCtx->stickAdjX > 30) { + pauseCtx->unk_298 = 4.0f; + sStickAdjTimer = 0; -u16 D_8082B5E0[] = { - 0xAF, 0xB3, 0xAA, 0xB1, 0xA9, 0xB2, 0xA8, 0xB0, 0xAC, 0xAE, -}; -u16 D_8082B5F4 = 0; + while (true) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] >= REGION_MAX) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + break; + } + if (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) { + break; + } + } + } else if (pauseCtx->stickAdjX < -30) { + pauseCtx->unk_298 = 4.0f; + sStickAdjTimer = 0; -s32 D_8082B5F8[] = { 0, 0 }; + while (true) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < REGION_GREAT_BAY) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + break; + } + if (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) { + break; + } + } + } else { + sStickAdjTimer++; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081D240.s") + if (pauseCtx->cursorSpecialPos == 0) { + pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + // Used as cursor vtxIndex + pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + } + } else { + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { + if (pauseCtx->stickAdjX > 30) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = -1; + pauseCtx->cursorSpecialPos = 0; + pauseCtx->unk_298 = 4.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081D6DC.s") + while (true) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] > REGION_STONE_TOWER) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + break; + } + if (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) { + break; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081E118.s") + if (pauseCtx->cursorSpecialPos == 0) { + pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + // Used as cursor vtxIndex + pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + } + play_sound(NA_SE_SY_CURSOR); + sStickAdjTimer = 0; + } + } else if (pauseCtx->stickAdjX < -30) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 11; + pauseCtx->cursorSpecialPos = 0; + pauseCtx->unk_298 = 4.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081E7D8.s") + while (true) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < 0) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + break; + } + if (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) { + break; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081FB1C.s") + if (pauseCtx->cursorSpecialPos == 0) { + pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + // Used as cursor vtxIndex + pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + } + play_sound(NA_SE_SY_CURSOR); + sStickAdjTimer = 0; + } + } + + if (!pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) { + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + } + if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_WORLD_MAP]) { + play_sound(NA_SE_SY_CURSOR); + } + } else if (pauseCtx->state == 0x17) { + pauseCtx->cursorColorSet = 4; + oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + + if (pauseCtx->stickAdjX > 30) { + pauseCtx->unk_298 = 4.0f; + sStickAdjTimer = 0; + do { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] > OWL_WARP_STONE_TOWER) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = OWL_WARP_GREAT_BAY_COAST; + } + } while (!pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]); + } else if (pauseCtx->stickAdjX < -30) { + pauseCtx->unk_298 = 4.0f; + sStickAdjTimer = 0; + do { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < OWL_WARP_GREAT_BAY_COAST) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = OWL_WARP_STONE_TOWER; + } + } while (!pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]); + } else { + sStickAdjTimer++; + } + + //! TODO: Is the `0xA4` here related to `0xA3` being the last recored item in the `ItemId` enum? + pauseCtx->cursorItem[PAUSE_MAP] = sOwlWarpPauseItems[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] - 0xA4; + // Used as cursor vtxIndex + pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + + if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_WORLD_MAP]) { + play_sound(NA_SE_SY_CURSOR); + } + } +} diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h index 94724154f9..72392390b2 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h @@ -51,9 +51,16 @@ typedef enum { // NES void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, s16 cursorSpecialPos); -void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, u16 width, u16 height, u16 point); +void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, TexturePtr texture, u16 width, u16 height, u16 point); +void KaleidoScope_SetView(PauseContext* pauseCtx, f32 x, f32 y, f32 z); void func_80821A04(PlayState* play); +// Map +void KaleidoScope_DrawDungeonMap(PlayState* play); +void KaleidoScope_UpdateDungeonCursor(PlayState* play); +void KaleidoScope_DrawWorldMap(PlayState* play); +void KaleidoScope_UpdateWorldMapCursor(PlayState* play); + // Item void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx); void KaleidoScope_DrawItemSelect(PlayState* play); 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 3b3de5937a..6c6754b3d7 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 @@ -345,7 +345,7 @@ s32 D_8082BEB8[] = { 0, 0 }; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8082585C.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808259D4.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_SetView.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80825A50.s") diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 260e868ca1..5255a72e90 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2410,7 +2410,7 @@ 0x8012ED78:("Inventory_DeleteEquipment",), 0x8012EDE8:("Inventory_ChangeUpgrade",), 0x8012EE34:("Inventory_IsMapVisible",), - 0x8012EF0C:("Inventory_SetMapVisibility",), + 0x8012EF0C:("Inventory_SetWorldMapCloudVisibility",), 0x8012F0EC:("Inventory_SaveDekuPlaygroundHighScore",), 0x8012F1BC:("Inventory_IncrementSkullTokenCount",), 0x8012F22C:("Inventory_GetSkullTokenCount",), @@ -2452,7 +2452,7 @@ 0x80130540:("Scene_HeaderCmdMiniMap",), 0x80130578:("Scene_HeaderCmd1D",), 0x80130588:("Scene_HeaderCmdMiniMapCompassInfo",), - 0x801305B0:("Scene_HeaderCmdSetAreaVisitedFlag",), + 0x801305B0:("Scene_HeaderCmdSetRegionVisitedFlag",), 0x80130674:("Scene_HeaderCmdAnimatedMaterials",), 0x801306A4:("Scene_SetExitFade",), 0x801306E8:("Scene_ProcessHeader",), @@ -2880,7 +2880,7 @@ 0x80158C04:("Message_LoadLocalizedRupeesNES",), 0x80158D98:("Message_LoadRupeesNES",), 0x80158FB0:("Message_LoadTimeNES",), - 0x8015926C:("Message_LoadAreaTextNES",), + 0x8015926C:("Message_LoadOwlWarpTextNES",), 0x80159438:("func_80159438",), 0x8015966C:("func_8015966C",), 0x8015B198:("func_8015B198",), @@ -4209,11 +4209,11 @@ 0x8081B6EC:("KaleidoScope_DrawItemSelect",), 0x8081BCA8:("KaleidoScope_UpdateItemCursor",), 0x8081C684:("KaleidoScope_UpdateItemEquip",), - 0x8081D240:("func_8081D240",), - 0x8081D6DC:("func_8081D6DC",), - 0x8081E118:("func_8081E118",), - 0x8081E7D8:("func_8081E7D8",), - 0x8081FB1C:("func_8081FB1C",), + 0x8081D240:("KaleidoScope_DrawDungeonStrayFairyCount",), + 0x8081D6DC:("KaleidoScope_DrawDungeonMap",), + 0x8081E118:("KaleidoScope_UpdateDungeonCursor",), + 0x8081E7D8:("KaleidoScope_DrawWorldMap",), + 0x8081FB1C:("KaleidoScope_UpdateWorldMapCursor",), 0x8081FF80:("KaleidoScope_DrawMaskSelect",), 0x808204AC:("KaleidoScope_UpdateMaskCursor",), 0x80820FA4:("KaleidoScope_UpdateMaskEquip",), @@ -4234,7 +4234,7 @@ 0x80824B90:("func_80824B90",), 0x808256E4:("func_808256E4",), 0x8082585C:("func_8082585C",), - 0x808259D4:("func_808259D4",), + 0x808259D4:("KaleidoScope_SetView",), 0x80825A50:("func_80825A50",), 0x80825E28:("func_80825E28",), 0x808274DC:("func_808274DC",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 71fdb0975c..255afb7a9d 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -4703,28 +4703,28 @@ 0x8082B484:("sCButtonPosX","UNK_TYPE1","",0x1), 0x8082B48C:("sCButtonPosY","UNK_TYPE1","",0x1), 0x8082B494:("sEquipMagicArrowBowSlotHoldTimer","UNK_TYPE2","",0x2), - 0x8082B4A0:("D_8082B4A0","UNK_TYPE4","",0x4), - 0x8082B4AC:("D_8082B4AC","UNK_TYPE1","",0x1), - 0x8082B4BC:("D_8082B4BC","UNK_TYPE1","",0x1), + 0x8082B4A0:("sDungeonItemTextures","UNK_TYPE4","",0x4), + 0x8082B4AC:("sDungeonTitleTextures","UNK_TYPE1","",0x1), + 0x8082B4BC:("sDungeonMapFloorIconPosY","UNK_TYPE1","",0x1), 0x8082B4C4:("D_8082B4C4","UNK_TYPE1","",0x1), - 0x8082B4C8:("D_8082B4C8","UNK_TYPE2","",0x2), - 0x8082B4CC:("D_8082B4CC","UNK_TYPE2","",0x2), - 0x8082B4D0:("D_8082B4D0","UNK_TYPE2","",0x2), - 0x8082B4D4:("D_8082B4D4","UNK_TYPE2","",0x2), - 0x8082B4D8:("D_8082B4D8","UNK_TYPE2","",0x2), - 0x8082B4DC:("D_8082B4DC","f32","",0x4), - 0x8082B4E0:("D_8082B4E0","UNK_TYPE1","",0x1), - 0x8082B520:("D_8082B520","UNK_TYPE1","",0x1), - 0x8082B52C:("D_8082B52C","UNK_TYPE1","",0x1), - 0x8082B538:("D_8082B538","UNK_TYPE1","",0x1), - 0x8082B548:("D_8082B548","s16","[30]",0x3C), - 0x8082B584:("D_8082B584","UNK_TYPE2","",0x2), - 0x8082B590:("D_8082B590","UNK_TYPE2","",0x2), - 0x8082B59C:("D_8082B59C","UNK_TYPE1","",0x1), - 0x8082B5B4:("D_8082B5B4","UNK_TYPE1","",0x1), - 0x8082B5CC:("D_8082B5CC","UNK_TYPE1","",0x1), - 0x8082B5E0:("D_8082B5E0","UNK_TYPE1","",0x1), - 0x8082B5F4:("D_8082B5F4","UNK_TYPE2","",0x2), + 0x8082B4C8:("sStrayFairyIconTimer","UNK_TYPE2","",0x2), + 0x8082B4CC:("sStrayFairyIconIndex","UNK_TYPE2","",0x2), + 0x8082B4D0:("sStrayFairyIconAlphaScaleTimer","UNK_TYPE2","",0x2), + 0x8082B4D4:("sStrayFairyIconAlphaScaleState","UNK_TYPE2","",0x2), + 0x8082B4D8:("sStrayFairyIconAlpha","UNK_TYPE2","",0x2), + 0x8082B4DC:("sStrayFairyIconScale","f32","",0x4), + 0x8082B4E0:("sStrayFairyIconTextures","UNK_TYPE1","",0x1), + 0x8082B520:("sStrayFairyIconPrimColors","UNK_TYPE1","",0x1), + 0x8082B52C:("sStrayFairyIconEnvColors","UNK_TYPE1","",0x1), + 0x8082B538:("sStrayFairyIconRectS","UNK_TYPE1","",0x1), + 0x8082B548:("sCloudTextures","s16","[30]",0x3C), + 0x8082B584:("sWorldMapDotPrimColors","UNK_TYPE2","",0x2), + 0x8082B590:("sWorldMapDotEnvColors","UNK_TYPE2","",0x2), + 0x8082B59C:("sWorldMapCursorsRectLeft","UNK_TYPE1","",0x1), + 0x8082B5B4:("sWorldMapCursorsRectTop","UNK_TYPE1","",0x1), + 0x8082B5CC:("sGreatFairySpawnRegions","UNK_TYPE1","",0x1), + 0x8082B5E0:("sOwlWarpPauseItems","UNK_TYPE1","",0x1), + 0x8082B5F4:("sStickAdjTimer","UNK_TYPE2","",0x2), 0x8082B600:("sMaskEquipState","UNK_TYPE2","",0x2), 0x8082B604:("sMaskEquipMagicArrowSlotHoldTimer","UNK_TYPE2","",0x2), 0x8082B608:("sMaskEquipAnimTimer","UNK_TYPE2","",0x2), diff --git a/tools/namefixer.py b/tools/namefixer.py index a5d13493b2..4f596ecef9 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -597,7 +597,7 @@ wordReplace = { "func_80158C04": "Message_LoadLocalizedRupeesNES", "func_80158D98": "Message_LoadRupeesNES", "func_80158FB0": "Message_LoadTimeNES", - "func_8015926C": "Message_LoadAreaTextNES", + "func_8015926C": "Message_LoadOwlWarpTextNES", "func_8015E750": "Message_FindCreditsMessage", "func_80133038": "Schedule_RunScript", diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml index bf61be3410..380acbfc2b 100644 --- a/tools/permuter_settings.toml +++ b/tools/permuter_settings.toml @@ -1,3 +1,5 @@ +compiler_type = "ido" + [preserve_macros] "g[DS]P.*" = "void" "gs[DS]P.*" = "void" diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index da49ac9694..310fbefd1a 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1924,7 +1924,7 @@ asm/non_matchings/code/code_8012EC80/Inventory_ChangeEquipment.s,Inventory_Chang asm/non_matchings/code/code_8012EC80/Inventory_DeleteEquipment.s,Inventory_DeleteEquipment,0x8012ED78,0x1C asm/non_matchings/code/code_8012EC80/Inventory_ChangeUpgrade.s,Inventory_ChangeUpgrade,0x8012EDE8,0x13 asm/non_matchings/code/code_8012EC80/Inventory_IsMapVisible.s,Inventory_IsMapVisible,0x8012EE34,0x36 -asm/non_matchings/code/code_8012EC80/Inventory_SetMapVisibility.s,Inventory_SetMapVisibility,0x8012EF0C,0x78 +asm/non_matchings/code/code_8012EC80/Inventory_SetWorldMapCloudVisibility.s,Inventory_SetWorldMapCloudVisibility,0x8012EF0C,0x78 asm/non_matchings/code/code_8012EC80/Inventory_SaveDekuPlaygroundHighScore.s,Inventory_SaveDekuPlaygroundHighScore,0x8012F0EC,0x34 asm/non_matchings/code/code_8012EC80/Inventory_IncrementSkullTokenCount.s,Inventory_IncrementSkullTokenCount,0x8012F1BC,0x1C asm/non_matchings/code/code_8012EC80/Inventory_GetSkullTokenCount.s,Inventory_GetSkullTokenCount,0x8012F22C,0x13 @@ -1966,7 +1966,7 @@ asm/non_matchings/code/z_scene/Scene_HeaderCmdActorCutsceneList.s,Scene_HeaderCm asm/non_matchings/code/z_scene/Scene_HeaderCmdMiniMap.s,Scene_HeaderCmdMiniMap,0x80130540,0xE asm/non_matchings/code/z_scene/Scene_HeaderCmd1D.s,Scene_HeaderCmd1D,0x80130578,0x4 asm/non_matchings/code/z_scene/Scene_HeaderCmdMiniMapCompassInfo.s,Scene_HeaderCmdMiniMapCompassInfo,0x80130588,0xA -asm/non_matchings/code/z_scene/Scene_HeaderCmdSetAreaVisitedFlag.s,Scene_HeaderCmdSetAreaVisitedFlag,0x801305B0,0x31 +asm/non_matchings/code/z_scene/Scene_HeaderCmdSetRegionVisitedFlag.s,Scene_HeaderCmdSetRegionVisitedFlag,0x801305B0,0x31 asm/non_matchings/code/z_scene/Scene_HeaderCmdAnimatedMaterials.s,Scene_HeaderCmdAnimatedMaterials,0x80130674,0xC asm/non_matchings/code/z_scene/Scene_SetExitFade.s,Scene_SetExitFade,0x801306A4,0x11 asm/non_matchings/code/z_scene/Scene_ProcessHeader.s,Scene_ProcessHeader,0x801306E8,0x20 @@ -2394,7 +2394,7 @@ asm/non_matchings/code/z_message_nes/Message_LoadPluralRupeesNES.s,Message_LoadP asm/non_matchings/code/z_message_nes/Message_LoadLocalizedRupeesNES.s,Message_LoadLocalizedRupeesNES,0x80158C04,0x65 asm/non_matchings/code/z_message_nes/Message_LoadRupeesNES.s,Message_LoadRupeesNES,0x80158D98,0x86 asm/non_matchings/code/z_message_nes/Message_LoadTimeNES.s,Message_LoadTimeNES,0x80158FB0,0xAF -asm/non_matchings/code/z_message_nes/Message_LoadAreaTextNES.s,Message_LoadAreaTextNES,0x8015926C,0x73 +asm/non_matchings/code/z_message_nes/Message_LoadOwlWarpTextNES.s,Message_LoadOwlWarpTextNES,0x8015926C,0x73 asm/non_matchings/code/z_message_nes/func_80159438.s,func_80159438,0x80159438,0x8D asm/non_matchings/code/z_message_nes/func_8015966C.s,func_8015966C,0x8015966C,0x6CB asm/non_matchings/code/z_message_nes/func_8015B198.s,func_8015B198,0x8015B198,0xD6E