diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/d/d_textunk.h | 49 | ||||
| -rw-r--r-- | include/d/lyt/d2d.h | 2 | ||||
| -rw-r--r-- | include/d/lyt/d_textbox.h | 27 | ||||
| -rw-r--r-- | include/sized_string.h | 28 |
4 files changed, 75 insertions, 31 deletions
diff --git a/include/d/d_textunk.h b/include/d/d_textunk.h index 3860c81b..5e43e709 100644 --- a/include/d/d_textunk.h +++ b/include/d/d_textunk.h @@ -42,10 +42,59 @@ public: return 1.0f; } + inline static f32 getFn800B1FD0() { + if (sInstance != nullptr) { + return sInstance->fn_800B1FD0(); + } + return 1.0f; + } + inline static f32 getFn800B1F10() { return sInstance->fn_800B1F10(); } + inline static f32 getFn800B1FF0() { + if (sInstance != nullptr) { + return sInstance->fn_800B1FF0(); + } + return 0.0f; + } + + inline static f32 getFn800B2000() { + if (sInstance != nullptr) { + return sInstance->fn_800B2000(); + } + return 0.0f; + } + + inline static f32 getFn800B2010() { + if (sInstance != nullptr) { + return sInstance->fn_800B2010(); + } + return 0.0f; + } + + inline static f32 getFn800B2020() { + if (sInstance != nullptr) { + return sInstance->fn_800B2020(); + } + return 0.0f; + } + + inline static f32 getFn800B2030() { + if (sInstance != nullptr) { + return sInstance->fn_800B2030(); + } + return 0.0f; + } + + inline static f32 getFn800B2040() { + if (sInstance != nullptr) { + return sInstance->fn_800B2040(); + } + return 0.0f; + } + private: static UnkTextThing *sInstance; diff --git a/include/d/lyt/d2d.h b/include/d/lyt/d2d.h index 0bb7d45f..83482558 100644 --- a/include/d/lyt/d2d.h +++ b/include/d/lyt/d2d.h @@ -286,6 +286,8 @@ struct AnmGroup_c : public AnmGroupBase_c { /* 0x28 */ m2d::FrameCtrl_c mFrameCtrl; }; +void pushToEnd(nw4r::lyt::Pane *); + // This abstraction is apparently only ever used in CsGame class AnmGroups { public: diff --git a/include/d/lyt/d_textbox.h b/include/d/lyt/d_textbox.h index 653aafb3..49afd74c 100644 --- a/include/d/lyt/d_textbox.h +++ b/include/d/lyt/d_textbox.h @@ -3,8 +3,7 @@ #include "d/lyt/d2d.h" #include "nw4r/lyt/lyt_textBox.h" - -extern "C" void *lbl_805753B0; +#include "nw4r/lyt/lyt_types.h" class dTextBox_c : public nw4r::lyt::TextBox { friend class dWindow_c; @@ -18,13 +17,13 @@ public: mpLytBase = lytBase; } - void SetScale(float scale) { - nw4r::math::VEC2 value = GetScale(); - value.x = GetScale().x * scale; - value.y = GetScale().y * scale; + void SetScale(f32 scale) { + nw4r::lyt::Size value(mTextScale); + value.width *= scale; + value.height *= scale; mScale = scale; MySetScale(value); - nw4r::lyt::TextBox::SetScale(value); + nw4r::lyt::TextBox::SetFontSize(value); } void set0x1F8(u8 val) { @@ -35,28 +34,18 @@ public: return mScale; } - static inline f32 GetTranslateX1() { - if (lbl_805753B0 != nullptr) { - return GetTranslateX1_(); - } else { - return 0.0f; - } - } - void fn_800E0A60(const char *area, ...) { // TODO } - static f32 GetTranslateX1_(); - // @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 MySetScale(const nw4r::math::VEC2 &value); + void MySetScale(const nw4r::lyt::Size &value); /* 0x104 */ d2d::LytBase_c *mpLytBase; /* 0x108 */ u8 field_0x108[0x118 - 0x108]; - /* 0x118 */ nw4r::math::VEC2 mTextScale; + /* 0x118 */ nw4r::lyt::Size mTextScale; /* 0x120 */ f32 mScale; /* 0x124 */ u8 field_0x124[0x1F8 - 0x124]; /* 0x1F8 */ u8 field_0x1F8; diff --git a/include/sized_string.h b/include/sized_string.h index 64b01a5a..c0670728 100644 --- a/include/sized_string.h +++ b/include/sized_string.h @@ -44,21 +44,25 @@ struct SizedString { void operator+=(const char *src) { if (src != nullptr) { - size_t destLen = strlen(mChars); - size_t copyLen = strlen(src); - - // Make sure copy length isnt more than destination length - if (destLen + copyLen + 1 >= Size) { - size_t tmpLen = Size - destLen; - copyLen = tmpLen - 1; - } + append(src); + } + } - strncpy(mChars + destLen, src, copyLen); + void append(const char *src) { + size_t destLen = strlen(mChars); + size_t copyLen = strlen(src); - // make sure string is null terminated - size_t offset = destLen + copyLen; - mChars[offset] = '\0'; + // Make sure copy length isnt more than destination length + if (destLen + copyLen + 1 >= Size) { + size_t tmpLen = Size - destLen; + copyLen = tmpLen - 1; } + + strncpy(mChars + destLen, src, copyLen); + + // make sure string is null terminated + size_t offset = destLen + copyLen; + mChars[offset] = '\0'; } bool operator==(const char *other) const { |
