SQC-15_online #1
| @@ -3,7 +3,7 @@ | |||||||
| #include <cstring> | #include <cstring> | ||||||
|  |  | ||||||
|  |  | ||||||
| RemotePlayer::RemotePlayer() : Player(Vector3f(0, 0, 0), 0, 0), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), next() { | RemotePlayer::RemotePlayer() : Player(Vector3f(0, 0, 0), 0, 0), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous() { | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -13,52 +13,58 @@ void RemotePlayer::Init() { | |||||||
|  |  | ||||||
| void RemotePlayer::Feed(const netprot::Output out) { | void RemotePlayer::Feed(const netprot::Output out) { | ||||||
|  |  | ||||||
| 	next.position = out.position; | 	current.position = out.position; | ||||||
| 	next.direction = out.direction; | 	current.direction = out.direction; | ||||||
| 	next.states = out.states; | 	current.states = out.states; | ||||||
| 	next.id = out.id; | 	current.id = out.id; | ||||||
|  |  | ||||||
| 	//a revoir pour le jump et le shoot en meme temps lorsque les test seront possible	 | 	//a revoir pour le jump et le shoot en meme temps lorsque les test seront possible	 | ||||||
|  |  | ||||||
| 	if (current.position != next.position) | 	if (current.position != previous.position) | ||||||
| 	{ | 	{ | ||||||
| 		Vector3f positionDelta = next.position - current.position; | 		Vector3f positionDelta = current.position - previous.position; | ||||||
| 		m_position = next.position + positionDelta; | 		m_position = current.position + positionDelta; | ||||||
| 		m_direction = next.direction; | 		m_direction = current.direction; | ||||||
| 		m_team_id = next.id; | 		m_team_id = current.id; | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if(next.direction != current.direction) | 	if(current.direction != previous.direction) | ||||||
| 	{ | 	{ | ||||||
| 		m_direction = next.direction; | 		m_direction = current.direction; | ||||||
| 		current.direction = next.direction; | 		current.direction = current.direction; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (next.states.shooting) { | 	if (current.states.shooting) { | ||||||
|  | 		true; | ||||||
| 		m_animstate = Anim::SHOOTING; | 		m_animstate = Anim::SHOOTING; | ||||||
| 	} | 	} | ||||||
| 	else if (next.states.jumping) { | 	else if (current.states.jumping) { | ||||||
|  | 		true; | ||||||
| 		m_animstate = Anim::JUMPING; | 		m_animstate = Anim::JUMPING; | ||||||
| 	} | 	} | ||||||
| 	else if (next.states.dead) { | 	else if (current.states.dead) { | ||||||
|  | 		true; | ||||||
| 		m_animstate = Anim::DEAD; | 		m_animstate = Anim::DEAD; | ||||||
| 	} | 	} | ||||||
| 	else if(next.states.jumpshot){ | 	else if(current.states.powerup){ | ||||||
| 		m_animstate = Anim::JUMPSHOOT; | 		true; | ||||||
|  | 		m_animstate = Anim::POWERUP; | ||||||
| 	} | 	} | ||||||
| 	else if (next.states.still) { | 	else if (current.states.still) { | ||||||
|  | 		true; | ||||||
| 		m_animstate = Anim::STILL; | 		m_animstate = Anim::STILL; | ||||||
| 	} | 	} | ||||||
| 	else if (next.states.running) { | 	else if (current.states.running) { | ||||||
|  | 		true; | ||||||
| 		m_animstate = Anim::RUNNING; | 		m_animstate = Anim::RUNNING; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	 | 	 | ||||||
| 	current.direction = next.direction; | 	previous.direction = current.direction; | ||||||
| 	current.position = next.position; | 	previous.position = current.position; | ||||||
| 	current.states = next.states; | 	previous.states = current.states; | ||||||
| 	current.id = next.id; | 	previous.id = current.id; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
|  |  | ||||||
| class RemotePlayer : public Player { | class RemotePlayer : public Player { | ||||||
| public: | public: | ||||||
| 	enum Anim { STILL, RUNNING, JUMPING, SHOOTING, JUMPSHOOT, DEAD }; | 	enum Anim { STILL = 1, RUNNING = 2, JUMPING = 4, SHOOTING = 8, POWERUP = 16,  DEAD = 32 }; | ||||||
|  |  | ||||||
| 	RemotePlayer(); | 	RemotePlayer(); | ||||||
|  |  | ||||||
| @@ -16,7 +16,7 @@ public: | |||||||
| 	void Feed(const netprot::Output out); | 	void Feed(const netprot::Output out); | ||||||
|  |  | ||||||
| private: | private: | ||||||
| 	netprot::Output current, next; | 	netprot::Output current, previous; | ||||||
| 	float m_aminacc; | 	float m_aminacc; | ||||||
| 	Anim m_animstate; | 	Anim m_animstate; | ||||||
| 	uint64_t m_team_id; | 	uint64_t m_team_id; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user