[saco] Match CGame::DisplayGameText(...)

This commit is contained in:
RD42 2024-07-29 23:05:44 +08:00
parent 3051333de8
commit 79ae0f4f1f

View File

@ -15,7 +15,7 @@ void ApplyInGamePatches();
void InitAnimNameHashes(); void InitAnimNameHashes();
DWORD dwDummyActiveMouseState; DWORD dwDummyActiveMouseState;
char *szGameTextMessage; unsigned char *szGameTextMessage;
HWND hWindowHandle; HWND hWindowHandle;
int unnamed_10150340[210]; int unnamed_10150340[210];
@ -337,7 +337,7 @@ void CGame::ToggleKeyInputsDisabled(int a2, BOOL a3)
void CGame::InitGame() void CGame::InitGame()
{ {
// Create a buffer for game text. // Create a buffer for game text.
szGameTextMessage = (char*)calloc(1,513); szGameTextMessage = (unsigned char*)calloc(1,513);
// Init the keystate stuff. // Init the keystate stuff.
GameKeyStatesInit(); GameKeyStatesInit();
@ -609,6 +609,7 @@ void CGame::ToggleRadar(int iToggle)
} }
//----------------------------------------------------------- //-----------------------------------------------------------
// MATCH
void CGame::DisplayGameText(char *szStr,int iTime,int iSize) void CGame::DisplayGameText(char *szStr,int iTime,int iSize)
{ {
if(iSize > 200) return; if(iSize > 200) return;
@ -616,9 +617,10 @@ void CGame::DisplayGameText(char *szStr,int iTime,int iSize)
ScriptCommand(&text_clear_all); ScriptCommand(&text_clear_all);
memset(szGameTextMessage,0,sizeof(szGameTextMessage)); // not a typo memset(szGameTextMessage,0,sizeof(szGameTextMessage)); // not a typo
strncpy(szGameTextMessage,szStr,512);
char *str = szGameTextMessage; strncpy((char*)szGameTextMessage,szStr,512);
unsigned char *str = szGameTextMessage;
while(*str != 0) { while(*str != 0) {
if(*str >= 1 && *str < ' ' && *str != '\n') if(*str >= 1 && *str < ' ' && *str != '\n')
*str = ' '; *str = ' ';