Mercurial > mm7
diff mm7_3.cpp @ 329:f76027321087
LoadLevel_InitializeLevelStr
author | Gloval |
---|---|
date | Wed, 20 Feb 2013 21:35:13 +0400 |
parents | d720a13e2273 |
children | ea55d6414029 |
line wrap: on
line diff
--- a/mm7_3.cpp Wed Feb 20 17:37:33 2013 +0600 +++ b/mm7_3.cpp Wed Feb 20 21:35:13 2013 +0400 @@ -14156,59 +14156,47 @@ //----- (00443E31) -------------------------------------------------------- void __cdecl LoadLevel_InitializeLevelStr() { - signed __int16 v0; // si@1 - //unsigned int v1; // ecx@1 - signed int v2; // edi@1 - int v3; // edx@1 - //int v4; // eax@2 - int v5; // ebx@4 - int v6; // ebx@11 - int v7; // eax@12 - unsigned int *v8; // edi@13 - char Args[100]; // [sp+Ch] [bp-68h]@9 - int v10; // [sp+70h] [bp-4h]@1 - - if (sizeof(pLevelStrOffsets) != 0x7D0) + + char Args[100]; + int string_num; + int max_string_length; + int current_string_length; + int prev_string_offset; + + if (sizeof(pLevelStrOffsets) != 2000) Log::Warning(L"pLevelStrOffsets: deserialization warning"); - memset(pLevelStrOffsets, 0, 0x7D0u); + memset(pLevelStrOffsets, 0, 2000); - v0 = 0; - //v1 = uLevelStrFileSize; - v2 = 1; - v3 = 0; - v10 = 0; - //v4 = 0; + max_string_length = 0; + string_num = 1; + prev_string_offset = 0; + for (uint i = 0; i < uLevelStrFileSize; ++i) { if ( !pLevelStr[i] ) { - v5 = (signed __int16)v2++; - pLevelStrOffsets[v5] = i + 1; - if ( (signed __int16)(i - (short)v10) > v0 ) - v0 = i - v10; - v10 = i; - } - } - - uLevelStrNumStrings = (signed __int16)v2 - 1; - if ( v0 > 800 ) - { - sprintf(Args, "MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", v0 + 1); + pLevelStrOffsets[string_num] = i + 1; + ++string_num; + if ( i - prev_string_offset > max_string_length ) + max_string_length = i - prev_string_offset; + prev_string_offset = i; + } + } + + uLevelStrNumStrings = string_num - 1; + if ( max_string_length > 800 ) + { + sprintf(Args, "MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length+1); Abortf(Args); } - v6 = 0; - if ( (signed __int16)v2 - 1 > 0 ) - { - v7 = 0; - do - { - v8 = &pLevelStrOffsets[v7]; - if ( RemoveQuotes(&pLevelStr[*v8]) != &pLevelStr[*v8] ) - ++*v8; - ++v6; - v7 = (signed __int16)v6; - } - while ( (signed __int16)v6 < (signed int)uLevelStrNumStrings ); + + if ( uLevelStrNumStrings > 0 ) + { + for(uint i = 1; i <uLevelStrNumStrings ; ++i) + { + if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] ) + ++pLevelStrOffsets[i]; + } } }