This commit is contained in:
Claudel-D-Roy 2023-12-13 16:10:21 -05:00
parent 136f589975
commit 5a3ce00cb2

View File

@ -8,7 +8,7 @@
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)) {
}
@ -24,7 +24,7 @@ RemotePlayer::~RemotePlayer()
void RemotePlayer::Init()
{
}
void RemotePlayer::Feed(const netprot::Output out) {
@ -108,7 +108,7 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
Vector3f angleRemote = GetDirection();
Vector3f angleCam = (v1 - v2).Cross(v3 - v2);
angleCam.y = 0;
angleRemote.y = 0;
angleCam.Normalize();
@ -127,21 +127,16 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
time += elapsedTime;
if (time >= 0.05)
{
time -= 0.05;
time -= 0.05;
Shooting = !Shooting;
/*if (!current.states.shooting)
Shooting = false;
else
Shooting = true;*/
Shooting = !Shooting;
}
std::cout << Shooting << std::endl;
//std::cout << time << std::endl;
//std::cout << "shooting : " << current.states.shooting << " jumping : " << current.states.jumping << " jumpshot : " << current.states.jumpshot << " running : " << current.states.running << " still : " << current.states.still << " dead : " << current.states.dead << " hit : " << current.states.hit << std::endl;
std::cout << "shooting : " << current.states.shooting << " jumping : " << current.states.jumping << " jumpshot : " << current.states.jumpshot << " running : " << current.states.running << " still : " << current.states.still << " dead : " << current.states.dead << " hit : " << current.states.hit << std::endl;
if (angle >= 0.75) //Face - side positif
{
if(current.states.shooting){
if (current.states.shooting) {
if (Shooting)
index = 17;
else
@ -174,12 +169,12 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
else
index = 34;
}
else if (current.states.jumping )
else if (current.states.jumping)
index = 26;
else if (!current.states.jumping && !current.states.shooting && !current.states.jumpshot)
index = 1;
}
else if (angle >= -0.25 && isLeft) //ProfileLeft
{
@ -190,18 +185,18 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
index = 12;
}
else if (current.states.jumpshot ) {
else if (current.states.jumpshot) {
if (Shooting)
index = 44;
else
index = 36;
}
else if (current.states.jumping )
else if (current.states.jumping)
index = 28;
else if (!current.states.jumping && !current.states.shooting && !current.states.jumpshot)
index = 3;
}
else if (angle >= -0.75 && isLeft) //BackLeft
{
@ -240,12 +235,12 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
else
index = 40;
}
else if (current.states.jumping )
else if (current.states.jumping)
index = 32;
else if (!current.states.jumping && !current.states.shooting && !current.states.jumpshot)
index = 7;
}
else if (angle >= 0.25 && !isLeft) //FrontRight //REVOIR L'ANIME DE SHOOTING EST PAS DRETTE
{
@ -311,7 +306,7 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
}
float u, v, w, h;
@ -321,9 +316,23 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
atlas.TextureIndexToCoord(index, u, v, w, h);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (current.states.hit)
{
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
glBlendColor(1.f, 0.f, 0.f, 1.f);
}
else {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
glBlendEquation(GL_FUNC_ADD);
glLoadMatrixf(tran.GetMatrix().GetInternalValues());
glBegin(GL_QUADS);
glTexCoord2f(u, v); glVertex3f(v1.x, v1.y, v1.z);