forked from perilouswithadollarsign/cstrike15_src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstocksolids.h
153 lines (106 loc) · 2.79 KB
/
stocksolids.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
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef STOCKSOLIDS_H
#define STOCKSOLIDS_H
#ifdef _WIN32
#pragma once
#endif
#pragma warning(push, 1)
#pragma warning(disable:4701 4702 4530)
#include <fstream>
#pragma warning(pop)
#include "mathlib/vector.h"
#include "MapFace.h"
class BoundBox;
class CMapSolid;
class Vector;
class StockSolid
{
public:
void Serialize(std::fstream& file, BOOL bIsStoring);
int GetFieldCount() const;
void SetFieldData(int iIndex, int iData);
int GetFieldData(int iIndex, int *piData = NULL) const;
void GetFieldRange(int iIndex, int *piRangeLower, int *piRangeUpper);
void SetOrigin(const Vector &o);
void SetCenterOffset(const Vector &ofs);
virtual void SetFromBox(BoundBox * pBox) {}
virtual void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eAlignment) = 0;
~StockSolid();
protected:
StockSolid(int nFields);
typedef enum
{
DFTYPE_INTEGER,
DFTYPE_BOOLEAN
} STSDF_TYPE;
void AddDataField(STSDF_TYPE type, const char *pszName, int iRangeLower = -1,
int iRangeUpper = -1);
Vector origin;
Vector cofs;
private:
void AllocateDataFields(int nFields);
enum
{
DFFLAG_RANGED = 0x01
};
typedef struct
{
unsigned flags;
STSDF_TYPE type;
char szName[128];
// range:
int iRangeLower;
int iRangeUpper;
// value:
int iValue;
} STSDATAFIELD;
STSDATAFIELD *pFields;
int nFields;
int iMaxFields;
};
class StockBlock : public StockSolid
{
public:
StockBlock();
void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eTextureAlignment);
void SetFromBox(BoundBox *pBox);
enum { fieldWidth, fieldDepth, fieldHeight };
};
class StockWedge : public StockSolid
{
public:
StockWedge();
void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eTextureAlignment);
void SetFromBox(BoundBox *pBox);
enum { fieldWidth, fieldDepth, fieldHeight };
};
class StockCylinder : public StockSolid
{
public:
StockCylinder();
void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eTextureAlignment);
void SetFromBox(BoundBox *pBox);
enum { fieldWidth, fieldDepth, fieldHeight, fieldSideCount };
};
class StockSpike : public StockSolid
{
public:
StockSpike();
void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eTextureAlignment);
void SetFromBox(BoundBox *pBox);
enum { fieldWidth, fieldDepth, fieldHeight, fieldSideCount };
};
class StockSphere : public StockSolid
{
public:
StockSphere();
void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eTextureAlignment);
void SetFromBox(BoundBox *pBox);
enum { fieldWidth, fieldDepth, fieldHeight, fieldSideCount };
};
#endif // STOCKSOLIDS_H