vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
vector autocvar_sv_player_headsize = '24 24 12';
+
+#ifdef SVQC
#define PL_VIEW_OFS autocvar_sv_player_viewoffset
#define PL_MIN autocvar_sv_player_mins
#define PL_MAX autocvar_sv_player_maxs
#define PL_CROUCH_MIN autocvar_sv_player_crouch_mins
#define PL_CROUCH_MAX autocvar_sv_player_crouch_maxs
#define PL_HEAD autocvar_sv_player_headsize
-
-// helpers
-#define PL_VIEW_OFS_z autocvar_sv_player_viewoffset.z
-#define PL_MIN_z autocvar_sv_player_mins.z
-#define PL_MAX_z autocvar_sv_player_maxs.z
-#define PL_CROUCH_VIEW_OFS_z autocvar_sv_player_crouch_viewoffset.z
-#define PL_CROUCH_MIN_z autocvar_sv_player_mins.z
-#define PL_HEAD_x autocvar_sv_player_headsize.x
-#define PL_HEAD_y autocvar_sv_player_headsize.y
-#define PL_HEAD_z autocvar_sv_player_headsize.z
+#elif defined(CSQC)
+#define PL_VIEW_OFS vec3(getstatf(STAT_PL_VIEW_OFS1), getstatf(STAT_PL_VIEW_OFS2), getstatf(STAT_PL_VIEW_OFS3))
+#define PL_MIN vec3(getstatf(STAT_PL_MIN1), getstatf(STAT_PL_MIN2), getstatf(STAT_PL_MIN3))
+#define PL_MAX vec3(getstatf(STAT_PL_MAX1), getstatf(STAT_PL_MAX2), getstatf(STAT_PL_MAX3))
+#define PL_CROUCH_VIEW_OFS vec3(getstatf(STAT_PL_CROUCH_VIEW_OFS1), getstatf(STAT_PL_CROUCH_VIEW_OFS2), getstatf(STAT_PL_CROUCH_VIEW_OFS3))
+#define PL_CROUCH_MIN vec3(getstatf(STAT_PL_CROUCH_MIN1), getstatf(STAT_PL_CROUCH_MIN2), getstatf(STAT_PL_CROUCH_MIN3))
+#define PL_CROUCH_MAX vec3(getstatf(STAT_PL_CROUCH_MAX1), getstatf(STAT_PL_CROUCH_MAX2), getstatf(STAT_PL_CROUCH_MAX3))
+#endif
// spawnpoint prios
const int SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200;
void Physics_AddStats()
{
+ // static view offset and hitbox vectors
+ // networked for all you bandwidth pigs out there
+ addstat(STAT_PL_VIEW_OFS1, AS_FLOAT, stat_pl_view_ofs_x);
+ addstat(STAT_PL_VIEW_OFS2, AS_FLOAT, stat_pl_view_ofs_y);
+ addstat(STAT_PL_VIEW_OFS3, AS_FLOAT, stat_pl_view_ofs_z);
+ addstat(STAT_PL_CROUCH_VIEW_OFS1, AS_FLOAT, stat_pl_crouch_view_ofs_x);
+ addstat(STAT_PL_CROUCH_VIEW_OFS2, AS_FLOAT, stat_pl_crouch_view_ofs_y);
+ addstat(STAT_PL_CROUCH_VIEW_OFS3, AS_FLOAT, stat_pl_crouch_view_ofs_z);
+
+ addstat(STAT_PL_MIN1, AS_FLOAT, stat_pl_min_x);
+ addstat(STAT_PL_MIN2, AS_FLOAT, stat_pl_min_y);
+ addstat(STAT_PL_MIN3, AS_FLOAT, stat_pl_min_z);
+ addstat(STAT_PL_MAX1, AS_FLOAT, stat_pl_max_x);
+ addstat(STAT_PL_MAX2, AS_FLOAT, stat_pl_max_y);
+ addstat(STAT_PL_MAX3, AS_FLOAT, stat_pl_max_z);
+ addstat(STAT_PL_CROUCH_MIN1, AS_FLOAT, stat_pl_crouch_min_x);
+ addstat(STAT_PL_CROUCH_MIN2, AS_FLOAT, stat_pl_crouch_min_y);
+ addstat(STAT_PL_CROUCH_MIN3, AS_FLOAT, stat_pl_crouch_min_z);
+ addstat(STAT_PL_CROUCH_MAX1, AS_FLOAT, stat_pl_crouch_max_x);
+ addstat(STAT_PL_CROUCH_MAX2, AS_FLOAT, stat_pl_crouch_max_y);
+ addstat(STAT_PL_CROUCH_MAX3, AS_FLOAT, stat_pl_crouch_max_z);
+
// g_movementspeed hack
addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw);
addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed);
void Physics_UpdateStats(float maxspd_mod)
{
+ // blah
+ self.stat_pl_view_ofs = PL_VIEW_OFS;
+ self.stat_pl_crouch_view_ofs = PL_CROUCH_VIEW_OFS;
+
+ self.stat_pl_min = PL_MIN;
+ self.stat_pl_max = PL_MAX;
+ self.stat_pl_crouch_min = PL_CROUCH_MIN;
+ self.stat_pl_crouch_max = PL_CROUCH_MAX;
+
+
self.stat_sv_airaccel_qw = AdjustAirAccelQW(Physics_ClientOption(self, "airaccel_qw"), maxspd_mod);
if(Physics_ClientOption(self, "airstrafeaccel_qw"))
self.stat_sv_airstrafeaccel_qw = AdjustAirAccelQW(Physics_ClientOption(self, "airstrafeaccel_qw"), maxspd_mod);
.float discomode;
+ .vector stat_pl_view_ofs;
+ .vector stat_pl_crouch_view_ofs;
+
+ .vector stat_pl_min;
+ .vector stat_pl_max;
+ .vector stat_pl_crouch_min;
+ .vector stat_pl_crouch_max;
+
.float stat_sv_airaccel_qw;
.float stat_sv_airstrafeaccel_qw;
.float stat_sv_airspeedlimit_nonqw;
/* Gamemode-specific stats end here */
-// 105 empty?
-// 106 empty?
-// 107 empty?
-// 108 empty?
-// 109 empty?
-// 110 empty?
-// 111 empty?
-// 112 empty?
-// 113 empty?
-// 114 empty?
-// 115 empty?
-// 116 empty?
-// 117 empty?
-// 118 empty?
-// 119 empty?
-// 120 empty?
-// 121 empty?
-// 122 empty?
+const int STAT_PL_VIEW_OFS1 = 105;
+const int STAT_PL_VIEW_OFS2 = 106;
+const int STAT_PL_VIEW_OFS3 = 107;
+const int STAT_PL_MIN1 = 108;
+const int STAT_PL_MIN2 = 109;
+const int STAT_PL_MIN3 = 110;
+const int STAT_PL_MAX1 = 111;
+const int STAT_PL_MAX2 = 112;
+const int STAT_PL_MAX3 = 113;
+const int STAT_PL_CROUCH_MIN1 = 114;
+const int STAT_PL_CROUCH_MIN2 = 115;
+const int STAT_PL_CROUCH_MIN3 = 116;
+const int STAT_PL_CROUCH_MAX1 = 117;
+const int STAT_PL_CROUCH_MAX2 = 118;
+const int STAT_PL_CROUCH_MAX3 = 119;
+const int STAT_PL_CROUCH_VIEW_OFS1 = 117;
+const int STAT_PL_CROUCH_VIEW_OFS2 = 118;
+const int STAT_PL_CROUCH_VIEW_OFS3 = 119;
// 123 empty?
// 124 empty?
// 125 empty?
// first calculate a typical start point for the jump
org = (self.absmin + self.absmax) * 0.5;
- org_z = self.absmax.z - PL_MIN_z;
+ org_z = self.absmax.z - PL_MIN.z;
if (self.target)
{
norm = trace_plane_normal;
if(trace_ent.iscreature)
{
- traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * PL_MIN_z, MOVE_WORLDONLY, self);
+ traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * PL_MIN.z, MOVE_WORLDONLY, self);
if(trace_fraction >= 1)
return;
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP)
self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
// get crouch state from the server
- if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+ if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
self.flags &= ~FL_DUCKED;
- else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+ else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
self.flags |= FL_DUCKED;
// get onground state from the server
self.velocity = v;
// get crouch state from the server
- if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+ if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
self.flags &= ~FL_DUCKED;
- else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+ else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
self.flags |= FL_DUCKED;
// get onground state from the server
//#ifdef CSQCMODEL_SERVERSIDE_CROUCH
// get crouch state from the server (LAG)
if(!autocvar_cl_crouch)
- if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+ if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
self.flags &= ~FL_DUCKED;
- else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+ else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
self.flags |= FL_DUCKED;
//#endif
string autocvar_sv_weapons_modeloverride;
string autocvar_sv_weapons_sounddir;
string autocvar_sv_items_modeloverride;
+float autocvar_sv_player_scale;
#endif
// Flying
self.BUTTON_HOOK = true;
- if(self.navigation_jetpack_point.z - PL_MAX_z + PL_MIN_z < self.origin.z)
+ if(self.navigation_jetpack_point.z - PL_MAX.z + PL_MIN.z < self.origin.z)
{
self.movement_x = dir * v_forward * maxspeed;
self.movement_y = dir * v_right * maxspeed;
}
org = ent.origin + 0.5 * (ent.mins + ent.maxs);
- org.z = ent.origin.z + ent.mins.z - PL_MIN_z; // player height
+ org.z = ent.origin.z + ent.mins.z - PL_MIN.z; // player height
// TODO possibly make other code have the same support for bboxes
if(ent.tag_entity)
org = org + ent.tag_entity.origin;
float zdistance, xydistance, cost, t, fuel;
vector down, npa, npb;
- down = '0 0 -1' * (PL_MAX_z - PL_MIN_z) * 10;
+ down = '0 0 -1' * (PL_MAX.z - PL_MIN.z) * 10;
do{
npa = pointa + down;
navigation_testtracewalk = 0;
if (!self.wpisbox)
{
- tracebox(sv - PL_MIN_z * '0 0 1', PL_MIN, PL_MAX, sv, false, self);
+ tracebox(sv - PL_MIN.z * '0 0 1', PL_MIN, PL_MAX, sv, false, self);
if (!trace_startsolid)
{
//dprint("sv deviation", vtos(trace_endpos - sv), "\n");
}
if (!e.wpisbox)
{
- tracebox(ev - PL_MIN_z * '0 0 1', PL_MIN, PL_MAX, ev, false, e);
+ tracebox(ev - PL_MIN.z * '0 0 1', PL_MIN, PL_MAX, ev, false, e);
if (!trace_startsolid)
{
//dprint("ev deviation", vtos(trace_endpos - ev), "\n");
vector waypoint_fixorigin(vector position)
{
- tracebox(position + '0 0 1' * (1 - PL_MIN_z), PL_MIN, PL_MAX, position + '0 0 -512', MOVE_NOMONSTERS, world);
+ tracebox(position + '0 0 1' * (1 - PL_MIN.z), PL_MIN, PL_MAX, position + '0 0 -512', MOVE_NOMONSTERS, world);
if(trace_fraction < 1)
position = trace_endpos;
//traceline(position, position + '0 0 -512', MOVE_NOMONSTERS, world);
self.respawn_flags = 0;
self.respawn_time = 0;
self.stat_respawn_time = 0;
- self.scale = 0;
+ self.scale = autocvar_sv_player_scale;
self.fade_time = 0;
self.pain_frame = 0;
self.pain_finished = 0;
const vector FLAG_DROP_OFFSET = ('0 0 32');
const vector FLAG_CARRY_OFFSET = ('-16 0 8');
-#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_z - 13))
+#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX.z - 13))
const vector FLAG_WAYPOINT_OFFSET = ('0 0 64');
const vector FLAG_FLOAT_OFFSET = ('0 0 32');
const vector FLAG_PASS_ARC_OFFSET = ('0 0 -10');
const vector KEY_DROP_OFFSET = ('0 0 16');
const vector KEY_CARRY_OFFSET = ('-16 0 8');
-#define KEY_SPAWN_OFFSET ('0 0 1' * (PL_MAX_z - 13))
+#define KEY_SPAWN_OFFSET ('0 0 1' * (PL_MAX.z - 13))
const vector KEY_WAYPOINT_OFFSET = ('0 0 64');
const vector KEY_FLOAT_OFFSET = ('0 0 16');
const vector KEY_PASS_ARC_OFFSET = ('0 0 -10');
// control point / generator constants
#define ONS_CP_THINKRATE 0.2
#define GEN_THINKRATE 1
-#define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX_z - 13))
+#define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX.z - 13))
#define CPGEN_WAYPOINT_OFFSET ('0 0 128')
#define CPICON_OFFSET ('0 0 96')
return;
/*
- if(other.mins_x < PL_MIN_x || other.mins_y < PL_MIN_y || other.mins_z < PL_MIN_z
- || other.maxs_x > PL_MAX_x || other.maxs_y > PL_MAX_y || other.maxs_z > PL_MAX_z)
+ if(other.mins_x < PL_MIN.x || other.mins_y < PL_MIN.y || other.mins_z < PL_MIN.z
+ || other.maxs_x > PL_MAX.x || other.maxs_y > PL_MAX.y || other.maxs_z > PL_MAX.z)
{
// can't teleport this
return;