# HG changeset patch # User Nomad # Date 1351090964 -7200 # Node ID 0f4ed4f0f4728fef4cd56dc876f61599914d13ad # Parent 4211cceb3813a3aeede71f4ae68a162b758510a3 BLV minimap: 1/3 diff -r 4211cceb3813 -r 0f4ed4f0f472 GUIProgressBar.cpp --- a/GUIProgressBar.cpp Tue Oct 23 23:40:55 2012 +0200 +++ b/GUIProgressBar.cpp Wed Oct 24 17:02:44 2012 +0200 @@ -179,13 +179,12 @@ v3 = pIconsFrameTable->GetFrame(uIconID_TurnHour, 0); pRenderer->DrawTextureTransparent(0x64u, 0x92u, &pIcons_LOD->pTextures[v3->uTextureID]); v4 = (double)(113 * uProgressCurrent) / (double)uProgressMax; - pRenderer->FillRect2( - 0, + pRenderer->FillRectFast( 174, 164, - COERCE_UNSIGNED_INT64(v4 + 6.7553994e15), + floorf(v4 + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15), 16, - LOWORD(pRenderer->uTargetRMask)); + pRenderer->uTargetRMask); goto LABEL_11; } LABEL_6: diff -r 4211cceb3813 -r 0f4ed4f0f472 Game.cpp --- a/Game.cpp Tue Oct 23 23:40:55 2012 +0200 +++ b/Game.cpp Wed Oct 24 17:02:44 2012 +0200 @@ -136,17 +136,16 @@ } if (!pVideoPlayer->pSmackerMovie) { - GameUI_DrawMinimap(0x1E8u, 0x10u, 0x271u, 0x85u, viewparams->uMinimapZoom, pParty->uFlags & 2); + GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, pParty->uFlags & 2); if (v4) { if ( !sub_4226C2() && pRenderer->pRenderD3D) - pRenderer->FillRect2( - 0, + pRenderer->FillRectFast( pViewport->uViewportX, pViewport->uViewportY, pViewport->uViewportZ - pViewport->uViewportX, pViewport->uViewportW - pViewport->uViewportY + 1, - LOWORD(pRenderer->uTargetGMask) | LOWORD(pRenderer->uTargetBMask)); + pRenderer->uTargetGMask | pRenderer->uTargetBMask); viewparams->field_48 = 0; } } @@ -827,11 +826,11 @@ signed int Game::_44ED0A(BLVFace *a2, int *a3, signed int a4) { double v4; // st7@3 - double v5; // ST00_8@3 + //double v5; // ST00_8@3 signed int v6; // eax@4 //double v7; // ST00_8@5 signed int result; // eax@7 - double v9; // ST00_8@8 + //double v9; // ST00_8@8 //double v10; // ST00_8@10 float v11; // [sp+14h] [bp+8h]@3 float v12; // [sp+18h] [bp+Ch]@3 @@ -845,8 +844,8 @@ v11 = v4; *a3 |= 2u; v12 = (1.0 - this->_E28_timed_gamma_strength) * v4; - v5 = v12 + 6.7553994e15; - if ( SLODWORD(v5) >= 0 ) + //v5 = v12 + 6.7553994e15; + if (floorf(v12 + 0.5f)/* SLODWORD(v5)*/ >= 0 ) { v13 = (1.0 - this->_E28_timed_gamma_strength) * v11; //v7 = v13 + 6.7553994e15; @@ -860,8 +859,8 @@ if ( a4 >= v6 ) { v14 = (1.0 - _E28_timed_gamma_strength) * v11; - v9 = v14 + 6.7553994e15; - if ( SLODWORD(v9) >= 0 ) + //v9 = v14 + 6.7553994e15; + if (floorf(v14 + 0.5f)/* SLODWORD(v9)*/ >= 0 ) { v15 = (1.0 - _E28_timed_gamma_strength) * v11; //v10 = v15 + 6.7553994e15; diff -r 4211cceb3813 -r 0f4ed4f0f472 IndoorCameraD3D.cpp --- a/IndoorCameraD3D.cpp Tue Oct 23 23:40:55 2012 +0200 +++ b/IndoorCameraD3D.cpp Wed Oct 24 17:02:44 2012 +0200 @@ -1225,10 +1225,10 @@ { char *v8; // eax@2 signed int v9; // ecx@2 - bool result; // eax@5 + //bool result; // eax@5 int v11; // ecx@5 - signed int v12; // ecx@6 - char *v13; // esi@6 + //signed int v12; // ecx@6 + //char *v13; // esi@6 RenderVertexSoft *v14; // eax@8 RenderVertexSoft *v15; // edx@8 Vec3_float_ a5; // [sp+18h] [bp-3Ch]@12 @@ -1236,7 +1236,7 @@ int v18; // [sp+48h] [bp-Ch]@5 //stru9 *thisa; // [sp+4Ch] [bp-8h]@1 int a7a; // [sp+53h] [bp-1h]@5 - bool a6a; // [sp+70h] [bp+1Ch]@5 + //bool a6a; // [sp+70h] [bp+1Ch]@5 v17 = 0.0; //thisa = pGame->pStru9Instance; @@ -1244,23 +1244,20 @@ static RenderVertexSoft sr_vertices_50D9D8[64]; - result = 0; - LOBYTE(a7a) = 0; + //result = 0; + a7a = 0; v11 = 2 * (a6 == 0) + 1; - a6a = 0; + //a6a = 0; v18 = v11; if ( uNumVertices <= 0 ) - { -LABEL_14: - LOBYTE(result) = a7a; - } - else - { - v12 = *pOutNumVertices; - v13 = (char *)&a4->y; + return false; + + //v12 = *pOutNumVertices; + //v13 = (char *)&a4->y; + uint i = 0; while ( 1 ) { - if ( result % 2 ) + if (i % 2 ) { v14 = a1; v15 = sr_vertices_50D9D8; @@ -1270,27 +1267,24 @@ v15 = a1; v14 = sr_vertices_50D9D8; } - ++a6a; - if ( a6a == uNumVertices ) + ++i; + if (i == uNumVertices ) v14 = pVertices; - a5.x = *((float *)v13 - 1); - a5.y = *(float *)v13; - a5.z = *((float *)v13 + 1); - result = pGame->pStru9Instance->_4985FB(v15, v12, v14, pOutNumVertices, &a5, *((float *)v13 + 2), (char *)&a7a, _unused); - v12 = *pOutNumVertices; + a5.x = a4[i].x; + a5.y = a4[i].y; + a5.z = a4[i].z; + pGame->pStru9Instance->_4985FB(v15, *pOutNumVertices, v14, pOutNumVertices, &a5, a4[i].dot, (char *)&a7a, _unused); + //v12 = *pOutNumVertices; if ( (signed int)*pOutNumVertices < v18 ) break; - result = a6a; - v13 += 24; - if ( a6a >= uNumVertices ) - goto LABEL_14; + //result = a6a; + //v13 += 24; + if (i >= uNumVertices) + return a7a; } *pOutNumVertices = 0; - LOBYTE(result) = 1; - } - return result; + return true; } -// 50E5D8: using guessed type char static_50D9D8_init_flag_bit1; //----- (004371C3) -------------------------------------------------------- bool IndoorCameraD3D::_4371C3(RenderVertexSoft *pVertices, unsigned int *pOutNumVertices, int _unused) diff -r 4211cceb3813 -r 0f4ed4f0f472 Party.h --- a/Party.h Tue Oct 23 23:40:55 2012 +0200 +++ b/Party.h Wed Oct 24 17:02:44 2012 +0200 @@ -148,6 +148,9 @@ static void TakeFood(unsigned int uNumFood); static __int16 GiveFood(unsigned int _this); + inline bool WizardEyeActive() {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uExpireTime > 0;} + inline int WizardEyeSkillLevel() {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uSkill;} + int field_0; unsigned int uPartyHeight; diff -r 4211cceb3813 -r 0f4ed4f0f472 Render.cpp --- a/Render.cpp Tue Oct 23 23:40:55 2012 +0200 +++ b/Render.cpp Wed Oct 24 17:02:44 2012 +0200 @@ -6139,7 +6139,7 @@ //----- (004A0BEE) -------------------------------------------------------- -char Render::FillRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor) +char Render::Line2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor) { int v6; // edi@1 int v7; // edx@5 @@ -9618,52 +9618,20 @@ //----- (004A6D87) -------------------------------------------------------- -void Render::FillRect2(int uX, int uY, int a4, unsigned int a5, int a6, unsigned __int16 a7) -{ - Render *v7; // esi@1 - void *v8; // edx@2 - unsigned int v9; // ecx@3 - unsigned __int8 v10; // cf@5 - unsigned int v11; // ecx@5 - unsigned __int16 *v12; // edi@5 - int i; // ecx@5 - char v14; // zf@9 - int v15; // [sp+10h] [bp+Ch]@3 - - auto a1 = this; - v7 = a1; - if ( a1->uNumSceneBegins ) - { - v8 = &a1->pTargetSurface[uY + a4 * a1->uTargetSurfacePitch]; - if ( a6 > 0 ) - { - v9 = a5; - v15 = a6; - do - { - if ( (signed int)v9 > 0 ) - { - LOWORD(uX) = a7; - uX <<= 16; - LOWORD(uX) = a7; - v10 = v9 & 1; - v11 = v9 >> 1; - memset32(v8, uX, v11); - v12 = (unsigned __int16 *)((char *)v8 + 4 * v11); - for ( i = v10; i; --i ) - { - *v12 = a7; - ++v12; - } - v9 = a5; - v8 = (char *)v8 + 2 * a5; - } - v14 = v15-- == 1; - v8 = (char *)v8 + 2 * (v7->uTargetSurfacePitch - v9); - } - while ( !v14 ); - } - } +void Render::FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16) +{ + if (!uNumSceneBegins) + return; + + unsigned __int32 twoColors = (uColor16 << 16) | uColor16; + for (uint y = 0; y < uHeight; ++y) + { + auto pDst = &pTargetSurface[uX + (y + uY) * uTargetSurfacePitch]; + + memset32(pDst, twoColors, uWidth / 2); + if (uWidth & 1) + pDst[uWidth - 1] = uColor16; + } } diff -r 4211cceb3813 -r 0f4ed4f0f472 Render.h --- a/Render.h Tue Oct 23 23:40:55 2012 +0200 +++ b/Render.h Wed Oct 24 17:02:44 2012 +0200 @@ -277,7 +277,7 @@ void CreateSomeTexture(); bool InitializeFullscreen(HWND hWnd); bool SwitchToWindow(HWND hWnd); - char FillRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor); + char Line2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor); void ClearZBuffer(int a2, int a3); void Clip_v2(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW); void ParseTargetPixelFormat(); @@ -339,7 +339,7 @@ void _4A6A68(unsigned int a2, unsigned int a3, Texture *a4, __int16 height); void DrawTextPalette(int x, int y, int a4, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8); void DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor); - void FillRect2(int uX, int uY, int a4, unsigned int a5, int a6, unsigned __int16 a7); + void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16); int _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7); void _4A6E7E(unsigned int a2, unsigned int a3, Texture *a4); char DrawBuildingsD3D(); diff -r 4211cceb3813 -r 0f4ed4f0f472 mm7_1.cpp --- a/mm7_1.cpp Tue Oct 23 23:40:55 2012 +0200 +++ b/mm7_1.cpp Wed Oct 24 17:02:44 2012 +0200 @@ -3101,15 +3101,15 @@ v106.sZValue = 0; v106.uFlags = 0; pRenderer->Clip_v2(0, 0, 0x27Fu, 0x1DFu); - pRenderer->FillRect(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5); - pRenderer->FillRect( + pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5); + pRenderer->Line2D( v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, a5); - pRenderer->FillRect(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5); - pRenderer->FillRect(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5); + pRenderer->Line2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5); + pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5); if ( pRenderer->pRenderD3D ) { v13 = &pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]]; @@ -3150,20 +3150,18 @@ v116 = v106.uViewportZ; if ( v119 > (signed int)v106.uViewportW ) v119 = v106.uViewportW; - pRenderer->FillRect2( - 0, + pRenderer->FillRectFast( v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, - LOWORD(pRenderer->uTargetBMask) | LOWORD(pRenderer->uTargetGMask)); - pRenderer->FillRect2( - 0, + pRenderer->uTargetBMask | pRenderer->uTargetGMask); + pRenderer->FillRectFast( v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, - LOWORD(pRenderer->uTargetBMask) | LOWORD(pRenderer->uTargetGMask)); + pRenderer->uTargetBMask | pRenderer->uTargetGMask); v84.left = v106.uViewportX; v84.top = v106.uViewportY; v84.right = v106.uViewportZ; @@ -3269,8 +3267,7 @@ } else { - pRenderer->FillRect2( - 0, + pRenderer->FillRectFast( v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, diff -r 4211cceb3813 -r 0f4ed4f0f472 mm7_2.cpp --- a/mm7_2.cpp Tue Oct 23 23:40:55 2012 +0200 +++ b/mm7_2.cpp Wed Oct 24 17:02:44 2012 +0200 @@ -3450,13 +3450,12 @@ pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); pRenderer->BeginScene(); if ( pRenderer->pRenderD3D ) - pRenderer->FillRect2( - 1, + pRenderer->FillRectFast( pViewport->uViewportX, pViewport->uViewportY, pViewport->uViewportZ - pViewport->uViewportX, pViewport->uViewportW - pViewport->uViewportY + 1, - LOWORD(pRenderer->uTargetGMask) | LOWORD(pRenderer->uTargetBMask)); + pRenderer->uTargetGMask | pRenderer->uTargetBMask); auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr); pRenderer->_4A6A68( diff -r 4211cceb3813 -r 0f4ed4f0f472 mm7_3.cpp --- a/mm7_3.cpp Tue Oct 23 23:40:55 2012 +0200 +++ b/mm7_3.cpp Wed Oct 24 17:02:44 2012 +0200 @@ -4733,6 +4733,7 @@ } //----- (00476395) -------------------------------------------------------- +//0x26 Wizard eye at skill level 2 bool __thiscall CheckHiredNPCSpeciality(unsigned int uProfession) { bool result; // eax@2 @@ -13690,15 +13691,13 @@ //----- (00441D38) -------------------------------------------------------- -void __fastcall GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int flags) -{ - int v6; // ebx@6 - BLVFace *v7; // eax@8 - unsigned int *v8; // edi@9 +void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int flags) +{ + int uHeight; // ebx@6 unsigned int v9; // edx@9 unsigned int v10; // ebx@10 __int16 v11; // cx@11 - int v12; // ecx@17 + BLVFace *v12; // ecx@17 unsigned int v13; // ecx@21 unsigned int v14; // ebx@23 int v15; // eax@23 @@ -13709,9 +13708,6 @@ double v20; // st7@30 double v21; // st6@30 double v22; // st5@33 - float v23; // ST3C_4@37 - double v24; // ST20_8@37 - double v25; // ST20_8@37 unsigned __int16 *v26; // edx@37 signed int v27; // eax@37 unsigned __int16 *v28; // ecx@37 @@ -13761,30 +13757,23 @@ signed int uBluea; // [sp+28h] [bp-2Ch]@37 int v73; // [sp+2Ch] [bp-28h]@30 unsigned __int8 *v74; // [sp+30h] [bp-24h]@30 - signed int v75; // [sp+34h] [bp-20h]@4 int v76; // [sp+34h] [bp-20h]@91 int v77; // [sp+34h] [bp-20h]@108 signed int v78; // [sp+38h] [bp-1Ch]@37 int v79; // [sp+38h] [bp-1Ch]@72 - bool v80; // [sp+3Ch] [bp-18h]@2 - unsigned int a2; // [sp+40h] [bp-14h]@1 - int a2a; // [sp+40h] [bp-14h]@8 signed int a2b; // [sp+40h] [bp-14h]@41 char *a2c; // [sp+40h] [bp-14h]@68 - unsigned int a3; // [sp+44h] [bp-10h]@1 int a3a; // [sp+44h] [bp-10h]@40 - signed int uHeight; // [sp+48h] [bp-Ch]@1 - signed int uWidth; // [sp+4Ch] [bp-8h]@1 - signed int uZa; // [sp+5Ch] [bp+8h]@7 + signed int uCenterY; // [sp+48h] [bp-Ch]@1 + signed int uCenterX; // [sp+4Ch] [bp-8h]@1 signed int uZb; // [sp+5Ch] [bp+8h]@27 - signed int uZc; // [sp+5Ch] [bp+8h]@30 + signed int uWidth; // [sp+5Ch] [bp+8h]@30 signed int uZd; // [sp+5Ch] [bp+8h]@45 signed int uZe; // [sp+5Ch] [bp+8h]@67 signed int uZf; // [sp+5Ch] [bp+8h]@85 signed int uZg; // [sp+5Ch] [bp+8h]@105 unsigned int uWa; // [sp+60h] [bp+Ch]@23 float uWb; // [sp+60h] [bp+Ch]@30 - float uWe; // [sp+60h] [bp+Ch]@37 unsigned __int16 *uWc; // [sp+60h] [bp+Ch]@37 unsigned int uWd; // [sp+60h] [bp+Ch]@95 float uZooma; // [sp+64h] [bp+10h]@117 @@ -13793,25 +13782,26 @@ char *flagsc; // [sp+68h] [bp+14h]@86 unsigned int flagsd; // [sp+68h] [bp+14h]@105 - a3 = uY; - a2 = uX; - uWidth = (signed int)(uX + uZ) >> 1; - uHeight = (signed int)(uY + uW) >> 1; + //a3 = uY; + //a2 = uX; + uCenterX = (uX + uZ) / 2; + uCenterY = (uY + uW) / 2; lPitch = pRenderer->uTargetSurfacePitch; GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); uBlue = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu); - v80 = (signed __int64)pParty->pPartyBuffs[19].uExpireTime > 0; - v75 = pParty->pPartyBuffs[19].uSkill; - if ( CheckHiredNPCSpeciality(0x26u) ) - { - v80 = 1; - v75 = 2; - } - pRenderer->Clip_v2(a2, a3, uZ - 1, uW - 1); - v6 = uW - a3; + auto bWizardEyeActive = pParty->WizardEyeActive(); + auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel(); + if (CheckHiredNPCSpeciality(0x26u)) + { + bWizardEyeActive = true; + uWizardEyeSkillLevel = 2; + } + pRenderer->Clip_v2(uX, uY, uZ - 1, uW - 1); + uHeight = uW - uY; + uWidth = uZ - uX; + if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) { - uZc = uZ - a2; v17 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; v74 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; v62 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; @@ -13823,54 +13813,54 @@ uWb = v21; if ( uZoom == 512 ) { - v20 = v20 - (double)(uZc / 2); - v22 = (double)(v6 / 2); + v20 = v20 - (double)(uWidth / 2); + v22 = (double)(uHeight / 2); } else { if ( uZoom == 1024 ) { - v20 = v20 - (double)(uZc / 4); - v22 = (double)(v6 / 4); + v20 = v20 - (double)(uWidth / 4); + v22 = (double)(uHeight / 4); } else { if ( uZoom != 2048 ) goto LABEL_37; - v20 = v20 - (double)(uZc / 8); - v22 = (double)(v6 / 8); + v20 = v20 - (double)(uWidth / 8); + v22 = (double)(uHeight / 8); } } uWb = v21 - v22; LABEL_37: - v23 = v20 * 65536.0; - v24 = v23 + 6.7553994e15; - v70 = LODWORD(v24); - uWe = uWb * 65536.0; - v25 = uWe + 6.7553994e15; + //v23 = v20 * 65536.0; + //v24 = v23 + 6.7553994e15; + v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24); + //uWe = uWb * 65536.0; + //v25 = uWe + 6.7553994e15; v78 = v70; - uBluea = LODWORD(v25); + uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25); v26 = (unsigned __int16 *)_56EFD8_minimap; - v27 = SLODWORD(v25) >> 16; + v27 = uBluea >> 16; uWc = (unsigned __int16 *)_56EFD8_minimap; - v28 = &pRenderer->pTargetSurface[a2 + a3 * lPitch]; + v28 = &pRenderer->pTargetSurface[uX + uY * lPitch]; if ( flags ) { if ( v74 ) { v64 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - if ( v6 > 0 ) - { - a3a = v6; + if ( uHeight > 0 ) + { + a3a = uHeight; v29 = v70 >> 16; do { a2b = 0; - if ( uZc > 0 ) + if ( uWidth > 0 ) { v30 = (int)&v74[v27 * v64]; - flagsa = uZc; - a2b = uZc; + flagsa = uWidth; + a2b = uWidth; do { v31 = uWc; @@ -13910,102 +13900,96 @@ } while ( uZd ); uNumBlueFacesInBLVMinimap = 0; - goto LABEL_50; - } - pRenderer->FillRect2(v6, a2, a3, uZ - a2, v6, 0xFu); - uNumBlueFacesInBLVMinimap = 0; - uZa = 0; - if ( (signed int)pIndoor->pMapVertices->uNumVertices > 0 ) - { - a2a = 0; - v7 = pIndoor->pFaces; - while ( 1 ) - { - v8 = (uint *)&pIndoor->pMapVertices->pVertices[a2a]; - v9 = v7[LOWORD(pIndoor->pMapVertices[a2a + 2])].uAttributes; + } + else + { + pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); + uNumBlueFacesInBLVMinimap = 0; + + for (uint i = 0; i < pIndoor->pMapVertices->uNumVertices; ++i) + { + auto pMapVertex = &pIndoor->pMapVertices->pVertices[i]; + v9 = pIndoor->pFaces[pMapVertex->uFace1ID].uAttributes; if ( !(BYTE1(v9) & 0x20) ) { - v10 = v7[HIWORD(pIndoor->pMapVertices[a2a + 2])].uAttributes; + v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes; if ( !(BYTE1(v10) & 0x20) ) { - v11 = HIWORD(pIndoor->pMapVertices[a2a + 3]); + v11 = pMapVertex->uFlags; if ( v11 & 1 ) goto LABEL_15; if ( (v9 & 0x80u) != 0 || (v10 & 0x80u) != 0 ) - break; - } - } -LABEL_26: - ++uZa; - a2a += 3; - if ( uZa >= (signed int)pIndoor->pMapVertices->uNumVertices ) - goto LABEL_27; - } - HIWORD(pIndoor->pMapVertices[a2a + 3]) = v11 | 1; - pIndoor->_visible_outlines[uZa >> 3] |= 1 << (7 - uZa % 8); - v7 = pIndoor->pFaces; + goto LABEL_ABC; + } + } + continue; + +LABEL_ABC: + pIndoor->pMapVertices->pVertices[i].uFlags = v11 | 1; + pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); + LABEL_15: - if ( v80 - && v75 >= 3 - && ((v12 = (int)&v7[*((short *)v8 + 2)], *(int *)(v12 + 44) & 0x2000000) - || v7[*((short *)v8 + 3)].uAttributes & 0x2000000) - && (pIndoor->pFaceExtras[*(short *)(v12 + 72)].uEventID - || pIndoor->pFaceExtras[v7[*((short *)v8 + 3)].uFaceExtraID].uEventID) + if ( bWizardEyeActive + && uWizardEyeSkillLevel >= 3 + && ((v12 = &pIndoor->pFaces[pMapVertex->uFace1ID], v12->uAttributes & 0x2000000) || pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes & 0x2000000) + && (pIndoor->pFaceExtras[v12->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pIndoor->pFaces[pMapVertex->uFace2ID].uFaceExtraID].uEventID) && (v13 = uNumBlueFacesInBLVMinimap, (signed int)uNumBlueFacesInBLVMinimap < 49) ) { - pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap] = uZa; + pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap] = i; uNumBlueFacesInBLVMinimap = v13 + 1; } else { - v69 = uWidth + v69 = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[*(short *)v8].x) >> 16) << 16) + * (signed __int64)pIndoor->pVertices[pMapVertex->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); - lPitcha = uHeight + lPitcha = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[*(short *)v8].y) >> 16) << 16) + * (signed __int64)pIndoor->pVertices[pMapVertex->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.z) >> 16); - uWa = uWidth + uWa = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[*((short *)v8 + 1)].x) >> 16) << 16) + * (signed __int64)pIndoor->pVertices[pMapVertex->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); - v14 = uHeight + v14 = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[*((short *)v8 + 1)].y) >> 16) << 16) + * (signed __int64)pIndoor->pVertices[pMapVertex->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.z) >> 16); - v15 = abs(*((short *)v8 + 4) - pParty->vPosition.y) / 8; + v15 = abs(pMapVertex->sZ - pParty->vPosition.y) / 8; if ( v15 > 100 ) v15 = 100; - pRenderer->FillRect(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); - v7 = pIndoor->pFaces; - } - goto LABEL_26; - } -LABEL_27: + pRenderer->Line2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); + } + } + + for ( uZb = 0; uZb < (signed int)uNumBlueFacesInBLVMinimap; ++uZb ) { v16 = (uint *)&pIndoor->pMapVertices->pVertices[3 * pBlueFacesInBLVMinimapIDs[uZb]]; - pRenderer->FillRect( - uWidth + pRenderer->Line2D( + uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[*(short *)v16].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16), - uHeight + uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[*(short *)v16].y) >> 16) << 16) - uZoom * pParty->vPosition.z) >> 16), - uWidth + uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[HIWORD(pIndoor->pMapVertices[3 * pBlueFacesInBLVMinimapIDs[uZb] + 1])].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16), - uHeight + uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[HIWORD(pIndoor->pMapVertices[3 * pBlueFacesInBLVMinimapIDs[uZb] + 1])].y) >> 16) << 16) - uZoom * pParty->vPosition.z) >> 16), uBlue); } -LABEL_50: + } + + +//_draw_party_arrow: v33 = 0; v34 = pParty->sRotationY & stru_5C6E00->uDoublePiMask; v35 = 0; @@ -14057,13 +14041,13 @@ v35 = v57; LABEL_66: pRenderer->DrawTextureTransparent( - uWidth - 3, - uHeight - 3, + uCenterX - 3, + uCenterY - 3, (Texture *)(pTextureIDs_pMapDirs[v35] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v35]] : 0)); v36 = 255; flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu); v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); - if ( v80 ) + if ( bWizardEyeActive ) { uZe = 0; if ( (signed int)uNumLayingItems > 0 ) @@ -14073,11 +14057,11 @@ { if ( !*((short *)a2c - 1) || !*(short *)a2c - || v75 == 1 + || uWizardEyeSkillLevel == 1 || (v37 = ((unsigned __int64)((*(int *)(a2c + 2) - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) - + uWidth, + + uCenterX, v79 = (unsigned __int64)((*(int *)(a2c + 6) - pParty->vPosition.z) * (signed __int64)(signed int)uZoom) >> 16, - v38 = uHeight - v79, + v38 = uCenterY - v79, v37 < pRenderer->field_1C_clipx) || v37 > pRenderer->field_24_clipz || v38 < pRenderer->field_20_clipy @@ -14087,22 +14071,22 @@ break; if ( (signed int)uZoom > 512 ) { - pRenderer->FillRect(v37 - 1, v38 - 1, v37 - 1, v38 + 1, flagsb); - pRenderer->FillRect(v37, v38 - 2, v37, v38 + 1, flagsb); - pRenderer->FillRect(v37 + 1, v38 - 1, v37 + 1, v38 + 1, flagsb); - pRenderer->FillRect(v37 - 2, v38, v37 - 2, v38 + 1, flagsb); + pRenderer->Line2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, flagsb); + pRenderer->Line2D(v37, v38 - 2, v37, v38 + 1, flagsb); + pRenderer->Line2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, flagsb); + pRenderer->Line2D(v37 - 2, v38, v37 - 2, v38 + 1, flagsb); v37 += 2; v58 = flagsb; v55 = v38 + 1; goto LABEL_81; } - pRenderer->FillRect(v37 - 1, v38 - 1, v37 - 1, uHeight - v79, flagsb); + pRenderer->Line2D(v37 - 1, v38 - 1, v37 - 1, uCenterY - v79, flagsb); v58 = flagsb; - v55 = uHeight - v79; + v55 = uCenterY - v79; v53 = v37; v51 = v38 - 1; LABEL_82: - pRenderer->FillRect(v37, v51, v53, v55, v58); + pRenderer->Line2D(v37, v51, v53, v55, v58); LABEL_83: ++uZe; a2c += 112; @@ -14114,10 +14098,10 @@ } } v58 = v60; - v55 = uHeight - v79; + v55 = uCenterY - v79; LABEL_81: v53 = v37; - v51 = uHeight - v79; + v51 = uCenterY - v79; goto LABEL_82; } LABEL_85: @@ -14135,10 +14119,10 @@ { v40 = ((unsigned __int64)(((signed int)*((short *)flagsc - 17) - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) - + uWidth; + + uCenterX; v76 = (unsigned __int64)(((signed int)*((short *)flagsc - 16) - pParty->vPosition.z) * (signed __int64)(signed int)uZoom) >> 16; - v41 = uHeight - v76; + v41 = uCenterY - v76; if ( v40 >= pRenderer->field_1C_clipx ) { if ( v40 <= pRenderer->field_24_clipz && v41 >= pRenderer->field_20_clipy && v41 <= pRenderer->field_28_clipw ) @@ -14150,13 +14134,13 @@ uWd = v65; if ( (signed int)uZoom > 1024 ) { - pRenderer->FillRect(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); - pRenderer->FillRect(v40, v41 - 2, v40, v41 + 2, uWd); - pRenderer->FillRect(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd); + pRenderer->Line2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); + pRenderer->Line2D(v40, v41 - 2, v40, v41 + 2, uWd); + pRenderer->Line2D(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd); v42 = v41 + 1; v43 = v41 - 1; v44 = v42; - pRenderer->FillRect(v40 - 2, v43, v40 - 2, v42, uWd); + pRenderer->Line2D(v40 - 2, v43, v40 - 2, v42, uWd); v40 += 2; v59 = uWd; v56 = v44; @@ -14165,13 +14149,13 @@ } else { - pRenderer->FillRect(v40 - 1, v41 - 1, v40 - 1, uHeight - v76, uWd); + pRenderer->Line2D(v40 - 1, v41 - 1, v40 - 1, uCenterY - v76, uWd); v59 = uWd; - v56 = uHeight - v76; + v56 = uCenterY - v76; v54 = v40; v52 = v41 - 1; } - pRenderer->FillRect(v40, v52, v54, v56, v59); + pRenderer->Line2D(v40, v52, v54, v56, v59); } } } @@ -14194,9 +14178,9 @@ if ( *(v45 - 2) & 8 ) { v46 = ((unsigned __int64)((*(int *)v45 - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) - + uWidth; + + uCenterX; v77 = (unsigned __int64)((*((int *)v45 + 1) - pParty->vPosition.z) * (signed __int64)(signed int)uZoom) >> 16; - v47 = uHeight - v77; + v47 = uCenterY - v77; if ( v46 >= pRenderer->field_1C_clipx ) { if ( v46 <= pRenderer->field_24_clipz && v47 >= pRenderer->field_20_clipy && v47 <= pRenderer->field_28_clipw ) @@ -14205,14 +14189,14 @@ { v48 = v47 + 1; v49 = v47 - 1; - pRenderer->FillRect(v46 - 1, v47 - 1, v46 - 1, v47 + 1, flagsd); - pRenderer->FillRect(v46, v49, v46, v48, flagsd); - pRenderer->FillRect(v46 + 1, v49, v46 + 1, v48, flagsd); + pRenderer->Line2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, flagsd); + pRenderer->Line2D(v46, v49, v46, v48, flagsd); + pRenderer->Line2D(v46 + 1, v49, v46 + 1, v48, flagsd); v45 = lPitchb; } else { - pRenderer->FillRect(v46, uHeight - v77, v46, uHeight - v77, flagsd); + pRenderer->Line2D(v46, uCenterY - v77, v46, uCenterY - v77, flagsd); } } } @@ -14496,7 +14480,7 @@ v87 = (unsigned __int64)((signed int)v92 * (signed __int64)v5) >> 16; v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16); v92 = (unsigned __int64)(v20 * (signed __int64)v5) >> 16; - pRenderer->FillRect( + pRenderer->Line2D( v85 + v88, v90 - v87, v85 + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), @@ -14530,7 +14514,7 @@ v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16; i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16; v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16; - pRenderer->FillRect( + pRenderer->Line2D( v85 + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16), v90 - v88, v85 + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16), @@ -14661,8 +14645,8 @@ { v96 = v55 + 1; black = v55 - 1; - pRenderer->FillRect(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86); - pRenderer->FillRect(v54, black, v54, v96, v86); + pRenderer->Line2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86); + pRenderer->Line2D(v54, black, v54, v96, v86); ++v54; v74 = v86; v72 = v96; @@ -14675,7 +14659,7 @@ v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + v85; v70 = v90 - (int)v97; } - pRenderer->FillRect(v54, v70, v71, v72, v74); + pRenderer->Line2D(v54, v70, v71, v72, v74); } } } diff -r 4211cceb3813 -r 0f4ed4f0f472 mm7_5.cpp --- a/mm7_5.cpp Tue Oct 23 23:40:55 2012 +0200 +++ b/mm7_5.cpp Wed Oct 24 17:02:44 2012 +0200 @@ -12110,14 +12110,14 @@ if ( bSolidFill ) { for ( i = v3->y; (signed int)i <= v3->w; ++i ) - pRenderer->FillRect(v3->x, i, v3->z, i, v4); - } - else - { - pRenderer->FillRect(v3->x, v3->y, v3->z, v3->y, v4); - pRenderer->FillRect(v3->z, v3->y, v3->z, v3->w, v4); - pRenderer->FillRect(v3->z, v3->w, v3->x, v3->w, v4); - pRenderer->FillRect(v3->x, v3->w, v3->x, v3->y, v4); + pRenderer->Line2D(v3->x, i, v3->z, i, v4); + } + else + { + pRenderer->Line2D(v3->x, v3->y, v3->z, v3->y, v4); + pRenderer->Line2D(v3->z, v3->y, v3->z, v3->w, v4); + pRenderer->Line2D(v3->z, v3->w, v3->x, v3->w, v4); + pRenderer->Line2D(v3->x, v3->w, v3->x, v3->y, v4); } pRenderer->EndScene(); } diff -r 4211cceb3813 -r 0f4ed4f0f472 mm7_data.h --- a/mm7_data.h Tue Oct 23 23:40:55 2012 +0200 +++ b/mm7_data.h Wed Oct 24 17:02:44 2012 +0200 @@ -2787,7 +2787,7 @@ void Load_isn_spells_21_27(); void GameUI_DrawPartySpells(); __int16 __fastcall sub_441A4E(int a1); -void __fastcall GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int flags); +void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int flags); int __fastcall DrawSpellbook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074); // idb int __cdecl Initialize2DA(); unsigned int __fastcall LoadEventsToBuffer(const char *pContainerName, char *a2, unsigned int uBufferSize); diff -r 4211cceb3813 -r 0f4ed4f0f472 stru9.cpp --- a/stru9.cpp Tue Oct 23 23:40:55 2012 +0200 +++ b/stru9.cpp Wed Oct 24 17:02:44 2012 +0200 @@ -155,10 +155,10 @@ { RenderVertexSoft *v9; // ecx@1 Vec3_float_ *v10; // esi@1 - char *v11; // ebx@1 + //char *v11; // ebx@1 RenderVertexSoft *v12; // edi@1 double v13; // st7@1 - bool result; // eax@4 + //bool result; // eax@4 signed int v15; // edx@9 RenderVertexSoft *v16; // ecx@9 double v17; // st7@9 @@ -169,60 +169,57 @@ v9 = a1; v10 = a5; - v11 = (char *)&a1->vWorldPosition.z; + //v11 = (char *)&a1->vWorldPosition.z; + auto v11 = a1; v12 = a3; v13 = a1->vWorldPosition.y * a5->y + a5->x * a1->vWorldPosition.x + a1->vWorldPosition.z * a5->z; v20 = v13; v21 = v13 >= a6; - result = 0; + *pOutNumVertices = 0; if ( a2 <= 0 ) - goto LABEL_19; + return false; + v19 = 1; while ( 1 ) { - v19 = result + 1; if ( v21 ) { ++a3; - memcpy(v12, v11 - 8, 0x30u); + memcpy(v12, v11, sizeof(RenderVertexSoft)); ++*pOutNumVertices; v10 = a5; v12 = a3; v9 = a1; } v15 = 0; - v16 = &v9[(result + 1) % a2]; + v16 = &v9[v19 % a2]; v17 = v16->vWorldPosition.z * v10->z + v16->vWorldPosition.y * v10->y + v10->x * v16->vWorldPosition.x; if ( v17 >= a6 ) v15 = 1; if ( v21 != v15 ) { v18 = (a6 - v20) / (v17 - v20); - v12->vWorldPosition.x = (v16->vWorldPosition.x - *((float *)v11 - 2)) * v18 + *((float *)v11 - 2); + v12->vWorldPosition.x = (v16->vWorldPosition.x - v11->vWorldPosition.x) * v18 + v11->vWorldPosition.x; + v12->vWorldPosition.y = (v16->vWorldPosition.y - v11->vWorldPosition.y) * v18 + v11->vWorldPosition.y; + v12->vWorldPosition.z = (v16->vWorldPosition.z - v11->vWorldPosition.z) * v18 + v11->vWorldPosition.z; + v12->u = (v16->u - v11->u) * v18 + v11->u; + v12->v = (v16->v - v11->v) * v18 + v11->v; ++v12; a3 = v12; - *((float *)v12 - 11) = (v16->vWorldPosition.y - *((float *)v11 - 1)) * v18 + *((float *)v11 - 1); - *((float *)v12 - 10) = (v16->vWorldPosition.z - *(float *)v11) * v18 + *(float *)v11; - *((float *)v12 - 3) = (v16->u - *((float *)v11 + 7)) * v18 + *((float *)v11 + 7); - *((float *)v12 - 2) = (v16->v - *((float *)v11 + 8)) * v18 + *((float *)v11 + 8); ++*pOutNumVertices; *a7 = 1; } - ++result; - v11 += 48; + + v11++; v21 = v15; v20 = v17; if ( v19 >= a2 ) break; v9 = a1; + v19++; } - result = (bool)pOutNumVertices; - if ( (signed int)*pOutNumVertices >= 3 ) - LOBYTE(result) = 1; - else -LABEL_19: - LOBYTE(result) = 0; - return result; + + return *pOutNumVertices >= 3; } //----- (00498737) --------------------------------------------------------