mirror of
https://github.com/zeldaret/ss
synced 2026-07-05 21:09:07 -04:00
Use a common constant for msg window character buffer size
This commit is contained in:
@@ -70,14 +70,14 @@ bool TextWindowUnk::checkEndReached() const {
|
||||
}
|
||||
|
||||
void MsgWindowBlurRelated::build() {
|
||||
for (int i = 0; i < 1023; i++) {
|
||||
for (int i = 0; i < TextWindowUnk::BUF_SIZE; i++) {
|
||||
mData[i].reset();
|
||||
}
|
||||
}
|
||||
|
||||
void MsgWindowBlurRelated::drawTextBlur(dLytTextLight *thing, mVec2_c size, u8 alpha) {
|
||||
s8 t = -1;
|
||||
for (int i = 0; i < 1023; i++) {
|
||||
for (int i = 0; i < TextWindowUnk::BUF_SIZE; i++) {
|
||||
if (mData[i].displayTimerMaybe >= 0) {
|
||||
if (t == -1) {
|
||||
mData[i].displayTimerMaybe++;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "d/d_gfx.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_lyt_hio.h"
|
||||
#include "d/d_textwindow_unk.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "m/m_vec.h"
|
||||
@@ -96,7 +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++) {
|
||||
for (int i = 0; i < TextWindowUnk::BUF_SIZE; i++) {
|
||||
mCharacterData[i].reset();
|
||||
mTextBuf[i] = L'\0';
|
||||
}
|
||||
@@ -265,7 +266,7 @@ bool dLytMsgWindowSword_c::execute() {
|
||||
void dLytMsgWindowSword_c::draw() {
|
||||
mLyt.draw();
|
||||
|
||||
for (int i = 0; i < 1023; i++) {
|
||||
for (int i = 0; i < TextWindowUnk::BUF_SIZE; i++) {
|
||||
if (mCharacterData[i].displayTimerMaybe >= 0) {
|
||||
if (!mHasDrawnThisTick) {
|
||||
mCharacterData[i].displayTimerMaybe += 1;
|
||||
@@ -313,15 +314,14 @@ bool dLytMsgWindowSword_c::isDoneClosing() const {
|
||||
}
|
||||
|
||||
bool dLytMsgWindowSword_c::setText(const wchar_t *text) {
|
||||
int foundIdx = 1023;
|
||||
for (int i = 0; i < 1023; i++) {
|
||||
int foundIdx = TextWindowUnk::BUF_SIZE;
|
||||
for (int i = 0; i < TextWindowUnk::BUF_SIZE; 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++) {
|
||||
for (int i = 0; i < TextWindowUnk::BUF_SIZE; i++) {
|
||||
if (i < foundIdx) {
|
||||
mTextBuf[i] = text[i];
|
||||
} else {
|
||||
@@ -333,5 +333,5 @@ bool dLytMsgWindowSword_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(mTextBuf, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(mTextBuf, mpTagProcessor, 0);
|
||||
return foundIdx == 1023;
|
||||
return foundIdx == TextWindowUnk::BUF_SIZE;
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ bool dLytSimpleWindowSword_c::build(d2d::ResAccIf_c *resAcc, dTagProcessor_c *ta
|
||||
mpTextboxes[1]->setIsShadow(1);
|
||||
mpTagProcessor = tagProcessor;
|
||||
|
||||
for (int i = 0; i < (int)ARRAY_LENGTH(mCharData); i++) {
|
||||
for (int i = 0; i < TextWindowUnk::BUF_SIZE; i++) {
|
||||
mCharData[i].reset();
|
||||
mTextBuf[i] = L'\0';
|
||||
}
|
||||
@@ -373,15 +373,14 @@ bool dLytSimpleWindowSword_c::isOut() {
|
||||
}
|
||||
|
||||
bool dLytSimpleWindowSword_c::setText(const wchar_t *text) {
|
||||
int foundIdx = ARRAY_LENGTH(mCharData);
|
||||
for (int i = 0; i < (int)ARRAY_LENGTH(mCharData); i++) {
|
||||
int foundIdx = TextWindowUnk::BUF_SIZE;
|
||||
for (int i = 0; i < TextWindowUnk::BUF_SIZE; i++) {
|
||||
if (mCharData[i].displayTimerMaybe >= 0 && foundIdx > mCharData[i].field_0x0C) {
|
||||
foundIdx = mCharData[i].field_0x0C;
|
||||
}
|
||||
}
|
||||
|
||||
// How is text bounds-checked here????
|
||||
for (int i = 0; i < (int)ARRAY_LENGTH(mCharData); i++) {
|
||||
for (int i = 0; i < TextWindowUnk::BUF_SIZE; i++) {
|
||||
if (i < foundIdx) {
|
||||
mTextBuf[i] = text[i];
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user