Nuclide
Software Development Kit for id Technology
propdata.h
1/*
2 * Copyright (c) 2016-2022 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
168var string g_curPropData;
169
171{
172 PDFL_BLOCKLOS, /* Does this block an AIs light of sight? */
173 PDFL_AIWALKABLE, /* can AI walk on this? */
174 PDFL_ALLOWSTATIC /* static simulation possible? */
175} propdataFlag_t;
176
177typedef struct
178{
180 int child;
181 float xmin;
182 float xmax;
184 float ymin;
185 float ymax;
187 float zmin;
188 float zmax;
191
192typedef struct
193{
194 int index;
195 string name;
196 string parent;
197 float mass;
199 float damping;
201 float inertia;
202 float volume;
204
206typedef struct
207{
208 string name;
209 string base;
210 float health; /* health until break */
211 propdataFlag_t flags;
212 float damage_bullets; /* dmg multipliers */
215 float explosive_damage; /* once the damage/radius keys are set, make explosion upon break */
217 string breakable_particle; /* name of BreakableModels entry in PropData.txt */
218 string breakable_model; /* name of BreakableModels entry in PropData.txt */
221 float mass;
224 float inertia;
225 float volume;
229 string doll;
230} propdata_t;
231
232/* entity will have to have a .propdata field pointing to a propdata id */
235var hashtable g_hashpropdata;
236
237/* necessary API functions */
238void PropData_Init(void);
239void PropData_Shutdown(void);
240
241int PropData_Load(string); /* called when we read entity data, returns -1 when not found */
242int PropData_ForModel(string); /* called when we set a model, returns -1 when not found */
243//int PropData_Read(string); /* this just handles the contents of a prop_data model string */
244
245void PropData_SetStage(string);
246int PropData_Finish(void);
247
248/* querying API */
249typedef enum
250{
261 /* physics related variables. */
270__variant Prop_GetInfo(int, int);
271
273typedef struct
274{
275 string name;
276 string data;
277 float modelindex; /* only used for networking */
278 bool physics; /* differentiate between Source and GS */
280
281/* entity will have a .breakmodel field pointing to a breakmodel id */
285var hashtable g_hashbreakmodel;
286
287
288#ifdef CLIENT
289void BreakModel_SpawnID(vector smins, vector smaxs, vector dir, float speed, int count, int index);
290void BreakModel_Receive(void);
292#else
293void BreakModel_Spawn(vector pos, vector dir, vector spread, float speed, int count, string type);
294void BreakModel_Entity(NSSurfacePropEntity target, vector dir, float speed);
295void BreakModel_SendClientData(entity);
296#endif
297
298 // end of propdata
300
301/* necessary API functions */
302//void BreakModel_Init(void);
303//void BreakModel_Shutdown(void);
304
305//int BreakModel_Load(string); /* called when we precache a model, returns -1 when not found */
306//int BreakModel_Read(string); /* this just handles the contents of a prop_data model string */
This entity represents an NSRenderableEntity with interactive surface properties.
Definition: NSSurfacePropEntity.h:52
void PropData_SetStage(string)
Definition: propdata.qc:850
void BreakModel_SpawnID(vector smins, vector smaxs, vector dir, float speed, int count, int index)
Definition: propdata.qc:872
var hashtable g_hashbreakmodel
Definition: propdata.h:285
breakModel_t * g_breakmodel
Definition: propdata.h:282
propinfo_t
Definition: propdata.h:250
void BreakModel_Receive(void)
Definition: propdata.qc:1009
int PropData_Finish(void)
Definition: propdata.qc:856
int PropData_Load(string)
Definition: propdata.qc:603
var string g_curPropData
Definition: propdata.h:168
var hashtable g_hashpropdata
Definition: propdata.h:235
void PropData_Init(void)
Definition: propdata.qc:736
void PropData_Shutdown(void)
Definition: propdata.qc:84
int g_propdata_count
Definition: propdata.h:234
propdata_t * g_propdata
Definition: propdata.h:233
__variant Prop_GetInfo(int, int)
Definition: propdata.qc:100
int PropData_ForModel(string)
Definition: propdata.qc:394
int g_breakmodel_count
Definition: propdata.h:283
void BreakModel_ReceiveClientData(void)
Definition: propdata.qc:1044
int g_breakmodel_end
Definition: propdata.h:284
typedef enumflags
Definition: propdata.h:171
@ PROPINFO_DMG_BULLET
Definition: propdata.h:253
@ PROPINFO_DAMPING_LINEAR
Definition: propdata.h:263
@ PROPINFO_EXPLOSIVE_RADIUS
Definition: propdata.h:257
@ PROPINFO_DOLL
Definition: propdata.h:268
@ PROPINFO_VOLUME
Definition: propdata.h:266
@ PROPINFO_INERTIA
Definition: propdata.h:265
@ PROPINFO_BREAKMODEL
Definition: propdata.h:258
@ PROPINFO_DAMPING_ANGULAR
Definition: propdata.h:264
@ PROPINFO_EXPLOSIVE_DMG
Definition: propdata.h:256
@ PROPINFO_DMG_MELEE
Definition: propdata.h:254
@ PROPINFO_FLAGS
Definition: propdata.h:252
@ PROPINFO_SKIN
Definition: propdata.h:260
@ PROPINFO_SURFACEPROP
Definition: propdata.h:267
@ PROPINFO_HEALTH
Definition: propdata.h:251
@ PROPINFO_DMG_EXPLOSIVE
Definition: propdata.h:255
@ PROPINFO_BREAKCOUNT
Definition: propdata.h:259
@ PROPINFO_MASS
Definition: propdata.h:262
Data holding BreakModel entries.
Definition: propdata.h:274
string name
Definition: propdata.h:275
float modelindex
Definition: propdata.h:277
string data
Definition: propdata.h:276
bool physics
Definition: propdata.h:278
Definition: propdata.h:178
float zmax
Definition: propdata.h:188
int parent
Definition: propdata.h:179
float zmin
Definition: propdata.h:187
float xfriction
Definition: propdata.h:183
float ymax
Definition: propdata.h:185
float xmin
Definition: propdata.h:181
float zfriction
Definition: propdata.h:189
float xmax
Definition: propdata.h:182
float yfriction
Definition: propdata.h:186
float ymin
Definition: propdata.h:184
int child
Definition: propdata.h:180
Definition: propdata.h:193
string parent
Definition: propdata.h:196
string surfaceprop
Definition: propdata.h:198
string name
Definition: propdata.h:195
float volume
Definition: propdata.h:202
float inertia
Definition: propdata.h:201
int index
Definition: propdata.h:194
float damping
Definition: propdata.h:199
float rotdamping
Definition: propdata.h:200
float mass
Definition: propdata.h:197
Data holding PropData entries.
Definition: propdata.h:207
float damping_linear
Definition: propdata.h:222
int solids
Definition: propdata.h:227
float volume
Definition: propdata.h:225
string surfaceprop
Definition: propdata.h:226
float mass
Definition: propdata.h:221
float damage_explosive
Definition: propdata.h:214
propdataFlag_t flags
Definition: propdata.h:211
string breakable_model
Definition: propdata.h:218
float health
Definition: propdata.h:210
float damage_bullets
Definition: propdata.h:212
float breakable_skin
Definition: propdata.h:220
string breakable_particle
Definition: propdata.h:217
float explosive_radius
Definition: propdata.h:216
float damage_melee
Definition: propdata.h:213
propdata_solids_t * solidInfo
Definition: propdata.h:228
float damping_angular
Definition: propdata.h:223
string doll
Definition: propdata.h:229
float explosive_damage
Definition: propdata.h:215
string base
Definition: propdata.h:209
int breakable_count
Definition: propdata.h:219
float inertia
Definition: propdata.h:224
string name
Definition: propdata.h:208