Mercurial > mm7
diff mm7_3.cpp @ 176:05682713195c
Обращённый набор изменений: 91fa025e6ca6
author | Ritor1 |
---|---|
date | Fri, 15 Feb 2013 10:32:09 +0600 |
parents | 4ae88cd19c30 |
children | c10509e439f1 |
line wrap: on
line diff
--- a/mm7_3.cpp Fri Feb 15 10:31:17 2013 +0600 +++ b/mm7_3.cpp Fri Feb 15 10:32:09 2013 +0600 @@ -20389,11 +20389,198 @@ v1->z = LODWORD(v14); } - - - - - +//----- (0044C448) -------------------------------------------------------- +GUIFont *LoadFont(const char *pFontFile, const char *pFontPalette, ...) +{ + GUIFont *result; // eax@1 + const char *v3; // edi@1 + const char **v4; // ebx@2 + unsigned int v5; // eax@3 + unsigned __int16 **v6; // ecx@6 + GUIFont *v7; // [sp+4h] [bp-Ch]@1 + int v8; // [sp+8h] [bp-8h]@1 + unsigned __int16 **v9; // [sp+Ch] [bp-4h]@2 + + result = (GUIFont *)pIcons_LOD->LoadRaw(pFontFile, 0); + v3 = pFontPalette; + v8 = 0; + v7 = result; + if ( pFontPalette ) + { + v4 = &pFontPalette; + v9 = result->pFontPalettes; + do + { + v5 = pIcons_LOD->LoadTexture(v3, TEXTURE_16BIT_PALETTE); + if ( v5 == -1 ) + { + sprintf(pTmpBuf, "Unable to open %s", v3); + Abortf(pTmpBuf); + } + ++v4; + v6 = v9; + v3 = *v4; + ++v8; + ++v9; + *v6 = (v5 != -1 ? pIcons_LOD->pTextures[v5].pPalette16 : 0); + } + while ( v3 ); + result = v7; + } + result->field_8 = v8; + return result; +} + + + + +//----- (0044C768) -------------------------------------------------------- +char *__fastcall FitTextInAWindow(const char *pInString, GUIFont *pFont, GUIWindow *pWindow, unsigned int uX, int a5) +{ + const char *v5; // edi@1 + GUIFont *v6; // esi@1 + unsigned int v8; // eax@3 + int v9; // edi@3 + unsigned __int8 v10; // cl@4 + int v11; // edx@10 + GUICharMetric *v12; // ecx@10 + int v13; // edx@11 + int v14; // edx@12 + int v15; // edx@13 + unsigned int v16; // esi@15 + unsigned int v17; // edx@15 + unsigned int v18; // ecx@15 + int v19; // ebx@16 + unsigned __int8 v20; // zf@16 + char v21; // sf@16 + unsigned __int8 v22; // of@16 + int v23; // edi@16 + unsigned __int8 v24; // dl@17 + int v25; // edi@39 + int v26; // eax@42 + std::string v27; // [sp-18h] [bp-40h]@2 + const char *v28; // [sp-8h] [bp-30h]@2 + int v29; // [sp-4h] [bp-2Ch]@2 + const char *v30; // [sp+Ch] [bp-1Ch]@1 + char Str[3]; // [sp+10h] [bp-18h]@42 + char v32; // [sp+13h] [bp-15h]@42 + size_t v33; // [sp+14h] [bp-14h]@3 + unsigned int v34; // [sp+18h] [bp-10h]@3 + GUIFont *v35; // [sp+1Ch] [bp-Ch]@1 + int v36; // [sp+20h] [bp-8h]@3 + int v37; // [sp+24h] [bp-4h]@3 + + v5 = pInString; + v6 = pFont; + v30 = pInString; + v35 = pFont; + if ( !pInString ) + { + MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0); + return 0; + } + v33 = strlen(pInString); + strcpy(pTmpBuf3, v5); + v8 = uX; + v9 = 0; + v36 = 0; + v34 = uX; + v37 = 0; + if ( (signed int)v33 > 0 ) + { + while ( 1 ) + { + v10 = pTmpBuf3[v9]; + if ((v10 < v6->cFirstChar || v10 > v6->cLastChar) + && v10 != '\f' && v10 != '\r' && v10 != '\t' && v10 != '\n' ) + goto LABEL_34; + v11 = v10 - 9; + v12 = &v6->pMetrics[v10]; + if ( !v11 ) + { + strncpy(Str, &pTmpBuf3[v9 + 1], 3u); + v32 = 0; + v26 = atoi(Str); + v8 = uX + v26; + v25 = v9 + 3; + v34 = v8; + goto LABEL_43; + } + v13 = v11 - 1; + if ( !v13 ) + break; + v14 = v13 - 2; + if ( !v14 ) + { + v25 = v9 + 5; +LABEL_43: + v37 = v25; + goto LABEL_34; + } + v15 = v14 - 1; + if ( v15 ) + { + if ( v15 != 19 ) + { + v16 = v12->uRightSpacing; + v17 = v12->uWidth; + v18 = v12->uLeftSpacing; + if ( v8 + v16 + v18 + v17 < pWindow->uFrameWidth ) + { + if ( v37 > v36 ) + v8 += v18; + v8 += v17; + if ( v37 < (signed int)v33 ) + v8 += v16; + v6 = v35; + } + else + { + v19 = v36; + v8 = v34; + v22 = v36 > v37; + v20 = v36 == v37; + v21 = v36 - v37 < 0; + v6 = v35; + pTmpBuf3[v36] = 10; + v23 = v19; + if ( (unsigned __int8)(v21 ^ v22) | v20 ) + { + do + { + v24 = pTmpBuf3[v23]; + if ( v24 >= v6->cFirstChar && v24 <= v6->cLastChar || v24 == 12 || v24 == 13 || v24 == 9 || v24 == 10 ) + { + if ( v23 > v19 ) + v8 += v6->pMetrics[v24].uLeftSpacing; + v8 += *((int *)&v6->cFirstChar + 3 * v24 + 9); + if ( v23 < v37 ) + v8 += v6->pMetrics[v24].uRightSpacing; + } + ++v23; + } + while ( v23 <= v37 ); + } + } + goto LABEL_34; + } + v8 += v12->uWidth; + goto LABEL_41; + } + if ( !a5 ) + return (char *)v30; +LABEL_34: + v9 = v37++ + 1; + if ( v37 >= (signed int)v33 ) + return pTmpBuf3; + } + v8 = v34; +LABEL_41: + v36 = v9; + goto LABEL_34; + } + return pTmpBuf3; +} //----- (00401000) -------------------------------------------------------- void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int)) {