1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 16:30:01 +00:00

Messages, fix Font

This commit is contained in:
erorcun 2020-10-20 22:19:05 +03:00
parent a1112183de
commit 0750f04019
3 changed files with 33 additions and 19 deletions

View file

@ -4126,6 +4126,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
CMessages::AddMessageJumpQ(key, ScriptParams[0], ScriptParams[1]); CMessages::AddMessageJumpQ(key, ScriptParams[0], ScriptParams[1]);
return 0; return 0;
} }
/*
case COMMAND_PRINT_SOON: case COMMAND_PRINT_SOON:
{ {
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
@ -4133,6 +4134,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
CMessages::AddMessageSoon(key, ScriptParams[0], ScriptParams[1]); CMessages::AddMessageSoon(key, ScriptParams[0], ScriptParams[1]);
return 0; return 0;
} }
*/
case COMMAND_CLEAR_PRINTS: case COMMAND_CLEAR_PRINTS:
CMessages::ClearMessages(); CMessages::ClearMessages();
return 0; return 0;

View file

@ -475,10 +475,14 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
bool first; bool first;
wchar *start, *t; wchar *start, *t;
Details.bFlash = false;
if(*s == '*') if(*s == '*')
return; return;
Details.anonymous_25++;
if(Details.background){ if(Details.background){
RenderState.color = Details.color;
GetNumberLines(xstart, ystart, s); // BUG: result not used GetNumberLines(xstart, ystart, s); // BUG: result not used
GetTextRect(&rect, xstart, ystart, s); GetTextRect(&rect, xstart, ystart, s);
CSprite2d::DrawRect(rect, Details.backgroundColor); CSprite2d::DrawRect(rect, Details.backgroundColor);
@ -1292,6 +1296,7 @@ CFont::RenderFontBuffer()
RenderState = *(CFontRenderState*)&FontRenderStateBuf[0]; RenderState = *(CFontRenderState*)&FontRenderStateBuf[0];
textPosX = RenderState.fTextPosX; textPosX = RenderState.fTextPosX;
textPosY = RenderState.fTextPosY; textPosY = RenderState.fTextPosY;
color = RenderState.color;
tFontRenderStatePointer pRenderStateBufPointer; tFontRenderStatePointer pRenderStateBufPointer;
pRenderStateBufPointer.pRenderState = (CFontRenderState*)&FontRenderStateBuf[0]; pRenderStateBufPointer.pRenderState = (CFontRenderState*)&FontRenderStateBuf[0];
for (++pRenderStateBufPointer.pRenderState; pRenderStateBufPointer.pStr < FontRenderStatePointer.pStr; pRenderStateBufPointer.pStr++) { for (++pRenderStateBufPointer.pRenderState; pRenderStateBufPointer.pStr < FontRenderStatePointer.pStr; pRenderStateBufPointer.pStr++) {

View file

@ -11,6 +11,8 @@
#include "Font.h" #include "Font.h"
// --MIAMI: file done
tMessage CMessages::BriefMessages[NUMBRIEFMESSAGES]; tMessage CMessages::BriefMessages[NUMBRIEFMESSAGES];
tPreviousBrief CMessages::PreviousBriefs[NUMPREVIOUSBRIEFS]; tPreviousBrief CMessages::PreviousBriefs[NUMPREVIOUSBRIEFS];
tBigMessage CMessages::BIGMessages[NUMBIGMESSAGES]; tBigMessage CMessages::BIGMessages[NUMBIGMESSAGES];
@ -70,7 +72,7 @@ CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size)
return false; return false;
for (int32 i = 0; i < size; i++) { for (int32 i = 0; i < size; i++) {
if (FixupChar(str1[i]) == '\0') if (FixupChar(str1[i]) == '\0' || i > size)
break; break;
if (FixupChar(str1[i]) != FixupChar(str2[i])) if (FixupChar(str1[i]) != FixupChar(str2[i]))
@ -297,6 +299,7 @@ CMessages::AddBigMessage(wchar *msg, uint32 time, uint16 style)
BIGMessages[style].m_Stack[0].m_nNumber[5] = -1; BIGMessages[style].m_Stack[0].m_nNumber[5] = -1;
BIGMessages[style].m_Stack[0].m_pString = nil; BIGMessages[style].m_Stack[0].m_pString = nil;
} }
void void
CMessages::AddBigMessageQ(wchar *msg, uint32 time, uint16 style) CMessages::AddBigMessageQ(wchar *msg, uint32 time, uint16 style)
{ {
@ -327,10 +330,8 @@ CMessages::AddBigMessageQ(wchar *msg, uint32 time, uint16 style)
void void
CMessages::AddToPreviousBriefArray(wchar *text, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, wchar *string) CMessages::AddToPreviousBriefArray(wchar *text, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, wchar *string)
{ {
int32 i = 0; int32 i;
while (i < NUMPREVIOUSBRIEFS) { for (i = 0; PreviousBriefs[i].m_pText && i < NUMPREVIOUSBRIEFS; i++) {
if (PreviousBriefs[i].m_pText == nil)
break;
if (PreviousBriefs[i].m_nNumber[0] == n1 if (PreviousBriefs[i].m_nNumber[0] == n1
&& PreviousBriefs[i].m_nNumber[1] == n2 && PreviousBriefs[i].m_nNumber[1] == n2
&& PreviousBriefs[i].m_nNumber[2] == n3 && PreviousBriefs[i].m_nNumber[2] == n3
@ -340,8 +341,6 @@ CMessages::AddToPreviousBriefArray(wchar *text, int32 n1, int32 n2, int32 n3, in
&& PreviousBriefs[i].m_pText == text && PreviousBriefs[i].m_pText == text
&& PreviousBriefs[i].m_pString == string) && PreviousBriefs[i].m_pString == string)
return; return;
i++;
} }
if (i != 0) { if (i != 0) {
@ -374,6 +373,14 @@ CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32
return; return;
} }
sprintf(numStr, "%d", n1);
size_t outLen = strlen(numStr);
AsciiToUnicode(numStr, wNumStr);
if (str[0] == 0) {
*outstr = '\0';
return;
}
int32 size = GetWideStringLength(str); int32 size = GetWideStringLength(str);
int32 i = 0; int32 i = 0;
@ -385,6 +392,11 @@ CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32
#else #else
if (str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~') { if (str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~') {
#endif #endif
c += 3;
for (int j=0; j<outLen; j++)
*(outstr++) = wNumStr[j++];
i++;
switch (i) { switch (i) {
case 0: sprintf(numStr, "%d", n1); break; case 0: sprintf(numStr, "%d", n1); break;
case 1: sprintf(numStr, "%d", n2); break; case 1: sprintf(numStr, "%d", n2); break;
@ -393,14 +405,8 @@ CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32
case 4: sprintf(numStr, "%d", n5); break; case 4: sprintf(numStr, "%d", n5); break;
case 5: sprintf(numStr, "%d", n6); break; case 5: sprintf(numStr, "%d", n6); break;
} }
i++; outLen = strlen(numStr);
AsciiToUnicode(numStr, wNumStr); AsciiToUnicode(numStr, wNumStr);
int j = 0;
while (wNumStr[j] != '\0')
*(outstr++) = wNumStr[j++];
c += 3;
} else { } else {
*(outstr++) = str[c++]; *(outstr++) = str[c++];
} }
@ -424,10 +430,9 @@ CMessages::InsertStringInString(wchar *str1, wchar *str2)
for (i = 0; i < total_size; ) { for (i = 0; i < total_size; ) {
#ifdef MORE_LANGUAGES #ifdef MORE_LANGUAGES
if ((CFont::IsJapanese() && *_str1 == (0x8000 | '~') && *(_str1 + 1) == (0x8000 | 'a') && *(_str1 + 2) == (0x8000 | '~')) if ((CFont::IsJapanese() && *_str1 == (0x8000 | '~') && *(_str1 + 1) == (0x8000 | 'a') && *(_str1 + 2) == (0x8000 | '~'))
|| (*_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~')) || (*_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~')) {
{
#else #else
if (*_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~') { if (*_str1 == '~' && *(_str1 + 1) == 'a' && *(_str1 + 2) == '~') {
#endif #endif
_str1 += 3; _str1 += 3;
for (int j = 0; j < str2_size; j++) { for (int j = 0; j < str2_size; j++) {
@ -466,10 +471,12 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') { if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') {
#endif #endif
i += 4; i += 4;
for (int32 cont = 0; cont < MAX_CONTROLLERACTIONS; cont++) { bool done = false;
for (int32 cont = 0; cont < MAX_CONTROLLERACTIONS && !done; cont++) {
uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]); uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]);
if (contSize != 0) { if (contSize != 0) {
if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) { if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) {
done = true;
ControlsManager.GetWideStringOfCommandKeys(cont, keybuf, 256); ControlsManager.GetWideStringOfCommandKeys(cont, keybuf, 256);
uint16 keybuf_size = GetWideStringLength(keybuf); uint16 keybuf_size = GetWideStringLength(keybuf);
for (uint16 j = 0; j < keybuf_size; j++) { for (uint16 j = 0; j < keybuf_size; j++) {
@ -751,7 +758,7 @@ CMessages::ClearThisPrint(wchar *str)
} }
BriefMessages[i].m_pText = nil; BriefMessages[i].m_pText = nil;
BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds(); BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
if (BriefMessages[0].m_pText == nil) if (BriefMessages[0].m_pText != nil)
AddToPreviousBriefArray( AddToPreviousBriefArray(
BriefMessages[0].m_pText, BriefMessages[0].m_pText,
BriefMessages[0].m_nNumber[0], BriefMessages[0].m_nNumber[0],