Update csqctest a little (trying to flesh out qss's csqc support).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5749 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2020-08-24 07:45:18 +00:00
parent 8dcf4db927
commit 78c88547da
43 changed files with 5042 additions and 1283 deletions

View file

@ -1,78 +0,0 @@
//common builtins.
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;
void() break = #6;
float() random = #7; // returns 0 - 1
void(entity e, float chan, string samp, float vol, float atten) sound = #8;
void(entity e, float chan, string samp, float vol, float atten, float ppct) soundp = #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(entity start, .string fld, string match) find = #18;
string(string s) precache_sound = #19;
float(string s) precache_model = #20;
void(entity client, string s)stuffcmd = #21;
entity(vector org, float rad) findradius = #22;
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() droptofloor= #34; // TRUE if landed on floor
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
float(vector v) pointcontents = #41; // returns a CONTENT_*
float(float f) fabs = #43;
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
vector(vector v) vectoangles = #51;
void(string var, string val) cvar_set = #72; // sets cvar.value
string(float modelindex) name_for_modelindex = #334;
float(string modelname) modelindex_for_name = #20;
string(string s) precache_file = #68; // no effect except for -copy
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

View file

@ -1,161 +0,0 @@
#ifdef SSQC //this is core for csqc
float(string s) checkextension = #99;
#endif
//DP_QC_TRACEBOX
void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90;
//DP_QC_REGISTERCVAR
void(string name, string value) registercvar = #93;
//DP_QC_FINDFLOAT
entity(entity start, .float fld, float match) findfloat = #98;
entity(entity start, .entity fld, entity match) findentity = #98;
//FRIK_FILE (file subset)
float FILE_READ = 0;
float FILE_WRITE = 1;
float FILE_APPEND = 2;
float(string filename, float mode) fopen = #110;
void(float fhandle) fclose = #111;
string(float fhandle) fgets = #112;
void(float fhandle, string s) fputs = #113;
//FRIK_FILE (strings subset)
float(string s) strlen = #114;
string(...) strcat = #115;
string(string s, float start, float length) substring = #116;
vector(string s) stov = #117;
string(string s) strzone = #118;
void(string s) strunzone = #119;
//QW_ENGINE FRIK_FILE
#ifndef QUAKEWORLD
float(string s) stof = #81;
#endif
//KRIMZON_SV_PARSECLIENTCOMMAND (excluding clientcommand which is inherantly sv only)
float(string s) tokenize = #441;
string(float argnum) argv = #442;
//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.
//FTE_STRINGS
float(string str, string match) strstrofs = #221;
float(string str, float ofs) str2chr = #222;
string(float c, ...) chr2str = #223;
string(float ccase, float redalpha, float redchars, string str) strconv = #224;
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;
//DP_QC_FS_SEARCH
//idea: Black
//darkplaces implementation: Black
//builtin definitions:
float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
void(float handle) search_end = #445;
float(float handle) search_getsize = #446;
string(float handle, float num) search_getfilename = #447;
//description:
//search_begin performs a filename search with the specified pattern (for example "maps/*.bsp") and stores the results in a search slot (minimum of 128 supported by any engine with this extension), the other functions take this returned search slot number, be sure to search_free when done (they are also freed on progs reload).
//search_end frees a search slot (also done at progs reload).
//search_getsize returns how many filenames were found.
//search_getfilename returns a filename from the search.
//DP_QC_CVAR_STRING
//idea: Paul Timofeyev
//DarkPlaces implementation: Paul Timofeyev, LordHavoc
//builtin definitions:
string(string s) cvar_string = #448;
//description:
//returns the value of a cvar, as a tempstring.
//This file contains optional client-specific extensions which may not exist in all CSQC implementations.
//UNNAMED_FTE_CS_SKINS_AND_SHADERS
#ifdef CSQC
float(float modelindex, string skinname) skinforname = #237;
float(string skinname) shaderforname = #238;
float(float midx, string framename) frameforname = #275;
#endif
//UNNAMED_FTE_CS_TAG_SUPPORT
#ifdef CSQC
vector(entity ent, float tagnum) RotateVectorsByTag = #234;
void(vector angle) RotateVectorsByAngle = #235;
void(vector fwd, vector right, vector up) RotateVectorsByVectors = #236;
#endif
//DP_MD3_TAGSINFO
float(entity ent, string tagname) gettagindex = #451;
vector(entity ent, float tagindex) gettaginfo = #452;
//DP_GECKO_SUPPORT
#if defined(CSQC) || defined(MENU)
//idea: Res2k, BlackHC
//darkplaces implementation: Res2k, BlackHC
//FTE implementation: Spike (curtesy of liboffscreengecko)
//constant definitions:
float GECKO_BUTTON_DOWN = 0;
float GECKO_BUTTON_UP = 1;
// either use down and up or just press but not all of them!
float GECKO_BUTTON_PRESS = 2;
// use this for mouse events if needed?
float GECKO_BUTTON_DOUBLECLICK = 3;
//builtin definitions:
float(string name) gecko_create( string name ) = #487;
void(string name) gecko_destroy( string name ) = #488;
void(string name) gecko_navigate( string name, string URI ) = #489;
float(string name) gecko_keyevent( string name, float key, float eventtype ) = #490;
void gecko_mousemove( string name, float x, float y ) = #491;
void gecko_resize( string name, float w, float h ) = #492;
vector gecko_get_texture_extent( string name ) = #493;
//engine-called QC prototypes:
//string(string name, string query) Qecko_Query;
//description:
//provides an interface to the offscreengecko library and allows for internet browsing in games
#else
#warning no gecko
#endif
#ifdef SSQC
.float dimension_seen;
.float dimension_see;
float dimension_send;
#endif
//DP_TE_STANDARDEFFECTBUILTINS)
void(vector org) te_gunshot = #418;
void(vector org) te_spike = #419;
void(vector org) te_superspike = #420;
void(vector org) te_explosion = #421;
void(vector org) te_tarexplosion = #420;
void(vector org) te_wizspike = #423;
void(vector org) te_knightspike = #424;
void(vector org) te_lavasplash = #425;
void(vector org) te_teleport = #426;
void(vector org, float colorstart, float colorlength) te_explosion2 = #427;
void(entity own, vector start, vector end) te_lightning1 = #428;
void(entity own, vector start, vector end) te_lightning2 = #429;
void(entity own, vector start, vector end) te_lightning3 = #430;
void(entity own, vector start, vector end) te_beam = #431;
//DP_QC_WHICHPACK
string(string filename) whichpack = #503;

View file

@ -188,7 +188,7 @@ void() RunPlayerPhysics =
phys_angles_z = bound(-1, phys_velocity * v_right * cl_divspeed, 1) * cl_rollangle;
if (!phys_fixangle)
{
phys_angles_x = (phys_v_angle_x + phys_punchangle_x) * -0.333;
phys_angles_x = (phys_v_angle_x + phys_punchangle_x) * 0.333 * autocvar(r_meshpitch, -1);
phys_angles_y = phys_v_angle_y + phys_punchangle_y;
}

View file

@ -28,6 +28,7 @@ Any fields that are read need to be the same between csqc and ssqc code somehow.
#ifdef HAVE_DOTGRAVITY
.float gravity;
#endif
.entity groundentity;
enumflags
{
@ -39,7 +40,7 @@ enumflags
static void(entity tother) dotouch =
{
entity oself;
//if (tother.touch == __NULL__)
if (tother.touch == __NULL__)
return;
oself = self;
@ -58,6 +59,12 @@ void(vector surfnorm) PMove_Rebound =
float v;
v = self.velocity*surfnorm;
self.velocity = self.velocity - surfnorm*(v);
if (surfnorm_z > 0.7)
{ //if we hit a ground plane then we're now on the ground.
self.pmove_flags |= PMF_ONGROUND;
self.groundentity = trace_ent;
}
};
void(void) PMove_Move = //move forwards (preferably on the level) (does step ups)
@ -97,9 +104,11 @@ void(void) PMove_Move = //move forwards (preferably on the level) (does step ups
//if we got anywhere, make this raised-step move count
if (trace_fraction != 0)
{
movetime -= movetime * trace_fraction;
self.pmove_flags &= ~PMF_ONGROUND;
if (trace_fraction < 1)
PMove_Rebound(trace_plane_normal);
//move down
dest = trace_endpos;
dest_z -= stepped+1;
@ -109,7 +118,6 @@ void(void) PMove_Move = //move forwards (preferably on the level) (does step ups
self.origin = trace_endpos;
movetime -= movetime * input_timelength;
continue;
}
@ -206,7 +214,7 @@ void() PMove_InAirAccelerate =
if (!(self.pmove_flags & PMF_JUMP_HELD))
{
self.velocity_z += movevars_jumpheight;
self.pmove_flags (+) PMF_ONGROUND;
self.pmove_flags |= PMF_ONGROUND;
}
}
}
@ -249,50 +257,111 @@ void() PMove_Categorise =
{
//if we're moving up, we're not on the ground
if (self.velocity_z > 0)
self.pmove_flags (-) PMF_ONGROUND;
{
self.pmove_flags &= ~PMF_ONGROUND;
}
else
{
//don't know, maybe we are, maybe we're not
tracebox(self.origin, self.mins, self.maxs, self.origin-'0 0 1', false, self);
if (trace_fraction == 1 || trace_plane_normal_z < 0.7)
{
self.pmove_flags (-) PMF_ONGROUND;
// self.groundentity = trace_ent;
self.pmove_flags &= ~PMF_ONGROUND;
}
else
self.pmove_flags (+) PMF_ONGROUND;
{
self.pmove_flags |= PMF_ONGROUND;
self.groundentity = trace_ent;
}
}
};
float roundcoordf(float f)
{ //round this coord like the networking will... ish...
//coord rounding is often client-specific. which makes life fun.
return rint(f*8)/8;
}
vector roundcoordv(vector v)
{
return [
roundcoordf(v_x),
roundcoordf(v_y),
roundcoordf(v_z)
];
}
vector truncv(vector v)
{
return v & v;
}
static void Pmove_Nudge(void)
{
self.velocity = truncv(self.velocity);
vector test, org = roundcoordv(self.origin);
static float offsets[] = {0, -1./8, 1./8, -2./8, 2./8};
for (float z = 0; z < offsets.length; z++)
{
test.z = org.z + offsets[z];
for (float y = 0; y < offsets.length; y++)
{
test.y = org.y + offsets[y];
for (float x = 0; x < offsets.length; x++)
{
test.x = org.x + offsets[x];
tracebox(test, self.mins, self.maxs, test, false, self);
if (!trace_startsolid)
{ //okay, that'll do
self.origin = test;
return;
}
}
}
}
self.origin = org;
};
void(entity ent) PMove =
{
self = ent;
makevectors(input_angles);
Pmove_Nudge();
if (!(input_buttons & PMF_JUMP_HELD))
self.pmove_flags (-) PMF_JUMP_HELD;
self.pmove_flags &= ~PMF_JUMP_HELD;
PMove_Categorise();
self.movetype = MOVETYPE_WALK;
switch(self.movetype)
if (input_timelength >= 0)
{
case MOVETYPE_WALK:
PMove_InAirAccelerate();
PMove_Move();
break;
case MOVETYPE_FLY:
PMove_NoclipAccelerate();
PMove_Move();
break;
case MOVETYPE_NOCLIP:
PMove_NoclipAccelerate();
self.origin += self.velocity*input_timelength;
break;
case MOVETYPE_NONE:
break;
switch(self.movetype)
{
case MOVETYPE_WALK:
PMove_InAirAccelerate();
PMove_Move();
break;
case MOVETYPE_FLY:
PMove_NoclipAccelerate();
PMove_Move();
break;
case MOVETYPE_NOCLIP:
PMove_NoclipAccelerate();
self.origin += self.velocity*input_timelength;
break;
case MOVETYPE_NONE:
break;
}
touchtriggers(self);
}
else print(sprintf("timelength %g\n", input_timelength));
if (self.pmove_flags & PMF_ONGROUND)
self.flags |= FL_ONGROUND;
else
self.flags &= ~FL_ONGROUND;
};
#endif

View file

