Ça s'ra pas long. Non non non non non.

This commit is contained in:
MarcEricMartel 2023-12-18 11:18:42 -05:00
parent 9a669acd9c
commit cf831e339f
2 changed files with 11 additions and 1 deletions

View File

@ -1520,13 +1520,17 @@ void Engine::Render(float elapsedTime) {
char* prevptr = nullptr; char* prevptr = nullptr;
Chat chat; Chat chat;
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.
Sync sync; Output out; ChunkMod cmod; BulletAdd bull; Sync sync; Output out; ChunkMod cmod; BulletAdd bull; PickupMod pmod;
if (!prevptr) if (!prevptr)
prevptr = m_buf.ptr; prevptr = m_buf.ptr;
uint32_t bsize = m_buf.len - (pck - prevptr); uint32_t bsize = m_buf.len - (pck - prevptr);
prevptr = pck; prevptr = pck;
switch (getType(pck, 1)) { switch (getType(pck, 1)) {
using enum PACKET_TYPE; using enum PACKET_TYPE;
case PICKUPMOD:
if (Deserialize(&pmod, pck, &bsize)) {
// TODO pikoppe
}
case SYNC: case SYNC:
if (Deserialize(&sync, pck, &bsize)) { if (Deserialize(&sync, pck, &bsize)) {
if (sync.sid != m_conn.getId()) { if (sync.sid != m_conn.getId()) {
@ -1547,6 +1551,11 @@ void Engine::Render(float elapsedTime) {
if (diff.y < 1.) if (diff.y < 1.)
diff.y = 0; diff.y = 0;
Boosts boost = sync.boost;
m_player.boostdamage = boost.damage;
m_player.boostinvincible = boost.invincible;
if (diff.Length() > 1.5) { if (diff.Length() > 1.5) {
diff.Normalize(); diff.Normalize();
m_player.Move(-diff); m_player.Move(-diff);

View File

@ -252,6 +252,7 @@ private:
std::set<uint64_t> m_deadplayers; std::set<uint64_t> m_deadplayers;
netprot::Buffer m_buf, m_bufout; netprot::Buffer m_buf, m_bufout;
netprot::ChunkMod* m_chunkmod = nullptr; netprot::ChunkMod* m_chunkmod = nullptr;
std::map<uint64_t, Booster*> m_boosters;
std::unordered_map<uint64_t, netprot::Sync> m_syncs; std::unordered_map<uint64_t, netprot::Sync> m_syncs;
std::string m_messageNotification = ""; std::string m_messageNotification = "";