From 1374de74927d37708a4d4497e8bf1b583d9bb1d9 Mon Sep 17 00:00:00 2001 From: plagman Date: Mon, 5 Jul 2010 08:10:15 +0000 Subject: [PATCH] Fix multiplayer. git-svn-id: https://svn.eduke32.com/eduke32@1668 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/duke3d.h | 3 ++- polymer/eduke32/source/game.c | 17 +++++++---------- polymer/eduke32/source/global.c | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index dc78eaa8e..379552f61 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -487,7 +487,8 @@ typedef struct { char name[32]; } DukePlayer_t; -extern char tempbuf[2048], packbuf[4096], menutextbuf[128]; +#define PACKBUF_SIZE 65535 +extern char tempbuf[2048], packbuf[PACKBUF_SIZE], menutextbuf[128]; extern int32_t g_spriteGravity; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index b566a2833..cf1b058f3 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1002,8 +1002,6 @@ void Net_ParseServerPacket(ENetEvent * event) TRAVERSE_CONNECT(i) { - if (g_player[i].playerquitflag == 0) continue; - g_player[i].ps->dead_flag = *(int16_t *)&packbuf[j]; j += sizeof(int16_t); @@ -1017,12 +1015,12 @@ void Net_ParseServerPacket(ENetEvent * event) nsyn = (input_t *)&inputfifo[0][0]; - Bmemcpy(&nsyn[i], &packbuf[j], sizeof(input_t)); - + Bmemcpy(&nsyn[i], &packbuf[j], offsetof(input_t, filler)); j += offsetof(input_t, filler); if (TEST_SYNC_KEY(nsyn[i].bits,SK_GAMEQUIT)) g_player[i].playerquitflag = 0; g_player[i].movefifoend++; + if (g_player[i].playerquitflag == 0) continue; // Bmemcpy(&g_player[i].ps->opos.x, &g_player[i].ps->pos.x, sizeof(vec3_t)); @@ -1962,8 +1960,6 @@ void Net_UpdateClients(void) TRAVERSE_CONNECT(i) { - if (g_player[i].playerquitflag == 0) continue; - Bmemcpy(&osyn[i], &nsyn[i], offsetof(input_t, filler)); *(int16_t *)&packbuf[j] = g_player[i].ps->dead_flag; @@ -1971,6 +1967,7 @@ void Net_UpdateClients(void) Bmemcpy(&packbuf[j], &nsyn[i], offsetof(input_t, filler)); j += offsetof(input_t, filler); + if (g_player[i].playerquitflag == 0) continue; Bmemcpy(&packbuf[j], &g_player[i].ps->pos.x, sizeof(vec3_t) * 2); j += sizeof(vec3_t) * 2; @@ -2229,7 +2226,7 @@ void Net_UpdateClients(void) } { - char buf[4096]; + char *buf = alloca(PACKBUF_SIZE); j = qlz_compress((char *)(packbuf)+1, (char *)buf, j, state_compress); Bmemcpy((char *)(packbuf)+1, (char *)buf, j); @@ -11834,9 +11831,9 @@ MAIN_LOOP_RESTART: OSD_DispatchQueued(); - if (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME) - { - CONTROL_ProcessBinds(); + if (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME) + { + CONTROL_ProcessBinds(); getinput(myconnectindex); avg.fvel += loc.fvel; diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 8c8640c2a..a457b5a2e 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -48,7 +48,7 @@ int16_t cyclers[MAXCYCLERS][6],g_numCyclers; char *ScriptQuotes[MAXQUOTES], *ScriptQuoteRedefinitions[MAXQUOTES]; -char tempbuf[2048], packbuf[4096], menutextbuf[128], buf[1024]; +char tempbuf[2048], packbuf[PACKBUF_SIZE], menutextbuf[128], buf[1024]; int16_t camsprite; int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;