From b45a0e65fded9b8f1e4011236da4c146a0cc83c8 Mon Sep 17 00:00:00 2001
From: Rudolf Polzer <divverent@xonotic.org>
Date: Sat, 26 Nov 2011 09:39:16 +0100
Subject: [PATCH] use the engine's progsdefs.qc. This may break stuff, please
 test!

---
 qcsrc/server/builtins.qh                    |  72 ---
 qcsrc/server/miscfunctions.qc               |  18 +-
 qcsrc/server/progsdefs.qc                   | 507 ++++++++++++++++++++
 qcsrc/server/sys.qh                         | 160 +-----
 qcsrc/server/tturrets/system/system_main.qc |   2 +-
 5 files changed, 532 insertions(+), 227 deletions(-)
 create mode 100644 qcsrc/server/progsdefs.qc

diff --git a/qcsrc/server/builtins.qh b/qcsrc/server/builtins.qh
index cf0198b4c..e69de29bb 100644
--- a/qcsrc/server/builtins.qh
+++ b/qcsrc/server/builtins.qh
@@ -1,72 +0,0 @@
-
-void	makevectors (vector ang)							= #1;
-void	setorigin (entity e, vector o)							= #2;
-void	setmodel (entity e, string m)							= #3;
-void	setsize (entity e, vector min, vector max)					= #4;
-
-void	crash (void)									= #6;
-float	random (void)									= #7;
-//void(entity e, float chan, string samp, float vol, float atten) sound = #8;
-vector	normalize (vector v)								= #9;
-void	error (string e)								= #10;
-void	objerror_builtin (string e)								= #11; // do not call, use objerror wrapper
-float	vlen (vector v)									= #12;
-float	vectoyaw (vector v)								= #13;
-entity	spawn (void)									= #14;
-void	remove_builtin (entity e)								= #15;
-void	traceline (vector v1, vector v2, float nomonst, entity forent)			= #16;
-entity	checkclient (void)								= #17;
-entity	find (entity start, .string fld, string match)					= #18;
-//string	precache_sound (string s)							= #19;
-string	precache_model (string s)							= #20;
-void(entity client, string s) stuffcmd = #21;
-entity	findradius (vector org, float rad)						= #22;
-void	bprint (string s, ...)								= #23;
-void(entity client, string s) sprint = #24;
-void	dprint (string s, ...)								= #25;
-string	ftos (float f)									= #26;
-string	vtos (vector v)									= #27;
-void	coredump (void)									= #28;
-void	traceon (void)									= #29;
-void	traceoff (void)									= #30;
-void	eprint (entity e)								= #31;
-float	walkmove (float yaw, float dist)						= #32;
-
-float	droptofloor_builtin ()						= #34;
-void	lightstyle (float style, string value)						= #35;
-float	rint (float v)									= #36;
-float	floor (float v)									= #37;
-float	ceil (float v)									= #38;
-
-float	checkbottom (entity e)								= #40;
-float	pointcontents (vector v)							= #41;
-
-float	fabs (float f)									= #43;
-vector(entity e, float speed) aim = #44;
-float	cvar (string s)									= #45;
-void	localcmd (string s, ...)							= #46;
-entity	nextent (entity e)								= #47;
-void	particle (vector v, vector d, float colour, float count)			= #48;
-void	ChangeYaw (void)								= #49;
-
-vector	vectoangles (vector v, ...)								= #51;
-void(float to, float f)		WriteByte = #52;
-void(float to, float f)		WriteChar = #53;
-void(float to, float f)		WriteShort = #54;
-void(float to, float f)		WriteLong = #55;
-void(float to, float f)		WriteCoord = #56;
-void(float to, float f)		WriteAngle = #57;
-void(float to, string s)	WriteString	= #58;
-void(float to, entity s)	WriteEntity	= #59;
-void	movetogoal (float step)								= #67;
-string	precache_file (string s)							= #68;
-void	makestatic (entity e)								= #69;
-void	changelevel (string s)								= #70;
-
-void	cvar_set (string var, string val)						= #72;
-void(entity client, string s) centerprint = #73;
-void	ambientsound (vector pos, string samp, float vol, float atten)			= #74;
-string	precache_model2 (string s)							= #75;
-string	precache_sound2 (string s)							= #76;
-string	precache_file2 (string s)							= #77;
-void(entity e) setspawnparms = #78;
diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc
index 2fe562774..4eed8f0c9 100644
--- a/qcsrc/server/miscfunctions.qc
+++ b/qcsrc/server/miscfunctions.qc
@@ -1266,12 +1266,12 @@ float sound_allowed(float dest, entity e)
 }
 
 #ifdef COMPAT_XON010_CHANNELS
