Mercurial > might-and-magic-trilogy
diff mm7_2.cpp @ 2:2ca04ccb612a
NoCD, main menu, various
author | Nomad |
---|---|
date | Wed, 10 Oct 2012 14:21:15 +0200 |
parents | ac0fb48cd27a |
children | 540178ef9b18 |
line wrap: on
line diff
--- a/mm7_2.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/mm7_2.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -546,7 +546,7 @@ { v65 = pFontArrus; pOutString = pFontArrus; - strcpy(pTmpBuf, pStr_72217C); + strcpy(pTmpBuf, pNPCTopics[354].pText); v78.uFrameWidth = 460; v78.uFrameZ = 452; v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; @@ -596,7 +596,7 @@ v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; goto LABEL_98; } - strcpy(pTmpBuf, *(const char **)&dword_721E24[8 * (unsigned int)ptr_507BC0->ptr_1C]); + strcpy(pTmpBuf, pNPCTopics[(uint)ptr_507BC0->ptr_1C + 247].pText); v78.uFrameWidth = 460; v78.uFrameZ = 452; v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0); @@ -3132,7 +3132,7 @@ // 50C9DC: using guessed type int dword_50C9DC; //----- (004BBA85) -------------------------------------------------------- -int __cdecl sub_4BBA85_bounties() +const char *sub_4BBA85_bounties() { int v0; // edi@1 signed __int64 v1; // qax@2 @@ -3142,11 +3142,11 @@ __int16 v5; // ax@14 char v6; // zf@14 Player *v7; // ebx@16 - int result; // eax@19 + const char *result; // eax@19 uDialogueType = 83; pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640u, 350u, WINDOW_Credits, 0, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0); ptr_5076F4 = pDialogueWindow->CreateButton( 471u, 445u, @@ -3158,7 +3158,7 @@ 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), + (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, nullstring, 0); pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, nullstring, 0); @@ -3193,9 +3193,9 @@ if ( v6 ) { v6 = v5 == 0; - result = dword_722164; + result = pNPCTopics[351].pText; if ( v6 ) - result = dword_722174; + result = pNPCTopics[353].pText; } else { @@ -3213,16 +3213,11 @@ pParty->field_750[v4] = 0; pParty->field_75A[v4] = 0; } - result = dword_72216C; + result = pNPCTopics[352].pText; } dword_F8B1A4 = (char *)result; return result; } -// 722164: using guessed type int dword_722164; -// 72216C: using guessed type int dword_72216C; -// 722174: using guessed type int dword_722174; -// F8B19C: using guessed type int dword_F8B19C; -// F8B1A0: using guessed type __int16 word_F8B1A0; //----- (004BBCDD) -------------------------------------------------------- void __cdecl sub_4BBCDD() @@ -3698,7 +3693,7 @@ GUIButton *__cdecl sub_4BCA33() { pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 0x280u, 0x159u, WINDOW_Credits, 0, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); ptr_5076F4 = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, @@ -3814,12 +3809,12 @@ { LABEL_9: pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 0x280u, 0x159u, WINDOW_Credits, v1, v1); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1); ptr_5076F4 = pDialogueWindow->CreateButton( - 526u, - 445u, - 75u, - 33u, + 526, + 445, + 75, + 33, 1, v1, 0x71u, @@ -4081,9 +4076,9 @@ { v1 = 0; v27 = v26 == v13; - v29 = dword_722164; + v29 = (int)pNPCTopics[351].pText; if ( v27 ) - v29 = dword_722174; + v29 = (int)pNPCTopics[353].pText; dword_F8B1A4 = (char *)v29; } else @@ -4103,7 +4098,7 @@ pParty->field_75A[v25] = v13; } v1 = 0; - dword_F8B1A4 = (char *)dword_72216C; + dword_F8B1A4 = pNPCTopics[352].pText; } goto LABEL_196; } @@ -4121,12 +4116,12 @@ switch ( v55 ) { case 96: - pDialogueWindow->uWindowType = 1; + pDialogueWindow->eWindowType = WINDOW_MainMenu; sub_4BCA33(); sub_4B3703((void *)dword_F8B198); break; case 101: - pDialogueWindow->uWindowType = 1; + pDialogueWindow->eWindowType = WINDOW_MainMenu; sub_4BCA33(); sub_4B3A72(dword_F8B198); break; @@ -4203,7 +4198,7 @@ { if ( v55 == 94 ) { - pDialogueWindow->uWindowType = 1; + pDialogueWindow->eWindowType = WINDOW_MainMenu; sub_4BCA33(); sub_4B3AD4(dword_F8B198); } @@ -5115,7 +5110,7 @@ pRenderer->EndScene(); free(_this.pPixels); _this.pPixels = 0; - ptr_507BC0 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_Credits, 0, 0); + ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); pWindow.uFrameX = 75; pWindow.uFrameY = 60; pWindow.uFrameWidth = 469; @@ -6120,12 +6115,14 @@ //----- (00451007) -------------------------------------------------------- -int stru350::sub_451007_scale_image_bicubic(int a2, signed int a3, signed int a4, int a5, signed int a6, signed int a7, signed int a8, int a9, int a10, int a11) -{ - signed int v11; // esi@1 - signed int result; // eax@1 - signed int v13; // edi@8 - signed int v14; // ecx@10 +int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch, + unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, + int a10, int a11) +{ + int v11; // esi@1 + int result; // eax@1 + int v13; // edi@8 + int v14; // ecx@10 double v15; // st7@11 double v16; // st6@11 float v17; // ST3C_4@12 @@ -6135,9 +6132,9 @@ int v21; // eax@18 unsigned int v22; // ecx@25 unsigned int v23; // eax@29 - signed int v24; // ecx@29 - signed int v25; // edi@33 - signed int v26; // ecx@35 + unsigned __int16 *v24; // ecx@29 + int v25; // edi@33 + int v26; // ecx@35 double v27; // st7@36 double v28; // st6@36 float v29; // ST34_4@37 @@ -6146,10 +6143,10 @@ int v32; // eax@41 int v33; // eax@43 unsigned int v34; // ecx@50 - __int16 v35; // ax@54 - signed int v36; // ecx@54 - signed int v37; // edi@58 - signed int v38; // ecx@60 + unsigned __int16 v35; // ax@54 + unsigned __int16 *v36; // ecx@54 + int v37; // edi@58 + int v38; // ecx@60 double v39; // st7@61 double v40; // st6@61 float v41; // ST34_4@62 @@ -6159,9 +6156,9 @@ int v45; // eax@68 unsigned int v46; // ecx@75 char v47; // al@79 - signed int v48; // ecx@79 - signed int v49; // edi@86 - signed int v50; // ecx@88 + unsigned __int16 *v48; // ecx@79 + int v49; // edi@86 + int v50; // ecx@88 double v51; // st7@89 double v52; // st6@89 float v53; // ST34_4@90 @@ -6171,9 +6168,9 @@ int v57; // eax@96 unsigned int v58; // ecx@103 unsigned int v59; // eax@107 - signed int v60; // ecx@107 - signed int v61; // edi@111 - signed int v62; // ecx@113 + unsigned __int16 *v60; // ecx@107 + int v61; // edi@111 + int v62; // ecx@113 double v63; // st7@114 double v64; // st6@114 float v65; // ST34_4@115 @@ -6182,10 +6179,10 @@ int v68; // eax@119 int v69; // eax@121 unsigned int v70; // ecx@128 - __int16 v71; // ax@132 - signed int v72; // ecx@132 - signed int v73; // edi@136 - signed int v74; // ecx@138 + unsigned __int16 v71; // ax@132 + unsigned __int16 *v72; // ecx@132 + int v73; // edi@136 + int v74; // ecx@138 double v75; // st7@139 double v76; // st6@139 float v77; // ST34_4@140 @@ -6195,9 +6192,9 @@ int v81; // eax@146 unsigned int v82; // ecx@153 char v83; // al@157 - signed int v84; // ecx@157 - signed int v85; // edi@164 - signed int v86; // ecx@166 + unsigned __int16 *v84; // ecx@157 + int v85; // edi@164 + int v86; // ecx@166 double v87; // st7@167 double v88; // st6@167 float v89; // ST34_4@168 @@ -6208,9 +6205,9 @@ int v94; // eax@173 unsigned int v95; // ecx@181 unsigned int v96; // eax@185 - signed int v97; // ecx@185 - signed int v98; // edi@189 - signed int v99; // ecx@191 + unsigned __int16 *v97; // ecx@185 + int v98; // edi@189 + int v99; // ecx@191 double v100; // st7@192 double v101; // st6@192 float v102; // ST34_4@193 @@ -6220,10 +6217,10 @@ int v106; // eax@196 int v107; // eax@198 unsigned int v108; // ecx@206 - __int16 v109; // ax@210 - signed int v110; // ecx@210 - signed int v111; // edi@214 - signed int v112; // ecx@216 + unsigned __int16 v109; // ax@210 + unsigned __int16 *v110; // ecx@210 + int v111; // edi@214 + int v112; // ecx@216 double v113; // st7@217 double v114; // st6@217 float v115; // ST34_4@218 @@ -6234,12 +6231,13 @@ int v120; // eax@223 unsigned int v121; // ecx@231 char v122; // al@235 - signed int v123; // ecx@235 + unsigned __int16 *v123; // ecx@235 double v124; // [sp+Ch] [bp-7Ch]@12 double v125; // [sp+Ch] [bp-7Ch]@37 double v126; // [sp+Ch] [bp-7Ch]@62 double v127; // [sp+Ch] [bp-7Ch]@90 - double v128; // [sp+Ch] [bp-7Ch]@115 + //double v128; // [sp+Ch] [bp-7Ch]@115 + uint _v128; double v129; // [sp+Ch] [bp-7Ch]@140 double v130; // [sp+Ch] [bp-7Ch]@168 double v131; // [sp+Ch] [bp-7Ch]@193 @@ -6248,7 +6246,8 @@ double v134; // [sp+14h] [bp-74h]@37 double v135; // [sp+14h] [bp-74h]@62 double v136; // [sp+14h] [bp-74h]@90 - double v137; // [sp+14h] [bp-74h]@115 + //double v137; // [sp+14h] [bp-74h]@115 + uint _v137; double v138; // [sp+14h] [bp-74h]@140 double v139; // [sp+14h] [bp-74h]@168 double v140; // [sp+14h] [bp-74h]@193 @@ -6257,7 +6256,8 @@ double v143; // [sp+1Ch] [bp-6Ch]@37 double v144; // [sp+1Ch] [bp-6Ch]@62 double v145; // [sp+1Ch] [bp-6Ch]@90 - double v146; // [sp+1Ch] [bp-6Ch]@115 + //double v146; // [sp+1Ch] [bp-6Ch]@115 + uint _v146; double v147; // [sp+1Ch] [bp-6Ch]@140 double v148; // [sp+1Ch] [bp-6Ch]@168 double v149; // [sp+1Ch] [bp-6Ch]@193 @@ -6266,7 +6266,8 @@ double v152; // [sp+24h] [bp-64h]@37 double v153; // [sp+24h] [bp-64h]@62 double v154; // [sp+24h] [bp-64h]@90 - double v155; // [sp+24h] [bp-64h]@115 + //double v155; // [sp+24h] [bp-64h]@115 + uint _v155; double v156; // [sp+24h] [bp-64h]@140 double v157; // [sp+24h] [bp-64h]@168 double v158; // [sp+24h] [bp-64h]@193 @@ -6286,43 +6287,43 @@ int v172; // [sp+48h] [bp-40h]@91 int v173; // [sp+48h] [bp-40h]@116 int v174; // [sp+48h] [bp-40h]@141 - int v175; // [sp+4Ch] [bp-3Ch]@13 + unsigned __int16 *v175; // [sp+4Ch] [bp-3Ch]@13 int *v176; // [sp+50h] [bp-38h]@15 int *v177; // [sp+50h] [bp-38h]@40 int *v178; // [sp+50h] [bp-38h]@65 int *v179; // [sp+50h] [bp-38h]@93 int *v180; // [sp+50h] [bp-38h]@118 int *v181; // [sp+50h] [bp-38h]@143 - int v182; // [sp+50h] [bp-38h]@169 - int v183; // [sp+50h] [bp-38h]@194 - int v184; // [sp+50h] [bp-38h]@219 - int v185; // [sp+54h] [bp-34h]@38 - int v186; // [sp+54h] [bp-34h]@63 - int v187; // [sp+54h] [bp-34h]@91 - int v188; // [sp+54h] [bp-34h]@116 - int v189; // [sp+54h] [bp-34h]@141 + char *v182; // [sp+50h] [bp-38h]@169 + char *v183; // [sp+50h] [bp-38h]@194 + char *v184; // [sp+50h] [bp-38h]@219 + unsigned __int16 *v185; // [sp+54h] [bp-34h]@38 + unsigned __int16 *v186; // [sp+54h] [bp-34h]@63 + unsigned __int16 *v187; // [sp+54h] [bp-34h]@91 + unsigned __int16 *v188; // [sp+54h] [bp-34h]@116 + unsigned __int16 *v189; // [sp+54h] [bp-34h]@141 signed int v190; // [sp+54h] [bp-34h]@170 signed int v191; // [sp+54h] [bp-34h]@195 signed int v192; // [sp+54h] [bp-34h]@220 - signed int v193; // [sp+5Ch] [bp-2Ch]@7 - signed int v194; // [sp+5Ch] [bp-2Ch]@32 - signed int v195; // [sp+5Ch] [bp-2Ch]@57 - signed int v196; // [sp+5Ch] [bp-2Ch]@85 - signed int v197; // [sp+5Ch] [bp-2Ch]@110 - signed int v198; // [sp+5Ch] [bp-2Ch]@135 - signed int v199; // [sp+5Ch] [bp-2Ch]@163 - signed int v200; // [sp+5Ch] [bp-2Ch]@188 - signed int v201; // [sp+5Ch] [bp-2Ch]@213 - stru350 *v202; // [sp+60h] [bp-28h]@1 - signed int v203; // [sp+64h] [bp-24h]@12 - signed int v204; // [sp+64h] [bp-24h]@37 - signed int v205; // [sp+64h] [bp-24h]@62 - signed int v206; // [sp+64h] [bp-24h]@90 - signed int v207; // [sp+64h] [bp-24h]@115 - signed int v208; // [sp+64h] [bp-24h]@140 - signed int v209; // [sp+64h] [bp-24h]@168 - signed int v210; // [sp+64h] [bp-24h]@193 - signed int v211; // [sp+64h] [bp-24h]@218 + unsigned __int16 *v193; // [sp+5Ch] [bp-2Ch]@7 + unsigned __int16 *v194; // [sp+5Ch] [bp-2Ch]@32 + unsigned __int16 *v195; // [sp+5Ch] [bp-2Ch]@57 + unsigned __int16 *v196; // [sp+5Ch] [bp-2Ch]@85 + unsigned __int16 *v197; // [sp+5Ch] [bp-2Ch]@110 + unsigned __int16 *v198; // [sp+5Ch] [bp-2Ch]@135 + unsigned __int16 *v199; // [sp+5Ch] [bp-2Ch]@163 + unsigned __int16 *v200; // [sp+5Ch] [bp-2Ch]@188 + unsigned __int16 *v201; // [sp+5Ch] [bp-2Ch]@213 + //stru350 *v202; // [sp+60h] [bp-28h]@1 + int v203; // [sp+64h] [bp-24h]@12 + int v204; // [sp+64h] [bp-24h]@37 + int v205; // [sp+64h] [bp-24h]@62 + int v206; // [sp+64h] [bp-24h]@90 + int v207; // [sp+64h] [bp-24h]@115 + int v208; // [sp+64h] [bp-24h]@140 + int v209; // [sp+64h] [bp-24h]@168 + int v210; // [sp+64h] [bp-24h]@193 + int v211; // [sp+64h] [bp-24h]@218 float v212; // [sp+6Ch] [bp-1Ch]@11 float v213; // [sp+6Ch] [bp-1Ch]@36 float v214; // [sp+6Ch] [bp-1Ch]@61 @@ -6372,52 +6373,52 @@ unsigned int v258; // [sp+84h] [bp-4h]@168 unsigned int v259; // [sp+84h] [bp-4h]@193 unsigned int v260; // [sp+84h] [bp-4h]@218 - signed int v261; // [sp+A0h] [bp+18h]@10 - float v262; // [sp+A0h] [bp+18h]@12 - float v263; // [sp+A0h] [bp+18h]@12 - unsigned int v264; // [sp+A0h] [bp+18h]@12 - signed int v265; // [sp+A0h] [bp+18h]@35 - float v266; // [sp+A0h] [bp+18h]@37 - float v267; // [sp+A0h] [bp+18h]@37 - unsigned int v268; // [sp+A0h] [bp+18h]@37 - signed int v269; // [sp+A0h] [bp+18h]@60 - float v270; // [sp+A0h] [bp+18h]@62 - float v271; // [sp+A0h] [bp+18h]@62 - unsigned int v272; // [sp+A0h] [bp+18h]@62 - signed int v273; // [sp+A0h] [bp+18h]@88 - float v274; // [sp+A0h] [bp+18h]@90 - float v275; // [sp+A0h] [bp+18h]@90 - unsigned int v276; // [sp+A0h] [bp+18h]@90 - signed int v277; // [sp+A0h] [bp+18h]@113 - float v278; // [sp+A0h] [bp+18h]@115 - float v279; // [sp+A0h] [bp+18h]@115 - unsigned int v280; // [sp+A0h] [bp+18h]@115 - signed int v281; // [sp+A0h] [bp+18h]@138 - float v282; // [sp+A0h] [bp+18h]@140 - float v283; // [sp+A0h] [bp+18h]@140 - unsigned int v284; // [sp+A0h] [bp+18h]@140 - signed int v285; // [sp+A0h] [bp+18h]@166 - float v286; // [sp+A0h] [bp+18h]@168 - float v287; // [sp+A0h] [bp+18h]@168 - unsigned int v288; // [sp+A0h] [bp+18h]@168 - signed int v289; // [sp+A0h] [bp+18h]@191 - float v290; // [sp+A0h] [bp+18h]@193 - float v291; // [sp+A0h] [bp+18h]@193 - unsigned int v292; // [sp+A0h] [bp+18h]@193 - signed int v293; // [sp+A0h] [bp+18h]@216 - float v294; // [sp+A0h] [bp+18h]@218 - float v295; // [sp+A0h] [bp+18h]@218 - unsigned int v296; // [sp+A0h] [bp+18h]@218 - int v297; // [sp+ACh] [bp+24h]@8 - int v298; // [sp+ACh] [bp+24h]@33 - int v299; // [sp+ACh] [bp+24h]@86 - int v300; // [sp+ACh] [bp+24h]@111 - int v301; // [sp+ACh] [bp+24h]@164 - int v302; // [sp+ACh] [bp+24h]@189 + signed int a6a; // [sp+A0h] [bp+18h]@10 + float a6s; // [sp+A0h] [bp+18h]@12 + float a6t; // [sp+A0h] [bp+18h]@12 + unsigned int a6b; // [sp+A0h] [bp+18h]@12 + signed int a6c; // [sp+A0h] [bp+18h]@35 + float a6u; // [sp+A0h] [bp+18h]@37 + float a6v; // [sp+A0h] [bp+18h]@37 + unsigned int a6d; // [sp+A0h] [bp+18h]@37 + signed int a6e; // [sp+A0h] [bp+18h]@60 + float a6w; // [sp+A0h] [bp+18h]@62 + float a6x; // [sp+A0h] [bp+18h]@62 + unsigned int a6f; // [sp+A0h] [bp+18h]@62 + signed int a6g; // [sp+A0h] [bp+18h]@88 + float a6y; // [sp+A0h] [bp+18h]@90 + float a6z; // [sp+A0h] [bp+18h]@90 + unsigned int a6h; // [sp+A0h] [bp+18h]@90 + signed int a6i; // [sp+A0h] [bp+18h]@113 + float a6ba; // [sp+A0h] [bp+18h]@115 + float a6bb; // [sp+A0h] [bp+18h]@115 + unsigned int a6j; // [sp+A0h] [bp+18h]@115 + signed int a6k; // [sp+A0h] [bp+18h]@138 + float a6bc; // [sp+A0h] [bp+18h]@140 + float a6bd; // [sp+A0h] [bp+18h]@140 + unsigned int a6l; // [sp+A0h] [bp+18h]@140 + signed int a6m; // [sp+A0h] [bp+18h]@166 + float a6be; // [sp+A0h] [bp+18h]@168 + float a6bf; // [sp+A0h] [bp+18h]@168 + unsigned int a6n; // [sp+A0h] [bp+18h]@168 + signed int a6o; // [sp+A0h] [bp+18h]@191 + float a6bg; // [sp+A0h] [bp+18h]@193 + float a6bh; // [sp+A0h] [bp+18h]@193 + unsigned int a6p; // [sp+A0h] [bp+18h]@193 + signed int a6q; // [sp+A0h] [bp+18h]@216 + float a6bi; // [sp+A0h] [bp+18h]@218 + float a6bj; // [sp+A0h] [bp+18h]@218 + unsigned int a6r; // [sp+A0h] [bp+18h]@218 + int a9a; // [sp+ACh] [bp+24h]@8 + int a9b; // [sp+ACh] [bp+24h]@33 + int a9c; // [sp+ACh] [bp+24h]@86 + int a9d; // [sp+ACh] [bp+24h]@111 + int a9e; // [sp+ACh] [bp+24h]@164 + int a9f; // [sp+ACh] [bp+24h]@189 v11 = 0; - result = this->field_0[3]; - v202 = this; + result = this->field_0.field_C; + //v202 = this; v230 = 0; if ( result != 8 ) { @@ -6425,47 +6426,47 @@ { if ( result != 32 ) return result; - result = this->array_20[3]; + result = this->field_20.field_C; if ( result != 8 ) { if ( result != 16 ) { - if ( result != 32 || (result = a6, v193 = a6, v231 = 0, a8 <= 0) ) + if ( result != 32 || (result = (int)pDst, v193 = pDst, v231 = 0, dstHeight <= 0) ) return result; - v13 = a7; - v297 = 4 * (a9 - a7); + v13 = dstWidth; + a9a = 4 * (dstPitch - dstWidth); while ( 1 ) { v14 = 0; - v261 = 0; - if ( a7 > v11 ) + a6a = 0; + if ( dstWidth > v11 ) break; LABEL_30: - v193 += v297; + v193 = (unsigned __int16 *)((char *)v193 + a9a); ++v231; result = v231; - if ( v231 >= a8 ) + if ( v231 >= dstHeight ) return result; v11 = 0; } - v221 = (double)a7; - v212 = (double)a3; - v15 = (double)a8; - v16 = (double)a4; + v221 = (double)dstWidth; + v212 = (double)srcWidth; + v15 = (double)dstHeight; + v16 = (double)srcHeight; while ( 1 ) { - v262 = (double)v261 / v221 * v212; - v151 = v262 + 6.7553994e15; + a6s = (double)a6a / v221 * v212; + v151 = floorf(a6s);//a6s + 6.7553994e15; v203 = v14 + 1; - v263 = (double)(v14 + 1) / v221 * v212; - v142 = v263 + 6.7553994e15; + a6t = (double)(v14 + 1) / v221 * v212; + v142 = floorf(a6t);//a6t + 6.7553994e15; v17 = (double)v231 / v15 * v16; - v133 = v17 + 6.7553994e15; + v133 = floorf(v17);//v17 + 6.7553994e15; v18 = (double)(v231 + 1) / v15 * v16; - v124 = v18 + 6.7553994e15; + v124 = floorf(v18);//v18 + 6.7553994e15; v19 = (LODWORD(v124) - LODWORD(v133)) * (LODWORD(v142) - LODWORD(v151)); v252 = 0; - v264 = 0; + a6b = 0; v240 = 0i64; if ( SLODWORD(v133) < SLODWORD(v124) ) break; @@ -6473,27 +6474,27 @@ v22 = (unsigned int)v240 / ((LODWORD(v124) - LODWORD(v133)) * (LODWORD(v142) - LODWORD(v151))); if ( v19 ) { - v264 /= v19; + a6b /= v19; v252 /= v19; HIDWORD(v240) /= v19; } if ( v22 != 255 ) v22 &= 0x7FFFFFFFu; - v23 = v202->_450F55(HIDWORD(v240) | ((v252 | ((v264 | (v22 << 8)) << 8)) << 8)); + v23 = _450F55(HIDWORD(v240) | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); v24 = v193; - v193 += 4; - *(int *)v24 = v23; + v193 += 2; + *(_DWORD *)v24 = v23; v14 = v203; - v261 = v203; - if ( v203 >= a7 ) + a6a = v203; + if ( v203 >= dstWidth ) goto LABEL_30; } v160 = LODWORD(v124) - LODWORD(v133); - v175 = a2 + 4 * (LODWORD(v151) + a5 * LODWORD(v133)); + v175 = &pSrc[2 * (LODWORD(v151) + srcPitch * LODWORD(v133))]; while ( SLODWORD(v151) >= SLODWORD(v142) ) { LABEL_24: - v175 += 4 * a5; + v175 += 2 * srcPitch; --v160; if ( !v160 ) goto LABEL_25; @@ -6508,7 +6509,7 @@ v230 = 1; v13 = v20 != a11 ? 0xFF : 0; } - v21 = v202->_450FB1(v20); + v21 = _450FB1(v20); if ( !v230 ) break; LODWORD(v240) = v13 + v240; @@ -6524,50 +6525,50 @@ } LODWORD(v240) = ((unsigned int)v21 >> 24) + v240; LABEL_22: - v264 += BYTE2(v21); + a6b += BYTE2(v21); v252 += BYTE1(v21); HIDWORD(v240) += (unsigned __int8)v21; goto LABEL_23; } - result = a6; - v194 = a6; + result = (int)pDst; + v194 = pDst; v232 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v25 = a7; - v298 = 2 * (a9 - a7); + v25 = dstWidth; + a9b = 2 * (dstPitch - dstWidth); while ( 1 ) { v26 = 0; - v265 = 0; - if ( a7 > v11 ) + a6c = 0; + if ( dstWidth > v11 ) break; LABEL_55: - v194 += v298; + v194 = (unsigned __int16 *)((char *)v194 + a9b); ++v232; result = v232; - if ( v232 >= a8 ) + if ( v232 >= dstHeight ) return result; v11 = 0; } - v222 = (double)a7; - v213 = (double)a3; - v27 = (double)a8; - v28 = (double)a4; + v222 = (double)dstWidth; + v213 = (double)srcWidth; + v27 = (double)dstHeight; + v28 = (double)srcHeight; while ( 1 ) { - v266 = (double)v265 / v222 * v213; - v125 = v266 + 6.7553994e15; + a6u = (double)a6c / v222 * v213; + v125 = a6u + 6.7553994e15; v204 = v26 + 1; - v267 = (double)(v26 + 1) / v222 * v213; - v134 = v267 + 6.7553994e15; + a6v = (double)(v26 + 1) / v222 * v213; + v134 = a6v + 6.7553994e15; v29 = (double)v232 / v27 * v28; v143 = v29 + 6.7553994e15; v30 = (double)(v232 + 1) / v27 * v28; v152 = v30 + 6.7553994e15; v31 = (LODWORD(v152) - LODWORD(v143)) * (LODWORD(v134) - LODWORD(v125)); v253 = 0; - v268 = 0; + a6d = 0; v241 = 0i64; if ( SLODWORD(v143) < SLODWORD(v152) ) break; @@ -6575,27 +6576,27 @@ v34 = (unsigned int)v241 / ((LODWORD(v152) - LODWORD(v143)) * (LODWORD(v134) - LODWORD(v125))); if ( v31 ) { - v268 /= v31; + a6d /= v31; v253 /= v31; HIDWORD(v241) /= v31; } if ( v34 != 255 ) v34 &= 0x7FFFFFFFu; - v35 = v202->_450F55(HIDWORD(v241) | ((v253 | ((v268 | (v34 << 8)) << 8)) << 8)); + v35 = _450F55(HIDWORD(v241) | ((v253 | ((a6d | (v34 << 8)) << 8)) << 8)); v36 = v194; - v194 += 2; - *(short *)v36 = v35; + ++v194; + *v36 = v35; v26 = v204; - v265 = v204; - if ( v204 >= a7 ) + a6c = v204; + if ( v204 >= dstWidth ) goto LABEL_55; } v170 = LODWORD(v152) - LODWORD(v143); - v185 = a2 + 4 * (LODWORD(v125) + a5 * LODWORD(v143)); + v185 = &pSrc[2 * (LODWORD(v125) + srcPitch * LODWORD(v143))]; while ( SLODWORD(v125) >= SLODWORD(v134) ) { LABEL_49: - v185 += 4 * a5; + v185 += 2 * srcPitch; --v170; if ( !v170 ) goto LABEL_50; @@ -6610,7 +6611,7 @@ v230 = 1; v25 = v32 != a11 ? 0xFF : 0; } - v33 = v202->_450FB1(v32); + v33 = _450FB1(v32); if ( !v230 ) break; LODWORD(v241) = v25 + v241; @@ -6626,49 +6627,49 @@ } LODWORD(v241) = ((unsigned int)v33 >> 24) + v241; LABEL_47: - v268 += BYTE2(v33); + a6d += BYTE2(v33); v253 += BYTE1(v33); HIDWORD(v241) += (unsigned __int8)v33; goto LABEL_48; } - result = a6; - v195 = a6; + result = (int)pDst; + v195 = pDst; v233 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v37 = a7; + v37 = dstWidth; while ( 1 ) { v38 = 0; - v269 = 0; - if ( a7 > v11 ) + a6e = 0; + if ( dstWidth > v11 ) break; LABEL_80: - v195 += a9 - a7; + v195 = (unsigned __int16 *)((char *)v195 + dstPitch - dstWidth); ++v233; result = v233; - if ( v233 >= a8 ) + if ( v233 >= dstHeight ) return result; v11 = 0; } - v223 = (double)a7; - v214 = (double)a3; - v39 = (double)a8; - v40 = (double)a4; + v223 = (double)dstWidth; + v214 = (double)srcWidth; + v39 = (double)dstHeight; + v40 = (double)srcHeight; while ( 1 ) { - v270 = (double)v269 / v223 * v214; - v126 = v270 + 6.7553994e15; + a6w = (double)a6e / v223 * v214; + v126 = a6w + 6.7553994e15; v205 = v38 + 1; - v271 = (double)(v38 + 1) / v223 * v214; - v135 = v271 + 6.7553994e15; + a6x = (double)(v38 + 1) / v223 * v214; + v135 = a6x + 6.7553994e15; v41 = (double)v233 / v39 * v40; v144 = v41 + 6.7553994e15; v42 = (double)(v233 + 1) / v39 * v40; v153 = v42 + 6.7553994e15; v43 = (LODWORD(v153) - LODWORD(v144)) * (LODWORD(v135) - LODWORD(v126)); v254 = 0; - v272 = 0; + a6f = 0; v242 = 0i64; if ( SLODWORD(v144) < SLODWORD(v153) ) break; @@ -6676,26 +6677,27 @@ v46 = (unsigned int)v242 / ((LODWORD(v153) - LODWORD(v144)) * (LODWORD(v135) - LODWORD(v126))); if ( v43 ) { - v272 /= v43; + a6f /= v43; v254 /= v43; HIDWORD(v242) /= v43; } if ( v46 != 255 ) v46 &= 0x7FFFFFFFu; - v47 = v202->_450F55(HIDWORD(v242) | ((v254 | ((v272 | (v46 << 8)) << 8)) << 8)); - v48 = v195++; - *(char *)v48 = v47; + v47 = _450F55(HIDWORD(v242) | ((v254 | ((a6f | (v46 << 8)) << 8)) << 8)); + v48 = v195; + v195 = (unsigned __int16 *)((char *)v195 + 1); + *(_BYTE *)v48 = v47; v38 = v205; - v269 = v205; - if ( v205 >= a7 ) + a6e = v205; + if ( v205 >= dstWidth ) goto LABEL_80; } v171 = LODWORD(v153) - LODWORD(v144); - v186 = a2 + 4 * (LODWORD(v126) + a5 * LODWORD(v144)); + v186 = &pSrc[2 * (LODWORD(v126) + srcPitch * LODWORD(v144))]; while ( SLODWORD(v126) >= SLODWORD(v135) ) { LABEL_74: - v186 += 4 * a5; + v186 += 2 * srcPitch; --v171; if ( !v171 ) goto LABEL_75; @@ -6710,7 +6712,7 @@ v230 = 1; v37 = v44 != a11 ? 0xFF : 0; } - v45 = v202->_450FB1(v44); + v45 = _450FB1(v44); if ( !v230 ) break; LODWORD(v242) = v37 + v242; @@ -6726,52 +6728,52 @@ } LODWORD(v242) = ((unsigned int)v45 >> 24) + v242; LABEL_72: - v272 += BYTE2(v45); + a6f += BYTE2(v45); v254 += BYTE1(v45); HIDWORD(v242) += (unsigned __int8)v45; goto LABEL_73; } - result = this->array_20[3]; + result = this->field_20.field_C; if ( result != 8 ) { if ( result != 16 ) { - if ( result != 32 || (result = a6, v196 = a6, v234 = 0, a8 <= 0) ) + if ( result != 32 || (result = (int)pDst, v196 = pDst, v234 = 0, dstHeight <= 0) ) return result; - v49 = a7; - v299 = 4 * (a9 - a7); + v49 = dstWidth; + a9c = 4 * (dstPitch - dstWidth); while ( 1 ) { v50 = 0; - v273 = 0; - if ( a7 > v11 ) + a6g = 0; + if ( dstWidth > v11 ) break; LABEL_108: - v196 += v299; + v196 = (unsigned __int16 *)((char *)v196 + a9c); ++v234; result = v234; - if ( v234 >= a8 ) + if ( v234 >= dstHeight ) return result; v11 = 0; } - v224 = (double)a7; - v215 = (double)a3; - v51 = (double)a8; - v52 = (double)a4; + v224 = (double)dstWidth; + v215 = (double)srcWidth; + v51 = (double)dstHeight; + v52 = (double)srcHeight; while ( 1 ) { - v274 = (double)v273 / v224 * v215; - v127 = v274 + 6.7553994e15; + a6y = (double)a6g / v224 * v215; + v127 = a6y + 6.7553994e15; v206 = v50 + 1; - v275 = (double)(v50 + 1) / v224 * v215; - v136 = v275 + 6.7553994e15; + a6z = (double)(v50 + 1) / v224 * v215; + v136 = a6z + 6.7553994e15; v53 = (double)v234 / v51 * v52; v145 = v53 + 6.7553994e15; v54 = (double)(v234 + 1) / v51 * v52; v154 = v54 + 6.7553994e15; v55 = (LODWORD(v154) - LODWORD(v145)) * (LODWORD(v136) - LODWORD(v127)); v255 = 0; - v276 = 0; + a6h = 0; v243 = 0i64; if ( SLODWORD(v145) < SLODWORD(v154) ) break; @@ -6779,27 +6781,27 @@ v58 = (unsigned int)v243 / ((LODWORD(v154) - LODWORD(v145)) * (LODWORD(v136) - LODWORD(v127))); if ( v55 ) { - v276 /= v55; + a6h /= v55; v255 /= v55; HIDWORD(v243) /= v55; } if ( v58 != 255 ) v58 &= 0x7FFFFFFFu; - v59 = v202->_450F55(HIDWORD(v243) | ((v255 | ((v276 | (v58 << 8)) << 8)) << 8)); + v59 = _450F55(HIDWORD(v243) | ((v255 | ((a6h | (v58 << 8)) << 8)) << 8)); v60 = v196; - v196 += 4; - *(int *)v60 = v59; + v196 += 2; + *(_DWORD *)v60 = v59; v50 = v206; - v273 = v206; - if ( v206 >= a7 ) + a6g = v206; + if ( v206 >= dstWidth ) goto LABEL_108; } v172 = LODWORD(v154) - LODWORD(v145); - v187 = a2 + 2 * (LODWORD(v127) + a5 * LODWORD(v145)); + v187 = &pSrc[LODWORD(v127) + srcPitch * LODWORD(v145)]; while ( SLODWORD(v127) >= SLODWORD(v136) ) { LABEL_102: - v187 += 2 * a5; + v187 += srcPitch; --v172; if ( !v172 ) goto LABEL_103; @@ -6808,13 +6810,13 @@ v164 = LODWORD(v136) - LODWORD(v127); while ( 1 ) { - v56 = *(short *)v179; + v56 = *(_WORD *)v179; if ( a10 ) { v230 = 1; v49 = v56 != a11 ? 0xFF : 0; } - v57 = v202->_450FB1(v56); + v57 = _450FB1(v56); if ( !v230 ) break; LODWORD(v243) = v49 + v243; @@ -6830,93 +6832,104 @@ } LODWORD(v243) = ((unsigned int)v57 >> 24) + v243; LABEL_100: - v276 += BYTE2(v57); + a6h += BYTE2(v57); v255 += BYTE1(v57); HIDWORD(v243) += (unsigned __int8)v57; goto LABEL_101; } - result = a6; - v197 = a6; + result = (int)pDst; + v197 = pDst; v235 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v61 = a7; - v300 = 2 * (a9 - a7); + v61 = dstWidth; + a9d = 2 * (dstPitch - dstWidth); while ( 1 ) { v62 = 0; - v277 = 0; - if ( a7 > v11 ) + a6i = 0; + if ( dstWidth > v11 ) break; LABEL_133: - v197 += v300; + v197 = (unsigned __int16 *)((char *)v197 + a9d); ++v235; result = v235; - if ( v235 >= a8 ) + if ( v235 >= dstHeight ) return result; v11 = 0; } - v225 = (double)a7; - v216 = (double)a3; - v63 = (double)a8; - v64 = (double)a4; + v225 = (double)dstWidth; + v216 = (double)srcWidth; + v63 = (double)dstHeight; + v64 = (double)srcHeight; while ( 1 ) { - v278 = (double)v277 / v225 * v216; - v128 = v278 + 6.7553994e15; + a6ba = (double)a6i / v225 * v216; + _v128 = floorf(a6ba); + //v128 = a6ba + 6.7553994e15; v207 = v62 + 1; - v279 = (double)(v62 + 1) / v225 * v216; - v137 = v279 + 6.7553994e15; + a6bb = (double)(v62 + 1) / v225 * v216; + //v137 = a6bb + 6.7553994e15; + _v137 = floorf(a6bb); v65 = (double)v235 / v63 * v64; - v146 = v65 + 6.7553994e15; + //v146 = v65 + 6.7553994e15; + _v146 = floorf(v65); v66 = (double)(v235 + 1) / v63 * v64; - v155 = v66 + 6.7553994e15; - v67 = (LODWORD(v155) - LODWORD(v146)) * (LODWORD(v137) - LODWORD(v128)); + //v155 = v66 + 6.7553994e15; + _v155 = floorf(v66); + //v67 = (LODWORD(v155) - LODWORD(v146)) * (LODWORD(v137) - LODWORD(v128)); + v67 = (_v155 - _v146) * (_v137 - _v128); v256 = 0; - v280 = 0; + a6j = 0; v244 = 0i64; - if ( SLODWORD(v146) < SLODWORD(v155) ) + //if ( SLODWORD(v146) < SLODWORD(v155) ) + if (_v146 < _v155) break; LABEL_128: - v70 = (unsigned int)v244 / ((LODWORD(v155) - LODWORD(v146)) * (LODWORD(v137) - LODWORD(v128))); + //v70 = (unsigned int)v244 / ((LODWORD(v155) - LODWORD(v146)) * (LODWORD(v137) - LODWORD(v128))); + v70 = (unsigned int)v244 / ((_v155 - _v146) * (_v137 - _v128)); if ( v67 ) { - v280 /= v67; + a6j /= v67; v256 /= v67; HIDWORD(v244) /= v67; } if ( v70 != 255 ) v70 &= 0x7FFFFFFFu; - v71 = v202->_450F55(HIDWORD(v244) | ((v256 | ((v280 | (v70 << 8)) << 8)) << 8)); + v71 = _450F55(HIDWORD(v244) | ((v256 | ((a6j | (v70 << 8)) << 8)) << 8)); v72 = v197; - v197 += 2; - *(short *)v72 = v71; + ++v197; + *v72 = v71; v62 = v207; - v277 = v207; - if ( v207 >= a7 ) + a6i = v207; + if ( v207 >= dstWidth ) goto LABEL_133; } - v173 = LODWORD(v155) - LODWORD(v146); - v188 = a2 + 2 * (LODWORD(v128) + a5 * LODWORD(v146)); - while ( SLODWORD(v128) >= SLODWORD(v137) ) + //v173 = LODWORD(v155) - LODWORD(v146); + v173 = _v155 - _v146; + //v188 = &pSrc[LODWORD(v128) + srcPitch * LODWORD(v146)]; + v188 = &pSrc[_v128 + srcPitch * _v146]; + //while ( SLODWORD(v128) >= SLODWORD(v137) ) + while (_v128 >= _v137) { LABEL_127: - v188 += 2 * a5; + v188 += srcPitch; --v173; if ( !v173 ) goto LABEL_128; } v180 = (int *)v188; - v165 = LODWORD(v137) - LODWORD(v128); + //v165 = LODWORD(v137) - LODWORD(v128); + v165 = _v137 - _v128; while ( 1 ) { - v68 = *(short *)v180; + v68 = *(_WORD *)v180; if ( a10 ) { v230 = 1; v61 = v68 != a11 ? 0xFF : 0; } - v69 = v202->_450FB1(v68); + v69 = _450FB1(v68); if ( !v230 ) break; LODWORD(v244) = v61 + v244; @@ -6932,49 +6945,49 @@ } LODWORD(v244) = ((unsigned int)v69 >> 24) + v244; LABEL_125: - v280 += BYTE2(v69); + a6j += BYTE2(v69); v256 += BYTE1(v69); HIDWORD(v244) += (unsigned __int8)v69; goto LABEL_126; } - result = a6; - v198 = a6; + result = (int)pDst; + v198 = pDst; v236 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v73 = a7; + v73 = dstWidth; while ( 1 ) { v74 = 0; - v281 = 0; - if ( a7 > v11 ) + a6k = 0; + if ( dstWidth > v11 ) break; LABEL_158: - v198 += a9 - a7; + v198 = (unsigned __int16 *)((char *)v198 + dstPitch - dstWidth); ++v236; result = v236; - if ( v236 >= a8 ) + if ( v236 >= dstHeight ) return result; v11 = 0; } - v226 = (double)a7; - v217 = (double)a3; - v75 = (double)a8; - v76 = (double)a4; + v226 = (double)dstWidth; + v217 = (double)srcWidth; + v75 = (double)dstHeight; + v76 = (double)srcHeight; while ( 1 ) { - v282 = (double)v281 / v226 * v217; - v129 = v282 + 6.7553994e15; + a6bc = (double)a6k / v226 * v217; + v129 = a6bc + 6.7553994e15; v208 = v74 + 1; - v283 = (double)(v74 + 1) / v226 * v217; - v138 = v283 + 6.7553994e15; + a6bd = (double)(v74 + 1) / v226 * v217; + v138 = a6bd + 6.7553994e15; v77 = (double)v236 / v75 * v76; v147 = v77 + 6.7553994e15; v78 = (double)(v236 + 1) / v75 * v76; v156 = v78 + 6.7553994e15; v257 = 0; v79 = (LODWORD(v156) - LODWORD(v147)) * (LODWORD(v138) - LODWORD(v129)); - v284 = 0; + a6l = 0; v245 = 0i64; if ( SLODWORD(v147) < SLODWORD(v156) ) break; @@ -6982,26 +6995,27 @@ v82 = (unsigned int)v245 / ((LODWORD(v156) - LODWORD(v147)) * (LODWORD(v138) - LODWORD(v129))); if ( v79 ) { - v284 /= v79; + a6l /= v79; v257 /= v79; HIDWORD(v245) /= v79; } if ( v82 != 255 ) v82 &= 0x7FFFFFFFu; - v83 = v202->_450F55(HIDWORD(v245) | ((v257 | ((v284 | (v82 << 8)) << 8)) << 8)); - v84 = v198++; - *(char *)v84 = v83; + v83 = _450F55(HIDWORD(v245) | ((v257 | ((a6l | (v82 << 8)) << 8)) << 8)); + v84 = v198; + v198 = (unsigned __int16 *)((char *)v198 + 1); + *(_BYTE *)v84 = v83; v74 = v208; - v281 = v208; - if ( v208 >= a7 ) + a6k = v208; + if ( v208 >= dstWidth ) goto LABEL_158; } v174 = LODWORD(v156) - LODWORD(v147); - v189 = a2 + 2 * (LODWORD(v129) + a5 * LODWORD(v147)); + v189 = &pSrc[LODWORD(v129) + srcPitch * LODWORD(v147)]; while ( SLODWORD(v129) >= SLODWORD(v138) ) { LABEL_152: - v189 += 2 * a5; + v189 += srcPitch; --v174; if ( !v174 ) goto LABEL_153; @@ -7010,13 +7024,13 @@ v181 = (int *)v189; while ( 1 ) { - v80 = *(short *)v181; + v80 = *(_WORD *)v181; if ( a10 ) { v230 = 1; v73 = v80 != a11 ? 0xFF : 0; } - v81 = v202->_450FB1(v80); + v81 = _450FB1(v80); if ( !v230 ) break; LODWORD(v245) = v73 + v245; @@ -7032,37 +7046,37 @@ } LODWORD(v245) = ((unsigned int)v81 >> 24) + v245; LABEL_150: - v284 += BYTE2(v81); + a6l += BYTE2(v81); v257 += BYTE1(v81); HIDWORD(v245) += (unsigned __int8)v81; goto LABEL_151; } - result = this->array_20[3]; + result = this->field_20.field_C; if ( result == 8 ) { - result = a6; - v201 = a6; + result = (int)pDst; + v201 = pDst; v239 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v111 = a7; + v111 = dstWidth; while ( 1 ) { v112 = 0; - v293 = 0; - if ( a7 <= v11 ) + a6q = 0; + if ( dstWidth <= v11 ) goto LABEL_236; - v229 = (double)a7; - v220 = (double)a3; - v113 = (double)a8; - v114 = (double)a4; + v229 = (double)dstWidth; + v220 = (double)srcWidth; + v113 = (double)dstHeight; + v114 = (double)srcHeight; do { - v294 = (double)v293 / v229 * v220; - v132 = v294 + 6.7553994e15; + a6bi = (double)a6q / v229 * v220; + v132 = a6bi + 6.7553994e15; v211 = v112 + 1; - v295 = (double)(v112 + 1) / v229 * v220; - v141 = v295 + 6.7553994e15; + a6bj = (double)(v112 + 1) / v229 * v220; + v141 = a6bj + 6.7553994e15; v115 = (double)v239 / v113 * v114; v150 = v115 + 6.7553994e15; v116 = (double)(v239 + 1) / v113 * v114; @@ -7070,25 +7084,25 @@ v251 = 0; v117 = (LODWORD(v159) - LODWORD(v150)) * (LODWORD(v141) - LODWORD(v132)); v260 = 0; - v296 = 0; + a6r = 0; v248 = 0; if ( SLODWORD(v150) >= SLODWORD(v159) ) goto LABEL_231; v169 = LODWORD(v159) - LODWORD(v150); - v184 = a2 + a5 * LODWORD(v150); + v184 = (char *)pSrc + srcPitch * LODWORD(v150); do { v118 = LODWORD(v132); v192 = LODWORD(v132); while ( v118 < SLODWORD(v141) ) { - v119 = *(char *)(v184 + v192); + v119 = (unsigned __int8)v184[v192]; if ( a10 ) { v230 = 1; v111 = v119 != a11 ? 0xFF : 0; } - v120 = v202->_450FB1(v119); + v120 = _450FB1(v119); if ( v230 ) { v248 += v111; @@ -7103,14 +7117,14 @@ { v248 += (unsigned int)v120 >> 24; } - v296 += BYTE2(v120); + a6r += BYTE2(v120); v260 += BYTE1(v120); v251 += (unsigned __int8)v120; LABEL_228: ++v192; v118 = v192; } - v184 += a5; + v184 += srcPitch; --v169; } while ( v169 ); @@ -7118,54 +7132,55 @@ v121 = v248 / ((LODWORD(v159) - LODWORD(v150)) * (LODWORD(v141) - LODWORD(v132))); if ( v117 ) { - v296 /= v117; + a6r /= v117; v260 /= v117; v251 /= v117; } if ( v121 != 255 ) v121 &= 0x7FFFFFFFu; - v122 = v202->_450F55(v251 | ((v260 | ((v296 | (v121 << 8)) << 8)) << 8)); - v123 = v201++; - *(char *)v123 = v122; + v122 = _450F55(v251 | ((v260 | ((a6r | (v121 << 8)) << 8)) << 8)); + v123 = v201; + v201 = (unsigned __int16 *)((char *)v201 + 1); + *(_BYTE *)v123 = v122; v112 = v211; - v293 = v211; - } - while ( v211 < a7 ); + a6q = v211; + } + while ( v211 < dstWidth ); LABEL_236: - v201 += a9 - a7; + v201 = (unsigned __int16 *)((char *)v201 + dstPitch - dstWidth); ++v239; result = v239; - if ( v239 >= a8 ) + if ( v239 >= dstHeight ) return result; v11 = 0; } } if ( result == 16 ) { - result = a6; - v200 = a6; + result = (int)pDst; + v200 = pDst; v238 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v98 = a7; - v302 = 2 * (a9 - a7); + v98 = dstWidth; + a9f = 2 * (dstPitch - dstWidth); while ( 1 ) { v99 = 0; - v289 = 0; - if ( a7 <= v11 ) + a6o = 0; + if ( dstWidth <= v11 ) goto LABEL_211; - v228 = (double)a7; - v219 = (double)a3; - v100 = (double)a8; - v101 = (double)a4; + v228 = (double)dstWidth; + v219 = (double)srcWidth; + v100 = (double)dstHeight; + v101 = (double)srcHeight; do { - v290 = (double)v289 / v228 * v219; - v131 = v290 + 6.7553994e15; + a6bg = (double)a6o / v228 * v219; + v131 = a6bg + 6.7553994e15; v210 = v99 + 1; - v291 = (double)(v99 + 1) / v228 * v219; - v140 = v291 + 6.7553994e15; + a6bh = (double)(v99 + 1) / v228 * v219; + v140 = a6bh + 6.7553994e15; v102 = (double)v238 / v100 * v101; v149 = v102 + 6.7553994e15; v103 = (double)(v238 + 1) / v100 * v101; @@ -7173,25 +7188,25 @@ v250 = 0; v104 = (LODWORD(v158) - LODWORD(v149)) * (LODWORD(v140) - LODWORD(v131)); v259 = 0; - v292 = 0; + a6p = 0; v247 = 0; if ( SLODWORD(v149) >= SLODWORD(v158) ) goto LABEL_206; v168 = LODWORD(v158) - LODWORD(v149); - v183 = a2 + a5 * LODWORD(v149); + v183 = (char *)pSrc + srcPitch * LODWORD(v149); do { v105 = LODWORD(v131); v191 = LODWORD(v131); while ( v105 < SLODWORD(v140) ) { - v106 = *(char *)(v183 + v191); + v106 = (unsigned __int8)v183[v191]; if ( a10 ) { v230 = 1; v98 = v106 != a11 ? 0xFF : 0; } - v107 = v202->_450FB1(v106); + v107 = _450FB1(v106); if ( v230 ) { v247 += v98; @@ -7206,14 +7221,14 @@ { v247 += (unsigned int)v107 >> 24; } - v292 += BYTE2(v107); + a6p += BYTE2(v107); v259 += BYTE1(v107); v250 += (unsigned __int8)v107; LABEL_203: ++v191; v105 = v191; } - v183 += a5; + v183 += srcPitch; --v168; } while ( v168 ); @@ -7221,50 +7236,50 @@ v108 = v247 / ((LODWORD(v158) - LODWORD(v149)) * (LODWORD(v140) - LODWORD(v131))); if ( v104 ) { - v292 /= v104; + a6p /= v104; v259 /= v104; v250 /= v104; } if ( v108 != 255 ) v108 &= 0x7FFFFFFFu; - v109 = v202->_450F55(v250 | ((v259 | ((v292 | (v108 << 8)) << 8)) << 8)); + v109 = _450F55(v250 | ((v259 | ((a6p | (v108 << 8)) << 8)) << 8)); v110 = v200; - v200 += 2; - *(short *)v110 = v109; + ++v200; + *v110 = v109; v99 = v210; - v289 = v210; - } - while ( v210 < a7 ); + a6o = v210; + } + while ( v210 < dstWidth ); LABEL_211: - v200 += v302; + v200 = (unsigned __int16 *)((char *)v200 + a9f); ++v238; result = v238; - if ( v238 >= a8 ) + if ( v238 >= dstHeight ) return result; v11 = 0; } } - if ( result != 32 || (result = a6, v199 = a6, v237 = 0, a8 <= 0) ) + if ( result != 32 || (result = (int)pDst, v199 = pDst, v237 = 0, dstHeight <= 0) ) return result; - v85 = a7; - v301 = 4 * (a9 - a7); + v85 = dstWidth; + a9e = 4 * (dstPitch - dstWidth); while ( 2 ) { v86 = 0; - v285 = 0; - if ( a7 <= v11 ) + a6m = 0; + if ( dstWidth <= v11 ) goto LABEL_186; - v227 = (double)a7; - v218 = (double)a3; - v87 = (double)a8; - v88 = (double)a4; - do - { - v286 = (double)v285 / v227 * v218; - v130 = v286 + 6.7553994e15; + v227 = (double)dstWidth; + v218 = (double)srcWidth; + v87 = (double)dstHeight; + v88 = (double)srcHeight; + do + { + a6be = (double)a6m / v227 * v218; + v130 = a6be + 6.7553994e15; v209 = v86 + 1; - v287 = (double)(v86 + 1) / v227 * v218; - v139 = v287 + 6.7553994e15; + a6bf = (double)(v86 + 1) / v227 * v218; + v139 = a6bf + 6.7553994e15; v89 = (double)v237 / v87 * v88; v148 = v89 + 6.7553994e15; v90 = (double)(v237 + 1) / v87 * v88; @@ -7272,25 +7287,25 @@ v249 = 0; v91 = (LODWORD(v157) - LODWORD(v148)) * (LODWORD(v139) - LODWORD(v130)); v258 = 0; - v288 = 0; + a6n = 0; v246 = 0; if ( SLODWORD(v148) >= SLODWORD(v157) ) goto LABEL_181; v167 = LODWORD(v157) - LODWORD(v148); - v182 = a2 + a5 * LODWORD(v148); + v182 = (char *)pSrc + srcPitch * LODWORD(v148); do { v92 = LODWORD(v130); v190 = LODWORD(v130); while ( v92 < SLODWORD(v139) ) { - v93 = *(char *)(v182 + v190); + v93 = (unsigned __int8)v182[v190]; if ( a10 ) { v230 = 1; v85 = v93 != a11 ? 0xFF : 0; } - v94 = v202->_450FB1(v93); + v94 = _450FB1(v93); if ( v230 ) { v246 += v85; @@ -7305,14 +7320,14 @@ { v246 += (unsigned int)v94 >> 24; } - v288 += BYTE2(v94); + a6n += BYTE2(v94); v258 += BYTE1(v94); v249 += (unsigned __int8)v94; LABEL_178: ++v190; v92 = v190; } - v182 += a5; + v182 += srcPitch; --v167; } while ( v167 ); @@ -7320,25 +7335,25 @@ v95 = v246 / ((LODWORD(v157) - LODWORD(v148)) * (LODWORD(v139) - LODWORD(v130))); if ( v91 ) { - v288 /= v91; + a6n /= v91; v258 /= v91; v249 /= v91; } if ( v95 != 255 ) v95 &= 0x7FFFFFFFu; - v96 = v202->_450F55(v249 | ((v258 | ((v288 | (v95 << 8)) << 8)) << 8)); + v96 = _450F55(v249 | ((v258 | ((a6n | (v95 << 8)) << 8)) << 8)); v97 = v199; - v199 += 4; - *(int *)v97 = v96; + v199 += 2; + *(_DWORD *)v97 = v96; v86 = v209; - v285 = v209; - } - while ( v209 < a7 ); + a6m = v209; + } + while ( v209 < dstWidth ); LABEL_186: - v199 += v301; + v199 = (unsigned __int16 *)((char *)v199 + a9e); ++v237; result = v237; - if ( v237 < a8 ) + if ( v237 < dstHeight ) { v11 = 0; continue; @@ -7351,6 +7366,8 @@ + + //----- (0044E1EC) -------------------------------------------------------- int TextureFrameTable::FromFileTxt(const char *Args) { @@ -8706,15 +8723,16 @@ //----- (00450DDE) -------------------------------------------------------- stru350 *stru350::_450DDE() { - _450DF1(" ", " "); + _450DF1(&stru_4E82A4, &stru_4E82A4); return this; } + //----- (00450DF1) -------------------------------------------------------- -void *stru350::_450DF1(const char *Src, const char *a3) -{ - stru350 *v3; // esi@1 - void *result; // eax@1 +bool stru350::_450DF1(const stru355 *p1, const stru355 *p2) +{ + //stru350 *v3; // esi@1 + //void *result; // eax@1 unsigned int v5; // ecx@2 int v6; // edi@2 int v7; // edx@2 @@ -8742,7 +8760,7 @@ int v29; // edx@31 int v30; // ebx@35 int v31; // ecx@35 - unsigned int v32; // edi@35 + int v32; // edi@35 int v33; // edx@35 unsigned int i; // ecx@35 int v35; // ecx@39 @@ -8750,13 +8768,14 @@ int v37; // ecx@39 int v38; // ebx@39 - v3 = this; - memcpy(this, Src, 0x20u); - result = memcpy(v3->array_20, a3, 0x20u); - (*(char *)&result) = 1; - if ( v3->field_0[1] & 1 ) - { - v5 = v3->field_0[7]; + //v3 = this; + memcpy(&field_0, p1, sizeof(stru355)); + memcpy(&field_20, p2, sizeof(stru355)); + //result = memcpy(&v3->field_20, p2, 0x20u); + //LOBYTE(result) = 1; + if (field_0.field_4 & 1) + { + v5 = field_0.field_1C; v6 = 0; v7 = 0; while ( !(v5 & 1) ) @@ -8770,13 +8789,13 @@ ++v7; } while ( v5 & 1 ); - v3->field_40 = 32 - v7 - v6; - } - else - { - v3->field_40 = 0; - } - v8 = v3->field_0[4]; + field_40 = 32 - v7 - v6; + } + else + { + field_40 = 0; + } + v8 = field_0.field_10; v9 = 0; v10 = 0; while ( !(v8 & 1) ) @@ -8792,8 +8811,8 @@ while ( v8 & 1 ); v11 = 24 - v10 - v9; v12 = 0; - v3->field_48 = v11; - v13 = v3->field_0[5]; + field_48 = v11; + v13 = field_0.field_14; v14 = 0; while ( !(v13 & 1) ) { @@ -8807,8 +8826,8 @@ } while ( v13 & 1 ); v15 = 16 - v14; - v16 = v3->field_0[6]; - v3->field_50 = v15 - v12; + v16 = field_0.field_18; + field_50 = v15 - v12; v17 = 0; v18 = 0; while ( !(v16 & 1) ) @@ -8822,15 +8841,15 @@ ++v18; } while ( v16 & 1 ); - v19 = (v3->array_20[1] & 1) == 0; - v3->field_58 = v17 - v18 + 8; + v19 = (field_20.field_4 & 1) == 0; + field_58 = v17 - v18 + 8; if ( v19 ) { - v3->field_44 = 0; - } - else - { - v20 = v3->array_20[7]; + field_44 = 0; + } + else + { + v20 = field_20.field_1C; v21 = 0; v22 = 0; while ( !(v20 & 1) ) @@ -8844,9 +8863,9 @@ ++v22; } while ( v20 & 1 ); - v3->field_44 = 32 - v22 - v21; - } - v23 = v3->array_20[4]; + field_44 = 32 - v22 - v21; + } + v23 = field_20.field_10; v24 = 0; v25 = 0; while ( !(v23 & 1) ) @@ -8862,8 +8881,8 @@ while ( v23 & 1 ); v26 = 24 - v25 - v24; v27 = 0; - v3->field_4C = v26; - v28 = v3->array_20[5]; + field_4C = v26; + v28 = field_20.field_14; v29 = 0; while ( !(v28 & 1) ) { @@ -8878,8 +8897,8 @@ while ( v28 & 1 ); v30 = 0; v31 = 16 - v29 - v27; - v32 = v3->array_20[6]; - v3->field_54 = v31; + v32 = field_20.field_18; + field_54 = v31; v33 = 0; for ( i = v32; !(i & 1); i >>= 1 ) ++v30; @@ -8891,7 +8910,7 @@ while ( i & 1 ); v35 = 32 - v33; v36 = v32; - v3->field_5C = v35 - v30; + field_5C = v35 - v30; v37 = 0; v38 = 0; while ( !(v36 & 1) ) @@ -8905,41 +8924,35 @@ ++v38; } while ( v36 & 1 ); - v3->field_5C = v37 - v38 + 8; - return result; -} + field_5C = v37 - v38 + 8; + return true; +} + //----- (00450F55) -------------------------------------------------------- unsigned int stru350::_450F55(int a2) { - int v2; // ebx@1 - - v2 = a2 & dword_4E82C0; - if ( this->array_20[1] & 1 ) + int v2 = a2 & stru_4E82A4.field_1C; + if (field_20.field_4 & 1) v2 = (unsigned int)v2 >> this->field_44; - return v2 & this->array_20[7] | this->array_20[4] & ((a2 & (unsigned int)dword_4E82B4) >> this->field_4C) | this->array_20[5] & ((a2 & (unsigned int)dword_4E82B8) >> this->field_54) | this->array_20[6] & ((a2 & (unsigned int)dword_4E82BC) >> this->field_5C); -} -// 4E82B4: using guessed type int dword_4E82B4; -// 4E82B8: using guessed type int dword_4E82B8; -// 4E82BC: using guessed type int dword_4E82BC; -// 4E82C0: using guessed type int dword_4E82C0; + return v2 & field_20.field_1C | + field_20.field_10 & ((a2 & (unsigned int)stru_4E82A4.field_10) >> field_4C) | + field_20.field_14 & ((a2 & (unsigned int)stru_4E82A4.field_14) >> field_54) | + field_20.field_18 & ((a2 & (unsigned int)stru_4E82A4.field_18) >> field_5C); +} //----- (00450FB1) -------------------------------------------------------- int stru350::_450FB1(int a2) { - int v2; // ebx@2 - int v4; // [sp+Ch] [bp-4h]@1 - - v4 = this->field_0[1] & 1; + int v2 = 0; + int v4 = field_0.field_4 & 1; if ( v4 ) - v2 = a2 & this->field_0[7]; - else - v2 = 0; + v2 = a2 & field_0.field_1C; if ( v4 ) - v2 <<= this->field_40; - return v2 | ((a2 & this->field_0[4]) << this->field_48) | ((a2 & this->field_0[5]) << this->field_50) | ((a2 & this->field_0[6]) << this->field_58); + v2 <<= field_40; + return v2 | ((a2 & field_0.field_10) << field_48) | ((a2 & field_0.field_14) << field_50) | ((a2 & field_0.field_18) << field_58); } @@ -11722,7 +11735,7 @@ uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (WindowType)(WINDOW_Chest|WINDOW_Credits|0x2), 0, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_Chest|WINDOW_MainMenu|0x2), 0, 0); pGUIWindow_CurrentMenu->CreateButton(21u, 198u, 0xBFu, 0x12u, 1, 0, 0xA5u, 0, 0, nullstring, 0); pGUIWindow_CurrentMenu->CreateButton(21u, 218u, 0xBFu, 0x12u, 1, 0, 0xA5u, 1u, 0, nullstring, 0); pGUIWindow_CurrentMenu->CreateButton(21u, 238u, 0xBFu, 0x12u, 1, 0, 0xA5u, 2u, 0, nullstring, 0); @@ -12833,10 +12846,12 @@ //----- (0046082C) -------------------------------------------------------- bool Initialize_GamesLOD_NewLOD() { - pGames_LOD->AllocSubIndicesAndIO(0x12Cu, 0); + pGames_LOD = new LODWriteableFile; + pGames_LOD->AllocSubIndicesAndIO(300, 0); if (pGames_LOD->LoadFile("data\\games.lod", 1)) { - pNew_LOD->AllocSubIndicesAndIO(0x12Cu, 0x186A0u); + pNew_LOD = new LODWriteableFile; + pNew_LOD->AllocSubIndicesAndIO(300, 0x186A0u); return true; } return false; @@ -13629,14 +13644,6 @@ //----- (004627B7) -------------------------------------------------------- void __cdecl MainMenu_Loop() { - unsigned int v0; // eax@8 - Texture *v1; // esi@8 - unsigned int v2; // eax@8 - Texture *v3; // edi@8 - unsigned int v4; // eax@8 - Texture *v5; // ebp@8 - unsigned int v6; // eax@8 - Texture *v7; // ebx@8 GUIButton *v8; // eax@27 unsigned int v9; // ecx@35 int v10; // ecx@36 @@ -13645,14 +13652,9 @@ Texture *v13; // [sp-14h] [bp-50h]@39 GUIButton *v14; // [sp+0h] [bp-3Ch]@27 GUIWindow *v15; // [sp+4h] [bp-38h]@11 - LONG uMouseX; // [sp+8h] [bp-34h]@11 - LONG uMouseY; // [sp+Ch] [bp-30h]@11 - POINT v18; // [sp+10h] [bp-2Ch]@11 - POINT v19; // [sp+18h] [bp-24h]@11 - MSG Msg; // [sp+20h] [bp-1Ch]@15 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) pAsyncKeyboard->Resume(); @@ -13662,97 +13664,100 @@ ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pWindow_Credits = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_Credits, 0, 0); - v0 = pIcons_LOD->LoadTexture("title_new", TEXTURE_16BIT_PALETTE); - v1 = (Texture *)(v0 != -1 ? (int)&pIcons_LOD->pTextures[v0] : 0); - pMainMenu_BtnNew = pWindow_Credits->CreateButton( - 0x1EFu, - 0xACu, - (v0 != -1 ? pIcons_LOD->pTextures[v0].uTextureWidth : 24), - (v0 != -1 ? pIcons_LOD->pTextures[v0].uTextureHeight : 26), - 1, - 0, - 0x36u, - 0, - 0x4Eu, - nullstring, - v1, - 0); - v2 = pIcons_LOD->LoadTexture("title_load", TEXTURE_16BIT_PALETTE); - v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); - pMainMenu_BtnLoad = pWindow_Credits->CreateButton( - 0x1EFu, - 0xE3u, - (v2 != -1 ? pIcons_LOD->pTextures[v2].uTextureWidth : 24), - (v2 != -1 ? pIcons_LOD->pTextures[v2].uTextureHeight : 26), - 1, - 0, - 0x37u, - 1u, - 0x4Cu, - nullstring, - v3, - 0); - v4 = pIcons_LOD->LoadTexture("title_cred", TEXTURE_16BIT_PALETTE); - v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); - pMainMenu_BtnCredits = pWindow_Credits->CreateButton( - 0x1EFu, - 0x11Au, - (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24), - (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureHeight : 26), - 1, - 0, - 0x38u, - 2u, - 0x43u, - nullstring, - v5, - 0); - v6 = pIcons_LOD->LoadTexture("title_exit", TEXTURE_16BIT_PALETTE); - v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); - pMainMenu_BtnExit = pWindow_Credits->CreateButton( - 0x1EFu, - 0x151u, - (v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24), - (v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureHeight : 26), - 1, - 0, - 0x39u, - 3u, - 0, - nullstring, - v7, - 0); + pWindow_Credits = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); + + auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); + //v0 = pIcons_LOD->LoadTexture("title_new", TEXTURE_16BIT_PALETTE); + //v1 = (Texture *)(v0 != -1 ? &pIcons_LOD->pTextures[v0] : 0); + pMainMenu_BtnNew = pWindow_Credits->CreateButton(495, 172, + pNew->uTextureWidth, + pNew->uTextureHeight, + 1, + 0, + 54, + 0, + 78, + "", + pNew, + 0); + //v2 = pIcons_LOD->LoadTexture("title_load", TEXTURE_16BIT_PALETTE); + //v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); + auto pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); + pMainMenu_BtnLoad = pWindow_Credits->CreateButton(495, 227, + pLoad->uTextureWidth, + pLoad->uTextureHeight, + 1, + 0, + 55, + 1, + 76, + "", + pLoad, + 0); + //v4 = pIcons_LOD->LoadTexture("title_cred", TEXTURE_16BIT_PALETTE); + //v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); + auto pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE); + pMainMenu_BtnCredits = pWindow_Credits->CreateButton(495, 282, + pCredits->uTextureWidth, + pCredits->uTextureHeight, + 1, + 0, + 56, + 2, + 67, + "", + pCredits, + 0); + //v6 = pIcons_LOD->LoadTexture("title_exit", TEXTURE_16BIT_PALETTE); + //v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); + auto pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE); + pMainMenu_BtnExit = pWindow_Credits->CreateButton(495, 337, + pExit->uTextureWidth, + pExit->uTextureHeight, + 1, + 0, + 57, + 3, + 0, + "", + pExit, + 0); + stru_506F20.Release(); stru_506F20.Load("title.pcx", 0); - SetCurrentMenuID(0); + SetCurrentMenuID(MENU_MAIN); SetForegroundWindow(hWnd); - SendMessageA(hWnd, 0x1Cu, 1u, 0); - while ( !uCurrentMenuID || uCurrentMenuID == 3 ) - { - uMouseX = pMouse->GetCursorPos(&v18)->x; - uMouseY = pMouse->GetCursorPos(&v19)->y; + SendMessageA(hWnd, WM_ACTIVATEAPP, 1, 0); + while (uCurrentMenuID == MENU_MAIN || + uCurrentMenuID == MENU_LOAD) + { + POINT pt; + pMouse->GetCursorPos(&pt); + //uMouseX = pMouse->GetCursorPos(&v18)->x; + //uMouseY = pMouse->GetCursorPos(&v19)->y; v15 = pWindow_Credits; - if ( uCurrentMenuID == 3 ) + if ( uCurrentMenuID == MENU_LOAD) { if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 12 ) { stru_506F20.Release(); stru_506F20.Load("lsave640.pcx", 0); - pGUIWindow2 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Credits, 0, 0); + pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 12; GameUI_DrawLoadMenu(0); } v15 = pGUIWindow_CurrentMenu; } - while ( PeekMessageA(&Msg, 0, 0, 0, 1u) ) - { - if ( Msg.message == 18 ) + + MSG msg; + while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) ) + { + if (msg.message == WM_QUIT) Game_DeinitializeAndTerminate(0); - TranslateMessage(&Msg); - DispatchMessageA(&Msg); - } - if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) + TranslateMessage(&msg); + DispatchMessageA(&msg); + } + if (dword_6BE364_game_settings_1 & 0x0100) { WaitMessage(); } @@ -13760,11 +13765,11 @@ { pRenderer->BeginScene(); pRenderer->DrawTextureRGB(0, 0, &stru_506F20); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(1); GUI_MainMenuMessageProc(); GUI_UpdateWindows(); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(1); if ( uCurrentMenuID ) { @@ -13789,10 +13794,10 @@ { while ( 1 ) { - if ( uMouseX >= (signed int)v8->uX - && uMouseX <= (signed int)v8->uZ - && uMouseY >= (signed int)v8->uY - && uMouseY <= (signed int)v8->uW + if ( pt.x >= (signed int)v8->uX + && pt.x <= (signed int)v8->uZ + && pt.y >= (signed int)v8->uY + && pt.y <= (signed int)v8->uW && v15 == pWindow_Credits ) { v9 = v8->uControlParam; @@ -13806,24 +13811,24 @@ { if ( v11 != 1 ) goto LABEL_44; - v13 = v7; + v13 = pExit; v12 = 337; } else { - v13 = v5; + v13 = pCredits; v12 = 282; } } else { - v13 = v3; + v13 = pLoad; v12 = 227; } } else { - v13 = v1; + v13 = pNew; v12 = 172; } pRenderer->DrawTextureIndexed(495u, v12, v13); @@ -13856,8 +13861,6 @@ pWindow_Credits->Release(); pIcons_LOD->_4114F2(); } -// 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; -// 6BE364: using guessed type int dword_6BE364_game_settings_1; @@ -13921,7 +13924,7 @@ v28 = 0; if ( pArcomageGame->bGameInProgress ) { - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 7; v29 = 1; @@ -13940,7 +13943,7 @@ v31 = 0; if ( !pArcomageGame->bGameInProgress ) goto LABEL_240; - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 8; v29 = 1; @@ -13949,7 +13952,7 @@ v32 = 0; if ( !pArcomageGame->bGameInProgress ) goto LABEL_218; - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 3; v29 = 0; @@ -13964,7 +13967,7 @@ back_to_game(); return DefWindowProcA(hWnd, Msg, wParam, v4); } - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 4; v29 = 0; @@ -13973,7 +13976,7 @@ v28 = 0; if ( pArcomageGame->bGameInProgress ) { - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 7; return DefWindowProcA(hWnd, Msg, wParam, v4); @@ -14027,7 +14030,7 @@ } goto _def_wnd_proc; } - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 8; return DefWindowProcA(hWnd, Msg, wParam, v4); @@ -14049,7 +14052,7 @@ case WM_MOUSEMOVE: if ( pArcomageGame->bGameInProgress ) { - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pXY[0] = (unsigned __int16)lParam; pXY[1] = lParam >> 16; @@ -14063,7 +14066,7 @@ } else { - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); } @@ -14364,7 +14367,7 @@ Abortf(pGlobalTXT_LocalizationStrings[62]); } BYTE1(dword_6BE364_game_settings_1) &= 0xFEu; - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); if ( pArcomageGame->bGameInProgress ) { @@ -14401,7 +14404,7 @@ dword_4E98BC_bApplicationActive = 0; if ( (pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) && pVideoPlayer->bPlayingMovie ) pVideoPlayer->bStopBeforeSchedule = 1; - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Suspend(); if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) SetWindowPos(::hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); @@ -14448,7 +14451,7 @@ pAsyncKeyboard->_45B3A4(); } } - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_46B1DD(); PostQuitMessage(0); return 0; @@ -14461,7 +14464,7 @@ if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) SetWindowPos(::hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); ClipCursor(0); - if ( pAsyncMouse ) + if (pAsyncMouse) { pAsyncMouse->Suspend(); return DefWindowProcA(hWnd, Msg, wParam, v4); @@ -14582,10 +14585,13 @@ { pViewport->SetScreen(viewparams->uSomeX, viewparams->uSomeY, viewparams->uSomeZ, viewparams->uSomeW); pViewport->_4C02F8((signed __int64)(flt_6BE3A0 * 65536.0)); + + pIndoorCamera = new IndoorCamera; pIndoorCamera->Initialize( 65, viewparams->uScreenZ - viewparams->uScreenX + 1, viewparams->uScreenW - viewparams->uScreenY + 1); + InitializeTurnBasedAnimations(&stru_50C198); pBitmaps_LOD->dword_11B84 = pBitmaps_LOD->uNumLoadedFiles; pSprites_LOD->field_ECA0 = pSprites_LOD->uNumLoadedSprites; @@ -15200,6 +15206,8 @@ bCanLoadFromCD = GetPrivateProfileIntW(L"settings", L"use_cd", 1, pMM6IniFile); + if (bNoCD) + bCanLoadFromCD = false; if (bCanLoadFromCD) { if (!FindMM7CD(hWnd, &cMM7GameCDDriveLetter)) @@ -15461,18 +15469,11 @@ //----- (00465D0B) -------------------------------------------------------- void __cdecl SecondaryInitialization() { - //_UNKNOWN *v0; // edi@3 - //char **v1; // ebp@3 - //char *v2; // esi@3 - //__int16 uIconID; // ax@4 __int16 v4; // ax@4 signed int v5; // esi@5 int v6; // ecx@6 int v7; // edx@7 ObjectDesc *v8; // eax@7 - //signed int v9; // esi@8 - signed int v10; // ebx@14 - signed int v11; // esi@15 char pContainer[32]; // [sp+10h] [bp-Ch]@9 pMouse->Initialize(hWnd); @@ -15558,9 +15559,15 @@ if ( pSprites_LOD->field_ECA0 < (signed int)pSprites_LOD->uNumLoadedSprites ) pSprites_LOD->field_ECA0 = pSprites_LOD->uNumLoadedSprites; pPaletteManager->LockAll(); + _mkdir("Saves"); - v10 = 1; - do + for (uint i = 0; i < 5; ++i) + for (uint j = 0; j < 6; ++j) + { + sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", i, j); + remove(pTmpBuf); + } + /*do { v11 = 1; do @@ -15572,7 +15579,8 @@ while ( v11 < 6 ); ++v10; } - while ( v10 < 5 ); + while ( v10 < 5 );*/ + Initialize_GamesLOD_NewLOD(); dword_576E2C = 512; dword_576E28 = 9; @@ -15613,8 +15621,10 @@ if (wcsstr(pCmdLine, L"-noanim")) { dword_6BE364_game_settings_1 |= 0x40; - bNoVideo = 1; - } + bNoVideo = true; + } + if (wcsstr(pCmdLine, L"-nocd")) + bNoCD = true; } stru_51076C.registry_debug_flags = ReadWindowsRegistryInt("debug flags", 0); @@ -15659,7 +15669,7 @@ pGame->Deinitialize(); return true; } - if ( uCurrentMenuID == 1 ) + if (GetCurrentMenuID() == MENU_NEWGAME) { if ( pAudioPlayer->hAILRedbook ) AIL_redbook_stop(pAudioPlayer->hAILRedbook); @@ -15703,7 +15713,7 @@ if ( uCurrentMenuID != 10 ) goto LABEL_49; pMouse->Activate(0); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Suspend(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) pAsyncKeyboard->Suspend(); @@ -15714,7 +15724,7 @@ if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) { pMouse->Activate(1); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) pAsyncKeyboard->Resume(); @@ -15723,7 +15733,7 @@ _chdir("..\\"); strcpy(pCurrentMapName, ofn.lpstrFileTitle); pMouse->Activate(1); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) pAsyncKeyboard->Resume(); @@ -16069,7 +16079,7 @@ } //----- (00466CA0) -------------------------------------------------------- -unsigned int __cdecl GetCurrentMenuID() +unsigned int GetCurrentMenuID() { return uCurrentMenuID; } @@ -16649,7 +16659,7 @@ if ( a1 <= 782 ) { uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE); - ptr_507BC4 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)30, v1 - 700, 0); + ptr_507BC4 = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)30, v1 - 700, 0); } } } @@ -16934,7 +16944,7 @@ if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0) || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 ) { - if ( pAsyncMouse ) + if (pAsyncMouse) { v18 = *((int *)pAsyncMouse + 6); v19 = *((int *)pAsyncMouse + 7); @@ -17082,7 +17092,7 @@ } return; } - if ( pAsyncMouse ) + if (pAsyncMouse) { v32 = *((int *)pAsyncMouse + 6); v33 = *((int *)pAsyncMouse + 7); @@ -17932,7 +17942,7 @@ goto LABEL_36; } if ( v25->IsInteractive() ) - v24 = (const char *)dword_722240[2 * stru_5E4C90.field_0[v26->field_1C]]; + v24 = pNPCTopics[stru_5E4C90.field_0[v26->field_1C] + 379].pTopic; else v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20; LABEL_51: