Mercurial > mm7
comparison mm7_3.cpp @ 160:933e2655c33d
FitTextInAWindow clean, but broke something accidentaly
author | zipi |
---|---|
date | Thu, 14 Feb 2013 07:48:40 +0000 |
parents | 8e0e2991f9d1 |
children | 71b13d70f5a6 |
comparison
equal
deleted
inserted
replaced
159:3235bc4cf78e | 160:933e2655c33d |
---|---|
19546 | 19546 |
19547 | 19547 |
19548 //----- (0044C768) -------------------------------------------------------- | 19548 //----- (0044C768) -------------------------------------------------------- |
19549 char *__fastcall FitTextInAWindow(const char *pInString, GUIFont *pFont, GUIWindow *pWindow, unsigned int uX, int a5) | 19549 char *__fastcall FitTextInAWindow(const char *pInString, GUIFont *pFont, GUIWindow *pWindow, unsigned int uX, int a5) |
19550 { | 19550 { |
19551 const char *v5; // edi@1 | |
19552 GUIFont *v6; // esi@1 | |
19553 unsigned int v8; // eax@3 | 19551 unsigned int v8; // eax@3 |
19554 int v9; // edi@3 | |
19555 unsigned __int8 v10; // cl@4 | 19552 unsigned __int8 v10; // cl@4 |
19556 int v11; // edx@10 | |
19557 GUICharMetric *v12; // ecx@10 | 19553 GUICharMetric *v12; // ecx@10 |
19558 int v13; // edx@11 | |
19559 int v14; // edx@12 | |
19560 int v15; // edx@13 | |
19561 unsigned int v16; // esi@15 | 19554 unsigned int v16; // esi@15 |
19562 unsigned int v17; // edx@15 | 19555 unsigned int v17; // edx@15 |
19563 unsigned int v18; // ecx@15 | 19556 unsigned int v18; // ecx@15 |
19564 int v19; // ebx@16 | |
19565 unsigned __int8 v20; // zf@16 | |
19566 char v21; // sf@16 | |
19567 unsigned __int8 v22; // of@16 | |
19568 int v23; // edi@16 | |
19569 unsigned __int8 v24; // dl@17 | 19557 unsigned __int8 v24; // dl@17 |
19570 int v25; // edi@39 | 19558 int v25; // edi@39 |
19571 int v26; // eax@42 | 19559 int v26; // eax@42 |
19572 std::string v27; // [sp-18h] [bp-40h]@2 | 19560 std::string v27; // [sp-18h] [bp-40h]@2 |
19573 const char *v28; // [sp-8h] [bp-30h]@2 | 19561 const char *v28; // [sp-8h] [bp-30h]@2 |
19574 int v29; // [sp-4h] [bp-2Ch]@2 | 19562 int v29; // [sp-4h] [bp-2Ch]@2 |
19575 const char *v30; // [sp+Ch] [bp-1Ch]@1 | |
19576 char Str[3]; // [sp+10h] [bp-18h]@42 | 19563 char Str[3]; // [sp+10h] [bp-18h]@42 |
19577 char v32; // [sp+13h] [bp-15h]@42 | 19564 char v32; // [sp+13h] [bp-15h]@42 |
19578 size_t v33; // [sp+14h] [bp-14h]@3 | 19565 int v33; // [sp+14h] [bp-14h]@3 |
19579 unsigned int v34; // [sp+18h] [bp-10h]@3 | |
19580 GUIFont *v35; // [sp+1Ch] [bp-Ch]@1 | |
19581 int v36; // [sp+20h] [bp-8h]@3 | 19566 int v36; // [sp+20h] [bp-8h]@3 |
19582 int v37; // [sp+24h] [bp-4h]@3 | 19567 |
19583 | |
19584 v5 = pInString; | |
19585 v6 = pFont; | |
19586 v30 = pInString; | |
19587 v35 = pFont; | |
19588 if ( !pInString ) | 19568 if ( !pInString ) |
19589 { | 19569 { |
19590 MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0); | 19570 MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0); |
19591 return 0; | 19571 return 0; |
19592 } | 19572 } |
19593 v33 = strlen(pInString); | 19573 v33 = strlen(pInString); |
19594 strcpy(pTmpBuf3, v5); | 19574 strcpy(pTmpBuf3, pInString); |
19595 v8 = uX; | 19575 v8 = uX; |
19596 v9 = 0; | |
19597 v36 = 0; | 19576 v36 = 0; |
19598 v34 = uX; | 19577 for(int i=0;i<v33;i++) |
19599 v37 = 0; | 19578 { |
19600 if ( (signed int)v33 > 0 ) | 19579 v10 = pTmpBuf3[i]; |
19601 { | 19580 if(!(v10 < pFont->cFirstChar || v10 > pFont->cLastChar) || v10 == '\f' || v10 == '\r' || v10 == '\t' || v10 == '\n' ) |
19602 while ( 1 ) | 19581 { |
19603 { | 19582 v12 = &pFont->pMetrics[v10]; |
19604 v10 = pTmpBuf3[v9]; | 19583 if ( v10 == '\t' ) |
19605 if ((v10 < v6->cFirstChar || v10 > v6->cLastChar) | 19584 { |
19606 && v10 != '\f' && v10 != '\r' && v10 != '\t' && v10 != '\n' ) | 19585 strncpy(Str, &pTmpBuf3[i + 1], 3u); |
19607 goto LABEL_34; | 19586 v32 = 0; |
19608 v11 = v10 - 9; | 19587 v26 = atoi(Str); |
19609 v12 = &v6->pMetrics[v10]; | 19588 v8 = uX + v26; |
19610 if ( !v11 ) | 19589 i+=3; |
19611 { | 19590 } |
19612 strncpy(Str, &pTmpBuf3[v9 + 1], 3u); | 19591 else if ( v10 == '\n' ) |
19613 v32 = 0; | 19592 { |
19614 v26 = atoi(Str); | 19593 v36 = i; |
19615 v8 = uX + v26; | 19594 } |
19616 v25 = v9 + 3; | 19595 else if ( v10 == '\f' ) |
19617 v34 = v8; | 19596 { |
19618 goto LABEL_43; | 19597 i+=5; |
19619 } | 19598 } |
19620 v13 = v11 - 1; | 19599 else if ( v10 == '\r' && !a5) |
19621 if ( !v13 ) | 19600 return (char *)pInString; |
19622 break; | 19601 else if ( v10 == ' ' ) |
19623 v14 = v13 - 2; | 19602 { |
19624 if ( !v14 ) | 19603 v8 += v12->uWidth; |
19625 { | 19604 v36 = i; |
19626 v25 = v9 + 5; | 19605 } |
19627 LABEL_43: | 19606 else |
19628 v37 = v25; | 19607 { |
19629 goto LABEL_34; | 19608 v16 = v12->uRightSpacing; |
19630 } | 19609 v17 = v12->uWidth; |
19631 v15 = v14 - 1; | 19610 v18 = v12->uLeftSpacing; |
19632 if ( v15 ) | 19611 if ( v8 + v16 + v18 + v17 < pWindow->uFrameWidth ) |
19633 { | 19612 { |
19634 if ( v15 != 19 ) | 19613 if ( i > v36 ) |
19635 { | 19614 v8 += v18; |
19636 v16 = v12->uRightSpacing; | 19615 v8 += v17; |
19637 v17 = v12->uWidth; | 19616 if ( i < v33 ) |
19638 v18 = v12->uLeftSpacing; | 19617 v8 += v16; |
19639 if ( v8 + v16 + v18 + v17 < pWindow->uFrameWidth ) | 19618 } |
19640 { | 19619 else |
19641 if ( v37 > v36 ) | 19620 { |
19642 v8 += v18; | 19621 pTmpBuf3[v36] = 10; |
19643 v8 += v17; | 19622 if ( v36 == i )//(unsigned __int8)(v21 ^ v22) | v20 ) |
19644 if ( v37 < (signed int)v33 ) | 19623 { |
19645 v8 += v16; | 19624 for(int j=v36;j<=i;j++) |
19646 v6 = v35; | 19625 { |
19647 } | 19626 v24 = pTmpBuf3[j]; |
19648 else | 19627 if ( v24 >= pFont->cFirstChar && v24 <= pFont->cLastChar || v24 == '\f' || v24 == '\r' || v24 == '\t' || v24 == '\n' ) |
19649 { | 19628 { |
19650 v19 = v36; | 19629 if ( j > v36 ) |
19651 v8 = v34; | 19630 v8 += pFont->pMetrics[v24].uLeftSpacing; |
19652 v22 = v36 > v37; | 19631 v8 += pFont->pMetrics[v24].uWidth;//*((int *)&pFont->cFirstChar + 3 * v24 + 9); |
19653 v20 = v36 == v37; | 19632 if ( j < i ) |
19654 v21 = v36 - v37 < 0; | 19633 v8 += pFont->pMetrics[v24].uRightSpacing; |
19655 v6 = v35; | 19634 } |
19656 pTmpBuf3[v36] = 10; | 19635 } |
19657 v23 = v19; | 19636 } |
19658 if ( (unsigned __int8)(v21 ^ v22) | v20 ) | 19637 } |
19659 { | 19638 } |
19660 do | 19639 } |
19661 { | |
19662 v24 = pTmpBuf3[v23]; | |
19663 if ( v24 >= v6->cFirstChar && v24 <= v6->cLastChar || v24 == 12 || v24 == 13 || v24 == 9 || v24 == 10 ) | |
19664 { | |
19665 if ( v23 > v19 ) | |
19666 v8 += v6->pMetrics[v24].uLeftSpacing; | |
19667 v8 += *((int *)&v6->cFirstChar + 3 * v24 + 9); | |
19668 if ( v23 < v37 ) | |
19669 v8 += v6->pMetrics[v24].uRightSpacing; | |
19670 } | |
19671 ++v23; | |
19672 } | |
19673 while ( v23 <= v37 ); | |
19674 } | |
19675 } | |
19676 goto LABEL_34; | |
19677 } | |
19678 v8 += v12->uWidth; | |
19679 goto LABEL_41; | |
19680 } | |
19681 if ( !a5 ) | |
19682 return (char *)v30; | |
19683 LABEL_34: | |
19684 v9 = v37++ + 1; | |
19685 if ( v37 >= (signed int)v33 ) | |
19686 return pTmpBuf3; | |
19687 } | |
19688 v8 = v34; | |
19689 LABEL_41: | |
19690 v36 = v9; | |
19691 goto LABEL_34; | |
19692 } | 19640 } |
19693 return pTmpBuf3; | 19641 return pTmpBuf3; |
19694 } | 19642 } |
19695 //----- (00401000) -------------------------------------------------------- | 19643 //----- (00401000) -------------------------------------------------------- |
19696 void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int)) | 19644 void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int)) |