r99 - in trunk: . client progsqc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Feb 6 07:08:07 EST 2008


Author: vermeulen
Date: 2008-02-06 07:08:06 -0500 (Wed, 06 Feb 2008)
New Revision: 99

Added:
   trunk/client/
   trunk/client/a_constants.qc
   trunk/client/cl_constants.qc
   trunk/client/cl_defs.qc
   trunk/client/cl_extensions.qc
   trunk/client/cl_main.qc
   trunk/client/cl_sbar.qc
   trunk/client/cl_vars.qc
   trunk/client/progs.src
Modified:
   trunk/progsqc/inventory.qc
Log:
added basic client side code

Added: trunk/client/a_constants.qc
===================================================================
--- trunk/client/a_constants.qc	                        (rev 0)
+++ trunk/client/a_constants.qc	2008-02-06 12:08:06 UTC (rev 99)
@@ -0,0 +1,91 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+// These are constants which are common between client and server quakec.
+// Things like items and flags which are sent from client to server.
+
+// helpful things
+entity NULL = world;
+
+float TRUE  = 1;
+float FALSE = 0;
+
+float EXTRA_LOW = -99999999;
+float EXTRA_HIGH = 99999999;
+
+vector VEC_1  = '1 1 1';
+vector VEC_0  = '0 0 0';
+vector VEC_M1 = '-1 -1 -1';
+
+float M_PI = 3.14159265358979323846;
+
+// 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;
+
+// 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
+
+// entity effects bits
+float EF_BRIGHTFIELD  = 1;
+float EF_MUZZLEFLASH  = 2;
+float EF_BRIGHTLIGHT  = 4;
+float EF_DIMLIGHT     = 8;
+float EF_NODRAW       = 16;
+float EF_ADDITIVE     = 32;
+float EF_BLUE         = 64;
+float EF_RED          = 128;
+float EF_FULLBRIGHT   = 512;
+float EF_FLAME        = 1024;
+float EF_STARDUST     = 2048;
+float EF_NOSHADOW     = 4096;
+float EF_NODEPTHTEST  = 8192;

Added: trunk/client/cl_constants.qc
===================================================================
--- trunk/client/cl_constants.qc	                        (rev 0)
+++ trunk/client/cl_constants.qc	2008-02-06 12:08:06 UTC (rev 99)
@@ -0,0 +1,82 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+// add-entity mask bits
+const float MASK_ENGINE				= 1;
+const float MASK_ENGINEVIEWMODELS	= 2;
+const float MASK_NORMAL				= 4;
+
+// renderflag bits
+const float RF_VIEWMODEL		= 1;
+const float RF_EXTERNALMODEL	= 2;
+const float RF_DEPTHHACK		= 4;
+const float RF_ADDATIVE			= 8;
+const float RF_USEAXIS			= 16;
+
+// setview parameter
+const float VF_MIN			= 1;	//(vector)
+const float VF_MIN_X		= 2;	//(float)
+const float VF_MIN_Y		= 3;	//(float)
+const float VF_SIZE			= 4;	//(vector) (viewport size)
+const float VF_SIZE_Y		= 5;	//(float)
+const float VF_SIZE_X		= 6;	//(float)
+const float VF_VIEWPORT		= 7;	//(vector, vector)
+const float VF_FOV			= 8;	//(vector)
+const float VF_FOVX			= 9;	//(float)
+const float VF_FOVY			= 10;	//(float)
+const float VF_ORIGIN		= 11;	//(vector)
+const float VF_ORIGIN_X		= 12;	//(float)
+const float VF_ORIGIN_Y		= 13;	//(float)
+const float VF_ORIGIN_Z		= 14;	//(float)
+const float VF_ANGLES		= 15;	//(vector)
+const float VF_ANGLES_X		= 16;	//(float)
+const float VF_ANGLES_Y		= 17;	//(float)
+const float VF_ANGLES_Z		= 18;	//(float)
+const float VF_DRAWWORLD	= 19;	//(float)
+const float VF_DRAWENGINESBAR	= 20;	//(float)
+const float VF_DRAWCROSSHAIR	= 21;	//(float)
+
+const float VF_CL_VIEWANGLES	= 33;	//(vector)
+const float VF_CL_VIEWANGLES_X	= 34;	//(float)
+const float VF_CL_VIEWANGLES_Y	= 35;	//(float)
+const float VF_CL_VIEWANGLES_Z	= 36;	//(float) 
+
+// stats
+// 0 - 31 are reserved for standard engine stats
+// 32 - 128 are for QuakeC modders
+const float STAT_HEALTH			= 0;
+const float STAT_WEAPONMODEL	= 2;
+const float STAT_AMMO			= 3;
+const float STAT_ARMOR			= 4;
+const float STAT_WEAPONFRAME	= 5;
+const float STAT_SHELLS			= 6;
+const float STAT_NAILS			= 7;
+const float STAT_ROCKETS		= 8;
+const float STAT_CELLS			= 9;
+const float STAT_ACTIVEWEAPON	= 10;
+const float	STAT_TOTALSECRETS	= 11;
+const float	STAT_TOTALMONSTERS	= 12;
+const float	STAT_SECRETS		= 13; // bumped on client side by svc_foundsecret
+const float	STAT_MONSTERS		= 14; // bumped by svc_killedmonster
+const float STAT_ITEMS			= 15;
+
+// player flags, calculated in 
+const float PFL_DEAD     = 4;
+const float PFL_GIBBED   = 8;

