Skip to content

Commit

Permalink
Some repair
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Oct 29, 2024
1 parent 414f80b commit b983896
Showing 1 changed file with 37 additions and 34 deletions.
71 changes: 37 additions & 34 deletions src/d/d_tag_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
getTextCommand(c, src + 1, &cmdLen, &cmd, &endPtr);
bool bVar3 = false;
switch (cmd) {
case 0x20001: writePtr = fn_800B5680(writePtr, endPtr, &local_b4, state4); break;
case 0x10008:
if (textBox != nullptr) {
float2 = fn_800B8040(((char *)endPtr)[0], field_0x90C) * textBox->getMyScale();
Expand Down Expand Up @@ -317,8 +316,7 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
} break;
case 0x10009: fn_800B5570(dest, &local_b4, state4); break;
case 0x10010: fn_800B5520(endPtr); break;

case 0x30001: field_0xEF1 = 1; break;
case 0x20001: writePtr = fn_800B5680(writePtr, endPtr, &local_b4, state4); break;
case 0x20002: writePtr = fn_800B5860(dest, endPtr, &local_b4, state4); break;
case 0x20003: writePtr = fn_800B5A20(dest, endPtr, &local_b4, state4); break;
case 0x20004:
Expand All @@ -338,6 +336,7 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
writePtr = writeTextNormal(dest, writePtr, &local_b4, cmdLen, state4);
float2 = tmp;
} break;
case 0x30001: field_0xEF1 = 1; break;

case 0x0F0F0F0F:
if (state4 == 0 || field_0x90E == 0) {
Expand All @@ -346,7 +345,7 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
writePtr++;
}
} else {
for (int i = (cmdLen / 2) + 1; i != 0; i--) {
for (int i = 0; i < (cmdLen / 2) + 1; i++) {
field_0x008[field_0x90E - 1][local_b4] = src[i];
if (field_0x90E >= 1 && field_0x90E < 5) {
field_0x808[field_0x90E - 1]++;
Expand All @@ -355,6 +354,7 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
}
}
break;
case 0x30004:
case 0x0F0F0F0E: writePtr = fn_800B5DD0(writePtr, endPtr, &local_b4, state4); break;

default: writePtr = writeTextNormal(dest, writePtr, &local_b4, cmdLen, state4); break;
Expand All @@ -378,41 +378,44 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
writePtr[1] = src[1];
writePtr[2] = src[2];
writePtr += 3;
} else if (state4 == 0 && field_0x90E == 0) {
if (textBox == nullptr) {
writePtr = fn_800B5FD0(c, writePtr, nullptr);
src++;
} else if (c == 10) {
*(writePtr++) = *(src++);
mCommandInsert++;
s32 i10 = mapSomething(field_0x90C);
if (mCommandInsert % i10 == 0) {
float2 = fn_800B8040(0, field_0x90C);
float2 *= textBox->getMyScale();
}
if (textBox != nullptr) {
wchar_t *buf = (wchar_t *)&x;
writePtr[0] = buf[0];
writePtr[2] = buf[1];
writePtr[3] = buf[2];
writePtr[4] = buf[3];
writePtr[5] = mCommandInsert;
writePtr += 6;
}
} else {
const nw4r::ut::Font *fnt = textBox->GetFont();
f32 charSpace = textBox->GetCharSpace();
f32 w = fnt->GetCharWidth(*src);
field_0x914[mCommandInsert] = field_0x914[mCommandInsert] + float2 * w + charSpace;
fn_800B5FD0(*src, writePtr, nullptr);
src++;
}
} else {
} else if (state4 != 0 && field_0x90E != 0) {
fn_800B5FD0(c, &field_0x008[field_0x90E - 1][local_b4], &local_b4);
src++;
if (field_0x90E >= 1 && field_0x90E < 5) {
field_0x808[field_0x90E - 1]++;
}
} else {
if (textBox != nullptr) {
if (c == 10) {
*(writePtr++) = *(src++);
mCommandInsert++;
s32 i10 = mapSomething(field_0x90C);
if (mCommandInsert % i10 == 0) {
float2 = fn_800B8040(0, field_0x90C);
float2 *= textBox->getMyScale();
}
if (textBox != nullptr) {
wchar_t *buf = (wchar_t *)&x;
writePtr[0] = buf[0];
writePtr[2] = buf[1];
writePtr[3] = buf[2];
writePtr[4] = buf[3];
writePtr[5] = mCommandInsert;
writePtr += 6;
}
} else {
const nw4r::ut::Font *fnt = textBox->GetFont();
f32 charSpace = textBox->GetCharSpace();
f32 w = fnt->GetCharWidth(*src);
field_0x914[mCommandInsert] = field_0x914[mCommandInsert] + float2 * w + charSpace;
fn_800B5FD0(*src, writePtr, nullptr);
src++;
}

} else {
writePtr = fn_800B5FD0(c, writePtr, nullptr);
src++;
}
}

} while (destLen > writePtr - dest);
Expand Down

0 comments on commit b983896

Please sign in to comment.