@ -1,99 +0,0 @@
//csqc only builtins.
float(string s) checkextension = #99; //this is core for csqc, but still an extension for ssqc
void() clearscene = #300; // (EXT_CSQC)
void(float mask) addentities = #301; // (EXT_CSQC)
void(entity ent) addentity = #302; // (EXT_CSQC)
float(float property, ...) setviewprop = #303; // (EXT_CSQC)
void() renderscene = #304; // (EXT_CSQC)
float(float property) getviewpropf = #309; // (EXT_CSQC)
vector(float property) getviewpropv = #309; // (EXT_CSQC)
void(vector org, float radius, vector lightcolours) adddynamiclight = #305; // (EXT_CSQC)
//void(string texturename) R_BeginPolygon = #306; // (EXT_CSQC_???)
//void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex = #307; // (EXT_CSQC_???)
//void() R_EndPolygon = #308; // (EXT_CSQC_???)
//maths stuff that uses the current view settings.
vector (vector v) unproject = #310; // (EXT_CSQC)
vector (vector v) project = #311; // (EXT_CSQC)
//2d (immediate) operations
void(float width, vector pos1, vector pos2) drawline = #315; // (EXT_CSQC)
float(string name) iscachedpic = #316; // (EXT_CSQC)
string(string name, float trywad) precache_pic = #317; // (EXT_CSQC)
vector(string picname) draw_getimagesize = #318; // (EXT_CSQC)
void(string name) freepic = #319; // (EXT_CSQC)
void(vector position, float character, vector scale, vector rgb, float alpha, ...) drawcharacter = #320; // (EXT_CSQC, [EXT_CSQC_???])
void(vector position, string text, vector scale, vector rgb, float alpha, ...) drawrawstring = #321; // (EXT_CSQC, [EXT_CSQC_???])
void(vector position, string pic, vector size, vector rgb, float alpha, ...) drawpic = #322; // (EXT_CSQC, [EXT_CSQC_???])
void(vector position, vector size, vector rgb, float alpha, ...) drawfill = #323; // (EXT_CSQC, [EXT_CSQC_???])
void(vector position, string text, vector scale, float alpha, ...) drawstring = #326; // (EXT_CSQC_1)
float(float stnum) getstati = #330; // (EXT_CSQC)
float(float stnum) getstatf = #331; // (EXT_CSQC)
float(float stnum, float first, float count) getstatbits = #331; // (EXT_CSQC)
string(float firststnum) getstats = #332; // (EXT_CSQC)
void(entity e, float mdlindex) setmodelindex = #333; // (EXT_CSQC)
string(float mdlindex) modelnameforindex = #334; // (EXT_CSQC)
float(string effectname) particleeffectforname = #335; // (EXT_CSQC)
#ifdef WORKINDP
//DP got the arguments the wrong way around...
void(entity ent, float effectnum, vector start, vector end) trailparticles_dp = #336; // (EXT_CSQC),
void(float effectnum, entity ent, vector start, vector end) trailparticles =
{
trailparticles_dp(ent, effectnum, start, end);
};
#else
void(float effectnum, entity ent, vector start, vector end) trailparticles = #336; // (EXT_CSQC),
#endif
void(float effectnum, vector origin, ...) pointparticles = #337; // (EXT_CSQC)
void(string s, ...) cprint = #338; // (EXT_CSQC)
void(string s, ...) print = #339; // (EXT_CSQC)
string(float keynum) keynumtostring = #340; // (EXT_CSQC)
float(string keyname) stringtokeynum = #341; // (EXT_CSQC)
string(float keynum) getkeybind = #342; // (EXT_CSQC)
float(float framenum) getinputstate = #345; // (EXT_CSQC)
void(float sens) setsensitivityscaler = #346; // (EXT_CSQC)
void(entity ent) runstandardplayerphysics = #347; // (EXT_CSQC_1)
string(float playernum, string keyname) getplayerkeyvalue = #348; // (EXT_CSQC)
float() isdemo = #349; // (EXT_CSQC)
float() isserver = #350; // (EXT_CSQC)
void(vector origin, vector forward, vector right, vector up) SetListener = #351; // (EXT_CSQC)
void(string cmdname) registercommand = #352; // (EXT_CSQC)
float(entity ent) wasfreed = #353; // (EXT_CSQC) (should be availabe on server too)
//note that 'ReadEntity' is pretty hard to implement reliably. Modders should use a combination of ReadShort, and findfloat, and remember that it might not be known clientside (pvs culled or other reason)
float() readbyte = #360; // (EXT_CSQC)
float() readchar = #361; // (EXT_CSQC)
float() readshort = #362; // (EXT_CSQC)
float() readlong = #363; // (EXT_CSQC)
float() readcoord = #364; // (EXT_CSQC)
float() readangle = #365; // (EXT_CSQC)
string() readstring = #366; // (EXT_CSQC)
string() readfloat = #367; // (EXT_CSQC)
void(string model, void(float isnew) updatefunc, float flags) deltalisten = #371;
//void(float flags, float simtime) readserverentitystate = #369;
#define RSES_NOLERP 1 //only really for use on predicted player entities
#define RSES_AUTOROTATE 0
#define RSES_NOROTATE 2
#define RSES_AUTOTRAILS 0
#define RSES_NOTRAILS 4
#define RSES_AUTOLIGHTS 0
#define RSES_NOLIGHTS 8
void(string evname, string argdesc, ...) sendevent = #359;

View file

