Browse Source

DPad items

pull/527/head
rozlette 3 days ago committed by louist103
parent
commit
fd06827e2b
  1. BIN
      OTRExporter/assets/ship_of_harkinian/buttons/dpad.bin
  2. 3
      libultraship/libultraship/SohImGuiImpl.cpp
  3. 4
      soh/include/macros.h
  4. 4
      soh/include/z64.h
  5. 15
      soh/include/z64interface.h
  6. 6
      soh/include/z64save.h
  7. 20
      soh/soh/SaveManager.cpp
  8. 46
      soh/src/code/z_construct.c
  9. 5
      soh/src/code/z_game_over.c
  10. 444
      soh/src/code/z_parameter.c
  11. 4
      soh/src/code/z_sram.c
  12. 73
      soh/src/overlays/actors/ovl_player_actor/z_player.c
  13. 10
      soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c
  14. 5
      soh/src/overlays/gamestates/ovl_select/z_select.c
  15. 8
      soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c
  16. 259
      soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c
  17. 83
      soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c

BIN
OTRExporter/assets/ship_of_harkinian/buttons/dpad.bin

Binary file not shown.

3
libultraship/libultraship/SohImGuiImpl.cpp

@ -776,9 +776,12 @@ namespace SohImGui { @@ -776,9 +776,12 @@ namespace SohImGui {
if (ImGui::BeginMenu("Controller"))
{
// TODO mutual exclusions -- gDpadEquips and gDpadPauseName cause conflicts, but nothing stops a user from selecting both
// There should be some system to prevent conclifting enhancements from being selected
EnhancementCheckbox("D-pad Support on Pause and File Select", "gDpadPauseName");
EnhancementCheckbox("D-pad Support in Ocarina and Text Choice", "gDpadOcarinaText");
EnhancementCheckbox("D-pad Support for Browsing Shop Items", "gDpadShop");
EnhancementCheckbox("D-pad as Equip Items", "gDpadEquips");
ImGui::Separator();

4
soh/include/macros.h

@ -76,6 +76,10 @@ @@ -76,6 +76,10 @@
? gSaveContext.equips.buttonItems[(button) + 1] \
: ITEM_NONE)
#define DPAD_ITEM(button) ((gSaveContext.buttonStatus[(button) + 5] != BTN_DISABLED) \
? gSaveContext.equips.buttonItems[(button) + 4] \
: ITEM_NONE)
#define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0)
#define CHECK_BTN_ANY(state, combo) (((state) & (combo)) != 0)

4
soh/include/z64.h

@ -705,6 +705,10 @@ typedef struct { @@ -705,6 +705,10 @@ typedef struct {
/* 0x024C */ u16 cDownAlpha;
/* 0x024E */ u16 cRightAlpha;
/* 0x0250 */ u16 healthAlpha; // also max C-Up alpha
/* 0x024E */ u16 dpadUpAlpha;
/* 0x024E */ u16 dpadDownAlpha;
/* 0x024E */ u16 dpadLeftAlpha;
/* 0x024E */ u16 dpadRightAlpha;
/* 0x0252 */ u16 magicAlpha; // also Rupee and Key counters alpha
/* 0x0254 */ u16 minimapAlpha;
/* 0x0256 */ s16 startAlpha;

15
soh/include/z64interface.h

@ -22,6 +22,21 @@ @@ -22,6 +22,21 @@
#define C_UP_BUTTON_X 254
#define C_UP_BUTTON_Y 16
#define DPAD_UP_X 279
#define DPAD_UP_Y 47
#define DPAD_DOWN_X 279
#define DPAD_DOWN_Y 79
#define DPAD_LEFT_X 263
#define DPAD_LEFT_Y 63
#define DPAD_RIGHT_X 295
#define DPAD_RIGHT_Y 63
#define DPAD_X 271
#define DPAD_Y 55
/**
* These are the colors for the hearts in the interface. The prim color is the red color of the heart
* for the base hearts, while the prim color for the double defense hearts is the white outline. The

6
soh/include/z64save.h

@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
#include "z64math.h"
typedef struct {
/* 0x00 */ u8 buttonItems[4];
/* 0x04 */ u8 cButtonSlots[3];
/* 0x00 */ u8 buttonItems[8];
/* 0x04 */ u8 cButtonSlots[7];
/* 0x08 */ u16 equipment;
} ItemEquips; // size = 0x0A
@ -125,7 +125,7 @@ typedef struct { @@ -125,7 +125,7 @@ typedef struct {
/* 0x13DA */ s16 timerY[2];
/* 0x13E0 */ u8 seqId;
/* 0x13E1 */ u8 natureAmbienceId;
/* 0x13E2 */ u8 buttonStatus[5];
/* 0x13E2 */ u8 buttonStatus[9];
/* 0x13E7 */ u8 unk_13E7; // alpha related
/* 0x13E8 */ u16 unk_13E8; // alpha type?
/* 0x13EA */ u16 unk_13EA; // also alpha type?

20
soh/soh/SaveManager.cpp

@ -278,11 +278,11 @@ void SaveManager::InitFileDebug() { @@ -278,11 +278,11 @@ void SaveManager::InitFileDebug() {
gSaveContext.savedSceneNum = 0x51;
// Equipment
static std::array<u8, 4> sButtonItems = { ITEM_SWORD_MASTER, ITEM_BOW, ITEM_BOMB, ITEM_OCARINA_FAIRY };
static std::array<u8, 8> sButtonItems = { ITEM_SWORD_MASTER, ITEM_BOW, ITEM_BOMB, ITEM_OCARINA_FAIRY, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE };
for (int button = 0; button < ARRAY_COUNT(gSaveContext.equips.buttonItems); button++) {
gSaveContext.equips.buttonItems[button] = sButtonItems[button];
}
static std::array<u8, 3> sCButtonSlots = { SLOT_BOW, SLOT_BOMB, SLOT_OCARINA };
static std::array<u8, 7> sCButtonSlots = { SLOT_BOW, SLOT_BOMB, SLOT_OCARINA, SLOT_NONE, SLOT_NONE, SLOT_NONE, SLOT_NONE };
for (int button = 0; button < ARRAY_COUNT(gSaveContext.equips.cButtonSlots); button++) {
gSaveContext.equips.cButtonSlots[button] = sCButtonSlots[button];
}
@ -493,19 +493,23 @@ void SaveManager::LoadBaseVersion1() { @@ -493,19 +493,23 @@ void SaveManager::LoadBaseVersion1() {
SaveManager::Instance->LoadData("ocarinaGameRoundNum", gSaveContext.ocarinaGameRoundNum);
SaveManager::Instance->LoadStruct("childEquips", []() {
SaveManager::Instance->LoadArray("buttonItems", ARRAY_COUNT(gSaveContext.childEquips.buttonItems), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.childEquips.buttonItems[i]);
SaveManager::Instance->LoadData("", gSaveContext.childEquips.buttonItems[i],
static_cast<uint8_t>(ITEM_NONE));
});
SaveManager::Instance->LoadArray("cButtonSlots", ARRAY_COUNT(gSaveContext.childEquips.cButtonSlots), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.childEquips.cButtonSlots[i]);
SaveManager::Instance->LoadData("", gSaveContext.childEquips.cButtonSlots[i],
static_cast<uint8_t>(SLOT_NONE));
});
SaveManager::Instance->LoadData("equipment", gSaveContext.childEquips.equipment);
});
SaveManager::Instance->LoadStruct("adultEquips", []() {
SaveManager::Instance->LoadArray("buttonItems", ARRAY_COUNT(gSaveContext.adultEquips.buttonItems), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.adultEquips.buttonItems[i]);
SaveManager::Instance->LoadData("", gSaveContext.adultEquips.buttonItems[i],
static_cast<uint8_t>(ITEM_NONE));
});
SaveManager::Instance->LoadArray("cButtonSlots", ARRAY_COUNT(gSaveContext.adultEquips.cButtonSlots), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.adultEquips.cButtonSlots[i]);
SaveManager::Instance->LoadData("", gSaveContext.adultEquips.cButtonSlots[i],
static_cast<uint8_t>(SLOT_NONE));
});
SaveManager::Instance->LoadData("equipment", gSaveContext.adultEquips.equipment);
});
@ -513,10 +517,10 @@ void SaveManager::LoadBaseVersion1() { @@ -513,10 +517,10 @@ void SaveManager::LoadBaseVersion1() {
SaveManager::Instance->LoadData("savedSceneNum", gSaveContext.savedSceneNum);
SaveManager::Instance->LoadStruct("equips", []() {
SaveManager::Instance->LoadArray("buttonItems", ARRAY_COUNT(gSaveContext.equips.buttonItems), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.equips.buttonItems[i]);
SaveManager::Instance->LoadData("", gSaveContext.equips.buttonItems[i], static_cast<uint8_t>(ITEM_NONE));
});
SaveManager::Instance->LoadArray("cButtonSlots", ARRAY_COUNT(gSaveContext.equips.cButtonSlots), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.equips.cButtonSlots[i]);
SaveManager::Instance->LoadData("", gSaveContext.equips.cButtonSlots[i], static_cast<uint8_t>(SLOT_NONE));
});
SaveManager::Instance->LoadData("equipment", gSaveContext.equips.equipment);
});

