Nuclide
Software Development Kit for id Tech
propdata.h
Go to the documentation of this file.
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
17/*
18 Prop-Data specs
19
20 According to Source SDK's propdata.txt we've got
21 a kinda sorta hacky definition table for this stuff:
22
23 "PropData.txt"
24 {
25
26 "sometype"
27 {
28 // .. key/field attributes
29 // e.g.
30 "health" "10"
31 "breakable_model" "somematerial"
32 }
33
34 "BreakableModels"
35 {
36 // completely unrelated to types defined in propdata.txt
37 // but somehow still part of it?
38
39 "somematerial"
40 {
41 // model path / fadeout time pair
42 // e.g.
43 "foo.vvm" "2.5"
44
45 // but I also added
46 "foo.mdl#submodels=9" "5.0"
47 // where the # symbol notes that >9< submodels of the first
48 // submodel group will be chosen at random to represent 1 unit
49 // of the breakmodel collective
50 }
51 }
52 }
53
54 The idea is that props specify the type of prop they are ("sometype") and it defines
55 a set of sensible defaults.
56
57 However, props can override any parts of this inside the model data itself.
58 Currently no model format FTEQW supports allows for reading of said propdata.
59 However we'll be loading "foobar.vvm.propdata" to remedy this for those.
60*/
61
62var string g_curPropData;
63
64typedef enumflags
65{
66 PDFL_BLOCKLOS, /* Does this block an AIs light of sight? */
67 PDFL_AIWALKABLE, /* can AI walk on this? */
68 PDFL_ALLOWSTATIC /* static simulation possible? */
69} propdataFlag_t;
70
71typedef struct
72{
73 string name;
74 string base;
75 float health; /* health until break */
76 propdataFlag_t flags;
77 float damage_bullets; /* dmg multipliers */
80 float explosive_damage; /* once the damage/radius keys are set, make explosion upon break */
82 string breakable_particle; /* name of BreakableModels entry in PropData.txt */
83 string breakable_model; /* name of BreakableModels entry in PropData.txt */
86 float mass;
89 float inertia;
90 float volume;
93
94/* entity will have to have a .propdata field pointing to a propdata id */
98
99/* necessary API functions */
100void PropData_Init(void);
101void PropData_Shutdown(void);
102
103int PropData_Load(string); /* called when we read entity data, returns -1 when not found */
104int PropData_ForModel(string); /* called when we set a model, returns -1 when not found */
105//int PropData_Read(string); /* this just handles the contents of a prop_data model string */
106
107void PropData_SetStage(string);
108int PropData_Finish(void);
109
110/* querying API */
111typedef enum
112{
123 /* physics related variables. */
131__variant Prop_GetInfo(int, int);
132
133typedef struct
134{
135 string name;
136 string data;
137 float modelindex; /* only used for networking */
138 bool physics; /* differentiate between Source and GS */
140
141/* entity will have a .breakmodel field pointing to a breakmodel id */
146
147
148#ifdef CLIENT
149void BreakModel_SpawnID(vector smins, vector smaxs, vector dir, float speed, int count, int index);
150void BreakModel_Receive(void);
152#else
153void BreakModel_Spawn(vector pos, vector dir, vector spread, float speed, int count, string type);
154void BreakModel_Entity(NSSurfacePropEntity target, vector dir, float speed);
155void BreakModel_SendClientData(entity);
156#endif
157
158/* necessary API functions */
159//void BreakModel_Init(void);
160//void BreakModel_Shutdown(void);
161
162//int BreakModel_Load(string); /* called when we precache a model, returns -1 when not found */
163//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:49
entity *__variant __variant int type
Definition: fteextensions.qc:1746
#define hashtable
Definition: fteextensions.qc:269
__variant(float table, string name, optional __variant deflt, optional float requiretype, optional float index) hash_get
vector(vector) normalize
entity() spawn
string target
Definition: defs.h:23
void PropData_SetStage(string)
Definition: propdata.qc:625
void BreakModel_SpawnID(vector smins, vector smaxs, vector dir, float speed, int count, int index)
Definition: propdata.qc:647
var hashtable g_hashbreakmodel
Definition: propdata.h:145
propinfo_t
Definition: propdata.h:112
@ PROPINFO_DMG_BULLET
Definition: propdata.h:115
@ PROPINFO_DAMPING_LINEAR
Definition: propdata.h:125
@ PROPINFO_EXPLOSIVE_RADIUS
Definition: propdata.h:119
@ PROPINFO_VOLUME
Definition: propdata.h:128
@ PROPINFO_INERTIA
Definition: propdata.h:127
@ PROPINFO_BREAKMODEL
Definition: propdata.h:120
@ PROPINFO_DAMPING_ANGULAR
Definition: propdata.h:126
@ PROPINFO_EXPLOSIVE_DMG
Definition: propdata.h:118
@ PROPINFO_DMG_MELEE
Definition: propdata.h:116
@ PROPINFO_FLAGS
Definition: propdata.h:114
@ PROPINFO_SKIN
Definition: propdata.h:122
@ PROPINFO_SURFACEPROP
Definition: propdata.h:129
@ PROPINFO_HEALTH
Definition: propdata.h:113
@ PROPINFO_DMG_EXPLOSIVE
Definition: propdata.h:117
@ PROPINFO_BREAKCOUNT
Definition: propdata.h:121
@ PROPINFO_MASS
Definition: propdata.h:124
void BreakModel_Receive(void)
Definition: propdata.qc:775
int PropData_Finish(void)
Definition: propdata.qc:631
int PropData_Load(string)
Definition: propdata.qc:409
var string g_curPropData
Definition: propdata.h:62
var hashtable g_hashpropdata
Definition: propdata.h:97
void PropData_Init(void)
Definition: propdata.qc:538
void PropData_Shutdown(void)
Definition: propdata.qc:34
int g_propdata_count
Definition: propdata.h:96
propdata_t * g_propdata
Definition: propdata.h:95
__variant Prop_GetInfo(int, int)
Definition: propdata.qc:50
breakmodel_t * g_breakmodel
Definition: propdata.h:142
int PropData_ForModel(string)
Definition: propdata.qc:273
int g_breakmodel_count
Definition: propdata.h:143
void BreakModel_ReceiveClientData(void)
Definition: propdata.qc:810
int g_breakmodel_end
Definition: propdata.h:144
typedef enumflags
Definition: propdata.h:65
Definition: propdata.h:134
float modelindex
Definition: propdata.h:137
string name
Definition: propdata.h:135
string data
Definition: propdata.h:136
bool physics
Definition: propdata.h:138
Definition: propdata.h:72
float damping_linear
Definition: propdata.h:87
float volume
Definition: propdata.h:90
string surfaceprop
Definition: propdata.h:91
float mass
Definition: propdata.h:86
float damage_explosive
Definition: propdata.h:79
propdataFlag_t flags
Definition: propdata.h:76
string breakable_model
Definition: propdata.h:83
float health
Definition: propdata.h:75
float damage_bullets
Definition: propdata.h:77
float breakable_skin
Definition: propdata.h:85
string breakable_particle
Definition: propdata.h:82
float explosive_radius
Definition: propdata.h:81
float damage_melee
Definition: propdata.h:78
float damping_angular
Definition: propdata.h:88
float explosive_damage
Definition: propdata.h:80
string base
Definition: propdata.h:74
int breakable_count
Definition: propdata.h:84
float inertia
Definition: propdata.h:89
string name
Definition: propdata.h:73