"svc_entities", // 57 // [int] deltaframe [int] thisframe [float vector] eye [variable length] entitydata
"svc_csqcentities", // 58 // [short] entnum [variable length] entitydata ... [short] 0x0000
"svc_spawnstaticsound2", // 59 // [coord3] [short] samp [byte] vol [byte] aten
+ "svc_trailparticles", // 60 // [short] entnum [short] effectnum [vector] start [vector] end
+ "svc_pointparticles", // 61 // [short] effectnum [vector] start [vector] velocity [short] count
+ "svc_pointparticles1", // 62 // [short] effectnum [vector] start, same as svc_pointparticles except velocity is zero and count is 1
};
char *qw_svc_strings[128] =
cvar_t cl_sound_ric1 = {0, "cl_sound_ric1", "weapons/ric1.wav", "sound to play with 5% chance during TE_SPIKE/TE_SUPERSPIKE (empty cvar disables sound)"};
cvar_t cl_sound_ric2 = {0, "cl_sound_ric2", "weapons/ric2.wav", "sound to play with 5% chance during TE_SPIKE/TE_SUPERSPIKE (empty cvar disables sound)"};
cvar_t cl_sound_ric3 = {0, "cl_sound_ric3", "weapons/ric3.wav", "sound to play with 10% chance during TE_SPIKE/TE_SUPERSPIKE (empty cvar disables sound)"};
+cvar_t cl_readpicture_force = {0, "cl_readpicture_force", "0", "when enabled, the low quality pictures read by ReadPicture() are preferred over the high quality pictures on the file system"};
#define RIC_GUNSHOT 1
#define RIC_GUNSHOTQUAD 2
//static qboolean QW_CL_IsUploading(void);
static void QW_CL_StopUpload(void);
void CL_VM_UpdateIntermissionState(int intermission);
-qboolean CL_VM_Event_Sound(int sound_num, int volume, int channel, float attenuation, int ent, vec3_t pos);
+qboolean CL_VM_Event_Sound(int sound_num, float volume, int channel, float attenuation, int ent, vec3_t pos);
/*
==================
else if (!strcmp("qlsky", key)) // non-standard, introduced by QuakeLives (EEK)
R_SetSkyBox(value);
else if (!strcmp("fog", key))
- sscanf(value, "%f %f %f %f", &r_refdef.fog_density, &r_refdef.fog_red, &r_refdef.fog_green, &r_refdef.fog_blue);
+ {
+ r_refdef.fog_start = 0;
+ r_refdef.fog_alpha = 1;
+ r_refdef.fog_end = 16384;
+#if _MSC_VER >= 1400
+#define sscanf sscanf_s
+#endif
+ sscanf(value, "%f %f %f %f %f %f %f", &r_refdef.fog_density, &r_refdef.fog_red, &r_refdef.fog_green, &r_refdef.fog_blue, &r_refdef.fog_alpha, &r_refdef.fog_start, &r_refdef.fog_end);
+ }
else if (!strcmp("fog_density", key))
r_refdef.fog_density = atof(value);
else if (!strcmp("fog_red", key))
r_refdef.fog_green = atof(value);
else if (!strcmp("fog_blue", key))
r_refdef.fog_blue = atof(value);
+ else if (!strcmp("fog_alpha", key))
+ r_refdef.fog_alpha = atof(value);
+ else if (!strcmp("fog_start", key))
+ r_refdef.fog_start = atof(value);
+ else if (!strcmp("fog_end", key))
+ r_refdef.fog_end = atof(value);
}
}
extern void CL_Locs_Reload_f(void);
extern void CL_VM_Init (void);
+static const vec3_t defaultmins = {-4096, -4096, -4096};
+static const vec3_t defaultmaxs = {4096, 4096, 4096};
static void CL_SetupWorldModel(void)
{
// update the world model
// set up csqc world for collision culling
if (cl.worldmodel)
- {
- VectorCopy(cl.worldmodel->normalmins, cl.world.areagrid_mins);
- VectorCopy(cl.worldmodel->normalmaxs, cl.world.areagrid_maxs);
- }
+ World_SetSize(&cl.world, cl.worldmodel->name, cl.worldmodel->normalmins, cl.worldmodel->normalmaxs);
else
- {
- VectorSet(cl.world.areagrid_mins, -4096, -4096, -4096);
- VectorSet(cl.world.areagrid_maxs, 4096, 4096, 4096);
- }
- World_Clear(&cl.world);
+ World_SetSize(&cl.world, "", defaultmins, defaultmaxs);
// load or reload .loc file for team chat messages
CL_Locs_Reload_f();
if (cl.loadcsqc)
{
cl.loadcsqc = false;
+
CL_VM_Init();
}
}
qfile_t *file;
// see if the file already exists
- file = FS_Open(filename, "rb", true, false);
+ file = FS_OpenVirtualFile(filename, true);
if (file)
{
FS_Close(file);
cls.qw_downloadtype = dl_none;
- // parse the Q3 shader files
- Mod_LoadQ3Shaders();
-
// touch all of the precached models that are still loaded so we can free
// anything that isn't needed
if (!sv.active)
&& !FS_FileExists(va("dlcache/%s.%i.%i", csqc_progname.string, csqc_progsize.integer, csqc_progcrc.integer)))
{
Con_Printf("Downloading new CSQC code to dlcache/%s.%i.%i\n", csqc_progname.string, csqc_progsize.integer, csqc_progcrc.integer);
- Cmd_ForwardStringToServer(va("download %s", csqc_progname.string));
+ if(cl_serverextension_download.integer == 2 && FS_HasZlib())
+ Cmd_ForwardStringToServer(va("download %s deflate", csqc_progname.string));
+ else
+ Cmd_ForwardStringToServer(va("download %s", csqc_progname.string));
return;
}
}
{
// loading models
- // parse the Q3 shader files
- if (cl.loadmodel_current < 2)
- Mod_LoadQ3Shaders();
-
for (;cl.loadmodel_current < cl.loadmodel_total;cl.loadmodel_current++)
{
if (cl.model_precache[cl.loadmodel_current] && cl.model_precache[cl.loadmodel_current]->Draw)
// finished loading sounds
}
+ if(gamemode == GAME_NEXUIZ)
+ Cvar_SetValueQuick(&cl_serverextension_download, false);
+ // in Nexuiz, the built in download protocol is kinda broken (misses lots
+ // of dependencies) anyway, and can mess around with the game directory;
+ // until this is fixed, only support pk3 downloads via curl, and turn off
+ // individual file downloads other than for CSQC
+ // on the other end of the download protocol, GAME_NEXUIZ enforces writing
+ // to dlcache only
+ // idea: support download of pk3 files using this protocol later
+
// note: the reason these loops skip already-loaded things is that it
// enables this command to be issued during the game if desired
continue;
if (cls.signon < SIGNONS)
CL_KeepaliveMessage(true);
- if (!FS_FileExists(cl.model_name[cl.downloadmodel_current]))
+ if (strcmp(cl.model_name[cl.downloadmodel_current], "null") && !FS_FileExists(cl.model_name[cl.downloadmodel_current]))
{
if (cl.downloadmodel_current == 1)
Con_Printf("Map %s not found\n", cl.model_name[cl.downloadmodel_current]);
if (cl.downloadmodel_current == 1)
{
// we now have the worldmodel so we can set up the game world
+ // or maybe we do not have it (cl_serverextension_download 0)
+ // then we need to continue loading ANYWAY!
CL_SetupWorldModel();
if (!cl.loadfinished && cl_joinbeforedownloadsfinish.integer)
{
// prevent cl_begindownloads from being issued multiple times in one match
// to prevent accidentally cancelled downloads
if(cl.loadbegun)
- Con_DPrintf("cl_begindownloads is only valid once per match\n");
+ Con_Printf("cl_begindownloads is only valid once per match\n");
else
CL_BeginDownloads(false);
}
size_t existingsize;
const char *extension;
- // finished file
- // save to disk only if we don't already have it
- // (this is mainly for playing back demos)
- existingcrc = FS_CRCFile(cls.qw_downloadname, &existingsize);
- if (existingsize)
+ if(cls.qw_download_deflate)
+ {
+ unsigned char *out;
+ size_t inflated_size;
+ out = FS_Inflate(cls.qw_downloadmemory, cls.qw_downloadmemorycursize, &inflated_size, tempmempool);
+ Mem_Free(cls.qw_downloadmemory);
+ Con_Printf("Inflated download: new size: %u (%g%%)\n", (unsigned)inflated_size, 100.0 - 100.0*(cls.qw_downloadmemorycursize / (float)inflated_size));
+ cls.qw_downloadmemory = out;
+ cls.qw_downloadmemorycursize = inflated_size;
+ }
+
+ if(!cls.qw_downloadmemory)
+ {
+ Con_Printf("Download \"%s\" is corrupt (see above!)\n", cls.qw_downloadname);
+ }
+ else
{
- if ((int)existingsize != size || existingcrc != crc)
+ crc = CRC_Block(cls.qw_downloadmemory, cls.qw_downloadmemorycursize);
+ size = cls.qw_downloadmemorycursize;
+ // finished file
+ // save to disk only if we don't already have it
+ // (this is mainly for playing back demos)
+ existingcrc = FS_CRCFile(cls.qw_downloadname, &existingsize);
+ if (existingsize || gamemode == GAME_NEXUIZ || !strcmp(cls.qw_downloadname, csqc_progname.string))
+ // let csprogs ALWAYS go to dlcache, to prevent "viral csprogs"; also, never put files outside dlcache for Nexuiz
{
- // we have a mismatching file, pick another name for it
- char name[MAX_QPATH*2];
- dpsnprintf(name, sizeof(name), "dlcache/%s.%i.%i", cls.qw_downloadname, size, crc);
- if (!FS_FileExists(name))
+ if ((int)existingsize != size || existingcrc != crc)
{
- Con_Printf("Downloaded \"%s\" (%i bytes, %i CRC)\n", name, size, crc);
- FS_WriteFile(name, cls.qw_downloadmemory, cls.qw_downloadmemorycursize);
+ // we have a mismatching file, pick another name for it
+ char name[MAX_QPATH*2];
+ dpsnprintf(name, sizeof(name), "dlcache/%s.%i.%i", cls.qw_downloadname, size, crc);
+ if (!FS_FileExists(name))
+ {
+ Con_Printf("Downloaded \"%s\" (%i bytes, %i CRC)\n", name, size, crc);
+ FS_WriteFile(name, cls.qw_downloadmemory, cls.qw_downloadmemorycursize);
+ }
}
}
- }
- else
- {
- // we either don't have it or have a mismatching file...
- // so it's time to accept the file
- // but if we already have a mismatching file we need to rename
- // this new one, and if we already have this file in renamed form,
- // we do nothing
- Con_Printf("Downloaded \"%s\" (%i bytes, %i CRC)\n", cls.qw_downloadname, size, crc);
- FS_WriteFile(cls.qw_downloadname, cls.qw_downloadmemory, cls.qw_downloadmemorycursize);
- extension = FS_FileExtension(cls.qw_downloadname);
- if (!strcasecmp(extension, "pak") || !strcasecmp(extension, "pk3"))
- FS_Rescan();
+ else
+ {
+ // we either don't have it or have a mismatching file...
+ // so it's time to accept the file
+ // but if we already have a mismatching file we need to rename
+ // this new one, and if we already have this file in renamed form,
+ // we do nothing
+ Con_Printf("Downloaded \"%s\" (%i bytes, %i CRC)\n", cls.qw_downloadname, size, crc);
+ FS_WriteFile(cls.qw_downloadname, cls.qw_downloadmemory, cls.qw_downloadmemorycursize);
+ extension = FS_FileExtension(cls.qw_downloadname);
+ if (!strcasecmp(extension, "pak") || !strcasecmp(extension, "pk3"))
+ FS_Rescan();
+ }
}
}
else if (cls.qw_downloadmemory && size)
// we're really beginning a download now, so initialize stuff
strlcpy(cls.qw_downloadname, Cmd_Argv(2), sizeof(cls.qw_downloadname));
cls.qw_downloadmemorymaxsize = size;
- cls.qw_downloadmemory = Mem_Alloc(cls.permanentmempool, cls.qw_downloadmemorymaxsize);
+ cls.qw_downloadmemory = (unsigned char *) Mem_Alloc(cls.permanentmempool, cls.qw_downloadmemorymaxsize);
cls.qw_downloadnumber++;
+ cls.qw_download_deflate = false;
+ if(Cmd_Argc() >= 4)
+ {
+ if(!strcmp(Cmd_Argv(3), "deflate"))
+ cls.qw_download_deflate = true;
+ // check further encodings here
+ }
+
Cmd_ForwardStringToServer("sv_startdownload");
}
void CL_StopDownload_f(void)
{
+ Curl_CancelAll();
if (cls.qw_downloadname[0])
{
Con_Printf("Download of %s aborted\n", cls.qw_downloadname);
*/
static void CL_SignonReply (void)
{
- Con_DPrintf("CL_SignonReply: %i\n", cls.signon);
+ if (developer.integer >= 100)
+ Con_Printf("CL_SignonReply: %i\n", cls.signon);
switch (cls.signon)
{
cl.movevars_wallfriction = 0;
cl.movevars_timescale = 1;
cl.movevars_jumpvelocity = 270;
- cl.movevars_edgefriction = 2;
+ cl.movevars_edgefriction = 1;
cl.movevars_maxairspeed = 30;
cl.movevars_stepheight = 18;
cl.movevars_airaccel_qw = 1;
// parse gametype
cl.gametype = MSG_ReadByte ();
+ // the original id singleplayer demos are bugged and contain
+ // GAME_DEATHMATCH even for singleplayer
+ if (cl.maxclients == 1 && cls.protocol == PROTOCOL_QUAKE)
+ cl.gametype = GAME_COOP;
// parse signon message
str = MSG_ReadString ();
Con_Printf ("Auto-recording to %s.\n", demofile);
- cls.demofile = FS_Open (demofile, "wb", false, false);
+ cls.demofile = FS_OpenRealFile(demofile, "wb", false);
if (cls.demofile)
{
cls.forcetrack = -1;
FS_Printf (cls.demofile, "%i\n", cls.forcetrack);
cls.demorecording = true;
+ strlcpy(cls.demoname, demofile, sizeof(cls.demoname));
+ cls.demo_lastcsprogssize = -1;
+ cls.demo_lastcsprogscrc = -1;
}
else
Con_Print ("ERROR: couldn't open.\n");
void CL_ValidateState(entity_state_t *s)
{
- model_t *model;
+ dp_model_t *model;
if (!s->active)
return;
// (this used to happen, sometimes affecting skin and frame)
// colormap is client index + 1
- if ((!s->flags & RENDER_COLORMAPPED) && s->colormap > cl.maxclients)
+ if (!(s->flags & RENDER_COLORMAPPED) && s->colormap > cl.maxclients)
Con_DPrintf("CL_ValidateState: colormap (%i) > cl.maxclients (%i)\n", s->colormap, cl.maxclients);
model = cl.model_precache[s->modelindex];
ent->render.framelerp = 0;
// make torchs play out of sync
ent->render.frame1time = ent->render.frame2time = lhrandom(-10, -1);
- ent->render.colormap = -1; // no special coloring
ent->render.skinnum = ent->state_baseline.skin;
ent->render.effects = ent->state_baseline.effects;
ent->render.alpha = 1;
CL_Effect(org, modelindex, startframe, framecount, framerate);
}
-void CL_NewBeam (int ent, vec3_t start, vec3_t end, model_t *m, int lightning)
+void CL_NewBeam (int ent, vec3_t start, vec3_t end, dp_model_t *m, int lightning)
{
int i;
beam_t *b = NULL;
Con_Print("beam list overflow!\n");
}
-void CL_ParseBeam (model_t *m, int lightning)
+void CL_ParseBeam (dp_model_t *m, int lightning)
{
int ent;
vec3_t start, end;
colorStart = MSG_ReadByte();
colorLength = MSG_ReadByte();
CL_ParticleExplosion2(pos, colorStart, colorLength);
- tempcolor = (unsigned char *)&palette_complete[(rand()%colorLength) + colorStart];
+ tempcolor = palette_rgb[(rand()%colorLength) + colorStart];
color[0] = tempcolor[0] * (2.0f / 255.0f);
color[1] = tempcolor[1] * (2.0f / 255.0f);
color[2] = tempcolor[2] * (2.0f / 255.0f);
{
cl_iplog_item_t *olditems = cl_iplog_items;
cl_iplog_maxitems = max(1024, cl_iplog_maxitems + 256);
- cl_iplog_items = Mem_Alloc(cls.permanentmempool, cl_iplog_maxitems * sizeof(cl_iplog_item_t));
+ cl_iplog_items = (cl_iplog_item_t *) Mem_Alloc(cls.permanentmempool, cl_iplog_maxitems * sizeof(cl_iplog_item_t));
if (olditems)
{
if (cl_iplog_numitems)
Mem_Free(olditems);
}
}
- cl_iplog_items[cl_iplog_numitems].address = Mem_Alloc(cls.permanentmempool, strlen(address) + 1);
- cl_iplog_items[cl_iplog_numitems].name = Mem_Alloc(cls.permanentmempool, strlen(name) + 1);
+ cl_iplog_items[cl_iplog_numitems].address = (char *) Mem_Alloc(cls.permanentmempool, strlen(address) + 1);
+ cl_iplog_items[cl_iplog_numitems].name = (char *) Mem_Alloc(cls.permanentmempool, strlen(name) + 1);
strlcpy(cl_iplog_items[cl_iplog_numitems].address, address, strlen(address) + 1);
// TODO: maybe it would be better to strip weird characters from name when
// copying it here rather than using a straight strcpy?
text++;
if (line[0] == '/' && line[1] == '/')
continue; // skip comments if anyone happens to add them
- for (i = 0;i < len && line[i] > ' ';i++)
+ for (i = 0;i < len && !ISWHITESPACE(line[i]);i++)
address[i] = line[i];
address[i] = 0;
// skip exactly one space character
}
extern cvar_t slowmo;
+extern void CSQC_UpdateNetworkTimes(double newtime, double oldtime);
static void CL_NetworkTimeReceived(double newtime)
{
double timehigh;
}
// this packet probably contains a player entity update, so we will need
// to update the prediction
- cl.movement_needupdate = true;
+ cl.movement_replay = true;
// this may get updated later in parsing by svc_clientdata
cl.onground = false;
// if true the cl.viewangles are interpolated from cl.mviewangles[]
cl.fixangle[0] = false;
if (!cls.demoplayback)
VectorCopy(cl.mviewangles[0], cl.mviewangles[1]);
+ // update the csqc's server timestamps, critical for proper sync
+ CSQC_UpdateNetworkTimes(cl.mtime[0], cl.mtime[1]);
}
-#define SHOWNET(x) if(cl_shownet.integer==2)Con_Printf("%3i:%s\n", msg_readcount-1, x);
+#define SHOWNET(x) if(cl_shownet.integer==2)Con_Printf("%3i:%s(%i)\n", msg_readcount-1, x, cmd);
//[515]: csqc
qboolean CL_VM_Parse_TempEntity (void);
EntityFrameQW_CL_ReadFrame(false);
// first update is the final signon stage
if (cls.signon == SIGNONS - 1)
+ {
cls.signon = SIGNONS;
+ CL_SignonReply ();
+ }
break;
case qw_svc_deltapacketentities:
EntityFrameQW_CL_ReadFrame(true);
// first update is the final signon stage
if (cls.signon == SIGNONS - 1)
+ {
cls.signon = SIGNONS;
+ CL_SignonReply ();
+ }
break;
case qw_svc_maxspeed:
{
if (i >= 1 && i < MAX_MODELS)
{
- model_t *model = Mod_ForName(s, false, false, i == 1);
+ dp_model_t *model = Mod_ForName(s, false, false, i == 1);
if (!model)
Con_DPrintf("svc_precache: Mod_ForName(\"%s\") failed\n", s);
cl.model_precache[i] = model;
Cvar_RegisterVariable(&cl_nettimesyncboundmode);
Cvar_RegisterVariable(&cl_nettimesyncboundtolerance);
Cvar_RegisterVariable(&cl_iplog_name);
+ Cvar_RegisterVariable(&cl_readpicture_force);
Cmd_AddCommand("nextul", QW_CL_NextUpload, "sends next fragment of current upload buffer (screenshot for example)");
Cmd_AddCommand("stopul", QW_CL_StopUpload, "aborts current upload (screenshot for example)");