Beispiel #1
0
/*
===================
SV_ClientThink

the move fields specify an intended velocity in pix/sec
the angle fields specify an exact angular motion in degrees
===================
*/
void SV_ClientThink (void)
{
	vec3_t		v_angle;

	if (sv_player->v.movetype == MOVETYPE_NONE)
		return;

	onground = (int)sv_player->v.flags & FL_ONGROUND;

	origin = sv_player->v.origin;
	velocity = sv_player->v.velocity;

	DropPunchAngle ();

//
// if dead, behave differently
//
	if (sv_player->v.health <= 0)
		return;

//
// angles
// show 1/3 the pitch angle and all the roll angle
	cmd = host_client->cmd;
	angles = sv_player->v.angles;

	VectorAdd (sv_player->v.v_angle, sv_player->v.punchangle, v_angle);
	angles[ROLL] = V_CalcRoll (sv_player->v.angles, sv_player->v.velocity)*4;
	if (!sv_player->v.fixangle)
	{
		angles[PITCH] = -v_angle[PITCH]/3;
		angles[YAW] = v_angle[YAW];
	}

	if ( (int)sv_player->v.flags & FL_WATERJUMP )
	{
		SV_WaterJump ();
		return;
	}
//
// walk
//
	if ( (sv_player->v.waterlevel >= 2)
	&& (sv_player->v.movetype != MOVETYPE_NOCLIP) )
	{
		SV_WaterMove ();
		return;
	}

	SV_AirMove ();
}
Beispiel #2
0
/*
===================
SV_ClientThink

the move fields specify an intended velocity in pix/sec
the angle fields specify an exact angular motion in degrees
===================
*/
static void
SV_ClientThink(client_t *client)
{
    edict_t *player = client->edict;
    vec3_t v_angle;

    if (player->v.movetype == MOVETYPE_NONE)
	return;

    DropPunchAngle(player->v.punchangle);

    /* if dead, behave differently */
    if (player->v.health <= 0)
	return;

    /* angles - show 1/3 the pitch angle and all the roll angle */
    VectorAdd(player->v.v_angle, player->v.punchangle, v_angle);
    player->v.angles[ROLL] = V_CalcRoll(player->v.angles, player->v.velocity) * 4;
    if (!player->v.fixangle) {
	player->v.angles[PITCH] = -v_angle[PITCH] / 3;
	player->v.angles[YAW] = v_angle[YAW];
    }

    if ((int)player->v.flags & FL_WATERJUMP) {
	SV_WaterJump(player);
	return;
    }

    /* walk */
    if (player->v.waterlevel >= 2 && player->v.movetype != MOVETYPE_NOCLIP) {
	SV_WaterMove(&client->cmd, player);
	return;
    }

    SV_AirMove(&client->cmd, player);
}
Beispiel #3
0
void SV_ClientThink (void)
{
	vec3_t		v_angle;
	int yeahdead;

	if (sv_player->v.movetype == MOVETYPE_NONE)
		return;

	if (cl.stats[STAT_HEALTH] <= 0) {	
		
			yeahdead = 1;
		
			if (!deathcam_yesiamdead){

				deathcam_angles[PITCH] = 50;
			//	deathcam_angles[YAW] = 20;
				deathcam_angles[ROLL] = 0;
				deathcam_whenidied = sv.time;
				//Con_Printf("I died at %f. sob.\n", deathcam_whenidied);
			}

			if (cl_diecam->value)
			deathcam_yesiamdead = cl_diecam->value;

	}
	else	
	{
			yeahdead = 0;
			deathcam_yesiamdead = 0;
	}

	onground = (int)sv_player->v.flags & FL_ONGROUND;

	origin = sv_player->v.origin;
	velocity = sv_player->v.velocity;


		

	DropPunchAngle ();


//
// if dead, behave differently
//

	// leilei - standstill hack
	if (sv_standstill->value)
	{
		float sample1, sample2, sample3, sample4, sample5;
		float divided;

		if (sv_maxspeed->value)
		divided = 1 / sv_maxspeed->value * sv_standstill->value;
		else
		divided = 1;	// avoiding a div0......

		sample1 = cmd.forwardmove * divided;
		sample2 = cmd.sidemove * divided;
		sample3 = cmd.upmove  * divided;
		sample4 = amouse_x * divided;
		sample5 = amouse_y * divided;
		
		if (sample1 < 0) sample1 *= -1;
		if (sample2 < 0) sample2 *= -1;
		if (sample3 < 0) sample3 *= -1;
		if (sample4 < 0) sample4 *= -1;
		if (sample5 < 0) sample5 *= -1;
		
		thestandstill = sample1 + sample2 + sample3 + sample4 + sample5 * 0.5;
		if (thestandstill > 1)
			thestandstill = 1;
		
		Cvar_SetValue (host_timescale,thestandstill); // slow it down!
	}


	if (sv_player->v.health <= 0)
		return;

//
// angles
// show 1/3 the pitch angle and all the roll angle
	cmd = host_client->cmd;


	angles = sv_player->v.angles;
	// leilei - aim lock
	if (aimlock){
		if ((lockedangle[YAW] + aimlockangle) > 360){
//			Con_Printf("goddamnit.\n");
			if (cl.viewangles[YAW] > (lockedangle[YAW] + aimlockangle > 360)) sv_player->v.angles[YAW] -= 360;
			if (cl.viewangles[YAW] > lockedangle[YAW] + aimlockangle) cl.viewangles[YAW] = lockedangle[YAW] + aimlockangle;
		}
		else
			if (cl.viewangles[YAW] > lockedangle[YAW] + aimlockangle) cl.viewangles[YAW] = lockedangle[YAW] + aimlockangle;
			if ((lockedangle[YAW] - aimlockangle) < 0){
			if (cl.viewangles[YAW] < lockedangle[YAW] - aimlockangle) cl.viewangles[YAW] = lockedangle[YAW] - aimlockangle + 360;
			if (cl.viewangles[YAW] < lockedangle[YAW] - aimlockangle) cl.viewangles[YAW] = lockedangle[YAW] - aimlockangle;
	//		Con_Printf("mother\n");
			}
			else
			if (cl.viewangles[YAW] < lockedangle[YAW] - aimlockangle) cl.viewangles[YAW] = lockedangle[YAW] - aimlockangle;

			// TODO: wrap angle, wrapangle
		if (cl.viewangles[PITCH] < lockedangle[PITCH] - aimlockangle) cl.viewangles[PITCH] = lockedangle[PITCH] - aimlockangle;
		if (cl.viewangles[PITCH] > lockedangle[PITCH] + aimlockangle) cl.viewangles[PITCH] = lockedangle[PITCH] + aimlockangle;
//		if (cl.viewangles[YAW] < lockedangle[YAW] - aimlockangle) cl.viewangles[YAW] = lockedangle[YAW] - aimlockangle;
//		if (cl.viewangles[YAW] > lockedangle[YAW] + aimlockangle) cl.viewangles[YAW] = lockedangle[YAW] + aimlockangle;
	

	}

	
	VectorAdd (sv_player->v.v_angle, sv_player->v.punchangle, v_angle);
	angles[ROLL] = V_CalcRoll (sv_player->v.angles, sv_player->v.velocity)*4;


	 if (!sv_player->v.fixangle)
	{
		angles[PITCH] = -v_angle[PITCH]/3;
		angles[YAW] = v_angle[YAW];

	}

	if ( (int)sv_player->v.flags & FL_WATERJUMP )
	{
		SV_WaterJump ();
		return;
	}
//
// walk
//
	if ( (sv_player->v.waterlevel >= 2)
	&& (sv_player->v.movetype != MOVETYPE_NOCLIP) )
	{
		SV_WaterMove ();
		return;
	}


	SV_AirMove ();
}