diff --git a/asm/non_matching/playerUtils/sub_080784E4.inc b/asm/non_matching/playerUtils/sub_080784E4.inc index 109b7fd3..40c47409 100644 --- a/asm/non_matching/playerUtils/sub_080784E4.inc +++ b/asm/non_matching/playerUtils/sub_080784E4.inc @@ -88,13 +88,13 @@ _080785B0: ands r0, r1 cmp r0, #0 bne _080785F0 - bl HasDungeonMap + bl HasDungeonSmallKey cmp r0, #0 beq _080785C4 movs r0, #1 _080785C4: adds r7, r0, #0 - bl HasDungeonCompass + bl HasDungeonBigKey cmp r0, #0 beq _080785D2 movs r0, #2 diff --git a/include/game.h b/include/game.h index 0bdc45e2..62584fe1 100644 --- a/include/game.h +++ b/include/game.h @@ -90,32 +90,32 @@ void sub_08052878(void); void ModDungeonKeys(s32 keys); /** - * Check if the current dungeon has a map item. + * Check if the player has at least one small key for the current dungeon. * - * @return True if the current dungeon has a map item. + * @return True if the player has a small key. */ -bool32 HasDungeonMap(void); +bool32 HasDungeonSmallKey(void); /** - * Check if the current dungeon has a compass item. + * Check if the player has the big key for the current dungeon. * - * @return True if the current dungeon has a compass item. - */ -bool32 HasDungeonCompass(void); - -/** - * Check if the current dungeon has a big key item. - * - * @return True if the current dungeon has a big key item. + * @return True if the player has the big key. */ bool32 HasDungeonBigKey(void); /** - * Check if the current dungeon has a small key item. + * Check if the player has the compass for the current dungeon. * - * @return True if the current dungeon has a small key item. + * @return True if the player has the compass. */ -bool32 HasDungeonSmallKey(void); +bool32 HasDungeonCompass(void); + +/** + * Check if the player has the map for the current dungeon. + * + * @return True if the player has the map. + */ +bool32 HasDungeonMap(void); /** * @brief Check if item is a sword. diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index d09ea3cd..42f6943b 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -332,7 +332,7 @@ u32 UpdatePlayerCollision(void) { OpenSmallChest(position, gPlayerEntity.collisionLayer); return 2; case 0x71: - if (HasDungeonMap() == 0) { + if (HasDungeonSmallKey() == 0) { return 0; } gUnk_0200AF00.unk_2d = 6; diff --git a/src/common.c b/src/common.c index 64543bd9..d55dbf54 100644 --- a/src/common.c +++ b/src/common.c @@ -444,7 +444,7 @@ void DrawDungeonMap(u32 floor, DungeonMapObject* specialData, u32 size) { floorMapData++; } else { flagBankOffset = sub_0801DF10(floorMapData); - if (HasDungeonBigKey()) { + if (HasDungeonCompass()) { while (tileEntity->type != 0) { switch (tileEntity->type) { case SMALL_CHEST: @@ -468,7 +468,7 @@ void DrawDungeonMap(u32 floor, DungeonMapObject* specialData, u32 size) { tileEntity++; } } - if ((HasDungeonBigKey() && ((floorMapData->unk_2 & 2) != 0)) && (!CheckGlobalFlag(gArea.dungeon_idx + 1))) { + if ((HasDungeonCompass() && ((floorMapData->unk_2 & 2) != 0)) && (!CheckGlobalFlag(gArea.dungeon_idx + 1))) { roomHeader = gAreaRoomHeaders[floorMapData->area] + floorMapData->room; specialData->type = DMO_TYPE_BOSS; tmp1 = ((roomHeader->pixel_width / 2) + roomHeader->map_x) / 16; @@ -536,7 +536,7 @@ void DrawDungeonFeatures(u32 floor, void* data, u32 size) { if (layout->area == gUI.roomControls.area && layout->room == gUI.roomControls.room) { features = 8; } else { - if (HasDungeonSmallKey()) { + if (HasDungeonMap()) { features = 2; } if (IsRoomVisited(tileEntity, bankOffset)) { diff --git a/src/gameUtils.c b/src/gameUtils.c index 4f615950..8f9e9ace 100644 --- a/src/gameUtils.c +++ b/src/gameUtils.c @@ -243,7 +243,7 @@ bool32 AreaHasKeys(void) { return (gArea.areaMetadata >> 1) & 1; } -bool32 HasDungeonMap(void) { +bool32 HasDungeonSmallKey(void) { u32 tmp; if (AreaHasKeys()) @@ -251,7 +251,7 @@ bool32 HasDungeonMap(void) { return tmp ? 1 : 0; } -bool32 HasDungeonCompass(void) { +bool32 HasDungeonBigKey(void) { u32 tmp; if (AreaHasKeys()) @@ -259,15 +259,13 @@ bool32 HasDungeonCompass(void) { return tmp ? 1 : 0; } -bool32 HasDungeonBigKey(void) { +bool32 HasDungeonCompass(void) { if (!AreaHasKeys()) return 0; return (gSave.dungeonItems[gArea.dungeon_idx] >> 1) & 1; } -bool32 HasDungeonSmallKey(void) { - u32 tmp; - +bool32 HasDungeonMap(void) { if (!AreaHasKeys()) return 0; return gSave.dungeonItems[gArea.dungeon_idx] & 1; diff --git a/src/menu/pauseMenu.c b/src/menu/pauseMenu.c index 0b76815b..c36dbb9a 100644 --- a/src/menu/pauseMenu.c +++ b/src/menu/pauseMenu.c @@ -1153,17 +1153,17 @@ void sub_080A5D1C(void) { DrawDirect(DRAW_DIRECT_SPRITE_INDEX, (gMain.ticks & 0x20) != 0 ? 0x78 : 0x79); gOamCmd.y = 0x7e; gOamCmd._8 = 0x4380; - if (HasDungeonSmallKey()) { + if (HasDungeonMap()) { gOamCmd.x = 0x18; frameIndex = gSpriteAnimations_322[0x50]->index; DrawDirect(SUB_080A5D1C_SPRITE_INDEX, frameIndex); } - if (HasDungeonCompass()) { + if (HasDungeonBigKey()) { gOamCmd.x = 0x2e; frameIndex = gSpriteAnimations_322[0x52]->index; DrawDirect(SUB_080A5D1C_SPRITE_INDEX, frameIndex); } - if (HasDungeonBigKey()) { + if (HasDungeonCompass()) { gOamCmd.x = 0x45; gOamCmd._8 = 0x380; frameIndex = gSpriteAnimations_322[0x51]->index; diff --git a/src/script.c b/src/script.c index 1f14de5f..91bc5e95 100644 --- a/src/script.c +++ b/src/script.c @@ -721,17 +721,17 @@ void ScriptCommand_CheckInventory1(Entity* entity, ScriptExecutionContext* conte u32 tmp; u32 tmp2 = GetNextScriptCommandHalfwordAfterCommandMetadata(context->scriptInstructionPointer); switch (tmp2) { - case 0x53: - tmp = HasDungeonMap(); + case ITEM_SMALL_KEY: + tmp = HasDungeonSmallKey(); break; - case 0x52: - tmp = HasDungeonCompass(); - break; - case 0x51: + case ITEM_BIG_KEY: tmp = HasDungeonBigKey(); break; - case 0x50: - tmp = HasDungeonSmallKey(); + case ITEM_COMPASS: + tmp = HasDungeonCompass(); + break; + case ITEM_DUNGEON_MAP: + tmp = HasDungeonMap(); break; default: tmp = GetInventoryValue(tmp2);