d_lyt_msg_window_wood OK, d_lyt_common_a_btn OK

This commit is contained in:
robojumper
2025-04-01 23:08:44 +02:00
parent 17fe773653
commit fc89f2b34a
27 changed files with 819 additions and 175 deletions
+1
View File
@@ -7,6 +7,7 @@
namespace dSys {
void setFrameRate(u32);
u8 getFrameRate();
void setClearColor(mColor clr);
} // namespace dSys_c
+25 -23
View File
@@ -44,10 +44,10 @@ class Multi_c : public m2d::Base_c {
public:
Multi_c();
virtual ~Multi_c() {}
virtual void draw() override;
virtual void animate();
virtual void calc();
virtual bool build(const char *name, m2d::ResAccIf_c *acc);
/* vt 0x0C */ virtual void draw() override;
/* vt 0x10 */ virtual void animate();
/* vt 0x18 */ virtual void calc();
/* vt 0x18 */ virtual bool build(const char *name, m2d::ResAccIf_c *acc);
void calcBefore();
void calcAfter();
@@ -79,11 +79,11 @@ class LytBase_c : public Multi_c {
public:
LytBase_c();
virtual ~LytBase_c();
virtual void draw() override {
/* vt 0x0C */ virtual void draw() override {
mLayout.Draw(mDrawInfo);
};
virtual bool build(const char *name, m2d::ResAccIf_c *acc) override;
/* vt 0x18 */ virtual bool build(const char *name, m2d::ResAccIf_c *acc) override;
dTextBox_c *getTextBox(const char *name);
dTextBox_c *getSizeBoxInWindow(const char *windowName);
dWindow_c *getWindow(const char *name);
@@ -131,9 +131,11 @@ private:
class dSubPane;
struct SubPaneListNode {
nw4r::ut::LinkListNode mNode;
dSubPane *mpLytPane;
nw4r::lyt::Pane *mpPane;
/* 0x00 */ nw4r::ut::LinkListNode mNode;
/** The d lyt pane, set by the UI element */
/* 0x08 */ dSubPane *mpLytPane;
/** The nw4r lyt pane, set by linkMeters */
/* 0x0C */ nw4r::lyt::Pane *mpPane;
};
typedef nw4r::ut::LinkList<SubPaneListNode, offsetof(SubPaneListNode, mNode)> SubPaneList;
@@ -141,24 +143,24 @@ typedef nw4r::ut::LinkList<SubPaneListNode, offsetof(SubPaneListNode, mNode)> Su
class dSubPane {
public:
dSubPane() : field_0x04(false), field_0x05(0) {}
virtual ~dSubPane() {}
virtual bool build(ResAccIf_c *resAcc) = 0;
virtual bool remove() = 0;
virtual bool execute() = 0;
virtual nw4r::lyt::Pane *getPane() = 0;
virtual LytBase_c *getLyt() = 0;
virtual const char *getName() const = 0;
virtual bool LytMeter0x24() const {
/* vt 0x08 */ virtual ~dSubPane() {}
/* vt 0x0C */ virtual bool build(ResAccIf_c *resAcc) = 0;
/* vt 0x10 */ virtual bool remove() = 0;
/* vt 0x14 */ virtual bool execute() = 0;
/* vt 0x18 */ virtual nw4r::lyt::Pane *getPane() = 0;
/* vt 0x1C */ virtual LytBase_c *getLyt() = 0;
/* vt 0x20 */ virtual const char *getName() const = 0;
/* vt 0x24 */ virtual bool LytMeter0x24() const {
return field_0x04;
}
virtual void LytMeter0x28(bool arg) {
/* vt 0x28 */ virtual void LytMeter0x28(bool arg) {
field_0x04 = arg;
}
virtual u8 LytMeter0x2C() const {
/* vt 0x2C */ virtual u8 LytMeter0x2C() const {
return field_0x05;
}
virtual void LytMeter0x30(u8 arg) {
/* vt 0x30 */ virtual void LytMeter0x30(u8 arg) {
field_0x05 = arg;
}
@@ -178,9 +180,9 @@ struct AnmGroupBase_c {
bool init(const char *fileName, m2d::ResAccIf_c *acc, d2d::Layout_c *layout, const char *animName);
bool init(nw4r::lyt::AnimTransform *transform, const char *fileName, m2d::ResAccIf_c *acc, nw4r::lyt::Group *group);
bool setDirection(bool backwards);
bool bind(bool bDisable);
bool unbind();
bool afterUnbind();
bool remove();
void setAnimEnable(bool);
void setAnmFrame(f32);
void syncAnmFrame();
@@ -188,7 +190,7 @@ struct AnmGroupBase_c {
void setBackward();
inline void setFrameAndControlThings(f32 frame) {
setDirection(false);
bind(false);
setAnimEnable(true);
mpFrameCtrl->setFrame(frame);
syncAnmFrame();
+103
View File
@@ -0,0 +1,103 @@
#ifndef D_LYT_COMMON_A_BTN_H
#define D_LYT_COMMON_A_BTN_H
#include "d/lyt/d2d.h"
/**
* Made up name.
*
* An A button used in various message windows, as well as
* the title menu. Can be hidden, visible, animating in, animating out.
*/
class dLytCommonABtn_c : public d2d::dSubPane {
public:
virtual bool build(d2d::ResAccIf_c *resAcc) override;
virtual bool remove() override;
virtual bool execute() override;
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();
}
void openMaybe() {
field_0x1B0 = 1;
}
void closeMaybe() {
field_0x1B0 = 0;
}
u8 shouldBeOpen() const {
return field_0x1B0;
}
u8 isDoneOut() const {
return mIsDoneOut;
}
bool requestIn();
bool requestOut(bool b);
enum SoundVariant {
VARIANT_NORMAL,
VARIANT_TITLE,
};
void setSoundVariant(SoundVariant);
void resetToInvisble();
enum ABtnState {
STATE_INVISIBLE,
STATE_IN,
STATE_VISIBLE,
STATE_OUT,
};
private:
enum OutState {
OUT_STATE_DECIDING,
OUT_STATE_GOTO_OUT,
OUT_STATE_OUT,
OUT_STATE_GOTO_INVISIBLE,
};
void setState(ABtnState state);
void runExecuteFunc();
void executeStateInvisible();
void executeStateIn();
void executeStateVisible();
void executeStateDecideOut();
void gotoStateInvisible();
void gotoStateIn();
void goToStateVisible();
void goToStateDecideOut();
typedef void (dLytCommonABtn_c::*executeFunc)(void);
static const executeFunc sExecuteFuncs[4];
/* 0x008 */ d2d::dLytSub mLyt;
/* 0x09C */ d2d::AnmGroup_c mAnm[4];
/* 0x19C */ ABtnState mState;
/* 0x1A0 */ OutState mOutState;
/* 0x1A4 */ SoundVariant mSoundVariant;
/* 0x1A8 */ u8 field_0x1A8;
/* 0x1A9 */ bool mInRequested;
/* 0x1AA */ bool mOutRequested;
/* 0x1AB */ bool mIsDoneOut;
/* 0x1AC */ u8 field_0x1AC;
/* 0x1AD */ bool mNoDecide;
/* 0x1AE */ u8 field_0x1AE;
/* 0x1AF */ u8 field_0x1AF;
/* 0x1B0 */ u8 field_0x1B0;
};
#endif
+10 -1
View File
@@ -5,6 +5,8 @@
#include "nw4r/lyt/lyt_textBox.h"
#include "nw4r/lyt/lyt_types.h"
class dTagProcessor_c;
class dTextBox_c : public nw4r::lyt::TextBox {
friend class dWindow_c;
@@ -26,6 +28,10 @@ public:
nw4r::lyt::TextBox::SetFontSize(value);
}
void set0x1F6(u8 val) {
field_0x1F6 = val;
}
void set0x1F8(u8 val) {
field_0x1F8 = val;
}
@@ -39,6 +45,7 @@ public:
}
void fn_800AF930(const wchar_t *);
void fn_800AF540(const wchar_t *text, dTagProcessor_c *tagProcessor, ...);
// @bug: This does not implement UT's RTTI, so casts to dTextBox_c will
// succeed even if all you have is a lyt::TextBox
@@ -49,7 +56,9 @@ private:
/* 0x108 */ u8 field_0x108[0x118 - 0x108];
/* 0x118 */ nw4r::lyt::Size mTextScale;
/* 0x120 */ f32 mScale;
/* 0x124 */ u8 field_0x124[0x1F8 - 0x124];
/* 0x124 */ u8 field_0x124[0x1F6 - 0x124];
/* 0x1F6 */ u8 field_0x1F6;
/* 0x1F7 */ u8 field_0x1F7;
/* 0x1F8 */ u8 field_0x1F8;
/* 0x1F9 */ u8 field_0x1F9[0x204 - 0x1F9];
};
@@ -0,0 +1,27 @@
#ifndef D_LYT_MGS_WINDOW_COMMON_H
#define D_LYT_MGS_WINDOW_COMMON_H
#include "d/d_tag_processor.h"
#include "d/lyt/d2d.h"
#include "m/m2d.h"
class dLytMsgWindowSubtype : public m2d::Base_c {
public:
/* vt 0x08 */ virtual ~dLytMsgWindowSubtype() {}
// vt 0x0C = m2d::Base_c::draw
/* vt 0x10 */ virtual bool build(void *unk, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor);
/* vt 0x14 */ virtual bool remove();
/* vt 0x18 */ virtual bool execute();
/* vt 0x1C */ virtual void vt_0x1C();
/* vt 0x20 */ virtual bool vt_0x20() const;
/* vt 0x24 */ virtual void vt_0x24();
/* vt 0x28 */ virtual bool vt_0x28() const;
/* vt 0x2C */ virtual bool setText(const wchar_t *text);
/* vt 0x30 */ virtual dTextBox_c *vt_0x30();
/* vt 0x34 */ virtual void vt_0x34();
/* vt 0x38 */ virtual void vt_0x38(bool b);
/* vt 0x3C */ virtual u8 vt_0x3C() const;
/* vt 0x40 */ virtual bool vt_0x40() const;
};
#endif
@@ -0,0 +1,55 @@
#ifndef D_LYT_MSG_WINDOW_WOOD_H
#define D_LYT_MSG_WINDOW_WOOD_H
#include "d/d_tag_processor.h"
#include "d/lyt/d2d.h"
#include "d/lyt/d_lyt_common_a_btn.h"
#include "d/lyt/d_textbox.h"
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
#include "nw4r/lyt/lyt_pane.h"
#include "s/s_State.hpp"
class dLytMsgWindowWood_c : public dLytMsgWindowSubtype {
public:
/* vt 0x08 */ virtual ~dLytMsgWindowWood_c() {}
/* vt 0x0C */ virtual void draw() override;
/* vt 0x10 */ virtual bool build(void *unk, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
/* vt 0x14 */ virtual bool remove() override;
/* vt 0x18 */ virtual bool execute() override;
/* vt 0x1C */ virtual void vt_0x1C() override;
/* vt 0x20 */ virtual bool vt_0x20() const override;
/* vt 0x24 */ virtual void vt_0x24() override;
/* vt 0x28 */ virtual bool vt_0x28() const override;
/* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
/* vt 0x30 */ virtual dTextBox_c *vt_0x30() override {
return mpTextboxes[0];
}
/* vt 0x34 */ virtual void vt_0x34() override {
mCommon.requestIn();
}
/* vt 0x38 */ virtual void vt_0x38(bool b) override {
mCommon.requestOut(b);
}
/* vt 0x3C */ virtual u8 vt_0x3C() const override {
return mCommon.isDoneOut();
}
STATE_FUNC_DECLARE(dLytMsgWindowWood_c, Invisible);
STATE_FUNC_DECLARE(dLytMsgWindowWood_c, In);
STATE_FUNC_DECLARE(dLytMsgWindowWood_c, Visible);
STATE_FUNC_DECLARE(dLytMsgWindowWood_c, Out);
private:
/* 0x010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowWood_c);
/* 0x04C */ d2d::SubPaneList mSubpaneList;
/* 0x05C */ d2d::SubPaneListNode mNodes[1];
/* 0x068 */ d2d::ResAccIf_c mResAcc;
/* 0x3D8 */ d2d::LytBase_c mLyt;
/* 0x468 */ d2d::AnmGroup_c mAnm[3];
/* 0x528 */ dTextBox_c *mpTextboxes[2];
/* 0x530 */ nw4r::lyt::Pane *mpPanes[2];
/* 0x538 */ dTagProcessor_c *mpTagProcessor;
/* 0x53C */ dLytCommonABtn_c mCommon;
};
#endif