d_lyt_msg_window_common OK

This commit is contained in:
robojumper
2025-04-05 19:59:59 +02:00
parent 2892dd467a
commit 131eb322e8
14 changed files with 215 additions and 47 deletions
+4 -1
View File
@@ -452,8 +452,11 @@ d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp:
.data start:0x8051C300 end:0x8051CB10
.bss start:0x805AE670 end:0x805AE930
d/lyt/msg_window/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/msg_window/d_lyt_msg_window_talk.cpp:
.text start:0x80121070 end:0x801223C8
+18 -17
View File
@@ -3888,7 +3888,7 @@ destroyMsg__12UnkTextThingFP8MsbtInfo = .text:0x800B2050; // type:function size:
destroyFlow__12UnkTextThingFP8MsbfInfo = .text:0x800B2090; // type:function size:0x40
__sinit_\d_textunk_cpp = .text:0x800B20D0; // type:function size:0xC scope:local
__ct__13TextWindowUnkFP15dTagProcessor_c = .text:0x800B20E0; // type:function size:0x48
fn_800B2130__13TextWindowUnkFPCcP10dTextBox_cPvb = .text:0x800B2130; // type:function size:0x370
fn_800B2130__13TextWindowUnkFPCcP10dTextBox_cP21dLytMsgWindowCharDatab = .text:0x800B2130; // type:function size:0x370
textAdvancingRelated__13TextWindowUnkFbb = .text:0x800B24A0; // type:function size:0x5FC
fn_800B2AA0__13TextWindowUnkFv = .text:0x800B2AA0; // type:function size:0x80
checkLastLineReached__13TextWindowUnkFv = .text:0x800B2B20; // type:function size:0x48
@@ -7115,22 +7115,22 @@ __dt__44sFStateID_c<29dLytMsgWindowSelectBtnParts_c>Fv = .text:0x80120840; // ty
__dt__39sFStateID_c<24dLytMsgWindowSelectBtn_c>Fv = .text:0x801208A0; // type:function size:0x58
isSameName__39sFStateID_c<24dLytMsgWindowSelectBtn_c>CFPCc = .text:0x80120900; // type:function size:0x88
isSameName__44sFStateID_c<29dLytMsgWindowSelectBtnParts_c>CFPCc = .text:0x80120990; // type:function size:0x88
fn_80120A20 = .text:0x80120A20; // type:function size:0x8
fn_80120A30 = .text:0x80120A30; // type:function size:0x8
fn_80120A40 = .text:0x80120A40; // type:function size:0x8
fn_80120A50 = .text:0x80120A50; // type:function size:0x4
fn_80120A60 = .text:0x80120A60; // type:function size:0x8
fn_80120A70 = .text:0x80120A70; // type:function size:0x4
fn_80120A80 = .text:0x80120A80; // type:function size:0x8
fn_80120A90 = .text:0x80120A90; // type:function size:0x8
build__20dLytMsgWindowSubtypeFPQ23d2d10ResAccIf_cPQ23d2d10ResAccIf_cP15dTagProcessor_c = .text:0x80120A20; // type:function size:0x8
remove__20dLytMsgWindowSubtypeFv = .text:0x80120A30; // type:function size:0x8
execute__20dLytMsgWindowSubtypeFv = .text:0x80120A40; // type:function size:0x8
open__20dLytMsgWindowSubtypeFP12dAcObjBase_cUl = .text:0x80120A50; // type:function size:0x4
isDoneOpening__20dLytMsgWindowSubtypeCFv = .text:0x80120A60; // type:function size:0x8
close__20dLytMsgWindowSubtypeFv = .text:0x80120A70; // type:function size:0x4
isDoneClosing__20dLytMsgWindowSubtypeCFv = .text:0x80120A80; // type:function size:0x8
setText__20dLytMsgWindowSubtypeFPCw = .text:0x80120A90; // type:function size:0x8
build__13dLytTextSwordFPQ23d2d10ResAccIf_cQ213dLytTextSword10ESwordType = .text:0x80120AA0; // type:function size:0x188
remove__13dLytTextSwordFv = .text:0x80120C30; // type:function size:0x28
draw__13dLytTextSwordFPCwScRC7mVec3_cf = .text:0x80120C60; // type:function size:0x14C
fn_80120DB0__13dLytTextSwordCFv = .text:0x80120DB0; // type:function size:0xC
draw__13dLytTextSwordFPCwSc7mVec3_cf = .text:0x80120C60; // type:function size:0x14C
getAnimDuration__13dLytTextSwordCFv = .text:0x80120DB0; // type:function size:0xC
build__13dLytTextLightFPQ23d2d10ResAccIf_cQ213dLytTextLight9ETextType = .text:0x80120DC0; // type:function size:0x104
remove__13dLytTextLightFv = .text:0x80120ED0; // type:function size:0x28
draw2__13dLytTextLightFScRC7mVec3_cUcf = .text:0x80120F00; // type:function size:0x14C
fn_80121050__13dLytTextLightCFv = .text:0x80121050; // type:function size:0xC
draw__13dLytTextLightFSc7mVec3_cUcf = .text:0x80120F00; // type:function size:0x14C
getAnimDuration__13dLytTextLightCFv = .text:0x80121050; // type:function size:0xC
vt_0x40__20dLytMsgWindowSubtypeCFv = .text:0x80121060; // type:function size:0x8
LytMsgWindowTalk__initialize = .text:0x80121070; // type:function size:0x2F8
fn_80121370 = .text:0x80121370; // type:function size:0xE0
@@ -32155,10 +32155,11 @@ lbl_8051C6B8 = .data:0x8051C6B8; // type:object size:0x40
lbl_8051C6F8 = .data:0x8051C6F8; // type:object size:0x3AC
lbl_8051CAA4 = .data:0x8051CAA4; // type:object size:0x34
lbl_8051CAD8 = .data:0x8051CAD8; // type:object size:0x38
lbl_8051CB10 = .data:0x8051CB10; // type:object size:0xC
lbl_8051CB1C = .data:0x8051CB1C; // type:object size:0xC
lbl_8051CB28 = .data:0x8051CB28; // type:object size:0xC
lbl_8051CB34 = .data:0x8051CB34; // type:object size:0x164
lbl_8051CB10 = .data:0x8051CB10; // type:object size:0x9 data:string
lbl_8051CB1C = .data:0x8051CB1C; // type:object size:0xA data:string
lbl_8051CB28 = .data:0x8051CB28; // type:object size:0xB data:string
lbl_8051CB34 = .data:0x8051CB34; // type:object size:0xB data:string
__vt__20dLytMsgWindowSubtype = .data:0x8051CC50; // type:object size:0x44
lbl_8051CC98 = .data:0x8051CC98; // type:object size:0x1C
lbl_8051CCB4 = .data:0x8051CCB4; // type:object size:0xC
lbl_8051CCC0 = .data:0x8051CCC0; // type:object size:0x20
+1
View File
@@ -410,6 +410,7 @@ config.libs = [
Object(Matching, "d/lyt/d_lyt_common_icon_item.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"),
+10 -5
View File
@@ -68,6 +68,10 @@ public:
mpResAcc = resAcc;
}
const nw4r::lyt::DrawInfo &getDrawInfo() {
return mDrawInfo;
}
protected:
Layout_c mLayout;
nw4r::lyt::DrawInfo mDrawInfo;
@@ -103,7 +107,8 @@ private:
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, wchar_t *destBuf, u32 maxLen
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);
@@ -200,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 {
@@ -245,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;
}
@@ -33,7 +33,9 @@ public:
/* vt 0x3C */ virtual bool isDoneDecide() const {
return true;
}
/* vt 0x40 */ virtual bool vt_0x40() const;
/* vt 0x40 */ virtual bool vt_0x40() const {
return true;
}
};
class dLytTextSword {
@@ -50,8 +52,8 @@ public:
bool build(d2d::ResAccIf_c *pResAcc, ESwordType type);
bool remove();
void draw(const wchar_t *str, s8, const mVec3_c &, f32);
f32 fn_80120DB0() const;
void draw(const wchar_t *str, s8 frame, mVec3_c pos, f32 scale);
f32 getAnimDuration() const;
private:
/* 0x04 */ d2d::LytBase_c mLyt;
@@ -74,10 +76,8 @@ public:
bool build(d2d::ResAccIf_c *pResAcc, ETextType type);
bool remove();
void draw(const wchar_t *str, s8, const mVec3_c &, f32);
void draw2(s8, const mVec3_c &, u8, f32);
f32 fn_80120DB0() const;
f32 fn_80121050() const;
void draw(s8 frame, mVec3_c pos, u8 alpha, f32 scale);
f32 getAnimDuration() const;
private:
/* 0x04 */ d2d::LytBase_c mLyt;
+1 -1
View File
@@ -110,7 +110,7 @@ public:
return f >= end ? 0.0f : f;
}
inline f32 getEndFrameRaw() const {
inline f32 getAnimDuration() const {
return mEndFrame;
}
+6
View File
@@ -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;
}
+2 -2
View File
@@ -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>
+3 -4
View File
@@ -12,7 +12,6 @@
#include "toBeSorted/lyt_related_floats.h"
#include "toBeSorted/other_sound_stuff.h"
TextWindowUnk::TextWindowUnk(dTagProcessor_c *c) {
mpTagProcessor = c;
reset();
@@ -83,15 +82,15 @@ void MsgWindowBlurRelated::drawTextBlur(dLytTextLight *thing, LytVec2f size, u8
if (t == -1) {
mData[i].displayTimerMaybe++;
if (mData[i].displayTimerMaybe >= thing->fn_80121050()) {
if (mData[i].displayTimerMaybe >= thing->getAnimDuration()) {
mData[i].displayTimerMaybe = 0;
}
t = mData[i].displayTimerMaybe;
} else {
mData[i].displayTimerMaybe = t;
}
nw4r::math::VEC3 v((size.x + mData[i].posX) / get_805751A4(), size.y + mData[i].posY, 0.0f);
thing->draw2(mData[i].displayTimerMaybe, v, alpha, mData[i].field_0x08);
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);
}
}
}
+3 -3
View File
@@ -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;
@@ -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;
@@ -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;
+2 -2
View File
@@ -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;
@@ -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;
+3 -3
View File
@@ -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;
@@ -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;
}
@@ -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();
}
@@ -271,7 +271,7 @@ void dLytMsgWindowSword_c::draw() {
if (!mHasDrawnThisTick) {
mCharacterData[i].displayTimerMaybe += 1;
}
nw4r::math::VEC3 v(
mVec3_c v(
(field_0x05E4 + mCharacterData[i].posX) / get_805751A4(), field_0x05E8 + mCharacterData[i].posY, 0.0f
);
@@ -280,7 +280,7 @@ void dLytMsgWindowSword_c::draw() {
str[1] = 0;
mSwordText.draw(str, mCharacterData[i].displayTimerMaybe, v, mCharacterData[i].field_0x08);
if (mCharacterData[i].displayTimerMaybe >= mSwordText.fn_80120DB0()) {
if (mCharacterData[i].displayTimerMaybe >= mSwordText.getAnimDuration()) {
mCharacterData[i].displayTimerMaybe = -1;
}
}