more stuff broken

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3071 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2008-11-28 20:34:51 +00:00
parent c020463677
commit 6fb100e8b5
24 changed files with 507 additions and 319 deletions

View file

@ -1349,7 +1349,7 @@ qboolean CL_SendCmdQW (sizebuf_t *buf)
cmd->lightlevel = 0;
#ifdef CSQC_DAT
CSQC_Input_Frame(cmd);
CSQC_Input_Frame(plnum, cmd);
#endif
cl.frames[i].senttime = realtime;
@ -1603,7 +1603,7 @@ void CL_SendCmd (double frametime)
cl.frames[i].receivedtime = 0; // nq doesn't allow us to find our own packetloss
#ifdef CSQC_DAT
CSQC_Input_Frame(cmd);
CSQC_Input_Frame(0, cmd);
#endif
CLNQ_SendCmd (&buf);
break;

View file

@ -49,6 +49,7 @@ cvar_t cl_sbar = SCVARFC("cl_sbar", "0", CVAR_ARCHIVE, CL_Sbar_Callback);
cvar_t cl_hudswap = SCVARF("cl_hudswap", "0", CVAR_ARCHIVE);
cvar_t cl_maxfps = SCVARF("cl_maxfps", "1000", CVAR_ARCHIVE);
cvar_t cl_nopext = SCVARF("cl_nopext", "0", CVAR_ARCHIVE);
cvar_t cl_pext_mask = SCVAR("cl_pext_mask", "0xffffffff");
cvar_t cl_nolerp = SCVAR("cl_nolerp", "1");
cvar_t hud_tracking_show = SCVAR("hud_tracking_show", "1");
@ -323,9 +324,6 @@ unsigned int CL_SupportedFTEExtensions(void)
#ifdef PEXT_ZLIBDL
fteprotextsupported |= PEXT_ZLIBDL;
#endif
#ifdef PEXT_LIGHTUPDATES
fteprotextsupported |= PEXT_LIGHTUPDATES;
#endif
#ifdef PEXT_FATNESS
fteprotextsupported |= PEXT_FATNESS;
#endif
@ -352,6 +350,9 @@ unsigned int CL_SupportedFTEExtensions(void)
#ifdef PEXT_MODELDBL
fteprotextsupported |= PEXT_MODELDBL;
#endif
#ifdef PEXT_SOUNDDBL
fteprotextsupported |= PEXT_SOUNDDBL;
#endif
#ifdef PEXT_VWEAP
fteprotextsupported |= PEXT_VWEAP;
#endif
@ -379,6 +380,11 @@ unsigned int CL_SupportedFTEExtensions(void)
fteprotextsupported |= PEXT_DPFLAGS;
#endif
fteprotextsupported &= strtoul(cl_pext_mask.string, NULL, 16);
if (cl_nopext.value)
fteprotextsupported = 0;
return fteprotextsupported;
}
#endif
@ -417,7 +423,6 @@ void CL_SendConnectPacket (
if (cl_nopext.value) //imagine it's an unenhanced server
{
ftepext = 0;
compressioncrc = 0;
}
@ -2898,6 +2903,8 @@ void CL_Init (void)
Cvar_Register (&cl_standardmsg, cl_controlgroup);
Cvar_Register (&cl_parsewhitetext, cl_controlgroup);
Cvar_Register (&cl_nopext, cl_controlgroup);
Cvar_Register (&cl_pext_mask, cl_controlgroup);
Cvar_Register (&cl_splitscreen, cl_controlgroup);
Cvar_Register (&host_mapname, "Scripting");

View file

@ -208,10 +208,6 @@ double parsecounttime;
int cl_spikeindex, cl_playerindex, cl_h_playerindex, cl_flagindex, cl_rocketindex, cl_grenadeindex, cl_gib1index, cl_gib2index, cl_gib3index;
#ifdef PEXT_LIGHTUPDATES
int cl_lightningindex;
#endif
//=============================================================================
int packet_latency[NET_TIMINGS];
@ -472,7 +468,7 @@ void CL_DownloadFinished(char *filename, char *tempname)
}
else
{
CL_CheckModelResources();
CL_CheckModelResources(filename);
if (!cl.sendprespawn)
{
for (i = 0; i < mod_numknown; i++) //go and load this model now.
@ -1079,9 +1075,6 @@ void Sound_NextDownload (void)
cl_gib1index = -1;
cl_gib2index = -1;
cl_gib3index = -1;
#ifdef PEXT_LIGHTUPDATES
cl_lightningindex = -1;
#endif
#ifdef Q2CLIENT
if (cls.protocol == CP_QUAKE2)
{
@ -2570,7 +2563,7 @@ void CLNQ_ParseClientdata (void)
CL_ParseSoundlist
==================
*/
void CL_ParseSoundlist (void)
void CL_ParseSoundlist (qboolean lots)
{
int numsounds;
char *str;
@ -2579,6 +2572,9 @@ void CL_ParseSoundlist (void)
// precache sounds
// memset (cl.sound_precache, 0, sizeof(cl.sound_precache));
if (lots)
numsounds = MSG_ReadShort();
else
numsounds = MSG_ReadByte();
for (;;)
@ -2606,7 +2602,7 @@ void CL_ParseSoundlist (void)
if (CL_RemoveClientCommands("soundlist"))
Con_Printf("Multiple soundlists\n");
// CL_SendClientCommand("soundlist %i %i", cl.servercount, n);
CL_SendClientCommand(true, soundlist_name, cl.servercount, n);
CL_SendClientCommand(true, soundlist_name, cl.servercount, (numsounds&0xff00) + n);
}
return;
}
@ -2643,10 +2639,6 @@ void CL_ParseModellist (qboolean lots)
if (!strcmp(cl.model_name[nummodels],"progs/spike.mdl"))
cl_spikeindex = nummodels;
#ifdef PEXT_LIGHTUPDATES
if (!strcmp(cl.model_name[nummodels], "progs/zap.mdl"))
cl_lightningindex = nummodels;
#endif
if (!strcmp(cl.model_name[nummodels],"progs/player.mdl"))
cl_playerindex = nummodels;
if (!strcmp(cl.model_name[nummodels],"progs/h_player.mdl"))
@ -4336,7 +4328,7 @@ void CL_ParseStuffCmd(char *msg, int destsplit) //this protects stuffcmds from n
#endif
#ifdef CSQC_DAT
else
if (CSQC_StuffCmd(stufftext))
if (CSQC_StuffCmd(destsplit, stufftext))
{}
#endif
else
@ -4628,6 +4620,11 @@ void CL_ParseServerMessage (void)
case svc_sound:
CL_ParseStartSoundPacket();
break;
#ifdef PEXT_SOUNDDBL
case svcfte_soundextended:
CLNQ_ParseStartSoundPacket();
break;
#endif
case svc_stopsound:
i = MSG_ReadShort();
@ -4825,8 +4822,13 @@ void CL_ParseServerMessage (void)
break;
case svc_soundlist:
CL_ParseSoundlist ();
CL_ParseSoundlist (false);
break;
#ifdef PEXT_SOUNDDBL
case svcfte_soundlistshort:
CL_ParseSoundlist (true);
break;
#endif
case svc_packetentities:
CL_ParsePacketEntities (false);
@ -4861,13 +4863,6 @@ void CL_ParseServerMessage (void)
Bul_ParseMessage();
break;
#endif
#ifdef PEXT_LIGHTUPDATES
case svc_lightnings:
if (!(cls.fteprotocolextensions & PEXT_LIGHTUPDATES))
Host_EndGame("PEXT_LIGHTUPDATES is meant to be disabled\n");
CL_ParseProjectiles (cl_lightningindex);
break;
#endif
case svc_ftesetclientpersist:
CL_ParseClientPersist();
@ -4912,8 +4907,7 @@ void CL_ParseServerMessage (void)
break;
case svcfte_trailparticles:
#error CLDP_ParseTrailParticles() doesn't take any arguments.
CLDP_ParseTrailParticles(true);
CLDP_ParseTrailParticles();
break;
case svcfte_pointparticles:
CLDP_ParsePointParticles(false);

View file

@ -436,7 +436,7 @@ void SCR_CenterPrint (int pnum, char *str, qboolean fromgamecode)
if (!fromgamecode)
{
#ifdef CSQC_DAT
if (CSQC_CenterPrint(str)) //csqc nabbed it.
if (CSQC_CenterPrint(pnum, str)) //csqc nabbed it.
return;
#endif
}

View file

@ -906,10 +906,10 @@ qboolean CSQC_Init (unsigned int checksum);
void CSQC_RegisterCvarsAndThings(void);
qboolean CSQC_DrawView(void);
void CSQC_Shutdown(void);
qboolean CSQC_StuffCmd(char *cmd);
qboolean CSQC_StuffCmd(int lplayernum, char *cmd);
qboolean CSQC_LoadResource(char *resname, char *restype);
qboolean CSQC_CenterPrint(char *cmd);
void CSQC_Input_Frame(usercmd_t *cmd);
qboolean CSQC_CenterPrint(int lplayernum, char *cmd);
void CSQC_Input_Frame(int lplayernum, usercmd_t *cmd);
void CSQC_WorldLoaded(void);
qboolean CSQC_ParseTempEntity(unsigned char firstbyte);
qboolean CSQC_ConsoleCommand(char *cmd);

View file

@ -157,8 +157,7 @@ static void PClassic_InitParticles (void)
r_numparticles = DEFAULT_NUM_PARTICLES;
}
#error BZ_Malloc() only takes one argument, but SMVC doesn't care.
particles = (cparticle_t *) BZ_Malloc (r_numparticles * sizeof(cparticle_t), "classic:particles");
particles = (cparticle_t *) BZ_Malloc (r_numparticles * sizeof(cparticle_t));
CL_RegisterParticles();
}
@ -198,7 +197,7 @@ static void PClassic_DrawParticles(void)
#ifdef RGLQUAKE
unsigned char *at, theAlpha;
vec3_t up, right;
float dist, scale, r_partscale;
float dist, scale, r_partscale=0;
#endif
if (!active_particles)

