Esempio n. 1
0
/*
 * Can be called by either the server or the client
 */
void Pmove (pmove_t *pmove)
{
#if !defined(DEDICATED_ONLY) && defined(USE_OPENAL)
	static int underwater;
#endif

	pm = pmove;

	/* clear results */
	pm->numtouch = 0;
	VectorClear (pm->viewangles);
	pm->viewheight = 0;
	pm->groundentity = 0;
	pm->watertype = 0;
	pm->waterlevel = 0;

	/* clear all pmove local vars */
	memset (&pml, 0, sizeof(pml));

	/* convert origin and velocity to float values */
	pml.origin[0] = pm->s.origin[0]*0.125f;
	pml.origin[1] = pm->s.origin[1]*0.125f;
	pml.origin[2] = pm->s.origin[2]*0.125f;

	pml.velocity[0] = pm->s.velocity[0]*0.125f;
	pml.velocity[1] = pm->s.velocity[1]*0.125f;
	pml.velocity[2] = pm->s.velocity[2]*0.125f;

	/* save old org in case we get stuck */
	VectorCopy (pm->s.origin, pml.previous_origin);

	pml.frametime = pm->cmd.msec * 0.001f;

	PM_ClampAngles ();

	if (pm->s.pm_type == PM_SPECTATOR)
	{
		PM_FlyMove (false);
		PM_SnapPosition ();
		return;
	}

	if (pm->s.pm_type >= PM_DEAD)
	{
		pm->cmd.forwardmove = 0;
		pm->cmd.sidemove = 0;
		pm->cmd.upmove = 0;
	}

	if (pm->s.pm_type == PM_FREEZE)
		return;	/* no movement at all */

	/* set mins, maxs, and viewheight */
	PM_CheckDuck ();

	if (pm->snapinitial)
		PM_InitialSnapPosition ();

	/* set groundentity, watertype, and waterlevel */
	PM_CatagorizePosition ();

	if (pm->s.pm_type == PM_DEAD)
		PM_DeadMove ();

	PM_CheckSpecialMovement ();

	/* drop timing counter */
	if (pm->s.pm_time)
	{
		int		msec;

		msec = pm->cmd.msec >> 3;

		if (!msec)
			msec = 1;

		if ( msec >= pm->s.pm_time)
		{
			pm->s.pm_flags &= ~(PMF_TIME_WATERJUMP | PMF_TIME_LAND | PMF_TIME_TELEPORT);
			pm->s.pm_time = 0;
		}

		else
			pm->s.pm_time -= msec;
	}
Esempio n. 2
0
/*
================
Pmove

Can be called by either the server or the client
================
*/
void Pmove (pmove_t *pmove)
{
	pm = pmove;

	// clear results
	pm->numtouch = 0;
	VectorClear (pm->viewangles);
	pm->viewheight = 0;
	pm->groundentity = 0;
	pm->watertype = 0;
	pm->waterlevel = 0;

	// clear all pmove local vars
	memset (&pml, 0, sizeof(pml));

	// convert origin and velocity to float values
	pml.origin[0] = pm->s.origin[0]*0.125;
	pml.origin[1] = pm->s.origin[1]*0.125;
	pml.origin[2] = pm->s.origin[2]*0.125;

	pml.velocity[0] = pm->s.velocity[0]*0.125;
	pml.velocity[1] = pm->s.velocity[1]*0.125;
	pml.velocity[2] = pm->s.velocity[2]*0.125;

	// save old org in case we get stuck
	VectorCopy (pm->s.origin, pml.previous_origin);

	pml.frametime = pm->cmd.msec * 0.001;

	PM_ClampAngles ();

	if (pm->s.pm_type == PM_SPECTATOR)
	{
		PM_FlyMove (false);
		PM_SnapPosition ();
		return;
	}

	if (pm->s.pm_type >= PM_DEAD)
	{
		pm->cmd.forwardmove = 0;
		pm->cmd.sidemove = 0;
		pm->cmd.upmove = 0;
	}

	if (pm->s.pm_type == PM_FREEZE)
		return;		// no movement at all

	// set mins, maxs, and viewheight
	PM_CheckDuck ();

	if (pm->snapinitial)
		PM_InitialSnapPosition ();

	// set groundentity, watertype, and waterlevel
	PM_CatagorizePosition ();

	if (pm->s.pm_type == PM_DEAD)
		PM_DeadMove ();

	PM_CheckSpecialMovement ();

	// drop timing counter
	if (pm->s.pm_time)
	{
		int		msec;

		msec = pm->cmd.msec >> 3;
		if (!msec)
			msec = 1;
		if ( msec >= pm->s.pm_time) 
		{
//			pm->s.pm_flags &= ~(PMF_TIME_WATERJUMP | PMF_TIME_LAND | PMF_TIME_TELEPORT);
//			pm->s.pm_time = 0;
			
			byte_write(&pm->s.pm_time, 0);
			byte_write(&pm->s.pm_flags,
					pm->s.pm_flags & ~(PMF_TIME_WATERJUMP | PMF_TIME_LAND | PMF_TIME_TELEPORT));
		}
		else
			pm->s.pm_time -= msec;
	}