mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 01:12:19 -05:00
Fix Giant's Knife unexpected behaviours (#834)
* Giant's Knife Behaviour Fixes Fixes a case where Giant's Knife (specifically, breaking and re-buying it) can behave unexpectedly if you don't have a Kokiri Sword in your inventory. Also fixes the broken icon not showing up in inventory after you break it. * less whitespace * fix 0xE check Accidentally committed with the wrong check * Move the grayscale code up Moved the grayscaling portion up higher in the function and renamed "bool not_acquired" to "bool age_restricted". Thanks to @vaguerant for the suggestion!
This commit is contained in:
parent
c19beca980
commit
52f22275e3
@ -1676,13 +1676,15 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
||||
if (item == ITEM_SWORD_BGS) {
|
||||
gSaveContext.swordHealth = 8;
|
||||
|
||||
if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF) {
|
||||
gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD];
|
||||
if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF
|
||||
||(gSaveContext.n64ddFlag && ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xE)) { // In rando, when buying Giant's Knife, also check
|
||||
gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; // for 0xE in case we don't have Kokiri Sword
|
||||
if (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KNIFE) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
|
||||
Interface_LoadItemIcon1(globalCtx, 0);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (item == ITEM_SWORD_MASTER) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
|
||||
gSaveContext.equips.equipment &= 0xFFF0;
|
||||
|
@ -637,24 +637,23 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
||||
gItemIcons[sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1], 32, 32, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw inventory screen icons
|
||||
for (k = 0, bit = rowStart, point = 4; k < 3; k++, point += 4, temp++, bit++) {
|
||||
|
||||
int itemId = ITEM_SWORD_KOKIRI + temp;
|
||||
bool age_restricted = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge);
|
||||
if (age_restricted) {
|
||||
gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255);
|
||||
gsSPGrayscale(POLY_KAL_DISP++, true);
|
||||
}
|
||||
if (((u32)i == 0) && (k == 2) && (gSaveContext.bgsFlag != 0)) {
|
||||
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBiggoronSwordIconTex, 32, 32, point);
|
||||
} else if ((i == 0) && (k == 2) && (gBitFlags[bit + 1] & gSaveContext.inventory.equipment)) {
|
||||
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBrokenGiantsKnifeIconTex, 32, 32, point);
|
||||
}
|
||||
if (gBitFlags[bit] & gSaveContext.inventory.equipment) {
|
||||
int itemId = ITEM_SWORD_KOKIRI + temp;
|
||||
bool not_acquired = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge);
|
||||
if (not_acquired) {
|
||||
gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255);
|
||||
gsSPGrayscale(POLY_KAL_DISP++, true);
|
||||
}
|
||||
} else if (gBitFlags[bit] & gSaveContext.inventory.equipment) {
|
||||
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, 32, point);
|
||||
gsSPGrayscale(POLY_KAL_DISP++, false);
|
||||
}
|
||||
gsSPGrayscale(POLY_KAL_DISP++, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user