X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=cl_parse.c;h=b4215c6da53fc5e64a55af9672571fe827340a60;hb=1a473289e63fa85c6edce042060fd2a4ac1ed4bc;hp=18b1e975752329bc2337a6436f6f657e9516ebd5;hpb=d561e1461a5a2525250c065fec074e94eda429d8;p=xonotic%2Fdarkplaces.git diff --git a/cl_parse.c b/cl_parse.c index 18b1e975..b4215c6d 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -300,7 +300,7 @@ void CL_KeepaliveMessage (void) memset(&msg, 0, sizeof(msg)); msg.data = buf; msg.maxsize = sizeof(buf); - MSG_WriteChar(&msg, svc_nop); + MSG_WriteChar(&msg, clc_nop); NetConn_SendUnreliableMessage(cls.netcon, &msg, cls.protocol); } } @@ -492,7 +492,7 @@ static void QW_CL_RequestNextDownload(void) // now that we have a world model, set up the world entity, renderer // modules and csqc cl.entities[0].render.model = cl.worldmodel = cl.model_precache[1]; - CL_BoundingBoxForEntity(&cl.entities[0].render); + CL_UpdateRenderEntity(&cl.entities[0].render); R_Modules_NewMap(); @@ -1017,7 +1017,8 @@ void CL_ParseServerInfo (void) // parse player number i = MSG_ReadByte(); - cl.qw_spectator = (i & 128) != 0; + // cl.qw_spectator is an unneeded flag, cl.scores[cl.playerentity].qw_spectator works better (it can be updated by the server during the game) + //cl.qw_spectator = (i & 128) != 0; cl.playerentity = cl.viewentity = (i & 127) + 1; cl.scores = (scoreboard_t *)Mem_Alloc(cls.levelmempool, cl.maxclients*sizeof(*cl.scores)); @@ -1157,7 +1158,7 @@ void CL_ParseServerInfo (void) // we now have the worldmodel so we can set up the game world cl.entities[0].render.model = cl.worldmodel = cl.model_precache[1]; - CL_BoundingBoxForEntity(&cl.entities[0].render); + CL_UpdateRenderEntity(&cl.entities[0].render); R_Modules_NewMap(); } @@ -1369,7 +1370,6 @@ void CL_ParseClientdata (void) cl.stats[STAT_ITEMS] = MSG_ReadLong (); cl.onground = (bits & SU_ONGROUND) != 0; - csqc_onground = cl.onground; //[515]: cause without this csqc will receive not right value on svc_print =/ cl.inwater = (bits & SU_INWATER) != 0; if (cls.protocol == PROTOCOL_DARKPLACES5) @@ -1412,6 +1412,9 @@ void CL_ParseClientdata (void) // viewzoom interpolation cl.mviewzoom[0] = (float) max(cl.stats[STAT_VIEWZOOM], 2) * (1.0f / 255.0f); + + // force a recalculation of the player prediction + cl.movement_replay = true; } /* @@ -1438,14 +1441,12 @@ void CL_ParseStatic (int large) ent->render.skinnum = ent->state_baseline.skin; ent->render.effects = ent->state_baseline.effects; ent->render.alpha = 1; - //ent->render.scale = 1; //VectorCopy (ent->state_baseline.origin, ent->render.origin); //VectorCopy (ent->state_baseline.angles, ent->render.angles); Matrix4x4_CreateFromQuakeEntity(&ent->render.matrix, ent->state_baseline.origin[0], ent->state_baseline.origin[1], ent->state_baseline.origin[2], ent->state_baseline.angles[0], ent->state_baseline.angles[1], ent->state_baseline.angles[2], 1); - Matrix4x4_Invert_Simple(&ent->render.inversematrix, &ent->render.matrix); - CL_BoundingBoxForEntity(&ent->render); + CL_UpdateRenderEntity(&ent->render); // This is definitely cheating... if (ent->render.model == NULL) @@ -2050,12 +2051,20 @@ qboolean CL_ExaminePrintString(const char *text) if (!strcmp(text, "Client ping times:\n")) { cl.parsingtextmode = CL_PARSETEXTMODE_PING; - cl.parsingtextplayerindex = 0; + for(cl.parsingtextplayerindex = 0; cl.parsingtextplayerindex < cl.maxclients && !cl.scores[cl.parsingtextplayerindex].name[0]; cl.parsingtextplayerindex++) + ; + if (cl.parsingtextplayerindex >= cl.maxclients) // should never happen, since the client itself should be in cl.scores + { + Con_Printf("ping reply but empty scoreboard?!?\n"); + cl.parsingtextmode = CL_PARSETEXTMODE_NONE; + cl.parsingtextexpectingpingforscores = 0; + } + cl.parsingtextexpectingpingforscores = cl.parsingtextexpectingpingforscores ? 2 : 0; return !cl.parsingtextexpectingpingforscores; } if (!strncmp(text, "host: ", 9)) { - cl.parsingtextexpectingpingforscores = false; + // cl.parsingtextexpectingpingforscores = false; // really? cl.parsingtextmode = CL_PARSETEXTMODE_STATUS; cl.parsingtextplayerindex = 0; return true; @@ -2064,35 +2073,47 @@ qboolean CL_ExaminePrintString(const char *text) { // if anything goes wrong, we'll assume this is not a ping report qboolean expected = cl.parsingtextexpectingpingforscores; - cl.parsingtextexpectingpingforscores = false; + cl.parsingtextexpectingpingforscores = 0; cl.parsingtextmode = CL_PARSETEXTMODE_NONE; t = text; while (*t == ' ') t++; - if (*t >= '0' && *t <= '9') + if ((*t >= '0' && *t <= '9') || *t == '-') { int ping = atoi(t); - while (*t >= '0' && *t <= '9') + while ((*t >= '0' && *t <= '9') || *t == '-') t++; if (*t == ' ') { int charindex = 0; t++; - for (charindex = 0;cl.scores[cl.parsingtextplayerindex].name[charindex] == t[charindex];charindex++) - ; - if (cl.scores[cl.parsingtextplayerindex].name[charindex] == 0 && t[charindex] == '\n') + if(cl.parsingtextplayerindex < cl.maxclients) { - cl.scores[cl.parsingtextplayerindex].qw_ping = bound(0, ping, 9999); - for (cl.parsingtextplayerindex++;cl.parsingtextplayerindex < cl.maxclients && !cl.scores[cl.parsingtextplayerindex].name[0];cl.parsingtextplayerindex++) + for (charindex = 0;cl.scores[cl.parsingtextplayerindex].name[charindex] == t[charindex];charindex++) ; - if (cl.parsingtextplayerindex < cl.maxclients) + if (cl.scores[cl.parsingtextplayerindex].name[charindex] == 0 && t[charindex] == '\n') { - // we parsed a valid ping entry, so expect another to follow - cl.parsingtextmode = CL_PARSETEXTMODE_PING; - cl.parsingtextexpectingpingforscores = expected; + cl.scores[cl.parsingtextplayerindex].qw_ping = bound(0, ping, 9999); + for (cl.parsingtextplayerindex++;cl.parsingtextplayerindex < cl.maxclients && !cl.scores[cl.parsingtextplayerindex].name[0];cl.parsingtextplayerindex++) + ; + //if (cl.parsingtextplayerindex < cl.maxclients) // we could still get unconnecteds! + { + // we parsed a valid ping entry, so expect another to follow + cl.parsingtextmode = CL_PARSETEXTMODE_PING; + cl.parsingtextexpectingpingforscores = expected; + } + return !expected; } + } + if (!strncmp(t, "unconnected\n", 12)) + { + // just ignore + cl.parsingtextmode = CL_PARSETEXTMODE_PING; + cl.parsingtextexpectingpingforscores = expected; return !expected; } + else + Con_DPrintf("player names '%s' and '%s' didn't match\n", cl.scores[cl.parsingtextplayerindex].name, t); } } } @@ -2200,6 +2221,7 @@ void CL_ParseServerMessage(void) cl.mtime[1] = cl.mtime[0]; cl.mtime[0] = realtime; // qw has no clock cl.movement_needupdate = true; + cl.onground = false; // since there's no clientdata parsing, clear the onground flag here // if true the cl.viewangles are interpolated from cl.mviewangles[] // during this frame // (makes spectating players much smoother and prevents mouse movement from turning) @@ -2208,6 +2230,9 @@ void CL_ParseServerMessage(void) if (!cls.demoplayback) VectorCopy(cl.mviewangles[0], cl.mviewangles[1]); + // force a recalculation of the player prediction + cl.movement_replay = true; + // slightly kill qw player entities each frame for (i = 1;i < cl.maxclients;i++) cl.entities_active[i] = false; @@ -2251,7 +2276,7 @@ void CL_ParseServerMessage(void) { char description[32*64], temp[64]; int count; - strcpy(description, "packet dump: "); + strlcpy(description, "packet dump: ", sizeof(description)); i = cmdcount - 32; if (i < 0) i = 0; @@ -2591,7 +2616,7 @@ void CL_ParseServerMessage(void) { char description[32*64], temp[64]; int count; - strcpy (description, "packet dump: "); + strlcpy (description, "packet dump: ", sizeof(description)); i = cmdcount - 32; if (i < 0) i = 0;