1
2/*
3==============================================================================
4
5			SOURCE FOR GLOBALVARS_T C STRUCTURE
6
7==============================================================================
8*/
9
10//
11// system globals
12//
13entity		self;
14entity		other;
15entity		world;
16float		time;
17float		frametime;
18
19float		force_retouch;		// force all entities to touch triggers
20								// next frame.  this is needed because
21								// non-moving things don't normally scan
22								// for triggers, and when a trigger is
23								// created (like a teleport trigger), it
24								// needs to catch everything.
25								// decremented each frame, so set to 2
26								// to guarantee everything is touched
27string		mapname;
28
29float		deathmatch;
30float		coop;
31float		teamplay;
32
33float		serverflags;		// propagated from level to level, used to
34								// keep track of completed episodes
35
36float		total_secrets;
37float		total_monsters;
38
39float		found_secrets;		// number of secrets found
40float		killed_monsters;	// number of monsters killed
41
42
43// spawnparms are used to encode information about clients across server
44// level changes
45float		parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
46
47//
48// global variables set by built in functions
49//
50vector		v_forward, v_up, v_right;	// set by makevectors()
51
52// set by traceline / tracebox
53float		trace_allsolid;
54float		trace_startsolid;
55float		trace_fraction;
56vector		trace_endpos;
57vector		trace_plane_normal;
58float		trace_plane_dist;
59entity		trace_ent;
60float		trace_inopen;
61float		trace_inwater;
62
63entity		msg_entity;				// destination of single entity writes
64
65//
66// required prog functions
67//
68void() 		main;						// only for testing
69
70void()		StartFrame;
71
72void() 		PlayerPreThink;
73void() 		PlayerPostThink;
74
75void()		ClientKill;
76void()		ClientConnect;
77void() 		PutClientInServer;		// call after setting the parm1... parms
78void()		ClientDisconnect;
79
80void()		SetNewParms;			// called when a client first connects to
81									// a server. sets parms so they can be
82									// saved off for restarts
83
84void()		SetChangeParms;			// call to set parms for self so they can
85									// be saved for a level transition
86
87
88//================================================
89void		end_sys_globals;		// flag for structure dumping
90//================================================
91
92/*
93==============================================================================
94
95			SOURCE FOR ENTVARS_T C STRUCTURE
96
97==============================================================================
98*/
99
100//
101// system fields (*** = do not set in prog code, maintained by C code)
102//
103.float		modelindex;		// *** model index in the precached list
104.vector		absmin, absmax;	// *** origin + mins / maxs
105
106.float		ltime;			// local time for entity
107.float		movetype;
108.float		solid;
109
110.vector		origin;			// ***
111.vector		oldorigin;		// ***
112.vector		velocity;
113.vector		angles;
114.vector		avelocity;
115
116.vector		punchangle;		// temp angle adjust from damage or recoil
117
118.string		classname;		// spawn function
119.string		model;
120.float		frame;
121.float		skin;
122.float		effects;
123
124.vector		mins, maxs;		// bounding box extents reletive to origin
125.vector		size;			// maxs - mins
126
127.void()		touch;
128.void()		use;
129.void()		think;
130.void()		blocked;		// for doors or plats, called when can't push other
131
132.float		nextthink;
133.entity		groundentity;
134
135// stats
136.float		health;
137.float		frags;
138.float		weapon;			// one of the IT_SHOTGUN, etc flags
139.string		weaponmodel;
140.float		weaponframe;
141.float		currentammo;
142.float		ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
143
144.float		items;			// bit flags
145
146.float		takedamage;
147.entity		chain;
148.float		deadflag;
149
150.vector		view_ofs;			// add to origin to get eye point
151
152
153.float		button0;		// fire
154.float		button1;		// use
155.float		button2;		// jump
156
157.float		impulse;		// weapon changes
158
159.float		fixangle;
160.vector		v_angle;		// view / targeting angle for players
161.float		idealpitch;		// calculated pitch angle for lookup up slopes
162
163
164.string		netname;
165
166.entity 	enemy;
167
168.float		flags;
169
170.float		colormap;
171.float		team;
172
173.float		max_health;		// players maximum health is stored here
174
175.float		teleport_time;	// don't back up
176
177.float		armortype;		// save this fraction of incoming damage
178.float		armorvalue;
179
180.float		waterlevel;		// 0 = not in, 1 = feet, 2 = wast, 3 = eyes
181.float		watertype;		// a contents value
182
183.float		ideal_yaw;
184.float		yaw_speed;
185
186.entity		aiment;
187
188.entity 	goalentity;		// a movetarget or an enemy
189
190.float		spawnflags;
191
192.string		target;
193.string		targetname;
194
195// damage is accumulated through a frame. and sent as one single
196// message, so the super shotgun doesn't generate huge messages
197.float		dmg_take;
198.float		dmg_save;
199.entity		dmg_inflictor;
200
201.entity		owner;		// who launched a missile
202.vector		movedir;	// mostly for doors, but also used for waterjump
203
204.string		message;		// trigger messages
205
206.float		sounds;		// either a cd track number or sound number
207
208.string		noise, noise1, noise2, noise3;	// contains names of wavs to play
209
210//================================================
211void		end_sys_fields;			// flag for structure dumping
212//================================================
213
214//================================================
215
216//
217// globals
218//
219float	movedist;
220float	gameover;		// set when a rule exits
221
222string	string_null;	// null string, nothing should be held here
223float	empty_float;
224
225entity	newmis;			// launch_spike sets this after spawning it
226
227entity	activator;		// the entity that activated a trigger or brush
228
229entity	damage_attacker;	// set by T_Damage
230float	framecount;
231
232float		skill;
233
234//================================================
235
236//
237// world fields (FIXME: make globals)
238//
239
240.string		wad;
241.string 	map;
242.float		worldtype;	// 0=medieval 1=metal 2=base
243
244//================================================
245
246//.string		killtarget;
247
248//
249// quakeed fields
250//
251.float		light_lev;		// not used by game, but parsed by light util
252.float		style;
253
254.float		speed;
255.float		lip;
256.float		wait;
257.float		dmg;
258.string		mdl;
259
260//
261// object stuff
262//
263.vector		mangle;			// angle at start
264
265//===========================================================================
266
267float 	MSG_BROADCAST	= 0;		// unreliable to all
268float	MSG_ONE			= 1;		// reliable to one (msg_entity)
269float	MSG_ALL			= 2;		// reliable to all
270float	MSG_INIT		= 3;		// write to the init string
271
272//
273// builtin functions
274//
275
276void(vector ang)	makevectors		= #1;		// sets v_forward, etc globals
277void(entity e, vector o) setorigin	= #2;
278void(entity e, string m) setmodel	= #3;		// set movetype and solid first
279void(entity e, vector min, vector max) setsize = #4;
280// #5 was removed
281void() break						= #6;
282float() random						= #7;		// returns 0 - 1
283void(entity e, float chan, string samp, float vol, float atten) sound = #8;
284vector(vector v) normalize			= #9;
285void(string e) error				= #10;
286void(string e) objerror				= #11;
287float(vector v) vlen				= #12;
288float(vector v) vectoyaw			= #13;
289entity() spawn						= #14;
290void(entity e) remove				= #15;
291
292// sets trace_* globals
293// nomonsters can be:
294// An entity will also be ignored for testing if forent == test,
295// forent->owner == test, or test->owner == forent
296// a forent of world is ignored
297void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
298
299entity() checkclient				= #17;	// returns a client to look for
300entity(entity start, .string fld, string match) find = #18;
301string(string s) precache_sound		= #19;
302string(string s) precache_model		= #20;
303void(entity client, string s)stuffcmd = #21;
304entity(vector org, float rad) findradius = #22;
305void(string s, ...) bprint			= #23;
306void(entity client, string s, ...) sprint = #24;
307void(string s, ...) dprint			= #25;
308string(float f) ftos				= #26;
309string(vector v) vtos				= #27;
310void() coredump						= #28;		// prints all edicts
311void() traceon						= #29;		// turns statment trace on
312void() traceoff						= #30;
313void(entity e) eprint				= #31;		// prints an entire edict
314float(float yaw, float dist) walkmove	= #32;	// returns TRUE or FALSE
315// #33 was removed
316float(float yaw, float dist) droptofloor= #34;	// TRUE if landed on floor
317void(float style, string value) lightstyle = #35;
318float(float v) rint					= #36;		// round to nearest int
319float(float v) floor				= #37;		// largest integer <= v
320float(float v) ceil					= #38;		// smallest integer >= v
321// #39 was removed
322float(entity e) checkbottom			= #40;		// true if self is on ground
323float(vector v) pointcontents		= #41;		// returns a CONTENT_*
324// #42 was removed
325float(float f) fabs = #43;
326vector(entity e, float speed) aim = #44;		// returns the shooting vector
327float(string s) cvar = #45;						// return cvar.value
328void(string s) localcmd = #46;					// put string into local que
329entity(entity e) nextent = #47;					// for looping through all ents
330void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
331void() ChangeYaw = #49;						// turn towards self.ideal_yaw
332											// at self.yaw_speed
333// #50 was removed
334vector(vector v) vectoangles			= #51;
335
336//
337// direct client message generation
338//
339void(float to, float f) WriteByte		= #52;
340void(float to, float f) WriteChar		= #53;
341void(float to, float f) WriteShort		= #54;
342void(float to, float f) WriteLong		= #55;
343void(float to, float f) WriteCoord		= #56;
344void(float to, float f) WriteAngle		= #57;
345void(float to, string s) WriteString	= #58;
346void(float to, entity s) WriteEntity	= #59;
347
348//
349// broadcast client message generation
350//
351
352// void(float f) bWriteByte		= #59;
353// void(float f) bWriteChar		= #60;
354// void(float f) bWriteShort		= #61;
355// void(float f) bWriteLong		= #62;
356// void(float f) bWriteCoord		= #63;
357// void(float f) bWriteAngle		= #64;
358// void(string s) bWriteString	= #65;
359// void(entity e) bWriteEntity = #66;
360
361void(float step) movetogoal				= #67;
362
363string(string s) precache_file		= #68;	// no effect except for -copy
364void(entity e) makestatic		= #69;
365void(string s) changelevel = #70;
366
367//#71 was removed
368
369void(string var, string val) cvar_set = #72;	// sets cvar.value
370
371void(entity client, ...) centerprint = #73;	// sprint, but in middle
372
373void(vector pos, string samp, float vol, float atten) ambientsound = #74;
374
375string(string s) precache_model2	= #75;		// registered version only
376string(string s) precache_sound2	= #76;		// registered version only
377string(string s) precache_file2		= #77;		// registered version only
378
379void(entity e) setspawnparms		= #78;		// set parm1... to the
380												// values at level start
381												// for coop respawn
382
383
384