-void(entity e, float chan, string samp, float vol, float atten) sound_builtin = #8;
+void(entity e, float chan, string samp, float vol, float atten) builtin_sound = #8;
 void sound(entity e, float chan, string samp, float vol, float atten)
 {
     if (!sound_allowed(MSG_BROADCAST, e))
         return;
-    sound_builtin(e, chan, samp, vol, atten);
+    builtin_sound(e, chan, samp, vol, atten);
 }
 #else
 #undef sound
@@ -1696,7 +1696,7 @@ void make_safe_for_remove(entity e)
 void objerror(string s)
 {
     make_safe_for_remove(self);
-    objerror_builtin(s);
+    builtin_objerror(s);
 }
 
 .float remove_except_protected_forbidden;
@@ -1704,20 +1704,20 @@ void remove_except_protected(entity e)
 {
 	if(e.remove_except_protected_forbidden)
 		error("not allowed to remove this at this point");
-	remove_builtin(e);
+	builtin_remove(e);
 }
 
 void remove_unsafely(entity e)
 {
     if(e.classname == "spike")
         error("Removing spikes is forbidden (crylink bug), please report");
-    remove_builtin(e);
+    builtin_remove(e);
 }
 
 void remove_safely(entity e)
 {
     make_safe_for_remove(e);
-    remove_builtin(e);
+    builtin_remove(e);
 }
 
 void InitializeEntity(entity e, void(void) func, float order)
@@ -1778,7 +1778,7 @@ void InitializeEntitiesRun()
         {
             entity e_old;
             e_old = self.enemy;
-            remove_builtin(self);
+            builtin_remove(self);
             self = e_old;
         }
         //dprint("Delayed initialization: ", self.classname, "\n");
@@ -1875,7 +1875,7 @@ void adaptor_think2use_hittype_splash() // for timed projectile detonation
 // deferred dropping
 void DropToFloor_Handler()
 {
-    droptofloor_builtin();
+    builtin_droptofloor();
     self.dropped_origin = self.origin;
 }
 
@@ -3050,7 +3050,7 @@ float cvar_normal(string n)
 	return stof(cvar_string_normal(n));
 }
 #endif
