# HG changeset patch # User Nomad # Date 1360530882 -7200 # Node ID be3c07c988613f52e03f409265cb684b066812e1 # Parent acff5a5d563bcfad79c22b0b7e5689c676b04b8d Outdoor minimap fixed (didn't test wizard eye thou) diff -r acff5a5d563b -r be3c07c98861 Outdoor.cpp --- a/Outdoor.cpp Sun Feb 10 23:06:36 2013 +0600 +++ b/Outdoor.cpp Sun Feb 10 23:14:42 2013 +0200 @@ -276,7 +276,7 @@ pIcons_LOD->ReleaseAll2(); sub_46080D(); TryLoadLevelFromLOD(); - if ( !Load((char *)pFilename, (ODMFace *)File, uRespawnInterval, thisa) ) + if ( !Load(pFilename, (ODMFace *)File, uRespawnInterval, thisa) ) { MessageBoxA(0, "Error!", "Couldn't Load Map!", 0); CreateDebugLocation(); @@ -1192,7 +1192,7 @@ } //----- (0047D0A6) -------------------------------------------------------- -bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t pNumItems, int thisa)//загрузка локации +bool OutdoorLocation::Load(const char *pFilename, ODMFace *File, size_t pNumItems, int thisa)//загрузка локации { //OutdoorLocation *pOutdoorLocation; // esi@1 /*bool result; // eax@9 @@ -1644,10 +1644,15 @@ if (!pGames_LOD->DoesContainerExist(pFilename)) Abortf("Unable to find %s in Games.LOD", pFilename); + + char pMinimapTextureFilename[1024]; + strcpy(pMinimapTextureFilename, pFilename); + pMinimapTextureFilename[strlen(pMinimapTextureFilename) - 4] = 0; + viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pMinimapTextureFilename, TEXTURE_16BIT_PALETTE); + //strcpy(FileName, pContainer); strcpy(Str, pFilename); strcpy(Str + strlen(Str) - 4, ".odm"); - viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(Str, TEXTURE_16BIT_PALETTE); //v141 = &v139; //v38 = strlen(pFilename); //strcpy((char *)&v139 + v38, ".odm"); diff -r acff5a5d563b -r be3c07c98861 Outdoor.h --- a/Outdoor.h Sun Feb 10 23:06:36 2013 +0600 +++ b/Outdoor.h Sun Feb 10 23:14:42 2013 +0200 @@ -143,7 +143,7 @@ unsigned int DrawActors(); void CreateDebugLocation(); void Release(); - bool Load(char *pFilename, ODMFace *File, size_t a4, int thisa); + bool Load(const char *pFilename, ODMFace *File, size_t a4, int thisa); int _47ECC1(signed int a2); unsigned int DoGetTileTexture(unsigned int uX, unsigned int uZ); int _47ED83(signed int a2, signed int a3); diff -r acff5a5d563b -r be3c07c98861 mm7_3.cpp --- a/mm7_3.cpp Sun Feb 10 23:06:36 2013 +0600 +++ b/mm7_3.cpp Sun Feb 10 23:14:42 2013 +0200 @@ -1,3 +1,5 @@ +#include + #include "MapInfo.h" #include "Game.h" #include "GUIWindow.h" @@ -13559,13 +13561,13 @@ double v20; // st7@30 double v21; // st6@30 double v22; // st5@33 - unsigned __int16 *v26; // edx@37 + //unsigned __int16 *v26; // edx@37 signed int v27; // eax@37 unsigned __int16 *v28; // ecx@37 signed int v29; // edi@40 - int v30; // eax@42 - unsigned __int16 *v31; // ebx@43 - signed int v32; // edi@46 + //int v30; // eax@42 + //unsigned __int16 *v31; // ebx@43 + //signed int v32; // edi@46 signed int v33; // ebx@50 unsigned int v34; // eax@50 signed int v35; // ecx@50 @@ -13583,7 +13585,7 @@ int v47; // eax@108 unsigned int v48; // ebx@114 unsigned int v49; // ST64_4@114 - double v50; // ST20_8@117 + //double v50; // ST20_8@117 unsigned int v51; // [sp-10h] [bp-64h]@79 unsigned int v52; // [sp-10h] [bp-64h]@100 unsigned int v53; // [sp-Ch] [bp-60h]@79 @@ -13595,9 +13597,9 @@ unsigned __int16 v59; // [sp-4h] [bp-58h]@100 unsigned __int16 v60; // [sp+10h] [bp-44h]@66 unsigned int v61; // [sp+10h] [bp-44h]@85 - unsigned __int16 *v62; // [sp+14h] [bp-40h]@30 + //unsigned __int16 *v62; // [sp+14h] [bp-40h]@30 unsigned int v63; // [sp+14h] [bp-40h]@85 - int v64; // [sp+18h] [bp-3Ch]@39 + //int v64; // [sp+18h] [bp-3Ch]@39 unsigned int v65; // [sp+18h] [bp-3Ch]@85 unsigned int lPitch; // [sp+20h] [bp-34h]@1 unsigned int lPitcha; // [sp+20h] [bp-34h]@23 @@ -13607,28 +13609,28 @@ unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1 signed int uBluea; // [sp+28h] [bp-2Ch]@37 int v73; // [sp+2Ch] [bp-28h]@30 - unsigned __int8 *v74; // [sp+30h] [bp-24h]@30 + //unsigned __int8 *v74; // [sp+30h] [bp-24h]@30 int v76; // [sp+34h] [bp-20h]@91 int v77; // [sp+34h] [bp-20h]@108 - signed int v78; // [sp+38h] [bp-1Ch]@37 + //signed int v78; // [sp+38h] [bp-1Ch]@37 int v79; // [sp+38h] [bp-1Ch]@72 - signed int a2b; // [sp+40h] [bp-14h]@41 + //signed int a2b; // [sp+40h] [bp-14h]@41 char *a2c; // [sp+40h] [bp-14h]@68 - int a3a; // [sp+44h] [bp-10h]@40 + //int a3a; // [sp+44h] [bp-10h]@40 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 uWidth; // [sp+5Ch] [bp+8h]@30 - signed int uZd; // [sp+5Ch] [bp+8h]@45 + //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 - unsigned __int16 *uWc; // [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 - signed int flagsa; // [sp+68h] [bp+14h]@42 + //signed int flagsa; // [sp+68h] [bp+14h]@42 unsigned int flagsb; // [sp+68h] [bp+14h]@66 Actor *flagsc; // [sp+68h] [bp+14h]@86 unsigned int flagsd; // [sp+68h] [bp+14h]@105 @@ -13654,102 +13656,114 @@ if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) { v17 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; - v74 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; - v62 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; + auto pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; + auto pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; v73 = (1 << (v17 + 16)) / (signed int)uZoom; v18 = (double)(1 << (16 - v17)); v19 = v18; v20 = (double)(pParty->vPosition.x + 32768) / v18; v21 = (double)(32768 - pParty->vPosition.y) / v19; uWb = v21; - if ( uZoom == 512 ) - { - v20 = v20 - (double)(uWidth / 2); - v22 = (double)(uHeight / 2); - } - else - { - if ( uZoom == 1024 ) + switch (uZoom) + { + case 512: + { + v20 = v20 - (double)(uWidth / 2); + v22 = (double)(uHeight / 2); + uWb = v21 - v22; + } + break; + + case 1024: { v20 = v20 - (double)(uWidth / 4); v22 = (double)(uHeight / 4); - } - else - { - if ( uZoom != 2048 ) - goto LABEL_37; + uWb = v21 - v22; + } + break; + + case 2048: + { v20 = v20 - (double)(uWidth / 8); v22 = (double)(uHeight / 8); - } - } - uWb = v21 - v22; -LABEL_37: + uWb = v21 - v22; + } + break; + + default: assert(false); + } +//LABEL_37: //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; + //v78 = v70; uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25); - v26 = (unsigned __int16 *)_56EFD8_minimap; v27 = uBluea >> 16; - uWc = (unsigned __int16 *)_56EFD8_minimap; v28 = &pRenderer->pTargetSurface[uX + uY * lPitch]; - if ( flags ) - { - if ( v74 ) - { - v64 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - if ( uHeight > 0 ) - { - a3a = uHeight; + if ( flags && pMapLod0) + { + auto pMinimap = (unsigned __int16 *)_56EFD8_minimap; + //if ( v74 ) + //{ + auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; + //if ( uHeight > 0 ) + //{ + //a3a = uHeight; v29 = v70 >> 16; - do - { - a2b = 0; - if ( uWidth > 0 ) - { - v30 = (int)&v74[v27 * v64]; - flagsa = uWidth; - a2b = uWidth; - do - { - v31 = uWc; - ++uWc; - *v31 = v62[*(char *)(v30 + v29)]; - v78 += v73; - v29 = v78 >> 16; - --flagsa; - } - while ( flagsa ); - } - v78 = v70; + //do + for (int y = 0; y < uHeight; ++y) + { + //a2b = 0; + //if ( uWidth > 0 ) + //{ + auto pMapLod0Line = &pMapLod0[v27 * mapWidth]; + //flagsa = uWidth; + //a2b = uWidth; + for (int x = 0; x < uWidth; ++x) + //do + { + //v31 = uWc; + //++uWc; + *pMinimap++ = pPal[pMapLod0Line[v29]]; + //v78 += v73; + v29 = (v70 + x * v73) >> 16; + //--flagsa; + } + //while ( flagsa ); + //} + //v78 = v70; v29 = v70 >> 16; - v28 += 137 - a2b; + v28 += 137 - uWidth; uBluea += v73; v27 = uBluea >> 16; - --a3a; - } - while ( a3a ); - } - } - } - uZd = 117; - do - { - v32 = 137; - do - { - *v28 = *v26; - ++v28; - ++v26; - --v32; - } - while ( v32 ); + //--a3a; + } + //while ( a3a ); + //} + //} + } + + auto pMinimap = (unsigned __int16 *)_56EFD8_minimap; + //uZd = 117; + //do + for (int y = 0; y < 117; ++y) + { + //v32 = 137; + //do + for (int x = 0; x < 137; ++x) + { + *v28++ = *pMinimap++; + //++v28; + //++v26; + //--v32; + } + //while ( v32 ); v28 += lPitch - 137; - --uZd; - } - while ( uZd ); + //--uZd; + } + //while ( uZd ); uNumBlueFacesInBLVMinimap = 0; } else @@ -13883,7 +13897,7 @@ v35 = v57; LABEL_66: pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, - (Texture *)(pTextureIDs_pMapDirs[v35] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v35]] : 0)); + (Texture *)(pTextureIDs_pMapDirs[v35] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v35]] : 0)); v36 = 255; flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu); v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); @@ -14051,9 +14065,9 @@ } pRenderer->DrawTextureTransparent(0x1D4u, v33, (Texture *)(dword_5079D8 != -1 ? &pIcons_LOD->pTextures[dword_5079D8] : 0)); uZooma = (double)pParty->sRotationY * 0.1171875; - v50 = uZooma + 6.7553994e15; + //v50 = uZooma + 6.7553994e15; pRenderer->Clip(0x21Du, v33, 0x237u, 0x1E0u); - pRenderer->DrawTextureIndexed(LODWORD(v50) + 285, 0x88u, (Texture *)(dword_5079B4 != -1 ? &pIcons_LOD->pTextures[dword_5079B4] : 0)); + pRenderer->DrawTextureIndexed(floorf(uZooma + 0.5f) + 285, 0x88u, (Texture *)(dword_5079B4 != -1 ? &pIcons_LOD->pTextures[dword_5079B4] : 0)); pRenderer->ResetClip(); }