46
soh/src/code/z_construct.c

@ -25,8 +25,9 @@ void func_801109B0(GlobalContext* globalCtx) { @@ -25,8 +25,9 @@ void func_801109B0(GlobalContext* globalCtx) {
interfaceCtx->minimapAlpha = 0;
interfaceCtx->unk_260 = 0;
interfaceCtx->unk_244 = interfaceCtx->aAlpha = interfaceCtx->bAlpha = interfaceCtx->cLeftAlpha =
interfaceCtx->cDownAlpha = interfaceCtx->cRightAlpha = interfaceCtx->healthAlpha = interfaceCtx->startAlpha =
interfaceCtx->magicAlpha = 0;
interfaceCtx->cDownAlpha = interfaceCtx->cRightAlpha = interfaceCtx->dpadUpAlpha = interfaceCtx->dpadDownAlpha =
interfaceCtx->dpadLeftAlpha = interfaceCtx->dpadRightAlpha = interfaceCtx->healthAlpha =
interfaceCtx->startAlpha = interfaceCtx->magicAlpha = 0;
parameterSize = (uintptr_t)_parameter_staticSegmentRomEnd - (uintptr_t)_parameter_staticSegmentRomStart;
@ -73,7 +74,8 @@ void func_801109B0(GlobalContext* globalCtx) { @@ -73,7 +74,8 @@ void func_801109B0(GlobalContext* globalCtx) {
//DmaMgr_SendRequest1(interfaceCtx->doActionSegment + 0x300, (uintptr_t)_do_action_staticSegmentRomStart + doActionOffset,
//0x180, "../z_construct.c", 178);
interfaceCtx->iconItemSegment = GameState_Alloc(&globalCtx->state, 0x4000, "../z_construct.c", 190);
interfaceCtx->iconItemSegment = GameState_Alloc(
&globalCtx->state, 0x1000 * ARRAY_COUNT(gSaveContext.equips.buttonItems), "../z_construct.c", 190);
// "Icon Item Texture Initialization = %x"
osSyncPrintf("アイコンアイテム テクスチャ初期=%x\n", 0x4000);
@ -85,32 +87,18 @@ void func_801109B0(GlobalContext* globalCtx) { @@ -85,32 +87,18 @@ void func_801109B0(GlobalContext* globalCtx) {
gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2],
gSaveContext.equips.buttonItems[3]);
if (gSaveContext.equips.buttonItems[0] < 0xF0) {
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[0] * 0x1000, 0x1000,
"../z_construct.c", 198);
} else if (gSaveContext.equips.buttonItems[0] != 0xFF) {
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[0] * 0x1000, 0x1000,
"../z_construct.c", 203);
}
if (gSaveContext.equips.buttonItems[1] < 0xF0) {
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment + 0x1000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[1] * 0x1000, 0x1000,
"../z_construct.c", 209);
}
if (gSaveContext.equips.buttonItems[2] < 0xF0) {
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment + 0x2000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[2] * 0x1000, 0x1000,
"../z_construct.c", 214);
}
if (gSaveContext.equips.buttonItems[3] < 0xF0) {
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment + 0x3000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[3] * 0x1000, 0x1000,
"../z_construct.c", 219);
for (int buttonIndex = 0; buttonIndex < ARRAY_COUNT(gSaveContext.equips.buttonItems); buttonIndex++) {
if (gSaveContext.equips.buttonItems[buttonIndex] < 0xF0) {
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment + 0x1000 * buttonIndex,
_icon_item_staticSegmentRomStart +
gSaveContext.equips.buttonItems[buttonIndex] * 0x1000,
0x1000, "../z_construct.c", 198);
} else if (buttonIndex == 0 && gSaveContext.equips.buttonItems[buttonIndex] != 0xFF) {
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment + 0x1000 * buttonIndex,
_icon_item_staticSegmentRomStart +
gSaveContext.equips.buttonItems[buttonIndex] * 0x1000,
0x1000, "../z_construct.c", 203);
}
}
osSyncPrintf("EVENT=%d\n", ((void)0, gSaveContext.timer1State));