@ -1,17 +1,5 @@
/*NOTE: csaddon is more up to date, with more stuff! use that instead!*/
/*FTE has some special light editing builtins, I don't ever expect them to be standard or anything, but they're handy for this*/
enum
{
lf_origin=0,
lf_colour=1,
lf_radius=2,
lf_flags=3,
lf_style=4
};
float(float l, float f) dl_getf = #372;
vector(float l, float f) dl_getv = #372;
void(float l, float f, float v) dl_setf = #373;
void(float l, float f, vector v) dl_setv = #373;
/*If you want to edit lights for hexen2, edit this cvar, use models/s_light.spr or something.*/
DEFCVAR_STRING(cg_editor_lightmodel, "progs/s_light.spr")
@ -25,7 +13,7 @@ void() editor_lights_add =
if (!tempent)
tempent = spawn();
l = dl_getf(-1, -1);
l = dynamiclight_get(-1, -1);
setmodel(tempent, CVARS(cg_editor_lightmodel));
while(l > 0)
{
@ -38,9 +26,9 @@ void() editor_lights_add =
}
else
tempent.effects (-) 8192;
if (!dl_getf(l, lf_radius))
if (!(float)dynamiclight_get(l, LFIELD_RADIUS))
continue;
setorigin(tempent, dl_getv(l, lf_origin));
setorigin(tempent, (vector)dynamiclight_get(l, LFIELD_ORIGIN));
addentity(tempent);
}
};
@ -62,15 +50,15 @@ static string(float fld, float foredit) readfield =
case 1:
if (foredit)
return ftos(selectedlight);
return strcat(ftos(selectedlight), " / ", ftos(dl_getf(-1, -1)));
return strcat(ftos(selectedlight), " / ", ftos(dynamiclight_get(-1, -1)));
case 2:
return vtos(dl_getv(selectedlight, lf_origin));
return vtos((vector)dynamiclight_get(selectedlight, LFIELD_ORIGIN));
case 3:
return vtos(dl_getv(selectedlight, lf_colour));
return vtos((vector)dynamiclight_get(selectedlight, LFIELD_COLOUR));
case 4:
return ftos(dl_getf(selectedlight, lf_radius));
return ftos(dynamiclight_get(selectedlight, LFIELD_RADIUS));
case 5:
float fl = dl_getf(selectedlight, lf_flags);
float fl = dynamiclight_get(selectedlight, LFIELD_FLAGS);
if (foredit)
return ftos(fl);
return strcat( ((fl & 1)?" alwaysvisible":""),
@ -78,7 +66,7 @@ static string(float fld, float foredit) readfield =
((fl & 65536)?" no-shadows":"")
);
case 6:
return ftos(dl_getf(selectedlight, lf_style));
return ftos(dynamiclight_get(selectedlight, LFIELD_STYLE));
default:
return "";
}
@ -92,22 +80,22 @@ static void(float fld, string newval) writefield =
selectedlight = stof(newval);
return;
case 2:
dl_setv(selectedlight, lf_origin, stov(newval));
dynamiclight_set(selectedlight, LFIELD_ORIGIN, stov(newval));
return;
case 3:
dl_setv(selectedlight, lf_colour, stov(newval));
dynamiclight_set(selectedlight, LFIELD_COLOUR, stov(newval));
return;
case 4:
dl_setf(selectedlight, lf_radius, stof(newval));
dynamiclight_set(selectedlight, LFIELD_RADIUS, stof(newval));
return;
case 5:
dl_getf(selectedlight, lf_flags, stof(newval));
dynamiclight_set(selectedlight, LFIELD_FLAGS, stof(newval));
return;
case 6:
dl_getf(selectedlight, lf_style, stof(newval));
dynamiclight_set(selectedlight, LFIELD_STYLE, stof(newval));
return;
default:
return "";
return;
}
};
@ -132,11 +120,11 @@ static void(vector fwd, vector vorg) selectbestlight =
{
float l, b=selectedlight, d, bd = 0;
vector ldir;
l = dl_getf(-1, -1);
l = (float)dynamiclight_get(-1, -1);
while(l > 0)
{
l--;
ldir = dl_getv(l, lf_origin);
ldir = (vector)dynamiclight_get(l, LFIELD_ORIGIN);
ldir = normalize(ldir - vorg);
d = fwd*ldir;
if (d > bd)
@ -191,53 +179,53 @@ float(float keyc, float unic) editor_lights_key =
localcmd("noclip\n");
else if (keyc == 's')
{
v = getviewpropv(15);
o = getviewpropv(11);
v = (vector)getviewprop(15);
o = (vector)getviewprop(11);
makevectors(v);
selectbestlight(v_forward, o);
}
else if (keyc == 'm')
{
v = getviewpropv(15);
o = getviewpropv(11);
v = (vector)getviewprop(15);
o = (vector)getviewprop(11);
makevectors(v);
traceline(o, o + v_forward*8192, true, world);
dl_setv(selectedlight, lf_origin, trace_endpos + trace_plane_normal*4);
dynamiclight_set(selectedlight, LFIELD_ORIGIN, trace_endpos + trace_plane_normal*4);
}
else if (keyc == 'i')
{
for (selectedlight = 32; ; selectedlight++)
{
if (!dl_getf(selectedlight, lf_radius))
if (!(float)dynamiclight_get(selectedlight, LFIELD_RADIUS))
{
dl_setf(selectedlight, lf_radius, 300);
v = getviewpropv(15);
o = getviewpropv(11);
dynamiclight_set(selectedlight, LFIELD_RADIUS, 300);
v = (vector)getviewprop(15);
o = (vector)getviewprop(11);
makevectors(v);
traceline(o, o + v_forward*8192, true, world);
dl_setv(selectedlight, lf_origin, trace_endpos + trace_plane_normal*4);
dynamiclight_set(selectedlight, LFIELD_ORIGIN, trace_endpos + trace_plane_normal*4);
break;
}
}
}
else if (keyc == '[')
{
v = getviewpropv(15);
o = getviewpropv(11);
v = (vector)getviewprop(15);
o = (vector)getviewprop(11);
makevectors(v);
traceline(o, o + v_forward*8192, true, world);
dl_setv(selectedlight, lf_origin, dl_getv(selectedlight, lf_origin) - trace_plane_normal);
dynamiclight_set(selectedlight, LFIELD_ORIGIN, (vector)dynamiclight_get(selectedlight, LFIELD_ORIGIN) - trace_plane_normal);
}
else if (keyc == ']')
{
v = getviewpropv(15);
o = getviewpropv(11);
v = (vector)getviewprop(15);
o = (vector)getviewprop(11);
makevectors(v);
traceline(o, o + v_forward*8192, true, world);
dl_setv(selectedlight, lf_origin, dl_getv(selectedlight, lf_origin) + trace_plane_normal);
dynamiclight_set(selectedlight, LFIELD_ORIGIN, (vector)dynamiclight_get(selectedlight, LFIELD_ORIGIN) + trace_plane_normal);
}
else if (keyc == 127)
dl_setf(selectedlight, lf_radius, 0);
dynamiclight_set(selectedlight, LFIELD_RADIUS, 0);
else
return false;
return true;

View file

@ -16,8 +16,8 @@ float(float keyc, float unic) editor_terrain_key =
vector v, o;
if (keyc == '[')
{
v = getviewpropv(VF_ANGLES);
o = getviewpropv(VF_ORIGIN);
v = (vector)getviewprop(VF_ANGLES);
o = (vector)getviewprop(VF_ORIGIN);
makevectors(v);
traceline(o, o + v_forward*8192, true, world);
@ -25,8 +25,8 @@ float(float keyc, float unic) editor_terrain_key =
}
else if (keyc == '=')
{
v = getviewpropv(VF_ANGLES);
o = getviewpropv(VF_ORIGIN);
v = (vector)getviewprop(VF_ANGLES);
o = (vector)getviewprop(VF_ORIGIN);
makevectors(v);
traceline(o, o + v_forward*8192, true, world);
@ -35,8 +35,8 @@ float(float keyc, float unic) editor_terrain_key =
else if (keyc == 13)
{
v = getviewpropv(VF_ANGLES);
o = getviewpropv(VF_ORIGIN);
v = (vector)getviewprop(VF_ANGLES);
o = (vector)getviewprop(VF_ORIGIN);
makevectors(v);
traceline(o, o + v_forward*8192, true, world);
@ -44,8 +44,8 @@ float(float keyc, float unic) editor_terrain_key =
}
else if (keyc == ']')
{
v = getviewpropv(VF_ANGLES);
o = getviewpropv(VF_ORIGIN);
v = (vector)getviewprop(VF_ANGLES);
o = (vector)getviewprop(VF_ORIGIN);
makevectors(v);
traceline(o, o + v_forward*8192, true, world);

View file

@ -2,6 +2,11 @@
#define show_scoreboard sb_showscores
#endif
#define RSES_NOLERP 1
#define RSES_NOROTATE 2
#define RSES_NOTRAILS 4
#define RSES_NOLIGHTS 8
float show_scoreboard;
string dbgstr;
@ -21,60 +26,7 @@ void() checkengineversion =
};
//check compiler, and give suitable warnings (unfortunatly at run time)
float(float f) testfunc =
{
return f;
}
float(float f1, float f2) testfunc2 =
{
return f1+f2;
}
float testarray[2];
float(float p1, float p2) a = {return p1+p2+5;};
float() b = {return 86;};
float(float p1) c = {return p1+566;};
float() d = {return 7773;};
#pragma TARGET ID
void() checkcompilerversion =
{
local entity testent;
testent = spawn();
testent.entnum = -5;
testent.owner = testent;
testent.owner.entnum += 5;
if (testent.entnum)
print("compiler failed on e.e.f += \n");
remove(testent);
testarray[0] = 5;
testarray[1] = 6;
if (testfunc (a(b(), c(d()))) != 86+5+7773+566)
print("compiler failed on a(b(), c(d()))\n");
if (testfunc(5)+testfunc(6) != 11)
print("compiler failed on f()+f()\n");
if (testfunc2(5, testfunc(6)) != 11)
print("compiler failed on f2(0,f1(1))\n");
if (testfunc2(testfunc(5),testfunc(6)) != 11)
print("compiler failed on f2(f(),f())\n");
if (testarray[0]+testarray[1] != 11)
print("compiler failed on a[0]+a[1]\n");
};
#ifdef FTEDEPENDANT
# pragma TARGET FTE
#endif
void(float isnew) RefreshPlayer;
void(float isnew) RefreshOther =
float(float isnew) RefreshOther =
{
self.drawmask = MASK_ENGINE;
setmodelindex(self, self.modelindex);
@ -83,6 +35,8 @@ void(float isnew) RefreshOther =
RefreshPlayer(isnew);
else if (self.colormap)
self.modelindex = 0; //don't show dead bodies, we do dying ourselves.
return PREDRAW_AUTOADD;
};
@ -139,6 +93,8 @@ void() regcommands =
registercommand("osgk_resize");
registercommand("osgk_mousemove");
registercommand("osgk_keypress");
registercommand("test_viewinfo");
};
float(string str) CSQC_ConsoleCommand =
@ -184,19 +140,44 @@ float(string str) CSQC_ConsoleCommand =
case "osgk_mousemove":
gecko_mousemove(argv(1), stof(argv(2)), stof(argv(3)));
break;
case "test_viewinfo":
if (player_local)
{
print(sprintf("View origin is at %v\n", vieworg));
print(sprintf("local player entity %i is num %g on server, at %v\n", player_local, player_local.entnum, player_local.origin));
}
else
print("Local player entity is not known. Engine is providing the default view origin.\n");
break;
default:
return false;
}
return true;
};
void(string line) CSQC_Parse_StuffCmd =
{
print("stufftext: ", line);
localcmd(line);
};
float(string msg) CSQC_Parse_CenterPrint =
{
print("centerprint: ");
print(msg);
print("\n");
cprint(msg);
return false;
};
void(string msg, float type) CSQC_Parse_Print =
{
cprint(msg);
print("print: ");
print(msg);
if (dbgstr)
/* if (dbgstr)
strunzone(dbgstr);
dbgstr = strzone(msg);
*/
};
void() CSQC_Ent_Remove = //the ent disappeared on the server.
@ -231,7 +212,6 @@ void(entity ve) DoThatViewModelThing =
ve.origin = '0 0 0';
ve.angles = '0 0 0';
ve.angles_x *= -1;
};
void() drawloadingscreen =
@ -241,10 +221,16 @@ void() drawloadingscreen =
// drawstring('0 0', "loading screen", '1 1', '1 1 1', 1);
};
void() CSQC_Init =
void(float apilevel, string enginename, float engineversion) CSQC_Init =
{
checkengineversion();
checkcompilerversion();
precache_model("progs/eyes.mdl");
precache_model("progs/player.mdl");
precache_model("progs/missile.mdl");
precache_sound("zombie/z_gib.wav");
precache_sound("player/udeath.wav");
precache_sound("weapons/r_exp3.wav");
viewentity = spawn();
viewentity.renderflags = RF_VIEWMODEL|RF_DEPTHHACK;
@ -253,9 +239,7 @@ void() CSQC_Init =
regcommands();
#ifndef FTEDEPENDANT
if (checkextension("EXT_CSQC_1"))
#endif
{
// deltalisten("*", RefreshOther, 0); //catch-all
deltalisten("progs/player.mdl", RefreshPlayer, RSES_NOLERP|RSES_NOROTATE); //animate players/player-corpses
@ -265,7 +249,11 @@ void() CSQC_Init =
void(entity ent) CSQC_DrawViewModel =
{
if (player_local.sveffects & SVE_INVIS)
{
if (!checkbuiltin(shaderforname))
return;
ent.forceshader = shaderforname("powerups/invisibility");
}
else
ent.forceshader = 0;
@ -278,17 +266,17 @@ void(entity ent) CSQC_DrawViewModel =
ent.renderflags = RF_DEPTHHACK; //nope, not a view model, that just breaks things
ent.origin = vieworg;
ent.angles = input_angles;
ent.angles_x = -ent.angles_x;
ent.angles_x *= autocvar(r_meshpitch, -1);
#endif
addentity(ent);
if (player_local.sveffects & SVE_QUAD)
if ((player_local.sveffects & SVE_QUAD) && checkbuiltin(shaderforname))
{
ent.fatness = -2;
ent.forceshader = shaderforname("powerups/quad");
addentity(ent);
}
if (player_local.sveffects & SVE_GOD)
if ((player_local.sveffects & SVE_GOD) && checkbuiltin(shaderforname))
{
ent.fatness = -2.8;
ent.forceshader = shaderforname("powerups/regen");
@ -317,9 +305,9 @@ void() CSQC_Delta_Remove =
};
float (float event, float parama, float paramb) CSQC_InputEvent =
float (float event, float parama, float paramb, float paramc) CSQC_InputEvent =
{
if (event == 0)
if (event == IE_KEYDOWN)
{
switch(CVARF(cg_editor))
{

View file

@ -615,7 +615,7 @@ Important Linking Into Quake stuff
void(float event, float button, float mousex, float mousey) TetrisMenuEvent =
{
local float key;
local float key = 0;
if (event == ME_DRAW)
{
@ -633,21 +633,16 @@ void(float event, float button, float mousex, float mousey) TetrisMenuEvent =
Menu_Main();
return;
}
if (button == K_LEFTARROW)
key = TETKEY_LEFT;
if (button == K_RIGHTARROW)
key = TETKEY_RIGHT;
if (button == K_UPARROW)
key = TETKEY_ROTRIGHT;
if (button == K_CTRL)
key = TETKEY_ROTLEFT;
if (button == K_SPACE)
key = TETKEY_DOWN;
if (button == K_DOWNARROW)
key = TETKEY_DOWN;
if (!key) //we didn't recognise it.
return;
switch(button)
{
case K_LEFTARROW: key = TETKEY_LEFT; break;
case K_RIGHTARROW: key = TETKEY_RIGHT; break;
case K_UPARROW: key = TETKEY_ROTRIGHT; break;
case K_SPACE: key = TETKEY_DOWN; break;
case K_DOWNARROW: key = TETKEY_DOWN; break;
default:
return; //we didn't recognise it.
}
if (event == ME_KEYDOWN)
tet_keys = tet_keys | key;

View file

@ -1,7 +1,5 @@
#ifdef HLPMODELS
#include "playerframes.inc"
.float oldframe;
#pragma noref 1
@ -77,17 +75,17 @@ static void(string framename) ForceToAnim =
void() updatesequences =
{
if (self.frame == $nailatt1 || self.frame == $nailatt2 ||
self.frame == $light1 || self.frame == $light2)
if (self.frame == playerframe::nailatt1 || self.frame == playerframe::nailatt2 ||
self.frame == playerframe::light1 || self.frame == playerframe::light2)
ForceToAnim ("ref_shoot_onehanded"); //these ones loop
// else if (random() < 0.005 && !(self.velocity_x || self.velocity_y) && (chasecam || self != player_local))
// { //randomly taunt, when standing still, when not first-person (making the sounds is just confusing when first person)
// sexedsound(self, "taunt.wav");
// ForceToAnim (TORSO_GESTURE);
// }
else if ((self.frame >= $axrun1 && self.frame <= $axrun6) ||
(self.frame >= $axstnd1 && self.frame <= $axstnd12) ||
(self.frame >= $axpain1 && self.frame <= $axpain6))
else if ((self.frame >= playerframe::axrun1 && self.frame <= playerframe::axrun6) ||
(self.frame >= playerframe::axstnd1 && self.frame <= playerframe::axstnd12) ||
(self.frame >= playerframe::axpain1 && self.frame <= playerframe::axpain6))
ForceToAnim ("ref_aim_crowbar");
else
ForceToAnim ("ref_aim_onehanded");

View file

@ -35,7 +35,7 @@ void() Hud_Init
};
vector screensize;
float items, items2;
float stat_items, stat_items2;
void(vector pos, float value, float threshhold) Hud_DrawLargeValue =
{
@ -141,23 +141,23 @@ void(vector pos) Hud_CoopScores_SBar =
drawpic(sbar, "scorebar", '320 24 0', '1 1 1', 0.333, 0);
s = strcat("Monsters:", FormatFloat(getstatf(STAT_KILLEDMONSTERS), 3, " "), "/", FormatFloat(getstatf(STAT_TOTALMONSTERS), 3, " "));
drawstring(sbar + '8 4', s, '8 8 0', 1, 0);
drawstring(sbar + '8 4', s, '8 8 0', '1 1 1', 1, 0);
s = strcat("Secrets :", FormatFloat(getstatf(STAT_FOUNDSECRETS), 3, " "), "/", FormatFloat(getstatf(STAT_TOTALSECRETS), 3, " "));
drawstring(sbar + '8 12', s, '8 8 0', 1, 0);
drawstring(sbar + '8 12', s, '8 8 0', '1 1 1', 1, 0);
mins = floor(time/60);
secs = floor(time - mins*60);
s = strcat("Time :", FormatFloat(mins, 3, " "), ":", FormatFloat(secs, 2, "0"));
drawstring(sbar + '184 4', s, '8 8 0', 1, 0);
drawstring(sbar + '184 4', s, '8 8 0', '1 1 1', 1, 0);
drawstring(sbar + '232 12' - strlen(levelname)*'4 0', levelname, '8 8 0', 1, 0);
drawstring(sbar + '232 12' - strlen(levelname)*'4 0', levelname, '8 8 0', '1 1 1', 1, 0);
};
void Hud_DrawSBar(vector pos)
{
drawpic(pos, "sbar", '320 24 0', '1 1 1', 0.333, 0);
if (items & IT_INVULNERABILITY)
if (stat_items & IT_INVULNERABILITY)
{
drawpic(pos, "disc", '24 24 0', '1 1 1', 1, 0);
Hud_DrawLargeValue(pos+'24 0 0', 999, 25);
@ -165,23 +165,23 @@ void Hud_DrawSBar(vector pos)
else
{
Hud_DrawLargeValue(pos+'24 0 0', getstatf(STAT_ARMOR), 25);
if (items & IT_ARMOR3)
if (stat_items & IT_ARMOR3)
drawpic(pos, "sb_armor3", '24 24 0', '1 1 1', 1, 0);
else if (items & IT_ARMOR2)
else if (stat_items & IT_ARMOR2)
drawpic(pos, "sb_armor2", '24 24 0', '1 1 1', 1, 0);
else if (items & IT_ARMOR1)
else if (stat_items & IT_ARMOR1)
drawpic(pos, "sb_armor1", '24 24 0', '1 1 1', 1, 0);
}
Hud_DrawLargeValue(pos+'136 0 0', getstatf(STAT_HEALTH), 25);
if (items & IT_SHELLS)
if (stat_items & IT_SHELLS)
drawpic(pos+'224 0 0', "sb_shells", '24 24 0', '1 1 1', 1, 0);
else if (items & IT_NAILS)
else if (stat_items & IT_NAILS)
drawpic(pos+'224 0 0', "sb_nails", '24 24 0', '1 1 1', 1, 0);
else if (items & IT_ROCKETS)
else if (stat_items & IT_ROCKETS)
drawpic(pos+'224 0 0', "sb_rocket", '24 24 0', '1 1 1', 1, 0);
else if (items & IT_CELLS)
else if (stat_items & IT_CELLS)
drawpic(pos+'224 0 0', "sb_cells", '24 24 0', '1 1 1', 1, 0);
Hud_DrawLargeValue(pos+'248 0 0', getstatf(STAT_AMMO), 10);
};
@ -190,19 +190,19 @@ void Hud_DrawIBar(vector pos)
{
drawpic(pos, "ibar", '320 24 0', '1 1 1', 0.333, 0);
if (items & IT_SHOTGUN)
if (stat_items & IT_SHOTGUN)
Hud_DrawWeapon(0, pos+'0 8 0');
if (items & IT_SUPER_SHOTGUN)
if (stat_items & IT_SUPER_SHOTGUN)
Hud_DrawWeapon(1, pos+'24 8 0');
if (items & IT_NAILGUN)
if (stat_items & IT_NAILGUN)
Hud_DrawWeapon(2, pos+'48 8 0');
if (items & IT_SUPER_NAILGUN)
if (stat_items & IT_SUPER_NAILGUN)
Hud_DrawWeapon(3, pos+'72 8 0');
if (items & IT_GRENADE_LAUNCHER)
if (stat_items & IT_GRENADE_LAUNCHER)
Hud_DrawWeapon(4, pos+'96 8 0');
if (items & IT_ROCKET_LAUNCHER)
if (stat_items & IT_ROCKET_LAUNCHER)
Hud_DrawWeapon(5, pos+'120 8 0');
if (items & IT_LIGHTNING)
if (stat_items & IT_LIGHTNING)
Hud_DrawWeaponWide(6, pos+'144 8 0');
Hud_DrawAmmoCount(0, pos + '10 0 0', false);
@ -210,27 +210,27 @@ void Hud_DrawIBar(vector pos)
Hud_DrawAmmoCount(2, pos + '106 0 0', false);
Hud_DrawAmmoCount(3, pos + '154 0 0', false);
if (items & IT_KEY1)
if (stat_items & IT_KEY1)
drawpic(pos+'192 8 0', "sb_key1", '16 16 0', '1 1 1', 1, 0);
if (items & IT_KEY2)
if (stat_items & IT_KEY2)
drawpic(pos+'208 8 0', "sb_key2", '16 16 0', '1 1 1', 1, 0);
if (items & IT_INVISIBILITY)
if (stat_items & IT_INVISIBILITY)
drawpic(pos+'224 8 0', "sb_invis", '16 16 0', '1 1 1', 1, 0);
if (items & IT_INVULNERABILITY)
if (stat_items & IT_INVULNERABILITY)
drawpic(pos+'240 8 0', "sb_invuln", '16 16 0', '1 1 1', 1, 0);
if (items & IT_SUIT)
if (stat_items & IT_SUIT)
drawpic(pos+'256 8 0', "sb_suit", '16 16 0', '1 1 1', 1, 0);
if (items & IT_QUAD)
if (stat_items & IT_QUAD)
drawpic(pos+'272 8 0', "sb_quad", '16 16 0', '1 1 1', 1, 0);
if (items2 & 32)
if (stat_items2 & 32)
drawpic(pos+'288 8 0', "sb_sigil1", '8 16 0', '1 1 1', 1, 0);
if (items2 & 64)
if (stat_items2 & 64)
drawpic(pos+'296 8 0', "sb_sigil2", '8 16 0', '1 1 1', 1, 0);
if (items2 & 128)
if (stat_items2 & 128)
drawpic(pos+'304 8 0', "sb_sigil3", '8 16 0', '1 1 1', 1, 0);
if (items2 & 256)
if (stat_items2 & 256)
drawpic(pos+'312 8 0', "sb_sigil4", '8 16 0', '1 1 1', 1, 0);
};
@ -360,8 +360,8 @@ nonstatic void Hud_Draw(float hudtype, float scoreboard, float width, float heig
pos_x = (screensize_x-320)/2;
pos_y = screensize_y;
items = getstatbits(STAT_ITEMS, 0, 23);
items2 = getstatbits(STAT_ITEMS, 23, 9);
stat_items = getstatbits(STAT_ITEMS, 0, 23);
stat_items2 = getstatbits(STAT_ITEMS, 23, 9);
//if hudtype == 0 then the engine already drew it.
if (hudtype == 3)

View file

@ -1,114 +0,0 @@
float K_TAB = 9;
float K_ENTER = 13;
float K_ESCAPE = 27;
float K_SPACE = 32;
// normal keys should be passed as lowercased ascii
float K_BACKSPACE = 127;
float K_UPARROW = 128;
float K_DOWNARROW = 129;
float K_LEFTARROW = 130;
float K_RIGHTARROW = 131;
float K_ALT = 132;
float K_CTRL = 133;
float K_SHIFT = 134;
float K_F1 = 135;
float K_F2 = 136;
float K_F3 = 137;
float K_F4 = 138;
float K_F5 = 139;
float K_F6 = 140;
float K_F7 = 141;
float K_F8 = 142;
float K_F9 = 143;
float K_F10 = 144;
float K_F11 = 145;
float K_F12 = 146;
float K_INS = 147;
float K_DEL = 148;
float K_PGDN = 149;
float K_PGUP = 150;
float K_HOME = 151;
float K_END = 152;
float K_KP_HOME = 160;
float K_KP_UPARROW = 161;
float K_KP_PGUP = 162;
float K_KP_LEFTARROW = 163;
float K_KP_5 = 164;
float K_KP_RIGHTARROW = 165;
float K_KP_END = 166;
float K_KP_DOWNARROW = 167;
float K_KP_PGDN = 168;
float K_KP_ENTER = 169;
float K_KP_INS = 170;
float K_KP_DEL = 171;
float K_KP_SLASH = 172;
float K_KP_MINUS = 173;
float K_KP_PLUS = 174;
float K_PAUSE = 255;
//
// joystick buttons
//
float K_JOY1 = 768;
float K_JOY2 = 769;
float K_JOY3 = 770;
float K_JOY4 = 771;
//
// aux keys are for multi-buttoned joysticks to generate so they can use
// the normal binding process
//
float K_AUX1 = 772;
float K_AUX2 = 773;
float K_AUX3 = 774;
float K_AUX4 = 775;
float K_AUX5 = 776;
float K_AUX6 = 777;
float K_AUX7 = 778;
float K_AUX8 = 779;
float K_AUX9 = 780;
float K_AUX10 = 781;
float K_AUX11 = 782;
float K_AUX12 = 783;
float K_AUX13 = 784;
float K_AUX14 = 785;
float K_AUX15 = 786;
float K_AUX16 = 787;
float K_AUX17 = 788;
float K_AUX18 = 789;
float K_AUX19 = 790;
float K_AUX20 = 791;
float K_AUX21 = 792;
float K_AUX22 = 793;
float K_AUX23 = 794;
float K_AUX24 = 795;
float K_AUX25 = 796;
float K_AUX26 = 797;
float K_AUX27 = 798;
float K_AUX28 = 799;
float K_AUX29 = 800;
float K_AUX30 = 801;
float K_AUX31 = 802;
float K_AUX32 = 803;
//
// mouse buttons generate virtual keys
//
float K_MOUSE1 = 512;
float K_MOUSE2 = 513;
float K_MOUSE3 = 514;
float K_MOUSE4 = 515;
float K_MOUSE5 = 516;
float K_MOUSE6 = 517;
float K_MOUSE7 = 518;
float K_MOUSE8 = 519;
float K_MOUSE9 = 520;
float K_MOUSE10 = 521;
const noref float K_MWHEELDOWN = K_MOUSE4;
const noref float K_MWHEELUP = K_MOUSE5;

View file

@ -3,8 +3,6 @@
.vector mangle;
.string message;
string() getentitytoken = #355;
void() cs_teleport_touch =
{
local entity t;
@ -48,7 +46,7 @@ float() parsenewmapentity =
{
local string field, value;
local entity nent;
local void() spawnfunc;
local void() spawnfunc = __NULL__;
nent = spawn();
while (1)

View file

@ -5,8 +5,6 @@ RefreshPlayer: Called from the engine each time a player (ent with player.mdl) i
ParsePlayer: Called from CSQC_Ent_Parse for csqc protocol ents
*/
#include "playerframes.inc"
static void() RemovePlayer;
enum
@ -32,9 +30,9 @@ enum
#define strzone(s) ""
#endif
static void() Player_Interpolate =
static float() Player_Interpolate =
{ //do some frame interpolation.
if (self.entnum == player_localentnum)
if (player_local == self)
{
Pred_UpdateLocalMovement(self);
}
@ -71,7 +69,7 @@ static void() Player_Interpolate =
self.renderflags = RF_EXTERNALMODEL;
#ifdef POWERUP_SHELLS
if (!isdp)
if (!checkbuiltin(shaderforname))
{
if (self.sveffects & SVE_INVIS)
self.forceshader = shaderforname("powerups/invisibility");
@ -104,8 +102,11 @@ static void() Player_Interpolate =
setmodel(self, "progs/eyes.mdl");
else
setmodel(self, "progs/player.mdl");
setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
break;
}
addentity(self);
return PREDRAW_NEXT;
};
static void(float g) Player_SetLocalInfoGender =
@ -208,7 +209,7 @@ static void() Player_UnsetModel =
static entity() Player_DupModel =
{
local entity e;
local entity e = world;
switch(self.modelstyle)
{
@ -240,18 +241,20 @@ static entity() Player_DupModel =
static void() bodythink =
{
local float final;
if (self.frame >= $axdeth1 && self.frame <= $axdeth9)
final = $axdeth9;
else if (self.frame >= $deatha1 && self.frame <= $deatha11)
final = $deatha11;
else if (self.frame >= $deathb1 && self.frame <= $deathb9)
final = $deathb9;
else if (self.frame >= $deathc1 && self.frame <= $deathc15)
final = $deathc15;
else if (self.frame >= $deathd1 && self.frame <= $deathd9)
final = $deathd9;
else if (self.frame >= $deathe1 && self.frame <= $deathe9)
final = $deathe9;
if (self.frame >= playerframe::axdeth1 && self.frame <= playerframe::axdeth9)
final = playerframe::axdeth9;
else if (self.frame >= playerframe::deatha1 && self.frame <= playerframe::deatha11)
final = playerframe::deatha11;
else if (self.frame >= playerframe::deathb1 && self.frame <= playerframe::deathb9)
final = playerframe::deathb9;
else if (self.frame >= playerframe::deathc1 && self.frame <= playerframe::deathc15)
final = playerframe::deathc15;
else if (self.frame >= playerframe::deathd1 && self.frame <= playerframe::deathd9)
final = playerframe::deathd9;
else if (self.frame >= playerframe::deathe1 && self.frame <= playerframe::deathe9)
final = playerframe::deathe9;
else
final = 0;
self.frame = self.frame+1;
@ -260,7 +263,7 @@ static void() bodythink =
self.nextthink = time + 0.1;
};
static void() DeadBodyPredraw =
static float() DeadBodyPredraw =
{
float ftime;
ftime = time - self.starttime;
@ -269,13 +272,14 @@ static void() DeadBodyPredraw =
{
Player_UnsetModel();
remove(self);
return;
return PREDRAW_NEXT;
}
Movetype_Bounce();
Player_Interpolate();
self.origin_z -= ftime*0.5;
return PREDRAW_AUTOADD;
};
static void() JustRessed =
@ -323,7 +327,7 @@ static void() RemovePlayer =
self.predraw = __NULL__;
};
void(float isnew) RefreshPlayer =
float(float isnew) RefreshPlayer =
{
local string newskin;
@ -333,7 +337,7 @@ void(float isnew) RefreshPlayer =
self.haddied = false;
//if its not new and they're not dead, but they were before..
if (self.frame < $axdeth1 || self.frame > $deathe9)
if (self.frame < playerframe::axdeth1 || self.frame > playerframe::deathe9)
{
if (self.haddied)
{
@ -353,18 +357,16 @@ void(float isnew) RefreshPlayer =
if (isnew)
{
if (self.entnum == player_localentnum)
{
player_local = self;
}
self.modelstyle = MF_BAD;
self.oldskin = strzone("");
self.drawmask = MASK_NORMAL;
self.removefunc = RemovePlayer;
self.customphysics = (void()){};
}
if (self.entnum == player_localentnum)
player_local = self;
if (self.sveffects & SVE_INVIS)
{
@ -416,10 +418,10 @@ void(float isnew) RefreshPlayer =
if (player_local != self)
{
return;
return TRUE;
}
Pred_PlayerUpdated(self);
return TRUE;
};
//this is sent after the server has run our movement command.

View file

@ -1,65 +1,45 @@
enum playerframe
{
//
//, running
//
axrun1, axrun2, axrun3, axrun4, axrun5, axrun6,
rockrun1, rockrun2, rockrun3, rockrun4, rockrun5, rockrun6,
//
// running
//, standing
//
$frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
$frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
//
// standing
//
$frame stand1 stand2 stand3 stand4 stand5
$frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
$frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
stand1, stand2, stand3, stand4, stand5,
axstnd1, axstnd2, axstnd3, axstnd4, axstnd5, axstnd6, axstnd7, axstnd8, axstnd9, axstnd10, axstnd11, axstnd12,
//
// pain
//, pain
//
$frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
$frame pain1 pain2 pain3 pain4 pain5 pain6
axpain1, axpain2, axpain3, axpain4, axpain5, axpain6,
pain1, pain2, pain3, pain4, pain5, pain6,
//
// death
//, death
//
$frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
$frame axdeth7 axdeth8 axdeth9
$frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
$frame deatha9 deatha10 deatha11
$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
$frame deathb9
$frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
$frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
$frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
$frame deathd8 deathd9
$frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
$frame deathe8 deathe9
axdeth1, axdeth2, axdeth3, axdeth4, axdeth5, axdeth6, axdeth7, axdeth8, axdeth9,
deatha1, deatha2, deatha3, deatha4, deatha5, deatha6, deatha7, deatha8, deatha9, deatha10, deatha11,
deathb1, deathb2, deathb3, deathb4, deathb5, deathb6, deathb7, deathb8, deathb9,
deathc1, deathc2, deathc3, deathc4, deathc5, deathc6, deathc7, deathc8, deathc9, deathc10, deathc11, deathc12, deathc13, deathc14, deathc15,
deathd1, deathd2, deathd3, deathd4, deathd5, deathd6, deathd7, deathd8, deathd9,
deathe1, deathe2, deathe3, deathe4, deathe5, deathe6, deathe7, deathe8, deathe9,
//
// attacks
//, attacks
//
$frame nailatt1 nailatt2
$frame light1 light2
$frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
$frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
$frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
$frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
$frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
nailatt1, nailatt2,
light1, light2,
rockatt1, rockatt2, rockatt3, rockatt4, rockatt5, rockatt6,
shotatt1, shotatt2, shotatt3, shotatt4, shotatt5, shotatt6,
axatt1, axatt2, axatt3, axatt4, axatt5, axatt6,
axattb1, axattb2, axattb3, axattb4, axattb5, axattb6,
axattc1, axattc2, axattc3, axattc4, axattc5, axattc6,
axattd1, axattd2, axattd3, axattd4, axattd5, axattd6,
};

View file

@ -166,7 +166,11 @@ void(entity ent, float endframe) Pred_RunMovement =
{
break;
}
#ifdef OWNPLAYERPHYSICS
PMove(ent);
#else
runstandardplayerphysics(ent);
#endif
pmoveframe++;
}

View file

@ -35,8 +35,6 @@
#ifdef MD3PMODELS
#include "playerframes.inc"
//these are the animation sequence names used in quake3.
enum {
BOTH_DEATH1,
@ -117,7 +115,7 @@ vector getlerpedtaginfo(entity ent, float tagnum)
//at the time of writing, this is needed for DP to be smooth.
//fte does not support gettaginfo at all (I've been lazy due to the heirachical nature).
//this is called by RotateVectorsByTag_GTI, so it not required in fte as FTE has a working RotateVectorsByTag instead.
//this is called by rotatevectorsbytag_GTI, so it not required in fte as FTE has a working rotatevectorsbytag instead.
float frame2ness = ent.lerpfrac;
float frame1ness = 1-frame2ness;
@ -151,8 +149,8 @@ vector getlerpedtaginfo(entity ent, float tagnum)
return v_origin;
}
#define RotateVectorsByTag RotateVectorsByTag_GTI
vector RotateVectorsByTag_GTI(entity ent, float tagnum)
#define rotatevectorsbytag rotatevectorsbytag_GTI
vector rotatevectorsbytag_GTI(entity ent, float tagnum)
{
vector saveang=ent.angles;
vector saveorg=ent.origin;
@ -198,8 +196,8 @@ vector RotateVectorsByTag_GTI(entity ent, float tagnum)
saveorg_z += ango_z * oldz_z;
return saveorg;
}
#define RotateVectorsByAngle RotateVectorsByAngle_QC
void RotateVectorsByAngle_QC(vector angle)
#define rotatevectorsbyangle rotatevectorsbyangle_QC
void rotatevectorsbyangle_QC(vector angle)
{
vector oldx=v_forward, oldy='0 0 0'-v_right, oldz=v_up;
angle_x = -angle_x;
@ -254,13 +252,13 @@ void(entity ent, string soundname) sexedsound =
if (fileexists(full))
{
precache_sound(str);
soundp(self, CHAN_VOICE, str, 1, 1, 95 + random()*10);
sound(self, CHAN_VOICE, str, 1, 1, 95 + random()*10);
}
else
{
str = strcat("player/sarge/", soundname); // :(
precache_sound(str);
soundp(self, CHAN_VOICE, str, 1, 1, 95 + random()*10);
sound(self, CHAN_VOICE, str, 1, 1, 95 + random()*10);
}
};
@ -305,7 +303,8 @@ float(entity ent) animate =
ft *= fps;
fnum = floor(ft);
ft = ft - fnum; //time into the frame.
if (fnum >= numframes)
ret = fnum >= numframes;
if (ret)
{
loopingframes = anim_loopingframes[anum];
@ -323,8 +322,6 @@ float(entity ent) animate =
if (numframes == 1)
ent.frame2 = ent.frame;
ret = true;
}
fnum += anim_firstframe[anum];
@ -355,6 +352,8 @@ void() LegsUpdateAnim =
if (trace_fraction == 1)
inair = self.velocity_z;
else
inair = 0;
if (self.legsent.animnum > BOTH_DEAD3)
if ((self.wasinair!=0) != (inair!=0))
@ -431,20 +430,21 @@ void() TorsoUpdateAnim =
{
if (animate(self.torsoent))
{
if (self.frame >= $axdeth1 && self.frame <= $deathe9)
playerframe f = self.frame;
if (f >= playerframe::axdeth1 && f <= playerframe::deathe9)
return; //dead.
if (self.frame == $nailatt1 || self.frame == $nailatt2 ||
self.frame == $light1 || self.frame == $light2)
if (f == playerframe::nailatt1 || f == playerframe::nailatt2 ||
f == playerframe::light1 || f == playerframe::light2)
ForceToAnim(TORSO_ATTACK); //these ones loop
else if (random() < 0.005 && !(self.velocity_x || self.velocity_y) && (chasecam || self != player_local))
{ //randomly taunt, when standing still, when not first-person (making the sounds is just confusing when first person)
sexedsound(self, "taunt.wav");
ForceToAnim(TORSO_GESTURE);
}
else if ((self.frame >= $axrun1 && self.frame <= $axrun6) ||
(self.frame >= $axstnd1 && self.frame <= $axstnd12) ||
(self.frame >= $axpain1 && self.frame <= $axpain6))
else if ((f >= playerframe::axrun1 && f <= playerframe::axrun6) ||
(f >= playerframe::axstnd1 && f <= playerframe::axstnd12) ||
(f >= playerframe::axpain1 && f <= playerframe::axpain6))
ForceToAnim(TORSO_STAND2);
else
ForceToAnim(TORSO_STAND);
@ -482,7 +482,7 @@ nonstatic void() Anim_Draw =
vector tf, tr, tu;
vector ang;
float move;
string weaponname;
string weaponname = 0;
self.modelindex = 0; //should never have been anything else.
@ -503,7 +503,7 @@ nonstatic void() Anim_Draw =
self.weaponent.renderflags = RF_USEAXIS;
}
if (!(self.frame >= $axdeth1 && self.frame <= $deathe9))
if (!(self.frame >= playerframe::axdeth1 && self.frame <= playerframe::deathe9))
{
//if they're still alive
//animate the legs a bit so they turn to the player, but not for 1-degree turns. little more realism there.
@ -563,73 +563,73 @@ nonstatic void() Anim_Draw =
if (self.frame != self.frame2)
{
//see if the player changed to any animations.
if (self.frame >= $axdeth1 && self.frame <= $axdeth8 && self.legsent.animnum != BOTH_DEATH1)
if (self.frame >= playerframe::axdeth1 && self.frame <= playerframe::axdeth8 && self.legsent.animnum != BOTH_DEATH1)
{
sexedsound(self, "death1.wav");
ForceToAnim(BOTH_DEATH1);
}
else if (self.frame == $axdeth9 && self.frame2 != $axdeth8)
else if (self.frame == playerframe::axdeth9 && self.frame2 != playerframe::axdeth8)
ForceToAnim(BOTH_DEAD1); //suddenly appeared with this frame (otherwise we just flow into it)
else if (self.frame == $deatha1 && self.frame <= $deatha10 && self.legsent.animnum != BOTH_DEATH2)
else if (self.frame == playerframe::deatha1 && self.frame <= playerframe::deatha10 && self.legsent.animnum != BOTH_DEATH2)
{
sexedsound(self, "death2.wav");
ForceToAnim(BOTH_DEATH2);
}
else if (self.frame == $deatha11 && self.frame2 != $deatha10)
else if (self.frame == playerframe::deatha11 && self.frame2 != playerframe::deatha10)
ForceToAnim(BOTH_DEAD2); //suddenly appeared with this frame (otherwise we just flow into it)
else if (self.frame == $deathb1 && self.frame <= $deathb8 && self.legsent.animnum != BOTH_DEATH3)
else if (self.frame == playerframe::deathb1 && self.frame <= playerframe::deathb8 && self.legsent.animnum != BOTH_DEATH3)
{
sexedsound(self, "death3.wav");
ForceToAnim(BOTH_DEATH3);
}
else if (self.frame == $deathb9 && self.frame2 != $deathb8)
else if (self.frame == playerframe::deathb9 && self.frame2 != playerframe::deathb8)
ForceToAnim(BOTH_DEAD3); //suddenly appeared with this frame (otherwise we just flow into it)
else if (self.frame == $deathc1 && self.frame <= $deathc14 && self.legsent.animnum != BOTH_DEATH1)
else if (self.frame == playerframe::deathc1 && self.frame <= playerframe::deathc14 && self.legsent.animnum != BOTH_DEATH1)
{
sexedsound(self, "death1.wav");
ForceToAnim(BOTH_DEATH1);
}
else if (self.frame == $deathc15 && self.frame2 != $deathc14)
else if (self.frame == playerframe::deathc15 && self.frame2 != playerframe::deathc14)
ForceToAnim(BOTH_DEAD1); //suddenly appeared with this frame (otherwise we just flow into it)
else if (self.frame == $deathd1 && self.frame <= $deathd8 && self.legsent.animnum != BOTH_DEATH2)
else if (self.frame == playerframe::deathd1 && self.frame <= playerframe::deathd8 && self.legsent.animnum != BOTH_DEATH2)
{
sexedsound(self, "death2.wav");
ForceToAnim(BOTH_DEATH2);
}
else if (self.frame == $deathd9 && self.frame2 != $deathd8)
else if (self.frame == playerframe::deathd9 && self.frame2 != playerframe::deathd8)
ForceToAnim(BOTH_DEAD2); //suddenly appeared with this frame (otherwise we just flow into it)
else if (self.frame == $deathe1 && self.frame <= $deathe8 && self.legsent.animnum != BOTH_DEATH3)
else if (self.frame == playerframe::deathe1 && self.frame <= playerframe::deathe8 && self.legsent.animnum != BOTH_DEATH3)
{
sexedsound(self, "death3.wav");
ForceToAnim(BOTH_DEATH3);
}
else if (self.frame == $deathe9 && self.frame2 != $deathe8)
else if (self.frame == playerframe::deathe9 && self.frame2 != playerframe::deathe8)
ForceToAnim(BOTH_DEAD3); //suddenly appeared with this frame (otherwise we just flow into it)
else if ((self.frame == $nailatt1 || self.frame == $nailatt2) &&
(self.frame2 != $nailatt1 && self.frame2 != $nailatt2))
else if ((self.frame == playerframe::nailatt1 || self.frame == playerframe::nailatt2) &&
(self.frame2 != playerframe::nailatt1 && self.frame2 != playerframe::nailatt2))
ForceToAnim(TORSO_ATTACK);
else if ((self.frame == $light1 || self.frame == $light2) &&
(self.frame2 != $light1 && self.frame2 != $light2))
else if ((self.frame == playerframe::light1 || self.frame == playerframe::light2) &&
(self.frame2 != playerframe::light1 && self.frame2 != playerframe::light2))
ForceToAnim(TORSO_ATTACK);
else if (self.frame == $rockatt1)
else if (self.frame == playerframe::rockatt1)
ForceToAnim(TORSO_ATTACK);
else if (self.frame == $shotatt1)
else if (self.frame == playerframe::shotatt1)
ForceToAnim(TORSO_ATTACK);
else if (self.frame == $axatt1)
else if (self.frame == playerframe::axatt1)
ForceToAnim(TORSO_ATTACK2);
else if (self.frame == $axattb1)
else if (self.frame == playerframe::axattb1)
ForceToAnim(TORSO_ATTACK2);
else if (self.frame == $axattc1)
else if (self.frame == playerframe::axattc1)
ForceToAnim(TORSO_ATTACK2);
else if (self.frame == $axattd1)
else if (self.frame == playerframe::axattd1)
ForceToAnim(TORSO_ATTACK2);
else if (self.frame2 >= $axdeth1 && self.frame2 <= $deathe9 && !(self.frame >= $axdeth1 && self.frame <= $deathe9))
else if (self.frame2 >= playerframe::axdeth1 && self.frame2 <= playerframe::deathe9 && !(self.frame >= playerframe::axdeth1 && self.frame <= playerframe::deathe9))
{ //respawned
ForceToAnim(LEGS_IDLE);
ForceToAnim(TORSO_STAND);
@ -645,7 +645,7 @@ nonstatic void() Anim_Draw =
ang_y = 0;
if (ang != '0 0 0')
{
adddynamiclight(self.origin, 400, ang);
dynamiclight_add(self.origin, 400, ang);
}
//if they're meant to be transparent, propogate that.
@ -663,13 +663,13 @@ nonstatic void() Anim_Draw =
//legs are in place, matricies are set up for them.
//work out where to put the torso by querying the tag
self.torsoent.origin = RotateVectorsByTag(self.legsent, self.torsoent.tag_index);//figure out the torso position
self.torsoent.origin = rotatevectorsbytag(self.legsent, self.torsoent.tag_index);//figure out the torso position
//torso's angles are not lagged, and must always point directly at the target, so rotate by the extra angles.
ang = self.angles;
ang_y = self.angles_y - self.legsent.angles_y; //keep the angle on the legs
ang_x*=2;
if (self.legsent.animnum > BOTH_DEAD3)
RotateVectorsByAngle(ang); //rotate the torso (when dead the whole thing acts as one model with no custom angles inside)
rotatevectorsbyangle(ang); //rotate the torso (when dead the whole thing acts as one model with no custom angles inside)
AddModelWithEffects(self.torsoent);
//torso is now added to the scene.
@ -679,15 +679,15 @@ nonstatic void() Anim_Draw =
tu = v_up;
//now work out where to put the head
self.headent.origin = RotateVectorsByTag(self.torsoent, self.headent.tag_index);//
self.headent.origin = rotatevectorsbytag(self.torsoent, self.headent.tag_index);//
ang_y = sin(time)*22.5;
ang_x = cos(time*0.4532)*11.25;
if (self.legsent.animnum > BOTH_DEAD3)
RotateVectorsByAngle(ang); //make the head around a bit
rotatevectorsbyangle(ang); //make the head around a bit
AddModelWithEffects(self.headent);
//head is now in place
if (self.frame >= $axdeth1 && self.frame <= $deathe9)
if (self.frame >= playerframe::axdeth1 && self.frame <= playerframe::deathe9)
return; //don't show the weapon in death frames.
//and revert the matrix back to how it was before the head.
@ -728,7 +728,7 @@ nonstatic void() Anim_Draw =
setmodel(self.weaponent, strcat(weaponname, ".md3"));
//rotate by a tag on the torso
self.weaponent.origin = RotateVectorsByTag(self.torsoent, self.weaponent.tag_index);//place the weapon in the hand
self.weaponent.origin = rotatevectorsbytag(self.torsoent, self.weaponent.tag_index);//place the weapon in the hand
//and add it.
AddModelWithEffects(self.weaponent);
@ -739,7 +739,7 @@ nonstatic void() Anim_Draw =
if (move)
{
//they're shooting something. make a muzzleflash appear at the end of their weapon.
self.weaponent.origin = RotateVectorsByTag(self.weaponent, move);
self.weaponent.origin = rotatevectorsbytag(self.weaponent, move);
setmodel(self.weaponent, strcat(weaponname, "_flash.md3"));
AddModelWithEffects(self.weaponent);
}
@ -781,7 +781,7 @@ nonstatic float(string modname) Anim_ReadAnimationFile =
local float modnum;
local string str;
local float file;
local float sequencenum;
local float sequencenum = 0;
local float stupid;
if (modname == "")
@ -818,7 +818,7 @@ nonstatic float(string modname) Anim_ReadAnimationFile =
precache_model(strcat("models/players/", modname, "/lower.md3"));
precache_model(strcat("models/players/", modname, "/head.md3"));
anim_headmodel[modnum] = modelindex_for_name(strcat("models/players/", modname, "/head.md3"));
anim_headmodel[modnum] = getmodelindex(strcat("models/players/", modname, "/head.md3"));
//default general values
anim_gender[modnum] = GENDER_DEFAULT;
@ -866,6 +866,7 @@ nonstatic float(string modname) Anim_ReadAnimationFile =
stupid = stof(str);
stupid = stupid - anim_firstframe[(modnum * NUMANIMS) + TORSO_GESTURE];
}
else stupid = 0;
anim_firstframe[(modnum * NUMANIMS) + sequencenum] = stof(str) - stupid;
anim_numframes[(modnum * NUMANIMS) + sequencenum] = stof(argv(1));
anim_loopingframes[(modnum * NUMANIMS) + sequencenum] = stof(argv(2));
@ -1243,11 +1244,11 @@ float(float channel, string soundname, vector pos, float vol, float attenuation)
return false;
};
float(float sventnum, float channel, string soundname, float vol, float att, vector org) CSQC_Event_Sound =
float(float sventnum, float channel, string soundname, float vol, float att, vector org, float pitchmod, float flags) CSQC_Event_Sound =
{
self = findfloat(world, entnum, sventnum);
if (self)
return CSQC_ServerSound(channel, soundname, org, vol, att);
return false;
};
#endif
#endif

View file

@ -1,21 +1,3 @@
float(float modlindex) skel_create = #263; // create a skeleton (be sure to assign the value to .skeletonindex for use), returns skeleton index (1 or higher) on success, returns 0 on failure (for example if the modelindex is not skeletal)
float(float skel, entity ent, float modlindex, float retainfrac, float firstbone, float lastbone) skel_build = #264; // blend in a percentage of standard animation, 0 replaces entirely, 1 does nothing, 0.5 blends half, etc, and this only alters the bones in the specified range for which out of bounds values like 0,100000 are safe (uses .frame, .frame2, .frame3, .frame4, .lerpfrac, .lerpfrac3, .lerpfrac4, .frame1time, .frame2time, .frame3time, .frame4time), returns skel on success, 0 on failure
float(float skel) skel_get_numbones = #265; // returns how many bones exist in the created skeleton
string(float skel, float bonenum) skel_get_bonename = #266; // returns name of bone (as a tempstring)
float(float skel, float bonenum) skel_get_boneparent = #267; // returns parent num for supplied bonenum, -1 if bonenum has no parent or bone does not exist (returned value is always less than bonenum, you can loop on this)
float(float skel, string tagname) skel_find_bone = #268; // get number of bone with specified name, 0 on failure, tagindex (bonenum+1) on success, same as using gettagindex on the modelindex
vector(float skel, float bonenum) skel_get_bonerel = #269; // get matrix of bone in skeleton relative to its parent - sets v_forward, v_right, v_up, returns origin (relative to parent bone)
vector(float skel, float bonenum) skel_get_boneabs = #270; // get matrix of bone in skeleton in model space - sets v_forward, v_right, v_up, returns origin (relative to entity)
void(float skel, float bonenum, vector org, vector fwd, vector rgt, vector up) skel_set_bone = #271; // set matrix of bone relative to its parent, reads v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
void(float skel, float bonenum, vector org) skel_mul_bone = #272; // transform bone matrix (relative to its parent) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
void(float skel, float startbone, float endbone, vector org, vector f, vector r, vector u) skel_mul_bones = #273; // transform bone matrices (relative to their parents) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bones)
void(float skeldst, float skelsrc, float startbone, float endbone) skel_copybones = #274; // copy bone matrices (relative to their parents) from one skeleton to another, useful for copying a skeleton to a corpse
void(float skel) skel_delete = #275; // deletes skeleton at the beginning of the next frame (you can add the entity, delete the skeleton, renderscene, and it will still work)
//float(float modlindex, string framename) frameforname = #276; // finds number of a specified frame in the animation, returns -1 if no match found
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.
.float skeletonindex;
enum
{
ANIM_FORWARD,
@ -184,9 +166,9 @@ void() Q4PM_Draw =
skel_build(self.skeletonindex, self, anim[i], ((i==0)?0:1), 0, -1, self.aweight[i]);
}
skel_mul_bone(self.skeletonindex, 18, '0 0 0', v_forward, v_right, v_up);
skel_mul_bone(self.skeletonindex, 19, '0 0 0', v_forward, v_right, v_up);
skel_mul_bone(self.skeletonindex, 20, '0 0 0', v_forward, v_right, v_up);
skel_premul_bone(self.skeletonindex, 18, '0 0 0', v_forward, v_right, v_up);
skel_premul_bone(self.skeletonindex, 19, '0 0 0', v_forward, v_right, v_up);
skel_premul_bone(self.skeletonindex, 20, '0 0 0', v_forward, v_right, v_up);
//obliterate the bone movement, so that it doesn't move forwards.
skel_get_bonerel(self.skeletonindex, 1);
@ -201,11 +183,11 @@ float(string skinname) Q4PM_SetModel =
if not (whichpack(mname))
return false;
anim[ANIM_IDLE] = precache_model("models/characters/player/idle.md5anim");
anim[ANIM_FORWARD] = precache_model("models/characters/player/run.md5anim");
anim[ANIM_BACK] = precache_model("models/characters/player/run_backwards.md5anim");
anim[ANIM_RIGHT] = precache_model("models/characters/player/strafe_right.md5anim");
anim[ANIM_LEFT] = precache_model("models/characters/player/strafe_left.md5anim");
anim[ANIM_IDLE] = getmodelindex("models/characters/player/idle.md5anim");
anim[ANIM_FORWARD] = getmodelindex("models/characters/player/run.md5anim");
anim[ANIM_BACK] = getmodelindex("models/characters/player/run_backwards.md5anim");
anim[ANIM_RIGHT] = getmodelindex("models/characters/player/strafe_right.md5anim");
anim[ANIM_LEFT] = getmodelindex("models/characters/player/strafe_left.md5anim");
setmodel(self, mname);
@ -224,4 +206,4 @@ void() Q4PM_UnsetModel =
entity() Q4PM_DupModel
{
return spawn();
};
};

View file

@ -1,210 +0,0 @@
//NOTE: THIS IS AN INTERFACE FILE. DO NOT EDIT.
//MODIFYING THIS FILE CAN RESULT IN CRC ERRORS.
//YOU HAVE BEEN WARNED.
//It is safe to edit below the end_sys_fields define,
//but please don't report the engine rejecting due to
//crc mismatches when you've modified above that line.
//feel free to look though. :)
#ifndef CSQC
#define CSQC 1
#endif
#ifdef FTEQCC
#pragma noref 1 //remove warnings about unreferenced variables.
#endif
/*
==============================================================================
SOURCE FOR GLOBALVARS_T C STRUCTURE
==============================================================================
*/
//
// system globals
//
entity self;
entity other;
entity world;
float time;
#ifndef WORKINDP
float cltime;
#endif
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
string mapname; //current brief map name
#ifndef WORKINDP
float intermission; //non-zero if the server sent an svc_intermission.
#endif
//
// global variables set by built in functions
//
vector v_forward, v_up, v_right; // set by makevectors()
#ifndef WORKINDP
vector view_angles;
#endif
// 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;
#ifdef WORKINDP
void() CSQC_Init;
void() CSQC_Shutdown;
float(float f, float t, float n) CSQC_InputEvent;
void(float width, float height, float do2d) 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;
#endif
//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)
#ifndef WORKINDP
float input_impulse;
#endif
#ifdef WORKINDP
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)
#endif
//================================================
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;
#ifndef WORKINDP
.float pmove_flags;
#endif
.string classname; // spawn function
#ifndef WORKINDP
.float renderflags;
#endif
.string model;
.float frame;
#ifndef WORKINDP
.float frame1time; //for automatic framegroups.
.float frame2;
.float frame2time;
.float lerpfrac; //the ammount of frame2 to use.
#endif
.float skin;
.float effects;
.vector mins, maxs; // bounding box extents reletive to origin
.vector size; // maxs - mins
.void() touch;
#ifdef WORKINDP
.void() use;
#endif
.void() think;
.void() blocked; // for doors or plats, called when can't push other
.float nextthink;
.entity chain;
#ifdef WORKINDP
.string netname;
#endif
.entity enemy;
.float flags;
.float colormap;
.entity owner; // who launched a missile
//================================================
void end_sys_fields; // flag for structure dumping
//================================================
#ifdef FTEQCC
#pragma noref 0
#endif
#ifdef WORKINDP
.float frame2;
.float frame1time;
.float frame2time;
.float renderflags;
.float lerpfrac;
vector view_angles;
#endif
//optional extras
.float alpha;
.float scale;
.float forceshader; //an fte extension, to force a q3 shader upon a model
.float fatness; //an fte feature, to expand alias models along thier normals.

View file

@ -0,0 +1,16 @@
float() CSQC_Parse_TempEntity =
{
vector org;
float te = readbyte();
print(sprintf("CSQC_Parse_TempEntity(%g)\n", te));
if (te == 130)
{
org_x = readcoord();
org_y = readcoord();
org_z = readcoord();
te_gunshot(org, 1);
}
else
return FALSE;
return TRUE;
};

View file

@ -2,18 +2,23 @@
#define crandom() (random()*2 - 1)
.float starttime;
.vector source;
void() SUB_Remove =
{
remove(self);
};
//Moves the entity to where it should be
void() RocketProject =
float() RocketProject =
{
local vector oldorg;
oldorg = self.origin;
self.origin = self.source + self.velocity * (time - self.starttime);
//Do the trail thing, if possible.
trailparticles(particleeffectforname("tr_rocket"), self, self.origin, oldorg);
trailparticles(particleeffectnum("tr_rocket"), self, self.origin, oldorg);
adddynamiclight(self.origin, 400, '0 1 0');
dynamiclight_add(self.origin, 400, '0 1 0');
return PREDRAW_AUTOADD;
};
nonstatic void(float isnew) ParseRocketClass =
@ -26,9 +31,9 @@ nonstatic void(float isnew) ParseRocketClass =
self.angles_y = (readshort()*360)/65535;
self.angles_z = random()*360;
self.angles_x*=-1;
self.angles_x*=autocvar(r_meshpitch,-1);
makevectors(self.angles);
self.angles_x*=-1;
self.angles_x*=autocvar(r_meshpitch,-1);
self.velocity = v_forward*1000;
self.origin = self.source;
@ -37,16 +42,17 @@ nonstatic void(float isnew) ParseRocketClass =
self.predraw = RocketProject;
};
nonstatic void() NailProject =
nonstatic float() NailProject =
{
local vector oldorg;
oldorg = self.origin;
self.origin = self.source + self.velocity * (time - self.starttime);
//Do the trail thing, if possible.
trailparticles(particleeffectforname("tr_nail"), self, self.origin, oldorg);
trailparticles(particleeffectnum("tr_nail"), self, self.origin, oldorg);
// adddynamiclight(self.origin, 100, '1 0 0');
return PREDRAW_AUTOADD;
};
nonstatic void(float isnew) ParseNailClass =
@ -62,9 +68,9 @@ nonstatic void(float isnew) ParseNailClass =
self.angles_y = (readshort()*360)/65535;
self.angles_z = 0; //don't rotate nails.
self.angles_x*=-1;
self.angles_x*=autocvar(r_meshpitch,-1);
makevectors(self.angles);
self.angles_x*=-1;
self.angles_x*=autocvar(r_meshpitch,-1);
self.velocity = v_forward*speed;
self.origin = self.source;
@ -102,7 +108,7 @@ vector(float dm) VelocityForDamage =
return v;
};
void() GibProject =
float() GibProject =
{
local float td;
local vector oldorg;
@ -114,13 +120,14 @@ void() GibProject =
if (self.alpha <= td)
{
remove(self);
return;
return PREDRAW_NEXT;
}
self.alpha -= td;
}
Movetype_Bounce();
trailparticles(particleeffectforname("tr_blood"), self, self.origin, oldorg);
trailparticles(particleeffectnum("tr_blood"), self, self.origin, oldorg);
return PREDRAW_AUTOADD;
};
void(string gibname, float dm, vector org) ThrowGib =
@ -137,7 +144,7 @@ void(string gibname, float dm, vector org) ThrowGib =
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.think = remove;
new.think = SUB_Remove;
new.nextthink = time + 10 + random()*10;
new.frame = 0;
new.flags = 0;
@ -290,9 +297,9 @@ nonstatic void(float isnew) ParseExplosion =
{
sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
#ifdef WORKINDP
pointparticles(particleeffectforname("te_explosion"), org, '0 0 0', 1);
pointparticles(particleeffectnum("te_explosion"), org, '0 0 0', 1);
#else
pointparticles(particleeffectforname("te_explosion"), org);
pointparticles(particleeffectnum("te_explosion"), org);
#endif
e = world;//findradius(org, 120);
@ -310,4 +317,4 @@ nonstatic void(float isnew) ParseExplosion =
}
self.drawmask = 0; //don't draw it any more.
};
};

View file

@ -1,26 +1,22 @@
../csprogs.dat
optscsqc.qc
#define CSQC
optsall.qc
cs/system.qc
#ifdef QSS
qsextensions.qc
#endif
fteextensions.qc
cs/defs.qc
common/classes.qc
common/combuiltins.qc
cs/csbuiltins.qc
common/extensions.qc
common/econstants.qc
cs/constants.qc
cs/playerframes.inc
common/pmovedefs.qc
common/pmove.qc
cs/keys.qc
common/makeallstatic.qc
cs/editor_lights.qc
@ -41,6 +37,7 @@ cs/fun/tetris.qc
cs/fun/osgk.qc
cs/weapons.qc
cs/tempent.qc
common/classes.qc

View file

@ -1,104 +0,0 @@
//FTE_CALLTIMEOFDAY
//IDEA: mvdsv team
void() calltimeofday = #231;
//void(float secs, float min, float hour, float day, float month, float year, string datestring) timeofday = {};
//A new builtin which immediatly calls a "timeofday" QC function. The key functionality here is that the parameters to the timeofday qc function are infact, the time of day.
//Note that expected use is to copy the parameters into globals, and then use the globals where the builtin was called from.
//History: This extension is identical to the calltimeofday builtin found in mvdsv. However, it uses a different builtin number in an effort to reduce builtin conflicts with other extensions (which mvdsv is not good for). Using cunning coding, you can achieve support for either.
//FTE_FORCEINFOKEY
//FIXME:forceinfokey
//FTE_ISBACKBUFFERED
//FIXME:isbackbuffered
//FTE_MEDIA_AVI
//The console command 'playfilm' supports avi files. Uncompressed audio only, however.
//FTE_MEDIA_CIN
//The console command 'playfilm' supports quake2 .cin files.
//FTE_MEDIA_ROQ
//The console command 'playfilm' supports quake3 .RoQ files.
//FTE_MULTIPROGS
//FIXME
//all sorts of fun multiple progs stuff all running in the same virtual machine.
//it's great fun.
//FTE_MULTITHREADED
void(float duration) sleep = #;
float() fork = #;
void(...) abort = #;
//sleep stops execution and magically restarts duration seconds later
//fork magically splits execution and somehow returns twice each individual time it's called.
//abort returns from the current function as well as all calling qc functions. Pass a parameter if the root qc function is meant to return something.
//note that sleep and fork preserve only locals and not globals or entity fields.
//FTE_MVD_PLAYBACK
//there is a playmvd console command, which can play a multiview demo to all connected clients, returning to the current gamestate when finished.
//FTE_NPCCHAT
//FIXME:chat
//a scripting language supporting qc callbacks, specially designed for one-on-one conversations with non-player charactures.
//FTE_SOLID_LADDER
float SOLID_LADDER = 20;
//players entering a solid type of this type using qw physics will treat it as a ladder.
//FTE_STRINGS
//FIXME:stof
//FIXME:strlen
//FIXME:strcat
//FIXME:substring
//FIXME:stov
//FIXME:strzone
//FIXME:strunzone
//FIXME:strstrofs
//FIXME:str2chr
//FIXME:chr2str
//FIXME:strconv
//FIXME:infoadd
//FIXME:infoget
//FIXME:strncmp
//FIXME:strcasecmp
//FIXME:strncasecmp
//FTE_PEXT_SETVIEW"}, //nq setview works.
//FTE_PEXT_LIGHTSTYLECOL
void(float style, string value, float colourmask) lightstylecol = #35;
float LS_RED = 1;
float LS_GREEN = 2;
float LS_BLUE = 4;
//colours light effects according to bits. Doesn't even need lits. Useful for making an entire map red, and stuff.
//FTE_PEXT_VIEW2
.entity view2;
//when set, the player will gain an extra little window showing the world from a different viewpoint.
//Move and angle the view2 entity to position it. Great for rocket cams and alerts (ctf?..)
//FTE_PEXT_BULLETENS
//Certain texture names can be replaced with text. Can show leader/looser/adverts.
//FTE_PEXT_FATNESS
.float fatness;
//expands an entity along it's vertex normals.
//Makes it fat without scaling it up.
//vacuum chambers...
//FTE_PEXT_HULLSIZE
.float hull;
//Use this hull number minus one for bsp collisions, and a bbox for entity-entity collisions.
//FTE_PEXT_CUSTOMTENTS
//FIXME:RegisterTempEnt
//FIXME:CustomTempEnt
//FTE_PEXT_256PACKETENTITIES
//Removes the 64 entities visible at once that the qw protocol origionally suffered from.
//EXT_CSQC

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
//#define WORKINDP //use workarounds for DP.
#define FTEDEPENDANT //explicitly depend upon FTE-only extensions (mostly prototype EXT_CSQC_1 features).
//#define OWNPLAYERPHYSICS //run our own prediction code, instead of the engine-supplied default
#define QSS
//#define FTEDEPENDANT //explicitly depend upon FTE-only extensions (mostly prototype EXT_CSQC_1 features).
#define OWNPLAYERPHYSICS //run our own prediction code, instead of the engine-supplied default
#define AUTOCVAR
@ -59,4 +60,4 @@
#define DEFCVAR_STRING(n,d)
#define CVARF(n) cvar(#n)
#define CVARS(n) cvar_string(#n)
#endif
#endif

View file

@ -1,2 +0,0 @@
#define CSQC
//#pragma compress 1

View file

@ -1 +0,0 @@
#define SSQC

File diff suppressed because it is too large Load diff

View file

@ -43,14 +43,14 @@ walkmove(angle, speed) primitive is all or nothing
entity sight_entity;
float sight_entity_time;
float(float v) anglemod =
/*float(float v) anglemod =
{
while (v >= 360)
v = v - 360;
while (v < 0)
v = v + 360;
return v;
};
};*/
/*
==============================================================================
@ -297,8 +297,6 @@ local float rsnd;
sound (self, CHAN_VOICE, "hknight/sight1.wav", 1, ATTN_NORM);
else if (self.classname == "monster_tarbaby")
sound (self, CHAN_VOICE, "blob/sight1.wav", 1, ATTN_NORM);
else if (self.classname == "monster_vomit")
sound (self, CHAN_VOICE, "vomitus/v_sight1.wav", 1, ATTN_NORM);
else if (self.classname == "monster_enforcer")
{
rsnd = rint(random() * 3);

View file

@ -1,43 +0,0 @@
//server only builtins.
entity() checkclient = #17; // returns a client to look for
void(string s) bprint = #23;
void(entity client, string s) sprint = #24;
float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
void(float style, string value) lightstyle = #35;
float(entity e) checkbottom = #40; // true if self is on ground
vector(entity e, float speed) aim = #44; // returns the shooting vector
//
// 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;
void(float step) movetogoal = #67;
void(entity e) makestatic = #69;
void(entity client, string s) centerprint = #73; // sprint, but in middle
void(vector pos, string samp, float vol, float atten) ambientsound = #74;
void(string s) changelevel = #70;
void(entity e) setspawnparms = #78; // set parm1... to the
// values at level start
// for coop respawn

View file

@ -2,15 +2,13 @@
// prototypes
void () W_WeaponFrame;
void() W_SetCurrentAmmo;
void() player_pain;
void(entity attacker, float damage) player_pain;
void() player_stand1;
void (vector org) spawn_tfog;
void (vector org, entity death_owner) spawn_tdeath;
float modelindex_eyes, modelindex_player;
void() DefaultPlayerPhysics;
.float usingcsqc;
/*
@ -472,7 +470,7 @@ entity() SelectSpawnPoint =
return spot;
};
float(entity to) SendPlayer =
float(entity to, float fl) SendPlayer =
{
float ef;
float f;
@ -1201,7 +1199,7 @@ ClientConnect
called when a player connects to a server
============
*/
void(float csqcenabled) ClientConnect =
void() ClientConnect =
{
bprint (self.netname);
bprint (" entered the game\n");
@ -1210,17 +1208,19 @@ void(float csqcenabled) ClientConnect =
if (intermission_running)
ExitIntermission ();
self.usingcsqc = csqcenabled;
self.usingcsqc = stof(infokey(self, INFOKEY_P_CSQCACTIVE));
if (self.usingcsqc)
{
self.dimension_see = 1;
sprint(self, "Welcome to csqctest!\n");
}
else
{
self.dimension_see = 3;
bprint(self.netname);
bprint(" is not using csqc!\n");
sprint(self, "You are not using csqc.\nThis could be due to version differences or only a partially installed mod.\nIf you are using FTEQW, please type \sallow_download_csprogs 1\s in the console, and then reconnect.\n\nNote that certain incompatabilities may exist if you do not.");
sprint(self, "You are not using csqc.\nThis could be due to version differences or only a partially installed mod.\nIf you are using FTEQW, please type \sallow_download_csprogs 1\s in the console, and then reconnect.\n\nNote that certain incompatabilities may exist if you do not.\n");
}
};
@ -1255,11 +1255,10 @@ enum {
GENDER_FEMALE,
GENDER_NEUTER
};
string infokey(entity ent, string keyname) = #80;
float(entity ent) GetGender =
{
local string s;
if (infokeyworks)
if (!isdp)
{
s = infokey(ent, "s");
if (s == "" || s == "m" || s == "male" || s == "yesplease")
@ -1370,27 +1369,27 @@ void(entity targ, entity attacker) ClientObituary =
deathstring = " was ax-murdered by ";
deathstring2 = "\n";
}
if (rnum == IT_SHOTGUN)
else if (rnum == IT_SHOTGUN)
{
deathstring = " chewed on ";
deathstring2 = "'s boomstick\n";
}
if (rnum == IT_SUPER_SHOTGUN)
else if (rnum == IT_SUPER_SHOTGUN)
{
deathstring = " ate 2 loads of ";
deathstring2 = "'s buckshot\n";
}
if (rnum == IT_NAILGUN)
else if (rnum == IT_NAILGUN)
{
deathstring = " was nailed by ";
deathstring2 = "\n";
}
if (rnum == IT_SUPER_NAILGUN)
else if (rnum == IT_SUPER_NAILGUN)
{
deathstring = " was punctured by ";
deathstring2 = "\n";
}
if (rnum == IT_GRENADE_LAUNCHER)
else if (rnum == IT_GRENADE_LAUNCHER)
{
deathstring = " eats ";
deathstring2 = "'s pineapple\n";
@ -1400,7 +1399,7 @@ void(entity targ, entity attacker) ClientObituary =
deathstring2 = "'s grenade\n";
}
}
if (rnum == IT_ROCKET_LAUNCHER)
else if (rnum == IT_ROCKET_LAUNCHER)
{
deathstring = " rides ";
deathstring2 = "'s rocket\n";
@ -1410,7 +1409,7 @@ void(entity targ, entity attacker) ClientObituary =
deathstring2 = "'s rocket\n" ;
}
}
if (rnum == IT_LIGHTNING)
else if (rnum == IT_LIGHTNING)
{
deathstring = " accepts ";
if (attacker.waterlevel > 1)
@ -1418,6 +1417,11 @@ void(entity targ, entity attacker) ClientObituary =
else
deathstring2 = "'s shaft\n";
}
else
{
deathstring = " was killed by ";
deathstring2 = "\n";
}
bprint (targ.netname);
bprint (deathstring);
bprint (attacker.netname);
@ -1549,14 +1553,13 @@ void(entity targ, entity attacker) ClientObituary =
}
};
void() DefaultPlayerPhysics = #347;
void() SV_RunClientCommand =
{
//should match the one used by csqc.
#ifdef OWNPLAYERPHYSICS
PMove(self);
#else
DefaultPlayerPhysics(self);
runstandardplayerphysics(self);
#endif
};

View file

@ -73,7 +73,7 @@ void() PlayerPreThink;
void() PlayerPostThink;
void() ClientKill;
void(float csqcenabled) ClientConnect;
void() ClientConnect;
void() PutClientInServer; // call after setting the parm1... parms
void() ClientDisconnect;
@ -501,8 +501,7 @@ float(entity targ, entity inflictor) CanDamage;
float serverusingcsqc;
float isdp;
.float(entity to) SendEntity;
.float SendFlags;
#define FULLSEND 0xffffff
float MSG_ENTITY = 5;

View file

@ -195,7 +195,7 @@ void() dog_painb14 =[ $painb14 , dog_painb15 ] {};
void() dog_painb15 =[ $painb15 , dog_painb16 ] {};
void() dog_painb16 =[ $painb16 , dog_run1 ] {};
void() dog_pain =
void(entity attacker, float damage) dog_pain =
{
sound (self, CHAN_VOICE, "dog/dpain1.wav", 1, ATTN_NORM);

View file

@ -578,7 +578,7 @@ void () fd_secret_use =
if (!(self.spawnflags & SECRET_NO_SHOOT))
{
self.th_pain = SUB_Null;
self.th_pain = __NULL__;
self.takedamage = DAMAGE_NO;
}
self.velocity = '0 0 0';
@ -665,7 +665,7 @@ void () fd_secret_done =
{
self.health = 10000;
self.takedamage = DAMAGE_YES;
self.th_pain = fd_secret_use;
self.th_pain = (void(entity attacker, float damage))fd_secret_use;
}
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
};
@ -769,7 +769,7 @@ void () func_door_secret =
{
self.health = 10000;
self.takedamage = DAMAGE_YES;
self.th_pain = fd_secret_use;
self.th_pain = (void(entity attacker, float damage))fd_secret_use;
self.th_die = fd_secret_use;
}
self.oldorigin = self.origin;

View file

@ -249,18 +249,20 @@ void() armor_touch =
value = 100;
bit = IT_ARMOR1;
}
if (self.classname == "item_armor2")
else if (self.classname == "item_armor2")
{
type = 0.6;
value = 150;
bit = IT_ARMOR2;
}
if (self.classname == "item_armorInv")
else if (self.classname == "item_armorInv")
{
type = 0.8;
value = 200;
bit = IT_ARMOR3;
}
else
return;
if (other.armortype*other.armorvalue >= type*value)
return;
@ -457,7 +459,10 @@ void() weapon_touch =
other.ammo_cells = other.ammo_cells + 15;
}
else
{
objerror ("weapon_touch: unknown classname");
new = 0;
}
sprint (other, "You got the ");
sprint (other, self.netname);

View file

@ -29,7 +29,7 @@ $frame painb10 painb11
//frame attack1 attack2 attack3 attack4 attack5 attack6 attack7
//frame attack8 attack9 attack10 attack11
$frame attackb1 attackb1 attackb2 attackb3 attackb4 attackb5
$frame attackb1 attackb1_dupe attackb2 attackb3 attackb4 attackb5
$frame attackb6 attackb7 attackb8 attackb9 attackb10
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9

View file

@ -26,7 +26,7 @@ $frame old30 old31 old32 old33 old34 old35 old36 old37 old38 old39
$frame old40 old41 old42 old43 old44 old45 old46
$frame shake1 shake2 shake3 shake4 shake5 shake6 shake7 shake8
$frame shake9 shake10 shake11 shake12 shake12 shake13 shake14
$frame shake9 shake10 shake11 shake12 shake12_dupe shake13 shake14
$frame shake15 shake16 shake17 shake18 shake19 shake20
//void() old_stand =[ $old1, old_stand ] {};
@ -239,7 +239,7 @@ void() finale_4 =
//============================================================================
void () nopain =
void (entity attacker, float damage) nopain =
{
self.health = 40000;
};

View file

@ -334,7 +334,7 @@ void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
void() player_axpain5 = [ $axpain5, player_axpain6 ] {};
void() player_axpain6 = [ $axpain6, player_run ] {};
void() player_pain =
void(entity attacker, float damage) player_pain =
{
if (self.weaponframe)
return;
@ -456,7 +456,7 @@ vector(float dm) VelocityForDamage =
return v;
};
float(entity ent) NotInCSQC =
float(entity ent, float fl) NotInCSQC =
{
return FALSE;
};
@ -501,7 +501,7 @@ void(string gibname, float dm) ThrowHead =
self.avelocity = crandom() * '0 600 0';
};
float(entity ent) WriteGibs =
float(entity ent, float fl) WriteGibs =
{
WriteByte(MSG_ENTITY, CLASS_GIB);
WriteByte(MSG_ENTITY, self.cnt);
@ -620,7 +620,6 @@ void() PlayerDie =
void() set_suicide_frame =
{ // used by kill command and diconnect command
local entity b;
if (self.model != "progs/player.mdl")
return; // already gibbed
self.frame = $deatha11;

View file

@ -21,7 +21,7 @@ $frame death1 death2 death3 death4 death5 death6 death7
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
$frame walk11 walk12
void() shalrath_pain;
void(entity attacker, float damage) shalrath_pain;
void() ShalMissile;
void() shal_stand =[ $walk1, shal_stand ] {ai_stand();};
@ -87,7 +87,7 @@ void() shal_death6 =[ $death6, shal_death7 ] {};
void() shal_death7 =[ $death7, shal_death7 ] {};
void() shalrath_pain =
void(entity attacker, float damage) shalrath_pain =
{
if (self.pain_finished > time)
return;

View file

@ -37,30 +37,31 @@ $frame prowl_1 prowl_2 prowl_3 prowl_4 prowl_5 prowl_6 prowl_7 prowl_8
$frame prowl_9 prowl_10 prowl_11 prowl_12 prowl_13 prowl_14 prowl_15 prowl_16
$frame prowl_17 prowl_18 prowl_19 prowl_20 prowl_21 prowl_22 prowl_23 prowl_24
#include "../cs/playerframes.inc"
float(float f) mapsoldieframetoplayer =
{
switch(f)
{
case $stand1 .. $stand8 :
return $stand1;
return playerframe::stand1;
case $death1 .. $deathc11 :
return $deatha1;
return playerframe::deatha1;
case $load1 .. $load11 :
return 0; //never used!
case $death1 .. $deathc11 :
return $deatha1;
return playerframe::deatha1;
case $pain1 .. $painc13 :
return $pain1;
return playerframe::pain1;
case $prowl_1 .. $prowl_24 :
case $run1 .. $run8 :
return $rockrun1;
return playerframe::rockrun1;
case $shoot1 .. $shoot9 :
return $shotatt1;
return playerframe::shotatt1;
}
return f;
};
float(entity to) SendSoldier =
float(entity to, float fl) SendSoldier =
{
WriteByte(MSG_ENTITY, CLASS_PLAYER);
WriteByte(MSG_ENTITY, mapsoldieframetoplayer (self.frame)); //for clientside animation selection, in a way compatable with not having csqc.

View file

@ -56,11 +56,24 @@ void() W_FireAxe =
else
{ // hit wall
sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_GUNSHOT);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
if (autocvar(test_buggyaxehit, 0) || isdp)
{ //for compat with dp. :(
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, 0x80|TE_GUNSHOT);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
}
else
{
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, 0x80|TE_GUNSHOT);
WriteCoord (MSG_MULTICAST, org_x);
WriteCoord (MSG_MULTICAST, org_y);
WriteCoord (MSG_MULTICAST, org_z);
multicast(org, MULTICAST_PVS);
}
}
};
@ -311,7 +324,7 @@ ROCKETS
.vector source;
.float starttime;
float(entity toplayer) SendNail =
float(entity toplayer, float fl) SendNail =
{
vector v;
v = self.source + self.velocity*(time-self.starttime);
@ -327,7 +340,7 @@ float(entity toplayer) SendNail =
return TRUE;
};
float(entity toplayer) SendRocket =
float(entity toplayer, float fl) SendRocket =
{
vector v;
v = self.source + self.velocity*(time-self.starttime);
@ -342,7 +355,7 @@ float(entity toplayer) SendRocket =
};
float(entity toplayer) SendExplosion =
float(entity toplayer, float fl) SendExplosion =
{
vector v;
v = self.origin;
@ -355,15 +368,15 @@ float(entity toplayer) SendExplosion =
};
/*this is for shits and giggles*/
void(float action, vector pos, float radius, float quant) terrain_edit = #278;
void() makevolcano =
{
#ifdef FTEDEPENDANT
terrain_edit(4, self.origin, 512, 64/3);
terrain_edit(5, self.origin, 256, 32/3);
#endif
if (checkbuiltin(terrain_edit) && autocvar(test_volcano, 0, "Rocket explosions create a volcano shape on terrain models."))
{
terrain_edit(4, self.origin, 512, 64/3);
terrain_edit(5, self.origin, 256, 32/3);
}
};
void() s_explode1 = {self.think = s_explode1; if (self.frame >= 6) {remove(self); return;}makevolcano(); self.frame += 0.5; self.nextthink = time + 0.05;};
void() s_explode1 = {self.think = s_explode1; makevolcano(); self.frame += 0.5; self.nextthink = time + 0.05; if (self.frame >= 6) {remove(self); return;}};
void() BecomeExplosion =
{
@ -1068,6 +1081,8 @@ void() W_ChangeWeapon =
if (self.ammo_cells < 1)
am = 1;
}
else
fl = 0;
self.impulse = 0;

View file

@ -1,10 +1,5 @@
float infokeyworks;
void() InitBodyQue;
void(float num, float type, .float field) addstatf = #232;
void(float num, float type, .string field) addstats = #232;
void(float num, float type, .vector field) addstatv = #232;
void() main =
{
dprint ("main function\n");
@ -337,13 +332,10 @@ void() worldspawn =
// 63 testing
lightstyle(63, "a");
infokeyworks = checkextension("QW_ENGINE");
isdp = autocvar(test_dpcompat, 0);
serverusingcsqc = checkextension("EXT_CSQC") || checkextension("EXT_CSQC_1");
#ifdef WORKINDP
if (isdp)
serverusingcsqc = TRUE;
#endif
};
void() StartFrame =
@ -355,7 +347,7 @@ void() StartFrame =
float(entity ent) BodyqueCSQC =
float(entity ent, float fl) BodyqueCSQC =
{
return FALSE;
};

View file

@ -1,12 +1,14 @@
../progs.dat
optsssqc.qc
#define SSQC
optsall.qc
#ifdef QSS
qsextensions.qc
#undef CSQC
#endif
fteextensions.qc
ss/defs.qc
ss/builtins.qc
common/combuiltins.qc
common/extensions.qc
common/econstants.qc
common/classes.qc