Mercurial > mm7
changeset 741:cd9ae9a2c99c
Слияние
author | Ritor1 |
---|---|
date | Fri, 22 Mar 2013 19:59:03 +0600 |
parents | 14cf77af15de (current diff) 2f4e33c1ed24 (diff) |
children | bd611ae85d27 |
files | Render.cpp mm7_3.cpp mm7_4.cpp |
diffstat | 17 files changed, 872 insertions(+), 939 deletions(-) [+] |
line wrap: on
line diff
--- a/GUIWindow.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/GUIWindow.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -523,7 +523,7 @@ pTexture_TownPortalIcons[2] = pIcons_LOD->LoadTexturePtr("tpwarlock", TEXTURE_16BIT_PALETTE); pTexture_TownPortalIcons[3] = pIcons_LOD->LoadTexturePtr("tpisland", TEXTURE_16BIT_PALETTE); pTexture_TownPortalIcons[4] = pIcons_LOD->LoadTexturePtr("tpheaven", TEXTURE_16BIT_PALETTE); - pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr( "tphell", TEXTURE_16BIT_PALETTE); + pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr("tphell", TEXTURE_16BIT_PALETTE); for (uint i = 0; i < 6; ++i) v1->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, 183, i, 0, "", nullptr);
--- a/Game.h Fri Mar 22 19:58:47 2013 +0600 +++ b/Game.h Fri Mar 22 19:59:03 2013 +0600 @@ -34,7 +34,7 @@ GAME_STATE_NEWGAME_OUT_GAMEMENU = 0x4, GAME_STATE_5 = 0x5, GAME_STATE_6 = 0x6, - GAME_STATE_7 = 0x7, + GAME_STATE_GAME_QUITTING_TO_MAIN_MENU = 7, GAME_STATE_8 = 0x8, GAME_STATE_FINAL_WINDOW = 0x9, GAME_STATE_A = 0xA
--- a/Indoor.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/Indoor.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -3227,8 +3227,8 @@ //LOWORD(v24) = v49->x; //v49 = v24; //v59 = v49->x; - v25 = v1->x >= sX ? 0 : 2; // BUG TODO TROLOLO - v26 = v25 | v2->x < sX; // SWAP v1 and v2 till the result's correct + v25 = v1->x >= sX ? 0 : 2; + v26 = v25 | v2->x < sX; if ( v26 != 3 ) { if (!v26)
--- a/Indoor_stuff.h Fri Mar 22 19:58:47 2013 +0600 +++ b/Indoor_stuff.h Fri Mar 22 19:59:03 2013 +0600 @@ -385,9 +385,9 @@ inline ~stru154() {} - int _49B04D(struct ODMFace *a2, struct BSPVertexBuffer *a3); - int _49B0C9(struct Vec3_float_ *pNormal, float dist); - int _49B13D(struct ODMFace *pFace, struct BSPVertexBuffer *pVertices, struct Vec3_float_ *a3, float *a4); + void GetFacePlaneAndClassify(struct ODMFace *a2, struct BSPVertexBuffer *a3); + void ClassifyPolygon(struct Vec3_float_ *pNormal, float dist); + void GetFacePlane(struct ODMFace *pFace, struct BSPVertexBuffer *pVertices, struct Vec3_float_ *pOutNormal, float *pOutDist); void (__thiscall ***vdestructor_ptr)(stru154 *, bool);
--- a/LOD.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/LOD.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -436,7 +436,7 @@ } //----- (004ACC38) -------------------------------------------------------- -int LODSprite::_4ACC38(RenderBillboardTransform_local0 *a2, char a3) +int LODSprite::DrawSprite_sw(RenderBillboardTransform_local0 *a2, char a3) { RenderBillboardTransform_local0 *v3; // edi@1 int result; // eax@1
--- a/LOD.h Fri Mar 22 19:58:47 2013 +0600 +++ b/LOD.h Fri Mar 22 19:59:03 2013 +0600 @@ -221,7 +221,7 @@ ~LODSprite(); void Release(); - int _4ACC38(struct RenderBillboardTransform_local0 *a2, char a3); + int DrawSprite_sw(struct RenderBillboardTransform_local0 *a2, char a3); int _4AD2D1(struct RenderBillboardTransform_local0 *a2, int a3); char pName[12]; //0
--- a/Render.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/Render.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -218,7 +218,7 @@ soft_billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, 0, 1); v5 = p->uHwSpriteID; if ( v5 >= 0 ) - pSprites_LOD->pSpriteHeaders[v5]._4ACC38(&soft_billboard, 1); + pSprites_LOD->pSpriteHeaders[v5].DrawSprite_sw(&soft_billboard, 1); } } } @@ -2150,7 +2150,7 @@ v33 = 3; else v33 = v108 != 0 ? 5 : 0; - static_sub_0048034E_stru_154._49B0C9(v23, v95); + static_sub_0048034E_stru_154.ClassifyPolygon(v23, v95); if ( pDecalBuilder->uNumDecals > 0 ) pDecalBuilder->ApplyDecals(31 - v16->dimming_level, 4, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, *(float *)&v33, -1); } @@ -2295,7 +2295,7 @@ else pVertices = (RenderVertexSoft *)(v108 != 0 ? 5 : 0); //a8 = (RenderVertexSoft *)(this_3a ? 3 : v108 != 0 ? 5 : 0); - static_sub_0048034E_stru_76D590._49B0C9(v48, *(float *)&a4); + static_sub_0048034E_stru_76D590.ClassifyPolygon(v48, *(float *)&a4); if ( pDecalBuilder->uNumDecals > 0 ) pDecalBuilder->ApplyDecals(31 - v40->dimming_level, 4, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)pVertices, -1); } @@ -2418,7 +2418,7 @@ v70 = 3; else v70 = v108 != 0 ? 5 : 0; - static_sub_0048034E_stru_76D578._49B0C9(v63, v87); + static_sub_0048034E_stru_76D578.ClassifyPolygon(v63, v87); if ( pDecalBuilder->uNumDecals > 0 ) pDecalBuilder->ApplyDecals(31 - v40->dimming_level, 4, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70, -1); } @@ -3050,7 +3050,7 @@ } v13 = *((short *)v1 - 8); if ( v13 >= 0 ) - pSprites_LOD->pSpriteHeaders[v13]._4ACC38(&billboard, 1); + pSprites_LOD->pSpriteHeaders[v13].DrawSprite_sw(&billboard, 1); } } }
--- a/UIPopup.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/UIPopup.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -643,12 +643,12 @@ //----- (0041E360) -------------------------------------------------------- -char *__fastcall MonsterPopup_Draw(unsigned int uActorID, GUIWindow *edx0) +void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *edx0) { unsigned int v2; // esi@1 Actor *v3; // esi@3 int v4; // eax@3 - unsigned int v5; // ecx@3 + //unsigned int v5; // ecx@3 NPCData *v6; // eax@3 unsigned __int16 v7; // cx@3 int v8; // eax@4 @@ -657,10 +657,10 @@ LODSprite *v11; // esi@17 unsigned int v12; // ecx@17 Sprite *v13; // edi@18 - int v14; // ecx@18 - int v15; // edx@18 - int v16; // edx@18 - int v17; // eax@18 + //int v14; // ecx@18 + //int v15; // edx@18 + //int v16; // edx@18 + //int v17; // eax@18 unsigned int v18; // ecx@19 unsigned int v19; // eax@21 char *v20; // esi@28 @@ -672,15 +672,15 @@ char *v26; // edx@34 unsigned __int8 v27; // sf@36 unsigned __int8 v28; // of@36 - int v29; // esi@40 - char *v30; // ecx@40 - int v31; // eax@40 - int v32; // esi@43 - unsigned __int16 v33; // ax@45 - int v34; // edx@45 - int v35; // eax@45 + //int v29; // esi@40 + //unsigned __int16 *v30; // ecx@40 + //int v31; // eax@40 + //int v32; // esi@43 + //unsigned __int16 v33; // ax@45 + //int v34; // edx@45 + //int v35; // eax@45 int v36; // eax@49 - char *v37; // eax@52 + //char *v37; // eax@52 int v38; // eax@55 unsigned __int16 v39; // ax@59 SpellBuff *v40; // eax@60 @@ -691,7 +691,7 @@ signed int v45; // edi@65 unsigned __int16 v46; // ax@73 Player *v47; // ecx@77 - unsigned int v48; // eax@85 + //unsigned int v48; // eax@85 GUIFont *v49; // edi@90 int v50; // edi@90 SpellBuff *v51; // eax@91 @@ -706,7 +706,7 @@ unsigned __int8 v60; // dl@138 char *v62; // eax@147 int v63; // eax@152 - char *result; // eax@152 + //char *result; // eax@152 int v65; // eax@155 const char *v66; // [sp-10h] [bp-1FCh]@121 const char *v67; // [sp-10h] [bp-1FCh]@125 @@ -735,20 +735,20 @@ unsigned int v109; // [sp+1A8h] [bp-44h]@32 LPVOID v110; // [sp+1ACh] [bp-40h]@28 unsigned int v111; // [sp+1B0h] [bp-3Ch]@29 - char **v112; // [sp+1B4h] [bp-38h]@3 - IDirectDrawSurface *v222; // [sp+1B8h] [bp-34h]@18 + int v112; // [sp+1B4h] [bp-38h]@3 + int v222; // [sp+1B8h] [bp-34h]@18 unsigned __int8 v114; // [sp+1BFh] [bp-2Dh]@133 int v115; // [sp+1C0h] [bp-2Ch]@3 unsigned int v116; // [sp+1C4h] [bp-28h]@18 int i; // [sp+1C8h] [bp-24h]@18 - Player *a2; // [sp+1CCh] [bp-20h]@28 + int a2; // [sp+1CCh] [bp-20h]@28 int v119; // [sp+1D0h] [bp-1Ch]@18 SpellBuff *v120; // [sp+1D4h] [bp-18h]@18 Actor *v121; // [sp+1D8h] [bp-14h]@3 int a5; // [sp+1DCh] [bp-10h]@3 GUIWindow *a1; // [sp+1E0h] [bp-Ch]@1 int v124; // [sp+1E4h] [bp-8h]@18 - char *a4; // [sp+1E8h] [bp-4h]@18 + int a4; // [sp+1E8h] [bp-4h]@18 a1 = edx0; v2 = uActorID; @@ -763,13 +763,13 @@ v106.uParentBillboardID = -1; v3 = &pActors[v2]; v121 = v3; - v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xFFu, 0x9Bu); - v5 = v3->sNPC_ID; + v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 255, 0x9Bu); + //v5 = v3->sNPC_ID; a5 = v4; - v6 = GetNPCData(v5); + v6 = GetNPCData(v3->sNPC_ID); v7 = v3->pMonsterInfo.uID; - v112 = (char **)v6; - v115 = byte_4E2B70[((signed __int16)v7 - 1) / 3] - 40; + //v112 = (char **)v6; + v115 = monster_popup_y_offsets[((signed __int16)v7 - 1) / 3] - 40; if ( v7 == pMonsterInfoUI_Doll.pMonsterInfo.uID ) { v9 = pMonsterInfoUI_Doll.uCurrentActionLength; @@ -784,6 +784,7 @@ v9 = v8 % 256 + 128; pMonsterInfoUI_Doll.uCurrentActionLength = v8 % 256 + 128; } + if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 ) { pMonsterInfoUI_Doll.uCurrentActionTime = 0; @@ -794,16 +795,15 @@ } else { - rand(); + //rand(); pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; - if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) - && (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) - && rand() % 30 < 100 ) + if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) && + (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) && rand() % 30 < 100 ) pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_AtkMelee; pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength; } } - v10 = pSpriteFrameTable->GetFrame( v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime); + v10 = pSpriteFrameTable->GetFrame( v3->pSpriteIDs[pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime); v11 = &pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]];//40 * v10->pHwSpriteIDs[0] + 7218180; v106.pTarget = pRenderer->pTargetSurface; v106.pTargetZ = pRenderer->pActiveZBuffer; @@ -829,46 +829,48 @@ { v13 = &pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]]; v106.uScreenSpaceY = v115 + v106.uViewportY + v13->uBufferHeight; - v222 = (IDirectDrawSurface *)v13->pTextureSurface; + //v222 = (IDirectDrawSurface *)v13->pTextureSurface; memset(&Dst, 0, 0x64u); Dst.dwSize = 100; Dst.dwFillColor = 0; memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - v222->GetSurfaceDesc((LPDDSURFACEDESC)&pDesc); - v14 = v13->uBufferHeight; - v120 = (SpellBuff *)v13->uBufferWidth; + v13->pTextureSurface->GetSurfaceDesc(&pDesc); + //v14 = v13->uBufferHeight; + //v120 = (SpellBuff *)v13->uBufferWidth; v107 = 0; - v15 = v13->uAreaX; - v119 = (signed int)v120 / 2; + //v15 = v13->uAreaX; + //v119 = v13->uBufferWidth / 2; i = 0; - a4 = (char *)(v106.uScreenSpaceX + v15 - (signed int)v120 / 2); - v115 = v13->uAreaY; - v16 = v13->uAreaWidth + (signed int)v120 / 2 + v15 - (int)v120; - v124 = v106.uScreenSpaceY + v115 - v14; - v17 = v13->uAreaHeight + v115 - v14; - v116 = v106.uScreenSpaceX + v16; - v119 = v106.uScreenSpaceY + v17; - if ( (signed int)a4 < (signed int)v106.uViewportX ) + //a4 = v106.uScreenSpaceX + v15 - v13->uBufferWidth / 2; + int dst_x = v106.uScreenSpaceX + v13->uAreaX - v13->uBufferWidth / 2; + //v115 = v13->uAreaY; + //v16 = v13->uAreaWidth + v13->uBufferWidth / 2 + v13->uAreaX - v13->uBufferWidth; + //v124 = v106.uScreenSpaceY + v115 - v14; + int dst_y = v106.uScreenSpaceY + v13->uAreaY - v13->uBufferHeight; + //v17 = v13->uAreaHeight + v13->uAreaY - v14; + //v116 = v106.uScreenSpaceX + v16; + uint dst_z = v106.uScreenSpaceX + v13->uAreaX + v13->uAreaWidth + v13->uBufferWidth / 2 - v13->uBufferWidth; + //v119 = v106.uScreenSpaceY + v17; + uint dst_w = v106.uScreenSpaceY + v13->uAreaY + v13->uAreaHeight - v13->uBufferHeight; + if (dst_x < v106.uViewportX) { - v18 = v106.uViewportX - (int)a4; - a4 = (char *)v106.uViewportX; + v18 = v106.uViewportX - dst_x; + dst_x = v106.uViewportX; v107 = v18; } - if ( v124 < (signed int)v106.uViewportY ) + if (dst_y < v106.uViewportY) { - v19 = v106.uViewportY - v124; - v124 = v106.uViewportY; + v19 = v106.uViewportY - dst_y; + dst_y = v106.uViewportY; i = v19; } - if ( (signed int)v116 > (signed int)v106.uViewportZ ) - v116 = v106.uViewportZ; - if ( v119 > (signed int)v106.uViewportW ) - v119 = v106.uViewportW; - pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, - pRenderer->uTargetBMask | pRenderer->uTargetGMask); - pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, - pRenderer->uTargetBMask | pRenderer->uTargetGMask); + if (dst_z > v106.uViewportZ) + dst_z = v106.uViewportZ; + if (dst_w > v106.uViewportW) + dst_w = v106.uViewportW; + pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, pRenderer->uTargetBMask | pRenderer->uTargetGMask); + pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, pRenderer->uTargetBMask | pRenderer->uTargetGMask); v84.left = v106.uViewportX; v84.top = v106.uViewportY; v84.right = v106.uViewportZ; @@ -876,25 +878,27 @@ ErrD3D(pRenderer->pBackBuffer4->Blt(&v84, 0, 0, 16778240u, &Dst)); if ( pRenderer->uTargetGBits == 5 ) { + __debugbreak(); // no monster popup for r5g5b5 yet memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - if ( pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, DDLOCK_WAIT)) + if ( pRenderer->LockSurface_DDraw4(v13->pTextureSurface, &pDesc, DDLOCK_WAIT)) { - v20 = (char *)v124; + v20 = (char *)dst_y; v110 = pDesc.lpSurface; - a2 = (Player *)v124; - if ( v124 < v119 ) + a2 = dst_y; + if (dst_y < dst_w) { - v111 = 2 * pRenderer->uTargetSurfacePitch; - v21 = (int)a4; - v22 = &pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; - v23 = i - v124; - v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; - v115 = i - v124; + //v111 = 2 * pRenderer->uTargetSurfacePitch; + v21 = dst_x; + v22 = &pRenderer->pTargetSurface[dst_y * pRenderer->uTargetSurfacePitch + dst_x]; + auto _v22_2 = v22; + v23 = i - dst_y; + //v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; + v115 = i - dst_y; while ( 1 ) { - v124 = v21; - if ( v21 < (signed int)v116 ) + dst_y = v21; + if ( v21 < dst_z ) { v24 = (int)&v20[v23]; v25 = v107 - v21; @@ -902,73 +906,54 @@ for ( i = v107 - v21; ; v25 = i ) { v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / v13->uAreaHeight); - v26 = (char *)v108 + pDesc.dwWidth * (v25 + v124++) / v13->uAreaWidth; + v26 = (char *)v108 + pDesc.dwWidth * (v25 + dst_y++) / v13->uAreaWidth; *v22 = *((short *)v110 + (int)v26); ++v22; - if ( v124 >= (signed int)v116 ) + if ( dst_y >= dst_z ) break; } v23 = v115; } - v22 = (unsigned __int16 *)((char *)v120 + v111); - v20 = (char *)&a2->pConditions[0] + 1; - v28 = __OFSUB__((int)&a2->pConditions[0] + 1, v119); - v27 = (signed int)((char *)&a2->pConditions[0] + -v119 + 1) < 0; - a2 = (Player *)((char *)a2 + 1); - v120 = (SpellBuff *)((char *)v120 + v111); + v22 = (unsigned __int16 *)((char *)_v22_2 + 2 * pRenderer->uTargetSurfacePitch); + _v22_2 = v22; + v20 = (char *)(a2 + 1); + v28 = __OFSUB__(a2 + 1, dst_w); + v27 = (signed int)(a2++ + 1 - dst_w) < 0; + //a2 = (Player *)((char *)a2 + 1); + //v120 = (SpellBuff *)((char *)v120 + v111); if ( !(v27 ^ v28) ) break; - v21 = (int)a4; + v21 = dst_x; } } - v222->Unlock(0); + v13->pTextureSurface->Unlock(0); } } else { memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - if ( pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, DDLOCK_WAIT) ) + if ( pRenderer->LockSurface_DDraw4(v13->pTextureSurface, &pDesc, DDLOCK_WAIT) ) { - v108 = (unsigned __int16 *)pDesc.lpSurface; - a2 = (Player *)v124; - if ( v124 < v119 ) + auto src = (unsigned __int16 *)pDesc.lpSurface; + + uint num_top_scanlines_above_frame_y = i - dst_y; + for (uint y = dst_y; y < dst_w; ++y) { - v109 = 2 * pRenderer->uTargetSurfacePitch; - v29 = (int)a4; - v30 = (char *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; - v31 = i - v124; - v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; - v115 = i - v124; - while ( 1 ) - { - v124 = v29; - if ( v29 < (signed int)v116 ) - { - v32 = v107 - (int)a4; - v111 = (unsigned int)((char *)a2 + v31); - for ( i = v107 - (int)a4; ; v32 = i ) - { - v110 = (LPVOID)((pDesc.lPitch >> 1) * pDesc.dwHeight * v111 / v13->uAreaHeight); - v33 = v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124) / v13->uAreaWidth)]; - v34 = v33 & 0x1F | 2 * (unsigned __int16)(v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124++) / v13->uAreaWidth)] & 0xFFE0); - v35 = v124; - *(short *)v30 = v34; - v30 += 2; - if ( v35 >= (signed int)v116 ) - break; - } - v31 = v115; - } - a2 = (Player *)((char *)a2 + 1); - v30 = (char *)v120 + v109; - v120 = (SpellBuff *)((char *)v120 + v109); - if ( (signed int)a2 >= v119 ) - break; - v29 = (int)a4; - } + auto dst = &pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + dst_x]; + + uint src_y = num_top_scanlines_above_frame_y + y; + for (uint x = dst_x; x < dst_z; ++x) + { + uint src_x = v107 - dst_x + x; // num scanlines left to frame_x + current x + + uint idx = pDesc.dwHeight * src_y / v13->uAreaHeight * (pDesc.lPitch / sizeof(short)) + + pDesc.dwWidth * src_x / v13->uAreaWidth; + uint b = src[idx] & 0x1F; + *dst++ = b | 2 * (src[idx] & 0xFFE0); + } } - v222->Unlock(0); + v13->pTextureSurface->Unlock(0); } } } @@ -977,19 +962,20 @@ pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0); v36 = v10->pHwSpriteIDs[0]; if ( v36 >= 0 ) - pSprites_LOD->pSpriteHeaders[v36]._4ACC38(&v106, 0); + pSprites_LOD->pSpriteHeaders[v36].DrawSprite_sw(&v106, 0); } + if ( v121->sNPC_ID ) { - v37 = v112[6]; - if ( v37 ) + //v37 = v6->uProfession; + if (v6->uProfession) { - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], *v112, aNPCProfessionNames[(signed int)v37]); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v6->uProfession]); // "%s the %s" / ^Pi[%s] %s } else { v77 = 2000; - v72 = *v112; + v72 = v6->pName; } } else @@ -1001,7 +987,7 @@ else v72 = pMonsterStats->pInfos[v121->pMonsterInfo.uID].pName; } - if(!v121->sNPC_ID || (v121->sNPC_ID && !v37)) + if(!v121->sNPC_ID || (v121->sNPC_ID && !v6->uProfession)) strncpy(pTmpBuf, v72, v77); v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); a1->DrawTitleText(pFontComic, 0, 0xCu, v39, pTmpBuf, 3u); @@ -1077,7 +1063,7 @@ v119 = 1; v116 = 1; i = 1; - v112 = (char **)1; + v112 = 1; } } } @@ -1102,11 +1088,14 @@ v47->PlaySound((PlayerSpeech)v73, 0); } } - a2 = pParty->pPlayers; - do + + for (uint _it = 0; _it < 4; ++_it) { - LOBYTE(v48) = a2->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); - v111 = v48; + auto player = pParty->pPlayers + _it; + + //LOBYTE(v48) = player->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); + //v111 = v48; + v111 = player->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); v120 = (SpellBuff *)138; do { @@ -1115,11 +1104,12 @@ v120 = (SpellBuff *)((char *)v120 - 1); } while ( v120 ); - ++a2; + //++a2; } - while ( (signed int)a2 < (signed int)pParty->pHirelings ); + //while ( (signed int)a2 < (signed int)pParty->pHirelings ); + v49 = pFontSmallnum; - a2 = (Player *)pFontSmallnum; + a2 = (int)pFontSmallnum; a1->DrawText(pFontSmallnum, 12, 196, a5, pGlobalTXT_LocalizationStrings[631], 0, 0, 0); v50 = LOBYTE(v49->uFontHeight) + 193; if ( !v115 ) @@ -1144,92 +1134,92 @@ { case 0u: v124 = 60; - a4 = pGlobalTXT_LocalizationStrings[591]; + a4 = (int)pGlobalTXT_LocalizationStrings[591]; break; case 1u: v124 = 82; - a4 = pGlobalTXT_LocalizationStrings[649]; + a4 = (int)pGlobalTXT_LocalizationStrings[649]; break; case 2u: v124 = 92; - a4 = pGlobalTXT_LocalizationStrings[592]; + a4 = (int)pGlobalTXT_LocalizationStrings[592]; break; case 3u: v124 = 63; - a4 = pGlobalTXT_LocalizationStrings[4]; + a4 = (int)pGlobalTXT_LocalizationStrings[4]; break; case 4u: v52 = pGlobalTXT_LocalizationStrings[220]; - a4 = v52; + a4 = (int)v52; v124 = 81; break; case 5u: v52 = pGlobalTXT_LocalizationStrings[162]; - a4 = v52; + a4 = (int)v52; v124 = 81; break; case 6u: v53 = pGlobalTXT_LocalizationStrings[593]; v124 = 35; - a4 = v53; + a4 = (int)v53; break; case 8u: v53 = pGlobalTXT_LocalizationStrings[608]; v124 = 62; - a4 = v53; + a4 = (int)v53; break; case 7u: case 9u: a4 = 0; v124 = 0; ++v51; - v222 = (IDirectDrawSurface *)((char *)v222 + 1); + v222 = v222 + 1; v120 = v51; __debugbreak(); // fix condition continue; case 0xAu: v124 = 47; - a4 = pGlobalTXT_LocalizationStrings[221]; + a4 = (int)pGlobalTXT_LocalizationStrings[221]; break; case 0xBu: v124 = 66; - a4 = pGlobalTXT_LocalizationStrings[607]; + a4 = (int)pGlobalTXT_LocalizationStrings[607]; break; case 0xCu: v124 = 85; - a4 = pGlobalTXT_LocalizationStrings[610]; + a4 = (int)pGlobalTXT_LocalizationStrings[610]; break; case 0xDu: v124 = 86; - a4 = pGlobalTXT_LocalizationStrings[609]; + a4 = (int)pGlobalTXT_LocalizationStrings[609]; break; case 0xEu: v124 = 17; - a4 = pGlobalTXT_LocalizationStrings[279]; + a4 = (int)pGlobalTXT_LocalizationStrings[279]; break; case 0xFu: v124 = 38; - a4 = pGlobalTXT_LocalizationStrings[442]; + a4 = (int)pGlobalTXT_LocalizationStrings[442]; break; case 0x10u: v124 = 46; - a4 = pGlobalTXT_LocalizationStrings[443]; + a4 = (int)pGlobalTXT_LocalizationStrings[443]; break; case 0x11u: v124 = 51; - a4 = pGlobalTXT_LocalizationStrings[440]; + a4 = (int)pGlobalTXT_LocalizationStrings[440]; break; case 0x12u: v124 = 5; - a4 = pGlobalTXT_LocalizationStrings[441]; + a4 = (int)pGlobalTXT_LocalizationStrings[441]; break; case 0x13u: v124 = 95; - a4 = pGlobalTXT_LocalizationStrings[229]; + a4 = (int)pGlobalTXT_LocalizationStrings[229]; break; case 0x14u: v124 = 73; - a4 = pGlobalTXT_LocalizationStrings[228]; + a4 = (int)pGlobalTXT_LocalizationStrings[228]; break; default: a4 = 0; @@ -1237,22 +1227,23 @@ } if ( a4 ) { - v54 = a4; + v54 = (char *)a4; v55 = GetSpellColor(v124); a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0); - v50 = v50 + BYTE5(a2->pConditions[0]) - 3; + v50 = v50 + *(char *)(a2 + 5) - 3; v51 = v120; } } ++v51; - v222 = (IDirectDrawSurface *)((char *)v222 + 1); + v222 = v222 + 1; v120 = v51; __debugbreak(); // fix condition } //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 ); while (true); + if ( !a4 ) { v78 = 0; @@ -1263,12 +1254,12 @@ } } v56 = pFontSmallnum; - a4 = (char *)v106.uViewportY; + a4 = v106.uViewportY; if ( v119 ) { sprintf(pTmpBuf, "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); - a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; + a4 = a4 + LOBYTE(v56->uFontHeight) - 3; v79 = v121->pMonsterInfo.uAC; v75 = 0; v70 = pGlobalTXT_LocalizationStrings[12]; @@ -1281,12 +1272,12 @@ v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630]; v75 = 0; v70 = pGlobalTXT_LocalizationStrings[12]; - a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; + a4 = a4 + LOBYTE(v56->uFontHeight) - 3; v67 = "%s\f%05u\t100%s\n"; } sprintf(pTmpBuf, v67, v70, v75, v79); - a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); - a4 = &a4[LOBYTE(v56->uFontHeight) - 6] + LOBYTE(v56->uFontHeight); + a1->DrawText(v56, 150, a4, a5, pTmpBuf, 0, 0, 0); + a4 = a4 + LOBYTE(v56->uFontHeight) - 6 + LOBYTE(v56->uFontHeight); v95[0] = pGlobalTXT_LocalizationStrings[87]; v95[1] = pGlobalTXT_LocalizationStrings[6]; v95[2] = pGlobalTXT_LocalizationStrings[240]; @@ -1302,7 +1293,7 @@ { sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, v95[v121->pMonsterInfo.uAttack1Type]); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); - a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; + a4 = a4 + LOBYTE(v56->uFontHeight) - 3; v57 = v121->pMonsterInfo.uAttack1DamageBonus; if ( v57 ) sprintf(pTmpBuf, "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53], @@ -1315,12 +1306,12 @@ { sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); - a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; + a4 = a4 + LOBYTE(v56->uFontHeight) - 3; sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); } - a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); + a1->DrawText(v56, 150, a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 6] + v58; + a4 = a4 + v58 - 6 + v58; if ( !i ) { v80 = pGlobalTXT_LocalizationStrings[630]; @@ -1330,7 +1321,7 @@ sprintf(pTmpBuf, v68, v71, v76, v80); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 3]; + a4 = a4 + v58 - 3; } else { @@ -1344,7 +1335,7 @@ sprintf(pTmpBuf, "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 3]; + a4 = a4 + v58 - 3; v59 = v121; } v60 = v59->pMonsterInfo.uSpell2ID; @@ -1353,7 +1344,7 @@ sprintf(pTmpBuf, "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 3]; + a4 = a4 + v58 - 3; v59 = v121; } if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID ) @@ -1365,12 +1356,12 @@ sprintf(pTmpBuf, v68, v71, v76, v80); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 3]; + a4 = a4 + v58 - 3; } } - a4 = &a4[v58 - 3]; - a1->DrawText(v56, 150, (int)a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0); - a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; + a4 = a4 + v58 - 3; + a1->DrawText(v56, 150, a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0); + a4 = a4 + LOBYTE(v56->uFontHeight) - 3; v85[0] = pGlobalTXT_LocalizationStrings[87]; v85[1] = pGlobalTXT_LocalizationStrings[6]; v85[2] = pGlobalTXT_LocalizationStrings[240]; @@ -1409,11 +1400,10 @@ v81 = pGlobalTXT_LocalizationStrings[153]; } sprintf(pTmpBuf, "%s\f%05u\t070%s\n", v85[v124], 0, v81); - a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); + a1->DrawText(v56, 170, a4, a5, pTmpBuf, 0, 0, 0); v63 = LOBYTE(v56->uFontHeight); v124 += 4; - result = &a4[v63 - 3]; - a4 = result; + a4 = a4 + v63 - 3; } while ( v124 < 40 ); } @@ -1423,11 +1413,10 @@ do { sprintf(pTmpBuf, "%s\f%05u\t070%s\n", v85[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?" - a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); + a1->DrawText(v56, 170, a4, a5, pTmpBuf, 0, 0, 0); v65 = LOBYTE(v56->uFontHeight); ++i; - result = &a4[v65 - 3]; - a4 = result; + a4 = a4 + v65 - 3; } while ( i < 10 ); } @@ -1435,9 +1424,8 @@ { sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP); pFontSmallnum->GetLineWidth(pTmpBuf); - result = a1->DrawTitleText(pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf, 3); + a1->DrawTitleText(pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf, 3); } - return result; }
--- a/VideoPlayer.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/VideoPlayer.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -1063,6 +1063,7 @@ { if ( (unsigned int)uCPUSpeed < 165 ) { + Log::Warning(L"Smacker seems to use lower resolution because it thinks CPU is slow"); v10 = SmackCheckSurfaceFromat() | 2; } else
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/_deleted.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -0,0 +1,494 @@ + +/* +//----- (004AC1C9) -------------------------------------------------------- +int __thiscall _4AC1C9_get_cpu_speed(unsigned int _this, Vec4_int_ *a2) +{ + unsigned int v2; // esi@1 + __int16 v3; // di@1 + signed int v4; // ebx@1 + int v5; // ecx@3 + Vec4_int_ *v6; // eax@10 + Vec4_int_ *v7; // esi@14 + int result; // eax@16 + char *v9; // esi@16 + Vec4_int_ a1; // [sp+Ch] [bp-34h]@10 + Vec4_int_ v11; // [sp+1Ch] [bp-24h]@14 + Vec4_int_ Dst; // [sp+2Ch] [bp-14h]@1 + int v13; // [sp+3Ch] [bp-4h]@1 + + v2 = _this; + v3 = _4382BC_get_cpu_speed_sub0(_this); + v13 = _4383ED_get_cpu_speed_sub2(); + v4 = 0; + memset(&Dst, 0, 0x10u); + if ( v3 < 0 ) + goto LABEL_19; + if ( (signed int)v2 > 0 ) + { + if ( (signed int)v2 > 150 ) + { + v5 = (int)a2; + } + else + { + v5 = 4000 * v2; + v4 = 1; + } + } + else + { + v5 = 4000 * dword_4F031C[(unsigned __int16)v3]; + } + if ( v13 & 0x10 && !v4 ) + { + if ( v2 ) + v6 = _4AC4FD_get_cpu_clocks_rdtsc(v5, &a1); + else + v6 = _4AC33A_get_cpu_clocks_QPC(v5, &a1); + goto LABEL_14; + } + if ( (unsigned __int16)v3 < 3u ) + { +LABEL_19: + v7 = &Dst; + goto LABEL_16; + } + v6 = _4AC277_get_cpu_speed_sub3(v5, &a1); +LABEL_14: + v11.x = v6->x; + v11.y = v6->y; + v11.z = v6->z; + v11.w = v6->w; + v7 = &v11; +LABEL_16: + result = (int)a2; + a2->x = v7->x; + v9 = (char *)&v7->y; + a2->y = *(int *)v9; + v9 += 4; + a2->z = *(int *)v9; + a2->w = *((int *)v9 + 1); + return result; +} +// 4F031C: using guessed type int dword_4F031C[]; + + + +//----- (004382BC) -------------------------------------------------------- +__int16 __thiscall _4382BC_get_cpu_speed_sub0(int _this) +{ + __int16 result; // ax@4 + __int16 v14; // sp@11 + int v15; // [sp-4h] [bp-Ch]@0 + signed __int16 v16; // [sp+4h] [bp-4h]@1 + __int16 v17; // [sp+4h] [bp-4h]@8 + __int16 v18; // [sp+4h] [bp-4h]@11 + + v16 = 1; + __asm { pushf } + if ( v15 == (v15 ^ 0x200000) ) + v16 = 0; + if ( v16 ) + { + result = _43847A_get_cpu_speed_sub1(); + } + else + { + //UNDEF(_ZF); + //UNDEF(_SF); + //UNDEF(_OF); + _CF = 0; + if ( !_ZF ) + _CF = 1; + __asm { pushfw } + bProcessorIsNotIntel = (BYTE2(v15) & 1 ^ 1) & 1; + _CF = 0; + _OF = 0; + _ZF = 0; + _SF = 1; + __asm { pushfw } + v17 = 2; + if ( (HIWORD(v15) | 0xF000) & 0xF000 ) + v17 = -1; + __asm { popfw } + result = v17; + if ( v17 != 2 ) + { + _CF = 0; + _OF = 0; + _ZF = v14 == 0; + _SF = v14 < 0; + __asm { pushf } + v18 = 3; + if ( v15 != (v15 ^ 0x40000) ) + v18 = -1; + __asm { popf } + result = v18; + if ( v18 != 3 ) + result = 4; + } + } + if ( bProcessorIsNotIntel ) + HIBYTE(result) |= 0x80u; + return result; +} + + + +//----- (0043847A) -------------------------------------------------------- +__int16 __cdecl _43847A_get_cpu_speed_sub1() +{ + signed int v5; // eax@1 + char v12[12]; // [sp+Ch] [bp-28h]@1 + char v13; // [sp+18h] [bp-1Ch]@1 + char v14; // [sp+19h] [bp-1Bh]@1 + int v15[4]; // [sp+1Ch] [bp-18h]@1 + int v16; // [sp+2Eh] [bp-6h]@1 + char v17; // [sp+32h] [bp-2h]@6 + char v18; // [sp+33h] [bp-1h]@1 + + *(int *)v12 = *(int *)"------------"; + *(int *)&v12[4] = *(int *)"--------"; + *(int *)&v12[8] = *(int *)"----"; + v13 = asc_4E4938[12]; + v14 = 0; + v18 = 0; + v15[0] = *(int *)"GenuineIntel"; + v15[1] = *(int *)"ineIntel"; + v15[2] = *(int *)"ntel"; + v16 = 65535; + LOBYTE(v15[3]) = aGenuineintel[12]; + _EAX = 0; + __asm { cpuid } + *(int *)v12 = _EBX; + *(int *)&v12[4] = _EDX; + *(int *)&v12[8] = _ECX; + v5 = 0; + do + { + if ( v12[v5] != *((char *)v15 + v5) ) + bProcessorIsNotIntel = 1; + ++v5; + } + while ( v5 < 12 ); + if ( v5 >= 1 ) + { + _EAX = 1; + __asm { cpuid } + v18 = _EAX & 0xF; + LOBYTE(_EAX) = (unsigned __int8)(_EAX & 0xF0) >> 4; + v17 = _EAX; + LOWORD(v16) = ((_EAX & 0xF00u) >> 8) & 0xF; + } + return v16; +} + + + +//----- (004383ED) -------------------------------------------------------- +int __cdecl _4383ED_get_cpu_speed_sub2() +{ + signed int v9; // eax@4 + int v16; // [sp-4h] [bp-38h]@0 + int v17[3]; // [sp+Ch] [bp-28h]@1 + char v18; // [sp+18h] [bp-1Ch]@1 + char v19; // [sp+19h] [bp-1Bh]@1 + int v20[4]; // [sp+1Ch] [bp-18h]@1 + int v21; // [sp+2Ch] [bp-8h]@1 + int v22; // [sp+30h] [bp-4h]@1 + + v17[0] = *(int *)"------------"; + v17[1] = *(int *)"--------"; + v17[2] = *(int *)"----"; + v18 = asc_4E4938[12]; + v19 = 0; + v22 = 0; + v20[0] = *(int *)"GenuineIntel"; + v20[1] = *(int *)"ineIntel"; + v20[2] = *(int *)"ntel"; + LOBYTE(v20[3]) = aGenuineintel[12]; + _CF = 0; + _OF = 0; + _ZF = 0; + _SF = 0; + v21 = 1; + __asm { pushf } + if ( v16 == (v16 ^ 0x200000) ) + v21 = 0; + if ( (short)v21 ) + { + _EAX = 0; + __asm { cpuid } + v17[0] = _EBX; + v17[1] = _EDX; + v17[2] = _ECX; + v9 = 0; + do + { + if ( *((char *)v17 + v9) != *((char *)v20 + v9) ) + bProcessorIsNotIntel = 1; + ++v9; + } + while ( v9 < 12 ); + if ( v9 >= 1 ) + { + _EAX = 1; + __asm { cpuid } + v22 = _EDX; + } + } + return v22; +} + + + +//----- (004AC4FD) -------------------------------------------------------- +Vec4_int_ *__thiscall _4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1) +{ + int v2; // eax@1 + int v3; // eax@4 + bool v4; // eax@5 + unsigned __int64 v5; // kr00_8@8 + int v6; // edi@9 + int v7; // eax@9 + bool v8; // eax@10 + unsigned __int64 v9; // kr08_8@13 + unsigned int v10; // eax@15 + Vec4_int_ *result; // eax@17 + int Dst; // [sp+Ch] [bp-2Ch]@1 + int v13; // [sp+10h] [bp-28h]@17 + int v14; // [sp+14h] [bp-24h]@15 + int v15; // [sp+18h] [bp-20h]@17 + unsigned int v16; // [sp+1Ch] [bp-1Ch]@8 + unsigned int v17; // [sp+20h] [bp-18h]@8 + unsigned int v18; // [sp+24h] [bp-14h]@13 + int nPriority; // [sp+28h] [bp-10h]@1 + __int64 v20; // [sp+2Ch] [bp-Ch]@1 + int v21; // [sp+34h] [bp-4h]@3 + + HIDWORD(v20) = GetCurrentThread(); + memset(&Dst, 0, 0x10u); + v2 = GetThreadPriority(HIDWORD(v20)); + nPriority = v2; + if ( v2 != 0x7FFFFFFF ) + SetThreadPriority(HIDWORD(v20), v2 + 1); + __outbyte(0x70u, 0); + v21 = __inbyte(0x71u); + do + { + __outbyte(0x70u, 0); + LODWORD(v20) = __inbyte(0x71u); + v3 = v20 - v21; + if ( (signed int)v20 >= v21 ) + v4 = v3 > 0; + else + v4 = v3 + 10; + } + while ( !v4 ); + v5 = __rdtsc(); + v16 = HIDWORD(v5); + v17 = v5; + do + { + __outbyte(0x70u, 0); + v21 = __inbyte(0x71u); + v6 = v21; + v7 = v21 - v20; + if ( v21 >= (signed int)v20 ) + v8 = v7 > 0; + else + v8 = v7 + 10; + } + while ( !v8 ); + v9 = __rdtsc(); + v18 = HIDWORD(v9); + v21 = v9; + if ( nPriority != 0x7FFFFFFF ) + SetThreadPriority(HIDWORD(v20), nPriority); + nPriority = v21; + *(__int64 *)((char *)&v20 + 4) = __PAIR__(v18, v21) - __PAIR__(v16, v17); + Dst = HIDWORD(v20); + v10 = HIDWORD(v20) / 0xF4240; + v14 = HIDWORD(v20) / 0xF4240; + if ( HIDWORD(v20) / 0x186A0 - 10 * HIDWORD(v20) / 0xF4240 >= 6 ) + ++v10; + v15 = v10; + result = a1; + v13 = 1000000 * v6 - 1000000 * v20; + a1->x = Dst; + a1->y = v13; + a1->z = v14; + a1->w = v15; + return result; +} + + + + +//----- (004AC33A) -------------------------------------------------------- +Vec4_int_ *__thiscall _4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1) +{ + int v2; // esi@1 + int v3; // ebx@1 + unsigned __int64 v4; // qax@4 + unsigned __int64 v5; // qax@7 + DWORD v6; // edi@7 + DWORD v7; // eax@7 + unsigned int v8; // ecx@10 + unsigned __int64 v9; // qax@10 + unsigned int v10; // edi@10 + int v11; // eax@14 + unsigned int v12; // ecx@19 + Vec4_int_ *result; // eax@24 + int Dst; // [sp+Ch] [bp-4Ch]@1 + int v15; // [sp+10h] [bp-48h]@23 + int v16; // [sp+14h] [bp-44h]@21 + int v17; // [sp+18h] [bp-40h]@21 + LARGE_INTEGER Frequency; // [sp+1Ch] [bp-3Ch]@1 + LARGE_INTEGER PerformanceCount; // [sp+24h] [bp-34h]@2 + LARGE_INTEGER v20; // [sp+2Ch] [bp-2Ch]@2 + int v21; // [sp+34h] [bp-24h]@2 + int v22; // [sp+38h] [bp-20h]@2 + int v23; // [sp+3Ch] [bp-1Ch]@4 + int v24; // [sp+40h] [bp-18h]@7 + int nPriority; // [sp+44h] [bp-14h]@2 + unsigned int v26; // [sp+48h] [bp-10h]@1 + unsigned int v27; // [sp+4Ch] [bp-Ch]@1 + HANDLE hThread; // [sp+50h] [bp-8h]@1 + int v29; // [sp+54h] [bp-4h]@1 + + v2 = 0; + v3 = 0; + v29 = 0; + v27 = 0; + v26 = 0; + hThread = GetCurrentThread(); + memset(&Dst, 0, 0x10u); + if ( QueryPerformanceFrequency(&Frequency) ) + { + do + { + ++v29; + v22 = v2; + v21 = v3; + QueryPerformanceCounter(&PerformanceCount); + v20 = PerformanceCount; + nPriority = GetThreadPriority(hThread); + if ( nPriority != 2147483647 ) + SetThreadPriority(hThread, 15); + while ( v20.s.LowPart - PerformanceCount.s.LowPart < 0x32 ) + { + QueryPerformanceCounter(&v20); + v4 = __rdtsc(); + v23 = v4; + } + PerformanceCount = v20; + do + { + QueryPerformanceCounter(&v20); + v5 = __rdtsc(); + v24 = v5; + v6 = v20.s.LowPart; + v7 = PerformanceCount.s.LowPart; + } + while ( v20.s.LowPart - PerformanceCount.s.LowPart < 0x3E8 ); + if ( nPriority != 2147483647 ) + { + SetThreadPriority(hThread, nPriority); + v7 = PerformanceCount.s.LowPart; + v6 = v20.s.LowPart; + } + v8 = v24 - v23; + v27 += v24 - v23; + v9 = (100000 * v6 - 100000 * v7) / (Frequency.s.LowPart / 0xA); + v10 = v9; + v26 += v9; + if ( v9 % Frequency.s.LowPart > Frequency.s.LowPart >> 1 ) + v10 = v9 + 1; + v3 = v8 / v10; + if ( v8 % v10 > v10 >> 1 ) + v3 = v8 / v10 + 1; + v2 = v21; + v11 = v3 + v22 + v21; + } + while ( v29 < 3 + || v29 < 20 + && ((unsigned int)(3 * v3 - v11) > 3 || (unsigned int)(3 * v21 - v11) > 3 || (unsigned int)(3 * v22 - v11) > 3) ); + v12 = 10 * v27 / v26; + if ( 100 * v27 / v26 - 10 * v12 >= 6 ) + ++v12; + v16 = v27 / v26; + v17 = v27 / v26; + if ( v12 - 10 * v27 / v26 >= 6 ) + v17 = v27 / v26 + 1; + v15 = v26; + Dst = v27; + } + result = a1; + a1->x = Dst; + a1->y = v15; + a1->z = v16; + a1->w = v17; + return result; +} + + + + + +//----- (004AC277) -------------------------------------------------------- +Vec4_int_ *__thiscall _4AC277_get_cpu_speed_sub3(unsigned int _this, Vec4_int_ *a2) +{ + signed int v2; // esi@1 + signed __int16 v4; // bx@3 + int v10; // esi@8 + int v11; // eax@10 + Vec4_int_ *result; // eax@13 + Vec4_int_ Dst; // [sp+8h] [bp-30h]@1 + LARGE_INTEGER Frequency; // [sp+18h] [bp-20h]@1 + LARGE_INTEGER PerformanceCount; // [sp+20h] [bp-18h]@3 + LARGE_INTEGER v16; // [sp+28h] [bp-10h]@5 + int v17; // [sp+30h] [bp-8h]@1 + int v18; // [sp+34h] [bp-4h]@2 + + v17 = _this; + v2 = -1; + memset(&Dst, 0, 0x10u); + if ( QueryPerformanceFrequency(&Frequency) ) + { + v18 = 10; + do + { + QueryPerformanceCounter(&PerformanceCount); + _EAX = -2147483648; + v4 = 4000; + do + { + __asm { bsf ecx, eax } + --v4; + } + while ( v4 ); + QueryPerformanceCounter(&v16); + if ( (signed int)v16.s.LowPart - (signed int)PerformanceCount.s.LowPart < (unsigned int)v2 ) + v2 = v16.s.LowPart - PerformanceCount.s.LowPart; + --v18; + } + while ( v18 ); + v10 = 100000 * v2 / (Frequency.s.LowPart / 0xA); + if ( v10 % Frequency.s.LowPart > Frequency.s.LowPart >> 1 ) + ++v10; + v11 = v17 / (unsigned int)v10; + Dst.z = v17 / (unsigned int)v10; + if ( v17 % (unsigned int)v10 > (unsigned int)v10 >> 1 ) + ++v11; + Dst.x = v17; + Dst.y = v10; + Dst.w = v11; + } + result = a2; + a2->x = Dst.x; + a2->y = Dst.y; + a2->z = Dst.z; + a2->w = Dst.w; + return result; +}*/ \ No newline at end of file
--- a/mm7_2.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/mm7_2.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -9730,14 +9730,14 @@ byte_6BE388_graphicsmode = 0; uGammaPos = ReadWindowsRegistryInt("GammaPos", 4); - if (uGammaPos < 0 || uGammaPos > 9) + if (uGammaPos > 9) uGammaPos = 4; pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6); if ( ReadWindowsRegistryInt("Bloodsplats", 1) ) pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS; else - pGame->uFlags2 &= GAME_FLAGS_2_DRAW_BLOODSPLATS; + pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS; uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0); dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0); @@ -9750,26 +9750,29 @@ dword_6BE364_game_settings_1 |= 0x4000; - if ( uTurnSpeed ) - { switch ( uTurnSpeed ) { - case 1u: + case 0: // undefined turn option + __debugbreak(); // really shouldn't use this mode + uTurnSpeed = (unsigned int)uCPUSpeed < 199 ? 128 : 64; // adjust turn speed to estimated fps + break; + + case 1u: // 16x + Log::Warning(L"x16 Turn Speed"); // really shouldn't use this mode uTurnSpeed = 128; - break; - case 2u: + break; + + case 2u: // 32x + Log::Warning(L"x32 Turn Speed"); // really shouldn't use this mode uTurnSpeed = 64; - break; - case 3u: + break; + + case 3u: // smooth uTurnSpeed = 0; - break; - } - } - else - { - uTurnSpeed = (unsigned int)uCPUSpeed < 0xC7 ? 128 : 64; // adjust turn speed to estimated fps - } - initing=false; //ADDED Gloval + break; + } + + initing = false; //ADDED Gloval return true; } @@ -10064,17 +10067,24 @@ stru_51076C.registry_debug_flags = ReadWindowsRegistryInt("debug flags", 0); - v8 = sub_4AC1C9(0, (Vec4_int_ *)a2); + /*v8 = _4AC1C9_get_cpu_speed(0, (Vec4_int_ *)a2); Rect.left = *(int *)v8; Rect.top = *(int *)(v8 + 4); Rect.right = *(int *)(v8 + 8); Rect.bottom = *(int *)(v8 + 12); - uCPUSpeed = Rect.bottom; - - - if (MM7_Initialize()) - { - Log::Warning(L"MM init: ok"); + uCPUSpeed = Rect.bottom;*/ + uCPUSpeed = 2048; // about 2GHz + + + if (!MM7_Initialize()) + { + Log::Warning(L"MM init: failed"); + pGame->Deinitialize(); + return 1; + } + + + Log::Warning(L"MM init: ok"); pEventTimer->Pause(); if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) @@ -10203,7 +10213,7 @@ uGameState = 0; continue; } - if ( uGameState == 7 ) + if ( uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU) __debugbreak(); /*{ pAudioPlayer->StopChannels(-1, -1); @@ -10220,11 +10230,9 @@ AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms); } } - } - else - Log::Warning(L"MM init: failed"); + pGame->Deinitialize(); -return 1; + return 1; }
--- a/mm7_3.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/mm7_3.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -4869,7 +4869,7 @@ if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) { v31 = (LightmapBuilder *)(v50 ? 3 : v49 != 0 ? 5 : 0); - static_RenderBuildingsD3D_stru_73C834._49B04D(pFace, (BSPVertexBuffer *)v56 - 1); + static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(pFace, (BSPVertexBuffer *)v56 - 1); if ( pDecalBuilder->uNumDecals > 0 ) { v40 = -1; @@ -5242,7 +5242,7 @@ v35 = (BSPVertexBuffer *)(v78 - 2); v12->field_108 = 1; - static_sub_004789DE_stru_73C818._49B04D((ODMFace *)v3, v35); + static_sub_004789DE_stru_73C818.GetFacePlaneAndClassify((ODMFace *)v3, v35); v55 = static_sub_004789DE_stru_73C818.face_plane.vNormal.x; v56 = static_sub_004789DE_stru_73C818.face_plane.vNormal.y; v57 = static_sub_004789DE_stru_73C818.face_plane.vNormal.z;
--- a/mm7_4.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/mm7_4.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -268,7 +268,13 @@ signed int v54; // [sp+30h] [bp-10h]@41 signed int v55; // [sp+34h] [bp-Ch]@1 - LOG_DECOMPILATION_WARNING(); + //LOG_DECOMPILATION_WARNING(); + + static int blv_floor_id[50]; // 00721200 + static int blv_floor_level[50]; // 007212C8 + + static __int16 word_721390_ys[104]; // idb + static __int16 word_721460_xs[104]; // idb auto pSector = &pIndoor->pSectors[uSectorID]; v55 = 1; @@ -283,16 +289,16 @@ { for (uint j = 0; j < pFloor->uNumVertices; ++j) { - word_721460[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; - word_721460[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; - word_721390[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; - word_721390[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; + word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; + word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; + word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; + word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; } v44 = 2 * pFloor->uNumVertices; - word_721460[2 * pFloor->uNumVertices] = word_721460[0]; - word_721390[2 * pFloor->uNumVertices] = word_721390[0]; - - v48 = word_721390[0] >= y; + word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; + word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; + + v48 = word_721390_ys[0] >= y; v53 = 0; if ( pFloor->uNumVertices > 0 ) { @@ -300,36 +306,33 @@ { if ( v53 >= 2 ) break; - v50 = word_721390[i + 1] >= y; - if ( v48 == v50 ) + v50 = word_721390_ys[i + 1] >= y; + + v13 = i; + if ( v48 != v50 ) { - v13 = i; - } - else - { - v13 = i; - v14 = word_721460[i + 1] >= x ? 0 : 2; - v15 = v14 | word_721460[i] < x; + v14 = word_721460_xs[i + 1] >= x ? 0 : 2; + v15 = v14 | word_721460_xs[i] < x; if ( !v15) ++v53; else { - //v16 = word_721390[i]; - v17 = word_721390[i + 1] - word_721390[i]; - v18 = y - word_721390[i]; + //v16 = word_721390_ys[i]; + v17 = word_721390_ys[i + 1] - word_721390_ys[i]; + v18 = y - word_721390_ys[i]; LODWORD(v19) = v18 << 16; HIDWORD(v19) = v18 >> 16; - if ((signed int)(((unsigned __int64)(((signed int)word_721460[i + 1] - (signed int)word_721460[i]) * v19 / v17) >> 16) + word_721460[i]) >= x) + if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v19 / v17) >> 16) + word_721460_xs[i]) >= x) ++v53; } /*if ( v15 != 3 ) { if ( !v15 ) { - LODWORD(v19) = (y - word_721390[i]) << 16; - HIDWORD(v19) = (y - word_721390[i]) >> 16; - v16 = ((((word_721460[i + 1] - word_721460[i]) * v19 / (word_721390[i + 1] - word_721390[i])) >> 16) + word_721460[i]); + LODWORD(v19) = (y - word_721390_ys[i]) << 16; + HIDWORD(v19) = (y - word_721390_ys[i]) >> 16; + v16 = ((((word_721460_xs[i + 1] - word_721460_xs[i]) * v19 / (word_721390_ys[i + 1] - word_721390_ys[i])) >> 16) + word_721460_xs[i]); if ( v16 >= x) ++v53; } @@ -352,7 +355,7 @@ } v22 = v55++; blv_floor_level[v22] = v21; - dword_721200[v22] = pSector->pFloors[i]; + blv_floor_id[v22] = pSector->pFloors[i]; } } } @@ -371,38 +374,38 @@ { for (uint j = 0; j < portal->uNumVertices; ++j) { - word_721460[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; - word_721460[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; - word_721390[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; - word_721390[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; - } - word_721460[2 * portal->uNumVertices] = word_721460[0]; - word_721390[2 * portal->uNumVertices] = word_721390[0]; + word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; + word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; + word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; + word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; + } + word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; + word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; v54 = 0; - v49 = word_721390[0] >= y; + v49 = word_721390_ys[0] >= y; if ( portal->uNumVertices > 0 ) { for ( int i = 0; i < 2 * portal->uNumVertices; ++i ) { if ( v54 >= 2 ) break; - v47 = word_721390[i + 1] >= y; + v47 = word_721390_ys[i + 1] >= y; if ( v49 != v47 ) { - v28 = word_721460[i + 1] >= x ? 0 : 2; - v29 = v28 | word_721460[i] < x; + v28 = word_721460_xs[i + 1] >= x ? 0 : 2; + v29 = v28 | word_721460_xs[i] < x; if ( v29 != 3 ) { if ( !v29 ) ++v54; else { - //v30 = word_721390[v27]; - v31 = word_721390[i + 1] - word_721390[i]; - v32 = y - word_721390[i]; + //v30 = word_721390_ys[v27]; + v31 = word_721390_ys[i + 1] - word_721390_ys[i]; + v32 = y - word_721390_ys[i]; LODWORD(v33) = v32 << 16; HIDWORD(v33) = v32 >> 16; - if ((signed int)(((unsigned __int64)(((signed int)word_721460[i + 1] - (signed int)word_721460[i]) * v33 / v31) >> 16) + word_721460[i]) >= x) + if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v33 / v31) >> 16) + word_721460_xs[i]) >= x) ++v54; } } @@ -415,7 +418,7 @@ break; v34 = v55++; blv_floor_level[v34] = -29000; - dword_721200[v34] = pSector->pPortals[i]; + blv_floor_id[v34] = pSector->pPortals[i]; } } } @@ -423,12 +426,12 @@ } if ( v55 == 1 ) { - *pFaceID = dword_721200[0]; + *pFaceID = blv_floor_id[0]; return blv_floor_level[0]; } if ( !v55 ) return -30000; - *pFaceID = dword_721200[0]; + *pFaceID = blv_floor_id[0]; //result = blv_floor_level[0]; if ( v55 > 1 ) { @@ -439,13 +442,13 @@ if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) continue; blv_floor_level[0] = blv_floor_level[v35]; - *pFaceID = dword_721200[v35]; + *pFaceID = blv_floor_id[v35]; continue; } if ( blv_floor_level[v35] < blv_floor_level[0] ) { blv_floor_level[0] = blv_floor_level[v35]; - *pFaceID = dword_721200[v35]; + *pFaceID = blv_floor_id[v35]; } } } @@ -2574,6 +2577,7 @@ float v26; // [sp+50h] [bp-8h]@3 float v27; // [sp+54h] [bp-4h]@3 + __debugbreak(); v22 = 0; v1 = this->pMemBlocks[1]->pAlignedBlock; v2 = this->pMemBlocks[6]->pAlignedBlock; @@ -4768,204 +4772,134 @@ //----- (0049B04D) -------------------------------------------------------- -int stru154::_49B04D(ODMFace *a2, BSPVertexBuffer *a3) +void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) { - stru154 *v3; // edi@1 - signed int v4; // eax@1 - signed int result; // eax@9 - signed int v6; // [sp-8h] [bp-18h]@8 + //stru154 *v3; // edi@1 + //signed int v4; // eax@1 + //signed int result; // eax@9 + //signed int v6; // [sp-8h] [bp-18h]@8 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 + float v7; v.x = 0.0; - v3 = this; v.y = 0.0; v.z = 0.0; - _49B13D(a2, a3, &v, (float *)&a3); - v4 = 2; - if ( a2->pFacePlane.vNormal.z ) - { - if ( !a2->pFacePlane.vNormal.x && !a2->pFacePlane.vNormal.y ) - v4 = 1; - } + GetFacePlane(a2, a3, &v, &v7); + + if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) + polygonType = POLYGON_VerticalWall; + else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && + fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) + polygonType = POLYGON_Floor; else - { - v4 = 0; - } - if ( v4 ) - { - if ( v4 == 1 ) - v6 = 3; - else - v6 = 4; - result = v6; - } - else - { - result = 1; - } - v3->face_plane.vNormal.x = v.x; - v3->face_plane.vNormal.y = v.y; - v3->face_plane.vNormal.z = v.z; - v3->face_plane.dist = *(float *)&a3; - v3->polygonType = (PolygonType)result; - return result; + polygonType = POLYGON_InBetweenFloorAndWall; + + face_plane.vNormal.x = v.x; + face_plane.vNormal.y = v.y; + face_plane.vNormal.z = v.z; + face_plane.dist = v7; } //----- (0049B0C9) -------------------------------------------------------- -int stru154::_49B0C9(Vec3_float_ *pNormal, float dist) +void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) { - signed int v3; // esi@1 - signed int result; // eax@9 - double v5; // st7@12 - double v6; // st6@12 - double v7; // st5@12 - signed int v8; // [sp+0h] [bp-4h]@8 - - v3 = 2; - if ( pNormal->z == 0.0 ) - { - v3 = 0; - } + if (fabsf(pNormal->z) < 1e-6f) + polygonType = POLYGON_VerticalWall; + else if (fabsf(pNormal->x) < 1e-6f && + fabsf(pNormal->y) < 1e-6f) + polygonType = POLYGON_Floor; else - { - if ( pNormal->x == 0.0 && pNormal->y == 0.0 ) - v3 = 1; - } - if ( v3 ) - { - if ( v3 == 1 ) - v8 = 3; - else - v8 = 4; - result = v8; - } - else - { - result = 1; - } - v5 = pNormal->z; - v6 = pNormal->y; - v7 = pNormal->x; - this->polygonType = (PolygonType)result; - this->face_plane.vNormal.x = v7; - this->face_plane.dist = dist; - this->face_plane.vNormal.y = v6; - this->face_plane.vNormal.z = v5; - return result; + polygonType = POLYGON_InBetweenFloorAndWall; + + face_plane.vNormal.x = pNormal->x; + face_plane.dist = dist; + face_plane.vNormal.y = pNormal->y; + face_plane.vNormal.z = pNormal->z; } //----- (0049B13D) -------------------------------------------------------- -int stru154::_49B13D(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *a3, float *a4) +void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) { ODMFace *v5; // ebx@1 - int v6; // eax@1 - unsigned __int16 *v7; // ebx@2 - Vec3_int_ *v8; // eax@3 + //int v6; // eax@1 + //unsigned __int16 *v7; // ebx@2 + //Vec3_int_ *v8; // eax@3 Vec3_int_ *v9; // ecx@3 - double v10; // st7@3 - int v11; // ecx@3 + //double v10; // st7@3 + //int v11; // ecx@3 Vec3_int_ *v12; // ecx@3 - double v13; // st7@3 - double v14; // st6@3 - double v15; // st5@3 - int v16; // ecx@3 + //double v13; // st7@3 + //double v14; // st6@3 + //double v15; // st5@3 + //int v16; // ecx@3 Vec3_int_ *v17; // eax@3 - double v18; // st5@3 + //double v18; // st5@3 Vec3_float_ *v19; // eax@3 - int result; // eax@8 - float v21; // ecx@10 - double v22; // st7@10 - double v23; // st6@10 + //int result; // eax@8 + //float v21; // ecx@10 + //double v22; // st7@10 + //double v23; // st6@10 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 - float v25; // [sp+18h] [bp-50h]@3 + //float v25; // [sp+18h] [bp-50h]@3 float v26; // [sp+1Ch] [bp-4Ch]@3 float v27; // [sp+20h] [bp-48h]@3 float v28; // [sp+24h] [bp-44h]@3 - float v29; // [sp+2Ch] [bp-3Ch]@3 - float v30; // [sp+30h] [bp-38h]@3 - float v31; // [sp+34h] [bp-34h]@3 - float v32; // [sp+38h] [bp-30h]@3 - float v33; // [sp+3Ch] [bp-2Ch]@3 + //float v29; // [sp+2Ch] [bp-3Ch]@3 + //float v30; // [sp+30h] [bp-38h]@3 + //float v31; // [sp+34h] [bp-34h]@3 + //float v32; // [sp+38h] [bp-30h]@3 + //float v33; // [sp+3Ch] [bp-2Ch]@3 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 - float v35; // [sp+4Ch] [bp-1Ch]@3 - float v36; // [sp+50h] [bp-18h]@3 - float v37; // [sp+54h] [bp-14h]@3 + //float v35; // [sp+4Ch] [bp-1Ch]@3 + //float v36; // [sp+50h] [bp-18h]@3 + //float v37; // [sp+54h] [bp-14h]@3 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 - int v39; // [sp+64h] [bp-4h]@1 - - v39 = 0; + //int v39; // [sp+64h] [bp-4h]@1 + + //v39 = 0; v1.x = 0.0; v5 = pFace; - v6 = pFace->uNumVertices; + //v6 = pFace->uNumVertices; v1.y = 0.0; v1.z = 0.0; - if ( v6 - 1 <= 0 ) - { -LABEL_8: - a3->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) * 0.000015259022 + (double)(v5->pFacePlane.vNormal.x >> 16); - a3->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) * 0.000015259022 + (double)(v5->pFacePlane.vNormal.y >> 16); - a3->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) * 0.000015259022 + (double)(v5->pFacePlane.vNormal.z >> 16); - result = (int)a4; - *a4 = (double)(v5->pFacePlane.dist & 0xFFFF) * 0.000015259022 + (double)(v5->pFacePlane.dist >> 16); - } - else - { - v7 = &pFace->pVertexIDs[1]; - while ( 1 ) - { - v8 = pVertices->pVertices; - v9 = &v8[*(v7 - 1)]; - v35 = (double)v9->x; - v36 = (double)v9->y; - v10 = (double)v9->z; - v11 = *v7; - v37 = v10; - v12 = &v8[v11]; - v13 = (double)v12->x; - v14 = (double)v12->y; - v15 = (double)v12->z; - v16 = v7[1]; - v25 = v15; - v17 = &v8[v16]; - v18 = (double)v17->x; - v29 = (double)v17->y; - v30 = (double)v17->z; - v31 = v13 - v35; - v32 = v14 - v36; - v33 = v25 - v37; - v1.x = v31; - v26 = v18 - v13; - v1.y = v32; - v27 = v29 - v14; - v1.z = v33; - v28 = v30 - v25; + + if (pFace->uNumVertices >= 2) + { + int i = 0; + while ( i < pFace->uNumVertices - 2 ) + { + v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; + v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; + v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; + + v1.x = v12->x - v9->x; + v26 = v17->x - v12->x; + v1.y = v12->y - v9->y; + v27 = v17->y - v12->y; + v1.z = v12->z - v9->z; + v28 = v17->z - v12->z; v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); v38.x = v19->x; v38.y = v19->y; v38.z = v19->z; - if ( v38.x != 0.0 ) - break; - if ( v38.y != 0.0 || v38.z != 0.0 ) - break; - ++v39; - ++v7; - if ( v39 >= pFace->uNumVertices - 1 ) - { - v5 = pFace; - goto LABEL_8; - } - } - v38.Normalize(); - v21 = v38.y; - a3->x = v38.x; - v22 = v37 * v38.z; - v23 = v36 * v38.y; - a3->y = v21; - a3->z = v38.z; - result = (int)a4; - *a4 = -(v22 + v23 + v35 * v38.x); - } - return result; + if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) + { + v38.Normalize(); + + pOutNormal->x = v38.x; + pOutNormal->y = v38.y; + pOutNormal->z = v38.z; + + *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); + return; + } + } + } + + pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); + pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); + pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); + *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); } @@ -5454,327 +5388,6 @@ -//----- (004AC1C9) -------------------------------------------------------- -int __thiscall sub_4AC1C9(unsigned int _this, Vec4_int_ *a2) -{ - unsigned int v2; // esi@1 - __int16 v3; // di@1 - signed int v4; // ebx@1 - int v5; // ecx@3 - Vec4_int_ *v6; // eax@10 - Vec4_int_ *v7; // esi@14 - int result; // eax@16 - char *v9; // esi@16 - Vec4_int_ a1; // [sp+Ch] [bp-34h]@10 - Vec4_int_ v11; // [sp+1Ch] [bp-24h]@14 - Vec4_int_ Dst; // [sp+2Ch] [bp-14h]@1 - int v13; // [sp+3Ch] [bp-4h]@1 - - v2 = _this; - v3 = sub_4382BC(_this); - v13 = sub_4383ED(); - v4 = 0; - memset(&Dst, 0, 0x10u); - if ( v3 < 0 ) - goto LABEL_19; - if ( (signed int)v2 > 0 ) - { - if ( (signed int)v2 > 150 ) - { - v5 = (int)a2; - } - else - { - v5 = 4000 * v2; - v4 = 1; - } - } - else - { - v5 = 4000 * dword_4F031C[(unsigned __int16)v3]; - } - if ( v13 & 0x10 && !v4 ) - { - if ( v2 ) - v6 = sub_4AC4FD_get_cpu_clocks_rdtsc(v5, &a1); - else - v6 = sub_4AC33A_get_cpu_clocks_QPC(v5, &a1); - goto LABEL_14; - } - if ( (unsigned __int16)v3 < 3u ) - { -LABEL_19: - v7 = &Dst; - goto LABEL_16; - } - v6 = sub_4AC277(v5, &a1); -LABEL_14: - v11.x = v6->x; - v11.y = v6->y; - v11.z = v6->z; - v11.w = v6->w; - v7 = &v11; -LABEL_16: - result = (int)a2; - a2->x = v7->x; - v9 = (char *)&v7->y; - a2->y = *(int *)v9; - v9 += 4; - a2->z = *(int *)v9; - a2->w = *((int *)v9 + 1); - return result; -} -// 4F031C: using guessed type int dword_4F031C[]; - -//----- (004AC277) -------------------------------------------------------- -Vec4_int_ *__thiscall sub_4AC277(unsigned int _this, Vec4_int_ *a2) -{ - __debugbreak(); - return 0; - /*signed int v2; // esi@1 - signed __int16 v4; // bx@3 - int v10; // esi@8 - int v11; // eax@10 - Vec4_int_ *result; // eax@13 - Vec4_int_ Dst; // [sp+8h] [bp-30h]@1 - LARGE_INTEGER Frequency; // [sp+18h] [bp-20h]@1 - LARGE_INTEGER PerformanceCount; // [sp+20h] [bp-18h]@3 - LARGE_INTEGER v16; // [sp+28h] [bp-10h]@5 - int v17; // [sp+30h] [bp-8h]@1 - int v18; // [sp+34h] [bp-4h]@2 - - v17 = _this; - v2 = -1; - memset(&Dst, 0, 0x10u); - if ( QueryPerformanceFrequency(&Frequency) ) - { - v18 = 10; - do - { - QueryPerformanceCounter(&PerformanceCount); - _EAX = -2147483648; - v4 = 4000; - do - { - __asm { bsf ecx, eax } - --v4; - } - while ( v4 ); - QueryPerformanceCounter(&v16); - if ( (signed int)v16.s.LowPart - (signed int)PerformanceCount.s.LowPart < (unsigned int)v2 ) - v2 = v16.s.LowPart - PerformanceCount.s.LowPart; - --v18; - } - while ( v18 ); - v10 = 100000 * v2 / (Frequency.s.LowPart / 0xA); - if ( v10 % Frequency.s.LowPart > Frequency.s.LowPart >> 1 ) - ++v10; - v11 = v17 / (unsigned int)v10; - Dst.z = v17 / (unsigned int)v10; - if ( v17 % (unsigned int)v10 > (unsigned int)v10 >> 1 ) - ++v11; - Dst.x = v17; - Dst.y = v10; - Dst.w = v11; - } - result = a2; - a2->x = Dst.x; - a2->y = Dst.y; - a2->z = Dst.z; - a2->w = Dst.w; - return result;*/ -} - -//----- (004AC33A) -------------------------------------------------------- -Vec4_int_ *__thiscall sub_4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1) -{ - __debugbreak(); - return 0; - /*int v2; // esi@1 - int v3; // ebx@1 - unsigned __int64 v4; // qax@4 - unsigned __int64 v5; // qax@7 - DWORD v6; // edi@7 - DWORD v7; // eax@7 - unsigned int v8; // ecx@10 - unsigned __int64 v9; // qax@10 - unsigned int v10; // edi@10 - int v11; // eax@14 - unsigned int v12; // ecx@19 - Vec4_int_ *result; // eax@24 - int Dst; // [sp+Ch] [bp-4Ch]@1 - int v15; // [sp+10h] [bp-48h]@23 - int v16; // [sp+14h] [bp-44h]@21 - int v17; // [sp+18h] [bp-40h]@21 - LARGE_INTEGER Frequency; // [sp+1Ch] [bp-3Ch]@1 - LARGE_INTEGER PerformanceCount; // [sp+24h] [bp-34h]@2 - LARGE_INTEGER v20; // [sp+2Ch] [bp-2Ch]@2 - int v21; // [sp+34h] [bp-24h]@2 - int v22; // [sp+38h] [bp-20h]@2 - int v23; // [sp+3Ch] [bp-1Ch]@4 - int v24; // [sp+40h] [bp-18h]@7 - int nPriority; // [sp+44h] [bp-14h]@2 - unsigned int v26; // [sp+48h] [bp-10h]@1 - unsigned int v27; // [sp+4Ch] [bp-Ch]@1 - HANDLE hThread; // [sp+50h] [bp-8h]@1 - int v29; // [sp+54h] [bp-4h]@1 - - v2 = 0; - v3 = 0; - v29 = 0; - v27 = 0; - v26 = 0; - hThread = GetCurrentThread(); - memset(&Dst, 0, 0x10u); - if ( QueryPerformanceFrequency(&Frequency) ) - { - do - { - ++v29; - v22 = v2; - v21 = v3; - QueryPerformanceCounter(&PerformanceCount); - v20 = PerformanceCount; - nPriority = GetThreadPriority(hThread); - if ( nPriority != 2147483647 ) - SetThreadPriority(hThread, 15); - while ( v20.s.LowPart - PerformanceCount.s.LowPart < 0x32 ) - { - QueryPerformanceCounter(&v20); - v4 = __rdtsc(); - v23 = v4; - } - PerformanceCount = v20; - do - { - QueryPerformanceCounter(&v20); - v5 = __rdtsc(); - v24 = v5; - v6 = v20.s.LowPart; - v7 = PerformanceCount.s.LowPart; - } - while ( v20.s.LowPart - PerformanceCount.s.LowPart < 0x3E8 ); - if ( nPriority != 2147483647 ) - { - SetThreadPriority(hThread, nPriority); - v7 = PerformanceCount.s.LowPart; - v6 = v20.s.LowPart; - } - v8 = v24 - v23; - v27 += v24 - v23; - v9 = (100000 * v6 - 100000 * v7) / (Frequency.s.LowPart / 0xA); - v10 = v9; - v26 += v9; - if ( v9 % Frequency.s.LowPart > Frequency.s.LowPart >> 1 ) - v10 = v9 + 1; - v3 = v8 / v10; - if ( v8 % v10 > v10 >> 1 ) - v3 = v8 / v10 + 1; - v2 = v21; - v11 = v3 + v22 + v21; - } - while ( v29 < 3 - || v29 < 20 - && ((unsigned int)(3 * v3 - v11) > 3 || (unsigned int)(3 * v21 - v11) > 3 || (unsigned int)(3 * v22 - v11) > 3) ); - v12 = 10 * v27 / v26; - if ( 100 * v27 / v26 - 10 * v12 >= 6 ) - ++v12; - v16 = v27 / v26; - v17 = v27 / v26; - if ( v12 - 10 * v27 / v26 >= 6 ) - v17 = v27 / v26 + 1; - v15 = v26; - Dst = v27; - } - result = a1; - a1->x = Dst; - a1->y = v15; - a1->z = v16; - a1->w = v17; - return result;*/ -} - -//----- (004AC4FD) -------------------------------------------------------- -Vec4_int_ *__thiscall sub_4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1) -{ - __debugbreak(); - return 0; - /*int v2; // eax@1 - int v3; // eax@4 - bool v4; // eax@5 - unsigned __int64 v5; // kr00_8@8 - int v6; // edi@9 - int v7; // eax@9 - bool v8; // eax@10 - unsigned __int64 v9; // kr08_8@13 - unsigned int v10; // eax@15 - Vec4_int_ *result; // eax@17 - int Dst; // [sp+Ch] [bp-2Ch]@1 - int v13; // [sp+10h] [bp-28h]@17 - int v14; // [sp+14h] [bp-24h]@15 - int v15; // [sp+18h] [bp-20h]@17 - unsigned int v16; // [sp+1Ch] [bp-1Ch]@8 - unsigned int v17; // [sp+20h] [bp-18h]@8 - unsigned int v18; // [sp+24h] [bp-14h]@13 - int nPriority; // [sp+28h] [bp-10h]@1 - __int64 v20; // [sp+2Ch] [bp-Ch]@1 - int v21; // [sp+34h] [bp-4h]@3 - - HIDWORD(v20) = GetCurrentThread(); - memset(&Dst, 0, 0x10u); - v2 = GetThreadPriority(HIDWORD(v20)); - nPriority = v2; - if ( v2 != 0x7FFFFFFF ) - SetThreadPriority(HIDWORD(v20), v2 + 1); - __outbyte(0x70u, 0); - v21 = __inbyte(0x71u); - do - { - __outbyte(0x70u, 0); - LODWORD(v20) = __inbyte(0x71u); - v3 = v20 - v21; - if ( (signed int)v20 >= v21 ) - v4 = v3 > 0; - else - v4 = v3 + 10; - } - while ( !v4 ); - v5 = __rdtsc(); - v16 = HIDWORD(v5); - v17 = v5; - do - { - __outbyte(0x70u, 0); - v21 = __inbyte(0x71u); - v6 = v21; - v7 = v21 - v20; - if ( v21 >= (signed int)v20 ) - v8 = v7 > 0; - else - v8 = v7 + 10; - } - while ( !v8 ); - v9 = __rdtsc(); - v18 = HIDWORD(v9); - v21 = v9; - if ( nPriority != 0x7FFFFFFF ) - SetThreadPriority(HIDWORD(v20), nPriority); - nPriority = v21; - *(__int64 *)((char *)&v20 + 4) = __PAIR__(v18, v21) - __PAIR__(v16, v17); - Dst = HIDWORD(v20); - v10 = HIDWORD(v20) / 0xF4240; - v14 = HIDWORD(v20) / 0xF4240; - if ( HIDWORD(v20) / 0x186A0 - 10 * HIDWORD(v20) / 0xF4240 >= 6 ) - ++v10; - v15 = v10; - result = a1; - v13 = 1000000 * v6 - 1000000 * v20; - a1->x = Dst; - a1->y = v13; - a1->z = v14; - a1->w = v15; - return result;*/ -}
--- a/mm7_5.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/mm7_5.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -4018,173 +4018,6 @@ -//----- (004382BC) -------------------------------------------------------- -__int16 __thiscall sub_4382BC(int _this) -{ - LOG_DECOMPILATION_WARNING(); - return 0; - /*__int16 result; // ax@4 - __int16 v14; // sp@11 - int v15; // [sp-4h] [bp-Ch]@0 - signed __int16 v16; // [sp+4h] [bp-4h]@1 - __int16 v17; // [sp+4h] [bp-4h]@8 - __int16 v18; // [sp+4h] [bp-4h]@11 - - v16 = 1; - __asm { pushf } - if ( v15 == (v15 ^ 0x200000) ) - v16 = 0; - if ( v16 ) - { - result = sub_43847A(); - } - else - { - //UNDEF(_ZF); - //UNDEF(_SF); - //UNDEF(_OF); - _CF = 0; - if ( !_ZF ) - _CF = 1; - __asm { pushfw } - bProcessorIsNotIntel = (BYTE2(v15) & 1 ^ 1) & 1; - _CF = 0; - _OF = 0; - _ZF = 0; - _SF = 1; - __asm { pushfw } - v17 = 2; - if ( (HIWORD(v15) | 0xF000) & 0xF000 ) - v17 = -1; - __asm { popfw } - result = v17; - if ( v17 != 2 ) - { - _CF = 0; - _OF = 0; - _ZF = v14 == 0; - _SF = v14 < 0; - __asm { pushf } - v18 = 3; - if ( v15 != (v15 ^ 0x40000) ) - v18 = -1; - __asm { popf } - result = v18; - if ( v18 != 3 ) - result = 4; - } - } - if ( bProcessorIsNotIntel ) - HIBYTE(result) |= 0x80u; - return result;*/ -} - -//----- (004383ED) -------------------------------------------------------- -int __cdecl sub_4383ED() -{ - LOG_DECOMPILATION_WARNING(); - return 0; - /*signed int v9; // eax@4 - int v16; // [sp-4h] [bp-38h]@0 - int v17[3]; // [sp+Ch] [bp-28h]@1 - char v18; // [sp+18h] [bp-1Ch]@1 - char v19; // [sp+19h] [bp-1Bh]@1 - int v20[4]; // [sp+1Ch] [bp-18h]@1 - int v21; // [sp+2Ch] [bp-8h]@1 - int v22; // [sp+30h] [bp-4h]@1 - - v17[0] = *(int *)"------------"; - v17[1] = *(int *)"--------"; - v17[2] = *(int *)"----"; - v18 = asc_4E4938[12]; - v19 = 0; - v22 = 0; - v20[0] = *(int *)"GenuineIntel"; - v20[1] = *(int *)"ineIntel"; - v20[2] = *(int *)"ntel"; - LOBYTE(v20[3]) = aGenuineintel[12]; - _CF = 0; - _OF = 0; - _ZF = 0; - _SF = 0; - v21 = 1; - __asm { pushf } - if ( v16 == (v16 ^ 0x200000) ) - v21 = 0; - if ( (short)v21 ) - { - _EAX = 0; - __asm { cpuid } - v17[0] = _EBX; - v17[1] = _EDX; - v17[2] = _ECX; - v9 = 0; - do - { - if ( *((char *)v17 + v9) != *((char *)v20 + v9) ) - bProcessorIsNotIntel = 1; - ++v9; - } - while ( v9 < 12 ); - if ( v9 >= 1 ) - { - _EAX = 1; - __asm { cpuid } - v22 = _EDX; - } - } - return v22;*/ -} - -//----- (0043847A) -------------------------------------------------------- -__int16 __cdecl sub_43847A() -{ - __debugbreak(); - return 0; - /*signed int v5; // eax@1 - char v12[12]; // [sp+Ch] [bp-28h]@1 - char v13; // [sp+18h] [bp-1Ch]@1 - char v14; // [sp+19h] [bp-1Bh]@1 - int v15[4]; // [sp+1Ch] [bp-18h]@1 - int v16; // [sp+2Eh] [bp-6h]@1 - char v17; // [sp+32h] [bp-2h]@6 - char v18; // [sp+33h] [bp-1h]@1 - - *(int *)v12 = *(int *)"------------"; - *(int *)&v12[4] = *(int *)"--------"; - *(int *)&v12[8] = *(int *)"----"; - v13 = asc_4E4938[12]; - v14 = 0; - v18 = 0; - v15[0] = *(int *)"GenuineIntel"; - v15[1] = *(int *)"ineIntel"; - v15[2] = *(int *)"ntel"; - v16 = 65535; - LOBYTE(v15[3]) = aGenuineintel[12]; - _EAX = 0; - __asm { cpuid } - *(int *)v12 = _EBX; - *(int *)&v12[4] = _EDX; - *(int *)&v12[8] = _ECX; - v5 = 0; - do - { - if ( v12[v5] != *((char *)v15 + v5) ) - bProcessorIsNotIntel = 1; - ++v5; - } - while ( v5 < 12 ); - if ( v5 >= 1 ) - { - _EAX = 1; - __asm { cpuid } - v18 = _EAX & 0xF; - LOBYTE(_EAX) = (unsigned __int8)(_EAX & 0xF0) >> 4; - v17 = _EAX; - LOWORD(v16) = ((_EAX & 0xF00u) >> 8) & 0xF; - } - return v16;*/ -}
--- a/mm7_data.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/mm7_data.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -486,7 +486,17 @@ unsigned int pManaBarPos[4] = {102, 217, 331, 447}; char _4E2AD8_ui_colors[72]; char _4E2B21_buff_spell_tooltip_colors[80]; -char byte_4E2B70[777]; // weak +char monster_popup_y_offsets[88] = +{ + 236, 20, 0, 216, 0, 0, 0, 0, 0, 0, 206, + 20, 0, 246, 246, 236, 10, 246, 0, 0, 0, 236, + 10, 246, 0, 0, 0, 236, 246, 0, 0, 0, 216, + 236, 0, 0, 0, 206, 226, 226, 226, 226, 226, 226, + 0, 0, 0, 0, 0, 0, 236, 236, 236, 20, 20, + 20, 10, 10, 10, 10, 10, 10, 166, 196, 216, 236, + 236, 176, 246, 0, 0, 216, 0, 0, 0, 236, 10, + 0, 0, 0, 0, 0, 0, 196, 0, 0, 0, 0 +}; unsigned char hourglass_icon_idx = 12; // weak char aSS[777]; // idb @@ -2101,10 +2111,6 @@ int dword_721110[777]; // idb int dword_721160[777]; // idb int odm_floor_level[20]; // idb -int dword_721200[777]; // idb -int blv_floor_level[50]; // idb dword_7212C8 -__int16 word_721390[104]; // idb -__int16 word_721460[104]; // idb int blv_prev_party_x; // weak int blv_prev_party_z; // weak int blv_prev_party_y; // weak
--- a/mm7_data.h Fri Mar 22 19:58:47 2013 +0600 +++ b/mm7_data.h Fri Mar 22 19:59:03 2013 +0600 @@ -472,7 +472,7 @@ extern unsigned int pManaBarPos[4]; extern char _4E2AD8_ui_colors[72]; extern char _4E2B21_buff_spell_tooltip_colors[80]; -extern char byte_4E2B70[]; // weak +extern char monster_popup_y_offsets[]; // weak extern unsigned char hourglass_icon_idx; // weak extern char aSS[]; // idb @@ -1560,10 +1560,6 @@ extern int dword_721110[]; // idb extern int dword_721160[]; // idb extern int odm_floor_level[20]; // idb dword_7211B0 -extern int dword_721200[]; // idb -extern int blv_floor_level[50]; // idb -extern __int16 word_721390[]; // idb -extern __int16 word_721460[]; // idb extern int blv_prev_party_x; // weak extern int blv_prev_party_z; // weak extern int blv_prev_party_y; // weak @@ -1896,7 +1892,7 @@ bool __thiscall sub_41CD4F(unsigned int _this); char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2); void GameUI_DrawItemInfo(struct ItemGen* inspect_item); // idb -char *__fastcall MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0); +void MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0); void __cdecl nullsub_3(); // idb void __cdecl LoadActualSkyFrame(); void __cdecl Sleep6Hours(); @@ -1956,9 +1952,6 @@ void __cdecl nullsub_4(); // idb void __cdecl nullsub_5(); // idb void __cdecl nullsub_6(); // idb -__int16 __thiscall sub_4382BC(int _this); -int __cdecl sub_4383ED(); -__int16 __cdecl sub_43847A(); void __cdecl _438F8F_area_of_effect__damage_evaluate(); void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, struct Vec3_int_ *pPos, unsigned int a4); void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2); // idb @@ -2274,10 +2267,7 @@ int __fastcall GetSoundStrengthByDistanceFromParty(int a1, int a2, int a3); struct _DIG_DRIVER *Audio_GetFirstHardwareDigitalDriver(void); void __cdecl PlayLevelMusic(); -int __thiscall sub_4AC1C9(unsigned int _this, Vec4_int_ *a2); -struct Vec4_int_ *__thiscall sub_4AC277(unsigned int _this, Vec4_int_ *a2); -struct Vec4_int_ *__thiscall sub_4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1); -struct Vec4_int_ *__thiscall sub_4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1); +struct Vec4_int_ *__thiscall _4AC277_get_cpu_speed_sub3(unsigned int _this, Vec4_int_ *a2); int __fastcall sub_4AD504(signed int uFaceID); void __fastcall sub_4ADD1D(int uFaceID); int __fastcall sub_4AE1E7(int a1, int a2, int a3);
--- a/stru6.cpp Fri Mar 22 19:58:47 2013 +0600 +++ b/stru6.cpp Fri Mar 22 19:59:03 2013 +0600 @@ -1537,7 +1537,7 @@ vsr.uViewportW = pViewport->uViewportBR_Y; vsr.uFlags = 0; if ( v11 >= 0 ) - pSprites_LOD->pSpriteHeaders[v11]._4ACC38(&vsr, 1); + pSprites_LOD->pSpriteHeaders[v11].DrawSprite_sw(&vsr, 1); } } }