Nuclide
Software Development Kit for id Tech
surfaceproperties.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 Surface Data Specs
19
20 Scripts are formatted like our sound shaders:
21
22 typename
23 {
24 key/value pairs
25 ...
26 }
27
28 Available keys are:
29 "base" <string> what type to inherit
30 "gamematerial" <char> material character, e.g. W for wood
31 which are looked up in scripts/decals.txt at a later time.
32 "climbable" <bool> ???
33 "thickness" <float> non-solid, air (?) thickness
34 "density" <int> material density in kg / m^3
35
36 "elasticity" <float> 0.0 - 1.0 ; soft to hard
37 "friction" <float> friction multiplier
38 "dampening" <float> drag multiplier
39 "jumpfactor" <float> bouncyness?
40 "maxspeedfactor" <float> maxvelocity?
41
42 "stepleft" <string> footstep left
43 "stepright" <string> footstep right
44 "bulletimpact" <string> sound shader to play on impact
45 "scraperough" <string> sound shader to play on rough scraping
46 "scrapesmooth" <string> sound shader to play on smooth scraping
47 "impacthard" <string> sound shader for hard impacts
48 "impactsoft" <string> sound shader for soft impacts
49
50 "shake" <string> sound to play when object is being shaken
51 "strain" <string> sound to play when object is being strained?
52 "break" <string> sound to play when object breaks
53 "roll/rolling" <string> sound to play when object rolls
54
55 none of these are concerning us right now:
56 "audioreflectivity" <float>
57 "audiohardnessfactor" <float>
58 "audioroughnessfactor" <float>
59 "scrapeRoughThreshold" <float>
60 "impactHardThreshold" <float>
61 "audioHardMinVelocity" <float>
62*/
63
64typedef struct
65{
66 string m_strBase;
75
83 string m_sndShake;
85 string m_sndRoll;
86 string m_sndBreak;
87
91
92/* entity will have to have a .surfdata field pointing to an id */
96
97/* querying API */
98typedef enum
99{
122
123/* initialized SurfaceKit */
124void SurfData_Init(void);
125
126/* Prepares an object for SurfaceKit initialization */
127void SurfData_SetStage(string type);
128
129/* Finishes initialization, returns valid SurfaceKit id */
130int SurfData_Finish(void);
131
132int SurfData_TexToSurfData(string tex_name);
133
134/* Call an impact effect against an entity surface */
135void SurfData_Impact(entity e, vector org, vector ang);
136
137/* Get information from a Surface */
139
140#ifdef CLIENT
141void SurfData_Impact_Parse(void);
142void SurfData_ImpactID_Parse(void);
143#endif
144
145void SurfData_ImpactOfType(int materialID, vector worldPosition, vector impactNormal);
146
147void SurfData_ImpactOfNamedType(string materialName, vector worldPosition, vector impactNormal);
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
Definition: surfaceproperties.h:65
string m_sndShake
Definition: surfaceproperties.h:83
string m_sndRoll
Definition: surfaceproperties.h:85
float m_flThickness
Definition: surfaceproperties.h:68
float m_flElasticity
Definition: surfaceproperties.h:70
float m_flFriction
Definition: surfaceproperties.h:71
string m_sndScrapeRough
Definition: surfaceproperties.h:79
float m_fxBulletImpactID
Definition: surfaceproperties.h:89
string m_sndBulletImpact
Definition: surfaceproperties.h:78
string m_sndStepLeft
Definition: surfaceproperties.h:76
string m_sndBreak
Definition: surfaceproperties.h:86
string m_sndImpactHard
Definition: surfaceproperties.h:81
float m_flMaxSpeedFactor
Definition: surfaceproperties.h:74
string m_sndStepRight
Definition: surfaceproperties.h:77
string m_sndScrapeSoft
Definition: surfaceproperties.h:80
float m_flDampening
Definition: surfaceproperties.h:72
float m_flDensity
Definition: surfaceproperties.h:69
string m_fxBulletImpact
Definition: surfaceproperties.h:88
string m_sndStrain
Definition: surfaceproperties.h:84
string m_strBase
Definition: surfaceproperties.h:66
float m_flJumpFactor
Definition: surfaceproperties.h:73
float m_flMaterial
Definition: surfaceproperties.h:67
string m_sndImpactSoft
Definition: surfaceproperties.h:82
void SurfData_Impact(entity e, vector org, vector ang)
Definition: surfaceproperties.qc:507
int SurfData_TexToSurfData(string tex_name)
Definition: surfaceproperties.qc:224
void SurfData_ImpactOfNamedType(string materialName, vector worldPosition, vector impactNormal)
Definition: surfaceproperties.qc:543
void SurfData_SetStage(string type)
Definition: surfaceproperties.qc:403
void SurfData_Impact_Parse(void)
Called by EV_SURFIMPACT.
Definition: surfaceproperties.qc:457
surfaceData_t * g_surfdata
Definition: surfaceproperties.h:93
__variant SurfData_GetInfo(int, int)
Definition: surfaceproperties.qc:243
int g_surfdata_count
Definition: surfaceproperties.h:94
surfinfo_t
Definition: surfaceproperties.h:99
@ SURFDATA_SND_STEPLEFT
Definition: surfaceproperties.h:108
@ SURFDATA_SND_STEPRIGHT
Definition: surfaceproperties.h:109
@ SURFDATA_SND_BULLETIMPACT
Definition: surfaceproperties.h:110
@ SURFDATA_SND_SCRAPEROUGH
Definition: surfaceproperties.h:111
@ SURFDATA_SND_IMPACTSOFT
Definition: surfaceproperties.h:114
@ SURFDATA_FX_BULLETIMPACTID
Definition: surfaceproperties.h:120
@ SURFDATA_SND_SHAKE
Definition: surfaceproperties.h:115
@ SURFDATA_MATERIAL
Definition: surfaceproperties.h:100
@ SURFDATA_MAXSPEEDFACTOR
Definition: surfaceproperties.h:107
@ SURFDATA_DAMPENING
Definition: surfaceproperties.h:105
@ SURFDATA_SND_STRAIN
Definition: surfaceproperties.h:116
@ SURFDATA_THICKNESS
Definition: surfaceproperties.h:101
@ SURFDATA_DENSITY
Definition: surfaceproperties.h:102
@ SURFDATA_SND_IMPACTHARD
Definition: surfaceproperties.h:113
@ SURFDATA_SND_BREAK
Definition: surfaceproperties.h:118
@ SURFDATA_FX_BULLETIMPACT
Definition: surfaceproperties.h:119
@ SURFDATA_JUMPFACTOR
Definition: surfaceproperties.h:106
@ SURFDATA_FRICTION
Definition: surfaceproperties.h:104
@ SURFDATA_ELASTICITY
Definition: surfaceproperties.h:103
@ SURFDATA_SND_SCRAPESOFT
Definition: surfaceproperties.h:112
@ SURFDATA_SND_ROLL
Definition: surfaceproperties.h:117
int SurfData_Finish(void)
Definition: surfaceproperties.qc:412
void SurfData_Init(void)
Definition: surfaceproperties.qc:309
void SurfData_ImpactOfType(int materialID, vector worldPosition, vector impactNormal)
Definition: surfaceproperties.qc:534
void SurfData_ImpactID_Parse(void)
Called by EV_SURFIMPACTID.
Definition: surfaceproperties.qc:484
var hashtable g_hashsurfdata
Definition: surfaceproperties.h:95