From: Mario Date: Tue, 9 Dec 2014 12:52:13 +0000 (+1100) Subject: Bring it back (apparently, pmove_flags is not set by QC yet) X-Git-Tag: xonotic-v0.8.1~38^2~104 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=b6d2885b19170550f4ce151237065e3492e0afc8 Bring it back (apparently, pmove_flags is not set by QC yet) --- diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 095467186..6a55d6969 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -186,6 +186,81 @@ void CSQC_ClientMovement_Unstick() } } +void CSQC_ClientMovement_UpdateStatus() +{ + // make sure player is not stuck + CSQC_ClientMovement_Unstick(); + + // set crouched + if (PHYS_INPUT_BUTTONS(self) & 16) + { + // wants to crouch, this always works.. + if (!IS_DUCKED(self)) + SET_DUCKED(self); + } + else + { + // wants to stand, if currently crouching we need to check for a + // low ceiling first + if (IS_DUCKED(self)) + { + tracebox(self.origin, PL_MIN, PL_MAX, self.origin, MOVE_NORMAL, self); + if (!trace_startsolid) + UNSET_DUCKED(self); + } + } + if (IS_DUCKED(self)) + { + self.mins = PL_CROUCH_MIN; + self.maxs = PL_CROUCH_MAX; + } + else + { + self.mins = PL_MIN; + self.maxs = PL_MAX; + } + + // set onground + vector origin1 = self.origin + '0 0 1'; + vector origin2 = self.origin - '0 0 1'; + + tracebox(origin1, self.mins, self.maxs, origin2, MOVE_NORMAL, self); + if (trace_fraction < 1 && trace_plane_normal_z > 0.7) + { + SET_ONGROUND(self); + + // this code actually "predicts" an impact; so let's clip velocity first + float f = dotproduct(self.velocity, trace_plane_normal); + if (f < 0) // only if moving downwards actually + self.velocity -= f * trace_plane_normal; + } + else + UNSET_ONGROUND(self); + + // set watertype/waterlevel + origin1 = self.origin; + origin1_z += self.mins_z + 1; + self.waterlevel = WATERLEVEL_NONE; + // TODO: convert +// self.watertype = CL_TracePoint(origin1, MOVE_NOMONSTERS, s, 0, true, false, NULL, false).startsupercontents & SUPERCONTENTS_LIQUIDSMASK; +// if (self.watertype) +// { +// self.waterlevel = WATERLEVEL_WETFEET; +// origin1[2] = self.origin[2] + (self.mins[2] + self.maxs[2]) * 0.5f; +// if (CL_TracePoint(origin1, MOVE_NOMONSTERS, s, 0, true, false, NULL, false).startsupercontents & SUPERCONTENTS_LIQUIDSMASK) +// { +// self.waterlevel = WATERLEVEL_SWIMMING; +// origin1[2] = self.origin[2] + 22; +// if (CL_TracePoint(origin1, MOVE_NOMONSTERS, s, 0, true, false, NULL, false).startsupercontents & SUPERCONTENTS_LIQUIDSMASK) +// self.waterlevel = WATERLEVEL_SUBMERGED; +// } +// } +// +// // water jump prediction +// if (IS_ONGROUND(self) || self.velocity_z <= 0 || pmove_waterjumptime <= 0) +// pmove_waterjumptime = 0; +} + void CSQC_ClientMovement_Move() { float t = PHYS_INPUT_TIMELENGTH;