22 vector goodmins = pivot, goodmaxs = pivot;
23 for(
int bump = 0; bump < 6; ++bump)
25 int coord = 2 - (bump >> 1);
28 for(
int subbump = 0; ; ++subbump)
30 vector testorigin = stuckorigin;
36 case 0: testorigin.x += this.maxs_x - goodmaxs.x;
break;
37 case 1: testorigin.y += this.maxs_y - goodmaxs.y;
break;
38 case 2: testorigin.z += this.maxs_z - goodmaxs.z;
break;
46 case 0: testorigin.x += this.mins_x - goodmins.x;
break;
47 case 1: testorigin.y += this.mins_y - goodmins.y;
break;
48 case 2: testorigin.z += this.mins_z - goodmins.z;
break;
52 tracebox(stuckorigin, goodmins, goodmaxs, testorigin,
MOVE_NOMONSTERS,
this);
79 case 0: goodmaxs.x = this.maxs_x;
break;
80 case 1: goodmaxs.y = this.maxs_y;
break;
81 case 2: goodmaxs.z = this.maxs_z;
break;
89 case 0: goodmins.x = this.mins_x;
break;
90 case 1: goodmins.y = this.mins_y;
break;
91 case 2: goodmins.z = this.mins_z;
break;
129 float time_left = dt, grav = 0;
131 vector primal_velocity, original_velocity;
145 this.velocity_z -= grav * 0.5;
147 this.velocity_z -= grav;
151 original_velocity = primal_velocity = this.
velocity;
218 steppush =
vec3(0, 0,
org.z -
this.origin_z);
227 if(this.origin_x -
org.x ||
this.origin_y -
org.y)
230 time_left *= 1 - trace2_fraction;
246 if(my_trace_fraction >= 0.001)
262 planes[numplanes] = my_trace_plane_normal;
266 vector new_velocity =
'0 0 0';
268 for (plane = 0;plane < numplanes; ++plane)
272 for (newplane = 0;newplane < numplanes; ++newplane)
274 if(newplane != plane)
277 if((new_velocity *
planes[newplane]) < 0)
281 if(newplane == numplanes)
285 if(plane != numplanes)
308 if((this.
velocity * primal_velocity) <= 0)
327 this.velocity_z -= grav * 0.5f;
337 point.z += this.
mins.z + 1;
339 int nativecontents = pointcontents(point);
343 if(this.contentstransition)
344 this.contentstransition(this.
watertype, nativecontents);
370 int contents = pointcontents(ent.origin);
377 ent.watertype = contents;
382 else if(ent.watertype != contents)
385 if(ent.contentstransition)
386 ent.contentstransition(ent.watertype, contents);
391 ent.watertype = contents;
524 setorigin(
this, this.
origin);
582 for(
int j = 2; j <= offset; ++j)
599 #define X(v) if (_Movetype_TestEntityPosition(v))
600 X(
'0 0 -1')
X(
' 0 0 1')
601 X(
'-1 0 0')
X(
' 1 0 0')
602 X(
' 0 -1 0')
X(
' 0 1 0')
603 X(
'-1 -1 0')
X(
' 1 -1 0')
604 X(
'-1 1 0')
X(
' 1 1 0')
609 LOG_DEBUGF(
"Can't unstick an entity (edict: %d, classname: %s, origin: %s)",
614 LOG_DEBUGF(
"Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)",
641 vel -= ((vel * norm) * norm) * f;
643 if(vel.x > -0.1 && vel.x < 0.1) vel.x = 0;
644 if(vel.y > -0.1 && vel.y < 0.1) vel.y = 0;
645 if(vel.z > -0.1 && vel.z < 0.1) vel.z = 0;
695 return (this.
origin == last_origin);
744 LOG_DEBUG(
"Physics: Lacking QuakeC support for Push movetype, FIX ME by using engine physics!");
802 setorigin(
this, this.
origin);
808 this.move_time =
time;
814 setorigin(
this, this.
origin);
840 if(this.(s) != this.tic_saved_##s) \
841 this.tic_##s = this.(s)
872 this.move_time += n * tr;
877 for (
int j = 0; j < n; ++j)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
int Mod_Q1BSP_SuperContentsFromNativeContents(int nativecontents)
const float MOVE_NOMONSTERS
const float SOLID_SLIDEBOX
float trace_dphitcontents
const float SOLID_TRIGGER
float DPCONTENTS_LIQUIDSMASK
float trace_dpstartcontents
const float CONTENT_WATER
string trace_dphittexturename
float DPCONTENTS_PLAYERCLIP
float DPCONTENTS_MONSTERCLIP
float trace_dphitq3surfaceflags
const float CONTENT_EMPTY
vector trace_plane_normal
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
ERASEABLE bool IL_CONTAINS(IntrusiveList this, entity it)
#define FOREACH_ENTITY_RADIUS_ORDERED(org, dist, cond, body)
void _Movetype_CheckStuck(entity this)
entity _Movetype_TestEntityPosition_ent
void Movetype_Physics_MatchServer(entity this, bool sloppy)
int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepnormal, float stepheight)
bool _Movetype_CheckWater(entity this)
void _Movetype_LinkEdict(entity this, bool touch_triggers)
void _Movetype_PushEntityTrace(entity this, vector push)
bool _Movetype_TestEntityPosition(vector ofs)
void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy)
void _Movetype_Physics_ClientFrame(entity this, float movedt)
int _Movetype_ContentsMask(entity this)
vector planes[MAX_CLIP_PLANES]
vector tic_saved_avelocity
void set_movetype(entity this, int mt)
void _Movetype_Physics_Frame(entity this, float movedt)
vector _Movetype_ClipVelocity(vector vel, vector norm, float f)
bool autocvar__movetype_debug
bool _Movetype_PushEntity(entity this, vector push, bool dolink)
int _Movetype_UnstickEntity(entity this)
void Movetype_Physics_NoMatchTicrate(entity this, float movedt, bool isclient)
void _Movetype_LinkEdict_TouchAreaGrid(entity this)
void _Movetype_CheckWaterTransition(entity ent)
bool _Movetype_TestEntityPosition_Offset(int offset)
void Movetype_Physics_NoMatchServer(entity this)
void _Movetype_WallFriction(entity this, vector stepnormal)
bool _Movetype_NudgeOutOfSolid_PivotIsKnownGood(entity this, vector pivot)
void _Movetype_Impact(entity this, entity toucher)
vector tic_saved_velocity
#define GAMEPLAYFIX_NOGRAVITYONGROUND
const int WATERLEVEL_SWIMMING
const int WATERLEVEL_WETFEET
const int WATERLEVEL_SUBMERGED
#define GAMEPLAYFIX_UNSTICKPLAYERS(s)
const int MOVETYPE_FOLLOW
const int MAX_CLIP_PLANES
const int MOVETYPE_FAKEPUSH
const int WATERLEVEL_NONE
#define GAMEPLAYFIX_DELAYPROJECTILES(s)
#define GAMEPLAYFIX_WATERTRANSITION(s)
const int MOVETYPE_FLYMISSILE
#define GAMEPLAYFIX_EASIERWATERJUMP(s)
const int MOVETYPE_FLY_WORLDONLY
const int MOVETYPE_BOUNCEMISSILE
const int MOVETYPE_PHYSICS
const int MOVETYPE_NOCLIP
const int MOVETYPE_QCENTITY
#define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE
const int MOVETYPE_BOUNCE
void _Movetype_Physics_Follow(entity this)
void _Movetype_Physics_Push(entity this, float dt)
void _Movetype_Physics_Step(entity this, float dt)
void _Movetype_Physics_Toss(entity this, float dt)
ERASEABLE float boxesoverlap(vector m1, vector m2, vector m3, vector m4)
requires that m2>m1 in all coordinates, and that m4>m3
void _Movetype_Physics_Walk(entity this, float dt)
IntrusiveList g_moveables