mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-21 19:41:14 +00:00
Fix some qtv proxy bugs, some serious some less so.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5604 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
3d54173ad1
commit
8e656b4af8
6 changed files with 102 additions and 73 deletions
|
@ -2348,11 +2348,12 @@ QTV_OBJECTS= \
|
|||
forward.c \
|
||||
pmove.c \
|
||||
menu.c \
|
||||
msg.c \
|
||||
httpsv.c \
|
||||
sha1.c \
|
||||
libqtvc/glibc_sucks.c
|
||||
$(RELEASE_DIR)/qtv$(BITS)$(EXEPOSTFIX): $(QTV_OBJECTS)
|
||||
$(CC) -o $@ $? -lstdc++ -lm $(BASE_INCLUDES) $(QTV_LDFLAGS)
|
||||
$(CC) -o $@ $? -lstdc++ -lm $(BASE_INCLUDES) $(QTV_LDFLAGS) $(SVNREVISION)
|
||||
qtv-rel:
|
||||
@$(MAKE) $(RELEASE_DIR)/qtv$(BITS)$(EXEPOSTFIX) VPATH="$(BASE_DIR)/../fteqtv:$(VPATH)"
|
||||
qtv: qtv-rel
|
||||
|
|
|
@ -13,10 +13,14 @@ VPATH=../engine/common
|
|||
|
||||
OBJS = netchan.o parse.o msg.o qw.o source.o bsp.o rcon.o mdfour.o crc.o control.o forward.o pmove.o menu.o httpsv.o sha1.o
|
||||
|
||||
#I hate this big long list.
|
||||
INCLUDES=-I../engine/common -I../engine/client -I../engine/server -I../engine/qclib -I../engine/gl
|
||||
REVISION:=-DSVNREVISION=$(shell svnversion)
|
||||
|
||||
all: qtv
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(SPIKEISALAZYBUGGERCFLAGS) $(CFLAGS) $< -c -o $@
|
||||
$(CC) $(SPIKEISALAZYBUGGERCFLAGS) $(CFLAGS) $(INCLUDES) $(REVISION) $< -c -o $@
|
||||
|
||||
libqtvc:
|
||||
$(MAKE) -C libqtvc CC="$(CC)" CFLAGS="$(CFLAGS) $(SPIKEISALAZYBUGGERCFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)"
|
||||
|
|
|
@ -197,7 +197,7 @@ void Cluster_BuildAvailableDemoList(cluster_t *cluster)
|
|||
closedir(dir);
|
||||
}
|
||||
else
|
||||
Sys_Printf(cluster, "Couldn't open dir for demo listings\n");
|
||||
Sys_Printf(cluster, "Couldn't open dir %s for demo listings\n", cluster->demodir);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -144,6 +144,7 @@ void Fwd_ParseCommands(cluster_t *cluster, oproxy_t *prox)
|
|||
break;
|
||||
|
||||
packetlength = prox->inbuffer[0] + (prox->inbuffer[1]<<8);
|
||||
packetlength -= 2; //qqshka's inconsistent-upstream-sizes stupidity.
|
||||
if (packetlength+2 > prox->inbuffersize)
|
||||
break;
|
||||
|
||||
|
@ -471,7 +472,7 @@ void Prox_SendInitialPlayers(sv_t *qtv, oproxy_t *prox, netmsg_t *msg)
|
|||
|
||||
for (j = 0 ; j < 3 ; j++)
|
||||
if (flags & (DF_ORIGIN << j))
|
||||
WriteShort (msg, qtv->map.players[i].current.origin[j]);
|
||||
WriteCoord (msg, qtv->map.players[i].current.origin[j], qtv->pext1);
|
||||
|
||||
for (j = 0 ; j < 3 ; j++)
|
||||
if (flags & (DF_ANGLES << j))
|
||||
|
|
140
fteqtv/qw.c
140
fteqtv/qw.c
|
@ -158,6 +158,8 @@ void BuildServerData(sv_t *tv, netmsg_t *msg, int servercount, viewer_t *viewer)
|
|||
{
|
||||
movevars_t movevars;
|
||||
WriteByte(msg, svc_serverdata);
|
||||
if (viewer)
|
||||
{ //its for an actual viewer, tailor the extensions...
|
||||
if (viewer->pext1)
|
||||
{
|
||||
WriteLong(msg, PROTOCOL_VERSION_FTE);
|
||||
|
@ -168,6 +170,20 @@ void BuildServerData(sv_t *tv, netmsg_t *msg, int servercount, viewer_t *viewer)
|
|||
WriteLong(msg, PROTOCOL_VERSION_FTE2);
|
||||
WriteLong(msg, viewer->pext2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //we're just forwarding, use the same extensions our source used.
|
||||
if (tv->pext1)
|
||||
{
|
||||
WriteLong(msg, PROTOCOL_VERSION_FTE);
|
||||
WriteLong(msg, tv->pext1);
|
||||
}
|
||||
if (tv->pext2)
|
||||
{
|
||||
WriteLong(msg, PROTOCOL_VERSION_FTE2);
|
||||
WriteLong(msg, tv->pext2);
|
||||
}
|
||||
}
|
||||
WriteLong(msg, PROTOCOL_VERSION);
|
||||
WriteLong(msg, servercount);
|
||||
|
||||
|
@ -3107,10 +3123,73 @@ tuiadmin:
|
|||
}
|
||||
}
|
||||
|
||||
void QTV_Say(cluster_t *cluster, sv_t *qtv, viewer_t *v, char *message, qboolean noupwards)
|
||||
static void QTV_DoSay(cluster_t *cluster, sv_t *qtv, const char *viewername, char *message)
|
||||
{
|
||||
char buf[1024];
|
||||
netmsg_t msg;
|
||||
viewer_t *ov;
|
||||
|
||||
if (cluster->notalking)
|
||||
return;
|
||||
|
||||
if (qtv)
|
||||
SV_SayToUpstream(qtv, message);
|
||||
|
||||
for (ov = cluster->viewers; ov; ov = ov->next)
|
||||
{
|
||||
if (ov->server != qtv)
|
||||
continue;
|
||||
|
||||
InitNetMsg(&msg, buf, sizeof(buf));
|
||||
|
||||
WriteByte(&msg, svc_print);
|
||||
|
||||
if (ov->netchan.isnqprotocol)
|
||||
{
|
||||
WriteByte(&msg, 1);
|
||||
WriteByte(&msg, '[');
|
||||
WriteString2(&msg, "QTV");
|
||||
WriteByte(&msg, ']');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ov->conmenussupported)
|
||||
{
|
||||
WriteByte(&msg, 2); //PRINT_HIGH
|
||||
WriteByte(&msg, 91+128);
|
||||
WriteString2(&msg, "QTV");
|
||||
WriteByte(&msg, 93+128);
|
||||
WriteString2(&msg, "^5");
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteByte(&msg, 2); //PRINT_HIGH
|
||||
WriteByte(&msg, 91+128);
|
||||
WriteString2(&msg, "QTV");
|
||||
WriteByte(&msg, 93+128);
|
||||
WriteByte(&msg, 0);
|
||||
|
||||
WriteByte(&msg, svc_print);
|
||||
WriteByte(&msg, 3); //PRINT_CHAT
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
WriteString2(&msg, viewername);
|
||||
WriteString2(&msg, ": ");
|
||||
// WriteString2(&msg, "\x8d ");
|
||||
if (ov->conmenussupported)
|
||||
WriteString2(&msg, "^s");
|
||||
WriteString2(&msg, message);
|
||||
WriteString(&msg, "\n");
|
||||
|
||||
SendBufferToViewer(ov, msg.data, msg.cursize, true);
|
||||
}
|
||||
}
|
||||
|
||||
void QTV_Say(cluster_t *cluster, sv_t *qtv, viewer_t *v, char *message, qboolean noupwards)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
if (message[strlen(message)-1] == '\"')
|
||||
message[strlen(message)-1] = '\0';
|
||||
|
@ -3257,8 +3336,6 @@ void QTV_Say(cluster_t *cluster, sv_t *qtv, viewer_t *v, char *message, qboolean
|
|||
}
|
||||
else
|
||||
{
|
||||
viewer_t *ov;
|
||||
|
||||
// If the current viewer is the player, pass on the say_team
|
||||
if (qtv && qtv->controller == v)
|
||||
{
|
||||
|
@ -3266,62 +3343,7 @@ void QTV_Say(cluster_t *cluster, sv_t *qtv, viewer_t *v, char *message, qboolean
|
|||
return;
|
||||
}
|
||||
|
||||
if (cluster->notalking)
|
||||
return;
|
||||
|
||||
if (v->server)
|
||||
SV_SayToUpstream(v->server, message);
|
||||
|
||||
for (ov = cluster->viewers; ov; ov = ov->next)
|
||||
{
|
||||
if (ov->server != v->server)
|
||||
continue;
|
||||
|
||||
InitNetMsg(&msg, buf, sizeof(buf));
|
||||
|
||||
WriteByte(&msg, svc_print);
|
||||
|
||||
if (ov->netchan.isnqprotocol)
|
||||
{
|
||||
WriteByte(&msg, 1);
|
||||
WriteByte(&msg, '[');
|
||||
WriteString2(&msg, "QTV");
|
||||
WriteByte(&msg, ']');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ov->conmenussupported)
|
||||
{
|
||||
WriteByte(&msg, 2); //PRINT_HIGH
|
||||
WriteByte(&msg, 91+128);
|
||||
WriteString2(&msg, "QTV");
|
||||
WriteByte(&msg, 93+128);
|
||||
WriteString2(&msg, "^5");
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteByte(&msg, 2); //PRINT_HIGH
|
||||
WriteByte(&msg, 91+128);
|
||||
WriteString2(&msg, "QTV");
|
||||
WriteByte(&msg, 93+128);
|
||||
WriteByte(&msg, 0);
|
||||
|
||||
WriteByte(&msg, svc_print);
|
||||
WriteByte(&msg, 3); //PRINT_CHAT
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
WriteString2(&msg, v->name);
|
||||
WriteString2(&msg, ": ");
|
||||
// WriteString2(&msg, "\x8d ");
|
||||
if (ov->conmenussupported)
|
||||
WriteString2(&msg, "^s");
|
||||
WriteString2(&msg, message);
|
||||
WriteString(&msg, "\n");
|
||||
|
||||
SendBufferToViewer(ov, msg.data, msg.cursize, true);
|
||||
}
|
||||
QTV_DoSay(cluster, v->server, v->name, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -990,9 +990,10 @@ qboolean Net_WriteUpstream(sv_t *qtv)
|
|||
void SV_SendUpstream(sv_t *qtv, netmsg_t *nm)
|
||||
{
|
||||
char size[2];
|
||||
int ffs = nm->cursize+2; //qq fucked up and made his upstream inconsistent with downstream. ffs.
|
||||
|
||||
size[0] = (nm->cursize&0x00ff)>>0;
|
||||
size[1] = (nm->cursize&0xff00)>>8;
|
||||
size[0] = (ffs&0x00ff)>>0;
|
||||
size[1] = (ffs&0xff00)>>8;
|
||||
Net_QueueUpstream(qtv, 2, size);
|
||||
Net_QueueUpstream(qtv, nm->cursize, nm->data);
|
||||
Net_WriteUpstream(qtv); //try and flush it
|
||||
|
|
Loading…
Reference in a new issue