@@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
24
25
25
static const filename_t ConnectionlessModelList [] = {{"" }, {"maps/start.bsp" }, {"progs/player.mdl" }, {"" }};
26
26
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 );
27
29
28
30
const intermission_t nullstreamspot = {{544 , 288 , 64 }, {0 , 90 , 0 }};
29
31
@@ -536,9 +538,17 @@ int SendCurrentBaselines(sv_t *tv, int cursize, netmsg_t *msg, int maxbuffersize
536
538
537
539
if (tv -> map .entity [i ].baseline .modelindex )
538
540
{
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
+ }
542
552
}
543
553
}
544
554
@@ -600,8 +610,16 @@ int SendStaticEntities(sv_t *tv, int cursize, netmsg_t *msg, int maxbuffersize,
600
610
if (!tv -> map .spawnstatic [i ].modelindex )
601
611
continue ;
602
612
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
+ }
605
623
}
606
624
607
625
return i ;
@@ -892,7 +910,7 @@ void NewNQClient(cluster_t *cluster, netadr_t *addr)
892
910
int len ;
893
911
int i ;
894
912
unsigned char buffer [64 ];
895
- viewer_t * viewer = NULL ;;
913
+ viewer_t * viewer = NULL ;
896
914
897
915
898
916
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
1549
1567
bits |= U_FRAME ;
1550
1568
if ((from -> effects & 0xff ) != (to -> effects & 0xff ))
1551
1569
bits |= U_EFFECTS ;
1552
- if ((from -> effects & 0xff00 ) != (to -> effects & 0xff00 ))
1570
+
1571
+ if ((from -> effects & 0xff00 ) != (to -> effects & 0xff00 ) &&
1572
+ pext & PEXT_DPFLAGS )
1553
1573
bits |= UX_EFFECTS16 ;
1554
- if (from -> alpha != to -> alpha )
1574
+ if (from -> alpha != to -> alpha &&
1575
+ pext & PEXT_TRANS )
1555
1576
bits |= UX_ALPHA ;
1556
- if (from -> scale != to -> scale )
1577
+ if (from -> scale != to -> scale &&
1578
+ pext & PEXT_SCALE )
1557
1579
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 ;
1558
1609
1559
1610
if (bits & 0xff000000 )
1560
1611
bits |= UX_YETMORE ;
@@ -1608,10 +1659,10 @@ void SV_WriteDelta(int entnum, const entity_state_t *from, const entity_state_t
1608
1659
WriteByte (msg , to -> scale );
1609
1660
if (bits & UX_ALPHA )
1610
1661
WriteByte (msg , to -> alpha );
1611
- /* if (bits & UX_FATNESS)
1662
+ if (bits & UX_FATNESS )
1612
1663
WriteByte (msg , to -> fatness );
1613
1664
if (bits & UX_DRAWFLAGS )
1614
- WriteByte (msg, to->hexen2flags );
1665
+ WriteByte (msg , to -> drawflags );
1615
1666
if (bits & UX_ABSLIGHT )
1616
1667
WriteByte (msg , to -> abslight );
1617
1668
if (bits & UX_COLOURMOD )
@@ -1637,12 +1688,11 @@ void SV_WriteDelta(int entnum, const entity_state_t *from, const entity_state_t
1637
1688
WriteShort (msg , to -> light [3 ]);
1638
1689
WriteByte (msg , to -> lightstyle );
1639
1690
WriteByte (msg , to -> lightpflags );
1640
- }*/
1691
+ }
1641
1692
if (bits & UX_EFFECTS16 )
1642
1693
WriteByte (msg , to -> effects >>8 );
1643
1694
}
1644
1695
1645
- const entity_state_t nullentstate = {0 };
1646
1696
void SV_EmitPacketEntities (const sv_t * qtv , const viewer_t * v , const packet_entities_t * to , netmsg_t * msg )
1647
1697
{
1648
1698
const entity_state_t * baseline ;
@@ -2607,6 +2657,7 @@ void UpdateStats(sv_t *qtv, viewer_t *v)
2607
2657
}
2608
2658
2609
2659
//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.
2610
2661
int Prespawn (sv_t * qtv , int curmsgsize , netmsg_t * msg , int bufnum , int thisplayer )
2611
2662
{
2612
2663
int r , ni ;
0 commit comments