Added: trunk/client/cl_defs.qc
===================================================================
--- trunk/client/cl_defs.qc	                        (rev 0)
+++ trunk/client/cl_defs.qc	2008-02-06 12:08:06 UTC (rev 99)
@@ -0,0 +1,342 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+//NOTE: THIS IS AN INTERFACE FILE. DO NOT EDIT.
+//MODIFYING THIS FILE CAN RESULT IN CRC ERRORS.
+//YOU HAVE BEEN WARNED.
+
+//feel free to look though. :)
+
+
+
+
+#define CSQC 1
+
+/*
+==============================================================================
+
+			SOURCE FOR GLOBALVARS_T C STRUCTURE
+
+==============================================================================
+*/
+
+//
+// system globals
+//
+entity		self;
+entity		other;
+entity		world;
+float		time;
+float		frametime;
+
+float 		player_localentnum;	//the entnum
+float 		player_localnum;	//the playernum
+float		maxclients;	//a constant filled in by the engine. gah, portability eh?
+
+float		clientcommandframe;	//player movement
+float		servercommandframe;	//clientframe echoed off the server
+
+//float		intermission;
+
+string		mapname;
+
+//
+// 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;
+
+//
+// required prog functions
+//
+void()		CSQC_Init;
+void()		CSQC_Shutdown;
+float(float f, float t)	CSQC_InputEvent;
+void()		CSQC_UpdateView;
+float(string s)	CSQC_ConsoleCommand;
+
+
+//these fields are read and set by the default player physics
+vector		pmove_org;
+vector		pmove_vel;
+vector		pmove_mins;
+vector		pmove_maxs;
+//retrieved from the current movement commands (read by player physics)
+float		input_timelength;
+vector		input_angles;
+vector		input_movevalues;	//forwards, right, up.
+float		input_buttons;		//attack, use, jump (default physics only uses jump)
+
+float		movevar_gravity;
+float		movevar_stopspeed;
+float		movevar_maxspeed;
+float		movevar_spectatormaxspeed;	//used by NOCLIP movetypes.
+float		movevar_accelerate;
+float		movevar_airaccelerate;
+float		movevar_wateraccelerate;
+float		movevar_friction;
+float		movevar_waterfriction;
+float		movevar_entgravity;	//the local player's gravity field. Is a multiple (1 is the normal value)
+
+//================================================
+void		end_sys_globals;		// flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+			SOURCE FOR ENTVARS_T C STRUCTURE
+
+==============================================================================
+*/
+
+//
+// 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		entnum;	// *** the ent number as on the server
+.float		drawmask;
+.void()		predraw;
+
+.float		movetype;
+.float		solid;
+
+.vector		origin;			// ***
+.vector		oldorigin;		// ***
+.vector		velocity;
+.vector		angles;
+.vector		avelocity;
+
+.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		chain;
+
+.string		netname;
+
+.entity 	enemy;
+
+.float		flags;
+
+.float		colormap;
+
+.entity		owner;		// who launched a missile
+
+//================================================
+void		end_sys_fields;			// flag for structure dumping
+//================================================
+
+//-----------------------------------------------------------------------------
+// BUILTINS
+//-----------------------------------------------------------------------------
+
+// 'core' - standard qc minus the funcs that are server specific
+
+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;
+
+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;
+
+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
+
+// 'csqc'
+
+// sound is overridden on the server
+void (entity e, float chan, string samp, float vol, float atten)	sound = #8;
+
+// CSQC Builtins
+float()									ReadByte = #360;
+float()									ReadChar = #361;
+float()									ReadShort = #362;
+float()									ReadLong = #363;
+float()									ReadCoord = #364;
+float()									ReadAngle = #365;
+string()								ReadString = #366;	//warning: this returns a temporary!
+
+// CSQC builtins
+void ()									R_ClearScene = #300;
+void (float mask)						R_AddEntities = #301;
+void (entity e)							R_AddEntity = #302;
+float (float property, ...)				R_SetView = #303;
+void ()									R_RenderScene = #304;
+void (vector org, float radius, vector rgb)	R_AddDynamicLight = #305;
+void ()									R_CalcRefDef = #306;
+
+vector (vector v)						cs_unproject = #310;
+vector (vector v)						cs_project = #311;
+
+// CSQC draw builtins
+void	drawline(float width, vector pos1, vector pos2, vector rgb, float alpha, float flags) = #315;
+
+float	iscachedpic(string name)	= #316;
+string	precache_pic(string name, ...)	= #317;
+vector	drawgetimagesize(string pic) = #318;
+void	freepic(string name)		= #319;
+float	drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #320;
+float	drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #321;
+float	drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #322;
+float	drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #323;
+void	drawsetcliparea(float x, float y, float width, float height) = #324;
+void	drawresetcliparea(void) = #325;
+
+// CSQC stat builtins
+// coerent names with the server functions by krimzon
+float (float statnum)	GetStat_FLOAT           = #330;
+float (float statnum)	GetStat_FLOAT_TRUNCATED = #331;
+string (float statnum)	GetStat_STRING          = #332;
+
+// client side centerprint and print
+void (string s, ...)	cprint = #338;
+void (string s, ...)	print = #339;
+
+// csqc?
+void (entity e, float i)					setmodelindex = #333;
+string (float i)							modelnameforindex = #334;
+
+float(string efname)						particleseffectforname = #335;
+void(entity ent, float effectnum, vector start, vector end, ...)	trailparticles = #336;
+void (float efnum, vector org, vector vel, float countmultiplier)	pointparticles = #337;
+
+// csqc input thingy
+float(float framenum)	CL_getinputstate = #345;
+
+void (float scale)		setsensitivityscale = #347;
+
+void (float framenum)	RetrieveMovementFrame = #345;
+void ()					DefaultPlayerPhysics = #347;
+
+string (float playernum, string key)	getplayerkey = #348;
+void (string cmdname)	registercmd = #352;
+vector ()				getmousepos = #344;
+
+float ()				playernum = #354;
+
+void (vector org, vector forward, vector right, vector up) setlistener = #351;
+
+float (vector start, vector end, float ignore, float csqcents) selecttraceline = #355;
+float ()				isdemo = #349;
+float ()				isserver = #350;
+
+void (float f)			setwantsmousemove = #343;
+string (float key)		getkeybind = #342;
+
+float () onground = #355;
+
+// CSQC manual drawing
+void(string texturename, ...) R_BeginPolygon = #306;
+void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex = #307;
+void() R_EndPolygon = #308;
+
+float(string s, float num) charindex = #356;

