-
Notifications
You must be signed in to change notification settings - Fork 7
/
BSPData.h
158 lines (119 loc) · 3.93 KB
/
BSPData.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#pragma once
#include "MathLib.h"
// #define COLLISION_ROUTINES
class CPolygon;
class CUIFucker;
class CSphere
{
public:
CSphere(const Vector& origin, float radius);
CSphere();
ULONG pack_size();
BOOL UnPack(BYTE** ppData, ULONG iSize);
BOOL intersects(CSphere* pSphere);
BOOL sphere_intersects_ray(const Ray& ray);
Vector m_origin;
float m_radius;
};
class CCylSphere
{
public:
CCylSphere();
ULONG pack_size();
BOOL UnPack(BYTE** ppData, ULONG iSize);
Vector m_origin;
float m_f0C;
float m_f10;
};
class CSolid
{
public:
CSolid(const Vector& Vec);
CSolid();
ULONG pack_size();
BOOL UnPack(BYTE** ppData, ULONG iSize);
// Alternatively, could utilize CVector class.
Vector m_Vec;
};
class CPortalPoly
{
public:
CPortalPoly();
~CPortalPoly();
BOOL UnPack(BYTE** ppData, ULONG iSize);
void Destroy();
long m_iWhat; //0x00
CPolygon* m_pPolygon; //0x04
};
class BSPNODE
{
public:
BSPNODE();
virtual ~BSPNODE(); //0x00
void Destroy();
static BOOL UnPackChild(BSPNODE** pOut, BYTE** ppData, ULONG iSize);
BOOL UnPack(BYTE** ppData, ULONG iSize);
// Draw routines
void draw_no_check();
void draw_check(DWORD unknown);
#ifdef COLLISION_ROUTINES
virtual bool sphere_intersects_poly(CSphere* pSphere, Vector*, CPolygon**, Vector*); // 0x04
virtual bool sphere_intersects_solid(CSphere* pSphere, BOOL); // 0x08
virtual bool point_intersects_solid(Vector* pPoint); // 0x0C
virtual bool sphere_intersects_solid_poly(CSphere* pSphere, float, BOOL*, CPolygon**, BOOL); // 0x10
virtual void find_walkable(void* ToBeDetermined, CSphere*, CPolygon**, Vector*, Vector*, BOOL*); // 0x14
virtual bool hits_walkable(void* ToBeDetermined, CSphere*, Vector*); // 0x18
#endif
BOOL point_inside_cell_bsp(const Vector& point);
CSphere m_bounds; //0x04 (size: 0x10)
Plane m_plane; //0x14 (size: 0x10)
DWORD m_NodeType; //0x24
DWORD m_iTriangleCount; //0x28
CPolygon** m_pTriangles; //0x2C
BSPNODE* m_pChild30;
BSPNODE* m_pChild34;
static DWORD pack_tree_type;
static CPolygon* pack_poly;
};
class BSPLEAF : public BSPNODE
{
public:
BSPLEAF();
virtual ~BSPLEAF();
BOOL UnPackLeaf(BYTE** ppData, ULONG iSize);
#ifdef COLLISION_ROUTINES
virtual bool sphere_intersects_poly(CSphere* pSphere, Vector*, CPolygon**, Vector*); // 0x04
virtual bool sphere_intersects_solid(CSphere* pSphere, BOOL); // 0x08
virtual bool point_intersects_solid(Vector* pPoint); // 0x0C
virtual bool sphere_intersects_solid_poly(CSphere* pSphere, float, BOOL*, CPolygon**, BOOL); // 0x10
virtual void find_walkable(CUIFucker* ToBeDetermined, CSphere*, CPolygon**, Vector*, Vector*, BOOL*); // 0x14
virtual bool hits_walkable(CUIFucker* ToBeDetermined, CSphere*, Vector*); // 0x18
#endif
DWORD m_dwLeaf38; //0x38
DWORD m_dwLeaf3C; //0x3C
};
class BSPPORTAL : public BSPNODE
{
public:
BSPPORTAL();
virtual ~BSPPORTAL();
void Destroy();
BOOL UnPackPortal(BYTE** ppData, ULONG iSize);
DWORD m_dwPolyCount; //0x38
CPortalPoly** m_pPortalPoly; //0x3C
};
class BSPTREE // size: 0x04
{
public:
BSPTREE();
virtual ~BSPTREE();
void Destroy();
BOOL UnPack(BYTE** ppData, ULONG iSize);
CSphere *GetSphere();
// Draw routines
void draw_no_check();
// Cell routines
BOOL point_inside_cell_bsp(const Vector& point);
private:
BSPNODE* m_pHead;
};