1
0
Fork 0
forked from fte/fteqw

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.
This commit is contained in:
Shpoike 2025-01-26 06:13:09 +00:00
parent f101a82066
commit 12721c764b
4 changed files with 101 additions and 43 deletions

View file

@ -437,7 +437,7 @@ void Prox_SendPlayerStats(sv_t *qtv, oproxy_t *prox)
if (msg.cursize) if (msg.cursize)
{ {
// Prox_SendMessage(prox, msg.data, msg.cursize, dem_stats|(player<<3), (1<<player)); Prox_SendMessage(qtv->cluster, prox, msg.data, msg.cursize, dem_stats|(player<<3), (1<<player));
msg.cursize = 0; msg.cursize = 0;
} }
} }
@ -477,7 +477,7 @@ void Prox_SendInitialPlayers(sv_t *qtv, oproxy_t *prox, netmsg_t *msg)
for (j = 0 ; j < 3 ; j++) for (j = 0 ; j < 3 ; j++)
if (flags & (DF_ANGLES << j)) if (flags & (DF_ANGLES << j))
WriteShort (msg, qtv->map.players[i].current.angles[j]); WriteShort (msg, (qtv->map.players[i].current.angles[j]/360.0f)*0x10000);
if (flags & DF_MODEL) // generally, that why we wrote this function, so YES send this if (flags & DF_MODEL) // generally, that why we wrote this function, so YES send this
WriteByte (msg, qtv->map.players[i].current.modelindex); WriteByte (msg, qtv->map.players[i].current.modelindex);

View file

