X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=cl_parse.c;h=101dee0fb603dcb9aacdeac8d99970cae53b0b5a;hb=75ed014650cc6c57abc48b854fb60f78bc249eab;hp=9baf8c1324fdf2734fab4beca59756ab60c3f57d;hpb=c10cd5ef15e3211797e91900f6ada528faa93e92;p=xonotic%2Fdarkplaces.git diff --git a/cl_parse.c b/cl_parse.c index 9baf8c13..101dee0f 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -83,7 +83,7 @@ char *svc_strings[128] = "", // 48 "", // 49 "svc_cgame", // 50 // [short] length [bytes] data - "svc_unusedlh1", // 51 // unused + "svc_updatestatubyte", // 51 // [byte] stat [byte] value "svc_effect", // 52 // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate "svc_effect2", // 53 // [vector] org [short] modelindex [short] startframe [byte] framecount [byte] framerate "svc_sound2", // 54 // short soundindex instead of byte @@ -204,8 +204,6 @@ void CL_KeepaliveMessage (void) msg.cursize = 0; MSG_WriteChar(&msg, svc_nop); NetConn_SendUnreliableMessage(cls.netcon, &msg); - // try not to utterly crush the computer with work, that's just rude - Sys_Sleep(1); } } @@ -289,6 +287,16 @@ Con_DPrintf("CL_SignonReply: %i\n", cls.signon); MSG_WriteByte (&cls.message, clc_stringcmd); MSG_WriteString (&cls.message, va("pmodel %i\n", cl_pmodel.integer)); } + if (*cl_playermodel.string) + { + MSG_WriteByte (&cls.message, clc_stringcmd); + MSG_WriteString (&cls.message, va("playermodel %s\n", cl_playermodel.string)); + } + if (*cl_playerskin.string) + { + MSG_WriteByte (&cls.message, clc_stringcmd); + MSG_WriteString (&cls.message, va("playerskin %s\n", cl_playerskin.string)); + } MSG_WriteByte (&cls.message, clc_stringcmd); MSG_WriteString (&cls.message, va("rate %i\n", cl_rate.integer)); @@ -334,19 +342,19 @@ void CL_ParseServerInfo (void) // hack for unmarked Nehahra movie demos which had a custom protocol if (i == PROTOCOL_QUAKE && cls.demoplayback && demo_nehahra.integer) i = PROTOCOL_NEHAHRAMOVIE; - if (i != PROTOCOL_QUAKE && i != PROTOCOL_DARKPLACES1 && i != PROTOCOL_DARKPLACES2 && i != PROTOCOL_DARKPLACES3 && i != PROTOCOL_DARKPLACES4 && i != PROTOCOL_DARKPLACES5 && i != PROTOCOL_NEHAHRAMOVIE) + if (i != PROTOCOL_QUAKE && i != PROTOCOL_DARKPLACES1 && i != PROTOCOL_DARKPLACES2 && i != PROTOCOL_DARKPLACES3 && i != PROTOCOL_DARKPLACES4 && i != PROTOCOL_DARKPLACES5 && i != PROTOCOL_DARKPLACES6 && i != PROTOCOL_NEHAHRAMOVIE) { - Host_Error("CL_ParseServerInfo: Server is protocol %i, not %i (Quake), %i (DP1), %i (DP2), %i (DP3), %i (DP4), %i (DP5), or %i (Nehahra movie)", i, PROTOCOL_QUAKE, PROTOCOL_DARKPLACES1, PROTOCOL_DARKPLACES2, PROTOCOL_DARKPLACES3, PROTOCOL_DARKPLACES4, PROTOCOL_DARKPLACES5, PROTOCOL_NEHAHRAMOVIE); + Host_Error("CL_ParseServerInfo: Server is protocol %i, not %i (Quake), %i (DP1), %i (DP2), %i (DP3), %i (DP4), %i (DP5), %i (DP6), or %i (Nehahra movie)", i, PROTOCOL_QUAKE, PROTOCOL_DARKPLACES1, PROTOCOL_DARKPLACES2, PROTOCOL_DARKPLACES3, PROTOCOL_DARKPLACES4, PROTOCOL_DARKPLACES5, PROTOCOL_DARKPLACES6, PROTOCOL_NEHAHRAMOVIE); return; } cl.protocol = i; - Con_DPrintf("Protocol %i\n", cl.protocol); + Con_DPrintf("Server protocol is %i\n", cl.protocol); // parse maxclients cl.maxclients = MSG_ReadByte (); if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD) { - Con_Printf("Bad maxclients (%u) from server\n", cl.maxclients); + Host_Error("Bad maxclients (%u) from server\n", cl.maxclients); return; } Mem_EmptyPool(cl_scores_mempool); @@ -366,6 +374,11 @@ void CL_ParseServerInfo (void) // check memory integrity Mem_CheckSentinelsGlobal(); + S_StopAllSounds(); + // if server is active, we already began a loading plaque + if (!sv.active) + SCR_BeginLoadingPlaque(); + // disable until we get textures for it R_ResetSkyBox(); @@ -401,10 +414,7 @@ void CL_ParseServerInfo (void) // anything that isn't needed Mod_ClearUsed(); for (i = 1;i < nummodels;i++) - { - CL_KeepaliveMessage(); - Mod_TouchModel(parse_model_precache[i]); - } + Mod_FindName(parse_model_precache[i]); Mod_PurgeUnused(); // do the same for sounds @@ -552,16 +562,6 @@ void CL_MoveLerpEntityStates(entity_t *ent) } } -void CL_ReadEntityFrame(void) -{ - if (cl.protocol == PROTOCOL_DARKPLACES1 || cl.protocol == PROTOCOL_DARKPLACES2 || cl.protocol == PROTOCOL_DARKPLACES3) - EntityFrame_CL_ReadFrame(); - else if (cl.protocol == PROTOCOL_DARKPLACES4) - EntityFrame4_CL_ReadFrame(); - else if (cl.protocol == PROTOCOL_DARKPLACES5) - EntityFrame5_CL_ReadFrame(); -} - /* ================== CL_ParseBaseline @@ -607,6 +607,25 @@ void CL_ParseClientdata (int bits) { int i, j; + VectorCopy (cl.mvelocity[0], cl.mvelocity[1]); + + if (cl.protocol != PROTOCOL_DARKPLACES6) + { + cl.stats[STAT_VIEWHEIGHT] = DEFAULT_VIEWHEIGHT; + cl.stats[STAT_ITEMS] = 0; + cl.stats[STAT_VIEWZOOM] = 255; + } + cl.idealpitch = 0; + cl.punchangle[0] = 0; + cl.punchangle[1] = 0; + cl.punchangle[2] = 0; + cl.punchvector[0] = 0; + cl.punchvector[1] = 0; + cl.punchvector[2] = 0; + cl.mvelocity[0][0] = 0; + cl.mvelocity[0][1] = 0; + cl.mvelocity[0][2] = 0; + bits &= 0xFFFF; if (bits & SU_EXTEND1) bits |= (MSG_ReadByte() << 16); @@ -614,85 +633,63 @@ void CL_ParseClientdata (int bits) bits |= (MSG_ReadByte() << 24); if (bits & SU_VIEWHEIGHT) - cl.viewheight = MSG_ReadChar (); - else - cl.viewheight = DEFAULT_VIEWHEIGHT; + cl.stats[STAT_VIEWHEIGHT] = MSG_ReadChar (); if (bits & SU_IDEALPITCH) cl.idealpitch = MSG_ReadChar (); - else - cl.idealpitch = 0; - VectorCopy (cl.mvelocity[0], cl.mvelocity[1]); for (i = 0;i < 3;i++) { if (bits & (SU_PUNCH1<= 1 && i < MAX_MODELS) + { + model_t *model = Mod_ForName(s, false, false, i == 1); + if (!model) + Con_Printf("svc_precache: Mod_ForName(\"%s\") failed\n", s); + cl.model_precache[i] = model; + } + else + Con_Printf("svc_precache: index %i outside range %i...%i\n", i, 1, MAX_MODELS); + } + else + { + i -= 32768; + if (i >= 1 && i < MAX_SOUNDS) + { + sfx_t *sfx = S_PrecacheSound (s, true, false); + if (!sfx && snd_initialized.integer) + Con_Printf("svc_precache: S_PrecacheSound(\"%s\") failed\n", s); + cl.sound_precache[i] = sfx; + } + else + Con_Printf("svc_precache: index %i outside range %i...%i\n", i, 1, MAX_SOUNDS); + } + } break; case svc_stopsound: @@ -1578,7 +1612,9 @@ void CL_ParseServerMessage(void) case svc_signonnum: i = MSG_ReadByte (); - if (i <= cls.signon) + // LordHavoc: it's rude to kick off the client if they missed the + // reconnect somehow, so allow signon 1 even if at signon 1 + if (i <= cls.signon && i != 1) Host_Error ("Received signon %i when at %i", i, cls.signon); cls.signon = i; CL_SignonReply (); @@ -1599,6 +1635,13 @@ void CL_ParseServerMessage(void) cl.stats[i] = MSG_ReadLong (); break; + case svc_updatestatubyte: + i = MSG_ReadByte (); + if (i < 0 || i >= MAX_CL_STATS) + Host_Error ("svc_updatestat: %i is invalid", i); + cl.stats[i] = MSG_ReadByte (); + break; + case svc_spawnstaticsound: CL_ParseStaticSound (false); break; @@ -1687,7 +1730,14 @@ void CL_ParseServerMessage(void) cls.signon = SIGNONS; CL_SignonReply (); } - CL_ReadEntityFrame(); + if (cl.protocol == PROTOCOL_DARKPLACES1 || cl.protocol == PROTOCOL_DARKPLACES2 || cl.protocol == PROTOCOL_DARKPLACES3) + EntityFrame_CL_ReadFrame(); + else if (cl.protocol == PROTOCOL_DARKPLACES4) + EntityFrame4_CL_ReadFrame(); + else if (cl.protocol == PROTOCOL_DARKPLACES5 || cl.protocol == PROTOCOL_DARKPLACES6) + EntityFrame5_CL_ReadFrame(); + else + Host_Error("CL_ParseServerMessage: svc_entities: unknown cl.protocol %i\n", cl.protocol); break; } } @@ -1715,3 +1765,8 @@ void CL_Parse_Init(void) Cvar_SetValue("demo_nehahra", 1); Cvar_RegisterVariable(&developer_networkentities); } + +void CL_Parse_Shutdown(void) +{ + Mem_FreePool (&cl_scores_mempool); +}