Nuclide
Software Development Kit for id Technology (BETA)
Loading...
Searching...
No Matches
defs.h
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 "api_func.h"
18#include "../shared/api.h"
19#include "../shared/system/entityDef.h"
20#include "Output.h"
21#include "GameRules.h"
22#include "skill.h"
23#include "Stats.h"
24
25#include "../nav/linkflags.h"
26#include "../nav/nodes.h"
27#include "../nav/route.h"
28#include "../nav/NodeEditor.h"
29#include "../nav/way_convert.h"
30#include "../nav/NavInfo.h"
31#include "../nav/Hint.h"
32
33#include "spawn.h"
34#include "AddonDelegate.h"
35#include "MapDelegate.h"
36#include "plugins.h"
37#include "lament.h"
38#include "vote.h"
39#include "mapcycle.h"
40#include "maptweaks.h"
41#include "Schedule.h"
42#include "SessionManager.h"
43
44#include "CapturePoint.h"
45#include "CaptureItem.h"
46#include "Auth.h"
47
48/* helper macros */
49#define EVALUATE_FIELD(fieldname, changedflag) {\
50 if (ATTR_CHANGED(fieldname)) {\
51 SetSendFlags(changedflag);\
52 }\
53 SAVE_STATE(fieldname);\
54}
55
56#define EVALUATE_VECTOR(fieldname, idx, changedflag) {\
57 if (VEC_CHANGED(fieldname, idx)) {\
58 SetSendFlags(changedflag);\
59 }\
60 SAVE_STATE_FIELD(fieldname, idx);\
61}
62
63#define SENDENTITY_BYTE(field, changedflag) {\
64 if (flChanged & changedflag)\
65 WriteByte(MSG_ENTITY, field);\
66}
67
68#define SENDENTITY_SHORT(field, changedflag) {\
69 if (flChanged & changedflag)\
70 WriteShort(MSG_ENTITY, field);\
71}
72
73#define SENDENTITY_INT(field, changedflag) {\
74 if (flChanged & changedflag)\
75 WriteInt(MSG_ENTITY, field);\
76}
77
78#define SENDENTITY_FLOAT(field, changedflag) {\
79 if (flChanged & changedflag)\
80 WriteFloat(MSG_ENTITY, field);\
81}
82
83#define SENDENTITY_STRING(field, changedflag) {\
84 if (flChanged & changedflag)\
85 WriteString(MSG_ENTITY, field);\
86}
87
88#define SENDENTITY_COORD(field, changedflag) {\
89 if (flChanged & changedflag)\
90 WriteCoord(MSG_ENTITY, field);\
91}
92
93#define SENDENTITY_ANGLE(field, changedflag) {\
94 if (flChanged & changedflag)\
95 WriteAngle(MSG_ENTITY, field);\
96}
97
98#define SENDENTITY_ENTITY(field, changedflag) {\
99 if (flChanged & changedflag)\
100 WriteEntity(MSG_ENTITY, field);\
101}
102
103#define SENDENTITY_COLOR(field, changedflag) {\
104 if (flChanged & changedflag)\
105 WriteByte(MSG_ENTITY, field * 255.0);\
106}
107
108#define SENDENTITY_MODELINDEX(field, changedflag) {\
109 if (flChanged & changedflag)\
110 WriteShort(MSG_ENTITY, field);\
111}
112
113var bool g_isloading = false;
114
115var bool autocvar_mp_flashlight = true;
116
117void Client_FixAngle(entity, vector);
118void Client_ShakeOnce(vector, float, float, float, float);
119
120void Mapcycle_Load(string);
121
122ncEntity eActivator;
123
124/* Generic entity fields */
125.void(void) PlayerUse;
126.void(void) PlayerUseUnpressed;
127.bool iBleeds;
128.entity eUser;
129.float material;
130.float deaths;
131
132/* in idTech the .owner field causes collisions to fail against set entity,
133 * we don't want this all of the time. so use this as a fallback */
134.entity real_owner;
135
136int trace_surfaceflagsi;
137string startspot;
138string __fullspawndata;
139
140var bool g_ents_initialized = false;
141
142/* main is a qcc leftover */
143void main(void)
144{
145}
146
147#define SAVE_DECIMAL(x,y,z) fputs(x, sprintf("%S \"%d\" ", y, z))
148#define SAVE_INTEGER(x,y,z) fputs(x, sprintf("%S \"%i\" ", y, z))
149#define SAVE_FLOAT(x,y,z) fputs(x, sprintf("%S \"%f\" ", y, z))
150#define SAVE_VECTOR(x,y,z) fputs(x, sprintf("%S \"%v\" ", y, z))
151#define SAVE_STRING(x,y,z) fputs(x, sprintf("%S \"%s\" ", y, z))
152#define SAVE_HEX(x,y,z) fputs(x, sprintf("%S \"%x\" ", y, z))
153
154
160ncEntity EntityDef_SpawnClassname(string className);
161
162
166ncEntity EntityDef_CreateClassname(string className);
167
178ncEntity Entity_CreateClass(string className);
179
185bool EntityDef_HasSpawnClass(string className);
186
187
192string EntityDef_GetKeyValue(string className, string keyName);
193
194void
195WriteEntityEvent(float to, entity targetEntity, float eventType)
196{
197 WriteByte(to, SVC_CGAMEPACKET);
198 WriteByte(to, EV_ENTITYEVENT);
199 WriteEntity(to, targetEntity);
200 WriteFloat(to, eventType);
201}
202
ncEntity is the lowest of the user-accessible entity class.
Definition Entity.h:75
var materialAPI_t material
Access atlasPicAPI_t functions using this variable.
Definition api_func.h:562