Cleanup, docs

This commit is contained in:
robojumper
2025-12-25 20:53:07 +01:00
parent 72b8b1865f
commit 59d51629bc
5 changed files with 134 additions and 127 deletions
+1 -1
View File
@@ -8667,7 +8667,7 @@ getCurrentSlot__18dLytDepositStock_cCFv = .text:0x80156C60; // type:function siz
setItem__18dLytDepositStock_cFll = .text:0x80156C80; // type:function size:0x58
realizeItem__18dLytDepositStock_cFl = .text:0x80156CE0; // type:function size:0xD8
selectNavTarget__18dLytDepositStock_cFl = .text:0x80156DC0; // type:function size:0xDC
pickUpItem__18dLytDepositStock_cFlb = .text:0x80156EA0; // type:function size:0x1D4
pickUpOrPlaceItem__18dLytDepositStock_cFlb = .text:0x80156EA0; // type:function size:0x1D4
navigateToPouch__18dLytDepositStock_cFv = .text:0x80157080; // type:function size:0x14
navigateToSell__18dLytDepositStock_cFv = .text:0x801570A0; // type:function size:0x54
navigateToSort__18dLytDepositStock_cFv = .text:0x80157100; // type:function size:0x54
+14 -14
View File
@@ -48,7 +48,7 @@ public:
}
void setField_0x1952C(bool b) {
field_0x1952C = b;
mPreventCancellingSelection = b;
}
s32 getStateStep() const {
@@ -76,7 +76,7 @@ public:
}
bool getField_0x1952B() const {
return field_0x1952B;
return mDidDropCancelItem;
}
bool isHoldingItem() const {
@@ -172,23 +172,23 @@ private:
/* 0x19523 */ bool mIsFinishActive;
/* 0x19524 */ bool mIsSellActive;
/* 0x19525 */ bool mIsSortActive;
/* 0x19526 */ bool field_0x19526;
/* 0x19526 */ bool mIsRecycleActive;
/* 0x19527 */ bool field_0x19527;
/* 0x19528 */ bool field_0x19528;
/* 0x19529 */ bool mHasScrolledOtherStocks;
/* 0x1952A */ bool field_0x1952A;
/* 0x1952B */ bool field_0x1952B;
/* 0x1952C */ bool field_0x1952C;
/* 0x19528 */ bool mIsArrangementDone;
/* 0x19529 */ bool mHasHandledScrollTempItems;
/* 0x1952A */ bool mPrevPointerVisible;
/* 0x1952B */ bool mDidDropCancelItem;
/* 0x1952C */ bool mPreventCancellingSelection;
/* 0x19530 */ s32 mCurrentPouchNavTarget;
/* 0x19534 */ s32 mCurrentlyHoldingItemSlot;
/* 0x19534 */ s32 mCurrentlyHoldingItemSlot; // encoded with SLOT_STOCK_OFFSET
/* 0x19538 */ s32 mStateStep;
/* 0x1953C */ s32 mCursorLocation;
/* 0x19540 */ UNKWORD field_0x19540;
/* 0x19540 */ s32 mCurrentlyHoldingStockOrPouchSlot; // always raw slot
/* 0x19544 */ s32 mItemSellValue;
/* 0x19548 */ UNKWORD field_0x19548;
/* 0x1954C */ UNKWORD field_0x1954C;
/* 0x19550 */ UNKWORD field_0x19550;
/* 0x19554 */ UNKWORD field_0x19554;
/* 0x19548 */ UNKWORD field_0x19548; // always -1
/* 0x1954C */ s32 mNextLocation;
/* 0x19550 */ s32 mChangeCooldown;
/* 0x19554 */ s32 mDroppedStockSlot;
/* 0x19558 */ u8 mPouchItemIds[RING_NUM_ITEMS];
};
+19 -11
View File
@@ -34,8 +34,8 @@ public:
return mLyt.getName();
}
void nextPage(bool unk);
void prevPage(bool unk);
void nextPage(bool preventCancellingSelection);
void prevPage(bool preventCancellingSelection);
void fn_80156530(bool unk);
void navigateToItem();
@@ -50,10 +50,11 @@ public:
void navigateOffIcon();
void handleNavOrPoint();
void pickUpItem(s32 slot, bool unk);
void pickUpOrPlaceItem(s32 slot, bool place);
void selectNavTarget(s32 idx);
void setItem(s32 idx, s32 item);
s32 getCurrentSlot() const;
void loadItems(s32 hiddenSlot);
STATE_MGR_DEFINE_UTIL_EXECUTESTATE(dLytDepositStock_c);
@@ -147,13 +148,20 @@ public:
void setMainStock(bool b) {
mIsMainStock = b;
}
void onDropItem() {
mPickedUpItemOnThisPage = false;
}
//private:
void setPreventCancellingSelection() {
mPreventCancellingSelection = true;
}
private:
static const s32 NUM_ICONS_PER_PAGE = 12;
static const s32 NUM_PAGES = 5;
void initIcons();
void loadItems(s32 hiddenSlot);
void loadIcon(s32 idx);
void navigateToPouch();
void realizeItem(s32 idx);
@@ -173,21 +181,21 @@ public:
/* 0x0718 */ dLytCommonIconItem_c mIcons[NUM_ICONS_PER_PAGE];
/* 0x6778 */ d2d::SubPaneList mSubpaneList;
/* 0x6784 */ d2d::SubPaneListNode mNodes[NUM_ICONS_PER_PAGE];
/* 0x6844 */ bool field_0x6844;
/* 0x6844 */ bool mIsIdle;
/* 0x6845 */ bool mIsModePouch;
/* 0x6846 */ bool mIsModeSell;
/* 0x6847 */ bool mIsModeSort;
/* 0x6848 */ bool mIsModeFinish;
/* 0x6849 */ bool mIsSellBlocked;
/* 0x684A */ bool mIsSortBlocked;
/* 0x684B */ bool field_0x684B;
/* 0x684C */ bool field_0x684C;
/* 0x684B */ bool mPreventCancellingSelection;
/* 0x684C */ bool mPrevPointerVisible;
/* 0x684D */ bool mIsMainStock;
/* 0x684E */ bool field_0x684E;
/* 0x684E */ bool mPickedUpItemOnThisPage;
/* 0x6850 */ s32 mCurrentNavTarget;
/* 0x6854 */ UNKWORD field_0x6854;
/* 0x6854 */ s32 mNumSlots;
/* 0x6858 */ s32 mSelectedItemId;
/* 0x685C */ UNKWORD field_0x685C;
/* 0x685C */ s32 mPickedUpIdx;
/* 0x6860 */ s32 mArrowDirection;
/* 0x6864 */ s32 mSavedArrowDirection;
/* 0x6868 */ s32 mNavMode;
+69 -70
View File
@@ -164,7 +164,7 @@ void dLytDepositMain_c::executeState_ModeIn() {
mStock[STOCK_ACTIVE].fn_80156530(false);
mCurrentPouchNavTarget = -RING_NUM_ITEMS;
dCsBase_c::GetInstance()->setCursorStickTargetPane(mpRingBoundings[0]);
field_0x1954C = 0;
mNextLocation = dLytDepositBoxCursor_c::LOC_POUCH;
mIsIdle = true;
}
}
@@ -184,7 +184,7 @@ void dLytDepositMain_c::executeState_ModeIn() {
target += NUM_ICONS_PER_PAGE;
}
dCsBase_c::GetInstance()->setCursorStickTargetPane(mpItemBoundings[target]);
field_0x1954C = 1;
mNextLocation = dLytDepositBoxCursor_c::LOC_STOCK;
mIsIdle = true;
}
}
@@ -213,8 +213,8 @@ void dLytDepositMain_c::executeState_ModeChange() {
if (mIsIdle) {
checkSort();
checkPointToPouch();
if (field_0x19550 != 0) {
field_0x19550--;
if (mChangeCooldown != 0) {
mChangeCooldown--;
} else {
mStock[STOCK_ACTIVE].handleNavOrPoint();
if (!mStock[STOCK_ACTIVE].isModeSort()) {
@@ -268,7 +268,7 @@ void dLytDepositMain_c::executeState_ModeChange() {
mpBoundingCleanUp->SetVisible(true);
mStock[STOCK_ACTIVE].fn_80156530(true);
setPouchItemsVisible(false);
field_0x1954C = 1;
mNextLocation = dLytDepositBoxCursor_c::LOC_STOCK;
mStock[STOCK_ACTIVE].returnToNoneMode();
s32 target = mStock[STOCK_ACTIVE].getCurrentNavTarget();
if (target < 0) {
@@ -280,7 +280,7 @@ void dLytDepositMain_c::executeState_ModeChange() {
}
showCursor();
updateStockCursor();
field_0x19550 = 1;
mChangeCooldown = 1;
mIsIdle = true;
}
}
@@ -294,7 +294,7 @@ void dLytDepositMain_c::executeState_ModeArrangement() {
mAnm[DEPOSIT_ANIM_BTN_DECIDE_01].setAnimEnable(false);
loadStockItems(mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET);
mStock[STOCK_ACTIVE].fn_80156530(true);
field_0x1954C = 1;
mNextLocation = dLytDepositBoxCursor_c::LOC_STOCK;
mIsIdle = true;
}
}
@@ -311,7 +311,7 @@ void dLytDepositMain_c::executeState_ModeReverseChange() {
mpBoundingCleanUp->SetVisible(false);
setPouchItemsVisible(true);
mStock[STOCK_ACTIVE].fn_80156530(false);
field_0x1954C = 0;
mNextLocation = dLytDepositBoxCursor_c::LOC_POUCH;
mStateStep = 1;
}
} else {
@@ -332,20 +332,20 @@ void dLytDepositMain_c::executeState_ModeScroll() {
mLyt.calc();
mAnm[DEPOSIT_ANIM_SCROLL_R].setAnimEnable(false);
for (int i = 0; i < NUM_STOCKS; i++) {
mStock[i].nextPage(field_0x1952C);
mStock[i].nextPage(mPreventCancellingSelection);
mStock[i].loadItems(currentlyHeldSlot);
}
mStock[STOCK_ACTIVE].fn_80156530(true);
field_0x1954C = 1;
mNextLocation = dLytDepositBoxCursor_c::LOC_STOCK;
loadPageText();
showCursor();
if (mStock[STOCK_ACTIVE].getArrowDirection() >= dLytCommonArrow_c::ARROW_NONE) {
updateStockCursor();
}
field_0x1952C = true;
mPreventCancellingSelection = true;
mIsIdle = true;
} else if (!mHasScrolledOtherStocks && mAnm[DEPOSIT_ANIM_SCROLL_R].getFrame() >= 2.0f) {
mHasScrolledOtherStocks = true;
} else if (!mHasHandledScrollTempItems && mAnm[DEPOSIT_ANIM_SCROLL_R].getFrame() >= 2.0f) {
mHasHandledScrollTempItems = true;
u8 oldPage = mStock[2].getPage();
mStock[2].setPage(mStock[1].getPage());
mStock[2].nextPage(false);
@@ -358,20 +358,20 @@ void dLytDepositMain_c::executeState_ModeScroll() {
mLyt.calc();
mAnm[DEPOSIT_ANIM_SCROLL_L].setAnimEnable(false);
for (int i = 0; i < NUM_STOCKS; i++) {
mStock[i].prevPage(field_0x1952C);
mStock[i].prevPage(mPreventCancellingSelection);
mStock[i].loadItems(currentlyHeldSlot);
}
mStock[STOCK_ACTIVE].fn_80156530(true);
field_0x1954C = 1;
mNextLocation = dLytDepositBoxCursor_c::LOC_STOCK;
loadPageText();
showCursor();
if (mStock[STOCK_ACTIVE].getArrowDirection() >= dLytCommonArrow_c::ARROW_NONE) {
updateStockCursor();
}
field_0x1952C = true;
mPreventCancellingSelection = true;
mIsIdle = true;
} else if (!mHasScrolledOtherStocks && mAnm[DEPOSIT_ANIM_SCROLL_L].getFrame() >= 2.0f) {
mHasScrolledOtherStocks = true;
} else if (!mHasHandledScrollTempItems && mAnm[DEPOSIT_ANIM_SCROLL_L].getFrame() >= 2.0f) {
mHasHandledScrollTempItems = true;
u8 oldPage = mStock[1].getPage();
mStock[1].setPage(mStock[2].getPage());
mStock[1].prevPage(false);
@@ -392,7 +392,7 @@ void dLytDepositMain_c::executeState_ModeRecycle() {
mLyt.calc();
dCsBase_c::GetInstance()->setVisible(false);
dPadNav::setNavEnabled(false, false);
if (field_0x1954C != 0) {
if (mNextLocation != dLytDepositBoxCursor_c::LOC_POUCH) {
mArrow.requestOut();
mStateStep = 2;
} else {
@@ -434,7 +434,7 @@ void dLytDepositMain_c::executeState_ModeArrangementOut() {
mAnm[DEPOSIT_ANIM_BTN_ON_OFF_01].setFrame(0.0f);
mLyt.calc();
mAnm[DEPOSIT_ANIM_BTN_ON_OFF_01].setAnimEnable(false);
field_0x19528 = true;
mIsArrangementDone = true;
mStock[STOCK_ACTIVE].disableModeSort();
mStock[STOCK_ACTIVE].navigateToItem();
mIsIdle = true;
@@ -596,30 +596,30 @@ bool dLytDepositMain_c::build(d2d::ResAccIf_c *resAcc) {
mIsFinishActive = false;
mIsSellActive = false;
mIsSortActive = false;
field_0x19526 = false;
mIsRecycleActive = false;
field_0x19527 = false;
field_0x19528 = false;
mHasScrolledOtherStocks = false;
field_0x1952A = true;
field_0x1952B = false;
field_0x1952C = true;
mIsArrangementDone = false;
mHasHandledScrollTempItems = false;
mPrevPointerVisible = true;
mDidDropCancelItem = false;
mPreventCancellingSelection = true;
mCurrentPouchNavTarget = -1;
mCurrentlyHoldingItemSlot = -1;
mStateStep = 0;
mCursorLocation = dLytDepositBoxCursor_c::LOC_POUCH;
field_0x19540 = 0;
mCurrentlyHoldingStockOrPouchSlot = 0;
mItemSellValue = 0;
field_0x19548 = -1;
field_0x1954C = 0;
field_0x19550 = 0;
field_0x19554 = 0;
mNextLocation = dLytDepositBoxCursor_c::LOC_POUCH;
mChangeCooldown = 0;
mDroppedStockSlot = 0;
return true;
}
bool dLytDepositMain_c::execute() {
field_0x1952B = false;
mDidDropCancelItem = false;
mCsHitCheck.resetCachedHitboxes();
mCsHitCheck.execute();
@@ -659,7 +659,7 @@ bool dLytDepositMain_c::execute() {
mArrow.setTranslate(&v);
mArrow.execute();
field_0x1952A = dPadNav::isPointerVisible();
mPrevPointerVisible = dPadNav::isPointerVisible();
return true;
}
@@ -810,7 +810,7 @@ void dLytDepositMain_c::setModeReverseChange() {
mLyt.calc();
mStock[STOCK_ACTIVE].navigateOffIcon();
mStock[STOCK_ACTIVE].field_0x684B = true;
mStock[STOCK_ACTIVE].setPreventCancellingSelection();
mStock[STOCK_ACTIVE].fn_80156530(false);
mStock[STOCK_ACTIVE].navigateToItem();
mStock[STOCK_ACTIVE].returnToNoneMode();
@@ -833,13 +833,13 @@ void dLytDepositMain_c::setModeScroll(bool leftRight, bool viaButton) {
}
mLyt.calc();
mStock[STOCK_ACTIVE].navigateOffIcon();
mStock[STOCK_ACTIVE].field_0x684B = true;
mStock[STOCK_ACTIVE].setPreventCancellingSelection();
mStock[STOCK_ACTIVE].fn_80156530(false);
if (viaButton) {
mArrow.triggerArrowPress();
}
hideCursor();
mHasScrolledOtherStocks = false;
mHasHandledScrollTempItems = false;
mStateMgr.changeState(StateID_ModeScroll);
mIsIdle = false;
}
@@ -849,10 +849,10 @@ void dLytDepositMain_c::setModeRecycle() {
mAnm[DEPOSIT_ANIM_BTN_DECIDE_02].setFrame(0.0f);
mLyt.calc();
mStateStep = 0;
field_0x19526 = true;
mIsRecycleActive = true;
field_0x19527 = true;
if (field_0x1954C == 0) {
if (mNextLocation == dLytDepositBoxCursor_c::LOC_POUCH) {
setPouchItemsVisible(false);
} else {
mStock[STOCK_ACTIVE].fn_80156530(false);
@@ -868,7 +868,7 @@ 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;
mIsRecycleActive = false;
mCursorLocation = dLytDepositBoxCursor_c::LOC_STOCK;
field_0x19527 = true;
mStateStep = 0;
@@ -888,7 +888,7 @@ void dLytDepositMain_c::setModeOut() {
mStock[STOCK_ACTIVE].navigateOffIcon();
}
field_0x19526 = false;
mIsRecycleActive = false;
field_0x19527 = false;
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_SELECT_DECIDE);
@@ -1024,12 +1024,12 @@ void dLytDepositMain_c::loadInitialState() {
mIsFinishActive = false;
mIsSellActive = false;
mIsSortActive = false;
field_0x19526 = false;
mIsRecycleActive = false;
field_0x19527 = false;
field_0x19528 = false;
mIsArrangementDone = false;
mCursorLocation = dLytDepositBoxCursor_c::LOC_POUCH;
field_0x19540 = 0;
mCurrentlyHoldingStockOrPouchSlot = 0;
mItemSellValue = 0;
mCurrentPouchNavTarget = -1;
@@ -1114,7 +1114,7 @@ void dLytDepositMain_c::checkPouchItems() {
!mStock[STOCK_ACTIVE].isModeFinish()) {
s32 target = mCurrentPouchNavTarget;
s32 direction = dPadNav::getFSStickNavDirection();
if (target < 0 || field_0x1952A) {
if (target < 0 || mPrevPointerVisible) {
if (direction != dPadNav::FS_STICK_NONE || dCsBase_c::GetInstance()->isCursorStickVisible()) {
if (target < 0) {
target += SLOT_STOCK_OFFSET;
@@ -1420,10 +1420,10 @@ void dLytDepositMain_c::checkSellOrFinish() {
} else {
s32 direction = dPadNav::getFSStickNavDirection();
if (mStock[STOCK_ACTIVE].isModeFinish()) {
if (!mIsFinishActive || field_0x1952A) {
if (!mIsFinishActive || mPrevPointerVisible) {
dCsBase_c::GetInstance()->setCursorStickTargetPane(mpBoundingChoices);
updateFlags = 1;
} else if (field_0x1954C == 0) {
} else if (mNextLocation == dLytDepositBoxCursor_c::LOC_POUCH) {
switch (direction) {
case dPadNav::FS_STICK_UP:
case dPadNav::FS_STICK_UP_LEFT:
@@ -1461,11 +1461,11 @@ void dLytDepositMain_c::checkSellOrFinish() {
}
}
} else if (mStock[STOCK_ACTIVE].isModeSell()) {
if (!mIsSellActive || field_0x1952A) {
if (!mIsSellActive || mPrevPointerVisible) {
dCsBase_c::GetInstance()->setCursorStickTargetPane(mpBoundingItem12);
mCursor.activateSell();
updateFlags = 2;
} else if (field_0x1954C == 0) {
} else if (mNextLocation == dLytDepositBoxCursor_c::LOC_POUCH) {
switch (direction) {
case dPadNav::FS_STICK_UP:
case dPadNav::FS_STICK_UP_RIGHT:
@@ -1542,7 +1542,7 @@ void dLytDepositMain_c::checkSellOrFinish() {
box1->setTextWithGlobalTextProcessor(buf, nullptr);
box2->setTextWithGlobalTextProcessor(buf, nullptr);
dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0);
if (field_0x1954C != 0) {
if (mNextLocation != dLytDepositBoxCursor_c::LOC_POUCH) {
mArrow.setBackwards(false);
}
}
@@ -1555,7 +1555,7 @@ void dLytDepositMain_c::checkSellOrFinish() {
mStock[STOCK_ACTIVE].disableModeSell();
mIsSellActive = false;
}
if (field_0x1954C != 0) {
if (mNextLocation != dLytDepositBoxCursor_c::LOC_POUCH) {
mArrow.setBackwards(true);
}
}
@@ -1635,7 +1635,7 @@ void dLytDepositMain_c::checkSort() {
}
} else {
if (mStock[STOCK_ACTIVE].isModeSort()) {
if (!mIsSortActive || field_0x1952A) {
if (!mIsSortActive || mPrevPointerVisible) {
dCsBase_c::GetInstance()->setCursorStickTargetPane(mpBoundingCleanUp);
b = true;
} else {
@@ -1710,7 +1710,7 @@ void dLytDepositMain_c::checkArrows() {
}
} else {
if (field_0x1952A && mStock[STOCK_ACTIVE].getSavedArrowDirection() < dLytCommonArrow_c::ARROW_NONE) {
if (mPrevPointerVisible && mStock[STOCK_ACTIVE].getSavedArrowDirection() < dLytCommonArrow_c::ARROW_NONE) {
s32 dir = mStock[STOCK_ACTIVE].restoreArrowDirection();
if (mStock[STOCK_ACTIVE].getArrowDirection() >= dLytCommonArrow_c::ARROW_NONE) {
mArrow.setActiveArrow(dir);
@@ -1743,7 +1743,7 @@ void dLytDepositMain_c::checkArrows() {
mCursor.updateSlot(loc, slot, LYT_CMN_PouchPotionHealthPlusPlusHalf, false);
}
mArrow.setActiveArrow(dir);
if (!field_0x1952A) {
if (!mPrevPointerVisible) {
switch (dPadNav::getFSStickNavDirection()) {
case dPadNav::FS_STICK_UP_RIGHT:
case dPadNav::FS_STICK_RIGHT:
@@ -1837,7 +1837,7 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() {
mPouchItemIds[mCurrentPouchNavTarget] != LYT_CMN_PouchPotionHealthPlusPlusHalf) {
// ... and picking up an item from the pouch
mCursorLocation = dLytDepositBoxCursor_c::LOC_POUCH;
field_0x19540 = convertLytPouchSlot2(mCurrentPouchNavTarget);
mCurrentlyHoldingStockOrPouchSlot = convertLytPouchSlot2(mCurrentPouchNavTarget);
item = getPouchItemIdForIndex(mCurrentPouchNavTarget, false);
mCurrentlyHoldingItemSlot = mCurrentPouchNavTarget;
mCursor.init(mCursorLocation, mCurrentPouchNavTarget, mPouchItemIds[mCurrentPouchNavTarget], false);
@@ -1857,16 +1857,16 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() {
// ... and picking up an item from the stock
s32 stockSlot = mStock[STOCK_ACTIVE].getCurrentSlot();
mCursorLocation = dLytDepositBoxCursor_c::LOC_STOCK;
field_0x19540 = stockSlot;
mCurrentlyHoldingStockOrPouchSlot = stockSlot;
item = FileManager::GetInstance()->getItemCheckItem(stockSlot);
mCurrentlyHoldingItemSlot = stockSlot + SLOT_STOCK_OFFSET;
mCursor.init(
mCursorLocation, stockSlot,
mStock[STOCK_ACTIVE].getItem(mStock[STOCK_ACTIVE].getCurrentNavTarget()), false
);
mStock[STOCK_ACTIVE].pickUpItem(stockSlot, false);
mStock[STOCK_ACTIVE].pickUpOrPlaceItem(stockSlot, false);
loadItemText(-1, dLytDepositBoxCursor_c::LOC_STOCK);
field_0x19554 = 0;
mDroppedStockSlot = 0;
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_CHACH_ITEM);
anyPickup = true;
}
@@ -1927,9 +1927,8 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() {
loadStockItems(-1);
loadPouchItem(mCurrentPouchNavTarget);
mStock[STOCK_ACTIVE].field_0x684E = false;
for (int i = 0; i < NUM_STOCKS; i++) {
mStock[i].field_0x684E = false;
mStock[i].onDropItem();
}
}
@@ -1943,12 +1942,11 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() {
} 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;
mDroppedStockSlot = mStock[STOCK_ACTIVE].getCurrentSlot();
s32 item = mStock[STOCK_ACTIVE].getActiveItem();
if (mCurrentlyHoldingItemSlot < SLOT_STOCK_OFFSET) {
// Source item is from pouch, so move item from pouch to stock
swapStockAndPouchItems(convertLytPouchSlot(mCurrentlyHoldingItemSlot), field_0x19554);
swapStockAndPouchItems(convertLytPouchSlot(mCurrentlyHoldingItemSlot), mDroppedStockSlot);
mStock[STOCK_ACTIVE].setItem(
mStock[STOCK_ACTIVE].getCurrentNavTarget(), mPouchItemIds[mCurrentlyHoldingItemSlot]
);
@@ -1957,20 +1955,20 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() {
loadPouchItem(mCurrentlyHoldingItemSlot);
} else {
// Source item is from stock, so swap stock items
swapStockItems(mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET, slot);
swapStockItems(mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET, mDroppedStockSlot);
loadStockItems(-1);
if (!dPadNav::isPointerVisible()) {
mStock[STOCK_ACTIVE].field_0x684B = true;
mStock[STOCK_ACTIVE].setPreventCancellingSelection();
}
mStock[STOCK_ACTIVE].fn_80156530(true);
field_0x1954C = 1;
if (field_0x19554 == mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET) {
mNextLocation = dLytDepositBoxCursor_c::LOC_STOCK;
if (mDroppedStockSlot == mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET) {
b2 = true;
}
}
for (int i = 0; i < NUM_STOCKS; i++) {
mStock[i].field_0x684E = false;
mStock[i].onDropItem();
}
if (item != LYT_CMN_PouchBlank4 && !b2) {
@@ -2003,7 +2001,7 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() {
mAnm[DEPOSIT_ANIM_RECYCLE].setBackwardsOnce();
mStock[STOCK_ACTIVE].disableModeSell();
mIsSellActive = false;
if (field_0x1954C == 0) {
if (mNextLocation == dLytDepositBoxCursor_c::LOC_POUCH) {
// TODO: Why is this not >= ...
if (mCurrentlyHoldingItemSlot > SLOT_STOCK_OFFSET) {
selectPouchSlot(0);
@@ -2026,9 +2024,10 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() {
// dropped pouch item, show pouch pane
mRingNodes[mCurrentlyHoldingItemSlot].mpPane->SetVisible(true);
} else {
mStock[STOCK_ACTIVE].pickUpItem(mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET, true);
// dropped stock item
mStock[STOCK_ACTIVE].pickUpOrPlaceItem(mCurrentlyHoldingItemSlot - SLOT_STOCK_OFFSET, true);
loadStockItems(-1);
mStock[STOCK_ACTIVE].field_0x684B = true;
mStock[STOCK_ACTIVE].setPreventCancellingSelection();
mStock[STOCK_ACTIVE].fn_80156530(true);
}
mCurrentlyHoldingItemSlot = -1;
@@ -2039,7 +2038,7 @@ void dLytDepositMain_c::checkForItemPickupOrDrop() {
mAnm[DEPOSIT_ANIM_INPUT_01].setBackwardsOnce();
mCursor.setVisible(false);
mItemSellValue = 0;
field_0x1952B = 1;
mDidDropCancelItem = true;
}
}
}
+31 -31
View File
@@ -18,7 +18,7 @@ STATE_DEFINE(dLytDepositStock_c, None);
void dLytDepositStock_c::initializeState_None() {}
void dLytDepositStock_c::executeState_None() {
field_0x6844 = true;
mIsIdle = true;
}
void dLytDepositStock_c::finalizeState_None() {}
@@ -92,13 +92,13 @@ bool dLytDepositStock_c::build(d2d::ResAccIf_c *resAcc) {
mCurrentNavTarget = -12;
mSelectedItemId = -1;
field_0x685C = -1;
mPickedUpIdx = -1;
mIsSellBlocked = false;
mIsSortBlocked = false;
field_0x684B = false;
field_0x684C = true;
field_0x684E = false;
mPreventCancellingSelection = false;
mPrevPointerVisible = true;
mPickedUpItemOnThisPage = false;
mArrowDirection = dLytCommonArrow_c::ARROW_NONE;
@@ -115,7 +115,7 @@ bool dLytDepositStock_c::build(d2d::ResAccIf_c *resAcc) {
}
bool dLytDepositStock_c::execute() {
for (int i = 0; i < field_0x6854; i++) {
for (int i = 0; i < mNumSlots; i++) {
mNodes[i].mpLytPane->execute();
}
@@ -135,7 +135,7 @@ bool dLytDepositStock_c::execute() {
mLyt.calc();
field_0x684C = dPadNav::isPointerVisible();
mPrevPointerVisible = dPadNav::isPointerVisible();
return true;
}
@@ -181,7 +181,7 @@ void dLytDepositStock_c::initIcons() {
}
}
for (int i = 0; i < field_0x6854; i++) {
for (int i = 0; i < mNumSlots; i++) {
mNodes[i].mpPane->SetVisible(false);
}
}
@@ -189,8 +189,8 @@ void dLytDepositStock_c::initIcons() {
void dLytDepositStock_c::loadItems(s32 hiddenSlot) {
s32 slot = mItemPage * NUM_ICONS_PER_PAGE;
field_0x6854 = 0;
field_0x684E = false;
mNumSlots = 0;
mPickedUpItemOnThisPage = false;
for (int i = 0; i < NUM_ICONS_PER_PAGE; i++) {
mIcons[i].reset();
@@ -214,7 +214,7 @@ void dLytDepositStock_c::loadItems(s32 hiddenSlot) {
mAnm[i + DEPOSIT_STOCK_ANIM_HAVE_BOX_OFFSET].setAnimEnable(false);
slot++;
field_0x6854++;
mNumSlots++;
}
}
@@ -241,21 +241,21 @@ void dLytDepositStock_c::loadIcon(s32 idx) {
}
}
void dLytDepositStock_c::nextPage(bool unk) {
void dLytDepositStock_c::nextPage(bool preventCancellingSelection) {
mItemPage++;
if (mItemPage >= NUM_PAGES) {
mItemPage = 0;
}
field_0x684B = unk;
mPreventCancellingSelection = preventCancellingSelection;
}
void dLytDepositStock_c::prevPage(bool unk) {
void dLytDepositStock_c::prevPage(bool preventCancellingSelection) {
if (mItemPage != 0) {
mItemPage--;
} else {
mItemPage = NUM_PAGES - 1;
}
field_0x684B = unk;
mPreventCancellingSelection = preventCancellingSelection;
}
void dLytDepositStock_c::fn_80156530(bool unk) {
@@ -263,7 +263,7 @@ void dLytDepositStock_c::fn_80156530(bool unk) {
mIcons[i].setVisible(unk);
}
if (!field_0x684B) {
if (!mPreventCancellingSelection) {
if (mCurrentNavTarget >= 0) {
mAnm[mCurrentNavTarget + DEPOSIT_STOCK_ANIM_FLASH_OFFSET].setAnimEnable(true);
mSelectedItemId = -1;
@@ -271,7 +271,7 @@ void dLytDepositStock_c::fn_80156530(bool unk) {
mCurrentNavTarget = -10;
}
field_0x684B = false;
mPreventCancellingSelection = false;
mIsModePouch = false;
mIsModeSell = false;
if (!mIsModeSort) {
@@ -301,7 +301,7 @@ void dLytDepositStock_c::handleNavOrPoint() {
handleSpecialNavMode();
} else if (!mIsModePouch && !mIsModeSell && !mIsModeSort && !mIsModeFinish && mSavedArrowDirection >= 2) {
s32 target = mCurrentNavTarget;
if (target < 0 || field_0x684C) {
if (target < 0 || mPrevPointerVisible) {
if (dir != dPadNav::FS_STICK_NONE || dCsBase_c::GetInstance()->isCursorStickVisible()) {
if (target < 0) {
target += NUM_ICONS_PER_PAGE;
@@ -533,7 +533,7 @@ void dLytDepositStock_c::setItem(s32 idx, s32 item) {
mItemIds[idx] = item;
realizeItem(idx);
mIcons[idx].setOn();
field_0x684E = false;
mPickedUpItemOnThisPage = false;
}
void dLytDepositStock_c::realizeItem(s32 idx) {
@@ -567,37 +567,37 @@ void dLytDepositStock_c::selectNavTarget(s32 idx) {
}
}
void dLytDepositStock_c::pickUpItem(s32 slot, bool unk) {
void dLytDepositStock_c::pickUpOrPlaceItem(s32 slot, bool place) {
s32 page = slot / NUM_ICONS_PER_PAGE;
s32 idx = slot % NUM_ICONS_PER_PAGE;
if (unk) {
mNodes[idx].mpPane->SetVisible(unk);
if (place) {
mNodes[idx].mpPane->SetVisible(place);
}
if (mItemPage != page) {
if (unk) {
field_0x684E = false;
if (place) {
mPickedUpItemOnThisPage = false;
}
} else {
s32 item = mItemIds[idx];
f32 frame;
if (unk) {
if (place) {
// TODO why LYT_CMN_PouchPotionHealthPlusPlusHalf
if (item != LYT_CMN_PouchPotionHealthPlusPlusHalf && item != LYT_CMN_PouchBlank4) {
frame = 1.0f;
if (field_0x684E) {
s32 otherIdx = field_0x685C % NUM_ICONS_PER_PAGE;
if (mPickedUpItemOnThisPage) {
s32 otherIdx = mPickedUpIdx % NUM_ICONS_PER_PAGE;
mIcons[idx].setItem(mItemIds[otherIdx]);
field_0x684E = false;
mPickedUpItemOnThisPage = false;
}
} else {
frame = 0.0f;
}
field_0x685C = -1;
mPickedUpIdx = -1;
} else {
field_0x685C = slot;
mPickedUpIdx = slot;
frame = 0.0f;
field_0x684E = true;
mPickedUpItemOnThisPage = true;
mIcons[idx].setOff();
mIcons[idx].setHasNumber(false);
mIcons[idx].setItem(LYT_CMN_PouchBlank4);