Skip to content

Commit 12721c7

Browse files
committed
Nano seems intent on having mvds with a few more twiddles in them - enable some of that stuff in qtv so as to not be caught out.
also fix a couple of bugs.
1 parent f101a82 commit 12721c7

File tree

4 files changed

+101
-43
lines changed

4 files changed

+101
-43
lines changed

fteqtv/forward.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ void Prox_SendPlayerStats(sv_t *qtv, oproxy_t *prox)
437437

438438
if (msg.cursize)
439439
{
440-
// Prox_SendMessage(prox, msg.data, msg.cursize, dem_stats|(player<<3), (1<<player));
440+
Prox_SendMessage(qtv->cluster, prox, msg.data, msg.cursize, dem_stats|(player<<3), (1<<player));
441441
msg.cursize = 0;
442442
}
443443
}
@@ -477,7 +477,7 @@ void Prox_SendInitialPlayers(sv_t *qtv, oproxy_t *prox, netmsg_t *msg)
477477

478478
for (j = 0 ; j < 3 ; j++)
479479
if (flags & (DF_ANGLES << j))
480-
WriteShort (msg, qtv->map.players[i].current.angles[j]);
480+
WriteShort (msg, (qtv->map.players[i].current.angles[j]/360.0f)*0x10000);
481481

482482
if (flags & DF_MODEL) // generally, that why we wrote this function, so YES send this
483483
WriteByte (msg, qtv->map.players[i].current.modelindex);

