Début de la classe remoteplayer.cpp, à vérifier
This commit is contained in:
parent
183c5f186a
commit
d7e55c8446
2
.gitignore
vendored
2
.gitignore
vendored
@ -373,3 +373,5 @@ FodyWeavers.xsd
|
|||||||
/x64/Release/SQCSim2023.exe
|
/x64/Release/SQCSim2023.exe
|
||||||
/x64/Debug/SQCSim2023.exe
|
/x64/Debug/SQCSim2023.exe
|
||||||
/x64/Debug/SQCSim2021.pdb
|
/x64/Debug/SQCSim2021.pdb
|
||||||
|
SQCSim2021/SQCSim2021.vcxproj.filters
|
||||||
|
SQCSim2021/SQCSim2021.vcxproj
|
||||||
|
@ -33,7 +33,11 @@ namespace netprot {
|
|||||||
bool jumping,
|
bool jumping,
|
||||||
shooting,
|
shooting,
|
||||||
hit,
|
hit,
|
||||||
powerup;
|
powerup,
|
||||||
|
dead,
|
||||||
|
still,
|
||||||
|
jumpshot,
|
||||||
|
running;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Input { // cli -> srv UDP ~frame
|
struct Input { // cli -> srv UDP ~frame
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
<ClCompile Include="mesh.cpp" />
|
<ClCompile Include="mesh.cpp" />
|
||||||
<ClCompile Include="openglcontext.cpp" />
|
<ClCompile Include="openglcontext.cpp" />
|
||||||
|
<ClCompile Include="remoteplayer.cpp" />
|
||||||
<ClCompile Include="shader.cpp" />
|
<ClCompile Include="shader.cpp" />
|
||||||
<ClCompile Include="skybox.cpp" />
|
<ClCompile Include="skybox.cpp" />
|
||||||
<ClCompile Include="texture.cpp" />
|
<ClCompile Include="texture.cpp" />
|
||||||
|
@ -94,5 +94,8 @@
|
|||||||
<ClCompile Include="renderer.cpp">
|
<ClCompile Include="renderer.cpp">
|
||||||
<Filter>Fichiers sources</Filter>
|
<Filter>Fichiers sources</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="remoteplayer.cpp">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
65
SQCSim2021/remoteplayer.cpp
Normal file
65
SQCSim2021/remoteplayer.cpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#include "remoteplayer.h"
|
||||||
|
#include <iostream>
|
||||||
|
#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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user