Added: trunk/client/cl_extensions.qc
===================================================================
--- trunk/client/cl_extensions.qc	                        (rev 0)
+++ trunk/client/cl_extensions.qc	2008-02-06 12:08:06 UTC (rev 99)
@@ -0,0 +1,108 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+// CheckExtension
+float(string s) checkextension = #99;
+
+// critical=TRUE for anything that would cause the mod to crash, or major
+// rendering errors which affect gameplay. This depends on the mod - one might
+// depend on DP_ENT_ALPHA for gameplay, another might use it as mere eye-candy.
+void(string s, float critical) vcheckextension =
+{
+	if (!checkextension(s))
+	{
+	    if (critical)
+			print("^1CRITICAL ");
+	    print("^3(client) QSG extension required but not found: ");
+	    print(s);
+	    print("\n");
+	}
+};
+
+// All extensions used should be checked here.
+void() Check_Extensions =
+{
+	print("Checking client extensions...\n");
+	vcheckextension("FRIK_FILE", TRUE);
+	vcheckextension("FTE_STRINGS", TRUE);
+	vcheckextension("DP_QC_SINCOSSQRTPOW", TRUE);
+	print("Extensions check ok.\n");
+};
+
+// All extensions used should define builtins, fields and globals below this
+// line. I've been copying their sections from dpextensions.qc as I use them.
+// ---------------------------------------------------------------------------
+
+//FRIK_FILE
+//idea: FrikaC
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+float(string s) stof = #81; // get numerical value from a string
+float(string filename, float mode) fopen = #110; // opens a file inside quake/gamedir/data/ (mode is FILE_READ, FILE_APPEND, or FILE_WRITE), returns fhandle >= 0 if successful, or fhandle < 0 if unable to open file for any reason
+void(float fhandle) fclose = #111; // closes a file
+string(float fhandle) fgets = #112; // reads a line of text from the file and returns as a tempstring
+void(float fhandle, string s, ...) fputs = #113; // writes a line of text to the end of the file
+float(string s) strlen = #114; // returns how many characters are in a string
+string(string s1, string s2, ...) strcat = #115; // concatenates two or more strings (for example "abc", "def" would return "abcdef") and returns as a tempstring
+string(string s, float start, float length) substring = #116; // returns a section of a string as a tempstring
+vector(string s) stov = #117; // returns vector value from a string
+string(string s, ...) strzone = #118; // makes a copy of a string into the string zone and returns it, this is often used to keep around a tempstring for longer periods of time (tempstrings are replaced often)
+void(string s) strunzone = #119; // removes a copy of a string from the string zone (you can not use that string again or it may crash!!!)
+//constants:
+float FILE_READ = 0;
+float FILE_APPEND = 1;
+float FILE_WRITE = 2;
+
+//FTE_STRINGS
+//idea: many
+//darkplaces implementation: KrimZon
+//description:
+//various string manipulation functions
+float(string str, string sub, float startpos) strstrofs = #221;
+float(string str, float ofs) str2chr = #222;
+string(float c, ...) chr2str = #223;
+string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
+string(float chars, string s, ...) strpad = #225;
+string(string info, string key, string value, ...) infoadd = #226;
+string(string info, string key) infoget = #227;
+float(string s1, string s2, float len) strncmp = #228;
+float(string s1, string s2) strcasecmp = #229;
+float(string s1, string s2, float len) strncasecmp = #230;
+// strconv parameters
+float CONV_SAME         = 0;
+float CONV_CASE_LOWER   = 1;
+float CONV_CASE_UPPER   = 2;
+float CONV_WHITE        = 1;
+float CONV_RED          = 2;
+float CONV_REDSPECIAL   = 3;
+float CONV_WHITESPECIAL = 4;
+float CONV_ALTERNATE_RW = 5;
+float CONV_ALTERNATE_WR = 6;
+
+//DP_QC_SINCOSSQRTPOW
+//idea: id Software, LordHavoc
+//darkplaces implementation: id Software, LordHavoc
+//builtin definitions:
+float(float val) sin = #60;
+float(float val) cos = #61;
+float(float val) sqrt = #62;
+float(float a, float b) pow = #97;
+//description:
+//useful math functions, sine of val, cosine of val, square root of val, and raise a to power b, respectively.

