diff --git a/SQCSim-srv/server.cpp b/SQCSim-srv/server.cpp index 920f366..f9e173b 100644 --- a/SQCSim-srv/server.cpp +++ b/SQCSim-srv/server.cpp @@ -232,6 +232,8 @@ void Server::Run() { if (sync_acc >= 1000) { sync_acc -= 1000; --timer; + std::string str = "Timer: "; + Log(str.append(std::to_string(timer)), false, false); } for (auto& [key, conn] : m_conns) { diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 91d741d..4db7aa5 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -1300,34 +1300,6 @@ void Engine::Render(float elapsedTime) { else if (m_mouseR) cmod = m_world.ChangeBlockAtCursor(BTYPE_METAL, m_player.GetPosition(), m_player.GetDirection(), m_block, m_networkgame); - - - //if (m_mouseL) { - // if (bloc != BTYPE_LAST) - // cmod = m_world.ChangeBlockAtCursor(bloc, m_player.GetPosition(), m_player.GetDirection(), m_block, m_networkgame); - // else if (bulletTime <= 0.f) { - // for (int x = 0; x < MAX_BULLETS; ++x) // Ajouter une balle dans l'array (aussi connu sous le nom de "faire pow pow"). - // if (!m_bullets[x]) { - // m_bullets[x] = new Bullet(m_player.GetPOV() + m_player.GetDirection(), m_player.GetDirection()); - // break; - // } - // else if (x == MAX_BULLETS - 1) { // S'il y a pas d'espace dans l'array, prendre la place de la première balle de l'array. - // m_bullets[0]->~Bullet(); - // m_bullets[0] = new Bullet(m_player.GetPOV() + m_player.GetDirection(), m_player.GetDirection()); - // } - // bulletTime = BULLET_TIME; - // m_audio.Create3DAudioObj(m_powpow, AUDIO_PATH "pow.wav", m_player.GetPOV(), m_player.GetDirection() * 10, false, .5f); - // if (m_flash) { // Coupe le rendering et affiche un frame blanc, pour simuler un flash. - // glClearColor(.8f, .8f, .8f, 1.f); - // glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - // glClearColor(0.f, 0.f, 0.f, 1.f); - // return; - // } - // } - //} - //else if (m_mouseR) - // cmod = m_world.ChangeBlockAtCursor(BTYPE_AIR, m_player.GetPosition(), m_player.GetDirection(), m_block, m_networkgame); - for (int x = 0; x < MAX_BULLETS; ++x) { // Array de bullets en jeu. if (m_bullets[x]) { for (int b = 0; b < BULLET_UPDATES_PER_FRAME; ++b) { @@ -1354,11 +1326,6 @@ void Engine::Render(float elapsedTime) { m_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo); m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo); - - //m_booster.RenderBillboard({ 195,16,195 }, m_textureAtlas, m_shader01, all); - /* m_remotePlayer.ApplyPhysics(Vector3f(0, 0, 0), &m_world, elapsedTime); - m_remotePlayer.Render(m_animeAtlas, m_shader01, all ,elapsedTime , m_player);*/ - m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas); if (m_isSkybox) m_skybox.Render(skybox); @@ -1436,8 +1403,6 @@ void Engine::Render(float elapsedTime) { sendPackTo(m_conn.m_sock_udp, &input, &m_bufout, &m_conn.m_srvsockaddr); - std::cout << "."; - lsPck = recvPacks(m_conn.m_sock_udp, &m_buf); char* prevptr = nullptr; for (auto& pck : lsPck) { // We could make a few threads out of this. @@ -1449,7 +1414,6 @@ void Engine::Render(float elapsedTime) { switch (getType(pck, 1)) { using enum PACKET_TYPE; case SYNC: - std::cout << "snyc"; if (Deserialize(&sync, pck, &bsize)) { if (sync.sid != m_conn.getId()) { SystemNotification("syncsid be no good."); @@ -1477,7 +1441,6 @@ void Engine::Render(float elapsedTime) { } break; case OUTPUT: - std::cout << "out"; if (Deserialize(&out, pck, &bsize)) { if (!m_players.contains(out.id)) { SystemNotification(std::to_string(out.id).append(" is id no good.")); @@ -1488,7 +1451,6 @@ void Engine::Render(float elapsedTime) { } break; case CHUNKMOD: - std::cout << "cmod"; if (Deserialize(&cmod, pck, &bsize)) { if (!std::erase_if(m_chunkmod_manifest, // Efface le chunkmod du manifeste s'il est dedans et reset le countdown, sinon fait la modification. [cmod](ChunkMod* c) { @@ -1502,7 +1464,6 @@ void Engine::Render(float elapsedTime) { else SystemNotification("cmod iznogoud."); break; case BULLET: - std::cout << "pow"; if (Deserialize(&bull, pck, &bsize)) { Bullet* bult = new Bullet(bull.pos, bull.dir); for (int x = 0; x < MAX_BULLETS; ++x) // Ajouter une balle dans l'array (aussi connu sous le nom de "faire pow pow"). @@ -1519,13 +1480,11 @@ void Engine::Render(float elapsedTime) { else SystemNotification("Bullet is kraput."); break; case CHAT: - std::cout << "cat"; if (Deserialize(&chat, pck, &bsize)) SystemNotification(chat.mess); else SystemNotification("Chat iznogoud."); break; default: - std::cout << "wtf"; SystemNotification("packet be no good."); break; }