2013-03-31 04:21:08 +00:00
# include "quakedef.h"
2004-08-23 00:15:46 +00:00
2015-09-01 04:45:15 +00:00
# if !defined(CLIENTONLY) && defined(NETPREPARSE)
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
/*Testing this code should typically be done with the three following mods:
Prydon gate
Nexuiz
FrikBots ( both NQ + QW ) .
If those 3 mods work , then pretty much everything else will
*/
//#define NEWPREPARSE
/*I want to rewrite this
to use something like
*/
# ifdef NEWPREPARSE
enum protocol_type
{
PPT_FLOAT ,
PPT_ENT ,
PPT_COORD ,
PPT_ANGLE ,
PPT_BYTE ,
PPT_SHORT ,
PPT_LONG ,
PPT_STRING
} ;
# define PPT_POS PPT_COORD,PPT_COORD,PPT_COORD
union protocol_data
{
float fd ;
int id ;
unsigned char * str ;
} ;
static union protocol_data pp_data [ 1024 ] ;
static enum protocol_type pp_temptypes [ 1024 ] , * pp_types ;
static unsigned char pp_sdata [ 4096 ] ;
static unsigned int pp_sdata_offset ;
static int pp_dest ;
static qboolean pp_fault ;
static unsigned int pp_expectedelements ;
static unsigned int pp_receivedelements ;
static qboolean ( * pp_curdecision ) ( enum protocol_type * pt , union protocol_data * pd ) ;
static enum protocol_type pp_root [ ] = { PPT_BYTE } ;
static qboolean pp_root_decide ( enum protocol_type * pt , union protocol_data * pd ) ;
static void decide ( enum protocol_type * types , unsigned int numtypes , qboolean ( * newdecision ) ( enum protocol_type * pt , union protocol_data * pd ) )
{
pp_types = types ;
pp_expectedelements = numtypes ;
pp_curdecision = newdecision ;
}
static void pp_flush ( multicast_t to , vec3_t origin , void ( * flushfunc ) ( client_t * cl , sizebuf_t * msg , enum protocol_type * pt , union protocol_data * pd ) , enum protocol_type * pt , union protocol_data * pd )
{
2011-05-29 04:26:29 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
client_t * client ;
qbyte * mask ;
int leafnum ;
int j ;
qboolean reliable ;
decide ( pp_root , 1 , pp_root_decide ) ;
{
reliable = false ;
switch ( to )
{
case MULTICAST_ALL_R :
reliable = true ; // intentional fallthrough
case MULTICAST_ALL :
2014-05-23 02:02:51 +00:00
mask = NULL ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
break ;
case MULTICAST_PHS_R :
reliable = true ; // intentional fallthrough
case MULTICAST_PHS :
if ( ! sv . phs )
2014-05-23 02:02:51 +00:00
mask = NULL ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
else
{
2014-05-23 02:02:51 +00:00
cluster = sv . world . worldmodel - > funcs . LeafnumForPoint ( sv . world . worldmodel , origin ) ;
if ( cluster > = 0 )
mask = sv . phs + cluster * 4 * ( ( sv . world . worldmodel - > numclusters + 31 ) > > 5 ) ;
else
mask = NULL ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
break ;
case MULTICAST_PVS_R :
reliable = true ; // intentional fallthrough
case MULTICAST_PVS :
2014-05-23 02:02:51 +00:00
cluster = sv . world . worldmodel - > funcs . LeafnumForPoint ( sv . world . worldmodel , origin ) ;
if ( cluster > = 0 )
mask = sv . pvs + cluster * 4 * ( ( sv . world . worldmodel - > numclusters + 31 ) > > 5 ) ;
else
mask = NULL ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
break ;
default :
return ;
}
// send the data to all relevent clients
2011-04-25 03:25:22 +00:00
for ( j = 0 , client = svs . clients ; j < sv . allocated_client_slots ; j + + , client + + )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
if ( client - > state ! = cs_spawned )
continue ;
if ( client - > controller )
continue ; //FIXME: send if at least one of the players is near enough.
if ( ! ( ( int ) client - > edict - > xv - > dimension_see & ( int ) pr_global_struct - > dimension_send ) )
continue ;
if ( to = = MULTICAST_PHS_R | | to = = MULTICAST_PHS )
{
vec3_t delta ;
VectorSubtract ( origin , client - > edict - > v - > origin , delta ) ;
if ( Length ( delta ) < = 1024 )
goto inrange ;
}
2014-05-23 02:02:51 +00:00
if ( mask )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
2014-05-23 02:02:51 +00:00
cluster = sv . world . worldmodel - > funcs . ClusterForPoint ( sv . world . worldmodel , client - > edict - > v - > origin ) ;
if ( cluster > = 0 & & ! ( mask [ leafnum > > 3 ] & ( 1 < < ( leafnum & 7 ) ) ) )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
continue ;
}
}
inrange :
if ( client - > protocol = = SCP_BAD )
{
/*bot*/
continue ;
}
if ( reliable )
flushfunc ( client , & client - > netchan . message , pt , pd ) ;
else
flushfunc ( client , & client - > datagram , pt , pd ) ;
}
}
/*
if ( sv . mvdrecording & & ! with ) //mvds don't get the pext stuff
{
2011-05-29 04:26:29 +00:00
flushfunc ( & dem . recorder ,
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( reliable )
{
MVDWrite_Begin ( dem_all , 0 , sv . multicast . cursize ) ;
2010-11-20 22:01:16 +00:00
SZ_Write ( & demo . dbuf - > sb , sv . multicast . data , sv . multicast . cursize ) ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
} else
SZ_Write ( & demo . datagram , sv . multicast . data , sv . multicast . cursize ) ;
} */
pp_sdata_offset = 0 ;
pp_receivedelements = 0 ;
}
# define DECIDE(t) decide(t, sizeof(t) / sizeof(*t), t##_decide)
# define DECIDE2(t,f) decide(t, sizeof(t) / sizeof(*t), f)
static void pp_identity_flush ( client_t * cl , sizebuf_t * msg , enum protocol_type * pt , union protocol_data * pd )
{
unsigned int i ;
for ( i = 0 ; i < pp_receivedelements ; i + + )
{
switch ( pt [ i ] )
{
case PPT_BYTE :
MSG_WriteByte ( msg , pd [ i ] . id ) ;
break ;
case PPT_ENT :
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
MSG_WriteEntity ( msg , pd [ i ] . id ) ;
break ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
case PPT_SHORT :
MSG_WriteShort ( msg , pd [ i ] . id ) ;
break ;
case PPT_COORD :
MSG_WriteCoord ( msg , pd [ i ] . fd ) ;
break ;
case PPT_ANGLE :
MSG_WriteAngle ( msg , pd [ i ] . fd ) ;
break ;
case PPT_STRING :
MSG_WriteString ( msg , pd [ i ] . str ) ;
break ;
}
}
}
/*flush is our last attempt to cope with unrecognised/invalid messages, it will send stuff though as it was, and most likely get things wrong*/
void NPP_Flush ( void )
{
pp_fault = false ;
pp_flush ( MULTICAST_ALL_R , NULL , pp_identity_flush , pp_types , pp_data ) ;
}
static void pp_entry ( int dest , enum protocol_type pt , union protocol_data pd )
{
if ( pp_receivedelements )
{
if ( pp_dest ! = dest )
{
if ( ! pp_fault )
Con_Printf ( " Preparse: MSG destination changed in the middle of a packet 0x%x. \n " , pp_data [ 0 ] . id ) ;
NPP_Flush ( ) ;
}
}
pp_dest = dest ;
if ( pp_fault )
{
pp_types [ pp_receivedelements ] = pt ;
pp_data [ pp_receivedelements ] = pd ;
pp_receivedelements + + ;
}
else if ( pp_types [ pp_receivedelements ] ! = pt )
{
Con_Printf ( " Preparse: Unmatched expectation at entry %i in svc 0x%x. \n " , pp_receivedelements + 1 , pp_data [ 0 ] . id ) ;
pp_types [ pp_receivedelements ] = pt ;
pp_data [ pp_receivedelements ] = pd ;
pp_receivedelements + + ;
faulted :
pp_fault = true ;
if ( pp_temptypes ! = pp_types )
{
memcpy ( pp_temptypes , pp_types , sizeof ( * pp_temptypes ) * pp_receivedelements ) ;
pp_types = pp_temptypes ;
}
}
else
{
pp_data [ pp_receivedelements + + ] = pd ;
if ( pp_expectedelements = = pp_receivedelements )
{
if ( ! pp_curdecision ( pp_types , pp_data ) )
{
if ( pp_types [ pp_receivedelements - 1 ] = = PPT_BYTE )
Con_Printf ( " Preparse: Unhandled byte %i@%i in svc%i. \n " , pd . id , pp_receivedelements , pp_data [ 0 ] . id ) ;
else
Con_Printf ( " Preparse: Unhandled data @%i in svc%i. \n " , pp_receivedelements , pp_data [ 0 ] . id ) ;
goto faulted ;
}
}
}
}
void NPP_NQWriteByte ( int dest , qbyte data )
{
union protocol_data pd ;
pd . id = data ;
pp_entry ( dest , PPT_BYTE , pd ) ;
}
void NPP_NQWriteChar ( int dest , char data )
{
union protocol_data pd ;
pd . id = ( unsigned char ) data ;
pp_entry ( dest , PPT_BYTE , pd ) ;
}
void NPP_NQWriteShort ( int dest , short data )
{
union protocol_data pd ;
pd . id = ( unsigned char ) data ;
pp_entry ( dest , PPT_SHORT , pd ) ;
}
void NPP_NQWriteLong ( int dest , long data )
{
union protocol_data pd ;
pd . id = data ;
pp_entry ( dest , PPT_LONG , pd ) ;
}
void NPP_NQWriteAngle ( int dest , float data )
{
union protocol_data pd ;
pd . fd = data ;
pp_entry ( dest , PPT_ANGLE , pd ) ;
}
void NPP_NQWriteCoord ( int dest , float data )
{
union protocol_data pd ;
pd . fd = data ;
pp_entry ( dest , PPT_COORD , pd ) ;
}
void NPP_NQWriteString ( int dest , char * data )
{
unsigned int l ;
union protocol_data pd ;
l = strlen ( data ) + 1 ;
if ( pp_sdata_offset + l > sizeof ( pp_sdata ) )
SV_Error ( " preparse string overflow \n " ) ;
pd . str = pp_sdata + pp_sdata_offset ;
memcpy ( pd . str , data , l ) ;
pp_entry ( dest , PPT_STRING , pd ) ;
}
void NPP_NQWriteEntity ( int dest , short data )
{
union protocol_data pd ;
pd . id = ( unsigned short ) data ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
pp_entry ( dest , PPT_ENTITY , pd ) ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
void NPP_QWWriteByte ( int dest , qbyte data )
{
NPP_NQWriteByte ( dest , data ) ;
}
void NPP_QWWriteChar ( int dest , char data )
{
NPP_NQWriteChar ( dest , data ) ;
}
void NPP_QWWriteShort ( int dest , short data )
{
NPP_NQWriteShort ( dest , data ) ;
}
void NPP_QWWriteLong ( int dest , long data )
{
NPP_NQWriteLong ( dest , data ) ;
}
void NPP_QWWriteAngle ( int dest , float data )
{
NPP_NQWriteAngle ( dest , data ) ;
}
void NPP_QWWriteCoord ( int dest , float data )
{
NPP_NQWriteCoord ( dest , data ) ;
}
void NPP_QWWriteString ( int dest , char * data )
{
NPP_NQWriteString ( dest , data ) ;
}
2014-10-11 19:39:45 +00:00
void NPP_QWWriteEntity ( int dest , int data )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
NPP_NQWriteEntity ( dest , data ) ;
}
static enum protocol_type pp_svc_temp_entity_beam [ ] = { PPT_BYTE , PPT_BYTE , PPT_ENT , PPT_POS , PPT_POS } ;
static void pp_svc_temp_entity_beam_flush ( client_t * cl , sizebuf_t * msg , enum protocol_type * pt , union protocol_data * pd )
{
MSG_WriteByte ( msg , pd [ 0 ] . id ) ;
MSG_WriteByte ( msg , pd [ 1 ] . id ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
MSG_WriteEntity ( msg , pd [ 2 ] . id ) ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
MSG_WriteCoord ( msg , pd [ 3 ] . fd ) ;
MSG_WriteCoord ( msg , pd [ 4 ] . fd ) ;
MSG_WriteCoord ( msg , pd [ 5 ] . fd ) ;
MSG_WriteCoord ( msg , pd [ 6 ] . fd ) ;
MSG_WriteCoord ( msg , pd [ 7 ] . fd ) ;
MSG_WriteCoord ( msg , pd [ 8 ] . fd ) ;
}
static qboolean pp_svc_temp_entity_beam_decide ( enum protocol_type * pt , union protocol_data * pd )
{
vec3_t org ;
org [ 0 ] = pd [ 3 ] . fd ;
org [ 1 ] = pd [ 4 ] . fd ;
org [ 2 ] = pd [ 5 ] . fd ;
pp_flush ( MULTICAST_PHS , org , pp_svc_temp_entity_beam_flush , pt , pd ) ;
return true ;
}
static void pp_svc_temp_entity_gunshot_flush ( client_t * cl , sizebuf_t * msg , enum protocol_type * pt , union protocol_data * pd )
{
int offset = ( progstype = = PROG_QW ) ? 3 : 2 ;
int count = ( offset = = 3 ) ? pd [ 2 ] . id : 1 ;
while ( count > 0 )
{
MSG_WriteByte ( msg , pd [ 0 ] . id ) ;
MSG_WriteByte ( msg , pd [ 1 ] . id ) ;
if ( cl - > protocol = = SCP_QUAKEWORLD )
{
if ( count > 255 )
{
MSG_WriteByte ( msg , 255 ) ;
count - = 255 ;
}
else
{
MSG_WriteByte ( msg , count ) ;
count = 0 ;
}
}
else
count - - ;
MSG_WriteCoord ( msg , pd [ offset + 0 ] . fd ) ;
MSG_WriteCoord ( msg , pd [ offset + 1 ] . fd ) ;
MSG_WriteCoord ( msg , pd [ offset + 2 ] . fd ) ;
}
}
static qboolean pp_svc_temp_entity_gunshot ( enum protocol_type * pt , union protocol_data * pd )
{
vec3_t org ;
int offset = ( progstype = = PROG_QW ) ? 3 : 2 ;
org [ 0 ] = pd [ offset + 0 ] . fd ;
org [ 1 ] = pd [ offset + 1 ] . fd ;
org [ 2 ] = pd [ offset + 2 ] . fd ;
pp_flush ( MULTICAST_PHS , org , pp_svc_temp_entity_gunshot_flush , pt , pd ) ;
return true ;
}
static qboolean pp_decide_pvs_2 ( enum protocol_type * pt , union protocol_data * pd )
{
vec3_t org ;
org [ 0 ] = pd [ 2 ] . fd ;
org [ 1 ] = pd [ 3 ] . fd ;
org [ 2 ] = pd [ 4 ] . fd ;
pp_flush ( MULTICAST_PVS , org , pp_identity_flush , pt , pd ) ;
return true ;
}
static qboolean pp_decide_phs_2 ( enum protocol_type * pt , union protocol_data * pd )
{
vec3_t org ;
org [ 0 ] = pd [ 2 ] . fd ;
org [ 1 ] = pd [ 3 ] . fd ;
org [ 2 ] = pd [ 4 ] . fd ;
pp_flush ( MULTICAST_PHS , org , pp_identity_flush , pt , pd ) ;
return true ;
}
static enum protocol_type pp_svc_temp_entity [ ] = { PPT_BYTE , PPT_BYTE } ;
static qboolean pp_svc_temp_entity_decide ( enum protocol_type * pt , union protocol_data * pd )
{
switch ( pd [ 1 ] . id )
{
case TE_LIGHTNING1 :
case TE_LIGHTNING2 :
case TE_LIGHTNING3 :
DECIDE ( pp_svc_temp_entity_beam ) ;
return true ;
case TE_EXPLOSION :
case TEDP_EXPLOSIONQUAD :
case TE_SPIKE :
case TE_SUPERSPIKE :
case TEDP_SPIKEQUAD :
case TEDP_SUPERSPIKEQUAD :
case TEDP_SMALLFLASH :
{
static enum protocol_type fmt [ ] = { PPT_BYTE , PPT_BYTE , PPT_POS } ;
DECIDE2 ( fmt , pp_decide_phs_2 ) ;
}
return true ;
case TEDP_GUNSHOTQUAD :
case TE_TAREXPLOSION :
case TE_WIZSPIKE :
case TE_KNIGHTSPIKE :
case TE_LAVASPLASH :
case TE_TELEPORT :
{
static enum protocol_type fmt [ ] = { PPT_BYTE , PPT_BYTE , PPT_POS } ;
DECIDE2 ( fmt , pp_decide_pvs_2 ) ;
}
return true ;
case TE_GUNSHOT :
if ( progstype = = PROG_QW )
{
static enum protocol_type fmt [ ] = { PPT_BYTE , PPT_BYTE , PPT_BYTE , PPT_POS } ;
DECIDE2 ( fmt , pp_svc_temp_entity_gunshot ) ;
}
else
{
static enum protocol_type fmt [ ] = { PPT_BYTE , PPT_BYTE , PPT_POS } ;
DECIDE2 ( fmt , pp_svc_temp_entity_gunshot ) ;
}
return true ;
case 12 :
if ( progstype = = PROG_QW )
{
/*TEQW_BLOOD*/
}
else
{
/*TENQ_EXPLOSION2*/
}
return false ;
case 13 :
if ( progstype = = PROG_QW )
{
/*TEQW_LIGHTNINGBLOOD*/
}
else
{
/*TENQ_BEAM*/
}
return false ;
case TEDP_BLOOD :
case TEDP_SPARK :
{
static enum protocol_type fmt [ ] = { PPT_BYTE , PPT_BYTE , PPT_POS , PPT_BYTE , PPT_BYTE , PPT_BYTE , PPT_BYTE } ;
DECIDE2 ( fmt , pp_decide_pvs_2 ) ;
}
return true ;
case TE_BULLET :
case TE_SUPERBULLET :
case TE_RAILTRAIL :
// hexen 2
case TEH2_STREAM_CHAIN :
case TEH2_STREAM_SUNSTAFF1 :
case TEH2_STREAM_SUNSTAFF2 :
case TEH2_STREAM_LIGHTNING :
case TEH2_STREAM_COLORBEAM :
case TEH2_STREAM_ICECHUNKS :
case TEH2_STREAM_GAZE :
case TEH2_STREAM_FAMINE :
case TEDP_BLOODSHOWER :
case TEDP_EXPLOSIONRGB :
case TEDP_PARTICLECUBE :
case TEDP_PARTICLERAIN : // [vector] min [vector] max [vector] dir [short] count [byte] color
case TEDP_PARTICLESNOW : // [vector] min [vector] max [vector] dir [short] count [byte] color
case TEDP_CUSTOMFLASH :
case TEDP_FLAMEJET :
case TEDP_PLASMABURN :
case TEDP_TEI_G3 :
case TEDP_SMOKE :
case TEDP_TEI_BIGEXPLOSION :
case TEDP_TEI_PLASMAHIT :
default :
return false ;
}
}
qboolean pp_root_decide ( enum protocol_type * pt , union protocol_data * pd )
{
switch ( pd [ 0 ] . id )
{
case svc_temp_entity :
DECIDE ( pp_svc_temp_entity ) ;
return true ;
default :
return false ;
}
}
# else
2004-11-29 01:21:00 +00:00
2004-08-23 00:15:46 +00:00
static sizebuf_t * writedest ;
static client_t * cldest ;
2010-08-28 17:14:38 +00:00
struct netprim_s * destprim ;
2004-08-23 00:15:46 +00:00
static int majortype ;
2019-05-10 09:31:21 +00:00
# ifdef NQPROT
2004-08-23 00:15:46 +00:00
static int minortype ;
2019-05-10 09:31:21 +00:00
# endif
2004-08-23 00:15:46 +00:00
static int protocollen ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
static qbyte buffer [ MAX_OVERALLMSGLEN ] ;
2004-08-23 00:15:46 +00:00
static int bufferlen ;
static int nullterms ;
static int multicastpos ; //writecoord*3 offset
static int multicasttype ;
static int requireextension ;
static qboolean ignoreprotocol ;
2011-05-20 04:10:46 +00:00
static int te_515sevilhackworkaround ;
2004-08-23 00:15:46 +00:00
# define svc_setfrags 14
# define svc_updatecolors 17
2017-11-14 14:37:04 +00:00
# ifdef HEXEN2
2016-07-12 00:40:13 +00:00
# define svch2_clearviewflags 41 //hexen2.
# define svch2_setangles_lerp 50
2017-11-14 14:37:04 +00:00
# endif
2004-08-23 00:15:46 +00:00
//these are present in the darkplaces engine.
2007-10-05 17:43:26 +00:00
//I wanna knick their mods.
2004-08-23 00:15:46 +00:00
# define svcdp_skybox 37
2005-03-23 22:14:08 +00:00
# define svcdp_showlmp 35 // [string] slotname [string] lmpfilename [short] x [short] y
# define svcdp_hidelmp 36 // [string] slotname
2018-09-01 04:18:08 +00:00
//#define TE_RAILTRAIL_NEH 15 // [vector] origin [coord] red [coord] green [coord] blue (fixme: ignored)
2004-11-17 17:52:56 +00:00
# define TE_EXPLOSION3_NEH 16 // [vector] origin [coord] red [coord] green [coord] blue (fixme: ignored)
2004-08-23 00:15:46 +00:00
# define TE_LIGHTNING4_NEH 17 // [string] model [entity] entity [vector] start [vector] end
2016-07-12 00:40:13 +00:00
# define TE_SMOKE_NEH 18
2004-08-23 00:15:46 +00:00
# define TE_EXPLOSIONSMALL2 20 // org.
client_t * Write_GetClient ( void ) ;
2005-07-03 15:16:20 +00:00
sizebuf_t * QWWriteDest ( int dest ) ;
2004-08-23 00:15:46 +00:00
# ifdef NQPROT
sizebuf_t * NQWriteDest ( int dest ) ;
# endif
void NPP_SetInfo ( client_t * cl , char * key , char * value )
{
int i ;
2016-07-12 00:40:13 +00:00
//its common for bots to be set up by renaming players randomly etc
//such bots should appear that way in server browsers.
//on the other hand, players might end up with postfixes on their names.
//this will break clientside name/stats parsing of course... not much we can do about that other than fixing the mods.
if ( cl - > netchan . remote_address . type ! = NA_INVALID )
{
int vlen = strlen ( value ) ;
if ( ! strcmp ( key , " name " ) & & 7 + vlen + 1 < = sizeof ( buffer ) )
{
if ( progstype ! = PROG_QW )
{
memmove ( buffer + 7 , value , vlen + 1 ) ;
buffer [ 0 ] = svc_setinfo ;
buffer [ 1 ] = cl - svs . clients ;
buffer [ 2 ] = ' n ' ;
buffer [ 3 ] = ' a ' ;
buffer [ 4 ] = ' m ' ;
buffer [ 5 ] = ' e ' ;
buffer [ 6 ] = 0 ;
bufferlen = 7 + vlen + 1 ;
return ;
}
}
}
bufferlen = 0 ;
if ( ! strcmp ( key , " colours " ) )
{
i = atoi ( value ) ;
2018-07-05 16:21:44 +00:00
InfoBuf_SetKey ( & cl - > userinfo , " bottomcolor " , va ( " %i " , i & 15 ) ) ;
InfoBuf_SetKey ( & cl - > userinfo , " topcolor " , va ( " %i " , i > > 4 ) ) ;
2016-07-12 00:40:13 +00:00
}
2018-07-05 16:21:44 +00:00
InfoBuf_SetKey ( & cl - > userinfo , key , value ) ;
if ( ! * InfoBuf_ValueForKey ( & cl - > userinfo , " name " ) )
2004-08-23 00:15:46 +00:00
cl - > name [ 0 ] = ' \0 ' ;
else // process any changed values
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
SV_ExtractFromUserinfo ( cl , false ) ;
2004-08-23 00:15:46 +00:00
i = cl - svs . clients ;
2016-07-12 00:40:13 +00:00
if ( ! strcmp ( key , " colours " ) )
{
MSG_WriteByte ( & sv . reliable_datagram , svc_setinfo ) ;
MSG_WriteByte ( & sv . reliable_datagram , i ) ;
MSG_WriteString ( & sv . reliable_datagram , " bottomcolor " ) ;
2018-07-05 16:21:44 +00:00
MSG_WriteString ( & sv . reliable_datagram , InfoBuf_ValueForKey ( & cl - > userinfo , " bottomcolor " ) ) ;
2016-07-12 00:40:13 +00:00
MSG_WriteByte ( & sv . reliable_datagram , svc_setinfo ) ;
MSG_WriteByte ( & sv . reliable_datagram , i ) ;
MSG_WriteString ( & sv . reliable_datagram , " topcolor " ) ;
2018-07-05 16:21:44 +00:00
MSG_WriteString ( & sv . reliable_datagram , InfoBuf_ValueForKey ( & cl - > userinfo , " topcolor " ) ) ;
2016-07-12 00:40:13 +00:00
}
else
{
MSG_WriteByte ( & sv . reliable_datagram , svc_setinfo ) ;
MSG_WriteByte ( & sv . reliable_datagram , i ) ;
MSG_WriteString ( & sv . reliable_datagram , key ) ;
2018-07-05 16:21:44 +00:00
MSG_WriteString ( & sv . reliable_datagram , InfoBuf_ValueForKey ( & cl - > userinfo , key ) ) ;
2016-07-12 00:40:13 +00:00
}
2004-08-23 00:15:46 +00:00
}
2005-07-03 15:16:20 +00:00
void NPP_NQFlush ( void )
2004-08-23 00:15:46 +00:00
{
if ( ! bufferlen )
return ;
switch ( majortype )
{
case svc_cdtrack :
if ( bufferlen ! = protocollen )
2005-07-03 15:16:20 +00:00
Con_Printf ( " NQFlush: svc_cdtrack wasn't the right length \n " ) ;
2004-08-23 00:15:46 +00:00
else
bufferlen - = 1 ;
break ;
2018-03-04 14:41:16 +00:00
case svc_updatefrags :
break ;
2004-08-23 00:15:46 +00:00
//ignore these.
case svc_print :
case svcdp_skybox :
bufferlen = 0 ;
break ;
2005-10-15 23:32:32 +00:00
case svc_updatename :
2004-08-23 00:15:46 +00:00
NPP_SetInfo ( & svs . clients [ buffer [ 1 ] ] , " name " , buffer + 2 ) ;
break ;
case svc_updatecolors :
2016-07-12 00:40:13 +00:00
NPP_SetInfo ( & svs . clients [ buffer [ 1 ] ] , " colours " , va ( " %i " , buffer [ 2 ] ) ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_intermission :
2005-05-08 17:03:19 +00:00
// if (writedest == &sv.reliable_datagram)
2004-08-23 00:15:46 +00:00
{
2019-07-19 02:13:19 +00:00
sizebuf_t * msg ;
2004-08-23 00:15:46 +00:00
client_t * cl ;
int i ;
2017-11-14 14:37:04 +00:00
# ifdef HEXEN2
2015-09-01 04:45:15 +00:00
char * h2finale = NULL ;
char * h2title = NULL ;
if ( progstype = = PROG_H2 )
{
2016-07-12 00:40:13 +00:00
/*FIXME: hexen2 intermission+finale includes the viewheight. NQ does not, and QW has explicit position with scores but no finale*/
2015-09-01 04:45:15 +00:00
/*hexen2 does something like this in the client, but we don't support those protocols, so translate to something usable*/
char * title [ 13 ] = { " gfx/finale.lmp " , " gfx/meso.lmp " , " gfx/egypt.lmp " , " gfx/roman.lmp " , " gfx/castle.lmp " , " gfx/castle.lmp " , " gfx/end-1.lmp " , " gfx/end-2.lmp " , " gfx/end-3.lmp " , " gfx/castle.lmp " , " gfx/mpend.lmp " , " gfx/mpmid.lmp " , " gfx/end-3.lmp " } ;
int lookup [ 13 ] = { 394 , 395 , 396 , 397 , 358 , strcmp ( T_GetString ( 400 + 5 * 2 + 1 ) , " BAD STRING " ) ? 400 + 5 * 2 + 1 : 400 + 4 * 2 , 386 + 6 , 386 + 7 , 386 + 8 , 391 , 538 , 545 , 561 } ;
//5 is the demo sell screen, which changes depending on hexen2 vs portals.
if ( buffer [ 1 ] < 13 )
{
h2title = title [ buffer [ 1 ] ] ;
h2finale = T_GetString ( lookup [ buffer [ 1 ] ] ) ;
}
}
# endif
2019-06-21 03:59:46 +00:00
# if defined(HAVE_CLIENT)
Log_MapNowCompleted ( ) ;
# endif
2004-08-23 00:15:46 +00:00
for ( i = 0 , cl = svs . clients ; i < sv . allocated_client_slots ; i + + , cl + + )
{
2005-05-26 12:55:34 +00:00
if ( cl - > state = = cs_spawned & & ISQWCLIENT ( cl ) )
2004-08-23 00:15:46 +00:00
{
2017-11-14 14:37:04 +00:00
# ifdef HEXEN2
2011-12-23 03:12:29 +00:00
if ( h2finale )
{
2019-07-19 02:13:19 +00:00
msg = ClientReliable_StartWrite ( cl , 6 + strlen ( h2title ) + 3 + strlen ( h2finale ) + 1 ) ;
MSG_WriteByte ( msg , svc_finale ) ;
2015-09-01 04:45:15 +00:00
2019-07-19 02:13:19 +00:00
MSG_WriteByte ( msg , ' / ' ) ;
MSG_WriteByte ( msg , ' F ' ) ;
MSG_WriteByte ( msg , ' f ' ) ; //hexen2-style finale
2016-07-12 00:40:13 +00:00
2019-07-19 02:13:19 +00:00
MSG_WriteByte ( msg , ' / ' ) ;
MSG_WriteByte ( msg , ' I ' ) ;
SZ_Write ( msg , h2title , strlen ( h2title ) ) ;
MSG_WriteByte ( msg , ' : ' ) ; //image
2015-09-01 04:45:15 +00:00
2019-07-19 02:13:19 +00:00
MSG_WriteByte ( msg , ' / ' ) ;
MSG_WriteByte ( msg , ' P ' ) ; //image should be a background.
2015-09-01 04:45:15 +00:00
2019-07-19 02:13:19 +00:00
MSG_WriteString ( msg , h2finale ) ;
2011-12-23 03:12:29 +00:00
}
2017-11-14 14:37:04 +00:00
else
# endif
if ( cl - > fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS )
2015-09-01 04:45:15 +00:00
{ //special intermission mode to leave the view attached to the viewentity (as required for nq - especially rogue's finale) instead of hacking it to some specific point
2019-07-19 02:13:19 +00:00
msg = ClientReliable_StartWrite ( cl , 5 ) ;
MSG_WriteByte ( msg , svc_finale ) ;
MSG_WriteString ( msg , " /FI " ) ;
2015-09-01 04:45:15 +00:00
}
2011-12-23 03:12:29 +00:00
else
{
2019-07-19 02:13:19 +00:00
msg = ClientReliable_StartWrite ( cl , 23 ) ;
MSG_WriteByte ( msg , svc_intermission ) ;
MSG_WriteCoord ( msg , cl - > edict - > v - > origin [ 0 ] ) ;
MSG_WriteCoord ( msg , cl - > edict - > v - > origin [ 1 ] ) ;
MSG_WriteCoord ( msg , cl - > edict - > v - > origin [ 2 ] + cl - > edict - > v - > view_ofs [ 2 ] ) ;
MSG_WriteAngle ( msg , cl - > edict - > v - > angles [ 0 ] ) ;
MSG_WriteAngle ( msg , cl - > edict - > v - > angles [ 1 ] ) ;
MSG_WriteAngle ( msg , cl - > edict - > v - > angles [ 2 ] ) ;
2011-12-23 03:12:29 +00:00
}
2019-07-19 02:13:19 +00:00
ClientReliable_FinishWrite ( cl ) ;
2004-08-23 00:15:46 +00:00
}
}
bufferlen = 0 ;
protocollen = 0 ;
writedest = NULL ;
}
2005-05-08 17:03:19 +00:00
break ;
2015-09-01 04:45:15 +00:00
// case svc_finale: //finale does exist in vanilla qw. apparently. hurrah.
2004-08-23 00:15:46 +00:00
// bufferlen = 0;
// break;
2015-09-01 04:45:15 +00:00
case svc_cutscene :
//finale with no text. and explicitly no flags (which mostly prevents the 'completed' banner appearing), should be equivelent.
buffer [ 0 ] = svc_finale ;
buffer [ 1 ] = ' / ' ;
buffer [ 2 ] = ' . ' ;
buffer [ 3 ] = 0 ;
bufferlen = 4 ;
break ;
2004-08-23 00:15:46 +00:00
case svc_setview :
2014-04-06 15:16:39 +00:00
requireextension = PEXT_SETVIEW ;
2004-08-23 00:15:46 +00:00
if ( cldest ) //catch it to work with all clients
{
cldest - > viewent = * ( unsigned short * ) & buffer [ 1 ] ;
// bufferlen = 0;
if ( cldest - > viewent = = ( cldest - svs . clients ) + 1 )
cldest - > viewent = 0 ; //self is the same as none
}
2014-04-06 15:16:39 +00:00
// bufferlen = 0;
2004-08-23 00:15:46 +00:00
break ;
2005-03-23 22:14:08 +00:00
case svcdp_hidelmp :
2015-08-22 02:59:01 +00:00
if ( progstype = = PROG_TENEBRAE )
2014-10-05 20:04:11 +00:00
{
bufferlen = 0 ;
break ;
}
2005-06-14 04:52:10 +00:00
requireextension = PEXT_SHOWPIC ;
2008-05-25 22:23:43 +00:00
buffer [ 0 ] = svcfte_hidepic ;
2005-06-14 04:52:10 +00:00
break ;
case svcdp_showlmp :
2015-08-22 02:59:01 +00:00
if ( progstype = = PROG_TENEBRAE )
2014-10-05 20:04:11 +00:00
{
bufferlen = 0 ;
break ;
}
2005-06-14 04:52:10 +00:00
requireextension = PEXT_SHOWPIC ;
memmove ( buffer + 2 , buffer + 1 , bufferlen - 1 ) ;
bufferlen + + ;
2008-05-25 22:23:43 +00:00
buffer [ 0 ] = svcfte_showpic ;
2005-06-14 04:52:10 +00:00
buffer [ 1 ] = 0 ; //top left
//pad the bytes to shorts.
buffer [ bufferlen ] = buffer [ bufferlen - 1 ] ;
buffer [ bufferlen - 1 ] = 0 ;
buffer [ bufferlen + 1 ] = 0 ;
bufferlen + = 2 ;
2005-03-23 22:14:08 +00:00
break ;
2013-04-13 08:15:18 +00:00
case svcfte_cgamepacket :
2020-09-08 05:11:09 +00:00
if ( sv_csqcdebug . ival | | writedest ! = & sv . multicast )
2013-04-13 08:15:18 +00:00
{
2020-09-08 05:11:09 +00:00
if ( writedest ! = & sv . multicast )
Con_Printf ( CON_WARNING " Warning: svc_cgamepacket used outside of a multicast \n " ) ;
/*shift the data up by two bytes*/
memmove ( buffer + 3 , buffer + 1 , bufferlen - 1 ) ;
buffer [ 0 ] = svcfte_cgamepacket_sized ;
/*add a length in the 2nd/3rd bytes*/
buffer [ 1 ] = ( bufferlen - 1 ) ;
buffer [ 2 ] = ( bufferlen - 1 ) > > 8 ;
bufferlen + = 2 ;
if ( multicastpos ) multicastpos + = 2 ;
2013-04-13 08:15:18 +00:00
}
break ;
2004-08-23 00:15:46 +00:00
case svc_temp_entity :
2020-09-08 05:11:09 +00:00
if ( sv_csqcdebug . ival )
{
if ( te_515sevilhackworkaround & & writedest ! = & sv . multicast )
Con_Printf ( CON_WARNING " Warning: unknown svc_temp_entity used outside of a multicast \n " ) ;
/*shift the data up by two bytes, but don't care about the first byte*/
memmove ( buffer + 3 , buffer + 1 , bufferlen - 1 ) ;
buffer [ 0 ] = svcfte_temp_entity_sized ;
/*add a length in the 2nd/3rd bytes, if needed*/
buffer [ 1 ] = ( bufferlen - 1 ) & 0xff ;
buffer [ 2 ] = ( ( bufferlen - 1 ) > > 8 ) ;
if ( te_515sevilhackworkaround ) //we don't know how to translate it, so the qw receiver must be told to interpret as the nq version
buffer [ 2 ] | = 0x80 ;
bufferlen + = 2 ;
if ( multicastpos ) multicastpos + = 2 ;
break ;
}
2004-08-23 00:15:46 +00:00
switch ( buffer [ 1 ] )
{
2011-05-20 04:10:46 +00:00
default :
if ( te_515sevilhackworkaround )
{
2018-10-23 07:09:06 +00:00
if ( writedest ! = & sv . multicast )
Con_Printf ( CON_WARNING " Warning: unknown svc_temp_entity used outside of a multicast \n " ) ;
2020-09-08 05:11:09 +00:00
/*shift the data up by two bytes, but don't care about the first byte*/
memmove ( buffer + 3 , buffer + 1 , bufferlen - 1 ) ;
2011-05-20 04:10:46 +00:00
2020-09-08 05:11:09 +00:00
buffer [ 0 ] = svcfte_temp_entity_sized ;
/*add a length in the 2nd/3rd bytes, if needed*/
buffer [ 1 ] = ( bufferlen - 1 ) & 0xff ;
buffer [ 2 ] = ( ( bufferlen - 1 ) > > 8 ) ;
if ( te_515sevilhackworkaround ) //we don't know how to translate it, so the qw receiver must be told to interpret as the nq version
buffer [ 2 ] | = 0x80 ;
2013-12-29 22:48:28 +00:00
2020-09-08 05:11:09 +00:00
bufferlen + = 2 ;
if ( multicastpos ) multicastpos + = 2 ;
2011-05-20 04:10:46 +00:00
}
break ;
2018-09-01 04:18:08 +00:00
case TENQ_NQEXPLOSION :
2015-08-20 03:17:47 +00:00
if ( writedest = = & sv . datagram )
{ //for old clients, use a te_explosion.
//for clients that support it, use a TEQW_EXPLOSIONNOSPRITE
vec3_t org ;
2019-10-14 02:36:57 +00:00
int coordsize = ( destprim - > coordtype & 0xf ) ;
2015-08-20 03:17:47 +00:00
coorddata cd ;
if ( sv . multicast . cursize + bufferlen > sv . multicast . maxsize )
SV_FlushBroadcasts ( ) ;
SZ_Write ( & sv . multicast , buffer , bufferlen ) ;
2019-10-14 02:36:57 +00:00
memcpy ( & cd , & buffer [ 2 + coordsize * 0 ] , coordsize ) ;
org [ 0 ] = MSG_FromCoord ( cd , coordsize ) ;
memcpy ( & cd , & buffer [ 2 + coordsize * 1 ] , coordsize ) ;
org [ 1 ] = MSG_FromCoord ( cd , coordsize ) ;
memcpy ( & cd , & buffer [ 2 + coordsize * 2 ] , coordsize ) ;
org [ 2 ] = MSG_FromCoord ( cd , coordsize ) ;
2015-08-20 03:17:47 +00:00
requireextension = PEXT_TE_BULLET ;
SV_MulticastProtExt ( org , multicasttype , pr_global_struct - > dimension_send , 0 , requireextension ) ;
2018-09-01 04:18:08 +00:00
buffer [ 1 ] = TEQW_NQEXPLOSION ;
2015-08-20 03:17:47 +00:00
}
break ;
2015-12-12 19:25:15 +00:00
case TENQ_BEAM :
requireextension = PEXT_TE_BULLET ;
//should translate it to lightning or something for old clients
buffer [ 1 ] = TEQW_BEAM ;
break ;
2010-03-25 22:56:11 +00:00
case TENQ_EXPLOSION2 : //happens with rogue.
2015-12-12 19:25:15 +00:00
requireextension = PEXT_TE_BULLET ;
if ( writedest = = & sv . datagram | | writedest = = & sv . multicast )
{
vec3_t org ;
2019-10-14 02:36:57 +00:00
int coordsize = ( destprim - > coordtype & 0xf ) ;
2015-12-12 19:25:15 +00:00
coorddata cd ;
2019-10-14 02:36:57 +00:00
memcpy ( & cd , & buffer [ 2 + coordsize * 0 ] , coordsize ) ;
org [ 0 ] = MSG_FromCoord ( cd , coordsize ) ;
memcpy ( & cd , & buffer [ 2 + coordsize * 1 ] , coordsize ) ;
org [ 1 ] = MSG_FromCoord ( cd , coordsize ) ;
memcpy ( & cd , & buffer [ 2 + coordsize * 2 ] , coordsize ) ;
org [ 2 ] = MSG_FromCoord ( cd , coordsize ) ;
2015-12-12 19:25:15 +00:00
2018-09-01 04:18:08 +00:00
buffer [ 1 ] = TEQW_QWEXPLOSION ; //use a generic crappy explosion
2015-12-12 19:25:15 +00:00
SZ_Write ( & sv . multicast , buffer , bufferlen - 2 ) ; //trim the two trailing colour bytes
SV_MulticastProtExt ( org , multicasttype , pr_global_struct - > dimension_send , 0 , requireextension ) ;
}
buffer [ 1 ] = TEQW_EXPLOSION2 ; //TENQ_EXPLOSION2 conflicts with TEQW_BLOOD
2004-08-23 00:15:46 +00:00
break ;
}
break ;
}
if ( ignoreprotocol )
{
ignoreprotocol = false ;
bufferlen = 0 ;
}
if ( cldest )
{
if ( ! requireextension | | cldest - > fteprotocolextensions & requireextension )
2005-05-26 12:55:34 +00:00
if ( bufferlen & & ISQWCLIENT ( cldest ) )
2004-08-23 00:15:46 +00:00
{
2019-07-19 02:13:19 +00:00
sizebuf_t * msg = ClientReliable_StartWrite ( cldest , bufferlen ) ;
SZ_Write ( msg , buffer , bufferlen ) ;
ClientReliable_FinishWrite ( cldest ) ;
2004-08-23 00:15:46 +00:00
}
cldest = NULL ;
}
else
{
if ( multicastpos & & ( writedest = = & sv . datagram | | writedest = = & sv . multicast ) )
writedest = & sv . multicast ;
else
multicastpos = 0 ;
if ( bufferlen )
2012-05-09 15:30:53 +00:00
{
if ( writedest - > cursize + bufferlen > writedest - > maxsize )
{
SV_FlushBroadcasts ( ) ;
}
2004-08-23 00:15:46 +00:00
SZ_Write ( writedest , buffer , bufferlen ) ;
2012-05-09 15:30:53 +00:00
}
2004-08-23 00:15:46 +00:00
if ( multicastpos )
{
vec3_t org ;
2019-10-14 02:36:57 +00:00
int coordsize = ( destprim - > coordtype & 0xf ) ;
2004-11-17 17:52:56 +00:00
coorddata cd ;
2019-10-14 02:36:57 +00:00
memcpy ( & cd , & buffer [ multicastpos + coordsize * 0 ] , coordsize ) ;
org [ 0 ] = MSG_FromCoord ( cd , coordsize ) ;
memcpy ( & cd , & buffer [ multicastpos + coordsize * 1 ] , coordsize ) ;
org [ 1 ] = MSG_FromCoord ( cd , coordsize ) ;
memcpy ( & cd , & buffer [ multicastpos + coordsize * 2 ] , coordsize ) ;
org [ 2 ] = MSG_FromCoord ( cd , coordsize ) ;
2004-11-17 17:52:56 +00:00
2009-11-04 21:16:50 +00:00
SV_MulticastProtExt ( org , multicasttype , pr_global_struct - > dimension_send , requireextension , 0 ) ;
2004-08-23 00:15:46 +00:00
}
writedest = NULL ;
}
bufferlen = 0 ;
protocollen = 0 ;
2006-06-08 02:04:41 +00:00
nullterms = 0 ;
2004-08-23 00:15:46 +00:00
multicastpos = 0 ;
requireextension = 0 ;
}
2005-07-03 15:16:20 +00:00
void NPP_NQCheckFlush ( void )
2004-08-23 00:15:46 +00:00
{
2006-06-08 02:04:41 +00:00
if ( bufferlen > = protocollen & & protocollen & & ! nullterms )
2005-07-03 15:16:20 +00:00
NPP_NQFlush ( ) ;
2004-08-23 00:15:46 +00:00
}
2005-07-03 15:16:20 +00:00
void NPP_NQCheckDest ( int dest )
2004-08-23 00:15:46 +00:00
{
if ( dest = = MSG_ONE )
{
2005-07-08 00:37:52 +00:00
client_t * cl = Write_GetClient ( ) ;
2004-08-23 00:15:46 +00:00
if ( ! cl )
{
Con_Printf ( " Not a client \n " ) ;
return ;
}
2012-04-24 07:59:11 +00:00
if ( bufferlen & & ( ( cldest & & cldest ! = cl ) | | writedest ) )
2004-08-23 00:15:46 +00:00
{
Con_Printf ( " MSG destination changed in the middle of a packet %i. \n " , ( int ) * buffer ) ;
2005-07-03 15:16:20 +00:00
NPP_NQFlush ( ) ;
2004-08-23 00:15:46 +00:00
}
2012-04-24 07:59:11 +00:00
writedest = NULL ;
2004-08-23 00:15:46 +00:00
cldest = cl ;
2010-08-28 17:14:38 +00:00
destprim = & cldest - > netchan . message . prim ;
2004-08-23 00:15:46 +00:00
}
else
{
2005-07-03 15:16:20 +00:00
sizebuf_t * ndest = QWWriteDest ( dest ) ;
2012-04-24 07:59:11 +00:00
if ( bufferlen & & ( cldest | | ( writedest & & writedest ! = ndest ) ) )
2004-08-23 00:15:46 +00:00
{
2011-07-08 21:24:03 +00:00
Con_DPrintf ( " NQCheckDest: MSG destination changed in the middle of a packet %i. \n " , ( int ) * buffer ) ;
2005-07-03 15:16:20 +00:00
NPP_NQFlush ( ) ;
2004-08-23 00:15:46 +00:00
}
2012-04-24 07:59:11 +00:00
cldest = NULL ;
2004-08-23 00:15:46 +00:00
writedest = ndest ;
2010-08-28 17:14:38 +00:00
destprim = & writedest - > prim ;
2004-08-23 00:15:46 +00:00
}
}
2014-03-30 08:55:06 +00:00
void NPP_AddData ( const void * data , int len )
2004-08-23 00:15:46 +00:00
{
if ( bufferlen + len > sizeof ( buffer ) )
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
{
bufferlen = 0 ;
SV_Error ( " Preparse buffer was filled \n " ) ;
}
2004-08-23 00:15:46 +00:00
memcpy ( buffer + bufferlen , data , len ) ;
2005-07-03 15:16:20 +00:00
bufferlen + = len ;
2004-08-23 00:15:46 +00:00
}
void NPP_NQWriteByte ( int dest , qbyte data ) //replacement write func (nq to qw)
{
2005-07-03 15:16:20 +00:00
NPP_NQCheckDest ( dest ) ;
2004-08-23 00:15:46 +00:00
# ifdef NQPROT
2011-05-29 04:26:29 +00:00
if ( dest = = MSG_ONE )
2006-07-02 04:27:56 +00:00
{
2004-08-23 00:15:46 +00:00
client_t * cl = Write_GetClient ( ) ;
2007-03-11 16:51:45 +00:00
if ( ! cl )
{
Con_Printf ( " msg_entity: not a client \n " ) ;
return ;
}
else
2005-07-03 15:16:20 +00:00
{
2006-07-02 04:27:56 +00:00
if ( cl - > protocol = = SCP_BAD ) // is a bot
return ;
else if ( ! ISQWCLIENT ( cl ) )
{
ClientReliableCheckBlock ( cl , sizeof ( qbyte ) ) ;
ClientReliableWrite_Byte ( cl , data ) ;
return ;
}
2004-08-23 00:15:46 +00:00
}
2006-07-02 04:27:56 +00:00
}
else
2004-08-23 00:15:46 +00:00
MSG_WriteByte ( NQWriteDest ( dest ) , data ) ;
# endif
2006-06-08 02:04:41 +00:00
2004-08-23 00:15:46 +00:00
if ( ! bufferlen ) //new message section
2005-07-03 15:16:20 +00:00
{
2014-08-16 19:03:04 +00:00
majortype = data ;
2004-08-23 00:15:46 +00:00
switch ( data )
{
2005-03-23 22:14:08 +00:00
case svcdp_showlmp :
case svcdp_hidelmp :
2008-11-09 22:29:28 +00:00
case svc_sound :
2013-04-13 08:15:18 +00:00
break ;
2005-07-03 15:16:20 +00:00
case svc_temp_entity :
2011-05-20 04:10:46 +00:00
te_515sevilhackworkaround = false ;
2004-08-23 00:15:46 +00:00
break ;
case svc_setangle :
2010-08-28 17:14:38 +00:00
protocollen = sizeof ( qbyte ) + destprim - > anglesize * 3 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_setview :
protocollen = sizeof ( qbyte ) * 1 + sizeof ( short ) ;
break ;
2005-10-15 23:32:32 +00:00
case svc_updatename :
2006-06-08 02:04:41 +00:00
nullterms = 1 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_setfrags :
2013-04-13 08:15:18 +00:00
protocollen = 4 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_updatecolors :
2013-04-13 08:15:18 +00:00
protocollen = 3 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_print :
protocollen = 3 ;
2006-06-08 02:04:41 +00:00
nullterms = 1 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_cdtrack :
2013-04-13 08:15:18 +00:00
if ( progstype = = PROG_QW )
protocollen = 2 ;
else
protocollen = 3 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_killedmonster :
protocollen = 1 ;
break ;
case svc_foundsecret :
protocollen = 1 ;
break ;
case svc_intermission :
if ( progstype = = PROG_H2 )
protocollen = 2 ;
else
protocollen = 1 ;
break ;
case svc_finale :
2015-09-01 04:45:15 +00:00
nullterms = 1 ;
2015-09-07 14:34:39 +00:00
protocollen = 2 ;
2004-08-23 00:15:46 +00:00
break ;
case svcdp_skybox :
protocollen = 2 ; //it's just a string
break ;
2012-09-30 05:52:03 +00:00
case svcnq_updatestatlong : //insta fixup
data = svcqw_updatestatlong ; //ho hum... let it through (should check size later.)
protocollen = 6 ;
2004-08-23 00:15:46 +00:00
break ;
2022-01-08 10:01:15 +00:00
case svcqex_achievement :
2021-08-20 11:34:41 +00:00
ignoreprotocol = true ;
nullterms = 1 ;
break ;
2004-08-31 23:58:18 +00:00
case svc_stufftext :
2004-08-23 00:15:46 +00:00
case svc_centerprint :
2006-06-08 02:04:41 +00:00
nullterms = 1 ;
2004-08-23 00:15:46 +00:00
break ;
2018-03-24 04:02:09 +00:00
# ifdef HEXEN2
2016-07-12 00:40:13 +00:00
case svch2_clearviewflags :
if ( progstype = = PROG_H2 )
{
protocollen = 2 ;
ignoreprotocol = true ;
}
else
{
Con_DPrintf ( " NQWriteByte: bad protocol %i \n " , ( int ) data ) ;
protocollen = sizeof ( buffer ) ;
}
break ;
case svch2_setangles_lerp :
if ( progstype = = PROG_H2 )
{
majortype = data = svc_setangle ;
protocollen = sizeof ( qbyte ) + destprim - > anglesize * 3 ;
}
else
{
Con_DPrintf ( " NQWriteByte: bad protocol %i \n " , ( int ) data ) ;
protocollen = sizeof ( buffer ) ;
}
2004-08-23 00:15:46 +00:00
break ;
2018-03-24 04:02:09 +00:00
# endif
2004-10-18 10:51:40 +00:00
case svc_cutscene :
2015-09-01 04:45:15 +00:00
nullterms = 1 ;
2004-10-18 10:51:40 +00:00
break ;
2016-07-12 00:40:13 +00:00
case svcdp_updatestatbyte :
2010-08-28 17:14:38 +00:00
protocollen = 3 ;
2010-08-12 09:04:05 +00:00
ignoreprotocol = true ;
break ;
2013-12-29 22:48:28 +00:00
case svcfte_cgamepacket :
protocollen = sizeof ( buffer ) ;
break ;
2004-08-23 00:15:46 +00:00
default :
2014-08-16 19:03:04 +00:00
if ( data & 128 )
{
majortype = 128 ; //nq 'fast update'
ignoreprotocol = true ;
//this handling is explicitly for hipnotic.
//hipnotic sends a camera entity this way so that svc_setview knows where to position itself.
//we emulate this with quakeworld protocols, so we don't necessarily need to support it other than to strip it.
//we're probably screwed if we're acting as an nq server, but few people will use that.
}
else
{
Con_DPrintf ( " NQWriteByte: bad protocol %i \n " , ( int ) data ) ;
protocollen = sizeof ( buffer ) ;
}
2004-08-23 00:15:46 +00:00
break ;
}
}
if ( bufferlen = = 1 & & ! protocollen ) //some of them depend on the following bytes for size.
{
switch ( majortype )
{
2014-08-16 19:03:04 +00:00
case 128 :
2018-03-24 04:02:09 +00:00
# ifdef NQPROT
2014-08-16 19:03:04 +00:00
{
unsigned int bits = buffer [ 0 ] ;
protocollen = 1 ;
if ( bits & NQU_MOREBITS )
{
bits | = data < < 8 ;
protocollen + = 1 ;
}
if ( bits ! = ( NQU_SIGNAL | NQU_MOREBITS | NQU_ORIGIN1 | NQU_ORIGIN2 | NQU_ORIGIN3 | NQU_LONGENTITY ) )
{ //this mask is what hipnotic uses. warn if anyone else tries it.
Con_Printf ( " fast update will be stripped \n " ) ;
PR_StackTrace ( svprogfuncs , false ) ;
}
if ( bits & NQU_ORIGIN1 )
protocollen + = 2 ;
if ( bits & NQU_ORIGIN2 )
protocollen + = 2 ;
if ( bits & NQU_ORIGIN3 )
protocollen + = 2 ;
if ( bits & NQU_ANGLE2 )
protocollen + = 1 ;
//nolerp no data
if ( bits & NQU_FRAME )
protocollen + = 1 ;
if ( bits & NQU_ANGLE1 )
protocollen + = 1 ;
if ( bits & NQU_ANGLE3 )
protocollen + = 1 ;
if ( bits & NQU_MODEL )
protocollen + = 1 ;
if ( bits & NQU_COLORMAP )
protocollen + = 1 ;
if ( bits & NQU_SKIN )
protocollen + = 1 ;
if ( bits & NQU_EFFECTS )
protocollen + = 1 ;
if ( bits & NQU_LONGENTITY )
protocollen + = 2 ;
else
protocollen + = 1 ;
if ( bits & DPU_EXTEND1 )
Con_DPrintf ( " NQWriteByte: fast update with extension bits is not supported \n " ) ;
}
2018-03-24 04:02:09 +00:00
# else
ignoreprotocol = true ;
# endif
2014-08-16 19:03:04 +00:00
break ;
2008-11-09 22:29:28 +00:00
case svc_sound :
2019-10-14 02:36:57 +00:00
protocollen = 5 + ( destprim - > coordtype & 0xf ) * 3 ;
2008-11-09 22:29:28 +00:00
if ( data & NQSND_VOLUME )
protocollen + + ;
if ( data & NQSND_ATTENUATION )
protocollen + + ;
2016-07-12 00:40:13 +00:00
if ( data & NQSND_LARGEENTITY ) //extension
2008-11-09 22:29:28 +00:00
protocollen + + ;
2016-07-12 00:40:13 +00:00
if ( data & NQSND_LARGESOUND ) //extension
2008-11-09 22:29:28 +00:00
protocollen + + ;
2011-10-27 16:16:29 +00:00
# ifdef warningmsg
# pragma warningmsg("NPP_NQWriteByte: this ignores SVC_SOUND from nq mods (nexuiz)")
2011-05-29 04:26:29 +00:00
# endif
2008-11-09 22:29:28 +00:00
ignoreprotocol = true ;
break ;
2004-08-23 00:15:46 +00:00
case svc_temp_entity :
switch ( data )
{
2010-03-25 22:56:11 +00:00
case TENQ_BEAM :
2004-08-23 00:15:46 +00:00
case TE_LIGHTNING1 :
case TE_LIGHTNING2 :
case TE_LIGHTNING3 :
multicastpos = 4 ;
multicasttype = MULTICAST_PHS ;
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 6 + sizeof ( short ) + sizeof ( qbyte ) * 2 ;
2004-08-23 00:15:46 +00:00
break ;
2018-09-01 04:18:08 +00:00
case TENQ_NQGUNSHOT :
2004-08-23 00:15:46 +00:00
multicastpos = 3 ;
multicasttype = MULTICAST_PVS ;
//we need to emit annother qbyte here. QuakeWorld has a number of particles.
//emit it here and we don't need to remember to play with temp_entity later
NPP_AddData ( & data , sizeof ( qbyte ) ) ;
data = 1 ;
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 3 + sizeof ( qbyte ) * 3 ;
2004-08-23 00:15:46 +00:00
break ;
2018-09-01 04:18:08 +00:00
case TENQ_NQEXPLOSION :
2004-08-23 00:15:46 +00:00
case TE_SPIKE :
case TE_SUPERSPIKE :
multicastpos = 2 ;
2015-08-20 03:17:47 +00:00
multicasttype = MULTICAST_PHS ;
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 3 + sizeof ( qbyte ) * 2 ;
2004-08-23 00:15:46 +00:00
break ;
2013-03-17 20:56:47 +00:00
case TE_LAVASPLASH :
multicastpos = 2 ;
multicasttype = MULTICAST_ALL ;
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 3 + sizeof ( qbyte ) * 2 ;
2013-03-17 20:56:47 +00:00
break ;
2004-08-23 00:15:46 +00:00
case TE_TAREXPLOSION :
case TE_WIZSPIKE :
case TE_KNIGHTSPIKE :
case TE_TELEPORT :
multicastpos = 2 ;
multicasttype = MULTICAST_PVS ;
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 3 + sizeof ( qbyte ) * 2 ;
2005-07-03 15:16:20 +00:00
break ;
2004-08-23 00:15:46 +00:00
case TE_EXPLOSION3_NEH :
2019-10-14 02:36:57 +00:00
protocollen = sizeof ( qbyte ) + ( destprim - > coordtype & 0xf ) * 6 ;
2004-08-23 00:15:46 +00:00
ignoreprotocol = true ;
break ;
2010-03-25 22:56:11 +00:00
case TENQ_EXPLOSION2 :
2019-10-14 02:36:57 +00:00
protocollen = sizeof ( qbyte ) * 4 + ( destprim - > coordtype & 0xf ) * 3 ;
2004-08-23 00:15:46 +00:00
multicastpos = 2 ;
2015-08-20 03:17:47 +00:00
multicasttype = MULTICAST_PHS ;
2004-08-23 00:15:46 +00:00
break ;
case TE_EXPLOSIONSMALL2 :
2018-09-01 04:18:08 +00:00
data = TEQW_QWEXPLOSION ;
2019-10-14 02:36:57 +00:00
protocollen = sizeof ( qbyte ) * 2 + ( destprim - > coordtype & 0xf ) * 3 ;
2004-08-23 00:15:46 +00:00
multicastpos = 2 ;
multicasttype = MULTICAST_PHS ;
break ;
2018-09-01 04:18:08 +00:00
case TEQW_RAILTRAIL :
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 6 + sizeof ( qbyte ) * 1 ;
2004-11-19 17:44:33 +00:00
multicastpos = 2 ;
2004-08-23 00:15:46 +00:00
multicasttype = MULTICAST_PHS ;
break ;
2010-08-16 02:03:02 +00:00
case TEH2_STREAM_LIGHTNING_SMALL :
2010-03-25 22:56:11 +00:00
case TEH2_STREAM_CHAIN :
case TEH2_STREAM_SUNSTAFF1 :
case TEH2_STREAM_SUNSTAFF2 :
case TEH2_STREAM_LIGHTNING :
case TEH2_STREAM_ICECHUNKS :
case TEH2_STREAM_GAZE :
case TEH2_STREAM_FAMINE :
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 6 + sizeof ( short ) + sizeof ( qbyte ) * ( 2 + 2 ) ;
2004-08-23 00:15:46 +00:00
multicastpos = 8 ;
multicasttype = MULTICAST_PHS ;
break ;
2010-03-25 22:56:11 +00:00
case TEH2_STREAM_COLORBEAM :
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 6 + sizeof ( short ) + sizeof ( qbyte ) * ( 3 + 2 ) ;
2004-08-23 00:15:46 +00:00
multicastpos = 8 ;
multicasttype = MULTICAST_PHS ;
break ;
2010-03-25 22:56:11 +00:00
case TEDP_FLAMEJET : //TE_FLAMEJET
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 6 + sizeof ( qbyte ) * 3 ;
2004-11-27 08:16:25 +00:00
multicastpos = 2 ;
multicasttype = MULTICAST_PVS ;
break ;
2010-03-25 22:56:11 +00:00
case TEDP_TEI_G3 :
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 9 + sizeof ( qbyte ) * 2 ;
2004-11-19 17:44:33 +00:00
multicastpos = 2 ;
multicasttype = MULTICAST_PHS ;
break ;
2010-03-25 22:56:11 +00:00
case TEDP_SMOKE :
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 6 + sizeof ( qbyte ) * 3 ;
2005-05-15 18:49:04 +00:00
multicastpos = 2 ;
multicasttype = MULTICAST_PHS ;
break ;
2010-03-25 22:56:11 +00:00
case TEDP_TEI_BIGEXPLOSION :
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 3 + sizeof ( qbyte ) * 2 ;
2006-09-18 22:49:42 +00:00
multicastpos = 2 ;
multicasttype = MULTICAST_PHS ;
break ;
2010-03-25 22:56:11 +00:00
case TEDP_TEI_PLASMAHIT :
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 6 + sizeof ( qbyte ) * 3 ;
2004-11-20 00:50:52 +00:00
multicastpos = 2 ;
2004-11-19 17:44:33 +00:00
multicasttype = MULTICAST_PHS ;
break ;
2004-08-23 00:15:46 +00:00
default :
protocollen = sizeof ( buffer ) ;
2011-12-23 03:12:29 +00:00
if ( dest = = MSG_MULTICAST )
{
Con_DPrintf ( " NQWriteByte: unknown tempentity %i \n " , data ) ;
}
else
{
te_515sevilhackworkaround = true ;
2013-12-29 22:48:28 +00:00
if ( ! ssqc_deprecated_warned )
{
ssqc_deprecated_warned = true ;
Con_Printf ( " NQWriteByte: invalid tempentity %i. Future errors will be dprinted. You may need to enable sv_csqcdebug. \n " , data ) ;
2014-05-30 03:57:30 +00:00
PR_StackTrace ( svprogfuncs , false ) ;
2013-12-29 22:48:28 +00:00
}
else
Con_DPrintf ( " NQWriteByte: unknown tempentity %i \n " , data ) ;
2011-12-23 03:12:29 +00:00
}
2004-08-23 00:15:46 +00:00
break ;
}
break ;
2022-01-08 10:01:15 +00:00
case svcqex_achievement :
2005-10-15 23:32:32 +00:00
case svc_updatename :
2004-08-31 23:58:18 +00:00
case svc_stufftext :
2004-08-23 00:15:46 +00:00
case svc_centerprint :
break ;
default :
2005-07-03 15:16:20 +00:00
Con_Printf ( " NQWriteByte: Non-Implemented svc \n " ) ;
2004-08-23 00:15:46 +00:00
protocollen = sizeof ( buffer ) ;
break ;
}
}
if ( ! protocollen ) //these protocols take strings, and are thus dynamically sized.
{
switch ( majortype )
{
2005-10-15 23:32:32 +00:00
case svc_updatename :
if ( bufferlen < 2 )
break ; //don't truncate the name if the mod is sending the slot number
2022-01-08 10:01:15 +00:00
case svcqex_achievement :
2004-08-31 23:58:18 +00:00
case svc_stufftext :
2004-08-23 00:15:46 +00:00
case svc_centerprint :
2014-08-16 19:03:04 +00:00
case svc_cutscene :
2004-08-23 00:15:46 +00:00
if ( ! data )
protocollen = bufferlen ;
break ;
2014-10-05 20:04:11 +00:00
case svcdp_hidelmp :
//tenebrae compat:
2015-08-22 02:59:01 +00:00
if ( progstype = = PROG_TENEBRAE )
2014-10-05 20:04:11 +00:00
{
//svc, coord6, byte, long, long, effectname
2019-10-14 02:36:57 +00:00
if ( bufferlen > = sizeof ( qbyte ) * 2 + ( destprim - > coordtype & 0xf ) * 6 + sizeof ( int ) * 2 & & ! data )
2014-10-05 20:04:11 +00:00
protocollen = bufferlen ;
break ;
}
//nehahra/dp compat
if ( ! data )
protocollen = bufferlen ;
break ;
case svcdp_showlmp :
//tenebrae compat:
2015-08-22 02:59:01 +00:00
if ( progstype = = PROG_TENEBRAE )
2014-10-05 20:04:11 +00:00
{
//svc, coord3, byte, effectname
2019-10-14 02:36:57 +00:00
if ( bufferlen > = sizeof ( qbyte ) * 2 + ( destprim - > coordtype & 0xf ) * 3 & & ! data )
2014-10-05 20:04:11 +00:00
protocollen = bufferlen ;
break ;
}
// [string] slotname [string] lmpfilename [byte] x [byte] y
//note: nehara uses bytes!
//and the rest of dp uses shorts. how nasty is that?
2005-03-23 22:14:08 +00:00
if ( ! data )
2005-06-14 04:52:10 +00:00
{ //second string, plus 2 bytes.
2005-03-23 22:14:08 +00:00
int i ;
for ( i = 0 ; i < bufferlen ; i + + )
if ( ! buffer [ i ] )
2005-06-14 04:52:10 +00:00
protocollen = bufferlen + 2 ;
2005-03-23 22:14:08 +00:00
}
break ;
2004-08-23 00:15:46 +00:00
}
}
NPP_AddData ( & data , sizeof ( qbyte ) ) ;
2006-06-08 02:04:41 +00:00
if ( ! data & & bufferlen > = protocollen )
if ( nullterms )
nullterms - - ;
2005-07-03 15:16:20 +00:00
NPP_NQCheckFlush ( ) ;
2004-08-23 00:15:46 +00:00
}
void NPP_NQWriteChar ( int dest , char data ) //replacement write func (nq to qw)
{
NPP_NQWriteByte ( dest , ( qbyte ) data ) ;
return ;
/*
2005-07-03 15:16:20 +00:00
NPP_NQCheckDest ( dest ) ;
2004-08-23 00:15:46 +00:00
if ( ! bufferlen )
{
NPP_NQWriteByte ( dest , ( qbyte ) data ) ;
return ;
}
# ifdef NQPROT
if ( dest = = MSG_ONE ) {
client_t * cl = Write_GetClient ( ) ;
if ( cl & & cl - > nqprot )
2005-07-03 15:16:20 +00:00
{
2004-08-23 00:15:46 +00:00
ClientReliableCheckBlock ( cl , sizeof ( char ) ) ;
ClientReliableWrite_Char ( cl , data ) ;
}
} else
MSG_WriteChar ( NQWriteDest ( dest ) , data ) ;
# endif
NPP_AddData ( & data , sizeof ( char ) ) ;
2005-07-03 15:16:20 +00:00
NPP_NQCheckFlush ( ) ; */
2004-08-23 00:15:46 +00:00
}
void NPP_NQWriteShort ( int dest , short data ) //replacement write func (nq to qw)
{
2005-07-03 15:16:20 +00:00
union {
qbyte b [ 2 ] ;
short s ;
} u ;
u . s = LittleShort ( data ) ;
NPP_NQWriteByte ( dest , u . b [ 0 ] ) ;
NPP_NQWriteByte ( dest , u . b [ 1 ] ) ;
2004-08-23 00:15:46 +00:00
}
void NPP_NQWriteLong ( int dest , long data ) //replacement write func (nq to qw)
{
2005-07-03 15:16:20 +00:00
union {
qbyte b [ 4 ] ;
int l ;
} u ;
u . l = LittleLong ( data ) ;
NPP_NQWriteByte ( dest , u . b [ 0 ] ) ;
NPP_NQWriteByte ( dest , u . b [ 1 ] ) ;
NPP_NQWriteByte ( dest , u . b [ 2 ] ) ;
NPP_NQWriteByte ( dest , u . b [ 3 ] ) ;
2004-08-23 00:15:46 +00:00
}
2013-08-21 07:14:39 +00:00
void NPP_NQWriteFloat ( int dest , float data ) //replacement write func (nq to qw)
{
union {
qbyte b [ 4 ] ;
float f ;
} u ;
u . f = LittleFloat ( data ) ;
NPP_NQWriteByte ( dest , u . b [ 0 ] ) ;
NPP_NQWriteByte ( dest , u . b [ 1 ] ) ;
NPP_NQWriteByte ( dest , u . b [ 2 ] ) ;
NPP_NQWriteByte ( dest , u . b [ 3 ] ) ;
}
2004-08-23 00:15:46 +00:00
void NPP_NQWriteAngle ( int dest , float in ) //replacement write func (nq to qw)
{
char data = ( int ) ( in * 256 / 360 ) & 255 ;
2005-07-03 15:16:20 +00:00
NPP_NQCheckDest ( dest ) ;
2004-08-23 00:15:46 +00:00
# ifdef NQPROT
2010-08-28 17:14:38 +00:00
if ( cldest )
2004-08-23 00:15:46 +00:00
{
2010-08-28 17:14:38 +00:00
if ( cldest - > protocol = = SCP_BAD )
2005-07-03 15:16:20 +00:00
return ;
2010-08-28 17:14:38 +00:00
else if ( ! ISQWCLIENT ( cldest ) )
2007-03-11 16:51:45 +00:00
{
2010-08-28 17:14:38 +00:00
ClientReliableCheckBlock ( cldest , sizeof ( char ) ) ;
ClientReliableWrite_Angle ( cldest , in ) ;
return ;
2007-03-11 16:51:45 +00:00
}
2004-08-23 00:15:46 +00:00
}
else
MSG_WriteAngle ( NQWriteDest ( dest ) , in ) ;
# endif
2014-03-30 08:55:06 +00:00
if ( ! bufferlen )
2016-07-12 00:40:13 +00:00
{
Con_Printf ( " NQWriteAngle: Messages should start with WriteByte (last was %i) \n " , majortype ) ;
PR_StackTrace ( svprogfuncs , false ) ;
}
2014-03-30 08:55:06 +00:00
2010-08-28 17:14:38 +00:00
if ( destprim - > anglesize = = 2 )
{
coorddata cd = MSG_ToAngle ( in , destprim - > anglesize ) ;
NPP_AddData ( & cd . b2 , sizeof ( cd . b2 ) ) ;
}
else
NPP_AddData ( & data , sizeof ( char ) ) ;
2005-07-03 15:16:20 +00:00
NPP_NQCheckFlush ( ) ;
2004-08-23 00:15:46 +00:00
}
void NPP_NQWriteCoord ( int dest , float in ) //replacement write func (nq to qw)
{
2005-07-03 15:16:20 +00:00
NPP_NQCheckDest ( dest ) ;
2004-08-23 00:15:46 +00:00
# ifdef NQPROT
2007-03-11 16:51:45 +00:00
if ( dest = = MSG_ONE )
{
2004-08-23 00:15:46 +00:00
client_t * cl = Write_GetClient ( ) ;
2007-03-11 16:51:45 +00:00
if ( ! cl )
2005-07-03 15:16:20 +00:00
{
2007-03-11 16:51:45 +00:00
Con_Printf ( " msg_entity: not a client \n " ) ;
2005-07-03 15:16:20 +00:00
return ;
2004-08-23 00:15:46 +00:00
}
2007-03-11 16:51:45 +00:00
else
{
if ( cl - > protocol = = SCP_BAD )
return ;
else if ( ! ISQWCLIENT ( cl ) )
{
ClientReliableCheckBlock ( cl , sizeof ( float ) ) ;
ClientReliableWrite_Coord ( cl , in ) ;
return ;
}
}
}
else
2004-08-23 00:15:46 +00:00
MSG_WriteCoord ( NQWriteDest ( dest ) , in ) ;
# endif
2016-07-12 00:40:13 +00:00
if ( ! bufferlen )
{
Con_Printf ( " NQWriteCoord: Messages should start with WriteByte \n " ) ;
PR_StackTrace ( svprogfuncs , false ) ;
}
2019-10-14 02:36:57 +00:00
if ( destprim - > coordtype = = COORDTYPE_FLOAT_32 )
2004-12-05 08:21:31 +00:00
{
2014-02-07 08:38:40 +00:00
float dataf = in ;
2004-12-05 08:21:31 +00:00
dataf = LittleFloat ( dataf ) ;
NPP_AddData ( & dataf , sizeof ( float ) ) ;
}
else
{
2014-05-10 13:42:13 +00:00
short datas = ( int ) ( in * 8 ) & 0xffff ;
2014-02-07 08:38:40 +00:00
2004-12-05 08:21:31 +00:00
datas = LittleShort ( datas ) ;
NPP_AddData ( & datas , sizeof ( short ) ) ;
}
2005-07-03 15:16:20 +00:00
NPP_NQCheckFlush ( ) ;
2004-08-23 00:15:46 +00:00
}
2014-03-30 08:55:06 +00:00
void NPP_NQWriteString ( int dest , const char * data ) //replacement write func (nq to qw)
2004-08-23 00:15:46 +00:00
{
2005-07-03 15:16:20 +00:00
NPP_NQCheckDest ( dest ) ;
2004-08-23 00:15:46 +00:00
# ifdef NQPROT
2007-03-11 16:51:45 +00:00
if ( dest = = MSG_ONE )
{
2004-08-23 00:15:46 +00:00
client_t * cl = Write_GetClient ( ) ;
2007-03-11 16:51:45 +00:00
if ( ! cl )
2005-07-03 15:16:20 +00:00
{
2007-03-11 16:51:45 +00:00
Con_Printf ( " msg_entity: not a client \n " ) ;
2005-07-03 15:16:20 +00:00
return ;
2004-08-23 00:15:46 +00:00
}
2007-03-11 16:51:45 +00:00
else
{
if ( cl - > protocol = = SCP_BAD )
return ;
else if ( ! ISQWCLIENT ( cl ) )
{
ClientReliableCheckBlock ( cl , strlen ( data ) + 1 ) ;
ClientReliableWrite_String ( cl , data ) ;
return ;
}
}
}
else
2004-08-23 00:15:46 +00:00
MSG_WriteString ( NQWriteDest ( dest ) , data ) ;
# endif
2016-07-12 00:40:13 +00:00
if ( ! bufferlen )
{
Con_Printf ( " NQWriteString: Messages should start with WriteByte \n " ) ;
PR_StackTrace ( svprogfuncs , false ) ;
}
2004-08-23 00:15:46 +00:00
NPP_AddData ( data , strlen ( data ) + 1 ) ;
2004-11-17 17:52:56 +00:00
if ( ! protocollen ) //these protocols take strings, and are thus dynamically sized.
{
switch ( majortype )
{
2005-10-15 23:32:32 +00:00
case svc_updatename :
2004-11-17 17:52:56 +00:00
case svc_stufftext :
case svc_centerprint :
2014-08-16 19:03:04 +00:00
case svc_cutscene :
2004-11-17 17:52:56 +00:00
protocollen = bufferlen ;
break ;
}
}
2006-06-08 02:04:41 +00:00
if ( nullterms )
nullterms - - ;
2005-07-03 15:16:20 +00:00
NPP_NQCheckFlush ( ) ;
2004-08-23 00:15:46 +00:00
}
2014-10-11 19:39:45 +00:00
void NPP_NQWriteEntity ( int dest , int data ) //replacement write func (nq to qw)
2004-08-23 00:15:46 +00:00
{
2005-07-03 15:16:20 +00:00
NPP_NQCheckDest ( dest ) ;
2004-08-23 00:15:46 +00:00
2013-11-21 23:02:28 +00:00
if ( majortype = = svc_temp_entity & & data > 0 & & data < = sv . allocated_client_slots )
2004-08-23 00:15:46 +00:00
if ( svs . clients [ data - 1 ] . viewent )
data = svs . clients [ data - 1 ] . viewent ;
# ifdef NQPROT
2007-03-11 16:51:45 +00:00
if ( dest = = MSG_ONE )
{
2004-08-23 00:15:46 +00:00
client_t * cl = Write_GetClient ( ) ;
2007-03-11 16:51:45 +00:00
if ( ! cl )
2005-07-03 15:16:20 +00:00
{
2007-03-11 16:51:45 +00:00
Con_Printf ( " msg_entity: not a client \n " ) ;
2005-07-03 15:16:20 +00:00
return ;
2004-08-23 00:15:46 +00:00
}
2007-03-11 16:51:45 +00:00
else
{
if ( cl - > protocol = = SCP_BAD )
return ;
else if ( ! ISQWCLIENT ( cl ) )
{
ClientReliableCheckBlock ( cl , sizeof ( short ) ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
ClientReliableWrite_Entity ( cl , data ) ;
2007-03-11 16:51:45 +00:00
return ;
}
}
}
else
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
MSG_WriteEntity ( NQWriteDest ( dest ) , data ) ;
2004-08-23 00:15:46 +00:00
# endif
2016-07-12 00:40:13 +00:00
if ( ! bufferlen )
{
Con_Printf ( " NQWriteEntity: Messages should start with WriteByte \n " ) ;
PR_StackTrace ( svprogfuncs , false ) ;
}
2004-08-23 00:15:46 +00:00
NPP_AddData ( & data , sizeof ( short ) ) ;
2005-07-03 15:16:20 +00:00
NPP_NQCheckFlush ( ) ;
2004-08-23 00:15:46 +00:00
}
# ifdef NQPROT
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
float NPP_ReadFloat ( qbyte * buf )
{
union
{
float f ;
qbyte b [ 4 ] ;
} u ;
memcpy ( u . b , buf , sizeof ( u . f ) ) ;
return LittleFloat ( u . f ) ;
}
short NPP_ReadShort ( qbyte * buf )
{
union
{
short s ;
qbyte b [ 2 ] ;
} u ;
memcpy ( u . b , buf , sizeof ( u . s ) ) ;
return LittleShort ( u . s ) ;
}
unsigned short NPP_ReadUShort ( qbyte * buf )
{
union
{
unsigned short s ;
qbyte b [ 2 ] ;
} u ;
memcpy ( u . b , buf , sizeof ( u . s ) ) ;
return LittleShort ( u . s ) ;
}
2004-08-23 00:15:46 +00:00
//qw to nq translation is only useful if we allow nq clients to connect.
void NPP_QWFlush ( void )
{
qbyte b ;
if ( ! bufferlen )
return ;
switch ( majortype )
{
2005-10-15 23:32:32 +00:00
case svc_updatename : //not a standard feature, but hey, if a progs wants bots.
2004-08-23 00:15:46 +00:00
NPP_SetInfo ( & svs . clients [ buffer [ 1 ] ] , " name " , buffer + 2 ) ;
break ;
case svc_updatecolors :
2016-07-12 00:40:13 +00:00
NPP_SetInfo ( & svs . clients [ buffer [ 1 ] ] , " colours " , va ( " %i " , buffer [ 2 ] ) ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_cdtrack :
if ( bufferlen ! = protocollen )
2005-07-03 15:16:20 +00:00
Con_Printf ( " QWFlush: svc_cdtrack wasn't the right length \n " ) ;
2004-08-23 00:15:46 +00:00
else
{
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
//qw cdtracks have only a loop byte.
//nq has initial+loop values.
b = ( bufferlen = = 2 ) ? buffer [ 1 ] : 0 ;
2004-08-23 00:15:46 +00:00
NPP_AddData ( & b , sizeof ( qbyte ) ) ;
}
break ;
//ignore these.
case svc_intermission :
2019-06-21 03:59:46 +00:00
# if defined(HAVE_CLIENT)
Log_MapNowCompleted ( ) ;
# endif
2005-05-26 12:55:34 +00:00
// if (writedest == &sv.reliable_datagram)
2004-08-23 00:15:46 +00:00
{
client_t * cl ;
int i ;
for ( i = 0 , cl = svs . clients ; i < sv . allocated_client_slots ; i + + , cl + + )
{
2022-05-28 17:59:17 +00:00
if ( cl - > state = = cs_spawned & & ISNQCLIENT ( cl ) )
2004-08-23 00:15:46 +00:00
{
vec3_t org , ang ;
if ( cl - > zquake_extensions & Z_EXT_SERVERTIME )
{
ClientReliableCheckBlock ( cl , 6 ) ;
2012-09-30 05:52:03 +00:00
ClientReliableWrite_Byte ( cl , svcqw_updatestatlong ) ;
2004-08-23 00:15:46 +00:00
ClientReliableWrite_Byte ( cl , STAT_TIME ) ;
2011-12-23 03:12:29 +00:00
ClientReliableWrite_Long ( cl , ( int ) ( sv . world . physicstime * 1000 ) ) ;
cl - > nextservertimeupdate = sv . world . physicstime + 10 ;
2004-08-23 00:15:46 +00:00
}
ClientReliableCheckBlock ( cl , 1 ) ;
ClientReliableWrite_Byte ( cl , svc_intermission ) ;
2005-07-03 15:16:20 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
i = 1 ;
2019-10-14 02:36:57 +00:00
if ( destprim - > coordtype = = COORDTYPE_FLOAT_32 )
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
{
org [ 0 ] = NPP_ReadFloat ( buffer + i + 0 ) ;
org [ 1 ] = NPP_ReadFloat ( buffer + i + 4 ) ;
org [ 2 ] = NPP_ReadFloat ( buffer + i + 8 ) ;
i + = 12 ;
}
else
{
org [ 0 ] = NPP_ReadShort ( buffer + i + 0 ) / 8.0 ;
org [ 1 ] = NPP_ReadShort ( buffer + i + 2 ) / 8.0 ;
org [ 2 ] = NPP_ReadShort ( buffer + i + 4 ) / 8.0 ;
i + = 6 ;
}
2004-08-23 00:15:46 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( destprim - > anglesize = = 2 )
{
ang [ 0 ] = NPP_ReadUShort ( buffer + i + 0 ) * 360.0 / 0xffff ;
ang [ 1 ] = NPP_ReadUShort ( buffer + i + 2 ) * 360.0 / 0xffff ;
ang [ 2 ] = NPP_ReadUShort ( buffer + i + 4 ) * 360.0 / 0xffff ;
i + = 6 ;
}
else
{
ang [ 0 ] = ( * ( qbyte * ) & buffer [ i + 0 ] ) * 360.0 / 0xff ;
ang [ 1 ] = ( * ( qbyte * ) & buffer [ i + 1 ] ) * 360.0 / 0xff ;
ang [ 2 ] = ( * ( qbyte * ) & buffer [ i + 2 ] ) * 360.0 / 0xff ;
i + = 3 ;
}
2004-08-23 00:15:46 +00:00
//move nq players to origin + angle
2005-05-26 12:55:34 +00:00
VectorCopy ( org , cl - > edict - > v - > origin ) ;
VectorCopy ( ang , cl - > edict - > v - > angles ) ;
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
cl - > edict - > v - > angles [ 0 ] * = r_meshpitch . value ;
2004-08-23 00:15:46 +00:00
}
}
}
bufferlen = 0 ;
protocollen = 0 ;
writedest = NULL ;
2005-07-03 15:16:20 +00:00
// case svc_finale:
2004-08-23 00:15:46 +00:00
// bufferlen = 0;
2005-05-26 12:55:34 +00:00
break ;
2004-08-23 00:15:46 +00:00
case svc_setview :
requireextension = PEXT_SETVIEW ;
// bufferlen = 0;
break ;
case svc_muzzleflash :
2012-04-24 07:59:11 +00:00
if ( bufferlen < 3 )
Con_Printf ( " Dodgy muzzleflash \n " ) ;
else
2005-07-03 15:16:20 +00:00
{
2004-08-23 00:15:46 +00:00
short data ;
float org [ 3 ] ;
2018-04-06 17:21:15 +00:00
edict_t * ent = EDICT_NUM_UB ( svprogfuncs , LittleShort ( ( * ( short * ) & buffer [ 1 ] ) ) ) ;
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
ent - > muzzletime = sv . world . physicstime + host_frametime ; //flag the entity as needing an EF_MUZZLEFLASH
2005-03-28 00:11:59 +00:00
VectorCopy ( ent - > v - > origin , org ) ;
2005-07-03 15:16:20 +00:00
2012-04-24 07:59:11 +00:00
//we need to make a fake muzzleflash position for multicast to work properly.
multicastpos = 4 ;
2004-08-23 00:15:46 +00:00
data = LittleShort ( ( short ) ( org [ 0 ] * 8 ) ) ;
NPP_AddData ( & data , sizeof ( short ) ) ;
data = LittleShort ( ( short ) ( org [ 1 ] * 8 ) ) ;
NPP_AddData ( & data , sizeof ( short ) ) ;
data = LittleShort ( ( short ) ( org [ 2 ] * 8 ) ) ;
NPP_AddData ( & data , sizeof ( short ) ) ;
}
2005-07-03 15:16:20 +00:00
bufferlen = 0 ; //can't send this to nq. :(
2004-08-23 00:15:46 +00:00
break ;
case svc_smallkick :
case svc_bigkick :
bufferlen = 0 ;
break ;
2021-07-17 15:09:49 +00:00
case svcqw_updatestatlong :
buffer [ 0 ] = svcnq_updatestatlong ;
break ;
2004-08-23 00:15:46 +00:00
case svc_updateuserinfo :
if ( buffer [ 6 ] )
{
2007-09-02 19:55:17 +00:00
unsigned int j = buffer [ 1 ] ;
2011-04-25 03:25:22 +00:00
if ( j < sv . allocated_client_slots )
2007-09-02 19:55:17 +00:00
{
2018-07-05 16:21:44 +00:00
InfoBuf_FromString ( & svs . clients [ j ] . userinfo , buffer + 6 , false ) ;
if ( * InfoBuf_ValueForKey ( & svs . clients [ j ] . userinfo , " name " ) )
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
SV_ExtractFromUserinfo ( & svs . clients [ j ] , false ) ;
2007-09-02 19:55:17 +00:00
else
* svs . clients [ j ] . name = ' \0 ' ;
}
2004-08-23 00:15:46 +00:00
}
else
{
2007-09-02 19:55:17 +00:00
unsigned int j = buffer [ 1 ] ;
2011-04-25 03:25:22 +00:00
if ( j < sv . allocated_client_slots )
2007-09-02 19:55:17 +00:00
{
* svs . clients [ j ] . name = ' \0 ' ;
2018-07-05 16:21:44 +00:00
InfoBuf_Clear ( & svs . clients [ j ] . userinfo , true ) ;
2007-09-02 19:55:17 +00:00
}
2004-08-23 00:15:46 +00:00
}
2013-04-13 08:15:18 +00:00
break ;
case svcfte_cgamepacket :
2020-09-08 05:11:09 +00:00
if ( sv_csqcdebug . ival | | writedest ! = & sv . nqmulticast )
2013-04-13 08:15:18 +00:00
{
2020-09-08 05:11:09 +00:00
if ( writedest ! = & sv . nqmulticast )
Con_Printf ( CON_WARNING " Warning: svc_cgamepacket used outside of a multicast \n " ) ;
/*shift the data up by two bytes*/
memmove ( buffer + 3 , buffer + 1 , bufferlen - 1 ) ;
buffer [ 0 ] = svcfte_cgamepacket_sized ;
/*add a length in the 2nd/3rd bytes*/
buffer [ 1 ] = ( bufferlen - 1 ) ;
buffer [ 2 ] = ( bufferlen - 1 ) > > 8 ;
bufferlen + = 2 ;
if ( multicastpos ) multicastpos + = 2 ;
2013-04-13 08:15:18 +00:00
}
2004-08-23 00:15:46 +00:00
break ;
case svc_temp_entity :
2020-09-08 05:11:09 +00:00
if ( sv_csqcdebug . ival )
{
if ( te_515sevilhackworkaround & & writedest ! = & sv . multicast )
Con_Printf ( CON_WARNING " Warning: unknown svc_temp_entity used outside of a multicast \n " ) ;
/*shift the data up by two bytes, but don't care about the first byte*/
memmove ( buffer + 3 , buffer + 1 , bufferlen - 1 ) ;
buffer [ 0 ] = svcfte_temp_entity_sized ;
/*add a length in the 2nd/3rd bytes, if needed*/
buffer [ 1 ] = ( bufferlen - 1 ) & 0xff ;
buffer [ 2 ] = ( bufferlen - 1 ) > > 8 ;
if ( ! te_515sevilhackworkaround ) //we translated it from qw, let the client know that its now the nq version
buffer [ 2 ] | = 0x80 ;
bufferlen + = 2 ;
if ( multicastpos ) multicastpos + = 2 ;
break ;
}
2004-08-23 00:15:46 +00:00
switch ( minortype )
{
2011-05-20 04:10:46 +00:00
default :
if ( te_515sevilhackworkaround )
{
2020-09-08 05:11:09 +00:00
Con_Printf ( CON_WARNING " Warning: unknown svc_temp_entity used outside of a multicast \n " ) ;
/*shift the data up by two bytes*/
memmove ( buffer + 3 , buffer + 1 , bufferlen - 1 ) ;
2013-04-13 08:15:18 +00:00
2020-09-08 05:11:09 +00:00
buffer [ 0 ] = svcfte_temp_entity_sized ;
/*add a length in the 2nd/3rd bytes*/
buffer [ 1 ] = ( bufferlen - 1 ) ;
buffer [ 2 ] = ( bufferlen - 1 ) > > 8 ;
if ( ! te_515sevilhackworkaround ) //we translated it from qw, let the client know that its now the nq version
buffer [ 2 ] | = 0x80 ;
2011-05-20 04:10:46 +00:00
2020-09-08 05:11:09 +00:00
bufferlen + = 2 ;
if ( multicastpos ) multicastpos + = 2 ;
2011-05-20 04:10:46 +00:00
}
break ;
2010-03-25 22:56:11 +00:00
case TEQW_LIGHTNINGBLOOD :
2018-09-01 04:18:08 +00:00
case TEQW_QWBLOOD : //needs to be converted to an svc_particle
2004-08-23 00:15:46 +00:00
{
vec3_t org ;
2005-07-03 15:16:20 +00:00
qbyte count ;
qbyte colour ;
char dir [ 3 ] ;
short s ;
2004-08-23 00:15:46 +00:00
int v ;
int i ;
2005-07-03 15:16:20 +00:00
qbyte svc ;
svc = svc_particle ;
org [ 0 ] = ( * ( short * ) & buffer [ multicastpos ] ) / 8.0f ;
2004-08-23 00:15:46 +00:00
org [ 1 ] = ( * ( short * ) & buffer [ multicastpos + 2 ] ) / 8.0f ;
org [ 2 ] = ( * ( short * ) & buffer [ multicastpos + 4 ] ) / 8.0f ;
2015-11-18 07:37:39 +00:00
count = bound ( 0 , buffer [ 2 ] * 20 , 254 ) ; //255 is taken to mean an explosion, for some reason.
2010-03-25 22:56:11 +00:00
if ( minortype = = TEQW_LIGHTNINGBLOOD )
2005-07-03 15:16:20 +00:00
colour = 225 ;
else
colour = 73 ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
v = 0 * 16 ;
if ( v > 127 )
v = 127 ;
else if ( v < - 128 )
v = - 128 ;
2005-07-03 15:16:20 +00:00
dir [ i ] = v ;
2004-08-23 00:15:46 +00:00
}
2005-07-03 15:16:20 +00:00
bufferlen = 0 ; //restart
protocollen = 1000 ;
multicastpos = 1 ;
NPP_AddData ( & svc , sizeof ( qbyte ) ) ;
for ( i = 0 ; i < 3 ; i + + )
{
2019-10-14 02:36:57 +00:00
if ( destprim - > coordtype = = COORDTYPE_FLOAT_32 )
2005-07-03 15:16:20 +00:00
NPP_AddData ( & org [ i ] , sizeof ( float ) ) ;
else
{
s = org [ i ] * 8 ;
NPP_AddData ( & s , sizeof ( short ) ) ;
}
}
NPP_AddData ( & dir [ 0 ] , sizeof ( char ) ) ;
NPP_AddData ( & dir [ 1 ] , sizeof ( char ) ) ;
NPP_AddData ( & dir [ 2 ] , sizeof ( char ) ) ;
NPP_AddData ( & count , sizeof ( qbyte ) ) ;
NPP_AddData ( & colour , sizeof ( qbyte ) ) ;
2004-08-23 00:15:46 +00:00
}
break ;
2018-09-01 04:18:08 +00:00
case TEQW_QWGUNSHOT : //needs byte 3 removed
2005-07-03 15:16:20 +00:00
if ( bufferlen > = 3 )
{
memmove ( buffer + 2 , buffer + 3 , bufferlen - 3 ) ;
bufferlen - - ;
}
2004-08-23 00:15:46 +00:00
break ;
}
}
if ( ignoreprotocol )
{
ignoreprotocol = false ;
bufferlen = 0 ;
}
if ( cldest )
{
if ( ! requireextension | | cldest - > fteprotocolextensions & requireextension )
2005-05-26 12:55:34 +00:00
if ( bufferlen & & ! ISQWCLIENT ( cldest ) )
2004-08-23 00:15:46 +00:00
{
2019-07-19 02:13:19 +00:00
sizebuf_t * msg = ClientReliable_StartWrite ( cldest , bufferlen ) ;
SZ_Write ( msg , buffer , bufferlen ) ;
ClientReliable_FinishWrite ( cldest ) ;
2004-08-23 00:15:46 +00:00
}
cldest = NULL ;
}
else
{
if ( multicastpos & & ( writedest = = & sv . nqdatagram | | writedest = = & sv . nqmulticast ) )
writedest = & sv . nqmulticast ;
else
multicastpos = 0 ;
if ( bufferlen )
SZ_Write ( writedest , buffer , bufferlen ) ;
if ( multicastpos )
{
2005-07-05 23:46:10 +00:00
int qwsize ;
2004-08-23 00:15:46 +00:00
vec3_t org ;
2019-10-14 02:36:57 +00:00
int coordsize = ( destprim - > coordtype & 0xf ) ;
2004-11-17 17:52:56 +00:00
coorddata cd ;
2019-10-14 02:36:57 +00:00
memcpy ( & cd , & buffer [ multicastpos + coordsize * 0 ] , coordsize ) ;
org [ 0 ] = MSG_FromCoord ( cd , coordsize ) ;
memcpy ( & cd , & buffer [ multicastpos + coordsize * 1 ] , coordsize ) ;
org [ 1 ] = MSG_FromCoord ( cd , coordsize ) ;
memcpy ( & cd , & buffer [ multicastpos + coordsize * 2 ] , coordsize ) ;
org [ 2 ] = MSG_FromCoord ( cd , coordsize ) ;
2004-11-17 17:52:56 +00:00
2005-07-05 23:46:10 +00:00
qwsize = sv . multicast . cursize ;
sv . multicast . cursize = 0 ;
2009-11-04 21:16:50 +00:00
SV_MulticastProtExt ( org , multicasttype , pr_global_struct - > dimension_send , requireextension , 0 ) ;
2005-07-05 23:46:10 +00:00
sv . multicast . cursize = qwsize ;
2004-08-23 00:15:46 +00:00
}
writedest = NULL ;
}
bufferlen = 0 ;
nullterms = 0 ;
protocollen = 0 ;
multicastpos = 0 ;
requireextension = 0 ;
}
void NPP_QWCheckFlush ( void )
{
if ( bufferlen > = protocollen & & protocollen & & ! nullterms )
NPP_QWFlush ( ) ;
}
void NPP_QWCheckDest ( int dest )
{
if ( dest = = MSG_ONE )
{
2012-04-24 07:59:11 +00:00
client_t * cl = Write_GetClient ( ) ;
2004-08-23 00:15:46 +00:00
if ( ! cl )
{
Con_Printf ( " Not a client \n " ) ;
return ;
}
2012-04-24 07:59:11 +00:00
if ( bufferlen & & ( ( cldest & & cldest ! = cl ) | | writedest ) )
2004-08-23 00:15:46 +00:00
{
Con_Printf ( " MSG destination changed in the middle of a packet %i. \n " , ( int ) * buffer ) ;
NPP_QWFlush ( ) ;
}
2012-04-24 07:59:11 +00:00
writedest = NULL ;
2004-08-23 00:15:46 +00:00
cldest = cl ;
2012-04-24 07:59:11 +00:00
destprim = & cldest - > netchan . message . prim ;
2004-08-23 00:15:46 +00:00
}
else
{
sizebuf_t * ndest = NQWriteDest ( dest ) ;
2012-04-24 07:59:11 +00:00
if ( bufferlen & & ( cldest | | ( writedest & & writedest ! = ndest ) ) )
2004-08-23 00:15:46 +00:00
{
2011-07-08 21:24:03 +00:00
Con_DPrintf ( " QWCheckDest: MSG destination changed in the middle of a packet %i. \n " , ( int ) * buffer ) ;
2004-08-23 00:15:46 +00:00
NPP_QWFlush ( ) ;
}
2012-04-24 07:59:11 +00:00
cldest = NULL ;
2004-08-23 00:15:46 +00:00
writedest = ndest ;
2010-08-28 17:14:38 +00:00
destprim = & writedest - > prim ;
2004-08-23 00:15:46 +00:00
}
}
void NPP_QWWriteByte ( int dest , qbyte data ) //replacement write func (nq to qw)
{
NPP_QWCheckDest ( dest ) ;
# ifdef NQPROT
2006-07-02 04:27:56 +00:00
if ( dest = = MSG_ONE )
{
2004-08-23 00:15:46 +00:00
client_t * cl = Write_GetClient ( ) ;
2007-03-11 16:51:45 +00:00
if ( ! cl )
2005-07-03 15:16:20 +00:00
{
2007-03-11 16:51:45 +00:00
Con_Printf ( " msg_entity: not a client \n " ) ;
return ;
}
else
{
if ( cl - > protocol = = SCP_BAD ) // is a bot
return ;
else if ( ISQWCLIENT ( cl ) )
2006-07-02 04:27:56 +00:00
{
ClientReliableCheckBlock ( cl , sizeof ( qbyte ) ) ;
ClientReliableWrite_Byte ( cl , data ) ;
return ;
}
2004-08-23 00:15:46 +00:00
}
2011-05-29 04:26:29 +00:00
}
2006-07-02 04:27:56 +00:00
else
2005-07-03 15:16:20 +00:00
MSG_WriteByte ( QWWriteDest ( dest ) , data ) ;
2004-08-23 00:15:46 +00:00
# endif
if ( ! bufferlen ) //new message section
2005-07-03 15:16:20 +00:00
{
2004-08-23 00:15:46 +00:00
switch ( data )
{
2005-07-03 15:16:20 +00:00
case svc_temp_entity :
2004-08-23 00:15:46 +00:00
break ;
case svc_setangle :
2010-08-28 17:14:38 +00:00
protocollen = sizeof ( qbyte ) + destprim - > anglesize * 3 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_setview :
protocollen = sizeof ( qbyte ) * 1 + sizeof ( short ) ;
break ;
case svc_cdtrack :
protocollen = sizeof ( qbyte ) * 2 ;
break ;
case svc_killedmonster :
protocollen = 1 ;
break ;
case svc_foundsecret :
protocollen = 1 ;
break ;
case svc_intermission :
2019-10-14 02:36:57 +00:00
protocollen = 1 + ( destprim - > coordtype & 0xf ) * 3 + destprim - > anglesize * 3 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_finale :
2015-09-01 04:45:15 +00:00
nullterms = 1 ;
2015-09-07 14:34:39 +00:00
protocollen = 2 ;
2004-08-23 00:15:46 +00:00
break ;
2005-03-01 15:36:23 +00:00
case svc_updatepl :
2004-08-23 00:15:46 +00:00
case svc_muzzleflash :
protocollen = 3 ;
break ;
case svc_smallkick :
case svc_bigkick :
protocollen = 1 ;
break ;
case svc_print :
protocollen = 2 ;
nullterms = 1 ;
break ;
2005-12-16 17:11:17 +00:00
case svc_setinfo :
protocollen = 2 ;
nullterms = 2 ;
break ;
2004-08-23 00:15:46 +00:00
case svc_centerprint :
case svc_stufftext :
protocollen = 1 ;
nullterms = 1 ;
break ;
2012-09-30 05:52:03 +00:00
case svcqw_updatestatbyte :
2004-08-23 00:15:46 +00:00
protocollen = 3 ;
break ;
case svc_updateping :
case svc_updatefrags :
protocollen = 4 ;
break ;
case svc_updateentertime :
protocollen = 6 ;
break ;
case svc_updateuserinfo :
nullterms = 1 ;
2015-04-14 23:12:17 +00:00
protocollen = 6 + nullterms ;
2004-08-23 00:15:46 +00:00
break ;
2012-09-30 05:52:03 +00:00
case svcqw_updatestatlong :
2004-08-23 00:15:46 +00:00
protocollen = 6 ;
break ;
2005-07-08 00:37:52 +00:00
case svc_setpause :
protocollen = 2 ;
break ;
2013-12-29 22:48:28 +00:00
case svcfte_cgamepacket :
protocollen = sizeof ( buffer ) ;
break ;
2004-08-23 00:15:46 +00:00
default :
2011-07-08 21:24:03 +00:00
Con_DPrintf ( " QWWriteByte: bad protocol %i \n " , ( int ) data ) ;
2004-08-23 00:15:46 +00:00
protocollen = sizeof ( buffer ) ;
break ;
}
majortype = data ;
}
if ( bufferlen = = 1 & & ! protocollen ) //some of them depend on the following bytes for size.
{
switch ( majortype )
{
case svc_temp_entity :
minortype = data ;
switch ( data )
{
case TE_LIGHTNING1 :
case TE_LIGHTNING2 :
case TE_LIGHTNING3 :
multicastpos = 4 ;
multicasttype = MULTICAST_PHS ;
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 6 + sizeof ( short ) + sizeof ( qbyte ) * 2 ;
2005-07-03 15:16:20 +00:00
break ;
2018-09-01 04:18:08 +00:00
case TEQW_QWBLOOD : //needs to be converted to a particle
case TEQW_QWGUNSHOT : //needs qbyte 2 removed
2004-08-23 00:15:46 +00:00
multicastpos = 3 ;
multicasttype = MULTICAST_PVS ;
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 3 + sizeof ( qbyte ) * 3 ;
2004-08-23 00:15:46 +00:00
break ;
2010-03-25 22:56:11 +00:00
case TEQW_LIGHTNINGBLOOD :
2018-09-01 04:18:08 +00:00
case TEQW_QWEXPLOSION :
2004-08-23 00:15:46 +00:00
case TE_SPIKE :
case TE_SUPERSPIKE :
multicastpos = 2 ;
multicasttype = MULTICAST_PHS_R ;
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 3 + sizeof ( qbyte ) * 2 ;
2004-08-23 00:15:46 +00:00
break ;
case TE_TAREXPLOSION :
case TE_WIZSPIKE :
case TE_KNIGHTSPIKE :
case TE_LAVASPLASH :
case TE_TELEPORT :
multicastpos = 2 ;
multicasttype = MULTICAST_PVS ;
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 3 + sizeof ( qbyte ) * 2 ;
2004-08-23 00:15:46 +00:00
break ;
2018-09-01 04:18:08 +00:00
case TEQW_RAILTRAIL :
2004-08-23 00:15:46 +00:00
multicastpos = 1 ;
multicasttype = MULTICAST_PVS ;
2019-10-14 02:36:57 +00:00
protocollen = ( destprim - > coordtype & 0xf ) * 3 + sizeof ( qbyte ) * 1 ;
2004-08-23 00:15:46 +00:00
break ;
default :
protocollen = sizeof ( buffer ) ;
2020-09-08 05:11:09 +00:00
if ( writedest ! = & sv . nqmulticast )
Con_Printf ( " QWWriteByte: bad tempentity - %i \n " , data ) ;
te_515sevilhackworkaround = true ;
2004-08-23 00:15:46 +00:00
break ;
}
break ;
default :
2005-07-03 15:16:20 +00:00
Con_Printf ( " QWWriteByte: Non-Implemented svc \n " ) ;
2004-08-23 00:15:46 +00:00
protocollen = sizeof ( buffer ) ;
break ;
}
}
NPP_AddData ( & data , sizeof ( qbyte ) ) ;
if ( ! data & & bufferlen > = protocollen )
if ( nullterms )
nullterms - - ;
NPP_QWCheckFlush ( ) ;
}
void NPP_QWWriteChar ( int dest , char data ) //replacement write func (nq to qw)
{
2005-07-03 15:16:20 +00:00
NPP_QWWriteByte ( dest , ( qbyte ) data ) ;
2004-08-23 00:15:46 +00:00
}
void NPP_QWWriteShort ( int dest , short data ) //replacement write func (nq to qw)
{
2005-07-03 15:16:20 +00:00
union {
qbyte b [ 2 ] ;
short s ;
} u ;
2013-03-12 22:35:33 +00:00
if ( bufferlen = = 2 & & majortype = = svc_temp_entity & & ( minortype = = TE_LIGHTNING1 | | minortype = = TE_LIGHTNING2 | | minortype = = TE_LIGHTNING3 ) )
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
NPP_QWWriteEntity ( dest , data ) ;
else
{
u . s = LittleShort ( data ) ;
NPP_QWWriteByte ( dest , u . b [ 0 ] ) ;
NPP_QWWriteByte ( dest , u . b [ 1 ] ) ;
}
2005-07-03 15:16:20 +00:00
}
2004-08-23 00:15:46 +00:00
2005-07-03 15:16:20 +00:00
void NPP_QWWriteFloat ( int dest , float data ) //replacement write func (nq to qw)
{
union {
qbyte b [ 4 ] ;
2005-07-09 15:47:20 +00:00
float f ;
2005-07-03 15:16:20 +00:00
} u ;
u . f = LittleFloat ( data ) ;
NPP_QWWriteByte ( dest , u . b [ 0 ] ) ;
NPP_QWWriteByte ( dest , u . b [ 1 ] ) ;
NPP_QWWriteByte ( dest , u . b [ 2 ] ) ;
NPP_QWWriteByte ( dest , u . b [ 3 ] ) ;
2004-08-23 00:15:46 +00:00
}
void NPP_QWWriteLong ( int dest , long data ) //replacement write func (nq to qw)
{
2005-07-03 15:16:20 +00:00
union {
qbyte b [ 4 ] ;
int l ;
} u ;
u . l = LittleLong ( data ) ;
NPP_QWWriteByte ( dest , u . b [ 0 ] ) ;
NPP_QWWriteByte ( dest , u . b [ 1 ] ) ;
NPP_QWWriteByte ( dest , u . b [ 2 ] ) ;
NPP_QWWriteByte ( dest , u . b [ 3 ] ) ;
2004-08-23 00:15:46 +00:00
}
void NPP_QWWriteAngle ( int dest , float in ) //replacement write func (nq to qw)
{
2010-08-28 17:14:38 +00:00
if ( destprim - > anglesize = = 1 )
2005-07-03 15:16:20 +00:00
{
char data = ( int ) ( in * 256 / 360 ) & 255 ;
2005-07-05 23:46:10 +00:00
NPP_QWWriteChar ( dest , data ) ;
2005-07-03 15:16:20 +00:00
}
else
{
short data = ( int ) ( in * 0xffff / 360 ) & 0xffff ;
2005-07-05 23:46:10 +00:00
NPP_QWWriteShort ( dest , data ) ;
2005-07-03 15:16:20 +00:00
}
2004-08-23 00:15:46 +00:00
}
void NPP_QWWriteCoord ( int dest , float in ) //replacement write func (nq to qw)
{
2019-10-14 02:36:57 +00:00
if ( destprim - > coordtype = = COORDTYPE_FLOAT_32 )
2004-11-17 17:52:56 +00:00
{
2005-07-03 15:16:20 +00:00
NPP_QWWriteFloat ( dest , in ) ;
2004-11-17 17:52:56 +00:00
}
else
{
2005-07-03 15:16:20 +00:00
short datas = ( int ) ( in * 8 ) ;
NPP_QWWriteShort ( dest , datas ) ;
2004-11-17 17:52:56 +00:00
}
2004-08-23 00:15:46 +00:00
}
2014-03-30 08:55:06 +00:00
void NPP_QWWriteString ( int dest , const char * data ) //replacement write func (nq to qw)
2004-08-23 00:15:46 +00:00
{
2005-12-16 17:11:17 +00:00
#if 0
//the slow but guarenteed routine
while ( * data )
NPP_QWWriteByte ( dest , * data + + ) ;
NPP_QWWriteByte ( dest , 0 ) ; //and the null terminator
# else
//the fast-track, less reliable routine
2004-08-23 00:15:46 +00:00
NPP_QWCheckDest ( dest ) ;
# ifdef NQPROT
2007-03-11 16:51:45 +00:00
if ( dest = = MSG_ONE )
{
2004-08-23 00:15:46 +00:00
client_t * cl = Write_GetClient ( ) ;
2007-03-11 16:51:45 +00:00
if ( ! cl )
2005-07-03 15:16:20 +00:00
{
2007-03-11 16:51:45 +00:00
Con_Printf ( " msg_entity: not a client \n " ) ;
2005-07-03 15:16:20 +00:00
return ;
2004-08-23 00:15:46 +00:00
}
2007-03-11 16:51:45 +00:00
else
{
if ( cl - > protocol = = SCP_BAD )
return ;
else if ( ISQWCLIENT ( cl ) )
{
ClientReliableCheckBlock ( cl , strlen ( data ) + 1 ) ;
ClientReliableWrite_String ( cl , data ) ;
return ;
}
}
}
else
2005-07-03 15:16:20 +00:00
MSG_WriteString ( QWWriteDest ( dest ) , data ) ;
2004-08-23 00:15:46 +00:00
# endif
2005-12-16 17:11:17 +00:00
if ( ! bufferlen )
2016-07-12 00:40:13 +00:00
{
2005-12-16 17:11:17 +00:00
Con_Printf ( " QWWriteString: Messages should start with WriteByte (last was %i) \n " , majortype ) ;
2016-07-12 00:40:13 +00:00
PR_StackTrace ( svprogfuncs , false ) ;
}
2005-12-16 17:11:17 +00:00
2004-08-23 00:15:46 +00:00
NPP_AddData ( data , strlen ( data ) + 1 ) ;
if ( nullterms )
nullterms - - ;
NPP_QWCheckFlush ( ) ;
2005-12-16 17:11:17 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
2014-10-11 19:39:45 +00:00
void NPP_QWWriteEntity ( int dest , int data ) //replacement write func (nq to qw)
2004-08-23 00:15:46 +00:00
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( data > = 0x8000 )
{
NPP_QWWriteByte ( dest , ( ( data > > 0 ) & 0xff ) ) ;
NPP_QWWriteByte ( dest , ( ( data > > 8 ) & 0x7f ) | 0x80 ) ;
NPP_QWWriteByte ( dest , ( ( data > > 15 ) & 0xff ) ) ;
}
else
{
NPP_QWWriteByte ( dest , ( data > > 0 ) & 0xff ) ;
NPP_QWWriteByte ( dest , ( data > > 8 ) & 0x7f ) ;
}
2004-08-23 00:15:46 +00:00
}
# endif
2009-11-07 13:29:15 +00:00
# ifdef SERVER_DEMO_PLAYBACK
2004-08-23 00:15:46 +00:00
# define DF_ORIGIN 1
# define DF_ANGLES (1<<3)
# define DF_EFFECTS (1<<6)
# define DF_SKINNUM (1<<7)
# define DF_DEAD (1<<8)
# define DF_GIB (1<<9)
# define DF_WEAPONFRAME (1<<10)
# define DF_MODEL (1<<11)
# define PF_MSEC (1<<0)
# define PF_COMMAND (1<<1)
# define PF_VELOCITY1 (1<<2)
# define PF_VELOCITY2 (1<<3)
# define PF_VELOCITY3 (1<<4)
# define PF_MODEL (1<<5)
# define PF_SKINNUM (1<<6)
# define PF_EFFECTS (1<<7)
# define PF_WEAPONFRAME (1<<8) // only sent for view player
# define PF_DEAD (1<<9) // don't block movement any more
# define PF_GIB (1<<10) // offset the view height differently
int sv_demo_spikeindex ;
void NPP_MVDFlush ( void )
{
if ( ! bufferlen )
return ;
switch ( majortype )
{
case svc_spawnbaseline :
SV_FlushDemoSignon ( ) ;
cldest = NULL ;
writedest = & sv . demosignon ;
if ( 1 )
{
int entnum , i ;
2004-12-08 04:14:52 +00:00
mvdentity_state_t * ent ;
2004-08-23 00:15:46 +00:00
2004-12-08 04:14:52 +00:00
if ( ! sv . demobaselines )
{
sv . demobaselines = ( mvdentity_state_t * ) BZ_Malloc ( sizeof ( mvdentity_state_t ) * MAX_EDICTS ) ;
sv . demostatevalid = true ;
}
2004-08-23 00:15:46 +00:00
entnum = buffer [ 1 ] + ( buffer [ 2 ] < < 8 ) ;
2013-10-29 17:38:22 +00:00
// if (entnum < svs.allocated_client_slots)
2004-08-23 00:15:46 +00:00
// break;
2004-12-08 04:14:52 +00:00
ent = & sv . demobaselines [ entnum ] ;
2004-08-23 00:15:46 +00:00
ent - > modelindex = buffer [ 3 ] ;
ent - > frame = buffer [ 4 ] ;
ent - > colormap = buffer [ 5 ] ;
ent - > skinnum = buffer [ 6 ] ;
for ( i = 0 ; i < 3 ; i + + )
{
ent - > origin [ i ] = ( short ) ( buffer [ 7 + i * 3 ] + ( buffer [ 8 + i * 3 ] < < 8 ) ) / 8.0f ;
2004-12-08 04:14:52 +00:00
ent - > angles [ i ] = buffer [ 9 + i * 3 ] ;
2004-08-23 00:15:46 +00:00
}
}
break ;
case svc_spawnstatic :
SV_FlushDemoSignon ( ) ;
cldest = NULL ;
writedest = & sv . demosignon ;
break ;
case svc_modellist :
ignoreprotocol = true ;
{
int i ;
int rpos , s ;
i = buffer [ 1 ] ;
rpos = 2 ;
while ( 1 )
{
i + + ;
s = rpos ;
while ( buffer [ rpos ] )
rpos + + ;
if ( rpos = = s ) //end
break ;
strcpy ( sv . demmodel_precache [ i ] , buffer + s ) ;
if ( ! strcmp ( sv . demmodel_precache [ i ] , " progs/spike.mdl " ) )
sv_demo_spikeindex = i ;
rpos + + ;
}
}
break ;
case svc_soundlist :
ignoreprotocol = true ;
{
int i ;
int rpos , s ;
i = buffer [ 1 ] ;
rpos = 2 ;
while ( 1 )
{
i + + ;
s = rpos ;
while ( buffer [ rpos ] )
rpos + + ;
if ( rpos = = s ) //end
break ;
strcpy ( sv . demsound_precache [ i ] , buffer + s ) ;
rpos + + ;
}
}
break ;
case svc_serverdata :
{
int i ;
sv_demo_spikeindex = 0 ; //new map, new precaches.
i = 9 ;
strcpy ( sv . demgamedir , buffer + i ) ;
for ( ; i < bufferlen & & buffer [ i ] ; i + + )
;
i + + ;
i + = 4 ;
Q_strncpyz ( sv . demfullmapname , buffer + i , sizeof ( sv . demfullmapname ) ) ;
for ( ; i < bufferlen & & buffer [ i ] ; i + + )
;
i + = 4 * 10 ;
}
ignoreprotocol = true ;
break ;
case svc_lightstyle :
sv . demolightstyles [ buffer [ 1 ] ] = Hunk_Alloc ( strlen ( buffer + 2 ) + 1 ) ;
strcpy ( sv . demolightstyles [ buffer [ 1 ] ] , buffer + 2 ) ;
break ;
case svc_updatestat :
case svc_updatestatlong : //make sure we update the running players stats properly.
{
int v , s ;
if ( majortype = = svc_updatestat )
v = buffer [ 2 ] ;
else
v = buffer [ 2 ] | ( buffer [ 3 ] < < 8 ) | ( buffer [ 4 ] < < 16 ) | ( buffer [ 5 ] < < 24 ) ;
s = buffer [ 1 ] ;
2004-12-10 21:32:54 +00:00
if ( sv . lastto < 32 ) //dem_multicast could be used at the wrong time...
sv . recordedplayer [ sv . lastto ] . stats [ s ] = v ;
2004-08-23 00:15:46 +00:00
ignoreprotocol = true ;
}
break ;
case svc_packetentities :
case svc_deltapacketentities : //read the delta in to the array.
ignoreprotocol = true ; //a bug exists in that the delta MUST have been reliably recorded.
{
int i ;
2004-12-08 04:14:52 +00:00
int entnum ;
mvdentity_state_t * ents ;
2004-08-23 00:15:46 +00:00
unsigned short s ;
if ( ! sv . demostate )
2004-12-08 04:14:52 +00:00
{
sv . demostate = BZ_Malloc ( sizeof ( mvdentity_state_t ) * MAX_EDICTS ) ;
sv . demostatevalid = true ;
}
2004-08-23 00:15:46 +00:00
i = majortype - svc_packetentities + 1 ;
while ( 1 )
{
s = buffer [ i ] + buffer [ i + 1 ] * 256 ;
i + = 2 ;
if ( ! s )
{
break ;
}
else
{
2004-12-08 04:14:52 +00:00
entnum = s & 511 ;
2004-08-23 00:15:46 +00:00
s & = ~ 511 ;
2004-12-08 04:14:52 +00:00
if ( entnum > sv . demomaxents )
sv . demomaxents = entnum ;
ents = & sv . demostate [ entnum ] ;
2004-08-23 00:15:46 +00:00
if ( s & U_REMOVE )
2004-12-08 04:14:52 +00:00
{ //this entity went from the last packet
2004-08-23 00:15:46 +00:00
ents - > modelindex = 0 ;
2004-12-08 04:14:52 +00:00
ents - > effects = 0 ;
continue ;
2004-08-23 00:15:46 +00:00
}
2004-12-08 04:14:52 +00:00
if ( ! ents - > modelindex & & ! ents - > effects & & sv . demobaselines )
{ //new entity, reset to baseline
memcpy ( ents , & sv . demobaselines [ entnum ] , sizeof ( mvdentity_state_t ) ) ;
}
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( s & U_MOREBITS )
{
s | = buffer [ i ] ;
i + + ;
}
if ( s & U_MODEL )
{
ents - > modelindex = buffer [ i ] ;
i + + ;
}
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( s & U_FRAME )
{
ents - > frame = buffer [ i ] ;
i + + ;
}
if ( s & U_COLORMAP )
{
ents - > colormap = buffer [ i ] ;
i + + ;
}
if ( s & U_SKIN )
{
ents - > skinnum = buffer [ i ] ;
i + + ;
}
if ( s & U_EFFECTS )
{
ents - > effects = buffer [ i ] ;
i + + ;
}
if ( s & U_ORIGIN1 )
{
ents - > origin [ 0 ] = ( short ) ( buffer [ i ] + buffer [ i + 1 ] * 256 ) / 8.0f ;
i + = 2 ;
}
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( s & U_ANGLE1 )
{
2004-12-08 04:14:52 +00:00
ents - > angles [ 0 ] = ( unsigned char ) ( buffer [ i ] ) ; // * (360.0/256);
2004-08-23 00:15:46 +00:00
i + + ;
}
if ( s & U_ORIGIN2 )
{
ents - > origin [ 1 ] = ( short ) ( buffer [ i ] + buffer [ i + 1 ] * 256 ) / 8.0f ;
i + = 2 ;
}
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( s & U_ANGLE2 )
{
2004-12-08 04:14:52 +00:00
ents - > angles [ 1 ] = ( unsigned char ) ( buffer [ i ] ) ; // * (360.0/256);
2004-08-23 00:15:46 +00:00
i + + ;
}
if ( s & U_ORIGIN3 )
{
ents - > origin [ 2 ] = ( short ) ( buffer [ i ] + buffer [ i + 1 ] * 256 ) / 8.0f ;
i + = 2 ;
}
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( s & U_ANGLE3 )
{
2004-12-08 04:14:52 +00:00
ents - > angles [ 2 ] = ( unsigned char ) ( buffer [ i ] ) ; // * (360.0/256);
2004-08-23 00:15:46 +00:00
i + + ;
}
}
}
}
break ;
case svc_playerinfo :
ignoreprotocol = true ;
{
int i , j ;
unsigned short flags ;
2004-12-08 04:14:52 +00:00
mvdentity_state_t * ents ;
2005-01-28 04:31:44 +00:00
int playernum ;
2004-08-23 00:15:46 +00:00
vec3_t oldang ;
if ( ! sv . demostate )
sv . demostate = BZ_Malloc ( sizeof ( entity_state_t ) * MAX_EDICTS ) ;
sv . demostatevalid = true ;
flags = buffer [ 2 ] + buffer [ 3 ] * 256 ;
playernum = buffer [ 1 ] ;
ents = & sv . demostate [ playernum + 1 ] ;
ents - > frame = buffer [ 4 ] ;
// ents->colormap=playernum+1;
2005-01-26 03:39:47 +00:00
VectorCopy ( ents - > origin , sv . recordedplayer [ playernum ] . oldorg ) ;
VectorCopy ( ents - > angles , sv . recordedplayer [ playernum ] . oldang ) ;
2004-08-23 00:15:46 +00:00
i = 5 ;
for ( j = 0 ; j < 3 ; j + + )
if ( flags & ( DF_ORIGIN < < j ) )
{
2005-01-25 05:01:30 +00:00
ents - > origin [ j ] = ( signed short ) ( buffer [ i ] + ( buffer [ i + 1 ] < < 8 ) ) / 8.0f ;
2004-08-23 00:15:46 +00:00
i + = 2 ;
}
VectorCopy ( ents - > angles , oldang ) ;
for ( j = 0 ; j < 3 ; j + + )
if ( flags & ( DF_ANGLES < < j ) )
{
2004-12-08 04:14:52 +00:00
//FIXME: angle truncation here.
2005-01-25 05:01:30 +00:00
ents - > angles [ j ] = ( char ) ( ( int ) ( buffer [ i ] + ( buffer [ i + 1 ] < < 8 ) ) / 256.0f ) ;
2004-08-23 00:15:46 +00:00
i + = 2 ;
}
2005-01-25 05:01:30 +00:00
if ( flags & ( DF_ANGLES < < 0 ) ) //'stupid quake bug' I believe is the correct quote...
2004-08-23 00:15:46 +00:00
ents - > angles [ 0 ] = ents - > angles [ 0 ] * - 1 / 3.0f ; //also scale pitch down as well as invert
if ( flags & DF_MODEL )
{
ents - > modelindex = buffer [ i ] ;
i + = 1 ;
}
if ( flags & DF_SKINNUM )
{
ents - > skinnum = buffer [ i ] ;
i + = 1 ;
}
if ( flags & DF_EFFECTS )
{
ents - > effects = buffer [ i ] ;
i + = 1 ;
}
if ( flags & DF_WEAPONFRAME )
2005-01-26 03:39:47 +00:00
{ //mvds are deltas remember, this is really the only place where that fact is all that important.
sv . recordedplayer [ playernum ] . weaponframe = buffer [ i ] ;
2004-08-23 00:15:46 +00:00
i + = 1 ;
}
sv . recordedplayer [ playernum ] . updatetime = realtime ;
ignoreprotocol = true ;
}
break ;
case svc_nails :
case svc_nails2 :
sv . numdemospikes = buffer [ 1 ] ;
{
qboolean hasid = ( majortype = = svc_nails2 ) ;
char * bits ;
int i ;
bits = buffer + 2 ;
for ( i = 0 ; i < sv . numdemospikes ; i + + )
{
if ( hasid )
{
sv . demospikes [ i ] . id = * bits ;
bits + + ;
}
else
sv . demospikes [ i ] . id = 0 ;
sv . demospikes [ i ] . modelindex = sv_demo_spikeindex ;
sv . demospikes [ i ] . org [ 0 ] = ( ( bits [ 0 ] + ( ( bits [ 1 ] & 15 ) < < 8 ) ) < < 1 ) - 4096 ;
sv . demospikes [ i ] . org [ 1 ] = ( ( ( bits [ 1 ] > > 4 ) + ( bits [ 2 ] < < 4 ) ) < < 1 ) - 4096 ;
sv . demospikes [ i ] . org [ 2 ] = ( ( bits [ 3 ] + ( ( bits [ 4 ] & 15 ) < < 8 ) ) < < 1 ) - 4096 ;
sv . demospikes [ i ] . pitch = ( bits [ 4 ] > > 4 ) ;
sv . demospikes [ i ] . yaw = bits [ 5 ] ;
bits + = 6 ;
}
}
2004-12-06 00:56:39 +00:00
ignoreprotocol = true ;
2004-08-23 00:15:46 +00:00
break ;
case svc_stufftext :
ignoreprotocol = true ;
2004-12-08 04:14:52 +00:00
Cmd_TokenizeString ( buffer + 1 , false , false ) ;
2004-08-23 00:15:46 +00:00
if ( ! stricmp ( Cmd_Argv ( 0 ) , " fullserverinfo " ) )
{
Q_strncpyz ( sv . demoinfo , Cmd_Argv ( 1 ) , sizeof ( sv . demoinfo ) ) ;
break ;
}
break ;
case svc_updateping :
{
int j ;
j = buffer [ 1 ] ;
sv . recordedplayer [ j ] . ping = buffer [ 2 ] | ( buffer [ 3 ] < < 8 ) ;
}
break ;
case svc_updatepl :
{
int j ;
j = buffer [ 1 ] ;
sv . recordedplayer [ j ] . pl = buffer [ 2 ] | ( buffer [ 3 ] < < 8 ) ;
}
break ;
case svc_updatefrags :
{
int j ;
j = buffer [ 1 ] ;
sv . recordedplayer [ j ] . frags = buffer [ 2 ] | ( buffer [ 3 ] < < 8 ) ;
}
break ;
case svc_setinfo :
// ignoreprotocol = true;
{
int j ;
j = buffer [ 1 ] ;
Info_SetValueForStarKey ( sv . recordedplayer [ j ] . userinfo , buffer + 2 , buffer + 2 + strlen ( buffer + 2 ) + 1 , sizeof ( sv . recordedplayer [ j ] . userinfo ) ) ;
}
break ;
case svc_updateuserinfo :
// ignoreprotocol = true;
{
2007-09-02 19:55:17 +00:00
unsigned int j ;
2004-08-23 00:15:46 +00:00
j = buffer [ 1 ] ;
2011-04-25 03:25:22 +00:00
if ( j < sv . allocated_client_slots )
2007-09-02 19:55:17 +00:00
{
sv . recordedplayer [ j ] . userid = buffer [ 2 ] | ( buffer [ 3 ] < < 8 ) | ( buffer [ 4 ] < < 16 ) | ( buffer [ 5 ] < < 24 ) ;
Q_strncpyz ( sv . recordedplayer [ j ] . userinfo , buffer + 6 , sizeof ( sv . recordedplayer [ j ] . userinfo ) ) ;
}
2004-08-23 00:15:46 +00:00
}
break ;
case svc_setangle : //FIXME: forward on to trackers.
ignoreprotocol = true ;
break ;
case svc_disconnect :
svs . spawncount + + ;
SV_BroadcastCommand ( " changing \n " ) ;
SV_BroadcastCommand ( " reconnect \n " ) ;
ignoreprotocol = true ;
break ;
}
if ( ignoreprotocol )
{
ignoreprotocol = false ;
bufferlen = 0 ;
}
if ( cldest )
{
if ( ! requireextension | | cldest - > fteprotocolextensions & requireextension )
if ( bufferlen )
{
ClientReliableCheckBlock ( cldest , bufferlen ) ;
ClientReliableWrite_SZ ( cldest , buffer , bufferlen ) ;
}
cldest = NULL ;
}
else
{
if ( multicastpos & & ( writedest = = & sv . datagram | | writedest = = & sv . multicast ) )
writedest = & sv . multicast ;
else
multicastpos = 0 ;
2004-12-06 01:52:32 +00:00
if ( writedest = = & sv . reliable_datagram )
{
writedest = & sv . multicast ;
multicasttype = MULTICAST_ALL_R ;
}
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( bufferlen )
SZ_Write ( writedest , buffer , bufferlen ) ;
if ( multicastpos )
{
vec3_t org ;
2004-11-17 17:52:56 +00:00
coorddata cd ;
memcpy ( & cd , & buffer [ multicastpos + sizeofcoord * 0 ] , sizeofcoord ) ;
org [ 0 ] = MSG_FromCoord ( cd , sizeofcoord ) ;
memcpy ( & cd , & buffer [ multicastpos + sizeofcoord * 1 ] , sizeofcoord ) ;
org [ 1 ] = MSG_FromCoord ( cd , sizeofcoord ) ;
memcpy ( & cd , & buffer [ multicastpos + sizeofcoord * 2 ] , sizeofcoord ) ;
org [ 2 ] = MSG_FromCoord ( cd , sizeofcoord ) ;
2004-08-31 23:58:18 +00:00
SV_MulticastProtExt ( org , multicasttype , FULLDIMENSIONMASK , requireextension , 0 ) ;
2004-08-23 00:15:46 +00:00
}
2004-12-06 01:52:32 +00:00
else if ( writedest = = & sv . multicast )
SV_MulticastProtExt ( vec3_origin , multicasttype , FULLDIMENSIONMASK , requireextension , 0 ) ;
2004-08-23 00:15:46 +00:00
writedest = NULL ;
}
bufferlen = 0 ;
protocollen = 0 ;
multicastpos = 0 ;
requireextension = 0 ;
}
void NPP_MVDForceFlush ( void )
{
if ( bufferlen )
{
Con_Printf ( " Forcing flush mvd->qw prot \n " ) ;
Con_Printf ( " (last was %i) \n " , ( int ) majortype ) ;
NPP_MVDFlush ( ) ;
}
}
void NPP_MVDCheckFlush ( void )
{
if ( bufferlen > = protocollen & & protocollen )
NPP_MVDFlush ( ) ;
}
void NPP_MVDCheckDest ( client_t * cl , int broadcast )
{
if ( ! broadcast )
{
if ( ! cl )
{
Con_Printf ( " Not a client \n " ) ;
return ;
}
if ( ( cldest & & cldest ! = cl ) | | writedest )
{
Con_Printf ( " MSG destination changed in the middle of a packet. \n " ) ;
NPP_MVDFlush ( ) ;
}
cldest = cl ;
}
else
{
sizebuf_t * ndest = & sv . reliable_datagram ;
if ( cldest | | ( writedest & & writedest ! = ndest ) )
{
Con_Printf ( " MSG destination changed in the middle of a packet. \n " ) ;
NPP_MVDFlush ( ) ;
}
writedest = ndest ;
}
}
void NPP_MVDWriteByte ( qbyte data , client_t * to , int broadcast ) //replacement write func (nq to qw)
{
int i ;
NPP_MVDCheckDest ( to , broadcast ) ;
if ( ! bufferlen ) //new message section
2005-07-03 15:16:20 +00:00
{
2004-08-23 00:15:46 +00:00
switch ( data )
{
case svc_temp_entity : //depends on following bytes
break ;
case svc_serverinfo :
case svc_print :
case svc_sound :
2005-07-03 15:16:20 +00:00
case svc_serverdata :
2004-08-23 00:15:46 +00:00
case svc_stufftext :
case svc_modellist :
case svc_soundlist :
case svc_updateuserinfo :
case svc_playerinfo :
case svc_packetentities :
case svc_deltapacketentities :
case svc_lightstyle :
case svc_nails :
2004-12-06 00:56:39 +00:00
case svc_nails2 :
2004-08-23 00:15:46 +00:00
case svc_centerprint :
case svc_setinfo :
break ;
case svc_setangle :
if ( sv . mvdplayback )
protocollen = sizeof ( qbyte ) * 5 ; //MVDSV writes an extra client num too.
else
protocollen = sizeof ( qbyte ) * 4 ; //MVDSV writes an extra client num too.
break ;
case svc_setview :
protocollen = sizeof ( qbyte ) * 1 + sizeof ( short ) ;
break ;
case svc_cdtrack :
protocollen = sizeof ( qbyte ) * 2 ;
break ;
case svc_killedmonster :
protocollen = 1 ;
break ;
case svc_foundsecret :
protocollen = 1 ;
break ;
// case svc_intermission:
// protocollen = 1;
// break;
// case svc_finale:
// protocollen = 2;
// break;
case svc_muzzleflash :
protocollen = 3 ;
break ;
case svc_smallkick :
case svc_bigkick :
protocollen = 1 ;
break ;
case svc_spawnstaticsound :
protocollen = 10 ;
break ;
case svc_spawnstatic :
protocollen = 14 ;
break ;
case svc_spawnbaseline :
protocollen = 16 ;
break ;
case svc_updateping :
case svc_updatefrags :
protocollen = 4 ;
break ;
case svc_updatestat :
case svc_updatepl :
protocollen = 3 ;
break ;
case svc_updatestatlong :
protocollen = 6 ;
break ;
case svc_updateentertime :
protocollen = 6 ;
break ;
case svc_intermission :
protocollen = 10 ;
break ;
case svc_disconnect :
protocollen = 2 + strlen ( " EndOfDemo " ) ;
break ;
case svc_chokecount :
protocollen = 2 ;
break ;
case svc_damage :
protocollen = 9 ;
break ;
default :
2004-11-13 17:37:49 +00:00
Con_Printf ( " mvd: bad protocol %i \n " , ( int ) data ) ;
2004-08-23 00:15:46 +00:00
Con_Printf ( " (last was %i) \n " , ( int ) majortype ) ;
protocollen = sizeof ( buffer ) ;
net_message . cursize = 0 ;
data = svc_nop ;
protocollen = 1 ;
break ;
}
majortype = data ;
}
else if ( ! protocollen )
{
switch ( majortype )
{
case svc_temp_entity :
if ( bufferlen = = 1 )
{
minortype = data ;
switch ( data )
{
case TE_LIGHTNING1 :
case TE_LIGHTNING2 :
case TE_LIGHTNING3 :
multicastpos = 4 ;
multicasttype = MULTICAST_PHS ;
protocollen = sizeof ( short ) * 6 + sizeof ( short ) + sizeof ( qbyte ) * 2 ;
2005-07-03 15:16:20 +00:00
break ;
2004-08-23 00:15:46 +00:00
case TE_BLOOD : //needs to be converted to a particle
case TE_GUNSHOT : //needs qbyte 2 removed
multicastpos = 3 ;
multicasttype = MULTICAST_PVS ;
protocollen = sizeof ( short ) * 3 + sizeof ( qbyte ) * 3 ;
break ;
case TE_LIGHTNINGBLOOD :
case TE_EXPLOSION :
case TE_SPIKE :
case TE_SUPERSPIKE :
multicastpos = 2 ;
multicasttype = MULTICAST_PHS_R ;
protocollen = sizeof ( short ) * 3 + sizeof ( qbyte ) * 2 ;
break ;
case TE_TAREXPLOSION :
case TE_WIZSPIKE :
case TE_KNIGHTSPIKE :
case TE_LAVASPLASH :
case TE_TELEPORT :
multicastpos = 2 ;
multicasttype = MULTICAST_PVS ;
protocollen = sizeof ( short ) * 3 + sizeof ( qbyte ) * 2 ;
2005-07-03 15:16:20 +00:00
break ;
2004-08-23 00:15:46 +00:00
default :
protocollen = sizeof ( buffer ) ;
Con_Printf ( " bad tempentity \n " ) ;
break ;
}
}
break ;
case svc_serverdata :
if ( bufferlen > 9 )
{
i = 9 ;
for ( ; i < bufferlen & & buffer [ i ] ; i + + )
;
i + + ;
i + = 4 ;
for ( ; i < bufferlen & & buffer [ i ] ; i + + )
;
i + = 4 * 10 ;
if ( i < = bufferlen )
protocollen = i ;
}
break ;
case svc_stufftext :
if ( ! data ) //terminated by a null term
protocollen = bufferlen ;
break ;
case svc_modellist :
case svc_soundlist :
if ( ! data )
if ( ! buffer [ bufferlen - 1 ] ) //two null bytes marks the last string
protocollen = bufferlen + 2 ;
break ;
case svc_updateuserinfo : //6 bytes then a string
if ( ! data & & bufferlen > = 6 )
protocollen = bufferlen + 1 ;
break ;
case svc_playerinfo :
if ( bufferlen = = 4 )
{
unsigned short pflags ;
int j ;
ignoreprotocol = true ;
pflags = buffer [ 2 ] + ( buffer [ 3 ] * 256 ) ; //little endian
protocollen = 4 + 1 ;
for ( j = 0 ; j < 3 ; j + + )
if ( pflags & ( DF_ORIGIN < < j ) )
protocollen + = 2 ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
for ( j = 0 ; j < 3 ; j + + )
if ( pflags & ( DF_ANGLES < < j ) )
protocollen + = 2 ;
if ( pflags & DF_MODEL )
protocollen + = 1 ;
if ( pflags & DF_SKINNUM )
protocollen + = 1 ;
if ( pflags & DF_EFFECTS )
protocollen + = 1 ;
if ( pflags & DF_WEAPONFRAME )
protocollen + = 1 ;
/*
if ( pflags & PF_MSEC )
protocollen + = 1 ;
if ( pflags & PF_COMMAND )
{
Con_Printf ( " svc_playerinfo PF_COMMAND not expected in mvd \n " ) ;
protocollen + = 500 ;
}
for ( i = 0 ; i < 3 ; i + + )
if ( pflags & ( PF_VELOCITY1 < < i ) )
protocollen + = 2 ;
if ( pflags & PF_MODEL )
protocollen + = 1 ;
if ( pflags & PF_SKINNUM )
protocollen + = 1 ;
if ( pflags & PF_EFFECTS )
protocollen + = 1 ;
if ( pflags & PF_WEAPONFRAME )
protocollen + = 1 ;
*/
}
break ;
case svc_packetentities :
case svc_deltapacketentities :
if ( ! data ) //two last bytes are 0.
{
unsigned short s ;
i = majortype - svc_packetentities + 1 ;
buffer [ bufferlen ] = data ;
bufferlen + + ;
while ( 1 )
{
s = buffer [ i ] + buffer [ i + 1 ] * 256 ;
i + = 2 ;
if ( i > bufferlen )
break ;
if ( ! s )
{
if ( i < = bufferlen )
protocollen = bufferlen ;
break ;
}
else
{
s & = ~ 511 ;
if ( s & U_MOREBITS )
{
s | = buffer [ i ] ;
i + + ;
}
if ( s & U_MODEL )
i + + ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( s & U_FRAME )
i + + ;
if ( s & U_COLORMAP )
i + + ;
if ( s & U_SKIN )
i + + ;
if ( s & U_EFFECTS )
i + + ;
if ( s & U_ORIGIN1 )
i + = 2 ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( s & U_ANGLE1 )
i + + ;
if ( s & U_ORIGIN2 )
i + = 2 ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( s & U_ANGLE2 )
i + + ;
if ( s & U_ORIGIN3 )
i + = 2 ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( s & U_ANGLE3 )
i + + ;
}
}
bufferlen - - ;
}
break ;
case svc_lightstyle :
if ( ! data & & bufferlen > = 2 )
protocollen = bufferlen + 1 ;
break ;
case svc_serverinfo : //looking for two null terminators
if ( ! data ) //gotta be the second.
{
for ( i = 0 ; i < bufferlen ; i + + )
{
if ( ! buffer [ i ] ) //we already wrote one.
{
protocollen = bufferlen + 1 ; //so this is the last qbyte
break ;
}
}
}
break ;
case svc_sound :
if ( bufferlen = = 3 ) //decide after 3
{
unsigned short s ;
i = 10 ;
s = buffer [ 1 ] + buffer [ 2 ] * 256 ;
if ( s & SND_VOLUME )
i + + ;
if ( s & SND_ATTENUATION )
i + + ;
protocollen = i ;
}
break ;
case svc_setinfo :
if ( ! data & & bufferlen > 2 )
{
for ( i = 2 ; i < bufferlen ; i + + )
{
if ( ! buffer [ i ] )
{
protocollen = bufferlen + 1 ;
break ;
}
}
}
break ;
case svc_centerprint :
if ( ! data & & bufferlen > = 1 )
protocollen = bufferlen + 1 ;
break ;
case svc_print :
if ( ! data & & bufferlen > = 2 )
protocollen = bufferlen + 1 ;
break ;
case svc_nails :
if ( bufferlen = = 1 )
{
i = data ; //first qbyte is id, second, (the current, about to be written) is number of nails.
protocollen = ( i * 6 ) + 2 ;
}
break ;
case svc_nails2 :
if ( bufferlen = = 1 )
{
i = data ; //first qbyte is id, second, (the current, about to be written) is number of nails.
protocollen = ( i * 7 ) + 2 ;
}
break ;
default :
2004-11-13 17:37:49 +00:00
Con_Printf ( " mvd: bad protocol %i \n " , ( int ) data ) ;
2004-08-23 00:15:46 +00:00
protocollen = sizeof ( buffer ) ;
net_message . cursize = 0 ;
data = svc_nop ;
protocollen = 1 ;
break ;
}
}
NPP_AddData ( & data , sizeof ( qbyte ) ) ;
NPP_MVDCheckFlush ( ) ;
}
2009-11-07 13:29:15 +00:00
# endif //SERVER_DEMO_PLAYBACK
2005-07-03 15:16:20 +00:00
void NPP_Flush ( void )
{
2014-10-05 20:04:11 +00:00
if ( progstype ! = PROG_QW )
2005-07-03 15:16:20 +00:00
NPP_NQFlush ( ) ;
# ifdef NQPROT
else
NPP_QWFlush ( ) ;
# endif
}
2004-11-29 01:21:00 +00:00
# endif
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
# endif