-#define cvar_set_normal cvar_set_builtin
+#define cvar_set_normal builtin_cvar_set
 
 void defer_think()
 {
diff --git a/qcsrc/server/progsdefs.qc b/qcsrc/server/progsdefs.qc
new file mode 100644
index 000000000..912c3ecab
--- /dev/null
+++ b/qcsrc/server/progsdefs.qc
@@ -0,0 +1,507 @@
+/*
+==============================================================================
+
+			SOURCE FOR GLOBALVARS_T C STRUCTURE
+			MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
+
+==============================================================================
+*/
+
+//
+// system globals
+//
+entity		self;
+entity		other;
+entity		world;
+float		time;
+float		frametime;
+
+float		force_retouch;		// force all entities to touch triggers
+								// next frame.  this is needed because
+								// non-moving things don't normally scan
+								// for triggers, and when a trigger is
+								// created (like a teleport trigger), it
+								// needs to catch everything.
+								// decremented each frame, so set to 2
+								// to guarantee everything is touched
+string		mapname;
+
+float		deathmatch;
+float		coop;
+float		teamplay;
+
+float		serverflags;		// propagated from level to level, used to
+								// keep track of completed episodes
+
+float		total_secrets;
+float		total_monsters;
+
+float		found_secrets;		// number of secrets found
+float		killed_monsters;	// number of monsters killed
+
+
+// spawnparms are used to encode information about clients across server
+// level changes
+float		parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
+
+//
+// global variables set by built in functions
+//
+vector		v_forward, v_up, v_right;	// set by makevectors()
+
+// set by traceline / tracebox
+float		trace_allsolid;
+float		trace_startsolid;
+float		trace_fraction;
+vector		trace_endpos;
+vector		trace_plane_normal;
+float		trace_plane_dist;
+entity		trace_ent;
+float		trace_inopen;
+float		trace_inwater;
+
+entity		msg_entity;				// destination of single entity writes
+
+//
+// required prog functions
+//
+void() 		main;						// only for testing
+
+void()		StartFrame;
+
+void() 		PlayerPreThink;
+void() 		PlayerPostThink;
+
+void()		ClientKill;
+void()		ClientConnect;
+void() 		PutClientInServer;		// call after setting the parm1... parms
+void()		ClientDisconnect;
+
+void()		SetNewParms;			// called when a client first connects to
+									// a server. sets parms so they can be
+									// saved off for restarts
+
+void()		SetChangeParms;			// call to set parms for self so they can
+									// be saved for a level transition
+
+
+//================================================
+void		end_sys_globals;		// flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+			SOURCE FOR ENTVARS_T C STRUCTURE
+			MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
+
+==============================================================================
+*/
+
+//
+// system fields (*** = do not set in prog code, maintained by C code)
+//
+.float		modelindex;		// *** model index in the precached list
+.vector		absmin, absmax;	// *** origin + mins / maxs
+
+.float		ltime;			// local time for entity
+.float		movetype;
+.float		solid;
+
+.vector		origin;			// ***
+.vector		oldorigin;		// ***
+.vector		velocity;
+.vector		angles;
+.vector		avelocity;
+
+.vector		punchangle;		// temp angle adjust from damage or recoil
+
+.string		classname;		// spawn function
+.string		model;
+.float		frame;
+.float		skin;
+.float		effects;
+
+.vector		mins, maxs;		// bounding box extents reletive to origin
+.vector		size;			// maxs - mins
+
+.void()		touch;
+.void()		use;
+.void()		think;
+.void()		blocked;		// for doors or plats, called when can't push other
+
+.float		nextthink;
+.entity		groundentity;
+
+// stats
+.float		health;
+.float		frags;
+.float		weapon;			// one of the IT_SHOTGUN, etc flags
+.string		weaponmodel;
+.float		weaponframe;
+.float		currentammo;
+.float		ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
+
+.float		items;			// bit flags
+
+.float		takedamage;
+.entity		chain;
+.float		deadflag;
+
+.vector		view_ofs;			// add to origin to get eye point
+
+
+.float		button0;		// fire
+.float		button1;		// use
+.float		button2;		// jump
+
+.float		impulse;		// weapon changes
+
+.float		fixangle;
+.vector		v_angle;		// view / targeting angle for players
+.float		idealpitch;		// calculated pitch angle for lookup up slopes
+
+
+.string		netname;
+
+.entity 	enemy;
+
+.float		flags;
+
+.float		colormap;
+.float		team;
+
+.float		max_health;		// players maximum health is stored here
+
+.float		teleport_time;	// don't back up
+
+.float		armortype;		// save this fraction of incoming damage
+.float		armorvalue;
+
+.float		waterlevel;		// 0 = not in, 1 = feet, 2 = wast, 3 = eyes
+.float		watertype;		// a contents value
+
+.float		ideal_yaw;
+.float		yaw_speed;
+
+.entity		aiment;
+
+.entity 	goalentity;		// a movetarget or an enemy
+
+.float		spawnflags;
+
+.string		target;
+.string		targetname;
+
+// damage is accumulated through a frame. and sent as one single
+// message, so the super shotgun doesn't generate huge messages
+.float		dmg_take;
+.float		dmg_save;
+.entity		dmg_inflictor;
+
+.entity		owner;		// who launched a missile
+.vector		movedir;	// mostly for doors, but also used for waterjump
+
+.string		message;		// trigger messages
+
+.float		sounds;		// either a cd track number or sound number
+
+.string		noise, noise1, noise2, noise3;	// contains names of wavs to play
+
+//================================================
+void		end_sys_fields;			// flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+				CONSTANT DEFINITIONS
+
+==============================================================================
+*/
+
+
+//
+// constants
+//
+
+float	FALSE					= 0;
+float 	TRUE					= 1;
+
+// edict.flags
+float	FL_FLY					= 1;
+float	FL_SWIM					= 2;
+float	FL_CLIENT				= 8;	// set for all client edicts
+float	FL_INWATER				= 16;	// for enter / leave water splash
+float	FL_MONSTER				= 32;
+float	FL_GODMODE				= 64;	// player cheat
+float	FL_NOTARGET				= 128;	// player cheat
+float	FL_ITEM					= 256;	// extra wide size for bonus items
+float	FL_ONGROUND				= 512;	// standing on something
+float	FL_PARTIALGROUND		= 1024;	// not all corners are valid
+float	FL_WATERJUMP			= 2048;	// player jumping out of water
+float	FL_JUMPRELEASED			= 4096;	// for jump debouncing
+
+// edict.movetype values
+float	MOVETYPE_NONE			= 0;	// never moves
+//float	MOVETYPE_ANGLENOCLIP	= 1;
+//float	MOVETYPE_ANGLECLIP		= 2;
+float	MOVETYPE_WALK			= 3;	// players only
+float	MOVETYPE_STEP			= 4;	// discrete, not real time unless fall
+float	MOVETYPE_FLY			= 5;
+float	MOVETYPE_TOSS			= 6;	// gravity
+float	MOVETYPE_PUSH			= 7;	// no clip to world, push and crush
+float	MOVETYPE_NOCLIP			= 8;
+float	MOVETYPE_FLYMISSILE		= 9;	// fly with extra size against monsters
+float	MOVETYPE_BOUNCE			= 10;
+float	MOVETYPE_BOUNCEMISSILE	= 11;	// bounce with extra size
+
+// edict.solid values
+float	SOLID_NOT				= 0;	// no interaction with other objects
+float	SOLID_TRIGGER			= 1;	// touch on edge, but not blocking
+float	SOLID_BBOX				= 2;	// touch on edge, block
+float	SOLID_SLIDEBOX			= 3;	// touch on edge, but not an onground
+float	SOLID_BSP				= 4;	// bsp clip, touch on edge, block
+
+// range values
+float	RANGE_MELEE				= 0;
+float	RANGE_NEAR				= 1;
+float	RANGE_MID				= 2;
+float	RANGE_FAR				= 3;
+
+// deadflag values
+
+float	DEAD_NO					= 0;
+float	DEAD_DYING				= 1;
+float	DEAD_DEAD				= 2;
+float	DEAD_RESPAWNABLE		= 3;
+float	DEAD_RESPAWNING			= 4; // dead, waiting for buttons to be released
+
+// takedamage values
+
+float	DAMAGE_NO				= 0;
+float	DAMAGE_YES				= 1;
+float	DAMAGE_AIM				= 2;
+
+// items
+float	IT_AXE					= 4096;
+float	IT_SHOTGUN				= 1;
+float	IT_SUPER_SHOTGUN		= 2;
+float	IT_NAILGUN				= 4;
+float	IT_SUPER_NAILGUN		= 8;
+float	IT_GRENADE_LAUNCHER		= 16;
+float	IT_ROCKET_LAUNCHER		= 32;
+float	IT_LIGHTNING			= 64;
+float	IT_EXTRA_WEAPON			= 128;
+
+float	IT_SHELLS				= 256;
+float	IT_NAILS				= 512;
+float	IT_ROCKETS				= 1024;
+float	IT_CELLS				= 2048;
+
+float	IT_ARMOR1				= 8192;
+float	IT_ARMOR2				= 16384;
+float	IT_ARMOR3				= 32768;
+float	IT_SUPERHEALTH			= 65536;
+
+float	IT_KEY1					= 131072;
+float	IT_KEY2					= 262144;
+
+float	IT_INVISIBILITY			= 524288;
+float	IT_INVULNERABILITY		= 1048576;
+float	IT_SUIT					= 2097152;
+float	IT_QUAD					= 4194304;
+
+// point content values
+
+float	CONTENT_EMPTY			= -1;
+float	CONTENT_SOLID			= -2;
+float	CONTENT_WATER			= -3;
+float	CONTENT_SLIME			= -4;
+float	CONTENT_LAVA			= -5;
+float	CONTENT_SKY				= -6;
+
+float	STATE_TOP		= 0;
+float	STATE_BOTTOM	= 1;
+float	STATE_UP		= 2;
+float	STATE_DOWN		= 3;
+
+vector	VEC_ORIGIN = '0 0 0';
+vector	VEC_HULL_MIN = '-16 -16 -24';
+vector	VEC_HULL_MAX = '16 16 32';
+
+vector	VEC_HULL2_MIN = '-32 -32 -24';
+vector	VEC_HULL2_MAX = '32 32 64';
+
+// protocol bytes
+float	SVC_TEMPENTITY		= 23;
+float	SVC_KILLEDMONSTER	= 27;
+float	SVC_FOUNDSECRET		= 28;
+float	SVC_INTERMISSION	= 30;
+float	SVC_FINALE			= 31;
+float	SVC_CDTRACK			= 32;
+float	SVC_SELLSCREEN		= 33;
+
+
+float	TE_SPIKE		= 0;
+float	TE_SUPERSPIKE	= 1;
+float	TE_GUNSHOT		= 2;
+float	TE_EXPLOSION	= 3;
+float	TE_TAREXPLOSION	= 4;
+float	TE_LIGHTNING1	= 5;
+float	TE_LIGHTNING2	= 6;
+float	TE_WIZSPIKE		= 7;
+float	TE_KNIGHTSPIKE	= 8;
+float	TE_LIGHTNING3	= 9;
+float	TE_LAVASPLASH	= 10;
+float	TE_TELEPORT		= 11;
+
+// sound channels
+// channel 0 never willingly overrides
+// other channels (1-7) allways override a playing sound on that channel
+float	CHAN_AUTO		= 0;
+float	CHAN_WEAPON		= 1;
+float	CHAN_VOICE		= 2;
+float	CHAN_ITEM		= 3;
+float	CHAN_BODY		= 4;
+
+float	ATTN_NONE		= 0;
+float	ATTN_NORM		= 1;
+float	ATTN_IDLE		= 2;
+float	ATTN_STATIC		= 3;
+
+// update types
+
+float	UPDATE_GENERAL	= 0;
+float	UPDATE_STATIC	= 1;
+float	UPDATE_BINARY	= 2;
+float	UPDATE_TEMP		= 3;
+
+// entity effects
+
+float	EF_BRIGHTFIELD	= 1;
+float	EF_MUZZLEFLASH 	= 2;
+float	EF_BRIGHTLIGHT 	= 4;
+float	EF_DIMLIGHT 	= 8;
+
+
+// messages
+float	MSG_BROADCAST	= 0;		// unreliable to all
+float	MSG_ONE			= 1;		// reliable to one (msg_entity)
+float	MSG_ALL			= 2;		// reliable to all
+float	MSG_INIT		= 3;		// write to the init string
+
+//===========================================================================
+
+//
+// builtin functions
+//
+
+void(vector ang)	makevectors		= #1;		// sets v_forward, etc globals
+void(entity e, vector o) setorigin	= #2;
+void(entity e, string m) setmodel	= #3;		// set movetype and solid first
+void(entity e, vector min, vector max) setsize = #4;
+// #5 was removed
+void() break						= #6;
+float() random						= #7;		// returns 0 - 1
+void(entity e, float chan, string samp, float vol, float atten) sound = #8;
+vector(vector v) normalize			= #9;
+void(string e, ...) error				= #10;
+void(string e, ...) objerror				= #11;
+float(vector v) vlen				= #12;
+float(vector v) vectoyaw			= #13;
+entity() spawn						= #14;
+void(entity e) remove				= #15;
+
+// sets trace_* globals
+// nomonsters can be:
+// An entity will also be ignored for testing if forent == test,
+// forent->owner == test, or test->owner == forent
+// a forent of world is ignored
+void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
+
+entity() checkclient				= #17;	// returns a client to look for
+entity(entity start, .string fld, string match) find = #18;
+string(string s) precache_sound		= #19;
+string(string s) precache_model		= #20;
+void(entity client, string s, ...)stuffcmd = #21;
+entity(vector org, float rad) findradius = #22;
+void(string s, ...) bprint				= #23;
+void(entity client, string s, ...) sprint = #24;
+void(string s, ...) dprint				= #25;
+string(float f) ftos				= #26;
+string(vector v) vtos				= #27;
+void() coredump						= #28;		// prints all edicts
+void() traceon						= #29;		// turns statment trace on
+void() traceoff						= #30;
+void(entity e) eprint				= #31;		// prints an entire edict
+float(float yaw, float dist) walkmove	= #32;	// returns TRUE or FALSE
+// #33 was removed
+float() droptofloor= #34;	// TRUE if landed on floor
+void(float style, string value) lightstyle = #35;
+float(float v) rint					= #36;		// round to nearest int
+float(float v) floor				= #37;		// largest integer <= v
+float(float v) ceil					= #38;		// smallest integer >= v
+// #39 was removed
+float(entity e) checkbottom			= #40;		// true if self is on ground
+float(vector v) pointcontents		= #41;		// returns a CONTENT_*
+// #42 was removed
+float(float f) fabs = #43;
+vector(entity e, float speed) aim = #44;		// returns the shooting vector
+float(string s) cvar = #45;						// return cvar.value
+void(string s, ...) localcmd = #46;					// put string into local que
+entity(entity e) nextent = #47;					// for looping through all ents
+void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
+void() ChangeYaw = #49;						// turn towards self.ideal_yaw
+											// at self.yaw_speed
+// #50 was removed
+vector(vector v) vectoangles			= #51;
+
+//
+// direct client message generation
+//
+void(float to, float f) WriteByte		= #52;
+void(float to, float f) WriteChar		= #53;
+void(float to, float f) WriteShort		= #54;
+void(float to, float f) WriteLong		= #55;
+void(float to, float f) WriteCoord		= #56;
+void(float to, float f) WriteAngle		= #57;
+void(float to, string s, ...) WriteString	= #58;
+void(float to, entity s) WriteEntity	= #59;
+
+//
+// broadcast client message generation
+//
+
+// void(float f) bWriteByte		= #59;
+// void(float f) bWriteChar		= #60;
+// void(float f) bWriteShort		= #61;
+// void(float f) bWriteLong		= #62;
+// void(float f) bWriteCoord		= #63;
+// void(float f) bWriteAngle		= #64;
+// void(string s) bWriteString	= #65;
+// void(entity e) bWriteEntity = #66;
+
+void(float step) movetogoal				= #67;
+
+string(string s) precache_file		= #68;	// no effect except for -copy
+void(entity e) makestatic		= #69;
+void(string s) changelevel = #70;
+
+//#71 was removed
+
+void(string var, string val) cvar_set = #72;	// sets cvar.value
+
+void(entity client, string s, ...) centerprint = #73;	// sprint, but in middle
+
+void(vector pos, string samp, float vol, float atten) ambientsound = #74;
+
+string(string s) precache_model2	= #75;		// registered version only
+string(string s) precache_sound2	= #76;		// registered version only
+string(string s) precache_file2		= #77;		// registered version only
+
+void(entity e) setspawnparms		= #78;		// set parm1... to the
+												// values at level start
+												// for coop respawn
+
+//============================================================================
diff --git a/qcsrc/server/sys.qh b/qcsrc/server/sys.qh
index 98ac726ba..9c0548385 100644
--- a/qcsrc/server/sys.qh
+++ b/qcsrc/server/sys.qh
@@ -1,147 +1,17 @@
-#pragma flag off fastarrays // make dp behave with new fteqcc versions. remove when dp bug with fteqcc fastarrays is fixed
 #define SVQC
 
-// DO NOT modify the contents of this file, or you will risk incompatibility with the game engine.
-
-entity		self;
-entity		other;
-entity		world;
-
-float		time;
-float		frametime;
-float		force_retouch;
-string		mapname;
-float		deathmatch;
-float		coop;
-float		teamplay;
-float		serverflags;
-float		total_secrets;
-float		total_monsters;
-float		found_secrets;
-float		killed_monsters;
-float		parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
-vector		v_forward, v_up, v_right;
-float		trace_allsolid;
-float		trace_startsolid;
-float		trace_fraction;
-vector		trace_endpos;
-vector		trace_plane_normal;
-float		trace_plane_dist;
-entity		trace_ent;
-float		trace_inopen;
-float		trace_inwater;
-
-entity		msg_entity;
-
-void		main (void);
-void		StartFrame (void);
-void		PlayerPreThink (void);
-void		PlayerPostThink (void);
-void		ClientKill (void);
-void		ClientConnect (void);
-void		PutClientInServer (void);
-void		ClientDisconnect (void);
-void		SetNewParms (void);
-void		SetChangeParms (void);
-
-/////////////////////////////////////////////////////////
-void		end_sys_globals;
-/////////////////////////////////////////////////////////
-
-.float		modelindex;
-
-.vector		absmin, absmax;
-
-.float		ltime;
-.float		movetype;
-.float		solid;
-
-.vector		origin;
-.vector		oldorigin;
-.vector		velocity;
-.vector		angles;
-.vector		avelocity;
-.vector		punchangle;
-
-.string		classname;
-.string		model;
-
-.float		frame;
-.float		skin;
-.float		effects;
-
-.vector		mins, maxs;
-.vector		size;
-
-.void()		touch;
-.void()		use;
-.void()		think;
-.void()		blocked;
-
-.float		nextthink;
-
-.entity		groundentity;
-
-.float		health;
-.float		frags;
-
-.float		weapon;
-.string		weaponmodel;
-.float		weaponframe;
-
-.float		currentammo;
-.float		ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
-.float		items;
-
-.float		takedamage;
-
-.entity		chain;
-
-.float		deadflag;
-
-.vector		view_ofs;
-
-.float		button0;
-.float		button1;
-.float		button2;
-.float		impulse;
-.float		fixangle;
-.vector		v_angle;
-.float		idealpitch;
-
-.string		netname;
-.entity 	enemy;
-
-.float		flags;
-.float		colormap;
-.float		team;
-.float		max_health;
-.float		teleport_time; // movement input is blocked till that time; set e.g. by waterjump logic - BUT, movement and friction still takes place
-.float		armortype;
-.float		armorvalue;
-.float		waterlevel;
-.float		watertype;
-.float		ideal_yaw;
-.float		yaw_speed;
-
-.entity		aiment;
-.entity 	goalentity;
-
-.float		spawnflags;
-
-.string		target;
-.string		targetname;
-
-.float		dmg_take;
-.float		dmg_save;
-.entity		dmg_inflictor;
-
-.entity		owner;
-.vector		movedir;
-.string		message;
-.float		sounds;
-.string		noise, noise1, noise2, noise3;
-
-/////////////////////////////////////////////////////////
-void		end_sys_fields;
-/////////////////////////////////////////////////////////
+#define ATTN_NORM builtin_ATTN_NORM
+#define objerror builtin_objerror
+#define droptofloor builtin_droptofloor
+#define sound builtin_sound
+#define remove builtin_remove
+#define cvar_set builtin_cvar_set
+
+#include "progsdefs.qc"
+
+#undef ATTN_NORM
+#undef objerror
+#undef droptofloor
+#undef sound
+#undef remove
+#undef cvar_set
diff --git a/qcsrc/server/tturrets/system/system_main.qc b/qcsrc/server/tturrets/system/system_main.qc
index 570310a25..6b92f8bb0 100644
--- a/qcsrc/server/tturrets/system/system_main.qc
+++ b/qcsrc/server/tturrets/system/system_main.qc
@@ -1041,7 +1041,7 @@ float turret_stdproc_init (string cvar_base_name, string base, string head, floa
     }
     
     if not (self.spawnflags & TSF_SUSPENDED)
-        droptofloor_builtin();
+        builtin_droptofloor(); // why can't we use regular droptofloor here?
 
     // Terrainbase spawnflag. This puts a enlongated model
     // under the turret, so it looks ok on uneaven surfaces.
-- 
2.39.5