#include "physics.qh"
-#include "triggers/trigger/swamp.qh"
-#include "triggers/trigger/jumppads.qh"
+#include "triggers/include.qh"
#include "viewloc.qh"
#ifdef SVQC
// client side physics
bool Physics_Valid(string thecvar)
{
- if(!autocvar_g_physics_clientselect) { return false; }
-
- string l = strcat(" ", autocvar_g_physics_clientselect_options, " ");
-
- if(strstrofs(l, strcat(" ", thecvar, " "), 0) >= 0)
- return true;
-
- return false;
+ return autocvar_g_physics_clientselect && strhasword(autocvar_g_physics_clientselect_options, thecvar);
}
float Physics_ClientOption(entity pl, string option)
{
if(Physics_Valid(pl.cvar_cl_physics))
{
- string var = sprintf("g_physics_%s_%s", pl.cvar_cl_physics, option);
- if(cvar_type(var) & CVAR_TYPEFLAG_EXISTS)
- return cvar(var);
+ string s = sprintf("g_physics_%s_%s", pl.cvar_cl_physics, option);
+ if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
+ return cvar(s);
}
if(autocvar_g_physics_clientselect && autocvar_g_physics_clientselect_default)
{
- string var = sprintf("g_physics_%s_%s", autocvar_g_physics_clientselect_default, option);
- if(cvar_type(var) & CVAR_TYPEFLAG_EXISTS)
- return cvar(var);
+ string s = sprintf("g_physics_%s_%s", autocvar_g_physics_clientselect_default, option);
+ if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
+ return cvar(s);
}
return cvar(strcat("sv_", option));
}
}
void Physics_UpdateStats(float maxspd_mod)
-{
+{SELFPARAM();
// blah
self.stat_pl_view_ofs = PL_VIEW_OFS;
self.stat_pl_crouch_view_ofs = PL_CROUCH_VIEW_OFS;
};
void PM_ClientMovement_Unstick()
-{
+{SELFPARAM();
float i;
for (i = 0; i < unstick_count; i++)
{
}
void PM_ClientMovement_UpdateStatus(bool ground)
-{
+{SELFPARAM();
// make sure player is not stuck
PM_ClientMovement_Unstick();
}
void PM_ClientMovement_Move()
-{
+{SELFPARAM();
#ifdef CSQC
int bump;
float t;
}
void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
-{
+{SELFPARAM();
float k = 32 * (2 * IsMoveInDirection(self.movement, 0) - 1);
if (k <= 0)
return;
// prvm_globalset server speedclamp_mode 1
// (or 2)
void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float accel, float accelqw, float stretchfactor, float sidefric, float speedlimit)
-{
+{SELFPARAM();
float speedclamp = stretchfactor > 0 ? stretchfactor
: accelqw < 0 ? 1 // full clamping, no stretch
: -1; // no clamping
}
void PM_AirAccelerate(vector wishdir, float wishspeed)
-{
+{SELFPARAM();
if (wishspeed == 0)
return;
=============
*/
bool PlayerJump (void)
-{
+{SELFPARAM();
if (PHYS_FROZEN(self))
return true; // no jumping in freezetag when frozen
}
void CheckWaterJump()
-{
+{SELFPARAM();
// check for a jump-out-of-water
makevectors(self.v_angle);
vector start = self.origin;
// Hack: shouldn't need to know about this
.float multijump_count;
void CheckPlayerJump()
-{
+{SELFPARAM();
#ifdef SVQC
float was_flying = ITEMS_STAT(self) & IT_USING_JETPACK;
#endif
}
void RaceCarPhysics()
-{
+{SELFPARAM();
#ifdef SVQC
// using this move type for "big rigs"
// the engine does not push the entity!
}
void PM_check_race_movetime(void)
-{
+{SELFPARAM();
#ifdef SVQC
self.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
float f = floor(self.race_movetime_frac);
}
float PM_check_specialcommand(float buttons)
-{
+{SELFPARAM();
#ifdef SVQC
string c;
if (!buttons)
}
void PM_check_nickspam(void)
-{
+{SELFPARAM();
#ifdef SVQC
if (time >= self.nickspamtime)
return;
}
void PM_check_punch()
-{
+{SELFPARAM();
#ifdef SVQC
if (self.punchangle != '0 0 0')
{
}
void PM_check_spider(void)
-{
+{SELFPARAM();
#ifdef SVQC
if (time >= self.spider_slowness)
return;
// predict frozen movement, as frozen players CAN move in some cases
void PM_check_frozen(void)
-{
+{SELFPARAM();
if (!PHYS_FROZEN(self))
return;
if (PHYS_DODGING_FROZEN
}
void PM_check_hitground()
-{
+{SELFPARAM();
#ifdef SVQC
if (IS_ONGROUND(self))
if (IS_PLAYER(self)) // no fall sounds for observers thank you very much
}
void PM_check_blocked(void)
-{
+{SELFPARAM();
#ifdef SVQC
if (!self.player_blocked)
return;
float speedaward_lastupdate;
#endif
void PM_check_race(void)
-{
+{SELFPARAM();
#ifdef SVQC
if(!(g_cts || g_race))
return;
}
void PM_check_vortex(void)
-{
+{SELFPARAM();
#ifdef SVQC
// WEAPONTODO
float xyspeed = vlen(vec2(self.velocity));
}
void PM_fly(float maxspd_mod)
-{
+{SELFPARAM();
// noclipping or flying
UNSET_ONGROUND(self);
}
void PM_swim(float maxspd_mod)
-{
+{SELFPARAM();
// swimming
UNSET_ONGROUND(self);
}
void PM_ladder(float maxspd_mod)
-{
+{SELFPARAM();
// on a spawnfunc_func_ladder or swimming in spawnfunc_func_water
UNSET_ONGROUND(self);
}
void PM_jetpack(float maxspd_mod)
-{
+{SELFPARAM();
//makevectors(self.v_angle.y * '0 1 0');
makevectors(self.v_angle);
vector wishvel = v_forward * self.movement_x
}
void PM_walk(float buttons_prev, float maxspd_mod)
-{
+{SELFPARAM();
if (!WAS_ONGROUND(self))
{
#ifdef SVQC
}
void PM_air(float buttons_prev, float maxspd_mod)
-{
+{SELFPARAM();
makevectors(self.v_angle.y * '0 1 0');
vector wishvel = v_forward * self.movement.x
+ v_right * self.movement.y;
}
void PM_Main()
-{
+{SELFPARAM();
int buttons = PHYS_INPUT_BUTTON_MASK(self);
#ifdef CSQC
self.items = getstati(STAT_ITEMS, 0, 24);
#elif defined(CSQC)
void CSQC_ClientMovement_PlayerMove_Frame(void)
#endif
-{
+{SELFPARAM();
PM_Main();
#ifdef CSQC