comparison Vis.cpp @ 2149:d4f00d622889

SortByScreenSpaceX and SortByScreenSpaceY for Vis fix
author Ritor1
date Wed, 08 Jan 2014 15:01:58 +0600
parents feeb7bfcb19e
children 701dc2f4956b
comparison
equal deleted inserted replaced
2148:af349bd395ff 2149:d4f00d622889
977 MessageBoxW(nullptr, L"Unknown pointer creation flag passed to ::create_object_pointers()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:1358", 0); 977 MessageBoxW(nullptr, L"Unknown pointer creation flag passed to ::create_object_pointers()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:1358", 0);
978 } 978 }
979 } 979 }
980 980
981 //----- (004C264A) -------------------------------------------------------- 981 //----- (004C264A) --------------------------------------------------------
982 void Vis::sort_object_pointers( Vis_ObjectInfo **pPointers, int start, int end ) 982 void Vis::sort_object_pointers( Vis_ObjectInfo **pPointers, int start, int end )//сортировка
983 { 983 {
984 int sort_start; // edx@1 984 int sort_start; // edx@1
985 int forward_sort_index; // esi@2 985 int forward_sort_index; // esi@2
986 signed int backward_sort_index; // ecx@2 986 signed int backward_sort_index; // ecx@2
987 unsigned int last_z_val; // eax@3 987 unsigned int last_z_val; // eax@3
988 unsigned int more_lz_val; // ebx@4 988 unsigned int more_lz_val; // ebx@4
998 { 998 {
999 forward_sort_index = sort_start - 1; 999 forward_sort_index = sort_start - 1;
1000 backward_sort_index = end; 1000 backward_sort_index = end;
1001 do 1001 do
1002 { 1002 {
1003 last_z_val = pPointers[end]->sZValue&0xFFFF0000; 1003 last_z_val = pPointers[end]->sZValue & 0xFFFF0000;
1004 do 1004 do
1005 { 1005 {
1006 ++forward_sort_index; 1006 ++forward_sort_index;
1007 more_lz_val = pPointers[forward_sort_index]->sZValue&0xFFFF0000; 1007 more_lz_val = pPointers[forward_sort_index]->sZValue & 0xFFFF0000;
1008 } 1008 }
1009 while ( more_lz_val < last_z_val ); 1009 while ( more_lz_val < last_z_val );
1010 1010
1011 do 1011 do
1012 { 1012 {
1013 if ( backward_sort_index < 1 ) 1013 if ( backward_sort_index < 1 )
1014 break; 1014 break;
1015 --backward_sort_index; 1015 --backward_sort_index;
1016 less_lz_val = pPointers[backward_sort_index]->sZValue&0xFFFF0000; 1016 less_lz_val = pPointers[backward_sort_index]->sZValue & 0xFFFF0000;
1017 } 1017 }
1018 while ( less_lz_val > last_z_val ); 1018 while ( less_lz_val > last_z_val );
1019 1019
1020 temp_pointer = pPointers[forward_sort_index]; 1020 temp_pointer = pPointers[forward_sort_index];
1021 if ( forward_sort_index >= backward_sort_index ) 1021 if ( forward_sort_index >= backward_sort_index )
1161 } 1161 }
1162 return true; 1162 return true;
1163 } 1163 }
1164 1164
1165 //----- (004C288E) -------------------------------------------------------- 1165 //----- (004C288E) --------------------------------------------------------
1166 bool Vis::SortByScreenSpaceX(RenderVertexSoft *pArray, int sLeft, int sRight) 1166 void Vis::SortByScreenSpaceX(RenderVertexSoft *pArray, int start, int end)//сортировка по возрастанию экранных координат х
1167 { 1167 {
1168 bool result; // eax@1 1168 int left_sort_index; // ebx@2
1169 RenderVertexSoft *v5; // edx@2 1169 int right_sort_index; // ecx@2
1170 int v6; // ebx@2 1170 RenderVertexSoft temp_array; // [sp+4h] [bp-6Ch]@8
1171 int i; // ecx@2 1171 RenderVertexSoft max_array; // [sp+34h] [bp-3Ch]@2
1172 int v8; // esi@3 1172 int v12; // [sp+64h] [bp-Ch]@7
1173 int v9; // esi@5 1173
1174 //RenderVertexSoft *v10; // eax@8 1174 if ( end > start )
1175 const void *v10; 1175 {
1176 RenderVertexSoft v11; // [sp+4h] [bp-6Ch]@8 1176 left_sort_index = start - 1;
1177 RenderVertexSoft v12; // [sp+34h] [bp-3Ch]@2 1177 memcpy(&max_array, &pArray[end], sizeof(max_array));
1178 //float v13; // [sp+4Ch] [bp-24h]@4 1178 for ( right_sort_index = end; ; right_sort_index = v12 )
1179 int v14; // [sp+64h] [bp-Ch]@7 1179 {
1180 //Vis *thisa; // [sp+68h] [bp-8h]@1 1180 do
1181 //void *thisa; 1181 {
1182 //RenderVertexSoft *v16; // [sp+6Ch] [bp-4h]@2 1182 ++left_sort_index;
1183 const void *v16; 1183 }
1184 1184 while ( pArray[left_sort_index].vWorldViewProjX < (double)max_array.vWorldViewProjX );
1185 //thisa = this; 1185 do
1186 if (sRight <= sLeft) 1186 {
1187 return true; 1187 --right_sort_index;
1188 v5 = pArray; 1188 }
1189 v16 = &pArray[sRight]; 1189 while ( pArray[right_sort_index].vWorldViewProjX > (double)max_array.vWorldViewProjX );
1190 v6 = sLeft - 1; 1190 v12 = right_sort_index;
1191 memcpy(&v12, &pArray[sRight], sizeof(v12)); 1191 if ( left_sort_index >= right_sort_index )
1192 for ( i = sRight; ; i = v14 ) 1192 break;
1193 { 1193 memcpy(&temp_array, &pArray[left_sort_index], sizeof(temp_array));
1194 v8 = (int)&v5[v6].vWorldViewProjX; 1194 memcpy(&pArray[left_sort_index], &pArray[right_sort_index], sizeof(pArray[left_sort_index]));
1195 do 1195 memcpy(&pArray[right_sort_index], &temp_array, sizeof(pArray[right_sort_index]));
1196 { 1196 }
1197 v8 += 48; 1197 memcpy(&temp_array, &pArray[left_sort_index], sizeof(temp_array));
1198 ++v6; 1198 memcpy(&pArray[left_sort_index], &pArray[end], sizeof(pArray[left_sort_index]));
1199 } 1199 memcpy(&pArray[end], &temp_array, sizeof(pArray[end]));
1200 while ( *(float *)v8 < v12.vWorldViewProjX); 1200 Vis::SortByScreenSpaceX(pArray, start, left_sort_index - 1);
1201 v9 = (int)&v5[i].vWorldViewProjX; 1201 Vis::SortByScreenSpaceX(pArray, left_sort_index + 1, end);
1202 do 1202 }
1203 {
1204 v9 -= 48;
1205 --i;
1206 }
1207 while ( *(float *)v9 > v12.vWorldViewProjX);
1208 v14 = i;
1209 if ( v6 >= i )
1210 break;
1211 v10 = &v5[i];
1212 memcpy(&v11, &pArray[v6], sizeof(v11));
1213 v5 = pArray;
1214 memcpy(&pArray[v6], v10, sizeof(pArray[v6]));
1215 memcpy((void *)v10, &v11, sizeof(0x30u));
1216 }
1217 memcpy(&v11, &v5[v6], sizeof(v11));
1218 memcpy(&v5[v6], v16, sizeof(v5[v6]));
1219 memcpy((void *)v16, &v11, sizeof(0x30u));
1220 SortByScreenSpaceX(v5, sLeft, v6 - 1);
1221 SortByScreenSpaceX(pArray, v6 + 1, sRight);
1222 return true;
1223 } 1203 }
1224 1204
1225 //----- (004C297E) -------------------------------------------------------- 1205 //----- (004C297E) --------------------------------------------------------
1226 bool Vis::SortByScreenSpaceY(RenderVertexSoft *pArray, int sLeft, int sRight) 1206 void Vis::SortByScreenSpaceY(RenderVertexSoft *pArray, int start, int end)
1227 { 1207 {
1228 //bool result; // eax@1 1208 int left_sort_index; // ebx@2
1229 RenderVertexSoft *v5; // edx@2 1209 int right_sort_index; // ecx@2
1230 int v6; // ebx@2 1210 RenderVertexSoft temp_array; // [sp+4h] [bp-6Ch]@8
1231 int i; // ecx@2 1211 RenderVertexSoft max_array; // [sp+34h] [bp-3Ch]@2
1232 int v8; // esi@3 1212 int v12; // [sp+64h] [bp-Ch]@7
1233 int v9; // esi@5 1213
1234 //RenderVertexSoft *v10; // eax@8 1214 if ( end > start )
1235 const void *v10; 1215 {
1236 //char v11; // [sp+4h] [bp-6Ch]@8 1216 left_sort_index = start - 1;
1237 RenderVertexSoft v11; 1217 memcpy(&max_array, &pArray[end], sizeof(max_array));
1238 RenderVertexSoft v12; // [sp+34h] [bp-3Ch]@2 1218 for ( right_sort_index = end; ; right_sort_index = v12 )
1239 //float v13; // [sp+50h] [bp-20h]@4 1219 {
1240 int v14; // [sp+64h] [bp-Ch]@7 1220 do
1241 //Vis *thisa; // [sp+68h] [bp-8h]@1 1221 {
1242 RenderVertexSoft *v16; // [sp+6Ch] [bp-4h]@2 1222 ++left_sort_index;
1243 1223 }
1244 if (sRight <= sLeft) 1224 while ( pArray[left_sort_index].vWorldViewProjY < (double)max_array.vWorldViewProjY );
1245 return true; 1225 do
1246 v5 = pArray; 1226 {
1247 v16 = &pArray[sRight]; 1227 --right_sort_index;
1248 v6 = sLeft - 1; 1228 }
1249 memcpy(&v12, &pArray[sRight], sizeof(v12)); 1229 while ( pArray[right_sort_index].vWorldViewProjY > (double)max_array.vWorldViewProjY );
1250 for ( i = sRight; ; i = v14 ) 1230 v12 = right_sort_index;
1251 { 1231 if ( left_sort_index >= right_sort_index )
1252 v8 = (int)&v5[v6].vWorldViewProjY; 1232 break;
1253 do 1233 memcpy(&temp_array, &pArray[left_sort_index], sizeof(temp_array));
1254 { 1234 memcpy(&pArray[left_sort_index], &pArray[right_sort_index], sizeof(pArray[left_sort_index]));
1255 v8 += 48; 1235 memcpy(&pArray[right_sort_index], &temp_array, sizeof(pArray[right_sort_index]));
1256 ++v6; 1236 }
1257 } 1237 memcpy(&temp_array, &pArray[left_sort_index], sizeof(temp_array));
1258 while ( *(float *)v8 < v12.vWorldViewProjY); 1238 memcpy(&pArray[left_sort_index], &pArray[end], sizeof(pArray[left_sort_index]));
1259 v9 = (int)&v5[v6].vWorldViewProjY; 1239 memcpy(&pArray[end], &temp_array, sizeof(pArray[end]));
1260 do 1240 Vis::SortByScreenSpaceY(pArray, start, left_sort_index - 1);
1261 { 1241 Vis::SortByScreenSpaceY(pArray, left_sort_index + 1, end);
1262 v9 -= 48; 1242 }
1263 --i;
1264 }
1265 while ( *(float *)v9 > v12.vWorldViewProjY);
1266 v14 = i;
1267 if ( v6 >= i )
1268 break;
1269 v10 = &v5[i];
1270 memcpy(&v11, &pArray[v6], sizeof(0x30));
1271 v5 = pArray;
1272 memcpy(&pArray[v6], v10, sizeof(pArray[v6]));
1273 memcpy((void *)v10, &v11, sizeof(0x30));
1274 }
1275 memcpy(&v11, &v5[v6], sizeof(0x30));
1276 memcpy(&v5[v6], v16, sizeof(v5[v6]));
1277 memcpy((void *)v16, &v11, sizeof(0x30));
1278 SortByScreenSpaceY(v5, sLeft, v6 - 1);
1279 SortByScreenSpaceY(pArray, v6 + 1, sRight);
1280 return true;
1281 } 1243 }
1282 1244
1283 //----- (004C04AF) -------------------------------------------------------- 1245 //----- (004C04AF) --------------------------------------------------------
1284 Vis::Vis() 1246 Vis::Vis()
1285 { 1247 {