From 14561ef3182e4be1b1f6c56bcf8ffaa269e103d0 Mon Sep 17 00:00:00 2001 From: robojumper Date: Thu, 25 Dec 2025 00:04:18 +0100 Subject: [PATCH] I sure hope this const doesn't break everything --- config/SOUE01/symbols.txt | 37 +- include/d/d_cs_base.h | 2 +- include/d/d_pouch.h | 2 + include/d/flag/storyflag_map.h | 2 +- include/d/lyt/d_lyt_deposit.h | 62 +- include/d/lyt/d_lyt_deposit_box_cursor.h | 6 +- include/d/lyt/d_lyt_deposit_stock.h | 23 +- .../MSL/MSL_C/MSL_Common/Include/cwchar | 6 +- src/d/lyt/d_lyt_deposit.cpp | 945 ++++++++++++++++-- src/d/lyt/d_lyt_deposit_box_cursor.cpp | 13 +- src/d/lyt/d_lyt_deposit_stock.cpp | 2 +- 11 files changed, 990 insertions(+), 110 deletions(-) diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index d7d68eea..b1627571 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -10094,7 +10094,7 @@ getAdditionalCapacitySizeForItem = .text:0x8018AC70; // type:function size:0x60 swapStockAndPouchItems__Fll = .text:0x8018ACD0; // type:function size:0xC4 swapStockItems__Fll = .text:0x8018ADA0; // type:function size:0xA0 swapAdventurePouchItems__Fll = .text:0x8018AE40; // type:function size:0x120 -fn_8018AF60 = .text:0x8018AF60; // type:function size:0x204 +sortStock__Fv = .text:0x8018AF60; // type:function size:0x204 itemCheckFindItemSlot__F7ITEM_ID = .text:0x8018B170; // type:function size:0x60 fn_8018B1D0 = .text:0x8018B1D0; // type:function size:0x60 fn_8018B230 = .text:0x8018B230; // type:function size:0x74 @@ -16013,30 +16013,30 @@ setModeIn__17dLytDepositMain_cFv = .text:0x802A9EE0; // type:function size:0x19C setModeCheck__17dLytDepositMain_cFv = .text:0x802AA080; // type:function size:0x84 setModeChange__17dLytDepositMain_cFb = .text:0x802AA110; // type:function size:0xE4 setModeArrangement__17dLytDepositMain_cFv = .text:0x802AA200; // type:function size:0x90 -fn_802AA290 = .text:0x802AA290; // type:function size:0x13C -fn_802AA3D0 = .text:0x802AA3D0; // type:function size:0xFC -fn_802AA4D0 = .text:0x802AA4D0; // type:function size:0xEC -fn_802AA5C0 = .text:0x802AA5C0; // type:function size:0xB0 -fn_802AA670 = .text:0x802AA670; // type:function size:0xF8 +setModeReverseChange__17dLytDepositMain_cFv = .text:0x802AA290; // type:function size:0x13C +setModeScroll__17dLytDepositMain_cFbb = .text:0x802AA3D0; // type:function size:0xFC +setModeRecycle__17dLytDepositMain_cFv = .text:0x802AA4D0; // type:function size:0xEC +setModeArrangementOut__17dLytDepositMain_cFv = .text:0x802AA5C0; // type:function size:0xB0 +setModeOut__17dLytDepositMain_cFv = .text:0x802AA670; // type:function size:0xF8 getStateID__86sStateMgr_c<17dLytDepositMain_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x802AA770; // type:function size:0x10 -loadItems__17dLytDepositMain_cFl = .text:0x802AA780; // type:function size:0x5C -fn_802AA7E0__17dLytDepositMain_cFv = .text:0x802AA7E0; // type:function size:0x348 -fn_802AAB30__17dLytDepositMain_cFv = .text:0x802AAB30; // type:function size:0x388 -fn_802AAEC0__17dLytDepositMain_cFl = .text:0x802AAEC0; // type:function size:0xF8 -fn_802AAFC0__17dLytDepositMain_cFv = .text:0x802AAFC0; // type:function size:0xB4 -fn_802AB080__17dLytDepositMain_cFv = .text:0x802AB080; // type:function size:0x188 -fn_802AB210__17dLytDepositMain_cFv = .text:0x802AB210; // type:function size:0x474 -fn_802AB690 = .text:0x802AB690; // type:function size:0xB8 -fn_802AB750 = .text:0x802AB750; // type:function size:0x2E8 +loadStockItems__17dLytDepositMain_cFl = .text:0x802AA780; // type:function size:0x5C +buildSubpanes__17dLytDepositMain_cFv = .text:0x802AA7E0; // type:function size:0x348 +loadInitialState__17dLytDepositMain_cFv = .text:0x802AAB30; // type:function size:0x388 +loadPouchItem__17dLytDepositMain_cFl = .text:0x802AAEC0; // type:function size:0xF8 +checkPointToStock__17dLytDepositMain_cFv = .text:0x802AAFC0; // type:function size:0xB4 +checkPointToPouch__17dLytDepositMain_cFv = .text:0x802AB080; // type:function size:0x188 +handleNavOrPoint__17dLytDepositMain_cFv = .text:0x802AB210; // type:function size:0x474 +navigateOffIcon__17dLytDepositMain_cFv = .text:0x802AB690; // type:function size:0xB8 +checkNav__17dLytDepositMain_cFv = .text:0x802AB750; // type:function size:0x2E8 loadItemText__17dLytDepositMain_cFll = .text:0x802ABA40; // type:function size:0x114 fn_802ABB60__17dLytDepositMain_cFv = .text:0x802ABB60; // type:function size:0x580 fn_802AC0E0__17dLytDepositMain_cFl = .text:0x802AC0E0; // type:function size:0x1A8 fn_802AC290__17dLytDepositMain_cFl = .text:0x802AC290; // type:function size:0xC4 -fn_802AC360 = .text:0x802AC360; // type:function size:0x58 +fn_802AC360__17dLytDepositMain_cFl = .text:0x802AC360; // type:function size:0x58 fn_802AC3C0__17dLytDepositMain_cFv = .text:0x802AC3C0; // type:function size:0x234 fn_802AC600 = .text:0x802AC600; // type:function size:0x64 fn_802AC670__17dLytDepositMain_cFv = .text:0x802AC670; // type:function size:0x304 -fn_802AC980 = .text:0x802AC980; // type:function size:0x54 +fn_802AC980__17dLytDepositMain_cFv = .text:0x802AC980; // type:function size:0x54 fn_802AC9E0 = .text:0x802AC9E0; // type:function size:0x90 setPouchItemsVisible__17dLytDepositMain_cFb = .text:0x802ACA70; // type:function size:0x80 checkForItemPickupOrDrop__17dLytDepositMain_cFv = .text:0x802ACAF0; // type:function size:0x85C @@ -37454,7 +37454,8 @@ lbl_8053D550 = .data:0x8053D550; // type:object size:0xF data:string jumptable_8053D560 = .data:0x8053D560; // type:object size:0x24 scope:local lbl_8053D584 = .data:0x8053D584; // type:object size:0x44 lbl_8053D5C8 = .data:0x8053D5C8; // type:object size:0xD data:string -lbl_8053D5D8 = .data:0x8053D5D8; // type:object size:0x34 +lbl_8053D5D8 = .data:0x8053D5D8; // type:object size:0xE data:string +lbl_8053D5E8 = .data:0x8053D5E8; // type:object size:0x24 g_profile_LYT_DEPOSIT = .data:0x8053D60C; // type:object size:0xC lbl_8053D618 = .data:0x8053D618; // type:object size:0x1B data:string __vt__13dLytDeposit_c = .data:0x8053D638; // type:object size:0x50 diff --git a/include/d/d_cs_base.h b/include/d/d_cs_base.h index b27832bc..0ac075b9 100644 --- a/include/d/d_cs_base.h +++ b/include/d/d_cs_base.h @@ -39,7 +39,7 @@ public: mCalibrationPointCenterEnabled = val; } - dCursorHitCheck_c *getHitCheck() { + dCursorHitCheck_c *getHitCheck() const { return mCursorIf.getHit(); } diff --git a/include/d/d_pouch.h b/include/d/d_pouch.h index b7ca10cb..6ef2f808 100644 --- a/include/d/d_pouch.h +++ b/include/d/d_pouch.h @@ -23,6 +23,8 @@ bool swapAdventurePouchItems(s32 slot1, s32 slot2); bool swapStockAndPouchItems(s32 pouchSlot, s32 stockSlot); bool swapStockItems(s32 slot1, s32 slot2); +void sortStock(); + #define ITEM_CHECK_SLOT_NONE 60 u16 itemCheckFindItemSlot(ITEM_ID item); diff --git a/include/d/flag/storyflag_map.h b/include/d/flag/storyflag_map.h index 940380fd..9f82fc70 100644 --- a/include/d/flag/storyflag_map.h +++ b/include/d/flag/storyflag_map.h @@ -1520,7 +1520,7 @@ enum StoryFlags_e { /** [Set when talking to Strich] * Story Flag #300 (0x012C) - JP 805ACD7D 0x40 / US 805A9AFD 0x40 */ - STORYFLAG_300, + STORYFLAG_TALKED_TO_STRICH, /** [Kukiel screams] * Story Flag #301 (0x012D) - JP 805ACD7D 0x80 / US 805A9AFD 0x80 diff --git a/include/d/lyt/d_lyt_deposit.h b/include/d/lyt/d_lyt_deposit.h index 9e437649..ba7dd61a 100644 --- a/include/d/lyt/d_lyt_deposit.h +++ b/include/d/lyt/d_lyt_deposit.h @@ -11,6 +11,7 @@ #include "d/lyt/d_lyt_deposit_stock.h" #include "d/lyt/d_textbox.h" #include "d/lyt/d_window.h" +#include "m/m_vec.h" #include "nw4r/lyt/lyt_bounding.h" #include "nw4r/lyt/lyt_pane.h" #include "s/s_State.hpp" @@ -32,6 +33,11 @@ public: void setModeCheck(); void setModeChange(bool unk); void setModeArrangement(); + void setModeReverseChange(); + void setModeScroll(bool leftRight, bool viaButton); + void setModeRecycle(); + void setModeArrangementOut(); + void setModeOut(); bool isSellableItem() const { return field_0x19524 && mItemSellValue > 0; @@ -53,6 +59,30 @@ public: return mIsIdle; } + bool isPointingAtToStockBounding() const { + return mIsPointingAtToStockBounding; + } + + bool isPointingAtToPouchBounding() const { + return mIsPointingAtToPouchBounding; + } + + bool getField_0x19523() const { + return field_0x19523; + } + + bool getField_0x19525() const { + return field_0x19525; + } + + bool getField_0x1952B() const { + return field_0x1952B; + } + + bool isHoldingItem() const { + return mCurrentlyHoldingItemSlot >= 0; + } + private: static const s32 NUM_STOCKS = 3; static const s32 STOCK_ACTIVE = 0; @@ -65,28 +95,32 @@ private: static const s32 NUM_PAGES = 5; void setPouchItemsVisible(bool visible); - void fn_802AA7E0(); + void buildSubpanes(); void fn_802AD370(); - void fn_802AAFC0(); - void fn_802AB210(); + void checkPointToStock(); + void handleNavOrPoint(); void checkForItemPickupOrDrop(); void fn_802ABB60(); - void fn_802AB080(); + void checkPointToPouch(); void fn_802AC3C0(); void fn_802AD4C0(); void loadItemText(s32 itemId, s32 where); void fn_802AC670(); void fn_802AC290(s32); void fn_802AD460(); - void loadItems(s32 hiddenSlot); + void loadStockItems(s32 hiddenSlot); s32 getItemSellValueFrame(s32 value); void fn_802AC0E0(s32); - void fn_802AAEC0(s32); + void loadPouchItem(s32 slot); void fn_8018ADA0(s32); - void fn_802AAB30(); + void loadInitialState(); void fn_802AD400(); + void navigateOffIcon(); + s32 checkNav(); + void fn_802AC980(); + void fn_802AC360(s32); STATE_FUNC_DECLARE(dLytDepositMain_c, ModeNone); STATE_FUNC_DECLARE(dLytDepositMain_c, ModeIn); @@ -115,9 +149,7 @@ private: /* 0x00A3C */ dWindow_c *mpWindows[2]; /* 0x00A44 */ dTextBox_c *mpSizeBoxes[2]; /* 0x00A4C */ dCursorHitCheckLyt_c mCsHitCheck; - - u8 _0x00002[0x8]; - + /* 0x00A74 */ mVec2_c mCsPosition; /* 0x00A7C */ dLytDepositStock_c mStock[NUM_STOCKS]; /* 0x143F0 */ dLytDepositBoxCursor_c mCursor; /* 0x14D48 */ dLytCommonIconItem_c mPouchItems[RING_NUM_ITEMS]; @@ -127,8 +159,8 @@ private: /* 0x19494 */ d2d::SubPaneList mRingList; /* 0x194A0 */ d2d::SubPaneListNode mRingNodes[RING_NUM_ITEMS]; /* 0x19520 */ bool mIsIdle; - /* 0x19521 */ bool field_0x19521; - /* 0x19522 */ bool field_0x19522; + /* 0x19521 */ bool mIsPointingAtToStockBounding; + /* 0x19522 */ bool mIsPointingAtToPouchBounding; /* 0x19523 */ bool field_0x19523; /* 0x19524 */ bool field_0x19524; /* 0x19525 */ bool field_0x19525; @@ -189,9 +221,9 @@ private: /* 0x08C */ UI_STATE_MGR_DECLARE(dLytDeposit_c); /* 0x0C8 */ d2d::ResAccIf_c mResAcc; /* 0x438 */ dLytDepositMain_c mMain; - /* 0x19998 */ bool field_0x19998; - /* 0x19999 */ bool field_0x19999; - /* 0x1999A */ bool field_0x1999A; + /* 0x19998 */ bool mInRequest; + /* 0x19999 */ bool mIsMovingOut; + /* 0x1999A */ bool mScrollViaArrowButton; }; #endif diff --git a/include/d/lyt/d_lyt_deposit_box_cursor.h b/include/d/lyt/d_lyt_deposit_box_cursor.h index 4c403b48..65cdf154 100644 --- a/include/d/lyt/d_lyt_deposit_box_cursor.h +++ b/include/d/lyt/d_lyt_deposit_box_cursor.h @@ -14,7 +14,7 @@ public: }; public: - dLytDepositBoxCursor_c() : mSlot(-1), field_0x950(0), mItemLocation(0) {} + dLytDepositBoxCursor_c() : mSlot(-1), mItem(0), mItemLocation(0) {} /* vt 0x0C */ virtual bool build(d2d::ResAccIf_c *resAcc) override; /* vt 0x10 */ virtual bool remove() override; /* vt 0x14 */ virtual bool execute() override; @@ -33,7 +33,7 @@ public: bool draw(); void init(s32 location, s32 slot, s32 item, bool unk); - void updateSlot(s32 location, s32 slot, s32 unk, bool unk2); + void updateSlot(s32 location, s32 slot, s32 item, bool unk2); void fn_801580A0(); bool isVisible() const { @@ -58,7 +58,7 @@ private: /* 0x948 */ bool mIsVisible; /* 0x948 */ bool field_0x949; /* 0x94C */ s32 mSlot; - /* 0x950 */ s32 field_0x950; + /* 0x950 */ s32 mItem; /* 0x954 */ s32 mItemLocation; }; diff --git a/include/d/lyt/d_lyt_deposit_stock.h b/include/d/lyt/d_lyt_deposit_stock.h index faf8eb85..90f2c061 100644 --- a/include/d/lyt/d_lyt_deposit_stock.h +++ b/include/d/lyt/d_lyt_deposit_stock.h @@ -79,6 +79,10 @@ public: return mIsModeSell; } + bool isModeFinish() const { + return mIsModeFinish; + } + void disableModeSort() { mIsModeSort = false; } @@ -91,7 +95,11 @@ public: mIsModeSell = false; } - void returnToNormalMode() { + void disableModeFinish() { + mIsModeFinish = false; + } + + void returnToNoneMode() { mIsModeFinish = false; mIsModeSell = false; mIsModeSort = false; @@ -99,6 +107,13 @@ public: mSavedArrowDirection = ARROW_NONE; } + void disableSpecialModes() { + mIsModeSell = false; + mIsModeFinish = false; + mIsModeSort = false; + mSavedArrowDirection = ARROW_NONE; + } + u8 getItem(s32 idx) const { return mItemIds[idx]; } @@ -127,6 +142,10 @@ public: return mArrowDirection; } + void setMainStock(bool b) { + mIsMainStock = b; + } + //private: static const s32 NUM_ICONS_PER_PAGE = 12; static const s32 NUM_PAGES = 5; @@ -161,7 +180,7 @@ public: /* 0x684A */ bool mIsSortBlocked; /* 0x684B */ bool field_0x684B; /* 0x684C */ bool field_0x684C; - /* 0x684D */ bool field_0x684D; + /* 0x684D */ bool mIsMainStock; /* 0x684E */ bool field_0x684E; /* 0x6850 */ s32 mCurrentNavTarget; /* 0x6854 */ UNKWORD field_0x6854; diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cwchar b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cwchar index 7191d7a0..3e2dfba5 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cwchar +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cwchar @@ -4,8 +4,8 @@ #ifdef __cplusplus namespace std { -using ::mbstowcs; -using ::mbtowc; +// using ::mbstowcs; +// using ::mbtowc; using ::swprintf; using ::vswprintf; using ::wcscat; @@ -14,7 +14,7 @@ using ::wcscmp; using ::wcscpy; using ::wcslen; using ::wcsncpy; -using ::wcstombs; +// using ::wcstombs; } // namespace std #endif diff --git a/src/d/lyt/d_lyt_deposit.cpp b/src/d/lyt/d_lyt_deposit.cpp index 8548de8d..04bf619d 100644 --- a/src/d/lyt/d_lyt_deposit.cpp +++ b/src/d/lyt/d_lyt_deposit.cpp @@ -8,7 +8,11 @@ #include "d/d_pad.h" #include "d/d_pad_nav.h" #include "d/d_pouch.h" +#include "d/d_rumble.h" +#include "d/flag/storyflag_manager.h" #include "d/lyt/d2d.h" +#include "d/lyt/d_lyt_common_icon_item.h" +#include "d/lyt/d_lyt_common_icon_item_maps.h" #include "d/lyt/d_lyt_deposit_box_cursor.h" #include "d/lyt/d_lyt_deposit_stock.h" #include "d/lyt/d_lyt_util_items.h" @@ -19,11 +23,17 @@ #include "f/f_profile_name.h" #include "m/m_pad.h" #include "m/m_vec.h" +#include "nw4r/lyt/lyt_group.h" +#include "nw4r/lyt/lyt_pane.h" +#include "nw4r/lyt/lyt_types.h" #include "nw4r/math/math_types.h" +#include "nw4r/types_nw4r.h" #include "sized_string.h" #include "toBeSorted/arc_managers/layout_arc_manager.h" #include "toBeSorted/file_manager.h" +#include + struct DepositSellValues { /* 0x00 */ u8 itemId; /* 0x02 */ u16 sellValue; //< 0 -> unsellable @@ -178,12 +188,12 @@ void dLytDepositMain_c::executeState_ModeIn() { void dLytDepositMain_c::finalizeState_ModeIn() {} void dLytDepositMain_c::initializeState_ModeCheck() { - field_0x19521 = false; - field_0x19522 = false; + mIsPointingAtToStockBounding = false; + mIsPointingAtToPouchBounding = false; } void dLytDepositMain_c::executeState_ModeCheck() { - fn_802AAFC0(); - fn_802AB210(); + checkPointToStock(); + handleNavOrPoint(); checkForItemPickupOrDrop(); fn_802ABB60(); mIsIdle = true; @@ -191,13 +201,13 @@ void dLytDepositMain_c::executeState_ModeCheck() { void dLytDepositMain_c::finalizeState_ModeCheck() {} void dLytDepositMain_c::initializeState_ModeChange() { - field_0x19521 = false; - field_0x19522 = false; + mIsPointingAtToStockBounding = false; + mIsPointingAtToPouchBounding = false; } void dLytDepositMain_c::executeState_ModeChange() { if (mIsIdle) { fn_802AC3C0(); - fn_802AB080(); + checkPointToPouch(); if (field_0x19550 != 0) { field_0x19550--; } else { @@ -214,7 +224,7 @@ void dLytDepositMain_c::executeState_ModeChange() { if (mStock[STOCK_ACTIVE].isModePouch()) { mStock[STOCK_ACTIVE].disableModePouch(); - field_0x19522 = true; + mIsPointingAtToPouchBounding = true; } } @@ -232,7 +242,8 @@ void dLytDepositMain_c::executeState_ModeChange() { v = -1; } else { s32 item = mStock[STOCK_ACTIVE].getItem(mStock[STOCK_ACTIVE].getCurrentNavTarget()); - if (item != 12 && item != 50 && slot >= 0 && slot < NUM_ICONS_PER_PAGE * NUM_PAGES) { + if (item != LYT_CMN_PouchBlank4 && item != LYT_CMN_PouchPotionHealthPlusPlusHalf && slot >= 0 && + slot < NUM_ICONS_PER_PAGE * NUM_PAGES) { v = FileManager::GetInstance()->getItemCheckItem(slot); if (v == 0) { v = -1; @@ -241,7 +252,7 @@ void dLytDepositMain_c::executeState_ModeChange() { v = -1; } } - loadItemText(v, true); + loadItemText(v, dLytDepositBoxCursor_c::LOC_STOCK); fn_802ABB60(); fn_802AC670(); } else { @@ -253,7 +264,7 @@ void dLytDepositMain_c::executeState_ModeChange() { mStock[STOCK_ACTIVE].fn_80156530(true); setPouchItemsVisible(false); field_0x1954C = 1; - mStock[STOCK_ACTIVE].returnToNormalMode(); + mStock[STOCK_ACTIVE].returnToNoneMode(); s32 target = mStock[STOCK_ACTIVE].getCurrentNavTarget(); if (target < 0) { target += NUM_ICONS_PER_PAGE; @@ -276,7 +287,7 @@ void dLytDepositMain_c::executeState_ModeArrangement() { if (!mIsIdle) { if (mAnm[DEPOSIT_ANIM_BTN_DECIDE_01].isEndReached()) { mAnm[DEPOSIT_ANIM_BTN_DECIDE_01].setAnimEnable(false); - loadItems(mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET); + loadStockItems(mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET); mStock[STOCK_ACTIVE].fn_80156530(true); field_0x1954C = 1; mIsIdle = true; @@ -495,8 +506,6 @@ static const char *sWindowNames[] = { "W_bgP_01", }; -static const char *sGroupName = "G_ref_00"; - bool dLytDepositMain_c::build(d2d::ResAccIf_c *resAcc) { mLyt.setResAcc(resAcc); mLyt.build("depositBox_00.brlyt", nullptr); @@ -565,7 +574,7 @@ bool dLytDepositMain_c::build(d2d::ResAccIf_c *resAcc) { mAnm[i + DEPOSIT_ANIM_FLASH_OFFSET].setAnimEnable(false); } - fn_802AA7E0(); + buildSubpanes(); mCsHitCheck.init(mLyt.getLayout()->GetRootPane(), 0x1, 0, 0); dCsMgr_c::GetInstance()->registCursorTarget(&mCsHitCheck); fn_802AD370(); @@ -577,10 +586,10 @@ bool dLytDepositMain_c::build(d2d::ResAccIf_c *resAcc) { setModeNone(); - field_0x19521 = false; - field_0x19522 = false; - field_0x19523 = false; + mIsPointingAtToStockBounding = false; + mIsPointingAtToPouchBounding = false; field_0x19524 = false; + field_0x19523 = false; field_0x19525 = false; field_0x19526 = false; field_0x19527 = false; @@ -620,7 +629,7 @@ bool dLytDepositMain_c::execute() { mCursor.execute(); for (int i = 0; i < RING_NUM_ITEMS; i++) { - if (mPouchItemIds[i] < 50) { + if (mPouchItemIds[i] < LYT_CMN_PouchPotionHealthPlusPlusHalf) { mRingNodes[i].mpLytPane->execute(); } } @@ -714,7 +723,7 @@ void dLytDepositMain_c::setModeIn() { } else { loc = dLytDepositBoxCursor_c::LOC_POUCH; } - fn_802AAB30(); + loadInitialState(); if (loc == dLytDepositBoxCursor_c::LOC_POUCH) { mAnm[DEPOSIT_ANIM_IN].setAnimEnable(true); @@ -785,6 +794,733 @@ void dLytDepositMain_c::setModeArrangement() { mStateMgr.changeState(StateID_ModeArrangement); } +void dLytDepositMain_c::setModeReverseChange() { + mAnm[DEPOSIT_ANIM_CHANGE].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_CHANGE].setFrame(mAnm[DEPOSIT_ANIM_CHANGE].getLastFrame()); + mAnm[DEPOSIT_ANIM_CHANGE].setBackwardsOnce(); + mAnm[DEPOSIT_ANIM_SELECT_ON_POUCH].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_SELECT_ON_POUCH].setFrame(0.0f); + mAnm[DEPOSIT_ANIM_SELECT_ON_POUCH].setForwardOnce(); + + mLyt.calc(); + + mStock[STOCK_ACTIVE].navigateOffIcon(); + mStock[STOCK_ACTIVE].field_0x684B = true; + mStock[STOCK_ACTIVE].fn_80156530(false); + mStock[STOCK_ACTIVE].navigateToItem(); + mStock[STOCK_ACTIVE].returnToNoneMode(); + mCurrentPouchNavTarget = -4; + fn_802AD400(); + mArrow.requestOut(); + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_CHANGE_POUCH); + mStateStep = 0; + mStateMgr.changeState(StateID_ModeReverseChange); + mIsIdle = false; +} + +void dLytDepositMain_c::setModeScroll(bool leftRight, bool viaButton) { + if (leftRight) { + mAnm[DEPOSIT_ANIM_SCROLL_R].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_SCROLL_R].setFrame(0.0f); + } else { + mAnm[DEPOSIT_ANIM_SCROLL_L].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_SCROLL_L].setFrame(0.0f); + } + mLyt.calc(); + mStock[STOCK_ACTIVE].navigateOffIcon(); + mStock[STOCK_ACTIVE].field_0x684B = true; + mStock[STOCK_ACTIVE].fn_80156530(false); + if (viaButton) { + mArrow.fn_80168760(); + } + fn_802AD400(); + mHasScrolledOtherStocks = false; + mStateMgr.changeState(StateID_ModeScroll); + mIsIdle = false; +} + +void dLytDepositMain_c::setModeRecycle() { + mAnm[DEPOSIT_ANIM_BTN_DECIDE_02].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_BTN_DECIDE_02].setFrame(0.0f); + mLyt.calc(); + mStateStep = 0; + field_0x19526 = true; + field_0x19527 = true; + + if (field_0x1954C == 0) { + setPouchItemsVisible(false); + } else { + mStock[STOCK_ACTIVE].fn_80156530(false); + } + dPadNav::setNavEnabled(false, false); + mCursor.setVisible(false); + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_SELECT_SELL); + mStateMgr.changeState(StateID_ModeRecycle); + mIsIdle = false; +} + +void dLytDepositMain_c::setModeArrangementOut() { + mAnm[DEPOSIT_ANIM_BTN_DECIDE_01].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_BTN_DECIDE_01].setFrame(0.0f); + mLyt.calc(); + field_0x19526 = false; + mCursorLocation = dLytDepositBoxCursor_c::LOC_STOCK; + field_0x19527 = true; + mStateStep = 0; + dPadNav::setNavEnabled(false, false); + mStateMgr.changeState(StateID_ModeArrangementOut); + mIsIdle = false; +} + +void dLytDepositMain_c::setModeOut() { + mAnm[DEPOSIT_ANIM_BTN_DECIDE_00].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_BTN_DECIDE_00].setFrame(0.0f); + mLyt.calc(); + + if (*mStateMgr.getStateID() == StateID_ModeChange) { + navigateOffIcon(); + } else { + mStock[STOCK_ACTIVE].navigateOffIcon(); + } + + field_0x19526 = false; + field_0x19527 = false; + + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_SELECT_DECIDE); + dPadNav::setNavEnabled(false, false); + mStateMgr.changeState(StateID_ModeOut); + mIsIdle = false; +} + +void dLytDepositMain_c::loadStockItems(s32 hiddenSlot) { + for (int i = 0; i < NUM_STOCKS; i++) { + mStock[i].loadItems(hiddenSlot); + } +} + +static const char *sGroupName = "G_ref_00"; + +void dLytDepositMain_c::buildSubpanes() { + void *data = LayoutArcManager::GetInstance()->getLoadedData("DoButton"); + d2d::ResAccIf_c resAcc1; + resAcc1.attach(data, ""); + + for (int i = 0; i < RING_NUM_ITEMS; i++) { + mRingNodes[i].mpLytPane = &mPouchItems[i]; + mPouchItems[i].build(&resAcc1, dLytCommonIconItem_c::POUCH); + mRingList.PushBack(&mRingNodes[i]); + } + + nw4r::lyt::GroupContainer *container = mLyt.getLayout()->GetGroupContainer(); + if (container != nullptr) { + nw4r::lyt::Group *g = container->FindGroupByName(sGroupName); + if (g != nullptr) { + d2d::dSubPane::linkMeters(g, &mRingList); + } + } + + for (int i = 0; i < RING_NUM_ITEMS; i++) { + mRingNodes[i].mpPane->SetVisible(false); + } + + void *data2 = LayoutArcManager::GetInstance()->getLoadedData("Shop"); + d2d::ResAccIf_c resAcc2; + resAcc2.attach(data2, ""); + + static const u8 sInitialPageIndices[] = {0, 1, 4}; + + bool isMainStock = true; + for (int i = 0; i < NUM_STOCKS; i++) { + mStockNodes[i].mpLytPane = &mStock[i]; + mStock[i].setPage(sInitialPageIndices[i]); + mStock[i].setMainStock(isMainStock); + mStockNodes[i].mpLytPane->build(&resAcc2); + mStockList.PushBack(&mStockNodes[i]); + isMainStock = false; + } + + if (container != nullptr) { + nw4r::lyt::Group *g = container->FindGroupByName(sGroupName); + if (g != nullptr) { + d2d::dSubPane::linkMeters(g, &mStockList); + } + } + + for (int i = 0; i < NUM_STOCKS; i++) { + mStockNodes[i].mpPane->SetVisible(true); + } +} + +void dLytDepositMain_c::loadInitialState() { + mAnm[DEPOSIT_ANIM_CHANGE].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_CHANGE].setFrame(0.0f); + mAnm[DEPOSIT_ANIM_SELECT_ON_BOX].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_SELECT_ON_POUCH].setAnimEnable(true); + + if (!field_0x19527 || mCursorLocation == dLytDepositBoxCursor_c::LOC_POUCH) { + mAnm[DEPOSIT_ANIM_SELECT_ON_BOX].setFrame(0.0f); + mAnm[DEPOSIT_ANIM_SELECT_ON_POUCH].setToEnd(); + } else { + mAnm[DEPOSIT_ANIM_SELECT_ON_BOX].setToEnd(); + mAnm[DEPOSIT_ANIM_SELECT_ON_POUCH].setFrame(0.0f); + } + + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_00].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_00].setFrame(0.0f); + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_01].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_01].setFrame(0.0f); + mAnm[DEPOSIT_ANIM_RECYCLE].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_RECYCLE].setFrame(0.0f); + + mAnm[DEPOSIT_ANIM_INPUT_00].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_INPUT_00].setForwardOnce(); + mAnm[DEPOSIT_ANIM_INPUT_00].setFrame(mAnm[DEPOSIT_ANIM_INPUT_00].getLastFrame()); + + mAnm[DEPOSIT_ANIM_INPUT_01].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_INPUT_01].setForwardOnce(); + mAnm[DEPOSIT_ANIM_INPUT_01].setFrame(0.0f); + + mLyt.calc(); + + mAnm[DEPOSIT_ANIM_CHANGE].setAnimEnable(false); + mAnm[DEPOSIT_ANIM_SELECT_ON_BOX].setAnimEnable(false); + mAnm[DEPOSIT_ANIM_SELECT_ON_POUCH].setAnimEnable(false); + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_00].setAnimEnable(false); + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_01].setAnimEnable(false); + mAnm[DEPOSIT_ANIM_RECYCLE].setAnimEnable(false); + mAnm[DEPOSIT_ANIM_INPUT_00].setAnimEnable(false); + mAnm[DEPOSIT_ANIM_INPUT_01].setAnimEnable(false); + + for (int i = 0; i < RING_NUM_ITEMS; i++) { + mPouchItemIds[i] = getPouchItemForSlot(i, false); + f32 frame; + if (!hasPouchSlot(i, false)) { + frame = 0.0f; + mRingNodes[i].mpPane->SetVisible(false); + } else { + frame = 1.0f; + if (mPouchItemIds[i] != LYT_CMN_PouchPotionHealthPlusPlusHalf) { + mRingNodes[i].mpPane->SetVisible(true); + loadPouchItem(i); + } else { + mRingNodes[i].mpPane->SetVisible(false); + } + } + mAnm[i + DEPOSIT_ANIM_HAVE_OFFSET].setAnimEnable(true); + mAnm[i + DEPOSIT_ANIM_HAVE_OFFSET].setFrame(frame); + mLyt.calc(); + mAnm[i + DEPOSIT_ANIM_HAVE_OFFSET].setAnimEnable(false); + } + // we'll actually be initializing mCurrentlyHoldingItemSlot to -1 right afterwards + // so this is probably technically wrong + loadStockItems(mCurrentlyHoldingItemSlot - 8); + mIsPointingAtToStockBounding = false; + mIsPointingAtToPouchBounding = false; + field_0x19523 = false; + field_0x19524 = false; + field_0x19525 = false; + field_0x19526 = false; + field_0x19527 = false; + field_0x19528 = false; + + mCursorLocation = dLytDepositBoxCursor_c::LOC_POUCH; + field_0x19540 = 0; + mItemSellValue = 0; + + mCurrentPouchNavTarget = -1; + mCurrentlyHoldingItemSlot = -1; + field_0x19548 = -1; +} + +void dLytDepositMain_c::loadPouchItem(s32 slot) { + s32 amount = getPouchItemAmount(slot, false); + mPouchItems[slot].setUnk(false); + if (amount < 0) { + mPouchItems[slot].setHasNumber(false); + } else { + mPouchItems[slot].setHasNumber(true); + mPouchItems[slot].setNumber(amount); + } + mPouchItems[slot].setItem(mPouchItemIds[slot]); + u8 color = getPouchItemNumberColor(slot, false); + if (color != 3) { + mPouchItems[slot].setNumberColor(color); + } + f32 durability = getPouchShieldDurability(slot, false); + if (durability >= 0.0f) { + mPouchItems[slot].setShieldDurability(durability); + } +} + +void dLytDepositMain_c::checkPointToStock() { + dCursorHitCheck_c *d = dCsBase_c::GetInstance()->getHitCheck(); + mIsPointingAtToStockBounding = false; + if (dPadNav::isPointerVisible() && d != nullptr && d->getType() == 'lyt ' && + static_cast(d)->getHitPane() == mpBoundingBox) { + // TODO: mIsPointingAtToStockBounding is always false at this point + if (!mIsPointingAtToStockBounding) { + dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0); + } + mIsPointingAtToStockBounding = true; + } +} + +void dLytDepositMain_c::checkPointToPouch() { + mIsPointingAtToPouchBounding = false; + if (dPadNav::isPointerVisible()) { + mCsPosition = dCsBase_c::GetInstance()->getCursorIf()->getCursorPos(); + nw4r::lyt::Pane *p = mLyt.findPane("N_ringAtari_00"); + nw4r::lyt::Size sz = p->GetSize(); + f32 radius = sz.width * 0.5f; + radius *= radius; + nw4r::math::MTX34 mtx = p->GetGlobalMtx(); + mVec3_c v(0.0f, 0.0f, 0.0f); + MTXMultVec(mtx, v, v); + // TODO I hate vectors + mVec2_c pos = mVec2_c(v.x, v.y); + if (pos.squareDistanceTo(mCsPosition) < radius) { + // TODO: field_0x19522 is always false at this point + if (!mIsPointingAtToPouchBounding) { + dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0); + } + mIsPointingAtToPouchBounding = true; + } + } +} + +void dLytDepositMain_c::handleNavOrPoint() { + bool selectIcon = false; + s32 nextTarget = 0; + if (dPadNav::isPointerVisible()) { + for (nextTarget = 0; nextTarget < RING_NUM_ITEMS; nextTarget++) { + if (mPouchItemIds[nextTarget] < LYT_CMN_PouchPotionHealthPlusPlusHalf && + mPouchItems[nextTarget].isCursorOver()) { + mStock[STOCK_ACTIVE].disableSpecialModes(); + selectIcon = true; + break; + } + } + } else { + if (!mStock[STOCK_ACTIVE].isNavModeItem()) { + mStock[STOCK_ACTIVE].handleSpecialNavMode(); + } else if (!mStock[STOCK_ACTIVE].isModeSell() && !mStock[STOCK_ACTIVE].isModeSort() && + !mStock[STOCK_ACTIVE].isModeFinish()) { + s32 target = mCurrentPouchNavTarget; + s32 direction = dPadNav::getFSStickNavDirection(); + if (target < 0 || field_0x1952A) { + if (direction != dPadNav::FS_STICK_NONE || dCsBase_c::GetInstance()->isCursorStickVisible()) { + if (target < 0) { + target += SLOT_STOCK_OFFSET; + } + nextTarget = target; + dCsBase_c::GetInstance()->setCursorStickTargetPane(mpRingBoundings[target]); + if (!mCursor.isVisible() && mCurrentlyHoldingItemSlot >= 0) { + mCursor.setVisible(true); + } + selectIcon = true; + } + } else { + switch (checkNav()) { + case dPadNav::FS_STICK_UP: + nextTarget = mCurrentPouchNavTarget - 4; + selectIcon = true; + break; + case dPadNav::FS_STICK_RIGHT: + nextTarget = mCurrentPouchNavTarget + 1; + if (nextTarget >= 8) { + nextTarget = 0; + } + selectIcon = true; + break; + case dPadNav::FS_STICK_DOWN_RIGHT: + nextTarget = -1; + mStock[STOCK_ACTIVE].navigateToFinish(); + break; + case dPadNav::FS_STICK_DOWN: + nextTarget = mCurrentPouchNavTarget + 4; + if (nextTarget >= 8) { + mIsPointingAtToStockBounding = true; + nextTarget = -1; + } else { + selectIcon = true; + } + break; + case dPadNav::FS_STICK_DOWN_LEFT: + nextTarget = -1; + mStock[STOCK_ACTIVE].navigateToSell(); + fn_802AC980(); + break; + case dPadNav::FS_STICK_LEFT: + nextTarget = mCurrentPouchNavTarget - 1; + if (nextTarget < 0) { + nextTarget = 7; + } + selectIcon = true; + break; + default: + nextTarget = mCurrentPouchNavTarget; + selectIcon = true; + break; + } + if (nextTarget >= 0) { + dCsBase_c::GetInstance()->setCursorStickTargetPane(mpRingBoundings[nextTarget]); + } + } + } + } + + if (selectIcon) { + if (mCurrentPouchNavTarget != nextTarget) { + if (mCurrentPouchNavTarget >= 0) { + mPouchItems[mCurrentPouchNavTarget].setOff(); + mAnm[mCurrentPouchNavTarget + DEPOSIT_ANIM_FLASH_OFFSET].setAnimEnable(true); + } + if (mPouchItemIds[nextTarget] != LYT_CMN_PouchBlank4 && + mPouchItemIds[nextTarget] != LYT_CMN_PouchPotionHealthPlusPlusHalf && + (mCurrentlyHoldingItemSlot < 0 || mCurrentlyHoldingItemSlot != nextTarget)) { + mPouchItems[nextTarget].setOn(); + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_POUCH_POINT_ITEM); + } else { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_POUCH_POINT_EMPTY); + } + + s32 anmIdx = nextTarget + DEPOSIT_ANIM_FLASH_OFFSET; + mAnm[anmIdx].setAnimEnable(true); + mAnm[anmIdx].setFrame(0.0f); + mLyt.calc(); + mAnm[anmIdx].setAnimEnable(false); + dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0); + mCurrentPouchNavTarget = nextTarget; + } + if (mPouchItemIds[nextTarget] != LYT_CMN_PouchBlank4 && + mPouchItemIds[nextTarget] != LYT_CMN_PouchPotionHealthPlusPlusHalf && + (mCurrentlyHoldingItemSlot < 0 || mCurrentlyHoldingItemSlot != nextTarget)) { + loadItemText(getPouchItemIdForIndex(nextTarget, false), dLytDepositBoxCursor_c::LOC_POUCH); + } else { + loadItemText(-1, dLytDepositBoxCursor_c::LOC_POUCH); + } + mStock[STOCK_ACTIVE].navigateToItem(); + } else { + navigateOffIcon(); + } + + if (mCurrentPouchNavTarget >= 0) { + s32 id; + if (mCurrentlyHoldingItemSlot >= 0 && mCurrentlyHoldingItemSlot == mCurrentPouchNavTarget) { + id = LYT_CMN_PouchBlank4; + } else { + id = mPouchItemIds[mCurrentPouchNavTarget]; + } + mCursor.updateSlot(dLytDepositBoxCursor_c::LOC_POUCH, mCurrentPouchNavTarget, id, false); + } +} + +void dLytDepositMain_c::navigateOffIcon() { + if (mCurrentPouchNavTarget >= 0) { + // TODO why LYT_CMN_PouchPotionHealthPlusPlusHalf + if (mPouchItemIds[mCurrentPouchNavTarget] != LYT_CMN_PouchBlank4 && + mPouchItemIds[mCurrentPouchNavTarget] != LYT_CMN_PouchPotionHealthPlusPlusHalf && + (mCurrentlyHoldingItemSlot < 0 || mCurrentlyHoldingItemSlot != mCurrentPouchNavTarget)) { + mPouchItems[mCurrentPouchNavTarget].setOff(); + loadItemText(-1, dLytDepositBoxCursor_c::LOC_POUCH); + } + mAnm[mCurrentPouchNavTarget + DEPOSIT_ANIM_FLASH_OFFSET].setAnimEnable(true); + mCurrentPouchNavTarget -= SLOT_STOCK_OFFSET; + } +} + +s32 dLytDepositMain_c::checkNav() { + s32 direction = dPadNav::getFSStickNavDirection(); + switch (direction) { + case dPadNav::FS_STICK_UP: { + s32 target = mCurrentPouchNavTarget; + if (target == 0) { + direction = dPadNav::FS_STICK_NONE; + } else if (target == 1 || target == 2 || target == 3) { + direction = dPadNav::FS_STICK_LEFT; + } else if (target == 5 || target == 6 || target == 7) { + direction = dPadNav::FS_STICK_RIGHT; + } + break; + } + case dPadNav::FS_STICK_UP_RIGHT: { + s32 target = mCurrentPouchNavTarget; + if (target == 0 || target == 6 || target == 7) { + direction = dPadNav::FS_STICK_RIGHT; + } else if (target == 2 || target == 3 || target == 4) { + direction = dPadNav::FS_STICK_LEFT; + } else if (target == 5) { + direction = dPadNav::FS_STICK_UP; + } else { + direction = dPadNav::FS_STICK_NONE; + } + break; + } + case dPadNav::FS_STICK_RIGHT: { + s32 target = mCurrentPouchNavTarget; + // wish I knew why this requires a range comparison... + if (target >= 0 && target <= 1 || target == 7) { + direction = dPadNav::FS_STICK_RIGHT; + } else if (target == 2 || target == 3) { + if (mCurrentlyHoldingItemSlot >= 0) { + direction = dPadNav::FS_STICK_NONE; + } else { + direction = dPadNav::FS_STICK_DOWN_RIGHT; + } + } else if (target == 4 || target == 5) { + direction = dPadNav::FS_STICK_LEFT; + } else { + direction = dPadNav::FS_STICK_UP; + } + break; + } + case dPadNav::FS_STICK_DOWN_RIGHT: { + s32 target = mCurrentPouchNavTarget; + if (target == 0 || target == 1) { + direction = dPadNav::FS_STICK_RIGHT; + } else if ((target == 2 || target == 3) && mCurrentlyHoldingItemSlot >= 0) { + direction = dPadNav::FS_STICK_NONE; + } else if (target == 4) { + direction = dPadNav::FS_STICK_DOWN; + } else if (target == 5 || target == 6) { + direction = dPadNav::FS_STICK_LEFT; + } else if (target == 7) { + direction = dPadNav::FS_STICK_UP; + } + break; + } + case dPadNav::FS_STICK_DOWN: { + s32 target = mCurrentPouchNavTarget; + if (target == 0) { + direction = dPadNav::FS_STICK_DOWN; + } else if (target == 1 || target == 2 || target == 3) { + direction = dPadNav::FS_STICK_RIGHT; + } else if (target == 5 || target == 6 || target == 7) { + direction = dPadNav::FS_STICK_LEFT; + } + break; + } + case dPadNav::FS_STICK_DOWN_LEFT: { + // wish I knew why this requires a switch... + switch (mCurrentPouchNavTarget) { + case 0: + case 7: direction = dPadNav::FS_STICK_LEFT; break; + case 1: + case 4: direction = dPadNav::FS_STICK_DOWN; break; + case 2: + case 3: direction = dPadNav::FS_STICK_RIGHT; break; + case 5: + case 6: + if (mItemSellValue > 0) { + direction = dPadNav::FS_STICK_DOWN_LEFT; + } else { + direction = dPadNav::FS_STICK_NONE; + } + break; + } + break; + } + case dPadNav::FS_STICK_LEFT: { + // wish I knew why this requires a switch... + switch (mCurrentPouchNavTarget) { + case 0: + case 1: + case 7: direction = dPadNav::FS_STICK_LEFT; break; + case 2: direction = dPadNav::FS_STICK_DOWN; break; + case 3: + case 4: direction = dPadNav::FS_STICK_RIGHT; break; + case 5: + case 6: + if (mItemSellValue > 0) { + direction = dPadNav::FS_STICK_DOWN_LEFT; + } else { + direction = dPadNav::FS_STICK_NONE; + } + break; + } + break; + } + case dPadNav::FS_STICK_UP_LEFT: { + s32 target = mCurrentPouchNavTarget; + if (target == 0 || target == 1 || target == 2) { + direction = dPadNav::FS_STICK_LEFT; + } else if (target == 3) { + direction = dPadNav::FS_STICK_DOWN; + } else if (target == 4 || target == 5 || target == 6) { + direction = dPadNav::FS_STICK_RIGHT; + } else { + direction = dPadNav::FS_STICK_NONE; + } + break; + } + } + + return direction; +} + +void dLytDepositMain_c::fn_802ABB60() { + s32 updateFlags = 0; + dCursorHitCheck_c *d = dCsBase_c::GetInstance()->getHitCheck(); + if (dPadNav::isPointerVisible()) { + if (d != nullptr && d->getType() == 'lyt ') { + if (static_cast(d)->getHitPane() == mpBoundingChoices && + mCurrentlyHoldingItemSlot < 0) { + mStock[STOCK_ACTIVE].navigateToFinish(); + mStock[STOCK_ACTIVE].disableModeSort(); + mStock[STOCK_ACTIVE].disableModeSell(); + updateFlags = 1; + } else if (static_cast(d)->getHitPane() == mpBoundingItem12 && + mItemSellValue != 0) { + mStock[STOCK_ACTIVE].navigateToSell(); + mStock[STOCK_ACTIVE].disableModeFinish(); + mStock[STOCK_ACTIVE].disableModeSort(); + updateFlags = 2; + } + } + } else { + s32 direction = dPadNav::getFSStickNavDirection(); + if (mStock[STOCK_ACTIVE].isModeFinish()) { + if (!field_0x19523 || field_0x1952A) { + dCsBase_c::GetInstance()->setCursorStickTargetPane(mpBoundingChoices); + updateFlags = 1; + } else if (field_0x1954C == 0) { + switch (direction) { + case 1: + case 8: + mStock[STOCK_ACTIVE].disableModeFinish(); + fn_802AC0E0(2); + break; + case 7: + mStock[STOCK_ACTIVE].disableModeFinish(); + fn_802AC0E0(3); + break; + default: updateFlags = 1; break; + } + } else { + switch (direction) { + case 1: + case 2: { + mStock[STOCK_ACTIVE].disableModeFinish(); + mArrow.setField_0x6B8(1); + mStock[STOCK_ACTIVE].navigateToArrow(dLytDepositStock_c::ARROW_RIGHT); + dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0); + mStock[STOCK_ACTIVE].saveArrowDirection(); + break; + } + case 7: + case 8: { + mStock[STOCK_ACTIVE].disableModeFinish(); + mStock[STOCK_ACTIVE].navigateToSort(); + dCsBase_c::GetInstance()->setCursorStickTargetPane(mpBoundingCleanUp); + break; + } + default: { + updateFlags = 1; + break; + } + } + } + } else if (mStock[STOCK_ACTIVE].isModeSell()) { + if (!field_0x19524 || field_0x1952A) { + dCsBase_c::GetInstance()->setCursorStickTargetPane(mpBoundingItem12); + mCursor.fn_801580A0(); + updateFlags = 2; + } else if (field_0x1954C == 0) { + switch (direction) { + case 1: + case 2: + mStock[STOCK_ACTIVE].disableModeSell(); + fn_802AC0E0(6); + break; + case 3: + mStock[STOCK_ACTIVE].disableModeSell(); + fn_802AC0E0(5); + break; + case 4: + if (mCurrentlyHoldingItemSlot < 0) { + mStock[STOCK_ACTIVE].disableModeSell(); + mStock[STOCK_ACTIVE].navigateToFinish(); + dCsBase_c::GetInstance()->setCursorStickTargetPane(mpBoundingChoices); + } + break; + default: updateFlags = 2; break; + } + } else { + switch (direction) { + case 1: { + mStock[STOCK_ACTIVE].disableModeSell(); + mArrow.setField_0x6B8(0); + mStock[STOCK_ACTIVE].navigateToArrow(dLytDepositStock_c::ARROW_LEFT); + dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0); + break; + } + case 2: + case 3: { + mStock[STOCK_ACTIVE].disableModeSell(); + fn_802AC290(6); + break; + } + default: { + updateFlags = 2; + break; + } + } + } + } + } + + if (updateFlags & 1) { + if (!field_0x19523) { + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_00].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_00].setFrame(0.0f); + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_00].setForwardOnce(); + dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0); + } + dCsBase_c::GetInstance()->setCursorStickTargetPane(mpBoundingChoices); + field_0x19523 = true; + } else if (field_0x19523) { + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_00].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_BTN_ON_OFF_00].setBackwardsOnce(); + mStock[STOCK_ACTIVE].disableModeFinish(); + field_0x19523 = false; + } + + if (updateFlags & 2) { + if (!field_0x19524 && mItemSellValue != 0) { + mAnm[DEPOSIT_ANIM_RECYCLE].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_RECYCLE].setFrame(0.0f); + mAnm[DEPOSIT_ANIM_RECYCLE].setForwardOnce(); + mpPaneABtn->SetVisible(true); + mpPanePrice->SetVisible(true); + + dTextBox_c *box1, *box2; + box1 = mLyt.getTextBox("T_recycle_01"); + box2 = mLyt.getTextBox("T_recycleS_01"); + fn_802AC360(mItemSellValue); + static wchar_t buf[5]; + swprintf(buf, ARRAY_LENGTH(buf), L"%d", mItemSellValue); + box1->setTextWithGlobalTextProcessor(buf, nullptr); + box2->setTextWithGlobalTextProcessor(buf, nullptr); + dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0); + if (field_0x1954C != 0) { + mArrow.setBackwards(false); + } + } + dCsBase_c::GetInstance()->setCursorStickTargetPane(mpBoundingItem12); + field_0x19524 = true; + } else { + if (field_0x19524) { + mAnm[DEPOSIT_ANIM_RECYCLE].setAnimEnable(true); + mAnm[DEPOSIT_ANIM_RECYCLE].setBackwardsOnce(); + mStock[STOCK_ACTIVE].disableModeSell(); + field_0x19524 = false; + } + if (field_0x1954C != 0) { + mArrow.setBackwards(true); + } + } +} + void dLytDepositMain_c::loadItemText(s32 itemId, s32 where) { dTextBox_c *box1, *box2; @@ -793,7 +1529,9 @@ void dLytDepositMain_c::loadItemText(s32 itemId, s32 where) { box2 = mLyt.getTextBox("T_messageS_08"); } else { box1 = mLyt.getTextBox("T_nameSpace_00"); - box2 = mLyt.getTextBox("T_nameSpaceS_00"); + // @bug shouldn't this be T_nameSpaceS_00 ? + // causes a missing text shadow + box2 = mLyt.getTextBox("T_nameSpace_00"); } if (itemId < 0) { @@ -823,9 +1561,9 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() { s32 item; if (mCurrentlyHoldingItemSlot < 0) { // Not holding an item... - if (mCurrentPouchNavTarget >= 0 && mPouchItemIds[mCurrentPouchNavTarget] != 12 && + if (mCurrentPouchNavTarget >= 0 && mPouchItemIds[mCurrentPouchNavTarget] != LYT_CMN_PouchBlank4 && // ... and picking up an item from the pouch - mPouchItemIds[mCurrentPouchNavTarget] != 50) { + mPouchItemIds[mCurrentPouchNavTarget] != LYT_CMN_PouchPotionHealthPlusPlusHalf) { mCursorLocation = dLytDepositBoxCursor_c::LOC_POUCH; field_0x19540 = convertLytPouchSlot2(mCurrentPouchNavTarget); item = getPouchItemIdForIndex(mCurrentPouchNavTarget, false); @@ -838,12 +1576,12 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() { mAnm[mCurrentPouchNavTarget + DEPOSIT_ANIM_FLASH_OFFSET].setAnimEnable(false); mPouchItems[mCurrentPouchNavTarget].setOff(); - loadItemText(-1, false); + loadItemText(-1, dLytDepositBoxCursor_c::LOC_POUCH); dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_POUCH_CHACH_ITEM); anyPickup = true; } else if (mStock[STOCK_ACTIVE].getCurrentNavTarget() >= 0) { s32 activeItem = mStock[STOCK_ACTIVE].getItem(mStock[STOCK_ACTIVE].getCurrentNavTarget()); - if (activeItem != 12) { + if (activeItem != LYT_CMN_PouchBlank4) { // ... and picking up an item from the stock s32 stockSlot = mStock[STOCK_ACTIVE].getCurrentSlot(); mCursorLocation = dLytDepositBoxCursor_c::LOC_STOCK; @@ -854,8 +1592,8 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() { mCursorLocation, stockSlot, mStock[STOCK_ACTIVE].getItem(mStock[STOCK_ACTIVE].getCurrentNavTarget()), false ); - mStock[STOCK_ACTIVE].pickUpItem(stockSlot, 0); - loadItemText(-1, true); + mStock[STOCK_ACTIVE].pickUpItem(stockSlot, false); + loadItemText(-1, dLytDepositBoxCursor_c::LOC_STOCK); field_0x19554 = 0; dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_CHACH_ITEM); anyPickup = true; @@ -892,7 +1630,8 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() { } else { // Currently holding an item... bool b2 = false; - if (mCurrentPouchNavTarget >= 0 && mPouchItemIds[mCurrentPouchNavTarget] != 50) { + if (mCurrentPouchNavTarget >= 0 && + mPouchItemIds[mCurrentPouchNavTarget] != LYT_CMN_PouchPotionHealthPlusPlusHalf) { // ... and dropping the item onto the pouch s32 oldItem = mPouchItemIds[mCurrentPouchNavTarget]; if (mCurrentlyHoldingItemSlot < SLOT_STOCK_OFFSET) { @@ -902,9 +1641,9 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() { swapAdventurePouchItems( convertLytPouchSlot(mCurrentPouchNavTarget), convertLytPouchSlot(mCurrentlyHoldingItemSlot) ); - fn_802AAEC0(mCurrentPouchNavTarget); + loadPouchItem(mCurrentPouchNavTarget); mPouchItems[mCurrentlyHoldingItemSlot].reset(); - fn_802AAEC0(mCurrentlyHoldingItemSlot); + loadPouchItem(mCurrentlyHoldingItemSlot); if (mCurrentlyHoldingItemSlot == mCurrentPouchNavTarget) { b2 = true; } @@ -913,8 +1652,8 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() { s32 actualSlot = mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET; mPouchItemIds[mCurrentPouchNavTarget] = getDepositItemForSlot(actualSlot); swapStockAndPouchItems(convertLytPouchSlot(mCurrentPouchNavTarget), actualSlot); - loadItems(-1); - fn_802AAEC0(mCurrentPouchNavTarget); + loadStockItems(-1); + loadPouchItem(mCurrentPouchNavTarget); mStock[STOCK_ACTIVE].field_0x684E = false; for (int i = 0; i < NUM_STOCKS; i++) { @@ -922,14 +1661,15 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() { } } - if (oldItem != 12 && !b2) { + if (oldItem != LYT_CMN_PouchBlank4 && !b2) { dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_POUCH_RELEASE_ITEM_CHANGE); } else { dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_POUCH_RELEASE_ITEM); } mItemSellValue = 0; anyPickup = true; - } else if (mStock[STOCK_ACTIVE].getCurrentNavTarget() >= 0 && mStock[STOCK_ACTIVE].getActiveItem() != 50) { + } else if (mStock[STOCK_ACTIVE].getCurrentNavTarget() >= 0 && + mStock[STOCK_ACTIVE].getActiveItem() != LYT_CMN_PouchPotionHealthPlusPlusHalf) { // ... and dropping the item into the stock s32 slot = mStock[STOCK_ACTIVE].getCurrentSlot(); field_0x19554 = slot; @@ -942,11 +1682,11 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() { ); mPouchItemIds[mCurrentlyHoldingItemSlot] = item; mPouchItems[mCurrentlyHoldingItemSlot].reset(); - fn_802AAEC0(mCurrentlyHoldingItemSlot); + loadPouchItem(mCurrentlyHoldingItemSlot); } else { // Source item is from stock, so swap stock items swapStockItems(mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET, slot); - loadItems(-1); + loadStockItems(-1); if (!dPadNav::isPointerVisible()) { mStock[STOCK_ACTIVE].field_0x684B = true; } @@ -961,7 +1701,7 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() { mStock[i].field_0x684E = false; } - if (item != 12 && !b2) { + if (item != LYT_CMN_PouchBlank4 && !b2) { dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_RELEASE_ITEM_CHANGE); } else { dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_RELEASE_ITEM); @@ -1000,18 +1740,20 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() { } } else { if ((mCurrentlyHoldingItemSlot < SLOT_STOCK_OFFSET) || - ((mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET) / 12) != mStock[STOCK_ACTIVE].getPage()) { + ((mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET) / NUM_ICONS_PER_PAGE) != + mStock[STOCK_ACTIVE].getPage()) { fn_802AC290(0); } else { - fn_802AC290((mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET) % 12); + fn_802AC290((mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET) % NUM_ICONS_PER_PAGE); } } } if (mCurrentlyHoldingItemSlot < SLOT_STOCK_OFFSET) { + // dropped pouch item, show pouch pane mRingNodes[mCurrentlyHoldingItemSlot].mpPane->SetVisible(true); } else { mStock[STOCK_ACTIVE].pickUpItem(mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET, true); - loadItems(-1); + loadStockItems(-1); mStock[STOCK_ACTIVE].field_0x684B = true; mStock[STOCK_ACTIVE].fn_80156530(true); } @@ -1041,10 +1783,10 @@ STATE_DEFINE(dLytDeposit_c, Out); void dLytDeposit_c::initializeState_None() {} void dLytDeposit_c::executeState_None() { - if (field_0x19998) { + if (mInRequest) { mMain.setModeIn(); mStateMgr.changeState(StateID_In); - field_0x19998 = false; + mInRequest = false; } } void dLytDeposit_c::finalizeState_None() {} @@ -1068,35 +1810,118 @@ void dLytDeposit_c::executeState_In() { void dLytDeposit_c::finalizeState_In() {} void dLytDeposit_c::initializeState_Check() {} -void dLytDeposit_c::executeState_Check() {} +void dLytDeposit_c::executeState_Check() { + if (mMain.isIdle()) { + if (dPad::getDownTrigA() && mMain.isSellableItem()) { + mMain.setModeRecycle(); + mStateMgr.changeState(StateID_Recycle); + } else if ((dPad::getDownTrigA() && mMain.getField_0x19523()) || + (dPad::getDownTrigB() && !mMain.getField_0x1952B() && !mMain.isHoldingItem())) { + mMain.setModeOut(); + mStateMgr.changeState(StateID_Out); + } else if (mMain.isPointingAtToStockBounding()) { + mMain.setModeChange(true); + mStateMgr.changeState(StateID_Change); + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_CHANGE_STOCK); + } + } +} void dLytDeposit_c::finalizeState_Check() {} void dLytDeposit_c::initializeState_Change() {} -void dLytDeposit_c::executeState_Change() {} +void dLytDeposit_c::executeState_Change() { + if (mMain.isIdle()) { + if ((dPad::getDownTrigA() && mMain.getField_0x19523()) || + (dPad::getDownTrigB() && !mMain.getField_0x1952B() && !mMain.isHoldingItem())) { + mMain.setModeOut(); + mStateMgr.changeState(StateID_Out); + } else if (checkForNavRight()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_PAGE_RIGHT); + mMain.setModeScroll(true, mScrollViaArrowButton); + mStateMgr.changeState(StateID_Scroll); + mScrollViaArrowButton = false; + } else if (checkForNavLeft()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_PAGE_LEFT); + mMain.setModeScroll(false, mScrollViaArrowButton); + mStateMgr.changeState(StateID_Scroll); + mScrollViaArrowButton = false; + } else if (mMain.isPointingAtToPouchBounding()) { + mMain.setModeReverseChange(); + mStateMgr.changeState(StateID_ReverseChange); + } else if (dPad::getDownTrigA() && mMain.isSellableItem()) { + mMain.setModeRecycle(); + mStateMgr.changeState(StateID_Recycle); + } else if (dPad::getDownTrigA() && mMain.getField_0x19525()) { + // TODO: what does this do? + if (!StoryflagManager::sInstance->getCounterOrFlag(STORYFLAG_TALKED_TO_STRICH)) { + mMain.setModeArrangementOut(); + mStateMgr.changeState(StateID_ArrangementOut); + } else { + mMain.setModeArrangement(); + mStateMgr.changeState(StateID_Arrangement); + } + sortStock(); + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_SELECT_TRIM); + } + } +} void dLytDeposit_c::finalizeState_Change() {} void dLytDeposit_c::initializeState_Arrangement() {} -void dLytDeposit_c::executeState_Arrangement() {} +void dLytDeposit_c::executeState_Arrangement() { + if (mMain.isIdle()) { + mMain.setModeChange(false); + mStateMgr.changeState(StateID_Change); + } +} void dLytDeposit_c::finalizeState_Arrangement() {} void dLytDeposit_c::initializeState_ReverseChange() {} -void dLytDeposit_c::executeState_ReverseChange() {} +void dLytDeposit_c::executeState_ReverseChange() { + if (mMain.isIdle()) { + mMain.setModeCheck(); + mStateMgr.changeState(StateID_Check); + } +} void dLytDeposit_c::finalizeState_ReverseChange() {} void dLytDeposit_c::initializeState_Scroll() {} -void dLytDeposit_c::executeState_Scroll() {} +void dLytDeposit_c::executeState_Scroll() { + if (mMain.isIdle()) { + mMain.setModeChange(false); + mStateMgr.changeState(StateID_Change); + } +} void dLytDeposit_c::finalizeState_Scroll() {} void dLytDeposit_c::initializeState_Recycle() {} -void dLytDeposit_c::executeState_Recycle() {} +void dLytDeposit_c::executeState_Recycle() { + if (mMain.isIdle()) { + mMain.setModeNone(); + mStateMgr.changeState(StateID_None); + } +} void dLytDeposit_c::finalizeState_Recycle() {} void dLytDeposit_c::initializeState_ArrangementOut() {} -void dLytDeposit_c::executeState_ArrangementOut() {} +void dLytDeposit_c::executeState_ArrangementOut() { + if (mMain.isIdle()) { + mMain.setModeNone(); + mStateMgr.changeState(StateID_None); + } +} void dLytDeposit_c::finalizeState_ArrangementOut() {} void dLytDeposit_c::initializeState_Out() {} -void dLytDeposit_c::executeState_Out() {} +void dLytDeposit_c::executeState_Out() { + if (mMain.isIdle()) { + dCsBase_c::GetInstance()->setVisible(false); + dPadNav::setNavEnabled(false, false); + mIsMovingOut = true; + mMain.setModeNone(); + mStateMgr.changeState(StateID_None); + } +} void dLytDeposit_c::finalizeState_Out() {} SPECIAL_BASE_PROFILE(LYT_DEPOSIT, dLytDeposit_c, fProfile::LYT_DEPOSIT, 0x2B9, 0); @@ -1112,9 +1937,9 @@ int dLytDeposit_c::create() { sInstance = this; allocateLytWork1Heap("dLytDeposit_c::m_allocator", false); mStateMgr.changeState(StateID_None); - field_0x19998 = false; - field_0x19999 = false; - field_0x1999A = false; + mInRequest = false; + mIsMovingOut = false; + mScrollViaArrowButton = false; return SUCCEEDED; } @@ -1133,7 +1958,7 @@ int dLytDeposit_c::execute() { } int dLytDeposit_c::draw() { - if (*mStateMgr.getStateID() != StateID_None || field_0x19999) { + if (*mStateMgr.getStateID() != StateID_None || mIsMovingOut) { mMain.draw(); } return SUCCEEDED; @@ -1150,18 +1975,18 @@ int dLytDeposit_c::doDelete() { bool dLytDeposit_c::checkForNavRight() { if (dPad::getDownTrigRight()) { if (!mMain.isSellableItem()) { - field_0x1999A = false; + mScrollViaArrowButton = false; return true; } } if (dPad::getDownTrigA() && mMain.getArrowDirection() == dLytDepositStock_c::ARROW_RIGHT) { dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_SELECT_TURN_PAGE_RIGHT); - field_0x1999A = true; + mScrollViaArrowButton = true; return true; } else if (dPadNav::isPointerVisible() && dPadNav::isMplsNavRightGesture()) { mMain.setField_0x1952C(false); - field_0x1999A = false; + mScrollViaArrowButton = false; return true; } @@ -1171,18 +1996,18 @@ bool dLytDeposit_c::checkForNavRight() { bool dLytDeposit_c::checkForNavLeft() { if (dPad::getDownTrigLeft()) { if (!mMain.isSellableItem()) { - field_0x1999A = false; + mScrollViaArrowButton = false; return true; } } if (dPad::getDownTrigA() && mMain.getArrowDirection() == dLytDepositStock_c::ARROW_LEFT) { dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_SELECT_TURN_PAGE_LEFT); - field_0x1999A = true; + mScrollViaArrowButton = true; return true; } else if (dPadNav::isPointerVisible() && !mMain.isSellableItem() && dPadNav::isMplsNavLeftGesture()) { mMain.setField_0x1952C(false); - field_0x1999A = false; + mScrollViaArrowButton = false; return true; } diff --git a/src/d/lyt/d_lyt_deposit_box_cursor.cpp b/src/d/lyt/d_lyt_deposit_box_cursor.cpp index 7ba91dfa..5471b3aa 100644 --- a/src/d/lyt/d_lyt_deposit_box_cursor.cpp +++ b/src/d/lyt/d_lyt_deposit_box_cursor.cpp @@ -5,6 +5,7 @@ #include "d/d_pad_nav.h" #include "d/lyt/d2d.h" #include "d/lyt/d_lyt_common_icon_item.h" +#include "d/lyt/d_lyt_common_icon_item_maps.h" #include "d/lyt/d_lyt_util_items.h" #include "m/m_vec.h" #include "nw4r/lyt/lyt_group.h" @@ -114,17 +115,17 @@ void dLytDepositBoxCursor_c::realizeNav() { s = mAnm[DEPOSIT_BOX_CURSOR_ANIM_STICK_CURSOR].getLastFrame(); } else if (dPadNav::isPointerVisible()) { s = 4; - } else if (field_0x950 == 50) { + } else if (mItem == LYT_CMN_PouchPotionHealthPlusPlusHalf) { s = 5; } else if (field_0x949) { s = 6; } else if (mItemLocation == LOC_POUCH) { // Flip the cursor for pouch slot 0 so that it's not above the screen edge s = mSlot == 0 ? 1 : 0; - if (field_0x950 == 12) { + if (mItem == LYT_CMN_PouchBlank4) { s += 2; } - } else if (field_0x950 == 12) { + } else if (mItem == LYT_CMN_PouchBlank4) { s = 2; } else { s = 0; @@ -182,13 +183,13 @@ void dLytDepositBoxCursor_c::init(s32 location, s32 slot, s32 item, bool unk) { } mNode.mpPane->SetVisible(true); - field_0x950 = 12; + mItem = LYT_CMN_PouchBlank4; realizeNav(); mIsVisible = true; } -void dLytDepositBoxCursor_c::updateSlot(s32 location, s32 slot, s32 unk, bool unk2) { - field_0x950 = unk; +void dLytDepositBoxCursor_c::updateSlot(s32 location, s32 slot, s32 item, bool unk2) { + mItem = item; mItemLocation = location; field_0x949 = unk2; if (mItemLocation == LOC_POUCH) { diff --git a/src/d/lyt/d_lyt_deposit_stock.cpp b/src/d/lyt/d_lyt_deposit_stock.cpp index 4bb60172..fc00aaa5 100644 --- a/src/d/lyt/d_lyt_deposit_stock.cpp +++ b/src/d/lyt/d_lyt_deposit_stock.cpp @@ -118,7 +118,7 @@ bool dLytDepositStock_c::execute() { mNodes[i].mpLytPane->execute(); } - if (field_0x684D) { + if (mIsMainStock) { mStateMgr.executeState(); }