"svc_cutscene",
"svc_showlmp", // [string] iconlabel [string] lmpfile [short] x [short] y
"svc_hidelmp", // [string] iconlabel
- "", // 37
+ "svc_skybox", // [string] skyname
"", // 38
"", // 39
"", // 40
"", // 50
"svc_fog", // 51
"svc_effect", // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
- "svc_effect2", // [vector] org [short] modelindex [byte] startframe [byte] framecount [byte] framerate
+ "svc_effect2", // [vector] org [short] modelindex [short] startframe [byte] framecount [byte] framerate
};
//=============================================================================
+cvar_t demo_nehahra = {0, "demo_nehahra", "0"};
+
+void CL_Parse_Init(void)
+{
+ // LordHavoc: added demo_nehahra cvar
+ Cvar_RegisterVariable (&demo_nehahra);
+ if (nehahra)
+ Cvar_SetValue("demo_nehahra", 1);
+}
+
qboolean Nehahrademcompatibility; // LordHavoc: to allow playback of the early Nehahra movie segments
qboolean dpprotocol; // LordHavoc: whether or not the current network stream is the enhanced DarkPlaces protocol
memcpy (net_message.data, olddata, net_message.cursize);
// check time
- time = Sys_FloatTime ();
+ time = Sys_DoubleTime ();
if (time - lastmsg < 5)
return;
lastmsg = time;
SZ_Clear (&cls.message);
}
-extern qboolean isworldmodel;
-extern char skyname[];
-extern void R_SetSkyBox (char *sky);
-extern void FOG_clear();
-extern cvar_t r_farclip;
-
void CL_ParseEntityLump(char *entdata)
{
char *data;
char wadname[128];
int i, j, k;
FOG_clear(); // LordHavoc: no fog until set
- skyname[0] = 0; // LordHavoc: no enviroment mapped sky until set
+ R_SetSkyBox(""); // LordHavoc: no environment mapped sky until set
r_farclip.value = 6144; // LordHavoc: default farclip distance
data = entdata;
if (!data)
CL_ParseServerInfo
==================
*/
-extern cvar_t demo_nehahra;
void CL_ParseServerInfo (void)
{
char *str;
// needlessly purge it
//
+ Hunk_Check ();
+
// precache models
memset (cl.model_precache, 0, sizeof(cl.model_precache));
for (nummodels=1 ; ; nummodels++)
Host_Error ("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1);
strcpy (model_precache[nummodels], str);
Mod_TouchModel (str);
+
+// Hunk_Check ();
+
}
// precache sounds
// now we try to load everything else until a cache allocation fails
//
+ Hunk_Check ();
+
for (i=1 ; i<nummodels ; i++)
{
isworldmodel = i == 1; // LordHavoc: first model is the world model
cl.model_precache[i] = Mod_ForName (model_precache[i], false);
+
+// Hunk_Check ();
+
if (cl.model_precache[i] == NULL)
{
Con_Printf("Model %s not found\n", model_precache[i]);
CL_KeepaliveMessage ();
}
+ Hunk_Check ();
+
S_BeginPrecaching ();
for (i=1 ; i<numsounds ; i++)
{
// local state
cl_entities[0].render.model = cl.worldmodel = cl.model_precache[1];
-
+
+// Hunk_Check ();
+
R_NewMap ();
Hunk_Check (); // make sure nothing is hurt
-
- noclip_anglehack = false; // noclip is turned off at start
+
+ noclip_anglehack = false; // noclip is turned off at start
}
void CL_ValidateState(entity_state_t *s)
==================
*/
byte entkill[MAX_EDICTS];
+int bitprofile[32], bitprofilecount = 0;
void CL_ParseUpdate (int bits)
{
- int num, deltadie;
+ int i, num, deltadie;
entity_t *ent;
if (cls.signon == SIGNONS - 1)
ent = CL_EntityNum (num);
+ for (i = 0;i < 32;i++)
+ if (bits & (1 << i))
+ bitprofile[i]++;
+ bitprofilecount++;
+
ent->state_previous = ent->state_current;
deltadie = false;
if (bits & U_DELTA)
if (bits & U_FRAME2) ent->state_current.frame = (ent->state_current.frame & 0x00FF) | (MSG_ReadByte() << 8);
if (bits & U_MODEL2) ent->state_current.modelindex = (ent->state_current.modelindex & 0x00FF) | (MSG_ReadByte() << 8);
if (bits & U_VIEWMODEL) ent->state_current.flags |= RENDER_VIEWMODEL;
+ if (bits & U_EXTERIORMODEL) ent->state_current.flags |= RENDER_EXTERIORMODEL;
// LordHavoc: to allow playback of the Nehahra movie
if (Nehahrademcompatibility && (bits & U_EXTEND1))
}
}
-void CL_EntityUpdateSetup()
+char *bitprofilenames[32] =
{
- memset(entkill, 1, MAX_EDICTS);
+ "U_MOREBITS",
+ "U_ORIGIN1",
+ "U_ORIGIN2",
+ "U_ORIGIN3",
+ "U_ANGLE2",
+ "U_STEP",
+ "U_FRAME",
+ "U_SIGNAL",
+ "U_ANGLE1",
+ "U_ANGLE3",
+ "U_MODEL",
+ "U_COLORMAP",
+ "U_SKIN",
+ "U_EFFECTS",
+ "U_LONGENTITY",
+ "U_EXTEND1",
+ "U_DELTA",
+ "U_ALPHA",
+ "U_SCALE",
+ "U_EFFECTS2",
+ "U_GLOWSIZE",
+ "U_GLOWCOLOR",
+ "U_COLORMOD",
+ "U_EXTEND2",
+ "U_GLOWTRAIL",
+ "U_VIEWMODEL",
+ "U_FRAME2",
+ "U_MODEL2",
+ "U_EXTERIORMODEL",
+ "U_UNUSED29",
+ "U_UNUSED30",
+ "U_EXTEND3",
+};
+
+void CL_BitProfile_f(void)
+{
+ int i;
+ Con_Printf("bitprofile: %i updates\n");
+ if (bitprofilecount)
+ for (i = 0;i < 32;i++)
+// if (bitprofile[i])
+ Con_Printf("%s: %i %3.2f%%\n", bitprofilenames[i], bitprofile[i], bitprofile[i] * 100.0 / bitprofilecount);
+ Con_Printf("\n");
+ for (i = 0;i < 32;i++)
+ bitprofile[i] = 0;
+ bitprofilecount = 0;
}
-int entityupdatestart;
-void CL_EntityUpdateBegin(int start)
+void CL_EntityUpdateSetup(void)
{
- if (start < 0 || start >= MAX_EDICTS)
- Host_Error("CL_EntityUpdateBegin: start (%i) < 0 or >= MAX_EDICTS (%i)\n", start, MAX_EDICTS);
- entityupdatestart = start;
+ memset(entkill, 1, MAX_EDICTS);
}
-void CL_EntityUpdateEnd(int end)
+void CL_EntityUpdateEnd(void)
{
int i;
- if (end < 0 || end > MAX_EDICTS)
- Host_Error("CL_EntityUpdateEnd: end (%i) < 0 or > MAX_EDICTS (%i)\n", end, MAX_EDICTS);
- for (i = entityupdatestart;i < end;i++)
+ for (i = 1;i < MAX_EDICTS;i++)
if (entkill[i])
cl_entities[i].state_previous.active = cl_entities[i].state_current.active = 0;
}
CL_ParseBaseline
==================
*/
-void CL_ParseBaseline (entity_t *ent, int largemodelindex)
+void CL_ParseBaseline (entity_t *ent, int large)
{
int i;
memset(&ent->state_baseline, 0, sizeof(entity_state_t));
ent->state_baseline.active = true;
- if (largemodelindex)
+ if (large)
+ {
ent->state_baseline.modelindex = (unsigned short) MSG_ReadShort ();
+ ent->state_baseline.frame = (unsigned short) MSG_ReadShort ();
+ }
else
+ {
ent->state_baseline.modelindex = MSG_ReadByte ();
- ent->state_baseline.frame = MSG_ReadByte ();
+ ent->state_baseline.frame = MSG_ReadByte ();
+ }
ent->state_baseline.colormap = MSG_ReadByte();
ent->state_baseline.skin = MSG_ReadByte();
for (i = 0;i < 3;i++)
CL_ParseStatic
=====================
*/
-void CL_ParseStatic (int largemodelindex)
+void CL_ParseStatic (int large)
{
entity_t *ent;
if (cl.num_statics >= MAX_STATIC_ENTITIES)
Host_Error ("Too many static entities");
ent = &cl_static_entities[cl.num_statics++];
- CL_ParseBaseline (ent, largemodelindex);
+ CL_ParseBaseline (ent, large);
// copy it to the current state
ent->render.model = cl.model_precache[ent->state_baseline.modelindex];
ent->render.alpha = 1;
ent->render.scale = 1;
ent->render.alpha = 1;
- ent->render.glowsize = 0;
- ent->render.glowcolor = 254;
ent->render.colormod[0] = ent->render.colormod[1] = ent->render.colormod[2] = 1;
VectorCopy (ent->state_baseline.origin, ent->render.origin);
VectorCopy (ent->state_baseline.angles, ent->render.angles);
-// R_AddEfrags (ent);
}
/*
CL_ParseStaticSound
===================
*/
-void CL_ParseStaticSound (void)
+void CL_ParseStaticSound (int large)
{
vec3_t org;
int sound_num, vol, atten;
MSG_ReadVector(org);
- sound_num = MSG_ReadByte ();
+ if (large)
+ sound_num = (unsigned short) MSG_ReadShort ();
+ else
+ sound_num = MSG_ReadByte ();
vol = MSG_ReadByte ();
atten = MSG_ReadByte ();
MSG_ReadVector(org);
modelindex = MSG_ReadShort ();
- startframe = MSG_ReadByte ();
+ startframe = MSG_ReadShort ();
framecount = MSG_ReadByte ();
framerate = MSG_ReadByte ();
#define SHOWNET(x) if(cl_shownet.value==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x);
-extern void SHOWLMP_decodehide();
-extern void SHOWLMP_decodeshow();
-extern void R_SetSkyBox(char* sky);
-extern int netshown;
-
/*
=====================
CL_ParseServerMessage
void CL_ParseServerMessage (void)
{
int cmd;
- int i, updateend;
+ int i, entitiesupdated;
byte cmdlog[32];
char *cmdlogname[32], *temp;
int cmdindex, cmdcount = 0;
// if recording demos, copy the message out
//
if (cl_shownet.value == 1)
- {
Con_Printf ("%i ",net_message.cursize);
- netshown = true;
- }
else if (cl_shownet.value == 2)
- {
Con_Printf ("------------------\n");
- netshown = true;
- }
cl.onground = false; // unless the server says otherwise
//
//
MSG_BeginReading ();
- updateend = false;
+ entitiesupdated = false;
CL_EntityUpdateSetup();
while (1)
i &= 31;
}
description[strlen(description)-1] = '\n'; // replace the last space with a newline
- Con_Printf(description);
+ Con_Printf("%s", description);
Host_Error ("CL_ParseServerMessage: Illegible server message\n");
}
break;
case svc_time:
// handle old protocols which do not have entity update ranges
- CL_EntityUpdateBegin(1);
- updateend = true;
+ entitiesupdated = true;
cl.mtime[1] = cl.mtime[0];
cl.mtime[0] = MSG_ReadFloat ();
break;
case svc_spawnbaseline2:
i = MSG_ReadShort ();
// must use CL_EntityNum() to force cl.num_entities up
- CL_ParseBaseline (CL_EntityNum(i), false);
+ CL_ParseBaseline (CL_EntityNum(i), true);
break;
case svc_spawnstatic:
CL_ParseStatic (false);
break;
case svc_spawnstaticsound:
- CL_ParseStaticSound ();
+ CL_ParseStaticSound (false);
+ break;
+
+ case svc_spawnstaticsound2:
+ CL_ParseStaticSound (true);
break;
case svc_cdtrack:
case svc_showlmp:
SHOWLMP_decodeshow();
break;
- case svc_entitiesbegin:
- // the beginning of an entity update range
- CL_EntityUpdateBegin((unsigned) MSG_ReadShort());
- break;
- case svc_entitiesend:
- // the end of an entity update range
- CL_EntityUpdateEnd((unsigned) MSG_ReadShort());
- updateend = false;
+ case svc_skybox:
+ R_SetSkyBox(MSG_ReadString());
break;
}
}
- if (updateend)
- CL_EntityUpdateEnd(MAX_EDICTS);
+ if (entitiesupdated)
+ CL_EntityUpdateEnd();
}
-