From c42d10a74bc4777a82a734fbb0647578939a5101 Mon Sep 17 00:00:00 2001 From: MelonSpeedruns Date: Fri, 24 Apr 2026 16:01:15 -0400 Subject: [PATCH] new item code --- include/d/actor/d_a_alink.h | 1 + include/d/d_item.h | 2 ++ include/d/d_item_data.h | 2 +- include/d/d_menu_window_HIO.h | 4 ++-- include/d/d_save.h | 9 +++++---- src/d/actor/d_a_alink.cpp | 14 ++++++++++++++ src/d/actor/d_a_alink_demo.inc | 2 +- src/d/d_item.cpp | 12 ++++++++++-- src/d/d_save.cpp | 8 ++++---- src/dusk/imgui/ImGuiSaveEditor.cpp | 11 ++++++----- 10 files changed, 46 insertions(+), 19 deletions(-) diff --git a/include/d/actor/d_a_alink.h b/include/d/actor/d_a_alink.h index 9980ab776f..f00f238e38 100644 --- a/include/d/actor/d_a_alink.h +++ b/include/d/actor/d_a_alink.h @@ -2383,6 +2383,7 @@ public: void setGroundFishingRodActor(); int procFishingCastInit(); int procFishingCast(); + void procLensOfTruthOn(); int procFishingFoodInit(); int procFishingFood(); f32 getCrawlMoveAnmSpeed(); diff --git a/include/d/d_item.h b/include/d/d_item.h index 0d379c0578..7a0d6cb92d 100644 --- a/include/d/d_item.h +++ b/include/d/d_item.h @@ -71,6 +71,7 @@ void item_func_WOOD_STICK(); void item_func_BOOMERANG(); void item_func_SPINNER(); void item_func_IRONBALL(); +void item_func_LENS_OF_TRUTH(); void item_func_BOW(); void item_func_HOOKSHOT(); void item_func_HVY_BOOTS(); @@ -260,6 +261,7 @@ int item_getcheck_func_WOOD_STICK(); int item_getcheck_func_BOOMERANG(); int item_getcheck_func_SPINNER(); int item_getcheck_func_IRONBALL(); +int item_getcheck_func_LENS_OF_TRUTH(); int item_getcheck_func_BOW(); int item_getcheck_func_HOOKSHOT(); int item_getcheck_func_HVY_BOOTS(); diff --git a/include/d/d_item_data.h b/include/d/d_item_data.h index a1770be241..9177d07458 100644 --- a/include/d/d_item_data.h +++ b/include/d/d_item_data.h @@ -317,7 +317,7 @@ enum { /* 0xDE */ dItemNo_NOENTRY_222_e, /* 0xDF */ dItemNo_NOENTRY_223_e, /* 0xE0 */ dItemNo_POU_SPIRIT_e, - /* 0xE1 */ dItemNo_NOENTRY_225_e, + /* 0xE1 */ dItemNo_LENS_OF_TRUTH_e, /* 0xE2 */ dItemNo_NOENTRY_226_e, /* 0xE3 */ dItemNo_NOENTRY_227_e, /* 0xE4 */ dItemNo_NOENTRY_228_e, diff --git a/include/d/d_menu_window_HIO.h b/include/d/d_menu_window_HIO.h index b5d5c81fb4..d9f68ce1b3 100644 --- a/include/d/d_menu_window_HIO.h +++ b/include/d/d_menu_window_HIO.h @@ -86,8 +86,8 @@ public: /* 0x047 */ u8 field_0x47; /* 0x048 */ u8 mPoes; /* 0x049 */ u8 mPoesCopy; - /* 0x04A */ u8 mItems[24]; - /* 0x062 */ u8 mItemsCopy[24]; + /* 0x04A */ u8 mItems[25]; + /* 0x062 */ u8 mItemsCopy[25]; /* 0x07A */ u8 field_0x7a[24]; /* 0x092 */ u8 mSwords[4]; /* 0x096 */ u8 mShields[3]; diff --git a/include/d/d_save.h b/include/d/d_save.h index 0e9a4b37cd..0f9eb2c51f 100644 --- a/include/d/d_save.h +++ b/include/d/d_save.h @@ -15,7 +15,7 @@ static const int MAX_SELECT_ITEM = 4; static const int SELECT_ITEM_NUM = 2; static const int MAX_EQUIPMENT = 6; static const int MAX_EVENTS = 256; -static const int MAX_ITEM_SLOTS = 24; +static const int MAX_ITEM_SLOTS = 25; static const int LIGHT_DROP_STAGE = 4; static const int LETTER_INFO_BIT = 64; static const int MAX_INSECT_NUM = 24; @@ -75,7 +75,8 @@ enum ItemSlots { /* 0x14 */ SLOT_20, /* 0x15 */ SLOT_21, /* 0x16 */ SLOT_22, - /* 0x17 */ SLOT_23 + /* 0x17 */ SLOT_23, + /* 0x18 */ SLOT_24, }; enum CollectItem { @@ -349,8 +350,8 @@ public: static const int BOMB_BAG_MAX = 3; static const int BOTTLE_MAX = 4; - /* 0x00 */ u8 mItems[24]; - /* 0x18 */ u8 mItemSlots[24]; + /* 0x00 */ u8 mItems[25]; + /* 0x18 */ u8 mItemSlots[25]; }; // Size: 0x30 class dSv_player_get_item_c { diff --git a/src/d/actor/d_a_alink.cpp b/src/d/actor/d_a_alink.cpp index e6943baf96..7fc7fadd34 100644 --- a/src/d/actor/d_a_alink.cpp +++ b/src/d/actor/d_a_alink.cpp @@ -14480,8 +14480,17 @@ enum daAlink_ItemProc { /* 13 */ ITEM_PROC_BOTTLE_SWING, /* 14 */ ITEM_PROC_NOT_USE_ITEM, /* 15 */ ITEM_PROC_GRASS_WHISTLE, + /* 16 */ ITEM_PROC_LENS_OF_TRUTH, }; +void daAlink_c::procLensOfTruthOn() { + if (!checkWolfEyeUp()) { + onWolfEyeUp(); + } else { + offWolfEyeUp(); + } +} + int daAlink_c::changeItemTriggerKeepProc(u8 i_selItemIdx, int i_procType) { u32 sel_item = dComIfGp_getSelectItem(i_selItemIdx); mSelectItemId = i_selItemIdx; @@ -14504,6 +14513,9 @@ int daAlink_c::changeItemTriggerKeepProc(u8 i_selItemIdx, int i_procType) { } else { procKandelaarPourInit(); } + } + else if (i_procType == ITEM_PROC_LENS_OF_TRUTH) { + procLensOfTruthOn(); } else if (i_procType == ITEM_PROC_FISHING_FOOD) { procFishingFoodInit(); } else if (i_procType == ITEM_PROC_BOOTS_EQUIP) { @@ -14572,6 +14584,8 @@ int daAlink_c::checkNewItemChange(u8 i_selItemIdx) { ) { return ITEM_PROC_NONE; + } else if (sel_item == dItemNo_LENS_OF_TRUTH_e) { + return ITEM_PROC_LENS_OF_TRUTH; } else if (sel_item == dItemNo_HVY_BOOTS_e || checkDungeonWarpItem(sel_item) || checkTradeItem(sel_item) diff --git a/src/d/actor/d_a_alink_demo.inc b/src/d/actor/d_a_alink_demo.inc index aa77b24129..5b2d36dce1 100644 --- a/src/d/actor/d_a_alink_demo.inc +++ b/src/d/actor/d_a_alink_demo.inc @@ -2182,7 +2182,7 @@ void daAlink_c::setGetSubBgm(int i_itemNo) { /* dItemNo_NOENTRY_222_e */ SETYPE_NONE, /* dItemNo_NOENTRY_223_e */ SETYPE_NONE, /* dItemNo_POU_SPIRIT_e */ SETYPE_ITEM_GET_POU, - /* dItemNo_NOENTRY_225_e */ SETYPE_NONE, + /* dItemNo_LENS_OF_TRUTH_e */ SETYPE_NONE, /* dItemNo_NOENTRY_226_e */ SETYPE_NONE, /* dItemNo_NOENTRY_227_e */ SETYPE_NONE, /* dItemNo_NOENTRY_228_e */ SETYPE_NONE, diff --git a/src/d/d_item.cpp b/src/d/d_item.cpp index cb525139db..7993760af6 100644 --- a/src/d/d_item.cpp +++ b/src/d/d_item.cpp @@ -236,7 +236,7 @@ static void (*item_func_ptr[256])() = { item_func_noentry, item_func_noentry, item_func_POU_SPIRIT, - item_func_noentry, + item_func_LENS_OF_TRUTH, item_func_noentry, item_func_noentry, item_func_noentry, @@ -504,7 +504,7 @@ static int (*item_getcheck_func_ptr[256])() = { item_getcheck_func_noentry, item_getcheck_func_noentry, item_getcheck_func_POU_SPIRIT, - item_getcheck_func_noentry, + item_getcheck_func_LENS_OF_TRUTH, item_getcheck_func_noentry, item_getcheck_func_noentry, item_getcheck_func_noentry, @@ -791,6 +791,10 @@ void item_func_IRONBALL() { dComIfGs_setItem(SLOT_6, dItemNo_IRONBALL_e); } +void item_func_LENS_OF_TRUTH() { + dComIfGs_setItem(SLOT_24, dItemNo_LENS_OF_TRUTH_e); +} + void item_func_BOW() { dComIfGs_setItem(SLOT_4, dItemNo_BOW_e); dComIfGs_setArrowNum(30); @@ -1453,6 +1457,10 @@ int item_getcheck_func_IRONBALL() { return dComIfGs_getItem(SLOT_6, true) == dItemNo_IRONBALL_e ? TRUE : FALSE; } +int item_getcheck_func_LENS_OF_TRUTH() { + return dComIfGs_getItem(SLOT_24, true) == dItemNo_LENS_OF_TRUTH_e ? TRUE : FALSE; +} + int item_getcheck_func_BOW() { return dComIfGs_getItem(SLOT_4, false) == dItemNo_BOW_e ? TRUE : FALSE; } diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index 3289a49c64..d3c88c1745 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -422,20 +422,20 @@ u8 dSv_player_item_c::getItem(int i_slotNo, bool i_checkCombo) const { } void dSv_player_item_c::setLineUpItem() { - static u8 i_item_lst[23] = { + static u8 i_item_lst[24] = { 10, 8, 6, 2, 9, 4, 3, 0, 1, 23, 20, 5, 15, 16, 17, 11, 12, 13, 14, 19, 18, - 22, 21 + 22, 21, 24 }; int slot_idx = 0; - for (int i = 0; i < 24; i++) { + for (int i = 0; i < 25; i++) { mItemSlots[i] = dItemNo_NONE_e; } - for (int i = 0; i < 23; i++) { + for (int i = 0; i < 24; i++) { u8 current = i_item_lst[i]; if (mItems[current] != dItemNo_NONE_e) { mItemSlots[slot_idx] = current; diff --git a/src/dusk/imgui/ImGuiSaveEditor.cpp b/src/dusk/imgui/ImGuiSaveEditor.cpp index eced44c7f7..2c88352762 100644 --- a/src/dusk/imgui/ImGuiSaveEditor.cpp +++ b/src/dusk/imgui/ImGuiSaveEditor.cpp @@ -251,7 +251,7 @@ namespace dusk { { dItemNo_NOENTRY_222_e, {"Reserved"} }, { dItemNo_NOENTRY_223_e, {"Reserved"} }, { dItemNo_POU_SPIRIT_e, {"Poe Soul"} }, - { dItemNo_NOENTRY_225_e, {"Reserved"} }, + { dItemNo_LENS_OF_TRUTH_e, {"Lens of Truth", ITEMTYPE_EQUIP_e} }, { dItemNo_NOENTRY_226_e, {"Reserved"} }, { dItemNo_NOENTRY_227_e, {"Reserved"} }, { dItemNo_NOENTRY_228_e, {"Reserved"} }, @@ -408,6 +408,7 @@ namespace dusk { { SLOT_21, dItemNo_HORSE_FLUTE_e }, { SLOT_22, dItemNo_ANCIENT_DOCUMENT_e }, { SLOT_23, dItemNo_PACHINKO_e }, + { SLOT_24, dItemNo_LENS_OF_TRUTH_e}, }; ImGuiSaveEditor::ImGuiSaveEditor() {} @@ -533,7 +534,7 @@ namespace dusk { selectItemData = 0xFF; } - for (int i = 0; i < 24; i++) { + for (int i = 0; i < 25; i++) { u8 itemNo = item.mItems[i]; if (ImGui::Selectable(fmt::format("Slot {0} ({1})", i, itemMap.find(itemNo)->second.m_name).c_str())) { selectItemData = i; @@ -820,19 +821,19 @@ namespace dusk { if (ImGui::TreeNode("Item Wheel")) { if (ImGui::Button("Default All##inv_default_all")) { - for (int slot = 0; slot < 24; slot++) { + for (int slot = 0; slot < 25; slot++) { dComIfGs_setItem(slot, getSlotDefault(slot)); } } ImGui::SameLine(); if (ImGui::Button("Clear All##inv_clear_all")) { - for (int slot = 0; slot < 24; slot++) { + for (int slot = 0; slot < 25; slot++) { dComIfGs_setItem(slot, dItemNo_NONE_e); } } ImGuiBeginGroupPanel("Items", { 200, 100 }); - for (int slot = 0; slot < 24; slot++) { + for (int slot = 0; slot < 25; slot++) { ImGui::Text("Slot %02d (%s): ", slot, itemMap.find(getSlotDefault(slot))->second.m_name.c_str()); ImGui::SameLine(240.0f); if (ImGui::BeginCombo(fmt::format("##ItemComboBox{}", slot).c_str(), itemMap.find(item.mItems[slot])->second.m_name.c_str())) {