Team chat sounds, a download bugfix, and a correction to the standard nq entity limits

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1704 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-12-13 02:31:57 +00:00
parent 57bb74c88d
commit f01489b7f4
3 changed files with 58 additions and 39 deletions

View file

@ -99,6 +99,8 @@ cvar_t noaim = {"noaim", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
cvar_t msg = {"msg", "1", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t msg = {"msg", "1", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
cvar_t cl_nofake = {"cl_nofake", "2"}; cvar_t cl_nofake = {"cl_nofake", "2"};
cvar_t cl_chatsound = {"cl_chatsound", "1"}; cvar_t cl_chatsound = {"cl_chatsound", "1"};
cvar_t cl_enemychatsound = {"cl_enemychatsound", "misc/talk.wav"};
cvar_t cl_teamchatsound = {"cl_teamchatsound", "misc/talk.wav"};
cvar_t r_rocketlight = {"r_rocketlight", "1"}; cvar_t r_rocketlight = {"r_rocketlight", "1"};
cvar_t r_lightflicker = {"r_lightflicker", "1"}; cvar_t r_lightflicker = {"r_lightflicker", "1"};
@ -2594,6 +2596,8 @@ void CL_Init (void)
Cvar_Register (&cl_nofake, cl_controlgroup); Cvar_Register (&cl_nofake, cl_controlgroup);
Cvar_Register (&cl_chatsound, cl_controlgroup); Cvar_Register (&cl_chatsound, cl_controlgroup);
Cvar_Register (&cl_enemychatsound, cl_controlgroup);
Cvar_Register (&cl_teamchatsound, cl_controlgroup);
Cvar_Register (&requiredownloads, cl_controlgroup); Cvar_Register (&requiredownloads, cl_controlgroup);
Cvar_Register (&cl_standardchat, cl_controlgroup); Cvar_Register (&cl_standardchat, cl_controlgroup);

View file

@ -918,6 +918,9 @@ void CL_ParseChunkedDownload(void)
if (cls.downloadmethod == DL_QWCHUNKS) if (cls.downloadmethod == DL_QWCHUNKS)
Host_EndGame("Received second download - \"%s\"\n", svname); Host_EndGame("Received second download - \"%s\"\n", svname);
if (!strcmp(cls.downloadname, svname))
Host_EndGame("Server sent the wrong download - \"%s\" instead of \"%s\"\n", svname, cls.downloadname);
//start the new download //start the new download
cls.downloadmethod = DL_QWCHUNKS; cls.downloadmethod = DL_QWCHUNKS;
cls.downloadpercent = 0; cls.downloadpercent = 0;
@ -936,6 +939,12 @@ void CL_ParseChunkedDownload(void)
COM_CreatePath (osname); COM_CreatePath (osname);
cls.downloadqw = fopen (osname, "wb"); cls.downloadqw = fopen (osname, "wb");
if (!cls.downloadqw)
{
CL_DownloadFailed(svname);
return;
}
firstblock = 0; firstblock = 0;
receivedbytes = 0; receivedbytes = 0;
blockcycle = -1; //so it requests 0 first. :) blockcycle = -1; //so it requests 0 first. :)
@ -1103,6 +1112,7 @@ void CL_ParseDownload (void)
{ {
msg_readcount += size; msg_readcount += size;
Con_TPrintf (TL_FAILEDTOOPEN, cls.downloadtempname); Con_TPrintf (TL_FAILEDTOOPEN, cls.downloadtempname);
CL_DownloadFailed(cls.downloadname);
CL_RequestNextDownload (); CL_RequestNextDownload ();
return; return;
} }
@ -3042,7 +3052,7 @@ void CLQ2_ParseInventory (void)
//return if we want to print the message. //return if we want to print the message.
char *CL_ParseChat(char *text, player_info_t **player) char *CL_ParseChat(char *text, player_info_t **player)
{ {
extern cvar_t cl_chatsound, cl_nofake; extern cvar_t cl_chatsound, cl_nofake, cl_teamchatsound, cl_enemychatsound;
int flags; int flags;
int offset=0; int offset=0;
qboolean suppress_talksound; qboolean suppress_talksound;
@ -3099,10 +3109,10 @@ char *CL_ParseChat(char *text, player_info_t **player)
if ((int)msg_filter.value & flags) if ((int)msg_filter.value & flags)
return NULL; //filter chat return NULL; //filter chat
check_flood = Ignore_Check_Flood(s, flags, offset); check_flood = Ignore_Check_Flood(s, flags, offset);
if (check_flood == IGNORE_NO_ADD) if (check_flood == IGNORE_NO_ADD)
return NULL; return NULL;
else if (check_flood == NO_IGNORE_ADD) else if (check_flood == NO_IGNORE_ADD)
Ignore_Flood_Add(s); Ignore_Flood_Add(s);
} }
@ -3116,7 +3126,12 @@ char *CL_ParseChat(char *text, player_info_t **player)
suppress_talksound = true; suppress_talksound = true;
if (!suppress_talksound) if (!suppress_talksound)
S_LocalSound ("misc/talk.wav"); {
if (flags == 2 && cl.teamplay)
S_LocalSound (cl_teamchatsound.value);
else
S_LocalSound (cl_enemychatsound.value);
}
if (cl_nofake.value == 1 || (cl_nofake.value == 2 && flags != 2)) { if (cl_nofake.value == 1 || (cl_nofake.value == 2 && flags != 2)) {
for (p = s; *p; p++) for (p = s; *p; p++)

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
@ -156,7 +156,7 @@ qboolean SV_AddLightUpdate (edict_t *ent)
void SV_EmitNailUpdate (sizebuf_t *msg, qboolean recorder) void SV_EmitNailUpdate (sizebuf_t *msg, qboolean recorder)
{ {
qbyte bits[6]; // [48 bits] xyzpy 12 12 12 4 8 qbyte bits[6]; // [48 bits] xyzpy 12 12 12 4 8
int n, i; int n, i;
edict_t *ent; edict_t *ent;
int x, y, z, p, yaw; int x, y, z, p, yaw;
@ -461,7 +461,7 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
bits = 0; bits = 0;
if (to->number >= 512) if (to->number >= 512)
{ {
if (to->number >= 1024) if (to->number >= 1024)
{ {
if (to->number >= 1024+512) if (to->number >= 1024+512)
@ -698,7 +698,7 @@ void SV_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t *
#ifdef PROTOCOLEXTENSIONS #ifdef PROTOCOLEXTENSIONS
SV_WriteDelta (&from->entities[oldindex], &to->entities[newindex], msg, false, client->fteprotocolextensions); SV_WriteDelta (&from->entities[oldindex], &to->entities[newindex], msg, false, client->fteprotocolextensions);
#else #else
SV_WriteDelta (&from->entities[oldindex], &to->entities[newindex], msg, false); SV_WriteDelta (&from->entities[oldindex], &to->entities[newindex], msg, false);
#endif #endif
oldindex++; oldindex++;
newindex++; newindex++;
@ -712,7 +712,7 @@ void SV_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t *
#ifdef PROTOCOLEXTENSIONS #ifdef PROTOCOLEXTENSIONS
SV_WriteDelta (&ent->baseline, &to->entities[newindex], msg, true, client->fteprotocolextensions); SV_WriteDelta (&ent->baseline, &to->entities[newindex], msg, true, client->fteprotocolextensions);
#else #else
SV_WriteDelta (&ent->baseline, &to->entities[newindex], msg, true); SV_WriteDelta (&ent->baseline, &to->entities[newindex], msg, true);
#endif #endif
newindex++; newindex++;
continue; continue;
@ -1041,7 +1041,7 @@ void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t
if (newnum == oldnum) if (newnum == oldnum)
{ // delta update from old position { // delta update from old position
//Con_Printf ("delta %i\n", newnum); //Con_Printf ("delta %i\n", newnum);
SVDP_EmitEntity (&from->entities[oldindex], &to->entities[newindex], msg, false); SVDP_EmitEntity (&from->entities[oldindex], &to->entities[newindex], msg, false);
oldindex++; oldindex++;
newindex++; newindex++;
continue; continue;
@ -1051,7 +1051,7 @@ void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t
{ // this is a new entity, send it from the baseline... as far as dp understands it... { // this is a new entity, send it from the baseline... as far as dp understands it...
ent = EDICT_NUM(svprogfuncs, newnum); ent = EDICT_NUM(svprogfuncs, newnum);
//Con_Printf ("baseline %i\n", newnum); //Con_Printf ("baseline %i\n", newnum);
SVDP_EmitEntity (&defaultstate, &to->entities[newindex], msg, true); SVDP_EmitEntity (&defaultstate, &to->entities[newindex], msg, true);
newindex++; newindex++;
continue; continue;
} }
@ -1146,7 +1146,7 @@ void SV_WritePlayerToClient(sizebuf_t *msg, clstate_t *ent)
int zext = ent->zext; int zext = ent->zext;
pflags = PF_MSEC | PF_COMMAND; pflags = PF_MSEC | PF_COMMAND;
if (ent->modelindex != sv_playermodel) if (ent->modelindex != sv_playermodel)
pflags |= PF_MODEL; pflags |= PF_MODEL;
@ -1411,7 +1411,7 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
needcleanup = (j+1); needcleanup = (j+1);
MSG_WriteByte(&sv.multicast, svc_muzzleflash); MSG_WriteByte(&sv.multicast, svc_muzzleflash);
MSG_WriteShort(&sv.multicast, (j+1)); MSG_WriteShort(&sv.multicast, (j+1));
SV_Multicast(ent->v->origin, MULTICAST_PVS); SV_Multicast(ent->v->origin, MULTICAST_PVS);
} }
} }
} }
@ -1479,7 +1479,7 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
extern vec3_t player_mins, player_maxs; extern vec3_t player_mins, player_maxs;
clstate_t clst; clstate_t clst;
extern float olddemotime, nextdemotime; extern float olddemotime, nextdemotime;
for (i=0 ; i<MAX_CLIENTS ; i++) for (i=0 ; i<MAX_CLIENTS ; i++)
{ {
//FIXME: Add PVS stuff. //FIXME: Add PVS stuff.
@ -1531,7 +1531,7 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
ang[j] = (a1 + (a2)*lerp); ang[j] = (a1 + (a2)*lerp);
org[j] = sv.recordedplayer[i].oldorg[j] + (sv.demostate[i+1].origin[j] - sv.recordedplayer[i].oldorg[j])*lerp; org[j] = sv.recordedplayer[i].oldorg[j] + (sv.demostate[i+1].origin[j] - sv.recordedplayer[i].oldorg[j])*lerp;
vel[j] = (-sv.recordedplayer[i].oldorg[j] + sv.demostate[i+1].origin[j])*(nextdemotime - olddemotime); vel[j] = (-sv.recordedplayer[i].oldorg[j] + sv.demostate[i+1].origin[j])*(nextdemotime - olddemotime);
} }
@ -1614,11 +1614,11 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
} }
else else
vent = ent; vent = ent;
if (progstype != PROG_QW) if (progstype != PROG_QW)
{ {
@ -1632,14 +1632,14 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
needcleanup = (j+1); needcleanup = (j+1);
MSG_WriteByte(&sv.multicast, svc_muzzleflash); MSG_WriteByte(&sv.multicast, svc_muzzleflash);
MSG_WriteShort(&sv.multicast, (j+1)); MSG_WriteShort(&sv.multicast, (j+1));
SV_Multicast(ent->v->origin, MULTICAST_PVS); SV_Multicast(ent->v->origin, MULTICAST_PVS);
} }
} }
} }
// ZOID visibility tracking // ZOID visibility tracking
if (ent != clent && if (ent != clent &&
!(client->spec_track && client->spec_track - 1 == j)) !(client->spec_track && client->spec_track - 1 == j))
{ {
if (cl->spectator) if (cl->spectator)
continue; continue;
@ -1806,14 +1806,14 @@ void SVNQ_EmitEntity(sizebuf_t *msg, edict_t *ent, int entnum)
#define DPU_UNUSED30 (1<<30) // future expansion #define DPU_UNUSED30 (1<<30) // future expansion
#define DPU_EXTEND3 (1<<31) // another byte to follow, future expansion #define DPU_EXTEND3 (1<<31) // another byte to follow, future expansion
int i, eff; int i, eff;
float miss; float miss;
unsigned int bits=0; unsigned int bits=0;
int glowsize, glowcolor; int glowsize, glowcolor;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
{ {
miss = ent->v->origin[i] - ent->baseline.origin[i]; miss = ent->v->origin[i] - ent->baseline.origin[i];
if ( miss < -0.1 || miss > 0.1 ) if ( miss < -0.1 || miss > 0.1 )
bits |= NQU_ORIGIN1<<i; bits |= NQU_ORIGIN1<<i;
@ -1821,13 +1821,13 @@ int glowsize, glowcolor;
if (ent->v->angles[0] != ent->baseline.angles[0] ) if (ent->v->angles[0] != ent->baseline.angles[0] )
bits |= NQU_ANGLE1; bits |= NQU_ANGLE1;
if (ent->v->angles[1] != ent->baseline.angles[1] ) if (ent->v->angles[1] != ent->baseline.angles[1] )
bits |= NQU_ANGLE2; bits |= NQU_ANGLE2;
if (ent->v->angles[2] != ent->baseline.angles[2] ) if (ent->v->angles[2] != ent->baseline.angles[2] )
bits |= NQU_ANGLE3; bits |= NQU_ANGLE3;
if ((ent->v->movetype == MOVETYPE_STEP || (ent->v->movetype == MOVETYPE_PUSH)) && (bits & (U_ANGLE1|U_ANGLE2|U_ANGLE3))) if ((ent->v->movetype == MOVETYPE_STEP || (ent->v->movetype == MOVETYPE_PUSH)) && (bits & (U_ANGLE1|U_ANGLE2|U_ANGLE3)))
bits |= NQU_NOLERP; // don't mess up the step animation bits |= NQU_NOLERP; // don't mess up the step animation
@ -1843,7 +1843,7 @@ int glowsize, glowcolor;
eff = ent->v->effects; eff = ent->v->effects;
if ((ent->baseline.effects & 0x00ff) != ((int)eff & 0x00ff)) if ((ent->baseline.effects & 0x00ff) != ((int)eff & 0x00ff))
bits |= NQU_EFFECTS; bits |= NQU_EFFECTS;
if (ent->baseline.modelindex != ent->v->modelindex) if (ent->baseline.modelindex != ent->v->modelindex)
bits |= NQU_MODEL; bits |= NQU_MODEL;
@ -1852,7 +1852,7 @@ int glowsize, glowcolor;
bits |= NQU_LONGENTITY; bits |= NQU_LONGENTITY;
if (1) if (0)
{ {
if (ent->baseline.trans != ent->v->alpha) if (ent->baseline.trans != ent->v->alpha)
if (!(ent->baseline.trans == 1 && !ent->v->alpha)) if (!(ent->baseline.trans == 1 && !ent->v->alpha))
@ -1887,7 +1887,7 @@ int glowsize, glowcolor;
{ {
if (ent->v->modelindex >= 256) //as much as protocols can handle if (ent->v->modelindex >= 256) //as much as protocols can handle
return; return;
if (entnum >= 768) //too many for a conventional nq client. if (entnum >= 600) //too many for a conventional nq client.
return; return;
} }
@ -1922,8 +1922,8 @@ int glowsize, glowcolor;
if (bits & NQU_FRAME) MSG_WriteByte (msg, ent->v->frame); if (bits & NQU_FRAME) MSG_WriteByte (msg, ent->v->frame);
if (bits & NQU_COLORMAP) MSG_WriteByte (msg, ent->v->colormap); if (bits & NQU_COLORMAP) MSG_WriteByte (msg, ent->v->colormap);
if (bits & NQU_SKIN) MSG_WriteByte (msg, ent->v->skin); if (bits & NQU_SKIN) MSG_WriteByte (msg, ent->v->skin);
if (bits & NQU_EFFECTS) MSG_WriteByte (msg, eff & 0x00ff); if (bits & NQU_EFFECTS) MSG_WriteByte (msg, eff & 0x00ff);
if (bits & NQU_ORIGIN1) MSG_WriteCoord (msg, ent->v->origin[0]); if (bits & NQU_ORIGIN1) MSG_WriteCoord (msg, ent->v->origin[0]);
if (bits & NQU_ANGLE1) MSG_WriteAngle(msg, ent->v->angles[0]); if (bits & NQU_ANGLE1) MSG_WriteAngle(msg, ent->v->angles[0]);
if (bits & NQU_ORIGIN2) MSG_WriteCoord (msg, ent->v->origin[1]); if (bits & NQU_ORIGIN2) MSG_WriteCoord (msg, ent->v->origin[1]);
if (bits & NQU_ANGLE2) MSG_WriteAngle(msg, ent->v->angles[1]); if (bits & NQU_ANGLE2) MSG_WriteAngle(msg, ent->v->angles[1]);
@ -1950,7 +1950,7 @@ gibfilter_t *gibfilter;
void SV_GibFilterAdd(char *modelname, int min, int max) void SV_GibFilterAdd(char *modelname, int min, int max)
{ {
int i; int i;
gibfilter_t *gf; gibfilter_t *gf;
for (i=1; sv.model_precache[i] ; i++) for (i=1; sv.model_precache[i] ; i++)
if (!strcmp(sv.model_precache[i], modelname)) if (!strcmp(sv.model_precache[i], modelname))
@ -1996,7 +1996,7 @@ void SV_GibFilterInit(void)
{ {
file = COM_Parse(file); file = COM_Parse(file);
if (!file) if (!file)
{ {
return; return;
} }
min = atoi(com_token); min = atoi(com_token);
@ -2113,7 +2113,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
sv.worldmodel->funcs.FatPVS(sv.worldmodel, org, false); sv.worldmodel->funcs.FatPVS(sv.worldmodel, org, false);
#ifdef PEXT_VIEW2 #ifdef PEXT_VIEW2
if (clent->v->view2) if (clent->v->view2)
sv.worldmodel->funcs.FatPVS(sv.worldmodel, PROG_TO_EDICT(svprogfuncs, clent->v->view2)->v->origin, true); sv.worldmodel->funcs.FatPVS(sv.worldmodel, PROG_TO_EDICT(svprogfuncs, clent->v->view2)->v->origin, true);
#endif #endif
@ -2138,7 +2138,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
{ {
SV_Q1BSP_FatPVS (org); SV_Q1BSP_FatPVS (org);
#ifdef PEXT_VIEW2 #ifdef PEXT_VIEW2
if (clent->v->view2) if (clent->v->view2)
SV_Q1BSP_AddToFatPVS (PROG_TO_EDICT(svprogfuncs, clent->v->view2)->v->origin, sv.worldmodel->nodes); //add a little more... SV_Q1BSP_AddToFatPVS (PROG_TO_EDICT(svprogfuncs, clent->v->view2)->v->origin, sv.worldmodel->nodes); //add a little more...
#endif #endif
@ -2156,7 +2156,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
// send over the players in the PVS // send over the players in the PVS
SV_WritePlayersToClient (client, clent, pvs, msg); SV_WritePlayersToClient (client, clent, pvs, msg);
// put other visible entities into either a packet_entities or a nails message // put other visible entities into either a packet_entities or a nails message
pack = &frame->entities; pack = &frame->entities;
pack->num_entities = 0; pack->num_entities = 0;
@ -2309,7 +2309,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
needcleanup = e; needcleanup = e;
MSG_WriteByte(&sv.multicast, svc_muzzleflash); MSG_WriteByte(&sv.multicast, svc_muzzleflash);
MSG_WriteShort(&sv.multicast, e); MSG_WriteShort(&sv.multicast, e);
SV_Multicast(ent->v->origin, MULTICAST_PVS); SV_Multicast(ent->v->origin, MULTICAST_PVS);
} }
} }
} }