Mercurial > might-and-magic-trilogy
changeset 125:b90504bbb93b
Merge
author | Nomad |
---|---|
date | Fri, 16 Nov 2012 13:58:59 +0200 |
parents | acf7f12714a7 (current diff) 05b2d9653abc (diff) |
children | 0afe11853c77 |
files | mm7_3.cpp |
diffstat | 4 files changed, 159 insertions(+), 238 deletions(-) [+] |
line wrap: on
line diff
--- a/Outdoor.cpp Fri Nov 16 13:56:53 2012 +0200 +++ b/Outdoor.cpp Fri Nov 16 13:58:59 2012 +0200 @@ -368,7 +368,7 @@ { v12 = (unsigned __int8)aTiletableLoadU[v10 + 39]; uDefaultTravelTime_ByFoot = (unsigned __int8)byte_4ECA93[v10]; - sprintfex(pOut, "out%02d.odm", v12); + sprintf(pOut, "out%02d.odm", v12); uLevel_StartingPointType = (unsigned __int8)byte_4ECACF[v10]; return 1; }
--- a/Render.cpp Fri Nov 16 13:56:53 2012 +0200 +++ b/Render.cpp Fri Nov 16 13:58:59 2012 +0200 @@ -906,9 +906,9 @@ //----- (0047F5C6) -------------------------------------------------------- float Render::DrawBezierTerrain() { - __debugbreak(); - return 0; - /* +// __debugbreak(); + // return 0; + unsigned int v0; // ebx@1 unsigned int v1; // edi@1 unsigned int v2; // eax@1 @@ -988,6 +988,7 @@ IndoorCameraD3D *v76; // ecx@184 int v77; // ecx@184 int v79; // ebx@185 + int v127; // esi@185 int v86; // edi@196 int v87; // eax@196 int v88; // ecx@196 @@ -1585,68 +1586,41 @@ v77 = v73 - 2; if ( v73 - 2 < v75 ) { - _ESI = 0; + v127 = 0; v79 = (v73 - 66) << 9; v116 = v77; v105 = v79; v111 = v75 - v77; do { - __asm { fild [ebp+var_58] } - _EAX = ptr_801A08; - __asm - { - fst [ebp+var_54] - fstp dword ptr [esi+eax] - } - v105 = (64 - terrain_76D9C8[v70]) << 9; - _EAX = ptr_801A08; - __asm - { - fild [ebp+var_58] - fstp dword ptr [esi+eax+4] - } - v105 = pOutdoor->GetHeightOnTerrain(v116, terrain_76D9C8[v70]); - _EAX = ptr_801A08; - __asm - { - fild [ebp+var_58] - fstp dword ptr [esi+eax+8] - fld [ebp+var_54] - } - _EAX = ptr_801A04; - __asm { fstp dword ptr [esi+eax] } - v105 = (63 - terrain_76D9C8[v70]) << 9; - _EAX = ptr_801A04; - __asm - { - fild [ebp+var_58] - fstp dword ptr [esi+eax+4] - } - v105 = pOutdoor->GetHeightOnTerrain(v116, terrain_76D9C8[v70] + 1); - _EAX = ptr_801A04; - __asm - { - fild [ebp+var_58] - fstp dword ptr [esi+eax+8] - } + *(float *)&v106 = (double)v105; + *(float *)((char *)&ptr_801A08->vWorldPosition.x + v127) = *(float *)&v106; + v105 = (64 - *(int *)((char *)terrain_76D9C8 + v70)) << 9; + *(float *)((char *)&ptr_801A08->vWorldPosition.y + v127) = (double)v105; + v105 = pOutdoor->GetHeightOnTerrain(v112, *(int *)((char *)terrain_76D9C8 + v70)); + *(float *)((char *)&ptr_801A08->vWorldPosition.z + v127) = (double)v105; + *(float *)((char *)&ptr_801A04->vWorldPosition.x + v127) = *(float *)&v106; + v105 = (63 - *(int *)((char *)terrain_76D9C8 + v70)) << 9; + *(float *)((char *)&ptr_801A04->vWorldPosition.y + v127) = (double)v105; + v105 = pOutdoor->GetHeightOnTerrain(v112, *(int *)((char *)terrain_76D9C8 + v70) + 1); + *(float *)((char *)&ptr_801A04->vWorldPosition.z + v127) = (double)v105; if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) { - a1->ViewTransform(&ptr_801A08[_ESI], 1u); - a1->ViewTransform(&ptr_801A04[_ESI], 1u); - a1->Project(&ptr_801A08[_ESI], 1u, 0); - a1->Project(&ptr_801A04[_ESI], 1u, 0); + a1->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v127, 1); + a1->ViewTransform((RenderVertexSoft *)(char *)ptr_801A04 + v127, 1); + a1->Project((RenderVertexSoft *)(char *)ptr_801A08 + v127, 1, 0); + a1->Project((RenderVertexSoft *)(char *)ptr_801A04 + v127, 1, 0); } v79 += 512; - ++_ESI; + v127 += 48; ++v116; v105 = v79; - } + } while ( v116 < v107 ); } - v103 = abs(pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v70]); - v104 = abs(pIndoorCamera->uMapGridCellX - terrain_76DBC8[v70]); - if ( pRenderer->pRenderD3D ) + v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v70]); + v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v70]); + if ( pRenderer->pRenderD3D ) Render::DrawTerrainD3D(v111, 0, (int)&v102); else Render::DrawTerrainSW(v111, 0, (int)&v102); @@ -1675,7 +1649,7 @@ v107 = v90 + 2; if ( v89 - 2 < v90 + 2 ) { - _ESI = 0; + v86 = 0; v116 = v89 - 2; v92 = (66 - v89) << 9; v105 = (66 - v89) << 9; @@ -1683,59 +1657,35 @@ do { v93 = v116; - v106 = (terrain_76DBC8[v86] - 64) << 9; - _EAX = ptr_801A08; - __asm - { - fild [ebp+var_54] - fstp dword ptr [esi+eax] - fild [ebp+var_58] - } - _EAX = ptr_801A08; - __asm - { - fst [ebp+var_58] - fstp dword ptr [esi+eax+4] - } - v106 = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86], v93); - _EAX = ptr_801A08; - __asm { fild [ebp+var_54] } + v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 64) << 9; + *(float *)((char *)&ptr_801A08->vWorldPosition.x + v86) = (double)v106; + *(float *)&v105 = (double)v105; + *(float *)((char *)&ptr_801A08->vWorldPosition.y + v86) = *(float *)&v105; + v106 = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86), v93); v97 = v116; - __asm { fstp dword ptr [esi+eax+8] } - v106 = (terrain_76DBC8[v86] - 63) << 9; - _EAX = ptr_801A04; - __asm - { - fild [ebp+var_54] - fstp dword ptr [esi+eax] - fld [ebp+var_58] - } - _EAX = ptr_801A04; - __asm { fstp dword ptr [esi+eax+4] } - v105 = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86] + 1, v97); - _EAX = ptr_801A04; - __asm - { - fild [ebp+var_58] - fstp dword ptr [esi+eax+8] - } + *(float *)((char *)&ptr_801A08->vWorldPosition.z + v86) = (double)v106; + v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 63) << 9; + *(float *)((char *)&ptr_801A04->vWorldPosition.x + v86) = (double)v106; + *(float *)((char *)&ptr_801A04->vWorldPosition.y + v86) = *(float *)&v105; + v105 = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97); + *(float *)((char *)&ptr_801A04->vWorldPosition.z + v86) = (double)v105; if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) { - a1->ViewTransform(&ptr_801A08[_ESI], 1u); - a1->ViewTransform(&ptr_801A04[_ESI], 1u); - a1->Project(&ptr_801A08[_ESI], 1u, 0); - a1->Project(&ptr_801A04[_ESI], 1u, 0); + a1->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1); + a1->ViewTransform((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1); + a1->Project((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1, 0); + a1->Project((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1, 0); } v92 -= 512; - ++_ESI; + v86 += 48; ++v116; v105 = v92; - } + } while ( v116 < v107 ); } - v103 = abs(pIndoorCamera->uMapGridCellX - terrain_76DBC8[v86]); - v104 = abs(pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v86]); - if ( pRenderer->pRenderD3D ) + v103 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v86]); + v104 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v86]); + if ( pRenderer->pRenderD3D ) Render::DrawTerrainD3D(v111, 1, (int)&v102); else Render::DrawTerrainSW(v111, 1, (int)&v102); @@ -1743,7 +1693,7 @@ } result = v126; pOutdoorCamera->field_40 = v126; - return result;*/ + return result; } // 47FFC4: inconsistent fpu stack // 4D864C: using guessed type char byte_4D864C; @@ -1854,7 +1804,7 @@ int sY; // [sp+B0h] [bp-20h]@6 RenderVertexSoft *a2; // [sp+B4h] [bp-1Ch]@3 unsigned int a5; // [sp+B8h] [bp-18h]@21 - RenderVertexSoft *_ECX; // [sp+BCh] [bp-14h]@6 + RenderVertexSoft *v101; // [sp+BCh] [bp-14h]@6 Vec3_float_ *v99; // [sp+C0h] [bp-10h]@17 RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6 RenderVertexSoft *a8; // [sp+C8h] [bp-8h]@6 @@ -1889,32 +1839,29 @@ v6 = abs(v83); --X; v93 = &stru_76E5C8[(v5 << 7) + v6]; - if ( !v93->field_0 - || ((v7 = v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = &pVerticesSR_801A10[v7], - v10 = &pVerticesSR_806210[v7 + 1]) : (v9 = &pVerticesSR_806210[v7 + 1], v10 = &pVerticesSR_801A10[v7]), + if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), + v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), ((a8 = v9, - pVertices = &pVerticesSR_801A10[v7 + 1], + pVertices = &pVerticesSR_801A10[1] + v7, v11 = v8->vWorldPosition.x, - _ECX = v10, - v12 = v11 + 6.7553994e15, + v101 = v10, + v12 = v11 + 6.755399441055744e15, sX = LODWORD(v12), - v13 = v8->vWorldPosition.y + 6.7553994e15, + v13 = v8->vWorldPosition.y + 6.755399441055744e15, sY = LODWORD(v13), thisd = (v10->vWorldPosition.x + v8->vWorldPosition.x) * 0.5, - v14 = WorldPosToGridCellX(COERCE_UNSIGNED_INT64(thisd + 6.7553994e15)), + v14 = WorldPosToGridCellX(COERCE_UNSIGNED_INT64(thisd + 6.755399441055744e15)), v15 = v9->vWorldPosition.y + v8->vWorldPosition.y, v89 = v14, thise = v15 * 0.5, - _this = (LightmapBuilder *)WorldPosToGridCellZ(COERCE_UNSIGNED_INT64(thise + 6.7553994e15)), + _this = (LightmapBuilder *)WorldPosToGridCellZ(COERCE_UNSIGNED_INT64(thise + 6.755399441055744e15)), WorldPosToGridCellX(sX), WorldPosToGridCellZ(sY), !byte_4D864C) || !(pGame->uFlags & 0x80)) - && !sub_481EFA(v8, v9, _ECX, pVertices, 1)) ) + && !sub_481EFA(v8, v9, v101, pVertices, 1)) ) goto LABEL_162; - if ( v8->vWorldPosition.z != v9->vWorldPosition.z - || v9->vWorldPosition.z != pVertices->vWorldPosition.z - || pVertices->vWorldPosition.z != _ECX->vWorldPosition.z ) + if ( v8->vWorldPosition.z != v9->vWorldPosition.z || v9->vWorldPosition.z != pVertices->vWorldPosition.z || pVertices->vWorldPosition.z != v101->vWorldPosition.z ) break; v16 = &array_77EC08[pOutdoorCamera->numStru148s]; v17 = pOutdoor->GetTileTexture(sX, sY); @@ -1940,13 +1887,13 @@ v99 = v23; thisf = 20.0 - (-v24 - v91 * v23->y - v90 * v23->x) * 20.0; v25 = thisf + 6.7553994e15; - v27 = __OFSUB__(pOutdoorCamera->numStru148s, 1999); + v27 = pOutdoorCamera->numStru148s > 1999; v26 = pOutdoorCamera->numStru148s - 1999 < 0; v16->field_58 = LOBYTE(v25); if ( !(v26 ^ v27) ) return; ++pOutdoorCamera->numStru148s; - if ( !sub_481FC9(v8, a8, _ECX, v16) ) + if ( !sub_481FC9(v8, a8, v101, v16) ) goto LABEL_126; v28 = 1.0 / (a2->vWorldViewPosition.x + 0.0000001); memcpy(array_50AC10, a2, 0x30u); @@ -1963,8 +1910,8 @@ array_50AC10[2].flt_20 = 1.0 / v30; array_50AC10[2].u = 1.0; array_50AC10[2].v = 1.0; - v31 = _ECX->vWorldViewPosition.x + 0.0000001; - memcpy(&array_50AC10[3], _ECX, sizeof(array_50AC10[3])); + v31 = v101->vWorldViewPosition.x + 0.0000001; + memcpy(&array_50AC10[3], v101, sizeof(array_50AC10[3])); array_50AC10[3].flt_20 = 1.0 / v31; array_50AC10[3].u = 1.0; array_50AC10[3].v = 0.0; @@ -1992,12 +1939,12 @@ } this_3 = a2->vWorldViewPosition.x < 8.0 || a8->vWorldViewPosition.x < 8.0 - || _ECX->vWorldViewPosition.x < 8.0 + || v101->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0; v32 = (double)pOutdoorCamera->shading_dist_mist; v108 = v32 < a2->vWorldViewPosition.x || v32 < a8->vWorldViewPosition.x - || v32 < _ECX->vWorldViewPosition.x + || v32 < v101->vWorldViewPosition.x || v32 < pVertices->vWorldViewPosition.x; LOBYTE(v33) = 0; pGame->pLightmapBuilder->std__vector_000004_size = 0; @@ -2238,7 +2185,7 @@ if ( pOutdoorCamera->numStru148s >= 1999 ) return; ++pOutdoorCamera->numStru148s; - if ( !sub_481FC9(_ECX, a2, pVertices, v59) ) + if ( !sub_481FC9(v101, a2, pVertices, v59) ) { LABEL_126: --pOutdoorCamera->numStru148s; @@ -2254,8 +2201,8 @@ array_50AC10[1].flt_20 = 1.0 / v67; array_50AC10[1].u = 1.0; array_50AC10[1].v = 1.0; - v68 = _ECX->vWorldViewPosition.x + 0.0000001; - memcpy(&array_50AC10[2], _ECX, sizeof(array_50AC10[2])); + v68 = v101->vWorldViewPosition.x + 0.0000001; + memcpy(&array_50AC10[2], v101, sizeof(array_50AC10[2])); array_50AC10[2].flt_20 = 1.0 / v68; array_50AC10[2].u = 1.0; array_50AC10[2].v = 0.0; @@ -2283,9 +2230,9 @@ } this_3b = a2->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 - || _ECX->vWorldViewPosition.x < 8.0; + || v101->vWorldViewPosition.x < 8.0; v69 = (double)pOutdoorCamera->shading_dist_mist; - v108 = v69 < a2->vWorldViewPosition.x || v69 < pVertices->vWorldViewPosition.x || v69 < _ECX->vWorldViewPosition.x; + v108 = v69 < a2->vWorldViewPosition.x || v69 < pVertices->vWorldViewPosition.x || v69 < v101->vWorldViewPosition.x; LOBYTE(v70) = 0; v96->std__vector_000004_size = 0; if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) @@ -7140,7 +7087,7 @@ //----- (004A2031) -------------------------------------------------------- unsigned int Render::GetActorTintColor(float a2, int a3, int a4, int a5, RenderBillboard *a6) { - return GetActorTintColor(a3, a4, a2, a5, a6); + return ::GetActorTintColor(a3, a4, a2, a5, a6); }
--- a/mm7_2.cpp Fri Nov 16 13:56:53 2012 +0200 +++ b/mm7_2.cpp Fri Nov 16 13:58:59 2012 +0200 @@ -146,7 +146,7 @@ _this.uFrameZ = 334; v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - sprintfex(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); + sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); _this.DrawText2(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u); if ( dword_F8B19C == 1 ) { @@ -207,7 +207,7 @@ v0 = ptr_507BC0; if ( ptr_507BC0->field_40 == 1 ) { - sprintfex(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); + sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); _this.DrawText2(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u); _this.DrawText2(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); v3 = pFontArrus; @@ -258,8 +258,8 @@ v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v7 = v5->pName; v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - sprintfex(pTmpBuf, &byte_4F0F98, v8, v7, v6); - sprintfex(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); + sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6); + sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); ptr_F8B1E8 = pTmpBuf2; memcpy(&a1, pDialogueWindow, sizeof(a1)); w.uFrameWidth = 458; @@ -311,7 +311,7 @@ _this.uFrameZ = 334; *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - sprintfex(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); + sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); _this.DrawText2(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); if ( dword_F8B19C != 1 ) { @@ -395,7 +395,7 @@ v11 = pGlobalTXT_LocalizationStrings[112]; v10 = pGlobalTXT_LocalizationStrings[244]; } - sprintfex(pTmpBuf, "%s\n%s", v10, v11); + sprintf(pTmpBuf, "%s\n%s", v10, v11); _this.DrawText2(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); _this.DrawText2(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); v4 = pFontArrus; @@ -682,7 +682,7 @@ while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); if ( v86 ) { - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); v79.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); pOutString = (GUIFont *)((149 - v89) / v86); if ( (149 - v89) / v86 > 32 ) @@ -732,7 +732,7 @@ } } v26 = pTmpBuf; - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->uClass]); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->uClass]); strcat(pTmpBuf, "\n \n"); strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); goto LABEL_97; @@ -771,16 +771,16 @@ v28 = *(int *)v84; if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) v28 = v81; - sprintfex(&Dest, format_4E2DC8, v28); - sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); + sprintf(&Dest, format_4E2DC8, v28); + sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); strcat(&Dest, pTmpBuf2); v90 = pFontArrus->CalcTextHeight(&Dest, &v79, 0, 0); strcat(&Dest, "\n \n"); v29 = *(int *)v84; if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) v29 = v81; - sprintfex(&a1, format_4E2DC8, v29); - sprintfex(pTmpBuf2, + sprintf(&a1, format_4E2DC8, v29); + sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[86], //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], (signed __int64)p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier, @@ -791,7 +791,7 @@ v30 = *(int *)v84; if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) v30 = v81; - sprintfex(&v77, format_4E2DC8, v30); + sprintf(&v77, format_4E2DC8, v30); strcat(&v77, pGlobalTXT_LocalizationStrings[160]); v82 = pFontArrus->CalcTextHeight(&v77, &v79, 0, 0); strcat(&v77, "\n \n"); @@ -803,7 +803,7 @@ v32 = *(int *)v84; if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) v32 = v81; - sprintfex(&v75, format_4E2DC8, v32); + sprintf(&v75, format_4E2DC8, v32); strcat(&v75, pGlobalTXT_LocalizationStrings[611]); v87 = pFontArrus->CalcTextHeight(&v75, &v79, 0, 0); } @@ -817,7 +817,7 @@ if ( !(v37 ^ __OFSUB__(v34, v35)) ) { LABEL_75: - sprintfex(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); + sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); v71 = 3; v69 = pTmpBuf; v67 = 0; @@ -1218,7 +1218,7 @@ if ( !v109 ) { LABEL_105: - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]); strcat(pTmpBuf, "\n \n"); strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); v7 = pTmpBuf; @@ -1230,7 +1230,7 @@ v77 = &v101; goto LABEL_15; } - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108); v101.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); v108 = (149 - v106.y) / (signed int)v109; if ( (149 - v106.y) / (signed int)v109 > 32 ) @@ -1957,7 +1957,7 @@ while ( (signed int)v6 < v2->pNumPresenceButton + v2->pStartingPosActiveItem ); if ( v114 ) { - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111); v104.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); v111 = (const char **)((signed int)(149 - v112) / v114); if ( (signed int)(149 - v112) / v114 > 32 ) @@ -2007,7 +2007,7 @@ return result; } } - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]); strcat(pTmpBuf, "\n \n"); strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); v21 = pTmpBuf; @@ -2551,7 +2551,7 @@ while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); if ( v153 ) { - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); v144.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); _this = (Player *)((149 - v152) / v153); if ( (149 - v152) / v153 > 32 ) @@ -2600,7 +2600,7 @@ return; } } - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->uClass]); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->uClass]); strcat(pTmpBuf, "\n \n"); strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); v11 = 0; @@ -5157,7 +5157,7 @@ { v4 = pClassNames[(unsigned __int8)v3[17]]; v5 = ((Player *)(v3 - 168))->GetBaseLevel(); - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[129], i, v5, v4); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[129], i, v5, v4); pWindow.DrawText2( pFont, 1u, @@ -5184,10 +5184,10 @@ v9 = pGlobalTXT_LocalizationStrings[245]; if ( v14 != 1 ) v9 = pGlobalTXT_LocalizationStrings[132]; - sprintfex(pTmpBuf2, " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7); + sprintf(pTmpBuf2, " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7); strcat(pTmpBuf, pTmpBuf2); pWindow.DrawText2(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf, 3u); - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[94], v23); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[94], v23); pWindow.DrawText2(pFont, 1u, pWindow.uFrameHeight, 1u, pTmpBuf, 3u); BYTE1(dword_6BE364_game_settings_1) |= 0x40u; pRenderer->EndScene(); @@ -7520,10 +7520,10 @@ int v16; // eax@19 int v17; // ecx@19 int v18; // esi@31 - int v19; // ecx@32 - int v20; // edx@32 - int v21; // eax@32 - Actor *v22; // esi@35 + //int pPosX; // ecx@32 + //int v20; // edx@32 + //int v21; // eax@32 + Actor *pMonster; // esi@35 int v23; // edx@36 signed int v24; // edi@36 int v25; // ecx@36 @@ -7546,7 +7546,7 @@ //void *v42; // [sp-10h] [bp-F8h]@50 //size_t v43; // [sp-Ch] [bp-F4h]@50 const char *v44; // [sp-8h] [bp-F0h]@13 - char *v45; // [sp-4h] [bp-ECh]@9 + char *pTexture; // [sp-4h] [bp-ECh]@9 char Str[32]; // [sp+Ch] [bp-DCh]@60 char Str2[120]; // [sp+2Ch] [bp-BCh]@29 unsigned int uFaceID; // [sp+A4h] [bp-44h]@52 @@ -7555,13 +7555,12 @@ char Source[32]; // [sp+B0h] [bp-38h]@20 int v52; // [sp+D0h] [bp-18h]@34 int v53; // [sp+D4h] [bp-14h]@34 - int v54; // [sp+D8h] [bp-10h]@32 - int v55; // [sp+DCh] [bp-Ch]@32 + int pSector; // [sp+D8h] [bp-10h]@32 + int pPosX; // [sp+DCh] [bp-Ch]@32 int v56; // [sp+E0h] [bp-8h]@8 int v57; // [sp+E4h] [bp-4h]@1 //auto a2 = spawn; - v57 = 0; //v5 = pMapInfo; //v6 = spawn; @@ -7571,15 +7570,12 @@ v7 = pIndoor->dlv.field_C_alert; else v7 = 0; - if (v7) v8 = (spawn->uAttributes & 1) == 0; else v8 = (spawn->uAttributes & 1) == 1; - if (v8) return; - //result = (void *)(spawn->uIndex - 1); v56 = 1; switch (spawn->uIndex - 1) @@ -7588,82 +7584,70 @@ v9 = pMapInfo->uEncounterMonster1AtLeast; v10 = rand(); v11 = pMapInfo->uEncounterMonster1AtMost; - v45 = pMapInfo->pEncounterMonster1Texture; + pTexture = pMapInfo->pEncounterMonster1Texture; v12 = v10 % (v11 - v9 + 1); v13 = pMapInfo->field_34; goto LABEL_20; - case 3u: - v45 = pMapInfo->pEncounterMonster1Texture; + pTexture = pMapInfo->pEncounterMonster1Texture; v44 = "%s A"; goto LABEL_25; - case 4u: - v45 = pMapInfo->pEncounterMonster2Texture; + pTexture = pMapInfo->pEncounterMonster2Texture; v44 = "%s A"; goto LABEL_25; - case 5u: - v45 = pMapInfo->pEncounterMonster3Texture; + pTexture = pMapInfo->pEncounterMonster3Texture; v44 = "%s A"; goto LABEL_25; - case 1u: v9 = pMapInfo->uEncounterMonster2AtLeast; v14 = rand(); v15 = pMapInfo->uEncounterMonster2AtMost; - v45 = pMapInfo->pEncounterMonster2Texture; + pTexture = pMapInfo->pEncounterMonster2Texture; v12 = v14 % (v15 - v9 + 1); v13 = pMapInfo->field_37; goto LABEL_20; - case 6u: - v45 = pMapInfo->pEncounterMonster1Texture; + pTexture = pMapInfo->pEncounterMonster1Texture; v44 = "%s B"; goto LABEL_25; - case 7u: - v45 = pMapInfo->pEncounterMonster2Texture; + pTexture = pMapInfo->pEncounterMonster2Texture; v44 = "%s B"; goto LABEL_25; - case 8u: - v45 = pMapInfo->pEncounterMonster3Texture; + pTexture = pMapInfo->pEncounterMonster3Texture; v44 = "%s B"; goto LABEL_25; - case 2u: v9 = pMapInfo->uEncounterMonster3AtLeast; v16 = rand(); v17 = pMapInfo->uEncounterMonster3AtMost; - v45 = pMapInfo->pEncounterMonster3Texture; + pTexture = pMapInfo->pEncounterMonster3Texture; v12 = v16 % (v17 - v9 + 1); v13 = pMapInfo->field_3A; LABEL_20: v57 = v13; v56 = v9 + v12; - strcpy(Source, v45); + strcpy(Source, pTexture); goto LABEL_26; - case 9u: - v45 = pMapInfo->pEncounterMonster1Texture; + pTexture = pMapInfo->pEncounterMonster1Texture; v44 = "%s C"; goto LABEL_25; - case 0xAu: - v45 = pMapInfo->pEncounterMonster2Texture; + pTexture = pMapInfo->pEncounterMonster2Texture; v44 = "%s C"; goto LABEL_25; - case 0xBu: - v45 = pMapInfo->pEncounterMonster3Texture; + pTexture = pMapInfo->pEncounterMonster3Texture; v44 = "%s C"; LABEL_25: - sprintf(Source, v44, v45); + sprintf(Source, v44, pTexture); LABEL_26: if (Source[0] == '0') return; - v57 += a3; if ( v57 > 4 ) v57 = 4; @@ -7673,15 +7657,12 @@ v18 = v56; if ( (signed int)(v56 + uNumActors) >= 500 ) return; - v19 = spawn->vPosition.x; - v20 = spawn->vPosition.y; - v21 = spawn->vPosition.z; - v54 = 0; - v55 = v19; - a4 = v20; - a3 = v21; + pSector = 0; + pPosX = spawn->vPosition.x; + a4 = spawn->vPosition.y; + a3 = spawn->vPosition.z; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - v54 = pIndoor->GetSector(v19, v20, v21); + pSector = pIndoor->GetSector(spawn->vPosition.x, spawn->vPosition.y, spawn->vPosition.z); v53 = 0; v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; if ( v18 <= 0 ) @@ -7690,10 +7671,9 @@ default: return; } - for (uint i = v53; i < v56; ++i) { - v22 = &pActors[uNumActors]; + pMonster = &pActors[uNumActors]; pActors[uNumActors].Reset(); if ( v57 ) { @@ -7711,72 +7691,66 @@ } if ( v24 == 1 ) { - v45 = Source; + pTexture = Source; v44 = "%s A"; } else { if ( v24 == 2 ) { - v45 = Source; + pTexture = Source; v44 = "%s B"; } else { if ( v24 != 3 ) goto LABEL_58; - v45 = Source; + pTexture = Source; v44 = "%s C"; } } - sprintf(Str2, v44, v45); + sprintf(Str2, v44, pTexture); } v26 = pMonsterList->GetMonsterByName(Str2); v50 = (signed __int16)v26; - v45 = Str2; + pTexture = Str2; if ( (signed __int16)v26 == -1 ) { - sprintfex(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", v45); + sprintf(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", pTexture); MessageBoxA(nullptr, Str, nullptr, 0); ExitProcess(0); } v27 = &pMonsterList->pMonsters[(signed __int16)v26]; - v28 = pMonsterStats->_4563FF(v45); + v28 = pMonsterStats->_4563FF(pTexture); if ( !v28 ) v28 = 1; Src = &pMonsterStats->pInfos[v28]; - strcpy(v22->pActorName, Src->pName); - //v43 = 88; - //v42 = Src; - v29 = Src->uHP; - v41 = &v22->pMonsterInfo; - v22->sCurrentHP = v29; + strcpy(pMonster->pActorName, Src->pName); + pMonster->sCurrentHP = Src->uHP; assert(sizeof(MonsterInfo) == 88); - memcpy(v41, Src, sizeof(MonsterInfo)); - v22->word_000086_some_monster_id = v50 + 1; - v22->uActorRadius = v27->uMonsterRadius; - v22->uActorHeight = v27->uMonsterHeight; - v22->uMovementSpeed = v27->uMovementSpeed; - v30 = v55; - v22->vInitialPosition.x = v55; - v22->vPosition.x = v30; - v31 = a4; - v22->uTetherDistance = 256; - v22->vInitialPosition.y = v31; - v22->vPosition.y = v31; - v45 = 0; - v22->vInitialPosition.z = a3; - v22->vPosition.z = a3; - v22->uSectorID = v54; - v22->uGroup = spawn->uGroup; - v22->PrepareSprites((char)v45); - v22->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + memcpy(&pMonster->pMonsterInfo, Src, sizeof(MonsterInfo)); + pMonster->word_000086_some_monster_id = v50 + 1; + pMonster->uActorRadius = v27->uMonsterRadius; + pMonster->uActorHeight = v27->uMonsterHeight; + pMonster->uMovementSpeed = v27->uMovementSpeed; + pMonster->vInitialPosition.x = spawn->vPosition.x; + pMonster->vPosition.x = spawn->vPosition.x; + pMonster->uTetherDistance = 256; + pMonster->vInitialPosition.y = a4; + pMonster->vPosition.y = a4; + pTexture = 0; + pMonster->vInitialPosition.z = a3; + pMonster->vPosition.z = a3; + pMonster->uSectorID = pSector; + pMonster->uGroup = spawn->uGroup; + pMonster->PrepareSprites((char)pTexture); + pMonster->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; v32 = rand(); v33 = v32 % 2048; v34 = stru_5C6E00->SinCos(v32 % 2048); a4 = v34; a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16; - v55 = a3 + spawn->vPosition.x; + pPosX = a3 + spawn->vPosition.x; v35 = stru_5C6E00->SinCos(v33 - stru_5C6E00->uIntegerHalfPi); a4 = v35; a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16; @@ -7785,10 +7759,10 @@ a3 = spawn->vPosition.z; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) goto LABEL_55; - v37 = pIndoor->GetSector(v55, a4, v36); - if ( v37 == v54 ) - { - v38 = _46CEC3_get_floor_level(v55, a4, a3, v37, &uFaceID); + v37 = pIndoor->GetSector(pPosX, a4, v36); + if ( v37 == pSector ) + { + v38 = _46CEC3_get_floor_level(pPosX, a4, a3, v37, &uFaceID); v39 = v38; if ( v38 != -30000 ) { @@ -7797,7 +7771,7 @@ a3 = v39; LABEL_55: if ( a5 ) - v22->uAttributes |= 0x080000; + pMonster->uAttributes |= 0x080000; ++uNumActors; goto LABEL_58; } @@ -10339,7 +10313,7 @@ } if ( _strcmpi(*(const char **)(v2 + 4), "Hammerhands") ) { - sprintfex(pTmpBuf, "Unknown monster spell %s", *(int *)(v2 + 4)); + sprintf(pTmpBuf, "Unknown monster spell %s", *(int *)(v2 + 4)); MessageBoxA(nullptr, pTmpBuf, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0); result = 0; goto LABEL_76; @@ -15155,7 +15129,7 @@ a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; v1 = pItemsTable->pItems[(unsigned int)ptr_507BC4->ptr_1C + 700].pName; v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - sprintfex(pTmpBuf, format_4E2D80, v2, v1); + sprintf(pTmpBuf, format_4E2D80, v2, v1); a1.DrawText2(pFontCreate, 0, 0, 0, pTmpBuf, 3u); return a1.DrawText( pFontSmallnum, @@ -15851,7 +15825,7 @@ if ( pParty->pPickedItem.uItemID ) return 1; v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName; - sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24); + sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24); ShowStatusBarString(pTmpBuf2, 2u); if ( v19->uItemID == 506 ) _449B7E_toggle_bit(pParty->_award_bits, 184, 1u);
--- a/mm7_3.cpp Fri Nov 16 13:56:53 2012 +0200 +++ b/mm7_3.cpp Fri Nov 16 13:58:59 2012 +0200 @@ -7854,7 +7854,7 @@ HIDWORD(v36) = v19->uTextureHeight; v22 = (double)SHIDWORD(v36); HIDWORD(v36) = v18 >> 16; - v24 = __OFSUB__(v31, _this.uNumVertices); + v24 = _this.uNumVertices > v31; v23 = ((v31 - _this.uNumVertices) & 0x80000000u) != 0; *((float *)v7 - 9) = v21 / (v22 * 65536.0); *((float *)v7 - 16) = (double)pOutdoorCamera->shading_dist_mist; @@ -18701,7 +18701,7 @@ if ( v10 ) { v11 = uNumActors; - SpawnEncounter((MapInfo *)&pMapStats + v10, &v16, 0, count, 0); + SpawnEncounter((MapInfo *)&pMapStats->pInfos[v10], &v16, 0, count, 0); memcpy(&v15, Actor::GetDirectionInfo(8 * v11 | AI_OBJECT_ACTOR, 4u, &a3, 1), sizeof(v15)); v12 = v11; if ( (signed int)v11 < (signed int)uNumActors )