Whooooooooo are you?
This commit is contained in:
parent
f29abe8046
commit
adf36c8905
@ -232,6 +232,8 @@ void Server::Run() {
|
|||||||
if (sync_acc >= 1000) {
|
if (sync_acc >= 1000) {
|
||||||
sync_acc -= 1000;
|
sync_acc -= 1000;
|
||||||
--timer;
|
--timer;
|
||||||
|
std::string str = "Timer: ";
|
||||||
|
Log(str.append(std::to_string(timer)), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& [key, conn] : m_conns) {
|
for (auto& [key, conn] : m_conns) {
|
||||||
|
@ -1300,34 +1300,6 @@ void Engine::Render(float elapsedTime) {
|
|||||||
else if (m_mouseR)
|
else if (m_mouseR)
|
||||||
cmod = m_world.ChangeBlockAtCursor(BTYPE_METAL, m_player.GetPosition(), m_player.GetDirection(), m_block, m_networkgame);
|
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.
|
for (int x = 0; x < MAX_BULLETS; ++x) { // Array de bullets en jeu.
|
||||||
if (m_bullets[x]) {
|
if (m_bullets[x]) {
|
||||||
for (int b = 0; b < BULLET_UPDATES_PER_FRAME; ++b) {
|
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_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_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);
|
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);
|
if (m_isSkybox) m_skybox.Render(skybox);
|
||||||
@ -1436,8 +1403,6 @@ void Engine::Render(float elapsedTime) {
|
|||||||
|
|
||||||
sendPackTo<Input>(m_conn.m_sock_udp, &input, &m_bufout, &m_conn.m_srvsockaddr);
|
sendPackTo<Input>(m_conn.m_sock_udp, &input, &m_bufout, &m_conn.m_srvsockaddr);
|
||||||
|
|
||||||
std::cout << ".";
|
|
||||||
|
|
||||||
lsPck = recvPacks(m_conn.m_sock_udp, &m_buf);
|
lsPck = recvPacks(m_conn.m_sock_udp, &m_buf);
|
||||||
char* prevptr = nullptr;
|
char* prevptr = nullptr;
|
||||||
for (auto& pck : lsPck) { // We could make a few threads out of this.
|
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)) {
|
switch (getType(pck, 1)) {
|
||||||
using enum PACKET_TYPE;
|
using enum PACKET_TYPE;
|
||||||
case SYNC:
|
case SYNC:
|
||||||
std::cout << "snyc";
|
|
||||||
if (Deserialize(&sync, pck, &bsize)) {
|
if (Deserialize(&sync, pck, &bsize)) {
|
||||||
if (sync.sid != m_conn.getId()) {
|
if (sync.sid != m_conn.getId()) {
|
||||||
SystemNotification("syncsid be no good.");
|
SystemNotification("syncsid be no good.");
|
||||||
@ -1477,7 +1441,6 @@ void Engine::Render(float elapsedTime) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OUTPUT:
|
case OUTPUT:
|
||||||
std::cout << "out";
|
|
||||||
if (Deserialize(&out, pck, &bsize)) {
|
if (Deserialize(&out, pck, &bsize)) {
|
||||||
if (!m_players.contains(out.id)) {
|
if (!m_players.contains(out.id)) {
|
||||||
SystemNotification(std::to_string(out.id).append(" is id no good."));
|
SystemNotification(std::to_string(out.id).append(" is id no good."));
|
||||||
@ -1488,7 +1451,6 @@ void Engine::Render(float elapsedTime) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CHUNKMOD:
|
case CHUNKMOD:
|
||||||
std::cout << "cmod";
|
|
||||||
if (Deserialize(&cmod, pck, &bsize)) {
|
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.
|
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) {
|
[cmod](ChunkMod* c) {
|
||||||
@ -1502,7 +1464,6 @@ void Engine::Render(float elapsedTime) {
|
|||||||
else SystemNotification("cmod iznogoud.");
|
else SystemNotification("cmod iznogoud.");
|
||||||
break;
|
break;
|
||||||
case BULLET:
|
case BULLET:
|
||||||
std::cout << "pow";
|
|
||||||
if (Deserialize(&bull, pck, &bsize)) {
|
if (Deserialize(&bull, pck, &bsize)) {
|
||||||
Bullet* bult = new Bullet(bull.pos, bull.dir);
|
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").
|
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.");
|
else SystemNotification("Bullet is kraput.");
|
||||||
break;
|
break;
|
||||||
case CHAT:
|
case CHAT:
|
||||||
std::cout << "cat";
|
|
||||||
if (Deserialize(&chat, pck, &bsize))
|
if (Deserialize(&chat, pck, &bsize))
|
||||||
SystemNotification(chat.mess);
|
SystemNotification(chat.mess);
|
||||||
else SystemNotification("Chat iznogoud.");
|
else SystemNotification("Chat iznogoud.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cout << "wtf";
|
|
||||||
SystemNotification("packet be no good.");
|
SystemNotification("packet be no good.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user