diff --git a/.gitignore b/.gitignore index f0c1c5a..1e812db 100644 --- a/.gitignore +++ b/.gitignore @@ -373,3 +373,5 @@ FodyWeavers.xsd /x64/Release/SQCSim2023.exe /x64/Debug/SQCSim2023.exe /x64/Debug/SQCSim2021.pdb +SQCSim2021/SQCSim2021.vcxproj.filters +SQCSim2021/SQCSim2021.vcxproj diff --git a/SQCSim-common/netprotocol.h b/SQCSim-common/netprotocol.h index d7c7a93..f7692b4 100644 --- a/SQCSim-common/netprotocol.h +++ b/SQCSim-common/netprotocol.h @@ -33,7 +33,11 @@ namespace netprot { bool jumping, shooting, hit, - powerup; + powerup, + dead, + still, + jumpshot, + running; }; struct Input { // cli -> srv UDP ~frame diff --git a/SQCSim2021/SQCSim2021.vcxproj b/SQCSim2021/SQCSim2021.vcxproj index eadb743..04701c8 100644 --- a/SQCSim2021/SQCSim2021.vcxproj +++ b/SQCSim2021/SQCSim2021.vcxproj @@ -41,6 +41,7 @@ + diff --git a/SQCSim2021/SQCSim2021.vcxproj.filters b/SQCSim2021/SQCSim2021.vcxproj.filters index b5d2499..5c8a864 100644 --- a/SQCSim2021/SQCSim2021.vcxproj.filters +++ b/SQCSim2021/SQCSim2021.vcxproj.filters @@ -94,5 +94,8 @@ Fichiers sources + + Fichiers sources + \ No newline at end of file diff --git a/SQCSim2021/remoteplayer.cpp b/SQCSim2021/remoteplayer.cpp new file mode 100644 index 0000000..6dfb3a4 --- /dev/null +++ b/SQCSim2021/remoteplayer.cpp @@ -0,0 +1,65 @@ +#include "remoteplayer.h" +#include +#include + + +RemotePlayer::RemotePlayer() : Player(Vector3f(0, 0, 0), 0, 0), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), next() { + +} + +void RemotePlayer::Init() { + +} + +void RemotePlayer::Feed(const netprot::Output out) { + + next.position = out.position; + next.direction = out.direction; + next.states = out.states; + next.id = out.id; + + //a revoir pour le jump et le shoot en meme temps lorsque les test seront possible + + if (current.position != next.position) + { + Vector3f positionDelta = next.position - current.position; + m_position = next.position + positionDelta; + m_direction = next.direction; + m_team_id = next.id; + + } + + if(next.direction != current.direction) + { + m_direction = next.direction; + current.direction = next.direction; + } + + if (next.states.shooting) { + m_animstate = Anim::SHOOTING; + } + else if (next.states.jumping) { + m_animstate = Anim::JUMPING; + } + else if (next.states.dead) { + m_animstate = Anim::DEAD; + } + else if(next.states.jumpshot){ + m_animstate = Anim::JUMPSHOOT; + } + else if (next.states.still) { + m_animstate = Anim::STILL; + } + else if (next.states.running) { + m_animstate = Anim::RUNNING; + } + + + current.direction = next.direction; + current.position = next.position; + current.states = next.states; + current.id = next.id; + + + +} \ No newline at end of file