Oh là là.

This commit is contained in:
MarcEricMartel 2023-12-07 12:10:47 -05:00
parent 18f08feb68
commit 76256115d1
4 changed files with 31 additions and 37 deletions

View File

@ -48,7 +48,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>ClangCL</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

View File

@ -48,7 +48,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>ClangCL</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

View File

@ -91,7 +91,7 @@
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>ClangCL</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">

View File

@ -659,17 +659,7 @@ void Engine::PrintText(float x, float y, const std::string& t, float charSizeMul
int Engine::GetFps(float elapsedTime) const { return 1 / elapsedTime; } int Engine::GetFps(float elapsedTime) const { return 1 / elapsedTime; }
int Engine::GetCountdown(float elapsedTime) { int Engine::GetCountdown(float elapsedTime) {
//if (m_resetcountdown) { return m_countdown;
// m_nbReductionChunk = 4;
// m_timerReductionChunk = 30;
// m_countdown = m_time + COUNTDOWN;
// m_resetcountdown = false;
// }
// if (m_countdown < m_time) {}
// Stop();
//if (!m_stopcountdown)
m_time += elapsedTime;
return m_countdown;// -(int)m_time;
} }
int Engine::GetOptionsChoice() { int Engine::GetOptionsChoice() {
@ -1216,16 +1206,13 @@ void Engine::Render(float elapsedTime) {
HideCursor(); HideCursor();
CenterMouse(); //D<>placement de centermouse dans l'action de jouer CenterMouse(); //D<>placement de centermouse dans l'action de jouer
//static float gameTime = elapsedTime;
static irrklang::ISound* step; // Pour les sons de pas. static irrklang::ISound* step; // Pour les sons de pas.
static float pollTime = 0; static float pollTime = 0;
static float bulletTime = 0; static float bulletTime = 0;
static float gameTime = 0;
static BlockType bloc = 1; static BlockType bloc = 1;
if (elapsedTime > 0.1f) return; if (elapsedTime > 0.1f) return;
//gameTime += elapsedTime;
pollTime += elapsedTime; pollTime += elapsedTime;
Transformation all; Transformation all;
@ -1269,13 +1256,6 @@ void Engine::Render(float elapsedTime) {
m_player.ApplyTransformation(remotePlayer, true, false); m_player.ApplyTransformation(remotePlayer, true, false);
//if (m_key1) bloc++;
//else if (m_key2) bloc--;
//if (m_mouseWU) bloc++;
//else if (m_mouseWD) bloc--;
//if (bloc == BTYPE_LAST + 1) bloc = BTYPE_AIR + 1;
//else if (bloc == BTYPE_AIR) bloc = BTYPE_LAST; // La selection de BTYPE_LAST <20>quipe l'arme.
m_mouseWU = m_mouseWD = m_key1 = m_key2 = false; m_mouseWU = m_mouseWD = m_key1 = m_key2 = false;
netprot::ChunkMod* cmod = nullptr; netprot::ChunkMod* cmod = nullptr;
if (m_mouseL) { if (m_mouseL) {
@ -1324,8 +1304,6 @@ void Engine::Render(float elapsedTime) {
} }
} }
gameTime += elapsedTime * 10;
m_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo); m_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo);
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo); m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas); m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas);
@ -1336,11 +1314,20 @@ void Engine::Render(float elapsedTime) {
if (m_damage) { if (m_damage) {
InstantDamage(); InstantDamage();
} }
static bool fell = false; static bool died = false;
if (m_player.GetPosition().y < 1.7f && !fell) { if ((m_player.GetPosition().y < 1.7f || m_player.AmIDead()) && !died) {
m_audio.Create3DAudioObj(m_scream, AUDIO_PATH "scream.wav", m_player.GetPOV(), m_player.GetVelocity(), false, 1.f); m_audio.Create3DAudioObj(m_scream, AUDIO_PATH "scream.wav", m_player.GetPOV(), m_player.GetVelocity(), false, 1.f);
fell = true; died = true;
} }
if (m_player.GetPosition().y < 15.f || died) {
died = false;
std::string user = m_player.m_username.append(" (Dead)");
m_player = Player(Vector3f(.5, CHUNK_SIZE_Y + 1.7f, .5), 0, 0);
m_player.m_username = user;
}
m_time += elapsedTime;
if (m_networkgame) { // Pour se gerer le paquet. if (m_networkgame) { // Pour se gerer le paquet.
static bool has_synced = false; static bool has_synced = false;
@ -1419,8 +1406,7 @@ void Engine::Render(float elapsedTime) {
if (m_syncs.count(sync.timestamp)) { if (m_syncs.count(sync.timestamp)) {
Sync comp = m_syncs[sync.timestamp]; Sync comp = m_syncs[sync.timestamp];
//std::cout << "HP: " << sync.hp << std::endl; m_player.InflictDamage(sync.hp - comp.hp);
//m_player.InflictDamage(sync.hp - comp.hp);
Vector3f diff = sync.position - comp.position; Vector3f diff = sync.position - comp.position;
@ -1436,7 +1422,6 @@ void Engine::Render(float elapsedTime) {
m_syncs.erase(sync.timestamp); m_syncs.erase(sync.timestamp);
} }
//else SystemNotification("sync be no good.");
} }
break; break;
case OUTPUT: case OUTPUT:
@ -1497,10 +1482,19 @@ void Engine::Render(float elapsedTime) {
RemotePlayer* rt = static_cast<RemotePlayer*>(player); RemotePlayer* rt = static_cast<RemotePlayer*>(player);
glClear(GL_STENCIL_BUFFER_BIT); glClear(GL_STENCIL_BUFFER_BIT);
rt->Render(m_animeAtlas, m_shader01, all, elapsedTime, m_player); rt->Render(m_animeAtlas, m_shader01, all, elapsedTime, m_player);
m_otherplayerpos = player->GetPosition(); // Aller chercher GetPosition des deux façon, voir si ça chie.
} }
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
} }
else {
if (m_resetcountdown) {
m_nbReductionChunk = 4;
m_timerReductionChunk = 30;
m_countdown = m_time + COUNTDOWN;
m_resetcountdown = false;
}
if (!m_stopcountdown)
m_countdown -= (int)m_time;
}
DrawHud(elapsedTime, bloc); DrawHud(elapsedTime, bloc);
DisplayPovGun(); DisplayPovGun();