@ -149,7 +149,7 @@ static void ParseServerData(sv_t *tv, netmsg_t *m, int to, unsigned int playerma
// supported |= PEXT_CHUNKEDDOWNLOADS; //shouldn't be relevant... // supported |= PEXT_CHUNKEDDOWNLOADS; //shouldn't be relevant...
supported |= PEXT_TRANS|PEXT_MODELDBL|PEXT_ENTITYDBL|PEXT_ENTITYDBL2|PEXT_SOUNDDBL; supported |= PEXT_TRANS|PEXT_MODELDBL|PEXT_ENTITYDBL|PEXT_ENTITYDBL2|PEXT_SOUNDDBL;
//replaced by replacementdeltas. we parse these, but we don't actually forward the data right now //replaced by replacementdeltas.
supported |= PEXT_SCALE|PEXT_TRANS|PEXT_FATNESS|PEXT_COLOURMOD|PEXT_HEXEN2|PEXT_SETATTACHMENT|PEXT_DPFLAGS; supported |= PEXT_SCALE|PEXT_TRANS|PEXT_FATNESS|PEXT_COLOURMOD|PEXT_HEXEN2|PEXT_SETATTACHMENT|PEXT_DPFLAGS;
//stuff that we ought to handle, but don't currently //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
//totally optional... so will probably never be added... //totally optional... so will probably never be added...
//PEXT_HULLSIZE - bigger players... maybe. like anyone can depend on this... not supported with mvd players so w/e //PEXT_HULLSIZE - bigger players... maybe. like anyone can depend on this... not supported with mvd players so w/e
//PEXT_CHUNKEDDOWNLOADS - not sure there's much point //PEXT_CHUNKEDDOWNLOADS - not sure there's much point
//PEXT_SPLITSCREEN - irrelevant for mvds. might be useful as a qw client, but who cares. //PEXT_SPLITSCREEN - irrelevant for mvds. might be useful as a qw client, but who cares. not enough servers have it active.
//PEXT_SHOWPIC - rare, lame, limited. just yuck. //PEXT_SHOWPIC - rare, lame, limited. just yuck.
if (protocol & ~supported) if (protocol & ~supported)
@ -919,34 +919,34 @@ static void ParseEntityDelta(sv_t *tv, netmsg_t *m, const entity_state_t *old, e
if (flags & UX_ALPHA) if (flags & UX_ALPHA)
new->alpha = ReadByte(m); new->alpha = ReadByte(m);
if (flags & UX_FATNESS) if (flags & UX_FATNESS)
/*new->fatness = (signed char)*/ReadByte(m); new->fatness = (signed char)ReadByte(m);
if (flags & UX_DRAWFLAGS) if (flags & UX_DRAWFLAGS)
/*new->hexen2flags =*/ ReadByte(m); new->drawflags = ReadByte(m);
if (flags & UX_ABSLIGHT) if (flags & UX_ABSLIGHT)
/*new->abslight =*/ ReadByte(m); new->abslight = ReadByte(m);
if (flags & UX_COLOURMOD) if (flags & UX_COLOURMOD)
{ {
/*new->colormod[0] =*/ ReadByte(m); new->colormod[0] = ReadByte(m);
/*new->colormod[1] =*/ ReadByte(m); new->colormod[1] = ReadByte(m);
/*new->colormod[2] =*/ ReadByte(m); new->colormod[2] = ReadByte(m);
} }
if (flags & UX_DPFLAGS) if (flags & UX_DPFLAGS)
{ // these are bits for the 'flags' field of the entity_state_t { // these are bits for the 'flags' field of the entity_state_t
/*new->dpflags =*/ ReadByte(m); new->dpflags = ReadByte(m);
} }
if (flags & UX_TAGINFO) if (flags & UX_TAGINFO)
{ {
/*new->tagentity =*/ ReadShort(m); new->tagentity = ReadShort(m);
/*new->tagindex =*/ ReadShort(m); new->tagindex = ReadShort(m);
} }
if (flags & UX_LIGHT) if (flags & UX_LIGHT)
{ {
/*new->light[0] =*/ ReadShort(m); new->light[0] = ReadShort(m);
/*new->light[1] =*/ ReadShort(m); new->light[1] = ReadShort(m);
/*new->light[2] =*/ ReadShort(m); new->light[2] = ReadShort(m);
/*new->light[3] =*/ ReadShort(m); new->light[3] = ReadShort(m);
/*new->lightstyle =*/ ReadByte(m); new->lightstyle = ReadByte(m);
/*new->lightpflags =*/ ReadByte(m); new->lightpflags = ReadByte(m);
} }
if (flags & UX_EFFECTS16) if (flags & UX_EFFECTS16)
new->effects = (new->effects&0x00ff)|(ReadByte(m)<<8); new->effects = (new->effects&0x00ff)|(ReadByte(m)<<8);

View file

@ -383,22 +383,29 @@ typedef struct {
unsigned short modelindex; unsigned short modelindex;
unsigned char colormap; unsigned char colormap;
unsigned char skinnum; unsigned char skinnum;
float origin[3]; float origin[3];
float angles[3]; float angles[3];
unsigned short effects; unsigned short effects;
unsigned char alpha;
unsigned char scale; unsigned char scale;
// unsigned char fatness; unsigned char fatness;
// unsigned char abslight;
// unsigned char h2flags; unsigned char colormod[3];
// unsigned char colormod[3]; unsigned char alpha;
// unsigned short light[4];
// unsigned char lightstyle; unsigned short light[4];
// unsigned char lightpflags;
// unsigned char tagentity; unsigned char lightstyle;
// unsigned char tagindex; unsigned char lightpflags;
unsigned char abslight;
unsigned char drawflags;
unsigned char dpflags;
unsigned char tagindex; //networked as a short, should have been a byte to match dpp5+.
unsigned short tagentity;
} entity_state_t; } entity_state_t;
typedef struct { typedef struct { //qw does players weirdly.
unsigned char frame; unsigned char frame;
unsigned char modelindex; unsigned char modelindex;
//colormap //colormap

View file

@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static const filename_t ConnectionlessModelList[] = {{""}, {"maps/start.bsp"}, {"progs/player.mdl"}, {""}}; static const filename_t ConnectionlessModelList[] = {{""}, {"maps/start.bsp"}, {"progs/player.mdl"}, {""}};
static const filename_t ConnectionlessSoundList[] = {{""}, {""}}; static const filename_t ConnectionlessSoundList[] = {{""}, {""}};
const entity_state_t nullentstate = {0};
void SV_WriteDelta(int entnum, const entity_state_t *from, const entity_state_t *to, netmsg_t *msg, qboolean force, unsigned int pext);
const intermission_t nullstreamspot = {{544, 288, 64}, {0, 90, 0}}; const intermission_t nullstreamspot = {{544, 288, 64}, {0, 90, 0}};
@ -536,9 +538,17 @@ int SendCurrentBaselines(sv_t *tv, int cursize, netmsg_t *msg, int maxbuffersize
if (tv->map.entity[i].baseline.modelindex) if (tv->map.entity[i].baseline.modelindex)
{ {
WriteByte(msg, svc_spawnbaseline); if (tv->pext1 & PEXT_SPAWNSTATIC2)
WriteShort(msg, i); {
WriteEntityState(msg, &tv->map.entity[i].baseline, tv->pext1); WriteByte(msg, svcfte_spawnbaseline2);
SV_WriteDelta(i, &nullentstate, &tv->map.entity[i].baseline, msg, true, tv->pext1);
}
else
{
WriteByte(msg, svc_spawnbaseline);
WriteShort(msg, i);
WriteEntityState(msg, &tv->map.entity[i].baseline, tv->pext1);
}
} }
} }
@ -600,8 +610,16 @@ int SendStaticEntities(sv_t *tv, int cursize, netmsg_t *msg, int maxbuffersize,
if (!tv->map.spawnstatic[i].modelindex) if (!tv->map.spawnstatic[i].modelindex)
continue; continue;
WriteByte(msg, svc_spawnstatic); if (tv->pext1 & PEXT_SPAWNSTATIC2)
WriteEntityState(msg, &tv->map.spawnstatic[i], tv->pext1); {
WriteByte(msg, svcfte_spawnstatic2);
SV_WriteDelta(i, &nullentstate, &tv->map.spawnstatic[i], msg, true, tv->pext1);
}
else
{
WriteByte(msg, svc_spawnstatic);
WriteEntityState(msg, &tv->map.spawnstatic[i], tv->pext1);
}
} }
return i; return i;
@ -892,7 +910,7 @@ void NewNQClient(cluster_t *cluster, netadr_t *addr)
int len; int len;
int i; int i;
unsigned char buffer[64]; unsigned char buffer[64];
viewer_t *viewer = NULL;; viewer_t *viewer = NULL;
if (cluster->numviewers >= cluster->maxviewers && cluster->maxviewers) 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
bits |= U_FRAME; bits |= U_FRAME;
if ((from->effects&0xff) != (to->effects&0xff)) if ((from->effects&0xff) != (to->effects&0xff))
bits |= U_EFFECTS; bits |= U_EFFECTS;
if ((from->effects&0xff00) != (to->effects&0xff00))
if ((from->effects&0xff00) != (to->effects&0xff00) &&
pext & PEXT_DPFLAGS)
bits |= UX_EFFECTS16; bits |= UX_EFFECTS16;
if (from->alpha != to->alpha) if (from->alpha != to->alpha &&
pext & PEXT_TRANS)
bits |= UX_ALPHA; bits |= UX_ALPHA;
if (from->scale != to->scale) if (from->scale != to->scale &&
pext & PEXT_SCALE)
bits |= UX_SCALE; bits |= UX_SCALE;
if (from->fatness != to->fatness &&
pext & PEXT_FATNESS)
bits |= UX_FATNESS;
if (from->drawflags != to->drawflags &&
pext & PEXT_HEXEN2)
bits |= UX_DRAWFLAGS;
if (from->abslight != to->abslight &&
pext & PEXT_HEXEN2)
bits |= UX_ABSLIGHT;
if ((from->colormod[0]!= to->colormod[0] ||
from->colormod[1] != to->colormod[1] ||
from->colormod[2] != to->colormod[2]) &&
pext & PEXT_COLOURMOD)
bits |= UX_COLOURMOD;
if (from->dpflags != to->dpflags &&
pext & PEXT_DPFLAGS)
bits |= UX_DPFLAGS;
if ((from->tagentity != to->tagentity ||
from->tagindex != to->tagindex) &&
pext & PEXT_SETATTACHMENT)
bits |= UX_TAGINFO;
if ((from->light[0] != to->light[0] ||
from->light[1] != to->light[1] ||
from->light[2] != to->light[2] ||
from->light[3] != to->light[3] ||
from->lightstyle != to->lightstyle ||
from->lightpflags != to->lightpflags) &&
pext & PEXT_DPFLAGS)
bits |= UX_LIGHT;
if (bits & 0xff000000) if (bits & 0xff000000)
bits |= UX_YETMORE; bits |= UX_YETMORE;
@ -1608,10 +1659,10 @@ void SV_WriteDelta(int entnum, const entity_state_t *from, const entity_state_t
WriteByte (msg, to->scale); WriteByte (msg, to->scale);
if (bits & UX_ALPHA) if (bits & UX_ALPHA)
WriteByte (msg, to->alpha); WriteByte (msg, to->alpha);
/* if (bits & UX_FATNESS) if (bits & UX_FATNESS)
WriteByte (msg, to->fatness); WriteByte (msg, to->fatness);
if (bits & UX_DRAWFLAGS) if (bits & UX_DRAWFLAGS)
WriteByte (msg, to->hexen2flags); WriteByte (msg, to->drawflags);
if (bits & UX_ABSLIGHT) if (bits & UX_ABSLIGHT)
WriteByte (msg, to->abslight); WriteByte (msg, to->abslight);
if (bits & UX_COLOURMOD) if (bits & UX_COLOURMOD)
@ -1637,12 +1688,11 @@ void SV_WriteDelta(int entnum, const entity_state_t *from, const entity_state_t
WriteShort (msg, to->light[3]); WriteShort (msg, to->light[3]);
WriteByte (msg, to->lightstyle); WriteByte (msg, to->lightstyle);
WriteByte (msg, to->lightpflags); WriteByte (msg, to->lightpflags);
}*/ }
if (bits & UX_EFFECTS16) if (bits & UX_EFFECTS16)
WriteByte (msg, to->effects>>8); WriteByte (msg, to->effects>>8);
} }
const entity_state_t nullentstate = {0};
void SV_EmitPacketEntities (const sv_t *qtv, const viewer_t *v, const packet_entities_t *to, netmsg_t *msg) void SV_EmitPacketEntities (const sv_t *qtv, const viewer_t *v, const packet_entities_t *to, netmsg_t *msg)
{ {
const entity_state_t *baseline; const entity_state_t *baseline;
@ -2607,6 +2657,7 @@ void UpdateStats(sv_t *qtv, viewer_t *v)
} }
//returns the next prespawn 'buffer' number to use, or -1 if no more //returns the next prespawn 'buffer' number to use, or -1 if no more
//FIXME: viewer may support fewer/different extensions vs the the stream.
int Prespawn(sv_t *qtv, int curmsgsize, netmsg_t *msg, int bufnum, int thisplayer) int Prespawn(sv_t *qtv, int curmsgsize, netmsg_t *msg, int bufnum, int thisplayer)
{ {
int r, ni; int r, ni;