5
soh/src/code/z_game_over.c

@ -68,8 +68,9 @@ void GameOver_Update(GlobalContext* globalCtx) { @@ -68,8 +68,9 @@ void GameOver_Update(GlobalContext* globalCtx) {
gSaveContext.eventInf[1] = 0;
gSaveContext.eventInf[2] = 0;
gSaveContext.eventInf[3] = 0;
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED;
for (int buttonIndex = 0; buttonIndex < ARRAY_COUNT(gSaveContext.buttonStatus); buttonIndex++) {
gSaveContext.buttonStatus[buttonIndex] = BTN_ENABLED;
}
gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0;
Environment_InitGameOverLights(globalCtx);

444
soh/src/code/z_parameter.c

@ -15,6 +15,10 @@ @@ -15,6 +15,10 @@
#define DO_ACTION_TEX_HEIGHT 16
#define DO_ACTION_TEX_SIZE ((DO_ACTION_TEX_WIDTH * DO_ACTION_TEX_HEIGHT) / 2) // (sizeof(gCheckDoActionENGTex))
// The button statuses include the A button when most things are only the equip item buttons
// So, when indexing into it with a item button index, we need to adjust
#define BUTTON_STATUS_INDEX(button) ((button) >= 4) ? ((button) + 1) : (button)
s16 Top_HUD_Margin = 0;
s16 Left_HUD_Margin = 0;
s16 Right_HUD_Margin = 0;
@ -257,6 +261,46 @@ void func_80082644(GlobalContext* globalCtx, s16 alpha) { @@ -257,6 +261,46 @@ void func_80082644(GlobalContext* globalCtx, s16 alpha) {
interfaceCtx->aAlpha = alpha;
}
}
if (gSaveContext.buttonStatus[5] == BTN_DISABLED) {
if (interfaceCtx->dpadUpAlpha != 70) {
interfaceCtx->dpadUpAlpha = 70;
}
} else {
if (interfaceCtx->dpadUpAlpha != 255) {
interfaceCtx->dpadUpAlpha = alpha;
}
}
if (gSaveContext.buttonStatus[6] == BTN_DISABLED) {
if (interfaceCtx->dpadDownAlpha != 70) {
interfaceCtx->dpadDownAlpha = 70;
}
} else {
if (interfaceCtx->dpadDownAlpha != 255) {
interfaceCtx->dpadDownAlpha = alpha;
}
}
if (gSaveContext.buttonStatus[7] == BTN_DISABLED) {
if (interfaceCtx->dpadLeftAlpha != 70) {
interfaceCtx->dpadLeftAlpha = 70;
}
} else {
if (interfaceCtx->dpadLeftAlpha != 255) {
interfaceCtx->dpadLeftAlpha = alpha;
}
}
if (gSaveContext.buttonStatus[8] == BTN_DISABLED) {
if (interfaceCtx->dpadRightAlpha != 70) {
interfaceCtx->dpadRightAlpha = 70;
}
} else {
if (interfaceCtx->dpadRightAlpha != 255) {
interfaceCtx->dpadRightAlpha = alpha;
}
}
}
void func_8008277C(GlobalContext* globalCtx, s16 maxAlpha, s16 alpha) {
@ -286,6 +330,22 @@ void func_8008277C(GlobalContext* globalCtx, s16 maxAlpha, s16 alpha) { @@ -286,6 +330,22 @@ void func_8008277C(GlobalContext* globalCtx, s16 maxAlpha, s16 alpha) {
if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) {
interfaceCtx->cRightAlpha = maxAlpha;
}
if ((interfaceCtx->dpadUpAlpha != 0) && (interfaceCtx->dpadUpAlpha > maxAlpha)) {
interfaceCtx->dpadUpAlpha = maxAlpha;
}
if ((interfaceCtx->dpadDownAlpha != 0) && (interfaceCtx->dpadDownAlpha > maxAlpha)) {
interfaceCtx->dpadDownAlpha = maxAlpha;
}
if ((interfaceCtx->dpadLeftAlpha != 0) && (interfaceCtx->dpadLeftAlpha > maxAlpha)) {
interfaceCtx->dpadLeftAlpha = maxAlpha;
}
if ((interfaceCtx->dpadRightAlpha != 0) && (interfaceCtx->dpadRightAlpha > maxAlpha)) {
interfaceCtx->dpadRightAlpha = maxAlpha;
}
}
void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) {
@ -324,6 +384,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { @@ -324,6 +384,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) {
interfaceCtx->cRightAlpha = maxAlpha;
}
if ((interfaceCtx->dpadUpAlpha != 0) && (interfaceCtx->dpadUpAlpha > maxAlpha)) {
interfaceCtx->dpadUpAlpha = maxAlpha;
}
if ((interfaceCtx->dpadDownAlpha != 0) && (interfaceCtx->dpadDownAlpha > maxAlpha)) {
interfaceCtx->dpadDownAlpha = maxAlpha;
}
if ((interfaceCtx->dpadLeftAlpha != 0) && (interfaceCtx->dpadLeftAlpha > maxAlpha)) {
interfaceCtx->dpadLeftAlpha = maxAlpha;
}
if ((interfaceCtx->dpadRightAlpha != 0) && (interfaceCtx->dpadRightAlpha > maxAlpha)) {
interfaceCtx->dpadRightAlpha = maxAlpha;
}
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) {
interfaceCtx->healthAlpha = maxAlpha;
}
@ -380,6 +456,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { @@ -380,6 +456,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) {
interfaceCtx->cRightAlpha = maxAlpha;
}
if ((interfaceCtx->dpadUpAlpha != 0) && (interfaceCtx->dpadUpAlpha > maxAlpha)) {
interfaceCtx->dpadUpAlpha = maxAlpha;
}
if ((interfaceCtx->dpadDownAlpha != 0) && (interfaceCtx->dpadDownAlpha > maxAlpha)) {
interfaceCtx->dpadDownAlpha = maxAlpha;
}
if ((interfaceCtx->dpadLeftAlpha != 0) && (interfaceCtx->dpadLeftAlpha > maxAlpha)) {
interfaceCtx->dpadLeftAlpha = maxAlpha;
}
if ((interfaceCtx->dpadRightAlpha != 0) && (interfaceCtx->dpadRightAlpha > maxAlpha)) {
interfaceCtx->dpadRightAlpha = maxAlpha;
}
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) {
interfaceCtx->healthAlpha = maxAlpha;
}
@ -503,6 +595,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { @@ -503,6 +595,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) {
interfaceCtx->cRightAlpha = maxAlpha;
}
if ((interfaceCtx->dpadUpAlpha != 0) && (interfaceCtx->dpadUpAlpha > maxAlpha)) {
interfaceCtx->dpadUpAlpha = maxAlpha;
}
if ((interfaceCtx->dpadDownAlpha != 0) && (interfaceCtx->dpadDownAlpha > maxAlpha)) {
interfaceCtx->dpadDownAlpha = maxAlpha;
}
if ((interfaceCtx->dpadLeftAlpha != 0) && (interfaceCtx->dpadLeftAlpha > maxAlpha)) {
interfaceCtx->dpadLeftAlpha = maxAlpha;
}
if ((interfaceCtx->dpadRightAlpha != 0) && (interfaceCtx->dpadRightAlpha > maxAlpha)) {
interfaceCtx->dpadRightAlpha = maxAlpha;
}
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
}
@ -533,6 +641,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { @@ -533,6 +641,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) {
interfaceCtx->cRightAlpha = maxAlpha;
}
if ((interfaceCtx->dpadUpAlpha != 0) && (interfaceCtx->dpadUpAlpha > maxAlpha)) {
interfaceCtx->dpadUpAlpha = maxAlpha;
}
if ((interfaceCtx->dpadDownAlpha != 0) && (interfaceCtx->dpadDownAlpha > maxAlpha)) {
interfaceCtx->dpadDownAlpha = maxAlpha;
}
if ((interfaceCtx->dpadLeftAlpha != 0) && (interfaceCtx->dpadLeftAlpha > maxAlpha)) {
interfaceCtx->dpadLeftAlpha = maxAlpha;
}
if ((interfaceCtx->dpadRightAlpha != 0) && (interfaceCtx->dpadRightAlpha > maxAlpha)) {
interfaceCtx->dpadRightAlpha = maxAlpha;
}
if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) {
interfaceCtx->healthAlpha = maxAlpha;
}
@ -571,6 +695,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { @@ -571,6 +695,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) {
interfaceCtx->cRightAlpha = maxAlpha;
}
if ((interfaceCtx->dpadUpAlpha != 0) && (interfaceCtx->dpadUpAlpha > maxAlpha)) {
interfaceCtx->dpadUpAlpha = maxAlpha;
}
if ((interfaceCtx->dpadDownAlpha != 0) && (interfaceCtx->dpadDownAlpha > maxAlpha)) {
interfaceCtx->dpadDownAlpha = maxAlpha;
}
if ((interfaceCtx->dpadLeftAlpha != 0) && (interfaceCtx->dpadLeftAlpha > maxAlpha)) {
interfaceCtx->dpadLeftAlpha = maxAlpha;
}
if ((interfaceCtx->dpadRightAlpha != 0) && (interfaceCtx->dpadRightAlpha > maxAlpha)) {
interfaceCtx->dpadRightAlpha = maxAlpha;
}
if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) {
interfaceCtx->minimapAlpha = maxAlpha;
}
@ -609,6 +749,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { @@ -609,6 +749,22 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) {
interfaceCtx->cRightAlpha = maxAlpha;
}
if ((interfaceCtx->dpadUpAlpha != 0) && (interfaceCtx->dpadUpAlpha > maxAlpha)) {
interfaceCtx->dpadUpAlpha = maxAlpha;
}
if ((interfaceCtx->dpadDownAlpha != 0) && (interfaceCtx->dpadDownAlpha > maxAlpha)) {
interfaceCtx->dpadDownAlpha = maxAlpha;
}
if ((interfaceCtx->dpadLeftAlpha != 0) && (interfaceCtx->dpadLeftAlpha > maxAlpha)) {
interfaceCtx->dpadLeftAlpha = maxAlpha;
}
if ((interfaceCtx->dpadRightAlpha != 0) && (interfaceCtx->dpadRightAlpha > maxAlpha)) {
interfaceCtx->dpadRightAlpha = maxAlpha;
}
if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) {
interfaceCtx->magicAlpha = maxAlpha;
}
@ -664,6 +820,8 @@ void func_80083108(GlobalContext* globalCtx) { @@ -664,6 +820,8 @@ void func_80083108(GlobalContext* globalCtx) {
if (gSaveContext.buttonStatus[0] == BTN_DISABLED) {
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_ENABLED;
gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] =
gSaveContext.buttonStatus[8] = BTN_ENABLED;
}
if ((gSaveContext.equips.buttonItems[0] != ITEM_SLINGSHOT) &&
@ -694,6 +852,8 @@ void func_80083108(GlobalContext* globalCtx) { @@ -694,6 +852,8 @@ void func_80083108(GlobalContext* globalCtx) {
gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = gSaveContext.buttonStatus[3] =
BTN_DISABLED;
gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] =
gSaveContext.buttonStatus[8] = BTN_DISABLED;
Interface_ChangeAlpha(6);
}
@ -739,6 +899,8 @@ void func_80083108(GlobalContext* globalCtx) { @@ -739,6 +899,8 @@ void func_80083108(GlobalContext* globalCtx) {
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_DISABLED;
gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] =
gSaveContext.buttonStatus[8] = BTN_DISABLED;
Interface_ChangeAlpha(50);
} else {
if (gSaveContext.buttonStatus[0] == BTN_ENABLED) {
@ -747,6 +909,8 @@ void func_80083108(GlobalContext* globalCtx) { @@ -747,6 +909,8 @@ void func_80083108(GlobalContext* globalCtx) {
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_DISABLED;
gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] =
gSaveContext.buttonStatus[8] = BTN_DISABLED;
Interface_ChangeAlpha(50);
}
} else if (msgCtx->msgMode == MSGMODE_NONE) {
@ -757,36 +921,36 @@ void func_80083108(GlobalContext* globalCtx) { @@ -757,36 +921,36 @@ void func_80083108(GlobalContext* globalCtx) {
gSaveContext.buttonStatus[0] = BTN_DISABLED;
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
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) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(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) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_DISABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_DISABLED;
} else {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
}
} else {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_DISABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_DISABLED;
}
}
@ -801,6 +965,10 @@ void func_80083108(GlobalContext* globalCtx) { @@ -801,6 +965,10 @@ void func_80083108(GlobalContext* globalCtx) {
gSaveContext.buttonStatus[1] = BTN_DISABLED;
gSaveContext.buttonStatus[2] = BTN_DISABLED;
gSaveContext.buttonStatus[3] = BTN_DISABLED;
gSaveContext.buttonStatus[5] = BTN_DISABLED;
gSaveContext.buttonStatus[6] = BTN_DISABLED;
gSaveContext.buttonStatus[7] = BTN_DISABLED;
gSaveContext.buttonStatus[8] = BTN_DISABLED;
gSaveContext.unk_13EA = 0;
Interface_ChangeAlpha(50);
}
@ -838,20 +1006,20 @@ void func_80083108(GlobalContext* globalCtx) { @@ -838,20 +1006,20 @@ void func_80083108(GlobalContext* globalCtx) {
sp28 = 0;
}
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] != ITEM_OCARINA_FAIRY) &&
(gSaveContext.equips.buttonItems[i] != ITEM_OCARINA_TIME)) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_DISABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_DISABLED;
} else {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
}
}
@ -907,154 +1075,154 @@ void func_80083108(GlobalContext* globalCtx) { @@ -907,154 +1075,154 @@ void func_80083108(GlobalContext* globalCtx) {
}
if (interfaceCtx->restrictions.bottles != 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) &&
(gSaveContext.equips.buttonItems[i] <= ITEM_POE)) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_DISABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_DISABLED;
}
}
} else if (interfaceCtx->restrictions.bottles == 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) &&
(gSaveContext.equips.buttonItems[i] <= ITEM_POE)) {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
}
}
}
if (interfaceCtx->restrictions.tradeItems != 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((CVar_GetS32("gMMBunnyHood", 0) != 0)
&& (gSaveContext.equips.buttonItems[i] >= ITEM_MASK_KEATON)
&& (gSaveContext.equips.buttonItems[i] <= ITEM_MASK_TRUTH)) {
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
} else if ((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK)) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_DISABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_DISABLED;
}
}
} else if (interfaceCtx->restrictions.tradeItems == 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK)) {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
}
}
}
if (interfaceCtx->restrictions.hookshot != 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] == ITEM_HOOKSHOT) ||
(gSaveContext.equips.buttonItems[i] == ITEM_LONGSHOT)) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_DISABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_DISABLED;
}
}
} else if (interfaceCtx->restrictions.hookshot == 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] == ITEM_HOOKSHOT) ||
(gSaveContext.equips.buttonItems[i] == ITEM_LONGSHOT)) {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
}
}
}
if (interfaceCtx->restrictions.ocarina != 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] == ITEM_OCARINA_FAIRY) ||
(gSaveContext.equips.buttonItems[i] == ITEM_OCARINA_TIME)) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_DISABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_DISABLED;
}
}
} else if (interfaceCtx->restrictions.ocarina == 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] == ITEM_OCARINA_FAIRY) ||
(gSaveContext.equips.buttonItems[i] == ITEM_OCARINA_TIME)) {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
}
}
}
if (interfaceCtx->restrictions.farores != 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (gSaveContext.equips.buttonItems[i] == ITEM_FARORES_WIND) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_DISABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_DISABLED;
osSyncPrintf("***(i=%d)*** ", i);
}
}
} else if (interfaceCtx->restrictions.farores == 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (gSaveContext.equips.buttonItems[i] == ITEM_FARORES_WIND) {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
}
}
}
if (interfaceCtx->restrictions.dinsNayrus != 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] == ITEM_DINS_FIRE) ||
(gSaveContext.equips.buttonItems[i] == ITEM_NAYRUS_LOVE)) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_DISABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_DISABLED;
}
}
} else if (interfaceCtx->restrictions.dinsNayrus == 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] == ITEM_DINS_FIRE) ||
(gSaveContext.equips.buttonItems[i] == ITEM_NAYRUS_LOVE)) {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
}
}
}
if (interfaceCtx->restrictions.all != 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] != ITEM_OCARINA_FAIRY) &&
(gSaveContext.equips.buttonItems[i] != ITEM_OCARINA_TIME) &&
!((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) &&
@ -1063,22 +1231,22 @@ void func_80083108(GlobalContext* globalCtx) { @@ -1063,22 +1231,22 @@ void func_80083108(GlobalContext* globalCtx) {
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
if ((globalCtx->sceneNum != SCENE_TAKARAYA) ||
(gSaveContext.equips.buttonItems[i] != ITEM_LENS)) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_DISABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_DISABLED;
} else {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
}
}
}
} else if (interfaceCtx->restrictions.all == 0) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((gSaveContext.equips.buttonItems[i] != ITEM_DINS_FIRE) &&
(gSaveContext.equips.buttonItems[i] != ITEM_HOOKSHOT) &&
(gSaveContext.equips.buttonItems[i] != ITEM_LONGSHOT) &&
@ -1090,11 +1258,11 @@ void func_80083108(GlobalContext* globalCtx) { @@ -1090,11 +1258,11 @@ void func_80083108(GlobalContext* globalCtx) {
(gSaveContext.equips.buttonItems[i] <= ITEM_POE)) &&
!((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) {
sp28 = 1;
}
gSaveContext.buttonStatus[i] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
}
}
}
@ -1196,7 +1364,7 @@ void Inventory_SwapAgeEquipment(void) { @@ -1196,7 +1364,7 @@ void Inventory_SwapAgeEquipment(void) {
u16 temp;
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
for (i = 0; i < 4; i++) {
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (i != 0) {
gSaveContext.childEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
} else {
@ -1225,8 +1393,18 @@ void Inventory_SwapAgeEquipment(void) { @@ -1225,8 +1393,18 @@ void Inventory_SwapAgeEquipment(void) {
gSaveContext.equips.cButtonSlots[1] = SLOT_BOMB;
gSaveContext.equips.cButtonSlots[2] = SLOT_OCARINA;
gSaveContext.equips.equipment = 0x1122;
// Set the dpad to nothing
gSaveContext.equips.buttonItems[4] = ITEM_NONE;
gSaveContext.equips.buttonItems[5] = ITEM_NONE;
gSaveContext.equips.buttonItems[6] = ITEM_NONE;
gSaveContext.equips.buttonItems[7] = ITEM_NONE;
gSaveContext.equips.cButtonSlots[3] = SLOT_NONE;
gSaveContext.equips.cButtonSlots[4] = SLOT_NONE;
gSaveContext.equips.cButtonSlots[5] = SLOT_NONE;
gSaveContext.equips.cButtonSlots[6] = SLOT_NONE;
} else {
for (i = 0; i < 4; i++) {
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
gSaveContext.equips.buttonItems[i] = gSaveContext.adultEquips.buttonItems[i];
if (i != 0) {
@ -1246,7 +1424,7 @@ void Inventory_SwapAgeEquipment(void) { @@ -1246,7 +1424,7 @@ void Inventory_SwapAgeEquipment(void) {
gSaveContext.equips.equipment = gSaveContext.adultEquips.equipment;
}
} else {
for (i = 0; i < 4; i++) {
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
gSaveContext.adultEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
if (i != 0) {
@ -1257,7 +1435,7 @@ void Inventory_SwapAgeEquipment(void) { @@ -1257,7 +1435,7 @@ void Inventory_SwapAgeEquipment(void) {
gSaveContext.adultEquips.equipment = gSaveContext.equips.equipment;
if (gSaveContext.childEquips.buttonItems[0] != ITEM_NONE) {
for (i = 0; i < 4; i++) {
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
gSaveContext.equips.buttonItems[i] = gSaveContext.childEquips.buttonItems[i];
if (i != 0) {
@ -1353,10 +1531,14 @@ void func_80084BF4(GlobalContext* globalCtx, u16 flag) { @@ -1353,10 +1531,14 @@ void func_80084BF4(GlobalContext* globalCtx, u16 flag) {
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_ENABLED;
gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] =
gSaveContext.buttonStatus[8] = BTN_ENABLED;
Interface_ChangeAlpha(7);
} else {
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_ENABLED;
gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] =
gSaveContext.buttonStatus[8] = BTN_ENABLED;
func_80083108(globalCtx);
}
}
@ -1565,7 +1747,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { @@ -1565,7 +1747,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
return ITEM_NONE;
} else if (item == ITEM_LONGSHOT) {
INV_CONTENT(item) = item;
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (gSaveContext.equips.buttonItems[i] == ITEM_HOOKSHOT) {
gSaveContext.equips.buttonItems[i] = ITEM_LONGSHOT;
Interface_LoadItemIcon1(globalCtx, i);
@ -1699,7 +1881,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { @@ -1699,7 +1881,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
return ITEM_NONE;
} else if (item == ITEM_OCARINA_TIME) {
INV_CONTENT(ITEM_OCARINA_TIME) = ITEM_OCARINA_TIME;
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (gSaveContext.equips.buttonItems[i] == ITEM_OCARINA_FAIRY) {
gSaveContext.equips.buttonItems[i] = ITEM_OCARINA_TIME;
Interface_LoadItemIcon1(globalCtx, i);
@ -1781,18 +1963,13 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { @@ -1781,18 +1963,13 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
gSaveContext.equips.cButtonSlots[0], gSaveContext.equips.cButtonSlots[1],
gSaveContext.equips.cButtonSlots[2], temp + i, item);
if ((temp + i) == gSaveContext.equips.cButtonSlots[0]) {
gSaveContext.equips.buttonItems[1] = item;
Interface_LoadItemIcon2(globalCtx, 1);
gSaveContext.buttonStatus[1] = BTN_ENABLED;
} else if ((temp + i) == gSaveContext.equips.cButtonSlots[1]) {
gSaveContext.equips.buttonItems[2] = item;
Interface_LoadItemIcon2(globalCtx, 2);
gSaveContext.buttonStatus[2] = BTN_ENABLED;
} else if ((temp + i) == gSaveContext.equips.cButtonSlots[2]) {
gSaveContext.equips.buttonItems[3] = item;
Interface_LoadItemIcon1(globalCtx, 3);
gSaveContext.buttonStatus[3] = BTN_ENABLED;
for (int buttonIndex = 1; buttonIndex < ARRAY_COUNT(gSaveContext.equips.buttonItems); buttonIndex++) {
if ((temp + i) == gSaveContext.equips.cButtonSlots[buttonIndex - 1]) {
gSaveContext.equips.buttonItems[buttonIndex] = item;
Interface_LoadItemIcon2(globalCtx, buttonIndex);
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(buttonIndex)] = BTN_ENABLED;
break;
}
}
gSaveContext.inventory.items[temp + i] = item;
@ -1816,7 +1993,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { @@ -1816,7 +1993,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
INV_CONTENT(item) = item;
if (temp != ITEM_NONE) {
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (temp == gSaveContext.equips.buttonItems[i]) {
if (item != ITEM_SOLD_OUT) {
gSaveContext.equips.buttonItems[i] = item;
@ -1978,7 +2155,7 @@ void Inventory_DeleteItem(u16 item, u16 invSlot) { @@ -1978,7 +2155,7 @@ void Inventory_DeleteItem(u16 item, u16 invSlot) {
osSyncPrintf("\nItem_Register(%d)\n", invSlot, gSaveContext.inventory.items[invSlot]);
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (gSaveContext.equips.buttonItems[i] == item) {
gSaveContext.equips.buttonItems[i] = ITEM_NONE;
gSaveContext.equips.cButtonSlots[i - 1] = SLOT_NONE;
@ -1993,7 +2170,7 @@ s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) { @@ -1993,7 +2170,7 @@ s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) {
if (gSaveContext.inventory.items[i] == oldItem) {
gSaveContext.inventory.items[i] = newItem;
osSyncPrintf("アイテム消去(%d)\n", i); // "Item Purge (%d)"
for (i = 1; i < 4; i++) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (gSaveContext.equips.buttonItems[i] == oldItem) {
gSaveContext.equips.buttonItems[i] = newItem;
Interface_LoadItemIcon1(globalCtx, i);
@ -2056,7 +2233,7 @@ void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 button) { @@ -2056,7 +2233,7 @@ void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 button) {
Interface_LoadItemIcon1(globalCtx, button);
globalCtx->pauseCtx.cursorItem[PAUSE_ITEM] = item;
gSaveContext.buttonStatus[button] = BTN_ENABLED;
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(button)] = BTN_ENABLED;
}
s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) {
@ -2066,7 +2243,7 @@ s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) { @@ -2066,7 +2243,7 @@ s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) {
for (i = 0; i < 4; i++) {
if (gSaveContext.inventory.items[bottleSlot + i] == ITEM_FAIRY) {
for (j = 1; j < 4; j++) {
for (j = 1; j < ARRAY_COUNT(gSaveContext.equips.buttonItems); j++) {
if (gSaveContext.equips.buttonItems[j] == ITEM_FAIRY) {
gSaveContext.equips.buttonItems[j] = ITEM_BOTTLE;
Interface_LoadItemIcon1(globalCtx, j);
@ -2577,10 +2754,15 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { @@ -2577,10 +2754,15 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) &&
(msgCtx->msgMode == MSGMODE_NONE) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) &&
(globalCtx->sceneLoadFlag == 0) && (globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) {
bool hasLens = false;
for (int buttonIndex = 1; buttonIndex < (CVar_GetS32("gDpadEquips", 0) != 0) ? ARRAY_COUNT(gSaveContext.equips.buttonItems) : 4; buttonIndex++) {
if (gSaveContext.equips.buttonItems[buttonIndex] == ITEM_LENS) {
hasLens = true;
break;
}
}
if ((gSaveContext.magic == 0) || ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) ||
((gSaveContext.equips.buttonItems[1] != ITEM_LENS) &&
(gSaveContext.equips.buttonItems[2] != ITEM_LENS) &&
(gSaveContext.equips.buttonItems[3] != ITEM_LENS)) ||
!hasLens ||
(globalCtx->actorCtx.unk_03 == 0)) {
globalCtx->actorCtx.unk_03 = 0;
Audio_PlaySoundGeneral(NA_SE_SY_GLASSMODE_OFF, &D_801333D4, 4, &D_801333E0, &D_801333E0,
@ -3011,10 +3193,20 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 @@ -3011,10 +3193,20 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
gDPLoadTextureBlock(OVERLAY_DISP++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPWideTextureRectangle(OVERLAY_DISP++, OTRGetRectDimensionFromRightEdge(R_ITEM_ICON_X(button)+Right_HUD_Margin) << 2, R_ITEM_ICON_Y(button)+(Top_HUD_Margin*-1) << 2,
(OTRGetRectDimensionFromRightEdge(R_ITEM_ICON_X(button)+Right_HUD_Margin) + R_ITEM_ICON_WIDTH(button)) << 2,
(R_ITEM_ICON_Y(button)+(Top_HUD_Margin*-1) + R_ITEM_ICON_WIDTH(button)) << 2, G_TX_RENDERTILE, 0, 0,
R_ITEM_ICON_DD(button) << 1, R_ITEM_ICON_DD(button) << 1);
// These are moved from registers since there was not room for the dpad data. They are static anyways.
static int16_t sItemIconX[] = { B_BUTTON_X, C_LEFT_BUTTON_X, C_DOWN_BUTTON_X, C_RIGHT_BUTTON_X,
DPAD_UP_X, DPAD_DOWN_X, DPAD_LEFT_X, DPAD_RIGHT_X };
static int16_t sItemIconY[] = { B_BUTTON_Y, C_LEFT_BUTTON_Y, C_DOWN_BUTTON_Y, C_RIGHT_BUTTON_Y,
DPAD_UP_Y, DPAD_DOWN_Y, DPAD_LEFT_Y, DPAD_RIGHT_Y };
static int16_t sItemIconWidth[] = { 30, 24, 24, 24, 16, 16, 16, 16 };
static int16_t sItemIconDD[] = { 550, 680, 680, 680, 1024, 1024, 1024, 1024 };
gSPWideTextureRectangle(
OVERLAY_DISP++, OTRGetRectDimensionFromRightEdge(sItemIconX[button] + Right_HUD_Margin) << 2,
sItemIconY[button] + (Top_HUD_Margin * -1) << 2,
(OTRGetRectDimensionFromRightEdge(sItemIconX[button] + Right_HUD_Margin) + sItemIconWidth[button]) << 2,
(sItemIconY[button] + (Top_HUD_Margin * -1) + sItemIconWidth[button]) << 2, G_TX_RENDERTILE, 0, 0,
sItemIconDD[button] << 1, sItemIconDD[button] << 1);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3094);
}
@ -3030,6 +3222,11 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { @@ -3030,6 +3222,11 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) {
s16 i;
s16 ammo;
static int16_t sItemAmmoX[] = { B_BUTTON_X + 2, C_LEFT_BUTTON_X + 1, C_DOWN_BUTTON_X + 1, C_RIGHT_BUTTON_X + 1,
DPAD_UP_X, DPAD_DOWN_X, DPAD_LEFT_X, DPAD_RIGHT_X };
static int16_t sItemAmmoY[] = { B_BUTTON_Y + 18, C_LEFT_BUTTON_Y + 17, C_DOWN_BUTTON_Y + 17, C_RIGHT_BUTTON_Y + 17,
DPAD_UP_Y + 11, DPAD_DOWN_Y + 11, DPAD_LEFT_Y + 11, DPAD_RIGHT_Y + 11 };
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3105);
i = gSaveContext.equips.buttonItems[button];
@ -3074,11 +3271,13 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { @@ -3074,11 +3271,13 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) {
if (i != 0) {
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, (u8*)_gAmmoDigit0Tex[i], 8, 8,
OTRGetRectDimensionFromRightEdge(R_ITEM_AMMO_X(button)+Right_HUD_Margin), R_ITEM_AMMO_Y(button)+(Top_HUD_Margin*-1), 8, 8, 1 << 10, 1 << 10);
OTRGetRectDimensionFromRightEdge(sItemAmmoX[button] + Right_HUD_Margin),
sItemAmmoY[button] + (Top_HUD_Margin * -1), 8, 8, 1 << 10, 1 << 10);
}
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, (u8*)_gAmmoDigit0Tex[ammo], 8, 8,
OTRGetRectDimensionFromRightEdge(R_ITEM_AMMO_X(button)+Right_HUD_Margin) + 6, R_ITEM_AMMO_Y(button)+(Top_HUD_Margin*-1), 8, 8, 1 << 10, 1 << 10);
OTRGetRectDimensionFromRightEdge(sItemAmmoX[button] + Right_HUD_Margin) + 6,
sItemAmmoY[button] + (Top_HUD_Margin * -1), 8, 8, 1 << 10, 1 << 10);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3158);
@ -3513,6 +3712,67 @@ void Interface_Draw(GlobalContext* globalCtx) { @@ -3513,6 +3712,67 @@ void Interface_Draw(GlobalContext* globalCtx) {
Interface_DrawAmmoCount(globalCtx, 3, interfaceCtx->cRightAlpha);
}
if (CVar_GetS32("gDpadEquips", 0) != 0) {
// DPad is only greyed-out when all 4 DPad directions are too
uint16_t dpadAlpha =
MAX(MAX(MAX(interfaceCtx->dpadUpAlpha, interfaceCtx->dpadDownAlpha), interfaceCtx->dpadLeftAlpha),
interfaceCtx->dpadRightAlpha);
// Draw DPad
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, dpadAlpha);
gDPLoadTextureBlock(OVERLAY_DISP++, ResourceMgr_LoadFileRaw("assets/ship_of_harkinian/buttons/dpad.bin"),
G_IM_FMT_IA, G_IM_SIZ_16b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPWideTextureRectangle(OVERLAY_DISP++, OTRGetRectDimensionFromRightEdge(DPAD_X) << 2, DPAD_Y << 2,
(OTRGetRectDimensionFromRightEdge(DPAD_X) + 32) << 2, (DPAD_Y + 32) << 2,
G_TX_RENDERTILE, 0, 0, (1 << 10), (1 << 10));
// DPad-Up Button Icon & Ammo Count
if (gSaveContext.equips.buttonItems[4] < 0xF0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->dpadUpAlpha);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM);
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[4]], 4);
gDPPipeSync(OVERLAY_DISP++);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
Interface_DrawAmmoCount(globalCtx, 4, interfaceCtx->dpadUpAlpha);
}
// DPad-Down Button Icon & Ammo Count
if (gSaveContext.equips.buttonItems[5] < 0xF0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->dpadDownAlpha);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM);
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[5]], 5);
gDPPipeSync(OVERLAY_DISP++);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
Interface_DrawAmmoCount(globalCtx, 5, interfaceCtx->dpadDownAlpha);
}
// DPad-Left Button Icon & Ammo Count
if (gSaveContext.equips.buttonItems[6] < 0xF0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->dpadLeftAlpha);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM);
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[6]], 6);
gDPPipeSync(OVERLAY_DISP++);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
Interface_DrawAmmoCount(globalCtx, 6, interfaceCtx->dpadLeftAlpha);
}
// DPad-Right Button Icon & Ammo Count
if (gSaveContext.equips.buttonItems[7] < 0xF0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->dpadRightAlpha);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM);
Interface_DrawItemIconTexture(globalCtx, gItemIcons[gSaveContext.equips.buttonItems[7]], 7);
gDPPipeSync(OVERLAY_DISP++);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
Interface_DrawAmmoCount(globalCtx, 7, interfaceCtx->dpadRightAlpha);
}
}
// A Button
func_80094A14(globalCtx->state.gfxCtx);
const f32 rABtnX = OTRGetDimensionFromRightEdge(R_A_BTN_X+Right_HUD_Margin);
@ -3690,7 +3950,7 @@ void Interface_Draw(GlobalContext* globalCtx) { @@ -3690,7 +3950,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
globalCtx->nextEntranceIndex = spoilingItemEntrances[svar1];
INV_CONTENT(gSpoilingItemReverts[svar1]) = gSpoilingItemReverts[svar1];