9 }
else if (autocvar_sv_qcphysics == 2) {
26 vector goodmins = pivot, goodmaxs = pivot;
27 for(
int bump = 0; bump < 6; bump++)
29 int coord = 2 - (bump >> 1);
32 for(
int subbump = 0; ; ++subbump)
34 vector testorigin = stuckorigin;
40 case 0: testorigin.x += this.maxs_x - goodmaxs.x;
break;
41 case 1: testorigin.y += this.maxs_y - goodmaxs.y;
break;
42 case 2: testorigin.z += this.maxs_z - goodmaxs.z;
break;
50 case 0: testorigin.x += this.mins_x - goodmins.x;
break;
51 case 1: testorigin.y += this.mins_y - goodmins.y;
break;
52 case 2: testorigin.z += this.mins_z - goodmins.z;
break;
56 tracebox(stuckorigin, goodmins, goodmaxs, testorigin,
MOVE_NOMONSTERS,
this);
83 case 0: goodmaxs.x = this.maxs_x;
break;
84 case 1: goodmaxs.y = this.maxs_y;
break;
85 case 2: goodmaxs.z = this.maxs_z;
break;
93 case 0: goodmins.x = this.mins_x;
break;
94 case 1: goodmins.y = this.mins_y;
break;
95 case 2: goodmins.z = this.mins_z;
break;
101 this.
origin = stuckorigin;
132 int i, j, numplanes = 0;
133 float time_left = dt, grav = 0;
135 vector primal_velocity, original_velocity;
144 grav = dt * (this.
gravity ? this.
gravity : 1) * PHYS_GRAVITY(
this);
146 if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !
IS_ONGROUND(
this))
148 if(GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE)
149 this.velocity_z -= grav * 0.5;
151 this.velocity_z -= grav;
155 original_velocity = primal_velocity = this.
velocity;
206 vector steppush =
'0 0 1' * stepheight;
219 steppush =
vec3(0, 0, org.z -
this.origin_z);
227 if(
fabs(this.origin_x - org.x) >= 0.03125 ||
fabs(this.origin_y - org.y) >= 0.03125)
230 time_left *= 1 - trace2_fraction;
246 if(my_trace_fraction >= 0.001)
253 time_left *= 1 - my_trace_fraction;
256 if(numplanes >= MAX_CLIP_PLANES)
264 planes[numplanes] = my_trace_plane_normal;
268 vector new_velocity =
'0 0 0';
269 for (i = 0;i < numplanes;i++)
272 for (j = 0;j < numplanes;j++)
277 if((new_velocity * planes[j]) < 0)
301 float ilength =
sqrt((dir * dir));
303 ilength = 1.0 / ilength;
313 if((this.
velocity * primal_velocity) <= 0)
329 if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !
IS_ONGROUND(
this))
331 if(GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE)
332 this.velocity_z -= grav * 0.5f;
348 point.z += this.
mins.z + 1;
350 int nativecontents = pointcontents(point);
354 if(this.contentstransition)
355 this.contentstransition(this.
watertype, nativecontents);
361 int supercontents = Mod_Q1BSP_SuperContentsFromNativeContents(nativecontents);
381 int contents = pointcontents(ent.origin);
388 ent.watertype = contents;
393 else if(ent.watertype != contents)
396 if(ent.contentstransition)
397 ent.contentstransition(ent.watertype, contents);
402 ent.watertype = contents;
433 gettouch(
this)(
this, oth);
435 if(oth.solid !=
SOLID_NOT && gettouch(oth))
436 gettouch(oth)(oth,
this);
476 if (gettouch(it) &&
boxesoverlap(it.absmin, it.absmax,
this.absmin,
this.absmax))
478 trace_allsolid = false;
479 trace_startsolid = false;
481 trace_inwater = false;
483 trace_endpos = it.origin;
484 trace_plane_normal =
'0 0 1';
485 trace_plane_dist = 0;
487 trace_dpstartcontents = 0;
488 trace_dphitcontents = 0;
489 trace_dphitq3surfaceflags = 0;
490 trace_dphittexturename = string_null;
492 gettouch(it)(it, this);
514 if(autocvar__movetype_debug)
611 for(
int j = 2; j <= offset; ++j)
624 _Movetype_TestEntityPosition_ent =
this;
628 #define X(v) if (_Movetype_TestEntityPosition(v)) 629 X(
'0 0 -1')
X(
' 0 0 1')
630 X(
'-1 0 0')
X(
' 1 0 0')
631 X(
' 0 -1 0')
X(
' 0 1 0')
632 X(
'-1 -1 0')
X(
' 1 -1 0')
633 X(
'-1 1 0')
X(
' 1 1 0')
638 LOG_DEBUGF(
"Can't unstick an entity (edict: %d, classname: %s, origin: %s)",
643 LOG_DEBUGF(
"Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)",
670 vel -= ((vel * norm) * norm) * f;
672 if(vel.x > -0.1 && vel.x < 0.1) vel.x = 0;
673 if(vel.y > -0.1 && vel.y < 0.1) vel.y = 0;
674 if(vel.z > -0.1 && vel.z < 0.1) vel.z = 0;
721 return (this.
origin == last_origin);
770 LOG_DEBUG(
"Physics: Lacking QuakeC support for Push movetype, FIX ME by using engine physics!");
842 this.move_time =
time;
874 if(this.(s) != this.tic_saved_##s) \ 875 this.tic_##s = this.(s) 906 this.move_time += n * tr;
911 for (
int j = 0; j < n; ++j)
941 this.velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1)
944 * PHYS_GRAVITY(
this);
964 this.velocity_z -= 0.5 * dt * ((this.
gravity) ? this.
gravity : 1) * PHYS_GRAVITY(
this);
void _Movetype_Physics_Push(entity this, float dt)
const float SOLID_SLIDEBOX
bool autocvar__movetype_debug
const int WATERLEVEL_SUBMERGED
float trace_dphitq3surfaceflags
#define GAMEPLAYFIX_WATERTRANSITION(s)
vector _Movetype_ClipVelocity(vector vel, vector norm, float f)
const float MOVETYPE_PHYSICS
const int MAX_CLIP_PLANES
#define GAMEPLAYFIX_EASIERWATERJUMP(s)
bool _Movetype_CheckWater(entity this)
float DPCONTENTS_MONSTERCLIP
float trace_dphitcontents
float MOVETYPE_BOUNCEMISSILE
bool _Movetype_TestEntityPosition_Offset(int offset)
#define GAMEPLAYFIX_UNSTICKPLAYERS(s)
float DPCONTENTS_PLAYERCLIP
void _Movetype_Physics_ClientFrame(entity this, float movedt)
#define GAMEPLAYFIX_DELAYPROJECTILES(s)
void Movetype_Physics_NoMatchServer(entity this)
void Movetype_Physics_NoMatchTicrate(entity this, float movedt, bool isclient)
ERASEABLE bool IL_CONTAINS(IntrusiveList this, entity it)
void _Movetype_CheckStuck(entity this)
bool _Movetype_NudgeOutOfSolid_PivotIsKnownGood(entity this, vector pivot)
const int MOVETYPE_FAKEPUSH
const int WATERLEVEL_NONE
int _Movetype_UnstickEntity(entity this)
string trace_dphittexturename
int _Movetype_ContentsMask(entity this)
const float CONTENT_EMPTY
void _Movetype_CheckWaterTransition(entity ent)
vector tic_saved_avelocity
void _Movetype_Physics_Follow(entity this)
const float MOVE_NOMONSTERS
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy)
void Movetype_Physics_MatchServer(entity this, bool sloppy)
ERASEABLE float boxesoverlap(vector m1, vector m2, vector m3, vector m4)
requires that m2>m1 in all coordinates, and that m4>m3
entity _Movetype_TestEntityPosition_ent
const float CONTENT_WATER
const int MOVETYPE_QCENTITY
float MOVETYPE_FLY_WORLDONLY
void _Movetype_Physics_Step(entity this, float dt)
void _Movetype_Physics_Frame(entity this, float movedt)
void _Movetype_LinkEdict(entity this, bool touch_triggers)
void _Movetype_Physics_Walk(entity this, float dt)
float trace_dpstartcontents
void _Movetype_PushEntityTrace(entity this, vector push)
int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepnormal, float stepheight)
const int WATERLEVEL_WETFEET
vector planes[MAX_CLIP_PLANES]
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float MOVETYPE_FLYMISSILE
void _Movetype_Physics_Toss(entity this, float dt)
vector tic_saved_velocity
void _Movetype_Impact(entity this, entity oth)
const float SOLID_TRIGGER
const int WATERLEVEL_SWIMMING
vector trace_plane_normal
bool _Movetype_TestEntityPosition(vector ofs)
IntrusiveList g_moveables
float DPCONTENTS_LIQUIDSMASK
bool _Movetype_PushEntity(entity this, vector push, bool failonstartsolid, bool dolink)
void _Movetype_CheckVelocity(entity this)
void _Movetype_WallFriction(entity this, vector stepnormal)
void _Movetype_LinkEdict_TouchAreaGrid(entity this)
void set_movetype(entity this, int mt)