[saco] Update DoProcessStuff()

* Add `CNetGame::Process()` stub
* Add `CNetGame::UpdateNetwork()` stub
* Implement `GetPacketID(...)`
* Implement `HasTimestamps()`
This commit is contained in:
RD42 2024-03-16 23:28:06 +08:00
parent 3687b95a9d
commit b6d8c9c215
3 changed files with 67 additions and 0 deletions

View File

@ -349,6 +349,18 @@ void DoInitStuff()
void DoProcessStuff() void DoProcessStuff()
{ {
DoInitStuff(); DoInitStuff();
SetupD3DFog(TRUE);
// Process the netgame if it's active.
if(pNetGame) {
//Sleep(0); // This hands the context over to raknet
pNetGame->Process();
}
if(pAudioStream) {
pAudioStream->Process();
}
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -4,6 +4,34 @@
extern CGame *pGame; extern CGame *pGame;
extern CChatWindow *pChatWindow; extern CChatWindow *pChatWindow;
//----------------------------------------------------
BYTE GetPacketID(Packet *p)
{
if (p==0) return 255;
if ((unsigned char)p->data[0] == ID_TIMESTAMP) {
assert(p->length > sizeof(unsigned char) + sizeof(unsigned long));
return (unsigned char) p->data[sizeof(unsigned char) + sizeof(unsigned long)];
}
else {
return (unsigned char) p->data[0];
}
}
//----------------------------------------------------
bool HasTimestamps(Packet *p)
{
if (p==0) return 0;
if ((unsigned char)p->data[0] == ID_TIMESTAMP)
return true;
return false;
}
//----------------------------------------------------
CNetGame::CNetGame(PCHAR szHostOrIp, int iPort, CNetGame::CNetGame(PCHAR szHostOrIp, int iPort,
PCHAR szPlayerName, PCHAR szPass) PCHAR szPlayerName, PCHAR szPass)
{ {
@ -32,6 +60,29 @@ CNetGame::CNetGame(PCHAR szHostOrIp, int iPort,
//---------------------------------------------------- //----------------------------------------------------
void CNetGame::Process()
{
UpdateNetwork();
// TODO: CNetGame::Process()
}
//----------------------------------------------------
// UPDATE NETWORK
//----------------------------------------------------
void CNetGame::UpdateNetwork()
{
/* Packet* pkt=NULL;
unsigned char packetIdentifier;
while((pkt = m_pRakClient->Receive()))
{
}*/
// TODO: CNetGame::UpdateNetwork()
}
void CNetGame::InitPools() void CNetGame::InitPools()
{ {
m_pPools = (NETGAME_POOLS *)calloc(1, sizeof(NETGAME_POOLS)); m_pPools = (NETGAME_POOLS *)calloc(1, sizeof(NETGAME_POOLS));

View File

@ -43,6 +43,8 @@ private:
RakClientInterface *m_pRakClient; RakClientInterface *m_pRakClient;
void UpdateNetwork();
char _gap4[44]; char _gap4[44];
char m_szHostOrIp[257]; char m_szHostOrIp[257];
char m_szHostName[257]; char m_szHostName[257];
@ -63,6 +65,8 @@ public:
CNetGame(char *a2, int a3, char *a4, char *a5); CNetGame(char *a2, int a3, char *a4, char *a5);
void Process();
void InitPools(); void InitPools();
DWORD GetTime(); DWORD GetTime();