items tied to items rather than slots + dpad items now work (#2884)

This commit is contained in:
inspectredc 2023-11-06 04:33:51 +00:00 committed by GitHub
parent 8e00265ff8
commit 8b78cb832a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 40 additions and 42 deletions

View File

@ -510,58 +510,60 @@ void UseItem(uint8_t usedItem, u8 started, Actor* thisx, PlayState* play) {
if (this->usedItem != 0xFF && this->itemTimer <= 0) {
switch (usedItem) {
case SLOT_STICK:
case ITEM_STICK:
UseDekuStick(this, play, started);
break;
case SLOT_BOMB:
case ITEM_BOMB:
UseBombs(this, play, started);
break;
case SLOT_BOMBCHU:
case ITEM_BOMBCHU:
UseBombchus(this, play, started);
break;
case SLOT_NUT:
case ITEM_NUT:
UseNuts(this, play, started);
break;
case SLOT_BOW:
case ITEM_BOW:
UseBow(this, play, started, 0);
break;
case SLOT_ARROW_FIRE:
case ITEM_ARROW_FIRE:
UseBow(this, play, started, 1);
break;
case SLOT_ARROW_ICE:
case ITEM_ARROW_ICE:
UseBow(this, play, started, 2);
break;
case SLOT_ARROW_LIGHT:
case ITEM_ARROW_LIGHT:
UseBow(this, play, started, 3);
break;
case SLOT_SLINGSHOT:
case ITEM_SLINGSHOT:
UseSlingshot(this, play, started);
break;
case SLOT_OCARINA:
case ITEM_OCARINA_FAIRY:
case ITEM_OCARINA_TIME:
UseOcarina(this, play, started);
break;
case SLOT_HOOKSHOT:
case ITEM_HOOKSHOT:
case ITEM_LONGSHOT:
UseHookshot(this, play, started);
break;
case SLOT_DINS_FIRE:
case ITEM_DINS_FIRE:
UseSpell(this, play, started, 1);
break;
case SLOT_NAYRUS_LOVE:
case ITEM_NAYRUS_LOVE:
UseSpell(this, play, started, 2);
break;
case SLOT_FARORES_WIND:
case ITEM_FARORES_WIND:
UseSpell(this, play, started, 3);
break;
case SLOT_HAMMER:
case ITEM_HAMMER:
UseHammer(this, play, started);
break;
case SLOT_BOOMERANG:
case ITEM_BOOMERANG:
UseBoomerang(this, play, started);
break;
case SLOT_LENS:
case ITEM_LENS:
UseLens(this, play, started);
break;
case SLOT_BEAN:
case ITEM_BEAN:
UseBeans(this, play, started);
break;
}
@ -685,39 +687,35 @@ void EnPartner_Update(Actor* thisx, PlayState* play) {
uint8_t released = 0;
uint8_t current = 0;
uint16_t partnerButtons[7] = { BTN_CLEFT, BTN_CDOWN, BTN_CRIGHT, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT};
uint8_t buttonMax = 3;
if (CVarGetInteger("gDpadEquips", 0) != 0) {
buttonMax = ARRAY_COUNT(gSaveContext.equips.cButtonSlots);
}
if (this->usedItem == 0xFF && this->itemTimer <= 0) {
if (CHECK_BTN_ALL(sControlInput.press.button, BTN_CLEFT)) {
this->usedItem = gSaveContext.equips.cButtonSlots[0];
this->usedItemButton = 0;
pressed = 1;
} else if (CHECK_BTN_ALL(sControlInput.press.button, BTN_CDOWN)) {
this->usedItem = gSaveContext.equips.cButtonSlots[1];
this->usedItemButton = 1;
pressed = 1;
} else if (CHECK_BTN_ALL(sControlInput.press.button, BTN_CRIGHT)) {
this->usedItem = gSaveContext.equips.cButtonSlots[2];
this->usedItemButton = 2;
pressed = 1;
for (uint8_t i = 0; i < buttonMax; i++) {
if (CHECK_BTN_ALL(sControlInput.press.button, partnerButtons[i])) {
this->usedItem = gSaveContext.equips.buttonItems[i+1];
this->usedItemButton = i;
pressed = 1;
}
}
}
if (this->usedItem != 0xFF) {
if (CHECK_BTN_ALL(sControlInput.cur.button, BTN_CLEFT) && this->usedItemButton == 0) {
current = 1;
} else if (CHECK_BTN_ALL(sControlInput.cur.button, BTN_CDOWN) && this->usedItemButton == 1) {
current = 1;
} else if (CHECK_BTN_ALL(sControlInput.cur.button, BTN_CRIGHT) && this->usedItemButton == 2) {
current = 1;
for (uint8_t i = 0; i < buttonMax; i++) {
if (CHECK_BTN_ALL(sControlInput.cur.button, partnerButtons[i]) && this->usedItemButton == i) {
current = 1;
}
}
}
if (this->usedItem != 0xFF) {
if (CHECK_BTN_ALL(sControlInput.rel.button, BTN_CLEFT) && this->usedItemButton == 0) {
released = 1;
} else if (CHECK_BTN_ALL(sControlInput.rel.button, BTN_CDOWN) && this->usedItemButton == 1) {
released = 1;
} else if (CHECK_BTN_ALL(sControlInput.rel.button, BTN_CRIGHT) && this->usedItemButton == 2) {
released = 1;
for (uint8_t i = 0; i < buttonMax; i++) {
if (CHECK_BTN_ALL(sControlInput.rel.button, partnerButtons[i]) && this->usedItemButton == i) {
released = 1;
}
}
}