fteqtv/parse.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static void ParseServerData(sv_t *tv, netmsg_t *m, int to, unsigned int playerma
149149
// supported |= PEXT_CHUNKEDDOWNLOADS; //shouldn't be relevant...
150150
supported |= PEXT_TRANS|PEXT_MODELDBL|PEXT_ENTITYDBL|PEXT_ENTITYDBL2|PEXT_SOUNDDBL;
151151

152-
//replaced by replacementdeltas. we parse these, but we don't actually forward the data right now
152+
//replaced by replacementdeltas.
153153
supported |= PEXT_SCALE|PEXT_TRANS|PEXT_FATNESS|PEXT_COLOURMOD|PEXT_HEXEN2|PEXT_SETATTACHMENT|PEXT_DPFLAGS;
154154

155155
//stuff that we ought to handle, but don't currently
@@ -163,7 +163,7 @@ static void ParseServerData(sv_t *tv, netmsg_t *m, int to, unsigned int playerma
163163
//totally optional... so will probably never be added...
164164
//PEXT_HULLSIZE - bigger players... maybe. like anyone can depend on this... not supported with mvd players so w/e
165165
//PEXT_CHUNKEDDOWNLOADS - not sure there's much point
166-
//PEXT_SPLITSCREEN - irrelevant for mvds. might be useful as a qw client, but who cares.
166+
//PEXT_SPLITSCREEN - irrelevant for mvds. might be useful as a qw client, but who cares. not enough servers have it active.
167167
//PEXT_SHOWPIC - rare, lame, limited. just yuck.
168168

169169
if (protocol & ~supported)
@@ -919,34 +919,34 @@ static void ParseEntityDelta(sv_t *tv, netmsg_t *m, const entity_state_t *old, e
919919
if (flags & UX_ALPHA)
920920
new->alpha = ReadByte(m);
921921
if (flags & UX_FATNESS)
922-
/*new->fatness = (signed char)*/ReadByte(m);
922+
new->fatness = (signed char)ReadByte(m);
923923
if (flags & UX_DRAWFLAGS)
924-
/*new->hexen2flags =*/ ReadByte(m);
924+
new->drawflags = ReadByte(m);
925925
if (flags & UX_ABSLIGHT)
926-
/*new->abslight =*/ ReadByte(m);
926+
new->abslight = ReadByte(m);
927927
if (flags & UX_COLOURMOD)
928928
{
929-
/*new->colormod[0] =*/ ReadByte(m);
930-
/*new->colormod[1] =*/ ReadByte(m);
931-
/*new->colormod[2] =*/ ReadByte(m);
929+
new->colormod[0] = ReadByte(m);
930+
new->colormod[1] = ReadByte(m);
931+
new->colormod[2] = ReadByte(m);
932932
}
933933
if (flags & UX_DPFLAGS)
934934
{ // these are bits for the 'flags' field of the entity_state_t
935-
/*new->dpflags =*/ ReadByte(m);
935+
new->dpflags = ReadByte(m);
936936
}
937937
if (flags & UX_TAGINFO)
938938
{
939-
/*new->tagentity =*/ ReadShort(m);
940-
/*new->tagindex =*/ ReadShort(m);
939+
new->tagentity = ReadShort(m);
940+
new->tagindex = ReadShort(m);
941941
}
942942
if (flags & UX_LIGHT)
943943
{
944-
/*new->light[0] =*/ ReadShort(m);
945-
/*new->light[1] =*/ ReadShort(m);
946-
/*new->light[2] =*/ ReadShort(m);
947-
/*new->light[3] =*/ ReadShort(m);
948-
/*new->lightstyle =*/ ReadByte(m);
949-
/*new->lightpflags =*/ ReadByte(m);
944+
new->light[0] = ReadShort(m);
945+
new->light[1] = ReadShort(m);
946+
new->light[2] = ReadShort(m);
947+
new->light[3] = ReadShort(m);
948+
new->lightstyle = ReadByte(m);
949+
new->lightpflags = ReadByte(m);
950950
}
951951
if (flags & UX_EFFECTS16)
952952
new->effects = (new->effects&0x00ff)|(ReadByte(m)<<8);

fteqtv/qtv.h

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -383,22 +383,29 @@ typedef struct {
383383
unsigned short modelindex;
384384
unsigned char colormap;
385385
unsigned char skinnum;
386+
386387
float origin[3];
387388
float angles[3];
389+
388390
unsigned short effects;
389-
unsigned char alpha;
390391
unsigned char scale;
391-
// unsigned char fatness;
392-
// unsigned char abslight;
393-
// unsigned char h2flags;
394-
// unsigned char colormod[3];
395-
// unsigned short light[4];
396-
// unsigned char lightstyle;
397-
// unsigned char lightpflags;
398-
// unsigned char tagentity;
399-
// unsigned char tagindex;
392+
unsigned char fatness;
393+
394+
unsigned char colormod[3];
395+
unsigned char alpha;
396+
397+
unsigned short light[4];
398+
399+
unsigned char lightstyle;
400+
unsigned char lightpflags;
401+
unsigned char abslight;
402+
unsigned char drawflags;
403+
404+
unsigned char dpflags;
405+
unsigned char tagindex; //networked as a short, should have been a byte to match dpp5+.
406+
unsigned short tagentity;
400407
} entity_state_t;
401-
typedef struct {
408+
typedef struct { //qw does players weirdly.
402409
unsigned char frame;
403410
unsigned char modelindex;
404411
//colormap

fteqtv/qw.c

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2424

2525
static const filename_t ConnectionlessModelList[] = {{""}, {"maps/start.bsp"}, {"progs/player.mdl"}, {""}};
2626
static const filename_t ConnectionlessSoundList[] = {{""}, {""}};
27+
const entity_state_t nullentstate = {0};
28+
void SV_WriteDelta(int entnum, const entity_state_t *from, const entity_state_t *to, netmsg_t *msg, qboolean force, unsigned int pext);
2729

2830
const intermission_t nullstreamspot = {{544, 288, 64}, {0, 90, 0}};
2931

@@ -536,9 +538,17 @@ int SendCurrentBaselines(sv_t *tv, int cursize, netmsg_t *msg, int maxbuffersize
536538

537539
if (tv->map.entity[i].baseline.modelindex)
538540
{
539-
WriteByte(msg, svc_spawnbaseline);
540-
WriteShort(msg, i);
541-
WriteEntityState(msg, &tv->map.entity[i].baseline, tv->pext1);
541+
if (tv->pext1 & PEXT_SPAWNSTATIC2)
542+
{
543+
WriteByte(msg, svcfte_spawnbaseline2);
544+
SV_WriteDelta(i, &nullentstate, &tv->map.entity[i].baseline, msg, true, tv->pext1);
545+
}
546+
else
547+
{
548+
WriteByte(msg, svc_spawnbaseline);
549+
WriteShort(msg, i);
550+
WriteEntityState(msg, &tv->map.entity[i].baseline, tv->pext1);
551+
}
542552
}
543553
}
544554

@@ -600,8 +610,16 @@ int SendStaticEntities(sv_t *tv, int cursize, netmsg_t *msg, int maxbuffersize,
600610
if (!tv->map.spawnstatic[i].modelindex)
601611
continue;
602612

603-
WriteByte(msg, svc_spawnstatic);
604-
WriteEntityState(msg, &tv->map.spawnstatic[i], tv->pext1);
613+
if (tv->pext1 & PEXT_SPAWNSTATIC2)
614+
{
615+
WriteByte(msg, svcfte_spawnstatic2);
616+
SV_WriteDelta(i, &nullentstate, &tv->map.spawnstatic[i], msg, true, tv->pext1);
617+
}
618+
else
619+
{
620+
WriteByte(msg, svc_spawnstatic);
621+
WriteEntityState(msg, &tv->map.spawnstatic[i], tv->pext1);
622+
}
605623
}
606624

607625
return i;
@@ -892,7 +910,7 @@ void NewNQClient(cluster_t *cluster, netadr_t *addr)
892910
int len;
893911
int i;
894912
unsigned char buffer[64];
895-
viewer_t *viewer = NULL;;
913+
viewer_t *viewer = NULL;
896914

897915

898916
if (cluster->numviewers >= cluster->maxviewers && cluster->maxviewers)
@@ -1549,12 +1567,45 @@ void SV_WriteDelta(int entnum, const entity_state_t *from, const entity_state_t
15491567
bits |= U_FRAME;
15501568
if ((from->effects&0xff) != (to->effects&0xff))
15511569
bits |= U_EFFECTS;
1552-
if ((from->effects&0xff00) != (to->effects&0xff00))
1570+
1571+
if ((from->effects&0xff00) != (to->effects&0xff00) &&
1572+
pext & PEXT_DPFLAGS)
15531573
bits |= UX_EFFECTS16;
1554-
if (from->alpha != to->alpha)
1574+
if (from->alpha != to->alpha &&
1575+
pext & PEXT_TRANS)
15551576
bits |= UX_ALPHA;
1556-
if (from->scale != to->scale)
1577+
if (from->scale != to->scale &&
1578+
pext & PEXT_SCALE)
15571579
bits |= UX_SCALE;
1580+
if (from->fatness != to->fatness &&
1581+
pext & PEXT_FATNESS)
1582+
bits |= UX_FATNESS;
1583+
if (from->drawflags != to->drawflags &&
1584+
pext & PEXT_HEXEN2)
1585+
bits |= UX_DRAWFLAGS;
1586+
if (from->abslight != to->abslight &&
1587+
pext & PEXT_HEXEN2)
1588+
bits |= UX_ABSLIGHT;
1589+
if ((from->colormod[0]!= to->colormod[0] ||
1590+
from->colormod[1] != to->colormod[1] ||
1591+
from->colormod[2] != to->colormod[2]) &&
1592+
pext & PEXT_COLOURMOD)
1593+
bits |= UX_COLOURMOD;
1594+
if (from->dpflags != to->dpflags &&
1595+
pext & PEXT_DPFLAGS)
1596+
bits |= UX_DPFLAGS;
1597+
if ((from->tagentity != to->tagentity ||
1598+
from->tagindex != to->tagindex) &&
1599+
pext & PEXT_SETATTACHMENT)
1600+
bits |= UX_TAGINFO;
1601+
if ((from->light[0] != to->light[0] ||
1602+
from->light[1] != to->light[1] ||
1603+
from->light[2] != to->light[2] ||
1604+
from->light[3] != to->light[3] ||
1605+
from->lightstyle != to->lightstyle ||
1606+
from->lightpflags != to->lightpflags) &&
1607+
pext & PEXT_DPFLAGS)
1608+
bits |= UX_LIGHT;
15581609

15591610
if (bits & 0xff000000)
15601611
bits |= UX_YETMORE;
@@ -1608,10 +1659,10 @@ void SV_WriteDelta(int entnum, const entity_state_t *from, const entity_state_t
16081659
WriteByte (msg, to->scale);
16091660
if (bits & UX_ALPHA)
16101661
WriteByte (msg, to->alpha);
1611-
/* if (bits & UX_FATNESS)
1662+
if (bits & UX_FATNESS)
16121663
WriteByte (msg, to->fatness);
16131664
if (bits & UX_DRAWFLAGS)
1614-
WriteByte (msg, to->hexen2flags);
1665+
WriteByte (msg, to->drawflags);
16151666
if (bits & UX_ABSLIGHT)
16161667
WriteByte (msg, to->abslight);
16171668
if (bits & UX_COLOURMOD)
@@ -1637,12 +1688,11 @@ void SV_WriteDelta(int entnum, const entity_state_t *from, const entity_state_t
16371688
WriteShort (msg, to->light[3]);
16381689
WriteByte (msg, to->lightstyle);
16391690
WriteByte (msg, to->lightpflags);
1640-
}*/
1691+
}
16411692
if (bits & UX_EFFECTS16)
16421693
WriteByte (msg, to->effects>>8);
16431694
}
16441695

1645-
const entity_state_t nullentstate = {0};
16461696
void SV_EmitPacketEntities (const sv_t *qtv, const viewer_t *v, const packet_entities_t *to, netmsg_t *msg)
16471697
{
16481698
const entity_state_t *baseline;
@@ -2607,6 +2657,7 @@ void UpdateStats(sv_t *qtv, viewer_t *v)
26072657
}
26082658

26092659
//returns the next prespawn 'buffer' number to use, or -1 if no more
2660+
//FIXME: viewer may support fewer/different extensions vs the the stream.
26102661
int Prespawn(sv_t *qtv, int curmsgsize, netmsg_t *msg, int bufnum, int thisplayer)
26112662
{
26122663
int r, ni;

0 commit comments

Comments
 (0)