This commit is contained in:
MarcEricMartel
2023-12-02 11:05:00 -05:00
parent 20eb410b08
commit 5a491c5446
10 changed files with 63 additions and 26 deletions

View File

@@ -1193,10 +1193,11 @@ void Engine::Render(float elapsedTime) {
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;
netprot::ChunkMod* cmod = nullptr;
if (m_mouseL) {
if (bloc != BTYPE_LAST)
m_world.ChangeBlockAtCursor(bloc, m_player.GetPosition(), m_player.GetDirection(), m_block);
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]) {
@@ -1218,12 +1219,12 @@ void Engine::Render(float elapsedTime) {
}
}
else if (m_mouseR)
m_world.ChangeBlockAtCursor(BTYPE_AIR, m_player.GetPosition(), m_player.GetDirection(), m_block);
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) {
if (m_bullets[x]->Update(&m_world, elapsedTime, BULLET_UPDATES_PER_FRAME, m_players)) {
if (m_bullets[x]->Update(&m_world, elapsedTime, BULLET_UPDATES_PER_FRAME, m_players, m_networkgame ? &m_chunkmod : nullptr)) {
m_bullets[x]->~Bullet();
if (m_whoosh[x])
m_whoosh[x]->drop();
@@ -1282,6 +1283,9 @@ void Engine::Render(float elapsedTime) {
static std::vector<char*> lsPck;
static int sync_acc = 0;
if (cmod)
m_chunkmod_manifest.emplace_back(cmod);
if (last == 0)
last = tstamp;