annotate Vis.h @ 1250:c515e406df4a

aWinProc cleanup - removing unused vars, unnesting conditions, removeing a few DefWindowProcA calls
author Grumpy7
date Mon, 10 Jun 2013 04:16:49 +0200
parents f947bedb2859
children 65d301bce717
rev   line source
0
Ritor1
parents:
diff changeset
1 #pragma once
Ritor1
parents:
diff changeset
2 #include "Render.h"
Ritor1
parents:
diff changeset
3
Ritor1
parents:
diff changeset
4
Ritor1
parents:
diff changeset
5
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
6 enum VisObjectType: unsigned __int32
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
7 {
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
8 VisObjectType_Any = 0,
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
9 VisObjectType_Sprite = 1,
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
10 VisObjectType_Face = 2
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
11 };
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
12
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
13 /* 150 */
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
14 #pragma pack(push, 1)
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
15 struct Vis_SelectionFilter //stru157
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
16 {
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
17 VisObjectType object_type;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
18 int object_id; // OBJECT_Actor, OBJECT_Player etc
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
19 int field_8;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
20 int field_C;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
21 int field_10;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
22 };
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
23 #pragma pack(pop)
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
24 extern Vis_SelectionFilter vis_sprite_filter_1; // 00F93E1C
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
25 extern Vis_SelectionFilter vis_sprite_filter_2; // 00F93E30
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
26 extern Vis_SelectionFilter vis_face_filter; // 00F93E44
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
27 extern Vis_SelectionFilter vis_door_filter; // 00F93E58
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
28 extern Vis_SelectionFilter vis_sprite_filter_3; // 00F93E6C
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
29 extern Vis_SelectionFilter vis_sprite_filter_4; // static to sub_44EEA7
0
Ritor1
parents:
diff changeset
30
Ritor1
parents:
diff changeset
31
Ritor1
parents:
diff changeset
32
Ritor1
parents:
diff changeset
33 #pragma pack(push, 1)
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
34 struct Vis_ObjectInfo
0
Ritor1
parents:
diff changeset
35 {
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
36 void *object;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
37 union
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
38 {
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
39 int sZValue;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
40 struct
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
41 {
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
42 unsigned __int16 object_pid;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
43 signed __int16 actual_z;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
44 };
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
45 };
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
46 VisObjectType object_type;
0
Ritor1
parents:
diff changeset
47 };
Ritor1
parents:
diff changeset
48 #pragma pack(pop)
Ritor1
parents:
diff changeset
49
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
50
0
Ritor1
parents:
diff changeset
51 #pragma pack(push, 1)
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
52 struct Vis_SelectionList
0
Ritor1
parents:
diff changeset
53 {
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
54 enum PointerCreationType
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
55 {
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
56 All = 0,
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
57 Unique = 1
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
58 };
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
59
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
60 Vis_SelectionList();
0
Ritor1
parents:
diff changeset
61 //----- (004C0585) --------------------------------------------------------
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
62 ~Vis_SelectionList() {}
1137
Ritor1
parents: 1050
diff changeset
63 Vis_ObjectInfo *SelectionPointers(int a2, int a3);
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
64 void create_object_pointers(PointerCreationType type = All);
0
Ritor1
parents:
diff changeset
65
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
66 inline void AddObject(void *object, VisObjectType type, int packed_zval)
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
67 {
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
68 object_pool[uNumPointers].object = object;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
69 object_pool[uNumPointers].object_type = type;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
70 object_pool[uNumPointers++].sZValue = packed_zval;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
71 }
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
72
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
73 void (__thiscall ***vdestructor_ptr)(Vis_SelectionList *, bool);
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
74 Vis_ObjectInfo object_pool[512];
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
75 Vis_ObjectInfo *object_pointers[512];
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
76 unsigned int uNumPointers;
0
Ritor1
parents:
diff changeset
77 };
Ritor1
parents:
diff changeset
78 #pragma pack(pop)
Ritor1
parents:
diff changeset
79
Ritor1
parents:
diff changeset
80
Ritor1
parents:
diff changeset
81
Ritor1
parents:
diff changeset
82 /* 116 */
Ritor1
parents:
diff changeset
83 #pragma pack(push, 1)
1103
db395ce89ede struct/class incostintency
Grumpy7
parents: 1050
diff changeset
84 class Vis
0
Ritor1
parents:
diff changeset
85 {
1103
db395ce89ede struct/class incostintency
Grumpy7
parents: 1050
diff changeset
86 public:
0
Ritor1
parents:
diff changeset
87 Vis();
Ritor1
parents:
diff changeset
88 //----- (004C05A2) --------------------------------------------------------
Ritor1
parents:
diff changeset
89 //virtual ~Vis() {}
Ritor1
parents:
diff changeset
90 //----- (004C05BE) --------------------------------------------------------
522
61343380715b Origianl structures integrity test added
Nomad
parents: 323
diff changeset
91 virtual ~Vis() {}
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
92 bool PickKeyboard(Vis_SelectionList *list, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter);
196
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
93 void PickBillboards_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter);
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
94 void PickIndoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter);
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
95 void PickOutdoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter);
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
96
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
97 bool PickMouse(float fDepth, float fMouseX, float fMouseY, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter);
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
98 void PickBillboards_Mouse(float fPickDepth, float fX, float fY, Vis_SelectionList *list, Vis_SelectionFilter *filter);
196
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
99 void PickIndoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 295
diff changeset
100 void PickOutdoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter, bool only_reachable);
196
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
101
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
102 bool is_part_of_selection(void *uD3DBillboardIdx_or_pBLVFace_or_pODMFace, Vis_SelectionFilter *filter);
0
Ritor1
parents:
diff changeset
103 bool DoesRayIntersectBillboard(float fDepth, unsigned int uD3DBillboardIdx);
916
897b10712a1a UIShop_Buy_Identify_Repair little clean and rename
Ritor1
parents: 522
diff changeset
104 Vis_ObjectInfo *DetermineFacetIntersection(struct BLVFace *face, unsigned int a3, float pick_depth);
196
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
105 bool IsPolygonOccludedByBillboard(struct RenderVertexSoft *vertices, int num_vertices, float x, float y);
0
Ritor1
parents:
diff changeset
106 void GetPolygonCenter(struct RenderVertexD3D3 *pVertices, unsigned int uNumVertices, float *pCenterX, float *pCenterY);
196
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
107 void GetPolygonScreenSpaceCenter(struct RenderVertexSoft *vertices, int num_vertices, float *out_center_x, float *out_center_y);
0
Ritor1
parents:
diff changeset
108 bool IsPointInsideD3DBillboard(struct RenderBillboardD3D *a1, float x, float y);
295
640a176c030f sub_42ECB5
Nomad
parents: 196
diff changeset
109 int PickClosestActor(int object_id, unsigned int pick_depth, int a4, int a5, int a6);
0
Ritor1
parents:
diff changeset
110 void _4C1A02();
Ritor1
parents:
diff changeset
111 bool SortVectors_x(RenderVertexSoft *a2, int a3, int a4);
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
112 int get_object_zbuf_val(Vis_ObjectInfo *info);
0
Ritor1
parents:
diff changeset
113 int get_picked_object_zbuf_val();
1025
8b492d4722d4 Intersection
Ritor1
parents: 916
diff changeset
114 bool Intersect_Ray_Face(struct RenderVertexSoft *pRayStart, struct RenderVertexSoft *pRayEnd, float *pDepth, RenderVertexSoft *Intersection, BLVFace *pFace, unsigned int pBModelID);
1050
4b329bf2d197 intersect_face_vertex_coords_list
Ritor1
parents: 1049
diff changeset
115 bool CheckIntersectBModel(BLVFace *pFace, Vec3_short_ IntersectPoint, unsigned int uModelID);
4b329bf2d197 intersect_face_vertex_coords_list
Ritor1
parents: 1049
diff changeset
116 void BLV_CreateIntersectFacesVertexCoordList(int *a, int *b, __int16 *intersect_face_vertex_coords_list_a, __int16 *intersect_face_vertex_coords_list_b, Vec3_short_ *IntersectPoint, BLVFace *pFace);
4b329bf2d197 intersect_face_vertex_coords_list
Ritor1
parents: 1049
diff changeset
117 void ODM_CreateIntersectFacesVertexCoordList(int *a, int *b, __int16 *intersect_face_vertex_coords_list_a, __int16 *intersect_face_vertex_coords_list_b, Vec3_short_ *IntersectPoint, BLVFace *pFace, unsigned int uModelID);
0
Ritor1
parents:
diff changeset
118 void CastPickRay(RenderVertexSoft *pRay, float fMouseX, float fMouseY, float fPickDepth);
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
119 void sort_object_pointers(Vis_ObjectInfo **pPointers, int left, int right);
0
Ritor1
parents:
diff changeset
120 bool SortVerticesByX(struct RenderVertexD3D3 *a2, unsigned int uStart, unsigned int uEnd);
Ritor1
parents:
diff changeset
121 bool SortVerticesByY(struct RenderVertexD3D3 *a2, unsigned int uStart, unsigned int uEnd);
196
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
122 bool SortByScreenSpaceX(struct RenderVertexSoft *pArray, int sLeft, int sRight);
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
123 bool SortByScreenSpaceY(struct RenderVertexSoft *pArray, int sLeft, int sRight);
0
Ritor1
parents:
diff changeset
124
522
61343380715b Origianl structures integrity test added
Nomad
parents: 323
diff changeset
125 //void (__thiscall ***vdestructor_ptr)(Vis *, bool);
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
126 Vis_SelectionList default_list;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
127 RenderVertexSoft stru_200C;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
128 RenderVertexSoft stru_203C;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
129 RenderVertexSoft stru_206C;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 123
diff changeset
130 RenderVertexSoft stru_209C;
196
982c1ec5a983 More picking stuff
Nomad
parents: 194
diff changeset
131 int keyboard_pick_depth;
0
Ritor1
parents:
diff changeset
132 };
Ritor1
parents:
diff changeset
133 #pragma pack(pop)