diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/d/a/d_a_item.h | 1 | ||||
| -rw-r--r-- | include/d/lyt/d_lyt_common_icon_item_maps.h | 6 | ||||
| -rw-r--r-- | include/d/lyt/d_lyt_common_icon_material.h | 5 | ||||
| -rw-r--r-- | include/d/lyt/d_lyt_deposit.h | 3 | ||||
| -rw-r--r-- | include/d/lyt/d_lyt_shop.h | 162 | ||||
| -rw-r--r-- | include/d/lyt/d_lyt_util_items.h | 6 |
6 files changed, 176 insertions, 7 deletions
diff --git a/include/d/a/d_a_item.h b/include/d/a/d_a_item.h index b08a0fa7..24fcd785 100644 --- a/include/d/a/d_a_item.h +++ b/include/d/a/d_a_item.h @@ -48,6 +48,7 @@ public: static void spawnDrop(u16 item, u32 room, const mVec3_c &pos, const mAng3_c &rot); static void giveItem22(ITEM_ID, s32, s32); static void giveItem(ITEM_ID, s32, s32); + // TODO should these be u16? static u32 checkFlag(u32 flag); static bool hasItem(u32 flag) { return checkFlag(flag); diff --git a/include/d/lyt/d_lyt_common_icon_item_maps.h b/include/d/lyt/d_lyt_common_icon_item_maps.h index 248ada9c..53f3f73d 100644 --- a/include/d/lyt/d_lyt_common_icon_item_maps.h +++ b/include/d/lyt/d_lyt_common_icon_item_maps.h @@ -55,7 +55,7 @@ #define LYT_CMN_ItemInvalid (18) // ------------------------- // Pouch Items -#define LYT_CMN_PouchPotionHealyh (0) // [12] uc_bottleKusuriA_00.tpl +#define LYT_CMN_PouchPotionHealth (0) // [12] uc_bottleKusuriA_00.tpl #define LYT_CMN_PouchBottle (1) // [ 5] uc_bottleEmpty_00.tpl #define LYT_CMN_PouchShieldWoodA (2) // [39] uc_shieldWoodA_00.tpl #define LYT_CMN_PouchShieldIronA (3) // [36] uc_shieldIronA_00.tpl @@ -68,8 +68,8 @@ #define LYT_CMN_PouchPotionAirPlus (10) // [ 4] uc_bottleAirB_00.tpl #define LYT_CMN_PouchPotionStaminaPlus (11) // [ 8] uc_bottleGutsB_00.tpl #define LYT_CMN_PouchBlank4 (12) // [ 0] tr_black4_00.tpl -#define LYT_CMN_PouchPotionGaurdian (13) // [16] uc_bottleMutekiA_00.tpl -#define LYT_CMN_PouchPotionGaurdianPlus (14) // [17] uc_bottleMutekiB_00.tpl +#define LYT_CMN_PouchPotionGuardian (13) // [16] uc_bottleMutekiA_00.tpl +#define LYT_CMN_PouchPotionGuardianPlus (14) // [17] uc_bottleMutekiB_00.tpl #define LYT_CMN_PouchShieldWoodB (15) // [40] uc_shieldWoodB_00.tpl #define LYT_CMN_PouchShieldWoodC (16) // [41] uc_shieldWoodC_00.tpl #define LYT_CMN_PouchShieldIronB (17) // [37] uc_shieldIronB_00.tpl diff --git a/include/d/lyt/d_lyt_common_icon_material.h b/include/d/lyt/d_lyt_common_icon_material.h index 8febea8a..4b87781c 100644 --- a/include/d/lyt/d_lyt_common_icon_material.h +++ b/include/d/lyt/d_lyt_common_icon_material.h @@ -132,6 +132,11 @@ private: class dLytCommonIconMaterial_c : public d2d::dSubPane { public: + enum Variant_e { + BUG, + TREASURE, + }; + dLytCommonIconMaterial_c() : mStateMgr(*this, sStateID::null), mPart(2) {} ~dLytCommonIconMaterial_c() {} diff --git a/include/d/lyt/d_lyt_deposit.h b/include/d/lyt/d_lyt_deposit.h index 22689646..082750b9 100644 --- a/include/d/lyt/d_lyt_deposit.h +++ b/include/d/lyt/d_lyt_deposit.h @@ -139,8 +139,6 @@ private: STATE_FUNC_DECLARE(dLytDepositMain_c, ModeArrangementOut); STATE_FUNC_DECLARE(dLytDepositMain_c, ModeOut); - STATE_MGR_DEFINE_UTIL_CHANGESTATE(dLytDepositMain_c); - /* 0x00004 */ UI_STATE_MGR_DECLARE(dLytDepositMain_c); /* 0x00040 */ d2d::LytBase_c mLyt; /* 0x000D0 */ d2d::AnmGroup_c mAnm[36]; @@ -227,7 +225,6 @@ private: STATE_FUNC_DECLARE(dLytDeposit_c, Out); STATE_MGR_DEFINE_UTIL_ISSTATE(dLytDeposit_c); - STATE_MGR_DEFINE_UTIL_CHANGESTATE(dLytDeposit_c); /* 0x0008C */ UI_STATE_MGR_DECLARE(dLytDeposit_c); /* 0x000C8 */ d2d::ResAccIf_c mResAcc; diff --git a/include/d/lyt/d_lyt_shop.h b/include/d/lyt/d_lyt_shop.h index 74b38903..e84b96ab 100644 --- a/include/d/lyt/d_lyt_shop.h +++ b/include/d/lyt/d_lyt_shop.h @@ -1,14 +1,174 @@ #ifndef D_LYT_SHOP_H #define D_LYT_SHOP_H -class dLytShop_c { +#include "d/d_cursor_hit_check.h" +#include "d/d_pad_nav.h" +#include "d/lyt/d2d.h" +#include "d/lyt/d_lyt_base.h" +#include "d/lyt/d_lyt_common_icon_item.h" +#include "d/lyt/d_lyt_common_icon_material.h" +#include "nw4r/lyt/lyt_bounding.h" +#include "s/s_State.hpp" + +class dLytShopMain_c { +public: + enum Service_e { + SERVICE_POTION_INFUSE, + SERVICE_GEAR_UPGRADE, + SERVICE_SHIELD_REPAIR, + }; + +private: + enum Phase_e { + PHASE_SELECT_ITEM, + PHASE_MATERIAL_CHECK, + }; + public: + dLytShopMain_c(); + virtual ~dLytShopMain_c() { + dPadNav::setNavEnabled(false, false); + } + + bool build(d2d::ResAccIf_c *resAcc); + bool execute(); + bool draw(); + bool remove(); + + bool isIdle() const { + return mIsIdle; + } + + s32 getService() const { + return mService; + } + + bool getField_0x116DD() const { + return field_0x116DD; + } + + bool getField_0x116DE() const { + return field_0x116DE; + } + + void retry() { + mIsIdle = false; + } + + void setModeNone(); + void setModeSelectIn(); + void setModeSelectCheck(); + void setModeSelectOut(); + void setModeOutIn(); + void setModeMaterialCheck(); + void setModeOut(); + void setModeInOut(); + +private: + static const s32 NUM_ITEMS = 12; + + void buildSubpanes(); + void handleNavigation(); + s32 checkNav(); + void buildMaterialCheckIcons(d2d::ResAccIf_c *resAcc, u8 variant); + + void addItemToDisplayed(s32 itemIdx, s32 itemKind, s32 pouchSlot); + void updateShopStuffMaybe(); + void prepareRemodelStoreStuff(s32 service); + void showShopLytMaybe(); + void showPriceMaybe(s32 value); + + s32 getItemTier(s32 item); + s32 calcNumDigits(s32 value); + + void fn_802A5CA0(bool); + void fn_802A5BD0(); + s32 fn_802A4490(s32); + s32 fn_802A4500(s32); + s32 fn_802A5760(u8); + s32 fn_802A5780(u8); + + STATE_FUNC_DECLARE(dLytShopMain_c, ModeNone); + STATE_FUNC_DECLARE(dLytShopMain_c, ModeSelectIn); + STATE_FUNC_DECLARE(dLytShopMain_c, ModeSelectCheck); + STATE_FUNC_DECLARE(dLytShopMain_c, ModeSelectOut); + STATE_FUNC_DECLARE(dLytShopMain_c, ModeOutIn); + STATE_FUNC_DECLARE(dLytShopMain_c, ModeMaterialCheck); + STATE_FUNC_DECLARE(dLytShopMain_c, ModeOut); + STATE_FUNC_DECLARE(dLytShopMain_c, ModeInOut); + + /* 0x00004 */ UI_STATE_MGR_DECLARE(dLytShopMain_c); + /* 0x00040 */ d2d::LytBase_c mLyts[3]; + /* 0x001F0 */ d2d::AnmGroup_c mAnmItemSelect[9]; + /* 0x00430 */ d2d::AnmGroup_c mAnmMaterialCheck[18]; + /* 0x008B0 */ d2d::AnmGroup_c mAnmShopInfo[2]; + /* 0x00930 */ nw4r::lyt::Bounding *mpItemBoundings[13]; + /* 0x00964 */ nw4r::lyt::Bounding *mpMaterialCheckChoiceBoundings[2]; + /* 0x0096C */ dCursorHitCheckLyt_c mCsHitChecks[3]; + /* 0x009E4 */ dLytCommonIconItem_c mBWheelOrPouchItemIcons[24]; + /* 0x0CAA4 */ dLytCommonIconItem_c mUpgradePreviewIcons[4]; + /* 0x0EAC4 */ dLytCommonIconMaterial_c mUpgradeCostIcons[8]; + /* 0x11484 */ d2d::SubPaneList mItemList; + /* 0x11490 */ d2d::SubPaneListNode mBWheelOrPouchNodes[24]; + /* 0x11610 */ d2d::SubPaneList mUpgradeList; + /* 0x1161C */ d2d::SubPaneListNode mUpgradeNodes[12]; + /* 0x116DC */ bool mIsIdle; + /* 0x116DD */ bool field_0x116DD; + /* 0x116DE */ bool field_0x116DE; + /* 0x116DF */ bool mUpgradeLoaded; + /* 0x116E0 */ bool mPrevPointerVisible; + /* 0x116E1 */ bool field_0x116E1; + /* 0x116E4 */ s32 mPhase; + /* 0x116E8 */ s32 mCurrentNavTarget; + /* 0x116EC */ s32 mStateStep; + /* 0x116F0 */ s32 mUpgradeIdx; + /* 0x116F4 */ s32 mService; + /* 0x116F8 */ s32 mItemCount; + /* 0x116FC */ s32 mUpgradeCostCount; + /* 0x11700 */ UNKWORD field_0x11700; + /* 0x11704 */ s32 mItemUpgradeIdxes[NUM_ITEMS]; + /* 0x11734 */ s32 mItemPouchSlots[NUM_ITEMS]; + /* 0x11764 */ u8 mItemKinds[NUM_ITEMS]; + /* 0x11770 */ u8 field_0x11770[8]; +}; + +class dLytShop_c : public dLytBase_c { +public: + dLytShop_c() : mStateMgr(*this) {} + virtual ~dLytShop_c() { + removeLyt(); + } + static dLytShop_c *GetInstance() { return sInstance; } + virtual bool build() override; + virtual int create() override; + virtual int execute() override; + virtual int draw() override; + virtual int doDelete() override; + private: static dLytShop_c *sInstance; + + STATE_FUNC_DECLARE(dLytShop_c, None); + STATE_FUNC_DECLARE(dLytShop_c, SelectIn); + STATE_FUNC_DECLARE(dLytShop_c, SelectCheck); + STATE_FUNC_DECLARE(dLytShop_c, SelectOut); + STATE_FUNC_DECLARE(dLytShop_c, OutIn); + STATE_FUNC_DECLARE(dLytShop_c, MaterialCheck); + STATE_FUNC_DECLARE(dLytShop_c, Out); + STATE_FUNC_DECLARE(dLytShop_c, InOut); + STATE_FUNC_DECLARE(dLytShop_c, End); + + STATE_MGR_DEFINE_UTIL_ISSTATE(dLytShop_c); + + /* 0x0008C */ UI_STATE_MGR_DECLARE(dLytShop_c); + /* 0x000C8 */ d2d::ResAccIf_c mResAcc; + /* 0x00438 */ dLytShopMain_c mMain; + /* 0x11BB0 */ bool mInRequest; + /* 0x11BB1 */ bool mIsMovingOut; }; #endif diff --git a/include/d/lyt/d_lyt_util_items.h b/include/d/lyt/d_lyt_util_items.h index d6bf4819..00ea2d3e 100644 --- a/include/d/lyt/d_lyt_util_items.h +++ b/include/d/lyt/d_lyt_util_items.h @@ -63,6 +63,7 @@ void getCaptionItemLabel(s32 itemId, SizedString<32> &buf); void getDowsingLabel(s32 itemId, SizedString<32> &buf); void getPauseCategoryLabel(s32 itemId, SizedString<32> &buf); +// TODO these could be u16 const wchar_t *getItemText(s32 itemId); const wchar_t *getCaptionItemText(s32 itemId); const wchar_t *getDowsingText(s32 itemId); @@ -76,8 +77,13 @@ u8 getPouchItemForSlot(s32 slot, bool unk); bool hasPouchSlot(s32 slot, bool unk); s32 getPouchItemAmount(s32 slot, bool unk); u8 getPouchItemNumberColor(s32 slot, bool unk); +// not sure about this one f32 getPouchShieldDurability(s32 slot, bool unk); u32 getPouchItemIdForIndex(s32 slot, bool unk); +// not sure about this one +f32 getPouchShieldDurability2(s32 slot, bool unk); +// not sure about this one +s32 getEvenMoreShieldStuff(s32 slot, bool unk); u8 getDepositItemForSlot(s32 slot); s32 getDepositItemAmount(s32 slot); |
