X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=cl_parse.c;h=04879f66683ade300075c51dc379663a24879f20;hb=823d8a2d16635f92223b991cb36ae0104fb6d88e;hp=c5f78db044bb4411ed7e3f2b329286379a364d75;hpb=154ab3fc865f799d97c2dd0a230559928c9677e8;p=xonotic%2Fdarkplaces.git diff --git a/cl_parse.c b/cl_parse.c index c5f78db0..04879f66 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -206,7 +206,7 @@ void CL_KeepaliveMessage (void) 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(); + Sys_Sleep(1); } } @@ -230,14 +230,14 @@ void CL_ParseEntityLump(char *entdata) if (com_token[0] == '}') break; // end of worldspawn if (com_token[0] == '_') - strcpy(key, com_token + 1); + strlcpy (key, com_token + 1, sizeof (key)); else - strcpy(key, com_token); + strlcpy (key, com_token, sizeof (key)); while (key[strlen(key)-1] == ' ') // remove trailing spaces key[strlen(key)-1] = 0; if (!COM_ParseToken(&data, false)) return; // error - strcpy(value, com_token); + strlcpy (value, com_token, sizeof (value)); if (!strcmp("sky", key)) R_SetSkyBox(value); else if (!strcmp("skyname", key)) // non-standard, introduced by QuakeForge... sigh. @@ -290,6 +290,9 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon); MSG_WriteString (&cls.message, va("pmodel %i\n", cl_pmodel.integer)); } + MSG_WriteByte (&cls.message, clc_stringcmd); + MSG_WriteString (&cls.message, va("rate %i\n", cl_rate.integer)); + MSG_WriteByte (&cls.message, clc_stringcmd); MSG_WriteString (&cls.message, "spawn"); break; @@ -354,7 +357,7 @@ void CL_ParseServerInfo (void) // parse signon message str = MSG_ReadString (); - strncpy (cl.levelname, str, sizeof(cl.levelname)-1); + strlcpy (cl.levelname, str, sizeof(cl.levelname)); // seperate the printfs so the server message can have a color if (cl.protocol != PROTOCOL_NEHAHRAMOVIE) // no messages when playing the Nehahra movie @@ -382,7 +385,7 @@ void CL_ParseServerInfo (void) Host_Error ("Server sent too many model precaches\n"); if (strlen(str) >= MAX_QPATH) Host_Error ("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1); - strcpy(parse_model_precache[nummodels], str); + strlcpy (parse_model_precache[nummodels], str, sizeof (parse_model_precache[nummodels])); } // parse sound precache list for (numsounds=1 ; ; numsounds++) @@ -394,7 +397,7 @@ void CL_ParseServerInfo (void) Host_Error("Server sent too many sound precaches\n"); if (strlen(str) >= MAX_QPATH) Host_Error("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1); - strcpy(parse_sound_precache[numsounds], str); + strlcpy (parse_sound_precache[numsounds], str, sizeof (parse_sound_precache[numsounds])); } // touch all of the precached models that are still loaded so we can free @@ -405,14 +408,16 @@ void CL_ParseServerInfo (void) CL_KeepaliveMessage(); Mod_TouchModel(parse_model_precache[i]); } + Mod_PurgeUnused(); + // do the same for sounds + S_ClearUsed(); for (i = 1;i < numsounds;i++) { CL_KeepaliveMessage(); S_TouchSound(parse_sound_precache[i]); } - // purge anything that was not touched - Mod_PurgeUnused(); + S_PurgeUnused(); // now we try to load everything that is new @@ -431,22 +436,20 @@ void CL_ParseServerInfo (void) } // sounds - S_BeginPrecaching (); for (i=1 ; istate_current.active = true; ent->render.model = cl.worldmodel = cl.model_precache[1]; - //ent->render.scale = 1; + ent->render.scale = 1; // some of the renderer still relies on scale ent->render.alpha = 1; - ent->render.flags = RENDER_SHADOW; + ent->render.flags = RENDER_SHADOW | RENDER_LIGHT; Matrix4x4_CreateFromQuakeEntity(&ent->render.matrix, 0, 0, 0, 0, 0, 0, 1); Matrix4x4_Invert_Simple(&ent->render.inversematrix, &ent->render.matrix); CL_BoundingBoxForEntity(&ent->render); @@ -807,6 +810,7 @@ void CL_ParseClientdata (int bits) cl.stats[STAT_CELLS] = MSG_ReadByte(); i = MSG_ReadByte (); + if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE) i = (1< 0) { - sprintf(temp, "%3i:%s ", cmdlog[i], cmdlogname[i]); - strcat(description, temp); + snprintf (temp, sizeof (temp), "%3i:%s ", cmdlog[i], cmdlogname[i]); + strlcat (description, temp, sizeof (description)); count--; i++; i &= 31; @@ -1550,7 +1572,7 @@ void CL_ParseServerMessage(void) i = MSG_ReadByte (); if (i >= MAX_LIGHTSTYLES) Host_Error ("svc_lightstyle >= MAX_LIGHTSTYLES"); - strncpy (cl_lightstyle[i].map, MSG_ReadString(), MAX_STYLESTRING - 1); + strlcpy (cl_lightstyle[i].map, MSG_ReadString(), sizeof (cl_lightstyle[i].map)); cl_lightstyle[i].map[MAX_STYLESTRING - 1] = 0; cl_lightstyle[i].length = strlen(cl_lightstyle[i].map); break; @@ -1572,7 +1594,7 @@ void CL_ParseServerMessage(void) i = MSG_ReadByte (); if (i >= cl.maxclients) Host_Error ("CL_ParseServerMessage: svc_updatename >= cl.maxclients"); - strcpy (cl.scores[i].name, MSG_ReadString ()); + strlcpy (cl.scores[i].name, MSG_ReadString (), sizeof (cl.scores[i].name)); break; case svc_updatefrags: @@ -1692,10 +1714,35 @@ void CL_ParseServerMessage(void) Cmd_ExecuteString ("help", src_command); break; case svc_hidelmp: - SHOWLMP_decodehide(); + if (gamemode == GAME_TENEBRAE) + { + // repeating particle effect + MSG_ReadCoord(); + MSG_ReadCoord(); + MSG_ReadCoord(); + MSG_ReadCoord(); + MSG_ReadCoord(); + MSG_ReadCoord(); + MSG_ReadByte(); + MSG_ReadLong(); + MSG_ReadLong(); + MSG_ReadString(); + } + else + SHOWLMP_decodehide(); break; case svc_showlmp: - SHOWLMP_decodeshow(); + if (gamemode == GAME_TENEBRAE) + { + // particle effect + MSG_ReadCoord(); + MSG_ReadCoord(); + MSG_ReadCoord(); + MSG_ReadByte(); + MSG_ReadString(); + } + else + SHOWLMP_decodeshow(); break; case svc_skybox: R_SetSkyBox(MSG_ReadString());