mirror of https://github.com/zeldaret/tmc.git
Fix dungeon item mixup
This commit is contained in:
parent
7e4466f928
commit
e59630f202
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
16
src/script.c
16
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);
|
||||
|
|
Loading…
Reference in New Issue