This commit is contained in:
robojumper
2025-04-05 18:19:37 +02:00
parent 134f7e1ab6
commit 2892dd467a
15 changed files with 282 additions and 102 deletions
+12 -12
View File
@@ -3891,20 +3891,20 @@ __ct__13TextWindowUnkFP15dTagProcessor_c = .text:0x800B20E0; // type:function si
fn_800B2130__13TextWindowUnkFPCcP10dTextBox_cPvb = .text:0x800B2130; // type:function size:0x370
textAdvancingRelated__13TextWindowUnkFbb = .text:0x800B24A0; // type:function size:0x5FC
fn_800B2AA0__13TextWindowUnkFv = .text:0x800B2AA0; // type:function size:0x80
somethingWithTextboxEndState = .text:0x800B2B20; // type:function size:0x48
checkLastLineReached__13TextWindowUnkFv = .text:0x800B2B20; // type:function size:0x48
checkEndReached__13TextWindowUnkCFv = .text:0x800B2B70; // type:function size:0x1C
checkLastLineReachedMaybe__13TextWindowUnkCFv = .text:0x800B2B90; // type:function size:0xD8
reset__13TextWindowUnkFv = .text:0x800B2B90; // type:function size:0xD8
fn_800B2C70 = .text:0x800B2C70; // type:function size:0x340
fn_800B2FB0 = .text:0x800B2FB0; // type:function size:0x324
build__20MsgWindowBlurRelatedFv = .text:0x800B32E0; // type:function size:0x84
drawTextBlur__20MsgWindowBlurRelatedFP13dLytTextLightQ34nw4r4math4VEC2Uc = .text:0x800B3370; // type:function size:0x138
fn_800B34B0 = .text:0x800B34B0; // type:function size:0x40
drawTextBlur__20MsgWindowBlurRelatedFP13dLytTextLight8LytVec2fUc = .text:0x800B3370; // type:function size:0x138
__dt__13TextWindowUnkFv = .text:0x800B34B0; // type:function size:0x40
fn_800B34F0 = .text:0x800B34F0; // type:function size:0xD0
__ct__15dTagProcessor_cFv = .text:0x800B35C0; // type:function size:0x260
__dt__15dTagProcessor_cFv = .text:0x800B3820; // type:function size:0x58
format__15dTagProcessor_cFP10dTextBox_cPCwPwUlPUlPve = .text:0x800B3880; // type:function size:0x8C
formatV__15dTagProcessor_cFP10dTextBox_cPCwPwUlPUlPvP16__va_list_struct = .text:0x800B3910; // type:function size:0x980
fn_800B4290 = .text:0x800B4290; // type:function size:0x5AC
fn_800B4290__15dTagProcessor_cFP10dTextBox_cPCwPwlPUsP21dLytMsgWindowCharData = .text:0x800B4290; // type:function size:0x5AC
Process__15dTagProcessor_cFUsPQ34nw4r2ut15PrintContext<w> = .text:0x800B4840; // type:function size:0x10
CalcRect__15dTagProcessor_cFPQ34nw4r2ut4RectUsPQ34nw4r2ut15PrintContext<w> = .text:0x800B4850; // type:function size:0x4
ProcessTags__15dTagProcessor_cFPQ34nw4r2ut4RectUsPQ34nw4r2ut15PrintContext<w> = .text:0x800B4860; // type:function size:0x78C
@@ -3955,8 +3955,8 @@ process0xFCommand__15dTagProcessor_cFwPCwPl = .text:0x800B88D0; // type:function
tick0x830__15dTagProcessor_cFv = .text:0x800B88E0; // type:function size:0x30
resetSomething__15dTagProcessor_cFv = .text:0x800B8910; // type:function size:0x1C
tickPauseFrame__15dTagProcessor_cFv = .text:0x800B8930; // type:function size:0x30
resetSomeFloats__15dTagProcessor_cFv = .text:0x800B8960; // type:function size:0xD8
getFloat__15dTagProcessor_cFl = .text:0x800B8A40; // type:function size:0x10
resetLineData__15dTagProcessor_cFv = .text:0x800B8960; // type:function size:0xD8
getLineWidth__15dTagProcessor_cFl = .text:0x800B8A40; // type:function size:0x10
setNumericArg0__15dTagProcessor_cFl = .text:0x800B8A50; // type:function size:0xC
setNumericArgs__15dTagProcessor_cFPCll = .text:0x800B8A60; // type:function size:0xDC
fn_800B8B40 = .text:0x800B8B40; // type:function size:0x4C
@@ -6828,7 +6828,7 @@ isOutputtingText__15dLytMsgWindow_cCFv = .text:0x801172C0; // type:function size
fn_80117310 = .text:0x80117310; // type:function size:0x4C
fn_80117360 = .text:0x80117360; // type:function size:0x14
fn_80117380 = .text:0x80117380; // type:function size:0xC
fn_80117390 = .text:0x80117390; // type:function size:0x54
fn_80117390__15dLytMsgWindow_cCFb = .text:0x80117390; // type:function size:0x54
setCurrentEntrypointName__15dLytMsgWindow_cFPCc = .text:0x801173F0; // type:function size:0xB4
setCurrentFlowFilename__15dLytMsgWindow_cFPCc = .text:0x801174B0; // type:function size:0xB4
LytMsgWindow__setNumericArg0 = .text:0x80117570; // type:function size:0x8
@@ -7129,8 +7129,8 @@ draw__13dLytTextSwordFPCwScRC7mVec3_cf = .text:0x80120C60; // type:function size
fn_80120DB0__13dLytTextSwordCFv = .text:0x80120DB0; // type:function size:0xC
build__13dLytTextLightFPQ23d2d10ResAccIf_cQ213dLytTextLight9ETextType = .text:0x80120DC0; // type:function size:0x104
remove__13dLytTextLightFv = .text:0x80120ED0; // type:function size:0x28
fn_80120F00 = .text:0x80120F00; // type:function size:0x14C
fn_80121050 = .text:0x80121050; // type:function size:0xC
draw2__13dLytTextLightFScRC7mVec3_cUcf = .text:0x80120F00; // type:function size:0x14C
fn_80121050__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
@@ -10928,7 +10928,7 @@ getMsbtNumberByIndex__10dMessage_cFl = .text:0x801B29A0; // type:function size:0
getMsbfNumberByIndex__10dMessage_cFl = .text:0x801B29D0; // type:function size:0x24
fn_801B2A00 = .text:0x801B2A00; // type:function size:0x14
getTextIndexForLabel__10dMessage_cFPCc = .text:0x801B2A20; // type:function size:0x4C
fn_801B2A70 = .text:0x801B2A70; // type:function size:0xC
getMsbtIndexForLabel__10dMessage_cFPCc = .text:0x801B2A70; // type:function size:0xC
getMsbtIndexForLabelInternal__10dMessage_cFPCc = .text:0x801B2A80; // type:function size:0xA4
getMsbtInfoForIndex__10dMessage_cFl = .text:0x801B2B30; // type:function size:0xC
getMsbtInfoForIndexInternal__10dMessage_cFl = .text:0x801B2B40; // type:function size:0x38
@@ -31002,7 +31002,7 @@ __vt__10dTextBox_c = .data:0x80510798; // type:object size:0x84
__vt__9dWindow_c = .data:0x80510820; // type:object size:0x8C scope:weak
__vt__Q23d2d10ResAccIf_c = .data:0x805108B0; // type:object size:0x18
__vt__12UnkTextThing = .data:0x805108C8; // type:object size:0xC scope:weak
lbl_805108D8 = .data:0x805108D8; // type:object size:0x10
__vt__13TextWindowUnk = .data:0x805108D8; // type:object size:0x10
lbl_805108E8 = .data:0x805108E8; // type:object size:0x10
lbl_805108F8 = .data:0x805108F8; // type:object size:0x14 data:string
jumptable_8051090C = .data:0x8051090C; // type:object size:0x80 scope:local
+1
View File
@@ -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"),
+3 -1
View File
@@ -47,6 +47,9 @@ public:
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);
@@ -65,7 +68,6 @@ private:
bool checkIsValidTextLabel(const char *name);
static void setZevFromMsbArc();
static const char *getMsbtFileName(s32 index);
static s32 getMsbtNumberByIndex(s32 index);
static const char *getMsbfFileName(s32 index);
static s32 getMsbfNumberByIndex(s32 index);
+30 -11
View File
@@ -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,7 @@ 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 format(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, ...);
void
formatV(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, va_list list);
@@ -62,11 +68,14 @@ 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();
@@ -76,11 +85,11 @@ public:
}
s32 getNumLinesMaybe() const {
return mCommandInsert;
return mLineData.mNumLines;
}
u8 getMsgWindowSubtype() const {
return field_0x90C;
return mMsgWindowSubtype;
}
u8 getField_0x90D() const {
@@ -91,6 +100,10 @@ public:
return field_0x90E;
}
s32 getField_0x824() const {
return field_0x824;
}
s32 getField_0x828() const {
return field_0x828;
}
@@ -104,7 +117,7 @@ public:
}
void setMsgWindowSubtype(u8 type) {
field_0x90C = type;
mMsgWindowSubtype = type;
}
void setField_0x828(s32 val) {
@@ -115,7 +128,6 @@ public:
field_0x82C = val;
}
void setField_0x90D(u8 val) {
field_0x90D = val;
}
@@ -124,6 +136,10 @@ public:
field_0x90E = val;
}
void setField_0xEE0(u8 val) {
field_0xEE0 = val;
}
void setField_0xEE1(u8 val) {
field_0xEE1 = val;
}
@@ -140,6 +156,10 @@ public:
return field_0x008[idx];
}
LineData getLineData() const {
return mLineData;
}
private:
/* 0x004 */ dTextBox_c *field_0x004;
/* 0x008 */ wchar_t field_0x008[4][256];
@@ -189,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]; // Maybe width for each individual line
/* 0x9DC */ s32 mCommandInsert; // Maybe number of lines
/* 0x914 */ LineData mLineData;
/* 0x9E0 */ wchar_t mStringArgs[8][64];
/* 0xDE0 */ u8 field_0xDE0[0xEE0 - 0xDE0];
/* 0xEE0 */ u8 field_0xEE0;
+24
View File
@@ -137,6 +137,30 @@ public:
return field_buf2[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;
}
private:
static UnkTextThing *sInstance;
+37 -14
View File
@@ -4,8 +4,27 @@
#include "d/d_tag_processor.h"
#include "d/lyt/d_textbox.h"
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
#include "sized_string.h"
#include "toBeSorted/lyt_vec2f.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
@@ -14,7 +33,7 @@ public:
TextWindowUnk(dTagProcessor_c *tagProcessor);
virtual ~TextWindowUnk() {}
void fn_800B2130(const char *, dTextBox_c *, void *, bool);
bool fn_800B2130(const char *, dTextBox_c *, dLytMsgWindowCharData *data, bool);
void fn_800B2AA0();
void textAdvancingRelated(bool, bool);
@@ -31,26 +50,29 @@ public:
}
bool checkEndReached() const;
bool checkLastLineReachedMaybe() const;
bool checkLastLineReached();
bool reset();
private:
/* 0x0004 */ dTagProcessor_c *mpTagProcessor;
/* 0x0008 */ wchar_t mRawTextBuffer[1023];
/* 0x0806 */ wchar_t mProcessedTextBuffer[1023];
/* 0x1004 */ wchar_t mUnkBuffer[571]; // ???
/* 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[0x1550 - 0x147E];
/* 0x1550 */ void *field_0x1550;
};
struct dLytMsgWindowCharData {
/* 0x00 */ f32 posX;
/* 0x04 */ f32 posY;
/* 0x08 */ f32 field_0x08;
/* 0x0C */ s16 field_0x0C;
/* 0x0E */ wchar_t character;
/* 0x10 */ s8 displayTimerMaybe;
/* 0x147E */ u8 _0x147E[0x1480 - 0x147E];
/* 0x1480 */ dTextBox_c *mpTextBox;
/* 0x1484 */ LineData mLineWidths;
/* 0x1550 */ dLytMsgWindowCharData *mpCharacterData;
};
class MsgWindowBlurRelated {
@@ -61,6 +83,7 @@ public:
void build();
void remove();
void drawTextBlur(dLytTextLight *thing, LytVec2f size, u8 alpha);
void reset();
dLytMsgWindowCharData *getCharData() {
return mData;
@@ -10,6 +10,7 @@
#include "s/s_State.hpp"
#include "sized_string.h"
// Forward declarations required for vtable order
class dLytMsgWindowTalk_c;
class dLytMsgWindowLink_c;
class dLytMsgWindowGet_c;
@@ -47,6 +48,8 @@ public:
return mNameCopy;
}
const char *fn_80117390(bool) const;
private:
bool setTextToDisplay(const wchar_t *text);
void createSubMsgManager(u8 type);
@@ -75,7 +75,9 @@ 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;
private:
/* 0x04 */ d2d::LytBase_c mLyt;
+11
View File
@@ -0,0 +1,11 @@
#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;
}
#endif
+9
View File
@@ -0,0 +1,9 @@
#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);
#endif
+41 -41
View File
@@ -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;
@@ -232,11 +232,11 @@ void dTagProcessor_c::formatV(
// 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);
}
@@ -250,7 +250,7 @@ void dTagProcessor_c::formatV(
dest[1] = x.us[1];
dest[2] = x.us[2];
dest[3] = x.us[3];
dest[4] = mCommandInsert;
dest[4] = mLineData.mNumLines;
}
StackThing yTmp;
@@ -260,7 +260,7 @@ void dTagProcessor_c::formatV(
wchar_t c = *src;
if (c == nullptr) {
if (textBox != nullptr) {
mCommandInsert++;
mLineData.mNumLines++;
}
*writePtr = '\0';
goto end;
@@ -353,7 +353,7 @@ void dTagProcessor_c::formatV(
} 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);
@@ -420,10 +420,10 @@ void dTagProcessor_c::formatV(
*writePtr = c;
src++;
writePtr++;
mCommandInsert++;
s32 i10 = getMaxNumLines(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) {
@@ -432,12 +432,13 @@ void dTagProcessor_c::formatV(
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++;
}
@@ -633,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 = getMaxNumLines(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 + getMaxNumLines(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) {
@@ -659,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 < getMaxNumLines(field_0x90C)) {
if (u < getMaxNumLines(mMsgWindowSubtype)) {
f32 w1 = fontSize.width * 0.5f;
f32 h1 = fontSize.height * 0.5f;
if (!(w1 < UnkTextThing::getField0x758())) {
@@ -669,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 * (getMaxNumLines(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;
@@ -680,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);
}
}
}
@@ -694,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;
@@ -716,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;
@@ -731,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;
@@ -833,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();
}
@@ -982,9 +984,7 @@ 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;
case 2: x = 1.1f; break;
}
x *= UnkTextThing::getFn800B1F10();
return x * f1;
@@ -1045,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) {
+97
View File
@@ -0,0 +1,97 @@
#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, LytVec2f 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->fn_80121050()) {
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);
}
}
}
+2 -4
View File
@@ -19,8 +19,8 @@
#include "rvl/GX/GXPixel.h"
#include "rvl/GX/GXTev.h"
#include "rvl/GX/GXTypes.h"
#include "toBeSorted/lyt_related_floats.h"
#include <cstddef>
#include <cstring>
dTextBox_c::dTextBox_c(const nw4r::lyt::res::TextBox *pBlock, const nw4r::lyt::ResBlockSet &resBlockSet)
@@ -440,10 +440,8 @@ f32 dTextBox_c::GetLinesHeight() const {
return totalHeight;
}
extern "C" f32 lbl_805751A4;
f32 dTextBox_c::GetUnkWidthRatio() const {
f32 tmp = lbl_805751A4;
return GetLineWidth(nullptr) / tmp;
return GetLineWidth(nullptr) / get_805751A4();
}
f32 dTextBox_c::resizeTextToFit(f32 maxWidth) {
+4 -4
View File
@@ -146,7 +146,7 @@ bool dLytMsgWindow_c::build() {
field_0x81E = 0;
field_0x828 = 0;
field_0x828 = nullptr;
mStateMgr.changeState(StateID_Invisible);
@@ -199,7 +199,7 @@ void dLytMsgWindow_c::executeState_Invisible() {
mStateMgr.changeState(StateID_ExplainIn);
} else {
createSubMsgManager(mpTagProcessor->getMsgWindowSubtype());
field_0x828 = 0;
field_0x828 = nullptr;
mSpecialFiMenuValue = 7;
if (mpTagProcessor->getMsgWindowSubtype() == 6) {
mpCurrentSubtype = mpWindowWood;
@@ -331,7 +331,7 @@ void dLytMsgWindow_c::executeState_OutputText() {
}
field_0x81C = mpMsgWindowUnk->checkEndReached();
field_0x81D = mpMsgWindowUnk->checkLastLineReachedMaybe();
field_0x81D = mpMsgWindowUnk->reset();
}
void dLytMsgWindow_c::finalizeState_OutputText() {}
@@ -673,7 +673,7 @@ bool dLytMsgWindow_c::execute() {
removeSubMsgManagers();
mStateMgr.changeState(StateID_Invisible);
}
mpMsgWindowUnk->checkLastLineReachedMaybe();
mpMsgWindowUnk->reset();
mSelectBtn.remove();
field_0x81B = 0;
// TODO boss caption
@@ -11,6 +11,7 @@
#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);
@@ -96,13 +97,7 @@ bool dLytMsgWindowSword_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resA
mSwordText.build(resAcc, mSwordType);
for (int i = 0; i < 1023; i++) {
mCharacterData[i].posX = 0.0f;
mCharacterData[i].posY = 0.0f;
mCharacterData[i].field_0x08 = dTagProcessor_c::fn_800B8040(0, 0);
mCharacterData[i].character = L'\0';
mCharacterData[i].field_0x0C = 1023;
mCharacterData[i].displayTimerMaybe = -1;
mCharacterData[i].reset();
mTextBuf[i] = L'\0';
}
@@ -268,8 +263,6 @@ bool dLytMsgWindowSword_c::execute() {
return true;
}
extern "C" f32 lbl_805751A4;
void dLytMsgWindowSword_c::draw() {
mLyt.draw();
@@ -278,16 +271,14 @@ void dLytMsgWindowSword_c::draw() {
if (!mHasDrawnThisTick) {
mCharacterData[i].displayTimerMaybe += 1;
}
wchar_t str[2];
// FPR regswaps
f32 x = field_0x05E4 + mCharacterData[i].posX;
x /= lbl_805751A4;
f32 y = field_0x05E8 + mCharacterData[i].posY;
nw4r::math::VEC3 v(
(field_0x05E4 + mCharacterData[i].posX) / get_805751A4(), field_0x05E8 + mCharacterData[i].posY, 0.0f
);
wchar_t str[2];
str[0] = mCharacterData[i].character;
str[1] = 0;
nw4r::math::VEC3 v(x, y, 0.0f);
mSwordText.draw(str, mCharacterData[i].displayTimerMaybe, v, mCharacterData[i].field_0x08);
if (mCharacterData[i].displayTimerMaybe >= mSwordText.fn_80120DB0()) {
mCharacterData[i].displayTimerMaybe = -1;