Added: trunk/client/cl_main.qc
===================================================================
--- trunk/client/cl_main.qc	                        (rev 0)
+++ trunk/client/cl_main.qc	2008-02-06 12:08:06 UTC (rev 99)
@@ -0,0 +1,117 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+float nxt_cmd;
+
+void() UpdateVariables =
+{
+	local float f;
+
+	vid_width = cvar("vid_conwidth");
+	vid_height = cvar("vid_conheight");
+	
+	sbar_alpha_bg = cvar("sbar_alpha_bg");
+	sbar_alpha_fg = cvar("sbar_alpha_fg");
+	
+	scr_viewsize = cvar("viewsize");
+	
+	CL_getinputstate(clientcommandframe);
+};
+
+void(float isnew) CSQC_Ent_Update =
+{
+};
+
+void() CSQC_Ent_Remove =
+{
+	remove(self);
+};
+
+
+void() CSQC_Init =
+{
+	Sbar_Init();
+};
+
+void() CSQC_Shutdown =
+{
+};
+
+float(string s) CSQC_ConsoleCommand =
+{
+	/*
+	float argc;
+	string cmd, cmd2, parm;
+
+	argc = tokenize(s);
+	cmd = argv(0);
+	*/
+
+	if (s == "+showscores")
+	{
+		showscores = 1;
+		return TRUE;
+	}
+	if (s == "-showscores")
+	{
+		showscores = 0;
+		return TRUE;
+	}
+
+	return FALSE;
+};
+
+void() CSQC_UpdateView =
+{
+	UpdateVariables();
+
+	R_ClearScene();
+	R_AddEntities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS);
+
+	R_SetView(VF_DRAWWORLD, 1);
+	R_SetView(VF_DRAWCROSSHAIR, 1);
+	R_SetView(VF_DRAWENGINESBAR, 1);
+	
+	R_RenderScene();
+	
+	Sbar_Draw();
+};
+
+float(float event, float parama) CSQC_InputEvent =
+{
+	return FALSE;
+};
+
+/*
+void(string msg) CSQC_Parse_StuffCmd =
+{
+	localcmd(msg);
+};
+
+void(string msg) CSQC_Parse_Print =
+{
+	print(msg);
+};
+
+void(string msg) CSQC_Parse_CenterPrint =
+{
+	cprint(msg);
+};
+*/

