diff --git a/SQCSim-common/SQCSim-common.vcxproj b/SQCSim-common/SQCSim-common.vcxproj index 4ba7bd4..c618082 100644 --- a/SQCSim-common/SQCSim-common.vcxproj +++ b/SQCSim-common/SQCSim-common.vcxproj @@ -48,7 +48,7 @@ StaticLibrary false - v143 + ClangCL true Unicode diff --git a/SQCSim-srv/SQCSim-srv.vcxproj b/SQCSim-srv/SQCSim-srv.vcxproj index d080276..b0dcd9c 100644 --- a/SQCSim-srv/SQCSim-srv.vcxproj +++ b/SQCSim-srv/SQCSim-srv.vcxproj @@ -48,7 +48,7 @@ Application false - v143 + ClangCL true Unicode diff --git a/SQCSim2021/SQCSim2021.vcxproj b/SQCSim2021/SQCSim2021.vcxproj index 31e1b8b..cda35f7 100644 --- a/SQCSim2021/SQCSim2021.vcxproj +++ b/SQCSim2021/SQCSim2021.vcxproj @@ -91,7 +91,7 @@ false true Unicode - v143 + ClangCL diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 03bbdd2..116f9b1 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -238,7 +238,7 @@ void Engine::LoadResource() { TextureAtlas::TextureIndex JumpQuarterBackLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackLeftJumpLeftShootingLeft.png"); ////38 TextureAtlas::TextureIndex JumpQuarterBackRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackRightJumpRightShootingRight.png"); ////39 TextureAtlas::TextureIndex JumpBackShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackJumpRightShootingRight.png"); ////40 - + //SHOOTINGJUMP TIRER TextureAtlas::TextureIndex JumpFrontShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueFrontJumpRightShootingRightShoot1.png"); ////41 @@ -249,9 +249,9 @@ void Engine::LoadResource() { TextureAtlas::TextureIndex JumpQuarterBackLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackLeftJumpLeftShootingLeftShoot1.png"); ////46 TextureAtlas::TextureIndex JumpQuarterBackRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackRightJumpRightShootingRightShoot1.png"); ////47 TextureAtlas::TextureIndex JumpBackShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackJumpRightShootingRightShoot1.png"); ////48 - - - + + + if (!m_animeAtlas.Generate(TEXTURE_SIZE, false)) { std::cout << " Unable to generate texture atlas ..." << std::endl; abort(); @@ -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::GetCountdown(float elapsedTime) { - //if (m_resetcountdown) { -// 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; + return m_countdown; } int Engine::GetOptionsChoice() { @@ -1216,16 +1206,13 @@ void Engine::Render(float elapsedTime) { HideCursor(); CenterMouse(); //D�placement de centermouse dans l'action de jouer - //static float gameTime = elapsedTime; static irrklang::ISound* step; // Pour les sons de pas. static float pollTime = 0; static float bulletTime = 0; - static float gameTime = 0; static BlockType bloc = 1; if (elapsedTime > 0.1f) return; - //gameTime += elapsedTime; pollTime += elapsedTime; Transformation all; @@ -1269,13 +1256,6 @@ void Engine::Render(float elapsedTime) { 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 �quipe l'arme. m_mouseWU = m_mouseWD = m_key1 = m_key2 = false; netprot::ChunkMod* cmod = nullptr; 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_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); @@ -1336,11 +1314,20 @@ void Engine::Render(float elapsedTime) { if (m_damage) { InstantDamage(); } - static bool fell = false; - if (m_player.GetPosition().y < 1.7f && !fell) { + static bool died = false; + 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); - 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. static bool has_synced = false; @@ -1419,8 +1406,7 @@ void Engine::Render(float elapsedTime) { if (m_syncs.count(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; @@ -1436,7 +1422,6 @@ void Engine::Render(float elapsedTime) { m_syncs.erase(sync.timestamp); } - //else SystemNotification("sync be no good."); } break; case OUTPUT: @@ -1497,10 +1482,19 @@ void Engine::Render(float elapsedTime) { RemotePlayer* rt = static_cast(player); glClear(GL_STENCIL_BUFFER_BIT); 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); } + 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); DisplayPovGun();