Merge branch 'SQC-15_online' of https://github.com/CegepSTH/SQCSim2023 into SQC-15_online

This commit is contained in:
MarcEricMartel 2023-12-13 16:10:34 -05:00
commit 7b350fa403

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)) {
}
@ -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,7 +169,7 @@ 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;
@ -190,13 +185,13 @@ 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;
@ -240,7 +235,7 @@ 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;
@ -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);