Nuclide
Software Development Kit for id Tech
defs.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
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#include "NSOutput.h"
18#include "NSGameRules.h"
19#include "skill.h"
20#include "logging.h"
21#include "nodes.h"
22#include "spawn.h"
23#include "weapons.h"
24#include "plugins.h"
25#include "NSTraceAttack.h"
26#include "../shared/weapons.h"
27#include "../shared/weapon_common.h"
28
29#include "route.h"
30#include "way.h"
31#include "lament.h"
32
33/* helper macros */
34#define EVALUATE_FIELD(fieldname, changedflag) {\
35 if (ATTR_CHANGED(fieldname)) {\
36 SetSendFlags(changedflag);\
37 }\
38 SAVE_STATE(fieldname);\
39}
40
41#define EVALUATE_VECTOR(fieldname, id, changedflag) {\
42 if (VEC_CHANGED(fieldname, id)) {\
43 SetSendFlags(changedflag);\
44 }\
45 SAVE_STATE_FIELD(fieldname, id);\
46}
47
48#define SENDENTITY_BYTE(field, changedflag) {\
49 if (flChanged & changedflag)\
50 WriteByte(MSG_ENTITY, field);\
51}
52
53#define SENDENTITY_SHORT(field, changedflag) {\
54 if (flChanged & changedflag)\
55 WriteShort(MSG_ENTITY, field);\
56}
57
58#define SENDENTITY_INT(field, changedflag) {\
59 if (flChanged & changedflag)\
60 WriteInt(MSG_ENTITY, field);\
61}
62
63#define SENDENTITY_FLOAT(field, changedflag) {\
64 if (flChanged & changedflag)\
65 WriteFloat(MSG_ENTITY, field);\
66}
67
68#define SENDENTITY_STRING(field, changedflag) {\
69 if (flChanged & changedflag)\
70 WriteString(MSG_ENTITY, field);\
71}
72
73#define SENDENTITY_COORD(field, changedflag) {\
74 if (flChanged & changedflag)\
75 WriteCoord(MSG_ENTITY, field);\
76}
77
78#define SENDENTITY_ANGLE(field, changedflag) {\
79 if (flChanged & changedflag)\
80 WriteAngle(MSG_ENTITY, field);\
81}
82
83#define SENDENTITY_ENTITY(field, changedflag) {\
84 if (flChanged & changedflag)\
85 WriteEntity(MSG_ENTITY, field);\
86}
87
88#define SENDENTITY_COLOR(field, changedflag) {\
89 if (flChanged & changedflag)\
90 WriteByte(MSG_ENTITY, field * 255.0);\
91}
92
93var bool g_isloading = false;
94
95var bool autocvar_mp_flashlight = true;
96
97
98void TraceAttack_FireBullets(int, vector, int, vector, int);
99#ifdef BULLETPENETRATION
102#endif
103
104void Damage_Radius(vector, entity, float, float, int, int);
105void Damage_Apply(entity, entity, float, int, damageType_t);
107void Client_ShakeOnce(vector, float, float, float, float);
108
109void Game_ServerModelEvent(float, int, string);
110void Event_ServerModelEvent(float, int, string);
111
112void Mapcycle_Load(string);
113
115
116/* Generic entity fields */
117.void(void) PlayerUse;
118.void(void) PlayerUseUnpressed;
120.entity eUser;
121.float material;
122.float deaths;
123.float botinfo;
124
125/* in idTech the .owner field causes collisions to fail against set entity,
126 * we don't want this all of the time. so use this as a fallback */
128
132
133/* damage related tempglobals, like trace_* */
142
144
145/* main is a qcc leftover */
146void main(void)
147{
148}
149
150#define SAVE_DECIMAL(x,y,z) fputs(x, sprintf("%S \"%d\" ", y, z))
151#define SAVE_INTEGER(x,y,z) fputs(x, sprintf("%S \"%i\" ", y, z))
152#define SAVE_FLOAT(x,y,z) fputs(x, sprintf("%S \"%f\" ", y, z))
153#define SAVE_VECTOR(x,y,z) fputs(x, sprintf("%S \"%v\" ", y, z))
154#define SAVE_STRING(x,y,z) fputs(x, sprintf("%S \"%s\" ", y, z))
155#define SAVE_HEX(x,y,z) fputs(x, sprintf("%S \"%x\" ", y, z))
156
157
163NSEntity EntityDef_SpawnClassname(string className);
164
165
169NSEntity EntityDef_CreateClassname(string className);
170
181NSEntity Entity_CreateClass(string className);
182
188bool EntityDef_HasSpawnClass(string className);
189
190
195string EntityDef_GetKeyValue(string className, string keyName);
Gamerule top level class.
NSEntity is the lowest of the user-accessible entity class.
Definition: NSEntity.h:52
damageType_t
All available damage types.
Definition: damage.h:19
const float FALSE
Definition: fteextensions.qc:863
vector(vector) normalize
entity() spawn
bodyType_t
Hitmesh types that models can support.
Definition: hitmesh.h:21
void Damage_Apply(entity, entity, float, int, damageType_t)
Definition: NSTraceAttack.qc:449
NSEntity g_dmg_eTarget
Definition: defs.h:135
NSEntity EntityDef_SpawnClassname(string className)
When called will turn the entity 'self' into the specified classname.
Definition: entityDef.qc:491
string startspot
Definition: defs.h:130
void Game_ServerModelEvent(float, int, string)
string __fullspawndata
Definition: defs.h:131
int g_dmg_iWeapon
Definition: defs.h:140
string EntityDef_GetKeyValue(string className, string keyName)
Retrieves the value of a specific key defined within an EntityDef.
Definition: entityDef.qc:529
void Event_ServerModelEvent(float, int, string)
Definition: modelevent.qc:28
var bool g_ents_initialized
Definition: defs.h:143
void TraceAttack_SetPenetrationPower(int)
Definition: NSTraceAttack.qc:436
bool iBleeds
Definition: defs.h:119
var bool g_isloading
Definition: defs.h:93
void main(void)
Definition: defs.h:146
entity real_owner
Definition: defs.h:127
entity eUser
Definition: defs.h:120
void Client_ShakeOnce(vector, float, float, float, float)
Definition: client.qc:46
void Client_FixAngle(entity, vector)
Definition: client.qc:26
NSEntity eActivator
Definition: defs.h:114
int trace_surfaceflagsi
Definition: defs.h:129
bool EntityDef_HasSpawnClass(string className)
Checks if an entity class was defined in an EntityDef.
Definition: entityDef.qc:570
int g_dmg_iRealDamage
Definition: defs.h:137
vector g_dmg_vecLocation
Definition: defs.h:141
NSEntity EntityDef_CreateClassname(string className)
Spawns an entity of a specific class.
Definition: entityDef.qc:510
float botinfo
Definition: defs.h:123
var bool autocvar_mp_flashlight
Definition: defs.h:95
NSEntity g_dmg_eAttacker
Definition: defs.h:134
float deaths
Definition: defs.h:122
void TraceAttack_FireBullets(int, vector, int, vector, int)
Definition: NSTraceAttack.qc:394
void TraceAttack_SetRangeModifier(float)
Definition: NSTraceAttack.qc:428
void Damage_Radius(vector, entity, float, float, int, int)
Definition: NSTraceAttack.qc:465
void Mapcycle_Load(string)
Definition: mapcycle.qc:20
float material
Definition: defs.h:121
int g_dmg_iFlags
Definition: defs.h:139
bodyType_t g_dmg_iHitBody
Definition: defs.h:138
NSEntity Entity_CreateClass(string className)
Spawns an entity of a class, guaranteed to be valid.
Definition: entityDef.qc:593
int g_dmg_iDamage
Definition: defs.h:136