Add equipable tunics/boots (#328)

This commit is contained in:
Rozelette 2022-05-15 14:26:54 -05:00 committed by GitHub
parent b9c5b34eba
commit 6dbb085a82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 191 additions and 64 deletions

View File

@ -676,6 +676,8 @@ namespace SohImGui {
Tooltip("Wearing the Bunny Hood grants a speed increase like in Majora's Mask");
EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony");
Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble");
EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots");
Tooltip("Allows equiping the tunic and boots to c-buttons");
ImGui::Text("Graphics");
ImGui::Separator();

View File

@ -78,6 +78,12 @@ typedef enum {
/* 0x15 */ SLOT_BOTTLE_4,
/* 0x16 */ SLOT_TRADE_ADULT,
/* 0x17 */ SLOT_TRADE_CHILD,
/* 0x18 */ SLOT_TUNIC_KOKIRI,
/* 0x19 */ SLOT_TUNIC_GORON,
/* 0x1A */ SLOT_TUNIC_ZORA,
/* 0x1B */ SLOT_BOOTS_KOKIRI,
/* 0x1C */ SLOT_BOOTS_IRON,
/* 0x1D */ SLOT_BOOTS_HOVER,
/* 0xFF */ SLOT_NONE = 0xFF
} InventorySlot;

View File

@ -128,7 +128,16 @@ typedef enum {
/* 0x40 */ PLAYER_AP_MASK_GERUDO,
/* 0x41 */ PLAYER_AP_MASK_TRUTH,
/* 0x42 */ PLAYER_AP_LENS,
/* 0x43 */ PLAYER_AP_MAX
/* 0x43 */ PLAYER_AP_SHIELD_DEKU,
/* 0x44 */ PLAYER_AP_SHIELD_HYLIAN,
/* 0x45 */ PLAYER_AP_SHIELD_MIRROR,
/* 0x46 */ PLAYER_AP_TUNIC_KOKIRI,
/* 0x47 */ PLAYER_AP_TUNIC_GORON,
/* 0x48 */ PLAYER_AP_TUNIC_ZORA,
/* 0x49 */ PLAYER_AP_BOOTS_KOKIRI,
/* 0x4A */ PLAYER_AP_BOOTS_IRON,
/* 0x4B */ PLAYER_AP_BOOTS_HOVER,
/* 0x4C */ PLAYER_AP_MAX
} PlayerActionParam;
typedef enum {

View File

@ -753,7 +753,15 @@ void func_80083108(GlobalContext* globalCtx) {
gSaveContext.buttonStatus[0] = BTN_DISABLED;
for (i = 1; i < 4; i++) {
if (func_8008F2F8(globalCtx) == 2) {
if ((gSaveContext.equips.buttonItems[i] >= ITEM_SHIELD_DEKU) &&
(gSaveContext.equips.buttonItems[i] <= ITEM_BOOTS_HOVER)) {
// Equipment on c-buttons is always enabled
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
} else if (func_8008F2F8(globalCtx) == 2) {
if ((gSaveContext.equips.buttonItems[i] != ITEM_HOOKSHOT) &&
(gSaveContext.equips.buttonItems[i] != ITEM_LONGSHOT)) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {

View File

@ -29,7 +29,8 @@ s16 sBootData[PLAYER_BOOTS_MAX][17] = {
// Used to map action params to model groups
u8 sActionModelGroups[] = {
3, 15, 10, 2, 2, 5, 10, 11, 6, 6, 6, 6, 6, 6, 6, 6, 9, 9, 7, 7, 8, 3, 3, 6, 3, 3, 3, 3, 12, 13, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
14, 14, 14, 14, 14, 14, 14, 14, 14, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3
};
TextTriggerEntry sTextTriggers[] = {

View File

@ -898,6 +898,15 @@ static s8 sItemActionParams[] = {
PLAYER_AP_SWORD_KOKIRI,
PLAYER_AP_SWORD_MASTER,
PLAYER_AP_SWORD_BGS,
PLAYER_AP_SHIELD_DEKU,
PLAYER_AP_SHIELD_HYLIAN,
PLAYER_AP_SHIELD_MIRROR,
PLAYER_AP_TUNIC_KOKIRI,
PLAYER_AP_TUNIC_GORON,
PLAYER_AP_TUNIC_ZORA,
PLAYER_AP_BOOTS_KOKIRI,
PLAYER_AP_BOOTS_IRON,
PLAYER_AP_BOOTS_HOVER,
};
static s32(*D_80853EDC[])(Player* this, GlobalContext* globalCtx) = {
@ -910,7 +919,8 @@ static s32(*D_80853EDC[])(Player* this, GlobalContext* globalCtx) = {
func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C,
func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C,
func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C,
func_8083485C, func_8083485C, func_8083485C, func_8083485C,
func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C,
func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C, func_8083485C,
};
static void (*D_80853FE8[])(GlobalContext* globalCtx, Player* this) = {
@ -923,7 +933,8 @@ static void (*D_80853FE8[])(GlobalContext* globalCtx, Player* this) = {
func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770,
func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770,
func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770,
func_80833770, func_80833770, func_80833770, func_80833770,
func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770,
func_80833770, func_80833770, func_80833770, func_80833770, func_80833770, func_80833770,
};
typedef enum {
@ -2752,7 +2763,8 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) {
if ((actionParam == PLAYER_AP_NONE) || !(this->stateFlags1 & PLAYER_STATE1_27) ||
((this->actor.bgCheckFlags & 1) &&
((actionParam == PLAYER_AP_HOOKSHOT) || (actionParam == PLAYER_AP_LONGSHOT)))) {
((actionParam == PLAYER_AP_HOOKSHOT) || (actionParam == PLAYER_AP_LONGSHOT))) ||
((actionParam >= PLAYER_AP_SHIELD_DEKU) && (actionParam <= PLAYER_AP_BOOTS_HOVER))) {
if ((globalCtx->bombchuBowlingStatus == 0) &&
(((actionParam == PLAYER_AP_STICK) && (AMMO(ITEM_STICK) == 0)) ||
@ -2764,6 +2776,33 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) {
return;
}
if (actionParam >= PLAYER_AP_BOOTS_KOKIRI) {
u16 bootsValue = actionParam - PLAYER_AP_BOOTS_KOKIRI + 1;
if (CUR_EQUIP_VALUE(EQUIP_BOOTS) == bootsValue) {
Inventory_ChangeEquipment(EQUIP_BOOTS, 1);
} else {
Inventory_ChangeEquipment(EQUIP_BOOTS, bootsValue);
}
Player_SetEquipmentData(globalCtx, this);
return;
}
if (actionParam >= PLAYER_AP_TUNIC_KOKIRI) {
u16 tunicValue = actionParam - PLAYER_AP_TUNIC_KOKIRI + 1;
if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == tunicValue) {
Inventory_ChangeEquipment(EQUIP_TUNIC, 1);
} else {
Inventory_ChangeEquipment(EQUIP_TUNIC, tunicValue);
}
Player_SetEquipmentData(globalCtx, this);
return;
}
if (actionParam >= PLAYER_AP_SHIELD_DEKU) {
// Changing shields through action commands is unimplemented
return;
}
if (actionParam == PLAYER_AP_LENS) {
if (func_80087708(globalCtx, 0, 3)) {
if (globalCtx->actorCtx.unk_03 != 0) {

View File

@ -471,39 +471,76 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
KaleidoScope_SetCursorVtx(pauseCtx, cursorSlot * 4, pauseCtx->equipVtx);
if ((pauseCtx->cursorSpecialPos == 0) && (cursorItem != PAUSE_ITEM_NONE) && (pauseCtx->state == 6) &&
(pauseCtx->unk_1E4 == 0) && CHECK_BTN_ALL(input->press.button, BTN_A) &&
(pauseCtx->unk_1E4 == 0) &&
CHECK_BTN_ANY(input->press.button, BTN_A | BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT) &&
(pauseCtx->cursorX[PAUSE_EQUIP] != 0)) {
if ((gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == 9) ||
(gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] ==
((void)0, gSaveContext.linkAge))) {
Inventory_ChangeEquipment(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]);
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
Inventory_ChangeEquipment(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]);
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) {
gSaveContext.infTable[29] = 0;
gSaveContext.equips.buttonItems[0] = cursorItem;
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) {
gSaveContext.infTable[29] = 0;
gSaveContext.equips.buttonItems[0] = cursorItem;
if ((pauseCtx->cursorX[PAUSE_EQUIP] == 3) && (gSaveContext.bgsFlag != 0)) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
gSaveContext.swordHealth = 8;
} else {
if (gSaveContext.equips.buttonItems[0] == ITEM_HEART_PIECE_2) {
if ((pauseCtx->cursorX[PAUSE_EQUIP] == 3) && (gSaveContext.bgsFlag != 0)) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
gSaveContext.swordHealth = 8;
} else {
if (gSaveContext.equips.buttonItems[0] == ITEM_HEART_PIECE_2) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
}
if ((gSaveContext.equips.buttonItems[0] == ITEM_SWORD_BGS) && (gSaveContext.bgsFlag == 0) &&
(gBitFlags[3] & gSaveContext.inventory.equipment)) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE;
}
}
if ((gSaveContext.equips.buttonItems[0] == ITEM_SWORD_BGS) && (gSaveContext.bgsFlag == 0) &&
(gBitFlags[3] & gSaveContext.inventory.equipment)) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE;
}
Interface_LoadItemIcon1(globalCtx, 0);
}
Interface_LoadItemIcon1(globalCtx, 0);
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
pauseCtx->unk_1E4 = 7;
sEquipTimer = 10;
} else if (CVar_GetS32("gAssignableTunicsAndBoots", 0) != 0) {
// Only allow assigning tunic and boots to c-buttons
if (pauseCtx->cursorY[PAUSE_EQUIP] > 1) {
u16 slot = 0;
switch (cursorItem) {
case ITEM_TUNIC_KOKIRI:
slot = SLOT_TUNIC_KOKIRI;
break;
case ITEM_TUNIC_GORON:
slot = SLOT_TUNIC_GORON;
break;
case ITEM_TUNIC_ZORA:
slot = SLOT_TUNIC_ZORA;
break;
case ITEM_BOOTS_KOKIRI:
slot = SLOT_BOOTS_KOKIRI;
break;
case ITEM_BOOTS_IRON:
slot = SLOT_BOOTS_IRON;
break;
case ITEM_BOOTS_HOVER:
slot = SLOT_BOOTS_HOVER;
break;
default:
break;
}
KaleidoScope_SetupItemEquip(globalCtx, cursorItem, slot,
pauseCtx->equipVtx[cursorSlot * 4].v.ob[0] * 10,
pauseCtx->equipVtx[cursorSlot * 4].v.ob[1] * 10);
}
}
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
pauseCtx->unk_1E4 = 7;
sEquipTimer = 10;
} else {
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
} else if ((CVar_GetS32("gAssignableTunicsAndBoots", 0) != 0) && (pauseCtx->cursorY[PAUSE_EQUIP] > 1)) {
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
}
}

View File

@ -351,43 +351,9 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
if (((gSlotAgeReqs[cursorSlot] == 9) ||
(gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.linkAge))) &&
(cursorItem != ITEM_SOLD_OUT)) {
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
pauseCtx->equipTargetCBtn = 0;
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
pauseCtx->equipTargetCBtn = 1;
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
pauseCtx->equipTargetCBtn = 2;
}
pauseCtx->equipTargetItem = cursorItem;
pauseCtx->equipTargetSlot = cursorSlot;
pauseCtx->unk_1E4 = 3;
pauseCtx->equipAnimX = pauseCtx->itemVtx[index].v.ob[0] * 10;
pauseCtx->equipAnimY = pauseCtx->itemVtx[index].v.ob[1] * 10;
pauseCtx->equipAnimAlpha = 255;
sEquipAnimTimer = 0;
sEquipState = 3;
sEquipMoveTimer = 10;
if ((pauseCtx->equipTargetItem == ITEM_ARROW_FIRE) ||
(pauseCtx->equipTargetItem == ITEM_ARROW_ICE) ||
(pauseCtx->equipTargetItem == ITEM_ARROW_LIGHT)) {
index = 0;
if (pauseCtx->equipTargetItem == ITEM_ARROW_ICE) {
index = 1;
}
if (pauseCtx->equipTargetItem == ITEM_ARROW_LIGHT) {
index = 2;
}
Audio_PlaySoundGeneral(NA_SE_SY_SET_FIRE_ARROW + index, &D_801333D4, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
pauseCtx->equipTargetItem = 0xBF + index;
sEquipState = 0;
pauseCtx->equipAnimAlpha = 0;
sEquipMoveTimer = 6;
} else {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
}
KaleidoScope_SetupItemEquip(globalCtx, cursorItem, cursorSlot,
pauseCtx->itemVtx[index].v.ob[0] * 10,
pauseCtx->itemVtx[index].v.ob[1] * 10);
} else {
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
@ -419,7 +385,9 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
gDPSetEnvColor(POLY_KAL_DISP++, 0, 0, 0, 0);
for (i = 0, j = 24 * 4; i < 3; i++, j += 4) {
if (gSaveContext.equips.buttonItems[i + 1] != ITEM_NONE) {
if ((gSaveContext.equips.buttonItems[i + 1] != ITEM_NONE) &&
!((gSaveContext.equips.buttonItems[i + 1] >= ITEM_SHIELD_DEKU) &&
(gSaveContext.equips.buttonItems[i + 1] <= ITEM_BOOTS_HOVER))) {
gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[j], 4, 0);
POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, gEquippedItemOutlineTex, 32, 32, 0);
}
@ -496,6 +464,46 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_item.c", 516);
}
void KaleidoScope_SetupItemEquip(GlobalContext* globalCtx, u16 item, u16 slot, s16 animX, s16 animY) {
Input* input = &globalCtx->state.input[0];
PauseContext* pauseCtx = &globalCtx->pauseCtx;
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
pauseCtx->equipTargetCBtn = 0;
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
pauseCtx->equipTargetCBtn = 1;
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
pauseCtx->equipTargetCBtn = 2;
}
pauseCtx->equipTargetItem = item;
pauseCtx->equipTargetSlot = slot;
pauseCtx->unk_1E4 = 3;
pauseCtx->equipAnimX = animX;
pauseCtx->equipAnimY = animY;
pauseCtx->equipAnimAlpha = 255;
sEquipAnimTimer = 0;
sEquipState = 3;
sEquipMoveTimer = 10;
if ((pauseCtx->equipTargetItem == ITEM_ARROW_FIRE) || (pauseCtx->equipTargetItem == ITEM_ARROW_ICE) ||
(pauseCtx->equipTargetItem == ITEM_ARROW_LIGHT)) {
u16 index = 0;
if (pauseCtx->equipTargetItem == ITEM_ARROW_ICE) {
index = 1;
}
if (pauseCtx->equipTargetItem == ITEM_ARROW_LIGHT) {
index = 2;
}
Audio_PlaySoundGeneral(NA_SE_SY_SET_FIRE_ARROW + index, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
pauseCtx->equipTargetItem = 0xBF + index;
sEquipState = 0;
pauseCtx->equipAnimAlpha = 0;
sEquipMoveTimer = 6;
} else {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
}
static s16 sCButtonPosX[] = { 66, 90, 114 };
static s16 sCButtonPosY[] = { 110, 92, 110 };

View File

@ -18,6 +18,7 @@ void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx);
void KaleidoScope_DrawEquipment(GlobalContext* globalCtx);
void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx);
void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx);
void KaleidoScope_SetupItemEquip(GlobalContext* globalCtx, u16 item, u16 slot, s16 animX, s16 animY);
void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx);
void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx);
void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx);

View File

@ -916,6 +916,13 @@ void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) {
gSaveContext.buttonStatus[3] = D_8082AB6C[pauseCtx->pageIndex + pt][3];
gSaveContext.buttonStatus[4] = D_8082AB6C[pauseCtx->pageIndex + pt][4];
if ((CVar_GetS32("gAssignableTunicsAndBoots", 0) != 0) && (D_8082ABEC[pauseCtx->mode] == PAUSE_EQUIP)) {
gSaveContext.buttonStatus[1] = BTN_ENABLED;
gSaveContext.buttonStatus[2] = BTN_ENABLED;
gSaveContext.buttonStatus[3] = BTN_ENABLED;
gSaveContext.buttonStatus[4] = BTN_ENABLED;
}
osSyncPrintf("kscope->kscp_pos+pt = %d\n", pauseCtx->pageIndex + pt);
gSaveContext.unk_13EA = 0;
@ -2902,7 +2909,16 @@ void func_808265BC(GlobalContext* globalCtx) {
gSaveContext.buttonStatus[2] = D_8082AB6C[pauseCtx->pageIndex][2];
gSaveContext.buttonStatus[3] = D_8082AB6C[pauseCtx->pageIndex][3];
gSaveContext.buttonStatus[4] = D_8082AB6C[pauseCtx->pageIndex][4];
pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode];
if ((CVar_GetS32("gAssignableTunicsAndBoots", 0) != 0) && (pauseCtx->pageIndex == PAUSE_EQUIP)) {
gSaveContext.buttonStatus[1] = BTN_ENABLED;
gSaveContext.buttonStatus[2] = BTN_ENABLED;
gSaveContext.buttonStatus[3] = BTN_ENABLED;
gSaveContext.buttonStatus[4] = BTN_ENABLED;
}
pauseCtx->unk_1E4 = 0;
pauseCtx->state++;
pauseCtx->alpha = 255;