mirror of
https://github.com/zeldaret/ss
synced 2026-07-11 06:45:20 -04:00
d_lyt_common_icon_item OK
This commit is contained in:
+26
-12
@@ -168,6 +168,9 @@ public:
|
||||
u8 field_0x05;
|
||||
};
|
||||
|
||||
#define ANMGROUP_FLAG_BOUND 1
|
||||
#define ANMGROUP_FLAG_ENABLE 2
|
||||
|
||||
struct AnmGroupBase_c {
|
||||
AnmGroupBase_c(m2d::FrameCtrl_c *frameCtrl) : field_0x04(nullptr), mFlags(0), mpFrameCtrl(frameCtrl) {}
|
||||
virtual ~AnmGroupBase_c() {}
|
||||
@@ -201,6 +204,11 @@ struct AnmGroupBase_c {
|
||||
syncAnmFrame();
|
||||
}
|
||||
|
||||
inline void setFrameRatio(f32 frame) {
|
||||
f32 end = getEndFrameRaw() - 1.0f;
|
||||
setFrame(end * frame);
|
||||
}
|
||||
|
||||
inline f32 getEndFrameRaw() const {
|
||||
return mpFrameCtrl->getEndFrameRaw();
|
||||
}
|
||||
@@ -209,11 +217,6 @@ struct AnmGroupBase_c {
|
||||
return mpFrameCtrl->getFrame();
|
||||
}
|
||||
|
||||
inline void setToStart() {
|
||||
mpFrameCtrl->setToStart();
|
||||
syncAnmFrame();
|
||||
}
|
||||
|
||||
inline void setToEnd() {
|
||||
mpFrameCtrl->setToEnd();
|
||||
syncAnmFrame();
|
||||
@@ -225,11 +228,10 @@ struct AnmGroupBase_c {
|
||||
|
||||
inline void setRate(f32 rate) {
|
||||
mpFrameCtrl->setRate(rate);
|
||||
setAnimEnable(true);
|
||||
}
|
||||
|
||||
inline bool isFlag2() const {
|
||||
return (mFlags & 2) != 0;
|
||||
inline bool isEnabled() const {
|
||||
return (mFlags & ANMGROUP_FLAG_ENABLE) != 0;
|
||||
}
|
||||
|
||||
inline bool isStop() const {
|
||||
@@ -240,14 +242,26 @@ struct AnmGroupBase_c {
|
||||
return mpFrameCtrl->isStop2();
|
||||
}
|
||||
|
||||
inline void playBackwardsOnce() {
|
||||
inline void setBackwardsOnce() {
|
||||
mpFrameCtrl->setFlags(FLAG_NO_LOOP | FLAG_BACKWARDS);
|
||||
setToEnd2();
|
||||
}
|
||||
|
||||
inline void playLoop() {
|
||||
inline bool isPlayingBackwardsOnce() const {
|
||||
return mpFrameCtrl->getFlags() == (FLAG_NO_LOOP | FLAG_BACKWARDS);
|
||||
}
|
||||
|
||||
inline bool isPlayingForwardsOnce() const {
|
||||
return mpFrameCtrl->getFlags() == FLAG_NO_LOOP;
|
||||
}
|
||||
|
||||
inline void setForwardOnce() {
|
||||
mpFrameCtrl->setFlags(FLAG_NO_LOOP);
|
||||
setToEnd2();
|
||||
}
|
||||
|
||||
inline void setToStart() {
|
||||
m2d::FrameCtrl_c &ctrl = *mpFrameCtrl;
|
||||
ctrl.setCurrFrame(ctrl.getStartFrame());
|
||||
syncAnmFrame();
|
||||
}
|
||||
|
||||
inline void setToEnd2() {
|
||||
|
||||
@@ -1,76 +1,275 @@
|
||||
#ifndef D_LYT_COMMON_ICON_ITEM_H
|
||||
#define D_LYT_COMMON_ICON_ITEM_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_structd.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "nw4r/lyt/lyt_bounding.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "s/s_StateMgr.hpp"
|
||||
|
||||
class dLytCommonIconItemPart1_c {
|
||||
class dLytCommonIconItemPartBase_c {
|
||||
public:
|
||||
virtual ~dLytCommonIconItemPartBase_c() {}
|
||||
virtual nw4r::lyt::Pane *getPane() = 0;
|
||||
virtual d2d::LytBase_c *getLyt() = 0;
|
||||
virtual const char *getName() const = 0;
|
||||
};
|
||||
|
||||
/** B-Wheel item */
|
||||
class dLytCommonIconItemPart1_c : public dLytCommonIconItemPartBase_c {
|
||||
public:
|
||||
dLytCommonIconItemPart1_c()
|
||||
: field_0x2D4(0), field_0x2D5(0), field_0x2FC(0), field_0x2FD(0), field_0x2FE(0), field_0x2FF(0) {}
|
||||
: field_0x28C(0), mColor(0), field_0x2B4(false), mHasNumber(false), mSize(false), mBocoburinLocked(false) {}
|
||||
virtual ~dLytCommonIconItemPart1_c() {}
|
||||
d2d::dLytSub lyt;
|
||||
d2d::AnmGroup_c mAnm[7];
|
||||
u32 unk[0x3];
|
||||
d2d::dLytStructD structD;
|
||||
u8 field_0x2D4;
|
||||
u8 field_0x2D5;
|
||||
u8 field_0x2D6[0x2FC - 0x2D6];
|
||||
u8 field_0x2FC;
|
||||
u8 field_0x2FD;
|
||||
u8 field_0x2FE;
|
||||
u8 field_0x2FF;
|
||||
virtual nw4r::lyt::Pane *getPane() override {
|
||||
return mLyt.getLayout()->GetRootPane();
|
||||
}
|
||||
virtual d2d::LytBase_c *getLyt() override {
|
||||
return &mLyt;
|
||||
}
|
||||
virtual const char *getName() const override {
|
||||
return mLyt.getName();
|
||||
}
|
||||
|
||||
bool build(d2d::ResAccIf_c *resAcc);
|
||||
bool remove();
|
||||
bool execute();
|
||||
void reset();
|
||||
|
||||
bool isCursorOver() const;
|
||||
void setNumber(s32 number);
|
||||
void setVisible(bool visible);
|
||||
void setItem(u8 item);
|
||||
void setHasNumber(bool hasNumber) {
|
||||
mHasNumber = hasNumber;
|
||||
}
|
||||
void setUnk(bool unk) {
|
||||
field_0x2B4 = unk;
|
||||
}
|
||||
void setSize(bool size) {
|
||||
mSize = size;
|
||||
}
|
||||
void setBocoburinLocked(bool locked) {
|
||||
mBocoburinLocked = locked;
|
||||
}
|
||||
void setNumberColor(u8 color);
|
||||
void setOn();
|
||||
void setOff();
|
||||
void startDecide();
|
||||
bool isDoneDeciding() const;
|
||||
|
||||
private:
|
||||
void realizeUnk();
|
||||
void realizeNumber();
|
||||
void realizeSize();
|
||||
void realizeBocoburin();
|
||||
void realizeItem(u8 item);
|
||||
|
||||
/* 0x004 */ d2d::dLytSub mLyt;
|
||||
/* 0x098 */ d2d::AnmGroup_c mAnm[7];
|
||||
/* 0x258 */ dTextBox_c *mpTextBoxes[2];
|
||||
/* 0x260 */ nw4r::lyt::Bounding *mpBounding;
|
||||
/* 0x264 */ d2d::dLytStructD mStructD;
|
||||
/* 0x28C */ u8 field_0x28C;
|
||||
/* 0x28D */ u8 mColor;
|
||||
/* 0x28E */ u8 _0x28E[0x294 - 0x28E];
|
||||
/* 0x294 */ wchar_t mNumberBuf[16];
|
||||
/* 0x2B4 */ bool field_0x2B4;
|
||||
/* 0x2B5 */ bool mHasNumber;
|
||||
/* 0x2B6 */ bool mSize;
|
||||
/* 0x2B7 */ bool mBocoburinLocked;
|
||||
};
|
||||
|
||||
class dLytCommonIconItemPart2_c {
|
||||
/** Pouch item */
|
||||
class dLytCommonIconItemPart2_c : public dLytCommonIconItemPartBase_c {
|
||||
public:
|
||||
dLytCommonIconItemPart2_c()
|
||||
: field_0x64C(0), field_0x64D(0), field_0x674(0), field_0x675(0), field_0x676(0), field_0x677(0),
|
||||
field_0x678(1), field_0x67C(0.0f) {}
|
||||
: mItem(0),
|
||||
mColor(0),
|
||||
field_0x374(0),
|
||||
mHasNumber(false),
|
||||
mSize(false),
|
||||
mBocoburinLocked(false),
|
||||
mOnOff(true),
|
||||
mDurability(0.0f) {}
|
||||
virtual ~dLytCommonIconItemPart2_c() {}
|
||||
d2d::dLytSub lyt;
|
||||
d2d::AnmGroup_c mAnm[10];
|
||||
u32 unk[0x3];
|
||||
d2d::dLytStructD structD;
|
||||
u8 field_0x64C;
|
||||
u8 field_0x64D;
|
||||
u8 field_0x64E[0x674 - 0x64E];
|
||||
u8 field_0x674;
|
||||
u8 field_0x675;
|
||||
u8 field_0x676;
|
||||
u8 field_0x677;
|
||||
u8 field_0x678;
|
||||
f32 field_0x67C;
|
||||
virtual nw4r::lyt::Pane *getPane() override {
|
||||
return mLyt.getLayout()->GetRootPane();
|
||||
}
|
||||
virtual d2d::LytBase_c *getLyt() override {
|
||||
return &mLyt;
|
||||
}
|
||||
virtual const char *getName() const override {
|
||||
return mLyt.getName();
|
||||
}
|
||||
|
||||
bool build(d2d::ResAccIf_c *resAcc);
|
||||
bool remove();
|
||||
bool execute();
|
||||
void reset();
|
||||
|
||||
bool isCursorOver() const;
|
||||
void setNumber(s32 number);
|
||||
u8 getShieldType() const;
|
||||
void setVisible(bool visible);
|
||||
void setItem(u8 item);
|
||||
void setHasNumber(bool hasNumber) {
|
||||
mHasNumber = hasNumber;
|
||||
}
|
||||
void setUnk(bool unk) {
|
||||
field_0x374 = unk;
|
||||
}
|
||||
void setSize(bool size) {
|
||||
mSize = size;
|
||||
}
|
||||
void setBocoburinLocked(bool locked) {
|
||||
mBocoburinLocked = locked;
|
||||
}
|
||||
void setNumberColor(u8 color);
|
||||
void setOn();
|
||||
void setOff();
|
||||
void startDecide();
|
||||
bool isDoneDeciding() const;
|
||||
void setShieldOnOff(bool onOff);
|
||||
|
||||
void setDurability(f32 durability);
|
||||
|
||||
private:
|
||||
void realizeUnk();
|
||||
void realizeNumber();
|
||||
void realizeSize();
|
||||
void realizeBocoburin();
|
||||
void realizeItem(u8 item);
|
||||
void realizeShieldOnOff(bool onOff);
|
||||
void realizeShieldType(u8 type);
|
||||
|
||||
/* 0x004 */ d2d::dLytSub mLyt;
|
||||
/* 0x098 */ d2d::AnmGroup_c mAnm[10];
|
||||
/* 0x318 */ dTextBox_c *mpTextBoxes[2];
|
||||
/* 0x320 */ nw4r::lyt::Bounding *mpBounding;
|
||||
/* 0x324 */ d2d::dLytStructD structD;
|
||||
/* 0x34C */ u8 mItem;
|
||||
/* 0x34D */ u8 mColor;
|
||||
/* 0x350 */ u32 mNumber;
|
||||
/* 0x354 */ wchar_t mNumberBuf[16];
|
||||
/* 0x374 */ u8 field_0x374;
|
||||
/* 0x375 */ bool mHasNumber;
|
||||
/* 0x376 */ bool mSize;
|
||||
/* 0x377 */ bool mBocoburinLocked;
|
||||
/* 0x378 */ bool mOnOff;
|
||||
/* 0x37C */ f32 mDurability;
|
||||
};
|
||||
|
||||
class dLytCommonIconItemPart3_c {
|
||||
/** Dowsing "item" */
|
||||
class dLytCommonIconItemPart3_c : public dLytCommonIconItemPartBase_c {
|
||||
public:
|
||||
dLytCommonIconItemPart3_c() : field_0x804(0), field_0x805(0), field_0x806(0) {}
|
||||
dLytCommonIconItemPart3_c() : mItem(0), mSize(false), mBocoburinLocked(false) {}
|
||||
virtual ~dLytCommonIconItemPart3_c() {}
|
||||
d2d::dLytSub lyt;
|
||||
d2d::AnmGroup_c mAnm[3];
|
||||
u32 unk;
|
||||
virtual nw4r::lyt::Pane *getPane() override {
|
||||
return mLyt.getLayout()->GetRootPane();
|
||||
}
|
||||
virtual d2d::LytBase_c *getLyt() override {
|
||||
return &mLyt;
|
||||
}
|
||||
virtual const char *getName() const override {
|
||||
return mLyt.getName();
|
||||
}
|
||||
|
||||
bool build(d2d::ResAccIf_c *resAcc);
|
||||
bool remove();
|
||||
bool execute();
|
||||
void reset();
|
||||
|
||||
void setSize(bool size) {
|
||||
mSize = size;
|
||||
}
|
||||
void setBocoburinLocked(bool locked) {
|
||||
mBocoburinLocked = locked;
|
||||
}
|
||||
|
||||
bool isCursorOver() const;
|
||||
void setVisible(bool visible);
|
||||
void setItem(u8 item);
|
||||
|
||||
private:
|
||||
void realizeSize();
|
||||
void realizeBocoburin();
|
||||
void realizeItem(u8 item);
|
||||
|
||||
/* 0x004 */ d2d::dLytSub mLyt;
|
||||
/* 0x098 */ d2d::AnmGroup_c mAnm[3];
|
||||
/* 0x158 */ nw4r::lyt::Bounding *mpBounding;
|
||||
d2d::dLytStructD structD;
|
||||
u8 field_0x804;
|
||||
u8 field_0x805;
|
||||
u8 field_0x806;
|
||||
// TODO wrong names/offsets because these are relative to main class
|
||||
/* 0x184 */ u8 mItem;
|
||||
/* 0x185 */ bool mSize;
|
||||
/* 0x186 */ bool mBocoburinLocked;
|
||||
};
|
||||
|
||||
/**
|
||||
* A common item component used in various UI screens like the item check, scrap shop,
|
||||
* pause menu wheels, B item preview in the top right HUD corner.
|
||||
* NOT used for the HUD wheels.
|
||||
*/
|
||||
class dLytCommonIconItem_c : public d2d::dSubPane {
|
||||
public:
|
||||
dLytCommonIconItem_c() : mStateMgr(*this, sStateID::null), unk(3) {}
|
||||
dLytCommonIconItem_c() : mStateMgr(*this, sStateID::null), mPart(3) {}
|
||||
~dLytCommonIconItem_c() {}
|
||||
|
||||
virtual bool build(d2d::ResAccIf_c *resAcc) override;
|
||||
virtual bool remove() override;
|
||||
virtual bool execute() override;
|
||||
virtual nw4r::lyt::Pane *getPane() override;
|
||||
virtual d2d::LytBase_c *getLyt() override;
|
||||
virtual const char *getName() const override;
|
||||
virtual nw4r::lyt::Pane *getPane() override {
|
||||
switch (mPart) {
|
||||
case 0: return mPart1.getPane();
|
||||
case 1: return mPart2.getPane();
|
||||
case 2: return mPart3.getPane();
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
virtual d2d::LytBase_c *getLyt() override {
|
||||
switch (mPart) {
|
||||
case 0: return mPart1.getLyt();
|
||||
case 1: return mPart2.getLyt();
|
||||
case 2: return mPart3.getLyt();
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
virtual const char *getName() const override {
|
||||
switch (mPart) {
|
||||
case 0: return mPart1.getName();
|
||||
case 1: return mPart2.getName();
|
||||
case 2: return mPart3.getName();
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void init(void *, u8);
|
||||
bool build(d2d::ResAccIf_c *resAcc, u8 variant);
|
||||
|
||||
void reset();
|
||||
void setNumber(s32 number);
|
||||
bool isCursorOver() const;
|
||||
void setVisible(bool visible);
|
||||
void setUnk(bool unk);
|
||||
void setSize(bool size);
|
||||
void setBocoburinLocked(bool locked);
|
||||
void setHasNumber(bool hasNumber);
|
||||
void setItem(u8 item);
|
||||
/** 0 -> golden, 1 -> red, 2 -> green */
|
||||
void setNumberColor(u8 color);
|
||||
/** Increases item size, e.g. when hovering over item in Item Check */
|
||||
void setOn();
|
||||
/** Restores item size to normal */
|
||||
void setOff();
|
||||
|
||||
/** The "decide" animation in the scrap shop makes the selected item flash for a
|
||||
short time before showing the upgrade screen */
|
||||
void startDecide();
|
||||
bool isDoneDeciding() const;
|
||||
|
||||
void setShieldOnOff(bool onOff);
|
||||
void setShieldDurability(f32 durability);
|
||||
|
||||
private:
|
||||
STATE_FUNC_DECLARE(dLytCommonIconItem_c, None);
|
||||
@@ -78,11 +277,11 @@ private:
|
||||
STATE_FUNC_DECLARE(dLytCommonIconItem_c, Wait);
|
||||
STATE_FUNC_DECLARE(dLytCommonIconItem_c, Out);
|
||||
|
||||
UI_STATE_MGR_DECLARE(dLytCommonIconItem_c);
|
||||
u8 unk;
|
||||
dLytCommonIconItemPart1_c part1;
|
||||
dLytCommonIconItemPart2_c part2;
|
||||
dLytCommonIconItemPart3_c part3;
|
||||
/* 0x008 */ UI_STATE_MGR_DECLARE(dLytCommonIconItem_c);
|
||||
/* 0x044 */ u8 mPart;
|
||||
/* 0x048 */ dLytCommonIconItemPart1_c mPart1;
|
||||
/* 0x300 */ dLytCommonIconItemPart2_c mPart2;
|
||||
/* 0x680 */ dLytCommonIconItemPart3_c mPart3;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -58,6 +58,18 @@ struct dLytStructDInArray {
|
||||
u16 field_0x0E;
|
||||
};
|
||||
|
||||
/**
|
||||
* This whole file setup is from the days where I had no idea how this game's UI code works
|
||||
* and I simply started naming the structs that appeared "StructA" and so on.
|
||||
*
|
||||
* The classes in this file are related to cursor pointing. UI code will generally
|
||||
* contain one or more "dLytStructD", give it an nw4r::lyt::Pane, register it in the
|
||||
* "dLytStructDList", and then ask the dCsBase_c which "dLytStructD" it's pointing at
|
||||
* to compare it to the own "dLytStructD".
|
||||
*
|
||||
* There's a base class! dLytStructD will report its type as 'lyt ' but there also
|
||||
* is a 'cc ' type used by the dStageMgr_c. d2d may not be a good namespace here!
|
||||
*/
|
||||
struct dLytStructD : dLytStructD_Base {
|
||||
dLytStructD()
|
||||
: field_0x18(0), field_0x1C(nullptr), field_0x20(0), field_0x22(0), field_0x23(0), field_0x24(nullptr) {}
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
// TODO
|
||||
}
|
||||
|
||||
void fn_800AF930(const wchar_t *);
|
||||
|
||||
// @bug: This does not implement UT's RTTI, so casts to dTextBox_c will
|
||||
// succeed even if all you have is a lyt::TextBox
|
||||
private:
|
||||
|
||||
+3
-3
@@ -53,8 +53,8 @@ public:
|
||||
|
||||
bool isStop() const;
|
||||
bool isStop2() const;
|
||||
f32 getStartFrame() const;
|
||||
f32 getEndFrame() const;
|
||||
f32 getEndFrame2() const;
|
||||
|
||||
inline f32 getFrame() const {
|
||||
return mCurrFrame;
|
||||
@@ -68,8 +68,8 @@ public:
|
||||
mFlags = flags;
|
||||
}
|
||||
|
||||
inline void setToStart() {
|
||||
setFrame(0.0f);
|
||||
inline u8 getFlags() const {
|
||||
return mFlags;
|
||||
}
|
||||
|
||||
inline bool isEndReached() const {
|
||||
|
||||
Reference in New Issue
Block a user