comparison mm7_3.cpp @ 119:be3c07c98861

Outdoor minimap fixed (didn't test wizard eye thou)
author Nomad
date Sun, 10 Feb 2013 23:14:42 +0200
parents 909822c91d47
children fe0e317c0de0
comparison
equal deleted inserted replaced
118:acff5a5d563b 119:be3c07c98861
1 #include <assert.h>
2
1 #include "MapInfo.h" 3 #include "MapInfo.h"
2 #include "Game.h" 4 #include "Game.h"
3 #include "GUIWindow.h" 5 #include "GUIWindow.h"
4 #include "GUIFont.h" 6 #include "GUIFont.h"
5 #include "GUIButton.h" 7 #include "GUIButton.h"
13557 double v18; // st7@30 13559 double v18; // st7@30
13558 float v19; // ST38_4@30 13560 float v19; // ST38_4@30
13559 double v20; // st7@30 13561 double v20; // st7@30
13560 double v21; // st6@30 13562 double v21; // st6@30
13561 double v22; // st5@33 13563 double v22; // st5@33
13562 unsigned __int16 *v26; // edx@37 13564 //unsigned __int16 *v26; // edx@37
13563 signed int v27; // eax@37 13565 signed int v27; // eax@37
13564 unsigned __int16 *v28; // ecx@37 13566 unsigned __int16 *v28; // ecx@37
13565 signed int v29; // edi@40 13567 signed int v29; // edi@40
13566 int v30; // eax@42 13568 //int v30; // eax@42
13567 unsigned __int16 *v31; // ebx@43 13569 //unsigned __int16 *v31; // ebx@43
13568 signed int v32; // edi@46 13570 //signed int v32; // edi@46
13569 signed int v33; // ebx@50 13571 signed int v33; // ebx@50
13570 unsigned int v34; // eax@50 13572 unsigned int v34; // eax@50
13571 signed int v35; // ecx@50 13573 signed int v35; // ecx@50
13572 unsigned __int16 v36; // di@66 13574 unsigned __int16 v36; // di@66
13573 int v37; // edi@72 13575 int v37; // edi@72
13581 char *v45; // ebx@106 13583 char *v45; // ebx@106
13582 int v46; // edi@108 13584 int v46; // edi@108
13583 int v47; // eax@108 13585 int v47; // eax@108
13584 unsigned int v48; // ebx@114 13586 unsigned int v48; // ebx@114
13585 unsigned int v49; // ST64_4@114 13587 unsigned int v49; // ST64_4@114
13586 double v50; // ST20_8@117 13588 //double v50; // ST20_8@117
13587 unsigned int v51; // [sp-10h] [bp-64h]@79 13589 unsigned int v51; // [sp-10h] [bp-64h]@79
13588 unsigned int v52; // [sp-10h] [bp-64h]@100 13590 unsigned int v52; // [sp-10h] [bp-64h]@100
13589 unsigned int v53; // [sp-Ch] [bp-60h]@79 13591 unsigned int v53; // [sp-Ch] [bp-60h]@79
13590 unsigned int v54; // [sp-Ch] [bp-60h]@100 13592 unsigned int v54; // [sp-Ch] [bp-60h]@100
13591 unsigned int v55; // [sp-8h] [bp-5Ch]@77 13593 unsigned int v55; // [sp-8h] [bp-5Ch]@77
13593 signed int v57; // [sp-4h] [bp-58h]@54 13595 signed int v57; // [sp-4h] [bp-58h]@54
13594 unsigned __int16 v58; // [sp-4h] [bp-58h]@77 13596 unsigned __int16 v58; // [sp-4h] [bp-58h]@77
13595 unsigned __int16 v59; // [sp-4h] [bp-58h]@100 13597 unsigned __int16 v59; // [sp-4h] [bp-58h]@100
13596 unsigned __int16 v60; // [sp+10h] [bp-44h]@66 13598 unsigned __int16 v60; // [sp+10h] [bp-44h]@66
13597 unsigned int v61; // [sp+10h] [bp-44h]@85 13599 unsigned int v61; // [sp+10h] [bp-44h]@85
13598 unsigned __int16 *v62; // [sp+14h] [bp-40h]@30 13600 //unsigned __int16 *v62; // [sp+14h] [bp-40h]@30
13599 unsigned int v63; // [sp+14h] [bp-40h]@85 13601 unsigned int v63; // [sp+14h] [bp-40h]@85
13600 int v64; // [sp+18h] [bp-3Ch]@39 13602 //int v64; // [sp+18h] [bp-3Ch]@39
13601 unsigned int v65; // [sp+18h] [bp-3Ch]@85 13603 unsigned int v65; // [sp+18h] [bp-3Ch]@85
13602 unsigned int lPitch; // [sp+20h] [bp-34h]@1 13604 unsigned int lPitch; // [sp+20h] [bp-34h]@1
13603 unsigned int lPitcha; // [sp+20h] [bp-34h]@23 13605 unsigned int lPitcha; // [sp+20h] [bp-34h]@23
13604 char *lPitchb; // [sp+20h] [bp-34h]@106 13606 char *lPitchb; // [sp+20h] [bp-34h]@106
13605 unsigned int v69; // [sp+24h] [bp-30h]@23 13607 unsigned int v69; // [sp+24h] [bp-30h]@23
13606 signed int v70; // [sp+24h] [bp-30h]@37 13608 signed int v70; // [sp+24h] [bp-30h]@37
13607 unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1 13609 unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1
13608 signed int uBluea; // [sp+28h] [bp-2Ch]@37 13610 signed int uBluea; // [sp+28h] [bp-2Ch]@37
13609 int v73; // [sp+2Ch] [bp-28h]@30 13611 int v73; // [sp+2Ch] [bp-28h]@30
13610 unsigned __int8 *v74; // [sp+30h] [bp-24h]@30 13612 //unsigned __int8 *v74; // [sp+30h] [bp-24h]@30
13611 int v76; // [sp+34h] [bp-20h]@91 13613 int v76; // [sp+34h] [bp-20h]@91
13612 int v77; // [sp+34h] [bp-20h]@108 13614 int v77; // [sp+34h] [bp-20h]@108
13613 signed int v78; // [sp+38h] [bp-1Ch]@37 13615 //signed int v78; // [sp+38h] [bp-1Ch]@37
13614 int v79; // [sp+38h] [bp-1Ch]@72 13616 int v79; // [sp+38h] [bp-1Ch]@72
13615 signed int a2b; // [sp+40h] [bp-14h]@41 13617 //signed int a2b; // [sp+40h] [bp-14h]@41
13616 char *a2c; // [sp+40h] [bp-14h]@68 13618 char *a2c; // [sp+40h] [bp-14h]@68
13617 int a3a; // [sp+44h] [bp-10h]@40 13619 //int a3a; // [sp+44h] [bp-10h]@40
13618 signed int uCenterY; // [sp+48h] [bp-Ch]@1 13620 signed int uCenterY; // [sp+48h] [bp-Ch]@1
13619 signed int uCenterX; // [sp+4Ch] [bp-8h]@1 13621 signed int uCenterX; // [sp+4Ch] [bp-8h]@1
13620 //signed int uZb; // [sp+5Ch] [bp+8h]@27 13622 //signed int uZb; // [sp+5Ch] [bp+8h]@27
13621 signed int uWidth; // [sp+5Ch] [bp+8h]@30 13623 signed int uWidth; // [sp+5Ch] [bp+8h]@30
13622 signed int uZd; // [sp+5Ch] [bp+8h]@45 13624 //signed int uZd; // [sp+5Ch] [bp+8h]@45
13623 signed int uZe; // [sp+5Ch] [bp+8h]@67 13625 signed int uZe; // [sp+5Ch] [bp+8h]@67
13624 signed int uZf; // [sp+5Ch] [bp+8h]@85 13626 signed int uZf; // [sp+5Ch] [bp+8h]@85
13625 signed int uZg; // [sp+5Ch] [bp+8h]@105 13627 signed int uZg; // [sp+5Ch] [bp+8h]@105
13626 unsigned int uWa; // [sp+60h] [bp+Ch]@23 13628 unsigned int uWa; // [sp+60h] [bp+Ch]@23
13627 float uWb; // [sp+60h] [bp+Ch]@30 13629 float uWb; // [sp+60h] [bp+Ch]@30
13628 unsigned __int16 *uWc; // [sp+60h] [bp+Ch]@37 13630 //unsigned __int16 *uWc; // [sp+60h] [bp+Ch]@37
13629 unsigned int uWd; // [sp+60h] [bp+Ch]@95 13631 unsigned int uWd; // [sp+60h] [bp+Ch]@95
13630 float uZooma; // [sp+64h] [bp+10h]@117 13632 float uZooma; // [sp+64h] [bp+10h]@117
13631 signed int flagsa; // [sp+68h] [bp+14h]@42 13633 //signed int flagsa; // [sp+68h] [bp+14h]@42
13632 unsigned int flagsb; // [sp+68h] [bp+14h]@66 13634 unsigned int flagsb; // [sp+68h] [bp+14h]@66
13633 Actor *flagsc; // [sp+68h] [bp+14h]@86 13635 Actor *flagsc; // [sp+68h] [bp+14h]@86
13634 unsigned int flagsd; // [sp+68h] [bp+14h]@105 13636 unsigned int flagsd; // [sp+68h] [bp+14h]@105
13635 13637
13636 //a3 = uY; 13638 //a3 = uY;
13652 uWidth = uZ - uX; 13654 uWidth = uZ - uX;
13653 13655
13654 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) 13656 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
13655 { 13657 {
13656 v17 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; 13658 v17 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2;
13657 v74 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; 13659 auto pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0;
13658 v62 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; 13660 auto pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
13659 v73 = (1 << (v17 + 16)) / (signed int)uZoom; 13661 v73 = (1 << (v17 + 16)) / (signed int)uZoom;
13660 v18 = (double)(1 << (16 - v17)); 13662 v18 = (double)(1 << (16 - v17));
13661 v19 = v18; 13663 v19 = v18;
13662 v20 = (double)(pParty->vPosition.x + 32768) / v18; 13664 v20 = (double)(pParty->vPosition.x + 32768) / v18;
13663 v21 = (double)(32768 - pParty->vPosition.y) / v19; 13665 v21 = (double)(32768 - pParty->vPosition.y) / v19;
13664 uWb = v21; 13666 uWb = v21;
13665 if ( uZoom == 512 ) 13667 switch (uZoom)
13666 { 13668 {
13667 v20 = v20 - (double)(uWidth / 2); 13669 case 512:
13668 v22 = (double)(uHeight / 2); 13670 {
13669 } 13671 v20 = v20 - (double)(uWidth / 2);
13670 else 13672 v22 = (double)(uHeight / 2);
13671 { 13673 uWb = v21 - v22;
13672 if ( uZoom == 1024 ) 13674 }
13675 break;
13676
13677 case 1024:
13673 { 13678 {
13674 v20 = v20 - (double)(uWidth / 4); 13679 v20 = v20 - (double)(uWidth / 4);
13675 v22 = (double)(uHeight / 4); 13680 v22 = (double)(uHeight / 4);
13676 } 13681 uWb = v21 - v22;
13677 else 13682 }
13678 { 13683 break;
13679 if ( uZoom != 2048 ) 13684
13680 goto LABEL_37; 13685 case 2048:
13686 {
13681 v20 = v20 - (double)(uWidth / 8); 13687 v20 = v20 - (double)(uWidth / 8);
13682 v22 = (double)(uHeight / 8); 13688 v22 = (double)(uHeight / 8);
13683 } 13689 uWb = v21 - v22;
13684 } 13690 }
13685 uWb = v21 - v22; 13691 break;
13686 LABEL_37: 13692
13693 default: assert(false);
13694 }
13695 //LABEL_37:
13687 //v23 = v20 * 65536.0; 13696 //v23 = v20 * 65536.0;
13688 //v24 = v23 + 6.7553994e15; 13697 //v24 = v23 + 6.7553994e15;
13689 v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24); 13698 v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24);
13690 //uWe = uWb * 65536.0; 13699 //uWe = uWb * 65536.0;
13691 //v25 = uWe + 6.7553994e15; 13700 //v25 = uWe + 6.7553994e15;
13692 v78 = v70; 13701 //v78 = v70;
13693 uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25); 13702 uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25);
13694 v26 = (unsigned __int16 *)_56EFD8_minimap;
13695 v27 = uBluea >> 16; 13703 v27 = uBluea >> 16;
13696 uWc = (unsigned __int16 *)_56EFD8_minimap;
13697 v28 = &pRenderer->pTargetSurface[uX + uY * lPitch]; 13704 v28 = &pRenderer->pTargetSurface[uX + uY * lPitch];
13698 if ( flags ) 13705 if ( flags && pMapLod0)
13699 { 13706 {
13700 if ( v74 ) 13707 auto pMinimap = (unsigned __int16 *)_56EFD8_minimap;
13701 { 13708 //if ( v74 )
13702 v64 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; 13709 //{
13703 if ( uHeight > 0 ) 13710 auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
13704 { 13711 //if ( uHeight > 0 )
13705 a3a = uHeight; 13712 //{
13713 //a3a = uHeight;
13706 v29 = v70 >> 16; 13714 v29 = v70 >> 16;
13707 do 13715 //do
13716 for (int y = 0; y < uHeight; ++y)
13708 { 13717 {
13709 a2b = 0; 13718 //a2b = 0;
13710 if ( uWidth > 0 ) 13719 //if ( uWidth > 0 )
13711 { 13720 //{
13712 v30 = (int)&v74[v27 * v64]; 13721 auto pMapLod0Line = &pMapLod0[v27 * mapWidth];
13713 flagsa = uWidth; 13722 //flagsa = uWidth;
13714 a2b = uWidth; 13723 //a2b = uWidth;
13715 do 13724 for (int x = 0; x < uWidth; ++x)
13725 //do
13716 { 13726 {
13717 v31 = uWc; 13727 //v31 = uWc;
13718 ++uWc; 13728 //++uWc;
13719 *v31 = v62[*(char *)(v30 + v29)]; 13729 *pMinimap++ = pPal[pMapLod0Line[v29]];
13720 v78 += v73; 13730 //v78 += v73;
13721 v29 = v78 >> 16; 13731 v29 = (v70 + x * v73) >> 16;
13722 --flagsa; 13732 //--flagsa;
13723 } 13733 }
13724 while ( flagsa ); 13734 //while ( flagsa );
13725 } 13735 //}
13726 v78 = v70; 13736 //v78 = v70;
13727 v29 = v70 >> 16; 13737 v29 = v70 >> 16;
13728 v28 += 137 - a2b; 13738 v28 += 137 - uWidth;
13729 uBluea += v73; 13739 uBluea += v73;
13730 v27 = uBluea >> 16; 13740 v27 = uBluea >> 16;
13731 --a3a; 13741 //--a3a;
13732 } 13742 }
13733 while ( a3a ); 13743 //while ( a3a );
13734 } 13744 //}
13735 } 13745 //}
13736 } 13746 }
13737 uZd = 117; 13747
13738 do 13748 auto pMinimap = (unsigned __int16 *)_56EFD8_minimap;
13739 { 13749 //uZd = 117;
13740 v32 = 137; 13750 //do
13741 do 13751 for (int y = 0; y < 117; ++y)
13742 { 13752 {
13743 *v28 = *v26; 13753 //v32 = 137;
13744 ++v28; 13754 //do
13745 ++v26; 13755 for (int x = 0; x < 137; ++x)
13746 --v32; 13756 {
13747 } 13757 *v28++ = *pMinimap++;
13748 while ( v32 ); 13758 //++v28;
13759 //++v26;
13760 //--v32;
13761 }
13762 //while ( v32 );
13749 v28 += lPitch - 137; 13763 v28 += lPitch - 137;
13750 --uZd; 13764 //--uZd;
13751 } 13765 }
13752 while ( uZd ); 13766 //while ( uZd );
13753 uNumBlueFacesInBLVMinimap = 0; 13767 uNumBlueFacesInBLVMinimap = 0;
13754 } 13768 }
13755 else 13769 else
13756 { 13770 {
13757 pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); 13771 pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF);
13881 v57 = 2; 13895 v57 = 2;
13882 } 13896 }
13883 v35 = v57; 13897 v35 = v57;
13884 LABEL_66: 13898 LABEL_66:
13885 pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, 13899 pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3,
13886 (Texture *)(pTextureIDs_pMapDirs[v35] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v35]] : 0)); 13900 (Texture *)(pTextureIDs_pMapDirs[v35] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v35]] : 0));
13887 v36 = 255; 13901 v36 = 255;
13888 flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu); 13902 flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu);
13889 v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); 13903 v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0);
13890 if ( bWizardEyeActive ) 13904 if ( bWizardEyeActive )
13891 { 13905 {
14049 while ( uZg < (signed int)uNumLevelDecorations ); 14063 while ( uZg < (signed int)uNumLevelDecorations );
14050 v33 = 0; 14064 v33 = 0;
14051 } 14065 }
14052 pRenderer->DrawTextureTransparent(0x1D4u, v33, (Texture *)(dword_5079D8 != -1 ? &pIcons_LOD->pTextures[dword_5079D8] : 0)); 14066 pRenderer->DrawTextureTransparent(0x1D4u, v33, (Texture *)(dword_5079D8 != -1 ? &pIcons_LOD->pTextures[dword_5079D8] : 0));
14053 uZooma = (double)pParty->sRotationY * 0.1171875; 14067 uZooma = (double)pParty->sRotationY * 0.1171875;
14054 v50 = uZooma + 6.7553994e15; 14068 //v50 = uZooma + 6.7553994e15;
14055 pRenderer->Clip(0x21Du, v33, 0x237u, 0x1E0u); 14069 pRenderer->Clip(0x21Du, v33, 0x237u, 0x1E0u);
14056 pRenderer->DrawTextureIndexed(LODWORD(v50) + 285, 0x88u, (Texture *)(dword_5079B4 != -1 ? &pIcons_LOD->pTextures[dword_5079B4] : 0)); 14070 pRenderer->DrawTextureIndexed(floorf(uZooma + 0.5f) + 285, 0x88u, (Texture *)(dword_5079B4 != -1 ? &pIcons_LOD->pTextures[dword_5079B4] : 0));
14057 pRenderer->ResetClip(); 14071 pRenderer->ResetClip();
14058 } 14072 }
14059 14073
14060 14074
14061 //----- (00442955) -------------------------------------------------------- 14075 //----- (00442955) --------------------------------------------------------