comparison Vis.cpp @ 828:0f56abdcce94

Massive refactors of spells + PID (packed id) macros introduced.
author Nomad
date Wed, 27 Mar 2013 00:27:38 +0200
parents bd611ae85d27
children ceef50611567 06fc66ceecd6
comparison
equal deleted inserted replaced
824:fe4c8b113548 828:0f56abdcce94
7 #include "IndoorCamera.h" 7 #include "IndoorCamera.h"
8 #include "Viewport.h" 8 #include "Viewport.h"
9 #include "Log.h" 9 #include "Log.h"
10 10
11 #include "mm7_data.h" 11 #include "mm7_data.h"
12 //#include "MM7.h" 12 #include "MM7.h"
13 13
14 14
15 static Vis_SelectionList Vis_static_sub_4C1944_stru_F8BDE8; 15 static Vis_SelectionList Vis_static_sub_4C1944_stru_F8BDE8;
16 16
17 Vis_SelectionFilter vis_sprite_filter_1 = {VisObjectType_Sprite, OBJECT_Decoration, 0, 0, 2}; // 00F93E1C 17 Vis_SelectionFilter vis_sprite_filter_1 = {VisObjectType_Sprite, OBJECT_Decoration, 0, 0, 2}; // 00F93E1C
375 RenderVertexSoft intersection; 375 RenderVertexSoft intersection;
376 if (Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &intersection, &blv_face, i)) 376 if (Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &intersection, &blv_face, i))
377 { 377 {
378 pGame->pIndoorCameraD3D->ViewTransform(&intersection, 1u); 378 pGame->pIndoorCameraD3D->ViewTransform(&intersection, 1u);
379 int v13 = _48B561_mess_with_scaling_along_z(/*v12, */intersection.vWorldViewPosition.x); 379 int v13 = _48B561_mess_with_scaling_along_z(/*v12, */intersection.vWorldViewPosition.x);
380 v13 += (8 * (j | (i << 6)) | OBJECT_BModel); 380 v13 += PID(OBJECT_BModel, j | (i << 6));
381 381
382 list->AddObject(face, VisObjectType_Face, v13); 382 list->AddObject(face, VisObjectType_Face, v13);
383 } 383 }
384 384
385 if (blv_face.uAttributes & 0x80000000) 385 if (blv_face.uAttributes & 0x80000000)
1800 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)
1801 { 1801 {
1802 int result; // eax@1 1802 int result; // eax@1
1803 signed int pFaceID; // esi@2 1803 signed int pFaceID; // esi@2
1804 BLVFace *pFace; // edi@4 1804 BLVFace *pFace; // edi@4
1805 unsigned int v7; // eax@6 1805 //unsigned int v7; // eax@6
1806 Vis_ObjectInfo *v8; // eax@6 1806 Vis_ObjectInfo *v8; // eax@6
1807 signed int i; // [sp+18h] [bp-8h]@1 1807 signed int i; // [sp+18h] [bp-8h]@1
1808 1808
1809 result = 0; 1809 result = 0;
1810 for ( i = 0; i < (signed int)pBspRenderer->num_faces; ++i ) 1810 for ( i = 0; i < (signed int)pBspRenderer->num_faces; ++i )
1817 pFace = &pIndoor->pFaces[pFaceID]; 1817 pFace = &pIndoor->pFaces[pFaceID];
1818 if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) ) 1818 if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) )
1819 { 1819 {
1820 if ( is_part_of_selection(pFace, filter) ) 1820 if ( is_part_of_selection(pFace, filter) )
1821 { 1821 {
1822 v7 = 8 * pFaceID; 1822 v8 = _4C1026(pFace, PID(OBJECT_BModel, pFaceID), pick_depth);
1823 LOBYTE(v7) = 8 * pFaceID | OBJECT_BModel;
1824 v8 = _4C1026(pFace, v7, pick_depth);
1825 if ( v8 ) 1823 if ( v8 )
1826 list->AddObject(v8->object, v8->object_type, v8->sZValue); 1824 list->AddObject(v8->object, v8->object_type, v8->sZValue);
1827 } 1825 }
1828 } 1826 }
1829 } 1827 }
1851 if (is_part_of_selection(face, filter) ) 1849 if (is_part_of_selection(face, filter) )
1852 { 1850 {
1853 BLVFace blv_face; 1851 BLVFace blv_face;
1854 blv_face.FromODM(face); 1852 blv_face.FromODM(face);
1855 1853
1856 int pid = 8 * (j | (i << 6)) | OBJECT_BModel; 1854 int pid = PID(OBJECT_BModel, j | (i << 6));
1857 if (auto object_info = _4C1026(&blv_face, pid, pick_depth)) 1855 if (auto object_info = _4C1026(&blv_face, pid, pick_depth))
1858 list->AddObject(object_info->object, object_info->object_type, object_info->sZValue); 1856 list->AddObject(object_info->object, object_info->object_type, object_info->sZValue);
1859 } 1857 }
1860 } 1858 }
1861 } 1859 }