Ejemplo n.º 1
0
CameraInformation rearViewMirrorOverlay()
{
	CameraInformation info;

	auto pos = utils::GetPlayerEyePosition();
	auto angles = utils::GetPlayerEyeAngles();

	info.x = pos.x;
	info.y = pos.y;
	info.z = pos.z;
	info.pitch = angles[PITCH];
	info.yaw = NormalizeDeg(angles[YAW] + 180);
	return info;
}
Ejemplo n.º 2
0
CameraInformation agOverlay()
{
	CameraInformation info;
	Vector pos;
	QAngle va;

	calculateAGPosition(pos, va);
	info.x = pos.x;
	info.y = pos.y;
	info.z = pos.z;
	info.pitch = va[PITCH];
	info.yaw = NormalizeDeg(va[YAW]);

	return info;
}
Ejemplo n.º 3
0
bool Strafe(PlayerData& player, const MovementVars& vars, bool onground, bool jumped, bool ducking, StrafeType type, StrafeDir dir, double target_yaw, double vel_yaw, ProcessedFrame& out, bool reduceWishspeed, const StrafeButtons& strafeButtons, bool useGivenButtons)
{
	//DevMsg("[Strafing] ducking = %d\n", (int)ducking);
	if (jumped && player.Velocity.Length2D() >= vars.Maxspeed * ((ducking || (vars.Maxspeed == 320)) ? 0.1 : 0.5)) {
		out.Yaw = NormalizeDeg(tas_strafe_yaw.GetFloat() + 180);
		out.Forward = false;
		out.Back = false;
		out.Right = false;
		out.Left = false;

		//Vector vecForward;
		//AngleVectors(QAngle(0, out.Yaw, 0), &vecForward);
		//vecForward.z = 0;
		//VectorNormalize(vecForward);

		//// We give a certain percentage of the current forward movement as a bonus to the jump speed.  That bonus is clipped
		//// to not accumulate over time.
		//float flSpeedBoostPerc = ((vars.Maxspeed != 320) && !ducking) ? 0.5f : 0.1f;
		//float flSpeedAddition = fabs(0 * flSpeedBoostPerc);
		//float flMaxSpeed = vars.Maxspeed + (vars.Maxspeed * flSpeedBoostPerc);
		//float flNewSpeed = (flSpeedAddition + player.Velocity.Length2D());

		//// If we're over the maximum, we want to only boost as much as will get us to the goal speed
		//if (flNewSpeed > flMaxSpeed)
		//{
		//	flSpeedAddition -= flNewSpeed - flMaxSpeed;
		//}

		//if (0 < 0.0f)
		//	flSpeedAddition *= -1.0f;

		//// Add it on
		//VectorAdd((vecForward*flSpeedAddition), player.Velocity, player.Velocity);

		return onground;
	}

	double wishspeed = vars.Maxspeed;
	if (reduceWishspeed)
		wishspeed *= 0.33333333f;

	Button usedButton;
	bool strafed;
	//if (frame.Strafe) {
		strafed = true;

		switch (dir) {
		//case StrafeDir::LEFT:
		//	if (type == StrafeType::MAXACCEL)
		//		out.Yaw = static_cast<float>(SideStrafeMaxAccel(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, false) * M_RAD2DEG);
		//	else if (type == StrafeType::MAXANGLE)
		//		out.Yaw = static_cast<float>(SideStrafeMaxAngle(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, false) * M_RAD2DEG);
		//	//else if (type == StrafeType::CONSTSPEED)
		//	//	out.Yaw = static_cast<float>(SideStrafeConstSpeed(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, false) * M_RAD2DEG);
		//	//else if (type == StrafeType::MAXDECCEL) {
		//	//	auto yaw = static_cast<float>(SideStrafeMaxDeccel(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, false, strafed) * M_RAD2DEG);
		//	//	if (strafed)
		//	//		out.Yaw = yaw;
		//	//}
		//	break;

		//case StrafeDir::RIGHT:
		//	if (type == StrafeType::MAXACCEL)
		//		out.Yaw = static_cast<float>(SideStrafeMaxAccel(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, true) * M_RAD2DEG);
		//	else if (type == StrafeType::MAXANGLE)
		//		out.Yaw = static_cast<float>(SideStrafeMaxAngle(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, true) * M_RAD2DEG);
		//	//else if (type == StrafeType::CONSTSPEED)
		//	//	out.Yaw = static_cast<float>(SideStrafeConstSpeed(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, true) * M_RAD2DEG);
		//	//else if (type == StrafeType::MAXDECCEL) {
		//	//	auto yaw = static_cast<float>(SideStrafeMaxDeccel(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, true, strafed) * M_RAD2DEG);
		//	//	if (strafed)
		//	//		out.Yaw = yaw;
		//	//}
		//	break;

		//case StrafeDir::BEST:
		//	if (type == StrafeType::MAXACCEL)
		//		out.Yaw = static_cast<float>(BestStrafeMaxAccel(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD) * M_RAD2DEG);
		//	else if (type == StrafeType::MAXANGLE)
		//		out.Yaw = static_cast<float>(BestStrafeMaxAngle(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD) * M_RAD2DEG);
		//	else if (type == StrafeType::CONSTSPEED)
		//		out.Yaw = static_cast<float>(BestStrafeConstSpeed(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD) * M_RAD2DEG);
		//	else if (type == StrafeType::MAXDECCEL) {
		//		auto yaw = static_cast<float>(BestStrafeMaxDeccel(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, strafed) * M_RAD2DEG);
		//		if (strafed)
		//			out.Yaw = yaw;
		//	}
		//	break;

		case StrafeDir::YAW:
			if (type == StrafeType::MAXACCEL)
				out.Yaw = static_cast<float>(YawStrafeMaxAccel(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, target_yaw * M_DEG2RAD) * M_RAD2DEG);
			else if (type == StrafeType::MAXANGLE)
				out.Yaw = static_cast<float>(YawStrafeMaxAngle(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, target_yaw * M_DEG2RAD) * M_RAD2DEG);
			//else if (type == StrafeType::CONSTSPEED)
			//	out.Yaw = static_cast<float>(YawStrafeConstSpeed(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, target_yaw * M_DEG2RAD) * M_RAD2DEG);
			//else if (type == StrafeType::MAXDECCEL) {
			//	auto yaw = static_cast<float>(YawStrafeMaxDeccel(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, target_yaw * M_DEG2RAD, strafed) * M_RAD2DEG);
			//	if (strafed)
			//		out.Yaw = yaw;
			//}
			break;

		//case StrafeDir::POINT:
		//{
		//	double point[] = { frame.GetX(), frame.GetY() };
		//	auto yaw = static_cast<float>(PointStrafe(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, type, point, strafed) * M_RAD2DEG);
		//	if (strafed)
		//		out.Yaw = yaw;
		//}
		//break;

		default:
			strafed = false;
			break;
		}
	//}

	//std::ostringstream o;
	//o << std::setprecision(8) << std::fixed << "[Strafing] wishspeed = " << wishspeed << "; speed = " << player.Velocity.Length2D();

	//out.Yaw = static_cast<float>(YawStrafeMaxAccel(player, vars, onground, wishspeed, strafeButtons, useGivenButtons, usedButton, vel_yaw * M_DEG2RAD, target_yaw * M_DEG2RAD) * M_RAD2DEG);

	if (strafed) {
		out.Forward = (usedButton == Button::FORWARD || usedButton == Button::FORWARD_LEFT || usedButton == Button::FORWARD_RIGHT);
		out.Back = (usedButton == Button::BACK || usedButton == Button::BACK_LEFT || usedButton == Button::BACK_RIGHT);
		out.Right = (usedButton == Button::RIGHT || usedButton == Button::FORWARD_RIGHT || usedButton == Button::BACK_RIGHT);
		out.Left = (usedButton == Button::LEFT || usedButton == Button::FORWARD_LEFT || usedButton == Button::BACK_LEFT);
	}

	//o << "; resulting yaw = " << out.Yaw << "; predicted speed = " << player.Velocity.Length2D() << "\n";
	//DevMsg("%s", o.str().c_str());

	return onground;
}