mirror of
https://github.com/zeldaret/ss
synced 2026-05-24 07:10:53 -04:00
Merge pull request #148 from robojumper/d_lyt_msg_window
various window files OK
This commit is contained in:
+95
-12
@@ -241,6 +241,11 @@ d/lyt/d_lyt_draw_mark.cpp:
|
||||
|
||||
d/lyt/d_textbox.cpp:
|
||||
.text start:0x800AE960 end:0x800B1628
|
||||
.data start:0x80510780 end:0x80510820
|
||||
.sdata start:0x805722C0 end:0x805722D8
|
||||
.sbss start:0x805753A8 end:0x805753B0
|
||||
.sdata2 start:0x805797D0 end:0x805797F0
|
||||
.bss start:0x805A6370 end:0x805A6F70
|
||||
|
||||
d/lyt/d_window.cpp:
|
||||
.text start:0x800B1630 end:0x800B1818
|
||||
@@ -256,6 +261,9 @@ d/d_textunk.cpp:
|
||||
.sdata2 start:0x805797F8 end:0x80579848
|
||||
.bss start:0x805A6F70 end:0x805A7730
|
||||
|
||||
d/d_textwindow_unk.cpp:
|
||||
.text start:0x800B20E0 end:0x800B34F0
|
||||
|
||||
d/d_tag_processor.cpp:
|
||||
.text start:0x800B34F0 end:0x800B9274
|
||||
.ctors start:0x804DB6D4 end:0x804DB6D8
|
||||
@@ -407,6 +415,12 @@ d/lyt/d_lyt_do_button.cpp:
|
||||
.data start:0x8051A5A8 end:0x8051AC00
|
||||
.bss start:0x805ACE10 end:0x805ACF78
|
||||
|
||||
d/lyt/d_lyt_common_a_btn.cpp:
|
||||
.text start:0x8010EF90 end:0x8010F818
|
||||
.rodata start:0x804E72E0 end:0x804E7330
|
||||
.data start:0x8051AC18 end:0x8051ACD8
|
||||
.sdata2 start:0x80579D98 end:0x80579DA8
|
||||
|
||||
d/lyt/d_lyt_common_icon_material.cpp:
|
||||
.text start:0x8010F820 end:0x80111718
|
||||
.ctors start:0x804DB730 end:0x804DB734
|
||||
@@ -425,56 +439,117 @@ d/lyt/d_lyt_common_icon_item.cpp:
|
||||
.sdata2 start:0x80579DB8 end:0x80579DD0
|
||||
.bss start:0x805AD088 end:0x805AD188
|
||||
|
||||
d/lyt/d_lyt_msg_window.cpp:
|
||||
d/lyt/msg_window/d_lyt_msg_window.cpp:
|
||||
.text start:0x801148F0 end:0x8011C8C8
|
||||
.ctors start:0x804DB738 end:0x804DB73C
|
||||
.data start:0x8051B6E8 end:0x8051C300
|
||||
.sdata start:0x80572580 end:0x80572588
|
||||
.sdata2 start:0x80579DF0 end:0x80579E18
|
||||
.bss start:0x805AD188 end:0x805AE670
|
||||
|
||||
d/lyt/d_lyt_msg_window_select_btn.cpp:
|
||||
.text start:0x8011C8D0 end:0x80120988
|
||||
d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp:
|
||||
.text start:0x8011C8D0 end:0x80120A18
|
||||
.ctors start:0x804DB73C end:0x804DB740
|
||||
.rodata start:0x804E7468 end:0x804E7540
|
||||
.data start:0x8051C300 end:0x8051CB10
|
||||
.sdata start:0x80572588 end:0x80572598
|
||||
.bss start:0x805AE670 end:0x805AE930
|
||||
|
||||
d/lyt/d_lyt_msg_window_base.cpp:
|
||||
d/lyt/msg_window/d_lyt_msg_window_common.cpp:
|
||||
.text start:0x80120A20 end:0x80121068
|
||||
.data start:0x8051CB10 end:0x8051CC98
|
||||
.sdata start:0x80572598 end:0x805725A0
|
||||
.sdata2 start:0x80579E60 end:0x80579E68
|
||||
|
||||
d/lyt/d_lyt_msg_window_talk.cpp:
|
||||
d/lyt/msg_window/d_lyt_msg_window_talk.cpp:
|
||||
.text start:0x80121070 end:0x801223C8
|
||||
.ctors start:0x804DB740 end:0x804DB744
|
||||
.rodata start:0x804E7540 end:0x804E7560
|
||||
.data start:0x8051CC98 end:0x8051CFC0
|
||||
.sdata start:0x805725A0 end:0x805725B0
|
||||
.sdata2 start:0x80579E68 end:0x80579E80
|
||||
.bss start:0x805AE930 end:0x805AEA70
|
||||
|
||||
d/lyt/d_lyt_msg_window_link.cpp:
|
||||
d/lyt/msg_window/d_lyt_msg_window_link.cpp:
|
||||
.text start:0x801223D0 end:0x80123738
|
||||
.ctors start:0x804DB744 end:0x804DB748
|
||||
.rodata start:0x804E7560 end:0x804E7580
|
||||
.data start:0x8051CFC0 end:0x8051D2D8
|
||||
.sdata start:0x805725B0 end:0x805725C0
|
||||
.sdata2 start:0x80579E80 end:0x80579E98
|
||||
.bss start:0x805AEA70 end:0x805AEBB0
|
||||
|
||||
d/lyt/d_lyt_msg_window_get.cpp:
|
||||
d/lyt/msg_window/d_lyt_msg_window_get.cpp:
|
||||
.text start:0x80123740 end:0x80124678
|
||||
.ctors start:0x804DB748 end:0x804DB74C
|
||||
.rodata start:0x804E7580 end:0x804E7598
|
||||
.data start:0x8051D2D8 end:0x8051D578
|
||||
.sdata start:0x805725C0 end:0x805725D0
|
||||
.sdata2 start:0x80579E98 end:0x80579EA8
|
||||
.bss start:0x805AEBB0 end:0x805AECB0
|
||||
|
||||
d/lyt/d_lyt_msg_window_sword.cpp:
|
||||
d/lyt/msg_window/d_lyt_msg_window_sword.cpp:
|
||||
.text start:0x80124680 end:0x80125BA8
|
||||
.ctors start:0x804DB74C end:0x804DB750
|
||||
.rodata start:0x804E7598 end:0x804E75C0
|
||||
.data start:0x8051D578 end:0x8051D8A0
|
||||
.sdata start:0x805725D0 end:0x805725E0
|
||||
.sdata2 start:0x80579EA8 end:0x80579EC0
|
||||
.bss start:0x805AECB0 end:0x805AEDF0
|
||||
|
||||
d/lyt/d_lyt_msg_window_wood.cpp:
|
||||
d/lyt/msg_window/d_lyt_msg_window_wood.cpp:
|
||||
.text start:0x80125BB0 end:0x801267F8
|
||||
.ctors start:0x804DB750 end:0x804DB754
|
||||
.rodata start:0x804E75C0 end:0x804E75D8
|
||||
.data start:0x8051D8A0 end:0x8051DB08
|
||||
.sdata start:0x805725E0 end:0x805725F8
|
||||
.sdata2 start:0x80579EC0 end:0x80579EC8
|
||||
.bss start:0x805AEDF0 end:0x805AEEF0
|
||||
|
||||
d/lyt/d_lyt_msg_window_stone.cpp:
|
||||
d/lyt/msg_window/d_lyt_msg_window_stone.cpp:
|
||||
.text start:0x80126800 end:0x80127478
|
||||
.ctors start:0x804DB754 end:0x804DB758
|
||||
.rodata start:0x804E75D8 end:0x804E75F0
|
||||
.data start:0x8051DB08 end:0x8051DD90
|
||||
.sdata start:0x805725F8 end:0x80572608
|
||||
.sdata2 start:0x80579EC8 end:0x80579ED0
|
||||
.bss start:0x805AEEF0 end:0x805AEFF0
|
||||
|
||||
d/lyt/d_lyt_msg_window_demo.cpp:
|
||||
d/lyt/msg_window/d_lyt_msg_window_demo.cpp:
|
||||
.text start:0x80127480 end:0x801281F8
|
||||
.ctors start:0x804DB758 end:0x804DB75C
|
||||
.rodata start:0x804E75F0 end:0x804E7600
|
||||
.data start:0x8051DD90 end:0x8051E008
|
||||
.sdata start:0x80572608 end:0x80572618
|
||||
.sdata2 start:0x80579ED0 end:0x80579EE0
|
||||
.bss start:0x805AEFF0 end:0x805AF0F0
|
||||
|
||||
d/lyt/d_lyt_simple_window.cpp:
|
||||
d/lyt/msg_window/d_lyt_simple_window.cpp:
|
||||
.text start:0x80128200 end:0x8012B948
|
||||
.ctors start:0x804DB75C end:0x804DB760
|
||||
.rodata start:0x804E7600 end:0x804E7668
|
||||
.data start:0x8051E008 end:0x8051E548
|
||||
.sdata start:0x80572618 end:0x80572638
|
||||
.sdata2 start:0x80579EE0 end:0x80579EF8
|
||||
.bss start:0x805AF0F0 end:0x805AF1F0
|
||||
|
||||
d/lyt/d_lyt_auto_caption.cpp:
|
||||
.text start:0x8012B950 end:0x8012C568
|
||||
.ctors start:0x804DB760 end:0x804DB764
|
||||
.rodata start:0x804E7668 end:0x804E7688
|
||||
.data start:0x8051E548 end:0x8051E7C0
|
||||
.sdata start:0x80572638 end:0x80572648
|
||||
.sdata2 start:0x80579EF8 end:0x80579F10
|
||||
.bss start:0x805AF1F0 end:0x805AF2F0
|
||||
|
||||
d/lyt/d_lyt_auto_explain.cpp:
|
||||
.text start:0x8012C570 end:0x8012D188
|
||||
.ctors start:0x804DB764 end:0x804DB768
|
||||
.rodata start:0x804E7688 end:0x804E76A0
|
||||
.data start:0x8051E7C0 end:0x8051EA08
|
||||
.sdata start:0x80572648 end:0x80572658
|
||||
.sdata2 start:0x80579F10 end:0x80579F28
|
||||
.bss start:0x805AF2F0 end:0x805AF3F0
|
||||
|
||||
d/lyt/d_lyt_map_capture.cpp:
|
||||
.text start:0x8012D190 end:0x8012DC28
|
||||
@@ -715,6 +790,14 @@ d/tg/d_t_weather.cpp:
|
||||
.text start:0x801A65D0 end:0x801AF7D8
|
||||
.ctors start:0x804DB804 end:0x804DB808
|
||||
|
||||
d/d_message.cpp:
|
||||
.text start:0x801AF7E0 end:0x801B329C
|
||||
.ctors start:0x804DB808 end:0x804DB80C
|
||||
.data start:0x8052C858 end:0x8052DF40
|
||||
.sdata start:0x80573248 end:0x80573290
|
||||
.sbss start:0x80575740 end:0x80575760
|
||||
.bss start:0x805B29E0 end:0x805B36E0
|
||||
|
||||
d/d_stage.cpp:
|
||||
.text start:0x801B32A0 end:0x801B5BC8
|
||||
.ctors start:0x804DB80C end:0x804DB810
|
||||
|
||||
+1065
-1064
File diff suppressed because it is too large
Load Diff
+13
-9
@@ -382,6 +382,7 @@ config.libs = [
|
||||
Object(NonMatching, "d/lyt/d_textbox.cpp"),
|
||||
Object(Matching, "d/lyt/d_window.cpp"),
|
||||
Object(Matching, "d/d_textunk.cpp"),
|
||||
Object(NonMatching, "d/d_textwindow_unk.cpp"),
|
||||
Object(NonMatching, "d/d_tag_processor.cpp"),
|
||||
Object(NonMatching, "d/lyt/meter/d_lyt_meter.cpp"),
|
||||
Object(NonMatching, "d/lyt/meter/d_lyt_meter_unk.cpp"),
|
||||
@@ -404,17 +405,19 @@ config.libs = [
|
||||
Object(NonMatching, "d/lyt/meter/d_lyt_meter_heart.cpp"),
|
||||
Object(NonMatching, "d/lyt/meter/d_lyt_meter_shield_gauge.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_do_button.cpp"),
|
||||
Object(Matching, "d/lyt/d_lyt_common_a_btn.cpp"),
|
||||
Object(Matching, "d/lyt/d_lyt_common_icon_material.cpp"),
|
||||
Object(Matching, "d/lyt/d_lyt_common_icon_item.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_msg_window.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_msg_window_select_btn.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_msg_window_talk.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_msg_window_link.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_msg_window_get.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_msg_window_sword.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_msg_window_wood.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_msg_window_stone.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_msg_window_demo.cpp"),
|
||||
Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window.cpp"),
|
||||
Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp"),
|
||||
Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_common.cpp"),
|
||||
Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window_talk.cpp"),
|
||||
Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window_link.cpp"),
|
||||
Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window_get.cpp"),
|
||||
Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_sword.cpp"),
|
||||
Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_wood.cpp"),
|
||||
Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_stone.cpp"),
|
||||
Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_demo.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_simple_window.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_auto_caption.cpp"),
|
||||
Object(NonMatching, "d/lyt/d_lyt_auto_explain.cpp"),
|
||||
@@ -435,6 +438,7 @@ config.libs = [
|
||||
Object(NonMatching, "d/a/d_a_insect.cpp"),
|
||||
Object(NonMatching, "d/d_stage_mgr.cpp"),
|
||||
Object(NonMatching, "d/d_last.cpp"),
|
||||
Object(NonMatching, "d/d_message.cpp"),
|
||||
Object(NonMatching, "d/d_stage.cpp"),
|
||||
Object(Matching, "d/d_room.cpp"),
|
||||
Object(NonMatching, "d/d_cs_base.cpp"),
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
#ifndef D_MESSAGE_H
|
||||
#define D_MESSAGE_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_base.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "libms/flowfile.h"
|
||||
#include "libms/msgfile.h"
|
||||
#include "sized_string.h"
|
||||
|
||||
class dMessage_c : public dBase_c {
|
||||
public:
|
||||
dMessage_c();
|
||||
virtual ~dMessage_c() {
|
||||
sInstance = nullptr;
|
||||
}
|
||||
|
||||
int create() override;
|
||||
int doDelete() override;
|
||||
int execute() override;
|
||||
int draw() override;
|
||||
|
||||
static const char *getLanguageIdentifier();
|
||||
|
||||
static dMessage_c *getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
static dTagProcessor_c *getGlobalTagProcessor() {
|
||||
return sTagProcessor;
|
||||
}
|
||||
|
||||
void reset();
|
||||
|
||||
bool getField_0x329() const {
|
||||
return field_0x329;
|
||||
}
|
||||
|
||||
void setField_0x329(bool v) {
|
||||
field_0x329 = v;
|
||||
}
|
||||
|
||||
bool getField_0x32A() const {
|
||||
return field_0x32A;
|
||||
}
|
||||
|
||||
static bool isValidTextLabel(const char *name);
|
||||
static void loadTextByLabel(const char *label, dTagProcessor_c *tagProcessor, bool, u32, u32);
|
||||
|
||||
static s32 getMsbtIndexForLabel(const char *name);
|
||||
static const char *getMsbtFileName(s32 index);
|
||||
|
||||
static const wchar_t *getTextMessageByLabel(const char *label, bool global, wchar_t *dstBuf, u32 maxLen);
|
||||
static const wchar_t *
|
||||
getTextMessageByLabel(const char *label, dTagProcessor_c *pTagProcessor, bool global, wchar_t *dstBuf, u32 maxLen);
|
||||
|
||||
static const wchar_t *formatText(const wchar_t *text);
|
||||
|
||||
private:
|
||||
static void *sZev0;
|
||||
static void *sZevStage;
|
||||
|
||||
static void *getZev0Internal();
|
||||
static void *getZevStageInternal();
|
||||
|
||||
void executeMinigame();
|
||||
|
||||
const wchar_t *formatTextInternal(const wchar_t *text);
|
||||
const wchar_t *getTextMessageByLabelInternal(
|
||||
const char *label, dTagProcessor_c *pTagProcessor, bool global, wchar_t *dstBuf, u32 maxLen
|
||||
);
|
||||
|
||||
static s32 getArcIndexForFile(const char *fileName);
|
||||
static const char *getArcNameByIndex(s32 idx, bool);
|
||||
|
||||
bool checkIsValidTextLabel(const char *name);
|
||||
|
||||
static void setZevFromMsbArc();
|
||||
static void setStageZevFromMsbArc();
|
||||
static s32 getMsbtNumberByIndex(s32 index);
|
||||
static const char *getMsbfFileName(s32 index);
|
||||
static s32 getMsbfNumberByIndex(s32 index);
|
||||
static void *getDataFromMsbArc(s32 number, const char *fileName, bool);
|
||||
|
||||
s32 getTextIndexForLabel(const char *label);
|
||||
s32 getMsbtIndexForLabelInternal(const char *label);
|
||||
static MsbtInfo *getMsbtInfoForIndex(s32 index);
|
||||
MsbtInfo *getMsbtInfoForIndexInternal(s32 index);
|
||||
|
||||
static MsbfInfo *getMsbfInfoForIndex(s32 index);
|
||||
MsbfInfo *getMsbfInfoForIndexInternal(s32 index);
|
||||
|
||||
static const char *getArcNameByIndexInternal(s32 idx, bool global);
|
||||
|
||||
static dMessage_c *sInstance;
|
||||
static dTagProcessor_c *sTagProcessor;
|
||||
|
||||
/* 0x068 */ MsbtInfo *mpMsgs[82];
|
||||
/* 0x1B0 */ MsbfInfo *mpFlows[80];
|
||||
/* 0x2F0 */ SizedString<8> mLanguage;
|
||||
/* 0x2F8 */ u32 mCurrentTextFileNumber;
|
||||
|
||||
/* 0x2FC */ s32 field_0x2FC;
|
||||
|
||||
/* 0x300 */ u8 _0x300[0x329 - 0x300];
|
||||
|
||||
/* 0x329 */ bool field_0x329;
|
||||
/* 0x32A */ bool field_0x32A;
|
||||
|
||||
/* 0x32B */ u8 _0x32B[0x334 - 0x32B];
|
||||
|
||||
/* 0x334 */ u32 mMinigameResultPoints;
|
||||
/* 0x338 */ u32 mMinigameTime;
|
||||
/* 0x33C */ u8 _0x33C[0x344 - 0x33C];
|
||||
/* 0x344 */ s32 field_0x344;
|
||||
};
|
||||
|
||||
#endif
|
||||
+5
-1
@@ -3,8 +3,12 @@
|
||||
|
||||
class dPad {
|
||||
public:
|
||||
|
||||
static bool checkButtonAPressed();
|
||||
static bool checkButtonBPressed();
|
||||
static bool checkButtonZPressed();
|
||||
static bool checkButtonPlusPressed();
|
||||
|
||||
static bool checkButtonAHeld();
|
||||
static bool checkButtonZHeld();
|
||||
};
|
||||
|
||||
|
||||
@@ -114,6 +114,10 @@ public:
|
||||
void addObjId(u16 id);
|
||||
void addActorId(u16 actorId);
|
||||
|
||||
dFader_c *getFader() {
|
||||
return &mFader;
|
||||
}
|
||||
|
||||
private:
|
||||
static void lastExecuteCallback();
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
namespace dSys {
|
||||
|
||||
void setFrameRate(u32);
|
||||
u8 getFrameRate();
|
||||
void setClearColor(mColor clr);
|
||||
|
||||
} // namespace dSys_c
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
#include "nw4r/ut/ut_TagProcessorBase.h"
|
||||
#include "nw4r/ut/ut_TextWriterBase.h"
|
||||
|
||||
struct dLytMsgWindowCharData;
|
||||
|
||||
struct LineData {
|
||||
f32 mLineWidths[0x32];
|
||||
u32 mNumLines;
|
||||
};
|
||||
|
||||
// inofficial name
|
||||
// size: 0xEF4
|
||||
class dTagProcessor_c : public nw4r::ut::TagProcessorBase<wchar_t> {
|
||||
@@ -12,8 +19,9 @@ public:
|
||||
dTagProcessor_c();
|
||||
virtual ~dTagProcessor_c();
|
||||
|
||||
void format(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, ...);
|
||||
void
|
||||
eventFlowTextProcessingRelated(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen);
|
||||
formatV(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, va_list list);
|
||||
|
||||
virtual nw4r::ut::Operation Process(u16 ch, nw4r::ut::PrintContext<wchar_t> *ctx) override;
|
||||
virtual nw4r::ut::Operation CalcRect(nw4r::ut::Rect *rect, u16 ch, nw4r::ut::PrintContext<wchar_t> *ctx) override;
|
||||
@@ -45,7 +53,7 @@ public:
|
||||
u8 symbolToFontIdx(s32 s);
|
||||
void setStringArg(const wchar_t *arg, s32 index);
|
||||
|
||||
static s32 getNumLines(s32 arg);
|
||||
static s32 getMaxNumLines(s32 arg);
|
||||
|
||||
static void getTextCommand(wchar_t _0xe, const wchar_t *src, u8 *outCmdLen, s32 *outCmd, wchar_t **outEndPtr);
|
||||
static void process0xFCommand(wchar_t _0xf, const wchar_t *src, s32 *outCmd);
|
||||
@@ -60,13 +68,97 @@ public:
|
||||
char fn_800B7880(u32);
|
||||
void fn_800B70D0(nw4r::ut::TextWriterBase<wchar_t> *, nw4r::ut::PrintContext<wchar_t> *ctx, u16 c, s32);
|
||||
|
||||
void
|
||||
fn_800B4290(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, s32, u16 *, dLytMsgWindowCharData *charData);
|
||||
|
||||
void resetSomething();
|
||||
void resetSomeFloats();
|
||||
void resetLineData();
|
||||
void setNumericArg0(s32 arg);
|
||||
void setNumericArgs(const s32 *args, s32 numArgs);
|
||||
f32 getFloat(s32 i);
|
||||
f32 getLineWidth(s32 i);
|
||||
s32 tickPauseFrame();
|
||||
s32 tick0x830();
|
||||
void execute();
|
||||
|
||||
void setTextbox(dTextBox_c *box) {
|
||||
field_0x004 = box;
|
||||
}
|
||||
|
||||
s32 getNumLinesMaybe() const {
|
||||
return mLineData.mNumLines;
|
||||
}
|
||||
|
||||
u8 getMsgWindowSubtype() const {
|
||||
return mMsgWindowSubtype;
|
||||
}
|
||||
|
||||
u8 getField_0x90D() const {
|
||||
return field_0x90D;
|
||||
}
|
||||
|
||||
u8 getField_0x90E() const {
|
||||
return field_0x90E;
|
||||
}
|
||||
|
||||
s32 getField_0x824() const {
|
||||
return field_0x824;
|
||||
}
|
||||
|
||||
s32 getField_0x828() const {
|
||||
return field_0x828;
|
||||
}
|
||||
|
||||
s32 getField_0x82C() const {
|
||||
return field_0x82C;
|
||||
}
|
||||
|
||||
s32 getField_0x830() const {
|
||||
return field_0x830;
|
||||
}
|
||||
|
||||
void setMsgWindowSubtype(u8 type) {
|
||||
mMsgWindowSubtype = type;
|
||||
}
|
||||
|
||||
void setField_0x828(s32 val) {
|
||||
field_0x828 = val;
|
||||
}
|
||||
|
||||
void setField_0x82C(s32 val) {
|
||||
field_0x82C = val;
|
||||
}
|
||||
|
||||
void setField_0x90D(u8 val) {
|
||||
field_0x90D = val;
|
||||
}
|
||||
|
||||
void setField_0x90E(u8 val) {
|
||||
field_0x90E = val;
|
||||
}
|
||||
|
||||
void setField_0xEE0(u8 val) {
|
||||
field_0xEE0 = val;
|
||||
}
|
||||
|
||||
void setField_0xEE1(u8 val) {
|
||||
field_0xEE1 = val;
|
||||
}
|
||||
|
||||
void setField_0xEE2(u8 val) {
|
||||
field_0xEE2 = val;
|
||||
}
|
||||
|
||||
void setField_0xEE3(u8 val) {
|
||||
field_0xEE3 = val;
|
||||
}
|
||||
|
||||
wchar_t *getBuf(s32 idx) {
|
||||
return field_0x008[idx];
|
||||
}
|
||||
|
||||
LineData getLineData() const {
|
||||
return mLineData;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x004 */ dTextBox_c *field_0x004;
|
||||
@@ -117,12 +209,11 @@ private:
|
||||
/* 0x900 */ s32 field_0x900;
|
||||
/* 0x904 */ f32 field_0x904;
|
||||
/* 0x908 */ f32 field_0x908;
|
||||
/* 0x90C */ u8 field_0x90C;
|
||||
/* 0x90C */ u8 mMsgWindowSubtype;
|
||||
/* 0x90D */ u8 field_0x90D;
|
||||
/* 0x90E */ u8 field_0x90E;
|
||||
/* 0x90F */ u8 field_0x90F[4];
|
||||
/* 0x914 */ f32 field_0x914[0x32];
|
||||
/* 0x9DC */ s32 mCommandInsert;
|
||||
/* 0x914 */ LineData mLineData;
|
||||
/* 0x9E0 */ wchar_t mStringArgs[8][64];
|
||||
/* 0xDE0 */ u8 field_0xDE0[0xEE0 - 0xDE0];
|
||||
/* 0xEE0 */ u8 field_0xEE0;
|
||||
|
||||
+87
-9
@@ -7,6 +7,13 @@
|
||||
#include "nw4r/ut/ut_Color.h"
|
||||
#include "sized_string.h"
|
||||
|
||||
/**
|
||||
* This class appears to be the remnant of a sort of "hot-reloading"
|
||||
* mechanism for the game's user interface. Many of the functions
|
||||
* affect text formatting, UI layouting, and it also has mechanisms
|
||||
* for overriding the text and flow files being accessed. The actual
|
||||
* implementation appears to have been stripped out though.
|
||||
*/
|
||||
class UnkTextThing {
|
||||
public:
|
||||
UnkTextThing();
|
||||
@@ -21,6 +28,20 @@ public:
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline static f32 getField0x75C() {
|
||||
if (sInstance != nullptr) {
|
||||
return sInstance->field_0x75C;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline static f32 getField0x760() {
|
||||
if (sInstance != nullptr) {
|
||||
return sInstance->field_0x760;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline static f32 getField0x768() {
|
||||
if (sInstance != nullptr) {
|
||||
return sInstance->field_0x768;
|
||||
@@ -95,11 +116,68 @@ public:
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
private:
|
||||
static UnkTextThing *sInstance;
|
||||
static UnkTextThing *getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
s16 getMsgWindowWaitDelay() const {
|
||||
return mMsgWindowWaitDelay;
|
||||
}
|
||||
|
||||
bool getShouldOverrideData() const {
|
||||
return mShouldOverrideData;
|
||||
}
|
||||
|
||||
void *getOverrideZev0() const {
|
||||
return mOverrideZev0;
|
||||
}
|
||||
|
||||
void *getOverrideStageZev() const {
|
||||
return mOverrideStageZev;
|
||||
}
|
||||
|
||||
bool getShouldHookAllocations() const {
|
||||
return mShouldHookAllocations;
|
||||
}
|
||||
|
||||
MsbtInfo *getOverrideMsbtInfo(s32 index) const {
|
||||
return mMsbts[index];
|
||||
}
|
||||
|
||||
MsbfInfo *getOverrideMsbfInfo(s32 index) const {
|
||||
return mMsbfs[index];
|
||||
}
|
||||
|
||||
const char *getStr1() const {
|
||||
return field_0x004;
|
||||
}
|
||||
|
||||
const char *getStr2() const {
|
||||
return field_0x084;
|
||||
}
|
||||
|
||||
const char *getStr3() const {
|
||||
return field_0x104;
|
||||
}
|
||||
|
||||
void setStr1(const char *s) {
|
||||
field_0x004 = s;
|
||||
}
|
||||
|
||||
void setStr2(const char *s) {
|
||||
field_0x084 = s;
|
||||
}
|
||||
|
||||
void setStr3(const char *s) {
|
||||
field_0x104 = s;
|
||||
}
|
||||
|
||||
void *allocUnk(size_t size, int align);
|
||||
void destroyUnk(void *thing);
|
||||
|
||||
private:
|
||||
static UnkTextThing *sInstance;
|
||||
|
||||
void destroyFlow(MsbfInfo *flow);
|
||||
void destroyMsg(MsbtInfo *msg);
|
||||
|
||||
@@ -121,11 +199,11 @@ private:
|
||||
/* 0x184 */ void *field_buf0[82];
|
||||
/* 0x2CC */ void *field_buf4[23];
|
||||
/* 0x328 */ void *field_buf1[80];
|
||||
/* 0x468 */ MsbtInfo *field_buf2[82];
|
||||
/* 0x468 */ MsbtInfo *mMsbts[82];
|
||||
/* 0x5B0 */ MsbtInfo *field_buf5[23];
|
||||
/* 0x60C */ MsbfInfo *field_buf3[80];
|
||||
/* 0x74C */ void *field_0x74C;
|
||||
/* 0x750 */ void *field_0x750;
|
||||
/* 0x60C */ MsbfInfo *mMsbfs[80];
|
||||
/* 0x74C */ void *mOverrideZev0;
|
||||
/* 0x750 */ void *mOverrideStageZev;
|
||||
/* 0x754 */ f32 field_0x754;
|
||||
/* 0x758 */ f32 field_0x758;
|
||||
/* 0x75C */ f32 field_0x75C;
|
||||
@@ -152,13 +230,13 @@ private:
|
||||
/* 0x7A8 */ s16 field_0x7A8;
|
||||
/* 0x7AA */ s16 field_0x7AA;
|
||||
/* 0x7AC */ s16 field_0x7AC;
|
||||
/* 0x7AE */ s16 field_0x7AE;
|
||||
/* 0x7AE */ s16 mMsgWindowWaitDelay;
|
||||
/* 0x7B0 */ s16 field_0x7B0;
|
||||
/* 0x7B2 */ bool field_0x7B2;
|
||||
/* 0x7B3 */ bool field_0x7B3;
|
||||
/* 0x7B4 */ bool field_0x7B4;
|
||||
/* 0x7B4 */ bool mShouldOverrideData;
|
||||
/* 0x7B5 */ bool field_0x7B5;
|
||||
/* 0x7B6 */ bool field_0x7B6;
|
||||
/* 0x7B6 */ bool mShouldHookAllocations;
|
||||
/* 0x7B6 */ bool field_0x7B7;
|
||||
/* 0x7B8 */ nw4r::ut::Color field_0x7B8;
|
||||
/* 0x7BC */ nw4r::ut::Color field_0x7BC;
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
#ifndef D_TEXTWINDOW_UNK_H
|
||||
#define D_TEXTWINDOW_UNK_H
|
||||
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "sized_string.h"
|
||||
|
||||
struct dLytMsgWindowCharData {
|
||||
/* 0x00 */ f32 posX;
|
||||
/* 0x04 */ f32 posY;
|
||||
/* 0x08 */ f32 field_0x08;
|
||||
/* 0x0C */ s16 field_0x0C;
|
||||
/* 0x0E */ wchar_t character;
|
||||
/* 0x10 */ s8 displayTimerMaybe;
|
||||
|
||||
void reset() {
|
||||
posX = 0.0f;
|
||||
posY = 0.0f;
|
||||
field_0x08 = dTagProcessor_c::fn_800B8040(0, 0);
|
||||
character = L'\0';
|
||||
field_0x0C = 1023;
|
||||
displayTimerMaybe = -1;
|
||||
}
|
||||
};
|
||||
|
||||
// Size 0x1554
|
||||
// Probably responsible for emitting characters
|
||||
// one by one in the text boxes
|
||||
class TextWindowUnk {
|
||||
public:
|
||||
TextWindowUnk(dTagProcessor_c *tagProcessor);
|
||||
virtual ~TextWindowUnk() {}
|
||||
|
||||
bool fn_800B2130(const char *, dTextBox_c *, dLytMsgWindowCharData *data, bool);
|
||||
void fn_800B2AA0();
|
||||
void textAdvancingRelated(bool, bool);
|
||||
|
||||
const wchar_t *getProcessedText() const {
|
||||
return mProcessedTextBuffer;
|
||||
}
|
||||
|
||||
u16 getField_0x147A() const {
|
||||
return field_0x147A;
|
||||
}
|
||||
|
||||
u16 getField_0x147C() const {
|
||||
return field_0x147C;
|
||||
}
|
||||
|
||||
bool checkEndReached() const;
|
||||
bool checkLastLineReached();
|
||||
bool reset();
|
||||
|
||||
private:
|
||||
/* 0x0004 */ dTagProcessor_c *mpTagProcessor;
|
||||
/* 0x0008 */ wchar_t mRawTextBuffer[1023];
|
||||
/* 0x0806 */ wchar_t mProcessedTextBuffer[1023];
|
||||
/* 0x1004 */ wchar_t mUnkBuffer[511]; // ???
|
||||
/* 0x1402 */ SizedString<64> field_0x1402;
|
||||
/* 0x1442 */ u8 _0x1442[0x144C - 0x1442];
|
||||
|
||||
/* 0x144C */ s32 mRawTextPos;
|
||||
/* 0x1450 */ s32 mRawTextEndPos;
|
||||
/* 0x1454 */ s32 mCurrentLine;
|
||||
/* 0x1458 */ s32 field_0x1458;
|
||||
/* 0x145C */ u8 _0x145C[0x1478 - 0x145C];
|
||||
/* 0x1478 */ u16 field_0x1478;
|
||||
/* 0x147A */ u16 field_0x147A;
|
||||
/* 0x147C */ u16 field_0x147C;
|
||||
/* 0x147E */ u8 _0x147E[0x1480 - 0x147E];
|
||||
/* 0x1480 */ dTextBox_c *mpTextBox;
|
||||
/* 0x1484 */ LineData mLineWidths;
|
||||
/* 0x1550 */ dLytMsgWindowCharData *mpCharacterData;
|
||||
};
|
||||
|
||||
class MsgWindowBlurRelated {
|
||||
public:
|
||||
MsgWindowBlurRelated() {}
|
||||
virtual ~MsgWindowBlurRelated() {}
|
||||
|
||||
void build();
|
||||
void remove();
|
||||
void drawTextBlur(dLytTextLight *thing, mVec2_c size, u8 alpha);
|
||||
void reset();
|
||||
|
||||
dLytMsgWindowCharData *getCharData() {
|
||||
return mData;
|
||||
}
|
||||
|
||||
private:
|
||||
dLytMsgWindowCharData mData[1023];
|
||||
};
|
||||
|
||||
#endif
|
||||
+40
-36
@@ -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();
|
||||
@@ -68,6 +68,10 @@ public:
|
||||
mpResAcc = resAcc;
|
||||
}
|
||||
|
||||
const nw4r::lyt::DrawInfo &getDrawInfo() {
|
||||
return mDrawInfo;
|
||||
}
|
||||
|
||||
protected:
|
||||
Layout_c mLayout;
|
||||
nw4r::lyt::DrawInfo mDrawInfo;
|
||||
@@ -79,11 +83,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);
|
||||
@@ -92,7 +96,7 @@ public:
|
||||
bool fn_800AB940(const char *name, int arg);
|
||||
bool fn_800AB9A0(dTextBox_c *textbox, int arg);
|
||||
|
||||
bool fn_800ABE50(dTextBox_c *textbox, int arg, void *unk);
|
||||
bool fn_800ABE50(dTextBox_c *textbox, wchar_t *destBuf, u32 maxLen);
|
||||
|
||||
private:
|
||||
void setPropertiesRecursive(nw4r::lyt::Pane *pane, f32, f32, f32, f32, f32);
|
||||
@@ -101,9 +105,10 @@ private:
|
||||
bool fn_800ABB80(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg);
|
||||
bool fn_800ABCE0(const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, int arg);
|
||||
|
||||
bool fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk);
|
||||
bool fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf, u32 maxLen);
|
||||
bool fn_800AC1AC(
|
||||
const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk
|
||||
const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf,
|
||||
u32 maxLen
|
||||
);
|
||||
MsbtInfo *getMsbtInfo() const;
|
||||
bool fn_800AB930(dTextBox_c *box);
|
||||
@@ -131,9 +136,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 +148,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,22 +185,15 @@ 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();
|
||||
void setForward();
|
||||
void setBackward();
|
||||
|
||||
inline void setFrameAndControlThings(f32 frame) {
|
||||
setDirection(false);
|
||||
setAnimEnable(true);
|
||||
mpFrameCtrl->setFrame(frame);
|
||||
syncAnmFrame();
|
||||
}
|
||||
|
||||
inline void play() {
|
||||
mpFrameCtrl->play();
|
||||
syncAnmFrame();
|
||||
@@ -205,12 +205,12 @@ struct AnmGroupBase_c {
|
||||
}
|
||||
|
||||
inline void setFrameRatio(f32 frame) {
|
||||
f32 end = getEndFrameRaw() - 1.0f;
|
||||
f32 end = getAnimDuration() - 1.0f;
|
||||
setFrame(end * frame);
|
||||
}
|
||||
|
||||
inline f32 getEndFrameRaw() const {
|
||||
return mpFrameCtrl->getEndFrameRaw();
|
||||
inline f32 getAnimDuration() const {
|
||||
return mpFrameCtrl->getAnimDuration();
|
||||
}
|
||||
|
||||
inline f32 getFrame() const {
|
||||
@@ -250,7 +250,7 @@ struct AnmGroupBase_c {
|
||||
return mpFrameCtrl->getFlags() == (FLAG_NO_LOOP | FLAG_BACKWARDS);
|
||||
}
|
||||
|
||||
inline bool isPlayingForwardsOnce() const {
|
||||
inline bool isPlayingForwardsOnce() const {
|
||||
return mpFrameCtrl->getFlags() == FLAG_NO_LOOP;
|
||||
}
|
||||
|
||||
@@ -275,6 +275,10 @@ struct AnmGroupBase_c {
|
||||
syncAnmFrame();
|
||||
}
|
||||
|
||||
inline f32 getRatio() const {
|
||||
return mpFrameCtrl->getRatio();
|
||||
}
|
||||
|
||||
inline void setBackwardsRatio(f32 ratio) {
|
||||
mpFrameCtrl->setBackwardsRatio(ratio);
|
||||
syncAnmFrame();
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef D_LYT_AUTO_CAPTION_H
|
||||
#define D_LYT_AUTO_CAPTION_H
|
||||
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.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 dLytAutoCaption_c : public dLytMsgWindowSubtype {
|
||||
public:
|
||||
dLytAutoCaption_c() : mStateMgr(*this) {}
|
||||
/* vt 0x08 */ virtual ~dLytAutoCaption_c() {}
|
||||
/* vt 0x0C */ virtual void draw() override;
|
||||
/* vt 0x10 */ virtual bool
|
||||
build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
|
||||
/* vt 0x14 */ virtual bool remove() override;
|
||||
/* vt 0x18 */ virtual bool execute() override;
|
||||
/* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
|
||||
/* vt 0x20 */ virtual bool isDoneOpening() const override;
|
||||
/* vt 0x24 */ virtual void close() override;
|
||||
/* vt 0x28 */ virtual bool isDoneClosing() const override;
|
||||
/* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
|
||||
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
|
||||
return mpTextboxes[0];
|
||||
}
|
||||
|
||||
STATE_FUNC_DECLARE(dLytAutoCaption_c, Invisible);
|
||||
STATE_FUNC_DECLARE(dLytAutoCaption_c, In);
|
||||
STATE_FUNC_DECLARE(dLytAutoCaption_c, OutputText);
|
||||
STATE_FUNC_DECLARE(dLytAutoCaption_c, Out);
|
||||
|
||||
bool checkSomethingMeter();
|
||||
|
||||
private:
|
||||
MSG_WINDOW_STATE_MGR_INLINE(dLytAutoCaption_c)
|
||||
/* 0x010 */ UI_STATE_MGR_DECLARE(dLytAutoCaption_c);
|
||||
/* 0x068 */ d2d::ResAccIf_c mResAcc;
|
||||
/* 0x3C4 */ d2d::LytBase_c mLyt;
|
||||
/* 0x44C */ d2d::AnmGroup_c mAnm[4];
|
||||
/* 0x54C */ dTextBox_c *mpTextboxes[2];
|
||||
/* 0x554 */ nw4r::lyt::Pane *mpPane;
|
||||
/* 0x558 */ dTagProcessor_c *mpTagProcessor;
|
||||
/* 0x55C */ bool mShouldBeOpen;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef D_LYT_AUTO_EXPLAIN_H
|
||||
#define D_LYT_AUTO_EXPLAIN_H
|
||||
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.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 dLytAutoExplain_c : public dLytMsgWindowSubtype {
|
||||
public:
|
||||
dLytAutoExplain_c() : mStateMgr(*this) {}
|
||||
/* vt 0x08 */ virtual ~dLytAutoExplain_c() {}
|
||||
/* vt 0x0C */ virtual void draw() override;
|
||||
/* vt 0x10 */ virtual bool
|
||||
build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
|
||||
/* vt 0x14 */ virtual bool remove() override;
|
||||
/* vt 0x18 */ virtual bool execute() override;
|
||||
/* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
|
||||
/* vt 0x20 */ virtual bool isDoneOpening() const override;
|
||||
/* vt 0x24 */ virtual void close() override;
|
||||
/* vt 0x28 */ virtual bool isDoneClosing() const override;
|
||||
/* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
|
||||
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
|
||||
return mpTextboxes[0];
|
||||
}
|
||||
|
||||
STATE_FUNC_DECLARE(dLytAutoExplain_c, Invisible);
|
||||
STATE_FUNC_DECLARE(dLytAutoExplain_c, In);
|
||||
STATE_FUNC_DECLARE(dLytAutoExplain_c, OutputText);
|
||||
STATE_FUNC_DECLARE(dLytAutoExplain_c, Out);
|
||||
|
||||
bool checkSomethingMeter();
|
||||
|
||||
private:
|
||||
MSG_WINDOW_STATE_MGR_INLINE(dLytAutoExplain_c)
|
||||
/* 0x010 */ UI_STATE_MGR_DECLARE(dLytAutoExplain_c);
|
||||
/* 0x068 */ d2d::ResAccIf_c mResAcc;
|
||||
/* 0x3C4 */ d2d::LytBase_c mLyt;
|
||||
/* 0x44C */ d2d::AnmGroup_c mAnm[3];
|
||||
/* 0x50C */ dTextBox_c *mpTextboxes[2];
|
||||
/* 0x514 */ nw4r::lyt::Pane *mpPane;
|
||||
/* 0x518 */ dTagProcessor_c *mpTagProcessor;
|
||||
/* 0x51C */ bool mShouldBeOpen;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,89 @@
|
||||
#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();
|
||||
}
|
||||
|
||||
bool 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;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
dLytCommonArrow_c();
|
||||
virtual ~dLytCommonArrow_c() {}
|
||||
|
||||
bool init();
|
||||
bool build();
|
||||
|
||||
STATE_FUNC_DECLARE(dLytCommonArrow_c, None);
|
||||
STATE_FUNC_DECLARE(dLytCommonArrow_c, In);
|
||||
@@ -20,20 +20,20 @@ public:
|
||||
STATE_FUNC_DECLARE(dLytCommonArrow_c, Out);
|
||||
|
||||
void setState(s32 state);
|
||||
bool addToDrawList();
|
||||
bool draw();
|
||||
|
||||
bool fn_80168490();
|
||||
bool fn_80168500();
|
||||
void setTranslate(const Vec *);
|
||||
bool remove();
|
||||
bool execute();
|
||||
bool requestIn();
|
||||
bool requestOut();
|
||||
bool fn_80168760();
|
||||
void displayElement(s32, f32);
|
||||
void fn_80168800(s32);
|
||||
void fn_80168810(d2d::AnmGroup_c *);
|
||||
void fn_80168880();
|
||||
|
||||
private:
|
||||
void setTranslate(const Vec *);
|
||||
bool fn_80168760();
|
||||
void displayElement(s32, f32);
|
||||
void unbindAt(s32);
|
||||
void tickDown(d2d::AnmGroup_c *);
|
||||
void fn_80168880();
|
||||
UI_STATE_MGR_DECLARE(dLytCommonArrow_c);
|
||||
/* 0x40 */ d2d::LytBase_c mLytBase;
|
||||
d2d::ResAccIf_c mResAcc;
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
void setNumberColor(u8 color);
|
||||
void setOn();
|
||||
void setOff();
|
||||
void startDecide();
|
||||
void startConfirm();
|
||||
bool isDoneDeciding() const;
|
||||
|
||||
private:
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
void setNumberColor(u8 color);
|
||||
void setOn();
|
||||
void setOff();
|
||||
void startDecide();
|
||||
void startConfirm();
|
||||
bool isDoneDeciding() const;
|
||||
void setShieldOnOff(bool onOff);
|
||||
|
||||
@@ -264,7 +264,7 @@ public:
|
||||
|
||||
/** The "decide" animation in the scrap shop makes the selected item flash for a
|
||||
short time before showing the upgrade screen */
|
||||
void startDecide();
|
||||
void startConfirm();
|
||||
bool isDoneDeciding() const;
|
||||
|
||||
void setShieldOnOff(bool onOff);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef D_LYT_CONTROL_GAME_H
|
||||
#define D_LYT_CONTROL_GAME_H
|
||||
|
||||
#include "d/d_base.h"
|
||||
|
||||
class dLytControlGame_c : public dBase_c {
|
||||
public:
|
||||
dLytControlGame_c();
|
||||
virtual ~dLytControlGame_c();
|
||||
|
||||
bool isInSomeMapState() const;
|
||||
bool isNotInStateMap() const;
|
||||
|
||||
void fn_802CCD40(bool);
|
||||
|
||||
static dLytControlGame_c *getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static dLytControlGame_c *sInstance;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -263,6 +263,8 @@ public:
|
||||
|
||||
void build();
|
||||
|
||||
bool isOpenMaybe() const;
|
||||
|
||||
STATE_FUNC_DECLARE(dLytMapMain_c, Invisible);
|
||||
STATE_FUNC_DECLARE(dLytMapMain_c, RenderingWait);
|
||||
STATE_FUNC_DECLARE(dLytMapMain_c, In);
|
||||
@@ -369,6 +371,14 @@ public:
|
||||
return &sInstance->mResAcc;
|
||||
}
|
||||
|
||||
static dLytMap_c *getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
bool isOpenMaybe() const {
|
||||
return mMapMain.isOpenMaybe();
|
||||
}
|
||||
|
||||
void build();
|
||||
|
||||
private:
|
||||
|
||||
+71
-11
@@ -2,56 +2,116 @@
|
||||
#define D_LYT_TEXTBOX_H
|
||||
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "libms/msgfile.h"
|
||||
#include "nw4r/lyt/lyt_drawInfo.h"
|
||||
#include "nw4r/lyt/lyt_textBox.h"
|
||||
#include "nw4r/lyt/lyt_types.h"
|
||||
#include "nw4r/ut/ut_Rect.h"
|
||||
#include "nw4r/ut/ut_TextWriterBase.h"
|
||||
|
||||
class dTagProcessor_c;
|
||||
|
||||
class dTextBox_c : public nw4r::lyt::TextBox {
|
||||
friend class dWindow_c;
|
||||
|
||||
public:
|
||||
dTextBox_c(const nw4r::lyt::res::TextBox *pBlock, const nw4r::lyt::ResBlockSet &ResBlockSet);
|
||||
dTextBox_c(const nw4r::lyt::res::TextBox *pBlock, const nw4r::lyt::ResBlockSet &resBlockSet);
|
||||
virtual void DrawSelf(const nw4r::lyt::DrawInfo &drawInfo) override; // at 0x18
|
||||
|
||||
f32 GetLineWidth(f32 *pOutSpacing);
|
||||
f32 GetLineWidth(f32 *pOutSpacing) const;
|
||||
f32 GetLinesHeight() const;
|
||||
f32 GetUnkWidthRatio() const;
|
||||
|
||||
void setLytBase(d2d::LytBase_c *lytBase) {
|
||||
mpLytBase = lytBase;
|
||||
}
|
||||
|
||||
void SetScale(f32 scale) {
|
||||
nw4r::lyt::Size value(mTextScale);
|
||||
nw4r::lyt::Size value(mMyTextScale);
|
||||
value.width *= scale;
|
||||
value.height *= scale;
|
||||
mScale = scale;
|
||||
mMyScale = scale;
|
||||
MySetScale(value);
|
||||
nw4r::lyt::TextBox::SetFontSize(value);
|
||||
}
|
||||
|
||||
void set0x1F6(u8 val) {
|
||||
field_0x1F6 = val;
|
||||
}
|
||||
|
||||
void set0x1F8(u8 val) {
|
||||
field_0x1F8 = val;
|
||||
}
|
||||
|
||||
f32 getMyScale() const {
|
||||
return mScale;
|
||||
return mMyScale;
|
||||
}
|
||||
|
||||
void fn_800E0A60(const char *area, ...) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void fn_800AF930(const wchar_t *);
|
||||
void setTextWithGlobalTextProcessor(const wchar_t *str);
|
||||
void setTextWithGlobalTextProcessor(const wchar_t *str, void *, ...);
|
||||
void setMessageWithGlobalTextProcessor(const char *labelId, void *unused, void *, ...);
|
||||
void setMessageWithGlobalTextProcessorV(const char *labelId, void *unused, void *, va_list list);
|
||||
void setTextWithTextProcessor(const wchar_t *str, dTagProcessor_c *tagProcessor, void *, ...);
|
||||
s32 calcTextLines(const wchar_t *src, dTagProcessor_c *tagProcessor);
|
||||
|
||||
void setMessageWithGlobalTextProcessorAndMsbtInfo(const MsbtInfo *info, const char *labelId, wchar_t *destBuf, u32 maxLen);
|
||||
|
||||
void loadTextFormatVars();
|
||||
void setupGX() const;
|
||||
|
||||
// @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:
|
||||
void init();
|
||||
void MySetFontSize(const nw4r::lyt::Size &value);
|
||||
void MySetScale(const nw4r::lyt::Size &value);
|
||||
|
||||
void setTextWithGlobalTextProcessorV(const wchar_t *str, void *, va_list list);
|
||||
void setTextWithTextProcessorV(const wchar_t *str, dTagProcessor_c *tagProcessor, void *, va_list list);
|
||||
|
||||
nw4r::ut::Rect GetMyTextDrawRect(nw4r::ut::TextWriterBase<wchar_t> *pWriter, bool *pbWideScreenUnk) const;
|
||||
|
||||
f32 resizeTextToFit(f32 maxWidth);
|
||||
bool hasDynamicText();
|
||||
void someDebugCheckMaybe();
|
||||
|
||||
int GetStoredLineStrNum(int i, f32 *pLineWidth, bool *pbOver) const {
|
||||
*pbOver = mbOvers[i];
|
||||
*pLineWidth = mLineWidths[i];
|
||||
return mLineStrNums[i];
|
||||
}
|
||||
|
||||
void SetStoredLineStrNum(int i, f32 lineWidth, int lineStrNum, bool bOver) {
|
||||
mLineWidths[i] = lineWidth;
|
||||
mLineStrNums[i] = lineStrNum;
|
||||
mbOvers[i] = bOver;
|
||||
}
|
||||
|
||||
/* 0x104 */ d2d::LytBase_c *mpLytBase;
|
||||
/* 0x108 */ u8 field_0x108[0x118 - 0x108];
|
||||
/* 0x118 */ nw4r::lyt::Size mTextScale;
|
||||
/* 0x120 */ f32 mScale;
|
||||
/* 0x124 */ u8 field_0x124[0x1F8 - 0x124];
|
||||
/* 0x108 */ f32 mFixedWidth;
|
||||
/* 0x10C */ u8 mIsWidthFixed;
|
||||
/* 0x114 */ nw4r::lyt::Size mMyFontSize;
|
||||
/* 0x118 */ nw4r::lyt::Size mMyTextScale;
|
||||
/* 0x120 */ f32 mMyScale;
|
||||
/* 0x124 */ nw4r::ut::TextWriterBase<wchar_t> mTextWriter;
|
||||
/* 0x188 */ nw4r::ut::Rect field_0x188;
|
||||
/* 0x198 */ u32 mLineStrNums[10];
|
||||
/* 0x1C0 */ u8 mFontIdx;
|
||||
/* 0x1C1 */ u8 mWindowSubtype;
|
||||
/* 0x1C4 */ f32 mLineWidths[10];
|
||||
/* 0x1EC */ bool mbOvers[10];
|
||||
/* 0x1F6 */ u8 field_0x1F6;
|
||||
/* 0x1F7 */ u8 field_0x1F7;
|
||||
/* 0x1F8 */ u8 field_0x1F8;
|
||||
/* 0x1F9 */ u8 field_0x1F9[0x204 - 0x1F9];
|
||||
/* 0x1F9 */ bool field_0x1F9;
|
||||
/* 0x1FA */ u8 field_0x1FA;
|
||||
/* 0x1FC */ dTagProcessor_c *mpMyTagProcessor;
|
||||
/* 0x200 */ bool mHasTextWriter;
|
||||
/* 0x201 */ bool field_0x201;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
#ifndef D_LYT_MSG_WINDOW_H
|
||||
#define D_LYT_MSG_WINDOW_H
|
||||
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textwindow_unk.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_select_btn.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "sized_string.h"
|
||||
|
||||
// Forward declarations required for vtable order
|
||||
class dLytMsgWindowTalk_c;
|
||||
class dLytMsgWindowLink_c;
|
||||
class dLytMsgWindowGet_c;
|
||||
class dLytMsgWindowSword_c;
|
||||
class dLytMsgWindowWood_c;
|
||||
class dLytMsgWindowStone_c;
|
||||
class dLytMsgWindowDemo_c;
|
||||
class dLytAutoExplain_c;
|
||||
class dLytAutoCaption_c;
|
||||
|
||||
struct dLytMsgWindowCharData;
|
||||
|
||||
class dLytMsgWindow_c {
|
||||
public:
|
||||
dLytMsgWindow_c() : mStateMgr(*this) {}
|
||||
virtual ~dLytMsgWindow_c() {}
|
||||
|
||||
bool build();
|
||||
bool remove();
|
||||
bool execute();
|
||||
bool draw();
|
||||
|
||||
bool isVisible() const;
|
||||
bool isOutputtingText() const;
|
||||
|
||||
void setCurrentLabelName(const char *name, bool storeFile);
|
||||
void setCurrentEntrypointName(const char *name);
|
||||
void setCurrentFlowFilename(const char *name);
|
||||
|
||||
static dLytMsgWindow_c *getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
SizedString<64> getLabel() const {
|
||||
return mNameCopy;
|
||||
}
|
||||
|
||||
const char *fn_80117390(bool) const;
|
||||
|
||||
private:
|
||||
bool setTextToDisplay(const wchar_t *text);
|
||||
void createSubMsgManager(u8 type);
|
||||
void removeSubMsgManagers();
|
||||
bool fn_8011A5D0() const;
|
||||
|
||||
static dLytMsgWindow_c *sInstance;
|
||||
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, Invisible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, In);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, OutputText);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyChangePage0);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyChangePage1);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyMsgEnd0);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyMsgEnd1);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyMsgEnd2);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeySelectQuestion);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, MapOpen);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, WaitKeyMapClose);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, MapClose);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, Out);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, ExplainIn);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, ExplainVisible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, ExplainOut);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, DemoIn);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, DemoVisible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindow_c, DemoOut);
|
||||
|
||||
/* 0x004 */ UI_STATE_MGR_DECLARE(dLytMsgWindow_c);
|
||||
/* 0x040 */ d2d::ResAccIf_c mResAcc1;
|
||||
/* 0x3B0 */ d2d::ResAccIf_c mResAcc2;
|
||||
|
||||
/* 0x720 */ TextWindowUnk *mpMsgWindowUnk;
|
||||
/* 0x724 */ dTagProcessor_c *mpTagProcessor;
|
||||
|
||||
/* 0x728 */ dLytMsgWindowSubtype *mpCurrentSubtype;
|
||||
/* 0x72C */ dLytMsgWindowTalk_c *mpWindowTalk;
|
||||
/* 0x730 */ dLytMsgWindowLink_c *mpWindowLink;
|
||||
/* 0x734 */ dLytMsgWindowSword_c *mpWindowSword;
|
||||
/* 0x738 */ dLytMsgWindowWood_c *mpWindowWood;
|
||||
/* 0x73C */ dLytMsgWindowStone_c *mpWindowStone;
|
||||
/* 0x740 */ dLytMsgWindowGet_c *mpWindowGet;
|
||||
/* 0x744 */ dLytMsgWindowDemo_c *mpWindowDemo;
|
||||
/* 0x748 */ dLytAutoExplain_c *mpAutoExplain;
|
||||
/* 0x74C */ dLytAutoCaption_c *mpAutoCaption;
|
||||
|
||||
/* 0x750 */ u8 _0x750[0x75C - 0x750];
|
||||
/* 0x75C */ mVec3_c field_0x75C;
|
||||
/* 0x768 */ mVec3_c field_0x768;
|
||||
/* 0x774 */ s32 field_0x774;
|
||||
/* 0x778 */ s32 field_0x778;
|
||||
/* 0x77C */ s32 field_0x77C;
|
||||
/* 0x780 */ s32 field_0x780;
|
||||
/* 0x784 */ s32 field_0x784;
|
||||
|
||||
/* 0x788 */ u16 mEntryPointToTrigger;
|
||||
/* 0x78A */ u16 mAlsoEntryPointToTrigger;
|
||||
|
||||
/* 0x78C */ SizedString<0x40> mName;
|
||||
/* 0x7CC */ SizedString<0x40> mNameCopy;
|
||||
|
||||
/* 0x80C */ u8 field_0x80C;
|
||||
/* 0x80D */ u8 field_0x80D;
|
||||
/* 0x80E */ u8 field_0x80E;
|
||||
/* 0x80F */ u8 mShowAutoMessage;
|
||||
/* 0x810 */ u8 field_0x810;
|
||||
/* 0x811 */ u8 field_0x811;
|
||||
/* 0x812 */ u8 field_0x812;
|
||||
/* 0x813 */ u8 field_0x813;
|
||||
/* 0x814 */ u8 field_0x814;
|
||||
/* 0x815 */ u8 field_0x815;
|
||||
/* 0x816 */ u8 field_0x816;
|
||||
/* 0x817 */ u8 field_0x817;
|
||||
/* 0x818 */ u8 field_0x818;
|
||||
/* 0x819 */ u8 field_0x819;
|
||||
/* 0x81A */ u8 field_0x81A;
|
||||
/* 0x81B */ u8 field_0x81B;
|
||||
/* 0x81C */ u8 field_0x81C;
|
||||
/* 0x81D */ u8 field_0x81D;
|
||||
/* 0x81E */ u8 field_0x81E;
|
||||
|
||||
/* 0x820 */ u16 field_0x820;
|
||||
/* 0x824 */ s32 field_0x824;
|
||||
/* 0x828 */ dLytMsgWindowCharData *field_0x828;
|
||||
|
||||
/* 0x82C */ u32 mTextOptionSelection;
|
||||
/* 0x830 */ u32 mSpecialFiMenuValue;
|
||||
|
||||
/* 0x834 */ dLytMsgWindowSelectBtn_c mSelectBtn;
|
||||
/* 0x1208 */ SizedString<8> mCurrentEntrypointName;
|
||||
/* 0x1210 */ SizedString<16> mCurrentFlowFileName;
|
||||
/* 0x1220 */ u8 field_0x1220;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,91 @@
|
||||
#ifndef D_LYT_MGS_WINDOW_COMMON_H
|
||||
#define D_LYT_MGS_WINDOW_COMMON_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "m/m2d.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
|
||||
#define MSG_WINDOW_STATE_MGR_INLINE(className) void changeState(const sFStateID_c<className> &newState) { mStateMgr.changeState(newState); }
|
||||
|
||||
class dLytMsgWindowSubtype : public m2d::Base_c {
|
||||
public:
|
||||
/* vt 0x08 */ virtual ~dLytMsgWindowSubtype() {}
|
||||
// vt 0x0C = m2d::Base_c::draw
|
||||
/* vt 0x10 */ virtual bool build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor);
|
||||
/* vt 0x14 */ virtual bool remove();
|
||||
/* vt 0x18 */ virtual bool execute();
|
||||
/* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param);
|
||||
/* vt 0x20 */ virtual bool isDoneOpening() const;
|
||||
/* vt 0x24 */ virtual void close();
|
||||
/* vt 0x28 */ virtual bool isDoneClosing() const;
|
||||
/* vt 0x2C */ virtual bool setText(const wchar_t *text);
|
||||
/* vt 0x30 */ virtual dTextBox_c *getTextBox() {
|
||||
return nullptr;
|
||||
}
|
||||
/* vt 0x34 */ virtual bool startConfirm() {
|
||||
return true;
|
||||
}
|
||||
/* vt 0x38 */ virtual bool startDecide(bool b) {
|
||||
return true;
|
||||
}
|
||||
/* vt 0x3C */ virtual bool isDoneDecide() const {
|
||||
return true;
|
||||
}
|
||||
/* vt 0x40 */ virtual bool vt_0x40() const {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class dLytTextSword {
|
||||
public:
|
||||
enum ESwordType {
|
||||
FI,
|
||||
GHIRAHIM,
|
||||
LASTBOSS,
|
||||
};
|
||||
|
||||
dLytTextSword() {}
|
||||
/* vt at 0x00 */
|
||||
virtual ~dLytTextSword() {}
|
||||
|
||||
bool build(d2d::ResAccIf_c *pResAcc, ESwordType type);
|
||||
bool remove();
|
||||
void draw(const wchar_t *str, s8 frame, mVec3_c pos, f32 scale);
|
||||
f32 getAnimDuration() const;
|
||||
|
||||
private:
|
||||
/* 0x04 */ d2d::LytBase_c mLyt;
|
||||
/* 0x94 */ d2d::AnmGroup_c mAnm;
|
||||
/* 0xD4 */ dTextBox_c *mpTexts[3];
|
||||
/* 0xE0 */ nw4r::lyt::Pane *mpPane;
|
||||
/* 0xE4 */ ESwordType mType;
|
||||
};
|
||||
|
||||
class dLytTextLight {
|
||||
public:
|
||||
enum ETextType {
|
||||
NORMAL,
|
||||
DEMO,
|
||||
};
|
||||
|
||||
dLytTextLight() {}
|
||||
/* vt at 0x00 */
|
||||
virtual ~dLytTextLight() {}
|
||||
|
||||
bool build(d2d::ResAccIf_c *pResAcc, ETextType type);
|
||||
bool remove();
|
||||
void draw(s8 frame, mVec3_c pos, u8 alpha, f32 scale);
|
||||
f32 getAnimDuration() const;
|
||||
|
||||
private:
|
||||
/* 0x04 */ d2d::LytBase_c mLyt;
|
||||
/* 0x94 */ d2d::AnmGroup_c mAnm;
|
||||
/* 0xD4 */ nw4r::lyt::Pane *mpPane;
|
||||
/* 0xD8 */ ETextType mType;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef D_LYT_MSG_WINDOW_DEMO_H
|
||||
#define D_LYT_MSG_WINDOW_DEMO_H
|
||||
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textwindow_unk.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "sized_string.h"
|
||||
|
||||
class dLytMsgWindowDemo_c : public dLytMsgWindowSubtype {
|
||||
public:
|
||||
dLytMsgWindowDemo_c() : mStateMgr(*this) {}
|
||||
/* vt 0x08 */ virtual ~dLytMsgWindowDemo_c() {}
|
||||
/* vt 0x0C */ virtual void draw() override;
|
||||
/* vt 0x10 */ virtual bool
|
||||
build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
|
||||
/* vt 0x14 */ virtual bool remove() override;
|
||||
/* vt 0x18 */ virtual bool execute() override;
|
||||
/* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
|
||||
/* vt 0x20 */ virtual bool isDoneOpening() const override;
|
||||
/* vt 0x24 */ virtual void close() override;
|
||||
/* vt 0x28 */ virtual bool isDoneClosing() const override;
|
||||
/* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
|
||||
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
|
||||
return mpTextboxes[0];
|
||||
}
|
||||
|
||||
dLytMsgWindowCharData *getCharData() {
|
||||
return mBlurRelated.getCharData();
|
||||
}
|
||||
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowDemo_c, Invisible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowDemo_c, In);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowDemo_c, Visible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowDemo_c, Out);
|
||||
|
||||
private:
|
||||
static SizedString<64> getTextLabel();
|
||||
|
||||
MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowDemo_c)
|
||||
/* 0x010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowDemo_c);
|
||||
/* 0x04C */ d2d::ResAccIf_c mResAcc;
|
||||
/* 0x3BC */ d2d::LytBase_c mLyt;
|
||||
/* 0x44C */ d2d::AnmGroup_c mAnm[2];
|
||||
|
||||
/* 0x4CC */ nw4r::lyt::Pane *mpPane;
|
||||
/* 0x4D0 */ dTextBox_c *mpTextboxes[2];
|
||||
/* 0x4D8 */ dTagProcessor_c *mpTagProcessor;
|
||||
/* 0x4DC */ mVec2_c mOffsets[2];
|
||||
/* 0x4EC */ dLytTextLight mText;
|
||||
/* 0x5C8 */ MsgWindowBlurRelated mBlurRelated;
|
||||
|
||||
/* 0x55B8 */ bool mShouldBeOpen;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
#ifndef D_LYT_MSG_WINDOW_GET_H
|
||||
#define D_LYT_MSG_WINDOW_GET_H
|
||||
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textwindow_unk.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 "m/m_vec.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
class dLytMsgWindowGet_c : public dLytMsgWindowSubtype {
|
||||
public:
|
||||
dLytMsgWindowGet_c() : mStateMgr(*this) {}
|
||||
/* vt 0x08 */ virtual ~dLytMsgWindowGet_c() {}
|
||||
/* vt 0x0C */ virtual void draw() override;
|
||||
/* vt 0x10 */ virtual bool
|
||||
build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
|
||||
/* vt 0x14 */ virtual bool remove() override;
|
||||
/* vt 0x18 */ virtual bool execute() override;
|
||||
/* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
|
||||
/* vt 0x20 */ virtual bool isDoneOpening() const override;
|
||||
/* vt 0x24 */ virtual void close() override;
|
||||
/* vt 0x28 */ virtual bool isDoneClosing() const override;
|
||||
/* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
|
||||
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
|
||||
return mpTextboxes[0];
|
||||
}
|
||||
/* vt 0x34 */ virtual bool startConfirm() override {
|
||||
return mBtn.requestIn();
|
||||
}
|
||||
/* vt 0x38 */ virtual bool startDecide(bool b) override {
|
||||
return mBtn.requestOut(b);
|
||||
}
|
||||
/* vt 0x3C */ virtual bool isDoneDecide() const override {
|
||||
return mBtn.isDoneOut();
|
||||
}
|
||||
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowGet_c, Invisible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowGet_c, In);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowGet_c, Visible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowGet_c, Out);
|
||||
|
||||
dLytMsgWindowCharData *getCharData() {
|
||||
return mBlurRelated.getCharData();
|
||||
}
|
||||
|
||||
private:
|
||||
MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowGet_c)
|
||||
/* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowGet_c);
|
||||
/* 0x004C */ d2d::SubPaneList mSubpaneList;
|
||||
/* 0x005C */ d2d::SubPaneListNode mNodes[1];
|
||||
/* 0x0068 */ d2d::ResAccIf_c mResAcc;
|
||||
/* 0x03D8 */ d2d::LytBase_c mLyt;
|
||||
/* 0x0468 */ d2d::AnmGroup_c mAnm[3];
|
||||
/* 0x0528 */ dTextBox_c *mpTextboxes[2];
|
||||
/* 0x0530 */ nw4r::lyt::Pane *mpPanes[6];
|
||||
/* 0x0548 */ dTagProcessor_c *mpTagProcessor;
|
||||
/* 0x054C */ mVec2_c mOffset;
|
||||
/* 0x0554 */ dLytCommonABtn_c mBtn;
|
||||
/* 0x06E0 */ dLytTextLight mText;
|
||||
/* 0x07C4 */ MsgWindowBlurRelated mBlurRelated;
|
||||
|
||||
/* 0x55B8 */ bool mShouldBeOpen;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef D_LYT_MSG_WINDOW_LINK_H
|
||||
#define D_LYT_MSG_WINDOW_LINK_H
|
||||
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textwindow_unk.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 "s/s_State.hpp"
|
||||
|
||||
class dLytMsgWindowLink_c : public dLytMsgWindowSubtype {
|
||||
public:
|
||||
dLytMsgWindowLink_c() : mStateMgr(*this) {}
|
||||
/* vt 0x08 */ virtual ~dLytMsgWindowLink_c() {}
|
||||
/* vt 0x0C */ virtual void draw() override;
|
||||
/* vt 0x10 */ virtual bool
|
||||
build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
|
||||
/* vt 0x14 */ virtual bool remove() override;
|
||||
/* vt 0x18 */ virtual bool execute() override;
|
||||
/* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
|
||||
/* vt 0x20 */ virtual bool isDoneOpening() const override;
|
||||
/* vt 0x24 */ virtual void close() override;
|
||||
/* vt 0x28 */ virtual bool isDoneClosing() const override;
|
||||
/* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
|
||||
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
|
||||
return mpTextboxes[0];
|
||||
}
|
||||
/* vt 0x34 */ virtual bool startConfirm() override {
|
||||
return mBtn.requestIn();
|
||||
}
|
||||
/* vt 0x38 */ virtual bool startDecide(bool b) override {
|
||||
return mBtn.requestOut(b);
|
||||
}
|
||||
/* vt 0x3C */ virtual bool isDoneDecide() const override {
|
||||
return mBtn.isDoneOut();
|
||||
}
|
||||
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Invisible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowLink_c, In);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Wait);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Visible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowLink_c, Out);
|
||||
|
||||
dLytMsgWindowCharData *getCharData() {
|
||||
return mBlurRelated.getCharData();
|
||||
}
|
||||
|
||||
private:
|
||||
MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowLink_c)
|
||||
/* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowLink_c);
|
||||
/* 0x004C */ d2d::SubPaneList mSubpaneList;
|
||||
/* 0x005C */ d2d::SubPaneListNode mNodes[1];
|
||||
/* 0x0068 */ d2d::ResAccIf_c mResAcc;
|
||||
/* 0x03D8 */ d2d::LytBase_c mLyt;
|
||||
/* 0x0468 */ d2d::AnmGroup_c mAnm[4];
|
||||
/* 0x0568 */ dTextBox_c *mpTextboxes[2];
|
||||
/* 0x0570 */ nw4r::lyt::Pane *mpPanes[5];
|
||||
/* 0x0584 */ dTagProcessor_c *mpTagProcessor;
|
||||
/* 0x0588 */ mVec3_c mTranslationOrig;
|
||||
/* 0x0594 */ mVec3_c mTranslationTo;
|
||||
/* 0x05A0 */ mVec3_c mTranslationFrom;
|
||||
/* 0x05AC */ mVec2_c mOffset;
|
||||
/* 0x05B4 */ dAcObjBase_c *mpActor;
|
||||
/* 0x05B8 */ s32 mParam;
|
||||
/* 0x05BC */ s32 mWaitDelay;
|
||||
/* 0x05C0 */ dLytCommonABtn_c mBtn;
|
||||
/* 0x0770 */ dLytTextLight mText;
|
||||
/* 0x084C */ MsgWindowBlurRelated mBlurRelated;
|
||||
/* 0x583C */ bool mShouldBeOpen;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,149 @@
|
||||
#ifndef D_LYT_MSG_WINDOW_SELECT_BTN_H
|
||||
#define D_LYT_MSG_WINDOW_SELECT_BTN_H
|
||||
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/d_window.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
// Size 0x54?
|
||||
struct SelectBtnHelper {
|
||||
SelectBtnHelper();
|
||||
~SelectBtnHelper();
|
||||
|
||||
/* 0x00 */ nw4r::lyt::Pane *panes[9];
|
||||
/* 0x24 */ u8 _0x24[0x34 - 0x24];
|
||||
/* 0x34 */ f32 field_0x34;
|
||||
/* 0x38 */ f32 field_0x38;
|
||||
/* 0x3C */ f32 field_0x3C;
|
||||
/* 0x40 */ f32 field_0x40;
|
||||
/* 0x44 */ s32 field_0x44;
|
||||
/* 0x48 */ s32 field_0x48;
|
||||
/* 0x4C */ s32 field_0x4C;
|
||||
/* 0x50 */ s8 field_0x50;
|
||||
/* 0x51 */ s8 field_0x51;
|
||||
/* 0x52 */ s8 field_0x52;
|
||||
|
||||
f32 fn_8011D690(s32);
|
||||
void fn_8011C970();
|
||||
u8 fn_8011CAC0();
|
||||
};
|
||||
|
||||
class dLytMsgWindowSelectBtnParts_c {
|
||||
friend class dLytMsgWindowSelectBtn_c;
|
||||
|
||||
public:
|
||||
dLytMsgWindowSelectBtnParts_c() : mStateMgr(*this) {}
|
||||
|
||||
void init();
|
||||
void execute();
|
||||
|
||||
private:
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtnParts_c, Wait);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtnParts_c, On);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtnParts_c, Select);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtnParts_c, Off);
|
||||
|
||||
/* 0x00 */ UI_STATE_MGR_DECLARE(dLytMsgWindowSelectBtnParts_c);
|
||||
/* 0x3C */ d2d::AnmGroup_c *mpAnms[3];
|
||||
/* 0x48 */ u32 field_0x48;
|
||||
/* 0x4C */ u32 field_0x4C;
|
||||
/* 0x50 */ u8 field_0x50;
|
||||
};
|
||||
|
||||
class dLytMsgWindowSelectBtn_c : public d2d::dSubPane {
|
||||
public:
|
||||
dLytMsgWindowSelectBtn_c() : mStateMgr(*this) {}
|
||||
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();
|
||||
}
|
||||
|
||||
virtual ~dLytMsgWindowSelectBtn_c() {}
|
||||
|
||||
bool draw();
|
||||
|
||||
s32 getField_0x9B4() const {
|
||||
return field_0x9B4;
|
||||
}
|
||||
|
||||
void setField_0x9B8(s32 value) {
|
||||
field_0x9B8 = value;
|
||||
}
|
||||
|
||||
void setField_0x9BC(s32 value) {
|
||||
field_0x9BC = value;
|
||||
}
|
||||
|
||||
void setField_0x990(s32 value) {
|
||||
mBtnHelper.field_0x4C = value;
|
||||
}
|
||||
|
||||
void setField_0x998(dTagProcessor_c *value) {
|
||||
mpTagProcessor = value;
|
||||
}
|
||||
|
||||
void fn_8011E5D0(u32, bool);
|
||||
|
||||
dTextBox_c *getSelectTextBox(s32 option, s32 idx) const {
|
||||
return mpSelectTextBoxes[option][idx];
|
||||
}
|
||||
|
||||
BOOL isStateWait() {
|
||||
return *mStateMgr.getStateID() == StateID_Wait;
|
||||
}
|
||||
|
||||
private:
|
||||
s32 fn_8011FE50();
|
||||
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, Wait);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, In);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, WaitSelect);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, CursorInOut);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, WaitDecide);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, WaitCancel);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, Out);
|
||||
|
||||
/* 0x008 */ UI_STATE_MGR_DECLARE(dLytMsgWindowSelectBtn_c);
|
||||
/* 0x044 */ d2d::dLytSub mLyt;
|
||||
/* 0x0D8 */ d2d::AnmGroup_c mAnm[27];
|
||||
/* 0x798 */ nw4r::lyt::Pane *mpSelectPanes[7];
|
||||
/* 0x7B4 */ dTextBox_c *mpSelectTextBoxes[4][2];
|
||||
/* 0x7D4 */ dTextBox_c *mpDecideTextBoxes[2];
|
||||
/* 0x7DC */ nw4r::lyt::Pane *mpBoundings[4];
|
||||
/* 0x7EC */ dWindow_c *mpWindow;
|
||||
/* 0x7F0 */ dTextBox_c *mpSizeBox;
|
||||
/* 0x7F4 */ dLytMsgWindowSelectBtnParts_c mParts[4];
|
||||
/* 0x944 */ SelectBtnHelper mBtnHelper;
|
||||
/* 0x998 */ dTagProcessor_c *mpTagProcessor;
|
||||
/* 0x99C */ s32 field_0x99C;
|
||||
/* 0x9A0 */ s32 field_0x9A0;
|
||||
/* 0x9A4 */ u8 field_0x9A4;
|
||||
/* 0x9A8 */ s32 field_0x9A8;
|
||||
/* 0x9AC */ void *field_0x9AC;
|
||||
/* 0x9B0 */ s32 field_0x9B0;
|
||||
/* 0x9B0 */ s32 field_0x9B4;
|
||||
/* 0x9B8 */ s32 field_0x9B8;
|
||||
/* 0x9BC */ s32 field_0x9BC;
|
||||
/* 0x9C0 */ s32 field_0x9C0;
|
||||
/* 0x9C4 */ void *field_0x9C4;
|
||||
/* 0x9C8 */ s32 field_0x9C8;
|
||||
/* 0x9CC */ s8 field_0x9CC;
|
||||
/* 0x9CD */ u8 field_0x9CD;
|
||||
/* 0x9CE */ u8 field_0x9CE;
|
||||
/* 0x9CF */ u8 field_0x9CF;
|
||||
/* 0x9D0 */ u8 field_0x9D0;
|
||||
/* 0x9D1 */ u8 field_0x9D1;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
#ifndef D_LYT_MSG_WINDOW_STONE_H
|
||||
#define D_LYT_MSG_WINDOW_STONE_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 dLytMsgWindowStone_c : public dLytMsgWindowSubtype {
|
||||
public:
|
||||
dLytMsgWindowStone_c() : mStateMgr(*this) {}
|
||||
/* vt 0x08 */ virtual ~dLytMsgWindowStone_c() {}
|
||||
/* vt 0x0C */ virtual void draw() override;
|
||||
/* vt 0x10 */ virtual bool
|
||||
build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
|
||||
/* vt 0x14 */ virtual bool remove() override;
|
||||
/* vt 0x18 */ virtual bool execute() override;
|
||||
/* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
|
||||
/* vt 0x20 */ virtual bool isDoneOpening() const override;
|
||||
/* vt 0x24 */ virtual void close() override;
|
||||
/* vt 0x28 */ virtual bool isDoneClosing() const override;
|
||||
/* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
|
||||
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
|
||||
return mpTextboxes[0];
|
||||
}
|
||||
/* vt 0x34 */ virtual bool startConfirm() override {
|
||||
return mBtn.requestIn();
|
||||
}
|
||||
/* vt 0x38 */ virtual bool startDecide(bool b) override {
|
||||
return mBtn.requestOut(b);
|
||||
}
|
||||
/* vt 0x3C */ virtual bool isDoneDecide() const override {
|
||||
return mBtn.isDoneOut();
|
||||
}
|
||||
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowStone_c, Invisible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowStone_c, In);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowStone_c, Visible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowStone_c, Out);
|
||||
|
||||
private:
|
||||
MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowStone_c)
|
||||
/* 0x010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowStone_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[3];
|
||||
/* 0x530 */ nw4r::lyt::Pane *mpPanes[2];
|
||||
/* 0x538 */ dTagProcessor_c *mpTagProcessor;
|
||||
/* 0x53C */ dLytCommonABtn_c mBtn;
|
||||
/* 0x6EC */ bool mShouldBeOpen;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,88 @@
|
||||
#ifndef D_LYT_MSG_WINDOW_SWORD_H
|
||||
#define D_LYT_MSG_WINDOW_SWORD_H
|
||||
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textwindow_unk.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 "m/m_vec.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
class dLytMsgWindowSword_c : public dLytMsgWindowSubtype {
|
||||
public:
|
||||
dLytMsgWindowSword_c() : mStateMgr(*this) {}
|
||||
/* vt 0x08 */ virtual ~dLytMsgWindowSword_c() {}
|
||||
/* vt 0x0C */ virtual void draw() override;
|
||||
/* vt 0x10 */ virtual bool
|
||||
build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
|
||||
/* vt 0x14 */ virtual bool remove() override;
|
||||
/* vt 0x18 */ virtual bool execute() override;
|
||||
/* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
|
||||
/* vt 0x20 */ virtual bool isDoneOpening() const override;
|
||||
/* vt 0x24 */ virtual void close() override;
|
||||
/* vt 0x28 */ virtual bool isDoneClosing() const override;
|
||||
/* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
|
||||
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
|
||||
return mpTextboxes[0];
|
||||
}
|
||||
/* vt 0x34 */ virtual bool startConfirm() override {
|
||||
return mBtn.requestIn();
|
||||
}
|
||||
/* vt 0x38 */ virtual bool startDecide(bool b) override {
|
||||
return mBtn.requestOut(b);
|
||||
}
|
||||
/* vt 0x3C */ virtual bool isDoneDecide() const override {
|
||||
return mBtn.isDoneOut();
|
||||
}
|
||||
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSword_c, Invisible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSword_c, In);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSword_c, Wait);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSword_c, Visible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowSword_c, Out);
|
||||
|
||||
void setSwordType(dLytTextSword::ESwordType type) {
|
||||
mSwordType = type;
|
||||
}
|
||||
|
||||
dLytMsgWindowCharData *getCharData() {
|
||||
return mCharacterData;
|
||||
}
|
||||
|
||||
private:
|
||||
MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowSword_c)
|
||||
/* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowSword_c);
|
||||
/* 0x004C */ d2d::SubPaneList mSubpaneList;
|
||||
/* 0x005C */ d2d::SubPaneListNode mNodes[1];
|
||||
/* 0x0068 */ d2d::ResAccIf_c mResAcc;
|
||||
/* 0x03D8 */ d2d::LytBase_c mLyt;
|
||||
/* 0x0468 */ d2d::AnmGroup_c mAnm[5];
|
||||
/* 0x05A8 */ dTextBox_c *mpTextboxes[2];
|
||||
/* 0x05B0 */ nw4r::lyt::Pane *mpPanes[3];
|
||||
/* 0x05BC */ dTagProcessor_c *mpTagProcessor;
|
||||
/* 0x05C0 */ mVec3_c mTranslationOrig;
|
||||
/* 0x05CC */ mVec3_c mTranslationTo;
|
||||
/* 0x05D8 */ mVec3_c mTranslationFrom;
|
||||
|
||||
/* 0x05E4 */ mVec2_c mOffset;
|
||||
|
||||
/* 0x05EC */ dAcObjBase_c *mpActor;
|
||||
/* 0x05F0 */ s32 mParam;
|
||||
|
||||
/* 0x05F4 */ s32 mWaitDelay;
|
||||
|
||||
/* 0x05F8 */ dLytCommonABtn_c mBtn;
|
||||
|
||||
/* 0x07A8 */ dLytMsgWindowCharData mCharacterData[1023];
|
||||
/* 0x5794 */ wchar_t mTextBuf[1023];
|
||||
|
||||
/* 0x5F94 */ dLytTextSword mSwordText;
|
||||
/* 0x607C */ dLytTextSword::ESwordType mSwordType;
|
||||
/* 0x6080 */ bool mShouldBeOpen;
|
||||
/* 0x6081 */ bool mHasDrawnThisTick;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,74 @@
|
||||
#ifndef D_LYT_MSG_WINDOW_TALK_H
|
||||
#define D_LYT_MSG_WINDOW_TALK_H
|
||||
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textwindow_unk.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 "m/m_vec.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
class dLytMsgWindowTalk_c : public dLytMsgWindowSubtype {
|
||||
public:
|
||||
dLytMsgWindowTalk_c() : mStateMgr(*this) {}
|
||||
/* vt 0x08 */ virtual ~dLytMsgWindowTalk_c() {}
|
||||
/* vt 0x0C */ virtual void draw() override;
|
||||
/* vt 0x10 */ virtual bool
|
||||
build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
|
||||
/* vt 0x14 */ virtual bool remove() override;
|
||||
/* vt 0x18 */ virtual bool execute() override;
|
||||
/* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
|
||||
/* vt 0x20 */ virtual bool isDoneOpening() const override;
|
||||
/* vt 0x24 */ virtual void close() override;
|
||||
/* vt 0x28 */ virtual bool isDoneClosing() const override;
|
||||
/* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
|
||||
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
|
||||
return mpTextboxes[0];
|
||||
}
|
||||
/* vt 0x34 */ virtual bool startConfirm() override {
|
||||
return mBtn.requestIn();
|
||||
}
|
||||
/* vt 0x38 */ virtual bool startDecide(bool b) override {
|
||||
return mBtn.requestOut(b);
|
||||
}
|
||||
/* vt 0x3C */ virtual bool isDoneDecide() const override {
|
||||
return mBtn.isDoneOut();
|
||||
}
|
||||
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Invisible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, In);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Wait);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Visible);
|
||||
STATE_FUNC_DECLARE(dLytMsgWindowTalk_c, Out);
|
||||
|
||||
dLytMsgWindowCharData *getCharData() {
|
||||
return mBlurRelated.getCharData();
|
||||
}
|
||||
|
||||
private:
|
||||
MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowTalk_c)
|
||||
/* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMsgWindowTalk_c);
|
||||
/* 0x004C */ d2d::SubPaneList mSubpaneList;
|
||||
/* 0x005C */ d2d::SubPaneListNode mNodes[1];
|
||||
/* 0x0068 */ d2d::ResAccIf_c mResAcc;
|
||||
/* 0x03D8 */ d2d::LytBase_c mLyt;
|
||||
/* 0x0468 */ d2d::AnmGroup_c mAnm[4];
|
||||
/* 0x0568 */ dTextBox_c *mpTextboxes[2];
|
||||
/* 0x0570 */ nw4r::lyt::Pane *mpPanes[5];
|
||||
/* 0x0584 */ dTagProcessor_c *mpTagProcessor;
|
||||
/* 0x0588 */ mVec3_c mTranslationOrig;
|
||||
/* 0x0594 */ mVec3_c mTranslationTo;
|
||||
/* 0x05A0 */ mVec3_c mTranslationFrom;
|
||||
/* 0x05AC */ mVec2_c mOffset;
|
||||
/* 0x05B4 */ dAcObjBase_c *mpActor;
|
||||
/* 0x05B8 */ s32 mParam;
|
||||
/* 0x05BC */ s32 mWaitDelay;
|
||||
/* 0x05C0 */ dLytCommonABtn_c mBtn;
|
||||
/* 0x0770 */ dLytTextLight mText;
|
||||
/* 0x084C */ MsgWindowBlurRelated mBlurRelated;
|
||||
/* 0x583C */ bool mShouldBeOpen;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef D_LYT_MSG_WINDOW_WOOD_H
|
||||
#define D_LYT_MSG_WINDOW_WOOD_H
|
||||
|
||||
#include "d/a/obj/d_a_obj_base.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:
|
||||
dLytMsgWindowWood_c() : mStateMgr(*this) {}
|
||||
/* vt 0x08 */ virtual ~dLytMsgWindowWood_c() {}
|
||||
/* vt 0x0C */ virtual void draw() override;
|
||||
/* vt 0x10 */ virtual bool
|
||||
build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) override;
|
||||
/* vt 0x14 */ virtual bool remove() override;
|
||||
/* vt 0x18 */ virtual bool execute() override;
|
||||
/* vt 0x1C */ virtual void open(dAcObjBase_c *obj, u32 param) override;
|
||||
/* vt 0x20 */ virtual bool isDoneOpening() const override;
|
||||
/* vt 0x24 */ virtual void close() override;
|
||||
/* vt 0x28 */ virtual bool isDoneClosing() const override;
|
||||
/* vt 0x2C */ virtual bool setText(const wchar_t *text) override;
|
||||
/* vt 0x30 */ virtual dTextBox_c *getTextBox() override {
|
||||
return mpTextboxes[0];
|
||||
}
|
||||
/* vt 0x34 */ virtual bool startConfirm() override {
|
||||
return mBtn.requestIn();
|
||||
}
|
||||
/* vt 0x38 */ virtual bool startDecide(bool b) override {
|
||||
return mBtn.requestOut(b);
|
||||
}
|
||||
/* vt 0x3C */ virtual bool isDoneDecide() const override {
|
||||
return mBtn.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:
|
||||
MSG_WINDOW_STATE_MGR_INLINE(dLytMsgWindowWood_c)
|
||||
/* 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 mBtn;
|
||||
/* 0x6EC */ bool mShouldBeOpen;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -136,6 +136,11 @@ public:
|
||||
static const Vector2f ex;
|
||||
static const Vector2f ey;
|
||||
|
||||
void set(f32 fx, f32 fy) {
|
||||
x = fx;
|
||||
y = fy;
|
||||
}
|
||||
|
||||
Vector2f operator-(const Vector2f &v) {
|
||||
return Vector2f(x - v.x, y - v.y);
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ struct MsbBlock {
|
||||
/* 0x0C */ u16 field_0x0C;
|
||||
};
|
||||
|
||||
#pragma push
|
||||
#pragma pack(2)
|
||||
#pragma pack(push ,2)
|
||||
|
||||
struct MsbHeader {
|
||||
/* 0x00 */ unsigned char field_0x00[0x0C - 0x00];
|
||||
@@ -33,7 +32,7 @@ struct MsbHeader {
|
||||
/* 0x12 */ int fileLength;
|
||||
};
|
||||
|
||||
#pragma pop
|
||||
#pragma pack(pop)
|
||||
|
||||
struct MsbInfo {
|
||||
/* 0x00 */ struct MsbHeader *header;
|
||||
|
||||
@@ -12,7 +12,7 @@ struct MsbfInfo;
|
||||
struct MsbFlowInfo {
|
||||
/* 0x00 */ char type;
|
||||
/* 0x01 */ char subType;
|
||||
/* 0x04 */ short params1n2;
|
||||
/* 0x04 */ int params1n2;
|
||||
/* 0x08 */ short next;
|
||||
/* 0x0A */ short param3;
|
||||
/* 0x0C */ short param4;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define LIBMS_MSGFILE_H
|
||||
|
||||
#include "common.h"
|
||||
#include <wchar.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -16,11 +17,11 @@ struct MsbtAttrInfo {
|
||||
|
||||
struct MsbtInfo *LMS_InitMessage(void *data);
|
||||
void LMS_CloseMessage(struct MsbtInfo *info);
|
||||
int LMS_GetTextIndexByLabel(struct MsbtInfo *info, const char *label);
|
||||
const char *LMS_GetText(struct MsbtInfo *info, int index);
|
||||
const char *LMS_GetTextByLabel(struct MsbtInfo *info, const char *label);
|
||||
const char *LMS_GetLabelByTextIndex(struct MsbtInfo *info, int index);
|
||||
struct MsbtAttrInfo *LMS_GetAttribute(struct MsbtInfo *info, int index);
|
||||
int LMS_GetTextIndexByLabel(const struct MsbtInfo *info, const char *label);
|
||||
const wchar_t *LMS_GetText(const struct MsbtInfo *info, int index);
|
||||
const wchar_t *LMS_GetTextByLabel(const struct MsbtInfo *info, const char *label);
|
||||
const char *LMS_GetLabelByTextIndex(const struct MsbtInfo *info, int index);
|
||||
struct MsbtAttrInfo *LMS_GetAttribute(const struct MsbtInfo *info, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+7
-2
@@ -94,6 +94,11 @@ public:
|
||||
setFrame(actualEnd * ratio);
|
||||
}
|
||||
|
||||
inline f32 getRatio() const {
|
||||
f32 actualEnd = mEndFrame - 1.0f;
|
||||
return mCurrFrame / actualEnd;
|
||||
}
|
||||
|
||||
inline void setBackwardsRatio(f32 ratio) {
|
||||
f32 actualEnd = mEndFrame - 1.0f;
|
||||
setFrame(actualEnd - (ratio * actualEnd));
|
||||
@@ -105,7 +110,7 @@ public:
|
||||
return f >= end ? 0.0f : f;
|
||||
}
|
||||
|
||||
inline f32 getEndFrameRaw() const {
|
||||
inline f32 getAnimDuration() const {
|
||||
return mEndFrame;
|
||||
}
|
||||
|
||||
@@ -162,7 +167,7 @@ public:
|
||||
Base_c(u8 priority) : mPriority(priority) {}
|
||||
/* 0x00 */ nw4r::ut::Node mLink;
|
||||
|
||||
/* vt offset 0x04 */
|
||||
/* vt offset 0x08 */
|
||||
/* vt 0x08 */ virtual ~Base_c();
|
||||
/* vt 0x0C */ virtual void draw();
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ public:
|
||||
};
|
||||
|
||||
mFaderBase_c(const mColor &color, EStatus status);
|
||||
virtual ~mFaderBase_c();
|
||||
/* vt 0x08 */ virtual ~mFaderBase_c();
|
||||
|
||||
virtual void setStatus(EStatus status) = 0;
|
||||
virtual EStatus getStatus() const;
|
||||
virtual bool fadeIn();
|
||||
virtual bool fadeOut();
|
||||
virtual bool calc();
|
||||
virtual void draw() = 0;
|
||||
/* vt 0x0C */ virtual void setStatus(EStatus status) = 0;
|
||||
/* vt 0x10 */ virtual EStatus getStatus() const;
|
||||
/* vt 0x14 */ virtual bool fadeIn();
|
||||
/* vt 0x18 */ virtual bool fadeOut();
|
||||
/* vt 0x1C */ virtual bool calc();
|
||||
/* vt 0x20 */ virtual void draw() = 0;
|
||||
|
||||
void setFrame(u16 frame);
|
||||
void setColor(const mColor &color);
|
||||
|
||||
@@ -254,4 +254,14 @@ public:
|
||||
static mVec3_c Ez;
|
||||
};
|
||||
|
||||
class mVec2_c : public EGG::Vector2f {
|
||||
public:
|
||||
mVec2_c() {}
|
||||
~mVec2_c() {}
|
||||
|
||||
mVec2_c(const mVec2_c &other) {
|
||||
set(other.x, other.y);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,9 +41,15 @@ public:
|
||||
bool IsInfluencedAlpha() const {
|
||||
return detail::TestBit<u8>(mFlag, INFLUENCED_ALPHA);
|
||||
}
|
||||
void SetInfluencedAlpha(bool bInfluenced) {
|
||||
detail::SetBit(&mFlag, INFLUENCED_ALPHA, bInfluenced);
|
||||
}
|
||||
bool IsLocationAdjust() const {
|
||||
return detail::TestBit<u8>(mFlag, LOCATION_ADJUST);
|
||||
}
|
||||
void SetLocationAdjust(bool bAdjust) {
|
||||
detail::SetBit(&mFlag, LOCATION_ADJUST, bAdjust);
|
||||
}
|
||||
bool IsUserAllocated() const {
|
||||
return mbUserAllocated;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,10 @@ public:
|
||||
mpTagProcessor = pTagProcessor;
|
||||
}
|
||||
|
||||
const wchar_t *GetString() const {
|
||||
return mTextBuf;
|
||||
}
|
||||
|
||||
virtual ~TextBox();
|
||||
NW4R_UT_RTTI_DECL(TextBox);
|
||||
virtual void DrawSelf(const DrawInfo &drawInfo); // at 0x18
|
||||
|
||||
@@ -31,8 +31,8 @@ inline bool TestBit(T bits, int index) {
|
||||
}
|
||||
template <typename T>
|
||||
inline void SetBit(T *bits, int pos, bool val) {
|
||||
T mask = T(1 << pos);
|
||||
*bits = T((*bits & ~mask)) | (val << pos);
|
||||
T mask = ~T(1 << pos);
|
||||
*bits = T((*bits & mask)) | (val << pos);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#ifndef NW4R_UT_FONT_H
|
||||
#define NW4R_UT_FONT_H
|
||||
#include "common.h"
|
||||
#include "nw4r/types_nw4r.h"
|
||||
#include "nw4r/ut/ut_CharStrmReader.h"
|
||||
#include "rvl/GX.h" // IWYU pragma: export
|
||||
@@ -67,7 +68,11 @@ public:
|
||||
|
||||
void InitReaderFunc(FontEncoding encode);
|
||||
|
||||
CharStrmReader GetCharStrmReader() const;
|
||||
// ???
|
||||
DECOMP_DONT_INLINE CharStrmReader GetCharStrmReader() const {
|
||||
CharStrmReader reader(mReadFunc);
|
||||
return reader;
|
||||
}
|
||||
|
||||
private:
|
||||
CharStrmReader::ReadFunc mReadFunc; // at 0x4
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
|
||||
// See include/s/README.txt for changes made
|
||||
|
||||
// Handy search and replace regex to generate functions based on define macros
|
||||
// STATE_DEFINE\(([A-Za-z_0-9]+), ([A-Za-z_0-9]+)\);
|
||||
// void $1::initializeState_$2() {}\nvoid $1::executeState_$2() {}\nvoid $1::finalizeState_$2() {}\n
|
||||
|
||||
#define STATE_FUNC_DECLARE(class, name) \
|
||||
void initializeState_##name(); \
|
||||
void executeState_##name(); \
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "m/m3d/m_proc.h"
|
||||
#include "m/m_color.h"
|
||||
#include "m/m_mtx.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "toBeSorted/tlist.h"
|
||||
|
||||
@@ -17,6 +18,9 @@
|
||||
|
||||
namespace d3d {
|
||||
|
||||
f32 fn_80016960(mVec3_c&, const mVec3_c& pos);
|
||||
bool fn_80016A90(const mVec3_c& pos);
|
||||
|
||||
class AnmMdlWrapper : protected m3d::mdlAnmChr {
|
||||
public:
|
||||
AnmMdlWrapper();
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
#define EVENT_MANAGER_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "f/f_base.h"
|
||||
#include "sized_string.h"
|
||||
#include "toBeSorted/event.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
class dAcBase_c;
|
||||
|
||||
class EventManager {
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
static bool finishEvent(dAcBase_c *actor, const char *eventName);
|
||||
static void changeOwnEvent(dAcBase_c *actor1, dAcBase_c *actor2, Event *event, UNKWORD);
|
||||
static bool alsoSetAsCurrentEvent(dAcBase_c *actor, Event *event, void *unknown);
|
||||
static dAcObjBase_c *fn_800A08F0(fBase_c::GROUP_TYPE_e);
|
||||
|
||||
static EventManager *sInstance;
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef GLOBAL_FI_CONTEXT_H
|
||||
#define GLOBAL_FI_CONTEXT_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct FiContext {
|
||||
/* 0x00 */ u8 _0x00[0x4B - 0x00];
|
||||
/* 0x4B */ bool mDoSpecialFiMenuHandling;
|
||||
|
||||
static s32 getGlobalFiInfo0(s32);
|
||||
};
|
||||
|
||||
extern "C" FiContext *GLOBAL_FI_CONTEXT;
|
||||
extern "C" void fn_8016C9F0(FiContext *);
|
||||
extern "C" void createGlobalFiContext();
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef LYT_RELATED_FLOATS_H
|
||||
#define LYT_RELATED_FLOATS_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern "C" f32 lbl_805751A4;
|
||||
inline f32 get_805751A4() {
|
||||
return lbl_805751A4;
|
||||
}
|
||||
|
||||
extern "C" s32 lbl_80575134;
|
||||
inline s32 get_80575134() {
|
||||
return lbl_80575134;
|
||||
}
|
||||
|
||||
extern "C" s32 lbl_8057511C;
|
||||
inline s32 get_8057511C() {
|
||||
return lbl_8057511C;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -5,7 +5,10 @@
|
||||
|
||||
extern "C" void *BGM_MGR;
|
||||
extern "C" void fn_8035E000();
|
||||
extern "C" void fn_8035E860(void *);
|
||||
extern "C" void fn_8035E310(void *);
|
||||
extern "C" void fn_8035E820(void *);
|
||||
extern "C" void fn_8035E880(void *);
|
||||
|
||||
extern "C" void *ENEMY_SOUND_MGR;
|
||||
extern "C" void fn_80362150(void *, u16);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef OTHER_SOUND_STUFF_H
|
||||
#define OTHER_SOUND_STUFF_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern "C" void *lbl_80575DE0;
|
||||
extern "C" void fn_803996B0(void *, const char *msgLabelName, u16, s32);
|
||||
extern "C" void fn_803998A0(void *, u16, u16);
|
||||
|
||||
#endif
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
// Thanks kiwi! https://gist.github.com/kiwi515/47bb17b07ed502bdfa7faa60bc48a3c7
|
||||
|
||||
#include "common.h"
|
||||
enum WZSound {
|
||||
/* 0x0000 */ SE_L_FLIPED,
|
||||
/* 0x0001 */ SE_L_FS_START,
|
||||
@@ -6471,6 +6472,7 @@ enum WZSound {
|
||||
class SmallSoundManager {
|
||||
public:
|
||||
void playSound(WZSound id);
|
||||
void playButtonPressSoundWhenAdvancingTextBoxes(f32);
|
||||
|
||||
static SmallSoundManager *GetInstance() {
|
||||
return sInstance;
|
||||
|
||||
@@ -25,6 +25,8 @@ char *strcpy(char *dst, const char *src);
|
||||
int sscanf(const char *buffer, const char *format, ...);
|
||||
size_t strlen(const char *str);
|
||||
|
||||
int atoi(const char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "d/d_dylink.h"
|
||||
#include "d/d_font_manager.h"
|
||||
#include "d/d_heap.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_scene.h"
|
||||
#include "d/d_sys.h"
|
||||
#include "d/lyt/d_lyt_battery.h"
|
||||
@@ -42,7 +43,6 @@ sFPhaseBase::sFPhaseState dScBoot_c::executeLoadPhase() {
|
||||
|
||||
extern "C" u8 getUsedLanguageNTSCNum();
|
||||
extern "C" const char *getEventFlowFileNameByIndex(int, int);
|
||||
extern "C" const char *getUsedLanguageString();
|
||||
extern "C" u8 fn_80054F30();
|
||||
extern "C" nw4r::ut::ResFont *lbl_805750D8;
|
||||
|
||||
@@ -54,7 +54,7 @@ sFPhaseBase::sFPhaseState dScBoot_c::cb1() {
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
SizedString<128> str;
|
||||
str.sprintf("%s/%s", getUsedLanguageString(), getEventFlowFileNameByIndex(i, 1));
|
||||
str.sprintf("%s/%s", dMessage_c::getLanguageIdentifier(), getEventFlowFileNameByIndex(i, 1));
|
||||
OarcManager::GetInstance()->loadObjectArcFromDisk(str, mHeap::g_archiveHeap);
|
||||
}
|
||||
OarcManager::GetInstance()->loadObjectArcFromDisk("System", mHeap::g_archiveHeap);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "d/col/c/c_m3d.h"
|
||||
#include "d/col/c/c_partition.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/lyt/d_lyt_map.h"
|
||||
#include "toBeSorted/arc_managers/oarc_manager.h"
|
||||
|
||||
const char *MAP_SOLID_MATERIAL_NAMES[31] = {
|
||||
@@ -1022,9 +1023,8 @@ void dBgS::SetupMapMaterial(int matIdx, bool, s32 roomId) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
extern "C" UNKTYPE *lbl_805754B0;
|
||||
UNKTYPE *dBgS::GetMapAccessor() {
|
||||
return lbl_805754B0;
|
||||
return dLytMap_c::getInstance();
|
||||
}
|
||||
|
||||
void dBgS::DrawMap(int roomId, mMtx_c *, bool bColor, int) {
|
||||
|
||||
+1
-1
@@ -234,7 +234,7 @@ bool dCsGame_c::lytItemCursor_c::doInit() {
|
||||
mAnm.init(mAnmGroups.tmp.mAnmGroups, lytItemCursorMap, 0x17, mpResAcc, mLyt.getLayout());
|
||||
|
||||
for (int i = 0; i < 0x17; i++) {
|
||||
mAnmGroups.tmp.mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups.tmp.mAnmGroups[i].bind(false);
|
||||
mAnmGroups.tmp.mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "d/d_font_manager.h"
|
||||
|
||||
#include "d/d_heap.h"
|
||||
#include "d/d_message.h"
|
||||
#include "sized_string.h"
|
||||
|
||||
|
||||
@@ -48,14 +49,12 @@ void dFontMng_c::setFontFile(int idx, void *fileData) {
|
||||
l_dFontMng_obj[idx].mpFileData = fileData;
|
||||
}
|
||||
|
||||
extern "C" const char *getUsedLanguageString();
|
||||
|
||||
const char *dFontMng_c::getFontPath(u8 idx) {
|
||||
static SizedString<128> TEMP_FONT_NAME;
|
||||
if (idx == 2) {
|
||||
TEMP_FONT_NAME.sprintf("/Font/%s", systemFonts[idx]);
|
||||
} else {
|
||||
TEMP_FONT_NAME.sprintf("/US/Font/%s/%s", getUsedLanguageString(), systemFonts[idx]);
|
||||
TEMP_FONT_NAME.sprintf("/US/Font/%s/%s", dMessage_c::getLanguageIdentifier(), systemFonts[idx]);
|
||||
}
|
||||
return TEMP_FONT_NAME;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,559 @@
|
||||
#include "d/d_message.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "f/f_base.h"
|
||||
#include "f/f_profile.h"
|
||||
#include "f/f_profile_name.h"
|
||||
#include "libms/libms.h"
|
||||
#include "libms/msgfile.h"
|
||||
#include "sized_string.h"
|
||||
#include "toBeSorted/arc_managers/oarc_manager.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/global_fi_context.h"
|
||||
|
||||
|
||||
SPECIAL_BASE_PROFILE(MESSAGE, dMessage_c, fProfile::MESSAGE, 0x2A8, 0);
|
||||
|
||||
static const char *sMsbtFileNames[82] = {
|
||||
"000-Test.msbt",
|
||||
"001-Action.msbt",
|
||||
"002-System.msbt",
|
||||
"003-ItemGet.msbt",
|
||||
"004-Object.msbt",
|
||||
"005-Tutorial.msbt",
|
||||
"006-KenseiNormal.msbt",
|
||||
"006-1KenseiNormal.msbt",
|
||||
"006-2KenseiNormal.msbt",
|
||||
"006-3KenseiNormal.msbt",
|
||||
"006-4KenseiNormal.msbt",
|
||||
"006-5KenseiNormal.msbt",
|
||||
"006-6KenseiNormal.msbt",
|
||||
"006-7KenseiNormal.msbt",
|
||||
"006-8KenseiNormal.msbt",
|
||||
"006-9KenseiNormal.msbt",
|
||||
"007-MapText.msbt",
|
||||
"008-Hint.msbt",
|
||||
"word.msbt",
|
||||
"100-Town.msbt",
|
||||
"101-Shop.msbt",
|
||||
"102-Zelda.msbt",
|
||||
"103-DaiShinkan.msbt",
|
||||
"104-Rival.msbt",
|
||||
"105-Terry.msbt",
|
||||
"106-DrugStore.msbt",
|
||||
"107-Kanban.msbt",
|
||||
"108-ShinkanA.msbt",
|
||||
"109-TakeGoron.msbt",
|
||||
"110-DivingGame.msbt",
|
||||
"111-FortuneTeller.msbt",
|
||||
"112-Trustee.msbt",
|
||||
"113-RemodelStore.msbt",
|
||||
"114-Friend.msbt",
|
||||
"115-Town2.msbt",
|
||||
"116-InsectGame.msbt",
|
||||
"117-Pumpkin.msbt",
|
||||
"118-Town3.msbt",
|
||||
"119-Captain.msbt",
|
||||
"120-Nushi.msbt",
|
||||
"121-AkumaKun.msbt",
|
||||
"122-Town4.msbt",
|
||||
"123-Town5.msbt",
|
||||
"124-Town6.msbt",
|
||||
"125-D3.msbt",
|
||||
"150-Siren.msbt",
|
||||
"198-Test.msbt",
|
||||
"199-Demo.msbt",
|
||||
"200-Forest.msbt",
|
||||
"201-ForestD1.msbt",
|
||||
"202-ForestD2.msbt",
|
||||
"203-ForestF2.msbt",
|
||||
"204-ForestF3.msbt",
|
||||
"250-ForestSiren.msbt",
|
||||
"251-Salvage.msbt",
|
||||
"299-Demo.msbt",
|
||||
"300-Mountain.msbt",
|
||||
"301-MountainD1.msbt",
|
||||
"302-Anahori.msbt",
|
||||
"303-MountainF2.msbt",
|
||||
"304-MountainD2.msbt",
|
||||
"305-MountainF3.msbt",
|
||||
"350-MountainSiren.msbt",
|
||||
"351-Salvage.msbt",
|
||||
"399-Demo.msbt",
|
||||
"400-Desert.msbt",
|
||||
"401-DesertD2.msbt",
|
||||
"402-DesertF2.msbt",
|
||||
"403-DesertD1.msbt",
|
||||
"404-DesertF3.msbt",
|
||||
"405-DesertD2Clear.msbt",
|
||||
"406-TrolleyRace.msbt",
|
||||
"450-DesertSiren.msbt",
|
||||
"451-Salvage.msbt",
|
||||
"460-RairyuMinigame.msbt",
|
||||
"499-Demo.msbt",
|
||||
"500-CenterField.msbt",
|
||||
"501-Inpa.msbt",
|
||||
"502-CenterFieldBack.msbt",
|
||||
"503-Goron.msbt",
|
||||
"510-Salvage.msbt",
|
||||
"599-Demo.msbt",
|
||||
};
|
||||
|
||||
static char *sMsbfFileNames[80] = {
|
||||
"000-Test.msbf",
|
||||
"001-Action.msbf",
|
||||
"002-System.msbf",
|
||||
"003-ItemGet.msbf",
|
||||
"004-Object.msbf",
|
||||
"005-Tutorial.msbf",
|
||||
"006-KenseiNormal.msbf",
|
||||
"006-1KenseiNormal.msbf",
|
||||
"006-2KenseiNormal.msbf",
|
||||
"006-3KenseiNormal.msbf",
|
||||
"006-4KenseiNormal.msbf",
|
||||
"006-5KenseiNormal.msbf",
|
||||
"006-6KenseiNormal.msbf",
|
||||
"006-7KenseiNormal.msbf",
|
||||
"006-8KenseiNormal.msbf",
|
||||
"006-9KenseiNormal.msbf",
|
||||
"008-Hint.msbf",
|
||||
"100-Town.msbf",
|
||||
"101-Shop.msbf",
|
||||
"102-Zelda.msbf",
|
||||
"103-DaiShinkan.msbf",
|
||||
"104-Rival.msbf",
|
||||
"105-Terry.msbf",
|
||||
"106-DrugStore.msbf",
|
||||
"107-Kanban.msbf",
|
||||
"108-ShinkanA.msbf",
|
||||
"109-TakeGoron.msbf",
|
||||
"110-DivingGame.msbf",
|
||||
"111-FortuneTeller.msbf",
|
||||
"112-Trustee.msbf",
|
||||
"113-RemodelStore.msbf",
|
||||
"114-Friend.msbf",
|
||||
"115-Town2.msbf",
|
||||
"116-InsectGame.msbf",
|
||||
"117-Pumpkin.msbf",
|
||||
"118-Town3.msbf",
|
||||
"119-Captain.msbf",
|
||||
"120-Nushi.msbf",
|
||||
"121-AkumaKun.msbf",
|
||||
"122-Town4.msbf",
|
||||
"123-Town5.msbf",
|
||||
"124-Town6.msbf",
|
||||
"125-D3.msbf",
|
||||
"150-Siren.msbf",
|
||||
"198-Test.msbf",
|
||||
"199-Demo.msbf",
|
||||
"200-Forest.msbf",
|
||||
"201-ForestD1.msbf",
|
||||
"202-ForestD2.msbf",
|
||||
"203-ForestF2.msbf",
|
||||
"204-ForestF3.msbf",
|
||||
"250-ForestSiren.msbf",
|
||||
"251-Salvage.msbf",
|
||||
"299-Demo.msbf",
|
||||
"300-Mountain.msbf",
|
||||
"301-MountainD1.msbf",
|
||||
"302-Anahori.msbf",
|
||||
"303-MountainF2.msbf",
|
||||
"304-MountainD2.msbf",
|
||||
"305-MountainF3.msbf",
|
||||
"350-MountainSiren.msbf",
|
||||
"351-Salvage.msbf",
|
||||
"399-Demo.msbf",
|
||||
"400-Desert.msbf",
|
||||
"401-DesertD2.msbf",
|
||||
"402-DesertF2.msbf",
|
||||
"403-DesertD1.msbf",
|
||||
"404-DesertF3.msbf",
|
||||
"405-DesertD2Clear.msbf",
|
||||
"406-TrolleyRace.msbf",
|
||||
"450-DesertSiren.msbf",
|
||||
"451-Salvage.msbf",
|
||||
"460-RairyuMinigame.msbf",
|
||||
"499-Demo.msbf",
|
||||
"500-CenterField.msbf",
|
||||
"501-Inpa.msbf",
|
||||
"502-CenterFieldBack.msbf",
|
||||
"503-Goron.msbf",
|
||||
"510-Salvage.msbf",
|
||||
"599-Demo.msbf",
|
||||
};
|
||||
|
||||
static char *sArcNames[] = {
|
||||
"0-Common", "1-Town", "2-Forest", "3-Mountain", "4-Desert", "5-CenterField",
|
||||
};
|
||||
|
||||
dMessage_c *dMessage_c::sInstance;
|
||||
dTagProcessor_c *dMessage_c::sTagProcessor;
|
||||
|
||||
static void *msbAlloc(size_t size) {
|
||||
if (UnkTextThing::getInstance()->getShouldHookAllocations() == false) {
|
||||
return EGG::Heap::alloc(size, 0x20, nullptr);
|
||||
} else {
|
||||
return UnkTextThing::getInstance()->allocUnk(size, 0x20);
|
||||
}
|
||||
}
|
||||
|
||||
static void msbFree(void *ptr) {
|
||||
if (UnkTextThing::getInstance()->getShouldHookAllocations() == false) {
|
||||
EGG::Heap::free(ptr, nullptr);
|
||||
} else {
|
||||
UnkTextThing::getInstance()->destroyUnk(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
dMessage_c::dMessage_c() {
|
||||
sInstance = this;
|
||||
}
|
||||
|
||||
int dMessage_c::create() {
|
||||
mLanguage = getLanguageIdentifier();
|
||||
|
||||
mCurrentTextFileNumber = -1;
|
||||
field_0x2FC = 0;
|
||||
field_0x344 = 0;
|
||||
LMS_SetMemFuncs(msbAlloc, msbFree);
|
||||
setZevFromMsbArc();
|
||||
|
||||
for (s32 i = 0; i < 82; i++) {
|
||||
SizedString<0x40> fileName = getMsbtFileName(i);
|
||||
s32 num = getMsbtNumberByIndex(i);
|
||||
void *data = getDataFromMsbArc(num, fileName, true);
|
||||
if (data == nullptr) {
|
||||
mpMsgs[i] = nullptr;
|
||||
} else {
|
||||
mpMsgs[i] = LMS_InitMessage(data);
|
||||
}
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < 80; i++) {
|
||||
SizedString<0x40> fileName = getMsbfFileName(i);
|
||||
s32 num = getMsbfNumberByIndex(i);
|
||||
void *data = getDataFromMsbArc(num, fileName, true);
|
||||
if (data == nullptr) {
|
||||
mpFlows[i] = nullptr;
|
||||
} else {
|
||||
mpFlows[i] = LMS_InitFlow(data);
|
||||
}
|
||||
}
|
||||
|
||||
sTagProcessor = new dTagProcessor_c();
|
||||
createGlobalFiContext();
|
||||
reset();
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dMessage_c::doDelete() {
|
||||
UnkTextThing::getInstance()->destroy();
|
||||
if (sTagProcessor != nullptr) {
|
||||
delete sTagProcessor;
|
||||
sTagProcessor = nullptr;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 82; i++) {
|
||||
if (mpMsgs[i] != nullptr) {
|
||||
LMS_CloseMessage(mpMsgs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 80; i++) {
|
||||
if (mpFlows[i] != nullptr) {
|
||||
LMS_CloseFlow(mpFlows[i]);
|
||||
}
|
||||
}
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dMessage_c::execute() {
|
||||
if (field_0x2FC != 0 && !EventManager::isInEvent()) {
|
||||
field_0x2FC = 0;
|
||||
}
|
||||
|
||||
if (field_0x2FC > 0) {
|
||||
field_0x2FC--;
|
||||
}
|
||||
executeMinigame();
|
||||
sTagProcessor->execute();
|
||||
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dMessage_c::draw() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
const wchar_t *dMessage_c::getTextMessageByLabel(const char *label, bool global, wchar_t *dstBuf, u32 maxLen) {
|
||||
return sInstance->getTextMessageByLabelInternal(label, nullptr, global, dstBuf, maxLen);
|
||||
}
|
||||
|
||||
const wchar_t *dMessage_c::getTextMessageByLabel(
|
||||
const char *label, dTagProcessor_c *pTagProcessor, bool global, wchar_t *dstBuf, u32 maxLen
|
||||
) {
|
||||
return sInstance->getTextMessageByLabelInternal(label, pTagProcessor, global, dstBuf, maxLen);
|
||||
}
|
||||
|
||||
const wchar_t *dMessage_c::formatText(const wchar_t *text) {
|
||||
return sInstance->formatTextInternal(text);
|
||||
}
|
||||
|
||||
const wchar_t *dMessage_c::getTextMessageByLabelInternal(
|
||||
const char *label, dTagProcessor_c *pTagProcessor, bool global, wchar_t *dstBuf, u32 maxLen
|
||||
) {
|
||||
s32 fileIndex = mCurrentTextFileNumber;
|
||||
MsbtInfo *info = nullptr;
|
||||
|
||||
if (global) {
|
||||
fileIndex = getMsbtIndexForLabelInternal(label);
|
||||
}
|
||||
|
||||
if (fileIndex >= 0) {
|
||||
info = getMsbtInfoForIndex(fileIndex);
|
||||
}
|
||||
|
||||
const wchar_t *text = LMS_GetTextByLabel(info, label);
|
||||
if (pTagProcessor == nullptr) {
|
||||
pTagProcessor = sTagProcessor;
|
||||
}
|
||||
|
||||
u32 outLen = 0;
|
||||
s32 textIdx = LMS_GetTextIndexByLabel(info, label);
|
||||
MsbtAttrInfo *att = LMS_GetAttribute(info, textIdx);
|
||||
pTagProcessor->setMsgWindowSubtype(att->c_0x00);
|
||||
pTagProcessor->setField_0x90D(att->c_0x01);
|
||||
|
||||
// Strip trailing newline
|
||||
wchar_t *end;
|
||||
s32 i;
|
||||
|
||||
if (dstBuf != nullptr) {
|
||||
pTagProcessor->format(nullptr, text, dstBuf, maxLen, &outLen, nullptr);
|
||||
i = outLen - 1;
|
||||
end = &dstBuf[i];
|
||||
for (; i > 0; i--) {
|
||||
if (*end != L'\n') {
|
||||
break;
|
||||
}
|
||||
*end-- = L'\0';
|
||||
}
|
||||
// no return - might be intentional since dstBuf already has the result
|
||||
} else {
|
||||
static wchar_t sBuf[0x400] = {};
|
||||
pTagProcessor->format(nullptr, text, sBuf, ARRAY_LENGTH(sBuf) - 1, &outLen, nullptr);
|
||||
i = outLen - 1;
|
||||
end = &sBuf[i];
|
||||
for (; i > 0; i--) {
|
||||
if (*end != L'\n') {
|
||||
break;
|
||||
}
|
||||
*end = L'\0';
|
||||
end--;
|
||||
}
|
||||
|
||||
return sBuf;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const wchar_t *dMessage_c::formatTextInternal(const wchar_t *text) {
|
||||
u32 outLen = 0;
|
||||
static wchar_t sBuf[0x200] = {};
|
||||
sTagProcessor->format(nullptr, text, sBuf, ARRAY_LENGTH(sBuf), &outLen, nullptr);
|
||||
s32 i = outLen - 1;
|
||||
wchar_t *end = &sBuf[i];
|
||||
for (; i > 0; i--) {
|
||||
if (*end != L'\n') {
|
||||
break;
|
||||
}
|
||||
*end = L'\0';
|
||||
end--;
|
||||
}
|
||||
|
||||
return sBuf;
|
||||
}
|
||||
|
||||
bool dMessage_c::isValidTextLabel(const char *name) {
|
||||
return sInstance->checkIsValidTextLabel(name);
|
||||
}
|
||||
|
||||
bool dMessage_c::checkIsValidTextLabel(const char *name) {
|
||||
if (name == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return getTextIndexForLabel(name) >= 0;
|
||||
}
|
||||
|
||||
const char *dMessage_c::getMsbtFileName(s32 idx) {
|
||||
static SizedString<128> sPath;
|
||||
|
||||
s32 arcIdx = getArcIndexForFile(sMsbtFileNames[idx]);
|
||||
const char *arcName = getArcNameByIndex(arcIdx, true);
|
||||
sPath.sprintf("%s/%s", arcName, sMsbtFileNames[idx]);
|
||||
return sPath;
|
||||
}
|
||||
|
||||
const char *dMessage_c::getMsbfFileName(s32 idx) {
|
||||
static SizedString<128> sPath;
|
||||
|
||||
s32 arcIdx = getArcIndexForFile(sMsbfFileNames[idx]);
|
||||
const char *arcName = getArcNameByIndex(arcIdx, true);
|
||||
sPath.sprintf("%s/%s", arcName, sMsbfFileNames[idx]);
|
||||
return sPath;
|
||||
}
|
||||
|
||||
s32 dMessage_c::getMsbtNumberByIndex(s32 index) {
|
||||
return atoi(getMsbtFileName(index));
|
||||
}
|
||||
|
||||
s32 dMessage_c::getMsbfNumberByIndex(s32 index) {
|
||||
return atoi(getMsbfFileName(index));
|
||||
}
|
||||
|
||||
s32 dMessage_c::getTextIndexForLabel(const char *label) {
|
||||
s32 idx = getMsbtIndexForLabelInternal(label);
|
||||
MsbtInfo *info = nullptr;
|
||||
if (idx >= 0) {
|
||||
info = getMsbtInfoForIndex(idx);
|
||||
}
|
||||
return LMS_GetTextIndexByLabel(info, label);
|
||||
}
|
||||
|
||||
s32 dMessage_c::getMsbtIndexForLabel(const char *label) {
|
||||
return sInstance->getMsbtIndexForLabelInternal(label);
|
||||
}
|
||||
|
||||
s32 dMessage_c::getMsbtIndexForLabelInternal(const char *label) {
|
||||
if (mCurrentTextFileNumber <= 81) {
|
||||
MsbtInfo *info = getMsbtInfoForIndex(mCurrentTextFileNumber);
|
||||
if (LMS_GetTextIndexByLabel(info, label) >= 0) {
|
||||
return mCurrentTextFileNumber;
|
||||
}
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < 82; i++) {
|
||||
if (getMsbtInfoForIndex(i) != nullptr) {
|
||||
if (LMS_GetTextIndexByLabel(getMsbtInfoForIndex(i), label) >= 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
MsbtInfo *dMessage_c::getMsbtInfoForIndex(s32 index) {
|
||||
return sInstance->getMsbtInfoForIndexInternal(index);
|
||||
}
|
||||
|
||||
MsbtInfo *dMessage_c::getMsbtInfoForIndexInternal(s32 index) {
|
||||
UnkTextThing *thing = UnkTextThing::getInstance();
|
||||
MsbtInfo *overrideMsbt = thing->getOverrideMsbtInfo(index);
|
||||
if (overrideMsbt != nullptr && thing->getShouldOverrideData() == true) {
|
||||
return overrideMsbt;
|
||||
}
|
||||
return mpMsgs[index];
|
||||
}
|
||||
|
||||
MsbfInfo *dMessage_c::getMsbfInfoForIndex(s32 index) {
|
||||
return sInstance->getMsbfInfoForIndexInternal(index);
|
||||
}
|
||||
|
||||
MsbfInfo *dMessage_c::getMsbfInfoForIndexInternal(s32 index) {
|
||||
UnkTextThing *thing = UnkTextThing::getInstance();
|
||||
MsbfInfo *overrideMsbf = thing->getOverrideMsbfInfo(index);
|
||||
if (overrideMsbf != nullptr && thing->getShouldOverrideData() == true) {
|
||||
return overrideMsbf;
|
||||
}
|
||||
return mpFlows[index];
|
||||
}
|
||||
|
||||
extern "C" u8 fn_80054F30();
|
||||
|
||||
static SizedString<8> sCurrentLanguage;
|
||||
const char *dMessage_c::getLanguageIdentifier() {
|
||||
u8 lang = fn_80054F30();
|
||||
if (lang == 3) {
|
||||
sCurrentLanguage = "fr_US";
|
||||
} else if (lang == 4) {
|
||||
sCurrentLanguage = "es_US";
|
||||
} else {
|
||||
sCurrentLanguage = "en_US";
|
||||
}
|
||||
return sCurrentLanguage;
|
||||
}
|
||||
|
||||
const char *dMessage_c::getArcNameByIndex(s32 idx, bool global) {
|
||||
return getArcNameByIndexInternal(idx, global);
|
||||
}
|
||||
|
||||
const char *dMessage_c::getArcNameByIndexInternal(s32 idx, bool global) {
|
||||
return sArcNames[idx];
|
||||
}
|
||||
|
||||
void *dMessage_c::getDataFromMsbArc(s32 number, const char *fileName, bool global) {
|
||||
SizedString<128> path;
|
||||
path.sprintf("%s/%s", getLanguageIdentifier(), getArcNameByIndex(number, global));
|
||||
return OarcManager::GetInstance()->getData(path, fileName);
|
||||
}
|
||||
|
||||
void dMessage_c::setZevFromMsbArc() {
|
||||
SizedString<128> path;
|
||||
path.sprintf("%s/dat/zev.dat", getArcNameByIndex(0, false));
|
||||
sZev0 = getDataFromMsbArc(0, path, false);
|
||||
sZevStage = nullptr;
|
||||
}
|
||||
|
||||
void dMessage_c::setStageZevFromMsbArc() {
|
||||
SizedString<32> stage = dScGame_c::currentSpawnInfo.stageName;
|
||||
char buf[2];
|
||||
buf[0] = stage[1];
|
||||
buf[1] = '\0';
|
||||
|
||||
SizedString<128> path;
|
||||
|
||||
int i = atoi(buf) + 1;
|
||||
|
||||
// TODO figure out what this is
|
||||
if (stage == "t_tkm24" || stage == "t_tkm26") {
|
||||
i = 2;
|
||||
} else if (i < 1 || 6 <= i) {
|
||||
i = 0;
|
||||
}
|
||||
path.sprintf("%s/dat/zev.dat", getArcNameByIndex(i, false));
|
||||
sZevStage = getDataFromMsbArc(i, path, false);
|
||||
}
|
||||
|
||||
void *dMessage_c::sZev0;
|
||||
void *dMessage_c::sZevStage;
|
||||
|
||||
void *dMessage_c::getZev0Internal() {
|
||||
UnkTextThing *thing = UnkTextThing::getInstance();
|
||||
void *overrideZev = thing->getOverrideZev0();
|
||||
if (overrideZev != nullptr && thing->getShouldOverrideData() == true) {
|
||||
return overrideZev;
|
||||
}
|
||||
return sZev0;
|
||||
}
|
||||
|
||||
void *dMessage_c::getZevStageInternal() {
|
||||
UnkTextThing *thing = UnkTextThing::getInstance();
|
||||
void *overrideZev = thing->getOverrideStageZev();
|
||||
if (overrideZev != nullptr && thing->getShouldOverrideData() == true) {
|
||||
return overrideZev;
|
||||
}
|
||||
return sZevStage;
|
||||
}
|
||||
|
||||
s32 dMessage_c::getArcIndexForFile(const char *fileName) {
|
||||
char buf[2];
|
||||
buf[0] = fileName[0];
|
||||
buf[1] = '\0';
|
||||
return atoi(buf);
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_heap.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/d_sys.h"
|
||||
#include "f/f_base.h"
|
||||
@@ -67,7 +68,6 @@ extern "C" u32 TITLE_SCREEN_CHANGE;
|
||||
extern "C" void fn_80059450();
|
||||
extern "C" void fn_80058C90(s32);
|
||||
extern "C" void fn_80015E40();
|
||||
extern "C" const char *getUsedLanguageString();
|
||||
|
||||
static const char *const sFileSelect = "FileSelect";
|
||||
static const char *const sSkb = "SoftwareKeyboard";
|
||||
@@ -98,7 +98,7 @@ int dScTitle_c::create() {
|
||||
LayoutArcManager::GetInstance()->loadLayoutArcFromDisk(sSkb, nullptr);
|
||||
mDvd_toMainRam_normal_c::create2(&mpSkbArc, "/SKB/sofkeybd.arc", 0, dHeap::work2Heap.heap);
|
||||
SizedString<128> fntPath;
|
||||
fntPath.sprintf("/US/Font/%s/%s", getUsedLanguageString(), "normal_02.brfnt");
|
||||
fntPath.sprintf("/US/Font/%s/%s", dMessage_c::getLanguageIdentifier(), "normal_02.brfnt");
|
||||
mDvd_toMainRam_normal_c::create2(&mpSkbFont, fntPath, 0, dHeap::work2Heap.heap);
|
||||
fn_8035E310(BGM_MGR);
|
||||
}
|
||||
|
||||
+54
-46
@@ -164,7 +164,7 @@ dTagProcessor_c::dTagProcessor_c() {
|
||||
field_0x890 = 0;
|
||||
field_0x8FC = -1;
|
||||
field_0x900 = -1;
|
||||
resetSomeFloats();
|
||||
resetLineData();
|
||||
field_0x81C = 0;
|
||||
field_0x820 = 0;
|
||||
setNumericArg0(0);
|
||||
@@ -200,7 +200,7 @@ dTagProcessor_c::dTagProcessor_c() {
|
||||
field_0xEE3 = 0;
|
||||
field_0xEE4 = 0;
|
||||
field_0x004 = nullptr;
|
||||
field_0x90C = 0x24;
|
||||
mMsgWindowSubtype = 0x24;
|
||||
field_0x90D = 4;
|
||||
field_0xEF0 = 0;
|
||||
field_0xEF1 = 0;
|
||||
@@ -212,8 +212,17 @@ struct StackThing {
|
||||
wchar_t us[4];
|
||||
};
|
||||
|
||||
void dTagProcessor_c::eventFlowTextProcessingRelated(
|
||||
dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen
|
||||
void dTagProcessor_c::format(
|
||||
dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, ...
|
||||
) {
|
||||
va_list l;
|
||||
va_start(l, str);
|
||||
formatV(textBox, src, dest, destLen, pOutLen, unk, l);
|
||||
va_end(l);
|
||||
}
|
||||
|
||||
void dTagProcessor_c::formatV(
|
||||
dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, va_list list
|
||||
) {
|
||||
s32 state3 = 0;
|
||||
s32 state4 = 0;
|
||||
@@ -223,11 +232,11 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
|
||||
|
||||
// FPR regswap between float1 and float2
|
||||
f32 float1, float2;
|
||||
float2 = float1 = fn_800B8040(0, field_0x90C);
|
||||
float2 = float1 = fn_800B8040(0, mMsgWindowSubtype);
|
||||
|
||||
if (textBox != nullptr) {
|
||||
float1 *= textBox->getMyScale();
|
||||
resetSomeFloats();
|
||||
resetLineData();
|
||||
textBox->set0x1F8(0);
|
||||
}
|
||||
|
||||
@@ -241,7 +250,7 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
|
||||
dest[1] = x.us[1];
|
||||
dest[2] = x.us[2];
|
||||
dest[3] = x.us[3];
|
||||
dest[4] = mCommandInsert;
|
||||
dest[4] = mLineData.mNumLines;
|
||||
}
|
||||
|
||||
StackThing yTmp;
|
||||
@@ -251,7 +260,7 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
|
||||
wchar_t c = *src;
|
||||
if (c == nullptr) {
|
||||
if (textBox != nullptr) {
|
||||
mCommandInsert++;
|
||||
mLineData.mNumLines++;
|
||||
}
|
||||
*writePtr = '\0';
|
||||
goto end;
|
||||
@@ -344,7 +353,7 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
|
||||
} break;
|
||||
case 0x10008:
|
||||
if (textBox != nullptr) {
|
||||
float1 = fn_800B8040(((u8 *)endPtr)[0], field_0x90C);
|
||||
float1 = fn_800B8040(((u8 *)endPtr)[0], mMsgWindowSubtype);
|
||||
float1 *= textBox->getMyScale();
|
||||
}
|
||||
writePtr = writeTextNormal(src, writePtr, &local_b4, cmdLen, state4);
|
||||
@@ -407,14 +416,14 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
|
||||
}
|
||||
} else {
|
||||
if (textBox != nullptr) {
|
||||
if (c == 10) {
|
||||
if (c == L'\n') {
|
||||
*writePtr = c;
|
||||
src++;
|
||||
writePtr++;
|
||||
mCommandInsert++;
|
||||
s32 i10 = getNumLines(field_0x90C);
|
||||
if (mCommandInsert % i10 == 0) {
|
||||
float1 = fn_800B8040(0, field_0x90C);
|
||||
mLineData.mNumLines++;
|
||||
s32 i10 = getMaxNumLines(mMsgWindowSubtype);
|
||||
if (mLineData.mNumLines % i10 == 0) {
|
||||
float1 = fn_800B8040(0, mMsgWindowSubtype);
|
||||
float1 *= textBox->getMyScale();
|
||||
}
|
||||
if (textBox != nullptr) {
|
||||
@@ -423,12 +432,13 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
|
||||
writePtr[1] = buf[1];
|
||||
writePtr[2] = buf[2];
|
||||
writePtr[3] = buf[3];
|
||||
writePtr[4] = mCommandInsert;
|
||||
writePtr[4] = mLineData.mNumLines;
|
||||
writePtr += 5;
|
||||
}
|
||||
} else {
|
||||
const nw4r::ut::Font *fnt = textBox->GetFont();
|
||||
field_0x914[mCommandInsert] += float1 * fnt->GetCharWidth(*src) + textBox->GetCharSpace();
|
||||
mLineData.mLineWidths[mLineData.mNumLines] +=
|
||||
float1 * fnt->GetCharWidth(*src) + textBox->GetCharSpace();
|
||||
writePtr = fn_800B5FD0(*src, writePtr, nullptr);
|
||||
src++;
|
||||
}
|
||||
@@ -624,16 +634,16 @@ nw4r::ut::Operation dTagProcessor_c::ProcessTags(nw4r::ut::Rect *rect, u16 ch, n
|
||||
}
|
||||
|
||||
void dTagProcessor_c::fn_800B4FF0(nw4r::ut::Rect *rect, nw4r::ut::PrintContext<wchar_t> *ctx, u8 cmdLen, wchar_t *ptr) {
|
||||
if (field_0x90C != 22 && field_0x90C != 30 && field_0xEE0 != 0) {
|
||||
if (mMsgWindowSubtype != 22 && mMsgWindowSubtype != 30 && field_0xEE0 != 0) {
|
||||
int arg = ptr[0];
|
||||
nw4r::lyt::Size textBoxSize = field_0x004->GetSize();
|
||||
nw4r::lyt::Size fontSize = field_0x004->GetFontSize();
|
||||
int i1 = getNumLines(field_0x90C);
|
||||
if (arg % i1 == 0 && field_0x90C != 31 && field_0x90C != 8) {
|
||||
int i1 = getMaxNumLines(mMsgWindowSubtype);
|
||||
if (arg % i1 == 0 && mMsgWindowSubtype != 31 && mMsgWindowSubtype != 8) {
|
||||
int u = 0;
|
||||
int v = 0;
|
||||
for (int i = arg; i < arg + getNumLines(field_0x90C) && i < 0x32; i++) {
|
||||
f32 f6 = getFloat(i);
|
||||
for (int i = arg; i < arg + getMaxNumLines(mMsgWindowSubtype) && i < 0x32; i++) {
|
||||
f32 f6 = getLineWidth(i);
|
||||
if (f6 > 0.0f) {
|
||||
v++;
|
||||
if (u != 0) {
|
||||
@@ -650,7 +660,7 @@ void dTagProcessor_c::fn_800B4FF0(nw4r::ut::Rect *rect, nw4r::ut::PrintContext<w
|
||||
// completely hidden in the Ghidra decompiler, apparently
|
||||
// because the results aren't used?
|
||||
|
||||
if (u < getNumLines(field_0x90C)) {
|
||||
if (u < getMaxNumLines(mMsgWindowSubtype)) {
|
||||
f32 w1 = fontSize.width * 0.5f;
|
||||
f32 h1 = fontSize.height * 0.5f;
|
||||
if (!(w1 < UnkTextThing::getField0x758())) {
|
||||
@@ -660,7 +670,8 @@ void dTagProcessor_c::fn_800B4FF0(nw4r::ut::Rect *rect, nw4r::ut::PrintContext<w
|
||||
h1 = UnkTextThing::getField0x758();
|
||||
}
|
||||
|
||||
f32 f7 = (fontSize.height + field_0x004->GetLineSpace()) * 0.5f * (getNumLines(field_0x90C) - v);
|
||||
f32 f7 =
|
||||
(fontSize.height + field_0x004->GetLineSpace()) * 0.5f * (getMaxNumLines(mMsgWindowSubtype) - v);
|
||||
field_0x814 = ctx->writer->GetCursorY();
|
||||
field_0x818 = ctx->y;
|
||||
field_0xEE4 = 1;
|
||||
@@ -671,13 +682,13 @@ void dTagProcessor_c::fn_800B4FF0(nw4r::ut::Rect *rect, nw4r::ut::PrintContext<w
|
||||
}
|
||||
}
|
||||
|
||||
f32 f7 = getFloat(arg);
|
||||
f32 f8 = (textBoxSize.width - f7) * 0.5f;
|
||||
if ((field_0x90C < 6 || field_0x90C >= 9) && field_0x90C != 30) {
|
||||
f8 = 0.0f;
|
||||
f32 lineWidth = getLineWidth(arg);
|
||||
f32 margin = (textBoxSize.width - lineWidth) * 0.5f;
|
||||
if ((mMsgWindowSubtype < 6 || mMsgWindowSubtype >= 9) && mMsgWindowSubtype != 30) {
|
||||
margin = 0.0f;
|
||||
}
|
||||
if (f8 > 0.0f) {
|
||||
ctx->writer->SetCursorX(ctx->writer->GetCursorX() + f8);
|
||||
if (margin > 0.0f) {
|
||||
ctx->writer->SetCursorX(ctx->writer->GetCursorX() + margin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -685,20 +696,20 @@ void dTagProcessor_c::fn_800B4FF0(nw4r::ut::Rect *rect, nw4r::ut::PrintContext<w
|
||||
void dTagProcessor_c::setColor(nw4r::ut::Rect *rect, nw4r::ut::PrintContext<wchar_t> *ctx, u8 cmdLen, wchar_t *buf) {
|
||||
u16 cmd = buf[0];
|
||||
if (cmd == 0xFFFF) {
|
||||
restoreColor(ctx, field_0x90C);
|
||||
restoreColor(ctx, mMsgWindowSubtype);
|
||||
return;
|
||||
}
|
||||
nw4r::ut::Color c1 = FontColors1[cmd & 0xFFFF];
|
||||
nw4r::ut::Color c2 = FontColors2[cmd & 0xFFFF];
|
||||
if (cmd == 0) {
|
||||
if (field_0x90C == 2) {
|
||||
if (mMsgWindowSubtype == 2) {
|
||||
c1.r = 0xFF;
|
||||
c1.g = 0x6E;
|
||||
c1.b = 0x64;
|
||||
c2.r = 0xFF;
|
||||
c2.g = 0x6E;
|
||||
c2.b = 0x64;
|
||||
} else if (field_0x90C == 7) {
|
||||
} else if (mMsgWindowSubtype == 7) {
|
||||
c1.r = 0xE6;
|
||||
c1.g = 0x4B;
|
||||
c1.b = 0x32;
|
||||
@@ -707,14 +718,14 @@ void dTagProcessor_c::setColor(nw4r::ut::Rect *rect, nw4r::ut::PrintContext<wcha
|
||||
c2.b = 0x32;
|
||||
}
|
||||
} else if (cmd == 1) {
|
||||
if (field_0x90C == 2) {
|
||||
if (mMsgWindowSubtype == 2) {
|
||||
c1.r = 0xF5;
|
||||
c1.g = 0x64;
|
||||
c1.b = 0x5A;
|
||||
c2.r = 0xC8;
|
||||
c2.g = 0x64;
|
||||
c2.b = 0x5A;
|
||||
} else if (field_0x90C == 7) {
|
||||
} else if (mMsgWindowSubtype == 7) {
|
||||
c1.r = 0xB4;
|
||||
c1.g = 0x50;
|
||||
c1.b = 0x50;
|
||||
@@ -722,7 +733,7 @@ void dTagProcessor_c::setColor(nw4r::ut::Rect *rect, nw4r::ut::PrintContext<wcha
|
||||
c2.g = 0x40;
|
||||
c2.b = 0x40;
|
||||
}
|
||||
} else if (cmd == 3 && field_0x90C >= 2 && field_0x90C < 5) {
|
||||
} else if (cmd == 3 && mMsgWindowSubtype >= 2 && mMsgWindowSubtype < 5) {
|
||||
c1.r = 0x50;
|
||||
c1.g = 0xE6;
|
||||
c1.b = 0xFA;
|
||||
@@ -824,7 +835,7 @@ void dTagProcessor_c::fn_800B61B0(u8 cmdLen, wchar_t *ptr) {
|
||||
}
|
||||
|
||||
void dTagProcessor_c::fn_800B61D0(nw4r::ut::Rect *rect, nw4r::ut::PrintContext<wchar_t> *ctx, u8 cmdLen, wchar_t *ptr) {
|
||||
f32 scale = fn_800B8040(*(char *)ptr, field_0x90C);
|
||||
f32 scale = fn_800B8040(*(char *)ptr, mMsgWindowSubtype);
|
||||
if (field_0x004 != nullptr) {
|
||||
scale *= field_0x004->getMyScale();
|
||||
}
|
||||
@@ -973,17 +984,14 @@ f32 dTagProcessor_c::fn_800B8040(s8 factor, u32 windowType) {
|
||||
case -1: x = 0.68f; break;
|
||||
case -0: x = 0.8f; break;
|
||||
case 1: x = 0.95f; break;
|
||||
case 2:
|
||||
x = 1.1f;
|
||||
break;
|
||||
// @bug: No default, so uninitialized is possible
|
||||
case 2: x = 1.1f; break;
|
||||
}
|
||||
x *= UnkTextThing::getFn800B1F10();
|
||||
return x * f1;
|
||||
}
|
||||
}
|
||||
|
||||
s32 dTagProcessor_c::getNumLines(s32 arg) {
|
||||
s32 dTagProcessor_c::getMaxNumLines(s32 arg) {
|
||||
if (arg >= 6 && arg < 8) {
|
||||
return 4;
|
||||
} else if (arg == 9) {
|
||||
@@ -1037,15 +1045,15 @@ s32 dTagProcessor_c::tickPauseFrame() {
|
||||
return mPauseFramesLeft;
|
||||
}
|
||||
|
||||
void dTagProcessor_c::resetSomeFloats() {
|
||||
void dTagProcessor_c::resetLineData() {
|
||||
for (int i = 0; i < 0x32; i++) {
|
||||
field_0x914[i] = 0.0f;
|
||||
mLineData.mLineWidths[i] = 0.0f;
|
||||
}
|
||||
mCommandInsert = 0;
|
||||
mLineData.mNumLines = 0;
|
||||
}
|
||||
|
||||
f32 dTagProcessor_c::getFloat(s32 i) {
|
||||
return field_0x914[i];
|
||||
f32 dTagProcessor_c::getLineWidth(s32 i) {
|
||||
return mLineData.mLineWidths[i];
|
||||
}
|
||||
|
||||
void dTagProcessor_c::setNumericArg0(s32 arg) {
|
||||
|
||||
+25
-31
@@ -36,7 +36,7 @@ UnkTextThing::UnkTextThing() {
|
||||
|
||||
for (int i = 0; i < 82; i++) {
|
||||
field_buf0[i] = 0;
|
||||
field_buf2[i] = 0;
|
||||
mMsbts[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 23; i++) {
|
||||
@@ -46,25 +46,25 @@ UnkTextThing::UnkTextThing() {
|
||||
|
||||
for (int i = 0; i < 80; i++) {
|
||||
field_buf1[i] = 0;
|
||||
field_buf3[i] = 0;
|
||||
mMsbfs[i] = 0;
|
||||
}
|
||||
|
||||
field_0x74C = 0;
|
||||
field_0x750 = 0;
|
||||
mOverrideZev0 = nullptr;
|
||||
mOverrideStageZev = nullptr;
|
||||
|
||||
field_0x7B4 = false;
|
||||
mShouldOverrideData = false;
|
||||
field_0x7B5 = false;
|
||||
|
||||
field_0x004 = "";
|
||||
field_0x084 = "";
|
||||
field_0x104 = "";
|
||||
|
||||
field_0x7B6 = 0;
|
||||
mShouldHookAllocations = false;
|
||||
|
||||
field_0x7A8 = 0;
|
||||
field_0x788 = 0.45;
|
||||
field_0x78C = -5.0f;
|
||||
field_0x7AE = 4;
|
||||
mMsgWindowWaitDelay = 4;
|
||||
field_0x7B7 = 0;
|
||||
field_0x7AA = 5;
|
||||
field_0x7AC = 15;
|
||||
@@ -72,14 +72,8 @@ UnkTextThing::UnkTextThing() {
|
||||
field_0x7B2 = false;
|
||||
|
||||
// Weird init order
|
||||
field_0x7B8.a = 0;
|
||||
field_0x7B8.b = 0;
|
||||
field_0x7B8.g = 0;
|
||||
field_0x7B8.r = 0;
|
||||
field_0x7BC.a = 0;
|
||||
field_0x7BC.b = 0;
|
||||
field_0x7BC.g = 0;
|
||||
field_0x7BC.r = 0;
|
||||
field_0x7B8.r = field_0x7B8.g = field_0x7B8.b = field_0x7B8.a = 0;
|
||||
field_0x7BC.r = field_0x7BC.g = field_0x7BC.b = field_0x7BC.a = 0;
|
||||
|
||||
field_0x790 = -1.0f;
|
||||
field_0x794 = 100.0f;
|
||||
@@ -92,9 +86,9 @@ void UnkTextThing::destroy() {
|
||||
field_buf0[i] = nullptr;
|
||||
}
|
||||
|
||||
if (field_buf2[i] != nullptr) {
|
||||
destroyMsg(field_buf2[i]);
|
||||
field_buf2[i] = nullptr;
|
||||
if (mMsbts[i] != nullptr) {
|
||||
destroyMsg(mMsbts[i]);
|
||||
mMsbts[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,20 +110,20 @@ void UnkTextThing::destroy() {
|
||||
field_buf1[i] = nullptr;
|
||||
}
|
||||
|
||||
if (field_buf3[i] != nullptr) {
|
||||
destroyFlow(field_buf3[i]);
|
||||
field_buf3[i] = nullptr;
|
||||
if (mMsbfs[i] != nullptr) {
|
||||
destroyFlow(mMsbfs[i]);
|
||||
mMsbfs[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (field_0x74C != nullptr) {
|
||||
destroyUnk(field_0x74C);
|
||||
field_0x74C = nullptr;
|
||||
if (mOverrideZev0 != nullptr) {
|
||||
destroyUnk(mOverrideZev0);
|
||||
mOverrideZev0 = nullptr;
|
||||
}
|
||||
|
||||
if (field_0x750 != nullptr) {
|
||||
destroyUnk(field_0x750);
|
||||
field_0x750 = nullptr;
|
||||
if (mOverrideStageZev != nullptr) {
|
||||
destroyUnk(mOverrideStageZev);
|
||||
mOverrideStageZev = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,13 +170,13 @@ f32 UnkTextThing::fn_800B2040() {
|
||||
}
|
||||
|
||||
void UnkTextThing::destroyMsg(MsbtInfo *msg) {
|
||||
field_0x7B6 = true;
|
||||
mShouldHookAllocations = true;
|
||||
LMS_CloseMessage(msg);
|
||||
field_0x7B6 = false;
|
||||
mShouldHookAllocations = false;
|
||||
}
|
||||
|
||||
void UnkTextThing::destroyFlow(MsbfInfo *flow) {
|
||||
field_0x7B6 = true;
|
||||
mShouldHookAllocations = true;
|
||||
LMS_CloseFlow(flow);
|
||||
field_0x7B6 = false;
|
||||
mShouldHookAllocations = false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
|
||||
|
||||
#include "d/d_textwindow_unk.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
#include "toBeSorted/other_sound_stuff.h"
|
||||
|
||||
TextWindowUnk::TextWindowUnk(dTagProcessor_c *c) {
|
||||
mpTagProcessor = c;
|
||||
reset();
|
||||
}
|
||||
|
||||
bool TextWindowUnk::fn_800B2130(const char *label, dTextBox_c *textBox, dLytMsgWindowCharData *charData, bool b) {
|
||||
if (!checkEndReached()) {
|
||||
return false;
|
||||
}
|
||||
reset();
|
||||
|
||||
field_0x1402 = label;
|
||||
mpCharacterData = charData;
|
||||
mpTextBox = textBox;
|
||||
|
||||
const wchar_t *msg = dMessage_c::getTextMessageByLabel(label, mpTagProcessor, true, nullptr, 0);
|
||||
if (b) {
|
||||
dTagProcessor_c *p = mpTagProcessor;
|
||||
p->setTextbox(mpTextBox);
|
||||
p->setField_0xEE0(1);
|
||||
}
|
||||
|
||||
// Oh no
|
||||
mpTagProcessor->format(
|
||||
mpTextBox, msg, mRawTextBuffer, ARRAY_LENGTH(mRawTextBuffer), (u32 *)&mRawTextEndPos, nullptr
|
||||
);
|
||||
mLineWidths = mpTagProcessor->getLineData();
|
||||
|
||||
if (mpCharacterData != nullptr) {
|
||||
mpTagProcessor->fn_800B4290(
|
||||
mpTextBox, mRawTextBuffer, mUnkBuffer, field_0x1458, &field_0x1478, mpCharacterData
|
||||
);
|
||||
if (mpTagProcessor->getMsgWindowSubtype() == 2) {
|
||||
fn_803996B0(lbl_80575DE0, field_0x1402, field_0x1478, mpTagProcessor->getField_0x824());
|
||||
}
|
||||
}
|
||||
|
||||
UnkTextThing::getInstance()->setStr1(label);
|
||||
if (dLytMsgWindow_c::getInstance()->fn_80117390(true) != nullptr) {
|
||||
// Regswap
|
||||
UnkTextThing::getInstance()->setStr2(dLytMsgWindow_c::getInstance()->fn_80117390(true));
|
||||
s32 idx = dMessage_c::getMsbtIndexForLabel(label);
|
||||
if (idx >= 0) {
|
||||
UnkTextThing::getInstance()->setStr3(dMessage_c::getMsbtFileName(idx));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TextWindowUnk::checkLastLineReached() {
|
||||
return mCurrentLine >= mpTagProcessor->getMaxNumLines(mpTagProcessor->getMsgWindowSubtype());
|
||||
}
|
||||
|
||||
bool TextWindowUnk::checkEndReached() const {
|
||||
return mRawTextPos >= mRawTextEndPos;
|
||||
}
|
||||
|
||||
void MsgWindowBlurRelated::build() {
|
||||
for (int i = 0; i < 1023; i++) {
|
||||
mData[i].reset();
|
||||
}
|
||||
}
|
||||
|
||||
void MsgWindowBlurRelated::drawTextBlur(dLytTextLight *thing, mVec2_c size, u8 alpha) {
|
||||
s8 t = -1;
|
||||
for (int i = 0; i < 1023; i++) {
|
||||
if (mData[i].displayTimerMaybe >= 0) {
|
||||
if (t == -1) {
|
||||
mData[i].displayTimerMaybe++;
|
||||
|
||||
if (mData[i].displayTimerMaybe >= thing->getAnimDuration()) {
|
||||
mData[i].displayTimerMaybe = 0;
|
||||
}
|
||||
t = mData[i].displayTimerMaybe;
|
||||
} else {
|
||||
mData[i].displayTimerMaybe = t;
|
||||
}
|
||||
mVec3_c v((size.x + mData[i].posX) / get_805751A4(), size.y + mData[i].posY, 0.0f);
|
||||
thing->draw(mData[i].displayTimerMaybe, v, alpha, mData[i].field_0x08);
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
-26
@@ -1,6 +1,7 @@
|
||||
#include "d/lyt/d2d.h"
|
||||
|
||||
#include "d/d_font_manager.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/d_window.h"
|
||||
@@ -278,9 +279,6 @@ LytBase_c::~LytBase_c() {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" const char *getUsedLanguageString();
|
||||
extern "C" nw4r::ut::TagProcessorBase<wchar_t> *GLOBAL_TEXT_MANAGER;
|
||||
|
||||
bool LytBase_c::build(const char *name, m2d::ResAccIf_c *acc) {
|
||||
if (mLayout.GetRootPane() != nullptr) {
|
||||
return true;
|
||||
@@ -332,7 +330,7 @@ bool LytBase_c::build(const char *name, m2d::ResAccIf_c *acc) {
|
||||
}
|
||||
|
||||
SizedString<0x80> localizedName;
|
||||
localizedName.sprintf("%s_%s", getUsedLanguageString(), fileName);
|
||||
localizedName.sprintf("%s_%s", dMessage_c::getLanguageIdentifier(), fileName);
|
||||
|
||||
void *data = acc->getAccessor()->GetResource(0, localizedName, nullptr);
|
||||
if (data == nullptr) {
|
||||
@@ -343,7 +341,7 @@ bool LytBase_c::build(const char *name, m2d::ResAccIf_c *acc) {
|
||||
|
||||
bool ok = mLayout.Build(resource, acc->getAccessor());
|
||||
if (ok) {
|
||||
mLayout.SetTagProcessor(GLOBAL_TEXT_MANAGER);
|
||||
mLayout.SetTagProcessor(dMessage_c::getGlobalTagProcessor());
|
||||
calc();
|
||||
setPropertiesRecursive(mLayout.GetRootPane(), -9999.0f, -9999.0f, -9999.0f, -9999.0f, -9999.0f);
|
||||
}
|
||||
@@ -441,9 +439,6 @@ void LytBase_c::setPropertiesRecursive(nw4r::lyt::Pane *pane, f32 posX, f32 posY
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" const wchar_t *fn_801B2600(const char *);
|
||||
extern "C" void fn_800B0F40(dTextBox_c *);
|
||||
|
||||
void LytBase_c::setProperties(nw4r::lyt::Pane *pane, f32 posX, f32 posY, f32 scale, f32 spaceX, f32 spaceY) {
|
||||
if (pane->GetName()[0] != 'T') {
|
||||
return;
|
||||
@@ -456,7 +451,7 @@ void LytBase_c::setProperties(nw4r::lyt::Pane *pane, f32 posX, f32 posY, f32 sca
|
||||
|
||||
textBox->AllocStringBuffer(0x200);
|
||||
textBox->setLytBase(this);
|
||||
fn_800B0F40(textBox);
|
||||
textBox->loadTextFormatVars();
|
||||
|
||||
if (posX != -9999.0f || posY != -9999.0f) {
|
||||
if (posX == -9999.0f) {
|
||||
@@ -606,17 +601,16 @@ bool LytBase_c::fn_800ABCE0(
|
||||
str1.append(fmt);
|
||||
}
|
||||
|
||||
const char *text = LMS_GetTextByLabel(getMsbtInfo(), str1);
|
||||
const wchar_t *text = LMS_GetTextByLabel(getMsbtInfo(), str1);
|
||||
if (text == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
textbox1->fn_800AF930(fn_801B2600(text));
|
||||
textbox1->setTextWithGlobalTextProcessor(dMessage_c::formatText(text));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Now largely the same functions again, but with an additional argument
|
||||
bool LytBase_c::fn_800ABE50(dTextBox_c *textbox, int arg, void *unk) {
|
||||
bool LytBase_c::fn_800ABE50(dTextBox_c *textbox, wchar_t *destBuf, u32 maxLen) {
|
||||
if (getMsbtInfo() == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@@ -651,15 +645,15 @@ bool LytBase_c::fn_800ABE50(dTextBox_c *textbox, int arg, void *unk) {
|
||||
if (ty == 1) {
|
||||
dTextBox_c *otherBox = getTextBox(list->GetString());
|
||||
if (otherBox != nullptr) {
|
||||
return fn_800AC040(textbox, otherBox, arg, unk);
|
||||
return fn_800AC040(textbox, otherBox, destBuf, maxLen);
|
||||
}
|
||||
} else {
|
||||
return fn_800AC1AC(list, textbox, textbox, arg, unk);
|
||||
return fn_800AC1AC(list, textbox, textbox, destBuf, maxLen);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LytBase_c::fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk) {
|
||||
bool LytBase_c::fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf, u32 maxLen) {
|
||||
u16 num = textbox2->GetExtUserDataNum();
|
||||
if (num == 0) {
|
||||
return false;
|
||||
@@ -679,13 +673,11 @@ bool LytBase_c::fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg,
|
||||
if (found != 1) {
|
||||
return false;
|
||||
}
|
||||
return fn_800AC1AC(list, textbox1, textbox2, arg, unk);
|
||||
return fn_800AC1AC(list, textbox1, textbox2, destBuf, maxLen);
|
||||
}
|
||||
|
||||
extern "C" void fn_800AF840(dTextBox_c *textbox1, MsbtInfo *, const char *, int arg, void *unk);
|
||||
|
||||
bool LytBase_c::fn_800AC1AC(
|
||||
const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk
|
||||
const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf, u32 maxLen
|
||||
) {
|
||||
s32 userDatInt = userDatum->GetInt();
|
||||
SizedString<0x40> str1;
|
||||
@@ -698,7 +690,7 @@ bool LytBase_c::fn_800AC1AC(
|
||||
str1.append(fmt);
|
||||
}
|
||||
|
||||
fn_800AF840(textbox1, getMsbtInfo(), str1, arg, unk);
|
||||
textbox1->setMessageWithGlobalTextProcessorAndMsbtInfo(getMsbtInfo(), str1, destBuf, maxLen);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -811,7 +803,7 @@ bool AnmGroupBase_c::init(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AnmGroupBase_c::setDirection(bool b) {
|
||||
bool AnmGroupBase_c::bind(bool bDisable) {
|
||||
nw4r::lyt::AnimTransform *anmTransform = mpAnmTransform;
|
||||
if (anmTransform == nullptr) {
|
||||
return false;
|
||||
@@ -821,9 +813,9 @@ bool AnmGroupBase_c::setDirection(bool b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nw4r::lyt::BindAnimation(mpGroup, anmTransform, false, b);
|
||||
nw4r::lyt::BindAnimation(mpGroup, anmTransform, false, bDisable);
|
||||
mFlags |= ANMGROUP_FLAG_BOUND;
|
||||
if (b) {
|
||||
if (bDisable) {
|
||||
mFlags = (mFlags & ~ANMGROUP_FLAG_ENABLE);
|
||||
} else {
|
||||
mFlags |= ANMGROUP_FLAG_ENABLE;
|
||||
@@ -855,7 +847,7 @@ bool AnmGroupBase_c::unbind() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AnmGroupBase_c::afterUnbind() {
|
||||
bool AnmGroupBase_c::remove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -905,7 +897,7 @@ bool AnmGroups::init(
|
||||
|
||||
void AnmGroups::remove() {
|
||||
for (int i = 0; i < mNumAnmGroups; i++) {
|
||||
mpAnmGroups[i].afterUnbind();
|
||||
mpAnmGroups[i].remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ bool dLytAreaCaptionParts_c::init(int first) {
|
||||
mAnmCtrlInUse[i] = false;
|
||||
} else {
|
||||
mAnmGroups[i].init(brlanMap1[i].mFile, &mResAcc, mLyt.getLayout(), brlanMap1[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
mAnmCtrlInUse[i] = true;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ bool dLytAreaCaptionParts_c::init(int first) {
|
||||
mAnmCtrlInUse[i] = false;
|
||||
} else {
|
||||
mAnmGroups[i].init(brlanMap2[i].mFile, &mResAcc, mLyt.getLayout(), brlanMap2[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
mAnmCtrlInUse[i] = true;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ bool dLytAreaCaptionParts_c::remove() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (mAnmCtrlInUse[i]) {
|
||||
mAnmGroups[i].unbind();
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
}
|
||||
mResAcc.detach();
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
#include "d/lyt/d_lyt_auto_caption.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
STATE_DEFINE(dLytAutoCaption_c, Invisible);
|
||||
STATE_DEFINE(dLytAutoCaption_c, In);
|
||||
STATE_DEFINE(dLytAutoCaption_c, OutputText);
|
||||
STATE_DEFINE(dLytAutoCaption_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "autoCaption_00_in.brlan", "G_inOut_00"},
|
||||
{ "autoCaption_00_out.brlan", "G_inOut_00"},
|
||||
{ "autoCaption_00_loop.brlan", "G_loop_00"},
|
||||
{"autoCaption_00_textLine.brlan", "G_textLine_00"},
|
||||
};
|
||||
|
||||
#define AUTO_CAPTION_ANIM_IN 0
|
||||
#define AUTO_CAPTION_ANIM_OUT 1
|
||||
#define AUTO_CAPTION_ANIM_LOOP 2
|
||||
#define AUTO_CAPTION_ANIM_TEXTLINE 3
|
||||
|
||||
#define AUTO_CAPTION_NUM_ANIMS 4
|
||||
|
||||
static const char *sPanes[] = {
|
||||
"N_inOutAll_00",
|
||||
};
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_textBox_00",
|
||||
"T_textBoxS_00",
|
||||
};
|
||||
|
||||
static const char *sGroupName = "G_ref_00";
|
||||
|
||||
void dLytAutoCaption_c::initializeState_Invisible() {}
|
||||
void dLytAutoCaption_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytAutoCaption_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytAutoCaption_c::initializeState_In() {
|
||||
s32 numTextLines = mpTextboxes[0]->calcTextLines(mpTextboxes[0]->GetString(), mpTagProcessor);
|
||||
f32 lineWidth = mpTextboxes[0]->GetLineWidth(nullptr);
|
||||
f32 frame = 0.0f;
|
||||
if (lineWidth <= 226.0f) {
|
||||
if (numTextLines > 1) {
|
||||
frame = 1.0f;
|
||||
}
|
||||
} else if (numTextLines > 1) {
|
||||
frame = 3.0f;
|
||||
} else {
|
||||
frame = 2.0f;
|
||||
}
|
||||
|
||||
mAnm[AUTO_CAPTION_ANIM_TEXTLINE].setAnimEnable(true);
|
||||
mAnm[AUTO_CAPTION_ANIM_TEXTLINE].setFrame(frame);
|
||||
mLyt.calc();
|
||||
mAnm[AUTO_CAPTION_ANIM_TEXTLINE].setAnimEnable(false);
|
||||
|
||||
mAnm[AUTO_CAPTION_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[AUTO_CAPTION_ANIM_IN].setFrame(0.0f);
|
||||
}
|
||||
void dLytAutoCaption_c::executeState_In() {
|
||||
if (mAnm[AUTO_CAPTION_ANIM_IN].isEndReached()) {
|
||||
mAnm[AUTO_CAPTION_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_OutputText);
|
||||
}
|
||||
}
|
||||
void dLytAutoCaption_c::finalizeState_In() {}
|
||||
|
||||
void dLytAutoCaption_c::initializeState_OutputText() {}
|
||||
void dLytAutoCaption_c::executeState_OutputText() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytAutoCaption_c::finalizeState_OutputText() {}
|
||||
|
||||
void dLytAutoCaption_c::initializeState_Out() {
|
||||
mAnm[AUTO_CAPTION_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[AUTO_CAPTION_ANIM_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytAutoCaption_c::executeState_Out() {
|
||||
if (mAnm[AUTO_CAPTION_ANIM_OUT].isEndReached()) {
|
||||
mAnm[AUTO_CAPTION_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytAutoCaption_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytAutoCaption_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mLyt.setResAcc(resAcc1);
|
||||
mLyt.build("autoCaption_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < AUTO_CAPTION_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc1, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mpPane = mLyt.findPane(sPanes[0]);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
}
|
||||
|
||||
mpTagProcessor = tagProcessor;
|
||||
mShouldBeOpen = false;
|
||||
|
||||
mAnm[AUTO_CAPTION_ANIM_LOOP].setAnimEnable(true);
|
||||
mAnm[AUTO_CAPTION_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[AUTO_CAPTION_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[AUTO_CAPTION_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytAutoCaption_c::remove() {
|
||||
for (int i = 0; i < AUTO_CAPTION_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytAutoCaption_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < AUTO_CAPTION_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
mLyt.calc();
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytAutoCaption_c::draw() {
|
||||
mLyt.draw();
|
||||
}
|
||||
|
||||
void dLytAutoCaption_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
bool dLytAutoCaption_c::isDoneOpening() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_In);
|
||||
}
|
||||
|
||||
void dLytAutoCaption_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytAutoCaption_c::isDoneClosing() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_Out);
|
||||
}
|
||||
|
||||
bool dLytAutoCaption_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithGlobalTextProcessor(text);
|
||||
mpTextboxes[1]->setTextWithGlobalTextProcessor(text);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytAutoCaption_c::checkSomethingMeter() {
|
||||
// TODO - too many dependencies on dLytMeter
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
#include "d/lyt/d_lyt_auto_explain.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
STATE_DEFINE(dLytAutoExplain_c, Invisible);
|
||||
STATE_DEFINE(dLytAutoExplain_c, In);
|
||||
STATE_DEFINE(dLytAutoExplain_c, OutputText);
|
||||
STATE_DEFINE(dLytAutoExplain_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "autoMessage_00_in.brlan", "G_inOut_00"},
|
||||
{ "autoMessage_00_out.brlan", "G_inOut_00"},
|
||||
{"autoMessage_00_line.brlan", "G_line_00"},
|
||||
};
|
||||
|
||||
#define AUTO_EXPLAIN_ANIM_IN 0
|
||||
#define AUTO_EXPLAIN_ANIM_OUT 1
|
||||
#define AUTO_EXPLAIN_ANIM_TEXTLINE 2
|
||||
|
||||
#define AUTO_EXPLAIN_NUM_ANIMS 3
|
||||
|
||||
static const char *sPanes[] = {
|
||||
"N_inOutAll_00",
|
||||
};
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_autoMsg_00",
|
||||
"T_autoMsgS_00",
|
||||
};
|
||||
|
||||
static const char *sGroupName = "G_ref_00";
|
||||
|
||||
void dLytAutoExplain_c::initializeState_Invisible() {}
|
||||
void dLytAutoExplain_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytAutoExplain_c::finalizeState_Invisible() {}
|
||||
|
||||
extern "C" u8 fn_80054F30();
|
||||
|
||||
void dLytAutoExplain_c::initializeState_In() {
|
||||
int numLines = mpTagProcessor->getNumLinesMaybe() - 1;
|
||||
if (fn_80054F30() != 0 && numLines == 3) {
|
||||
numLines = 2;
|
||||
}
|
||||
|
||||
mAnm[AUTO_EXPLAIN_ANIM_TEXTLINE].setAnimEnable(true);
|
||||
mAnm[AUTO_EXPLAIN_ANIM_TEXTLINE].setFrame(numLines);
|
||||
mLyt.calc();
|
||||
mAnm[AUTO_EXPLAIN_ANIM_TEXTLINE].setAnimEnable(false);
|
||||
|
||||
mAnm[AUTO_EXPLAIN_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[AUTO_EXPLAIN_ANIM_IN].setFrame(0.0f);
|
||||
}
|
||||
void dLytAutoExplain_c::executeState_In() {
|
||||
if (mAnm[AUTO_EXPLAIN_ANIM_IN].isEndReached()) {
|
||||
mAnm[AUTO_EXPLAIN_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_OutputText);
|
||||
}
|
||||
}
|
||||
void dLytAutoExplain_c::finalizeState_In() {}
|
||||
|
||||
void dLytAutoExplain_c::initializeState_OutputText() {}
|
||||
void dLytAutoExplain_c::executeState_OutputText() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytAutoExplain_c::finalizeState_OutputText() {}
|
||||
|
||||
void dLytAutoExplain_c::initializeState_Out() {
|
||||
mAnm[AUTO_EXPLAIN_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[AUTO_EXPLAIN_ANIM_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytAutoExplain_c::executeState_Out() {
|
||||
if (mAnm[AUTO_EXPLAIN_ANIM_OUT].isEndReached()) {
|
||||
mAnm[AUTO_EXPLAIN_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytAutoExplain_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytAutoExplain_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mLyt.setResAcc(resAcc1);
|
||||
mLyt.build("autoMessage_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < AUTO_EXPLAIN_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc1, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mpPane = mLyt.findPane(sPanes[0]);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
mpTextboxes[i]->SetTextPositionH(0);
|
||||
// mpTextboxes[i]->SetTextPositionV(0);
|
||||
}
|
||||
|
||||
mpTagProcessor = tagProcessor;
|
||||
mShouldBeOpen = false;
|
||||
|
||||
mAnm[AUTO_EXPLAIN_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[AUTO_EXPLAIN_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[AUTO_EXPLAIN_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytAutoExplain_c::remove() {
|
||||
for (int i = 0; i < AUTO_EXPLAIN_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytAutoExplain_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < AUTO_EXPLAIN_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
mLyt.calc();
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytAutoExplain_c::draw() {
|
||||
mLyt.draw();
|
||||
}
|
||||
|
||||
void dLytAutoExplain_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
bool dLytAutoExplain_c::isDoneOpening() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_In);
|
||||
}
|
||||
|
||||
void dLytAutoExplain_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytAutoExplain_c::isDoneClosing() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_Out);
|
||||
}
|
||||
|
||||
bool dLytAutoExplain_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytAutoExplain_c::checkSomethingMeter() {
|
||||
// TODO - too many dependencies on dLytMeter
|
||||
return false;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ bool dLytBattery_c::init() {
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mAnmGroups[i].init(brlanMap[i].mFile, &mResAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ bool dLytBirdGaugeMain_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
|
||||
for (int i = 0; i < LYT_SKY_GAUGE_MAIN_NUM_ANIMS; i++) {
|
||||
mAnmGroups[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ bool dLytBirdGaugeMain_c::execute() {
|
||||
bool dLytBirdGaugeMain_c::remove() {
|
||||
mLyt.unbindAnims();
|
||||
for (int i = 0; i < LYT_SKY_GAUGE_MAIN_NUM_ANIMS; i++) {
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
|
||||
|
||||
#include "d/lyt/d_lyt_common_a_btn.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_sys.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "aBtn_00_in.brlan", "G_inOut_00"},
|
||||
{ "aBtn_00_loop.brlan", "G_loopBtn_00"},
|
||||
{"aBtn_00_decide.brlan", "G_decide_00"},
|
||||
{ "aBtn_00_out.brlan", "G_inOut_00"},
|
||||
};
|
||||
|
||||
#define A_BTN_ANIM_IN 0
|
||||
#define A_BTN_ANIM_LOOP 1
|
||||
#define A_BTN_ANIM_DECIDE 2
|
||||
#define A_BTN_ANIM_OUT 3
|
||||
|
||||
#define A_BTN_NUM_ANIMS 4
|
||||
|
||||
const dLytCommonABtn_c::executeFunc dLytCommonABtn_c::sExecuteFuncs[4] = {
|
||||
&dLytCommonABtn_c::executeStateInvisible,
|
||||
&dLytCommonABtn_c::executeStateIn,
|
||||
&dLytCommonABtn_c::executeStateVisible,
|
||||
&dLytCommonABtn_c::executeStateDecideOut,
|
||||
};
|
||||
|
||||
bool dLytCommonABtn_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("aBtn_00.brlyt", nullptr);
|
||||
|
||||
for (int i = 0; i < A_BTN_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
}
|
||||
|
||||
resetToInvisble();
|
||||
setSoundVariant(VARIANT_NORMAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytCommonABtn_c::remove() {
|
||||
for (int i = 0; i < A_BTN_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytCommonABtn_c::execute() {
|
||||
runExecuteFunc();
|
||||
if (mState == STATE_INVISIBLE) {
|
||||
return true;
|
||||
}
|
||||
mLyt.calc();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytCommonABtn_c::requestIn() {
|
||||
if (mState != STATE_INVISIBLE) {
|
||||
return false;
|
||||
}
|
||||
mInRequested = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytCommonABtn_c::requestOut(bool b) {
|
||||
if (mState != STATE_VISIBLE) {
|
||||
return false;
|
||||
}
|
||||
mOutRequested = true;
|
||||
field_0x1AC = b;
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::resetToInvisble() {
|
||||
gotoStateInvisible();
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::setSoundVariant(SoundVariant value) {
|
||||
mSoundVariant = value;
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::runExecuteFunc() {
|
||||
executeFunc fn = sExecuteFuncs[mState];
|
||||
if (fn != nullptr) {
|
||||
(this->*fn)();
|
||||
}
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::gotoStateInvisible() {
|
||||
setState(STATE_INVISIBLE);
|
||||
mLyt.unbindAnims();
|
||||
|
||||
d2d::AnmGroup_c &inAnim = mAnm[A_BTN_ANIM_IN];
|
||||
field_0x1A8 = 0;
|
||||
mInRequested = false;
|
||||
mOutRequested = false;
|
||||
mIsDoneOut = false;
|
||||
field_0x1AC = 0;
|
||||
mNoDecide = false;
|
||||
|
||||
inAnim.bind(false);
|
||||
inAnim.setAnimEnable(true);
|
||||
inAnim.setFrame(0.0f);
|
||||
if (dSys::getFrameRate() == 1) {
|
||||
inAnim.setRate(0.5f);
|
||||
} else {
|
||||
inAnim.setRate(1.0f);
|
||||
}
|
||||
mLyt.calc();
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::executeStateInvisible() {
|
||||
if (mInRequested != true) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (field_0x1AC == 1) {
|
||||
gotoStateInvisible();
|
||||
}
|
||||
mInRequested = false;
|
||||
field_0x1A8 = 1;
|
||||
gotoStateIn();
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::gotoStateIn() {
|
||||
setState(STATE_IN);
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::executeStateIn() {
|
||||
d2d::AnmGroup_c &anm = mAnm[A_BTN_ANIM_IN];
|
||||
if (anm.isEndReached() == true) {
|
||||
goToStateVisible();
|
||||
} else {
|
||||
anm.play();
|
||||
}
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::goToStateVisible() {
|
||||
setState(STATE_VISIBLE);
|
||||
mAnm[A_BTN_ANIM_IN].unbind();
|
||||
d2d::AnmGroup_c &anm = mAnm[A_BTN_ANIM_LOOP];
|
||||
anm.bind(false);
|
||||
anm.setFrame(0.0f);
|
||||
if (dSys::getFrameRate() == 1) {
|
||||
anm.setRate(0.5f);
|
||||
} else {
|
||||
anm.setRate(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::executeStateVisible() {
|
||||
if (mOutRequested == true) {
|
||||
goToStateDecideOut();
|
||||
mOutRequested = false;
|
||||
} else {
|
||||
d2d::AnmGroup_c &anm = mAnm[A_BTN_ANIM_LOOP];
|
||||
anm.play();
|
||||
}
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::goToStateDecideOut() {
|
||||
setState(STATE_OUT);
|
||||
mAnm[A_BTN_ANIM_LOOP].unbind();
|
||||
if (mNoDecide == true) {
|
||||
mNoDecide = false;
|
||||
d2d::AnmGroup_c &anm = mAnm[A_BTN_ANIM_OUT];
|
||||
anm.bind(false);
|
||||
anm.setFrame(0.0f);
|
||||
if (dSys::getFrameRate() == 1) {
|
||||
anm.setRate(0.5f);
|
||||
} else {
|
||||
anm.setRate(1.0f);
|
||||
}
|
||||
mOutState = OUT_STATE_OUT;
|
||||
} else {
|
||||
d2d::AnmGroup_c &anm = mAnm[A_BTN_ANIM_DECIDE];
|
||||
anm.bind(false);
|
||||
anm.setAnimEnable(true);
|
||||
anm.setFrame(0.0f);
|
||||
if (dSys::getFrameRate() == 1) {
|
||||
anm.setRate(0.5f);
|
||||
} else {
|
||||
anm.setRate(1.0f);
|
||||
}
|
||||
if (mSoundVariant == VARIANT_NORMAL) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_WINDOW_PRESS_A);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TITLE_PRESS_START);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::executeStateDecideOut() {
|
||||
d2d::AnmGroup_c &decideAnm = mAnm[A_BTN_ANIM_DECIDE];
|
||||
switch (mOutState) {
|
||||
case OUT_STATE_DECIDING: {
|
||||
if (decideAnm.isEndReached() == true) {
|
||||
mOutState = OUT_STATE_GOTO_OUT;
|
||||
if (field_0x1AC == 1) {
|
||||
mIsDoneOut = true;
|
||||
setState(STATE_INVISIBLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
decideAnm.play();
|
||||
break;
|
||||
}
|
||||
case OUT_STATE_GOTO_OUT: {
|
||||
decideAnm.unbind();
|
||||
d2d::AnmGroup_c &anmOut = mAnm[A_BTN_ANIM_OUT];
|
||||
anmOut.bind(false);
|
||||
anmOut.setAnimEnable(true);
|
||||
anmOut.setFrame(0.0f);
|
||||
if (dSys::getFrameRate() == 1) {
|
||||
anmOut.setRate(0.5f);
|
||||
} else {
|
||||
anmOut.setRate(1.0f);
|
||||
}
|
||||
mOutState = OUT_STATE_OUT;
|
||||
break;
|
||||
}
|
||||
case OUT_STATE_OUT: {
|
||||
d2d::AnmGroup_c &anmOut = mAnm[A_BTN_ANIM_OUT];
|
||||
if (anmOut.isEndReached() == true) {
|
||||
mOutState = OUT_STATE_GOTO_INVISIBLE;
|
||||
mIsDoneOut = true;
|
||||
}
|
||||
anmOut.play();
|
||||
break;
|
||||
}
|
||||
case OUT_STATE_GOTO_INVISIBLE: {
|
||||
gotoStateInvisible();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dLytCommonABtn_c::setState(ABtnState state) {
|
||||
mState = state;
|
||||
mOutState = OUT_STATE_DECIDING;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
|
||||
dLytCommonArrow_c::dLytCommonArrow_c() : mStateMgr(*this, sStateID::null) {}
|
||||
|
||||
bool dLytCommonArrow_c::init() {
|
||||
bool dLytCommonArrow_c::build() {
|
||||
void *data = LayoutArcManager::GetInstance()->getLoadedData("CommonArrow");
|
||||
mResAcc.attach(data, "");
|
||||
mLytBase.build("commonArrow_00.brlyt", &mResAcc);
|
||||
@@ -56,16 +56,16 @@ bool dLytCommonArrow_c::init() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytCommonArrow_c::fn_80168490() {
|
||||
bool dLytCommonArrow_c::remove() {
|
||||
d2d::dLytStructDList::GetInstance()->removeFromList2(&mStructD);
|
||||
mLytBase.unbindAnims();
|
||||
for (int i = 0; i < 9; i++) {
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytCommonArrow_c::fn_80168500() {
|
||||
bool dLytCommonArrow_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
if (!mStateMgr.getStateID()->isEqual(StateID_None)) {
|
||||
mAnmGroups[ANIM_LOOP].play();
|
||||
@@ -77,7 +77,7 @@ bool dLytCommonArrow_c::fn_80168500() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytCommonArrow_c::addToDrawList() {
|
||||
bool dLytCommonArrow_c::draw() {
|
||||
if (field_0x6CB == 1) {
|
||||
mLytBase.addToDrawList();
|
||||
}
|
||||
@@ -125,14 +125,16 @@ bool dLytCommonArrow_c::fn_80168760() {
|
||||
|
||||
void dLytCommonArrow_c::displayElement(s32 idx, f32 frame) {
|
||||
d2d::AnmGroup_c *s = &mAnmGroups[idx];
|
||||
s->setFrameAndControlThings(frame);
|
||||
s->bind(false);
|
||||
s->setAnimEnable(true);
|
||||
s->setFrame(frame);
|
||||
}
|
||||
|
||||
void dLytCommonArrow_c::fn_80168800(s32 idx) {
|
||||
void dLytCommonArrow_c::unbindAt(s32 idx) {
|
||||
mAnmGroups[idx].unbind();
|
||||
}
|
||||
|
||||
void dLytCommonArrow_c::fn_80168810(d2d::AnmGroup_c *ctrl) {
|
||||
void dLytCommonArrow_c::tickDown(d2d::AnmGroup_c *ctrl) {
|
||||
if (ctrl->getFrame()) {
|
||||
f32 newFrame = ctrl->getFrame() - 1.0f;
|
||||
if (newFrame <= 0.0f) {
|
||||
@@ -221,7 +223,7 @@ void dLytCommonArrow_c::executeState_In() {
|
||||
}
|
||||
}
|
||||
void dLytCommonArrow_c::finalizeState_In() {
|
||||
fn_80168800(ANIM_IN);
|
||||
unbindAt(ANIM_IN);
|
||||
}
|
||||
|
||||
void dLytCommonArrow_c::initializeState_Wait() {
|
||||
@@ -238,19 +240,19 @@ void dLytCommonArrow_c::executeState_Wait() {
|
||||
if (field_0x6B8 == 0) {
|
||||
d2d::AnmGroup_c &g = mAnmGroups[ANIM_ONOFF_L];
|
||||
g.play();
|
||||
fn_80168810(&mAnmGroups[ANIM_ONOFF_R]);
|
||||
tickDown(&mAnmGroups[ANIM_ONOFF_R]);
|
||||
} else if (field_0x6B8 == 1) {
|
||||
d2d::AnmGroup_c &g = mAnmGroups[ANIM_ONOFF_R];
|
||||
g.play();
|
||||
fn_80168810(&mAnmGroups[ANIM_ONOFF_L]);
|
||||
tickDown(&mAnmGroups[ANIM_ONOFF_L]);
|
||||
} else {
|
||||
fn_80168810(&mAnmGroups[ANIM_ONOFF_L]);
|
||||
fn_80168810(&mAnmGroups[ANIM_ONOFF_R]);
|
||||
tickDown(&mAnmGroups[ANIM_ONOFF_L]);
|
||||
tickDown(&mAnmGroups[ANIM_ONOFF_R]);
|
||||
}
|
||||
|
||||
d2d::AnmGroup_c &g2 = mAnmGroups[ANIM_INPUT];
|
||||
if (field_0x6CC != 0) {
|
||||
fn_80168810(&g2);
|
||||
tickDown(&g2);
|
||||
} else {
|
||||
g2.play();
|
||||
}
|
||||
@@ -276,7 +278,7 @@ void dLytCommonArrow_c::executeState_Wait() {
|
||||
g.play();
|
||||
} break;
|
||||
case 2:
|
||||
fn_80168800(field_0x6C0 + ANIM_DECIDE_OFFSET);
|
||||
unbindAt(field_0x6C0 + ANIM_DECIDE_OFFSET);
|
||||
mTimer = 0;
|
||||
field_0x6CA = 0;
|
||||
field_0x6C0 = 2;
|
||||
|
||||
@@ -45,7 +45,7 @@ bool dLytCommonIconItemPart1_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
mLyt.build("commonIcon_02.brlyt", nullptr);
|
||||
for (int i = 0; i < ITEM_PART_1_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMapPart1[i].mFile, resAcc, mLyt.getLayout(), brlanMapPart1[i].mName);
|
||||
mAnm[i].setDirection(false);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setRate(1.0f);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ bool dLytCommonIconItemPart1_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytCommonIconItemPart1_c::remove() {
|
||||
for (int i = 0; i < ITEM_PART_1_NUM_ANIMS; i++) {
|
||||
mAnm[i].unbind();
|
||||
mAnm[i].afterUnbind();
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ void dLytCommonIconItemPart1_c::realizeBocoburin() {
|
||||
|
||||
void dLytCommonIconItemPart1_c::realizeItem(u8 item) {
|
||||
// Inline?
|
||||
if (mAnm[ITEM_PART_1_ANIM_ICON].getEndFrameRaw() - 1.0f < item) {
|
||||
if (mAnm[ITEM_PART_1_ANIM_ICON].getAnimDuration() - 1.0f < item) {
|
||||
mItem = 0;
|
||||
} else {
|
||||
mItem = item;
|
||||
@@ -182,7 +182,7 @@ void dLytCommonIconItemPart1_c::setNumber(s32 number) {
|
||||
std::memset(mNumberBuf, 0, sizeof(mNumberBuf));
|
||||
swprintf(mNumberBuf, ARRAY_LENGTH(mNumberBuf), L"%d", number);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextBoxes[i]->fn_800AF930(mNumberBuf);
|
||||
mpTextBoxes[i]->setTextWithGlobalTextProcessor(mNumberBuf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ void dLytCommonIconItemPart1_c::setOff() {
|
||||
}
|
||||
}
|
||||
|
||||
void dLytCommonIconItemPart1_c::startDecide() {
|
||||
void dLytCommonIconItemPart1_c::startConfirm() {
|
||||
mAnm[ITEM_PART_1_ANIM_DECIDE].setForwardOnce();
|
||||
mAnm[ITEM_PART_1_ANIM_DECIDE].setToStart();
|
||||
mAnm[ITEM_PART_1_ANIM_DECIDE].setAnimEnable(true);
|
||||
@@ -276,7 +276,7 @@ bool dLytCommonIconItemPart2_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
mLyt.build("commonIcon_03.brlyt", nullptr);
|
||||
for (int i = 0; i < ITEM_PART_2_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMapPart2[i].mFile, resAcc, mLyt.getLayout(), brlanMapPart2[i].mName);
|
||||
mAnm[i].setDirection(false);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setRate(1.0f);
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ bool dLytCommonIconItemPart2_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytCommonIconItemPart2_c::remove() {
|
||||
for (int i = 0; i < ITEM_PART_2_NUM_ANIMS; i++) {
|
||||
mAnm[i].unbind();
|
||||
mAnm[i].afterUnbind();
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -450,7 +450,7 @@ void dLytCommonIconItemPart2_c::realizeBocoburin() {
|
||||
|
||||
void dLytCommonIconItemPart2_c::realizeItem(u8 item) {
|
||||
// Inline?
|
||||
if (mAnm[ITEM_PART_2_ANIM_ICON].getEndFrameRaw() - 1.0f < item) {
|
||||
if (mAnm[ITEM_PART_2_ANIM_ICON].getAnimDuration() - 1.0f < item) {
|
||||
mItem = 0;
|
||||
} else {
|
||||
mItem = item;
|
||||
@@ -515,7 +515,7 @@ void dLytCommonIconItemPart2_c::setNumber(s32 number) {
|
||||
std::memset(mNumberBuf, 0, sizeof(mNumberBuf));
|
||||
swprintf(mNumberBuf, ARRAY_LENGTH(mNumberBuf), L"%d", number);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextBoxes[i]->fn_800AF930(mNumberBuf);
|
||||
mpTextBoxes[i]->setTextWithGlobalTextProcessor(mNumberBuf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ void dLytCommonIconItemPart2_c::setOff() {
|
||||
}
|
||||
}
|
||||
|
||||
void dLytCommonIconItemPart2_c::startDecide() {
|
||||
void dLytCommonIconItemPart2_c::startConfirm() {
|
||||
mAnm[ITEM_PART_2_ANIM_DECIDE].setForwardOnce();
|
||||
mAnm[ITEM_PART_2_ANIM_DECIDE].setToStart();
|
||||
mAnm[ITEM_PART_2_ANIM_DECIDE].setAnimEnable(true);
|
||||
@@ -600,7 +600,7 @@ bool dLytCommonIconItemPart3_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
mLyt.build("commonIcon_04.brlyt", nullptr);
|
||||
for (int i = 0; i < ITEM_PART_3_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMapPart3[i].mFile, resAcc, mLyt.getLayout(), brlanMapPart3[i].mName);
|
||||
mAnm[i].setDirection(false);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setRate(1.0f);
|
||||
}
|
||||
|
||||
@@ -612,7 +612,7 @@ bool dLytCommonIconItemPart3_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytCommonIconItemPart3_c::remove() {
|
||||
for (int i = 0; i < ITEM_PART_3_NUM_ANIMS; i++) {
|
||||
mAnm[i].unbind();
|
||||
mAnm[i].afterUnbind();
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -672,7 +672,7 @@ void dLytCommonIconItemPart3_c::realizeBocoburin() {
|
||||
}
|
||||
|
||||
void dLytCommonIconItemPart3_c::realizeItem(u8 item) {
|
||||
if (mAnm[ITEM_PART_3_ANIM_ICON].getEndFrameRaw() - 1.0f < item) {
|
||||
if (mAnm[ITEM_PART_3_ANIM_ICON].getAnimDuration() - 1.0f < item) {
|
||||
mItem = 0;
|
||||
} else {
|
||||
mItem = item;
|
||||
@@ -849,10 +849,10 @@ void dLytCommonIconItem_c::setOff() {
|
||||
}
|
||||
}
|
||||
|
||||
void dLytCommonIconItem_c::startDecide() {
|
||||
void dLytCommonIconItem_c::startConfirm() {
|
||||
switch (mPart) {
|
||||
case 0: mPart1.startDecide(); break;
|
||||
case 1: mPart2.startDecide(); break;
|
||||
case 0: mPart1.startConfirm(); break;
|
||||
case 1: mPart2.startConfirm(); break;
|
||||
case 2: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ bool dLytCommonIconMaterialPart1_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
mLyt.build("commonIcon_00.brlyt", nullptr);
|
||||
for (int i = 0; i < MATERIAL_PART_1_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMapPart1[i].mFile, resAcc, mLyt.getLayout(), brlanMapPart1[i].mName);
|
||||
mAnm[i].setDirection(false);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setRate(1.0f);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ bool dLytCommonIconMaterialPart1_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytCommonIconMaterialPart1_c::remove() {
|
||||
for (int i = 0; i < MATERIAL_PART_1_NUM_ANIMS; i++) {
|
||||
mAnm[i].unbind();
|
||||
mAnm[i].afterUnbind();
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ void dLytCommonIconMaterialPart1_c::realizeShadow() {
|
||||
|
||||
void dLytCommonIconMaterialPart1_c::realizeItem(u8 item) {
|
||||
// Inline?
|
||||
if (mAnm[MATERIAL_PART_1_ANIM_ICON].getEndFrameRaw() - 1.0f < item) {
|
||||
if (mAnm[MATERIAL_PART_1_ANIM_ICON].getAnimDuration() - 1.0f < item) {
|
||||
mItem = 0;
|
||||
} else {
|
||||
mItem = item;
|
||||
@@ -175,7 +175,7 @@ void dLytCommonIconMaterialPart1_c::setNumber(s32 number) {
|
||||
std::memset(mNumberBuf, 0, sizeof(mNumberBuf));
|
||||
swprintf(mNumberBuf, ARRAY_LENGTH(mNumberBuf), L"%d", number);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextBoxes[i]->fn_800AF930(mNumberBuf);
|
||||
mpTextBoxes[i]->setTextWithGlobalTextProcessor(mNumberBuf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ bool dLytCommonIconMaterialPart2_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
mLyt.build("commonIcon_01.brlyt", nullptr);
|
||||
for (int i = 0; i < MATERIAL_PART_2_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMapPart2[i].mFile, resAcc, mLyt.getLayout(), brlanMapPart2[i].mName);
|
||||
mAnm[i].setDirection(false);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setRate(1.0f);
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ bool dLytCommonIconMaterialPart2_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytCommonIconMaterialPart2_c::remove() {
|
||||
for (int i = 0; i < MATERIAL_PART_2_NUM_ANIMS; i++) {
|
||||
mAnm[i].unbind();
|
||||
mAnm[i].afterUnbind();
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -357,7 +357,7 @@ void dLytCommonIconMaterialPart2_c::realizeShadow() {
|
||||
|
||||
void dLytCommonIconMaterialPart2_c::realizeItem(u8 item) {
|
||||
// Inline?
|
||||
if (mAnm[MATERIAL_PART_2_ANIM_ICON].getEndFrameRaw() - 1.0f < item) {
|
||||
if (mAnm[MATERIAL_PART_2_ANIM_ICON].getAnimDuration() - 1.0f < item) {
|
||||
mItem = 0;
|
||||
} else {
|
||||
mItem = item;
|
||||
@@ -374,7 +374,7 @@ void dLytCommonIconMaterialPart2_c::setNumber(s32 number) {
|
||||
std::memset(mNumberBuf, 0, sizeof(mNumberBuf));
|
||||
swprintf(mNumberBuf, ARRAY_LENGTH(mNumberBuf), L"%d", number);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextBoxes[i]->fn_800AF930(mNumberBuf);
|
||||
mpTextBoxes[i]->setTextWithGlobalTextProcessor(mNumberBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ dLytFader_c::~dLytFader_c() {
|
||||
|
||||
if (field_0x4DD == true) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mLytStructAs[i].afterUnbind();
|
||||
mLytStructAs[i].remove();
|
||||
}
|
||||
mResAcc.detach();
|
||||
}
|
||||
@@ -27,7 +27,7 @@ void dLytFader_c::setStatus(EStatus status) {
|
||||
mStatus = FADED_OUT;
|
||||
mLytBase.unbindAnims();
|
||||
d2d::AnmGroup_c *s = &mLytStructAs[0];
|
||||
s->setDirection(false);
|
||||
s->bind(false);
|
||||
s->setToEnd();
|
||||
s->setAnimEnable(true);
|
||||
s->play();
|
||||
@@ -38,7 +38,7 @@ void dLytFader_c::setStatus(EStatus status) {
|
||||
mStatus = FADED_IN;
|
||||
mLytBase.unbindAnims();
|
||||
d2d::AnmGroup_c *s = &mLytStructAs[0];
|
||||
s->setDirection(false);
|
||||
s->bind(false);
|
||||
s->setFrame(0.0f);
|
||||
s->setAnimEnable(true);
|
||||
mLytBase.calc();
|
||||
@@ -109,7 +109,7 @@ void dLytFader_c::fn_801758F0() {
|
||||
fn_80175BC0(0);
|
||||
mLytBase.unbindAnims();
|
||||
d2d::AnmGroup_c *s = &mLytStructAs[0];
|
||||
s->setDirection(false);
|
||||
s->bind(false);
|
||||
s->setFrame(0.0f);
|
||||
s->setRate(20.0f / (mFrame - 1));
|
||||
s->setAnimEnable(true);
|
||||
@@ -130,7 +130,7 @@ void dLytFader_c::fn_80175A50() {
|
||||
fn_80175BC0(1);
|
||||
mLytBase.unbindAnims();
|
||||
d2d::AnmGroup_c *s = &mLytStructAs[1];
|
||||
s->setDirection(false);
|
||||
s->bind(false);
|
||||
s->setFrame(0.0f);
|
||||
s->setRate(20.0f / (mFrame - 1));
|
||||
s->setAnimEnable(true);
|
||||
|
||||
@@ -207,7 +207,7 @@ void dLytMapPinIcon_c::finalizeState_Wait() {}
|
||||
|
||||
void dLytMapPinIcon_c::initializeState_ToSelect() {
|
||||
d2d::AnmGroup_c *m = &mAnmGroups[1];
|
||||
m->setDirection(false);
|
||||
m->bind(false);
|
||||
m->setFrame(0.0f);
|
||||
}
|
||||
void dLytMapPinIcon_c::executeState_ToSelect() {
|
||||
@@ -255,7 +255,7 @@ bool dLytMapPinIcon_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
pAnmGroups[i].init(sMapPinIconBrlanMap[i].mFile, resAcc, mLyt.getLayout(), sMapPinIconBrlanMap[i].mName);
|
||||
pAnmGroups[i].setDirection(false);
|
||||
pAnmGroups[i].bind(false);
|
||||
pAnmGroups[i].setFrame(0.0f);
|
||||
}
|
||||
|
||||
@@ -269,8 +269,8 @@ bool dLytMapPinIcon_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
mStructD.fn_80065E70(mpBounding, 2, 1, 0);
|
||||
d2d::dLytStructDList::GetInstance()->appendToList2(&mStructD);
|
||||
|
||||
mAnmGroups[LYT_MAP_PIN_ICON_ANIM_SCALE].setDirection(false);
|
||||
mAnmGroups[LYT_MAP_PIN_ICON_ANIM_LOOP].setDirection(false);
|
||||
mAnmGroups[LYT_MAP_PIN_ICON_ANIM_SCALE].bind(false);
|
||||
mAnmGroups[LYT_MAP_PIN_ICON_ANIM_LOOP].bind(false);
|
||||
|
||||
mLyt.calc();
|
||||
|
||||
@@ -284,7 +284,7 @@ bool dLytMapPinIcon_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytMapPinIcon_c::remove() {
|
||||
d2d::dLytStructDList::GetInstance()->removeFromList2(&mStructD);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ void dLytNote_c::executeState_Move() {
|
||||
field_0x260 = 0.0f;
|
||||
mInAnim = NOTE_ANIM_LOST_LOOP;
|
||||
// Maybe an inline?
|
||||
f32 progress = mAnmGroups[mInAnim].getEndFrameRaw();
|
||||
f32 progress = mAnmGroups[mInAnim].getAnimDuration();
|
||||
f32 nul = 0.0f;
|
||||
if (nul >= progress) {
|
||||
field_0x260 = nul - progress;
|
||||
@@ -93,7 +93,7 @@ void dLytNote_c::executeState_Move() {
|
||||
field_0x260 = 0.0f;
|
||||
mInAnim = NOTE_ANIM_GET_LOOP;
|
||||
// Maybe an inline?
|
||||
f32 progress = mAnmGroups[mInAnim].getEndFrameRaw();
|
||||
f32 progress = mAnmGroups[mInAnim].getAnimDuration();
|
||||
f32 nul = 0.0f;
|
||||
if (nul >= progress) {
|
||||
field_0x260 = nul - progress;
|
||||
@@ -142,7 +142,7 @@ bool dLytNote_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
mAnmGroups[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ bool dLytNote_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytNote_c::remove() {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
// @bug? .unbind call is missing
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ void dLytNote_c::execute(u8 alpha) {
|
||||
|
||||
if (mInAnim != NOTE_ANIM_INVALID) {
|
||||
field_0x260 += 1.0f;
|
||||
f32 nextFrame = mAnmGroups[mInAnim].getEndFrameRaw();
|
||||
f32 nextFrame = mAnmGroups[mInAnim].getAnimDuration();
|
||||
if (field_0x260 >= nextFrame) {
|
||||
field_0x260 -= nextFrame;
|
||||
}
|
||||
|
||||
@@ -50,5 +50,7 @@ void dLytPauseDisp00_c::init() {
|
||||
|
||||
void dLytPauseDisp00_c::displayElement(int i, float frame) {
|
||||
d2d::AnmGroup_c *s = &field_0x00D0[i];
|
||||
s->setFrameAndControlThings(frame);
|
||||
s->bind(false);
|
||||
s->setAnimEnable(true);
|
||||
s->setFrame(frame);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ bool dLytSkyGaugeMain_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mAnmGroups[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ bool dLytSkyGaugeMain_c::execute() {
|
||||
bool dLytSkyGaugeMain_c::remove() {
|
||||
mLyt.unbindAnims();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,861 @@
|
||||
#include "d/lyt/d_textbox.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_font_manager.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "libms/msgfile.h"
|
||||
#include "m/m_color.h"
|
||||
#include "nw4r/lyt/lyt_common.h"
|
||||
#include "nw4r/lyt/lyt_drawInfo.h"
|
||||
#include "nw4r/lyt/lyt_material.h"
|
||||
#include "nw4r/lyt/lyt_resources.h"
|
||||
#include "nw4r/lyt/lyt_textBox.h"
|
||||
#include "nw4r/lyt/lyt_types.h"
|
||||
#include "nw4r/ut/ut_CharWriter.h"
|
||||
#include "nw4r/ut/ut_Font.h"
|
||||
#include "nw4r/ut/ut_Rect.h"
|
||||
#include "rvl/GX/GXPixel.h"
|
||||
#include "rvl/GX/GXTev.h"
|
||||
#include "rvl/GX/GXTypes.h"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
dTextBox_c::dTextBox_c(const nw4r::lyt::res::TextBox *pBlock, const nw4r::lyt::ResBlockSet &resBlockSet)
|
||||
: nw4r::lyt::TextBox(pBlock, resBlockSet), mMyFontSize(0.0f, 0.0f), mMyTextScale(0.0f, 0.0f) {
|
||||
const nw4r::lyt::res::Font *fonts = nw4r::lyt::detail::ConvertOffsToPtr<nw4r::lyt::res::Font>(
|
||||
resBlockSet.pFontList, sizeof(nw4r::lyt::res::FontList)
|
||||
);
|
||||
const char *fontName = nw4r::lyt::detail::ConvertOffsToPtr<char>(fonts, fonts[pBlock->fontIdx].nameStrOffset);
|
||||
for (u32 i = 0; i < 5; i++) {
|
||||
const char *name = dFontMng_c::getFontName(i);
|
||||
if (!std::strcmp(fontName, name)) {
|
||||
mFontIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Begin largely copied from nw4r::lyt::TextBox
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline u8 ClampColor(s16 colVal) {
|
||||
// The CLAMP macro was reversed for this -_-
|
||||
return colVal < 0 ? 0 : (colVal > 0xFF ? 0xFF : colVal);
|
||||
}
|
||||
|
||||
nw4r::ut::Color GetColor(const GXColorS10 &src) {
|
||||
GXColor dst;
|
||||
dst.r = ClampColor(src.r);
|
||||
dst.g = ClampColor(src.g);
|
||||
dst.b = ClampColor(src.b);
|
||||
dst.a = ClampColor(src.a);
|
||||
return dst;
|
||||
}
|
||||
|
||||
static void CalcStringRect(
|
||||
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> &textWriter, const wchar_t *str, int length,
|
||||
bool *pbWideScreenUnk, f32 maxWidth
|
||||
);
|
||||
|
||||
static void CalcStringRectImpl(
|
||||
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> *pTextWriter, const wchar_t *str, int length, f32 maxWidth,
|
||||
bool *pbWideScreenUnk
|
||||
);
|
||||
|
||||
static int CalcLineRectImpl(
|
||||
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> *pTextWriter, const wchar_t *str, int length, f32 maxWidth,
|
||||
bool *pbOver, bool *pbWideScreenUnk
|
||||
);
|
||||
|
||||
static int CalcLineStrNum(
|
||||
f32 *pWidth, nw4r::ut::TextWriterBase<wchar_t> *pTextWriter, const wchar_t *str, int length, f32 maxWidth,
|
||||
bool *pbOver
|
||||
);
|
||||
|
||||
nw4r::ut::Rect dTextBox_c::GetMyTextDrawRect(nw4r::ut::TextWriterBase<wchar_t> *pWriter, bool *pbWideScreenUnk) const {
|
||||
nw4r::ut::Rect textRect;
|
||||
pWriter->SetCursor(0.0f, 0.0f);
|
||||
pWriter->SetFont(*mpFont);
|
||||
pWriter->SetFontSize(GetFontSize().width, GetFontSize().height);
|
||||
pWriter->SetLineSpace(mLineSpace);
|
||||
pWriter->SetCharSpace(mCharSpace);
|
||||
if (mIsWidthFixed == true) {
|
||||
pWriter->EnableFixedWidth(true);
|
||||
pWriter->SetFixedWidth(mFixedWidth);
|
||||
}
|
||||
if (GetTagProcessor() != nullptr) {
|
||||
pWriter->SetTagProcessor(GetTagProcessor());
|
||||
}
|
||||
CalcStringRect(&textRect, *pWriter, mTextBuf, mTextLen, pbWideScreenUnk, FLT_MAX);
|
||||
|
||||
nw4r::lyt::Size textSize(textRect.GetWidth(), textRect.GetHeight());
|
||||
nw4r::math::VEC2 ltPos = GetVtxPos();
|
||||
|
||||
// Adjust for Alignment (left, center, right)
|
||||
ltPos.x += (mSize.width - textSize.width) * GetTextMagH();
|
||||
ltPos.y -= (mSize.height - textSize.height) * GetTextMagV();
|
||||
|
||||
// Apply the new pos
|
||||
textRect.left = ltPos.x;
|
||||
textRect.top = ltPos.y;
|
||||
textRect.right = ltPos.x + textSize.width;
|
||||
textRect.bottom = ltPos.y - textSize.height;
|
||||
|
||||
return textRect;
|
||||
}
|
||||
|
||||
static void CalcStringRect(
|
||||
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> &textWriter, const wchar_t *str, int length,
|
||||
bool *pbWideScreenUnk, f32 maxWidth
|
||||
) {
|
||||
nw4r::ut::TextWriterBase<wchar_t> writerCpy(textWriter);
|
||||
CalcStringRectImpl(pRect, &writerCpy, str, length, maxWidth, pbWideScreenUnk);
|
||||
}
|
||||
|
||||
static void CalcStringRectImpl(
|
||||
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> *pTextWriter, const wchar_t *str, int length, f32 maxWidth,
|
||||
bool *pbWideScreenUnk
|
||||
) {
|
||||
pRect->left = 0.0f;
|
||||
pRect->right = 0.0f;
|
||||
pRect->top = 0.0f;
|
||||
pRect->bottom = 0.0f;
|
||||
pTextWriter->SetCursor(0.0f, 0.0f);
|
||||
int remain = length;
|
||||
const wchar_t *pos = str;
|
||||
int i = 0;
|
||||
do {
|
||||
nw4r::ut::Rect rect;
|
||||
bool bOver;
|
||||
int read =
|
||||
CalcLineRectImpl(&rect, pTextWriter, pos, remain, maxWidth, &bOver, i == 0 ? pbWideScreenUnk : nullptr);
|
||||
pos += read;
|
||||
remain -= read;
|
||||
pRect->left = nw4r::ut::Min(pRect->left, rect.left);
|
||||
pRect->top = nw4r::ut::Min(pRect->top, rect.top);
|
||||
pRect->right = nw4r::ut::Max(pRect->right, rect.right);
|
||||
pRect->bottom = nw4r::ut::Max(pRect->bottom, rect.bottom);
|
||||
if (bOver) {
|
||||
CalcLineRectImpl(&rect, pTextWriter, L"\n", 1, maxWidth, &bOver, nullptr);
|
||||
pRect->left = nw4r::ut::Min(pRect->left, rect.left);
|
||||
pRect->top = nw4r::ut::Min(pRect->top, rect.top);
|
||||
pRect->right = nw4r::ut::Max(pRect->right, rect.right);
|
||||
pRect->bottom = nw4r::ut::Max(pRect->bottom, rect.bottom);
|
||||
}
|
||||
i++;
|
||||
} while (remain > 0);
|
||||
}
|
||||
|
||||
extern "C" bool NeedsScreenAdjustment();
|
||||
|
||||
static int CalcLineRectImpl(
|
||||
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> *pTextWriter, const wchar_t *str, int length, f32 maxWidth,
|
||||
bool *pbOver, bool *pbWideScreenUnk
|
||||
) {
|
||||
nw4r::ut::PrintContext<wchar_t> context = {pTextWriter, str, 0.0f, 0.0f, 0};
|
||||
f32 x = 0.0f;
|
||||
|
||||
const nw4r::ut::Font *font = pTextWriter->GetFont();
|
||||
bool bCharSpace = false;
|
||||
nw4r::ut::CharStrmReader reader = font->GetCharStrmReader();
|
||||
|
||||
const wchar_t *prStrPos = (const wchar_t *)reader.GetCurrentPos();
|
||||
|
||||
pRect->left = 0.0f;
|
||||
pRect->right = 0.0f;
|
||||
pRect->top = nw4r::ut::Min(0.0f, pTextWriter->GetLineHeight());
|
||||
pRect->bottom = nw4r::ut::Max(0.0f, pTextWriter->GetLineHeight());
|
||||
|
||||
*pbOver = false;
|
||||
|
||||
reader.Set(str);
|
||||
nw4r::ut::Rect prMaxRect = *pRect;
|
||||
u16 code = reader.Next();
|
||||
while (((const wchar_t *)reader.GetCurrentPos() - str) <= length) {
|
||||
if (code < ' ') {
|
||||
nw4r::ut::Operation operation;
|
||||
nw4r::ut::Rect rect(x, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
context.str = (const wchar_t *)reader.GetCurrentPos();
|
||||
context.flags = !bCharSpace;
|
||||
|
||||
pTextWriter->SetCursorX(x);
|
||||
// ??????????
|
||||
if (pbWideScreenUnk != nullptr && ((u32 *)context.str)[0] == 0 && NeedsScreenAdjustment()) {
|
||||
*pbWideScreenUnk = true;
|
||||
}
|
||||
operation = pTextWriter->GetTagProcessor()->CalcRect(&rect, code, &context);
|
||||
reader.Set(context.str);
|
||||
|
||||
pRect->left = nw4r::ut::Min(pRect->left, rect.left);
|
||||
pRect->top = nw4r::ut::Min(pRect->top, rect.top);
|
||||
pRect->right = nw4r::ut::Max(pRect->right, rect.right);
|
||||
pRect->bottom = nw4r::ut::Max(pRect->bottom, rect.bottom);
|
||||
|
||||
x = pTextWriter->GetCursorX();
|
||||
|
||||
if (pRect->GetWidth() > maxWidth) {
|
||||
*pbOver = true;
|
||||
break;
|
||||
}
|
||||
if (operation == nw4r::ut::OPERATION_END_DRAW) {
|
||||
return length;
|
||||
} else if (operation == nw4r::ut::OPERATION_NO_CHAR_SPACE) {
|
||||
bCharSpace = false;
|
||||
} else if (operation == nw4r::ut::OPERATION_CHAR_SPACE) {
|
||||
bCharSpace = true;
|
||||
} else if (operation == nw4r::ut::OPERATION_NEXT_LINE) {
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (bCharSpace) {
|
||||
x += pTextWriter->GetCharSpace();
|
||||
}
|
||||
bCharSpace = true;
|
||||
if (pTextWriter->IsWidthFixed()) {
|
||||
x += pTextWriter->GetFixedWidth();
|
||||
} else {
|
||||
x += pTextWriter->GetFont()->GetCharWidth(code) * pTextWriter->GetScaleH();
|
||||
}
|
||||
pRect->left = nw4r::ut::Min(pRect->left, x);
|
||||
pRect->right = nw4r::ut::Max(pRect->right, x);
|
||||
|
||||
if (pRect->GetWidth() > maxWidth) {
|
||||
*pbOver = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
prStrPos = (const wchar_t *)reader.GetCurrentPos();
|
||||
code = reader.Next();
|
||||
prMaxRect = *pRect;
|
||||
}
|
||||
|
||||
if (*pbOver) {
|
||||
if (prStrPos) {
|
||||
*pRect = prMaxRect;
|
||||
return (prStrPos - str);
|
||||
}
|
||||
}
|
||||
return ((const wchar_t *)reader.GetCurrentPos() - str);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// End largely copied from nw4r::lyt::TextBox
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void dTextBox_c::setTextWithGlobalTextProcessor(const wchar_t *str, void *unk, ...) {
|
||||
va_list l;
|
||||
va_start(l, str);
|
||||
setTextWithGlobalTextProcessorV(str, unk, l);
|
||||
va_end(l);
|
||||
}
|
||||
|
||||
void dTextBox_c::setTextWithGlobalTextProcessorV(const wchar_t *str, void *unk, va_list list) {
|
||||
SetFontSize(mMyTextScale);
|
||||
mHasTextWriter = true;
|
||||
mpMyTagProcessor = dMessage_c::getGlobalTagProcessor();
|
||||
u32 outLen = 0;
|
||||
mWindowSubtype = mpMyTagProcessor->getMsgWindowSubtype();
|
||||
mpMyTagProcessor->setField_0xEE1(field_0x1F6);
|
||||
mpMyTagProcessor->setField_0xEE2(0);
|
||||
mpMyTagProcessor->setField_0xEE3(1);
|
||||
|
||||
static wchar_t destBuffer[0x200];
|
||||
mpMyTagProcessor->formatV(nullptr, str, destBuffer, ARRAY_LENGTH(destBuffer), &outLen, unk, list);
|
||||
SetString(destBuffer, 0, outLen);
|
||||
}
|
||||
|
||||
void dTextBox_c::setTextWithTextProcessor(const wchar_t *str, dTagProcessor_c *tagProcessor, void *unk, ...) {
|
||||
va_list l;
|
||||
va_start(l, str);
|
||||
setTextWithTextProcessorV(str, tagProcessor, unk, l);
|
||||
va_end(l);
|
||||
}
|
||||
|
||||
void dTextBox_c::setTextWithTextProcessorV(const wchar_t *str, dTagProcessor_c *tagProcessor, void *unk, va_list list) {
|
||||
SetFontSize(mMyTextScale);
|
||||
mHasTextWriter = true;
|
||||
u32 outLen = 0;
|
||||
mpMyTagProcessor = tagProcessor;
|
||||
mWindowSubtype = mpMyTagProcessor->getMsgWindowSubtype();
|
||||
mpMyTagProcessor->setField_0xEE1(field_0x1F6);
|
||||
mpMyTagProcessor->setField_0xEE2(0);
|
||||
mpMyTagProcessor->setField_0xEE3(1);
|
||||
|
||||
static wchar_t destBuffer[0x200];
|
||||
mpMyTagProcessor->formatV(nullptr, str, destBuffer, ARRAY_LENGTH(destBuffer), &outLen, unk, list);
|
||||
SetString(destBuffer, 0, outLen);
|
||||
}
|
||||
|
||||
s32 dTextBox_c::calcTextLines(const wchar_t *src, dTagProcessor_c *tagProcessor) {
|
||||
static wchar_t destBuffer[0x200];
|
||||
u32 outLen = 0;
|
||||
tagProcessor->format(this, src, destBuffer, ARRAY_LENGTH(destBuffer), &outLen, nullptr);
|
||||
return tagProcessor->getNumLinesMaybe();
|
||||
}
|
||||
|
||||
void dTextBox_c::setMessageWithGlobalTextProcessor(const char *labelId, void *unused, void *unk, ...) {
|
||||
va_list l;
|
||||
va_start(l, str);
|
||||
setMessageWithGlobalTextProcessorV(labelId, unused, unk, l);
|
||||
va_end(l);
|
||||
}
|
||||
|
||||
void dTextBox_c::setMessageWithGlobalTextProcessorV(const char *labelId, void *unused, void *unk, va_list list) {
|
||||
const wchar_t *text = dMessage_c::getTextMessageByLabel(labelId, true, nullptr, 0);
|
||||
setTextWithGlobalTextProcessorV(text, unk, list);
|
||||
if (GetFont() != nullptr) {
|
||||
resizeTextToFit(GetSize().width);
|
||||
}
|
||||
}
|
||||
|
||||
void dTextBox_c::setMessageWithGlobalTextProcessorAndMsbtInfo(
|
||||
const MsbtInfo *info, const char *labelId, wchar_t *destBuf, u32 maxLen
|
||||
) {
|
||||
const wchar_t *src = LMS_GetTextByLabel(info, labelId);
|
||||
SetFontSize(mMyTextScale);
|
||||
mHasTextWriter = true;
|
||||
field_0x1FA = 1;
|
||||
u32 outLen = 0;
|
||||
mpMyTagProcessor = dMessage_c::getGlobalTagProcessor();
|
||||
mpMyTagProcessor->setMsgWindowSubtype(0x22);
|
||||
mWindowSubtype = mpMyTagProcessor->getMsgWindowSubtype();
|
||||
mpMyTagProcessor->setField_0xEE1(field_0x1F6);
|
||||
mpMyTagProcessor->setField_0xEE2(0);
|
||||
mpMyTagProcessor->setField_0xEE3(1);
|
||||
|
||||
mpMyTagProcessor->format(nullptr, src, destBuf, maxLen, &outLen, 0);
|
||||
SetString(destBuf, 0, outLen);
|
||||
}
|
||||
|
||||
void dTextBox_c::setTextWithGlobalTextProcessor(const wchar_t *str) {
|
||||
setTextWithGlobalTextProcessor(str, nullptr);
|
||||
if (GetFont() != nullptr) {
|
||||
resizeTextToFit(GetSize().width);
|
||||
}
|
||||
}
|
||||
|
||||
f32 dTextBox_c::GetLineWidth(f32 *pOutSpacing) const {
|
||||
if ((int)mTextLen <= 0) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
f32 widthThisLine = 0.0f;
|
||||
int numCharsThisLine = 0;
|
||||
int maxNumCharacters = 0;
|
||||
const wchar_t *buf = GetString();
|
||||
f32 maxWidth = widthThisLine;
|
||||
const nw4r::ut::Font *f = GetFont();
|
||||
f32 charBaseWidth = mFontSize.width / f->GetWidth();
|
||||
wchar_t c;
|
||||
while ((c = *buf, c != '\0')) {
|
||||
if (c == L'\x0E') {
|
||||
u8 commandLen = buf[3];
|
||||
buf += commandLen / 2 + 4;
|
||||
} else if (c == L'\x0F') {
|
||||
buf += 3;
|
||||
} else if (c == L'\n') {
|
||||
if (widthThisLine > maxWidth) {
|
||||
maxWidth = widthThisLine;
|
||||
maxNumCharacters = numCharsThisLine;
|
||||
}
|
||||
widthThisLine = 0.0f;
|
||||
numCharsThisLine = 0;
|
||||
buf++;
|
||||
} else {
|
||||
if (mIsWidthFixed == true) {
|
||||
widthThisLine += mFixedWidth;
|
||||
} else {
|
||||
int charWid = f->GetCharWidth(c);
|
||||
widthThisLine += charBaseWidth * charWid;
|
||||
}
|
||||
numCharsThisLine++;
|
||||
buf++;
|
||||
}
|
||||
}
|
||||
|
||||
if (widthThisLine > maxWidth) {
|
||||
maxWidth = widthThisLine;
|
||||
maxNumCharacters = numCharsThisLine;
|
||||
}
|
||||
|
||||
f32 maxSpaceWidth = (maxNumCharacters - 1) * GetCharSpace();
|
||||
maxWidth += maxSpaceWidth + 1.0f;
|
||||
if (pOutSpacing != nullptr) {
|
||||
*pOutSpacing = maxSpaceWidth;
|
||||
}
|
||||
|
||||
return maxWidth;
|
||||
}
|
||||
|
||||
f32 dTextBox_c::GetLinesHeight() const {
|
||||
if ((int)mTextLen <= 0) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
const wchar_t *buf = GetString();
|
||||
const nw4r::ut::Font *f = GetFont();
|
||||
|
||||
f32 assumedDefaultSize = 35.0f;
|
||||
|
||||
f32 f3 = UnkTextThing::getFn800B1F70();
|
||||
nw4r::lyt::Size size = mMyFontSize;
|
||||
int fontHeight = f->GetHeight();
|
||||
f3 *= (size.height / assumedDefaultSize) * fontHeight;
|
||||
f32 lineBaseHeight = f3;
|
||||
|
||||
f32 totalHeight = 0.0f;
|
||||
|
||||
wchar_t c;
|
||||
while ((c = *buf, c != '\0')) {
|
||||
if (c == L'\x0E') {
|
||||
u8 commandLen = buf[3];
|
||||
s32 skip = commandLen / 2 + 4;
|
||||
u32 command = *((u32 *)(buf + 1));
|
||||
if (command == 0x10008) {
|
||||
f32 nullHeight = dTagProcessor_c::fn_800B8040(0, mWindowSubtype);
|
||||
f32 cmdHeight = dTagProcessor_c::fn_800B8040(*((u8 *)(buf + 4)), mWindowSubtype);
|
||||
lineBaseHeight = f3 * (cmdHeight / nullHeight);
|
||||
}
|
||||
|
||||
buf += skip;
|
||||
} else if (c == L'\x0F') {
|
||||
buf += 3;
|
||||
} else if (c == L'\n') {
|
||||
totalHeight += lineBaseHeight + GetLineSpace();
|
||||
buf++;
|
||||
} else {
|
||||
buf++;
|
||||
}
|
||||
}
|
||||
|
||||
totalHeight += lineBaseHeight;
|
||||
|
||||
return totalHeight;
|
||||
}
|
||||
|
||||
f32 dTextBox_c::GetUnkWidthRatio() const {
|
||||
return GetLineWidth(nullptr) / get_805751A4();
|
||||
}
|
||||
|
||||
f32 dTextBox_c::resizeTextToFit(f32 maxWidth) {
|
||||
if (!hasDynamicText()) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
nw4r::lyt::Size size;
|
||||
size = GetFontSize();
|
||||
|
||||
f32 spacing = 0.0f;
|
||||
f32 computedTextWidth = GetLineWidth(&spacing);
|
||||
if (maxWidth >= computedTextWidth) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if (spacing < 0.0f) {
|
||||
spacing = 0.0f;
|
||||
}
|
||||
f32 resizeFactor = (maxWidth - spacing) / computedTextWidth;
|
||||
size.width *= resizeFactor;
|
||||
size.height = size.height;
|
||||
SetFontSize(size);
|
||||
return resizeFactor * 100.0f;
|
||||
}
|
||||
|
||||
void dTextBox_c::init() {
|
||||
mpLytBase = nullptr;
|
||||
mIsWidthFixed = false;
|
||||
mFixedWidth = 0.0f;
|
||||
mHasTextWriter = true;
|
||||
field_0x1F6 = 0;
|
||||
field_0x1F7 = 0;
|
||||
field_0x1F9 = false;
|
||||
field_0x1FA = 0;
|
||||
field_0x1F8 = 2;
|
||||
mpMyTagProcessor = nullptr;
|
||||
MySetFontSize(GetFontSize());
|
||||
for (int i = 0; i < 10; i++) {
|
||||
mLineStrNums[i] = 0;
|
||||
mLineWidths[i] = 0.0f;
|
||||
mbOvers[i] = 0;
|
||||
}
|
||||
|
||||
f32 f1 = 35.0f;
|
||||
if (mFontIdx > 1 && mFontIdx < 4) {
|
||||
f1 = 41.0f;
|
||||
}
|
||||
|
||||
nw4r::lyt::Size sz = GetFontSize();
|
||||
f32 scale = UnkTextThing::getFn800B1F70();
|
||||
|
||||
f32 height = sz.height / f1;
|
||||
sz.width = GetFont()->GetWidth() * height * scale;
|
||||
sz.height = GetFont()->GetHeight() * height * scale;
|
||||
SetFontSize(sz);
|
||||
mMyTextScale = sz;
|
||||
mMyScale = 1.0f;
|
||||
mWindowSubtype = 0x24;
|
||||
field_0x201 = true;
|
||||
}
|
||||
|
||||
bool dTextBox_c::hasDynamicText() {
|
||||
u16 myNum = GetExtUserDataNum();
|
||||
if (myNum == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const nw4r::lyt::res::ExtUserData *myList = GetExtUserData();
|
||||
for (int i = 0; i < myNum; i++) {
|
||||
SizedString<0x40> userDatName;
|
||||
userDatName = myList->GetName();
|
||||
if (userDatName == "embed" && myList->GetType() == nw4r::lyt::res::TYPE_INT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (userDatName == "textScale" && myList->GetType() == nw4r::lyt::res::TYPE_INT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (userDatName == "copy" && myList->GetType() == nw4r::lyt::res::TYPE_STRING) {
|
||||
field_0x1F6 = true;
|
||||
dTextBox_c *other = mpLytBase->getTextBox(myList->GetString());
|
||||
if (other != nullptr) {
|
||||
u16 otherNum = other->GetExtUserDataNum();
|
||||
if (otherNum == 0) {
|
||||
break;
|
||||
}
|
||||
const nw4r::lyt::res::ExtUserData *otherList = other->GetExtUserData();
|
||||
for (int j = 0; j < otherNum; j++) {
|
||||
userDatName = otherList->GetName();
|
||||
if (userDatName == "embed") {
|
||||
return true;
|
||||
}
|
||||
if (userDatName == "textScale") {
|
||||
return true;
|
||||
}
|
||||
otherList++;
|
||||
}
|
||||
}
|
||||
}
|
||||
myList++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void dTextBox_c::someDebugCheckMaybe() {
|
||||
field_0x1F7 = 0;
|
||||
|
||||
// Everything below this is effectively no-ops, since
|
||||
// we check and compare a bunch of things but don't actually
|
||||
// do anything.
|
||||
|
||||
u16 myNum = GetExtUserDataNum();
|
||||
if (!myNum) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nw4r::lyt::res::ExtUserData *myList = GetExtUserData();
|
||||
for (int i = 0; i < myNum; myList++, i++) {
|
||||
SizedString<0x40> userDatName;
|
||||
userDatName = myList->GetName();
|
||||
|
||||
if (userDatName == "copy" && myList->GetType() == nw4r::lyt::res::TYPE_STRING) {
|
||||
dTextBox_c *other = mpLytBase->getTextBox(myList->GetString());
|
||||
if (other != nullptr) {
|
||||
u16 otherNum = other->GetExtUserDataNum();
|
||||
if (otherNum == 0) {
|
||||
continue;
|
||||
}
|
||||
const nw4r::lyt::res::ExtUserData *otherList = other->GetExtUserData();
|
||||
for (int j = 0; j < otherNum; j++) {
|
||||
SizedString<0x40> otherName;
|
||||
otherName = otherList->GetName();
|
||||
otherList++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Also largely copied from nw4r::lyt::TextBox
|
||||
void dTextBox_c::DrawSelf(const nw4r::lyt::DrawInfo &drawInfo) {
|
||||
if (!mTextBuf || !mpFont || !mpMaterial) {
|
||||
return;
|
||||
}
|
||||
LoadMtx(drawInfo);
|
||||
nw4r::ut::TextWriterBase<wchar_t> writer;
|
||||
nw4r::ut::Rect textRect;
|
||||
if (mHasTextWriter) {
|
||||
field_0x1F9 = false;
|
||||
someDebugCheckMaybe();
|
||||
nw4r::ut::Rect resultRect = GetMyTextDrawRect(&writer, &field_0x1F9);
|
||||
textRect = resultRect;
|
||||
mTextWriter = writer;
|
||||
field_0x188 = textRect;
|
||||
} else {
|
||||
writer = mTextWriter;
|
||||
textRect = field_0x188;
|
||||
}
|
||||
|
||||
if (mpMyTagProcessor != nullptr) {
|
||||
mpMyTagProcessor->setMsgWindowSubtype(mWindowSubtype);
|
||||
mpMyTagProcessor->setField_0xEE1(field_0x1F6);
|
||||
mpMyTagProcessor->setField_0xEE2(0);
|
||||
if (mAlpha != 0) {
|
||||
mpMyTagProcessor->setField_0xEE3(1);
|
||||
} else {
|
||||
mpMyTagProcessor->setField_0xEE3(0);
|
||||
}
|
||||
}
|
||||
|
||||
bool unk1;
|
||||
if (field_0x1F8 == 2) {
|
||||
unk1 = field_0x1F9;
|
||||
} else {
|
||||
unk1 = field_0x1F8 == 1;
|
||||
}
|
||||
if (field_0x1F7 == 1 || (field_0x1F7 == 2 && unk1)) {
|
||||
f32 f = GetFontSize().height * UnkTextThing::getField0x75C();
|
||||
textRect.top -= f;
|
||||
textRect.bottom -= f;
|
||||
} else if (field_0x1F7 == 3 && unk1) {
|
||||
f32 f = GetFontSize().height * UnkTextThing::getField0x760();
|
||||
textRect.top -= f;
|
||||
textRect.bottom -= f;
|
||||
}
|
||||
|
||||
nw4r::ut::Color topCol = nw4r::lyt::detail::MultipleAlpha(mTextColors[0], mGlbAlpha);
|
||||
nw4r::ut::Color btmCol = nw4r::lyt::detail::MultipleAlpha(mTextColors[1], mGlbAlpha);
|
||||
|
||||
writer.SetGradationMode(topCol != btmCol ? nw4r::ut::CharWriter::GRADMODE_V : nw4r::ut::CharWriter::GRADMODE_NONE);
|
||||
writer.SetTextColor(topCol, btmCol);
|
||||
|
||||
nw4r::ut::Color minCol = GetColor(mpMaterial->GetTevColor(0));
|
||||
nw4r::ut::Color maxCol = GetColor(mpMaterial->GetTevColor(1));
|
||||
writer.SetColorMapping(minCol, maxCol);
|
||||
|
||||
if (mFontIdx <= 3) {
|
||||
setupGX();
|
||||
if (mpMyTagProcessor != nullptr) {
|
||||
mpMyTagProcessor->setTextbox(this);
|
||||
}
|
||||
} else {
|
||||
writer.SetupGX();
|
||||
}
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
|
||||
f32 hMag = GetTextAlignMag();
|
||||
const wchar_t *strPos = GetString();
|
||||
writer.SetCursor(textRect.left, -textRect.top);
|
||||
f32 texWidth = textRect.GetWidth();
|
||||
|
||||
int i = 0;
|
||||
|
||||
if (field_0x1FA != 0) {
|
||||
// The original variant from nw4r::lyt
|
||||
int remain = mTextLen;
|
||||
while (remain > 0) {
|
||||
bool bOver;
|
||||
f32 lineWidth;
|
||||
int lineStrNum = CalcLineStrNum(&lineWidth, &writer, strPos, remain, mSize.width, &bOver);
|
||||
f32 textPosX = textRect.left + hMag * (texWidth - lineWidth);
|
||||
writer.SetCursorX(textPosX);
|
||||
writer.PrintMutable(strPos, lineStrNum);
|
||||
if (bOver) {
|
||||
writer.PrintMutable(L"\n", 1);
|
||||
}
|
||||
strPos += lineStrNum;
|
||||
remain -= lineStrNum;
|
||||
}
|
||||
} else if (!mHasTextWriter && field_0x201 == true) {
|
||||
// Taking parameters from the three arrays, instead of calculating them
|
||||
int remain = mTextLen;
|
||||
while (remain > 0 && i < 10) {
|
||||
bool bOver;
|
||||
f32 lineWidth;
|
||||
int lineStrNum = GetStoredLineStrNum(i, &lineWidth, &bOver);
|
||||
// lineWidth = mLineWidths[i];
|
||||
// int lineStrNum = mLineStrNums[i];
|
||||
// bOver = mbOvers[i];
|
||||
f32 textPosX = textRect.left + hMag * (texWidth - lineWidth);
|
||||
writer.SetCursorX(textPosX);
|
||||
writer.PrintMutable(strPos, lineStrNum);
|
||||
if (bOver) {
|
||||
writer.PrintMutable(L"\n", 1);
|
||||
}
|
||||
strPos += lineStrNum;
|
||||
remain -= lineStrNum;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
// Copying parameters to the three arrays
|
||||
int remain = mTextLen;
|
||||
while (remain > 0 && i < 10) {
|
||||
bool bOver;
|
||||
f32 lineWidth;
|
||||
int lineStrNum = CalcLineStrNum(&lineWidth, &writer, strPos, remain, mSize.width, &bOver);
|
||||
f32 textPosX = textRect.left + hMag * (texWidth - lineWidth);
|
||||
writer.SetCursorX(textPosX);
|
||||
writer.PrintMutable(strPos, lineStrNum);
|
||||
if (mHasTextWriter && field_0x201 == true && i < 10) {
|
||||
SetStoredLineStrNum(i, lineWidth, lineStrNum, bOver);
|
||||
// mLineWidths[i] = lineWidth;
|
||||
// mLineStrNums[i] = lineStrNum;
|
||||
// mbOvers[i] = bOver;
|
||||
}
|
||||
if (bOver) {
|
||||
writer.PrintMutable(L"\n", 1);
|
||||
}
|
||||
strPos += lineStrNum;
|
||||
remain -= lineStrNum;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
const wchar_t *strPos = mTextBuf;
|
||||
writer.SetCursor(textRect.left, -textRect.top);
|
||||
f32 texWidth = textRect.GetWidth();
|
||||
int remain = mTextLen;
|
||||
|
||||
while (remain > 0) {
|
||||
bool bOver;
|
||||
f32 lineWidth;
|
||||
int lineStrNum = CalcLineStrNum(&lineWidth, &writer, strPos, remain, mSize.width, &bOver);
|
||||
f32 textPosX = textRect.left + hMag * (texWidth - lineWidth);
|
||||
writer.SetCursorX(textPosX);
|
||||
writer.PrintMutable(strPos, lineStrNum);
|
||||
if (bOver) {
|
||||
writer.PrintMutable(L"\n", 1);
|
||||
}
|
||||
strPos += lineStrNum;
|
||||
remain -= lineStrNum;
|
||||
}
|
||||
*/
|
||||
|
||||
mHasTextWriter = false;
|
||||
}
|
||||
|
||||
void dTextBox_c::loadTextFormatVars() {
|
||||
u16 myNum = GetExtUserDataNum();
|
||||
if (myNum == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nw4r::lyt::res::ExtUserData *myList = GetExtUserData();
|
||||
for (int i = 0; i < myNum; i++) {
|
||||
SizedString<0x40> userDatName;
|
||||
userDatName = myList->GetName();
|
||||
if (userDatName == "fontWidth" && myList->GetType() == nw4r::lyt::res::TYPE_FLOAT) {
|
||||
// If this text box has a "fontWidth" user datum of type float,
|
||||
// we use that as a fixed font width.
|
||||
mIsWidthFixed = true;
|
||||
mFixedWidth = myList->GetFloat();
|
||||
return;
|
||||
}
|
||||
|
||||
// If this text box has a "copy" user datum, find a text box
|
||||
// of the given name and use its font width, if any
|
||||
if (userDatName == "copy") {
|
||||
dTextBox_c *other = mpLytBase->getTextBox(myList->GetString());
|
||||
if (other != nullptr) {
|
||||
u16 otherNum = other->GetExtUserDataNum();
|
||||
if (otherNum == 0) {
|
||||
return;
|
||||
}
|
||||
const nw4r::lyt::res::ExtUserData *otherList = other->GetExtUserData();
|
||||
for (int j = 0; j < otherNum; j++) {
|
||||
userDatName = otherList->GetName();
|
||||
if (userDatName == "fontWidth" && otherList->GetType() == nw4r::lyt::res::TYPE_FLOAT) {
|
||||
mIsWidthFixed = true;
|
||||
mFixedWidth = otherList->GetFloat();
|
||||
break;
|
||||
}
|
||||
otherList++;
|
||||
}
|
||||
}
|
||||
}
|
||||
myList++;
|
||||
}
|
||||
}
|
||||
|
||||
void dTextBox_c::setupGX() const {
|
||||
static mColor sFogColor = mColor(0);
|
||||
GXSetFog(GX_FOG_NONE, sFogColor, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GXSetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);
|
||||
GXSetZTexture(0, GX_TF_Z8, 0);
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0A0, false, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
|
||||
GXSetChanCtrl(GX_COLOR1A1, false, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
|
||||
GXSetNumTexGens(1);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x3c, 0, 0x7d);
|
||||
GXSetNumIndStages(0);
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET);
|
||||
GXSetNumTevStages(2);
|
||||
GXSetTevDirect(GX_TEVSTAGE0);
|
||||
GXSetTevDirect(GX_TEVSTAGE1);
|
||||
GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP0);
|
||||
GXSetTevSwapMode(GX_TEVSTAGE1, GX_TEV_SWAP0, GX_TEV_SWAP0);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
|
||||
GXColorS10 c0 = mpMaterial->GetTevColor(0);
|
||||
GXColorS10 c1 = mpMaterial->GetTevColor(1);
|
||||
GXColorS10 c2 = c1;
|
||||
c2.r /= -2, c2.g /= -2, c2.b /= -2, c2.a /= -2;
|
||||
|
||||
GXSetTevColorS10(GX_TEVREG0, c0);
|
||||
GXSetTevColorS10(GX_TEVREG1, c1);
|
||||
GXSetTevColorS10(GX_TEVREG2, c2);
|
||||
|
||||
if ((mFontIdx == 1) || (mFontIdx == 3)) {
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C0, GX_CC_C1, GX_CC_TEXC, GX_CC_C2);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A0, GX_CA_A1, GX_CA_TEXA, GX_CA_ZERO);
|
||||
} else if ((mFontIdx == 0) || (mFontIdx == 2)) {
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C0, GX_CC_C1, GX_CC_TEXC, GX_CC_C2);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A0, GX_CA_A1, GX_CA_TEXA, GX_CA_A2);
|
||||
}
|
||||
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_2, 1, GX_TEVPREV);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_2, 1, GX_TEVPREV);
|
||||
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_CPREV, GX_CC_RASC, GX_CC_ZERO);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_APREV, GX_CA_RASA, GX_CA_ZERO);
|
||||
GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
}
|
||||
|
||||
static int CalcLineStrNum(
|
||||
f32 *pWidth, nw4r::ut::TextWriterBase<wchar_t> *pTextWriter, const wchar_t *str, int length, f32 maxWidth,
|
||||
bool *pbOver
|
||||
) {
|
||||
nw4r::ut::Rect rect;
|
||||
nw4r::ut::TextWriterBase<wchar_t> writerCpy(*pTextWriter);
|
||||
writerCpy.SetCursor(0.0f, 0.0f);
|
||||
int ret = CalcLineRectImpl(&rect, &writerCpy, str, length, maxWidth, pbOver, nullptr);
|
||||
*pWidth = rect.right - rect.left;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void dTextBox_c::MySetFontSize(const nw4r::lyt::Size &value) {
|
||||
mMyFontSize = value;
|
||||
}
|
||||
|
||||
void dTextBox_c::MySetScale(const nw4r::lyt::Size &value) {
|
||||
mMyTextScale = value;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// clang-format off
|
||||
#include "common.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/d_sc_title.h"
|
||||
#include "d/d_stage_mgr.h"
|
||||
@@ -102,12 +103,12 @@ bool dLytMeter1Button_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mAnmGroups[i].init(btn1BrlanMap[i].mFile, resAcc, mLyt.getLayout(), btn1BrlanMap[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
// TODO
|
||||
mLyt.fn_800AB9A0(mLyt.getTextBox("T_sabBtnS_00"), nullptr);
|
||||
mLyt.fn_800AB9A0(mLyt.getTextBox("T_sabBtn_00"), nullptr);
|
||||
mLyt.fn_800AB9A0(mLyt.getTextBox("T_sabBtnS_00"), 0);
|
||||
mLyt.fn_800AB9A0(mLyt.getTextBox("T_sabBtn_00"), 0);
|
||||
mpWindow = mLyt.getWindow(sWindowName1);
|
||||
mpTextbox = mLyt.getSizeBoxInWindow(sWindowName1);
|
||||
mpWindow->UpdateSize(mpTextbox, 32.0f);
|
||||
@@ -127,7 +128,7 @@ bool dLytMeter1Button_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytMeter1Button_c::remove() {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mAnmGroups[i].unbind();
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -215,7 +216,7 @@ bool dLytMeter2Button_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mAnmGroups[i].init(btn2BrlanMap[i].mFile, resAcc, mLyt.getLayout(), btn2BrlanMap[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
mpWindow = mLyt.getWindow(sWindowName2);
|
||||
@@ -237,7 +238,7 @@ bool dLytMeter2Button_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytMeter2Button_c::remove() {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mAnmGroups[i].unbind();
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -285,8 +286,6 @@ dLytMeter_c::dLytMeter_c() {}
|
||||
|
||||
extern "C" void fn_800D97E0(int i);
|
||||
extern "C" void fn_800D9800(int i);
|
||||
extern "C" void fn_801B2D10(void *);
|
||||
extern "C" void *GLOBAL_MESSAGE_RELATED_CONTEXT;
|
||||
|
||||
static const d2d::LytBrlanMapping meterBrlanMap[] = {
|
||||
{ "basicPosition_00_in.brlan", "G_remoConBtn_00"},
|
||||
@@ -333,7 +332,7 @@ bool dLytMeter_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
mLyt.setPriority(0x8A);
|
||||
for (int i = 0; i < 34; i++) {
|
||||
mAnmGroups[i].init(meterBrlanMap[i].mFile, resAcc, mLyt.getLayout(), meterBrlanMap[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
@@ -460,7 +459,7 @@ bool dLytMeter_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
|
||||
bool dLytMeter_c::remove() {
|
||||
for (int i = 0; i < 34; i++) {
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
|
||||
|
||||
@@ -632,7 +631,7 @@ bool dLytMeterContainer_c::build() {
|
||||
|
||||
fn_800D97E0(0xb);
|
||||
fn_800D9800(1);
|
||||
fn_801B2D10(GLOBAL_MESSAGE_RELATED_CONTEXT);
|
||||
dMessage_c::getInstance()->reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ bool dLytMeterABtn_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mAnmGroups[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ bool dLytMeterABtn_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytMeterABtn_c::remove() {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mAnmGroups[i].unbind();
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ bool dLytMeterDrink_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
mAnmGroups[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnmGroups[i].setDirection(false);
|
||||
mAnmGroups[i].bind(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ bool dLytMeterDrink_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytMeterDrink_c::remove() {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
mAnmGroups[i].unbind();
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -24,7 +24,7 @@ bool dLytMeterShieldGauge_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
bool dLytMeterShieldGauge_c::remove() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
mAnmGroups[i].unbind();
|
||||
mAnmGroups[i].afterUnbind();
|
||||
mAnmGroups[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,858 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_pad.h"
|
||||
#include "d/d_stage_mgr.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "d/d_textwindow_unk.h"
|
||||
#include "d/lyt/d_lyt_control_game.h"
|
||||
#include "d/lyt/d_lyt_map.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
|
||||
// clang-format off
|
||||
// vtable order
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_talk.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_link.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_sword.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_wood.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_stone.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_get.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_demo.h"
|
||||
#include "d/lyt/d_lyt_auto_explain.h"
|
||||
#include "d/lyt/d_lyt_auto_caption.h"
|
||||
// clang-format on
|
||||
|
||||
#include "f/f_base.h"
|
||||
#include "m/m_fader_base.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "toBeSorted/arc_managers/layout_arc_manager.h"
|
||||
#include "toBeSorted/d_d3d.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/global_fi_context.h"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
#include "toBeSorted/other_sound_stuff.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
class MsgWindowUnkLocalClass {
|
||||
public:
|
||||
MsgWindowUnkLocalClass();
|
||||
virtual ~MsgWindowUnkLocalClass();
|
||||
|
||||
private:
|
||||
/* 0x04 */ u32 field_0x04;
|
||||
/* 0x08 */ u8 field_0x08;
|
||||
/* 0x09 */ u8 field_0x09;
|
||||
};
|
||||
|
||||
MsgWindowUnkLocalClass mUnk;
|
||||
|
||||
MsgWindowUnkLocalClass::MsgWindowUnkLocalClass() {
|
||||
field_0x04 = 8;
|
||||
field_0x08 = 0;
|
||||
field_0x09 = 0;
|
||||
}
|
||||
MsgWindowUnkLocalClass::~MsgWindowUnkLocalClass() {}
|
||||
|
||||
STATE_DEFINE(dLytMsgWindow_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindow_c, In);
|
||||
STATE_DEFINE(dLytMsgWindow_c, OutputText);
|
||||
STATE_DEFINE(dLytMsgWindow_c, WaitKeyChangePage0);
|
||||
STATE_DEFINE(dLytMsgWindow_c, WaitKeyChangePage1);
|
||||
STATE_DEFINE(dLytMsgWindow_c, WaitKeyMsgEnd0);
|
||||
STATE_DEFINE(dLytMsgWindow_c, WaitKeyMsgEnd1);
|
||||
STATE_DEFINE(dLytMsgWindow_c, WaitKeyMsgEnd2);
|
||||
STATE_DEFINE(dLytMsgWindow_c, WaitKeySelectQuestion);
|
||||
STATE_DEFINE(dLytMsgWindow_c, MapOpen);
|
||||
STATE_DEFINE(dLytMsgWindow_c, WaitKeyMapClose);
|
||||
STATE_DEFINE(dLytMsgWindow_c, MapClose);
|
||||
STATE_DEFINE(dLytMsgWindow_c, Out);
|
||||
STATE_DEFINE(dLytMsgWindow_c, ExplainIn);
|
||||
STATE_DEFINE(dLytMsgWindow_c, ExplainVisible);
|
||||
STATE_DEFINE(dLytMsgWindow_c, ExplainOut);
|
||||
STATE_DEFINE(dLytMsgWindow_c, DemoIn);
|
||||
STATE_DEFINE(dLytMsgWindow_c, DemoVisible);
|
||||
STATE_DEFINE(dLytMsgWindow_c, DemoOut);
|
||||
|
||||
bool dLytMsgWindow_c::build() {
|
||||
mResAcc1.attach(LayoutArcManager::GetInstance()->getLoadedData("DoButton"), "");
|
||||
mResAcc2.attach(LayoutArcManager::GetInstance()->getLoadedData("System2D"), "");
|
||||
mSelectBtn.build(&mResAcc2);
|
||||
|
||||
mpTagProcessor = new dTagProcessor_c();
|
||||
mpMsgWindowUnk = new TextWindowUnk(mpTagProcessor);
|
||||
|
||||
if (GLOBAL_FI_CONTEXT != nullptr) {
|
||||
fn_8016C9F0(GLOBAL_FI_CONTEXT);
|
||||
}
|
||||
|
||||
mpWindowTalk = nullptr;
|
||||
mpWindowLink = nullptr;
|
||||
mpWindowSword = nullptr;
|
||||
mpWindowWood = nullptr;
|
||||
mpWindowStone = nullptr;
|
||||
mpWindowGet = nullptr;
|
||||
mpWindowDemo = nullptr;
|
||||
mpAutoExplain = nullptr;
|
||||
mpAutoCaption = nullptr;
|
||||
mpCurrentSubtype = nullptr;
|
||||
|
||||
mTextOptionSelection = 0;
|
||||
mSpecialFiMenuValue = 7;
|
||||
|
||||
field_0x1220 = 0;
|
||||
|
||||
field_0x80C = 0;
|
||||
field_0x80D = 0;
|
||||
field_0x80E = 0;
|
||||
mShowAutoMessage = 0;
|
||||
field_0x810 = 0;
|
||||
|
||||
field_0x774 = 0;
|
||||
field_0x778 = 0;
|
||||
field_0x77C = 0;
|
||||
field_0x780 = 0;
|
||||
field_0x784 = -1;
|
||||
|
||||
mAlsoEntryPointToTrigger = 0xFFFF;
|
||||
mEntryPointToTrigger = 0xFFFF;
|
||||
|
||||
mName = "";
|
||||
|
||||
field_0x811 = 0;
|
||||
field_0x812 = 0;
|
||||
field_0x813 = 0;
|
||||
field_0x814 = 0;
|
||||
field_0x815 = 0;
|
||||
field_0x816 = 0;
|
||||
field_0x817 = 0;
|
||||
field_0x818 = 0;
|
||||
field_0x819 = 0;
|
||||
field_0x81B = 0;
|
||||
field_0x81A = 0;
|
||||
field_0x81C = 0;
|
||||
field_0x81D = 0;
|
||||
|
||||
field_0x824 = 0;
|
||||
field_0x820 = 0;
|
||||
|
||||
field_0x81E = 0;
|
||||
|
||||
field_0x828 = nullptr;
|
||||
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindow_c::remove() {
|
||||
delete mpMsgWindowUnk;
|
||||
mpMsgWindowUnk = nullptr;
|
||||
delete mpTagProcessor;
|
||||
mpTagProcessor = nullptr;
|
||||
mSelectBtn.remove();
|
||||
removeSubMsgManagers();
|
||||
field_0x824 = 0;
|
||||
mResAcc1.detach();
|
||||
mResAcc2.detach();
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_Invisible() {}
|
||||
void dLytMsgWindow_c::executeState_Invisible() {
|
||||
if (dMessage_c::getInstance()->getField_0x329()) {
|
||||
mStateMgr.changeState(StateID_MapOpen);
|
||||
} else if (dMessage_c::getInstance()->getField_0x32A()) {
|
||||
mStateMgr.changeState(StateID_WaitKeyMapClose);
|
||||
} else if (field_0x80C) {
|
||||
field_0x80C = 0;
|
||||
if (dMessage_c::isValidTextLabel(mName)) {
|
||||
mNameCopy = mName;
|
||||
dMessage_c::getTextMessageByLabel(mNameCopy, mpTagProcessor, true, 0, 0);
|
||||
|
||||
if (field_0x1220 == 0) {
|
||||
if (field_0x80D != 0) {
|
||||
if (mpTagProcessor->getMsgWindowSubtype() == 0x16) {
|
||||
mpAutoCaption = new dLytAutoCaption_c();
|
||||
mpAutoCaption->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
mpCurrentSubtype = mpAutoCaption;
|
||||
} else {
|
||||
mpAutoExplain = new dLytAutoExplain_c();
|
||||
mpAutoExplain->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
mpCurrentSubtype = mpAutoExplain;
|
||||
}
|
||||
|
||||
mpCurrentSubtype->setPriority(0x8A);
|
||||
dTextBox_c *box = mpCurrentSubtype->getTextBox();
|
||||
mpMsgWindowUnk->fn_800B2130(mNameCopy, box, nullptr, true);
|
||||
mpMsgWindowUnk->textAdvancingRelated(true, true);
|
||||
mShowAutoMessage = false;
|
||||
setTextToDisplay(mpMsgWindowUnk->getProcessedText());
|
||||
mStateMgr.changeState(StateID_ExplainIn);
|
||||
} else {
|
||||
createSubMsgManager(mpTagProcessor->getMsgWindowSubtype());
|
||||
field_0x828 = nullptr;
|
||||
mSpecialFiMenuValue = 7;
|
||||
if (mpTagProcessor->getMsgWindowSubtype() == 6) {
|
||||
mpCurrentSubtype = mpWindowWood;
|
||||
dTextBox_c *box = mpCurrentSubtype->getTextBox();
|
||||
mpMsgWindowUnk->fn_800B2130(mNameCopy, box, nullptr, true);
|
||||
mpMsgWindowUnk->textAdvancingRelated(true, true);
|
||||
setTextToDisplay(mpMsgWindowUnk->getProcessedText());
|
||||
} else if (mpTagProcessor->getMsgWindowSubtype() == 7) {
|
||||
mpCurrentSubtype = mpWindowStone;
|
||||
dTextBox_c *box = mpCurrentSubtype->getTextBox();
|
||||
mpMsgWindowUnk->fn_800B2130(mNameCopy, box, nullptr, true);
|
||||
mpMsgWindowUnk->textAdvancingRelated(true, true);
|
||||
setTextToDisplay(mpMsgWindowUnk->getProcessedText());
|
||||
} else if (mpTagProcessor->getMsgWindowSubtype() >= 2 &&
|
||||
mpTagProcessor->getMsgWindowSubtype() < 5) {
|
||||
mpCurrentSubtype = mpWindowSword;
|
||||
field_0x828 = mpWindowSword->getCharData();
|
||||
} else if (mpTagProcessor->getMsgWindowSubtype() == 9) {
|
||||
mpCurrentSubtype = mpWindowLink;
|
||||
field_0x828 = mpWindowLink->getCharData();
|
||||
} else if (mpTagProcessor->getMsgWindowSubtype() == 5) {
|
||||
mpCurrentSubtype = mpWindowGet;
|
||||
field_0x828 = mpWindowGet->getCharData();
|
||||
} else if (mpTagProcessor->getMsgWindowSubtype() == 30) {
|
||||
mpCurrentSubtype = mpWindowDemo;
|
||||
field_0x828 = mpWindowDemo->getCharData();
|
||||
dTextBox_c *box = mpCurrentSubtype->getTextBox();
|
||||
mpMsgWindowUnk->fn_800B2130(mNameCopy, box, field_0x828, true);
|
||||
mpMsgWindowUnk->textAdvancingRelated(true, true);
|
||||
setTextToDisplay(mpMsgWindowUnk->getProcessedText());
|
||||
mpCurrentSubtype->setPriority(0x8A);
|
||||
mStateMgr.changeState(StateID_DemoIn);
|
||||
return;
|
||||
} else {
|
||||
mpCurrentSubtype = mpWindowTalk;
|
||||
field_0x828 = mpWindowTalk->getCharData();
|
||||
}
|
||||
mpCurrentSubtype->setPriority(0x8A);
|
||||
dTextBox_c *box = mpCurrentSubtype->getTextBox();
|
||||
mpMsgWindowUnk->fn_800B2130(mNameCopy, box, field_0x828, true);
|
||||
setTextToDisplay(mpMsgWindowUnk->getProcessedText());
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
} else {
|
||||
mStateMgr.changeState(StateID_OutputText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_In() {
|
||||
dAcObjBase_c *obj = EventManager::fn_800A08F0(fBase_c::ACTOR);
|
||||
u32 param = 0;
|
||||
if (mpTagProcessor->getField_0x90D() == 1) {
|
||||
param = 0;
|
||||
} else if (mpTagProcessor->getField_0x90D() == 2) {
|
||||
param = 2;
|
||||
} else if (mpTagProcessor->getField_0x90D() == 3) {
|
||||
param = 1;
|
||||
} else if (obj != nullptr && d3d::fn_80016A90(obj->poscopy2)) {
|
||||
d3d::fn_80016960(field_0x768, obj->poscopy2);
|
||||
// TODO - stack and FPR problems
|
||||
field_0x768 = mVec3_c(field_0x768.x, field_0x768.y, 0.0f);
|
||||
if (field_0x768.y < get_8057511C() / 3.0f + get_80575134()) {
|
||||
param = 2;
|
||||
}
|
||||
}
|
||||
mpCurrentSubtype->open(obj, param);
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_In() {
|
||||
if (mpCurrentSubtype->isDoneOpening()) {
|
||||
mStateMgr.changeState(StateID_OutputText);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_In() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_OutputText() {
|
||||
field_0x81C = 0;
|
||||
field_0x81D = 0;
|
||||
field_0x820 = 0;
|
||||
field_0x81E = 0;
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_OutputText() {
|
||||
u16 oldValue = mpMsgWindowUnk->getField_0x147A();
|
||||
field_0x812 = 0;
|
||||
if (mpTagProcessor->getField_0x830() != -1) {
|
||||
field_0x811 = 1;
|
||||
} else {
|
||||
field_0x811 = 0;
|
||||
}
|
||||
|
||||
if (field_0x815 == 0 && field_0x816 == 0) {
|
||||
mpMsgWindowUnk->textAdvancingRelated(false, true);
|
||||
if (field_0x811 == 0 && dPad::checkButtonAHeld() && field_0x815 == 0 && field_0x816 == 0) {
|
||||
mpMsgWindowUnk->textAdvancingRelated(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (mpTagProcessor->getMsgWindowSubtype() >= 2 && mpTagProcessor->getMsgWindowSubtype() < 5) {
|
||||
fn_803998A0(lbl_80575DE0, mpMsgWindowUnk->getField_0x147A(), mpMsgWindowUnk->getField_0x147C());
|
||||
} else if (mpTagProcessor->getMsgWindowSubtype() <= 1 && oldValue != mpMsgWindowUnk->getField_0x147A()) {
|
||||
u16 a = mpMsgWindowUnk->getField_0x147C();
|
||||
f32 b = (dTagProcessor_c::fn_800B8040(0, 0) * 100.0f);
|
||||
SmallSoundManager::GetInstance()->playButtonPressSoundWhenAdvancingTextBoxes(a / b);
|
||||
}
|
||||
|
||||
if (setTextToDisplay(mpMsgWindowUnk->getProcessedText())) {
|
||||
if (field_0x81C != 0) {
|
||||
if (field_0x811 != 0) {
|
||||
mStateMgr.changeState(StateID_WaitKeyMsgEnd0);
|
||||
} else if (mpTagProcessor->getField_0x90E() != 0) {
|
||||
mStateMgr.changeState(StateID_WaitKeyMsgEnd0);
|
||||
} else if (mpCurrentSubtype->startConfirm()) {
|
||||
field_0x817 = 1;
|
||||
mStateMgr.changeState(StateID_WaitKeyMsgEnd0);
|
||||
}
|
||||
} else if (field_0x81D != 0) {
|
||||
if (field_0x811 != 0) {
|
||||
mStateMgr.changeState(StateID_WaitKeyChangePage0);
|
||||
} else if (mpCurrentSubtype->startConfirm()) {
|
||||
field_0x817 = 1;
|
||||
mStateMgr.changeState(StateID_WaitKeyChangePage0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
field_0x81C = mpMsgWindowUnk->checkEndReached();
|
||||
field_0x81D = mpMsgWindowUnk->checkLastLineReached();
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_OutputText() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_WaitKeyChangePage0() {
|
||||
if (field_0x811 != 0) {
|
||||
field_0x812 = 1;
|
||||
} else if (field_0x814 == 0) {
|
||||
fn_8035E860(BGM_MGR);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_WaitKeyChangePage0() {
|
||||
bool allowChange = false;
|
||||
if (field_0x811 != 0) {
|
||||
if (mpTagProcessor->getField_0x830() <= 0) {
|
||||
allowChange = true;
|
||||
}
|
||||
} else if (field_0x814 != 0) {
|
||||
if (field_0x813 != 0) {
|
||||
field_0x813 = 0;
|
||||
allowChange = true;
|
||||
}
|
||||
} else if (dPad::checkButtonAPressed() || fn_8011A5D0()) {
|
||||
fn_8035E880(BGM_MGR);
|
||||
allowChange = true;
|
||||
}
|
||||
|
||||
if (!allowChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (field_0x811 == 0) {
|
||||
mStateMgr.changeState(StateID_WaitKeyChangePage1);
|
||||
} else {
|
||||
mpMsgWindowUnk->fn_800B2AA0();
|
||||
if (mpTagProcessor->getMsgWindowSubtype() >= 6 && mpTagProcessor->getMsgWindowSubtype() < 8) {
|
||||
mpMsgWindowUnk->textAdvancingRelated(true, true);
|
||||
}
|
||||
setTextToDisplay(mpMsgWindowUnk->getProcessedText());
|
||||
field_0x818 = 1;
|
||||
mStateMgr.changeState(StateID_OutputText);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_WaitKeyChangePage0() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_WaitKeyChangePage1() {}
|
||||
void dLytMsgWindow_c::executeState_WaitKeyChangePage1() {
|
||||
if (mpCurrentSubtype->startDecide(false)) {
|
||||
field_0x817 = 0;
|
||||
mpMsgWindowUnk->fn_800B2AA0();
|
||||
if (mpTagProcessor->getMsgWindowSubtype() >= 6 && mpTagProcessor->getMsgWindowSubtype() < 8) {
|
||||
mpMsgWindowUnk->textAdvancingRelated(true, true);
|
||||
}
|
||||
setTextToDisplay(mpMsgWindowUnk->getProcessedText());
|
||||
field_0x818 = 1;
|
||||
mStateMgr.changeState(StateID_OutputText);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_WaitKeyChangePage1() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_WaitKeyMsgEnd0() {
|
||||
if (field_0x811 != 0) {
|
||||
field_0x812 = 1;
|
||||
} else if (mpTagProcessor->getField_0x90E() == 0 && field_0x814 == 0) {
|
||||
fn_8035E860(BGM_MGR);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_WaitKeyMsgEnd0() {
|
||||
bool allowChange = false;
|
||||
if (field_0x811 != 0) {
|
||||
if (mpTagProcessor->getField_0x830() <= 0) {
|
||||
allowChange = true;
|
||||
}
|
||||
} else if (mpTagProcessor->getField_0x90E() != 0) {
|
||||
allowChange = true;
|
||||
} else if (field_0x814 != 0) {
|
||||
if (field_0x813 != 0) {
|
||||
field_0x813 = 0;
|
||||
allowChange = true;
|
||||
}
|
||||
} else if (dPad::checkButtonAPressed() || fn_8011A5D0()) {
|
||||
fn_8035E880(BGM_MGR);
|
||||
allowChange = true;
|
||||
}
|
||||
|
||||
if (!allowChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (field_0x811 == 0 && mpTagProcessor->getField_0x90E() == 0) {
|
||||
mStateMgr.changeState(StateID_WaitKeyMsgEnd1);
|
||||
} else if (field_0x810 != 0) {
|
||||
if (dMessage_c::isValidTextLabel(mName)) {
|
||||
mNameCopy = mName;
|
||||
dTextBox_c *box = mpCurrentSubtype->getTextBox();
|
||||
mpMsgWindowUnk->fn_800B2130(mNameCopy, box, field_0x828, true);
|
||||
setTextToDisplay(mpMsgWindowUnk->getProcessedText());
|
||||
field_0x818 = 1;
|
||||
mStateMgr.changeState(StateID_OutputText);
|
||||
}
|
||||
field_0x810 = 0;
|
||||
} else {
|
||||
fn_8035E820(BGM_MGR);
|
||||
if (mpTagProcessor->getField_0x90E() != 0) {
|
||||
mStateMgr.changeState(StateID_WaitKeySelectQuestion);
|
||||
} else {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_WaitKeyMsgEnd0() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_WaitKeyMsgEnd1() {}
|
||||
void dLytMsgWindow_c::executeState_WaitKeyMsgEnd1() {
|
||||
if (mpCurrentSubtype->startDecide(false)) {
|
||||
if (field_0x810 != 0) {
|
||||
field_0x817 = 0;
|
||||
if (dMessage_c::isValidTextLabel(mName)) {
|
||||
mNameCopy = mName;
|
||||
mpMsgWindowUnk->fn_800B2130(mNameCopy, mpCurrentSubtype->getTextBox(), field_0x828, true);
|
||||
setTextToDisplay(mpMsgWindowUnk->getProcessedText());
|
||||
field_0x818 = 1;
|
||||
mStateMgr.changeState(StateID_OutputText);
|
||||
}
|
||||
field_0x810 = 0;
|
||||
} else {
|
||||
fn_8035E820(BGM_MGR);
|
||||
if (mpTagProcessor->getField_0x90E() != 0) {
|
||||
mStateMgr.changeState(StateID_WaitKeySelectQuestion);
|
||||
} else if (field_0x817 == 0) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
} else {
|
||||
field_0x817 = 0;
|
||||
mStateMgr.changeState(StateID_WaitKeyMsgEnd2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_WaitKeyMsgEnd1() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_WaitKeyMsgEnd2() {}
|
||||
void dLytMsgWindow_c::executeState_WaitKeyMsgEnd2() {
|
||||
if (mpCurrentSubtype->isDoneDecide()) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_WaitKeyMsgEnd2() {}
|
||||
|
||||
static wchar_t *sBufs[4];
|
||||
|
||||
void dLytMsgWindow_c::initializeState_WaitKeySelectQuestion() {
|
||||
// TODO regswaps
|
||||
field_0x824 = mpTagProcessor->getField_0x90E();
|
||||
|
||||
mSelectBtn.setField_0x9B8(mpTagProcessor->getField_0x82C());
|
||||
s32 tmp = mpTagProcessor->getField_0x828();
|
||||
mSelectBtn.setField_0x9BC(tmp);
|
||||
mSelectBtn.setField_0x990(tmp);
|
||||
mSelectBtn.setField_0x998(mpTagProcessor);
|
||||
|
||||
wchar_t **buf = sBufs;
|
||||
|
||||
buf[0] = mpTagProcessor->getBuf(0);
|
||||
buf[1] = mpTagProcessor->getBuf(1);
|
||||
buf[2] = mpTagProcessor->getBuf(2);
|
||||
buf[3] = mpTagProcessor->getBuf(3);
|
||||
|
||||
mSelectBtn.fn_8011E5D0(field_0x824, true);
|
||||
|
||||
for (int i = 0; i < field_0x824; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
mSelectBtn.getSelectTextBox(i, j)->setTextWithGlobalTextProcessor(buf[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_WaitKeySelectQuestion() {
|
||||
s32 selection = mSelectBtn.getField_0x9B4();
|
||||
if (selection >= 0) {
|
||||
if (mSelectBtn.isStateWait()) {
|
||||
bool doFiThing = false;
|
||||
mpTagProcessor->setField_0x90E(0);
|
||||
mpTagProcessor->setField_0x82C(-1);
|
||||
mpTagProcessor->setField_0x828(-1);
|
||||
mSelectBtn.setField_0x998(nullptr);
|
||||
field_0x824 = 0;
|
||||
mTextOptionSelection = selection;
|
||||
field_0x1220 = 0;
|
||||
if (GLOBAL_FI_CONTEXT != nullptr) {
|
||||
doFiThing = GLOBAL_FI_CONTEXT->mDoSpecialFiMenuHandling;
|
||||
}
|
||||
|
||||
if (doFiThing) {
|
||||
switch ((int)mTextOptionSelection) {
|
||||
case 0: mSpecialFiMenuValue = FiContext::getGlobalFiInfo0(0); break;
|
||||
case 1: mSpecialFiMenuValue = FiContext::getGlobalFiInfo0(1); break;
|
||||
case 2: mSpecialFiMenuValue = FiContext::getGlobalFiInfo0(2); break;
|
||||
case 3: mSpecialFiMenuValue = 7; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (field_0x1220 != 0) {
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
} else {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_WaitKeySelectQuestion() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_MapOpen() {}
|
||||
void dLytMsgWindow_c::executeState_MapOpen() {
|
||||
if ((dLytMap_c::getInstance() != nullptr && dLytMap_c::getInstance()->isOpenMaybe()) ||
|
||||
!dLytControlGame_c::getInstance()->isInSomeMapState()) {
|
||||
dMessage_c::getInstance()->setField_0x329(0);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_MapOpen() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_WaitKeyMapClose() {}
|
||||
void dLytMsgWindow_c::executeState_WaitKeyMapClose() {
|
||||
if ((dPad::checkButtonBPressed() || dPad::checkButtonPlusPressed()) &&
|
||||
!dLytControlGame_c::getInstance()->isNotInStateMap()) {
|
||||
dLytControlGame_c::getInstance()->fn_802CCD40(true);
|
||||
mStateMgr.changeState(StateID_MapClose);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_WaitKeyMapClose() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_MapClose() {}
|
||||
void dLytMsgWindow_c::executeState_MapClose() {}
|
||||
void dLytMsgWindow_c::finalizeState_MapClose() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_Out() {
|
||||
field_0x768 = field_0x75C;
|
||||
mpCurrentSubtype->close();
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_Out() {
|
||||
if (mpCurrentSubtype->isDoneClosing() && (field_0x817 == 0 || mpCurrentSubtype->isDoneDecide())) {
|
||||
removeSubMsgManagers();
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_Out() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_ExplainIn() {
|
||||
mpCurrentSubtype->open(nullptr, false);
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_ExplainIn() {
|
||||
if (mpCurrentSubtype->isDoneOpening()) {
|
||||
mpMsgWindowUnk->textAdvancingRelated(true, true);
|
||||
if (setTextToDisplay(mpMsgWindowUnk->getProcessedText())) {
|
||||
mStateMgr.changeState(StateID_ExplainVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_ExplainIn() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_ExplainVisible() {}
|
||||
void dLytMsgWindow_c::executeState_ExplainVisible() {
|
||||
if ((mShowAutoMessage != 0 || (mpAutoExplain != nullptr && mpAutoExplain->checkSomethingMeter())) ||
|
||||
((mpAutoCaption != nullptr && mpAutoCaption->checkSomethingMeter()))) {
|
||||
mStateMgr.changeState(StateID_ExplainOut);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_ExplainVisible() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_ExplainOut() {
|
||||
mpCurrentSubtype->close();
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_ExplainOut() {
|
||||
if (mpCurrentSubtype->isDoneClosing()) {
|
||||
field_0x80D = 0;
|
||||
mShowAutoMessage = 0;
|
||||
removeSubMsgManagers();
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_ExplainOut() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_DemoIn() {
|
||||
mpCurrentSubtype->open(nullptr, 0);
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_DemoIn() {
|
||||
if (mpCurrentSubtype->isDoneOpening()) {
|
||||
mStateMgr.changeState(StateID_DemoVisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_DemoIn() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_DemoVisible() {
|
||||
field_0x81C = 0;
|
||||
field_0x812 = 1;
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_DemoVisible() {
|
||||
if (mpTagProcessor->getField_0x830() <= 0) {
|
||||
mStateMgr.changeState(StateID_DemoOut);
|
||||
}
|
||||
field_0x81C = mpMsgWindowUnk->checkEndReached();
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_DemoVisible() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_DemoOut() {
|
||||
mpCurrentSubtype->close();
|
||||
}
|
||||
void dLytMsgWindow_c::executeState_DemoOut() {
|
||||
if (mpCurrentSubtype->isDoneClosing()) {
|
||||
if (field_0x81C != 0) {
|
||||
field_0x81C = 0;
|
||||
removeSubMsgManagers();
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
} else {
|
||||
mpMsgWindowUnk->fn_800B2AA0();
|
||||
mpMsgWindowUnk->textAdvancingRelated(true, true);
|
||||
setTextToDisplay(mpMsgWindowUnk->getProcessedText());
|
||||
mStateMgr.changeState(StateID_DemoIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytMsgWindow_c::finalizeState_DemoOut() {}
|
||||
|
||||
bool dLytMsgWindow_c::execute() {
|
||||
field_0x818 = 0;
|
||||
u8 old_field_0x816 = field_0x816;
|
||||
if (*mStateMgr.getStateID() == StateID_DemoIn || *mStateMgr.getStateID() == StateID_DemoVisible ||
|
||||
*mStateMgr.getStateID() == StateID_DemoOut) {
|
||||
dStageMgr_c *mgr = dStageMgr_c::GetInstance();
|
||||
// Bleh
|
||||
bool b =
|
||||
!(mgr->getFader()->isNotStatus(static_cast<mFaderBase_c::EStatus>(-1)) ||
|
||||
mgr->getFader()->isNotStatus(mFaderBase_c::FADED_OUT));
|
||||
if (!b) {
|
||||
field_0x819 = 1;
|
||||
field_0x81B = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (field_0x81B != 0) {
|
||||
if (isVisible()) {
|
||||
removeSubMsgManagers();
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
mpMsgWindowUnk->reset();
|
||||
mSelectBtn.remove();
|
||||
field_0x81B = 0;
|
||||
// TODO boss caption
|
||||
}
|
||||
// TODO ActorEventFlowManagerRelated::checkEventFinished
|
||||
|
||||
mStateMgr.executeState();
|
||||
|
||||
if (isVisible()) {
|
||||
mSelectBtn.execute();
|
||||
if (mpCurrentSubtype != nullptr) {
|
||||
mpCurrentSubtype->execute();
|
||||
}
|
||||
}
|
||||
|
||||
if (field_0x812 != 0) {
|
||||
if (mpTagProcessor->getField_0x830() != -1) {
|
||||
mpTagProcessor->tick0x830();
|
||||
} else {
|
||||
field_0x811 = 0;
|
||||
field_0x812 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mpTagProcessor->execute();
|
||||
if (field_0x816 == 1 && old_field_0x816 == 1) {
|
||||
field_0x816 = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindow_c::draw() {
|
||||
if (isVisible() || field_0x1220 != 0) {
|
||||
if (mpCurrentSubtype != nullptr) {
|
||||
// TODO tag processor
|
||||
mpCurrentSubtype->addToDrawList();
|
||||
}
|
||||
mSelectBtn.draw();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindow_c::setCurrentLabelName(const char *name, bool storeFile) {
|
||||
// TODO
|
||||
mName = name;
|
||||
!std::strcmp(name, "FR_SIREN_04");
|
||||
}
|
||||
|
||||
bool dLytMsgWindow_c::isVisible() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_Invisible);
|
||||
}
|
||||
|
||||
bool dLytMsgWindow_c::setTextToDisplay(const wchar_t *text) {
|
||||
if (mpCurrentSubtype != nullptr) {
|
||||
return mpCurrentSubtype->setText(text);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool dLytMsgWindow_c::isOutputtingText() const {
|
||||
return *mStateMgr.getStateID() == StateID_OutputText;
|
||||
}
|
||||
|
||||
void dLytMsgWindow_c::setCurrentEntrypointName(const char *name) {
|
||||
mCurrentEntrypointName = name;
|
||||
}
|
||||
|
||||
void dLytMsgWindow_c::setCurrentFlowFilename(const char *name) {
|
||||
mCurrentFlowFileName = name;
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
void dLytMsgWindow_c::createSubMsgManager(u8 type) {
|
||||
switch (type) {
|
||||
case 6:
|
||||
mpWindowWood = new dLytMsgWindowWood_c();
|
||||
mpWindowWood->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
break;
|
||||
case 7:
|
||||
mpWindowStone = new dLytMsgWindowStone_c();
|
||||
mpWindowStone->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
break;
|
||||
case 2:
|
||||
mpWindowSword = new dLytMsgWindowSword_c();
|
||||
mpWindowSword->setSwordType(dLytTextSword::FI);
|
||||
mpWindowSword->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
break;
|
||||
case 3:
|
||||
mpWindowSword = new dLytMsgWindowSword_c();
|
||||
mpWindowSword->setSwordType(dLytTextSword::GHIRAHIM);
|
||||
mpWindowSword->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
break;
|
||||
case 4:
|
||||
mpWindowSword = new dLytMsgWindowSword_c();
|
||||
mpWindowSword->setSwordType(dLytTextSword::LASTBOSS);
|
||||
mpWindowSword->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
break;
|
||||
case 9:
|
||||
// TODO Link
|
||||
mpWindowLink = new dLytMsgWindowLink_c();
|
||||
mpWindowLink->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
break;
|
||||
case 5:
|
||||
// TODO Get
|
||||
mpWindowGet = new dLytMsgWindowGet_c();
|
||||
mpWindowGet->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
break;
|
||||
case 30:
|
||||
// TODO Demo
|
||||
mpWindowDemo = new dLytMsgWindowDemo_c();
|
||||
mpWindowDemo->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
break;
|
||||
default:
|
||||
// TODO talk
|
||||
mpWindowTalk = new dLytMsgWindowTalk_c();
|
||||
mpWindowTalk->build(&mResAcc1, &mResAcc2, mpTagProcessor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma dont_inline off
|
||||
|
||||
void dLytMsgWindow_c::removeSubMsgManagers() {
|
||||
if (mpWindowTalk != nullptr) {
|
||||
mpWindowTalk->remove();
|
||||
delete mpWindowTalk;
|
||||
mpWindowTalk = nullptr;
|
||||
}
|
||||
|
||||
if (mpWindowLink != nullptr) {
|
||||
mpWindowLink->remove();
|
||||
delete mpWindowLink;
|
||||
mpWindowLink = nullptr;
|
||||
}
|
||||
|
||||
if (mpWindowSword != nullptr) {
|
||||
mpWindowSword->remove();
|
||||
delete mpWindowSword;
|
||||
mpWindowSword = nullptr;
|
||||
}
|
||||
|
||||
if (mpWindowWood != nullptr) {
|
||||
mpWindowWood->remove();
|
||||
delete mpWindowWood;
|
||||
mpWindowWood = nullptr;
|
||||
}
|
||||
|
||||
if (mpWindowStone != nullptr) {
|
||||
mpWindowStone->remove();
|
||||
delete mpWindowStone;
|
||||
mpWindowStone = nullptr;
|
||||
}
|
||||
|
||||
if (mpWindowGet != nullptr) {
|
||||
mpWindowGet->remove();
|
||||
delete mpWindowGet;
|
||||
mpWindowGet = nullptr;
|
||||
}
|
||||
|
||||
if (mpWindowDemo != nullptr) {
|
||||
mpWindowDemo->remove();
|
||||
delete mpWindowDemo;
|
||||
mpWindowDemo = nullptr;
|
||||
}
|
||||
|
||||
if (mpAutoExplain != nullptr) {
|
||||
mpAutoExplain->remove();
|
||||
delete mpAutoExplain;
|
||||
mpAutoExplain = nullptr;
|
||||
}
|
||||
|
||||
if (mpAutoCaption != nullptr) {
|
||||
mpAutoCaption->remove();
|
||||
delete mpAutoCaption;
|
||||
mpAutoCaption = nullptr;
|
||||
}
|
||||
|
||||
mpCurrentSubtype = nullptr;
|
||||
field_0x1220 = 0;
|
||||
|
||||
UnkTextThing::getInstance()->setStr2("");
|
||||
UnkTextThing::getInstance()->setStr1("");
|
||||
UnkTextThing::getInstance()->setStr3("");
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
|
||||
bool dLytMsgWindowSubtype::build(d2d::ResAccIf_c *, d2d::ResAccIf_c *, dTagProcessor_c *) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowSubtype::remove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowSubtype::execute() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowSubtype::open(dAcObjBase_c *obj, u32 param) {}
|
||||
|
||||
bool dLytMsgWindowSubtype::isDoneOpening() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowSubtype::close() {}
|
||||
|
||||
bool dLytMsgWindowSubtype::isDoneClosing() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowSubtype::setText(const wchar_t *text) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static const char *sSwordPane = "RootPane";
|
||||
static const char *sSwordTextBoxes[] = {
|
||||
"T_font_00",
|
||||
"T_fontS_00",
|
||||
"T_fontS_01",
|
||||
};
|
||||
|
||||
bool dLytTextSword::build(d2d::ResAccIf_c *resAcc, ESwordType type) {
|
||||
mType = type;
|
||||
mLyt.setResAcc(resAcc);
|
||||
if (mType == GHIRAHIM) {
|
||||
mLyt.build("textGirahim00.brlyt", nullptr);
|
||||
} else if (mType == LASTBOSS) {
|
||||
mLyt.build("textLastBoss_00.brlyt", nullptr);
|
||||
} else {
|
||||
mLyt.build("textSword_00.brlyt", nullptr);
|
||||
}
|
||||
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
if (mType == GHIRAHIM) {
|
||||
mAnm.init("textGirahim00_in.brlan", resAcc, mLyt.getLayout(), "G_inOut_00");
|
||||
} else if (mType == LASTBOSS) {
|
||||
mAnm.init("textLastBoss_00_in.brlan", resAcc, mLyt.getLayout(), "G_inOut_00");
|
||||
} else {
|
||||
mAnm.init("textSword_00_in.brlan", resAcc, mLyt.getLayout(), "G_inOut_00");
|
||||
}
|
||||
|
||||
mAnm.bind(false);
|
||||
mAnm.setAnimEnable(true);
|
||||
|
||||
mpPane = mLyt.findPane(sSwordPane);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mpTexts[i] = mLyt.getTextBox(sSwordTextBoxes[i]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytTextSword::remove() {
|
||||
mAnm.remove();
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytTextSword::draw(const wchar_t *str, s8 timer, mVec3_c pos, f32 fScale) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mpTexts[i]->setTextWithGlobalTextProcessor(str, nullptr);
|
||||
}
|
||||
|
||||
f32 f = fScale / dTagProcessor_c::fn_800B8040(0, 0);
|
||||
nw4r::math::VEC2 scale = nw4r::math::VEC2(f, f);
|
||||
|
||||
mAnm.setFrame(timer);
|
||||
mpPane->SetLocationAdjust(true);
|
||||
mpPane->SetTranslate(pos);
|
||||
mpPane->SetScale(scale);
|
||||
mLyt.calc();
|
||||
mpPane->CalculateMtx(mLyt.getDrawInfo());
|
||||
mpPane->Draw(mLyt.getDrawInfo());
|
||||
}
|
||||
|
||||
f32 dLytTextSword::getAnimDuration() const {
|
||||
return mAnm.getAnimDuration();
|
||||
}
|
||||
|
||||
static const char *sLightPane = "RootPane";
|
||||
|
||||
bool dLytTextLight::build(d2d::ResAccIf_c *resAcc, ETextType type) {
|
||||
mType = type;
|
||||
mLyt.setResAcc(resAcc);
|
||||
|
||||
if (type == DEMO) {
|
||||
mLyt.build("textLightDemo_00.brlyt", nullptr);
|
||||
} else {
|
||||
mLyt.build("textLight_00.brlyt", nullptr);
|
||||
}
|
||||
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
if (mType == DEMO) {
|
||||
mAnm.init("textLightDemo_00_loop.brlan", resAcc, mLyt.getLayout(), "G_loop_00");
|
||||
} else {
|
||||
mAnm.init("textLight_00_loop.brlan", resAcc, mLyt.getLayout(), "G_loop_00");
|
||||
}
|
||||
|
||||
mAnm.bind(false);
|
||||
mAnm.setAnimEnable(true);
|
||||
|
||||
mpPane = mLyt.findPane(sLightPane);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytTextLight::remove() {
|
||||
mAnm.remove();
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytTextLight::draw(s8 frame, mVec3_c pos, u8 alpha, f32 fScale) {
|
||||
f32 f = fScale / dTagProcessor_c::fn_800B8040(0, 0);
|
||||
nw4r::math::VEC2 scale = nw4r::math::VEC2(f, f);
|
||||
|
||||
mAnm.setFrame(frame);
|
||||
mpPane->SetLocationAdjust(true);
|
||||
mpPane->SetInfluencedAlpha(true);
|
||||
mpPane->SetAlpha(alpha);
|
||||
mpPane->SetTranslate(pos);
|
||||
mpPane->SetScale(scale);
|
||||
mLyt.calc();
|
||||
mpPane->CalculateMtx(mLyt.getDrawInfo());
|
||||
mpPane->Draw(mLyt.getDrawInfo());
|
||||
}
|
||||
|
||||
f32 dLytTextLight::getAnimDuration() const {
|
||||
return mAnm.getAnimDuration();
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_demo.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "nw4r/lyt/lyt_types.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "toBeSorted/arc_managers/layout_arc_manager.h"
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowDemo_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindowDemo_c, In);
|
||||
STATE_DEFINE(dLytMsgWindowDemo_c, Visible);
|
||||
STATE_DEFINE(dLytMsgWindowDemo_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "demoWait_00_in.brlan", "G_inOut_00"},
|
||||
{"demoWait_00_out.brlan", "G_inOut_00"},
|
||||
};
|
||||
|
||||
#define DEMO_ANIM_IN 0
|
||||
#define DEMO_ANIM_OUT 1
|
||||
|
||||
#define DEMO_NUM_ANIMS 2
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_message_00",
|
||||
"T_messageS_00",
|
||||
};
|
||||
|
||||
bool dLytMsgWindowDemo_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mResAcc.attach(LayoutArcManager::GetInstance()->getLoadedData("DemoWait"), "");
|
||||
mLyt.setResAcc(&mResAcc);
|
||||
mLyt.build("demoWait_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < DEMO_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, &mResAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnm[DEMO_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[DEMO_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[DEMO_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
mpPane = mLyt.findPane("N_inOut_00");
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
}
|
||||
|
||||
mpTextboxes[1]->set0x1F6(1);
|
||||
|
||||
mpTagProcessor = tagProcessor;
|
||||
|
||||
mOffsets[0].x = mOffsets[0].y = 0.0f;
|
||||
mOffsets[1].x = mOffsets[1].y = 0.0f;
|
||||
|
||||
mText.build(&mResAcc, dLytTextLight::DEMO);
|
||||
mBlurRelated.build();
|
||||
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowDemo_c::remove() {
|
||||
mText.remove();
|
||||
for (int i = 0; i < DEMO_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
mResAcc.detach();
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowDemo_c::initializeState_Invisible() {
|
||||
nw4r::lyt::Size size = getTextBox()->GetSize();
|
||||
nw4r::lyt::Size fontSize = getTextBox()->GetFontSize();
|
||||
nw4r::math::MTX34 transform = getTextBox()->GetGlobalMtx();
|
||||
|
||||
mOffsets[0].x = transform._03 - size.width / 2.0f;
|
||||
mOffsets[0].y = (transform._13 - size.height / 2.0f) + fontSize.height + fontSize.height * 0.5f;
|
||||
mOffsets[1].x = mOffsets[0].x;
|
||||
mOffsets[1].y =
|
||||
(transform._13 - size.height / 2.0f) + fontSize.height + getTextBox()->GetLineSpace() + fontSize.height;
|
||||
}
|
||||
void dLytMsgWindowDemo_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowDemo_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytMsgWindowDemo_c::initializeState_In() {
|
||||
mAnm[DEMO_ANIM_IN].setForwardOnce();
|
||||
mAnm[DEMO_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[DEMO_ANIM_IN].setToStart();
|
||||
}
|
||||
void dLytMsgWindowDemo_c::executeState_In() {
|
||||
if (mAnm[DEMO_ANIM_IN].isStop2()) {
|
||||
mAnm[DEMO_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Visible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowDemo_c::finalizeState_In() {}
|
||||
|
||||
void dLytMsgWindowDemo_c::initializeState_Visible() {}
|
||||
void dLytMsgWindowDemo_c::executeState_Visible() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowDemo_c::finalizeState_Visible() {}
|
||||
|
||||
void dLytMsgWindowDemo_c::initializeState_Out() {
|
||||
mAnm[DEMO_ANIM_OUT].setForwardOnce();
|
||||
mAnm[DEMO_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[DEMO_ANIM_OUT].setToStart();
|
||||
}
|
||||
void dLytMsgWindowDemo_c::executeState_Out() {
|
||||
if (mAnm[DEMO_ANIM_OUT].isStop2()) {
|
||||
mAnm[DEMO_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowDemo_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytMsgWindowDemo_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < DEMO_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
mLyt.calc();
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowDemo_c::draw() {
|
||||
SizedString<64> label = getTextLabel();
|
||||
// TODO figure out what these correspond to
|
||||
if (!(label == "Demo01_01:07") && !(label == "Demo01_01:15") && !(label == "Demo01_01:16") &&
|
||||
!(label == "Demo01_01:17") && !(label == "Demo01_01:18")) {
|
||||
// TODO order of evaluation
|
||||
s32 i = 0;
|
||||
if (mpTagProcessor->getNumLinesMaybe() > 1) {
|
||||
i = 1;
|
||||
}
|
||||
mBlurRelated.drawTextBlur(&mText, mOffsets[i], mpPane->GetAlpha());
|
||||
}
|
||||
mLyt.draw();
|
||||
}
|
||||
|
||||
SizedString<64> dLytMsgWindowDemo_c::getTextLabel() {
|
||||
return dLytMsgWindow_c::getInstance()->getLabel();
|
||||
}
|
||||
|
||||
void dLytMsgWindowDemo_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowDemo_c::isDoneOpening() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_In);
|
||||
}
|
||||
|
||||
void dLytMsgWindowDemo_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowDemo_c::isDoneClosing() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_Out);
|
||||
}
|
||||
|
||||
bool dLytMsgWindowDemo_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_get.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowGet_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindowGet_c, In);
|
||||
STATE_DEFINE(dLytMsgWindowGet_c, Visible);
|
||||
STATE_DEFINE(dLytMsgWindowGet_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "getWindow_00_in.brlan", "G_inOut_00"},
|
||||
{ "getWindow_00_out.brlan", "G_inOut_00"},
|
||||
{"getWindow_00_loop.brlan", "G_loop_00"},
|
||||
};
|
||||
|
||||
#define GET_ANIM_IN 0
|
||||
#define GET_ANIM_OUT 1
|
||||
#define GET_ANIM_LOOP 2
|
||||
|
||||
#define GET_NUM_ANIMS 3
|
||||
|
||||
static const char *sPanes[] = {
|
||||
"N_window_00", "P_light_03", "P_light_02", "N_message_00", "N_aBtn_00", "N_inOut_00",
|
||||
};
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_message_00",
|
||||
"T_messageS_00",
|
||||
};
|
||||
|
||||
static const char *sGroupName = "G_ref_00";
|
||||
|
||||
bool dLytMsgWindowGet_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("getWindow_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < GET_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnm[GET_ANIM_LOOP].setAnimEnable(true);
|
||||
mAnm[GET_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[GET_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[GET_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
mpPanes[i] = mLyt.findPane(sPanes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
mpTextboxes[i]->SetTextPositionH(0);
|
||||
mpTextboxes[i]->SetTextPositionV(0);
|
||||
}
|
||||
|
||||
mpTextboxes[1]->set0x1F6(1);
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane = &mBtn;
|
||||
mBtn.build(resAcc);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
mText.build(resAcc, dLytTextLight::NORMAL);
|
||||
mBlurRelated.build();
|
||||
|
||||
mpPanes[5]->SetVisible(true);
|
||||
mLyt.calc();
|
||||
mpPanes[5]->SetVisible(false);
|
||||
mpTagProcessor = tagProcessor;
|
||||
mOffset.x = mOffset.y = 0.0f;
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowGet_c::remove() {
|
||||
mText.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 < 1; i++) {
|
||||
mNodes[i].mpLytPane->remove();
|
||||
}
|
||||
mBtn.remove();
|
||||
for (int i = 0; i < GET_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowGet_c::initializeState_Invisible() {
|
||||
mBtn.resetToInvisble();
|
||||
}
|
||||
void dLytMsgWindowGet_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowGet_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytMsgWindowGet_c::initializeState_In() {
|
||||
mAnm[GET_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[GET_ANIM_IN].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowGet_c::executeState_In() {
|
||||
if (mAnm[GET_ANIM_IN].isEndReached()) {
|
||||
mAnm[GET_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Visible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowGet_c::finalizeState_In() {}
|
||||
|
||||
void dLytMsgWindowGet_c::initializeState_Visible() {
|
||||
nw4r::lyt::Size size = getTextBox()->GetSize();
|
||||
nw4r::lyt::Size fontSize = getTextBox()->GetFontSize();
|
||||
nw4r::math::MTX34 transform = getTextBox()->GetGlobalMtx();
|
||||
|
||||
mOffset.x = transform._03 - size.width / 2.0f;
|
||||
mOffset.y = transform._13 + size.height / 2.0f;
|
||||
}
|
||||
void dLytMsgWindowGet_c::executeState_Visible() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowGet_c::finalizeState_Visible() {}
|
||||
|
||||
void dLytMsgWindowGet_c::initializeState_Out() {
|
||||
mAnm[GET_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[GET_ANIM_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowGet_c::executeState_Out() {
|
||||
if (mAnm[GET_ANIM_OUT].isEndReached()) {
|
||||
mAnm[GET_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowGet_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytMsgWindowGet_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < GET_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
mLyt.calc();
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane->execute();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowGet_c::draw() {
|
||||
// NONMATCHING
|
||||
// The instruction patterns here are the same that EGG::StateGX::Scoped
|
||||
// generates, but there's no RAII to be found here. What's the missing
|
||||
// link that makes the compiler generate these?
|
||||
// When you fix this, fix other instances of this problem
|
||||
// by searching for 91657b77
|
||||
bool bVis[5] = {
|
||||
mpPanes[0]->IsVisible(),
|
||||
mpPanes[1]->IsVisible(),
|
||||
mpPanes[2]->IsVisible(),
|
||||
mpPanes[3]->IsVisible(),
|
||||
mpPanes[4]->IsVisible(),
|
||||
};
|
||||
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(bVis[1]);
|
||||
mpPanes[2]->SetVisible(bVis[2]);
|
||||
mpPanes[3]->SetVisible(false);
|
||||
mpPanes[4]->SetVisible(false);
|
||||
|
||||
mLyt.draw();
|
||||
mBlurRelated.drawTextBlur(&mText, mOffset, mpPanes[5]->GetAlpha());
|
||||
|
||||
mpPanes[0]->SetVisible(false);
|
||||
mpPanes[1]->SetVisible(false);
|
||||
mpPanes[2]->SetVisible(false);
|
||||
mpPanes[3]->SetVisible(bVis[3]);
|
||||
mpPanes[4]->SetVisible(bVis[4]);
|
||||
|
||||
mLyt.draw();
|
||||
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(bVis[1]);
|
||||
mpPanes[2]->SetVisible(bVis[2]);
|
||||
mpPanes[3]->SetVisible(bVis[3]);
|
||||
mpPanes[4]->SetVisible(bVis[4]);
|
||||
}
|
||||
|
||||
void dLytMsgWindowGet_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowGet_c::isDoneOpening() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_In);
|
||||
}
|
||||
|
||||
void dLytMsgWindowGet_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowGet_c::isDoneClosing() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_Out);
|
||||
}
|
||||
|
||||
bool dLytMsgWindowGet_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_link.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowLink_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindowLink_c, In);
|
||||
STATE_DEFINE(dLytMsgWindowLink_c, Wait);
|
||||
STATE_DEFINE(dLytMsgWindowLink_c, Visible);
|
||||
STATE_DEFINE(dLytMsgWindowLink_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "linkWindow_00_in.brlan", "G_inOut_00"},
|
||||
{ "linkWindow_00_out.brlan", "G_inOut_00"},
|
||||
{"linkWindow_00_position.brlan", "G_position_00"},
|
||||
{"linkWindow_00_loop.brlan", "G_loop_00"},
|
||||
};
|
||||
|
||||
#define LINK_ANIM_IN 0
|
||||
#define LINK_ANIM_OUT 1
|
||||
#define LINK_ANIM_POSITION 2
|
||||
#define LINK_ANIM_LOOP 3
|
||||
|
||||
#define LINK_NUM_ANIMS 4
|
||||
|
||||
static const char *sPanes[] = {
|
||||
"N_window_00", "N_message_00", "N_aBtn_00", "N_inOut_00", "N_position_00",
|
||||
};
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_message_00",
|
||||
"T_messageS_00",
|
||||
};
|
||||
|
||||
static const char *sGroupName = "G_ref_00";
|
||||
|
||||
bool dLytMsgWindowLink_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("linkWindow_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < LINK_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnm[LINK_ANIM_LOOP].setAnimEnable(true);
|
||||
mAnm[LINK_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[LINK_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[LINK_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
mpPanes[i] = mLyt.findPane(sPanes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
mpTextboxes[i]->SetTextPositionH(0);
|
||||
mpTextboxes[i]->SetTextPositionV(0);
|
||||
}
|
||||
|
||||
mpTextboxes[1]->set0x1F6(1);
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane = &mBtn;
|
||||
mBtn.build(resAcc);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
mText.build(resAcc, dLytTextLight::NORMAL);
|
||||
mBlurRelated.build();
|
||||
|
||||
mpPanes[3]->SetVisible(true);
|
||||
mLyt.calc();
|
||||
mpPanes[3]->SetVisible(false);
|
||||
mpTagProcessor = tagProcessor;
|
||||
|
||||
mTranslationOrig.copyFrom(mpPanes[4]->GetTranslate());
|
||||
mTranslationTo.copyFrom(mpPanes[4]->GetTranslate());
|
||||
mTranslationFrom.copyFrom(mpPanes[4]->GetTranslate());
|
||||
|
||||
mParam = 0;
|
||||
|
||||
mOffset.x = mOffset.y = 0.0f;
|
||||
|
||||
mWaitDelay = 0;
|
||||
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowLink_c::remove() {
|
||||
mText.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 < 1; i++) {
|
||||
mNodes[i].mpLytPane->remove();
|
||||
}
|
||||
mBtn.remove();
|
||||
for (int i = 0; i < LINK_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowLink_c::initializeState_Invisible() {
|
||||
mBtn.resetToInvisble();
|
||||
}
|
||||
void dLytMsgWindowLink_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowLink_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytMsgWindowLink_c::initializeState_In() {
|
||||
mAnm[LINK_ANIM_POSITION].setFrame(mParam);
|
||||
mAnm[LINK_ANIM_POSITION].setAnimEnable(true);
|
||||
mLyt.calc();
|
||||
mAnm[LINK_ANIM_POSITION].setAnimEnable(false);
|
||||
|
||||
mTranslationTo = mTranslationOrig;
|
||||
mTranslationTo.y = mpPanes[4]->GetTranslate().y;
|
||||
mTranslationFrom = mTranslationTo;
|
||||
|
||||
mAnm[LINK_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[LINK_ANIM_IN].setFrame(0.0f);
|
||||
|
||||
mpPanes[4]->SetTranslate(mTranslationFrom);
|
||||
}
|
||||
void dLytMsgWindowLink_c::executeState_In() {
|
||||
if (mTranslationFrom != mTranslationTo) {
|
||||
mVec3_c v;
|
||||
if (mAnm[LINK_ANIM_IN].isEndReached()) {
|
||||
v = mTranslationTo;
|
||||
} else {
|
||||
v.copyFrom(mpPanes[4]->GetTranslate());
|
||||
mVec3_c tmp = (mTranslationTo - v) / 2.0f;
|
||||
v += tmp;
|
||||
}
|
||||
mpPanes[4]->SetTranslate(v);
|
||||
}
|
||||
|
||||
if (mAnm[LINK_ANIM_IN].isEndReached()) {
|
||||
mAnm[LINK_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowLink_c::finalizeState_In() {}
|
||||
|
||||
void dLytMsgWindowLink_c::initializeState_Wait() {
|
||||
mWaitDelay = UnkTextThing::getInstance()->getMsgWindowWaitDelay();
|
||||
}
|
||||
void dLytMsgWindowLink_c::executeState_Wait() {
|
||||
if (--mWaitDelay > 0) {
|
||||
return;
|
||||
}
|
||||
mStateMgr.changeState(StateID_Visible);
|
||||
}
|
||||
void dLytMsgWindowLink_c::finalizeState_Wait() {}
|
||||
|
||||
void dLytMsgWindowLink_c::initializeState_Visible() {
|
||||
nw4r::lyt::Size size = getTextBox()->GetSize();
|
||||
nw4r::lyt::Size fontSize = getTextBox()->GetFontSize();
|
||||
nw4r::math::MTX34 transform = getTextBox()->GetGlobalMtx();
|
||||
|
||||
mOffset.x = transform._03 - size.width / 2;
|
||||
mOffset.y = transform._13 + size.height / 2;
|
||||
}
|
||||
void dLytMsgWindowLink_c::executeState_Visible() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowLink_c::finalizeState_Visible() {}
|
||||
|
||||
void dLytMsgWindowLink_c::initializeState_Out() {
|
||||
mTranslationFrom = mTranslationTo;
|
||||
mAnm[LINK_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[LINK_ANIM_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowLink_c::executeState_Out() {
|
||||
if (mTranslationFrom != mTranslationTo) {
|
||||
mVec3_c v;
|
||||
if (mAnm[LINK_ANIM_OUT].isEndReached()) {
|
||||
v = mTranslationFrom;
|
||||
} else {
|
||||
f32 ratio = mAnm[LINK_ANIM_OUT].getRatio();
|
||||
if (ratio > 1.0f) {
|
||||
ratio = 1.0f;
|
||||
}
|
||||
v = mTranslationTo + (mTranslationFrom - mTranslationTo) * ratio;
|
||||
}
|
||||
mpPanes[4]->SetTranslate(v);
|
||||
}
|
||||
|
||||
if (mAnm[LINK_ANIM_OUT].isEndReached()) {
|
||||
mAnm[LINK_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowLink_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytMsgWindowLink_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < LINK_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
mLyt.calc();
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane->execute();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowLink_c::draw() {
|
||||
// NONMATCHING
|
||||
// The instruction patterns here are the same that EGG::StateGX::Scoped
|
||||
// generates, but there's no RAII to be found here. What's the missing
|
||||
// link that makes the compiler generate these?
|
||||
// When you fix this, fix other instances of this problem
|
||||
// by searching for 91657b77
|
||||
bool bVis[3] = {
|
||||
mpPanes[0]->IsVisible(),
|
||||
mpPanes[1]->IsVisible(),
|
||||
mpPanes[2]->IsVisible(),
|
||||
};
|
||||
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(false);
|
||||
mpPanes[2]->SetVisible(false);
|
||||
|
||||
mLyt.draw();
|
||||
if (mWaitDelay <= 0) {
|
||||
mBlurRelated.drawTextBlur(&mText, mOffset, mpPanes[3]->GetAlpha());
|
||||
}
|
||||
|
||||
mpPanes[0]->SetVisible(false);
|
||||
mpPanes[1]->SetVisible(bVis[1]);
|
||||
mpPanes[2]->SetVisible(bVis[2]);
|
||||
|
||||
mLyt.draw();
|
||||
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(bVis[1]);
|
||||
mpPanes[2]->SetVisible(bVis[2]);
|
||||
}
|
||||
|
||||
void dLytMsgWindowLink_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mpActor = obj;
|
||||
mParam = param;
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
// Curiously enough, this file is almost an exact copy of d_lyt_msg_window_talk,
|
||||
// but the behavior of these two functions (isDoneOpening/isDoneClosing) is swapped
|
||||
bool dLytMsgWindowLink_c::isDoneOpening() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_In);
|
||||
}
|
||||
|
||||
void dLytMsgWindowLink_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowLink_c::isDoneClosing() const {
|
||||
if (*mStateMgr.getStateID() == StateID_Out || *mStateMgr.getStateID() == StateID_Wait) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowLink_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,576 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_select_btn.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_pad.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, Wait);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, On);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, Select);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, Off);
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtn_c, Wait);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtn_c, In);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtn_c, WaitSelect);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtn_c, CursorInOut);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtn_c, WaitDecide);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtn_c, WaitCancel);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtn_c, Out);
|
||||
|
||||
SelectBtnHelper::SelectBtnHelper() {
|
||||
field_0x4C = -1;
|
||||
field_0x50 = -1;
|
||||
field_0x44 = field_0x48 = 0;
|
||||
field_0x34 = field_0x3C = 0.0f;
|
||||
field_0x38 = field_0x40 = 0.0f;
|
||||
field_0x52 = 0;
|
||||
field_0x51 = 1;
|
||||
|
||||
panes[0] = 0;
|
||||
panes[1] = 0;
|
||||
panes[2] = 0;
|
||||
panes[3] = 0;
|
||||
panes[4] = 0;
|
||||
panes[5] = 0;
|
||||
panes[6] = 0;
|
||||
panes[7] = 0;
|
||||
panes[8] = 0;
|
||||
}
|
||||
SelectBtnHelper::~SelectBtnHelper() {}
|
||||
|
||||
void dLytMsgWindowSelectBtnParts_c::initializeState_Wait() {}
|
||||
void dLytMsgWindowSelectBtnParts_c::executeState_Wait() {
|
||||
if (field_0x48 != 0) {
|
||||
for (int i = 0; i <= 1; i++) {
|
||||
mpAnms[i]->setForwardOnce();
|
||||
mpAnms[i]->setFrame(0.0f);
|
||||
mpAnms[i]->setAnimEnable(true);
|
||||
}
|
||||
mStateMgr.changeState(StateID_On);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtnParts_c::finalizeState_Wait() {}
|
||||
|
||||
void dLytMsgWindowSelectBtnParts_c::initializeState_On() {}
|
||||
void dLytMsgWindowSelectBtnParts_c::executeState_On() {
|
||||
if (mpAnms[0]->isEndReached() && mpAnms[1]->isEndReached()) {
|
||||
mpAnms[0]->setAnimEnable(false);
|
||||
mpAnms[1]->setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Select);
|
||||
}
|
||||
for (int i = 0; i <= 1; i++) {
|
||||
if (mpAnms[i]->isEnabled()) {
|
||||
mpAnms[i]->play();
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtnParts_c::finalizeState_On() {}
|
||||
|
||||
void dLytMsgWindowSelectBtnParts_c::initializeState_Select() {}
|
||||
void dLytMsgWindowSelectBtnParts_c::executeState_Select() {
|
||||
if (field_0x48 == 0) {
|
||||
for (int i = 0; i <= 1; i++) {
|
||||
mpAnms[i]->setBackwardsOnce();
|
||||
mpAnms[i]->setToStart();
|
||||
mpAnms[i]->setAnimEnable(true);
|
||||
}
|
||||
mStateMgr.changeState(StateID_Off);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtnParts_c::finalizeState_Select() {}
|
||||
|
||||
void dLytMsgWindowSelectBtnParts_c::initializeState_Off() {}
|
||||
void dLytMsgWindowSelectBtnParts_c::executeState_Off() {
|
||||
if (mpAnms[0]->isStop2() && mpAnms[1]->isStop2()) {
|
||||
mpAnms[0]->setAnimEnable(false);
|
||||
mpAnms[1]->setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
}
|
||||
for (int i = 0; i <= 1; i++) {
|
||||
if (mpAnms[i]->isEnabled()) {
|
||||
mpAnms[i]->play();
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtnParts_c::finalizeState_Off() {}
|
||||
|
||||
void dLytMsgWindowSelectBtnParts_c::init() {
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
field_0x48 = 0;
|
||||
field_0x50 = 0;
|
||||
field_0x4C = 3;
|
||||
}
|
||||
|
||||
void dLytMsgWindowSelectBtnParts_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
mpAnms[2]->play();
|
||||
}
|
||||
|
||||
#define SELECT_BTN_ANIM_IN 0
|
||||
#define SELECT_BTN_ANIM_LOOP_REMOCON 1
|
||||
#define SELECT_BTN_ANIM_INOUT_CURSOR 2
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN 3
|
||||
#define SELECT_BTN_ANIM_ITEM_ARROW_0 4
|
||||
#define SELECT_BTN_ANIM_ITEM_ARROW_1 5
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_LOOP_0 6
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_LOOP_1 7
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_LOOP_2 8
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_LOOP_3 9
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_0 10
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_1 11
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_2 12
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_3 13
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_B_0 14
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_B_1 15
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_B_2 16
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_B_3 17
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_A_0 18
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_A_1 19
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_A_2 20
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_A_3 21
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_DECIDE_0 22
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_DECIDE_1 23
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_DECIDE_2 24
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_DECIDE_3 25
|
||||
#define SELECT_BTN_ANIM_OUT 26
|
||||
|
||||
#define SELECT_BTN_NUM_ANIMS 27
|
||||
#define SELECT_BTN_NUM_BTNS 4
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_LOOP_OFFSET SELECT_BTN_ANIM_MESSAGE_BTN_LOOP_0
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_OFFSET SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_0
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_B_OFFSET SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_B_0
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_A_OFFSET SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_A_0
|
||||
#define SELECT_BTN_ANIM_MESSAGE_BTN_DECIDE_OFFSET SELECT_BTN_ANIM_MESSAGE_BTN_DECIDE_0
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "messageBtn_00_in.brlan", "G_inOut_00"},
|
||||
{"messageBtn_00_loopRemocon.brlan", "G_loopRemocon_00"},
|
||||
{"messageBtn_00_inOutCursor.brlan", "G_inOutAlpha_00"},
|
||||
{ "messageBtn_00_messageBtn.brlan", "G_messageBtn_00"},
|
||||
{ "messageBtn_00_itemArrow.brlan", "G_itemArrow_00"},
|
||||
{ "messageBtn_00_itemArrow.brlan", "G_itemArrow_01"},
|
||||
{ "messageBtn_00_loop.brlan", "G_btn_00"},
|
||||
{ "messageBtn_00_loop.brlan", "G_btn_01"},
|
||||
{ "messageBtn_00_loop.brlan", "G_btn_02"},
|
||||
{ "messageBtn_00_loop.brlan", "G_btn_03"},
|
||||
{ "messageBtn_00_cancel.brlan", "G_cancel_00"},
|
||||
{ "messageBtn_00_cancel.brlan", "G_cancel_01"},
|
||||
{ "messageBtn_00_cancel.brlan", "G_cancel_02"},
|
||||
{ "messageBtn_00_cancel.brlan", "G_cancel_03"},
|
||||
{ "messageBtn_00_onOffB.brlan", "G_onOffB_00"},
|
||||
{ "messageBtn_00_onOffB.brlan", "G_onOffB_01"},
|
||||
{ "messageBtn_00_onOffB.brlan", "G_onOffB_02"},
|
||||
{ "messageBtn_00_onOffB.brlan", "G_onOffB_03"},
|
||||
{ "messageBtn_00_onOffA.brlan", "G_btn_00"},
|
||||
{ "messageBtn_00_onOffA.brlan", "G_btn_01"},
|
||||
{ "messageBtn_00_onOffA.brlan", "G_btn_02"},
|
||||
{ "messageBtn_00_onOffA.brlan", "G_btn_03"},
|
||||
{ "messageBtn_00_decide.brlan", "G_btn_00"},
|
||||
{ "messageBtn_00_decide.brlan", "G_btn_01"},
|
||||
{ "messageBtn_00_decide.brlan", "G_btn_02"},
|
||||
{ "messageBtn_00_decide.brlan", "G_btn_03"},
|
||||
{ "messageBtn_00_out.brlan", "G_inOut_00"}
|
||||
};
|
||||
|
||||
static const char *sSelectTextBoxes[SELECT_BTN_NUM_BTNS][2] = {
|
||||
{"T_selectS_00", "T_select_00"},
|
||||
{"T_selectS_01", "T_select_01"},
|
||||
{"T_selectS_02", "T_select_02"},
|
||||
{"T_selectS_03", "T_select_03"},
|
||||
};
|
||||
|
||||
static const char *sDecideTextBoxes[2] = {
|
||||
"T_decide_00",
|
||||
"T_decideS_00",
|
||||
};
|
||||
|
||||
static const char *sWindowName = "W_bgP_01";
|
||||
|
||||
static const char *sBoundings[SELECT_BTN_NUM_BTNS] = {
|
||||
"B_btn_00",
|
||||
"B_btn_01",
|
||||
"B_btn_02",
|
||||
"B_btn_03",
|
||||
};
|
||||
|
||||
static const char *sSelectPanes[7] = {
|
||||
"N_itemArrow_00", "N_arrowHand_00", "N_aBtn_00", "N_messageBtn_00",
|
||||
"N_messageBtn_01", "N_messageBtn_02", "N_messageBtn_03",
|
||||
};
|
||||
|
||||
void dLytMsgWindowSelectBtn_c::initializeState_Wait() {
|
||||
field_0x9A4 = 0;
|
||||
field_0x9B8 = -1;
|
||||
field_0x9BC = -1;
|
||||
|
||||
field_0x9CC = 0xFF;
|
||||
field_0x9C0 = 10;
|
||||
field_0x9CD = 1;
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::executeState_Wait() {}
|
||||
void dLytMsgWindowSelectBtn_c::finalizeState_Wait() {}
|
||||
|
||||
void dLytMsgWindowSelectBtn_c::initializeState_In() {
|
||||
field_0x9A4 = 1;
|
||||
field_0x9B4 = -1;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mLyt.fn_800AB9A0(mpDecideTextBoxes[i], 1);
|
||||
}
|
||||
|
||||
mpWindow->UpdateSize(mpSizeBox, 32.0f);
|
||||
|
||||
for (int i = SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_0; i <= SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_3; i++) {
|
||||
if (field_0x9BC == i - SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_0) {
|
||||
mAnm[i].setFrame(1.0f);
|
||||
} else {
|
||||
mAnm[i].setFrame(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
mBtnHelper.field_0x50 = -1;
|
||||
mBtnHelper.field_0x51 = 1;
|
||||
// ??????
|
||||
f32 v = mBtnHelper.fn_8011D690(mBtnHelper.field_0x50);
|
||||
|
||||
mLyt.findPane("N_allBtn_00")->SetVisible(true);
|
||||
mLyt.findPane("N_arrowIn_00")->SetVisible(true);
|
||||
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setForwardOnce();
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setToStart();
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setAnimEnable(true);
|
||||
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_0].setAnimEnable(true);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_0].setFrame(0.0f);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_1].setAnimEnable(true);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_1].setFrame(0.0f);
|
||||
|
||||
for (int i = 0; i < SELECT_BTN_NUM_BTNS; i++) {
|
||||
mParts[i].init();
|
||||
mAnm[i + SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_A_OFFSET].setAnimEnable(true);
|
||||
mAnm[i + SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_A_OFFSET].setFrame(0.0f);
|
||||
mAnm[i + SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_B_OFFSET].setAnimEnable(true);
|
||||
mAnm[i + SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_B_OFFSET].setFrame(0.0f);
|
||||
}
|
||||
|
||||
mLyt.calc();
|
||||
|
||||
for (int i = 0; i < SELECT_BTN_NUM_BTNS; i++) {
|
||||
mAnm[i + SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_A_OFFSET].setAnimEnable(false);
|
||||
mAnm[i + SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_B_OFFSET].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setAnimEnable(false);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_0].setAnimEnable(false);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_1].setAnimEnable(false);
|
||||
|
||||
mLyt.findPane("N_allBtn_00")->SetVisible(false);
|
||||
mLyt.findPane("N_arrowIn_00")->SetVisible(false);
|
||||
|
||||
mAnm[SELECT_BTN_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[SELECT_BTN_ANIM_IN].setForwardOnce();
|
||||
|
||||
if (field_0x9D1 != 0) {
|
||||
mAnm[SELECT_BTN_ANIM_IN].setToEnd();
|
||||
field_0x9D1 = false;
|
||||
} else {
|
||||
if (field_0x9CF != 0) {
|
||||
if (field_0x9A0 == 1) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_CHOICE_START);
|
||||
} else if (field_0x9A0 == 2) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_CHOICE_START_GAMEOVER);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TALK_CHOICE_START);
|
||||
}
|
||||
}
|
||||
mAnm[SELECT_BTN_ANIM_IN].setFrame(0.0f);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::executeState_In() {
|
||||
mAnm[SELECT_BTN_ANIM_IN].play();
|
||||
if (mAnm[SELECT_BTN_ANIM_IN].isEndReached()) {
|
||||
mStateMgr.changeState(StateID_WaitSelect);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::finalizeState_In() {
|
||||
mAnm[SELECT_BTN_ANIM_IN].setAnimEnable(false);
|
||||
}
|
||||
|
||||
void dLytMsgWindowSelectBtn_c::initializeState_WaitSelect() {
|
||||
if (field_0x9D0 == 0) {
|
||||
field_0x9D0 = true;
|
||||
fn_8035E860(BGM_MGR);
|
||||
}
|
||||
|
||||
mBtnHelper.fn_8011C970();
|
||||
mBtnHelper.field_0x48 = fn_8011FE50();
|
||||
}
|
||||
|
||||
void dLytMsgWindowSelectBtn_c::executeState_WaitSelect() {
|
||||
u8 v = mBtnHelper.fn_8011CAC0();
|
||||
if (v == 1) {
|
||||
mStateMgr.changeState(StateID_CursorInOut);
|
||||
return;
|
||||
} else if (v == 2) {
|
||||
f32 f = mBtnHelper.fn_8011D690(mBtnHelper.field_0x50);
|
||||
// TODO
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mLyt.fn_800AB9A0(mpDecideTextBoxes[i], 0);
|
||||
}
|
||||
|
||||
mpWindow->UpdateSize(mpSizeBox, 32.0f);
|
||||
} else if (v == 3) {
|
||||
field_0x9D1 = 1;
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_POINTER_RESET);
|
||||
mStateMgr.changeState(StateID_In);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mBtnHelper.field_0x50 >= 0 && dPad::checkButtonAPressed()) {
|
||||
field_0x9D0 = 0;
|
||||
field_0x9B0 = mBtnHelper.field_0x50;
|
||||
mStateMgr.changeState(StateID_WaitDecide);
|
||||
// TODO
|
||||
if (mpTagProcessor != nullptr) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TALK_CURSOR_CANCEL);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TALK_CURSOR_OK);
|
||||
}
|
||||
fn_8035E880(BGM_MGR);
|
||||
} else if (dPad::checkButtonBPressed()) {
|
||||
f32 f = mBtnHelper.fn_8011D690(field_0x9BC);
|
||||
// TODO
|
||||
field_0x9CC = field_0x9BC;
|
||||
field_0x9D0 = 0;
|
||||
mStateMgr.changeState(StateID_WaitCancel);
|
||||
// TODO
|
||||
if (mpTagProcessor != nullptr) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TALK_CURSOR_CANCEL);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TALK_CURSOR_OK);
|
||||
}
|
||||
fn_8035E880(BGM_MGR);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::finalizeState_WaitSelect() {}
|
||||
|
||||
void dLytMsgWindowSelectBtn_c::initializeState_CursorInOut() {}
|
||||
void dLytMsgWindowSelectBtn_c::executeState_CursorInOut() {
|
||||
if (mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].isStop2()) {
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_WaitSelect);
|
||||
}
|
||||
if (mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].isEnabled()) {
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].play();
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::finalizeState_CursorInOut() {}
|
||||
|
||||
void dLytMsgWindowSelectBtn_c::initializeState_WaitDecide() {
|
||||
s32 decideAnm = field_0x9B0 + SELECT_BTN_ANIM_MESSAGE_BTN_DECIDE_OFFSET;
|
||||
mAnm[decideAnm].setAnimEnable(true);
|
||||
mAnm[decideAnm].setFrame(0.0f);
|
||||
mAnm[decideAnm].setForwardOnce();
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::executeState_WaitDecide() {
|
||||
s32 decideAnm = field_0x9B0 + SELECT_BTN_ANIM_MESSAGE_BTN_DECIDE_OFFSET;
|
||||
mAnm[decideAnm].play();
|
||||
if (mAnm[decideAnm].isStop2()) {
|
||||
mAnm[decideAnm].setAnimEnable(false);
|
||||
field_0x9B4 = field_0x9B0;
|
||||
if (field_0x99C == 1) {
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
} else {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::finalizeState_WaitDecide() {}
|
||||
|
||||
void dLytMsgWindowSelectBtn_c::initializeState_WaitCancel() {
|
||||
field_0x9C0 = 10;
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setForwardOnce();
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setToEnd2();
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setAnimEnable(true);
|
||||
mLyt.calc();
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setAnimEnable(false);
|
||||
mpSelectPanes[0]->SetAlpha(0xFF);
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::executeState_WaitCancel() {
|
||||
if (--field_0x9C0 <= 0) {
|
||||
field_0x9B0 = field_0x9CC;
|
||||
mStateMgr.changeState(StateID_WaitDecide);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::finalizeState_WaitCancel() {}
|
||||
|
||||
void dLytMsgWindowSelectBtn_c::initializeState_Out() {
|
||||
mAnm[SELECT_BTN_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[SELECT_BTN_ANIM_OUT].setFrame(0.0f);
|
||||
mAnm[SELECT_BTN_ANIM_OUT].setForwardOnce();
|
||||
field_0x9C8 = 0;
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::executeState_Out() {
|
||||
switch (field_0x9C8) {
|
||||
case 0:
|
||||
mAnm[SELECT_BTN_ANIM_OUT].play();
|
||||
if (mAnm[SELECT_BTN_ANIM_OUT].isStop2()) {
|
||||
field_0x9A4 = 0;
|
||||
field_0x9C8 = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
mAnm[SELECT_BTN_ANIM_OUT].setAnimEnable(false);
|
||||
field_0x9B4 = field_0x9B0;
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSelectBtn_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytMsgWindowSelectBtn_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("messageBtn_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < SELECT_BTN_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
for (int i = SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_0; i <= SELECT_BTN_ANIM_MESSAGE_BTN_CANCEL_3; i++) {
|
||||
mAnm[i].setAnimEnable(true);
|
||||
}
|
||||
|
||||
mAnm[SELECT_BTN_ANIM_LOOP_REMOCON].setAnimEnable(true);
|
||||
|
||||
for (int i = 0; i < SELECT_BTN_NUM_BTNS; i++) {
|
||||
mParts[i].mpAnms[0] = &mAnm[SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_A_OFFSET + i];
|
||||
mParts[i].mpAnms[1] = &mAnm[SELECT_BTN_ANIM_MESSAGE_BTN_ONOFF_B_OFFSET + i];
|
||||
mParts[i].mpAnms[2] = &mAnm[SELECT_BTN_ANIM_MESSAGE_BTN_LOOP_OFFSET + i];
|
||||
mParts[i].init();
|
||||
mAnm[SELECT_BTN_ANIM_MESSAGE_BTN_LOOP_OFFSET + i].setAnimEnable(true);
|
||||
}
|
||||
|
||||
for (int i = 0; i < SELECT_BTN_NUM_BTNS; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
mpSelectTextBoxes[i][j] = mLyt.getTextBox(sSelectTextBoxes[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpDecideTextBoxes[i] = mLyt.getTextBox(sDecideTextBoxes[i]);
|
||||
}
|
||||
|
||||
mpWindow = mLyt.getWindow(sWindowName);
|
||||
mpSizeBox = mLyt.getSizeBoxInWindow(sWindowName);
|
||||
|
||||
mpWindow->UpdateSize(mpSizeBox, 32.0f);
|
||||
|
||||
for (int i = 0; i < SELECT_BTN_NUM_BTNS; i++) {
|
||||
mpBoundings[i] = mLyt.findPane(sBoundings[i]);
|
||||
}
|
||||
|
||||
mpTagProcessor = nullptr;
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
mpSelectPanes[i] = mLyt.findPane(sSelectPanes[i]);
|
||||
}
|
||||
|
||||
mBtnHelper.panes[0] = mpSelectPanes[0];
|
||||
mBtnHelper.panes[1] = mpSelectPanes[3];
|
||||
mBtnHelper.panes[2] = mpSelectPanes[4];
|
||||
mBtnHelper.panes[3] = mpSelectPanes[5];
|
||||
mBtnHelper.panes[4] = mpSelectPanes[6];
|
||||
mBtnHelper.panes[5] = mpBoundings[0];
|
||||
mBtnHelper.panes[6] = mpBoundings[1];
|
||||
mBtnHelper.panes[7] = mpBoundings[2];
|
||||
mBtnHelper.panes[8] = mpBoundings[3];
|
||||
|
||||
field_0x9C4 = nullptr;
|
||||
|
||||
mLyt.findPane("N_arrowIn_00")->SetVisible(true);
|
||||
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setForwardOnce();
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setToStart();
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setAnimEnable(true);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_0].setAnimEnable(true);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_0].setFrame(0.0f);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_1].setAnimEnable(true);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_1].setFrame(0.0f);
|
||||
|
||||
mLyt.calc();
|
||||
|
||||
mAnm[SELECT_BTN_ANIM_INOUT_CURSOR].setAnimEnable(false);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_0].setAnimEnable(false);
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_1].setAnimEnable(false);
|
||||
|
||||
mLyt.findPane("N_arrowIn_00")->SetVisible(false);
|
||||
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
|
||||
field_0x9A8 = -1;
|
||||
field_0x9B0 = -1;
|
||||
|
||||
field_0x9D0 = 0;
|
||||
field_0x9D1 = 0;
|
||||
field_0x99C = 0;
|
||||
field_0x9A0 = 0;
|
||||
field_0x9CE = 0;
|
||||
field_0x9CF = 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" void fn_801942F0(int, int);
|
||||
|
||||
bool dLytMsgWindowSelectBtn_c::remove() {
|
||||
for (int i = 0; i < SELECT_BTN_NUM_ANIMS; i++) {
|
||||
mAnm[i].unbind();
|
||||
mAnm[i].remove();
|
||||
}
|
||||
|
||||
if (mBtnHelper.field_0x52 != 0) {
|
||||
mBtnHelper.field_0x52 = 0;
|
||||
fn_801942F0(0, 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowSelectBtn_c::execute() {
|
||||
if (*mStateMgr.getStateID() != StateID_Wait) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < SELECT_BTN_NUM_BTNS; i++) {
|
||||
mParts[i].execute();
|
||||
}
|
||||
|
||||
if (mAnm[SELECT_BTN_ANIM_ITEM_ARROW_0].isEnabled()) {
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_0].play();
|
||||
}
|
||||
|
||||
if (mAnm[SELECT_BTN_ANIM_ITEM_ARROW_1].isEnabled()) {
|
||||
mAnm[SELECT_BTN_ANIM_ITEM_ARROW_1].play();
|
||||
}
|
||||
|
||||
if (mAnm[SELECT_BTN_ANIM_LOOP_REMOCON].isEnabled()) {
|
||||
mAnm[SELECT_BTN_ANIM_LOOP_REMOCON].play();
|
||||
}
|
||||
|
||||
mLyt.calc();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowSelectBtn_c::draw() {
|
||||
if (field_0x9A4 != 0) {
|
||||
mLyt.addToDrawList();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_stone.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowStone_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindowStone_c, In);
|
||||
STATE_DEFINE(dLytMsgWindowStone_c, Visible);
|
||||
STATE_DEFINE(dLytMsgWindowStone_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "sekibanWindow_00_in.brlan", "G_inOut_00"},
|
||||
{"sekibanWindow_00_loop.brlan", "G_loop_00"},
|
||||
{ "sekibanWindow_00_out.brlan", "G_inOut_00"},
|
||||
};
|
||||
|
||||
#define SEKIBAN_ANIM_IN 0
|
||||
#define SEKIBAN_ANIM_LOOP 1
|
||||
#define SEKIBAN_ANIM_OUT 2
|
||||
|
||||
#define SEKIBAN_NUM_ANIMS 3
|
||||
|
||||
static const char *sPanes[] = {
|
||||
"N_aBtn_00",
|
||||
"N_inOut_00",
|
||||
};
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_message_00",
|
||||
"T_messageS_00",
|
||||
"T_messageS_01",
|
||||
};
|
||||
|
||||
static const char *sGroupName = "G_ref_00";
|
||||
|
||||
bool dLytMsgWindowStone_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("sekibanWindow_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < SEKIBAN_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnm[SEKIBAN_ANIM_LOOP].setAnimEnable(true);
|
||||
mAnm[SEKIBAN_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[SEKIBAN_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[SEKIBAN_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpPanes[i] = mLyt.findPane(sPanes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
mpTextboxes[i]->SetTextPositionH(0);
|
||||
mpTextboxes[i]->SetTextPositionV(0);
|
||||
}
|
||||
|
||||
mpTextboxes[1]->set0x1F6(1);
|
||||
mpTextboxes[2]->set0x1F6(1);
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane = &mBtn;
|
||||
mBtn.build(resAcc);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
mpPanes[1]->SetVisible(true);
|
||||
mLyt.calc();
|
||||
mpPanes[1]->SetVisible(false);
|
||||
mpTagProcessor = tagProcessor;
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowStone_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 < 1; i++) {
|
||||
mNodes[i].mpLytPane->remove();
|
||||
}
|
||||
mBtn.remove();
|
||||
for (int i = 0; i < SEKIBAN_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowStone_c::initializeState_Invisible() {
|
||||
mBtn.resetToInvisble();
|
||||
}
|
||||
void dLytMsgWindowStone_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowStone_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytMsgWindowStone_c::initializeState_In() {
|
||||
mAnm[SEKIBAN_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[SEKIBAN_ANIM_IN].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowStone_c::executeState_In() {
|
||||
if (mAnm[SEKIBAN_ANIM_IN].isEndReached()) {
|
||||
mAnm[SEKIBAN_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Visible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowStone_c::finalizeState_In() {}
|
||||
|
||||
void dLytMsgWindowStone_c::initializeState_Visible() {}
|
||||
void dLytMsgWindowStone_c::executeState_Visible() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowStone_c::finalizeState_Visible() {}
|
||||
|
||||
void dLytMsgWindowStone_c::initializeState_Out() {
|
||||
mAnm[SEKIBAN_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[SEKIBAN_ANIM_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowStone_c::executeState_Out() {
|
||||
if (mAnm[SEKIBAN_ANIM_OUT].isEndReached()) {
|
||||
mAnm[SEKIBAN_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowStone_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytMsgWindowStone_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < SEKIBAN_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
mLyt.calc();
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane->execute();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowStone_c::draw() {
|
||||
mLyt.draw();
|
||||
}
|
||||
|
||||
void dLytMsgWindowStone_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowStone_c::isDoneOpening() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_In);
|
||||
}
|
||||
|
||||
void dLytMsgWindowStone_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowStone_c::isDoneClosing() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_Out);
|
||||
}
|
||||
|
||||
bool dLytMsgWindowStone_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[2]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
mpTextboxes[2]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_sword.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "nw4r/lyt/lyt_types.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowSword_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindowSword_c, In);
|
||||
STATE_DEFINE(dLytMsgWindowSword_c, Wait);
|
||||
STATE_DEFINE(dLytMsgWindowSword_c, Visible);
|
||||
STATE_DEFINE(dLytMsgWindowSword_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "messageWindow_01_in.brlan", "G_inOut_00"},
|
||||
{ "messageWindow_01_out.brlan", "G_inOut_00"},
|
||||
{ "messageWindow_01_loop.brlan", "G_loop_00"},
|
||||
{ "messageWindow_01_color.brlan", "G_color_00"},
|
||||
{"messageWindow_01_position.brlan", "G_position_00"},
|
||||
};
|
||||
|
||||
#define SWORD_ANIM_IN 0
|
||||
#define SWORD_ANIM_OUT 1
|
||||
#define SWORD_ANIM_LOOP 2
|
||||
#define SWORD_ANIM_COLOR 3
|
||||
#define SWORD_ANIM_POSITION 4
|
||||
|
||||
#define SWORD_NUM_ANIMS 5
|
||||
|
||||
#define TRANSLATE_ORIGINAL 0
|
||||
#define TRANSLATE_TO 1
|
||||
#define TRANSLATE_FROM 2
|
||||
|
||||
static const char *sPanes[] = {
|
||||
"N_aBtn_00",
|
||||
"N_inOut_00",
|
||||
"N_position_00",
|
||||
};
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_message_00",
|
||||
"T_messageS_00",
|
||||
};
|
||||
|
||||
static const char *sGroupName = "G_ref_00";
|
||||
|
||||
bool dLytMsgWindowSword_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("messageWindow_01.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < SWORD_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnm[SWORD_ANIM_LOOP].setAnimEnable(true);
|
||||
mAnm[SWORD_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[SWORD_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[SWORD_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mpPanes[i] = mLyt.findPane(sPanes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
mpTextboxes[i]->SetTextPositionH(0);
|
||||
mpTextboxes[i]->SetTextPositionV(0);
|
||||
}
|
||||
|
||||
mpTextboxes[1]->set0x1F6(1);
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane = &mBtn;
|
||||
mBtn.build(resAcc);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
mSwordText.build(resAcc, mSwordType);
|
||||
|
||||
for (int i = 0; i < 1023; i++) {
|
||||
mCharacterData[i].reset();
|
||||
mTextBuf[i] = L'\0';
|
||||
}
|
||||
|
||||
mAnm[SWORD_ANIM_COLOR].setAnimEnable(true);
|
||||
mAnm[SWORD_ANIM_COLOR].setFrame(mSwordType);
|
||||
|
||||
mpPanes[1]->SetVisible(true);
|
||||
mLyt.calc();
|
||||
mpPanes[1]->SetVisible(false);
|
||||
|
||||
mAnm[SWORD_ANIM_COLOR].setAnimEnable(false);
|
||||
|
||||
mpTagProcessor = tagProcessor;
|
||||
|
||||
mTranslationOrig.copyFrom(mpPanes[2]->GetTranslate());
|
||||
mTranslationTo.copyFrom(mpPanes[2]->GetTranslate());
|
||||
mTranslationFrom.copyFrom(mpPanes[2]->GetTranslate());
|
||||
|
||||
mParam = 0;
|
||||
mOffset.x = mOffset.y = 0.0f;
|
||||
mWaitDelay = 0;
|
||||
|
||||
mHasDrawnThisTick = false;
|
||||
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowSword_c::remove() {
|
||||
mSwordText.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 < 1; i++) {
|
||||
mNodes[i].mpLytPane->remove();
|
||||
}
|
||||
mBtn.remove();
|
||||
for (int i = 0; i < SWORD_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowSword_c::initializeState_Invisible() {
|
||||
mBtn.resetToInvisble();
|
||||
}
|
||||
void dLytMsgWindowSword_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSword_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytMsgWindowSword_c::initializeState_In() {
|
||||
mAnm[SWORD_ANIM_POSITION].setFrame(mParam);
|
||||
mAnm[SWORD_ANIM_POSITION].setAnimEnable(true);
|
||||
mLyt.calc();
|
||||
mAnm[SWORD_ANIM_POSITION].setAnimEnable(false);
|
||||
|
||||
mTranslationTo = mTranslationOrig;
|
||||
mTranslationTo.y = mpPanes[2]->GetTranslate().y;
|
||||
mTranslationFrom = mTranslationTo;
|
||||
|
||||
mAnm[SWORD_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[SWORD_ANIM_IN].setFrame(0.0f);
|
||||
|
||||
mpPanes[2]->SetTranslate(mTranslationFrom);
|
||||
}
|
||||
void dLytMsgWindowSword_c::executeState_In() {
|
||||
if (mTranslationFrom != mTranslationTo) {
|
||||
mVec3_c v;
|
||||
if (mAnm[SWORD_ANIM_IN].isEndReached()) {
|
||||
v = mTranslationTo;
|
||||
} else {
|
||||
f32 ratio = mAnm[SWORD_ANIM_IN].getRatio();
|
||||
if (ratio > 1.0f) {
|
||||
ratio = 1.0f;
|
||||
}
|
||||
v = mTranslationFrom + (mTranslationTo - mTranslationFrom) * ratio;
|
||||
}
|
||||
mpPanes[2]->SetTranslate(v);
|
||||
}
|
||||
|
||||
if (mAnm[SWORD_ANIM_IN].isEndReached()) {
|
||||
mAnm[SWORD_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSword_c::finalizeState_In() {}
|
||||
|
||||
void dLytMsgWindowSword_c::initializeState_Wait() {
|
||||
mWaitDelay = UnkTextThing::getInstance()->getMsgWindowWaitDelay();
|
||||
}
|
||||
void dLytMsgWindowSword_c::executeState_Wait() {
|
||||
if (--mWaitDelay > 0) {
|
||||
return;
|
||||
}
|
||||
mStateMgr.changeState(StateID_Visible);
|
||||
}
|
||||
void dLytMsgWindowSword_c::finalizeState_Wait() {}
|
||||
|
||||
void dLytMsgWindowSword_c::initializeState_Visible() {
|
||||
nw4r::lyt::Size size = getTextBox()->GetSize();
|
||||
nw4r::lyt::Size fontSize = getTextBox()->GetFontSize(); // unused
|
||||
nw4r::math::MTX34 transform = getTextBox()->GetGlobalMtx();
|
||||
|
||||
mOffset.x = transform._03 - size.width / 2;
|
||||
mOffset.y = transform._13 + size.height / 2;
|
||||
|
||||
getTextBox()->GetTextDrawRect(); // unused
|
||||
}
|
||||
void dLytMsgWindowSword_c::executeState_Visible() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSword_c::finalizeState_Visible() {}
|
||||
|
||||
void dLytMsgWindowSword_c::initializeState_Out() {
|
||||
mTranslationFrom = mTranslationTo;
|
||||
mAnm[SWORD_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[SWORD_ANIM_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowSword_c::executeState_Out() {
|
||||
if (mTranslationFrom != mTranslationTo) {
|
||||
mVec3_c v;
|
||||
if (mAnm[SWORD_ANIM_OUT].isEndReached()) {
|
||||
v = mTranslationFrom;
|
||||
} else {
|
||||
v.copyFrom(mpPanes[2]->GetTranslate());
|
||||
mVec3_c tmp = (mTranslationTo - v) / 2.0f;
|
||||
v += tmp;
|
||||
}
|
||||
mpPanes[2]->SetTranslate(v);
|
||||
}
|
||||
|
||||
if (mAnm[SWORD_ANIM_OUT].isEndReached()) {
|
||||
mAnm[SWORD_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowSword_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytMsgWindowSword_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
|
||||
for (int i = 0; i < SWORD_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
|
||||
mLyt.calc();
|
||||
mNodes[0].mpLytPane->execute();
|
||||
mHasDrawnThisTick = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowSword_c::draw() {
|
||||
mLyt.draw();
|
||||
|
||||
for (int i = 0; i < 1023; i++) {
|
||||
if (mCharacterData[i].displayTimerMaybe >= 0) {
|
||||
if (!mHasDrawnThisTick) {
|
||||
mCharacterData[i].displayTimerMaybe += 1;
|
||||
}
|
||||
mVec3_c v(
|
||||
(mOffset.x + mCharacterData[i].posX) / get_805751A4(), mOffset.y + mCharacterData[i].posY, 0.0f
|
||||
);
|
||||
|
||||
wchar_t str[2];
|
||||
str[0] = mCharacterData[i].character;
|
||||
str[1] = 0;
|
||||
|
||||
mSwordText.draw(str, mCharacterData[i].displayTimerMaybe, v, mCharacterData[i].field_0x08);
|
||||
if (mCharacterData[i].displayTimerMaybe >= mSwordText.getAnimDuration()) {
|
||||
mCharacterData[i].displayTimerMaybe = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mHasDrawnThisTick) {
|
||||
mHasDrawnThisTick = true;
|
||||
}
|
||||
}
|
||||
|
||||
void dLytMsgWindowSword_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mpActor = obj;
|
||||
mParam = param;
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowSword_c::isDoneOpening() const {
|
||||
if (*mStateMgr.getStateID() == StateID_In || *mStateMgr.getStateID() == StateID_Wait) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowSword_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowSword_c::isDoneClosing() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_Out);
|
||||
}
|
||||
|
||||
bool dLytMsgWindowSword_c::setText(const wchar_t *text) {
|
||||
int foundIdx = 1023;
|
||||
for (int i = 0; i < 1023; i++) {
|
||||
if (mCharacterData[i].displayTimerMaybe >= 0 && foundIdx > mCharacterData[i].field_0x0C) {
|
||||
foundIdx = mCharacterData[i].field_0x0C;
|
||||
}
|
||||
}
|
||||
|
||||
// How is text bounds-checked here????
|
||||
for (int i = 0; i < 1023; i++) {
|
||||
if (i < foundIdx) {
|
||||
mTextBuf[i] = text[i];
|
||||
} else {
|
||||
mTextBuf[i] = L' ';
|
||||
}
|
||||
}
|
||||
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(mTextBuf, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(mTextBuf, mpTagProcessor, 0);
|
||||
return foundIdx == 1023;
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_talk.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowTalk_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindowTalk_c, In);
|
||||
STATE_DEFINE(dLytMsgWindowTalk_c, Wait);
|
||||
STATE_DEFINE(dLytMsgWindowTalk_c, Visible);
|
||||
STATE_DEFINE(dLytMsgWindowTalk_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "messageWindow_00_in.brlan", "G_inOut_00"},
|
||||
{ "messageWindow_00_out.brlan", "G_inOut_00"},
|
||||
{"messageWindow_00_position.brlan", "G_position_00"},
|
||||
{ "messageWindow_00_loop.brlan", "G_loop_00"},
|
||||
};
|
||||
|
||||
#define TALK_ANIM_IN 0
|
||||
#define TALK_ANIM_OUT 1
|
||||
#define TALK_ANIM_POSITION 2
|
||||
#define TALK_ANIM_LOOP 3
|
||||
|
||||
#define TALK_NUM_ANIMS 4
|
||||
|
||||
static const char *sPanes[] = {
|
||||
"N_window_00", "N_message_00", "N_aBtn_00", "N_inOut_00", "N_position_00",
|
||||
};
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_message_00",
|
||||
"T_messageS_00",
|
||||
};
|
||||
|
||||
static const char *sGroupName = "G_ref_00";
|
||||
|
||||
bool dLytMsgWindowTalk_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("messageWindow_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < TALK_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnm[TALK_ANIM_LOOP].setAnimEnable(true);
|
||||
mAnm[TALK_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[TALK_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[TALK_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
mpPanes[i] = mLyt.findPane(sPanes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
mpTextboxes[i]->SetTextPositionH(0);
|
||||
mpTextboxes[i]->SetTextPositionV(0);
|
||||
}
|
||||
|
||||
mpTextboxes[1]->set0x1F6(1);
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane = &mBtn;
|
||||
mBtn.build(resAcc);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
mText.build(resAcc, dLytTextLight::NORMAL);
|
||||
mBlurRelated.build();
|
||||
|
||||
mpPanes[3]->SetVisible(true);
|
||||
mLyt.calc();
|
||||
mpPanes[3]->SetVisible(false);
|
||||
mpTagProcessor = tagProcessor;
|
||||
|
||||
mTranslationOrig.copyFrom(mpPanes[4]->GetTranslate());
|
||||
mTranslationTo.copyFrom(mpPanes[4]->GetTranslate());
|
||||
mTranslationFrom.copyFrom(mpPanes[4]->GetTranslate());
|
||||
|
||||
mParam = 0;
|
||||
|
||||
mOffset.x = mOffset.y = 0.0f;
|
||||
|
||||
mWaitDelay = 0;
|
||||
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowTalk_c::remove() {
|
||||
mText.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 < 1; i++) {
|
||||
mNodes[i].mpLytPane->remove();
|
||||
}
|
||||
mBtn.remove();
|
||||
for (int i = 0; i < TALK_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowTalk_c::initializeState_Invisible() {
|
||||
mBtn.resetToInvisble();
|
||||
}
|
||||
void dLytMsgWindowTalk_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowTalk_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytMsgWindowTalk_c::initializeState_In() {
|
||||
mAnm[TALK_ANIM_POSITION].setFrame(mParam);
|
||||
mAnm[TALK_ANIM_POSITION].setAnimEnable(true);
|
||||
mLyt.calc();
|
||||
mAnm[TALK_ANIM_POSITION].setAnimEnable(false);
|
||||
|
||||
mTranslationTo = mTranslationOrig;
|
||||
mTranslationTo.y = mpPanes[4]->GetTranslate().y;
|
||||
mTranslationFrom = mTranslationTo;
|
||||
|
||||
mAnm[TALK_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[TALK_ANIM_IN].setFrame(0.0f);
|
||||
|
||||
mpPanes[4]->SetTranslate(mTranslationFrom);
|
||||
}
|
||||
void dLytMsgWindowTalk_c::executeState_In() {
|
||||
if (mTranslationFrom != mTranslationTo) {
|
||||
mVec3_c v;
|
||||
if (mAnm[TALK_ANIM_IN].isEndReached()) {
|
||||
v = mTranslationTo;
|
||||
} else {
|
||||
v.copyFrom(mpPanes[4]->GetTranslate());
|
||||
mVec3_c tmp = (mTranslationTo - v) / 2.0f;
|
||||
v += tmp;
|
||||
}
|
||||
mpPanes[4]->SetTranslate(v);
|
||||
}
|
||||
|
||||
if (mAnm[TALK_ANIM_IN].isEndReached()) {
|
||||
mAnm[TALK_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowTalk_c::finalizeState_In() {}
|
||||
|
||||
void dLytMsgWindowTalk_c::initializeState_Wait() {
|
||||
mWaitDelay = UnkTextThing::getInstance()->getMsgWindowWaitDelay();
|
||||
}
|
||||
void dLytMsgWindowTalk_c::executeState_Wait() {
|
||||
if (--mWaitDelay > 0) {
|
||||
return;
|
||||
}
|
||||
mStateMgr.changeState(StateID_Visible);
|
||||
}
|
||||
void dLytMsgWindowTalk_c::finalizeState_Wait() {}
|
||||
|
||||
void dLytMsgWindowTalk_c::initializeState_Visible() {
|
||||
nw4r::lyt::Size size = getTextBox()->GetSize();
|
||||
nw4r::lyt::Size fontSize = getTextBox()->GetFontSize();
|
||||
nw4r::math::MTX34 transform = getTextBox()->GetGlobalMtx();
|
||||
|
||||
mOffset.x = transform._03 - size.width / 2;
|
||||
mOffset.y = transform._13 + size.height / 2;
|
||||
}
|
||||
void dLytMsgWindowTalk_c::executeState_Visible() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowTalk_c::finalizeState_Visible() {}
|
||||
|
||||
void dLytMsgWindowTalk_c::initializeState_Out() {
|
||||
mTranslationFrom = mTranslationTo;
|
||||
mAnm[TALK_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[TALK_ANIM_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowTalk_c::executeState_Out() {
|
||||
if (mTranslationFrom != mTranslationTo) {
|
||||
mVec3_c v;
|
||||
if (mAnm[TALK_ANIM_OUT].isEndReached()) {
|
||||
v = mTranslationFrom;
|
||||
} else {
|
||||
f32 ratio = mAnm[TALK_ANIM_OUT].getRatio();
|
||||
if (ratio > 1.0f) {
|
||||
ratio = 1.0f;
|
||||
}
|
||||
v = mTranslationTo + (mTranslationFrom - mTranslationTo) * ratio;
|
||||
}
|
||||
mpPanes[4]->SetTranslate(v);
|
||||
}
|
||||
|
||||
if (mAnm[TALK_ANIM_OUT].isEndReached()) {
|
||||
mAnm[TALK_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowTalk_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytMsgWindowTalk_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < TALK_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
mLyt.calc();
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane->execute();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowTalk_c::draw() {
|
||||
// NONMATCHING
|
||||
// The instruction patterns here are the same that EGG::StateGX::Scoped
|
||||
// generates, but there's no RAII to be found here. What's the missing
|
||||
// link that makes the compiler generate these?
|
||||
// When you fix this, fix other instances of this problem
|
||||
// by searching for 91657b77
|
||||
bool bVis[3] = {
|
||||
mpPanes[0]->IsVisible(),
|
||||
mpPanes[1]->IsVisible(),
|
||||
mpPanes[2]->IsVisible(),
|
||||
};
|
||||
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(false);
|
||||
mpPanes[2]->SetVisible(false);
|
||||
|
||||
mLyt.draw();
|
||||
mBlurRelated.drawTextBlur(&mText, mOffset, mpPanes[3]->GetAlpha());
|
||||
|
||||
mpPanes[0]->SetVisible(false);
|
||||
mpPanes[1]->SetVisible(bVis[1]);
|
||||
mpPanes[2]->SetVisible(bVis[2]);
|
||||
|
||||
mLyt.draw();
|
||||
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(bVis[1]);
|
||||
mpPanes[2]->SetVisible(bVis[2]);
|
||||
}
|
||||
|
||||
void dLytMsgWindowTalk_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mpActor = obj;
|
||||
mParam = param;
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowTalk_c::isDoneOpening() const {
|
||||
if (*mStateMgr.getStateID() == StateID_In || *mStateMgr.getStateID() == StateID_Wait) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowTalk_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowTalk_c::isDoneClosing() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_Out);
|
||||
}
|
||||
|
||||
bool dLytMsgWindowTalk_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_wood.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowWood_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindowWood_c, In);
|
||||
STATE_DEFINE(dLytMsgWindowWood_c, Visible);
|
||||
STATE_DEFINE(dLytMsgWindowWood_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "kanbanWindow_00_in.brlan", "G_inOut_00"},
|
||||
{"kanbanWindow_00_loop.brlan", "G_loop_00"},
|
||||
{ "kanbanWindow_00_out.brlan", "G_inOut_00"},
|
||||
};
|
||||
|
||||
#define KANBAN_ANIM_IN 0
|
||||
#define KANBAN_ANIM_LOOP 1
|
||||
#define KANBAN_ANIM_OUT 2
|
||||
|
||||
#define KANBAN_NUM_ANIMS 3
|
||||
|
||||
static const char *sPanes[] = {
|
||||
"N_aBtn_00",
|
||||
"N_inOut_00",
|
||||
};
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_message_00",
|
||||
"T_messageS_00",
|
||||
};
|
||||
|
||||
static const char *sGroupName = "G_ref_00";
|
||||
|
||||
bool dLytMsgWindowWood_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("kanbanWindow_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < KANBAN_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnm[KANBAN_ANIM_LOOP].setAnimEnable(true);
|
||||
mAnm[KANBAN_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[KANBAN_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[KANBAN_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpPanes[i] = mLyt.findPane(sPanes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
mpTextboxes[i]->SetTextPositionH(0);
|
||||
mpTextboxes[i]->SetTextPositionV(0);
|
||||
}
|
||||
|
||||
mpTextboxes[1]->set0x1F6(1);
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane = &mBtn;
|
||||
mBtn.build(resAcc);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
mpPanes[1]->SetVisible(true);
|
||||
mLyt.calc();
|
||||
mpPanes[1]->SetVisible(false);
|
||||
mpTagProcessor = tagProcessor;
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowWood_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 < 1; i++) {
|
||||
mNodes[i].mpLytPane->remove();
|
||||
}
|
||||
mBtn.remove();
|
||||
for (int i = 0; i < KANBAN_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowWood_c::initializeState_Invisible() {
|
||||
mBtn.resetToInvisble();
|
||||
}
|
||||
void dLytMsgWindowWood_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowWood_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytMsgWindowWood_c::initializeState_In() {
|
||||
mAnm[KANBAN_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[KANBAN_ANIM_IN].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowWood_c::executeState_In() {
|
||||
if (mAnm[KANBAN_ANIM_IN].isEndReached()) {
|
||||
mAnm[KANBAN_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Visible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowWood_c::finalizeState_In() {}
|
||||
|
||||
void dLytMsgWindowWood_c::initializeState_Visible() {}
|
||||
void dLytMsgWindowWood_c::executeState_Visible() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowWood_c::finalizeState_Visible() {}
|
||||
|
||||
void dLytMsgWindowWood_c::initializeState_Out() {
|
||||
mAnm[KANBAN_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[KANBAN_ANIM_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowWood_c::executeState_Out() {
|
||||
if (mAnm[KANBAN_ANIM_OUT].isEndReached()) {
|
||||
mAnm[KANBAN_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowWood_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytMsgWindowWood_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < KANBAN_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
mLyt.calc();
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane->execute();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowWood_c::draw() {
|
||||
mLyt.draw();
|
||||
}
|
||||
|
||||
void dLytMsgWindowWood_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowWood_c::isDoneOpening() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_In);
|
||||
}
|
||||
|
||||
void dLytMsgWindowWood_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowWood_c::isDoneClosing() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_Out);
|
||||
}
|
||||
|
||||
bool dLytMsgWindowWood_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
return true;
|
||||
}
|
||||
+6
-6
@@ -30,7 +30,7 @@ void LMS_CloseMessage(struct MsbtInfo *info) {
|
||||
LMSi_Free(info);
|
||||
}
|
||||
|
||||
int LMS_GetTextIndexByLabel(struct MsbtInfo *info, const char *label) {
|
||||
int LMS_GetTextIndexByLabel(const struct MsbtInfo *info, const char *label) {
|
||||
if (info->lbl1Index == -1) {
|
||||
return -2;
|
||||
} else {
|
||||
@@ -38,7 +38,7 @@ int LMS_GetTextIndexByLabel(struct MsbtInfo *info, const char *label) {
|
||||
}
|
||||
}
|
||||
|
||||
const char *LMS_GetText(struct MsbtInfo *info, int index) {
|
||||
const wchar_t *LMS_GetText(const struct MsbtInfo *info, int index) {
|
||||
if (info->txt2Index == -1) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -48,10 +48,10 @@ const char *LMS_GetText(struct MsbtInfo *info, int index) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &((const char *)header)[header[index + 1]];
|
||||
return (const wchar_t*)&((const char *)header)[header[index + 1]];
|
||||
}
|
||||
|
||||
const char *LMS_GetTextByLabel(struct MsbtInfo *info, const char *label) {
|
||||
const wchar_t *LMS_GetTextByLabel(const struct MsbtInfo *info, const char *label) {
|
||||
int index = LMS_GetTextIndexByLabel(info, label);
|
||||
if (index < 0) {
|
||||
return NULL;
|
||||
@@ -60,11 +60,11 @@ const char *LMS_GetTextByLabel(struct MsbtInfo *info, const char *label) {
|
||||
}
|
||||
}
|
||||
|
||||
const char *LMS_GetLabelByTextIndex(struct MsbtInfo *info, int index) {
|
||||
const char *LMS_GetLabelByTextIndex(const struct MsbtInfo *info, int index) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
struct MsbtAttrInfo *LMS_GetAttribute(struct MsbtInfo *info, int index) {
|
||||
struct MsbtAttrInfo *LMS_GetAttribute(const struct MsbtInfo *info, int index) {
|
||||
int *p = info->base.sectionInfos[info->atr1Index].ptr;
|
||||
return (struct MsbtAttrInfo *)&((const char *)p)[p[1] * index + 8];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user