cl_parser aufgeräumt

This commit is contained in:
Yamagi Burmeister 2009-03-02 18:42:57 +00:00
parent 61b0a4c456
commit 6ca313230f

View file

@ -97,13 +97,11 @@ qboolean CL_CheckOrDownloadFile (char *filename)
COM_StripExtension (cls.downloadname, cls.downloadtempname); COM_StripExtension (cls.downloadname, cls.downloadtempname);
strcat (cls.downloadtempname, ".tmp"); strcat (cls.downloadtempname, ".tmp");
//ZOID //ZOID
// check to see if we already have a tmp for this file, if so, try to resume // check to see if we already have a tmp for this file, if so, try to resume
// open the file if not opened yet // open the file if not opened yet
CL_DownloadFileName(name, sizeof(name), cls.downloadtempname); CL_DownloadFileName(name, sizeof(name), cls.downloadtempname);
// FS_CreatePath (name);
fp = fopen (name, "r+b"); fp = fopen (name, "r+b");
if (fp) { // it exists if (fp) { // it exists
int len; int len;
@ -249,15 +247,6 @@ void CL_ParseDownload (void)
if (percent != 100) if (percent != 100)
{ {
// request next block // request next block
// change display routines by zoid
#if 0
Com_Printf (".");
if (10*(percent/10) != cls.downloadpercent)
{
cls.downloadpercent = 10*(percent/10);
Com_Printf ("%i%%", cls.downloadpercent);
}
#endif
cls.downloadpercent = percent; cls.downloadpercent = percent;
MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
@ -268,8 +257,6 @@ void CL_ParseDownload (void)
char oldn[MAX_OSPATH]; char oldn[MAX_OSPATH];
char newn[MAX_OSPATH]; char newn[MAX_OSPATH];
// Com_Printf ("100%%\n");
fclose (cls.download); fclose (cls.download);
// rename the temp file to it's final name // rename the temp file to it's final name
@ -309,13 +296,13 @@ void CL_ParseServerData (void)
int i; int i;
Com_DPrintf ("Serverdata packet received.\n"); Com_DPrintf ("Serverdata packet received.\n");
// //
// wipe the client_state_t struct // wipe the client_state_t struct
// //
CL_ClearState (); CL_ClearState ();
cls.state = ca_connected; cls.state = ca_connected;
// parse protocol version number // parse protocol version number
i = MSG_ReadLong (&net_message); i = MSG_ReadLong (&net_message);
cls.serverProtocol = i; cls.serverProtocol = i;
@ -409,10 +396,10 @@ void CL_LoadClientinfo (clientinfo_t *ci, char *s)
if (cl_noskins->value || *s == 0) if (cl_noskins->value || *s == 0)
{ {
Com_sprintf (model_filename, sizeof(model_filename), "players/male/tris.md2"); strcpy (model_filename, "players/male/tris.md2");
Com_sprintf (weapon_filename, sizeof(weapon_filename), "players/male/weapon.md2"); strcpy (weapon_filename, "players/male/weapon.md2");
Com_sprintf (skin_filename, sizeof(skin_filename), "players/male/grunt.pcx"); strcpy (skin_filename, "players/male/grunt.pcx");
Com_sprintf (ci->iconname, sizeof(ci->iconname), "/players/male/grunt_i.pcx"); strcpy (ci->iconname, "/players/male/grunt_i.pcx");
ci->model = re.RegisterModel (model_filename); ci->model = re.RegisterModel (model_filename);
memset(ci->weaponmodel, 0, sizeof(ci->weaponmodel)); memset(ci->weaponmodel, 0, sizeof(ci->weaponmodel));
ci->weaponmodel[0] = re.RegisterModel (weapon_filename); ci->weaponmodel[0] = re.RegisterModel (weapon_filename);
@ -605,17 +592,17 @@ void CL_ParseStartSoundPacket(void)
sound_num = MSG_ReadByte (&net_message); sound_num = MSG_ReadByte (&net_message);
if (flags & SND_VOLUME) if (flags & SND_VOLUME)
volume = MSG_ReadByte (&net_message) / 255.0; volume = MSG_ReadByte (&net_message) / 255.0f;
else else
volume = DEFAULT_SOUND_PACKET_VOLUME; volume = DEFAULT_SOUND_PACKET_VOLUME;
if (flags & SND_ATTENUATION) if (flags & SND_ATTENUATION)
attenuation = MSG_ReadByte (&net_message) / 64.0; attenuation = MSG_ReadByte (&net_message) / 64.0f;
else else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION; attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
if (flags & SND_OFFSET) if (flags & SND_OFFSET)
ofs = MSG_ReadByte (&net_message) / 1000.0; ofs = MSG_ReadByte (&net_message) / 1000.0f;
else else
ofs = 0; ofs = 0;
@ -667,18 +654,18 @@ void CL_ParseServerMessage (void)
char *s; char *s;
int i; int i;
// //
// if recording demos, copy the message out // if recording demos, copy the message out
// //
if (cl_shownet->value == 1) if (cl_shownet->value == 1)
Com_Printf ("%i ",net_message.cursize); Com_Printf ("%i ",net_message.cursize);
else if (cl_shownet->value >= 2) else if (cl_shownet->value >= 2)
Com_Printf ("------------------\n"); Com_Printf ("------------------\n");
// //
// parse the message // parse the message
// //
while (1) while (1)
{ {
if (net_message.readcount > net_message.cursize) if (net_message.readcount > net_message.cursize)
@ -703,7 +690,7 @@ void CL_ParseServerMessage (void)
SHOWNET(svc_strings[cmd]); SHOWNET(svc_strings[cmd]);
} }
// other commands // other commands
switch (cmd) switch (cmd)
{ {
default: default:
@ -711,7 +698,6 @@ void CL_ParseServerMessage (void)
break; break;
case svc_nop: case svc_nop:
// Com_Printf ("svc_nop\n");
break; break;
case svc_disconnect: case svc_disconnect:
@ -748,6 +734,11 @@ void CL_ParseServerMessage (void)
s = MSG_ReadString (&net_message); s = MSG_ReadString (&net_message);
Com_DPrintf ("stufftext: %s\n", s); Com_DPrintf ("stufftext: %s\n", s);
Cbuf_AddText (s); Cbuf_AddText (s);
if (!cl.attractloop || !strcmp(s, "precache\n"))
Cbuf_AddText (s);
else
Com_DPrintf ("WARNING: Demo tried to execute command, ignored.\n");
break; break;
case svc_serverdata: case svc_serverdata: