comparison Render.cpp @ 989:bb37d33934b0

Слияние
author Ritor1
date Mon, 13 May 2013 09:39:58 +0600
parents af2472c5842e 062788391c88
children 087a9af8e0ec
comparison
equal deleted inserted replaced
988:af2472c5842e 989:bb37d33934b0
206 LOBYTE(result) = 0; 206 LOBYTE(result) = 0;
207 return result; 207 return result;
208 } 208 }
209 209
210 //----- (00487389) -------------------------------------------------------- 210 //----- (00487389) --------------------------------------------------------
211 __int16 Render::ExecOutdoorDrawSW() 211 void Render::ExecOutdoorDrawSW()
212 { 212 {
213 unsigned __int16 *v0; // ebx@1 213 unsigned __int16 *v0; // ebx@1
214 unsigned int v1; // esi@1 214 unsigned int v1; // esi@1
215 stru148 *v2; // eax@1 215 stru148 *v2; // eax@1
216 Span *v3; // edi@6 216 Span *v3; // edi@6
225 unsigned int v12; // ebp@32 225 unsigned int v12; // ebp@32
226 Span *v13; // esi@33 226 Span *v13; // esi@33
227 int v14; // ecx@37 227 int v14; // ecx@37
228 int v15; // eax@40 228 int v15; // eax@40
229 Texture *v16; // ebp@51 229 Texture *v16; // ebp@51
230 unsigned int v17; // eax@51 230 //unsigned int v17; // eax@51
231 int v18; // eax@54 231 int v18; // eax@54
232 char v19; // al@56 232 char v19; // al@56
233 unsigned int v20; // eax@57 233 unsigned int v20; // eax@57
234 int v21; // ecx@57 234 int v21; // ecx@57
235 unsigned int v22; // eax@57 235 unsigned int v22; // eax@57
313 else 313 else
314 { 314 {
315 while ( 1 ) 315 while ( 1 )
316 { 316 {
317 v16 = v4->pTexture; 317 v16 = v4->pTexture;
318 v17 = pBitmaps_LOD->LoadTexture("wtrtyl"); 318 v4->pTexture = pBitmaps_LOD->LoadTexturePtr("wtrtyl");
319 v4->pTexture = (Texture *)(v17 != -1 ? (int)&pBitmaps_LOD->pTextures[v17] : 0);
320 if ( pOutdoorCamera->outdoor_no_wavy_water ) 319 if ( pOutdoorCamera->outdoor_no_wavy_water )
321 sr_sub_48408A_prolly_odm_water_no_waves(v3); 320 sr_sub_48408A_prolly_odm_water_no_waves(v3);
322 else 321 else
323 sr_sub_485407_prolly_odm_water_wavy(v3); 322 sr_sub_485407_prolly_odm_water_wavy(v3);
324 v18 = v4->terrain_grid_z - 64; 323 v18 = v4->terrain_grid_z - 64;
547 uNumElementsIn80AA28 = v7; 546 uNumElementsIn80AA28 = v7;
548 } 547 }
549 } 548 }
550 v9 = pOutdoorCamera->uNumSpans; 549 v9 = pOutdoorCamera->uNumSpans;
551 unnamed_6BE060[0] = pOutdoorCamera->uNumSpans; 550 unnamed_6BE060[0] = pOutdoorCamera->uNumSpans;
552 if ( pOutdoorCamera->numStru148s >= 1999 551 if (pOutdoorCamera->numStru148s >= 1999)
553 || (array_77EC08[1999]._48607B(&stru_8019C8), 552 return;
554 array_77EC08[1999].ptr_38->_48694B(), 553
555 v2 = (stru148 *)&pBitmaps_LOD->pTextures[pOutdoor->uMainTile_BitmapID], 554 array_77EC08[1999]._48607B(&stru_8019C8);
556 (array_77EC08[1999].pTexture = (Texture *)(pOutdoor->uMainTile_BitmapID != -1 ? (int)v2 : 0)) == 0) ) 555 array_77EC08[1999].ptr_38->_48694B();
557 return (signed __int16)v2; 556
557 if (pOutdoor->uMainTile_BitmapID == -1)
558 {
559 array_77EC08[1999].pTexture = nullptr;
560 return;
561 }
562 else
563 array_77EC08[1999].pTexture = pBitmaps_LOD->GetTexture(pOutdoor->uMainTile_BitmapID);
558 array_77EC08[1999].dimming_level = 23 - (-20 * pOutdoor->vSunlight.z >> 16); 564 array_77EC08[1999].dimming_level = 23 - (-20 * pOutdoor->vSunlight.z >> 16);
559 if ( array_77EC08[1999].dimming_level > 20 ) 565 if ( array_77EC08[1999].dimming_level > 20 )
560 array_77EC08[1999].dimming_level = 20; 566 array_77EC08[1999].dimming_level = 20;
561 v10 = stru_5C6E00->Sin(pIndoorCamera->sRotationX); 567 v10 = stru_5C6E00->Sin(pIndoorCamera->sRotationX);
562 array_77EC08[1999].v_18.y = 0; 568 array_77EC08[1999].v_18.y = 0;
568 + (double)pViewport->uScreenCenterY); 574 + (double)pViewport->uScreenCenterY);
569 cos((double)pIndoorCamera->sRotationX * 0.0030664064); 575 cos((double)pIndoorCamera->sRotationX * 0.0030664064);
570 sin((double)pIndoorCamera->sRotationX * 0.0030664064); 576 sin((double)pIndoorCamera->sRotationX * 0.0030664064);
571 array_77EC08[1999]._48607B(&stru_8019C8); 577 array_77EC08[1999]._48607B(&stru_8019C8);
572 array_77EC08[1999].ptr_38->_48694B(); 578 array_77EC08[1999].ptr_38->_48694B();
573 v2 = (stru148 *)&pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID]; 579
574 array_77EC08[1999].pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? (int)v2 : 0); 580 if (pOutdoor->uSky_TextureID == -1)
575 if ( !(pOutdoor->uSky_TextureID != -1 ? (int)v2 : 0) ) 581 {
576 return (signed __int16)v2; 582 array_77EC08[1999].pTexture = nullptr;
583 return;
584 }
585 else
586 array_77EC08[1999].pTexture = pBitmaps_LOD->GetTexture(pOutdoor->uSky_TextureID);
577 array_77EC08[1999].dimming_level = 0; 587 array_77EC08[1999].dimming_level = 0;
578 v11 = stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16); 588 v11 = stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);
579 array_77EC08[1999].v_18.y = 0; 589 array_77EC08[1999].v_18.y = 0;
580 array_77EC08[1999].v_18.x = -v11; 590 array_77EC08[1999].v_18.x = -v11;
581 array_77EC08[1999].v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16); 591 array_77EC08[1999].v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);
589 || bUnderwater ) 599 || bUnderwater )
590 { 600 {
591 v2 = (stru148 *)*(short *)PaletteManager::Get_Mist_or_Red_LUT(array_77EC08[1999].pTexture->palette_id2, 31, 1); 601 v2 = (stru148 *)*(short *)PaletteManager::Get_Mist_or_Red_LUT(array_77EC08[1999].pTexture->palette_id2, 31, 1);
592 a1b = (unsigned int)v2; 602 a1b = (unsigned int)v2;
593 if ( (signed int)v9 <= 0 ) 603 if ( (signed int)v9 <= 0 )
594 return (signed __int16)v2; 604 return;
595 v29 = v9; 605 v29 = v9;
596 while ( 1 ) 606 while ( 1 )
597 { 607 {
598 v30 = &pSpans[v29 - 1]; 608 v30 = &pSpans[v29 - 1];
599 v2 = (stru148 *)v30->field_E; 609 v2 = (stru148 *)v30->field_E;
628 } 638 }
629 LABEL_125: 639 LABEL_125:
630 --v29; 640 --v29;
631 --v9; 641 --v9;
632 if ( !v9 ) 642 if ( !v9 )
633 return (signed __int16)v2; 643 return;
634 } 644 }
635 } 645 }
636 if ( (signed int)v9 > 0 ) 646 if ( (signed int)v9 > 0 )
637 { 647 {
638 v12 = v9; 648 v12 = v9;
673 --v12; 683 --v12;
674 --v9; 684 --v9;
675 } 685 }
676 while ( v9 ); 686 while ( v9 );
677 } 687 }
678 return (signed __int16)v2;
679 } 688 }
680 689
681 //----- (00485044) -------------------------------------------------------- 690 //----- (00485044) --------------------------------------------------------
682 int Render::DrawSkySW(Span *a1, stru148 *a2, int a3) 691 int Render::DrawSkySW(Span *a1, stru148 *a2, int a3)
683 { 692 {
863 int v6; // esi@3 872 int v6; // esi@3
864 unsigned int v7; // eax@3 873 unsigned int v7; // eax@3
865 int v8; // eax@4 874 int v8; // eax@4
866 unsigned int v9; // eax@6 875 unsigned int v9; // eax@6
867 int v10; // eax@7 876 int v10; // eax@7
868 int v11; // ebx@9 877 //int v11; // ebx@9
869 int v12; // edi@9 878 //int v12; // edi@9
870 int v13; // eax@21 879 int v13; // eax@21
871 int v14; // eax@31 880 int v14; // eax@31
872 int v15; // edi@33 881 int v15; // edi@33
873 int v16; // eax@34 882 int v16; // eax@34
874 int v17; // edx@34 883 int v17; // edx@34
875 int v18; // ebx@34 884 int v18; // ebx@34
876 int v19; // eax@36 885 int v19; // eax@36
877 int v20; // eax@39 886 int v20; // eax@39
878 int v21; // ecx@43 887 int v21; // ecx@43
879 char v22; // zf@44 888 //char v22; // zf@44
880 int v23; // ecx@47 889 int v23; // ecx@47
881 int v24; // edi@52 890 int v24; // edi@52
882 int v25; // eax@54 891 int v25; // eax@54
883 int v26; // ecx@54 892 int v26; // ecx@54
884 int v27; // eax@56 893 int v27; // eax@56
923 int v66; // edx@163 932 int v66; // edx@163
924 int v67; // ecx@164 933 int v67; // ecx@164
925 int v68; // ecx@167 934 int v68; // ecx@167
926 int v69; // eax@173 935 int v69; // eax@173
927 int v70; // edi@178 936 int v70; // edi@178
928 int v71; // eax@178 937 //int v71; // eax@178
929 int v72; // ecx@178 938 //int v72; // ecx@178
930 int x; // ebx@180 939 //int x; // ebx@180
931 int v74; // eax@182 940 //int v74; // eax@182
932 int v75; // eax@184 941 int v75; // eax@184
933 IndoorCameraD3D *pIndoorCameraD3D_3; // ecx@184 942 IndoorCameraD3D *pIndoorCameraD3D_3; // ecx@184
934 int uStartZ; // ecx@184 943 int uStartZ; // ecx@184
935 int v79; // ebx@185 944 int v79; // ebx@185
936 int v127; // esi@185 945 int v127; // esi@185
937 int v86; // edi@196 946 int v86; // edi@196
938 int v87; // eax@196 947 //int v87; // eax@196
939 int v88; // ecx@196 948 //int v88; // ecx@196
940 int v89; // eax@198 949 //int v89; // eax@198
941 int v90; // ecx@200 950 //int v90; // ecx@200
942 int v92; // ebx@203 951 int v92; // ebx@203
943 int v93; // ST08_4@204 952 //int v93; // ST08_4@204
944 int v97; // ST08_4@204 953 int v97; // ST08_4@204
945 float result; // eax@212 954 float result; // eax@212
946 struct 955 //struct
947 { 956 //{
948 char v102[4]; // [sp+Ch] [bp-68h]@191 957 int v106; // [sp+Ch] [bp-68h]@191
949 __int16 v103; // [sp+10h] [bp-64h]@190 958 int v103; // [sp+10h] [bp-64h]@190
950 __int16 v104; // [sp+12h] [bp-62h]@190 959 int v104; // [sp+12h] [bp-62h]@190
951 } v102; 960 //} v102;
952 int v105; // [sp+1Ch] [bp-58h]@1 961 int v105; // [sp+1Ch] [bp-58h]@1
953 int v106; // [sp+20h] [bp-54h]@3 962 int v107; // [sp+20h] [bp-54h]@3
954 int uEndZ; // [sp+24h] [bp-50h]@3 963 int uEndZ; // [sp+24h] [bp-50h]@3
955 int v108; // [sp+28h] [bp-4Ch]@9 964 int v108; // [sp+28h] [bp-4Ch]@9
956 int v109; // [sp+2Ch] [bp-48h]@9 965 int v109; // [sp+2Ch] [bp-48h]@9
957 int v110; // [sp+30h] [bp-44h]@9 966 int v110; // [sp+30h] [bp-44h]@9
958 int v111; // [sp+34h] [bp-40h]@3 967 int v111; // [sp+34h] [bp-40h]@3
959 int v112; // [sp+38h] [bp-3Ch]@6 968 int v112; // [sp+38h] [bp-3Ch]@6
960 IndoorCameraD3D *pIndoorCameraD3D_4; // [sp+3Ch] [bp-38h]@9 969 IndoorCameraD3D *pIndoorCameraD3D_4; // [sp+3Ch] [bp-38h]@9
961 int v114; // [sp+40h] [bp-34h]@9 970 int v114; // [sp+40h] [bp-34h]@9
962 int v115; // [sp+44h] [bp-30h]@9 971 int v115; // [sp+44h] [bp-30h]@9
963 int v116; // [sp+48h] [bp-2Ch]@9 972 int v116; // [sp+48h] [bp-2Ch]@9
964 int v117; // [sp+4Ch] [bp-28h]@9 973 //int v117; // [sp+4Ch] [bp-28h]@9
965 int v118; // [sp+50h] [bp-24h]@9 974 int v118; // [sp+50h] [bp-24h]@9
966 int v119; // [sp+54h] [bp-20h]@1 975 int v119; // [sp+54h] [bp-20h]@1
967 int v120; // [sp+58h] [bp-1Ch]@1 976 int v120; // [sp+58h] [bp-1Ch]@1
968 int i; // [sp+5Ch] [bp-18h]@1 977 int i; // [sp+5Ch] [bp-18h]@1
969 int v122; // [sp+60h] [bp-14h]@1 978 int v122; // [sp+60h] [bp-14h]@1
1003 if ( (v5 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) 1012 if ( (v5 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi )
1004 v10 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v9]; 1013 v10 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v9];
1005 else 1014 else
1006 v10 = stru_5C6E00->pTanTable[v9]; 1015 v10 = stru_5C6E00->pTanTable[v9];
1007 v108 = abs(v10); 1016 v108 = abs(v10);
1008 v11 = v124; 1017 //v11 = v124;
1009 v12 = v123; 1018 //v12 = v123;
1010 v114 = 0; 1019 v114 = 0;
1011 v115 = 0; 1020 v115 = 0;
1012 pIndoorCameraD3D_4 = 0; 1021 pIndoorCameraD3D_4 = 0;
1013 v125 = 0; 1022 v125 = 0;
1014 v110 = (v106 >= 0 ? 1: -1);//2 * (v106 >= 0) - 1; 1023 v110 = (v106 >= 0 ? 1: -1);//2 * (v106 >= 0) - 1;
1015 v126 = v124; 1024 v126 = v124;
1016 v118 = v123; 1025 v118 = v123;
1017 v109 = (uEndZ >= 0 ? 1: -1);//2 * (v107 >= 0) - 1; 1026 v109 = (uEndZ >= 0 ? 1: -1);//2 * (v107 >= 0) - 1;
1018 uEndZ = (v111 >= 0 ? 1: -1);//2 * (v111 >= 0) - 1; 1027 uEndZ = (v111 >= 0 ? 1: -1);//2 * (v111 >= 0) - 1;
1019 terrain_76E1C8[0] = 65535; 1028 terrain_76E1C8[0] = 65535;
1020 //v116 = 1; 1029 uint _i = 1;
1021 v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1; 1030 v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1;
1022 //v117 = 1; 1031 uint j = 1;
1023 terrain_76E3C8[0] = 65535; 1032 terrain_76E3C8[0] = 65535;
1024 terrain_76DDC8[0] = 65535; 1033 terrain_76DDC8[0] = 65535;
1025 terrain_76DFC8[0] = 65535; 1034 terrain_76DFC8[0] = 65535;
1026 for( v116=1; v116 < 128; v116++) 1035 for( _i = 1; _i < 128; _i++)
1027 { 1036 {
1028 if ( v112 >= 0x10000 ) 1037 if ( v112 >= 0x10000 )
1029 { 1038 {
1030 int v1, v2; 1039 int v1, v2;
1031 /*v111 = 4294967296i64 / v112; 1040 /*v111 = 4294967296i64 / v112;
1037 } 1046 }
1038 v12 += v109;*/ 1047 v12 += v109;*/
1039 } 1048 }
1040 else 1049 else
1041 { 1050 {
1042 v11 += v110; 1051 v124 += v110;
1043 v115 += v112; 1052 v115 += v112;
1044 if ( v112 + v115 >= 65536 ) 1053 if ( v112 + v115 >= 65536 )
1045 { 1054 {
1046 v12 += v109; 1055 v123 += v109;
1047 v115 = (unsigned __int16)v115; 1056 v115 = (unsigned __int16)v115;
1048 } 1057 }
1049 } 1058 }
1050 if ( v11 < i || v11 > v120 || v12 < v122 || v12 > v119 ) 1059 if ( v124 < _i || v124 > v120 || v123 < v122 || v123 > v119 )
1051 break; 1060 break;
1052 //v13 = v116++; 1061 //v13 = v116++;
1053 terrain_76E3C8[v116] = v11; 1062 terrain_76E3C8[_i] = v124;
1054 terrain_76E1C8[v116] = v12; 1063 terrain_76E1C8[_i] = v123;
1055 } 1064 }
1056 1065
1057 for( v117=1; v117 < 128; v117++ ) 1066 for( j = 1; j < 128; j++ )
1058 { 1067 {
1059 if ( v108 >= 65536 ) 1068 if ( v108 >= 65536 )
1060 { 1069 {
1061 v111 = 4294967296i64 / v108; 1070 v111 = 4294967296i64 / v108;
1062 v114 += v111;// 1071 v114 += v111;//
1077 v125 = (unsigned __int16)v125; 1086 v125 = (unsigned __int16)v125;
1078 } 1087 }
1079 } 1088 }
1080 //if ( v117 >= 128 ) 1089 //if ( v117 >= 128 )
1081 //break; 1090 //break;
1082 if ( v126 < i ) 1091 if ( v126 < _i )
1083 break; 1092 break;
1084 if ( v126 > v120 ) 1093 if ( v126 > v120 )
1085 break; 1094 break;
1086 v14 = v118; 1095 v14 = v118;
1087 if ( v118 < v122 ) 1096 if ( v118 < v122 )
1088 break; 1097 break;
1089 if ( v118 > v119 ) 1098 if ( v118 > v119 )
1090 break; 1099 break;
1091 terrain_76DFC8[v117] = v126; 1100 terrain_76DFC8[j] = v126;
1092 terrain_76DDC8[v117] = v14; 1101 terrain_76DDC8[j] = v14;
1093 } 1102 }
1094 v16 = 0; 1103 v16 = 0;
1095 v126 = 0; 1104 v126 = 0;
1096 v17 = v117 - 1; 1105 v17 = j - 1;
1097 v18 = v116 - 1; 1106 v18 = _i - 1;
1098 switch ( v105 ) 1107 switch ( v105 )
1099 { 1108 {
1100 case 0: 1109 case 0:
1101 case 7: 1110 case 7:
1102 { 1111 {
1103 v116 = terrain_76DFC8[v17]; 1112 //v116 = terrain_76DFC8[v17];
1104 if ( v120 > v116 ) 1113 if ( v120 > terrain_76DFC8[v17] )
1105 { 1114 {
1106 v125 = v120; 1115 v125 = v120;
1107 memset32(terrain_76D9C8, v119 + 1, 4 * (v120 - v116 + 1)); 1116 memset32(terrain_76D9C8, v119 + 1, 4 * (v120 - terrain_76DFC8[v17] + 1));
1108 v19 = v120; 1117 v19 = v120;
1109 do 1118 do
1110 terrain_76DBC8[v126++] = v19--; 1119 terrain_76DBC8[v126++] = v19--;
1111 while ( v19 >= v116 ); 1120 while ( v19 >= terrain_76DFC8[v17] );
1112 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 + 127] ) 1121 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 + 127] )
1113 { 1122 {
1114 do 1123 do
1115 v20 = terrain_76DDC8[v17-- -1]; 1124 v20 = terrain_76DDC8[v17-- -1];
1116 while ( v20 == terrain_76DDC8[v17 -1] ); 1125 while ( v20 == terrain_76DDC8[v17 -1] );
1125 { 1134 {
1126 v125 = v21; 1135 v125 = v21;
1127 if ( v21 < v124 ) 1136 if ( v21 < v124 )
1128 break; 1137 break;
1129 terrain_76DBC8[v16] = v21; 1138 terrain_76DBC8[v16] = v21;
1130 v22 = terrain_76DDC8[v17] == 65535; 1139 //v22 = terrain_76DDC8[v17] == 65535;
1131 terrain_76D9C8[v16] = terrain_76DDC8[v17] + 1; 1140 terrain_76D9C8[v16] = terrain_76DDC8[v17] + 1;
1132 if ( v22 ) 1141 if ( terrain_76DDC8[v17] == 65535 )
1133 { 1142 {
1134 terrain_76D9C8[v16] = v123 + 1; 1143 terrain_76D9C8[v16] = v123 + 1;
1135 break; 1144 break;
1136 } 1145 }
1137 if ( !v17 ) 1146 if ( !v17 )
1199 break; 1208 break;
1200 } 1209 }
1201 case 1: 1210 case 1:
1202 case 2: 1211 case 2:
1203 { 1212 {
1204 v116 = terrain_76DDC8[v17]; 1213 //v116 = terrain_76DDC8[v17];
1205 if ( v122 < v116 ) 1214 if ( v122 < terrain_76DDC8[v17] )
1206 { 1215 {
1207 v106 = v122; 1216 v106 = v122;
1208 memset32(terrain_76DBC8, v120 + 1, 4 * (v116 - v122 + 1)); 1217 memset32(terrain_76DBC8, v120 + 1, 4 * (terrain_76DDC8[v17] - v122 + 1));
1209 v32 = v122; 1218 v32 = v122;
1210 do 1219 do
1211 { 1220 {
1212 v33 = v126++; 1221 v33 = v126++;
1213 terrain_76D9C8[v33] = v32++; 1222 terrain_76D9C8[v33] = v32++;
1214 } 1223 }
1215 while ( v32 <= v116 ); 1224 while ( v32 <= terrain_76DDC8[v17] );
1216 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) 1225 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] )
1217 { 1226 {
1218 do 1227 do
1219 v34 = terrain_76DBC8[v17-- -1]; 1228 v34 = terrain_76DBC8[v17-- -1];
1220 while ( v34 == terrain_76DBC8[v17 -1] ); 1229 while ( v34 == terrain_76DBC8[v17 -1] );
1226 v17 = 0; 1235 v17 = 0;
1227 v35 = terrain_76DDC8[v17]; 1236 v35 = terrain_76DDC8[v17];
1228 v125 = terrain_76DDC8[v17]; 1237 v125 = terrain_76DDC8[v17];
1229 while ( v35 <= v123 ) 1238 while ( v35 <= v123 )
1230 { 1239 {
1231 v22 = terrain_76DFC8[v17] == 65535; 1240 //v22 = terrain_76DFC8[v17] == 65535;
1232 terrain_76DBC8[v16] = terrain_76DFC8[v17] + 1; 1241 terrain_76DBC8[v16] = terrain_76DFC8[v17] + 1;
1233 terrain_76D9C8[v16] = v125; 1242 terrain_76D9C8[v16] = v125;
1234 if ( v22 ) 1243 if ( terrain_76DFC8[v17] == 65535 )
1235 { 1244 {
1236 terrain_76DBC8[v16] = v124 + 1; 1245 terrain_76DBC8[v16] = v124 + 1;
1237 break; 1246 break;
1238 } 1247 }
1239 if ( !v17 ) 1248 if ( !v17 )
1302 break; 1311 break;
1303 } 1312 }
1304 case 5: 1313 case 5:
1305 case 6: 1314 case 6:
1306 { 1315 {
1307 v116 = terrain_76DDC8[v17]; 1316 //v116 = terrain_76DDC8[v17];
1308 if ( v119 > v116 ) 1317 if ( v119 > terrain_76DDC8[v17] )
1309 { 1318 {
1310 v106 = v119; 1319 v106 = v119;
1311 memset32(terrain_76DBC8, i, 4 * (v119 - v116 + 1)); 1320 memset32(terrain_76DBC8, i, 4 * (v119 - terrain_76DDC8[v17] + 1));
1312 v45 = v119; 1321 v45 = v119;
1313 do 1322 do
1314 terrain_76D9C8[v126++] = v45--; 1323 terrain_76D9C8[v126++] = v45--;
1315 while ( v45 >= v116 ); 1324 while ( v45 >= terrain_76DDC8[v17] );
1316 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) 1325 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] )
1317 { 1326 {
1318 do 1327 do
1319 v46 = terrain_76DBC8[v17-- -1]; 1328 v46 = terrain_76DBC8[v17-- -1];
1320 while ( v46 == terrain_76DBC8[v17 -1] ); 1329 while ( v46 == terrain_76DBC8[v17 -1] );
1326 v17 = 0; 1335 v17 = 0;
1327 v47 = terrain_76DDC8[v17]; 1336 v47 = terrain_76DDC8[v17];
1328 v125 = terrain_76DDC8[v17]; 1337 v125 = terrain_76DDC8[v17];
1329 while ( v47 >= v123 ) 1338 while ( v47 >= v123 )
1330 { 1339 {
1331 v22 = terrain_76DFC8[v17] == 65535; 1340 //v22 = terrain_76DFC8[v17] == 65535;
1332 terrain_76DBC8[v16] = terrain_76DFC8[v17]; 1341 terrain_76DBC8[v16] = terrain_76DFC8[v17];
1333 terrain_76D9C8[v16] = v125; 1342 terrain_76D9C8[v16] = v125;
1334 if ( v22 ) 1343 if ( terrain_76DFC8[v17] == 65535 )
1335 { 1344 {
1336 terrain_76DBC8[v16] = v124; 1345 terrain_76DBC8[v16] = v124;
1337 break; 1346 break;
1338 } 1347 }
1339 if ( !v17 ) 1348 if ( !v17 )
1401 break; 1410 break;
1402 } 1411 }
1403 case 3: 1412 case 3:
1404 case 4: 1413 case 4:
1405 { 1414 {
1406 v116 = terrain_76DFC8[v17]; 1415 //v116 = terrain_76DFC8[v17];
1407 if ( i < v116 ) 1416 if ( i < terrain_76DFC8[v17] )
1408 { 1417 {
1409 v106 = i; 1418 v106 = i;
1410 memset32(terrain_76D9C8, v122, 4 * (v116 - i + 1)); 1419 memset32(terrain_76D9C8, v122, 4 * (terrain_76DFC8[v17] - i + 1));
1411 v56 = i; 1420 v56 = i;
1412 do 1421 do
1413 { 1422 {
1414 v57 = v126++; 1423 v57 = v126++;
1415 terrain_76DBC8[v57] = v56++; 1424 terrain_76DBC8[v57] = v56++;
1416 } 1425 }
1417 while ( v56 <= v116 ); 1426 while ( v56 <= terrain_76DFC8[v17] );
1418 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 -1] ) 1427 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 -1] )
1419 { 1428 {
1420 do 1429 do
1421 v58 = terrain_76DDC8[v17-- -1]; 1430 v58 = terrain_76DDC8[v17-- -1];
1422 while ( v58 == terrain_76DDC8[v17 -1] ); 1431 while ( v58 == terrain_76DDC8[v17 -1] );
1483 while ( v66 <= v124 ) 1492 while ( v66 <= v124 )
1484 { 1493 {
1485 v67 = terrain_76E1C8[v18]; 1494 v67 = terrain_76E1C8[v18];
1486 terrain_76D7C8[v16] = v66; 1495 terrain_76D7C8[v16] = v66;
1487 terrain_76D5C8[v16] = v67 + 1; 1496 terrain_76D5C8[v16] = v67 + 1;
1488 if ( v67 == 65535 ) 1497 if ( terrain_76E1C8[v18] == 65535 )
1489 { 1498 {
1490 v31 = v123 + 1; 1499 v31 = v123 + 1;
1491 terrain_76D5C8[v16] = v31; 1500 terrain_76D5C8[v16] = v31;
1492 break; 1501 break;
1493 } 1502 }
1515 if ( v105 && v105 != 7 && v105 != 3 && v105 != 4 )// 1524 if ( v105 && v105 != 7 && v105 != 3 && v105 != 4 )//
1516 { 1525 {
1517 for ( i = v69; i >= 1; --i ) 1526 for ( i = v69; i >= 1; --i )
1518 { 1527 {
1519 //v70 = i; 1528 //v70 = i;
1520 v71 = terrain_76D7C8[i];//88 1529 //v71 = terrain_76D7C8[i];//88
1521 v72 = terrain_76DBC8[i];//0 1530 //v72 = terrain_76DBC8[i];//0
1522 if ( v71 < v72 )//swap 1531 if ( terrain_76D7C8[i] < terrain_76DBC8[i] )//swap
1523 { 1532 {
1524 terrain_76DBC8[i] = v71; 1533 terrain_76DBC8[i] = terrain_76D7C8[i];
1525 terrain_76D7C8[i] = v72; 1534 terrain_76D7C8[i] = terrain_76DBC8[i];
1526 } 1535 }
1527 x = terrain_76DBC8[i];//0 1536 //x = terrain_76DBC8[i];//0
1528 v111 = 0; 1537 v111 = 0;
1529 if ( x <= 0 ) 1538 if ( terrain_76DBC8[i] <= 0 )
1530 x = -x; 1539 terrain_76DBC8[i] = -terrain_76DBC8[i];
1531 v74 = terrain_76D7C8[i]; 1540 //v74 = terrain_76D7C8[i];
1532 if ( v74 <= 0 ) 1541 if ( terrain_76D7C8[i] <= 0 )
1533 v74 = -v74; 1542 terrain_76D7C8[i] = -terrain_76D7C8[i];
1534 v75 = v74 + 2; 1543 v75 = terrain_76D7C8[i] + 2;
1535 //pIndoorCameraD3D_3 = pGame->pIndoorCameraD3D; 1544 //pIndoorCameraD3D_3 = pGame->pIndoorCameraD3D;
1536 uEndZ = v75; 1545 uEndZ = v75;
1537 //pIndoorCameraD3D_4 = pIndoorCameraD3D_3; 1546 //pIndoorCameraD3D_4 = pIndoorCameraD3D_3;
1538 uStartZ = x - 2; 1547 uStartZ = terrain_76DBC8[i] - 2;
1539 if ( x - 2 < v75 ) 1548 if ( terrain_76DBC8[i] - 2 < v75 )
1540 { 1549 {
1541 v127 = 0; 1550 v127 = 0;
1542 //v79 = (v73 - 66) << 9; 1551 //v79 = (v73 - 66) << 9;
1543 //v116 = v77; 1552 //v116 = v77;
1544 //pHeight = v79; 1553 //pHeight = v79;
1545 v111 = v75 - uStartZ; 1554 v111 = v75 - uStartZ;
1546 for (int z = uStartZ; z < uEndZ; ++z) 1555 for (int z = uStartZ; z < uEndZ; ++z)
1547 { 1556 {
1548 ptr_801A08[v127].vWorldPosition.x = (-64 + x) * 512;//pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512; 1557 ptr_801A08[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512;//pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512;
1549 ptr_801A08[v127].vWorldPosition.y = (64 - terrain_76D9C8[i]) * 512; 1558 ptr_801A08[v127].vWorldPosition.y = (64 - terrain_76D9C8[i]) * 512;
1550 ptr_801A08[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i]); 1559 ptr_801A08[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i]);
1551 ptr_801A04[v127].vWorldPosition.x = (-64 + x) * 512; 1560 ptr_801A04[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512;
1552 ptr_801A04[v127].vWorldPosition.y = (63 - terrain_76D9C8[i]) * 512; 1561 ptr_801A04[v127].vWorldPosition.y = (63 - terrain_76D9C8[i]) * 512;
1553 ptr_801A04[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i] + 1); 1562 ptr_801A04[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i] + 1);
1554 if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) 1563 if ( !byte_4D864C || !(pGame->uFlags & 0x80) )
1555 { 1564 {
1556 pIndoorCameraD3D_4->ViewTransform(&ptr_801A08[v127], 1); 1565 pIndoorCameraD3D_4->ViewTransform(&ptr_801A08[v127], 1);
1563 //++v116; 1572 //++v116;
1564 //pHeight = v79; 1573 //pHeight = v79;
1565 } 1574 }
1566 //while ( v116 < v107 ); 1575 //while ( v116 < v107 );
1567 } 1576 }
1568 v102.v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]); 1577 v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]);
1569 v102.v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]); 1578 v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]);
1570 if ( pRenderer->pRenderD3D )//Ritor1: do comment to test 1579 if ( pRenderer->pRenderD3D )//Ritor1: do comment to test
1571 Render::RenderTerrainD3D();//Render::DrawTerrainD3D(v111, 0, (int)&v102); 1580 Render::DrawTerrainD3D(v111, 0, v103, v104);//Render::RenderTerrainD3D();
1572 else 1581 else
1573 Render::DrawTerrainSW(v111, 0, (int)&v102); 1582 Render::DrawTerrainSW(v111, 0, v103, v104);
1574 } 1583 }
1575 } 1584 }
1576 /* else 1585 else
1577 { 1586 {
1578 for ( i = v69; i >= 1; --i ) 1587 for ( i = v69; i >= 1; --i )
1579 { 1588 {
1580 v86 = i; 1589 //v86 = i;
1581 v87 = terrain_76D5C8[i]; 1590 //v87 = terrain_76D5C8[i];
1582 v88 = terrain_76D9C8[i]; 1591 //v88 = terrain_76D9C8[i];
1583 if ( v87 < v88 ) 1592 if ( terrain_76D5C8[i] < terrain_76D9C8[i] )
1584 { 1593 {
1585 terrain_76D9C8[v86] = v87; 1594 terrain_76D9C8[i] = terrain_76D5C8[i];
1586 terrain_76D5C8[v86] = v88; 1595 terrain_76D5C8[i] = terrain_76D9C8[i];
1587 } 1596 }
1588 v89 = terrain_76D9C8[v86]; 1597 //v89 = terrain_76D9C8[i];
1589 v111 = 0; 1598 v111 = 0;
1590 if ( v89 <= 0 ) 1599 if ( terrain_76D9C8[i] <= 0 )
1591 v89 = -v89; 1600 terrain_76D9C8[i] = -terrain_76D9C8[i];
1592 v90 = terrain_76D5C8[v86]; 1601 //v90 = terrain_76D5C8[i];
1593 if ( v90 <= 0 ) 1602 if ( terrain_76D5C8[i] <= 0 )
1594 v90 = -v90; 1603 terrain_76D5C8[i] = -terrain_76D5C8[i];
1595 pIndoorCameraD3D_4 = pGame->pIndoorCameraD3D; 1604 pIndoorCameraD3D_4 = pGame->pIndoorCameraD3D;
1596 v107 = v90 + 2; 1605 v107 = terrain_76D5C8[i] + 2;
1597 if ( v89 - 2 < v90 + 2 ) 1606 if ( terrain_76D9C8[i] - 2 < terrain_76D5C8[i] + 2 )
1598 { 1607 {
1599 v86 = 0; 1608 v86 = 0;
1600 v116 = v89 - 2; 1609 //v116 = terrain_76D9C8[i] - 2;
1601 v92 = (66 - v89) << 9; 1610 v92 = (66 - terrain_76D9C8[i]) << 9;
1602 pHeight = (66 - v89) << 9; 1611 //pHeight = (66 - terrain_76D9C8[i]) << 9;
1603 v111 = v90 + 2 - (v89 - 2); 1612 v111 = terrain_76D5C8[i] + 2 - (terrain_76D9C8[i] - 2);
1604 do 1613 //do
1605 { 1614 for ( v116 = terrain_76D9C8[i] - 2; v116 < v107; ++v116 )
1606 v93 = v116; 1615 {
1607 v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 64) << 9; 1616 //v93 = v116;
1608 *(float *)((char *)&ptr_801A08->vWorldPosition.x + v86) = (double)v106; 1617 //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 64) << 9;
1609 *(float *)&pHeight = (double)pHeight; 1618 ptr_801A08[v86].vWorldPosition.x = terrain_76DBC8[v86] - 64 << 9;
1610 *(float *)((char *)&ptr_801A08->vWorldPosition.y + v86) = *(float *)&pHeight; 1619 //*(float *)&pHeight = (double)pHeight;
1611 v106 = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86), v93); 1620 ptr_801A08[v86].vWorldPosition.y = v92;
1612 v97 = v116; 1621 //v106 = ;
1613 *(float *)((char *)&ptr_801A08->vWorldPosition.z + v86) = (double)v106; 1622 //v97 = v116;
1614 v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 63) << 9; 1623 ptr_801A08[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86], v116);
1615 *(float *)((char *)&ptr_801A04->vWorldPosition.x + v86) = (double)v106; 1624 //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 63) << 9;
1616 *(float *)((char *)&ptr_801A04->vWorldPosition.y + v86) = *(float *)&pHeight; 1625 ptr_801A04[v86].vWorldPosition.x = terrain_76DBC8[v86] - 63 << 9;
1617 pHeight = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97); 1626 ptr_801A04[v86].vWorldPosition.y = v92;
1618 *(float *)((char *)&ptr_801A04->vWorldPosition.z + v86) = (double)pHeight; 1627 //pHeight = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97);
1628 ptr_801A04[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86] + 1, v116);
1619 if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) 1629 if ( !byte_4D864C || !(pGame->uFlags & 0x80) )
1620 { 1630 {
1621 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1); 1631 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1);
1622 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1); 1632 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1);
1623 pIndoorCameraD3D_4->Project((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1, 0); 1633 pIndoorCameraD3D_4->Project((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1, 0);
1624 pIndoorCameraD3D_4->Project((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1, 0); 1634 pIndoorCameraD3D_4->Project((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1, 0);
1625 } 1635 }
1626 v92 -= 512; 1636 v92 -= 512;
1627 v86 += 48; 1637 v86 += 48;
1628 ++v116; 1638 //++v116;
1629 pHeight = v92; 1639 //pHeight = v92;
1630 } 1640 }
1631 while ( v116 < v107 ); 1641 //while ( v116 < v107 );
1632 } 1642 }
1633 v103 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v86]); 1643 v103 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v86]);
1634 v104 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v86]); 1644 v104 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v86]);
1635 if ( pRenderer->pRenderD3D ) 1645 if ( pRenderer->pRenderD3D )
1636 Render::DrawTerrainD3D(v111, 1, (int)&v102); 1646 Render::DrawTerrainD3D(v111, 1, v103, v104);
1637 else 1647 else
1638 Render::DrawTerrainSW(v111, 1, (int)&v102); 1648 Render::DrawTerrainSW(v111, 1, v103, v104);
1639 } 1649 }
1640 }*/ 1650 }
1641 result = v126; 1651 result = v126;
1642 pOutdoorCamera->field_40 = v126; 1652 pOutdoorCamera->field_40 = v126;
1643 return result; 1653 return result;
1644 } 1654 }
1645 // 47FFC4: inconsistent fpu stack 1655 // 47FFC4: inconsistent fpu stack
1828 } 1838 }
1829 } 1839 }
1830 } 1840 }
1831 1841
1832 //----- (0048034E) -------------------------------------------------------- 1842 //----- (0048034E) --------------------------------------------------------
1833 void Render::DrawTerrainD3D(int a1, int a2, int a3) 1843 void Render::DrawTerrainD3D(int a1, int a2, int a3, int unk4)
1834 { 1844 {
1835 int v3; // esi@1 1845 //int v3; // esi@1
1836 int v4; // edi@1 1846 int v4; // edi@1
1837 int v5; // ebx@2 1847 int v5; // ebx@2
1838 int v6; // eax@2 1848 int v6; // eax@2
1839 int v7; // eax@3 1849 int v7; // eax@3
1840 RenderVertexSoft *v8; // edi@3 1850 RenderVertexSoft *v8; // edi@3
1904 stru148 *v71; // esi@147 1914 stru148 *v71; // esi@147
1905 unsigned int v72; // ecx@147 1915 unsigned int v72; // ecx@147
1906 unsigned int v73; // eax@150 1916 unsigned int v73; // eax@150
1907 int v74; // eax@154 1917 int v74; // eax@154
1908 unsigned int v75; // eax@158 1918 unsigned int v75; // eax@158
1909 unsigned int v76; // [sp-10h] [bp-E0h]@61 1919 //unsigned int v76; // [sp-10h] [bp-E0h]@61
1910 int v77; // [sp-Ch] [bp-DCh]@61 1920 int v77; // [sp-Ch] [bp-DCh]@61
1911 IDirect3DTexture2 *v78; // [sp-8h] [bp-D8h]@61 1921 IDirect3DTexture2 *v78; // [sp-8h] [bp-D8h]@61
1912 int v79; // [sp-4h] [bp-D4h]@61 1922 //int v79; // [sp-4h] [bp-D4h]@61
1913 int v80; // [sp+0h] [bp-D0h]@59 1923 int v80; // [sp+0h] [bp-D0h]@59
1914 int v81; // [sp+0h] [bp-D0h]@109 1924 int v81; // [sp+0h] [bp-D0h]@109
1915 int v82; // [sp+54h] [bp-7Ch]@1 1925 int v82; // [sp+54h] [bp-7Ch]@1
1916 int v83; // [sp+60h] [bp-70h]@1 1926 int v83; // [sp+60h] [bp-70h]@1
1917 int v84; // [sp+6Ch] [bp-64h]@1 1927 int v84; // [sp+6Ch] [bp-64h]@1
1951 char this_3a; // [sp+DBh] [bp+Bh]@82 1961 char this_3a; // [sp+DBh] [bp+Bh]@82
1952 char this_3b; // [sp+DBh] [bp+Bh]@131 1962 char this_3b; // [sp+DBh] [bp+Bh]@131
1953 1963
1954 static stru154 static_sub_0048034E_stru_154; 1964 static stru154 static_sub_0048034E_stru_154;
1955 static stru154 stru_76D5A8; 1965 static stru154 stru_76D5A8;
1956 v3 = a1; 1966 //v3 = a1;
1957 v82 = a2; 1967 v82 = a2;
1958 v83 = *(/*short **/_WORD *)(a3 + 4); 1968 v83 = a3;
1959 X = abs(*(/*short **/_WORD *)(a3 + 6)); 1969 X = abs(unk4);
1960 v4 = 0; 1970 v4 = 0;
1961 v88 = 0; 1971 v88 = 0;
1962 v84 = v3 - 1; 1972 v84 = a1 - 1;
1963 v90 = (float)pOutdoor->vSunlight.x / 65536.0; 1973 v90 = (float)pOutdoor->vSunlight.x / 65536.0;
1964 v91 = (float)pOutdoor->vSunlight.y / 65536.0; 1974 v91 = (float)pOutdoor->vSunlight.y / 65536.0;
1965 v92 = (float)pOutdoor->vSunlight.z / 65536.0; 1975 v92 = (float)pOutdoor->vSunlight.z / 65536.0;
1966 if ( v3 - 1 > 0 ) 1976 if ( a1 - 1 > 0 )
1967 { 1977 {
1968 while ( 1 ) 1978 while ( 1 )
1969 { 1979 {
1970 v5 = abs(X);//v5 = 13108 1980 v5 = abs(X);//v5 = 13108
1971 v6 = abs(v83);//v6 = 13108 1981 v6 = abs(v83);//v6 = 13108
1972 --X; 1982 --X;
1973 __debugbreak(); // uncoment & refactor following large if 1983 //__debugbreak(); // uncoment & refactor following large if
1974 v93 = (int)&stru_76E5C8[(v5 << 7) + v6]; 1984 v93 = (int)&stru_76E5C8[(v5 << 7) + v6];
1975 /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), 1985 /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7),
1976 v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), 1986 v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)),
1977 ((a8 = v9, 1987 ((a8 = v9,
1978 pVertices = &pVerticesSR_801A10[1] + v7, 1988 pVertices = &pVerticesSR_801A10[1] + v7,
2401 { 2411 {
2402 v75 = v71->uTileBitmapID; 2412 v75 = v71->uTileBitmapID;
2403 v80 = true; 2413 v80 = true;
2404 } 2414 }
2405 //v79 = 0; 2415 //v79 = 0;
2406 //v78 = pBitmaps_LOD->pHardwareTextures[v75]; 2416 v78 = pBitmaps_LOD->pHardwareTextures[v75];
2407 v71->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v75];// Ritor1: It's temporary 2417 v71->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v75];// Ritor1: It's temporary
2408 //v77 = (int)v71; 2418 //v77 = (int)v71;
2409 //v76 = v71->uNumVertices; 2419 //v76 = v71->uNumVertices;
2410 //goto LABEL_161; 2420 //goto LABEL_161;
2411 pRenderer->DrawTerrainPolygon(v76, (stru148 *)v71, v78, v79, v80); 2421 pRenderer->DrawTerrainPolygon(v71->uNumVertices, (stru148 *)v71, v78, 0, v80);
2412 goto LABEL_162; 2422 goto LABEL_162;
2413 } 2423 }
2414 v38 = (stru148 *)v71; 2424 v38 = (stru148 *)v71;
2415 goto LABEL_56; 2425 goto LABEL_56;
2416 } 2426 }
2425 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); 2435 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int);
2426 // 4D864C: using guessed type char byte_4D864C; 2436 // 4D864C: using guessed type char byte_4D864C;
2427 // 76D5C0: using guessed type char static_sub_0048034E_byte_76D5C0__init_flag; 2437 // 76D5C0: using guessed type char static_sub_0048034E_byte_76D5C0__init_flag;
2428 2438
2429 //----- (00481212) -------------------------------------------------------- 2439 //----- (00481212) --------------------------------------------------------
2430 void Render::DrawTerrainSW(int a1, int a2, int a3) 2440 void Render::DrawTerrainSW(int a1, int a2, int a3, int a4)
2431 { 2441 {
2432 int v3; // esi@1 2442 int v3; // esi@1
2433 int v4; // ecx@1 2443 int v4; // ecx@1
2434 int v5; // ST10_4@1 2444 int v5; // ST10_4@1
2435 int v6; // edi@1 2445 int v6; // edi@1
2539 2549
2540 v3 = a1; 2550 v3 = a1;
2541 //v4 = *(short *)(a3 + 4); 2551 //v4 = *(short *)(a3 + 4);
2542 //v5 = *(short *)(a3 + 6); 2552 //v5 = *(short *)(a3 + 6);
2543 v85 = a2; 2553 v85 = a2;
2544 v86 = *(_WORD *)(a3 + 4); //v4; 2554 v86 = a3; //v4;
2545 X = abs(*(_WORD *)(a3 + 6)); //v5 2555 X = abs(a4); //v5
2546 v6 = 0; 2556 v6 = 0;
2547 v90 = 0; 2557 v90 = 0;
2548 v81 = v3 - 1; 2558 v81 = v3 - 1;
2549 v95 = (double)pOutdoor->vSunlight.x / 65536.0; 2559 v95 = (double)pOutdoor->vSunlight.x / 65536.0;
2550 v96 = (double)pOutdoor->vSunlight.y / 65536.0; 2560 v96 = (double)pOutdoor->vSunlight.y / 65536.0;