]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_parse.c
another bugfix for WORKINGLQUAKE code
[xonotic/darkplaces.git] / cl_parse.c
index 06fa7d134c59d395182ef28ab18ccf76ffbca068..b63a017a1cbf28fcefc7420ebbadd8b41fc5cdf2 100644 (file)
@@ -291,8 +291,6 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
                }
 
                MSG_WriteByte (&cls.message, clc_stringcmd);
-               //sprintf (str, "spawn %s", cls.spawnparms);
-               //MSG_WriteString (&cls.message, str);
                MSG_WriteString (&cls.message, "spawn");
                break;
 
@@ -332,7 +330,7 @@ void CL_ParseServerInfo (void)
        i = MSG_ReadLong ();
        if (i != PROTOCOL_VERSION && i != DPPROTOCOL_VERSION1 && i != DPPROTOCOL_VERSION2 && i != DPPROTOCOL_VERSION3 && i != 250)
        {
-               Con_Printf ("Server is protocol %i, not %i, %i, %i or %i", i, DPPROTOCOL_VERSION1, DPPROTOCOL_VERSION2, DPPROTOCOL_VERSION3, PROTOCOL_VERSION);
+               Host_Error ("Server is protocol %i, not %i, %i, %i or %i", i, DPPROTOCOL_VERSION1, DPPROTOCOL_VERSION2, DPPROTOCOL_VERSION3, PROTOCOL_VERSION);
                return;
        }
        Nehahrademcompatibility = false;
@@ -512,7 +510,7 @@ void CL_MoveLerpEntityStates(entity_t *ent)
                // monster interpolation
                if (DotProduct(odelta, odelta) + DotProduct(adelta, adelta) > 0.01)
                {
-                       ent->persistent.lerpdeltatime = cl.time - ent->persistent.lerpstarttime;
+                       ent->persistent.lerpdeltatime = bound(0, cl.mtime[1] - ent->persistent.lerpstarttime, 0.1);
                        ent->persistent.lerpstarttime = cl.mtime[1];
                        VectorCopy(ent->persistent.neworigin, ent->persistent.oldorigin);
                        VectorCopy(ent->persistent.newangles, ent->persistent.oldangles);
@@ -1178,7 +1176,7 @@ void CL_ParseTempEntity (void)
                // rocket explosion
                MSG_ReadVector(pos);
                Mod_FindNonSolidLocation(pos, cl.worldmodel);
-               CL_ParticleExplosion (pos, false);
+               CL_ParticleExplosion (pos);
                // LordHavoc: boosted color from 1.0, 0.8, 0.4 to 1.25, 1.0, 0.5
                CL_AllocDlight (NULL, pos, 350, 1.25f, 1.0f, 0.5f, 700, 0.5);
                S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
@@ -1188,7 +1186,7 @@ void CL_ParseTempEntity (void)
                // quad rocket explosion
                MSG_ReadVector(pos);
                Mod_FindNonSolidLocation(pos, cl.worldmodel);
-               CL_ParticleExplosion (pos, false);
+               CL_ParticleExplosion (pos);
                CL_AllocDlight (NULL, pos, 600, 0.5f, 0.4f, 1.0f, 1200, 0.5);
                S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
                break;
@@ -1197,7 +1195,7 @@ void CL_ParseTempEntity (void)
                // Nehahra movie colored lighting explosion
                MSG_ReadVector(pos);
                Mod_FindNonSolidLocation(pos, cl.worldmodel);
-               CL_ParticleExplosion (pos, false);
+               CL_ParticleExplosion (pos);
                CL_AllocDlight (NULL, pos, 350, MSG_ReadCoord(), MSG_ReadCoord(), MSG_ReadCoord(), 700, 0.5);
                S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
                break;
@@ -1206,7 +1204,7 @@ void CL_ParseTempEntity (void)
                // colored lighting explosion
                MSG_ReadVector(pos);
                Mod_FindNonSolidLocation(pos, cl.worldmodel);
-               CL_ParticleExplosion (pos, false);
+               CL_ParticleExplosion (pos);
                color[0] = MSG_ReadByte() * (1.0 / 255.0);
                color[1] = MSG_ReadByte() * (1.0 / 255.0);
                color[2] = MSG_ReadByte() * (1.0 / 255.0);
@@ -1306,13 +1304,46 @@ void CL_ParseTempEntity (void)
                colorStart = MSG_ReadByte ();
                colorLength = MSG_ReadByte ();
                CL_ParticleExplosion2 (pos, colorStart, colorLength);
-               tempcolor = (qbyte *)&d_8to24table[(rand()%colorLength) + colorStart];
+               tempcolor = (qbyte *)&palette_complete[(rand()%colorLength) + colorStart];
                CL_AllocDlight (NULL, pos, 350, tempcolor[0] * (1.0f / 255.0f), tempcolor[1] * (1.0f / 255.0f), tempcolor[2] * (1.0f / 255.0f), 700, 0.5);
                S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
                break;
 
+       case TE_TEI_G3:
+               MSG_ReadVector(pos);
+               MSG_ReadVector(pos2);
+               MSG_ReadVector(dir);
+               CL_BeamParticle(pos, pos2, 12, 1, 0.3, 0.1, 1, 1);
+               CL_BeamParticle(pos, pos2, 5, 1, 0.9, 0.3, 1, 1);
+               break;
+
+       case TE_TEI_SMOKE:
+               MSG_ReadVector(pos);
+               MSG_ReadVector(dir);
+               count = MSG_ReadByte ();
+               Mod_FindNonSolidLocation(pos, cl.worldmodel);
+               CL_Tei_Smoke(pos, dir, count);
+               break;
+
+       case TE_TEI_BIGEXPLOSION:
+               MSG_ReadVector(pos);
+               Mod_FindNonSolidLocation(pos, cl.worldmodel);
+               CL_ParticleExplosion (pos);
+               CL_AllocDlight (NULL, pos, 500, 1.25f, 1.0f, 0.5f, 500, 9999);
+               S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
+               break;
+
+       case TE_TEI_PLASMAHIT:
+               MSG_ReadVector(pos);
+               MSG_ReadVector(dir);
+               count = MSG_ReadByte ();
+               Mod_FindNonSolidLocation(pos, cl.worldmodel);
+               CL_Tei_PlasmaHit(pos, dir, count);
+               CL_AllocDlight (NULL, pos, 500, 0.3, 0.6, 1.0f, 2000, 9999);
+               break;
+
        default:
-               Host_Error ("CL_ParseTempEntity: bad type %d", type);
+               Host_Error ("CL_ParseTempEntity: bad type %d (hex %02X)", type, type);
        }
 }
 
@@ -1325,6 +1356,7 @@ static qbyte cgamenetbuffer[65536];
 CL_ParseServerMessage
 =====================
 */
+int parsingerror = false;
 void CL_ParseServerMessage (void)
 {
        int                     cmd;
@@ -1349,6 +1381,8 @@ void CL_ParseServerMessage (void)
 
        entitiesupdated = false;
 
+       parsingerror = true;
+
        while (1)
        {
                if (msg_badread)
@@ -1669,6 +1703,17 @@ void CL_ParseServerMessage (void)
 
        if (entitiesupdated)
                CL_EntityUpdateEnd();
+
+       parsingerror = false;
+}
+
+void CL_Parse_DumpPacket(void)
+{
+       if (!parsingerror)
+               return;
+       Con_Printf("Packet dump:\n");
+       SZ_HexDumpToConsole(&net_message);
+       parsingerror = false;
 }
 
 void CL_Parse_Init(void)