View file

@ -46,6 +46,8 @@ qboolean csqc_addcrosshair;
static int num_csqc_edicts;
static int csqc_fakereadbyte;
static int csqc_lplayernum;
#define CSQCPROGSGROUP "CSQC progs control"
cvar_t pr_csmaxedicts = SCVAR("pr_csmaxedicts", "3072");
cvar_t cl_csqcdebug = SCVAR("cl_csqcdebug", "0"); //prints entity numbers which arrive (so I can tell people not to apply it to players...)
@ -90,8 +92,8 @@ extern sfx_t *cl_sfx_r_exp3;
globalfunction(parse_tempentity, "CSQC_Parse_TempEntity");/*EXT_CSQC_ABSOLUTLY_VILE*/ \
\
/*These are pointers to the csqc's globals.*/ \
globalfloat(time, "time"); /*float Written before entering most qc functions*/ \
globalfloat(simtime, "simtime"); /*float Written before entering most qc functions*/ \
globalfloat(svtime, "time"); /*float Written before entering most qc functions*/ \
globalfloat(cltime, "cltime"); /*float Written before entering most qc functions*/ \
globalentity(self, "self"); /*entity Written before entering most qc functions*/ \
globalentity(other, "other"); /*entity Written before entering most qc functions*/ \
\
@ -169,8 +171,22 @@ typedef struct {
} csqcglobals_t;
static csqcglobals_t csqcg;
#define plnum 0
static void CSQC_ChangeLocalPlayer(int lplayernum)
{
csqc_lplayernum = lplayernum;
if (csqcg.player_localentnum)
*csqcg.player_localentnum = cl.playernum[lplayernum]+1;
if (csqcg.player_localnum)
*csqcg.player_localnum = cl.playernum[lplayernum];
if (csqcg.view_angles)
{
csqcg.view_angles[0] = cl.viewangles[csqc_lplayernum][0];
csqcg.view_angles[1] = cl.viewangles[csqc_lplayernum][1];
csqcg.view_angles[2] = cl.viewangles[csqc_lplayernum][2];
}
}
static void CSQC_FindGlobals(void)
{
@ -188,15 +204,12 @@ static void CSQC_FindGlobals(void)
#undef globalstring
#undef globalfunction
if (csqcg.time)
*csqcg.time = Sys_DoubleTime();
if (csqcg.simtime)
*csqcg.simtime = cl.servertime;
if (csqcg.svtime)
*csqcg.svtime = cl.servertime;
if (csqcg.cltime)
*csqcg.cltime = cl.time;
if (csqcg.player_localentnum)
*csqcg.player_localentnum = cl.playernum[plnum]+1;
if (csqcg.player_localnum)
*csqcg.player_localnum = cl.playernum[plnum];
CSQC_ChangeLocalPlayer(0);
if (csqcg.maxclients)
*csqcg.maxclients = MAX_CLIENTS;
@ -630,7 +643,7 @@ static void PF_NoCSQC (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void PF_cl_cprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str = PF_VarString(prinst, 0, pr_globals);
SCR_CenterPrint(0, str, true);
SCR_CenterPrint(csqc_lplayernum, str, true);
}
static void PF_cs_makevectors (progfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -774,8 +787,8 @@ static qboolean CopyCSQCEdictToEntity(csqcedict_t *in, entity_t *out)
out->baseframe2 = in->v->baseframe2;
if (rflags & CSQCRF_FRAMETIMESARESTARTTIMES)
{
out->baseframe1time = *csqcg.time - in->v->baseframe1time;
out->baseframe2time = *csqcg.time - in->v->baseframe2time;
out->baseframe1time = *csqcg.svtime - in->v->baseframe1time;
out->baseframe2time = *csqcg.svtime - in->v->baseframe2time;
}
else
{
@ -791,8 +804,8 @@ static qboolean CopyCSQCEdictToEntity(csqcedict_t *in, entity_t *out)
out->lerpfrac = in->v->lerpfrac;
if (rflags & CSQCRF_FRAMETIMESARESTARTTIMES)
{
out->frame1time = *csqcg.time - in->v->frame1time;
out->frame2time = *csqcg.time - in->v->frame2time;
out->frame1time = *csqcg.svtime - in->v->frame1time;
out->frame2time = *csqcg.svtime - in->v->frame2time;
}
else
{
@ -1039,6 +1052,9 @@ static void PF_R_ClearScene (progfuncs_t *prinst, struct globalvars_s *pr_global
extern frame_t *view_frame;
extern player_state_t *view_message;
if (*prinst->callargc > 0)
CSQC_ChangeLocalPlayer(G_FLOAT(OFS_PARM0));
csqc_rebuildmatricies = true;
CL_DecayLights ();
@ -1061,15 +1077,15 @@ static void PF_R_ClearScene (progfuncs_t *prinst, struct globalvars_s *pr_global
CL_SwapEntityLists();
view_frame = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
view_message = &view_frame->playerstate[cl.playernum[plnum]];
view_message = &view_frame->playerstate[cl.playernum[csqc_lplayernum]];
#ifdef NQPROT
if (cls.protocol == CP_NETQUAKE || !view_message->messagenum)
view_message->weaponframe = cl.stats[0][STAT_WEAPONFRAME];
view_message->weaponframe = cl.stats[csqc_lplayernum][STAT_WEAPONFRAME];
#endif
V_CalcRefdef(0); //set up the defaults (for player 0)
V_CalcRefdef(csqc_lplayernum); //set up the defaults (for player 0)
/*
VectorCopy(cl.simangles[0], r_refdef.viewangles);
VectorCopy(cl.simorg[0], r_refdef.vieworg);
VectorCopy(cl.simangles[csqc_lplayernum], r_refdef.viewangles);
VectorCopy(cl.simorg[csqc_lplayernum], r_refdef.vieworg);
r_refdef.flags = 0;
r_refdef.vrect.x = 0;
@ -1109,7 +1125,20 @@ typedef enum
VF_ENGINESBAR = 20,
VF_DRAWCROSSHAIR = 21,
VF_CARTESIAN_ANGLES = 22,
VF_PERSPECTIVE = 200
//this is a DP-compatibility hack.
VF_CL_VIEWANGLES_V = 33,
VF_CL_VIEWANGLES_X = 34,
VF_CL_VIEWANGLES_Y = 35,
VF_CL_VIEWANGLES_Z = 36,
#pragma message("FIXME: add cshift")
//33-36 used by DP...
VF_PERSPECTIVE = 200,
//201 used by DP... WTF? CLEARSCREEN
VF_LPLAYER = 202,
VF_AFOV = 203, //aproximate fov (match what the engine would normally use for the fov cvar). p0=fov, p1=zoom
} viewflags;
static void PF_R_SetViewFlag(progfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -1135,13 +1164,25 @@ static void PF_R_SetViewFlag(progfuncs_t *prinst, struct globalvars_s *pr_global
r_refdef.fov_y = *p;
break;
case VF_AFOV:
{
float frustumx, frustumy;
frustumy = tan(p[0] * (M_PI/360)) * 0.75;
if (*prinst->callargc > 2)
frustumy *= G_FLOAT(OFS_PARM2);
frustumx = frustumy * vid.width / vid.height /* / vid.pixelheight*/;
r_refdef.fov_x = atan2(frustumx, 1) * (360/M_PI);
r_refdef.fov_y = atan2(frustumy, 1) * (360/M_PI);
}
break;
case VF_ORIGIN:
VectorCopy(p, r_refdef.vieworg);
cl.crouch[0] = 0;
cl.crouch[csqc_lplayernum] = 0;
break;
case VF_ORIGIN_Z:
cl.crouch[0] = 0;
cl.crouch[csqc_lplayernum] = 0;
case VF_ORIGIN_X:
case VF_ORIGIN_Y:
r_refdef.vieworg[parametertype-VF_ORIGIN_X] = *p;
@ -1156,6 +1197,15 @@ static void PF_R_SetViewFlag(progfuncs_t *prinst, struct globalvars_s *pr_global
r_refdef.viewangles[parametertype-VF_ANGLES_X] = *p;
break;
case VF_CL_VIEWANGLES_V:
VectorCopy(p, cl.viewangles[csqc_lplayernum]);
break;
case VF_CL_VIEWANGLES_X:
case VF_CL_VIEWANGLES_Y:
case VF_CL_VIEWANGLES_Z:
cl.viewangles[csqc_lplayernum][parametertype-VF_CL_VIEWANGLES_X] = *p;
break;
case VF_CARTESIAN_ANGLES:
Con_Printf(CON_WARNING "WARNING: CARTESIAN ANGLES ARE NOT YET SUPPORTED!\n");
break;
@ -1235,6 +1285,11 @@ static void PF_R_GetViewFlag(progfuncs_t *prinst, struct globalvars_s *pr_global
*r = r_refdef.fov_y;
break;
#pragma message("fixme: AFOV not retrievable")
case VF_AFOV:
*r = r_refdef.fov_x;
break;
case VF_ORIGIN:
#ifdef CHEAT_PARANOID
VectorClear(r);
@ -1262,6 +1317,15 @@ static void PF_R_GetViewFlag(progfuncs_t *prinst, struct globalvars_s *pr_global
*r = r_refdef.viewangles[parametertype-VF_ANGLES_X];
break;
case VF_CL_VIEWANGLES_V:
VectorCopy(cl.viewangles[csqc_lplayernum], r);
break;
case VF_CL_VIEWANGLES_X:
case VF_CL_VIEWANGLES_Y:
case VF_CL_VIEWANGLES_Z:
*r = cl.viewangles[csqc_lplayernum][parametertype-VF_CL_VIEWANGLES_X];
break;
case VF_CARTESIAN_ANGLES:
Con_Printf(CON_WARNING "WARNING: CARTESIAN ANGLES ARE NOT YET SUPPORTED!\n");
break;
@ -1327,8 +1391,10 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global
}
#endif
VectorCopy (r_refdef.vieworg, cl.viewent[0].origin);
CalcGunAngle(0);
r_refdef.currentplayernum = csqc_lplayernum;
VectorCopy (r_refdef.vieworg, cl.viewent[csqc_lplayernum].origin);
CalcGunAngle(csqc_lplayernum);
R_RenderView();
@ -1372,14 +1438,14 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global
static void PF_cs_getstatf(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int stnum = G_FLOAT(OFS_PARM0);
float val = *(float*)&cl.stats[plnum][stnum]; //copy float into the stat
float val = *(float*)&cl.stats[csqc_lplayernum][stnum]; //copy float into the stat
G_FLOAT(OFS_RETURN) = val;
}
static void PF_cs_getstati(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ //convert an int stat into a qc float.
int stnum = G_FLOAT(OFS_PARM0);
int val = cl.stats[plnum][stnum];
int val = cl.stats[csqc_lplayernum][stnum];
if (*prinst->callargc > 1)
{
int first, count;
@ -1400,10 +1466,10 @@ static void PF_cs_getstats(progfuncs_t *prinst, struct globalvars_s *pr_globals)
//the network protocol byteswaps
((unsigned int*)out)[0] = LittleLong(cl.stats[0][stnum+0]);
((unsigned int*)out)[1] = LittleLong(cl.stats[0][stnum+1]);
((unsigned int*)out)[2] = LittleLong(cl.stats[0][stnum+2]);
((unsigned int*)out)[3] = LittleLong(cl.stats[0][stnum+3]);
((unsigned int*)out)[0] = LittleLong(cl.stats[csqc_lplayernum][stnum+0]);
((unsigned int*)out)[1] = LittleLong(cl.stats[csqc_lplayernum][stnum+1]);
((unsigned int*)out)[2] = LittleLong(cl.stats[csqc_lplayernum][stnum+2]);
((unsigned int*)out)[3] = LittleLong(cl.stats[csqc_lplayernum][stnum+3]);
((unsigned int*)out)[4] = 0; //make sure it's null terminated
RETURN_TSTRING(out);
@ -1871,9 +1937,13 @@ static void PF_cs_trailparticles (progfuncs_t *prinst, struct globalvars_s *pr_g
pe->ParticleTrail(start, end, efnum, &ent->trailstate);
}
static void PF_cs_particlesloaded (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void PF_cs_particleeffectnum (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *effectname = PR_GetStringOfs(prinst, OFS_PARM0);
//keep the effectinfo synced between server and client.
COM_Effectinfo_ForName(effectname);
G_FLOAT(OFS_RETURN) = pe->FindParticleType(effectname)+1;
}
@ -1956,7 +2026,7 @@ static void PF_cs_getinputstate (progfuncs_t *prinst, struct globalvars_s *pr_gl
}
// save this command off for prediction
cmd = &cl.frames[f&UPDATE_MASK].cmd[plnum];
cmd = &cl.frames[f&UPDATE_MASK].cmd[csqc_lplayernum];
cs_set_input_state(cmd);
@ -1964,6 +2034,7 @@ static void PF_cs_getinputstate (progfuncs_t *prinst, struct globalvars_s *pr_gl
}
//read lots of globals, run the default player physics, write lots of globals.
//not intended to affect client state at all
static void PF_cs_runplayerphysics (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
unsigned int msecs;
@ -4022,7 +4093,7 @@ static struct {
{"setmodelindex", PF_cs_SetModelIndex, 333}, // #333 void(entity e, float mdlindex) setmodelindex (EXT_CSQC)
{"modelnameforindex", PF_cs_ModelnameForIndex, 334}, // #334 string(float mdlindex) modelnameforindex (EXT_CSQC)
{"particleeffectnum", PF_cs_particlesloaded, 335}, // #335 float(string effectname) particleeffectnum (EXT_CSQC)
{"particleeffectnum", PF_cs_particleeffectnum, 335}, // #335 float(string effectname) particleeffectnum (EXT_CSQC)
{"trailparticles", PF_cs_trailparticles, 336}, // #336 void(entity ent, float effectnum, vector start, vector end) trailparticles (EXT_CSQC),
{"pointparticles", PF_cs_pointparticles, 337}, // #337 void(float effectnum, vector origin [, vector dir, float count]) pointparticles (EXT_CSQC)
@ -4735,12 +4806,7 @@ qboolean CSQC_DrawView(void)
if (csqcg.intermission)
*csqcg.intermission = cl.intermission;
if (csqcg.view_angles)
{
csqcg.view_angles[0] = cl.viewangles[0][0];
csqcg.view_angles[1] = cl.viewangles[0][1];
csqcg.view_angles[2] = cl.viewangles[0][2];
}
CSQC_ChangeLocalPlayer(0);
/* if (csqcg.dpcompat_sbshowscores)
{
@ -4748,8 +4814,10 @@ qboolean CSQC_DrawView(void)
*csqcg.dpcompat_sbshowscores = sb_showscores;
}
*/
if (csqcg.time)
*csqcg.time = Sys_DoubleTime();
if (csqcg.cltime)
*csqcg.cltime = cl.time;
if (csqcg.cltime)
*csqcg.svtime = cl.servertime;
CSQC_RunThreads(); //wake up any qc threads
@ -4841,24 +4909,28 @@ qboolean CSQC_LoadResource(char *resname, char *restype)
return !!G_FLOAT(OFS_RETURN);
}
qboolean CSQC_StuffCmd(char *cmd)
qboolean CSQC_StuffCmd(int lplayernum, char *cmd)
{
void *pr_globals;
if (!csqcprogs || !csqcg.parse_stuffcmd)
return false;
CSQC_ChangeLocalPlayer(lplayernum);
pr_globals = PR_globals(csqcprogs, PR_CURRENT);
(((string_t *)pr_globals)[OFS_PARM0] = PR_TempString(csqcprogs, cmd));
PR_ExecuteProgram (csqcprogs, csqcg.parse_stuffcmd);
return true;
}
qboolean CSQC_CenterPrint(char *cmd)
qboolean CSQC_CenterPrint(int lplayernum, char *cmd)
{
void *pr_globals;
if (!csqcprogs || !csqcg.parse_centerprint)
return false;
CSQC_ChangeLocalPlayer(lplayernum);
pr_globals = PR_globals(csqcprogs, PR_CURRENT);
(((string_t *)pr_globals)[OFS_PARM0] = PR_TempString(csqcprogs, cmd));
@ -4866,13 +4938,19 @@ qboolean CSQC_CenterPrint(char *cmd)
return G_FLOAT(OFS_RETURN);
}
void CSQC_Input_Frame(usercmd_t *cmd)
void CSQC_Input_Frame(int lplayernum, usercmd_t *cmd)
{
if (!csqcprogs || !csqcg.input_frame)
return;
if (csqcg.time)
*csqcg.time = Sys_DoubleTime();
CSQC_ChangeLocalPlayer(lplayernum);
CL_CalcClientTime();
if (csqcg.svtime)
*csqcg.svtime = cl.servertime;
if (csqcg.cltime)
*csqcg.cltime = cl.time;
if (csqcg.clientcommandframe)
*csqcg.clientcommandframe = cls.netchan.outgoing_sequence;
@ -4957,8 +5035,11 @@ void CSQC_ParseEntities(void)
pr_globals = PR_globals(csqcprogs, PR_CURRENT);
if (csqcg.time)
*csqcg.time = Sys_DoubleTime();
CL_CalcClientTime();
if (csqcg.svtime) //estimated server time
*csqcg.svtime = cl.servertime;
if (csqcg.cltime) //smooth client time.
*csqcg.cltime = cl.time;
if (csqcg.clientcommandframe)
*csqcg.clientcommandframe = cls.netchan.outgoing_sequence;

View file

@ -366,7 +366,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAX_LIGHTSTYLES 255
#define MAX_STANDARDLIGHTSTYLES 64
#define MAX_MODELS 512 // these are sent over the net as bytes
#define MAX_SOUNDS 256 // so they cannot be blindly increased
#define MAX_SOUNDS 512 // so they cannot be blindly increased
#define MAX_CSQCMODELS 256 // these live entirly clientside

View file

@ -2742,20 +2742,89 @@ struct effectinfo_s
char name[1];
};
struct effectinfo_s *effectinfo;
static struct effectinfo_s *effectinfo;
static unsigned int lasteffectinfoid;
void COM_Effectinfo_Reset(void)
void COM_Effectinfo_Clear(void)
{
int fidx = 0;
char *f;
struct effectinfo_s *n;
while(effectinfo)
{
n = effectinfo->next;
Z_Free(effectinfo);
effectinfo = n;
}
lasteffectinfoid = 0;
}
int COM_Effectinfo_Add(const char *effectname)
{
struct effectinfo_s *n;
for (n = effectinfo; n; n = n->next)
{
if (!strcmp(effectname, n->name))
return 0; //already known
}
n = Z_Malloc(sizeof(*n) + strlen(effectname));
n->next = effectinfo;
n->index = ++lasteffectinfoid;
effectinfo = n;
strcpy(n->name, effectname);
return n->index;
}
void COM_Effectinfo_Reload(void)
{
int i;
char *f;
static const char *dpnames[] =
{
"TE_GUNSHOT",
"TE_GUNSHOTQUAD",
"TE_SPIKE",
"TE_SPIKEQUAD",
"TE_SUPERSPIKE",
"TE_SUPERSPIKEQUAD",
"TE_WIZSPIKE",
"TE_KNIGHTSPIKE",
"TE_EXPLOSION",
"TE_EXPLOSIONQUAD",
"TE_TAREXPLOSION",
"TE_TELEPORT",
"TE_LAVASPLASH",
"TE_SMALLFLASH",
"TE_FLAMEJET",
"EF_FLAME",
"TE_BLOOD",
"TE_SPARK",
"TE_PLASMABURN",
"TE_TEI_G3",
"TE_TEI_SMOKE",
"TE_TEI_BIGEXPLOSION",
"TE_TEI_PLASMAHIT",
"EF_STARDUST",
"TR_ROCKET",
"TR_GRENADE",
"TR_BLOOD",
"TR_WIZSPIKE",
"TR_SLIGHTBLOOD",
"TR_KNIGHTSPIKE",
"TR_VORESPIKE",
"TR_NEHAHRASMOKE",
"TR_NEXUIZPLASMA",
"TR_GLOWTRAIL",
"SVC_PARTICLE",
NULL
};
COM_Effectinfo_Clear();
for (i = 0; dpnames[i]; i++)
COM_Effectinfo_Add(dpnames[i]);
f = COM_LoadMallocFile("effectinfo.txt");
if (!f)
@ -2768,20 +2837,8 @@ void COM_Effectinfo_Reset(void)
if (!strcmp(com_token, "effect"))
{
f = COM_ParseToken(f, NULL);
//don't count duplicates
for (n = effectinfo; n; n = n->next)
{
if (!strcmp(com_token, n->name))
break;
}
if (!n)
{
n = Z_Malloc(sizeof(*n) + strlen(com_token));
n->next = effectinfo;
n->index = ++fidx;
effectinfo = n;
strcpy(n->name, com_token);
}
COM_Effectinfo_Add(com_token);
}
do
@ -2797,14 +2854,14 @@ unsigned int COM_Effectinfo_ForName(char *efname)
struct effectinfo_s *e;
if (!effectinfo)
COM_Effectinfo_Reset();
COM_Effectinfo_Reload();
for (e = effectinfo; e; e = e->next)
{
if (!strcmp(efname, e->name))
return e->index;
}
return 0;
return COM_Effectinfo_Add(efname);
}
char *COM_Effectinfo_ForNumber(unsigned int efnum)
@ -2812,7 +2869,7 @@ char *COM_Effectinfo_ForNumber(unsigned int efnum)
struct effectinfo_s *e;
if (!effectinfo)
COM_Effectinfo_Reset();
COM_Effectinfo_Reload();
for (e = effectinfo; e; e = e->next)
{

View file

@ -378,7 +378,7 @@ void COM_EnumerateFiles (char *match, int (*func)(char *, int, void *), void *pa
extern struct cvar_s registered;
extern qboolean standard_quake; //fixme: remove
void COM_Effectinfo_Reset(void);
void COM_Effectinfo_Clear(void);
unsigned int COM_Effectinfo_ForName(char *efname);
char *COM_Effectinfo_ForNumber(unsigned int efnum);

View file

@ -2867,7 +2867,7 @@ void COM_Gamedir (char *dir)
}
#endif
COM_Effectinfo_Reset();
COM_Effectinfo_Clear();
Validation_FlushFileList(); //prevent previous hacks from making a difference.

View file

@ -2681,6 +2681,7 @@ void NET_SendPacket (netsrc_t netsrc, int length, void *data, netadr_t to)
{
#ifdef CLIENTONLY
Sys_Error("NET_GetPacket: Bad netsrc");
return;
#else
collection = svs.sockets;
#endif
@ -2689,6 +2690,7 @@ void NET_SendPacket (netsrc_t netsrc, int length, void *data, netadr_t to)
{
#ifdef SERVERONLY
Sys_Error("NET_GetPacket: Bad netsrc");
return;
#else
collection = cls.sockets;
#endif

View file

@ -693,6 +693,7 @@ void PF_fcloseall (progfuncs_t *prinst)
{
if (pf_fopen_files[i].prinst != prinst)
continue;
Con_Printf("qc file %s was still open\n", pf_fopen_files[i].name);
PF_fclose_i(i);
}
}
@ -2339,13 +2340,13 @@ lh_extension_t QSG_Extensions[] = {
{"DP_ENT_ALPHA"}, //transparent entites
{"FTE_PEXT_VIEW2"}, //secondary view.
{"FTE_PEXT_BULLETENS"}, //bulleten boards (scrolling text on walls)
{"FTE_PEXT_ZLIBDL"}, //supposed download optimisation (unimportant to qc)
{"FTE_PEXT_LIGHTUPDATES"}, //zap.mdl is sent as a nail packet.
{"FTE_PEXT_ACURATETIMINGS"}, //allows full interpolation
{"FTE_PEXT_SOUNDDBL"}, //twice the sound indexes
{"FTE_PEXT_FATNESS"}, //entities may be expanded along their vertex normals
{"DP_HALFLIFE_MAP"}, //entitiy can visit a hl bsp
{"FTE_PEXT_TE_BULLET"}, //additional particle effect. Like TE_SPIKE and TE_SUPERSPIKE
{"FTE_PEXT_HULLSIZE"}, //means we can tell a client to go to crouching hull
{"FTE_PEXT_MODELDBL"}, //max of 512 models
{"FTE_PEXT_MODELDBL"}, //max of 512 models/sounds
{"FTE_PEXT_ENTITYDBL"}, //max of 1024 ents
{"FTE_PEXT_ENTITYDBL2"}, //max of 2048 ents
{"FTE_PEXT_ORIGINDBL"}, //-8k to +8k map size.

View file

@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#define PEXT_BULLETENS 0x00000020
#define PEXT_ACCURATETIMINGS 0x00000040
//#define PEXT_LIGHTUPDATES 0x00000080 //send progs/zap.mdl in the same mannor as a nail.
#define PEXT_SOUNDDBL 0x00000080 //revised startsound protocol
#define PEXT_FATNESS 0x00000100 //GL only (or servers)
#define PEXT_HLBSP 0x00000200
#define PEXT_TE_BULLET 0x00000400
@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PEXT_ENTITYDBL 0x00002000 //max of 1024 ents instead of 512
#define PEXT_ENTITYDBL2 0x00004000 //max of 1024 ents instead of 512
#define PEXT_FLOATCOORDS 0x00008000 //supports floating point origins.
#define PEXT_VWEAP 0x00010000 //cause an extra qbyte to be sent, and an extra list of models for vweaps.
//#define PEXT_VWEAP 0x00010000 //cause an extra qbyte to be sent, and an extra list of models for vweaps.
#ifdef Q2BSPS
#define PEXT_Q2BSP 0x00020000
#endif
@ -206,8 +206,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_nails2 54 //qwe - [qbyte] num [52 bits] nxyzpy 8 12 12 12 4 8
//FTE extended svcs
#ifdef PEXT_VIEW2
//#define svcfte_view2 56
#ifdef PEXT_SOUNDDBL
#define svcfte_soundextended 55
#define svcfte_soundlistshort 56
#endif
#ifdef PEXT_LIGHTSTYLECOL
#define svcfte_lightstylecol 57
@ -217,9 +218,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svcfte_bulletentext 58
#endif
#ifdef PEXT_LIGHTUPDATES
#define svcfte_lightnings 59
#endif
//#define svcfte_svcremoved 59
#ifdef PEXT_MODELDBL
#define svcfte_modellistshort 60 // [strings]
@ -523,10 +522,16 @@ enum clcq2_ops_e
//==============================================
// a sound with no channel is a local only sound
// the sound field has bits 0-2: channel, 3-12: entity
// the sound field has bits 0-2: channel, 3-12: entity, 13: unused, 14-15: flags
#define SND_VOLUME (1<<15) // a qbyte
#define SND_ATTENUATION (1<<14) // a qbyte
#define NQSND_VOLUME (1<<0) // a qbyte
#define NQSND_ATTENUATION (1<<1) // a qbyte
#define DPSND_LOOPING (1<<2) // a long, supposedly
#define DPSND_LARGEENTITY (1<<3)
#define DPSND_LARGESOUND (1<<4)
#define DEFAULT_SOUND_PACKET_VOLUME 255
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0

View file

@ -6,9 +6,6 @@ int numlightmaps;
mvertex_t *r_pcurrentvertbase;
#define LMBLOCK_WIDTH 128
#define LMBLOCK_HEIGHT LMBLOCK_WIDTH
LPDIRECTDRAWSURFACE7 *lightmap_d3dtextures;
LPDIRECTDRAWSURFACE7 *deluxmap_d3dtextures;
lightmapinfo_t **lightmap;

View file

@ -103,7 +103,6 @@ static galiastexnum_t *D3D9_ChooseSkin(galiasinfo_t *inf, char *modelname, int s
int frame;
int tc, bc;
int local;
if (!gl_nocolors.value)
{
@ -113,33 +112,6 @@ static galiastexnum_t *D3D9_ChooseSkin(galiasinfo_t *inf, char *modelname, int s
Skin_Find(e->scoreboard);
tc = e->scoreboard->ttopcolor;
bc = e->scoreboard->tbottomcolor;
/*
//colour forcing
if (cl.splitclients<2 && !(cl.fpd & FPD_NO_FORCE_COLOR)) //no colour/skin forcing in splitscreen.
{
if (cl.teamplay && cl.spectator)
{
local = Cam_TrackNum(0);
if (local < 0)
local = cl.playernum[0];
}
else
local = cl.playernum[0];
if (cl.teamplay && !strcmp(e->scoreboard->team, cl.players[local].team))
{
if (cl_teamtopcolor>=0)
tc = cl_teamtopcolor;
if (cl_teambottomcolor>=0)
bc = cl_teambottomcolor;
}
else
{
if (cl_enemytopcolor>=0)
tc = cl_enemytopcolor;
if (cl_enemybottomcolor>=0)
bc = cl_enemybottomcolor;
}
}*/
}
else
{

View file

@ -22,7 +22,7 @@ void D3D9_Draw_DebugChar (qbyte num);
void D3D9_Draw_EditorBackground (int lines);
void D3D9_Draw_EndDisc (void);
void D3D9_Draw_FadeScreen (void);
void D3D9_Draw_Fill (int x, int y, int w, int h, int c);
void D3D9_Draw_Fill (int x, int y, int w, int h, unsigned int c);
void D3D9_Draw_Fill_Colours (int x, int y, int w, int h);
void D3D9_Draw_Fill_I (int x, int y, int w, int h, unsigned int imgcolour);
void D3D9_Draw_FillRGB (int x, int y, int w, int h, float r, float g, float b);

View file

@ -175,7 +175,7 @@ void D3D9_VID_GenPaletteTables (unsigned char *palette)
}
if (pD3DDev9)
IDirect3DDevice9_SetGammaRamp(pD3DDev9, 0, D3DSGR_NO_CALIBRATION, ramps);
IDirect3DDevice9_SetGammaRamp(pD3DDev9, 0, D3DSGR_NO_CALIBRATION, (D3DGAMMARAMP *)ramps);
}
#if 0
#if !defined(SWQUAKE) && !defined(GLQUAKE)
@ -1372,7 +1372,7 @@ void (D3D9_Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyt
void (D3D9_Draw_ConsoleBackground) (int lines);
void (D3D9_Draw_EditorBackground) (int lines);
void (D3D9_Draw_TileClear) (int x, int y, int w, int h);
void (D3D9_Draw_Fill) (int x, int y, int w, int h, int c);
void (D3D9_Draw_Fill) (int x, int y, int w, int h, unsigned int c);
void (D3D9_Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b);
void (D3D9_Draw_FadeScreen) (void);
void (D3D9_Draw_BeginDisc) (void);

View file

@ -360,11 +360,6 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
switch(majortype)
{
case svc_sound:
#define NQSND_VOLUME (1<<0) // a qbyte
#define NQSND_ATTENUATION (1<<1) // a qbyte
#define DPSND_LOOPING (1<<2) // a long, supposedly
#define DPSND_LARGEENTITY (1<<3)
#define DPSND_LARGESOUND (1<<4)
protocollen = 5+sizeofcoord*3;
if (data & NQSND_VOLUME)
protocollen++;

View file

@ -2987,8 +2987,15 @@ static void PF_cvar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
cvar_t *cv = Cvar_FindVar(str);
if (!cv)
{
cv = Cvar_Get(str, "", 0, "QC variables");
Con_Printf("Creating cvar %s\n", str);
//this little chunk is so cvars dp creates are created with meaningful values
char *def = "";
if (!strcmp(str, "sv_maxairspeed"))
def = "30";
else
def = "";
cv = Cvar_Get(str, def, 0, "QC variables");
Con_Printf("^3Creating cvar %s\n", str);
}
G_FLOAT(OFS_RETURN) = cv->value;
}

View file

@ -106,12 +106,6 @@ extern int sv_nailmodel, sv_supernailmodel, sv_playermodel;
qboolean demonails;
#ifdef PEXT_LIGHTUPDATES
edict_t *light[MAX_NAILS];
int numlight;
extern int sv_lightningmodel;
#endif
static edict_t *csqcent[MAX_EDICTS];
static int csqcnuments;
@ -146,19 +140,6 @@ qboolean SV_DemoNailUpdate (int i)
return true;
}
#ifdef PEXT_LIGHTUPDATES
qboolean SV_AddLightUpdate (edict_t *ent)
{
if (ent->v->modelindex != sv_lightningmodel)
return false;
if (numlight == MAX_NAILS)
return true;
light[numnails] = ent;
numlight++;
return true;
}
#endif
void SV_EmitNailUpdate (sizebuf_t *msg, qboolean recorder)
{
qbyte bits[6]; // [48 bits] xyzpy 12 12 12 4 8
@ -166,33 +147,6 @@ void SV_EmitNailUpdate (sizebuf_t *msg, qboolean recorder)
edict_t *ent;
int x, y, z, p, yaw;
#ifdef PEXT_LIGHTUPDATES
if (numlight)
{
MSG_WriteByte (msg, svc_lightnings);
MSG_WriteByte (msg, numlight);
for (n=0 ; n<numlight ; n++)
{
ent = light[n];
x = (int)(ent->v->origin[0]+4096)>>1;
y = (int)(ent->v->origin[1]+4096)>>1;
z = (int)(ent->v->origin[2]+4096)>>1;
p = (int)(16*ent->v->angles[0]/360)&15;
yaw = (int)(256*ent->v->angles[1]/360)&255;
bits[0] = x;
bits[1] = (x>>8) | (y<<4);
bits[2] = (y>>4);
bits[3] = z;
bits[4] = (z>>8) | (p<<4);
bits[5] = yaw;
for (i=0 ; i<6 ; i++)
MSG_WriteByte (msg, bits[i]);
}
}
#endif
if (!numnails)
return;
@ -2565,11 +2519,6 @@ void SV_Snapshot_BuildQ1(client_t *client, packet_entities_t *pack, qbyte *pvs,
{
if (SV_AddNailUpdate (ent))
continue; // added to the special update list
#ifdef PEXT_LIGHTUPDATES
if (client->fteprotocolextensions & PEXT_LIGHTUPDATES)
if (SV_AddLightUpdate (ent))
continue;
#endif
}
//the entity would mess up the client and possibly disconnect them.
@ -2682,9 +2631,6 @@ void SV_Snapshot_Clear(packet_entities_t *pack)
csqcnuments = 0;
numnails = 0;
#ifdef PEXT_LIGHTUPDATES
numlight = 0;
#endif
}
/*

View file

@ -1674,6 +1674,43 @@ client_t *SVC_DirectConnect(void)
}
}
msg_badread=false;
if (developer.value && protextsupported)
{
#define printext(e) Con_Printf("Pext: " #e ": %s\n", (protextsupported & e)?"yes":"no")
printext(PEXT_SETVIEW);
printext(PEXT_SCALE);
printext(PEXT_LIGHTSTYLECOL);
printext(PEXT_TRANS);
printext(PEXT_VIEW2);
printext(PEXT_BULLETENS);
printext(PEXT_ACCURATETIMINGS);
printext(PEXT_SOUNDDBL);
printext(PEXT_FATNESS);
printext(PEXT_HLBSP);
printext(PEXT_TE_BULLET);
printext(PEXT_HULLSIZE);
printext(PEXT_MODELDBL);
printext(PEXT_ENTITYDBL);
printext(PEXT_ENTITYDBL2);
printext(PEXT_FLOATCOORDS);
printext(PEXT_VWEAP);
printext(PEXT_Q2BSP);
printext(PEXT_Q3BSP);
printext(PEXT_COLOURMOD);
printext(PEXT_SPLITSCREEN);
printext(PEXT_HEXEN2);
printext(PEXT_SPAWNSTATIC2);
printext(PEXT_CUSTOMTEMPEFFECTS);
printext(PEXT_256PACKETENTITIES);
// printext(PEXT_64PLAYERS);
printext(PEXT_SHOWPIC);
printext(PEXT_SETATTACHMENT);
// printext(PEXT_PK3DOWNLOADS);
printext(PEXT_CHUNKEDDOWNLOADS);
printext(PEXT_CSQC);
printext(PEXT_DPFLAGS);
}
}
if (protextsupported & PEXT_256PACKETENTITIES)
@ -3486,9 +3523,6 @@ void SV_InitLocal (void)
#ifdef PEXT_ZLIBDL
svs.fteprotocolextensions |= PEXT_ZLIBDL;
#endif
#ifdef PEXT_LIGHTUPDATES
svs.fteprotocolextensions |= PEXT_LIGHTUPDATES;
#endif
#ifdef PEXT_FATNESS
svs.fteprotocolextensions |= PEXT_FATNESS;
#endif
@ -3513,6 +3547,9 @@ void SV_InitLocal (void)
#ifdef PEXT_MODELDBL
svs.fteprotocolextensions |= PEXT_MODELDBL;
#endif
#ifdef PEXT_SOUNDDBL
svs.fteprotocolextensions |= PEXT_SOUNDDBL;
#endif
#ifdef PEXT_FLOATCOORDS
svs.fteprotocolextensions |= PEXT_FLOATCOORDS;
#endif

View file

@ -530,6 +530,8 @@ void SV_MulticastProtExt(vec3_t origin, multicast_t to, int dimension_mask, int
if (client->state != cs_spawned)
continue;
if (client->protocol == SCP_QUAKEWORLD)
{
if (client->fteprotocolextensions & without)
{
// Con_Printf ("Version supressed multicast - without pext\n");
@ -540,6 +542,7 @@ void SV_MulticastProtExt(vec3_t origin, multicast_t to, int dimension_mask, int
// Con_Printf ("Version supressed multicast - with pext\n");
continue;
}
}
if (mask)
{
@ -645,6 +648,8 @@ void SV_MulticastProtExt(vec3_t origin, multicast_t to, int dimension_mask, int
if (client->controller)
continue; //FIXME: send if at least one of the players is near enough.
if (client->protocol == SCP_QUAKEWORLD)
{
if (client->fteprotocolextensions & without)
{
// Con_Printf ("Version supressed multicast - without pext\n");
@ -655,6 +660,7 @@ void SV_MulticastProtExt(vec3_t origin, multicast_t to, int dimension_mask, int
// Con_Printf ("Version supressed multicast - with pext\n");
continue;
}
}
if (svprogfuncs)
if (!((int)client->edict->xv->dimension_see & dimension_mask))
@ -771,14 +777,9 @@ Larger attenuations will drop off. (max 4 attenuation)
void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
float attenuation)
{
#define NQSND_VOLUME (1<<0) // a qbyte
#define NQSND_ATTENUATION (1<<1) // a qbyte
int sound_num;
#ifdef NQPROT
int field_mask;
int nqchan;
#endif
int extfield_mask;
int qwflags;
int i;
int ent;
vec3_t origin;
@ -828,26 +829,7 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
else
use_phs = true;
// if (channel == CHAN_BODY || channel == CHAN_VOICE)
// reliable = true;
channel = (ent<<3) | channel;
#ifdef NQPROT
field_mask = 0;
if (volume != DEFAULT_SOUND_PACKET_VOLUME)
field_mask |= NQSND_VOLUME;
if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
field_mask |= NQSND_ATTENUATION;
nqchan = channel;
#endif
if (volume != DEFAULT_SOUND_PACKET_VOLUME)
channel |= SND_VOLUME;
if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
channel |= SND_ATTENUATION;
// use the entity origin unless it is a bmodel
// use the entity origin unless it is a bmodel, in which case use its bbox middle
if (entity->v->solid == SOLID_BSP)
{
for (i=0 ; i<3 ; i++)
@ -858,11 +840,64 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
VectorCopy (entity->v->origin, origin);
}
MSG_WriteByte (&sv.multicast, svc_sound);
MSG_WriteShort (&sv.multicast, channel);
if (channel & SND_VOLUME)
// if (channel == CHAN_BODY || channel == CHAN_VOICE)
// reliable = true;
extfield_mask = 0;
if (volume != DEFAULT_SOUND_PACKET_VOLUME)
extfield_mask |= NQSND_VOLUME;
if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
extfield_mask |= NQSND_ATTENUATION;
if (ent >= 8192 || channel >= 8)
extfield_mask |= DPSND_LARGEENTITY;
if (sound_num > 0xff)
extfield_mask |= DPSND_LARGESOUND;
#ifdef PEXT_SOUNDDBL
if (channel >= 8 || ent >= 2048 || sound_num > 0xff)
{
//if any of the above conditions evaluates to true, then we can't use standard qw protocols
MSG_WriteByte (&sv.multicast, svcfte_soundextended);
MSG_WriteByte (&sv.multicast, extfield_mask);
if (extfield_mask & NQSND_VOLUME)
MSG_WriteByte (&sv.multicast, volume);
if (channel & SND_ATTENUATION)
if (extfield_mask & NQSND_ATTENUATION)
MSG_WriteByte (&sv.multicast, attenuation*64);
if (extfield_mask & DPSND_LARGEENTITY)
{
MSG_WriteShort (&sv.multicast, ent);
MSG_WriteByte (&sv.multicast, channel);
}
else
MSG_WriteShort (&sv.multicast, (ent<<3) | channel);
if (extfield_mask & DPSND_LARGESOUND)
MSG_WriteShort (&sv.multicast, sound_num);
else
MSG_WriteByte (&sv.multicast, sound_num);
for (i=0 ; i<3 ; i++)
MSG_WriteCoord (&sv.multicast, origin[i]);
requiredextensions |= PEXT_SOUNDDBL;
if (ent > 512)
requiredextensions |= PEXT_ENTITYDBL;
if (ent > 1024)
requiredextensions |= PEXT_ENTITYDBL2;
}
else
#endif
{
qwflags = (ent<<3) | channel;
if (volume != DEFAULT_SOUND_PACKET_VOLUME)
qwflags |= SND_VOLUME;
if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
qwflags |= SND_ATTENUATION;
MSG_WriteByte (&sv.multicast, svc_sound);
MSG_WriteShort (&sv.multicast, qwflags);
if (qwflags & SND_VOLUME)
MSG_WriteByte (&sv.multicast, volume);
if (qwflags & SND_ATTENUATION)
MSG_WriteByte (&sv.multicast, attenuation*64);
MSG_WriteByte (&sv.multicast, sound_num);
for (i=0 ; i<3 ; i++)
@ -872,15 +907,25 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
requiredextensions |= PEXT_ENTITYDBL;
if (ent > 1024)
requiredextensions |= PEXT_ENTITYDBL2;
}
#ifdef NQPROT
MSG_WriteByte (&sv.nqmulticast, svc_sound);
MSG_WriteByte (&sv.nqmulticast, field_mask);
if (field_mask & NQSND_VOLUME)
MSG_WriteByte (&sv.nqmulticast, extfield_mask);
if (extfield_mask & NQSND_VOLUME)
MSG_WriteByte (&sv.nqmulticast, volume);
if (field_mask & NQSND_ATTENUATION)
if (extfield_mask & NQSND_ATTENUATION)
MSG_WriteByte (&sv.nqmulticast, attenuation*64);
MSG_WriteShort (&sv.nqmulticast, nqchan);
if (extfield_mask & DPSND_LARGEENTITY)
{
MSG_WriteShort (&sv.nqmulticast, ent);
MSG_WriteByte (&sv.nqmulticast, channel);
}
else
MSG_WriteShort (&sv.nqmulticast, (ent<<3) | channel);
if (extfield_mask & DPSND_LARGESOUND)
MSG_WriteShort (&sv.nqmulticast, sound_num);
else
MSG_WriteByte (&sv.nqmulticast, sound_num);
for (i=0 ; i<3 ; i++)
MSG_WriteCoord (&sv.nqmulticast, origin[i]);
@ -900,9 +945,6 @@ FRAME UPDATES
*/
int sv_nailmodel, sv_supernailmodel, sv_playermodel;
#ifdef PEXT_LIGHTUPDATES
int sv_lightningmodel;
#endif
void SV_FindModelNumbers (void)
{
@ -911,9 +953,6 @@ void SV_FindModelNumbers (void)
sv_nailmodel = -1;
sv_supernailmodel = -1;
sv_playermodel = -1;
#ifdef PEXT_LIGHTUPDATES
sv_lightningmodel = -1;
#endif
for (i=0 ; i<MAX_MODELS ; i++)
{
@ -923,10 +962,6 @@ void SV_FindModelNumbers (void)
sv_nailmodel = i;
if (!strcmp(sv.strings.model_precache[i],"progs/s_spike.mdl"))
sv_supernailmodel = i;
#ifdef PEXT_LIGHTUPDATES
if (!strcmp(sv.strings.model_precache[i],"progs/zap.mdl"))
sv_lightningmodel = i;
#endif
if (!strcmp(sv.strings.model_precache[i],"progs/player.mdl"))
sv_playermodel = i;
}
@ -1480,11 +1515,17 @@ void SV_UpdateClientStats (client_t *client, int pnum)
{
ClientReliableWrite_Begin(client->controller, svcfte_choosesplitclient, 8);
ClientReliableWrite_Byte(client->controller, pnum);
ClientReliableWrite_Byte(client->controller, svcfte_updatestatfloat);
ClientReliableWrite_Byte(client->controller, i);
ClientReliableWrite_Float(client->controller, statsf[i]);
}
else
{
ClientReliableWrite_Begin(client, svcfte_updatestatfloat, 6);
ClientReliableWrite_Byte(client, i);
ClientReliableWrite_Float(client, statsf[i]);
}
}
if (statss[i] || client->statss[i])
if (strcmp(statss[i]?statss[i]:"", client->statss[i]?client->statss[i]:""))
@ -1495,13 +1536,17 @@ void SV_UpdateClientStats (client_t *client, int pnum)
ClientReliableWrite_Begin(client->controller, svcfte_choosesplitclient, 5+strlen(statss[i]));
ClientReliableWrite_Byte(client->controller, pnum);
ClientReliableWrite_Byte(client->controller, svcfte_updatestatstring);
ClientReliableWrite_Byte(client->controller, i);
ClientReliableWrite_String(client->controller, statss[i]);
}
else
{
ClientReliableWrite_Begin(client, svcfte_updatestatstring, 3+strlen(statss[i]));
ClientReliableWrite_Byte(client, i);
ClientReliableWrite_String(client, statss[i]);
}
}
}
else if (!statsi[i])
statsi[i] = statsf[i];
if (statsi[i] != client->statsi[i])
@ -1509,17 +1554,33 @@ void SV_UpdateClientStats (client_t *client, int pnum)
client->statsi[i] = statsi[i];
client->statsf[i] = 0;
if (statsi[i] >=0 && statsi[i] <= 255)
{
if (pnum)
{
ClientReliableWrite_Begin(client->controller, svcfte_choosesplitclient, 8);
ClientReliableWrite_Begin(client->controller, svcfte_choosesplitclient, 5);
ClientReliableWrite_Byte(client->controller, pnum);
ClientReliableWrite_Byte(client->controller, svc_updatestat);
ClientReliableWrite_Byte(client->controller, i);
ClientReliableWrite_Byte(client->controller, statsi[i]);
}
if (statsi[i] >=0 && statsi[i] <= 255)
else
{
ClientReliableWrite_Begin(client, svc_updatestat, 3);
ClientReliableWrite_Byte(client, i);
ClientReliableWrite_Byte(client, statsi[i]);
}
}
else
{
if (pnum)
{
ClientReliableWrite_Begin(client->controller, svcfte_choosesplitclient, 8);
ClientReliableWrite_Byte(client->controller, pnum);
ClientReliableWrite_Byte(client->controller, svc_updatestatlong);
ClientReliableWrite_Byte(client->controller, i);
ClientReliableWrite_Long(client->controller, statsi[i]);
}
else
{
ClientReliableWrite_Begin(client, svc_updatestatlong, 6);
@ -1529,6 +1590,7 @@ void SV_UpdateClientStats (client_t *client, int pnum)
}
}
}
}
}
/*

View file

@ -794,9 +794,10 @@ SV_Soundlist_f
*/
void SV_Soundlist_f (void)
{
int i;
unsigned int i;
//char **s;
unsigned n;
unsigned int n;
unsigned int maxclientsupportedsounds;
if (host_client->state != cs_connected)
{
@ -833,8 +834,25 @@ void SV_Soundlist_f (void)
return;
}
#ifdef PEXT_SOUNDDBL
if (n > 255)
{
MSG_WriteByte (&host_client->netchan.message, svcfte_soundlistshort);
MSG_WriteShort (&host_client->netchan.message, n);
}
else
#endif
{
MSG_WriteByte (&host_client->netchan.message, svc_soundlist);
MSG_WriteByte (&host_client->netchan.message, n);
}
maxclientsupportedsounds = 256;
#ifdef PEXT_SOUNDDBL
if (host_client->fteprotocolextensions & PEXT_SOUNDDBL)
maxclientsupportedsounds *= 2;
#endif
if (sv.democausesreconnect) //read the list from somewhere else
{
for (i = 1+n;
@ -849,9 +867,13 @@ void SV_Soundlist_f (void)
else
{
for (i = 1+n;
*sv.strings.sound_precache[i] && host_client->netchan.message.cursize < (MAX_QWMSGLEN/2);
i < maxclientsupportedsounds && *sv.strings.sound_precache[i] && host_client->netchan.message.cursize < (MAX_QWMSGLEN/2);
i++, n++)
{
MSG_WriteString (&host_client->netchan.message, sv.strings.sound_precache[i]);
if (((n&255)==255) && n != i-1)
break;
}
if (!*sv.strings.sound_precache[i])
n = 0;
@ -869,9 +891,9 @@ SV_Modellist_f
*/
void SV_Modellist_f (void)
{
int i;
unsigned n;
int maxclientsupportedmodels;
unsigned int i;
unsigned int n;
unsigned int maxclientsupportedmodels;
if (host_client->state != cs_connected)
{
@ -908,20 +930,24 @@ void SV_Modellist_f (void)
return;
}
if (n >= 255)
#ifdef PEXT_MODELDBL
if (n > 255)
{
MSG_WriteByte (&host_client->netchan.message, svcfte_modellistshort);
MSG_WriteShort (&host_client->netchan.message, n);
}
else
#endif
{
MSG_WriteByte (&host_client->netchan.message, svc_modellist);
MSG_WriteByte (&host_client->netchan.message, n);
}
maxclientsupportedmodels = 256;
#ifdef PEXT_MODELDBL
if (host_client->fteprotocolextensions & PEXT_MODELDBL)
maxclientsupportedmodels *= 2;
#endif
if (sv.democausesreconnect) //read the list from somewhere else
{