From b9838963acf2d13a287b46c06c2040df8c6a35ff Mon Sep 17 00:00:00 2001 From: robojumper Date: Tue, 29 Oct 2024 22:34:01 +0100 Subject: [PATCH] Some repair --- src/d/d_tag_processor.cpp | 71 ++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/src/d/d_tag_processor.cpp b/src/d/d_tag_processor.cpp index 7d6a2361..b398d09d 100644 --- a/src/d/d_tag_processor.cpp +++ b/src/d/d_tag_processor.cpp @@ -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(); @@ -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: @@ -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) { @@ -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]++; @@ -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; @@ -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);