SQC-15_online #1
| @@ -10,14 +10,10 @@ | |||||||
|  |  | ||||||
| RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(Vector3f(0, 0, 0)){ | RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(Vector3f(0, 0, 0)){ | ||||||
|  |  | ||||||
| 	 |  | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo, const Vector3f& pos) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(pos) { | RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo, const Vector3f& pos) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(pos) { | ||||||
|  |  | ||||||
| 	 |  | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -98,11 +94,15 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
|  |  | ||||||
| 	Vector3f DiffCam = GetPosition() - camera.GetPosition(); | 	Vector3f DiffCam = GetPosition() - camera.GetPosition(); | ||||||
| 	Vector3f UpCam = Vector3f(0.f, 1.f, 0.f); | 	Vector3f UpCam = Vector3f(0.f, 1.f, 0.f); | ||||||
|  |  | ||||||
| 	Vector3f CrossA = DiffCam.Cross(UpCam); | 	Vector3f CrossA = DiffCam.Cross(UpCam); | ||||||
| 	Vector3f CrossB = DiffCam.Cross(CrossA); | 	Vector3f CrossB = DiffCam.Cross(CrossA); | ||||||
|  |  | ||||||
| 	CrossA.Normalize(); | 	CrossA.Normalize(); | ||||||
| 	CrossB.Normalize(); | 	CrossB.Normalize(); | ||||||
|  |  | ||||||
| 	Vector3f playerPosition = GetPosition() + Vector3f(0.f, -.75f, 0.f); | 	Vector3f playerPosition = GetPosition() + Vector3f(0.f, -.75f, 0.f); | ||||||
|  |  | ||||||
| 	Vector3f v2 = (playerPosition + CrossA * 0.5 * width + CrossB * 0.5 * height); | 	Vector3f v2 = (playerPosition + CrossA * 0.5 * width + CrossB * 0.5 * height); | ||||||
| 	Vector3f v1 = (playerPosition - CrossA * 0.5 * width + CrossB * 0.5 * height); | 	Vector3f v1 = (playerPosition - CrossA * 0.5 * width + CrossB * 0.5 * height); | ||||||
| 	Vector3f v3 = (playerPosition + CrossA * 0.5 * width - CrossB * 0.5 * height); | 	Vector3f v3 = (playerPosition + CrossA * 0.5 * width - CrossB * 0.5 * height); | ||||||
| @@ -110,6 +110,7 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
|  |  | ||||||
| 	Vector3f angleRemote = GetDirection(); | 	Vector3f angleRemote = GetDirection(); | ||||||
| 	Vector3f angleCam = (v1 - v2).Cross(v3 - v2); | 	Vector3f angleCam = (v1 - v2).Cross(v3 - v2); | ||||||
|  | 	 | ||||||
| 	angleCam.y = 0; | 	angleCam.y = 0; | ||||||
| 	angleRemote.y = 0; | 	angleRemote.y = 0; | ||||||
| 	angleCam.Normalize(); | 	angleCam.Normalize(); | ||||||
| @@ -122,6 +123,7 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
|  |  | ||||||
| 	static float time = 0.f; | 	static float time = 0.f; | ||||||
| 	static bool Shooting = false; | 	static bool Shooting = false; | ||||||
|  | 	bool isLeft = side.y > 0; | ||||||
|  |  | ||||||
| 	time += elapsedTime; | 	time += elapsedTime; | ||||||
| 	if (time >= 200) | 	if (time >= 200) | ||||||
| @@ -129,25 +131,21 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
| 			time -= 200; | 			time -= 200; | ||||||
| 		if (!current.states.shooting) | 		if (!current.states.shooting) | ||||||
| 			Shooting = false; | 			Shooting = false; | ||||||
| 		else { | 		else  | ||||||
| 			Shooting = !Shooting; | 			Shooting = !Shooting; | ||||||
| 		} |  | ||||||
| 	 |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
| 	bool isLeft = side.y > 0; |  | ||||||
| 	if (angle >= 0.75) //Face //side positif | 	if (angle >= 0.75) //Face - side positif | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
| 		 |  | ||||||
| 		if(current.states.shooting){ | 		if(current.states.shooting){ | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 17; | 				index = 17; | ||||||
| 			else | 			else | ||||||
| 				index = 9; | 				index = 9; | ||||||
| 		} | 		} | ||||||
| 		else if (current.states.jumpshot) { | 		else if (current.states.jumping && current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 41; | 				index = 41; | ||||||
| 			else | 			else | ||||||
| @@ -158,20 +156,16 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
| 		else if (current.states.running && current.states.still) | 		else if (current.states.running && current.states.still) | ||||||
| 			index = 0; | 			index = 0; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
| 	else if (angle >= 0.25 && isLeft) //Frontleft | 	else if (angle >= 0.25 && isLeft) //Frontleft | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
|  |  | ||||||
| 		if (current.states.shooting) { | 		if (current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 18; | 				index = 18; | ||||||
| 			else | 			else | ||||||
| 				index = 10; | 				index = 10; | ||||||
| 		} | 		} | ||||||
| 		else if (current.states.jumpshot) { | 		else if (current.states.jumping && current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 42; | 				index = 42; | ||||||
| 			else | 			else | ||||||
| @@ -185,15 +179,13 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
| 	} | 	} | ||||||
| 	else if (angle >= -0.25 && isLeft) //ProfileLeft | 	else if (angle >= -0.25 && isLeft) //ProfileLeft | ||||||
| 	{ | 	{ | ||||||
| 		 |  | ||||||
|  |  | ||||||
| 		if (current.states.shooting) { | 		if (current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 20; | 				index = 20; | ||||||
| 			else | 			else | ||||||
| 				index = 12; | 				index = 12; | ||||||
| 		} | 		} | ||||||
| 		else if (current.states.jumpshot) { | 		else if (current.states.jumping && current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 44; | 				index = 44; | ||||||
| 			else | 			else | ||||||
| @@ -207,15 +199,13 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
| 	} | 	} | ||||||
| 	else if (angle >= -0.75 && isLeft) //BackLeft | 	else if (angle >= -0.75 && isLeft) //BackLeft | ||||||
| 	{ | 	{ | ||||||
| 	 |  | ||||||
|  |  | ||||||
| 		if (current.states.shooting) { | 		if (current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 22; | 				index = 22; | ||||||
| 			else | 			else | ||||||
| 				index = 14; | 				index = 14; | ||||||
| 		} | 		} | ||||||
| 		else if (current.states.jumpshot) { | 		else if (current.states.jumping && current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 46; | 				index = 46; | ||||||
| 			else | 			else | ||||||
| @@ -226,17 +216,15 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
| 		else if (current.states.running && current.states.still) | 		else if (current.states.running && current.states.still) | ||||||
| 			index = 5; | 			index = 5; | ||||||
| 	} | 	} | ||||||
| 	else if (angle < -0.75) //Dos //side n<>gatif | 	else if (angle < -0.75) //Dos - side n<>gatif | ||||||
| 	{ | 	{ | ||||||
| 		 |  | ||||||
|  |  | ||||||
| 		if (current.states.shooting) { | 		if (current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 24; | 				index = 24; | ||||||
| 			else | 			else | ||||||
| 				index = 16; | 				index = 16; | ||||||
| 		} | 		} | ||||||
| 		else if (current.states.jumpshot) { | 		else if (current.states.jumping && current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 48; | 				index = 48; | ||||||
| 			else | 			else | ||||||
| @@ -250,15 +238,13 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
| 	} | 	} | ||||||
| 	else if (angle >= 0.25 && !isLeft) //FrontRight | 	else if (angle >= 0.25 && !isLeft) //FrontRight | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
|  |  | ||||||
| 		if (current.states.shooting) { | 		if (current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 19; | 				index = 19; | ||||||
| 			else | 			else | ||||||
| 				index = 11; | 				index = 11; | ||||||
| 		} | 		} | ||||||
| 		else if (current.states.jumpshot) { | 		else if (current.states.jumping && current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 43; | 				index = 43; | ||||||
| 			else | 			else | ||||||
| @@ -272,15 +258,13 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
| 	} | 	} | ||||||
| 	else if (angle >= -0.25 && !isLeft) //ProfileRight | 	else if (angle >= -0.25 && !isLeft) //ProfileRight | ||||||
| 	{ | 	{ | ||||||
| 	 |  | ||||||
|  |  | ||||||
| 		if (current.states.shooting) { | 		if (current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 21; | 				index = 21; | ||||||
| 			else | 			else | ||||||
| 				index = 13; | 				index = 13; | ||||||
| 		} | 		} | ||||||
| 		else if (current.states.jumpshot) { | 		else if (current.states.jumping && current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 45; | 				index = 45; | ||||||
| 			else | 			else | ||||||
| @@ -294,15 +278,13 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr | |||||||
| 	} | 	} | ||||||
| 	else if (angle >= -0.75 && !isLeft) //BackRight | 	else if (angle >= -0.75 && !isLeft) //BackRight | ||||||
| 	{ | 	{ | ||||||
| 	 |  | ||||||
|  |  | ||||||
| 		if (current.states.shooting) { | 		if (current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 23; | 				index = 23; | ||||||
| 			else | 			else | ||||||
| 				index = 15; | 				index = 15; | ||||||
| 		} | 		} | ||||||
| 		else if (current.states.jumpshot) { | 		else if (current.states.jumping && current.states.shooting) { | ||||||
| 			if (Shooting) | 			if (Shooting) | ||||||
| 				index = 47; | 				index = 47; | ||||||
| 			else | 			else | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user