comparison Outdoor.cpp @ 61:6c2cefdaea3e

Слияние
author Ritor1
date Tue, 22 Jan 2013 18:41:17 +0600
parents b9d70af644f3 63cfe63ac4c5
children 80484cf3a683
comparison
equal deleted inserted replaced
60:b9d70af644f3 61:6c2cefdaea3e
233 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); 233 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int);
234 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); 234 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int);
235 235
236 //----- (00488F2E) -------------------------------------------------------- 236 //----- (00488F2E) --------------------------------------------------------
237 int OutdoorLocation::GetHeightOnTerrain(int sX, int sZ) 237 int OutdoorLocation::GetHeightOnTerrain(int sX, int sZ)
238 /* , .
239 ( Y) , .
240 X Z .
241 Terrain::getHeight; X Z ,
242 , .*/
238 { 243 {
239 int result; // eax@5 244 int result; // eax@5
240 245
241 if ( sX < 0 || sX > 127 || sZ < 0 || sZ > 127 ) 246 if ( sX < 0 || sX > 127 || sZ < 0 || sZ > 127 )
242 result = 0; 247 result = 0;
705 this->field_1C = 0; 710 this->field_1C = 0;
706 this->field_18 = 0; 711 this->field_18 = 0;
707 } 712 }
708 713
709 //----- (0047C7C2) -------------------------------------------------------- 714 //----- (0047C7C2) --------------------------------------------------------
710 void OutdoorLocationTerrain::Release() 715 void OutdoorLocationTerrain::Release()//
711 { 716 {
712 if (pHeightmap) 717 if (pHeightmap)
713 { 718 {
714 pAllocator->FreeChunk(this->pHeightmap); 719 pAllocator->FreeChunk(this->pHeightmap);
715 pHeightmap = nullptr; 720 pHeightmap = nullptr;
734 } 739 }
735 740
736 //----- (0047C80A) -------------------------------------------------------- 741 //----- (0047C80A) --------------------------------------------------------
737 int OutdoorLocationTerrain::_47C80A(int a2, int a3, int a4, int a5) 742 int OutdoorLocationTerrain::_47C80A(int a2, int a3, int a4, int a5)
738 { 743 {
739 OutdoorLocationTerrain *v5; // ebx@1 744 OutdoorLocationTerrain *pOutLocTerrain; // ebx@1
740 double v6; // st7@1 745 double v6; // st7@1
741 double v7; // st7@2 746 double v7; // st7@2
742 double v8; // st7@2 747 double v8; // st7@2
743 int result; // eax@3 748 int result; // eax@3
744 int v10; // eax@4 749 int v10; // eax@4
745 int v11; // ecx@5 750 int v11; // ecx@5
746 int v12; // ecx@6 751 int v12; // ecx@6
747 int v13; // edi@7 752 int v13; // edi@7
748 int v14; // edx@9 753 int v14; // edx@9
749 int v15; // eax@15 754 int v15; // eax@15
750 unsigned __int8 *v16; // ebx@15 755 unsigned __int8 *pMapHeight; // ebx@15
751 int v17; // eax@15 756 int v17; // eax@15
752 int v18; // ecx@15 757 int v18; // ecx@15
753 int v19; // esi@15 758 int v19; // esi@15
754 int v20; // edi@15 759 int v20; // edi@15
755 int v21; // edx@15 760 int v21; // edx@15
772 double v38; // st7@23 777 double v38; // st7@23
773 int v39; // [sp+14h] [bp-34h]@8 778 int v39; // [sp+14h] [bp-34h]@8
774 int v40; // [sp+18h] [bp-30h]@15 779 int v40; // [sp+18h] [bp-30h]@15
775 int v41; // [sp+1Ch] [bp-2Ch]@15 780 int v41; // [sp+1Ch] [bp-2Ch]@15
776 int v42; // [sp+20h] [bp-28h]@15 781 int v42; // [sp+20h] [bp-28h]@15
777 OutdoorLocationTerrain *v43; // [sp+24h] [bp-24h]@1 782 OutdoorLocationTerrain *pOutLocTerrain2; // [sp+24h] [bp-24h]@1
778 int v44; // [sp+28h] [bp-20h]@21 783 int v44; // [sp+28h] [bp-20h]@21
779 float v45; // [sp+2Ch] [bp-1Ch]@1 784 float v45; // [sp+2Ch] [bp-1Ch]@1
780 float v46; // [sp+30h] [bp-18h]@1 785 float v46; // [sp+30h] [bp-18h]@1
781 float v47; // [sp+34h] [bp-14h]@1 786 float v47; // [sp+34h] [bp-14h]@1
782 int v48; // [sp+38h] [bp-10h]@7 787 int v48; // [sp+38h] [bp-10h]@7
790 float v56; // [sp+54h] [bp+Ch]@15 795 float v56; // [sp+54h] [bp+Ch]@15
791 float v57; // [sp+54h] [bp+Ch]@21 796 float v57; // [sp+54h] [bp+Ch]@21
792 797
793 v46 = -64.0; 798 v46 = -64.0;
794 v47 = -64.0; 799 v47 = -64.0;
795 v5 = this; 800 pOutLocTerrain = this;
796 v45 = 64.0; 801 v45 = 64.0;
797 v43 = this; 802 pOutLocTerrain2 = this;
798 v6 = sqrt(12288.0); 803 v6 = sqrt(12288.0);
799 if ( v6 != 0.0 ) 804 if ( v6 != 0.0 )
800 { 805 {
801 v7 = 1.0 / v6; 806 v7 = 1.0 / v6;
802 v45 = 64.0 * v7; 807 v45 = 64.0 * v7;
833 v49 = (v39 - 63) << 9; 838 v49 = (v39 - 63) << 9;
834 do 839 do
835 { 840 {
836 if ( v13 >= 0 && result >= -32256 && v13 <= 127 && result <= 32768 ) 841 if ( v13 >= 0 && result >= -32256 && v13 <= 127 && result <= 32768 )
837 { 842 {
838 v15 = v5->field_10; 843 v15 = pOutLocTerrain->field_10;
839 v55 = v15; 844 v55 = v15;
840 v16 = v5->pHeightmap; 845 pMapHeight = pOutLocTerrain->pHeightmap;
841 v17 = (int)(&v16[v13 * v15] + v14); 846 v17 = (int)(&pMapHeight[v13 * v15] + v14);
842 v18 = -v13; 847 v18 = -v13;
843 v19 = (64 - v13) << 9; 848 v19 = (64 - v13) << 9;
844 v20 = 32 * *(char *)v17; 849 v20 = 32 * *(char *)v17;
845 v21 = 32 * *(char *)(v17 + 1); 850 v21 = 32 * *(char *)(v17 + 1);
846 v22 = (v18 + 63) << 9; 851 v22 = (v18 + 63) << 9;
847 v41 = v22; 852 v41 = v22;
848 v23 = (int)(&v16[v55 * (v48 + 1)] + v50); 853 v23 = (int)(&pMapHeight[v55 * (v48 + 1)] + v50);
849 v24 = v22 - v19; 854 v24 = v22 - v19;
850 v40 = 32 * *(char *)v23; 855 v40 = 32 * *(char *)v23;
851 v42 = 32 * *(char *)(v23 + 1); 856 v42 = 32 * *(char *)(v23 + 1);
852 v25 = v49 - 512 - v49; 857 v25 = v49 - 512 - v49;
853 v26 = (double)-((v20 - v21) * v24); 858 v26 = (double)-((v20 - v21) * v24);
867 v31 = (v56 * v47 + v53 * v46 + v51 * v45) * 31.0; 872 v31 = (v56 * v47 + v53 * v46 + v51 * v45) * 31.0;
868 if ( v31 < 0.0 ) 873 if ( v31 < 0.0 )
869 v31 = 0.0; 874 v31 = 0.0;
870 if ( v31 > 31.0 ) 875 if ( v31 > 31.0 )
871 v31 = 31.0; 876 v31 = 31.0;
872 v44 = 2 * (v50 + v48 * v43->field_10); 877 v44 = 2 * (v50 + v48 * pOutLocTerrain2->field_10);
873 v5 = v43; 878 pOutLocTerrain = pOutLocTerrain2;
874 *((char *)v43->ptr_C + v44 + 1) = (signed __int64)v31; 879 *((char *)pOutLocTerrain2->ptr_C + v44 + 1) = (signed __int64)v31;
875 v32 = v49 - (v49 - 512); 880 v32 = v49 - (v49 - 512);
876 v33 = (double)-((v42 - v40) * (v19 - v41)); 881 v33 = (double)-((v42 - v40) * (v19 - v41));
877 v52 = v33; 882 v52 = v33;
878 v34 = (double)-(v32 * (v20 - v40)); 883 v34 = (double)-(v32 * (v20 - v40));
879 v54 = v34; 884 v54 = v34;
891 if ( v38 < 0.0 ) 896 if ( v38 < 0.0 )
892 v38 = 0.0; 897 v38 = 0.0;
893 if ( v38 > 31.0 ) 898 if ( v38 > 31.0 )
894 v38 = 31.0; 899 v38 = 31.0;
895 v13 = v48; 900 v13 = v48;
896 *((char *)v43->ptr_C + v44) = (signed __int64)v38; 901 *((char *)pOutLocTerrain2->ptr_C + v44) = (signed __int64)v38;
897 v14 = v50; 902 v14 = v50;
898 result = v49; 903 result = v49;
899 } 904 }
900 ++v14; 905 ++v14;
901 result += 512; 906 result += 512;
1036 void *v4; // eax@3 1041 void *v4; // eax@3
1037 void *v5; // eax@4 1042 void *v5; // eax@4
1038 void *v6; // eax@5 1043 void *v6; // eax@5
1039 1044
1040 v1 = this; 1045 v1 = this;
1041 v2 = pAllocator->AllocNamedChunk(this->pHeightmap, 0x4000u, "HMAP"); 1046 v2 = pAllocator->AllocNamedChunk(this->pHeightmap, 0x4000u, "HMAP");//
1042 v1->pHeightmap = (unsigned __int8 *)v2; 1047 v1->pHeightmap = (unsigned __int8 *)v2;
1043 if ( v2 1048 if ( v2
1044 && (v4 = pAllocator->AllocNamedChunk(v1->pTilemap, 0x4000u, "TMAP"), 1049 && (v4 = pAllocator->AllocNamedChunk(v1->pTilemap, 0x4000u, "TMAP"),//
1045 (v1->pTilemap = (unsigned __int8 *)v4) != 0) 1050 (v1->pTilemap = (unsigned __int8 *)v4) != 0)
1046 && (v5 = pAllocator->AllocNamedChunk(v1->pAttributemap, 0x4000u, "AMAP"), 1051 && (v5 = pAllocator->AllocNamedChunk(v1->pAttributemap, 0x4000u, "AMAP"),//
1047 (v1->pAttributemap = (unsigned __int8 *)v5) != 0) ) 1052 (v1->pAttributemap = (unsigned __int8 *)v5) != 0) )
1048 { 1053 {
1049 v6 = pAllocator->AllocNamedChunk(v1->ptr_C, 0x8000u, "DMAP"); 1054 v6 = pAllocator->AllocNamedChunk(v1->ptr_C, 0x8000u, "DMAP");
1050 v1->ptr_C = v6; 1055 v1->ptr_C = v6;
1051 result = v6 != 0; 1056 result = v6 != 0;
1175 pTerrainNormals = nullptr; 1180 pTerrainNormals = nullptr;
1176 } 1181 }
1177 } 1182 }
1178 1183
1179 //----- (0047D0A6) -------------------------------------------------------- 1184 //----- (0047D0A6) --------------------------------------------------------
1180 bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t pNumItems, int thisa) 1185 bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t pNumItems, int thisa)//
1181 { 1186 {
1182 //OutdoorLocation *pOutdoorLocation; // esi@1 1187 //OutdoorLocation *pOutdoorLocation; // esi@1
1183 /*bool result; // eax@9 1188 /*bool result; // eax@9
1184 bool v7; // ebx@9 1189 bool v7; // ebx@9
1185 size_t v8; // eax@10 1190 size_t v8; // eax@10
2445 //----- (0047EE16) -------------------------------------------------------- 2450 //----- (0047EE16) --------------------------------------------------------
2446 int OutdoorLocation::DoGetHeightOnTerrain(unsigned int uX, unsigned int uZ) 2451 int OutdoorLocation::DoGetHeightOnTerrain(unsigned int uX, unsigned int uZ)
2447 { 2452 {
2448 int result; // eax@5 2453 int result; // eax@5
2449 2454
2450 if ( (uX & 0x80000000u) != 0 || (signed int)uX > 127 || (uZ & 0x80000000u) != 0 || (signed int)uZ > 127 ) 2455 if ( (signed int)uX < 0 || (signed int)uX > 127 || (signed int)uZ < 0 || (signed int)uZ > 127 )
2451 result = 0; 2456 result = 0;
2452 else 2457 else
2453 result = 32 * *(&this->pTerrain.pHeightmap[128 * uZ] + uX); 2458 result = 32 * *(&this->pTerrain.pHeightmap[128 * uZ] + uX);
2454 return result; 2459 return result;
2455 } 2460 }