From 16439ae77d4248f3f11455703452fa3b13e6f850 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Thu, 25 Apr 2024 22:14:30 +0800 Subject: [PATCH] [bot] Implement `CNetGame::Packet_ModifiedPacket(...)` * Add `CNetGame::UpdateNetwork()` * Update `CNetGame::Process()` --- bot/net/netgame.cpp | 38 ++++++++++++++++++++++++++++++++++++-- bot/net/netgame.h | 5 +++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/bot/net/netgame.cpp b/bot/net/netgame.cpp index 2661b67..b14046e 100644 --- a/bot/net/netgame.cpp +++ b/bot/net/netgame.cpp @@ -187,10 +187,14 @@ float GetElapsedTime() void CNetGame::Process() { + float fElapsedTime = GetElapsedTime(); + + UpdateNetwork(); + + + // TODO: CNetGame::Process (W: 00418370 L: 080AD6A4) /* - v2 = sub_80AC130(); - sub_80AE6A4(this); if ( this->field_C == 2 ) { if ( this->field_386 ) @@ -212,6 +216,36 @@ void CNetGame::Process() }*/ } +//---------------------------------------------------- +// UPDATE NETWORK +//---------------------------------------------------- + +void CNetGame::UpdateNetwork() +{ + Packet* pkt=NULL; + unsigned char packetIdentifier; + + while((pkt = m_pRakClient->Receive())) + { + packetIdentifier = GetPacketID(pkt); + + switch(packetIdentifier) + { + case ID_MODIFIED_PACKET: + Packet_ModifiedPacket(pkt); + break; + } + } +} + +//---------------------------------------------------- +// PACKET HANDLERS INTERNAL +//---------------------------------------------------- + +void CNetGame::Packet_ModifiedPacket(Packet* packet) +{ +} + //---------------------------------------------------- void CNetGame::sub_415EA0(PLAYERID playerId, BOOL a2) diff --git a/bot/net/netgame.h b/bot/net/netgame.h index af231fc..bb2f6fa 100644 --- a/bot/net/netgame.h +++ b/bot/net/netgame.h @@ -15,6 +15,11 @@ private: int m_iGameState; BOOL m_bLanMode; + void UpdateNetwork(); + + // Packet handlers + void Packet_ModifiedPacket(Packet* packet); + int m_iSpawnsAvailable; char _gap18[6]; BYTE m_byteWorldTime;