Mercurial > mm7
comparison Vis.cpp @ 742:bd611ae85d27
PickItemInBlv
author | Ritor1 |
---|---|
date | Fri, 22 Mar 2013 23:41:47 +0600 |
parents | 066e2b29b30f |
children | 0f56abdcce94 |
comparison
equal
deleted
inserted
replaced
741:cd9ae9a2c99c | 742:bd611ae85d27 |
---|---|
26 //----- (004C1026) -------------------------------------------------------- | 26 //----- (004C1026) -------------------------------------------------------- |
27 Vis_ObjectInfo *Vis::_4C1026(BLVFace *face, unsigned int a3, float pick_depth) | 27 Vis_ObjectInfo *Vis::_4C1026(BLVFace *face, unsigned int a3, float pick_depth) |
28 { | 28 { |
29 char *v4; // eax@4 | 29 char *v4; // eax@4 |
30 signed int v5; // ecx@4 | 30 signed int v5; // ecx@4 |
31 //BLVFace *v6; // ecx@7 | |
32 //unsigned int v7; // edi@7 | |
33 Vec3_short_ *v8; // eax@9 | |
34 char *v9; // edx@9 | |
35 signed int v10; // esi@10 | |
36 //Vec3_int_ **v11; // edx@13 | |
37 //char *v12; // eax@13 | |
38 //double v13; // st7@14 | |
39 //signed int v14; // ebx@14 | |
40 //Vis *v15; // ebx@15 | |
41 //Vis_ObjectInfo *result; // eax@21 | |
42 //Vis_ObjectInfo *v17; // ecx@24 | |
43 RenderVertexSoft pRay[2]; // [sp+20h] [bp-70h]@17 | 31 RenderVertexSoft pRay[2]; // [sp+20h] [bp-70h]@17 |
44 int v20; // [sp+84h] [bp-Ch]@10 | 32 int v20; // [sp+84h] [bp-Ch]@10 |
45 //int v21; // [sp+88h] [bp-8h]@16 | |
46 //int v22; // [sp+8Ch] [bp-4h]@16 | |
47 signed int v23; // [sp+98h] [bp+8h]@7 | |
48 | |
49 //auto ecx0 = this; | |
50 | 33 |
51 static Vis_SelectionList static_sub_4C1026_stru_F8FE00; | 34 static Vis_SelectionList static_sub_4C1026_stru_F8FE00; |
52 static_sub_4C1026_stru_F8FE00.uNumPointers = 0; | 35 static_sub_4C1026_stru_F8FE00.uNumPointers = 0; |
53 | 36 |
54 static bool _init_flag = false; | 37 static bool _init_flag = false; |
58 _init_flag = true; | 41 _init_flag = true; |
59 for (uint i = 0; i < 64; ++i) | 42 for (uint i = 0; i < 64; ++i) |
60 static_sub_4C1026_array_F8F200[i].flt_2C = 0.0f; | 43 static_sub_4C1026_array_F8F200[i].flt_2C = 0.0f; |
61 } | 44 } |
62 | 45 |
63 //v6 = a2; | |
64 v23 = 0; | |
65 //v7 = face->uNumVertices; | |
66 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | 46 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
67 { | 47 { |
68 __debugbreak(); // refactor for BLV picking | |
69 if ( (signed int)face->uNumVertices > 0 ) | 48 if ( (signed int)face->uNumVertices > 0 ) |
70 { | 49 { |
71 v8 = pIndoor->pVertices; | 50 for ( int i = 0; i < face->uNumVertices; i++) |
72 v9 = (char *)&static_sub_4C1026_array_F8F200[0].vWorldPosition.y; | 51 { |
73 do | 52 static_sub_4C1026_array_F8F200[i].vWorldPosition.x = (double)pIndoor->pVertices[face->pVertexIDs[i]].x; |
74 { | 53 static_sub_4C1026_array_F8F200[i].vWorldPosition.y = (double)pIndoor->pVertices[face->pVertexIDs[i]].y; |
75 v10 = v23++; | 54 static_sub_4C1026_array_F8F200[i].vWorldPosition.z = (double)pIndoor->pVertices[face->pVertexIDs[i]].z; |
76 v20 = v8[face->pVertexIDs[v10]].x; | 55 } |
77 *((float *)v9 - 1) = (double)v20; | |
78 v20 = v8[face->pVertexIDs[v10]].y; | |
79 *(float *)v9 = (double)v20; | |
80 v9 += 48; | |
81 v20 = v8[face->pVertexIDs[v10]].z; | |
82 *((float *)v9 - 11) = (double)v20; | |
83 } | |
84 while ( v23 < (signed int)face->uNumVertices ); | |
85 } | 56 } |
86 } | 57 } |
87 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | 58 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
88 { | 59 { |
89 uint bmodel_id = a3 >> 9; | 60 uint bmodel_id = a3 >> 9; |
327 | 298 |
328 //----- (004C16B4) -------------------------------------------------------- | 299 //----- (004C16B4) -------------------------------------------------------- |
329 void Vis::PickIndoorFaces_Mouse(float fDepth, RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter) | 300 void Vis::PickIndoorFaces_Mouse(float fDepth, RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter) |
330 { | 301 { |
331 int v5; // eax@1 | 302 int v5; // eax@1 |
332 signed int v6; // edi@2 | 303 signed int pFaceID; // edi@2 |
333 signed int v7; // esi@4 | |
334 int v8; // ecx@7 | 304 int v8; // ecx@7 |
335 int v9; // eax@7 | 305 int v9; // eax@7 |
336 unsigned int *pNumPointers; // eax@7 | 306 unsigned int *pNumPointers; // eax@7 |
337 unsigned int v11; // ecx@7 | 307 unsigned int v11; // ecx@7 |
338 Vis_ObjectInfo *v12; // edi@7 | 308 Vis_ObjectInfo *v12; // edi@7 |
339 RenderVertexSoft a1; // [sp+Ch] [bp-44h]@1 | 309 RenderVertexSoft a1; // [sp+Ch] [bp-44h]@1 |
340 BLVFace *v14; // [sp+3Ch] [bp-14h]@7 | 310 BLVFace *pFace; // [sp+3Ch] [bp-14h]@7 |
341 void *v15; // [sp+40h] [bp-10h]@7 | 311 void *v15; // [sp+40h] [bp-10h]@7 |
342 int v16; // [sp+44h] [bp-Ch]@7 | |
343 int v17; // [sp+48h] [bp-8h]@1 | 312 int v17; // [sp+48h] [bp-8h]@1 |
344 Vis *thisa; // [sp+4Ch] [bp-4h]@1 | |
345 | |
346 | |
347 __debugbreak(); // refactor for BLV picking | |
348 | 313 |
349 v5 = 0; | 314 v5 = 0; |
350 thisa = this; | |
351 v17 = 0; | 315 v17 = 0; |
352 for ( a1.flt_2C = 0.0; v17 < (signed int)pBspRenderer->num_faces; ++v17 ) | 316 for ( a1.flt_2C = 0.0; v17 < (signed int)pBspRenderer->num_faces; ++v17 ) |
353 { | 317 { |
354 v6 = pBspRenderer->faces[v5].uFaceID; | 318 pFaceID = pBspRenderer->faces[v5].uFaceID; |
355 if ( v6 >= 0 ) | 319 if ( pFaceID >= 0 ) |
356 { | 320 { |
357 if ( v6 < (signed int)pIndoor->uNumFaces ) | 321 if ( pFaceID < (signed int)pIndoor->uNumFaces ) |
358 { | 322 { |
359 v7 = v6; | 323 if ( is_part_of_selection(&pIndoor->pFaces[pFaceID], filter) ) |
360 if ( is_part_of_selection(&pIndoor->pFaces[v6], filter) ) | |
361 { | 324 { |
362 if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[v7]) ) | 325 if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) ) |
363 { | 326 { |
364 if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[v7], 0xFFFFFFFFu) ) | 327 if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[pFaceID], 0xFFFFFFFFu) ) |
365 { | 328 { |
366 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1u); | 329 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1); |
367 v9 = _48B561_mess_with_scaling_along_z(/*v8, */a1.vWorldViewPosition.x); | 330 v9 = _48B561_mess_with_scaling_along_z(/*v8, */a1.vWorldViewPosition.x); |
368 LOWORD(v9) = 0; | 331 LOWORD(v9) = 0; |
369 v15 = (void *)((8 * v6 | 6) + v9); | 332 v15 = (void *)((8 * pFaceID | 6) + v9); |
370 pNumPointers = &list->uNumPointers; | 333 pNumPointers = &list->uNumPointers; |
371 v16 = 2; | 334 //v16 = 2; |
372 v11 = list->uNumPointers; | 335 //v11 = list->uNumPointers; |
373 v14 = &pIndoor->pFaces[v7]; | 336 pFace = &pIndoor->pFaces[pFaceID]; |
374 v12 = &list->object_pool[v11]; | 337 v12 = &list->object_pool[list->uNumPointers]; |
375 v12->object = &pIndoor->pFaces[v7]; | 338 v12->object = &pIndoor->pFaces[pFaceID]; |
376 v12 = (Vis_ObjectInfo *)((char *)v12 + 4); | 339 v12 = (Vis_ObjectInfo *)((char *)v12 + 4); |
377 v12->object = v15; | 340 v12->object = v15; |
378 v12->sZValue = v16; | 341 v12->sZValue = 2; |
379 ++*pNumPointers; | 342 ++*pNumPointers; |
380 } | 343 } |
381 } | 344 } |
382 } | 345 } |
383 } | 346 } |
1835 | 1798 |
1836 //----- (004C0D32) -------------------------------------------------------- | 1799 //----- (004C0D32) -------------------------------------------------------- |
1837 void Vis::PickIndoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter) | 1800 void Vis::PickIndoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter) |
1838 { | 1801 { |
1839 int result; // eax@1 | 1802 int result; // eax@1 |
1840 signed int v5; // esi@2 | 1803 signed int pFaceID; // esi@2 |
1841 BLVFace *v6; // edi@4 | 1804 BLVFace *pFace; // edi@4 |
1842 unsigned int v7; // eax@6 | 1805 unsigned int v7; // eax@6 |
1843 Vis_ObjectInfo *v8; // eax@6 | 1806 Vis_ObjectInfo *v8; // eax@6 |
1844 //int v9; // ST18_4@7 | |
1845 //unsigned int v10; // ST1C_4@7 | |
1846 //unsigned int v11; // ecx@7 | |
1847 signed int i; // [sp+18h] [bp-8h]@1 | 1807 signed int i; // [sp+18h] [bp-8h]@1 |
1848 Vis *thisa; // [sp+1Ch] [bp-4h]@1 | |
1849 | 1808 |
1850 result = 0; | 1809 result = 0; |
1851 thisa = this; | |
1852 for ( i = 0; i < (signed int)pBspRenderer->num_faces; ++i ) | 1810 for ( i = 0; i < (signed int)pBspRenderer->num_faces; ++i ) |
1853 { | 1811 { |
1854 v5 = pBspRenderer->faces[result].uFaceID; | 1812 pFaceID = pBspRenderer->faces[result].uFaceID; |
1855 if ( v5 >= 0 ) | 1813 if ( pFaceID >= 0 ) |
1856 { | 1814 { |
1857 if ( v5 < (signed int)pIndoor->uNumFaces ) | 1815 if ( pFaceID < (signed int)pIndoor->uNumFaces ) |
1858 { | 1816 { |
1859 v6 = &pIndoor->pFaces[v5]; | 1817 pFace = &pIndoor->pFaces[pFaceID]; |
1860 if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[v5]) ) | 1818 if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) ) |
1861 { | 1819 { |
1862 if ( is_part_of_selection(v6, filter) ) | 1820 if ( is_part_of_selection(pFace, filter) ) |
1863 { | 1821 { |
1864 v7 = 8 * v5; | 1822 v7 = 8 * pFaceID; |
1865 LOBYTE(v7) = 8 * v5 | OBJECT_BModel; | 1823 LOBYTE(v7) = 8 * pFaceID | OBJECT_BModel; |
1866 v8 = _4C1026(v6, v7, pick_depth); | 1824 v8 = _4C1026(pFace, v7, pick_depth); |
1867 if ( v8 ) | 1825 if ( v8 ) |
1868 list->AddObject(v8->object, v8->object_type, v8->sZValue); | 1826 list->AddObject(v8->object, v8->object_type, v8->sZValue); |
1869 } | 1827 } |
1870 } | 1828 } |
1871 } | 1829 } |