]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/dpdefs/csprogsdefs.qc
#include this
[xonotic/xonotic-data.pk3dir.git] / qcsrc / dpdefs / csprogsdefs.qc
index 9c138add7bc996929fb30f219682d9d3f3822e1d..dac4c1651a7fb62a61560676a2663f95937a060f 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef CSPROGSDEFS_H
+#define CSPROGSDEFS_H
 /*
 ==============================================================================
 
@@ -48,7 +50,7 @@ void()                CSQC_Init;
 void()         CSQC_Shutdown;
 float(float f, float t, float n)       CSQC_InputEvent;
 void(float w, float h)         CSQC_UpdateView;
-float(string s)        CSQC_ConsoleCommand;
+bool(string s) CSQC_ConsoleCommand;
 
 //these fields are read and set by the default player physics
 vector         pmove_org;
@@ -88,7 +90,7 @@ void          end_sys_globals;                // flag for structure dumping
 //
 // system fields (*** = do not set in prog code, maintained by C code)
 //
-.float         modelindex;             // *** model index in the precached list
+.int           modelindex;             // *** model index in the precached list
 .vector                absmin, absmax; // *** origin + mins / maxs
 
 .int           entnum; // *** the ent number as on the server
@@ -106,8 +108,8 @@ void                end_sys_globals;                // flag for structure dumping
 
 .string                classname;              // spawn function
 .string                model;
-.float         frame;
-.float         skin;
+.int           frame;
+.int           skin;
 .int           effects;
 
 .vector                mins, maxs;             // bounding box extents reletive to origin
@@ -198,22 +200,22 @@ const int VF_CL_VIEWANGLES_Z      = 36;   //(float)
 
 const int VF_PERSPECTIVE       = 200;
 
-const int STAT_HEALTH                  = 0;
-const int STAT_WEAPONMODEL             = 2;
-const int STAT_AMMO                            = 3;
-const int STAT_ARMOR                   = 4;
-const int STAT_WEAPONFRAME             = 5;
-const int STAT_SHELLS                  = 6;
-const int STAT_NAILS                   = 7;
-const int STAT_ROCKETS                 = 8;
-const int STAT_CELLS                   = 9;
-const int STAT_ACTIVEWEAPON            = 10;
-const int STAT_TOTALSECRETS            = 11;
-const int STAT_TOTALMONSTERS   = 12;
-const int STAT_SECRETS                 = 13;
-const int STAT_MONSTERS                        = 14;
-const int STAT_ITEMS                   = 15;
-const int STAT_VIEWHEIGHT              = 16;
+//const int STAT_HEALTH                        = 0;
+//const int STAT_WEAPONMODEL   = 2;
+//const int STAT_AMMO                  = 3;
+//const int STAT_ARMOR                 = 4;
+//const int STAT_WEAPONFRAME   = 5;
+//const int STAT_SHELLS                        = 6;
+//const int STAT_NAILS                 = 7;
+//const int STAT_ROCKETS               = 8;
+//const int STAT_CELLS                 = 9;
+//const int STAT_ACTIVEWEAPON  = 10;
+//const int STAT_TOTALSECRETS  = 11;
+//const int STAT_TOTALMONSTERS = 12;
+//const int STAT_SECRETS               = 13;
+//const int STAT_MONSTERS              = 14;
+//const int STAT_ITEMS                 = 15;
+//const int STAT_VIEWHEIGHT            = 16;
 
 // Quake Sound Constants
 const int CHAN_AUTO                            = 0;
@@ -260,7 +262,7 @@ const vector VEC_1                          = '1 1 1';
 const vector VEC_0                             = '0 0 0';
 const vector VEC_M1                            = '-1 -1 -1';
 
-const float M_PI                               = 3.14159265358979323846;
+//const float M_PI                             = 3.14159265358979323846;
 
 vector VEC_HULL_MIN                            = '-16 -16 -24';
 vector VEC_HULL_MAX                            = '16 16 32';
@@ -419,7 +421,7 @@ entity(entity start, .float fld, float match) findfloat = #98;
 float(string s) checkextension = #99;
 // FrikaC and Telejano range #100-#199
 
-float(string filename, float mode) fopen = #110;
+int(string filename, int mode) fopen = #110;
 void(float fhandle) fclose = #111;
 string(float fhandle) fgets = #112;
 void(float fhandle, string s) fputs = #113;
@@ -479,12 +481,12 @@ void(void) drawresetcliparea = #325;
 float(vector position, string text, vector scale, float alpha, float flag) drawcolorcodedstring = #326;
 vector(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawcolorcodedstring2 = #326;
 
-float(float stnum) getstatf = #330;
-float(float stnum, ...) getstati = #331; // can optionally take first bit and count
+float(int stnum) getstatf = #330;
+int(int stnum, ...) getstati = #331; // can optionally take first bit and count
 string(float firststnum) getstats = #332;
 void(entity e, float mdlindex) setmodelindex = #333;
 string(float mdlindex) modelnameforindex = #334;
-float(string effectname) particleeffectnum = #335;
+int(string effectname) particleeffectnum = #335;
 void(entity ent, float effectnum, vector start, vector end) trailparticles = #336;
 //void(float effectnum, vector origin [, vector dir, float count]) pointparticles = #337;
 void(float effectnum, vector origin , vector dir, float count) pointparticles = #337;
@@ -551,14 +553,14 @@ void(entity own, vector start, vector end) te_lightning3 = #430;
 void(entity own, vector start, vector end) te_beam = #431;
 void(vector dir) vectorvectors = #432;
 void(vector org) te_plasmaburn = #433;
-float(entity e, float s) getsurfacenumpoints = #434;
-vector(entity e, float s, float n) getsurfacepoint = #435;
-vector(entity e, float s) getsurfacenormal = #436;
-string(entity e, float s) getsurfacetexture = #437;
-float(entity e, vector p) getsurfacenearpoint = #438;
-vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
-
-float(string s) tokenize = #441;
+//float(entity e, float s) getsurfacenumpoints = #434;
+//vector(entity e, float s, float n) getsurfacepoint = #435;
+//vector(entity e, float s) getsurfacenormal = #436;
+//string(entity e, float s) getsurfacetexture = #437;
+//float(entity e, vector p) getsurfacenearpoint = #438;
+//vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
+
+int(string s) tokenize = #441;
 string(float n) argv = #442;
 void(entity e, entity tagentity, string tagname) setattachment = #443;
 float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
@@ -568,13 +570,13 @@ string(float handle, float num) search_getfilename = #447;
 string(string s) cvar_string = #448;
 entity(entity start, .float fld, float match) findflags = #449;
 entity(.float fld, float match) findchainflags = #450;
-float(entity ent, string tagname) gettagindex = #451;
+int(entity ent, string tagname) gettagindex = #451;
 vector(entity ent, float tagindex) gettaginfo = #452;
 
 void(vector org, vector vel, float howmany) te_flamejet = #457;
 
 entity(float num) entitybyindex = #459;
-float() buf_create = #460;
+int() buf_create = #460;
 void(float bufhandle) buf_del = #461;
 float(float bufhandle) buf_getsize = #462;
 void(float bufhandle_from, float bufhandle_to) buf_copy = #463;
@@ -585,11 +587,11 @@ void(float bufhandle, float string_index, string str) bufstr_set = #467;
 float(float bufhandle, string str, float order) bufstr_add = #468;
 void(float bufhandle, float string_index) bufstr_free = #469;
 
-float(float s) asin = #471;
-float(float c) acos = #472;
-float(float t) atan = #473;
-float(float c, float s) atan2 = #474;
-float(float a) tan = #475;
+//float(float s) asin = #471;
+//float(float c) acos = #472;
+//float(float t) atan = #473;
+//float(float c, float s) atan2 = #474;
+//float(float a) tan = #475;
 float(string s) strippedstringlen = #476;
 float(string s) strlennocol = #476; // This is the correct name for the function, but not removing the decolorizedstring mapping.
 string(string s) decolorizedstring = #477;
@@ -601,7 +603,7 @@ string(string s) cvar_defstring = #482;
 void(vector origin, string sample, float volume, float attenuation) pointsound = #483;
 string(string search, string replace, string subject) strreplace = #484;
 string(string search, string replace, string subject) strireplace = #485;
-vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
+//vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
 #ifdef SUPPORT_GECKO
 float gecko_create( string name ) = #487;
 void gecko_destroy( string name ) = #488;
@@ -1017,7 +1019,7 @@ float GETTIME_CDTRACK = 4;
 //idea: Electro, SavageX, LordHavoc
 //darkplaces implementation: LordHavoc
 //builtin definitions:
-float(string s, string separator1, ...) tokenizebyseparator = #479;
+int(string s, string separator1, ...) tokenizebyseparator = #479;
 //description:
 //this function returns tokens separated by any of the supplied separator strings, example:
 //numnumbers = tokenizebyseparator("10.2.3.4", ".");
@@ -1028,9 +1030,9 @@ float(string s, string separator1, ...) tokenizebyseparator = #479;
 //idea: divVerent
 //darkplaces implementation: divVerent
 //builtin definitions:
-float(string s) tokenize_console = #514;
-float(float i) argv_start_index = #515;
-float(float i) argv_end_index = #516;
+int(string s) tokenize_console = #514;
+int(float i) argv_start_index = #515;
+int(float i) argv_end_index = #516;
 //description:
 //this function returns tokens separated just like the console does
 //also, functions are provided to get the index of the first and last character of each token in the original string
@@ -1229,10 +1231,10 @@ float(float modlindex, string framename) frameforname = #276; // finds number of
 float(float modlindex, float framenum) frameduration = #277; // returns the intended play time (in seconds) of the specified framegroup, if it does not exist the result is 0, if it is a single frame it may be a small value around 0.1 or 0.
 //fields:
 .float skeletonindex; // active skeleton overriding standard animation on model
-.float frame; // primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
-.float frame2; // secondary framegroup animation (strength = lerpfrac)
-.float frame3; // tertiary framegroup animation (strength = lerpfrac3)
-.float frame4; // quaternary framegroup animation (strength = lerpfrac4)
+.int frame; // primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
+.int frame2; // secondary framegroup animation (strength = lerpfrac)
+.int frame3; // tertiary framegroup animation (strength = lerpfrac3)
+.int frame4; // quaternary framegroup animation (strength = lerpfrac4)
 .float lerpfrac; // strength of framegroup blend
 .float lerpfrac3; // strength of framegroup blend
 .float lerpfrac4; // strength of framegroup blend
@@ -1267,7 +1269,7 @@ float(float modlindex, float framenum) frameduration = #277; // returns the inte
 //"leftarm" (which is a child of "torso") which would return 2 instead...
 float(float skel, float bonenum, string g1, string g2, string g3, string g4, string g5, string g6) example_skel_findbonegroup =
 {
-       local string bonename;
+       string bonename;
        while (bonenum >= 0)
        {
                bonename = skel_get_bonename(skel, bonenum);
@@ -1307,8 +1309,6 @@ void(float animmodelindex, float framegroup, float framegroupstarttime) example_
 // apply a different framegroup animation to bones with a specified parent
 void(float animmodelindex, float framegroup, float framegroupstarttime, float blendalpha, string groupbonename, string excludegroupname1, string excludegroupname2) example_skel_player_update_applyoverride =
 {
-       local float bonenum;
-       local float numbones;
        self.frame = framegroup;
        self.frame2 = 0;
        self.frame3 = 0;
@@ -1320,8 +1320,8 @@ void(float animmodelindex, float framegroup, float framegroupstarttime, float bl
        self.lerpfrac = 0;
        self.lerpfrac3 = 0;
        self.lerpfrac4 = 0;
-       bonenum = 0;
-       numbones = skel_get_numbones(self.skeletonindex);
+       float bonenum = 0;
+       float numbones = skel_get_numbones(self.skeletonindex);
        while (bonenum < numbones)
        {
                if (example_skel_findbonegroup(self.skeletonindex, bonenum, groupbonename, excludegroupname1, excludegroupname2, "", "", "") == 1)
@@ -1332,46 +1332,39 @@ void(float animmodelindex, float framegroup, float framegroupstarttime, float bl
 // make eyes point at a target location, be sure v_forward, v_right, v_up are set correctly before calling
 void(vector eyetarget, string bonename) example_skel_player_update_eyetarget =
 {
-       local float bonenum;
-       local vector ang;
-       local vector oldforward, oldright, oldup;
-       local vector relforward, relright, relup, relorg;
-       local vector boneforward, boneright, boneup, boneorg;
-       local vector parentforward, parentright, parentup, parentorg;
-       local vector u, v;
-       local vector modeleyetarget;
-       bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
+       float bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
        if (bonenum < 0)
                return;
-       oldforward = v_forward;
-       oldright = v_right;
-       oldup = v_up;
-       v = eyetarget - self.origin;
+       vector oldforward = v_forward;
+       vector oldright = v_right;
+       vector oldup = v_up;
+       vector v = eyetarget - self.origin;
+       vector modeleyetarget;
        modeleyetarget_x =   v * v_forward;
        modeleyetarget_y = 0-v * v_right;
        modeleyetarget_z =   v * v_up;
        // this is an eyeball, make it point at the target location
        // first get all the data we can...
-       relorg = skel_get_bonerel(self.skeletonindex, bonenum);
-       relforward = v_forward;
-       relright = v_right;
-       relup = v_up;
-       boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
-       boneforward = v_forward;
-       boneright = v_right;
-       boneup = v_up;
-       parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
-       parentforward = v_forward;
-       parentright = v_right;
-       parentup = v_up;
+       vector relorg = skel_get_bonerel(self.skeletonindex, bonenum);
+       vector relforward = v_forward;
+       vector relright = v_right;
+       vector relup = v_up;
+       vector boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
+       vector boneforward = v_forward;
+       vector boneright = v_right;
+       vector boneup = v_up;
+       vector parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
+       vector parentforward = v_forward;
+       vector parentright = v_right;
+       vector parentup = v_up;
        // get the vector from the eyeball to the target
-       u = modeleyetarget - boneorg;
+       vector u = modeleyetarget - boneorg;
        // now transform it inversely by the parent matrix to produce new rel vectors
        v_x = u * parentforward;
        v_y = u * parentright;
        v_z = u * parentup;
-       ang = vectoangles2(v, relup);
-       ang_x = 0 - ang_x;
+       vector ang = vectoangles2(v, relup);
+       ang_x = 0 - ang.x;
        makevectors(ang);
        // set the relative bone matrix
        skel_set_bone(self.skeletonindex, bonenum, relorg);
@@ -1425,12 +1418,12 @@ float(string s) isfunction = #607;
 void(entity e, string s) parseentitydata = #608;
 
 // assorted builtins
-const float            STAT_MOVEVARS_TICRATE           = 240;
-const float            STAT_MOVEVARS_TIMESCALE         = 241;
-const float            STAT_FRAGLIMIT                                  = 235;
-const float            STAT_TIMELIMIT                                  = 236;
-const float     STAT_MOVEVARS_GRAVITY           = 242;
-string(void)                                           ReadPicture = #501;
+//const int STAT_MOVEVARS_TICRATE              = 240;
+//const int STAT_MOVEVARS_TIMESCALE            = 241;
+//const int STAT_FRAGLIMIT                             = 235;
+//const int STAT_TIMELIMIT                             = 236;
+//const int STAT_MOVEVARS_GRAVITY       = 242;
+string(void) ReadPicture                               = #501;
 const int PARTICLES_USEALPHA = 1;
 float particles_alphamin, particles_alphamax;
 const int PARTICLES_USECOLOR = 2;
@@ -1451,3 +1444,4 @@ vector gettaginfo_forward;
 vector gettaginfo_right;
 vector gettaginfo_up;
 float checkpvs(vector viewpos, entity viewee) = #240;
+#endif
\ No newline at end of file