1
0
Fork 0
forked from fte/fteqw

protocol fixes for bot clients

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2339 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-07-02 04:27:56 +00:00
parent f51b6bbff6
commit cb447fa3f7
2 changed files with 31 additions and 17 deletions

View file

@ -259,14 +259,22 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
NPP_NQCheckDest(dest); NPP_NQCheckDest(dest);
#ifdef NQPROT #ifdef NQPROT
if (dest == MSG_ONE) { if (dest == MSG_ONE)
{
client_t *cl = Write_GetClient(); client_t *cl = Write_GetClient();
if (cl && !ISQWCLIENT(cl)) if (cl)
{ {
ClientReliableCheckBlock(cl, sizeof(qbyte)); if (cl->protocol == SCP_BAD) // is a bot
ClientReliableWrite_Byte(cl, data); return;
else if (!ISQWCLIENT(cl))
{
ClientReliableCheckBlock(cl, sizeof(qbyte));
ClientReliableWrite_Byte(cl, data);
return;
}
} }
} else }
else
MSG_WriteByte (NQWriteDest(dest), data); MSG_WriteByte (NQWriteDest(dest), data);
#endif #endif
@ -933,7 +941,7 @@ void NPP_QWCheckDest(int dest)
{ {
if (dest == MSG_ONE) if (dest == MSG_ONE)
{ {
/*client_t *cl = Write_GetClient(); /* client_t *cl = Write_GetClient();
if (!cl) if (!cl)
{ {
Con_Printf("Not a client\n"); Con_Printf("Not a client\n");
@ -945,7 +953,7 @@ void NPP_QWCheckDest(int dest)
NPP_QWFlush(); NPP_QWFlush();
} }
cldest = cl; cldest = cl;
*/ */
} }
else else
{ {
@ -967,15 +975,22 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
NPP_QWCheckDest(dest); NPP_QWCheckDest(dest);
#ifdef NQPROT #ifdef NQPROT
if (dest == MSG_ONE) { if (dest == MSG_ONE)
{
client_t *cl = Write_GetClient(); client_t *cl = Write_GetClient();
if (cl && ISQWCLIENT(cl)) if (cl)
{ {
ClientReliableCheckBlock(cl, sizeof(qbyte)); if (ISQWCLIENT(cl))
ClientReliableWrite_Byte(cl, data); {
return; ClientReliableCheckBlock(cl, sizeof(qbyte));
ClientReliableWrite_Byte(cl, data);
return;
}
else if (cl->protocol == SCP_BAD) // is a bot
return;
} }
} else }
else
MSG_WriteByte (QWWriteDest(dest), data); MSG_WriteByte (QWWriteDest(dest), data);
#endif #endif
if (!bufferlen) //new message section if (!bufferlen) //new message section

View file

@ -1329,7 +1329,7 @@ void SV_WritePlayerToClient(sizebuf_t *msg, clstate_t *ent)
{ // don't show the corpse looking around... { // don't show the corpse looking around...
cmd.angles[0] = 0; cmd.angles[0] = 0;
cmd.angles[1] = ent->angles[1]*65535/360; cmd.angles[1] = ent->angles[1]*65535/360;
cmd.angles[0] = 0; cmd.angles[2] = 0;
} }
cmd.buttons = 0; // never send buttons cmd.buttons = 0; // never send buttons
@ -1621,11 +1621,10 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
for (j=0,cl=svs.clients ; j<sv.allocated_client_slots ; j++,cl++) for (j=0,cl=svs.clients ; j<sv.allocated_client_slots ; j++,cl++)
{ {
isbot = !cl->state && (cl->name[0] || cl->protocol == SCP_BAD);
if (cl->state != cs_spawned) //this includes bots if (cl->state != cs_spawned) //this includes bots
if (!isbot || progstype == PROG_QW) //unless they're NQ bots... continue;
continue;
isbot = (cl->name[0] || cl->protocol == SCP_BAD);
ent = cl->edict; ent = cl->edict;
if (cl->viewent && ent == clent) if (cl->viewent && ent == clent)
{ {