d_lyt_deposit WIP

This commit is contained in:
robojumper
2025-12-21 21:33:53 +01:00
parent 3754ad2e08
commit b6f53bad32
12 changed files with 1214 additions and 129 deletions
+203
View File
@@ -0,0 +1,203 @@
#include "d/lyt/d_lyt_deposit_box_cursor.h"
#include "common.h"
#include "d/d_cs_base.h"
#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_util_items.h"
#include "m/m_vec.h"
#include "nw4r/lyt/lyt_group.h"
#include "nw4r/lyt/lyt_pane.h"
#include "nw4r/math/math_types.h"
#include "toBeSorted/arc_managers/layout_arc_manager.h"
static const d2d::LytBrlanMapping brlanMap[] = {
{ "depositBoxCursor_00_loop.brlan", "G_loop_00"},
{"depositBoxCursor_00_stickCursor.brlan", "G_stickCursor_00"},
};
#define DEPOSIT_BOX_CURSOR_ANIM_LOOP 0
#define DEPOSIT_BOX_CURSOR_ANIM_STICK_CURSOR 1
#define DEPOSIT_BOX_CURSOR_NUM_ANIMS 2
bool dLytDepositBoxCursor_c::build(d2d::ResAccIf_c *resAcc) {
mLyt.setResAcc(resAcc);
mLyt.build("depositBoxCursor_00.brlyt", nullptr);
mLyt.setPriority(0x88);
for (int i = 0; i < DEPOSIT_BOX_CURSOR_NUM_ANIMS; i++) {
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
mAnm[i].bind(false);
mAnm[i].setAnimEnable(false);
}
mAnm[DEPOSIT_BOX_CURSOR_ANIM_LOOP].setAnimEnable(true);
mAnm[DEPOSIT_BOX_CURSOR_ANIM_LOOP].setFrame(0.0f);
mLyt.calc();
mpStickCursorPane = mLyt.findPane("N_stickCursor_00");
mpGetIconPane = mLyt.findPane("N_getIcon_00");
initIcon();
mIsVisible = false;
field_0x949 = false;
return true;
}
bool dLytDepositBoxCursor_c::execute() {
realizeNav();
mAnm[DEPOSIT_BOX_CURSOR_ANIM_LOOP].play();
if (mIsVisible) {
mNode.mpLytPane->execute();
}
mLyt.calc();
return true;
}
bool dLytDepositBoxCursor_c::draw() {
if (mIsVisible) {
mLyt.addToDrawList();
}
return true;
}
bool dLytDepositBoxCursor_c::remove() {
for (d2d::SubPaneList::Iterator it = mSubpaneList.GetBeginIter(); it != mSubpaneList.GetEndIter(); ++it) {
d2d::dSubPane *subPane = it->mpLytPane;
if (subPane != nullptr) {
nw4r::lyt::Pane *parent = subPane->getPane()->GetParent();
parent->RemoveChild(subPane->getPane());
}
}
mNode.mpLytPane->remove();
mLyt.unbindAnims();
for (int i = 0; i < DEPOSIT_BOX_CURSOR_NUM_ANIMS; i++) {
mAnm[i].remove();
}
return true;
}
static const char *sGroupName = "G_ref_00";
void dLytDepositBoxCursor_c::initIcon() {
void *data = LayoutArcManager::GetInstance()->getLoadedData("DoButton");
d2d::ResAccIf_c resAcc;
resAcc.attach(data, "");
mNode.mpLytPane = &mIcon;
mIcon.build(&resAcc, dLytCommonIconItem_c::POUCH);
mSubpaneList.PushBack(&mNode);
if (mLyt.getLayout()->GetGroupContainer() != nullptr) {
nw4r::lyt::Group *g = mLyt.getLayout()->GetGroupContainer()->FindGroupByName(sGroupName);
if (g != nullptr) {
d2d::dSubPane::linkMeters(g, &mSubpaneList);
}
}
mIcon.setUnk(false);
mIcon.setHasNumber(false);
mIcon.setNumber(0);
mIcon.setVisible(false);
mNode.mpPane->SetVisible(false);
}
void dLytDepositBoxCursor_c::realizeNav() {
s32 s;
if (mSlot < 0) {
s = mAnm[DEPOSIT_BOX_CURSOR_ANIM_STICK_CURSOR].getLastFrame();
} else if (dPadNav::isPointerVisible()) {
s = 4;
} else if (field_0x950 == 50) {
s = 5;
} else if (field_0x949) {
s = 6;
} else if (mItemLocation == LOC_POUCH) {
s = mSlot == 0 ? 1 : 0;
if (field_0x950 == 12) {
s += 2;
}
} else if (field_0x950 == 12) {
s = 2;
} else {
s = 0;
}
mVec3_c v;
if (dPadNav::isPointerVisible()) {
mVec2_c pos = dCsBase_c::GetInstance()->getCursorIf()->getCursorPos();
v.set(pos.x, pos.y + 15.0f, 0.0f);
} else {
nw4r::math::MTX34 mtx = dCsBase_c::GetInstance()->getCursorStickAllPane()->GetGlobalMtx();
v.set(mtx._03, mtx._13, 0.0f);
}
mpStickCursorPane->SetTranslate(v);
mAnm[DEPOSIT_BOX_CURSOR_ANIM_STICK_CURSOR].setAnimEnable(true);
mAnm[DEPOSIT_BOX_CURSOR_ANIM_STICK_CURSOR].setFrame(s);
mLyt.calc();
mAnm[DEPOSIT_BOX_CURSOR_ANIM_STICK_CURSOR].setAnimEnable(false);
}
void dLytDepositBoxCursor_c::init(s32 location, s32 slot, s32 item, bool unk) {
mItemLocation = location;
field_0x949 = unk;
s32 number;
f32 durability;
u8 color;
if (mItemLocation == LOC_POUCH) {
number = getPouchItemAmount(slot, false);
durability = getPouchShieldDurability(slot, false);
color = getPouchItemNumberColor(slot, false);
mSlot = slot;
} else {
number = getDepositItemAmount(slot);
durability = getDepositShieldDurability(slot);
color = getDepositItemNumberColor(slot);
mSlot = slot % 12;
}
if (number < 0) {
mIcon.setHasNumber(false);
} else {
mIcon.setHasNumber(true);
mIcon.setNumber(number);
}
mIcon.setUnk(false);
mIcon.setItem(item);
if (color != 3) {
mIcon.setNumberColor(color);
}
if (durability >= 0.0f) {
mIcon.setShieldDurability(durability);
}
mNode.mpPane->SetVisible(true);
field_0x950 = 12;
realizeNav();
mIsVisible = true;
}
void dLytDepositBoxCursor_c::updateSlot(s32 location, s32 slot, s32 unk, bool unk2) {
field_0x950 = unk;
mItemLocation = location;
field_0x949 = unk2;
if (mItemLocation == LOC_POUCH) {
mSlot = slot;
} else {
mSlot = slot % 12;
}
}
void dLytDepositBoxCursor_c::fn_801580A0() {
field_0x949 = true;
realizeNav();
}
+682
View File
@@ -0,0 +1,682 @@
#include "d/lyt/d_lyt_deposit_stock.h"
#include "d/d_cs_base.h"
#include "d/d_pad_nav.h"
#include "d/d_rumble.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 "d/snd/d_snd_small_effect_mgr.h"
#include "d/snd/d_snd_wzsound.h"
#include "nw4r/lyt/lyt_group.h"
#include "toBeSorted/arc_managers/layout_arc_manager.h"
#include "toBeSorted/file_manager.h"
STATE_DEFINE(dLytDepositStock_c, None);
void dLytDepositStock_c::initializeState_None() {}
void dLytDepositStock_c::executeState_None() {
field_0x6844 = true;
}
void dLytDepositStock_c::finalizeState_None() {}
static const d2d::LytBrlanMapping brlanMap[] = {
{ "depositBoxBg_00_flash.brlan", "G_flash_00"},
{ "depositBoxBg_00_flash.brlan", "G_flash_01"},
{ "depositBoxBg_00_flash.brlan", "G_flash_02"},
{ "depositBoxBg_00_flash.brlan", "G_flash_03"},
{ "depositBoxBg_00_flash.brlan", "G_flash_04"},
{ "depositBoxBg_00_flash.brlan", "G_flash_05"},
{ "depositBoxBg_00_flash.brlan", "G_flash_06"},
{ "depositBoxBg_00_flash.brlan", "G_flash_07"},
{ "depositBoxBg_00_flash.brlan", "G_flash_08"},
{ "depositBoxBg_00_flash.brlan", "G_flash_09"},
{ "depositBoxBg_00_flash.brlan", "G_flash_10"},
{ "depositBoxBg_00_flash.brlan", "G_flash_11"},
{ "depositBoxBg_00_loop.brlan", "G_loop_00"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_00"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_01"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_02"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_03"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_04"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_05"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_06"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_07"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_08"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_09"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_10"},
{"depositBoxBg_00_haveBox.brlan", "G_poach_11"},
};
#define DEPOSIT_STOCK_ANIM_FLASH_OFFSET 0
#define DEPOSIT_STOCK_ANIM_LOOP 12
#define DEPOSIT_STOCK_ANIM_HAVE_BOX_OFFSET 13
#define DEPOSIT_STOCK_NUM_ANIMS 25
bool dLytDepositStock_c::build(d2d::ResAccIf_c *resAcc) {
mLyt.setResAcc(resAcc);
mLyt.build("depositBoxBg_00.brlyt", nullptr);
for (int i = 0; i < DEPOSIT_STOCK_NUM_ANIMS; i++) {
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
mAnm[i].bind(false);
mAnm[i].setAnimEnable(false);
}
int i;
for (i = 0; i < DEPOSIT_STOCK_NUM_ANIMS; i++) {
if (i < DEPOSIT_STOCK_ANIM_FLASH_OFFSET + NUM_ICONS_PER_PAGE) {
mAnm[i].setAnimEnable(true);
mAnm[i].setToEnd();
} else {
mAnm[i].setAnimEnable(true);
mAnm[i].setFrame(0.0f);
}
}
mLyt.calc();
for (i = 0; i < DEPOSIT_STOCK_NUM_ANIMS; i++) {
if (i != DEPOSIT_STOCK_ANIM_LOOP) {
mAnm[i].setAnimEnable(false);
}
}
initIcons();
mStateMgr.changeState(StateID_None);
mCurrentNavTarget = -12;
mSelectedItemId = -1;
field_0x685C = -1;
field_0x6849 = false;
field_0x684A = false;
field_0x684B = false;
field_0x684C = true;
field_0x684E = false;
mArrowDirection = ARROW_NONE;
field_0x6845 = false;
field_0x6846 = false;
field_0x6847 = false;
field_0x6848 = false;
mSavedArrowDirection = ARROW_NONE;
navigateToItem();
return true;
}
bool dLytDepositStock_c::execute() {
for (int i = 0; i < field_0x6854; i++) {
mNodes[i].mpLytPane->execute();
}
if (field_0x684D) {
mStateMgr.executeState();
}
for (int i = 0; i < DEPOSIT_STOCK_ANIM_LOOP + 1; i++) {
if (mAnm[i].isEnabled()) {
if (i < NUM_ICONS_PER_PAGE && mAnm[i].isStop()) {
mAnm[i].setAnimEnable(false);
}
mAnm[i].play();
}
}
mLyt.calc();
field_0x684C = dPadNav::isPointerVisible();
return true;
}
bool dLytDepositStock_c::remove() {
for (d2d::SubPaneList::Iterator it = mSubpaneList.GetBeginIter(); it != mSubpaneList.GetEndIter(); ++it) {
d2d::dSubPane *subPane = it->mpLytPane;
if (subPane != nullptr) {
nw4r::lyt::Pane *parent = subPane->getPane()->GetParent();
parent->RemoveChild(subPane->getPane());
}
}
for (int i = 0; i < NUM_ICONS_PER_PAGE; i++) {
mNodes[i].mpLytPane->remove();
}
mLyt.unbindAnims();
for (int i = 0; i < DEPOSIT_STOCK_NUM_ANIMS; i++) {
mAnm[i].remove();
}
return true;
}
static const char *sGroupName = "G_ref_00";
void dLytDepositStock_c::initIcons() {
void *data = LayoutArcManager::GetInstance()->getLoadedData("DoButton");
d2d::ResAccIf_c resAcc;
resAcc.attach(data, "");
for (int i = 0; i < NUM_ICONS_PER_PAGE; i++) {
mNodes[i].mpLytPane = &mIcons[i];
mIcons[i].build(&resAcc, dLytCommonIconItem_c::POUCH);
mSubpaneList.PushBack(&mNodes[i]);
}
if (mLyt.getLayout()->GetGroupContainer() != nullptr) {
nw4r::lyt::Group *g = mLyt.getLayout()->GetGroupContainer()->FindGroupByName(sGroupName);
if (g != nullptr) {
d2d::dSubPane::linkMeters(g, &mSubpaneList);
}
}
for (int i = 0; i < field_0x6854; i++) {
mNodes[i].mpPane->SetVisible(false);
}
}
void dLytDepositStock_c::loadItems(s32 hiddenSlot) {
s32 slot = mItemPage * NUM_ICONS_PER_PAGE;
field_0x6854 = 0;
field_0x684E = false;
for (int i = 0; i < NUM_ICONS_PER_PAGE; i++) {
mIcons[i].reset();
mItemIds[i] = getDepositItemForSlot(slot);
f32 f = 0.0f;
if (mItemIds[i] != LYT_CMN_PouchBlank4 && slot != hiddenSlot) {
f = 1.0f;
}
loadIcon(i);
mIcons[i].setVisible(false);
if (slot == hiddenSlot) {
mNodes[i].mpPane->SetVisible(false);
} else {
mNodes[i].mpPane->SetVisible(true);
}
mAnm[i + DEPOSIT_STOCK_ANIM_HAVE_BOX_OFFSET].setAnimEnable(true);
mAnm[i + DEPOSIT_STOCK_ANIM_HAVE_BOX_OFFSET].setFrame(f);
mLyt.calc();
mAnm[i + DEPOSIT_STOCK_ANIM_HAVE_BOX_OFFSET].setAnimEnable(false);
slot++;
field_0x6854++;
}
}
void dLytDepositStock_c::loadIcon(s32 idx) {
s32 slot = idx + mItemPage * NUM_ICONS_PER_PAGE;
s32 number = getDepositItemAmount(slot);
mIcons[idx].setUnk(false);
if (number < 0) {
mIcons[idx].setHasNumber(false);
} else {
mIcons[idx].setHasNumber(true);
mIcons[idx].setNumber(number);
}
mIcons[idx].setItem(mItemIds[idx]);
u8 color = getDepositItemNumberColor(slot);
if (color != 3) {
mIcons[idx].setNumberColor(color);
}
f32 durability = getDepositShieldDurability(slot);
if (durability >= 0.0f) {
mIcons[idx].setShieldDurability(durability);
}
}
void dLytDepositStock_c::nextPage(bool unk) {
mItemPage++;
if (mItemPage >= NUM_PAGES) {
mItemPage = 0;
}
field_0x684B = unk;
}
void dLytDepositStock_c::prevPage(bool unk) {
if (mItemPage != 0) {
mItemPage--;
} else {
mItemPage = NUM_PAGES - 1;
}
field_0x684B = unk;
}
void dLytDepositStock_c::fn_80156530(bool unk) {
for (int i = 0; i < NUM_ICONS_PER_PAGE; i++) {
mIcons[i].setVisible(unk);
}
if (!field_0x684B) {
if (mCurrentNavTarget >= 0) {
mAnm[mCurrentNavTarget + DEPOSIT_STOCK_ANIM_FLASH_OFFSET].setAnimEnable(true);
mSelectedItemId = -1;
}
mCurrentNavTarget = -10;
}
field_0x684B = false;
field_0x6845 = false;
field_0x6846 = false;
if (!field_0x6847) {
// okay
field_0x6847 = false;
}
field_0x6848 = false;
if (mArrowDirection >= ARROW_NONE) {
handleSpecialNavMode();
}
}
void dLytDepositStock_c::handleNavOrPoint() {
bool selectIcon = false;
s32 nextTarget = 0;
if (dPadNav::isPointerVisible()) {
for (nextTarget = 0; nextTarget < NUM_ICONS_PER_PAGE; nextTarget++) {
if (mIcons[nextTarget].isCursorOver()) {
selectIcon = true;
saveArrowDirection();
break;
}
}
} else {
s32 dir = checkNav();
if (!isNavModeItem()) {
handleSpecialNavMode();
} else if (!field_0x6845 && !field_0x6846 && !field_0x6847 && !field_0x6848 && mSavedArrowDirection >= 2) {
s32 target = mCurrentNavTarget;
if (target < 0 || field_0x684C) {
if (dir != dPadNav::FS_STICK_NONE || dCsBase_c::GetInstance()->isCursorStickVisible()) {
if (target < 0) {
target += NUM_ICONS_PER_PAGE;
}
selectIcon = true;
nextTarget = target;
}
} else {
switch (dir) {
case dPadNav::FS_STICK_UP:
if (target < 6) {
navigateToPouch();
} else {
nextTarget = target - 6;
selectIcon = true;
}
break;
case dPadNav::FS_STICK_UP_RIGHT:
nextTarget = target - 5;
selectIcon = true;
break;
case dPadNav::FS_STICK_RIGHT:
if (target % 6 == 5) {
navigateToArrow(ARROW_RIGHT);
saveArrowDirection();
dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0);
} else {
nextTarget = target + 1;
selectIcon = true;
}
break;
case dPadNav::FS_STICK_DOWN_RIGHT:
nextTarget = target + 7;
selectIcon = true;
break;
case dPadNav::FS_STICK_DOWN:
if (target >= 10) {
navigateToSort();
} else if (target >= 6 && target <= 7) {
navigateToSell();
} else {
nextTarget = target + 6;
selectIcon = true;
}
break;
case dPadNav::FS_STICK_DOWN_LEFT:
nextTarget = target + 5;
selectIcon = true;
break;
case dPadNav::FS_STICK_LEFT:
if (target % 6 == 0) {
navigateToArrow(ARROW_LEFT);
saveArrowDirection();
dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0);
} else {
nextTarget = target - 1;
selectIcon = true;
}
break;
case dPadNav::FS_STICK_UP_LEFT:
nextTarget = target - 7;
selectIcon = true;
break;
default:
nextTarget = target;
selectIcon = true;
break;
}
}
}
}
if (selectIcon) {
mSavedArrowDirection = ARROW_NONE;
if (mCurrentNavTarget != nextTarget) {
if (mCurrentNavTarget >= 0) {
mIcons[mCurrentNavTarget].setOff();
mAnm[mCurrentNavTarget + DEPOSIT_STOCK_ANIM_FLASH_OFFSET].setAnimEnable(true);
}
if (mItemIds[nextTarget] != LYT_CMN_PouchBlank4 &&
mItemIds[nextTarget] != LYT_CMN_PouchPotionHealthPlusPlusHalf) {
mIcons[nextTarget].setOn();
mSelectedItemId = FileManager::sInstance->getItemCheckItem(nextTarget + mItemPage * NUM_ICONS_PER_PAGE);
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_POINT_ITEM);
} else {
mSelectedItemId = -1;
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_POINT_EMPTY);
}
s32 anmIdx = nextTarget + DEPOSIT_STOCK_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);
mCurrentNavTarget = nextTarget;
field_0x6846 = false;
field_0x6847 = false;
field_0x6848 = false;
navigateToItem();
}
mNavMode = 0;
} else {
navigateOffIcon();
}
}
void dLytDepositStock_c::navigateOffIcon() {
if (mCurrentNavTarget >= 0) {
// TODO why LYT_CMN_PouchPotionHealthPlusPlusHalf
if (mItemIds[mCurrentNavTarget] != LYT_CMN_PouchBlank4 &&
mItemIds[mCurrentNavTarget] != LYT_CMN_PouchPotionHealthPlusPlusHalf) {
mIcons[mCurrentNavTarget].setOff();
mSelectedItemId = -1;
}
mAnm[mCurrentNavTarget + DEPOSIT_STOCK_ANIM_FLASH_OFFSET].setAnimEnable(true);
mCurrentNavTarget -= NUM_ICONS_PER_PAGE;
}
}
s32 dLytDepositStock_c::checkNav() {
// Note: Navigating UP when in the first row means switching from stock to pouch
s32 target = mCurrentNavTarget;
s32 direction = dPadNav::getFSStickNavDirection();
if (target >= 0) {
switch (direction) {
case dPadNav::FS_STICK_UP_RIGHT:
if (target == 11) {
direction = dPadNav::FS_STICK_UP;
} else if (target < 6) {
if (target < 4) {
direction = dPadNav::FS_STICK_UP;
} else if (target == 5) {
direction = dPadNav::FS_STICK_NONE;
} else {
direction = dPadNav::FS_STICK_RIGHT;
}
}
break;
case dPadNav::FS_STICK_DOWN_RIGHT:
if (target == 5) {
direction = dPadNav::FS_STICK_DOWN;
} else if (target >= 6) {
if (target >= 10) {
if (field_0x684A) {
if (target == 11) {
direction = dPadNav::FS_STICK_NONE;
} else {
direction = dPadNav::FS_STICK_RIGHT;
}
} else {
direction = dPadNav::FS_STICK_DOWN;
}
} else {
direction = dPadNav::FS_STICK_RIGHT;
}
}
break;
case dPadNav::FS_STICK_DOWN:
if (target >= 6) {
if (target < 8) {
if (field_0x6849) {
direction = dPadNav::FS_STICK_NONE;
}
} else if (target >= 10) {
if (field_0x684A) {
direction = dPadNav::FS_STICK_NONE;
}
} else {
direction = dPadNav::FS_STICK_NONE;
}
}
break;
case dPadNav::FS_STICK_DOWN_LEFT:
if (target == 0 || target == 11) {
if (target == 11 && field_0x684A) {
direction = dPadNav::FS_STICK_LEFT;
} else {
direction = dPadNav::FS_STICK_DOWN;
}
} else if (target >= 6) {
if (target <= 7) {
if (field_0x6849) {
if (target == 6) {
direction = dPadNav::FS_STICK_NONE;
} else {
direction = dPadNav::FS_STICK_LEFT;
}
} else {
direction = dPadNav::FS_STICK_DOWN;
}
} else if (target == 11) {
if (field_0x684A) {
direction = dPadNav::FS_STICK_NONE;
} else {
direction = dPadNav::FS_STICK_DOWN;
}
} else {
direction = dPadNav::FS_STICK_LEFT;
}
}
break;
case dPadNav::FS_STICK_UP_LEFT:
if (target == 6) {
direction = dPadNav::FS_STICK_UP;
} else if (target < 6) {
if (target == 0) {
direction = dPadNav::FS_STICK_NONE;
} else if (target == 1) {
direction = dPadNav::FS_STICK_LEFT;
} else {
direction = dPadNav::FS_STICK_UP;
}
}
break;
}
}
return direction;
}
s32 dLytDepositStock_c::getCurrentSlot() const {
return mCurrentNavTarget + mItemPage * NUM_ICONS_PER_PAGE;
}
void dLytDepositStock_c::setItem(s32 idx, s32 item) {
mItemIds[idx] = item;
realizeItem(idx);
mIcons[idx].setOn();
field_0x684E = false;
}
void dLytDepositStock_c::realizeItem(s32 idx) {
f32 frame = 0.0f;
if (mItemIds[idx] != LYT_CMN_PouchBlank4) {
frame = 1.0f;
}
loadIcon(idx);
mIcons[idx].setVisible(true);
s32 anmIdx = idx + DEPOSIT_STOCK_ANIM_HAVE_BOX_OFFSET;
mAnm[anmIdx].setAnimEnable(true);
mAnm[anmIdx].setFrame(frame);
mLyt.calc();
mAnm[anmIdx].setAnimEnable(false);
}
void dLytDepositStock_c::selectNavTarget(s32 idx) {
if (idx < NUM_ICONS_PER_PAGE) {
if (mCurrentNavTarget >= 0) {
mAnm[mCurrentNavTarget + DEPOSIT_STOCK_ANIM_FLASH_OFFSET].setAnimEnable(true);
}
mCurrentNavTarget = idx;
if (mCurrentNavTarget >= 0) {
mAnm[mCurrentNavTarget + DEPOSIT_STOCK_ANIM_FLASH_OFFSET].setAnimEnable(true);
mAnm[mCurrentNavTarget + DEPOSIT_STOCK_ANIM_FLASH_OFFSET].setFrame(0.0f);
mLyt.calc();
mAnm[mCurrentNavTarget + DEPOSIT_STOCK_ANIM_FLASH_OFFSET].setAnimEnable(false);
dRumble_c::start(dRumble_c::sRumblePreset1, dRumble_c::FLAG_SLOT0);
}
}
}
void dLytDepositStock_c::pickUpItem(s32 slot, bool unk) {
s32 page = slot / NUM_ICONS_PER_PAGE;
s32 idx = slot % NUM_ICONS_PER_PAGE;
if (unk) {
mNodes[idx].mpPane->SetVisible(unk);
}
if (mItemPage != page) {
if (unk) {
field_0x684E = false;
}
} else {
s32 item = mItemIds[idx];
f32 frame;
if (unk) {
// 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;
mIcons[idx].setItem(mItemIds[otherIdx]);
field_0x684E = false;
}
} else {
frame = 0.0f;
}
field_0x685C = -1;
} else {
field_0x685C = slot;
frame = 0.0f;
field_0x684E = true;
mIcons[idx].setOff();
mIcons[idx].setHasNumber(false);
mIcons[idx].setItem(LYT_CMN_PouchBlank4);
}
s32 anmIdx = idx + DEPOSIT_STOCK_ANIM_HAVE_BOX_OFFSET;
mAnm[anmIdx].setAnimEnable(true);
mAnm[anmIdx].setFrame(frame);
mLyt.calc();
mAnm[anmIdx].setAnimEnable(false);
}
}
void dLytDepositStock_c::navigateToPouch() {
field_0x6845 = true;
mSavedArrowDirection = ARROW_NONE;
}
void dLytDepositStock_c::navigateToSell() {
if (!field_0x6846) {
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_POINT_SELL);
}
field_0x6846 = true;
mNavMode = NAV_SELL;
mSavedArrowDirection = ARROW_NONE;
}
void dLytDepositStock_c::navigateToSort() {
if (!field_0x6847) {
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_STOCK_POINT_TRIM);
}
field_0x6847 = true;
mNavMode = NAV_SORT;
mSavedArrowDirection = ARROW_NONE;
}
void dLytDepositStock_c::navigateToFinish() {
if (!field_0x6848) {
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SHOP_STK_POINT_DECIDE);
}
field_0x6848 = true;
mNavMode = NAV_FINISH;
mSavedArrowDirection = ARROW_NONE;
}
void dLytDepositStock_c::saveArrowDirection() {
mSavedArrowDirection = mArrowDirection;
}
void dLytDepositStock_c::navigateToArrow(s32 arrowDirection) {
mArrowDirection = arrowDirection;
if (mArrowDirection < ARROW_NONE) {
mNavMode = NAV_ARROW;
}
}
s32 dLytDepositStock_c::restoreArrowDirection() {
if (mSavedArrowDirection < ARROW_NONE && mArrowDirection >= ARROW_NONE) {
navigateToArrow(mSavedArrowDirection);
}
return mArrowDirection;
}
void dLytDepositStock_c::navigateToItem() {
mNavMode = NAV_ITEM;
}
void dLytDepositStock_c::handleSpecialNavMode() {
switch (mNavMode) {
case NAV_SELL: navigateToSell(); break;
case NAV_SORT: navigateToSort(); break;
case NAV_FINISH: navigateToFinish(); break;
case NAV_ARROW:
if (mArrowDirection < ARROW_NONE) {
saveArrowDirection();
}
break;
}
}
bool dLytDepositStock_c::isNavModeItem() const {
return mNavMode == NAV_ITEM;
}
+3 -1
View File
@@ -1252,6 +1252,7 @@ void dLytPauseDisp00_c::setupInventoryWheel() {
}
u32 item = getPouchItemForSlot(i, true);
// TODO why LYT_CMN_PouchPotionHealthPlusPlusHalf
if (item != LYT_CMN_PouchPotionHealthPlusPlusHalf) {
if (isPouchBocoburinLocked()) {
icon->setBocoburinLocked(true);
@@ -1259,7 +1260,7 @@ void dLytPauseDisp00_c::setupInventoryWheel() {
}
haveFrame = 1.0f;
icon->setItem(item);
f32 durability = getShieldDurability(i, true);
f32 durability = getPouchShieldDurability(i, true);
if (durability >= 0.0f) {
icon->setShieldDurability(durability);
}
@@ -1575,6 +1576,7 @@ void dLytPauseDisp00_c::setupRingIcons(s32 tab) {
s32 offset = PAUSE_DISP_00_BOUNDING_RING_OFFSET;
for (int i = 0; i < PAUSE_DISP_00_ICONS_NUM_ITEMS_ON_WHEEL; i++) {
bool visible = false;
// TODO why LYT_CMN_PouchPotionHealthPlusPlusHalf
if (getPouchItemForSlot(i, true) != LYT_CMN_PouchPotionHealthPlusPlusHalf) {
visible = true;
}
+5 -5
View File
@@ -339,8 +339,8 @@ void dLytMeterMinusBtn_c::initializeState_MenuSelectingIn() {
mItemIcons[i].setItem(field_0x4E98[i]);
}
if (getShieldDurability(i, true) >= 0.0f) {
mItemIcons[i].setShieldDurability(getShieldDurability(i, true));
if (getPouchShieldDurability(i, true) >= 0.0f) {
mItemIcons[i].setShieldDurability(getPouchShieldDurability(i, true));
if (i == convertFilePouchSlot(FileManager::GetInstance()->getShieldPouchSlot())) {
mItemIcons[i].setShieldOnOff(false);
} else {
@@ -574,8 +574,8 @@ void dLytMeterMinusBtn_c::initializeState_DemoMove() {
mItemIcons[i].setItem(field_0x4E98[i]);
}
if (getShieldDurability(i, true) >= 0.0f) {
mItemIcons[i].setShieldDurability(getShieldDurability(i, true));
if (getPouchShieldDurability(i, true) >= 0.0f) {
mItemIcons[i].setShieldDurability(getPouchShieldDurability(i, true));
if (i == convertFilePouchSlot(FileManager::GetInstance()->getShieldPouchSlot())) {
mItemIcons[i].setShieldOnOff(false);
} else {
@@ -1086,7 +1086,7 @@ void dLytMeterMinusBtn_c::setItemText(s32 item) {
void dLytMeterMinusBtn_c::realizeShieldDurability() {
for (int i = 0; i < MINUS_BTN_NUM_ITEMS; i++) {
if (field_0x4EBB[i] != 0) {
mItemIcons[i].setShieldDurability(getShieldDurability(i, true));
mItemIcons[i].setShieldDurability(getPouchShieldDurability(i, true));
}
}
}