Added: trunk/client/cl_sbar.qc
===================================================================
--- trunk/client/cl_sbar.qc	                        (rev 0)
+++ trunk/client/cl_sbar.qc	2008-02-06 12:08:06 UTC (rev 99)
@@ -0,0 +1,77 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+float SBAR_HEIGHT = 24;
+
+float cl_items;
+entity scoreboard_chain;
+float  scoreboard_size;
+
+//-----------------------------------------------------------------------------
+// Sbar_Init
+//-----------------------------------------------------------------------------
+
+void() Sbar_Init =
+{
+	precache_pic("gfx/sb_shells");
+	precache_pic("gfx/sb_nails");
+	precache_pic("gfx/sb_rocket");
+	precache_pic("gfx/sb_cells");
+};
+
+//-----------------------------------------------------------------------------
+// Sbar_Draw functions
+//-----------------------------------------------------------------------------
+
+float(float x) NewX =
+{
+	return x + ((vid_width - 320) / 2);
+};
+
+void(float x, float y, string pic, float alph) Sbar_DrawPic =
+{
+	local float width;
+	local vector siz, pos;
+	siz = drawgetimagesize(pic);
+	pos_x = NewX(x);
+	pos_y = vid_height - y;
+	drawpic(pos, pic, siz, VEC_1, alph, 0);
+};
+
+//-----------------------------------------------------------------------------
+// Sbar_Draw
+//-----------------------------------------------------------------------------
+
+void() Sbar_Draw =
+{
+	local float f;
+	
+	f = GetStat_FLOAT_TRUNCATED(STAT_CELLS);
+	if (f==1)
+		Sbar_DrawPic (0, 50, "gfx/item1", sbar_alpha_fg);
+	else if (f==2)
+		Sbar_DrawPic (0, 50, "gfx/item2", sbar_alpha_fg);
+	else if (f==3)
+		Sbar_DrawPic (0, 50, "gfx/item3", sbar_alpha_fg);
+	else if (f==4)
+		Sbar_DrawPic (0, 50, "gfx/item4", sbar_alpha_fg);
+	else if (f==5)
+		Sbar_DrawPic (0, 50, "gfx/item5", sbar_alpha_fg);
+};

Added: trunk/client/cl_vars.qc
===================================================================
--- trunk/client/cl_vars.qc	                        (rev 0)
+++ trunk/client/cl_vars.qc	2008-02-06 12:08:06 UTC (rev 99)
@@ -0,0 +1,28 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+float vid_width, vid_height;
+
+// sbar
+float sbar_alpha_bg, sbar_alpha_fg;
+float showscores;
+
+// sbar and view
+float scr_viewsize;

Added: trunk/client/progs.src
===================================================================
--- trunk/client/progs.src	                        (rev 0)
+++ trunk/client/progs.src	2008-02-06 12:08:06 UTC (rev 99)
@@ -0,0 +1,10 @@
+../csprogs.dat
+
+cl_defs.qc
+cl_constants.qc
+a_constants.qc
+cl_extensions.qc
+
+cl_vars.qc
+cl_sbar.qc
+cl_main.qc

Modified: trunk/progsqc/inventory.qc
===================================================================
--- trunk/progsqc/inventory.qc	2008-02-02 12:03:45 UTC (rev 98)
+++ trunk/progsqc/inventory.qc	2008-02-06 12:08:06 UTC (rev 99)
@@ -32,7 +32,7 @@
 float ITEMTYPE_ITEM2 = 23;
 float ITEMTYPE_ITEM3 = 24;
 float ITEMTYPE_ITEM4 = 25;
-float ITEMTYPE_ITEM5 = 25;
+float ITEMTYPE_ITEM5 = 26;
 
 float ITEMTYPE_AMMO1 = 27;
 float ITEMTYPE_AMMO2 = 28;
@@ -391,7 +391,7 @@
 		character.ammo_shells = 0;
 		//character.ammo_nails = 0;
 		//character.ammo_rockets = 0;
-		character.ammo_cells = 0;
+		character.ammo_cells = character.itemselected - ITEMTYPE_ITEM1 + 1;
 		if (iteminfo_ammomax + iteminfo_ammoinventorymax)
 		{
 			character.currentammo = iteminfo_ammo * 200 / (iteminfo_ammomax + iteminfo_ammoinventorymax);




More information about the zymotic-commits mailing list