2004-08-23 00:15:46 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2005-09-26 03:40:09 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-23 00:15:46 +00:00
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
// cl_parse.c -- parse a message received from the server
# include "quakedef.h"
2005-11-30 01:20:53 +00:00
# include "cl_ignore.h"
2004-08-23 00:15:46 +00:00
void CL_GetNumberedEntityInfo ( int num , float * org , float * ang ) ;
2012-02-12 05:18:31 +00:00
void CLDP_ParseDarkPlaces5Entities ( void ) ;
2008-05-25 22:23:43 +00:00
void CL_SetStatInt ( int pnum , int stat , int value ) ;
2008-11-14 16:43:28 +00:00
static qboolean CL_CheckModelResources ( char * name ) ;
2004-08-23 00:15:46 +00:00
2008-11-09 22:29:28 +00:00
char cl_dp_csqc_progsname [ 128 ] ;
2007-06-20 00:02:54 +00:00
int cl_dp_csqc_progssize ;
int cl_dp_csqc_progscrc ;
2008-12-03 02:42:05 +00:00
int cl_dp_serverextension_download ;
2007-06-20 00:02:54 +00:00
2004-08-23 00:15:46 +00:00
2012-09-30 05:52:03 +00:00
char * svc_qwstrings [ ] =
2004-08-23 00:15:46 +00:00
{
" svc_bad " ,
" svc_nop " ,
" svc_disconnect " ,
2012-09-30 05:52:03 +00:00
" svcqw_updatestatbyte " ,
2004-08-23 00:15:46 +00:00
" svc_version " , // [long] server version
" svc_setview " , // [short] entity number
" svc_sound " , // <see code>
" svc_time " , // [float] server time
" svc_print " , // [string] null terminated string
" svc_stufftext " , // [string] stuffed into client's console buffer
// the string should be \n terminated
" svc_setangle " , // [vec3] set the view angle to this absolute value
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
" svc_serverdata " , // [long] version ...
" svc_lightstyle " , // [qbyte] [string]
" svc_updatename " , // [qbyte] [string]
" svc_updatefrags " , // [qbyte] [short]
" svc_clientdata " , // <shortbits + data>
" svc_stopsound " , // <see code>
" svc_updatecolors " , // [qbyte] [qbyte]
" svc_particle " , // [vec3] <variable>
" svc_damage " , // [qbyte] impact [qbyte] blood [vec3] from
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
" svc_spawnstatic " ,
" svc_spawnstatic2 " ,
" svc_spawnbaseline " ,
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
" svc_temp_entity " , // <variable>
" svc_setpause " ,
" svc_signonnum " ,
" svc_centerprint " ,
" svc_killedmonster " ,
" svc_foundsecret " ,
" svc_spawnstaticsound " ,
" svc_intermission " ,
" svc_finale " ,
" svc_cdtrack " ,
" svc_sellscreen " ,
" svc_smallkick " ,
" svc_bigkick " ,
" svc_updateping " ,
" svc_updateentertime " ,
" svc_updatestatlong " ,
" svc_muzzleflash " ,
" svc_updateuserinfo " ,
" svc_download " ,
" svc_playerinfo " ,
" svc_nails " ,
" svc_choke " ,
" svc_modellist " ,
" svc_soundlist " ,
" svc_packetentities " ,
" svc_deltapacketentities " ,
" svc_maxspeed " ,
" svc_entgravity " ,
" svc_setinfo " ,
" svc_serverinfo " ,
" svc_updatepl " ,
2006-03-14 01:21:18 +00:00
" MVD svc_nails2 " ,
2012-02-12 05:18:31 +00:00
" svcfte_soundextended " ,
" svcfte_soundlistshort " ,
2006-03-14 01:21:18 +00:00
" FTE svc_lightstylecol " ,
2011-03-24 14:35:24 +00:00
" FTE svc_bulletentext " , // obsolete
2006-03-14 01:21:18 +00:00
" FTE svc_lightnings " ,
" FTE svc_modellistshort " ,
" FTE svc_ftesetclientpersist " ,
" FTE svc_setportalstate " ,
" FTE svc_particle2 " ,
" FTE svc_particle3 " ,
" FTE svc_particle4 " ,
" FTE svc_spawnbaseline2 " ,
" FTE svc_customtempent " ,
" FTE svc_choosesplitclient " ,
2011-06-04 16:11:35 +00:00
" svcfte_showpic " ,
" svcfte_hidepic " ,
" svcfte_movepic " ,
" svcfte_updatepic " ,
" ??? " ,
" svcfte_effect " ,
" svcfte_effect2 " ,
" svcfte_csqcentities " ,
" svcfte_precache " ,
" svcfte_updatestatstring " ,
" svcfte_updatestatfloat " ,
" svcfte_trailparticles " ,
" svcfte_pointparticles " ,
" svcfte_pointparticles1 " ,
" svcfte_cgamepacket " ,
" svcfte_voicechat " ,
" svcfte_setangledelta " ,
2012-02-12 05:18:31 +00:00
" svcfte_updateentities " ,
2011-06-04 16:11:35 +00:00
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
" ??? " ,
2004-08-23 00:15:46 +00:00
} ;
char * svc_nqstrings [ ] =
{
" nqsvc_bad " ,
" nqsvc_nop " ,
" nqsvc_disconnect " ,
2012-09-30 05:52:03 +00:00
" nqsvc_updatestatlong " ,
2004-08-23 00:15:46 +00:00
" nqsvc_version " , // [long] server version
" nqsvc_setview " , // [short] entity number
" nqsvc_sound " , // <see code>
" nqsvc_time " , // [float] server time
" nqsvc_print " , // [string] null terminated string
" nqsvc_stufftext " , // [string] stuffed into client's console buffer
// the string should be \n terminated
" nqsvc_setangle " , // [vec3] set the view angle to this absolute value
" nqsvc_serverinfo " , // [long] version
// [string] signon string
// [string]..[0]model cache [string]...[0]sounds cache
// [string]..[0]item cache
" nqsvc_lightstyle " , // [qbyte] [string]
" nqsvc_updatename " , // [qbyte] [string]
" nqsvc_updatefrags " , // [qbyte] [short]
" nqsvc_clientdata " , // <shortbits + data>
" nqsvc_stopsound " , // <see code>
" nqsvc_updatecolors " , // [qbyte] [qbyte]
" nqsvc_particle " , // [vec3] <variable>
" nqsvc_damage " , // [qbyte] impact [qbyte] blood [vec3] from
" nqsvc_spawnstatic " ,
2013-03-12 22:35:33 +00:00
" nqsvcfte_spawnstatic2(21) " ,
2004-08-23 00:15:46 +00:00
" nqsvc_spawnbaseline " ,
" nqsvc_temp_entity " , // <variable>
" nqsvc_setpause " ,
" nqsvc_signonnum " ,
" nqsvc_centerprint " ,
" nqsvc_killedmonster " ,
" nqsvc_foundsecret " ,
" nqsvc_spawnstaticsound " ,
" nqsvc_intermission " ,
" nqsvc_finale " , // [string] music [string] text
" nqsvc_cdtrack " , // [qbyte] track [qbyte] looptrack
" nqsvc_sellscreen " ,
2005-09-26 03:40:09 +00:00
" nqsvc_cutscene " , //34
2004-08-23 00:15:46 +00:00
2013-07-26 17:19:06 +00:00
" NEW PROTOCOL " , //35
" NEW PROTOCOL " , //36
" fitzsvc_skybox " , //37
" NEW PROTOCOL " , //38
" NEW PROTOCOL " , //39
" fitzsvc_bf " , //40
" fitzsvc_fog " , //41
" fitzsvc_spawnbaseline2 " , //42
" fitzsvc_spawnstatic2 " , //43
" fitzsvc_spawnstaticsound2 " , //44
" NEW PROTOCOL " , //45
" NEW PROTOCOL " , //46
" NEW PROTOCOL " , //47
" NEW PROTOCOL " , //48
" NEW PROTOCOL " , //49
2007-06-20 00:02:54 +00:00
" dpsvc_downloaddata " , //50
2008-11-09 22:29:28 +00:00
" dpsvc_updatestatubyte " , //51
" dpsvc_effect " , //52
" dpsvc_effect2 " , //53
" dp6svc_precache/dp5svc_sound2 " , //54
" dpsvc_spawnbaseline2 " , //55
" dpsvc_spawnstatic2 " , //56 obsolete
" dpsvc_entities " , //57
2012-11-27 03:23:19 +00:00
" dpsvc_csqcentities " , //58
2008-11-09 22:29:28 +00:00
" dpsvc_spawnstaticsound2 " , //59
" dpsvc_trailparticles " , //60
" dpsvc_pointparticles " , //61
2013-03-12 22:35:33 +00:00
" dpsvc_pointparticles1 " , //62
2013-07-26 17:19:06 +00:00
" NEW PROTOCOL(63) " , //63
" NEW PROTOCOL(64) " , //64
" NEW PROTOCOL(65) " , //65
" ftenqsvc_spawnbaseline2 " , //66
" NEW PROTOCOL(67) " , //67
" NEW PROTOCOL(68) " , //68
" NEW PROTOCOL(69) " , //69
" NEW PROTOCOL(70) " , //70
" NEW PROTOCOL(71) " , //71
" NEW PROTOCOL(72) " , //72
" NEW PROTOCOL(73) " , //73
" NEW PROTOCOL(74) " , //74
" NEW PROTOCOL(75) " , //75
" NEW PROTOCOL(76) " , //76
" NEW PROTOCOL(77) " , //77
" NEW PROTOCOL(78) " , //78
" NEW PROTOCOL(79) " , //79
" NEW PROTOCOL(80) " , //80
" NEW PROTOCOL(81) " , //81
" NEW PROTOCOL(82) " , //82
2014-03-30 08:55:06 +00:00
" nqsvcfte_cgamepacket(83) " , //83
2013-07-26 17:19:06 +00:00
" NEW PROTOCOL(84) " , //84
" NEW PROTOCOL(85) " , //85
" nqsvcfte_updateentities " , //86
" NEW PROTOCOL(87) " , //87
" NEW PROTOCOL(88) " //88
2004-08-23 00:15:46 +00:00
} ;
2015-04-14 23:12:17 +00:00
extern cvar_t requiredownloads , cl_standardchat , msg_filter , msg_filter_frags , cl_countpendingpl , cl_download_mapsrc ;
2004-08-23 00:15:46 +00:00
int oldparsecountmod ;
int parsecountmod ;
double parsecounttime ;
2005-01-18 20:15:20 +00:00
int cl_spikeindex , cl_playerindex , cl_h_playerindex , cl_flagindex , cl_rocketindex , cl_grenadeindex , cl_gib1index , cl_gib2index , cl_gib3index ;
2004-08-23 00:15:46 +00:00
2012-07-05 19:42:36 +00:00
//called after disconnect, purges all memory that was allocated etc
void CL_Parse_Disconnected ( void )
{
2014-06-12 23:08:42 +00:00
if ( cls . download )
2012-07-05 19:42:36 +00:00
{
2014-06-12 23:08:42 +00:00
//note: not all downloads abort when the server disconnects, as they're fully out of bounds (ie: http)
if ( cls . download - > method < = DL_QWPENDING )
DL_Abort ( cls . download , QDL_DISCONNECT ) ;
2012-07-05 19:42:36 +00:00
}
{
downloadlist_t * next ;
while ( cl . downloadlist )
{
next = cl . downloadlist - > next ;
Z_Free ( cl . downloadlist ) ;
cl . downloadlist = next ;
}
while ( cl . faileddownloads )
{
next = cl . faileddownloads - > next ;
Z_Free ( cl . faileddownloads ) ;
cl . faileddownloads = next ;
}
}
CL_ClearParseState ( ) ;
}
2004-08-23 00:15:46 +00:00
//=============================================================================
int packet_latency [ NET_TIMINGS ] ;
2014-03-30 08:55:06 +00:00
int CL_CalcNet ( float scale )
2004-08-23 00:15:46 +00:00
{
2013-03-12 22:53:23 +00:00
int i ;
2013-09-06 22:57:44 +00:00
outframe_t * frame ;
2013-03-12 22:53:23 +00:00
int lost = 0 ;
2006-04-02 23:25:03 +00:00
int percent ;
int sent ;
2004-08-23 00:15:46 +00:00
// char st[80];
2006-04-02 23:25:03 +00:00
sent = NET_TIMINGS ;
2013-07-26 17:19:06 +00:00
for ( i = cl . movesequence - UPDATE_BACKUP + 1
; i < = cl . movesequence
2004-08-23 00:15:46 +00:00
; i + + )
{
2013-09-06 22:57:44 +00:00
frame = & cl . outframes [ i & UPDATE_MASK ] ;
2013-07-26 17:19:06 +00:00
if ( i > cl . lastackedmovesequence )
2013-03-12 22:55:17 +00:00
{
// no response yet
if ( cl_countpendingpl . ival )
{
packet_latency [ i & NET_TIMINGSMASK ] = 9999 ;
lost + + ;
}
else
packet_latency [ i & NET_TIMINGSMASK ] = 10000 ;
}
else if ( frame - > latency = = - 1 )
2013-03-12 22:53:23 +00:00
{
2004-08-23 00:15:46 +00:00
packet_latency [ i & NET_TIMINGSMASK ] = 9999 ; // dropped
2013-03-12 22:53:23 +00:00
lost + + ;
}
else if ( frame - > latency = = - 2 )
2004-08-23 00:15:46 +00:00
packet_latency [ i & NET_TIMINGSMASK ] = 10000 ; // choked
2013-03-12 22:53:23 +00:00
else if ( frame - > latency = = - 3 )
2006-04-02 23:25:03 +00:00
{
packet_latency [ i & NET_TIMINGSMASK ] = 9997 ; // c2spps
sent - - ;
}
2013-09-06 22:57:44 +00:00
// else if (frame->invalid)
// packet_latency[i&NET_TIMINGSMASK] = 9998; // invalid delta
2004-08-23 00:15:46 +00:00
else
2014-03-30 08:55:06 +00:00
packet_latency [ i & NET_TIMINGSMASK ] = frame - > latency * 60 * scale ;
2004-08-23 00:15:46 +00:00
}
2006-04-02 23:25:03 +00:00
2013-03-12 22:53:23 +00:00
if ( sent < 1 )
percent = 100 ; //shouldn't ever happen.
2006-04-02 23:25:03 +00:00
else
2013-03-12 22:53:23 +00:00
percent = lost * 100 / sent ;
2006-04-02 23:25:03 +00:00
return percent ;
2004-08-23 00:15:46 +00:00
}
2015-04-21 04:12:00 +00:00
float CL_CalcNet2 ( float * ping , float * ping_min , float * ping_max , float * ping_stddev )
{
int i ;
outframe_t * frame ;
int lost = 0 ;
int pending = 0 ;
int sent ;
int valid = 0 ;
// char st[80];
* ping = 0 ;
* ping_max = 0 ;
* ping_min = 1000000000000 ;
sent = NET_TIMINGS ;
for ( i = cl . movesequence - UPDATE_BACKUP + 1
; i < = cl . movesequence
; i + + )
{
frame = & cl . outframes [ i & UPDATE_MASK ] ;
if ( i > cl . lastackedmovesequence )
{ // no response yet
if ( cl_countpendingpl . ival )
lost + + ;
}
else if ( frame - > latency = = - 1 )
lost + + ; // lost
else if ( frame - > latency = = - 2 )
; // choked
else if ( frame - > latency = = - 3 )
sent - - ; // c2spps
// else if (frame->invalid)
// packet_latency[i&NET_TIMINGSMASK] = 9998; // invalid delta
else
{
* ping + = frame - > latency ;
if ( * ping_max < frame - > latency )
* ping_max = frame - > latency ;
if ( * ping_min > frame - > latency )
* ping_min = frame - > latency ;
valid + + ;
}
}
* ping / = valid ;
if ( pending = = sent | | sent < 1 )
return 1 ; //shouldn't ever happen.
else
return lost / sent ;
}
2013-09-06 22:57:44 +00:00
void CL_AckedInputFrame ( int inseq , int outseq , qboolean worldstateokay )
2013-07-26 17:19:06 +00:00
{
unsigned int i ;
unsigned int newmod ;
2013-09-06 22:57:44 +00:00
outframe_t * frame ;
2013-07-26 17:19:06 +00:00
2013-09-06 22:57:44 +00:00
newmod = outseq & UPDATE_MASK ;
//calc the latency for this frame, but only if its not a dupe ack. we want the youngest, not the oldest, so we can calculate network latency rather than simply packet frequency
if ( outseq ! = cl . lastackedmovesequence )
2013-07-26 17:19:06 +00:00
{
2013-09-06 22:57:44 +00:00
frame = & cl . outframes [ newmod ] ;
// calculate latency
frame - > latency = realtime - frame - > senttime ;
if ( frame - > latency < 0 | | frame - > latency > 1.0 )
{
// Con_Printf ("Odd latency: %5.2f\n", latency);
}
2013-07-26 17:19:06 +00:00
else
2013-09-06 22:57:44 +00:00
{
// drift the average latency towards the observed latency
if ( frame - > latency < cls . latency )
cls . latency = frame - > latency ;
else
cls . latency + = 0.001 ; // drift up, so correction are needed
}
2013-07-26 17:19:06 +00:00
2013-09-06 22:57:44 +00:00
if ( cl . inframes [ inseq & UPDATE_MASK ] . invalid )
frame - > latency = - 4 ;
//and mark any missing ones as dropped
2013-07-26 17:19:06 +00:00
for ( i = ( cl . lastackedmovesequence + 1 ) & UPDATE_MASK ; i ! = newmod ; i = ( i + 1 ) & UPDATE_MASK )
{
2013-09-06 22:57:44 +00:00
//nq has no concept of choking. outbound packets that are accepted during a single frame will be erroneoulsy considered dropped. nq never had a netgraph based upon outgoing timings.
// Con_Printf("Dropped moveframe %i\n", i);
cl . outframes [ i ] . latency = - 1 ;
2013-07-26 17:19:06 +00:00
}
}
2013-09-06 22:57:44 +00:00
cl . inframes [ inseq & UPDATE_MASK ] . ackframe = outseq ;
2013-07-26 17:19:06 +00:00
if ( worldstateokay )
2013-09-06 22:57:44 +00:00
cl . ackedmovesequence = outseq ;
cl . lastackedmovesequence = outseq ;
2013-07-26 17:19:06 +00:00
}
2004-08-23 00:15:46 +00:00
//=============================================================================
2014-03-30 08:55:06 +00:00
int CL_IsDownloading ( const char * localname )
2014-02-07 08:38:40 +00:00
{
downloadlist_t * dl ;
/*check for dupes*/
for ( dl = cl . downloadlist ; dl ; dl = dl - > next ) //It's already on our list. Ignore it.
{
if ( ! strcmp ( dl - > localname , localname ) )
return 2 ; //queued
}
2014-06-12 23:08:42 +00:00
if ( cls . download )
if ( ! strcmp ( cls . download - > localname , localname ) )
return 1 ; //downloading
2014-02-07 08:38:40 +00:00
return 0 ;
}
2005-01-13 16:29:20 +00:00
//note: this will overwrite existing files.
//returns true if the download is going to be downloaded after the call.
2014-03-30 08:55:06 +00:00
qboolean CL_EnqueDownload ( const char * filename , const char * localname , unsigned int flags )
2005-01-13 16:29:20 +00:00
{
2014-09-02 02:44:43 +00:00
extern cvar_t cl_downloads ;
2005-01-13 16:29:20 +00:00
downloadlist_t * dl ;
2010-03-25 22:56:11 +00:00
qboolean webdl = false ;
2014-10-05 20:04:11 +00:00
char ext [ 8 ] ;
2015-04-21 04:12:00 +00:00
if ( ! strncmp ( filename , " http:// " , 7 ) | | ! strncmp ( filename , " https:// " , 8 ) )
2010-03-25 22:56:11 +00:00
{
2012-11-27 03:23:19 +00:00
if ( ! localname )
return false ;
2010-03-25 22:56:11 +00:00
webdl = true ;
}
else
{
if ( ! localname )
localname = filename ;
if ( cls . demoplayback & & cls . demoplayback ! = DPB_EZTV )
return false ;
}
2014-10-05 20:04:11 +00:00
COM_FileExtension ( localname , ext , sizeof ( ext ) ) ;
2013-05-11 05:03:07 +00:00
if ( ! stricmp ( ext , " dll " ) | | ! stricmp ( ext , " so " ) | | strchr ( localname , ' \\ ' ) | | strchr ( localname , ' : ' ) | | strstr ( localname , " .. " ) )
2005-01-13 16:29:20 +00:00
{
Con_Printf ( " Denying download of \" %s \" \n " , filename ) ;
return false ;
}
2014-09-02 02:44:43 +00:00
if ( ! ( flags & DLLF_USEREXPLICIT ) & & ! cl_downloads . ival )
{
if ( flags & DLLF_VERBOSE )
Con_Printf ( " cl_downloads setting prevents download of \" %s \" \n " , filename ) ;
return false ;
}
2011-10-27 15:46:36 +00:00
/*reject if it already failed*/
2008-11-09 22:29:28 +00:00
if ( ! ( flags & DLLF_IGNOREFAILED ) )
2005-01-13 16:29:20 +00:00
{
2008-12-03 02:42:05 +00:00
# ifdef NQPROT
2010-03-25 22:56:11 +00:00
if ( ! webdl & & cls . protocol = = CP_NETQUAKE )
2008-12-03 02:42:05 +00:00
if ( ! cl_dp_serverextension_download )
return false ;
# endif
2005-01-13 16:29:20 +00:00
for ( dl = cl . faileddownloads ; dl ; dl = dl - > next ) //yeah, so it failed... Ignore it.
{
2009-05-24 10:11:17 +00:00
if ( ! strcmp ( dl - > rname , filename ) )
2005-01-13 16:29:20 +00:00
{
2008-11-09 22:29:28 +00:00
if ( flags & DLLF_VERBOSE )
2005-01-13 16:29:20 +00:00
Con_Printf ( " We've failed to download \" %s \" already \n " , filename ) ;
return false ;
}
}
}
2011-10-27 15:46:36 +00:00
/*check for dupes*/
2014-02-07 08:38:40 +00:00
switch ( CL_IsDownloading ( localname ) )
2005-01-13 16:29:20 +00:00
{
2014-02-07 08:38:40 +00:00
case 2 :
if ( flags & DLLF_VERBOSE )
Con_Printf ( " Already waiting for \" %s \" \n " , filename ) ;
return true ;
default :
case 1 :
2008-11-09 22:29:28 +00:00
if ( flags & DLLF_VERBOSE )
2005-01-13 16:29:20 +00:00
Con_Printf ( " Already downloading \" %s \" \n " , filename ) ;
return true ;
2014-02-07 08:38:40 +00:00
case 0 :
break ;
2005-01-13 16:29:20 +00:00
}
2008-11-09 22:29:28 +00:00
if ( ! * filename )
{
Con_Printf ( " Download \" \" ? Huh? \n " ) ;
return true ;
}
2005-01-13 16:29:20 +00:00
dl = Z_Malloc ( sizeof ( downloadlist_t ) ) ;
2009-05-24 10:11:17 +00:00
Q_strncpyz ( dl - > rname , filename , sizeof ( dl - > rname ) ) ;
2005-08-11 04:14:33 +00:00
Q_strncpyz ( dl - > localname , localname , sizeof ( dl - > localname ) ) ;
2005-01-13 16:29:20 +00:00
dl - > next = cl . downloadlist ;
cl . downloadlist = dl ;
2008-11-09 22:29:28 +00:00
dl - > size = 0 ;
dl - > flags = flags | DLLF_SIZEUNKNOWN ;
2005-01-13 16:29:20 +00:00
2010-03-25 22:56:11 +00:00
if ( ! webdl & & ( cls . fteprotocolextensions & ( PEXT_CHUNKEDDOWNLOADS
2008-11-09 22:29:28 +00:00
# ifdef PEXT_PK3DOWNLOADS
| PEXT_PK3DOWNLOADS
# endif
2012-11-29 13:37:48 +00:00
) ) & & ! ( dl - > flags & DLLF_TEMPORARY ) )
2011-10-27 15:46:36 +00:00
{
2009-05-24 10:11:17 +00:00
CL_SendClientCommand ( true , " dlsize \" %s \" " , dl - > rname ) ;
2011-10-27 15:46:36 +00:00
}
2008-11-09 22:29:28 +00:00
if ( flags & DLLF_VERBOSE )
2005-01-13 16:29:20 +00:00
Con_Printf ( " Enqued download of \" %s \" \n " , filename ) ;
return true ;
}
2011-10-27 15:46:36 +00:00
# ifdef warningmsg
# pragma warningmsg("fix this")
2011-05-29 04:26:29 +00:00
# endif
2008-11-09 22:29:28 +00:00
int downloadsize ;
2014-06-12 23:08:42 +00:00
void CL_GetDownloadSizes ( unsigned int * filecount , qofs_t * totalsize , qboolean * somesizesunknown )
2008-11-09 22:29:28 +00:00
{
downloadlist_t * dl ;
2014-06-12 23:08:42 +00:00
qdownload_t * d ;
2008-11-09 22:29:28 +00:00
* filecount = 0 ;
* totalsize = 0 ;
* somesizesunknown = false ;
for ( dl = cl . downloadlist ; dl ; dl = dl - > next )
{
2009-04-06 00:34:32 +00:00
* filecount + = 1 ;
2008-11-09 22:29:28 +00:00
if ( dl - > flags & DLLF_SIZEUNKNOWN )
* somesizesunknown = true ;
else
* totalsize + = dl - > size ;
}
2014-06-12 23:08:42 +00:00
d = cls . download ;
if ( d )
2008-11-09 22:29:28 +00:00
{
2014-06-12 23:08:42 +00:00
if ( d - > sizeunknown )
* somesizesunknown = true ;
* totalsize + = d - > size ;
2008-11-09 22:29:28 +00:00
}
}
2005-01-16 02:25:35 +00:00
void CL_DisenqueDownload ( char * filename )
2005-01-13 16:29:20 +00:00
{
downloadlist_t * dl , * nxt ;
if ( cl . downloadlist ) //remove from enqued download list
{
2009-05-24 10:11:17 +00:00
if ( ! strcmp ( cl . downloadlist - > rname , filename ) )
2005-01-13 16:29:20 +00:00
{
dl = cl . downloadlist ;
cl . downloadlist = cl . downloadlist - > next ;
Z_Free ( dl ) ;
}
else
{
2009-04-06 00:34:32 +00:00
for ( dl = cl . downloadlist ; dl - > next ; dl = dl - > next )
2005-01-13 16:29:20 +00:00
{
2009-05-24 10:11:17 +00:00
if ( ! strcmp ( dl - > next - > rname , filename ) )
2005-01-13 16:29:20 +00:00
{
nxt = dl - > next - > next ;
Z_Free ( dl - > next ) ;
dl - > next = nxt ;
break ;
}
}
}
}
2005-01-13 23:33:00 +00:00
}
2005-01-13 16:29:20 +00:00
2010-07-11 02:22:39 +00:00
# ifdef WEBCLIENT
2010-03-25 22:56:11 +00:00
void CL_WebDownloadFinished ( struct dl_download * dl )
{
if ( dl - > status = = DL_FAILED )
2014-06-12 23:08:42 +00:00
CL_DownloadFailed ( dl - > url , & dl - > qdownload ) ;
2010-03-25 22:56:11 +00:00
else if ( dl - > status = = DL_FINISHED )
{
if ( dl - > file )
VFS_CLOSE ( dl - > file ) ;
dl - > file = NULL ;
2014-06-12 23:08:42 +00:00
CL_DownloadFinished ( & dl - > qdownload ) ;
2010-03-25 22:56:11 +00:00
}
}
2010-07-11 02:22:39 +00:00
# endif
2010-03-25 22:56:11 +00:00
2012-11-29 13:37:48 +00:00
void CL_SendDownloadStartRequest ( char * filename , char * localname , unsigned int flags )
2005-01-16 02:25:35 +00:00
{
2014-06-12 23:08:42 +00:00
static int dlsequence ;
qdownload_t * dl ;
# ifdef WEBCLIENT
if ( ! strncmp ( filename , " http:// " , 7 ) )
{
if ( ! HTTP_CL_Get ( filename , localname , CL_WebDownloadFinished ) )
CL_DownloadFailed ( filename , NULL ) ;
return ;
}
# endif
if ( cls . download )
return ; //no!
dl = Z_Malloc ( sizeof ( * dl ) ) ;
dl - > filesequence = + + dlsequence ;
Q_strncpyz ( dl - > remotename , filename , sizeof ( dl - > remotename ) ) ;
Q_strncpyz ( dl - > localname , localname , sizeof ( dl - > localname ) ) ;
2012-11-29 13:37:48 +00:00
if ( ! ( flags & DLLF_TEMPORARY ) )
2014-06-12 23:08:42 +00:00
Con_TPrintf ( " Downloading %s... \n " , dl - > localname ) ;
2005-01-16 02:25:35 +00:00
// download to a temp name, and only rename
// to the real name when done, so if interrupted
// a runt file wont be left
2014-06-12 23:08:42 +00:00
COM_StripExtension ( localname , dl - > tempname , sizeof ( dl - > tempname ) - 5 ) ;
Q_strncatz ( dl - > tempname , " .tmp " , sizeof ( dl - > tempname ) ) ;
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
CL_SendClientCommand ( true , " download %s " , filename ) ;
dl - > method = DL_QWPENDING ;
dl - > percent = 0 ;
dl - > sizeunknown = true ;
dl - > flags = flags & DLLF_OVERWRITE ;
2005-01-16 02:25:35 +00:00
CL_DisenqueDownload ( filename ) ;
2014-06-12 23:08:42 +00:00
cls . download = dl ;
2005-01-16 02:25:35 +00:00
}
2005-01-13 23:33:00 +00:00
//Do any reloading for the file that just reloaded.
2014-06-12 23:08:42 +00:00
void CL_DownloadFinished ( qdownload_t * dl )
2005-01-13 23:33:00 +00:00
{
int i ;
2014-10-05 20:04:11 +00:00
char ext [ 8 ] ;
2005-01-13 16:29:20 +00:00
2014-06-12 23:08:42 +00:00
char filename [ MAX_QPATH ] ;
char tempname [ MAX_QPATH ] ;
2009-05-24 10:11:17 +00:00
2014-06-12 23:08:42 +00:00
Q_strncpyz ( filename , dl - > localname , sizeof ( filename ) ) ;
Q_strncpyz ( tempname , dl - > tempname , sizeof ( tempname ) ) ;
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
DL_Abort ( dl , QDL_COMPLETED ) ;
COM_RefreshFSCache_f ( ) ;
2005-01-16 02:25:35 +00:00
2014-10-05 20:04:11 +00:00
COM_FileExtension ( filename , ext , sizeof ( ext ) ) ;
2008-11-09 22:29:28 +00:00
2010-12-23 08:53:23 +00:00
2014-06-12 23:08:42 +00:00
//should probably ask the filesytem code if its a package format instead.
if ( ! strncmp ( filename , " package/ " , 8 ) | | ! strncmp ( ext , " pk4 " , 3 ) | | ! strncmp ( ext , " pk3 " , 3 ) | | ! strncmp ( ext , " pak " , 3 ) )
2011-10-27 15:46:36 +00:00
{
2008-11-09 22:29:28 +00:00
FS_ReloadPackFiles ( ) ;
2011-10-27 15:46:36 +00:00
CL_CheckServerInfo ( ) ;
}
2008-11-09 22:29:28 +00:00
else if ( ! strcmp ( filename , " gfx/palette.lmp " ) )
2005-01-13 23:33:00 +00:00
{
Cbuf_AddText ( " vid_restart \n " , RESTRICT_LOCAL ) ;
}
else
{
2008-11-28 20:34:51 +00:00
CL_CheckModelResources ( filename ) ;
2008-11-09 22:29:28 +00:00
if ( ! cl . sendprespawn )
2005-01-13 23:33:00 +00:00
{
2012-11-27 03:23:19 +00:00
/*
2013-03-12 22:47:42 +00:00
extern int mod_numknown ;
2014-08-25 07:35:41 +00:00
extern model_t * mod_known ;
2008-11-09 22:29:28 +00:00
for ( i = 0 ; i < mod_numknown ; i + + ) //go and load this model now.
2005-01-13 23:33:00 +00:00
{
2008-11-09 22:29:28 +00:00
if ( ! strcmp ( mod_known [ i ] . name , filename ) )
{
Mod_ForName ( mod_known [ i ] . name , false ) ; //throw away result.
break ;
}
2005-01-13 23:33:00 +00:00
}
2012-11-27 03:23:19 +00:00
*/
2014-09-17 03:04:08 +00:00
for ( i = 0 ; i < MAX_PRECACHE_MODELS ; i + + ) //go and load this model now.
2006-01-04 00:44:34 +00:00
{
2008-11-09 22:29:28 +00:00
if ( ! strcmp ( cl . model_name [ i ] , filename ) )
{
2014-03-30 08:55:06 +00:00
cl . model_precache [ i ] = Mod_ForName ( cl . model_name [ i ] , MLV_WARN ) ; //throw away result.
2008-11-09 22:29:28 +00:00
if ( i = = 1 )
cl . worldmodel = cl . model_precache [ i ] ;
break ;
}
2006-01-04 00:44:34 +00:00
}
2013-03-12 22:44:00 +00:00
for ( i = 0 ; i < MAX_CSMODELS ; i + + ) //go and load this model now.
2012-11-27 03:23:19 +00:00
{
if ( ! strcmp ( cl . model_csqcname [ i ] , filename ) )
{
2014-03-30 08:55:06 +00:00
cl . model_csqcprecache [ i ] = Mod_ForName ( cl . model_csqcname [ i ] , MLV_WARN ) ; //throw away result.
2012-11-27 03:23:19 +00:00
break ;
}
}
2009-07-06 01:20:20 +00:00
for ( i = 0 ; i < MAX_VWEP_MODELS ; i + + )
{
if ( ! strcmp ( cl . model_name_vwep [ i ] , filename ) )
{
2014-03-30 08:55:06 +00:00
cl . model_precache_vwep [ i ] = Mod_ForName ( cl . model_name_vwep [ i ] , MLV_WARN ) ;
2009-07-06 01:20:20 +00:00
break ;
}
}
2006-01-04 00:44:34 +00:00
}
2006-10-05 22:11:17 +00:00
S_ResetFailedLoad ( ) ; //okay, so this can still get a little spammy in bad places...
2006-01-04 00:44:34 +00:00
//this'll do the magic for us
2005-01-13 23:33:00 +00:00
Skin_FlushSkin ( filename ) ;
}
2005-01-13 16:29:20 +00:00
}
2007-06-20 00:02:54 +00:00
2014-03-30 08:55:06 +00:00
qboolean CL_CheckFile ( const char * filename )
2007-06-20 00:02:54 +00:00
{
if ( strstr ( filename , " .. " ) )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Refusing to download a path with .. \n " ) ;
2007-06-20 00:02:54 +00:00
return true ;
}
if ( COM_FCheckExists ( filename ) )
{ // it exists, no need to download
return true ;
}
return false ;
}
2011-10-27 15:46:36 +00:00
2014-03-30 08:55:06 +00:00
qboolean CL_CheckDLFile ( const char * filename )
2011-10-27 15:46:36 +00:00
{
if ( ! strncmp ( filename , " package/ " , 8 ) )
{
vfsfile_t * f ;
f = FS_OpenVFS ( filename + 8 , " rb " , FS_ROOT ) ;
if ( f )
{
VFS_CLOSE ( f ) ;
return true ;
}
return false ;
}
else
return COM_FCheckExists ( filename ) ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = =
2006-01-04 00:44:34 +00:00
CL_CheckOrEnqueDownloadFile
2004-08-23 00:15:46 +00:00
2010-03-25 22:56:11 +00:00
Returns true if the file exists , returns false if it triggered a download .
2004-08-23 00:15:46 +00:00
= = = = = = = = = = = = = = =
*/
2007-06-20 00:02:54 +00:00
2014-03-30 08:55:06 +00:00
qboolean CL_CheckOrEnqueDownloadFile ( const char * filename , const char * localname , unsigned int flags )
2006-01-04 00:44:34 +00:00
{ //returns false if we don't have the file yet.
2014-10-05 20:04:11 +00:00
COM_AssertMainThread ( " CL_CheckOrEnqueDownloadFile " ) ;
2011-10-27 15:46:36 +00:00
if ( flags & DLLF_NONGAME )
{
/*pak/pk3 downloads have an explicit leading package/ as an internal/network marker*/
2013-06-23 02:17:02 +00:00
if ( ! strchr ( filename , ' : ' ) )
filename = va ( " package/%s " , filename ) ;
2011-10-27 15:46:36 +00:00
localname = va ( " package/%s " , localname ) ;
}
2013-06-23 02:17:02 +00:00
/*files with a leading * should not be downloaded (inline models, sexed sounds, etc). also block anyone trying to explicitly download a package/ because our code (wrongly) uses that name internally*/
2011-10-27 15:46:36 +00:00
else if ( * filename = = ' * ' | | ! strncmp ( filename , " package/ " , 8 ) )
return true ;
2005-08-11 04:14:33 +00:00
if ( ! localname )
localname = filename ;
2005-09-26 03:40:09 +00:00
2009-03-03 01:52:30 +00:00
# ifndef CLIENTONLY
2011-10-27 15:46:36 +00:00
/*no downloading if we're the one we'd be downloading from*/
2009-03-03 01:52:30 +00:00
if ( sv . state )
return true ;
# endif
2011-10-27 15:46:36 +00:00
if ( ! ( flags & DLLF_OVERWRITE ) )
{
if ( CL_CheckDLFile ( localname ) )
return true ;
}
2010-03-25 22:56:11 +00:00
2004-08-23 00:15:46 +00:00
//ZOID - can't download when recording
2005-01-13 16:29:20 +00:00
if ( cls . demorecording )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Unable to download %s in record mode. \n " , filename ) ;
2004-08-23 00:15:46 +00:00
return true ;
}
//ZOID - can't download when playback
2010-03-25 22:56:11 +00:00
// if (cls.demoplayback && cls.demoplayback != DPB_EZTV)
// return true;
2004-08-23 00:15:46 +00:00
2004-11-27 08:16:25 +00:00
SCR_EndLoadingPlaque ( ) ; //release console.
2010-03-25 22:56:11 +00:00
if ( * cl_download_mapsrc . string )
if ( ! strncmp ( filename , " maps/ " , 5 ) )
if ( ! strcmp ( filename + strlen ( filename ) - 4 , " .bsp " ) )
2005-06-04 04:20:20 +00:00
{
char base [ MAX_QPATH ] ;
2010-03-25 22:56:11 +00:00
COM_FileBase ( filename , base , sizeof ( base ) ) ;
filename = va ( " %s%s.bsp " , cl_download_mapsrc . string , base ) ;
2005-06-04 04:20:20 +00:00
}
2010-03-25 22:56:11 +00:00
if ( ! CL_EnqueDownload ( filename , localname , flags ) )
return true ; /*don't stall waiting for it if it failed*/
2008-11-09 22:29:28 +00:00
if ( ! ( flags & DLLF_IGNOREFAILED ) )
{
downloadlist_t * dl ;
for ( dl = cl . faileddownloads ; dl ; dl = dl - > next )
{
2009-05-24 10:11:17 +00:00
if ( ! strcmp ( dl - > rname , filename ) )
2008-11-09 22:29:28 +00:00
{
//if its on the failed list, don't block waiting for it to download
return true ;
}
}
}
2006-01-04 00:44:34 +00:00
return false ;
2004-08-23 00:15:46 +00:00
}
2008-11-09 22:29:28 +00:00
static qboolean CL_CheckMD2Skins ( qbyte * precache_model )
2004-08-23 00:15:46 +00:00
{
2008-11-09 22:29:28 +00:00
qboolean ret = false ;
2004-08-23 00:15:46 +00:00
md2_t * pheader ;
2008-11-09 22:29:28 +00:00
int skin = 1 ;
2005-03-18 06:14:07 +00:00
char * str ;
2004-08-23 00:15:46 +00:00
pheader = ( md2_t * ) precache_model ;
2008-11-09 22:29:28 +00:00
if ( LittleLong ( pheader - > version ) ! = MD2ALIAS_VERSION )
{
//bad version.
2004-08-23 00:15:46 +00:00
return false ;
}
pheader = ( md2_t * ) precache_model ;
2008-11-09 22:29:28 +00:00
for ( skin = 0 ; skin < LittleLong ( pheader - > num_skins ) ; skin + + )
2005-03-18 06:14:07 +00:00
{
str = ( char * ) precache_model +
2005-09-26 03:40:09 +00:00
LittleLong ( pheader - > ofs_skins ) +
2008-11-09 22:29:28 +00:00
skin * MD2MAX_SKINNAME ;
2005-03-18 06:14:07 +00:00
COM_CleanUpPath ( str ) ;
2008-11-09 22:29:28 +00:00
if ( ! CL_CheckOrEnqueDownloadFile ( str , str , 0 ) )
ret = true ;
2004-08-23 00:15:46 +00:00
}
2008-11-09 22:29:28 +00:00
return ret ;
}
qboolean CL_CheckHLBspWads ( char * file )
{
lump_t lump ;
dheader_t * dh ;
char * s ;
char * w ;
char key [ 256 ] ;
char wads [ 4096 ] ;
dh = ( dheader_t * ) file ;
lump . fileofs = LittleLong ( dh - > lumps [ LUMP_ENTITIES ] . fileofs ) ;
lump . filelen = LittleLong ( dh - > lumps [ LUMP_ENTITIES ] . filelen ) ;
2010-12-23 08:53:23 +00:00
2008-11-09 22:29:28 +00:00
s = file + lump . fileofs ;
2005-09-26 03:40:09 +00:00
2008-11-09 22:29:28 +00:00
s = COM_Parse ( s ) ;
if ( strcmp ( com_token , " { " ) )
return false ;
while ( * s )
{
s = COM_ParseOut ( s , key , sizeof ( key ) ) ;
if ( ! strcmp ( key , " } " ) )
break ;
s = COM_ParseOut ( s , wads , sizeof ( wads ) ) ;
if ( ! strcmp ( key , " wad " ) )
{
s = wads ;
2011-05-30 13:36:44 +00:00
while ( ( s = COM_ParseToken ( s , " ; " ) ) )
2008-11-09 22:29:28 +00:00
{
if ( ! strcmp ( com_token , " ; " ) )
continue ;
2011-05-30 13:36:44 +00:00
while ( ( w = strchr ( com_token , ' \\ ' ) ) )
2008-11-09 22:29:28 +00:00
* w = ' / ' ;
w = COM_SkipPath ( com_token ) ;
Con_Printf ( " wads: %s \n " , w ) ;
if ( ! CL_CheckFile ( w ) )
CL_CheckOrEnqueDownloadFile ( va ( " textures/%s " , w ) , NULL , DLLF_REQUIRED ) ;
}
return false ;
}
}
2004-08-23 00:15:46 +00:00
return false ;
}
2006-06-04 16:02:03 +00:00
2008-11-09 22:29:28 +00:00
qboolean CL_CheckQ2BspWals ( char * file )
{
qboolean gotone = false ;
q2dheader_t * dh ;
lump_t lump ;
q2texinfo_t * tinf ;
unsigned int i , j , count ;
dh = ( q2dheader_t * ) file ;
2015-03-03 00:14:43 +00:00
if ( LittleLong ( dh - > version ) ! = BSPVERSION_Q2 )
2008-11-09 22:29:28 +00:00
{
//quake3? unknown?
return false ;
}
lump . fileofs = LittleLong ( dh - > lumps [ Q2LUMP_TEXINFO ] . fileofs ) ;
lump . filelen = LittleLong ( dh - > lumps [ Q2LUMP_TEXINFO ] . filelen ) ;
count = lump . filelen / sizeof ( * tinf ) ;
if ( lump . filelen ! = count * sizeof ( * tinf ) )
return false ;
tinf = ( q2texinfo_t * ) ( file + lump . fileofs ) ;
for ( i = 0 ; i < count ; i + + )
{
//ignore duplicate files (to save filesystem hits)
for ( j = 0 ; j < i ; j + + )
if ( ! strcmp ( tinf [ i ] . texture , tinf [ j ] . texture ) )
break ;
if ( i = = j )
2012-02-15 13:53:30 +00:00
{
if ( ! CL_CheckDLFile ( va ( " textures/%s.wal " , tinf [ i ] . texture ) ) )
if ( ! CL_CheckDLFile ( va ( " textures/%s.tga " , tinf [ i ] . texture ) ) )
if ( ! CL_CheckOrEnqueDownloadFile ( tinf [ i ] . texture , NULL , 0 ) )
gotone = true ;
}
2008-11-09 22:29:28 +00:00
}
return gotone ;
}
2008-11-14 16:43:28 +00:00
static qboolean CL_CheckModelResources ( char * name )
2008-11-09 22:29:28 +00:00
{
//returns true if we triggered a download
qboolean ret ;
qbyte * file ;
if ( ! ( strstr ( name , " .md2 " ) | | strstr ( name , " .bsp " ) ) )
return false ;
// checking for skins in the model
2009-05-24 10:11:17 +00:00
2011-05-19 13:34:07 +00:00
FS_LoadFile ( name , ( void * * ) & file ) ;
2008-11-09 22:29:28 +00:00
if ( ! file )
{
return false ; // couldn't load it
}
if ( LittleLong ( * ( unsigned * ) file ) = = MD2IDALIASHEADER )
ret = CL_CheckMD2Skins ( file ) ;
else if ( LittleLong ( * ( unsigned * ) file ) = = BSPVERSIONHL )
ret = CL_CheckHLBspWads ( file ) ;
else if ( LittleLong ( * ( unsigned * ) file ) = = IDBSPHEADER )
ret = CL_CheckQ2BspWals ( file ) ;
else
ret = false ;
2009-05-24 10:11:17 +00:00
FS_FreeFile ( file ) ;
2008-11-09 22:29:28 +00:00
return ret ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = =
Model_NextDownload
= = = = = = = = = = = = = = = = =
*/
2009-04-06 00:34:32 +00:00
void Model_CheckDownloads ( void )
2004-08-23 00:15:46 +00:00
{
char * s ;
int i ;
2014-10-05 20:04:11 +00:00
char ext [ 8 ] ;
2004-08-23 00:15:46 +00:00
2009-03-03 01:52:30 +00:00
// Con_TPrintf (TLC_CHECKINGMODELS);
2006-01-04 00:44:34 +00:00
2010-07-11 02:22:39 +00:00
R_SetSky ( cl . skyname ) ;
2004-08-23 00:15:46 +00:00
# ifdef Q2CLIENT
2005-05-26 12:55:34 +00:00
if ( cls . protocol = = CP_QUAKE2 )
2004-08-23 00:15:46 +00:00
{
for ( i = 0 ; i < Q2MAX_IMAGES ; i + + )
{
char picname [ 256 ] ;
2015-03-03 00:14:43 +00:00
if ( ! cl . image_name [ i ] | | ! * cl . image_name [ i ] )
2004-08-23 00:15:46 +00:00
continue ;
2011-07-22 15:11:35 +00:00
Q_snprintfz ( picname , sizeof ( picname ) , " pics/%s.pcx " , cl . image_name [ i ] ) ;
2008-11-09 22:29:28 +00:00
CL_CheckOrEnqueDownloadFile ( picname , picname , 0 ) ;
2004-08-23 00:15:46 +00:00
}
if ( ! CLQ2_RegisterTEntModels ( ) )
return ;
}
# endif
2004-11-17 17:58:22 +00:00
2006-03-26 17:08:19 +00:00
for ( i = 1 ; cl . model_name [ i ] [ 0 ] ; i + + )
2004-08-23 00:15:46 +00:00
{
2006-01-04 00:44:34 +00:00
s = cl . model_name [ i ] ;
2004-08-23 00:15:46 +00:00
if ( s [ 0 ] = = ' * ' )
continue ; // inline brush model
2014-10-05 20:04:11 +00:00
if ( ! stricmp ( COM_FileExtension ( s , ext , sizeof ( ext ) ) , " dsp " ) ) //doom sprites are weird, and not really downloadable via this system
2004-08-23 00:15:46 +00:00
continue ;
2004-11-17 17:58:22 +00:00
2005-01-27 22:20:16 +00:00
# ifdef Q2CLIENT
2005-05-26 12:55:34 +00:00
if ( cls . protocol = = CP_QUAKE2 & & s [ 0 ] = = ' # ' ) //this is a vweap
2005-01-07 02:41:46 +00:00
continue ;
2005-01-27 22:20:16 +00:00
# endif
2005-01-07 02:41:46 +00:00
2008-11-09 22:29:28 +00:00
CL_CheckOrEnqueDownloadFile ( s , s , ( i = = 1 ) ? DLLF_REQUIRED : 0 ) ; //world is required to be loaded.
CL_CheckModelResources ( s ) ;
2004-08-23 00:15:46 +00:00
}
2009-07-06 01:20:20 +00:00
for ( i = 0 ; i < MAX_VWEP_MODELS ; i + + )
{
s = cl . model_name_vwep [ i ] ;
2014-10-05 20:04:11 +00:00
if ( ! stricmp ( COM_FileExtension ( s , ext , sizeof ( ext ) ) , " dsp " ) ) //doom sprites are weird, and not really downloadable via this system
2009-07-06 01:20:20 +00:00
continue ;
2010-03-25 22:56:11 +00:00
if ( ! * s )
continue ;
2009-07-06 01:20:20 +00:00
CL_CheckOrEnqueDownloadFile ( s , s , 0 ) ;
CL_CheckModelResources ( s ) ;
}
2006-01-04 00:44:34 +00:00
}
2009-04-06 00:34:32 +00:00
int CL_LoadModels ( int stage , qboolean dontactuallyload )
2006-01-04 00:44:34 +00:00
{
int i ;
2014-10-05 20:04:11 +00:00
float giveuptime = Sys_DoubleTime ( ) + 1 ; //small things get padded into a single frame
2006-01-11 22:24:08 +00:00
2009-04-06 00:34:32 +00:00
# define atstage() ((cl.contentstage == stage++ && !dontactuallyload)?++cl.contentstage:false)
2010-07-11 02:22:39 +00:00
# define endstage() if (!cls.timedemo && giveuptime<Sys_DoubleTime()) return -1;
2006-01-04 00:44:34 +00:00
2006-02-27 00:42:25 +00:00
pmove . numphysent = 0 ;
2013-03-12 23:24:15 +00:00
/*#ifdef PEXT_CSQC
2007-06-20 00:02:54 +00:00
if ( atstage ( ) )
{
2010-07-11 02:22:39 +00:00
extern cvar_t cl_nocsqc ;
if ( cls . protocol = = CP_NETQUAKE & & ! cl_nocsqc . ival & & ! cls . demoplayback )
2007-06-20 00:02:54 +00:00
{
char * s ;
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " csprogs " ) ;
2007-06-20 00:02:54 +00:00
s = Info_ValueForKey ( cl . serverinfo , " *csprogs " ) ;
2010-07-11 02:22:39 +00:00
if ( * s ) //only allow csqc if the server says so, and the 'checksum' matches.
2007-06-20 00:02:54 +00:00
{
2011-10-27 15:46:36 +00:00
extern cvar_t cl_download_csprogs ;
2007-06-20 00:02:54 +00:00
unsigned int chksum = strtoul ( s , NULL , 0 ) ;
2011-10-27 15:46:36 +00:00
if ( cl_download_csprogs . ival )
2007-06-20 00:02:54 +00:00
{
char * str = va ( " csprogsvers/%x.dat " , chksum ) ;
2008-11-09 22:29:28 +00:00
if ( CL_CheckOrEnqueDownloadFile ( " csprogs.dat " , str , DLLF_REQUIRED ) )
return stage ; //its kinda required
2007-06-20 00:02:54 +00:00
}
else
{
Con_Printf ( " Not downloading csprogs.dat due to allow_download_csprogs \n " ) ;
}
}
}
endstage ( ) ;
}
2013-03-12 23:24:15 +00:00
# endif* /
2007-06-20 00:02:54 +00:00
2009-04-01 22:03:56 +00:00
# ifdef HLCLIENT
if ( atstage ( ) )
{
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " hlclient " ) ;
2009-04-01 22:03:56 +00:00
CLHL_LoadClientGame ( ) ;
endstage ( ) ;
}
# endif
2006-01-13 06:27:18 +00:00
# ifdef PEXT_CSQC
2006-01-04 00:44:34 +00:00
if ( atstage ( ) )
{
2008-11-09 22:29:28 +00:00
char * s ;
2009-11-04 21:16:50 +00:00
qboolean anycsqc ;
2012-10-13 00:56:31 +00:00
char * endptr ;
unsigned int chksum ;
2011-10-27 15:46:36 +00:00
# ifdef _DEBUG
2009-11-04 21:16:50 +00:00
anycsqc = true ;
# else
anycsqc = atoi ( Info_ValueForKey ( cl . serverinfo , " anycsqc " ) ) ;
2008-11-09 22:29:28 +00:00
# endif
2012-10-13 00:56:31 +00:00
if ( cls . demoplayback )
anycsqc = true ;
2009-11-04 21:16:50 +00:00
s = Info_ValueForKey ( cl . serverinfo , " *csprogs " ) ;
2012-10-13 00:56:31 +00:00
chksum = strtoul ( s , & endptr , 0 ) ;
if ( * endptr )
2006-01-04 00:44:34 +00:00
{
2012-10-13 00:56:31 +00:00
Con_Printf ( " corrupt *csprogs key in serverinfo \n " ) ;
anycsqc = true ;
chksum = 0 ;
}
SCR_SetLoadingFile ( " csprogs " ) ;
if ( ! CSQC_Init ( anycsqc , * s ? true : false , chksum ) )
{
Sbar_Start ( ) ; //try and start this before we're actually on the server,
//this'll stop the mod from sending so much stuffed data at us, whilst we're frozen while trying to load.
//hopefully this'll make it more robust.
//csqc is expected to use it's own huds, or to run on decent servers. :p
2006-01-04 00:44:34 +00:00
}
2006-01-11 22:24:08 +00:00
endstage ( ) ;
2006-01-04 00:44:34 +00:00
}
2006-01-13 06:27:18 +00:00
# endif
2006-01-04 00:44:34 +00:00
2008-01-19 05:59:00 +00:00
if ( atstage ( ) )
{
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " prenewmap " ) ;
2014-10-05 20:04:11 +00:00
Surf_PreNewMap ( ) ;
2008-01-19 05:59:00 +00:00
endstage ( ) ;
}
2013-06-23 02:17:02 +00:00
if ( cl . playerview [ 0 ] . playernum = = - 1 )
2004-08-23 00:15:46 +00:00
{ //q2 cinematic - don't load the models.
2014-03-30 08:55:06 +00:00
cl . worldmodel = cl . model_precache [ 1 ] = Mod_ForName ( " " , MLV_WARN ) ;
2004-08-23 00:15:46 +00:00
}
2006-01-04 00:44:34 +00:00
else
2004-08-23 00:15:46 +00:00
{
2014-09-17 03:04:08 +00:00
for ( i = 1 ; i < MAX_PRECACHE_MODELS ; i + + )
2004-08-23 00:15:46 +00:00
{
if ( ! cl . model_name [ i ] [ 0 ] )
2006-01-04 00:44:34 +00:00
continue ;
2005-02-28 07:16:19 +00:00
2006-01-04 00:44:34 +00:00
if ( atstage ( ) )
{
2014-10-05 20:04:11 +00:00
#if 0
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( cl . model_name [ i ] ) ;
2008-11-09 22:29:28 +00:00
# ifdef CSQC_DAT
if ( i = = 1 )
CSQC_LoadResource ( cl . model_name [ i ] , " map " ) ;
else
CSQC_LoadResource ( cl . model_name [ i ] , " model " ) ;
# endif
2014-10-05 20:04:11 +00:00
# endif
2009-04-01 22:03:56 +00:00
# ifdef Q2CLIENT
if ( cls . protocol = = CP_QUAKE2 & & * cl . model_name [ i ] = = ' # ' )
cl . model_precache [ i ] = NULL ;
else
# endif
2014-10-05 20:04:11 +00:00
cl . model_precache [ i ] = Mod_ForName ( Mod_FixName ( cl . model_name [ i ] , cl . model_name [ 1 ] ) , MLV_WARN ) ;
2004-08-23 00:15:46 +00:00
2006-01-04 00:44:34 +00:00
S_ExtraUpdate ( ) ;
2004-08-23 00:15:46 +00:00
2006-01-11 22:24:08 +00:00
endstage ( ) ;
2006-01-04 00:44:34 +00:00
}
2004-08-23 00:15:46 +00:00
}
2009-07-06 01:20:20 +00:00
for ( i = 0 ; i < MAX_VWEP_MODELS ; i + + )
{
if ( ! cl . model_name_vwep [ i ] [ 0 ] )
continue ;
if ( atstage ( ) )
{
2014-10-05 20:04:11 +00:00
#if 0
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( cl . model_name_vwep [ i ] ) ;
2009-07-09 22:12:29 +00:00
# ifdef CSQC_DAT
CSQC_LoadResource ( cl . model_name_vwep [ i ] , " vwep " ) ;
2014-10-05 20:04:11 +00:00
# endif
2009-07-09 22:12:29 +00:00
# endif
2014-03-30 08:55:06 +00:00
cl . model_precache_vwep [ i ] = Mod_ForName ( cl . model_name_vwep [ i ] , MLV_WARN ) ;
2009-07-06 01:20:20 +00:00
endstage ( ) ;
}
}
2006-01-04 00:44:34 +00:00
}
2004-08-23 00:15:46 +00:00
2008-05-25 22:23:43 +00:00
if ( atstage ( ) )
{
cl . worldmodel = cl . model_precache [ 1 ] ;
if ( ! cl . worldmodel | | cl . worldmodel - > type = = mod_dummy )
2008-11-09 22:29:28 +00:00
{
if ( ! cl . model_name [ 1 ] [ 0 ] )
Host_EndGame ( " Worldmodel name wasn't sent \n " ) ;
2009-03-03 01:52:30 +00:00
// else
// return stage;
// Host_EndGame("Worldmodel wasn't loaded\n");
2008-11-09 22:29:28 +00:00
}
2008-05-25 22:23:43 +00:00
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " csprogs world " ) ;
2008-06-08 20:46:58 +00:00
# ifdef CSQC_DAT
2008-05-25 22:23:43 +00:00
CSQC_WorldLoaded ( ) ;
2008-06-08 20:46:58 +00:00
# endif
2008-05-25 22:23:43 +00:00
endstage ( ) ;
}
2013-03-12 22:44:00 +00:00
for ( i = 1 ; i < MAX_CSMODELS ; i + + )
2006-01-11 22:24:08 +00:00
{
if ( ! cl . model_csqcname [ i ] [ 0 ] )
continue ;
if ( atstage ( ) )
{
2014-10-05 20:04:11 +00:00
#if 0
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( cl . model_csqcname [ i ] ) ;
2008-11-09 22:29:28 +00:00
# ifdef CSQC_DAT
if ( i = = 1 )
CSQC_LoadResource ( cl . model_csqcname [ i ] , " map " ) ;
else
CSQC_LoadResource ( cl . model_csqcname [ i ] , " model " ) ;
2014-10-05 20:04:11 +00:00
# endif
2008-11-09 22:29:28 +00:00
# endif
2014-03-30 08:55:06 +00:00
cl . model_csqcprecache [ i ] = Mod_ForName ( cl . model_csqcname [ i ] , MLV_WARN ) ;
2006-01-11 22:24:08 +00:00
S_ExtraUpdate ( ) ;
endstage ( ) ;
}
}
2006-01-04 00:44:34 +00:00
if ( atstage ( ) )
{
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " wads " ) ;
2015-01-07 13:34:05 +00:00
if ( cl . worldmodel & & cl . worldmodel - > loadstate = = MLS_LOADING )
2015-01-08 13:09:20 +00:00
return - 1 ;
if ( cl . worldmodel & & cl . worldmodel - > loadstate = = MLS_LOADING )
COM_WorkerPartialSync ( cl . worldmodel , & cl . worldmodel - > loadstate , MLS_LOADING ) ;
2015-01-07 13:34:05 +00:00
Mod_ParseInfoFromEntityLump ( cl . worldmodel ) ;
2006-01-04 00:44:34 +00:00
Wad_NextDownload ( ) ;
2006-01-11 22:24:08 +00:00
endstage ( ) ;
2006-01-04 00:44:34 +00:00
}
2004-08-23 00:15:46 +00:00
2006-01-04 00:44:34 +00:00
if ( atstage ( ) )
{
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " external textures " ) ;
2014-10-05 20:04:11 +00:00
if ( cl . worldmodel & & cl . worldmodel - > loadstate = = MLS_LOADING )
COM_WorkerPartialSync ( cl . worldmodel , & cl . worldmodel - > loadstate , MLS_LOADING ) ;
if ( cl . worldmodel & & cl . worldmodel - > loadstate = = MLS_LOADED )
Mod_NowLoadExternal ( cl . worldmodel ) ;
2006-01-04 00:44:34 +00:00
2006-01-11 22:24:08 +00:00
endstage ( ) ;
2004-08-23 00:15:46 +00:00
}
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
// all done
2006-01-04 00:44:34 +00:00
if ( atstage ( ) )
2004-08-23 00:15:46 +00:00
{
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " newmap " ) ;
2014-10-05 20:04:11 +00:00
// if (!cl.worldmodel || cl.worldmodel->type == mod_dummy)
2009-03-03 01:52:30 +00:00
// Host_EndGame("No worldmodel was loaded\n");
cl . model_precaches_added = false ;
2014-10-05 20:04:11 +00:00
Surf_NewMap ( ) ;
2006-01-04 00:44:34 +00:00
2006-01-28 19:04:13 +00:00
pmove . physents [ 0 ] . model = cl . worldmodel ;
2006-01-11 22:24:08 +00:00
endstage ( ) ;
2004-08-23 00:15:46 +00:00
}
2006-01-04 00:44:34 +00:00
2011-09-05 01:48:23 +00:00
# ifdef CSQC_DAT
2011-09-03 03:49:43 +00:00
if ( atstage ( ) )
{
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " csqc init " ) ;
2011-09-03 03:49:43 +00:00
if ( CSQC_Inited ( ) )
{
------------------------------------------------------------------------
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 ( cls . fteprotocolextensions & PEXT_CSQC )
CL_SendClientCommand ( true , " enablecsqc " ) ;
2011-09-03 03:49:43 +00:00
}
else
{
2011-12-05 15:23:40 +00:00
if ( cls . fteprotocolextensions & PEXT_CSQC )
CL_SendClientCommand ( true , " disablecsqc " ) ;
2011-09-03 03:49:43 +00:00
}
endstage ( ) ;
}
2011-09-05 01:48:23 +00:00
# endif
2011-09-03 03:49:43 +00:00
2006-01-04 00:44:34 +00:00
return stage ;
2004-08-23 00:15:46 +00:00
}
2009-04-06 00:34:32 +00:00
int CL_LoadSounds ( int stage , qboolean dontactuallyload )
2008-11-09 22:29:28 +00:00
{
int i ;
float giveuptime = Sys_DoubleTime ( ) + 0.1 ; //small things get padded into a single frame
2009-04-06 00:34:32 +00:00
//#define atstage() ((cl.contentstage == stage++)?++cl.contentstage:false)
//#define endstage() if (giveuptime<Sys_DoubleTime()) return -1;
2008-11-09 22:29:28 +00:00
2014-09-17 03:04:08 +00:00
for ( i = 1 ; i < MAX_PRECACHE_SOUNDS ; i + + )
2008-11-09 22:29:28 +00:00
{
if ( ! cl . sound_name [ i ] [ 0 ] )
break ;
if ( atstage ( ) )
{
2014-10-05 20:04:11 +00:00
#if 0
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( cl . sound_name [ i ] ) ;
2008-11-09 22:29:28 +00:00
# ifdef CSQC_DAT
CSQC_LoadResource ( cl . sound_name [ i ] , " sound " ) ;
2014-10-05 20:04:11 +00:00
# endif
2008-11-09 22:29:28 +00:00
# endif
cl . sound_precache [ i ] = S_PrecacheSound ( cl . sound_name [ i ] ) ;
S_ExtraUpdate ( ) ;
endstage ( ) ;
}
}
return stage ;
}
2014-03-30 08:55:06 +00:00
void Sound_CheckDownload ( const char * s )
2011-04-20 21:32:43 +00:00
{
char mangled [ 512 ] ;
if ( * s = = ' * ' ) //q2 sexed sound
return ;
if ( ! S_HaveOutput ( ) )
return ;
//check without the sound/ prefix
if ( CL_CheckFile ( s ) )
return ; //we have it already
//the things I do for nexuiz... *sigh*
COM_StripExtension ( s , mangled , sizeof ( mangled ) ) ;
COM_DefaultExtension ( mangled , " .ogg " , sizeof ( mangled ) ) ;
if ( CL_CheckFile ( mangled ) )
return ;
//check with the sound/ prefix
s = va ( " sound/%s " , s ) ;
if ( CL_CheckFile ( s ) )
return ; //we have it already
//the things I do for nexuiz... *sigh*
COM_StripExtension ( s , mangled , sizeof ( mangled ) ) ;
COM_DefaultExtension ( mangled , " .ogg " , sizeof ( mangled ) ) ;
if ( CL_CheckFile ( mangled ) )
return ;
//download the one the server said.
CL_CheckOrEnqueDownloadFile ( s , NULL , 0 ) ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = =
Sound_NextDownload
= = = = = = = = = = = = = = = = =
*/
2009-04-06 00:34:32 +00:00
void Sound_CheckDownloads ( void )
2004-08-23 00:15:46 +00:00
{
int i ;
2005-08-11 04:14:33 +00:00
2009-03-03 01:52:30 +00:00
// Con_TPrintf (TLC_CHECKINGSOUNDS);
2004-08-23 00:15:46 +00:00
2005-08-11 04:14:33 +00:00
# ifdef CSQC_DAT
2009-05-24 10:11:17 +00:00
// if (cls.fteprotocolextensions & PEXT_CSQC)
2005-08-11 04:14:33 +00:00
{
2012-10-13 00:56:31 +00:00
char * s ;
2005-08-11 04:14:33 +00:00
s = Info_ValueForKey ( cl . serverinfo , " *csprogs " ) ;
2009-05-24 10:11:17 +00:00
if ( * s ) //only allow csqc if the server says so, and the 'checksum' matches.
2005-08-11 04:14:33 +00:00
{
2011-10-27 15:46:36 +00:00
extern cvar_t cl_download_csprogs , cl_nocsqc ;
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
char * endptr ;
unsigned int chksum = strtoul ( s , & endptr , 0 ) ;
if ( cl_nocsqc . ival | | cls . demoplayback | | * endptr )
2010-07-11 02:22:39 +00:00
{
}
2011-10-27 15:46:36 +00:00
else if ( cl_download_csprogs . ival )
2006-01-04 00:44:34 +00:00
{
char * str = va ( " csprogsvers/%x.dat " , chksum ) ;
2008-11-09 22:29:28 +00:00
CL_CheckOrEnqueDownloadFile ( " csprogs.dat " , str , DLLF_REQUIRED ) ;
2006-01-04 00:44:34 +00:00
}
2005-10-01 03:09:17 +00:00
else
2006-01-04 00:44:34 +00:00
{
Con_Printf ( " Not downloading csprogs.dat \n " ) ;
}
2005-08-11 04:14:33 +00:00
}
}
# endif
2006-01-04 00:44:34 +00:00
for ( i = 1 ; cl . sound_name [ i ] [ 0 ]
; i + + )
2004-08-23 00:15:46 +00:00
{
2011-04-20 21:32:43 +00:00
Sound_CheckDownload ( cl . sound_name [ i ] ) ;
2004-08-23 00:15:46 +00:00
}
}
/*
= = = = = = = = = = = = = = = = = = = = = =
CL_RequestNextDownload
= = = = = = = = = = = = = = = = = = = = = =
*/
void CL_RequestNextDownload ( void )
{
2010-12-23 08:53:23 +00:00
2008-11-09 22:29:28 +00:00
int stage ;
2011-10-27 15:46:36 +00:00
/*already downloading*/
2014-06-12 23:08:42 +00:00
if ( cls . download & & ! cls . demoplayback )
2006-01-04 00:44:34 +00:00
return ;
2011-10-27 15:46:36 +00:00
/*request downloads only if we're at the point where we've received a complete list of them*/
2006-01-04 00:44:34 +00:00
if ( cl . sendprespawn | | cls . state = = ca_active )
if ( cl . downloadlist )
{
2008-11-09 22:29:28 +00:00
downloadlist_t * dl ;
2010-08-28 17:14:38 +00:00
unsigned int fl ;
2009-04-06 00:34:32 +00:00
//download required downloads first
2008-11-09 22:29:28 +00:00
for ( dl = cl . downloadlist ; dl ; dl = dl - > next )
{
2011-10-27 15:46:36 +00:00
if ( dl - > flags & DLLF_NONGAME )
2008-11-09 22:29:28 +00:00
break ;
}
if ( ! dl )
2011-10-27 15:46:36 +00:00
{
for ( dl = cl . downloadlist ; dl ; dl = dl - > next )
{
if ( dl - > flags & DLLF_REQUIRED )
break ;
}
if ( ! dl )
dl = cl . downloadlist ;
}
2010-08-28 17:14:38 +00:00
fl = dl - > flags ;
2010-12-23 08:53:23 +00:00
2011-10-27 15:46:36 +00:00
/*if we don't require downloads don't queue requests until we're actually on the server, slightly more deterministic*/
2013-11-28 00:45:22 +00:00
if ( cls . state = = ca_active | | ( requiredownloads . value & & ! cls . demoplayback ) | | ( fl & DLLF_REQUIRED ) )
2006-01-04 00:44:34 +00:00
{
2011-10-27 15:46:36 +00:00
if ( ( fl & DLLF_OVERWRITE ) | | ! CL_CheckFile ( dl - > localname ) )
2010-11-02 23:17:25 +00:00
{
2012-11-29 13:37:48 +00:00
CL_SendDownloadStartRequest ( dl - > rname , dl - > localname , fl ) ;
2010-11-02 23:17:25 +00:00
return ;
}
2010-08-28 17:14:38 +00:00
else
{
Con_Printf ( " Already have %s \n " , dl - > localname ) ;
CL_DisenqueDownload ( dl - > rname ) ;
2008-11-09 22:29:28 +00:00
2010-08-28 17:14:38 +00:00
//recurse a bit.
CL_RequestNextDownload ( ) ;
return ;
}
2006-01-04 00:44:34 +00:00
}
}
if ( cl . sendprespawn )
{ // get next signon phase
2009-04-06 00:34:32 +00:00
extern int total_loading_size , current_loading_size ;
if ( ! cl . contentstage )
{
stage = 0 ;
stage = CL_LoadModels ( stage , true ) ;
stage = CL_LoadSounds ( stage , true ) ;
total_loading_size = stage ;
cl . contentstage = 0 ;
}
2008-11-09 22:29:28 +00:00
stage = 0 ;
2009-04-06 00:34:32 +00:00
stage = CL_LoadModels ( stage , false ) ;
current_loading_size = cl . contentstage ;
2008-11-09 22:29:28 +00:00
if ( stage < 0 )
2006-01-04 00:44:34 +00:00
return ; //not yet
2009-04-06 00:34:32 +00:00
stage = CL_LoadSounds ( stage , false ) ;
current_loading_size = cl . contentstage ;
2008-11-09 22:29:28 +00:00
if ( stage < 0 )
return ;
2014-10-05 20:04:11 +00:00
if ( requiredownloads . ival & & COM_HasWork ( ) )
{
SCR_SetLoadingFile ( " loading content " ) ;
return ;
}
2014-08-27 08:41:31 +00:00
SCR_SetLoadingFile ( " receiving game state " ) ;
2014-10-05 20:04:11 +00:00
2006-01-04 00:44:34 +00:00
cl . sendprespawn = false ;
2014-10-05 20:04:11 +00:00
if ( cl . worldmodel & & cl . worldmodel - > loadstate = = MLS_LOADING )
COM_WorkerPartialSync ( cl . worldmodel , & cl . worldmodel - > loadstate , MLS_LOADING ) ;
2011-10-27 15:46:36 +00:00
# ifdef warningmsg
# pragma warningmsg("timedemo timer should start here")
2008-01-09 00:52:31 +00:00
# endif
2006-01-04 00:44:34 +00:00
2014-10-05 20:04:11 +00:00
if ( ! cl . worldmodel | | cl . worldmodel - > loadstate ! = MLS_LOADED )
2009-04-06 00:34:32 +00:00
{
Con_Printf ( " \n \n ------------- \n Couldn't download %s - cannot fully connect \n " , cl . worldmodel - > name ) ;
SCR_SetLoadingStage ( LS_NONE ) ;
return ;
}
2006-01-04 00:44:34 +00:00
# ifdef Q2CLIENT
if ( cls . protocol = = CP_QUAKE2 )
{
Skin_NextDownload ( ) ;
2009-04-06 00:34:32 +00:00
SCR_SetLoadingStage ( LS_NONE ) ;
2006-01-06 23:58:32 +00:00
CL_SendClientCommand ( true , " begin %i \n " , cl . servercount ) ;
2006-01-04 00:44:34 +00:00
}
2005-01-16 02:25:35 +00:00
else
2006-01-04 00:44:34 +00:00
# endif
2005-01-16 02:25:35 +00:00
{
2008-01-09 00:52:31 +00:00
if ( cls . demoplayback = = DPB_EZTV )
{
if ( CL_RemoveClientCommands ( " qtvspawn " ) )
------------------------------------------------------------------------
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
Con_DPrintf ( " Multiple prespawns \n " ) ;
2009-11-04 21:16:50 +00:00
CL_SendClientCommand ( true , " qtvspawn %i 0 %i " , cl . servercount , COM_RemapMapChecksum ( LittleLong ( cl . worldmodel - > checksum2 ) ) ) ;
2009-04-06 00:34:32 +00:00
SCR_SetLoadingStage ( LS_NONE ) ;
2008-01-09 00:52:31 +00:00
}
else
{
2006-01-04 00:44:34 +00:00
// done with modellist, request first of static signon messages
2008-01-09 00:52:31 +00:00
if ( CL_RemoveClientCommands ( " prespawn " ) )
------------------------------------------------------------------------
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
Con_DPrintf ( " Multiple prespawns \n " ) ;
if ( cls . protocol = = CP_NETQUAKE )
CL_SendClientCommand ( true , " prespawn " ) ;
else
{
// CL_SendClientCommand("prespawn %i 0 %i", cl.servercount, cl.worldmodel->checksum2);
CL_SendClientCommand ( true , prespawn_name , cl . servercount , COM_RemapMapChecksum ( LittleLong ( cl . worldmodel - > checksum2 ) ) ) ;
}
2008-01-09 00:52:31 +00:00
}
2005-01-16 02:25:35 +00:00
}
2006-01-04 00:44:34 +00:00
2004-08-23 00:15:46 +00:00
}
}
2005-01-16 02:25:35 +00:00
int CL_RequestADownloadChunk ( void ) ;
void CL_SendDownloadReq ( sizebuf_t * msg )
2005-01-13 23:33:00 +00:00
{
2008-01-30 02:32:00 +00:00
if ( cls . demoplayback = = DPB_EZTV )
return ; //tcp connection, so no need to constantly ask
2014-06-12 23:08:42 +00:00
if ( ! cls . download )
2005-01-13 23:33:00 +00:00
{
2014-06-12 23:08:42 +00:00
if ( cl . downloadlist )
CL_RequestNextDownload ( ) ;
2005-01-13 23:33:00 +00:00
return ;
}
# ifdef PEXT_CHUNKEDDOWNLOADS
2014-06-12 23:08:42 +00:00
if ( cls . download - > method = = DL_QWCHUNKS )
DLC_Poll ( cls . download ) ;
2005-01-13 23:33:00 +00:00
# endif
}
2004-08-23 00:15:46 +00:00
# ifdef PEXT_ZLIBDL
# ifdef _WIN32
# define ZEXPORT VARGS
# include "../../zip/zlib.h"
2005-09-26 03:40:09 +00:00
//# pragma comment (lib, "zip/zlib.lib")
2004-08-23 00:15:46 +00:00
# else
# include <zlib.h>
# endif
char * ZLibDownloadDecode ( int * messagesize , char * input , int finalsize )
{
char * outbuf = Hunk_TempAlloc ( finalsize ) ;
z_stream zs ;
* messagesize = ( * ( short * ) input ) ;
input + = 2 ;
if ( ! * messagesize )
{
* messagesize = finalsize + 2 ;
return input ;
}
memset ( & zs , 0 , sizeof ( zs ) ) ;
zs . next_in = input ;
zs . avail_in = * messagesize ; //tell it that it has a lot. Possibly a bad idea.
zs . total_in = 0 ;
zs . next_out = outbuf ;
zs . avail_out = finalsize ; //this is the limiter.
zs . total_out = 0 ;
zs . data_type = Z_BINARY ;
inflateInit ( & zs ) ;
inflate ( & zs , Z_FINISH ) ; //decompress it in one go.
inflateEnd ( & zs ) ;
* messagesize = zs . total_in + 2 ;
return outbuf ;
}
# endif
2014-06-12 23:08:42 +00:00
downloadlist_t * CL_DownloadFailed ( const char * name , qdownload_t * qdl )
2005-01-16 02:25:35 +00:00
{
//add this to our failed list. (so we don't try downloading it again...)
2008-11-09 22:29:28 +00:00
downloadlist_t * failed , * * link , * dl ;
2005-01-16 02:25:35 +00:00
failed = Z_Malloc ( sizeof ( downloadlist_t ) ) ;
failed - > next = cl . faileddownloads ;
cl . faileddownloads = failed ;
2009-05-24 10:11:17 +00:00
Q_strncpyz ( failed - > rname , name , sizeof ( failed - > rname ) ) ;
2005-01-16 02:25:35 +00:00
2008-11-09 22:29:28 +00:00
//if this is what we're currently downloading, close it up now.
2012-11-29 13:37:48 +00:00
//don't do this if we're just marking the file as unavailable for download.
2014-06-12 23:08:42 +00:00
if ( qdl & & ( ! stricmp ( qdl - > remotename , name ) | | ! * name ) )
2008-11-09 22:29:28 +00:00
{
2014-06-12 23:08:42 +00:00
DL_Abort ( qdl , QDL_FAILED ) ;
2008-11-09 22:29:28 +00:00
}
link = & cl . downloadlist ;
while ( * link )
{
dl = * link ;
2009-05-24 10:11:17 +00:00
if ( ! strcmp ( dl - > rname , name ) )
2008-11-09 22:29:28 +00:00
{
* link = dl - > next ;
failed - > flags | = dl - > flags ;
Z_Free ( dl ) ;
}
else
link = & ( * link ) - > next ;
}
return failed ;
2005-01-16 02:25:35 +00:00
}
2005-01-13 16:29:20 +00:00
# ifdef PEXT_CHUNKEDDOWNLOADS
2005-01-16 02:25:35 +00:00
# define DLBLOCKSIZE 1024
2008-11-09 22:29:28 +00:00
int CL_DownloadRate ( void )
{
2014-06-12 23:08:42 +00:00
qdownload_t * dl = cls . download ;
if ( dl )
{
double curtime = Sys_DoubleTime ( ) ;
if ( ! dl - > ratetime )
{
dl - > ratetime = curtime ;
return dl - > completedbytes / ( Sys_DoubleTime ( ) - dl - > starttime ) ;
}
if ( curtime - dl - > ratetime > 1 )
{
dl - > rate = dl - > ratebytes / ( curtime - dl - > ratetime ) ;
dl - > ratetime = curtime ;
dl - > ratebytes = 0 ;
}
return dl - > rate ;
}
return 0 ;
}
# ifdef _MSC_VER
# define strtoull _strtoui64
# endif
//called when the server acks the download. opens the local file and stuff. returns false on failure
qboolean DL_Begun ( qdownload_t * dl )
{
//figure out where the file is meant to be going.
dl - > prefixbytes = 0 ;
if ( ! strncmp ( dl - > tempname , " package/ " , 8 ) )
{
dl - > prefixbytes = 8 ; //ignore the package/ part
dl - > fsroot = FS_ROOT ; //and put it in the root dir (-basedir), and hope the name includes a gamedir part
}
else if ( ! strncmp ( dl - > tempname , " skins/ " , 6 ) )
dl - > fsroot = FS_PUBBASEGAMEONLY ; //shared between gamedirs, so only use the basegame.
else
dl - > fsroot = FS_GAMEONLY ; //other files are relative to the active gamedir.
Q_snprintfz ( dl - > dclname , sizeof ( dl - > dclname ) , " %s.dcl " , dl - > tempname ) ;
if ( dl - > method = = DL_QWCHUNKS )
{
qboolean error = false ;
char partline [ 256 ] ;
char partterm [ 128 ] ;
char * p , t ;
qofs_t lastend = 0 ;
qofs_t start , end ;
struct dlblock_s * * link = & dl - > dlblocks ;
vfsfile_t * parts = FS_OpenVFS ( dl - > dclname + dl - > prefixbytes , " rb " , dl - > fsroot ) ;
if ( ! parts )
error = true ;
while ( ! error & & VFS_GETS ( parts , partline , sizeof ( partline ) ) )
{
p = COM_ParseOut ( partline , partterm , sizeof ( partterm ) ) ;
t = * partterm ;
p = COM_ParseOut ( p , partterm , sizeof ( partterm ) ) ;
start = strtoull ( partterm , NULL , 0 ) ;
p = COM_ParseOut ( p , partterm , sizeof ( partterm ) ) ;
end = strtoull ( partterm , NULL , 0 ) ;
( * link ) = Z_Malloc ( sizeof ( * * link ) ) ;
( * link ) - > start = start ;
( * link ) - > end = end ;
( * link ) - > state = ( t = = ' c ' ) ? DLB_RECEIVED : DLB_MISSING ;
link = & ( * link ) - > next ;
if ( t = = ' c ' )
dl - > completedbytes + = end - start ;
if ( start ! = lastend )
error = true ;
lastend = end ;
}
if ( lastend ! = dl - > size )
error = true ;
if ( parts )
VFS_CLOSE ( parts ) ;
if ( ! error )
dl - > file = FS_OpenVFS ( dl - > tempname + dl - > prefixbytes , " w+b " , dl - > fsroot ) ;
}
if ( ! dl - > file )
{
struct dlblock_s * b ;
//make sure we don't get confused if someone end-tasks us before the download is complete.
FS_Remove ( dl - > dclname + dl - > prefixbytes , dl - > fsroot ) ;
dl - > completedbytes = 0 ;
while ( dl - > dlblocks )
{
b = dl - > dlblocks ;
dl - > dlblocks = b - > next ;
Z_Free ( b ) ;
}
FS_CreatePath ( dl - > tempname + dl - > prefixbytes , dl - > fsroot ) ;
dl - > file = FS_OpenVFS ( dl - > tempname + dl - > prefixbytes , " wb " , dl - > fsroot ) ;
}
if ( ! dl - > file )
{
char native [ MAX_OSPATH ] ;
FS_NativePath ( dl - > tempname + dl - > prefixbytes , dl - > fsroot , native , sizeof ( native ) ) ;
Con_TPrintf ( " Unable to open \" %s \" \n " , native ) ;
return false ;
}
if ( dl - > method = = DL_QWPENDING )
Con_TPrintf ( " method is still 'pending' \n " ) ;
if ( dl - > method = = DL_QWCHUNKS & & ! dl - > dlblocks )
{
dl - > dlblocks = Z_Malloc ( sizeof ( * dl - > dlblocks ) ) ;
dl - > dlblocks - > start = 0 ;
dl - > dlblocks - > end = dl - > size ;
dl - > dlblocks - > state = DLB_MISSING ;
}
dl - > flags | = DLLF_BEGUN ;
dl - > starttime = Sys_DoubleTime ( ) ;
return true ;
}
void DL_Completed ( qdownload_t * dl , qofs_t start , qofs_t end )
{
struct dlblock_s * prev = NULL , * b , * n , * e ;
if ( end < = start )
return ; //ignore invalid ranges.
for ( b = dl - > dlblocks ; b ; )
{
if ( b - > state = = DLB_RECEIVED )
{
//nothing to be done. dupe. somehow. or simply a different range.
}
else if ( b - > start > = start & & b - > end < = end )
{
//whole block
// Con_Printf("Whole block\n");
b - > state = DLB_RECEIVED ;
dl - > completedbytes + = b - > end - b - > start ;
dl - > ratebytes + = b - > end - b - > start ;
}
else if ( start > b - > start & & end < b - > end )
{
// Con_Printf("chop out middle\n");
//in the middle, no need to merge
n = Z_Malloc ( sizeof ( * n ) ) ;
e = Z_Malloc ( sizeof ( * e ) ) ;
e - > next = b - > next ;
n - > next = e ;
b - > next = n ;
e - > state = b - > state ;
e - > sequence = b - > sequence ;
n - > state = DLB_RECEIVED ;
e - > end = b - > end ;
b - > end = start ;
n - > start = start ;
n - > end = end ;
e - > start = end ;
dl - > completedbytes + = n - > end - n - > start ;
dl - > ratebytes + = n - > end - n - > start ;
}
//data overlaps the start (data end must be smaller than block end)
else if ( start < = b - > start & & end > b - > start )
{
// Con_Printf("complete start\n");
//split it. new(non-complete) block is second.
n = Z_Malloc ( sizeof ( * n ) ) ;
n - > next = b - > next ;
b - > next = n ;
//second block keeps original block's state. first block gets completed
n - > state = b - > state ;
n - > sequence = b - > sequence ;
b - > state = DLB_RECEIVED ;
n - > start = end ;
n - > end = b - > end ;
b - > end = end ;
dl - > completedbytes + = b - > end - b - > start ;
dl - > ratebytes + = b - > end - b - > start ;
}
//new data overlaps the end
else if ( start > b - > start & & start < b - > end )
{
// Con_Printf("complete end\n");
//split it. new(completed) block is second.
n = Z_Malloc ( sizeof ( * n ) ) ;
n - > next = b - > next ;
b - > next = n ;
//second block keeps original block's state. first block gets completed
n - > state = DLB_RECEIVED ;
n - > sequence = 0 ;
n - > start = end ;
n - > end = b - > end ;
b - > end = end ;
dl - > completedbytes + = n - > end - n - > start ;
dl - > ratebytes + = n - > end - n - > start ;
prev = b ;
b = n ;
}
else
{ //don't bother merging, as nothing changed
prev = b ;
b = b - > next ;
continue ;
}
//merge with next block
if ( b - > next & & b - > next - > state = = DLB_RECEIVED )
{
n = b - > next ;
b - > next = n - > next ;
b - > end = n - > end ;
Z_Free ( n ) ;
}
//merge with previous block if possible
if ( prev & & prev - > state = = DLB_RECEIVED )
{
n = b ;
prev - > end = b - > end ;
prev - > next = b - > next ;
Z_Free ( b ) ;
b = prev - > next ;
continue ; //careful here
}
prev = b ;
b = b - > next ;
}
2008-11-09 22:29:28 +00:00
}
2013-03-31 04:21:08 +00:00
qboolean CL_AllowArbitaryDownload ( char * localfile ) ;
2014-06-12 23:08:42 +00:00
static float chunkrate ;
void CL_ParseChunkedDownload ( qdownload_t * dl )
2005-01-13 16:29:20 +00:00
{
2005-01-17 17:40:21 +00:00
qbyte * svname ;
2014-06-12 23:08:42 +00:00
int flag ;
qofs_t filesize ;
qofs_t chunknum ;
2005-01-16 02:25:35 +00:00
char data [ DLBLOCKSIZE ] ;
2005-01-13 16:29:20 +00:00
chunknum = MSG_ReadLong ( ) ;
2013-03-31 04:21:08 +00:00
if ( chunknum = = - 1 )
2005-01-13 16:29:20 +00:00
{
2014-06-12 23:08:42 +00:00
flag = MSG_ReadLong ( ) ;
if ( flag = = 0x80000000 )
{ //really big files need special handling here.
flag = MSG_ReadLong ( ) ;
filesize = qofs_Make ( flag , MSG_ReadLong ( ) ) ;
flag = 0 ;
}
else
filesize = flag ;
2005-01-17 17:40:21 +00:00
svname = MSG_ReadString ( ) ;
2005-01-13 16:29:20 +00:00
if ( cls . demoplayback )
return ;
2008-11-09 22:29:28 +00:00
if ( ! * svname )
{
//stupid mvdsv.
/*if (totalsize < 0)
svname = cls . downloadname ;
else */
{
Con_Printf ( " ignoring nameless download \n " ) ;
return ;
}
}
2014-06-12 23:08:42 +00:00
if ( flag < 0 )
2005-01-13 16:29:20 +00:00
{
2014-06-12 23:08:42 +00:00
if ( flag = = - 4 )
2013-03-31 04:21:08 +00:00
{
if ( CL_AllowArbitaryDownload ( svname ) )
{
2014-06-12 23:08:42 +00:00
Con_Printf ( " Download of \" %s \" redirected to \" %s \" \n " , dl - > remotename , svname ) ;
2013-03-31 04:21:08 +00:00
if ( CL_CheckOrEnqueDownloadFile ( svname , NULL , 0 ) )
Con_Printf ( " However, \" %s \" already exists. You may need to delete it. \n " , svname ) ;
}
2014-06-12 23:08:42 +00:00
svname = dl - > remotename ;
2013-03-31 04:21:08 +00:00
}
2014-06-12 23:08:42 +00:00
else if ( flag = = - 3 )
2008-11-09 22:29:28 +00:00
Con_Printf ( " Server reported an error when downloading file \" %s \" \n " , svname ) ;
2014-06-12 23:08:42 +00:00
else if ( flag = = - 2 )
2008-11-09 22:29:28 +00:00
Con_Printf ( " Server permissions deny downloading file \" %s \" \n " , svname ) ;
2005-01-13 16:29:20 +00:00
else
2008-11-09 22:29:28 +00:00
Con_Printf ( " Couldn't find file \" %s \" on the server \n " , svname ) ;
2005-01-13 16:29:20 +00:00
2014-06-12 23:08:42 +00:00
if ( dl )
{
CL_DownloadFailed ( svname , dl ) ;
2005-01-13 16:29:20 +00:00
2014-06-12 23:08:42 +00:00
CL_RequestNextDownload ( ) ;
}
2005-01-13 16:29:20 +00:00
return ;
}
2014-06-12 23:08:42 +00:00
if ( ! dl )
{
Con_Printf ( " ignoring download start. we're not meant to be downloading \n " ) ;
return ;
}
if ( dl - > method = = DL_QWCHUNKS )
2005-01-17 17:40:21 +00:00
Host_EndGame ( " Received second download - \" %s \" \n " , svname ) ;
2005-01-13 16:29:20 +00:00
2014-06-12 23:08:42 +00:00
if ( stricmp ( dl - > remotename , svname ) )
2013-03-31 04:21:08 +00:00
{
//fixme: we should allow extension changes, in the case of ogg/mp3/wav, or tga/png/jpg/pcx, or the addition of .gz or whatever
2014-06-12 23:08:42 +00:00
Host_EndGame ( " Server sent the wrong download - \" %s \" instead of \" %s \" \n " , svname , dl - > remotename ) ;
2013-03-31 04:21:08 +00:00
}
2006-01-04 00:44:34 +00:00
2005-12-13 02:31:57 +00:00
2005-01-13 16:29:20 +00:00
//start the new download
2014-06-12 23:08:42 +00:00
dl - > method = DL_QWCHUNKS ;
dl - > percent = 0 ;
dl - > size = filesize ;
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
dl - > starttime = Sys_DoubleTime ( ) ;
2005-01-13 16:29:20 +00:00
2006-01-10 18:48:03 +00:00
/*
2005-01-17 17:40:21 +00:00
strcpy ( cls . downloadname , svname ) ;
COM_StripExtension ( svname , cls . downloadtempname ) ;
2005-01-13 16:29:20 +00:00
COM_DefaultExtension ( cls . downloadtempname , " .tmp " ) ;
2006-01-10 18:48:03 +00:00
*/
2005-01-13 16:29:20 +00:00
2014-06-12 23:08:42 +00:00
if ( ! DL_Begun ( dl ) )
2005-12-13 02:31:57 +00:00
{
2014-06-12 23:08:42 +00:00
CL_DownloadFailed ( svname , dl ) ;
2005-12-13 02:31:57 +00:00
return ;
}
2005-01-13 16:29:20 +00:00
return ;
}
2005-01-17 17:40:21 +00:00
// Con_Printf("Received dl block %i: ", chunknum);
2005-01-16 02:25:35 +00:00
MSG_ReadData ( data , DLBLOCKSIZE ) ;
2014-06-12 23:08:42 +00:00
if ( ! dl )
{
Con_Printf ( " ignoring download data packet \n " ) ;
2013-03-31 04:21:08 +00:00
return ;
2014-06-12 23:08:42 +00:00
}
2013-03-31 04:21:08 +00:00
2014-06-12 23:08:42 +00:00
if ( chunknum * DLBLOCKSIZE > dl - > size + DLBLOCKSIZE )
return ;
if ( ! dl - > file )
2006-01-13 20:30:01 +00:00
return ;
2005-01-13 16:29:20 +00:00
if ( cls . demoplayback )
2005-01-16 02:25:35 +00:00
{ //err, yeah, when playing demos we don't actually pay any attention to this.
return ;
}
2011-10-27 15:46:36 +00:00
2014-06-12 23:08:42 +00:00
VFS_SEEK ( dl - > file , chunknum * DLBLOCKSIZE ) ;
if ( dl - > size - chunknum * DLBLOCKSIZE < DLBLOCKSIZE ) //final block is actually meant to be smaller than we recieve.
VFS_WRITE ( dl - > file , data , dl - > size - chunknum * DLBLOCKSIZE ) ;
else
VFS_WRITE ( dl - > file , data , DLBLOCKSIZE ) ;
2005-09-26 03:40:09 +00:00
2014-06-12 23:08:42 +00:00
DL_Completed ( dl , chunknum * DLBLOCKSIZE , ( chunknum + 1 ) * DLBLOCKSIZE ) ;
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
dl - > percent = dl - > completedbytes / ( float ) dl - > size * 100 ;
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
chunkrate + = 1 ;
2005-01-13 23:33:00 +00:00
}
2006-01-04 00:44:34 +00:00
int CL_CountQueuedDownloads ( void )
{
int count = 0 ;
downloadlist_t * dl ;
for ( dl = cl . downloadlist ; dl ; dl = dl - > next )
count + + ;
return count ;
}
2014-06-12 23:08:42 +00:00
static void DLC_RequestDownloadChunks ( qdownload_t * dl , float frametime )
2005-01-13 23:33:00 +00:00
{
2014-06-12 23:08:42 +00:00
char * cmd ;
qofs_t chunk ;
struct dlblock_s * b , * n ;
qboolean stillpending = false ;
qboolean haveloss = false ;
int chunks , chunksremaining ;
static float slop ; //try to keep things as integers
// int cmds = 20;
if ( frametime < 0 )
frametime = 0 ;
if ( frametime > 0.1 )
frametime = 0.1 ; //erg?
if ( chunkrate < 0 )
chunkrate = 0 ;
slop + = chunkrate * frametime ;
chunksremaining = slop ;
slop - = chunksremaining ;
if ( chunksremaining < 1 )
{
if ( chunkrate < 30 )
chunksremaining = 1 ;
else
return ;
/* if (!chunkrate)
chunkrate = 72 ;
else
chunkrate + = frametime ;
return ;
*/ }
if ( chunksremaining > 100 )
{ //we're going to need some sanity limit, for cpu resources.
chunkrate - = ( chunksremaining - 100 ) ;
chunksremaining = 100 ;
2005-01-16 02:25:35 +00:00
}
2014-06-12 23:08:42 +00:00
//Con_DPrintf("%i\n", chunksremaining);
for ( b = dl - > dlblocks ; b ; b = b - > next )
2005-01-16 02:25:35 +00:00
{
2014-06-12 23:08:42 +00:00
//packetloss reverts blocks to missing.
if ( b - > state = = DLB_PENDING )
2005-01-16 02:25:35 +00:00
{
2014-06-12 23:08:42 +00:00
if ( b - > sequence < cls . netchan . incoming_sequence - 10 )
{
haveloss = true ;
b - > state = DLB_MISSING ;
for ( ; ; ) //merge it with the next if they're all invalid
{
n = b - > next ;
if ( ! n )
break ;
if ( n - > state = = DLB_MISSING | | ( n - > state = = DLB_PENDING & & n - > sequence < cls . netchan . incoming_sequence - 10 ) )
{
b - > next = n - > next ;
b - > end = n - > end ;
Z_Free ( n ) ;
continue ;
}
break ;
}
}
else
stillpending = true ;
2005-01-16 02:25:35 +00:00
}
2014-06-12 23:08:42 +00:00
if ( b - > state = = DLB_MISSING & & chunksremaining )
{
chunk = b - > start / DLBLOCKSIZE ;
chunks = 1 ; //((b->end+DLBLOCKSIZE-1)/DLBLOCKSIZE) - (b->start / DLBLOCKSIZE);
if ( chunks > chunksremaining )
chunks = chunksremaining ;
//if this block is bigger than a chunk, split the two blocks.
if ( b - > end - b - > start > DLBLOCKSIZE * chunks )
{
n = Z_Malloc ( sizeof ( * n ) ) ;
n - > next = b - > next ;
n - > start = ( chunk + chunks ) * DLBLOCKSIZE ;
n - > end = b - > end ;
b - > end = n - > start ;
n - > state = DLB_MISSING ;
b - > next = n ;
}
b - > state = DLB_PENDING ;
b - > sequence = cls . netchan . outgoing_sequence ;
stillpending = true ;
if ( chunks > 1 )
cmd = va ( " nextdl %u %3g %i %i \n " , ( unsigned int ) chunk , dl - > percent , dl - > filesequence , chunks ) ;
else
cmd = va ( " nextdl %u %3g %i \n " , ( unsigned int ) chunk , dl - > percent , dl - > filesequence ) ;
CL_RemoveClientCommands ( cmd ) ;
CL_SendClientCommand ( false , " %s " , cmd ) ;
chunksremaining - = chunks ;
if ( chunksremaining < = 0 )
break ;
/*if (--cmds <= 0)
{
chunkrate - = chunksremaining ;
// haveloss = true;
break ;
} */
}
}
if ( haveloss )
{
chunkrate * = 0.98 ;
2005-01-16 02:25:35 +00:00
}
2014-06-12 23:08:42 +00:00
if ( ! stillpending )
{ //when there's nothing still pending, the download is complete.
Con_DPrintf ( " Download took %i seconds (%i more) \n " , ( int ) ( Sys_DoubleTime ( ) - dl - > starttime ) , CL_CountQueuedDownloads ( ) ) ;
CL_DownloadFinished ( dl ) ;
}
}
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
void DLC_Poll ( qdownload_t * dl )
{
static float lasttime ;
DLC_RequestDownloadChunks ( dl , realtime - lasttime ) ;
lasttime = realtime ;
}
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
# endif
2008-11-09 22:29:28 +00:00
2014-06-12 23:08:42 +00:00
void DL_Abort ( qdownload_t * dl , enum qdlabort aborttype )
{
struct dlblock_s * b , * n ;
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
if ( dl - > file )
{
VFS_CLOSE ( dl - > file ) ;
dl - > file = NULL ;
}
2005-01-17 17:40:21 +00:00
2014-06-12 23:08:42 +00:00
if ( dl - > flags & DLLF_BEGUN )
{
if ( aborttype = = QDL_COMPLETED )
{
//this file isn't needed now the download has finished.
FS_Remove ( dl - > dclname + dl - > prefixbytes , dl - > fsroot ) ;
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
if ( dl - > flags & DLLF_TEMPORARY )
{
2014-06-16 21:13:50 +00:00
# ifdef TERRAIN
2014-06-12 23:08:42 +00:00
if ( ! Terr_DownloadedSection ( dl - > tempname + dl - > prefixbytes ) )
2014-06-16 21:13:50 +00:00
# endif
2014-06-12 23:08:42 +00:00
Con_Printf ( " Downloaded unusable temporary file \n " ) ;
FS_Remove ( dl - > tempname + dl - > prefixbytes , dl - > fsroot ) ;
}
else if ( Q_strcasecmp ( dl - > tempname , dl - > localname ) )
{
if ( dl - > flags & DLLF_OVERWRITE )
FS_Remove ( dl - > localname + dl - > prefixbytes , dl - > fsroot ) ;
if ( ! FS_Rename ( dl - > tempname + dl - > prefixbytes , dl - > localname + dl - > prefixbytes , dl - > fsroot ) )
{
char nativetmp [ MAX_OSPATH ] , nativefinal [ MAX_OSPATH ] ;
FS_NativePath ( dl - > tempname + dl - > prefixbytes , dl - > fsroot , nativetmp , sizeof ( nativetmp ) ) ;
FS_NativePath ( dl - > localname + dl - > prefixbytes , dl - > fsroot , nativefinal , sizeof ( nativefinal ) ) ;
Con_Printf ( " Couldn't rename %s to %s \n " , nativetmp , nativefinal ) ;
}
}
}
else
{
//file was aborted half way through...
if ( dl - > dlblocks )
{
//save the list of valid chunks so we don't have to redownload those.
vfsfile_t * parts ;
parts = FS_OpenVFS ( dl - > dclname + dl - > prefixbytes , " wb " , dl - > fsroot ) ;
if ( parts )
{
for ( b = dl - > dlblocks ; b ; b = n )
{
if ( b - > state = = DLB_RECEIVED )
VFS_PRINTF ( parts , " c %#llx %#llx \n " , ( long long ) b - > start , ( long long ) b - > end ) ;
else
{
for ( ; ; )
{
n = b - > next ;
if ( n & & n - > state ! = DLB_RECEIVED )
{
b - > end = n - > end ;
b - > next = n - > next ;
Z_Free ( n ) ;
continue ;
}
break ;
}
VFS_PRINTF ( parts , " m %#llx %#llx \n " , ( long long ) b - > start , ( long long ) b - > end ) ;
}
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
n = b - > next ;
Z_Free ( b ) ;
}
dl - > dlblocks = NULL ;
VFS_CLOSE ( parts ) ;
}
else
FS_Remove ( dl - > tempname + dl - > prefixbytes , dl - > fsroot ) ;
}
else
{
//download looks like it was non-resumable. just delete it.
FS_Remove ( dl - > tempname + dl - > prefixbytes , dl - > fsroot ) ;
}
}
if ( aborttype ! = QDL_DISCONNECT )
{
switch ( dl - > method )
{
default :
break ;
# ifdef Q3CLIENT
case DL_Q3 :
CLQ3_SendClientCommand ( " stopdl " ) ;
break ;
2005-01-13 16:29:20 +00:00
# endif
2014-06-12 23:08:42 +00:00
case DL_DARKPLACES :
case DL_QW :
case DL_QWCHUNKS :
{
char * serverversion = Info_ValueForKey ( cl . serverinfo , " *version " ) ;
if ( strncmp ( serverversion , " MVDSV " , 6 ) ) //don't tell mvdsv to stop, because it has retarded annoying clientprints that are spammy as fuck, and we don't want that.
CL_SendClientCommand ( true , " stopdownload " ) ;
}
break ;
}
}
}
for ( b = dl - > dlblocks ; b ; b = n )
{
n = b - > next ;
Z_Free ( b ) ;
}
dl - > dlblocks = NULL ;
Z_Free ( dl ) ;
if ( cls . download = = dl )
cls . download = NULL ;
}
2005-01-13 16:29:20 +00:00
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = = = = =
CL_ParseDownload
A download message has been received from the server
= = = = = = = = = = = = = = = = = = = = =
*/
void CL_ParseDownload ( void )
{
2006-08-02 05:34:17 +00:00
extern cvar_t cl_dlemptyterminate ;
2004-08-23 00:15:46 +00:00
int size , percent ;
qbyte name [ 1024 ] ;
2014-06-12 23:08:42 +00:00
qdownload_t * dl = cls . download ;
2004-08-23 00:15:46 +00:00
2005-01-13 16:29:20 +00:00
# ifdef PEXT_CHUNKEDDOWNLOADS
if ( cls . fteprotocolextensions & PEXT_CHUNKEDDOWNLOADS )
{
2008-01-30 02:32:00 +00:00
if ( cls . demoplayback = = DPB_EZTV )
Host_EndGame ( " CL_ParseDownload: chunked download on qtv proxy. " ) ;
2014-06-12 23:08:42 +00:00
CL_ParseChunkedDownload ( dl ) ;
2005-01-13 16:29:20 +00:00
return ;
}
# endif
2004-08-23 00:15:46 +00:00
// read the data
size = MSG_ReadShort ( ) ;
percent = MSG_ReadByte ( ) ;
2012-02-12 05:18:31 +00:00
if ( size = = - 2 )
{
/*quakeforge*/
MSG_ReadString ( ) ;
return ;
}
if ( size = = - 3 )
{
2014-02-14 09:59:32 +00:00
char * requestedname ;
2012-02-12 05:18:31 +00:00
Q_strncpyz ( name , MSG_ReadString ( ) , sizeof ( name ) ) ;
2014-02-14 09:59:32 +00:00
requestedname = MSG_ReadString ( ) ;
Con_DPrintf ( " Download for %s redirected to %s \n " , requestedname , name ) ;
2012-02-12 05:18:31 +00:00
/*quakeforge http download redirection*/
2014-06-12 23:08:42 +00:00
if ( dl )
CL_DownloadFailed ( dl - > remotename , dl ) ;
2013-03-12 22:35:33 +00:00
//FIXME: find some safe way to do this and actually test it. we should already know the local name, but we might have gained a .gz or something (this is quakeforge after all).
// CL_CheckOrEnqueDownloadFile(name, localname, DLLF_IGNOREFAILED);
2012-02-12 05:18:31 +00:00
return ;
}
2008-01-30 02:32:00 +00:00
if ( cls . demoplayback & & cls . demoplayback ! = DPB_EZTV )
2004-08-23 00:15:46 +00:00
{
if ( size > 0 )
msg_readcount + = size ;
2014-06-12 23:08:42 +00:00
return ; // not in demo playback, we don't know the name of the file.
2004-08-23 00:15:46 +00:00
}
2014-06-12 23:08:42 +00:00
if ( ! dl )
2004-12-05 11:37:39 +00:00
{
2014-06-12 23:08:42 +00:00
//download packet without file requested.
if ( size > 0 )
msg_readcount + = size ;
return ; // not in demo playback
2004-12-05 11:37:39 +00:00
}
2005-01-13 16:29:20 +00:00
if ( size < 0 )
2004-08-23 00:15:46 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " File not found. \n " ) ;
2005-01-16 02:25:35 +00:00
2014-06-12 23:08:42 +00:00
if ( dl )
CL_DownloadFailed ( dl - > remotename , dl ) ;
2004-08-23 00:15:46 +00:00
return ;
}
// open the file if not opened yet
2014-06-12 23:08:42 +00:00
if ( dl - > method = = DL_QWPENDING )
2004-08-23 00:15:46 +00:00
{
2014-06-12 23:08:42 +00:00
dl - > method = DL_QW ;
if ( ! DL_Begun ( dl ) )
2004-08-23 00:15:46 +00:00
{
msg_readcount + = size ;
2014-06-12 23:08:42 +00:00
Con_TPrintf ( " Failed to open %s \n " , dl - > tempname ) ;
CL_DownloadFailed ( dl - > remotename , dl ) ;
2004-08-23 00:15:46 +00:00
CL_RequestNextDownload ( ) ;
return ;
}
SCR_EndLoadingPlaque ( ) ;
}
2014-06-12 23:08:42 +00:00
2004-08-23 00:15:46 +00:00
# ifdef PEXT_ZLIBDL
if ( percent > = 101 & & percent < = 201 ) // && cls.fteprotocolextensions & PEXT_ZLIBDL)
{
int compsize ;
percent = percent - 101 ;
2006-01-02 23:00:10 +00:00
VFS_WRITE ( cls . download , ZLibDownloadDecode ( & compsize , net_message . data + msg_readcount , size ) , size ) ;
2004-08-23 00:15:46 +00:00
msg_readcount + = compsize ;
}
else
# endif
{
2014-06-12 23:08:42 +00:00
VFS_WRITE ( dl - > file , net_message . data + msg_readcount , size ) ;
2004-08-23 00:15:46 +00:00
msg_readcount + = size ;
}
2014-06-12 23:08:42 +00:00
dl - > completedbytes + = size ;
dl - > ratebytes + = size ;
if ( dl - > percent ! = percent ) //try and guess the size (its most acurate when the percent value changes)
dl - > size = ( ( float ) dl - > completedbytes * 100 ) / percent ;
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
if ( percent ! = 100 & & size = = 0 & & cl_dlemptyterminate . ival )
2006-08-02 05:34:17 +00:00
{
2014-06-12 23:08:42 +00:00
Con_Printf ( CON_WARNING " WARNING: Client received empty svc_download, assuming EOF. \n " ) ;
2006-08-02 05:34:17 +00:00
percent = 100 ;
}
2004-08-23 00:15:46 +00:00
if ( percent ! = 100 )
{
// request next block
2014-06-12 23:08:42 +00:00
dl - > percent = percent ;
2004-08-23 00:15:46 +00:00
2005-03-23 22:14:08 +00:00
CL_SendClientCommand ( true , " nextdl " ) ;
2004-08-23 00:15:46 +00:00
}
else
{
2014-06-12 23:08:42 +00:00
Con_DPrintf ( " Download took %i seconds \n " , ( int ) ( Sys_DoubleTime ( ) - dl - > starttime ) ) ;
2004-08-23 00:15:46 +00:00
2014-06-12 23:08:42 +00:00
CL_DownloadFinished ( dl ) ;
2005-01-16 02:25:35 +00:00
2004-08-23 00:15:46 +00:00
// get another file if needed
CL_RequestNextDownload ( ) ;
}
}
2008-11-09 22:29:28 +00:00
qboolean CL_ParseOOBDownload ( void )
{
2014-06-12 23:08:42 +00:00
qdownload_t * dl = cls . download ;
if ( ! dl )
return false ;
if ( MSG_ReadLong ( ) ! = dl - > filesequence )
2008-11-09 22:29:28 +00:00
return false ;
if ( MSG_ReadChar ( ) ! = svc_download )
return false ;
CL_ParseDownload ( ) ;
return true ;
}
2007-06-20 00:02:54 +00:00
void CLDP_ParseDownloadData ( void )
{
2014-06-12 23:08:42 +00:00
qdownload_t * dl = cls . download ;
2007-06-20 00:02:54 +00:00
unsigned char buffer [ 1 < < 16 ] ;
2014-02-07 08:38:40 +00:00
qofs_t start ;
2007-06-20 00:02:54 +00:00
int size ;
start = MSG_ReadLong ( ) ;
size = ( unsigned short ) MSG_ReadShort ( ) ;
2010-12-23 08:53:23 +00:00
2007-06-20 00:02:54 +00:00
MSG_ReadData ( buffer , size ) ;
2014-06-12 23:08:42 +00:00
if ( ! dl )
return ;
if ( dl - > file )
2009-04-12 16:57:30 +00:00
{
2014-06-12 23:08:42 +00:00
VFS_SEEK ( dl - > file , start ) ;
VFS_WRITE ( dl - > file , buffer , size ) ;
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-06-12 23:08:42 +00:00
dl - > percent = ( start + size ) / ( float ) VFS_GETLEN ( dl - > file ) * 100 ;
2009-04-12 16:57:30 +00:00
}
2007-06-20 00:02:54 +00:00
//this is only reliable because I'm lazy
MSG_WriteByte ( & cls . netchan . message , clcdp_ackdownloaddata ) ;
MSG_WriteLong ( & cls . netchan . message , start ) ;
MSG_WriteShort ( & cls . netchan . message , size ) ;
}
void CLDP_ParseDownloadBegin ( char * s )
{
2014-06-12 23:08:42 +00:00
qdownload_t * dl = cls . download ;
2007-06-20 00:02:54 +00:00
char buffer [ 8192 ] ;
2014-08-03 14:47:47 +00:00
qofs_t size , pos , chunk ;
2007-06-20 00:02:54 +00:00
char * fname ;
Cmd_TokenizeString ( s + 1 , false , false ) ;
2014-08-03 14:47:47 +00:00
size = ( qofs_t ) strtoull ( Cmd_Argv ( 1 ) , NULL , 0 ) ;
2007-06-20 00:02:54 +00:00
fname = Cmd_Argv ( 2 ) ;
2014-06-12 23:08:42 +00:00
if ( ! dl | | strcmp ( fname , dl - > remotename ) )
2012-11-27 03:23:19 +00:00
{
Con_Printf ( " Warning: server started sending a file we did not request. Ignoring. \n " ) ;
return ;
}
2014-06-12 23:08:42 +00:00
if ( dl - > method ! = DL_DARKPLACES )
2007-06-20 00:02:54 +00:00
{
2014-06-12 23:08:42 +00:00
Con_Printf ( " Warning: download method isn't right. \n " ) ;
return ;
2007-06-20 00:02:54 +00:00
}
2014-06-12 23:08:42 +00:00
dl - > sizeunknown = false ;
dl - > size = size ;
if ( ! DL_Begun ( dl ) )
{
CL_DownloadFailed ( dl - > remotename , dl ) ;
return ;
}
2010-12-23 08:53:23 +00:00
2014-06-12 23:08:42 +00:00
CL_SendClientCommand ( true , " sv_startdownload " ) ;
2012-11-27 03:23:19 +00:00
2014-06-12 23:08:42 +00:00
//fill the file with 0 bytes, for some reason
memset ( buffer , 0 , sizeof ( buffer ) ) ;
for ( pos = 0 , chunk = 1 ; chunk ; pos + = chunk )
2007-06-20 00:02:54 +00:00
{
2014-06-12 23:08:42 +00:00
chunk = size - pos ;
if ( chunk > sizeof ( buffer ) )
chunk = sizeof ( buffer ) ;
VFS_WRITE ( dl - > file , buffer , chunk ) ;
2007-06-20 00:02:54 +00:00
}
}
void CLDP_ParseDownloadFinished ( char * s )
{
2014-06-12 23:08:42 +00:00
qdownload_t * dl = cls . download ;
2007-08-08 03:02:36 +00:00
unsigned short runningcrc = 0 ;
2007-06-20 00:02:54 +00:00
char buffer [ 8192 ] ;
int size , pos , chunk ;
2014-06-12 23:08:42 +00:00
if ( ! dl | | ! dl - > file )
2007-06-20 00:02:54 +00:00
return ;
Cmd_TokenizeString ( s + 1 , false , false ) ;
2014-06-12 23:08:42 +00:00
VFS_CLOSE ( dl - > file ) ;
2007-06-20 00:02:54 +00:00
2014-06-12 23:08:42 +00:00
dl - > file = FS_OpenVFS ( dl - > tempname + dl - > prefixbytes , " rb " , dl - > fsroot ) ;
if ( dl - > file )
2007-06-20 00:02:54 +00:00
{
2014-06-12 23:08:42 +00:00
size = dl - > size ;
2007-06-20 00:02:54 +00:00
QCRC_Init ( & runningcrc ) ;
for ( pos = 0 , chunk = 1 ; chunk ; pos + = chunk )
{
chunk = size - pos ;
if ( chunk > sizeof ( buffer ) )
chunk = sizeof ( buffer ) ;
2014-06-12 23:08:42 +00:00
VFS_READ ( dl - > file , buffer , chunk ) ;
2007-06-20 00:02:54 +00:00
QCRC_AddBlock ( & runningcrc , buffer , chunk ) ;
}
2014-06-12 23:08:42 +00:00
VFS_CLOSE ( dl - > file ) ;
dl - > file = NULL ;
2007-08-08 03:02:36 +00:00
}
else
{
Con_Printf ( " Download failed: unable to check CRC of download \n " ) ;
2014-06-12 23:08:42 +00:00
CL_DownloadFailed ( dl - > remotename , dl ) ;
2010-12-23 08:53:23 +00:00
return ;
2007-08-08 03:02:36 +00:00
}
2007-06-20 00:02:54 +00:00
2007-08-08 03:02:36 +00:00
Cmd_TokenizeString ( s + 1 , false , false ) ;
if ( size ! = atoi ( Cmd_Argv ( 1 ) ) )
{
Con_Printf ( " Download failed: wrong file size \n " ) ;
2014-06-12 23:08:42 +00:00
CL_DownloadFailed ( dl - > remotename , dl ) ;
2007-08-08 03:02:36 +00:00
return ;
}
if ( runningcrc ! = atoi ( Cmd_Argv ( 2 ) ) )
{
Con_Printf ( " Download failed: wrong crc \n " ) ;
2014-06-12 23:08:42 +00:00
CL_DownloadFailed ( dl - > remotename , dl ) ;
2007-08-08 03:02:36 +00:00
return ;
2007-06-20 00:02:54 +00:00
}
2014-06-12 23:08:42 +00:00
Con_DPrintf ( " Download took %i seconds \n " , ( int ) ( Sys_DoubleTime ( ) - dl - > starttime ) ) ;
2007-06-20 00:02:54 +00:00
2014-06-12 23:08:42 +00:00
CL_DownloadFinished ( dl ) ;
2007-06-20 00:02:54 +00:00
// get another file if needed
CL_RequestNextDownload ( ) ;
}
2006-01-12 22:56:54 +00:00
static vfsfile_t * upload_file ;
2004-08-23 00:15:46 +00:00
static qbyte * upload_data ;
static int upload_pos ;
static int upload_size ;
void CL_NextUpload ( void )
{
qbyte buffer [ 1024 ] ;
int r ;
int percent ;
int size ;
r = upload_size - upload_pos ;
if ( r > 768 )
r = 768 ;
2006-01-12 22:56:54 +00:00
if ( upload_data )
{
memcpy ( buffer , upload_data + upload_pos , r ) ;
}
else if ( upload_file )
{
r = VFS_READ ( upload_file , buffer , r ) ;
if ( r = = 0 )
{
CL_StopUpload ( ) ;
return ;
}
}
else
return ;
2004-08-23 00:15:46 +00:00
MSG_WriteByte ( & cls . netchan . message , clc_upload ) ;
MSG_WriteShort ( & cls . netchan . message , r ) ;
upload_pos + = r ;
size = upload_size ;
if ( ! size )
size = 1 ;
percent = upload_pos * 100 / size ;
MSG_WriteByte ( & cls . netchan . message , percent ) ;
SZ_Write ( & cls . netchan . message , buffer , r ) ;
Con_DPrintf ( " UPLOAD: %6d: %d written \n " , upload_pos - r , r ) ;
if ( upload_pos ! = upload_size )
return ;
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Upload completed \n " ) ;
2004-08-23 00:15:46 +00:00
2006-01-12 22:56:54 +00:00
CL_StopUpload ( ) ;
2004-08-23 00:15:46 +00:00
}
void CL_StartUpload ( qbyte * data , int size )
{
if ( cls . state < ca_onserver )
return ; // gotta be connected
// override
2006-01-12 22:56:54 +00:00
CL_StopUpload ( ) ;
2004-08-23 00:15:46 +00:00
Con_DPrintf ( " Upload starting of %d... \n " , size ) ;
upload_data = BZ_Malloc ( size ) ;
memcpy ( upload_data , data , size ) ;
upload_size = size ;
upload_pos = 0 ;
CL_NextUpload ( ) ;
2005-09-26 03:40:09 +00:00
}
2004-08-23 00:15:46 +00:00
qboolean CL_IsUploading ( void )
{
2006-01-12 22:56:54 +00:00
if ( upload_data | | upload_file )
2004-08-23 00:15:46 +00:00
return true ;
return false ;
}
void CL_StopUpload ( void )
{
if ( upload_data )
BZ_Free ( upload_data ) ;
2006-01-12 22:56:54 +00:00
if ( upload_file )
VFS_CLOSE ( upload_file ) ;
upload_file = NULL ;
2004-08-23 00:15:46 +00:00
upload_data = NULL ;
2006-01-12 22:56:54 +00:00
upload_pos = upload_size = 0 ;
}
qboolean CL_StartUploadFile ( char * filename )
{
if ( ! COM_CheckParm ( " -fileul " ) )
{
Con_Printf ( " You must currently use the -fileul commandline parameter in order to use this functionality \n " ) ;
return false ;
}
if ( cls . state < ca_onserver )
return false ; // gotta be connected
CL_StopUpload ( ) ;
2008-12-23 02:55:20 +00:00
upload_file = FS_OpenVFS ( filename , " rb " , FS_ROOT ) ;
2006-01-12 22:56:54 +00:00
upload_size = VFS_GETLEN ( upload_file ) ;
upload_pos = 0 ;
if ( upload_file )
{
CL_NextUpload ( ) ;
return true ;
}
return false ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
SERVER CONNECTING MESSAGES
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2004-12-08 07:55:43 +00:00
# ifdef CLIENTONLY
float nextdemotime ;
# endif
2004-08-23 00:15:46 +00:00
2009-04-06 00:34:32 +00:00
void CL_ClearParseState ( void )
{
// done with sounds, request models now
memset ( cl . model_precache , 0 , sizeof ( cl . model_precache ) ) ;
cl_playerindex = - 1 ;
cl_h_playerindex = - 1 ;
cl_spikeindex = - 1 ;
cl_flagindex = - 1 ;
cl_rocketindex = - 1 ;
cl_grenadeindex = - 1 ;
cl_gib1index = - 1 ;
cl_gib2index = - 1 ;
cl_gib3index = - 1 ;
2012-07-05 19:42:36 +00:00
if ( cl_baselines )
{
BZ_Free ( cl_baselines ) ;
cl_baselines = NULL ;
}
cl_baselines_count = 0 ;
cl_max_static_entities = 0 ;
if ( cl_static_entities )
{
BZ_Free ( cl_static_entities ) ;
cl_static_entities = NULL ;
}
2009-04-06 00:34:32 +00:00
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = =
CL_ParseServerData
= = = = = = = = = = = = = = = = = =
*/
2011-07-30 14:14:56 +00:00
void CLQW_ParseServerData ( void )
2004-08-23 00:15:46 +00:00
{
int pnum ;
int clnum ;
char * str ;
int protover , svcnt ;
float maxspeed , entgrav ;
2005-09-26 03:40:09 +00:00
2014-06-12 23:08:42 +00:00
if ( cls . download & & cls . download - > method = = DL_QWPENDING )
2013-03-12 22:35:33 +00:00
{
//if we didn't actually start downloading it yet, cancel the current download.
//this is to avoid qizmo not responding to the download command, resulting in hanging downloads that cause the client to then be unable to connect anywhere simply because someone's skin was set.
2014-06-12 23:08:42 +00:00
CL_DownloadFailed ( cls . download - > remotename , cls . download ) ;
2013-03-12 22:35:33 +00:00
}
2004-08-23 00:15:46 +00:00
Con_DPrintf ( " Serverdata packet received. \n " ) ;
//
// wipe the client_state_t struct
2005-09-26 03:40:09 +00:00
//
2004-08-23 00:15:46 +00:00
2009-04-06 00:34:32 +00:00
SCR_SetLoadingStage ( LS_CLIENT ) ;
2004-08-23 00:15:46 +00:00
SCR_BeginLoadingPlaque ( ) ;
// parse protocol version number
// allow 2.2 and 2.29 demos to play
# ifdef PROTOCOL_VERSION_FTE
cls . fteprotocolextensions = 0 ;
2009-11-04 21:16:50 +00:00
cls . fteprotocolextensions2 = 0 ;
2004-08-23 00:15:46 +00:00
for ( ; ; )
{
protover = MSG_ReadLong ( ) ;
if ( protover = = PROTOCOL_VERSION_FTE )
{
2010-07-18 08:42:59 +00:00
cls . fteprotocolextensions = MSG_ReadLong ( ) ;
2009-11-04 21:16:50 +00:00
continue ;
}
if ( protover = = PROTOCOL_VERSION_FTE2 )
{
2010-07-18 08:42:59 +00:00
cls . fteprotocolextensions2 = MSG_ReadLong ( ) ;
2004-08-23 00:15:46 +00:00
continue ;
}
2010-07-18 08:42:59 +00:00
if ( protover = = PROTOCOL_VERSION_VARLENGTH )
{
int ident ;
int len ;
char data [ 1024 ] ;
ident = MSG_ReadLong ( ) ;
len = MSG_ReadLong ( ) ;
if ( len < = sizeof ( data ) )
{
MSG_ReadData ( data , len ) ;
switch ( ident )
{
default :
break ;
}
continue ;
}
}
2008-04-12 23:24:19 +00:00
if ( protover = = PROTOCOL_VERSION_QW ) //this ends the version info
2004-08-23 00:15:46 +00:00
break ;
if ( cls . demoplayback & & ( protover = = 26 | | protover = = 27 | | protover = = 28 ) ) //older versions, maintain demo compatability.
break ;
2008-04-12 23:24:19 +00:00
Host_EndGame ( " Server returned version %i, not %i \n " , protover , PROTOCOL_VERSION_QW ) ;
2004-08-23 00:15:46 +00:00
}
# else
2005-09-26 03:40:09 +00:00
protover = MSG_ReadLong ( ) ;
2008-04-12 23:24:19 +00:00
if ( protover ! = PROTOCOL_VERSION_QW & &
2004-08-23 00:15:46 +00:00
! ( cls . demoplayback & & ( protover = = 26 | | protover = = 27 | | protover = = 28 ) ) )
2008-04-12 23:24:19 +00:00
Host_EndGame ( " Server returned version %i, not %i \n " , protover , PROTOCOL_VERSION_QW ) ;
2004-08-23 00:15:46 +00:00
# endif
2009-11-04 21:16:50 +00:00
if ( cls . fteprotocolextensions2 | | cls . fteprotocolextensions )
if ( developer . ival | | cl_shownet . ival )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Using FTE extensions 0x%x%08x \n " , cls . fteprotocolextensions2 , cls . fteprotocolextensions ) ;
2009-11-04 21:16:50 +00:00
2004-11-27 08:16:25 +00:00
if ( cls . fteprotocolextensions & PEXT_FLOATCOORDS )
{
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
cls . netchan . netprim . coordsize = 4 ;
cls . netchan . netprim . anglesize = 2 ;
2004-11-27 08:16:25 +00:00
}
else
{
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
cls . netchan . netprim . coordsize = 2 ;
cls . netchan . netprim . anglesize = 1 ;
2004-11-27 08:16:25 +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
cls . netchan . message . prim = cls . netchan . netprim ;
MSG_ChangePrimitives ( cls . netchan . netprim ) ;
2004-11-27 08:16:25 +00:00
2005-09-08 01:58:25 +00:00
svcnt = MSG_ReadLong ( ) ;
2004-08-23 00:15:46 +00:00
// game directory
str = MSG_ReadString ( ) ;
2012-02-12 05:18:31 +00:00
Con_DPrintf ( " Server is using gamedir \" %s \" \n " , str ) ;
2006-02-22 23:35:04 +00:00
if ( ! * str )
str = " qw " ;
2004-08-23 00:15:46 +00:00
# ifndef CLIENTONLY
if ( ! sv . state )
# endif
{
COM_FlushTempoaryPacks ( ) ;
COM_Gamedir ( str ) ;
2004-11-29 01:21:00 +00:00
# ifndef CLIENTONLY
2004-08-23 00:15:46 +00:00
Info_SetValueForStarKey ( svs . info , " *gamedir " , str , MAX_SERVERINFO_STRING ) ;
2004-11-29 01:21:00 +00:00
# endif
2010-12-05 02:46:07 +00:00
Cvar_ForceCallback ( Cvar_FindVar ( " r_particlesdesc " ) ) ;
2004-08-23 00:15:46 +00:00
}
CL_ClearState ( ) ;
Stats_NewMap ( ) ;
cl . servercount = svcnt ;
2004-12-29 03:24:21 +00:00
cl . teamfortress = ! Q_strcasecmp ( str , " fortress " ) ;
2004-08-23 00:15:46 +00:00
if ( cl . gamedirchanged )
{
cl . gamedirchanged = false ;
# ifndef CLIENTONLY
if ( ! sv . state )
# endif
Wads_Flush ( ) ;
}
2012-02-12 05:18:31 +00:00
/*mvds have different parsing*/
2008-01-09 00:52:31 +00:00
if ( cls . demoplayback = = DPB_MVD | | cls . demoplayback = = DPB_EZTV )
2004-08-23 00:15:46 +00:00
{
2012-01-24 04:24:14 +00:00
int i , j ;
2012-02-12 05:18:31 +00:00
if ( cls . fteprotocolextensions2 & PEXT2_MAXPLAYERS )
{
cl . allocated_client_slots = MSG_ReadByte ( ) ;
if ( cl . allocated_client_slots > MAX_CLIENTS )
cl . allocated_client_slots = MAX_CLIENTS ;
}
cl . gametime = MSG_ReadFloat ( ) ;
cl . gametimemark = realtime ;
cl . oldgametime = cl . gametime ;
cl . oldgametimemark = realtime ;
2012-01-24 04:24:14 +00:00
for ( j = 0 ; j < MAX_SPLITS ; j + + )
{
2013-06-23 02:17:02 +00:00
cl . playerview [ j ] . playernum = cl . allocated_client_slots + j ;
cl . playerview [ j ] . viewentity = 0 ; //free floating.
2012-01-24 04:24:14 +00:00
for ( i = 0 ; i < UPDATE_BACKUP ; i + + )
{
2013-06-23 02:17:02 +00:00
cl . inframes [ i ] . playerstate [ cl . playerview [ j ] . playernum ] . pm_type = PM_SPECTATOR ;
cl . inframes [ i ] . playerstate [ cl . playerview [ j ] . playernum ] . messagenum = 1 ;
2012-01-24 04:24:14 +00:00
}
}
2004-08-23 00:15:46 +00:00
cl . spectator = true ;
cl . splitclients = 1 ;
}
2012-02-12 05:18:31 +00:00
else if ( cls . fteprotocolextensions2 & PEXT2_MAXPLAYERS )
{
cl . allocated_client_slots = MSG_ReadByte ( ) ;
if ( cl . allocated_client_slots > MAX_CLIENTS )
{
cl . allocated_client_slots = MAX_CLIENTS ;
Host_EndGame ( " Server sent us too many alternate clients \n " ) ;
}
/*parsing here is slightly different to allow us 255 max players instead of 127*/
cl . splitclients = MSG_ReadByte ( ) ;
if ( cl . splitclients & 128 )
{
cl . spectator = true ;
cl . splitclients & = ~ 128 ;
}
if ( cl . splitclients > MAX_SPLITS )
Host_EndGame ( " Server sent us too many alternate clients \n " ) ;
for ( pnum = 0 ; pnum < cl . splitclients ; pnum + + )
{
2014-09-14 01:45:11 +00:00
if ( cls . z_ext & Z_EXT_VIEWHEIGHT )
cl . playerview [ pnum ] . viewheight = 0 ;
2013-06-23 02:17:02 +00:00
cl . playerview [ pnum ] . playernum = MSG_ReadByte ( ) ;
if ( cl . playerview [ pnum ] . playernum > = cl . allocated_client_slots )
2012-02-12 05:18:31 +00:00
Host_EndGame ( " unsupported local player slot \n " ) ;
2013-06-23 02:17:02 +00:00
cl . playerview [ pnum ] . viewentity = cl . playerview [ pnum ] . playernum + 1 ;
2012-02-12 05:18:31 +00:00
}
}
else
2004-08-23 00:15:46 +00:00
{
// parse player slot, high bit means spectator
pnum = MSG_ReadByte ( ) ;
for ( clnum = 0 ; ; clnum + + )
{
2013-03-12 22:47:42 +00:00
if ( clnum = = MAX_SPLITS )
Host_EndGame ( " Server sent us too many alternate clients \n " ) ;
2014-09-14 01:45:11 +00:00
if ( cls . z_ext & Z_EXT_VIEWHEIGHT )
cl . playerview [ pnum ] . viewheight = 0 ;
2013-06-23 02:17:02 +00:00
cl . playerview [ clnum ] . playernum = pnum ;
if ( cl . playerview [ clnum ] . playernum & 128 )
2004-08-23 00:15:46 +00:00
{
cl . spectator = true ;
2013-06-23 02:17:02 +00:00
cl . playerview [ clnum ] . playernum & = ~ 128 ;
2004-08-23 00:15:46 +00:00
}
2013-06-23 02:17:02 +00:00
if ( cl . playerview [ clnum ] . playernum > = cl . allocated_client_slots )
2012-02-12 05:18:31 +00:00
Host_EndGame ( " unsupported local player slot \n " ) ;
2013-06-23 02:17:02 +00:00
cl . playerview [ clnum ] . viewentity = cl . playerview [ clnum ] . playernum + 1 ;
2004-08-23 00:15:46 +00:00
if ( ! ( cls . fteprotocolextensions & PEXT_SPLITSCREEN ) )
break ;
pnum = MSG_ReadByte ( ) ;
if ( pnum = = 128 )
break ;
}
cl . splitclients = clnum + 1 ;
}
// get the full level name
str = MSG_ReadString ( ) ;
Q_strncpyz ( cl . levelname , str , sizeof ( cl . levelname ) ) ;
// get the movevars
movevars . gravity = MSG_ReadFloat ( ) ;
movevars . stopspeed = MSG_ReadFloat ( ) ;
maxspeed = MSG_ReadFloat ( ) ;
movevars . spectatormaxspeed = MSG_ReadFloat ( ) ;
movevars . accelerate = MSG_ReadFloat ( ) ;
movevars . airaccelerate = MSG_ReadFloat ( ) ;
movevars . wateraccelerate = MSG_ReadFloat ( ) ;
movevars . friction = MSG_ReadFloat ( ) ;
movevars . waterfriction = MSG_ReadFloat ( ) ;
entgrav = MSG_ReadFloat ( ) ;
for ( clnum = 0 ; clnum < cl . splitclients ; clnum + + )
{
2013-06-23 02:17:02 +00:00
cl . playerview [ clnum ] . maxspeed = maxspeed ;
cl . playerview [ clnum ] . entgravity = entgrav ;
2004-08-23 00:15:46 +00:00
}
// seperate the printfs so the server message can have a color
2009-07-05 18:45:53 +00:00
# if 1
2012-04-24 07:59:11 +00:00
Con_Printf ( " \n \n " ) ;
Con_Printf ( " ^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f " ) ;
Con_Printf ( " \n \n " ) ;
2009-07-05 18:45:53 +00:00
Con_Printf ( " \1 %s \n " , str ) ;
# else
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " \n \n ^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f \n \n " ) ;
Con_Printf ( " %c%s \n " , 2 , str ) ;
2009-07-05 18:45:53 +00:00
# endif
2004-08-23 00:15:46 +00:00
2005-06-04 04:20:20 +00:00
if ( CL_RemoveClientCommands ( " new " ) ) //mvdsv is really appaling some times.
2005-10-01 13:47:47 +00:00
{
// Con_Printf("Multiple 'new' commands?!?!? This server needs reinstalling!\n");
}
2005-06-04 04:20:20 +00:00
2004-08-23 00:15:46 +00:00
memset ( cl . sound_name , 0 , sizeof ( cl . sound_name ) ) ;
2005-01-24 23:47:32 +00:00
# ifdef PEXT_PK3DOWNLOADS
if ( cls . fteprotocolextensions & PEXT_PK3DOWNLOADS ) //instead of going for a soundlist, go for the pk3 list instead. The server will make us go for the soundlist after.
2004-11-17 17:58:22 +00:00
{
2006-01-02 23:00:10 +00:00
if ( CL_RemoveClientCommands ( " pk3list " ) )
------------------------------------------------------------------------
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
Con_DPrintf ( " Multiple pk3lists \n " ) ;
2005-02-28 07:16:19 +00:00
CL_SendClientCommand ( " pk3list %i 0 " , cl . servercount , 0 ) ;
2004-11-17 17:58:22 +00:00
}
else
2005-01-24 23:47:32 +00:00
# endif
2004-11-17 17:58:22 +00:00
{
2008-01-09 00:52:31 +00:00
if ( cls . demoplayback = = DPB_EZTV )
{
if ( CL_RemoveClientCommands ( " qtvsoundlist " ) )
------------------------------------------------------------------------
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
Con_DPrintf ( " Multiple soundlists \n " ) ;
2008-01-09 00:52:31 +00:00
CL_SendClientCommand ( true , " qtvsoundlist %i 0 " , cl . servercount ) ;
}
else
{
if ( CL_RemoveClientCommands ( " soundlist " ) )
------------------------------------------------------------------------
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
Con_DPrintf ( " Multiple soundlists \n " ) ;
2008-01-09 00:52:31 +00:00
// ask for the sound list next
// CL_SendClientCommand ("soundlist %i 0", cl.servercount);
CL_SendClientCommand ( true , soundlist_name , cl . servercount , 0 ) ;
}
2004-11-17 17:58:22 +00:00
}
2004-08-23 00:15:46 +00:00
// now waiting for downloads, etc
cls . state = ca_onserver ;
2006-01-10 18:50:23 +00:00
cl . sendprespawn = false ;
2010-11-16 02:03:47 +00:00
# ifdef VOICECHAT
S_Voip_MapChange ( ) ;
# endif
2004-08-23 00:15:46 +00:00
# ifdef VM_CG
CG_Stop ( ) ;
# endif
2005-02-09 19:32:09 +00:00
# ifdef CSQC_DAT
2005-03-10 03:55:18 +00:00
CSQC_Shutdown ( ) ; //revive it when we get the serverinfo saying the checksum.
2005-02-09 19:32:09 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
2010-08-11 09:31:24 +00:00
# ifdef Q2CLIENT
2004-08-23 00:15:46 +00:00
void CLQ2_ParseServerData ( void )
{
char * str ;
int i ;
int svcnt ;
// int cflag;
2004-11-27 08:16:25 +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
cls . netchan . netprim . coordsize = 2 ;
cls . netchan . netprim . anglesize = 1 ;
MSG_ChangePrimitives ( cls . netchan . netprim ) ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
Con_DPrintf ( " Serverdata packet received. \n " ) ;
//
// wipe the client_state_t struct
//
2009-04-06 00:34:32 +00:00
SCR_SetLoadingStage ( LS_CLIENT ) ;
2004-08-23 00:15:46 +00:00
SCR_BeginLoadingPlaque ( ) ;
// CL_ClearState ();
cls . state = ca_onserver ;
// parse protocol version number
i = MSG_ReadLong ( ) ;
// cls.serverProtocol = i;
if ( i > PROTOCOL_VERSION_Q2 | | i < PROTOCOL_VERSION_Q2_MIN )
Host_EndGame ( " Server returned version %i, not %i " , i , PROTOCOL_VERSION_Q2 ) ;
svcnt = MSG_ReadLong ( ) ;
/*cl.attractloop =*/ MSG_ReadByte ( ) ;
// game directory
str = MSG_ReadString ( ) ;
// strncpy (cl.gamedir, str, sizeof(cl.gamedir)-1);
// set gamedir
if ( ! * str )
COM_Gamedir ( " baseq2 " ) ;
else
COM_Gamedir ( str ) ;
// if ((*str && (!fs_gamedirvar->string || !*fs_gamedirvar->string || strcmp(fs_gamedirvar->string, str))) || (!*str && (fs_gamedirvar->string || *fs_gamedirvar->string)))
// Cvar_Set("game", str);
2006-04-11 20:09:39 +00:00
Cvar_Get ( " timescale " , " 1 " , 0 , " Q2Admin hacks " ) ; //Q2Admin will kick players who have a timescale set to something other than 1
//FTE doesn't actually have a timescale cvar, so create one to fool q2admin.
//I can't really blame q2admin for rejecting engines that don't have this cvar, as it could have been renamed via a hex-edit.
2004-08-23 00:15:46 +00:00
CL_ClearState ( ) ;
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
CLQ2_ClearState ( ) ;
2004-08-23 00:15:46 +00:00
cl . minpitch = - 89 ;
cl . maxpitch = 89 ;
cl . servercount = svcnt ;
Stats_NewMap ( ) ;
// parse player entity number
2013-06-23 02:17:02 +00:00
cl . playerview [ 0 ] . playernum = MSG_ReadShort ( ) ;
cl . playerview [ 0 ] . viewentity = cl . playerview [ 0 ] . playernum + 1 ;
2004-08-23 00:15:46 +00:00
cl . splitclients = 1 ;
cl . spectator = false ;
2006-04-11 20:09:39 +00:00
cl . numq2visibleweapons = 1 ; //give it a default.
cl . q2visibleweapons [ 0 ] = " weapon.md2 " ;
2004-08-23 00:15:46 +00:00
// get the full level name
str = MSG_ReadString ( ) ;
Q_strncpyz ( cl . levelname , str , sizeof ( cl . levelname ) ) ;
2013-06-23 02:17:02 +00:00
if ( cl . playerview [ 0 ] . playernum = = - 1 )
2004-08-23 00:15:46 +00:00
{ // playing a cinematic or showing a pic, not a level
SCR_EndLoadingPlaque ( ) ;
2013-05-03 04:28:08 +00:00
if ( ! Media_PlayFilm ( str , false ) )
2010-11-13 17:22:46 +00:00
{
CL_SendClientCommand ( true , " nextserver %i " , cl . servercount ) ;
}
CL_MakeActive ( " Quake2 " ) ;
2004-08-23 00:15:46 +00:00
}
else
{
// seperate the printfs so the server message can have a color
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " \n \n ^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f \n \n " ) ;
Con_Printf ( " %c%s \n " , 2 , str ) ;
2004-08-23 00:15:46 +00:00
2013-05-03 04:28:08 +00:00
Media_StopFilm ( true ) ;
2004-08-27 00:48:03 +00:00
2004-08-23 00:15:46 +00:00
// need to prep refresh at next oportunity
//cl.refresh_prepped = false;
}
2008-11-09 22:29:28 +00:00
Cvar_ForceCallback ( Cvar_FindVar ( " r_particlesdesc " ) ) ;
2004-08-23 00:15:46 +00:00
2014-10-05 20:04:11 +00:00
Surf_PreNewMap ( ) ;
2004-08-23 00:15:46 +00:00
}
2010-08-11 09:31:24 +00:00
# endif
2004-08-23 00:15:46 +00:00
2008-12-03 02:42:05 +00:00
void CL_ParseEstablished ( void )
{
# ifdef NQPROT
cl_dp_serverextension_download = false ;
cl_dp_csqc_progscrc = 0 ;
cl_dp_csqc_progssize = 0 ;
# endif
}
2004-08-23 00:15:46 +00:00
# ifdef NQPROT
2013-07-26 17:19:06 +00:00
void CLNQ_ParseProtoVersion ( void )
2004-08-23 00:15:46 +00:00
{
int protover ;
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
struct netprim_s netprim ;
2007-06-20 00:02:54 +00:00
2013-03-12 22:35:33 +00:00
cls . fteprotocolextensions = 0 ;
cls . fteprotocolextensions2 = 0 ;
for ( ; ; )
{
protover = MSG_ReadLong ( ) ;
switch ( protover )
{
case PROTOCOL_VERSION_FTE :
cls . fteprotocolextensions = MSG_ReadLong ( ) ;
continue ;
case PROTOCOL_VERSION_FTE2 :
cls . fteprotocolextensions2 = MSG_ReadLong ( ) ;
continue ;
default :
break ;
}
break ;
}
2004-08-23 00:15:46 +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
netprim . coordsize = 2 ;
netprim . anglesize = 1 ;
2004-11-27 08:16:25 +00:00
2011-06-16 02:03:57 +00:00
cls . protocol_nq = ( cls . protocol_nq = = CPNQ_PROQUAKE3_4 ) ? CPNQ_PROQUAKE3_4 : CPNQ_ID ;
2004-12-05 08:19:54 +00:00
cls . z_ext = 0 ;
2004-11-27 08:16:25 +00:00
2010-08-16 02:03:02 +00:00
if ( protover = = NEHD_PROTOCOL_VERSION )
2004-08-23 00:15:46 +00:00
Host_EndGame ( " Nehahra demo net protocol is not supported \n " ) ;
2010-08-16 02:03:02 +00:00
else if ( protover = = FITZ_PROTOCOL_VERSION )
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
{
//fitzquake 0.85
cls . protocol_nq = CPNQ_FITZ666 ;
Con_DPrintf ( " FitzQuake 666 protocol \n " ) ;
}
2011-10-27 15:46:36 +00:00
else if ( protover = = RMQ_PROTOCOL_VERSION )
{
int fl ;
cls . protocol_nq = CPNQ_FITZ666 ;
Con_DPrintf ( " RMQ extensions to FitzQuake's protocol \n " ) ;
fl = MSG_ReadLong ( ) ;
if ( fl & RMQFL_SHORTANGLE )
netprim . anglesize = 2 ;
if ( fl & RMQFL_FLOATANGLE )
netprim . anglesize = 4 ;
if ( fl & RMQFL_24BITCOORD )
netprim . coordsize = 3 ;
if ( fl & RMQFL_FLOATCOORD )
netprim . coordsize = 4 ;
2012-09-30 05:52:03 +00:00
if ( fl & ~ ( RMQFL_SHORTANGLE | RMQFL_FLOATANGLE | RMQFL_24BITCOORD | RMQFL_FLOATCOORD | RMQFL_EDICTSCALE ) )
2011-10-27 15:46:36 +00:00
Con_Printf ( " WARNING: Server is using unsupported RMQ extensions \n " ) ;
}
2010-08-16 02:03:02 +00:00
else if ( protover = = DP5_PROTOCOL_VERSION )
2004-11-27 08:16:25 +00:00
{
//darkplaces5
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
cls . protocol_nq = CPNQ_DP5 ;
netprim . coordsize = 4 ;
netprim . anglesize = 2 ;
2005-09-26 03:40:09 +00:00
Con_DPrintf ( " DP5 protocols \n " ) ;
2004-11-27 08:16:25 +00:00
}
2005-05-27 05:41:07 +00:00
else if ( protover = = DP6_PROTOCOL_VERSION )
2004-12-05 08:19:54 +00:00
{
//darkplaces6 (it's a small difference from dp5)
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
cls . protocol_nq = CPNQ_DP6 ;
netprim . coordsize = 4 ;
netprim . anglesize = 2 ;
2004-12-05 08:19:54 +00:00
cls . z_ext = Z_EXT_VIEWHEIGHT ;
2005-09-26 03:40:09 +00:00
Con_DPrintf ( " DP6 protocols \n " ) ;
2004-12-05 08:19:54 +00:00
}
2005-05-27 05:41:07 +00:00
else if ( protover = = DP7_PROTOCOL_VERSION )
2005-05-26 12:55:34 +00:00
{
//darkplaces7 (it's a small difference from dp5)
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
cls . protocol_nq = CPNQ_DP7 ;
netprim . coordsize = 4 ;
netprim . anglesize = 2 ;
2005-05-26 12:55:34 +00:00
cls . z_ext = Z_EXT_VIEWHEIGHT ;
2005-09-26 03:40:09 +00:00
Con_DPrintf ( " DP7 protocols \n " ) ;
2005-05-26 12:55:34 +00:00
}
2010-08-16 02:03:02 +00:00
else if ( protover = = H2_PROTOCOL_VERSION )
{
2011-09-03 03:49:43 +00:00
Host_EndGame ( " \n Unable to connect to standard Hexen2 servers. Host the game with " DISTRIBUTION " \n " ) ;
2010-08-16 02:03:02 +00:00
}
2004-08-23 00:15:46 +00:00
else if ( protover ! = NQ_PROTOCOL_VERSION )
{
2011-10-27 15:46:36 +00:00
Host_EndGame ( " Server is using protocol version %i, which is not supported by this version of " FULLENGINENAME " . " , protover ) ;
2004-08-23 00:15:46 +00:00
}
2005-09-26 03:40:09 +00:00
else
{
Con_DPrintf ( " Standard NQ protocols \n " ) ;
}
2013-03-12 22:35:33 +00:00
if ( cls . fteprotocolextensions & PEXT_FLOATCOORDS )
{
if ( netprim . anglesize < 2 )
netprim . anglesize = 2 ;
if ( netprim . coordsize < 4 )
netprim . coordsize = 4 ;
}
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
cls . netchan . message . prim = cls . netchan . netprim = netprim ;
MSG_ChangePrimitives ( netprim ) ;
2013-07-26 17:19:06 +00:00
}
//FIXME: move to header
void CL_KeepaliveMessage ( void ) { }
void CLNQ_ParseServerData ( void ) //Doesn't change gamedir - use with caution.
{
int nummodels , numsounds ;
char * str ;
int gametype ;
if ( developer . ival )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Serverdata packet received. \n " ) ;
2013-07-26 17:19:06 +00:00
SCR_SetLoadingStage ( LS_CLIENT ) ;
CL_ClearState ( ) ;
Stats_NewMap ( ) ;
Cvar_ForceCallback ( Cvar_FindVar ( " r_particlesdesc " ) ) ;
CLNQ_ParseProtoVersion ( ) ;
2005-09-26 03:40:09 +00:00
2005-05-17 02:36:54 +00:00
if ( MSG_ReadByte ( ) > MAX_CLIENTS )
2004-08-23 00:15:46 +00:00
{
2006-01-28 19:04:13 +00:00
Con_Printf ( " \n Warning, this server supports more than %i clients, additional clients will do bad things \n " , MAX_CLIENTS ) ;
2004-08-23 00:15:46 +00:00
}
cl . splitclients = 1 ;
2008-11-09 22:29:28 +00:00
gametype = MSG_ReadByte ( ) ;
2004-08-23 00:15:46 +00:00
str = MSG_ReadString ( ) ;
Q_strncpyz ( cl . levelname , str , sizeof ( cl . levelname ) ) ;
// seperate the printfs so the server message can have a color
2012-11-27 03:23:19 +00:00
# if 1
Con_Printf ( " \n \n " ) ;
Con_Printf ( " ^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f " ) ;
Con_Printf ( " \n \n " ) ;
Con_Printf ( " \1 %s \n " , str ) ;
# else
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " \n \n ^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f \n \n " ) ;
Con_Printf ( " %c%s \n " , 2 , str ) ;
2012-11-27 03:23:19 +00:00
# endif
2004-08-23 00:15:46 +00:00
SCR_BeginLoadingPlaque ( ) ;
2014-10-05 20:04:11 +00:00
Surf_PreNewMap ( ) ;
2004-08-23 00:15:46 +00:00
memset ( cl . model_name , 0 , sizeof ( cl . model_name ) ) ;
for ( nummodels = 1 ; ; nummodels + + )
{
str = MSG_ReadString ( ) ;
if ( ! str [ 0 ] )
break ;
2014-09-17 03:04:08 +00:00
if ( nummodels = = MAX_PRECACHE_MODELS )
2004-08-23 00:15:46 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Server sent too many model precaches \n " ) ;
2004-08-23 00:15:46 +00:00
return ;
}
strcpy ( cl . model_name [ nummodels ] , str ) ;
2013-03-12 23:24:15 +00:00
if ( * str ! = ' * ' & & strcmp ( str , " null " ) ) //not inline models!
2011-10-27 15:46:36 +00:00
CL_CheckOrEnqueDownloadFile ( str , NULL , ( ( nummodels = = 1 ) ? DLLF_REQUIRED : 0 ) ) ;
2004-08-23 00:15:46 +00:00
Mod_TouchModel ( str ) ;
}
memset ( cl . sound_name , 0 , sizeof ( cl . sound_name ) ) ;
for ( numsounds = 1 ; ; numsounds + + )
{
2005-09-26 03:40:09 +00:00
str = MSG_ReadString ( ) ;
2004-08-23 00:15:46 +00:00
if ( ! str [ 0 ] )
break ;
2014-09-17 03:04:08 +00:00
if ( numsounds = = MAX_PRECACHE_SOUNDS )
2004-08-23 00:15:46 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Server sent too many sound precaches \n " ) ;
2004-08-23 00:15:46 +00:00
return ;
}
strcpy ( cl . sound_name [ numsounds ] , str ) ;
2008-12-03 02:42:05 +00:00
2013-03-12 23:24:15 +00:00
Sound_CheckDownload ( str ) ;
2004-08-23 00:15:46 +00:00
S_TouchSound ( str ) ;
}
2008-11-09 22:29:28 +00:00
cls . signon = 0 ;
cls . state = ca_onserver ;
2004-08-23 00:15:46 +00:00
2008-11-09 22:29:28 +00:00
//fill in the csqc stuff
2009-03-03 01:52:30 +00:00
if ( ! cl_dp_csqc_progscrc )
{
Info_RemoveKey ( cl . serverinfo , " *csprogs " ) ;
Info_RemoveKey ( cl . serverinfo , " *csprogssize " ) ;
Info_RemoveKey ( cl . serverinfo , " *csprogsname " ) ;
}
else
{
Info_SetValueForStarKey ( cl . serverinfo , " *csprogs " , va ( " %i " , cl_dp_csqc_progscrc ) , sizeof ( cl . serverinfo ) ) ;
Info_SetValueForStarKey ( cl . serverinfo , " *csprogssize " , va ( " %i " , cl_dp_csqc_progssize ) , sizeof ( cl . serverinfo ) ) ;
2009-11-04 21:16:50 +00:00
Info_SetValueForStarKey ( cl . serverinfo , " *csprogsname " , va ( " %s " , cl_dp_csqc_progsname ) , sizeof ( cl . serverinfo ) ) ;
2009-03-03 01:52:30 +00:00
}
2004-08-23 00:15:46 +00:00
2008-11-09 22:29:28 +00:00
//update gamemode
2013-03-12 22:53:23 +00:00
if ( gametype ! = GAME_COOP )
2008-11-09 22:29:28 +00:00
Info_SetValueForStarKey ( cl . serverinfo , " deathmatch " , " 1 " , sizeof ( cl . serverinfo ) ) ;
else
Info_SetValueForStarKey ( cl . serverinfo , " deathmatch " , " 0 " , sizeof ( cl . serverinfo ) ) ;
Info_SetValueForStarKey ( cl . serverinfo , " teamplay " , " 0 " , sizeof ( cl . serverinfo ) ) ;
2004-08-23 00:15:46 +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
//allow some things by default that quakeworld bans by default
Info_SetValueForStarKey ( cl . serverinfo , " watervis " , " 1 " , sizeof ( cl . serverinfo ) ) ;
2011-09-03 03:49:43 +00:00
Info_SetValueForStarKey ( cl . serverinfo , " mirrors " , " 1 " , sizeof ( cl . serverinfo ) ) ;
//prohibit some things that QW/FTE has enabled by default
Info_SetValueForStarKey ( cl . serverinfo , " fbskins " , " 0 " , sizeof ( cl . serverinfo ) ) ;
2005-05-19 02:53:03 +00:00
2008-11-09 22:29:28 +00:00
//pretend it came from the server, and update cheat/permissions/etc
CL_CheckServerInfo ( ) ;
2004-08-23 00:15:46 +00:00
2010-12-23 08:53:23 +00:00
# if _MSC_VER > 1200
2010-12-05 02:46:07 +00:00
Sys_RecentServer ( " +nqconnect " , cls . servername , cls . servername , " Join NQ Server " ) ;
2010-12-23 08:53:23 +00:00
# endif
2010-12-05 02:46:07 +00:00
2009-07-18 20:46:42 +00:00
# ifdef PEXT_CSQC
2008-11-09 22:29:28 +00:00
CSQC_Shutdown ( ) ;
2012-10-13 00:56:31 +00:00
CSQC_Init ( cls . demoplayback , false , 0 ) ;
2009-07-18 20:46:42 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
void CLNQ_SignonReply ( void )
2005-02-28 07:16:19 +00:00
{
2004-08-23 00:15:46 +00:00
extern cvar_t topcolor ;
extern cvar_t bottomcolor ;
2005-10-01 03:09:17 +00:00
extern cvar_t rate ;
extern cvar_t model ;
extern cvar_t skin ;
2004-08-23 00:15:46 +00:00
Con_DPrintf ( " CL_SignonReply: %i \n " , cls . signon ) ;
switch ( cls . signon )
{
case 1 :
2007-06-20 00:02:54 +00:00
cl . sendprespawn = true ;
2014-10-05 20:04:11 +00:00
SCR_SetLoadingFile ( " loading data " ) ;
2011-01-29 22:24:19 +00:00
CL_RequestNextDownload ( ) ;
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
case 2 :
2005-03-23 22:14:08 +00:00
CL_SendClientCommand ( true , " name \" %s \" \n " , name . string ) ;
2005-09-26 03:40:09 +00:00
2009-11-04 21:16:50 +00:00
CL_SendClientCommand ( true , " color %i %i \n " , topcolor . ival , bottomcolor . ival ) ;
2005-09-26 03:40:09 +00:00
2005-03-23 22:14:08 +00:00
CL_SendClientCommand ( true , " spawn %s " , " " ) ;
2005-10-01 03:09:17 +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
if ( CPNQ_IS_DP ) //dp needs a couple of extras to work properly.
2005-10-01 03:09:17 +00:00
{
CL_SendClientCommand ( true , " rate %s " , rate . string ) ;
CL_SendClientCommand ( true , " playermodel %s " , model . string ) ;
CL_SendClientCommand ( true , " playerskin %s " , skin . string ) ;
2015-02-02 08:01:53 +00:00
/*
2009-07-18 20:46:42 +00:00
# ifdef PEXT_CSQC
2007-06-20 00:02:54 +00:00
{
char * s ;
s = Info_ValueForKey ( cl . serverinfo , " *csprogs " ) ;
2012-10-13 00:56:31 +00:00
CSQC_Init ( false , * s ? true : false , atoi ( s ) ) ;
2007-06-20 00:02:54 +00:00
}
2009-07-18 20:46:42 +00:00
# endif
2015-02-02 08:01:53 +00:00
*/
2005-10-01 03:09:17 +00:00
}
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
case 3 :
2005-03-23 22:14:08 +00:00
CL_SendClientCommand ( true , " begin " ) ;
2004-08-23 04:43:03 +00:00
# ifdef VM_CG
2004-08-23 00:15:46 +00:00
CG_Start ( ) ;
2004-08-23 04:43:03 +00:00
# endif
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case 4 :
2005-09-26 03:40:09 +00:00
SCR_EndLoadingPlaque ( ) ; // allow normal screen updates
2009-04-19 00:50:42 +00:00
SCR_SetLoadingStage ( LS_NONE ) ;
2004-08-23 00:15:46 +00:00
break ;
}
}
# define DEFAULT_VIEWHEIGHT 22
2005-09-26 03:40:09 +00:00
void CLNQ_ParseClientdata ( void )
2004-08-23 00:15:46 +00:00
{
2004-12-05 08:19:54 +00:00
int i ;
2014-08-19 06:08:23 +00:00
player_state_t * pl = & cl . inframes [ cl . validsequence & UPDATE_MASK ] . playerstate [ cl . playerview [ 0 ] . playernum ] ;
2004-11-27 08:16:25 +00:00
2005-09-26 03:40:09 +00:00
unsigned int bits ;
2006-02-12 20:20:01 +00:00
bits = ( unsigned short ) MSG_ReadShort ( ) ;
2004-11-27 08:16:25 +00:00
2013-03-12 22:36:18 +00:00
if ( bits & SU_EXTEND1 )
2004-11-27 08:16:25 +00:00
bits | = ( MSG_ReadByte ( ) < < 16 ) ;
2013-03-12 22:36:18 +00:00
if ( bits & SU_EXTEND2 )
2004-11-27 08:16:25 +00:00
bits | = ( MSG_ReadByte ( ) < < 24 ) ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
if ( bits & SU_VIEWHEIGHT )
2008-05-25 22:23:43 +00:00
CL_SetStatInt ( 0 , STAT_VIEWHEIGHT , MSG_ReadChar ( ) ) ;
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 if ( CPNQ_IS_DP | | cls . protocol_nq = = CPNQ_DP5 )
2008-05-25 22:23:43 +00:00
CL_SetStatInt ( 0 , STAT_VIEWHEIGHT , DEFAULT_VIEWHEIGHT ) ;
2004-08-23 00:15:46 +00:00
if ( bits & SU_IDEALPITCH )
/*cl.idealpitch =*/ MSG_ReadChar ( ) ;
/*else
cl . idealpitch = 0 ; */
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
if ( bits & ( SU_PUNCH1 < < i ) )
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
/*cl.punchangle[i] =*/ CPNQ_IS_DP ? MSG_ReadAngle16 ( ) : MSG_ReadChar ( ) ;
2004-08-23 00:15:46 +00:00
// else
// cl.punchangle[i] = 0;
2004-11-27 08:16:25 +00:00
2013-03-12 22:36:18 +00:00
if ( CPNQ_IS_DP & & bits & ( DPSU_PUNCHVEC1 < < i ) )
2004-11-27 08:16:25 +00:00
{
/*cl.punchvector[i] =*/ MSG_ReadCoord ( ) ;
}
// else
// cl.punchvector[i] = 0;
2014-08-19 06:08:23 +00:00
if ( bits & ( SU_VELOCITY1 < < i ) )
2004-11-27 08:16:25 +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
if ( CPNQ_IS_DP )
2014-08-19 06:08:23 +00:00
pl - > velocity [ i ] = MSG_ReadFloat ( ) ;
2004-11-27 08:16:25 +00:00
else
2014-08-19 06:08:23 +00:00
pl - > velocity [ i ] = MSG_ReadChar ( ) * 16 ;
2004-11-27 08:16:25 +00:00
}
2014-08-19 06:08:23 +00:00
else
pl - > velocity [ i ] = 0 ;
2004-08-23 00:15:46 +00:00
}
2014-08-16 19:03:04 +00:00
if ( ( bits & SU_ITEMS ) | | cls . protocol_nq = = CPNQ_ID ) //hipnotic bug - hipnotic demos don't always have SU_ITEMS set, yet they update STAT_ITEMS anyway.
2008-05-25 22:23:43 +00:00
CL_SetStatInt ( 0 , STAT_ITEMS , MSG_ReadLong ( ) ) ;
2004-08-23 00:15:46 +00:00
2014-08-19 06:08:23 +00:00
pl - > onground = ( bits & SU_ONGROUND ) ! = 0 ;
2004-08-23 00:15:46 +00:00
// cl.inwater = (bits & SU_INWATER) != 0;
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 ( cls . protocol_nq = = CPNQ_DP5 )
2004-12-05 08:19:54 +00:00
{
2008-05-25 22:23:43 +00:00
CL_SetStatInt ( 0 , STAT_WEAPONFRAME , ( bits & SU_WEAPONFRAME ) ? ( unsigned short ) MSG_ReadShort ( ) : 0 ) ;
CL_SetStatInt ( 0 , STAT_ARMOR , ( bits & SU_ARMOR ) ? MSG_ReadShort ( ) : 0 ) ;
2015-03-03 00:14:43 +00:00
CL_SetStatInt ( 0 , STAT_WEAPONMODELI , ( bits & SU_WEAPONMODEL ) ? MSG_ReadShort ( ) : 0 ) ;
2004-11-27 08:16:25 +00:00
2008-05-25 22:23:43 +00:00
CL_SetStatInt ( 0 , STAT_HEALTH , MSG_ReadShort ( ) ) ;
2004-11-27 08:16:25 +00:00
2008-05-25 22:23:43 +00:00
CL_SetStatInt ( 0 , STAT_AMMO , MSG_ReadShort ( ) ) ;
2004-11-27 08:16:25 +00:00
2008-05-25 22:23:43 +00:00
CL_SetStatInt ( 0 , STAT_SHELLS , MSG_ReadShort ( ) ) ;
CL_SetStatInt ( 0 , STAT_NAILS , MSG_ReadShort ( ) ) ;
CL_SetStatInt ( 0 , STAT_ROCKETS , MSG_ReadShort ( ) ) ;
CL_SetStatInt ( 0 , STAT_CELLS , MSG_ReadShort ( ) ) ;
2004-08-23 00:15:46 +00:00
2008-05-25 22:23:43 +00:00
CL_SetStatInt ( 0 , STAT_ACTIVEWEAPON , ( unsigned short ) MSG_ReadShort ( ) ) ;
2004-08-23 00:15:46 +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
else if ( CPNQ_IS_DP )
{
2012-02-12 05:18:31 +00:00
/*nothing in dp6+*/
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
}
2004-11-27 08:16:25 +00:00
else
2004-08-23 00:15:46 +00:00
{
2013-03-12 22:36:18 +00:00
int weaponmodel = 0 , armor = 0 , weaponframe = 0 , health = 0 , currentammo = 0 , shells = 0 , nails = 0 , rockets = 0 , cells = 0 , activeweapon = 0 ;
2004-11-27 08:16:25 +00:00
2013-03-12 22:36:18 +00:00
if ( bits & SU_WEAPONFRAME ) weaponframe | = ( unsigned char ) MSG_ReadByte ( ) ;
if ( bits & SU_ARMOR ) armor | = ( unsigned char ) MSG_ReadByte ( ) ;
if ( bits & SU_WEAPONMODEL ) weaponmodel | = ( unsigned char ) MSG_ReadByte ( ) ;
health | = MSG_ReadShort ( ) ;
currentammo | = MSG_ReadByte ( ) ;
shells | = MSG_ReadByte ( ) ;
nails | = MSG_ReadByte ( ) ;
rockets | = MSG_ReadByte ( ) ;
cells | = MSG_ReadByte ( ) ;
activeweapon | = MSG_ReadByte ( ) ;
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 ( cls . protocol_nq = = CPNQ_FITZ666 )
{
2013-03-12 22:36:18 +00:00
if ( bits & FITZSU_WEAPONMODEL2 )
weaponmodel | = MSG_ReadByte ( ) < < 8 ;
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 ( bits & FITZSU_ARMOR2 )
2013-03-12 22:36:18 +00:00
armor | = MSG_ReadByte ( ) < < 8 ;
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 ( bits & FITZSU_AMMO2 )
2013-03-12 22:36:18 +00:00
currentammo | = MSG_ReadByte ( ) < < 8 ;
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 ( bits & FITZSU_SHELLS2 )
2013-03-12 22:36:18 +00:00
shells | = MSG_ReadByte ( ) < < 8 ;
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 ( bits & FITZSU_NAILS2 )
2013-03-12 22:36:18 +00:00
nails | = MSG_ReadByte ( ) < < 8 ;
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 ( bits & FITZSU_ROCKETS2 )
2013-03-12 22:36:18 +00:00
rockets | = MSG_ReadByte ( ) < < 8 ;
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 ( bits & FITZSU_CELLS2 )
2013-03-12 22:36:18 +00:00
cells | = MSG_ReadByte ( ) < < 8 ;
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 ( bits & FITZSU_WEAPONFRAME2 )
2013-03-12 22:36:18 +00:00
weaponframe | = MSG_ReadByte ( ) < < 8 ;
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 ( bits & FITZSU_WEAPONALPHA )
MSG_ReadByte ( ) ;
}
2013-03-12 22:36:18 +00:00
CL_SetStatInt ( 0 , STAT_WEAPONFRAME , weaponframe ) ;
CL_SetStatInt ( 0 , STAT_ARMOR , armor ) ;
2015-03-03 00:14:43 +00:00
CL_SetStatInt ( 0 , STAT_WEAPONMODELI , weaponmodel ) ;
2013-03-12 22:36:18 +00:00
CL_SetStatInt ( 0 , STAT_HEALTH , health ) ;
CL_SetStatInt ( 0 , STAT_AMMO , currentammo ) ;
CL_SetStatInt ( 0 , STAT_SHELLS , shells ) ;
CL_SetStatInt ( 0 , STAT_NAILS , nails ) ;
CL_SetStatInt ( 0 , STAT_ROCKETS , rockets ) ;
CL_SetStatInt ( 0 , STAT_CELLS , cells ) ;
CL_SetStatInt ( 0 , STAT_ACTIVEWEAPON , activeweapon ) ;
2004-08-23 00:15:46 +00:00
}
2004-11-27 08:16:25 +00:00
2012-02-12 05:18:31 +00:00
if ( CPNQ_IS_DP )
2004-11-27 08:16:25 +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
if ( bits & DPSU_VIEWZOOM )
{
if ( cls . protocol_nq )
i = ( unsigned short ) MSG_ReadShort ( ) ;
else
i = MSG_ReadByte ( ) ;
if ( i < 2 )
i = 2 ;
CL_SetStatInt ( 0 , STAT_VIEWZOOM , i ) ;
}
2004-11-27 08:16:25 +00:00
else
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
CL_SetStatInt ( 0 , STAT_VIEWZOOM , 255 ) ;
2004-11-27 08:16:25 +00:00
}
2004-08-23 00:15:46 +00:00
}
# endif
/*
= = = = = = = = = = = = = = = = = =
CL_ParseSoundlist
= = = = = = = = = = = = = = = = = =
*/
2008-11-28 20:34:51 +00:00
void CL_ParseSoundlist ( qboolean lots )
2004-08-23 00:15:46 +00:00
{
int numsounds ;
char * str ;
int n ;
// precache sounds
// memset (cl.sound_precache, 0, sizeof(cl.sound_precache));
2008-11-28 20:34:51 +00:00
if ( lots )
numsounds = MSG_ReadShort ( ) ;
else
numsounds = MSG_ReadByte ( ) ;
2004-08-23 00:15:46 +00:00
2005-02-28 07:16:19 +00:00
for ( ; ; )
{
2004-08-23 00:15:46 +00:00
str = MSG_ReadString ( ) ;
if ( ! str [ 0 ] )
break ;
numsounds + + ;
2014-09-17 03:04:08 +00:00
if ( numsounds > = MAX_PRECACHE_SOUNDS )
2004-08-23 00:15:46 +00:00
Host_EndGame ( " Server sent too many sound_precache " ) ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
// if (strlen(str)>4)
// if (!strcmp(str+strlen(str)-4, ".mp3")) //don't let the server send us a specific mp3. convert it to wav and this way we know not to look outside the quake path for it.
// strcpy(str+strlen(str)-4, ".wav");
2005-09-26 03:40:09 +00:00
strcpy ( cl . sound_name [ numsounds ] , str ) ;
2004-08-23 00:15:46 +00:00
}
n = MSG_ReadByte ( ) ;
2005-02-28 07:16:19 +00:00
if ( n )
{
2008-01-09 00:52:31 +00:00
if ( cls . demoplayback ! = DPB_EZTV )
{
if ( CL_RemoveClientCommands ( " soundlist " ) )
------------------------------------------------------------------------
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
Con_DPrintf ( " Multiple soundlists \n " ) ;
2008-01-09 00:52:31 +00:00
// CL_SendClientCommand("soundlist %i %i", cl.servercount, n);
2008-11-28 20:34:51 +00:00
CL_SendClientCommand ( true , soundlist_name , cl . servercount , ( numsounds & 0xff00 ) + n ) ;
2008-01-09 00:52:31 +00:00
}
2004-08-23 00:15:46 +00:00
return ;
}
2009-04-06 00:34:32 +00:00
# ifdef Q2CLIENT
if ( cls . protocol = = CP_QUAKE2 )
{
CL_AllowIndependantSendCmd ( false ) ; //stop it now, the indep stuff *could* require model tracing.
cl . sendprespawn = true ;
2014-10-05 20:04:11 +00:00
SCR_SetLoadingFile ( " loading data " ) ;
2009-04-06 00:34:32 +00:00
}
else
# endif
{
if ( cls . demoplayback = = DPB_EZTV )
{
if ( CL_RemoveClientCommands ( " qtvmodellist " ) )
------------------------------------------------------------------------
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
Con_DPrintf ( " Multiple modellists \n " ) ;
2009-04-06 00:34:32 +00:00
CL_SendClientCommand ( true , " qtvmodellist %i 0 " , cl . servercount ) ;
}
else
{
if ( CL_RemoveClientCommands ( " modellist " ) )
------------------------------------------------------------------------
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
Con_DPrintf ( " Multiple modellists \n " ) ;
2009-04-06 00:34:32 +00:00
// CL_SendClientCommand ("modellist %i 0", cl.servercount);
CL_SendClientCommand ( true , modellist_name , cl . servercount , 0 ) ;
}
}
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = = =
CL_ParseModellist
= = = = = = = = = = = = = = = = = =
*/
void CL_ParseModellist ( qboolean lots )
{
int nummodels ;
char * str ;
int n ;
// precache models and note certain default indexes
if ( lots )
nummodels = MSG_ReadShort ( ) ;
else
nummodels = MSG_ReadByte ( ) ;
for ( ; ; )
{
str = MSG_ReadString ( ) ;
if ( ! str [ 0 ] )
break ;
nummodels + + ;
2014-09-17 03:04:08 +00:00
if ( nummodels > = MAX_PRECACHE_MODELS )
2004-08-23 00:15:46 +00:00
Host_EndGame ( " Server sent too many model_precache " ) ;
strcpy ( cl . model_name [ nummodels ] , str ) ;
2013-11-21 23:02:28 +00:00
//qw has a special network protocol for spikes.
2004-08-23 00:15:46 +00:00
if ( ! strcmp ( cl . model_name [ nummodels ] , " progs/spike.mdl " ) )
cl_spikeindex = nummodels ;
if ( ! strcmp ( cl . model_name [ nummodels ] , " progs/player.mdl " ) )
cl_playerindex = nummodels ;
2013-10-08 14:28:11 +00:00
if ( * cl . model_name_vwep [ 0 ] & & ! strcmp ( cl . model_name [ nummodels ] , cl . model_name_vwep [ 0 ] ) & & cl_playerindex = = - 1 )
cl_playerindex = nummodels ;
2005-01-18 20:15:20 +00:00
if ( ! strcmp ( cl . model_name [ nummodels ] , " progs/h_player.mdl " ) )
cl_h_playerindex = nummodels ;
2004-08-23 00:15:46 +00:00
if ( ! strcmp ( cl . model_name [ nummodels ] , " progs/flag.mdl " ) )
cl_flagindex = nummodels ;
2005-01-17 17:40:21 +00:00
2013-11-21 23:02:28 +00:00
//rocket to grenade
2005-01-17 17:40:21 +00:00
if ( ! strcmp ( cl . model_name [ nummodels ] , " progs/missile.mdl " ) )
cl_rocketindex = nummodels ;
if ( ! strcmp ( cl . model_name [ nummodels ] , " progs/grenade.mdl " ) )
cl_grenadeindex = nummodels ;
2005-01-18 20:15:20 +00:00
2013-11-21 23:02:28 +00:00
//cl_gibfilter
2005-01-18 20:15:20 +00:00
if ( ! strcmp ( cl . model_name [ nummodels ] , " progs/gib1.mdl " ) )
cl_gib1index = nummodels ;
if ( ! strcmp ( cl . model_name [ nummodels ] , " progs/gib2.mdl " ) )
cl_gib2index = nummodels ;
if ( ! strcmp ( cl . model_name [ nummodels ] , " progs/gib3.mdl " ) )
cl_gib3index = nummodels ;
2004-08-23 00:15:46 +00:00
}
if ( nummodels )
SCR_ImageName ( cl . model_name [ 1 ] ) ;
n = MSG_ReadByte ( ) ;
2005-02-28 07:16:19 +00:00
if ( n )
{
2008-01-09 00:52:31 +00:00
if ( cls . demoplayback ! = DPB_EZTV )
{
if ( CL_RemoveClientCommands ( " modellist " ) )
------------------------------------------------------------------------
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
Con_DPrintf ( " Multiple modellists \n " ) ;
2008-01-09 00:52:31 +00:00
// CL_SendClientCommand("modellist %i %i", cl.servercount, n);
CL_SendClientCommand ( true , modellist_name , cl . servercount , ( nummodels & 0xff00 ) + n ) ;
}
2004-08-23 00:15:46 +00:00
return ;
}
2009-05-24 10:11:17 +00:00
Sound_CheckDownloads ( ) ;
2009-04-06 00:34:32 +00:00
Model_CheckDownloads ( ) ;
CL_AllowIndependantSendCmd ( false ) ; //stop it now, the indep stuff *could* require model tracing.
//set the flag to load models and send prespawn
cl . sendprespawn = true ;
2014-10-05 20:04:11 +00:00
SCR_SetLoadingFile ( " loading data " ) ;
2004-08-23 00:15:46 +00:00
}
void CL_ProcessUserInfo ( int slot , player_info_t * player ) ;
2006-05-28 21:56:04 +00:00
# ifdef Q2CLIENT
2004-08-23 00:15:46 +00:00
void CLQ2_ParseClientinfo ( int i , char * s )
{
2005-03-20 02:57:11 +00:00
char * model , * name ;
2004-08-23 00:15:46 +00:00
player_info_t * player ;
//s contains "name\model/skin"
player = & cl . players [ i ] ;
* player - > userinfo = ' \0 ' ;
model = strchr ( s , ' \\ ' ) ;
if ( model )
{
* model = ' \0 ' ;
model + + ;
name = s ;
}
else
{
name = " Unnammed " ;
model = " male " ;
}
2005-03-20 02:57:11 +00:00
#if 0
2004-08-23 00:15:46 +00:00
skin = strchr ( model , ' / ' ) ;
if ( skin )
{
* skin = ' \0 ' ;
skin + + ;
}
else
skin = " " ;
Info_SetValueForKey ( player - > userinfo , " model " , model , MAX_INFO_STRING ) ;
Info_SetValueForKey ( player - > userinfo , " skin " , skin , MAX_INFO_STRING ) ;
2005-03-20 02:57:11 +00:00
# else
2013-07-13 12:14:32 +00:00
Info_SetValueForKey ( player - > userinfo , " skin " , model , sizeof ( player - > userinfo ) ) ;
2005-03-20 02:57:11 +00:00
# endif
2013-07-13 12:14:32 +00:00
Info_SetValueForKey ( player - > userinfo , " name " , name , sizeof ( player - > userinfo ) ) ;
2005-03-20 02:57:11 +00:00
cl . players [ i ] . userid = i ;
2007-07-23 18:52:11 +00:00
cl . players [ i ] . rbottomcolor = 1 ;
cl . players [ i ] . rtopcolor = 1 ;
2004-08-23 00:15:46 +00:00
CL_ProcessUserInfo ( i , player ) ;
}
void CLQ2_ParseConfigString ( void )
{
int i ;
char * s ;
// char olds[MAX_QPATH];
i = MSG_ReadShort ( ) ;
if ( i < 0 | | i > = Q2MAX_CONFIGSTRINGS )
Host_EndGame ( " configstring > Q2MAX_CONFIGSTRINGS " ) ;
s = MSG_ReadString ( ) ;
// strncpy (olds, cl.configstrings[i], sizeof(olds));
// olds[sizeof(olds) - 1] = 0;
// strcpy (cl.configstrings[i], s);
2005-09-26 03:40:09 +00:00
// do something apropriate
2004-08-23 00:15:46 +00:00
if ( i = = Q2CS_SKY )
{
Q_strncpyz ( cl . skyname , s , sizeof ( cl . skyname ) ) ;
}
2005-10-16 03:53:31 +00:00
else if ( i = = Q2CS_SKYAXIS )
{
s = COM_Parse ( s ) ;
2006-01-09 01:49:06 +00:00
if ( s )
{
cl . skyaxis [ 0 ] = atof ( com_token ) ;
s = COM_Parse ( s ) ;
if ( s )
{
cl . skyaxis [ 1 ] = atof ( com_token ) ;
s = COM_Parse ( s ) ;
if ( s )
cl . skyaxis [ 2 ] = atof ( com_token ) ;
}
}
2005-10-16 03:53:31 +00:00
}
else if ( i = = Q2CS_SKYROTATE )
cl . skyrotate = atof ( s ) ;
2004-08-23 00:15:46 +00:00
else if ( i = = Q2CS_STATUSBAR )
{
Q_strncpyz ( cl . q2statusbar , s , sizeof ( cl . q2statusbar ) ) ;
}
else if ( i > = Q2CS_LIGHTS & & i < Q2CS_LIGHTS + Q2MAX_LIGHTSTYLES )
{
2014-06-25 03:53:11 +00:00
R_UpdateLightStyle ( i , s , 1 , 1 , 1 ) ;
2004-08-23 00:15:46 +00:00
}
else if ( i = = Q2CS_CDTRACK )
{
2015-03-03 00:14:43 +00:00
Media_BackgroundTrack ( s , NULL ) ;
2004-08-23 00:15:46 +00:00
}
else if ( i > = Q2CS_MODELS & & i < Q2CS_MODELS + Q2MAX_MODELS )
{
2015-03-03 00:14:43 +00:00
Q_strncpyz ( cl . model_name [ i - Q2CS_MODELS ] , s , MAX_QPATH ) ;
if ( cl . model_name [ i - Q2CS_MODELS ] [ 0 ] = = ' # ' )
2004-08-23 00:15:46 +00:00
{
2015-03-03 00:14:43 +00:00
if ( cl . numq2visibleweapons < Q2MAX_VISIBLE_WEAPONS )
2006-04-11 20:09:39 +00:00
{
2015-03-03 00:14:43 +00:00
cl . q2visibleweapons [ cl . numq2visibleweapons ] = cl . model_name [ i - Q2CS_MODELS ] + 1 ;
cl . numq2visibleweapons + + ;
2006-04-11 20:09:39 +00:00
}
2015-03-03 00:14:43 +00:00
cl . model_precache [ i - Q2CS_MODELS ] = NULL ;
2004-08-23 00:15:46 +00:00
}
2015-03-03 00:14:43 +00:00
else
cl . model_precache [ i - Q2CS_MODELS ] = Mod_ForName ( cl . model_name [ i - Q2CS_MODELS ] , MLV_WARN ) ;
2004-08-23 00:15:46 +00:00
}
2015-03-03 00:14:43 +00:00
else if ( i > = Q2CS_SOUNDS & & i < Q2CS_SOUNDS + Q2MAX_SOUNDS )
2004-08-23 00:15:46 +00:00
{
Q_strncpyz ( cl . sound_name [ i - Q2CS_SOUNDS ] , s , MAX_QPATH ) ;
2015-03-03 00:14:43 +00:00
cl . sound_precache [ i - Q2CS_SOUNDS ] = S_PrecacheSound ( s ) ;
2004-08-23 00:15:46 +00:00
}
2015-03-03 00:14:43 +00:00
else if ( i > = Q2CS_IMAGES & & i < Q2CS_IMAGES + Q2MAX_IMAGES )
{
Z_Free ( cl . image_name [ i - Q2CS_IMAGES ] ) ;
cl . image_name [ i - Q2CS_IMAGES ] = Z_StrDup ( s ) ;
}
else if ( i > = Q2CS_ITEMS & & i < Q2CS_ITEMS + Q2MAX_ITEMS )
{
Z_Free ( cl . item_name [ i - Q2CS_ITEMS ] ) ;
cl . item_name [ i - Q2CS_ITEMS ] = Z_StrDup ( s ) ;
2004-08-23 00:15:46 +00:00
}
else if ( i > = Q2CS_PLAYERSKINS & & i < Q2CS_PLAYERSKINS + Q2MAX_CLIENTS )
{
2015-03-03 00:14:43 +00:00
CLQ2_ParseClientinfo ( i - Q2CS_PLAYERSKINS , s ) ;
2004-08-23 00:15:46 +00:00
}
2006-04-08 05:43:53 +00:00
else if ( i = = Q2CS_MAPCHECKSUM )
{
extern int map_checksum ;
int serverchecksum = atoi ( s ) ;
if ( cl . worldmodel & & ( cl . worldmodel - > fromgame = = fg_quake2 | | cl . worldmodel - > fromgame = = fg_quake3 ) )
{
// the Q2 client normally exits here, however for our purposes we might as well ignore it
if ( map_checksum ! = serverchecksum )
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_WARNING " WARNING: Client checksum does not match server checksum (%i != %i) " , map_checksum , serverchecksum ) ;
2006-04-08 05:43:53 +00:00
}
}
2004-08-23 00:15:46 +00:00
2005-09-09 23:40:55 +00:00
# ifdef VM_UI
2004-08-23 00:15:46 +00:00
UI_StringChanged ( i ) ;
2005-09-09 23:40:55 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
2006-05-28 21:56:04 +00:00
# endif
2004-08-23 00:15:46 +00:00
2006-07-24 04:24:41 +00:00
qboolean CL_CheckBaselines ( int size )
{
int i ;
if ( size < 0 )
return false ;
if ( size > MAX_EDICTS )
return false ;
size = ( size + 64 ) & ~ 63 ; // round up to next 64
2009-03-03 01:52:30 +00:00
if ( size < = cl_baselines_count )
2006-07-24 04:24:41 +00:00
return true ;
2010-12-23 08:53:23 +00:00
cl_baselines = BZ_Realloc ( cl_baselines , sizeof ( * cl_baselines ) * size ) ;
2006-07-24 04:24:41 +00:00
for ( i = cl_baselines_count ; i < size ; i + + )
{
memcpy ( cl_baselines + i , & nullentitystate , sizeof ( * cl_baselines ) ) ;
}
cl_baselines_count = size ;
return true ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = =
CL_ParseBaseline
= = = = = = = = = = = = = = = = = =
*/
void CL_ParseBaseline ( entity_state_t * es )
{
int i ;
2006-02-27 00:42:25 +00:00
memcpy ( es , & nullentitystate , sizeof ( entity_state_t ) ) ;
2005-09-26 03:40:09 +00:00
2006-02-27 00:42:25 +00:00
es - > modelindex = MSG_ReadByte ( ) ;
2004-08-23 00:15:46 +00:00
es - > frame = MSG_ReadByte ( ) ;
es - > colormap = MSG_ReadByte ( ) ;
es - > skinnum = MSG_ReadByte ( ) ;
for ( i = 0 ; i < 3 ; i + + )
{
es - > origin [ i ] = MSG_ReadCoord ( ) ;
es - > angles [ i ] = MSG_ReadAngle ( ) ;
}
}
void CL_ParseBaseline2 ( void )
{
2006-02-27 00:42:25 +00:00
entity_state_t es ;
2004-08-23 00:15:46 +00:00
2012-07-05 19:42:36 +00:00
if ( cls . fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS )
CLFTE_ParseBaseline ( & es , true ) ;
else
CLQW_ParseDelta ( & nullentitystate , & es , ( unsigned short ) MSG_ReadShort ( ) , true ) ;
2006-07-24 04:24:41 +00:00
if ( ! CL_CheckBaselines ( es . number ) )
Host_EndGame ( " CL_ParseBaseline2: check baselines failed with size %i " , es . number ) ;
memcpy ( cl_baselines + es . number , & es , sizeof ( es ) ) ;
2004-08-23 00:15:46 +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
void CLFitz_ParseBaseline2 ( entity_state_t * es )
{
int i ;
int bits ;
memcpy ( es , & nullentitystate , sizeof ( entity_state_t ) ) ;
bits = MSG_ReadByte ( ) ;
------------------------------------------------------------------------
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
es - > modelindex = ( bits & FITZ_B_LARGEMODEL ) ? MSG_ReadShort ( ) : MSG_ReadByte ( ) ;
es - > frame = ( bits & FITZ_B_LARGEFRAME ) ? MSG_ReadShort ( ) : MSG_ReadByte ( ) ;
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
es - > colormap = MSG_ReadByte ( ) ;
es - > skinnum = MSG_ReadByte ( ) ;
for ( i = 0 ; i < 3 ; i + + )
{
es - > origin [ i ] = MSG_ReadCoord ( ) ;
es - > angles [ i ] = MSG_ReadAngle ( ) ;
}
------------------------------------------------------------------------
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
es - > trans = ( bits & FITZ_B_ALPHA ) ? MSG_ReadByte ( ) : 255 ;
es - > scale = ( bits & RMQFITZ_B_SCALE ) ? MSG_ReadByte ( ) : 16 ;
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
}
2004-08-23 00:15:46 +00:00
void CLQ2_Precache_f ( void )
{
2009-04-06 00:34:32 +00:00
Model_CheckDownloads ( ) ;
Sound_CheckDownloads ( ) ;
cl . contentstage = 0 ;
2006-01-06 23:58:32 +00:00
cl . sendprespawn = true ;
2014-10-05 20:04:11 +00:00
SCR_SetLoadingFile ( " loading data " ) ;
2009-04-06 00:34:32 +00:00
2004-08-23 00:15:46 +00:00
# ifdef VM_CG
CG_Start ( ) ;
# endif
}
/*
= = = = = = = = = = = = = = = = = = = = =
CL_ParseStatic
Static entities are non - interactive world objects
like torches
= = = = = = = = = = = = = = = = = = = = =
*/
void CL_ParseStatic ( int version )
{
entity_t * ent ;
int i ;
2006-02-27 00:42:25 +00:00
entity_state_t es ;
2010-07-11 02:22:39 +00:00
vec3_t mins , maxs ;
2004-08-23 00:15:46 +00:00
2013-07-26 17:19:06 +00:00
if ( version = = 3 )
{
CLFitz_ParseBaseline2 ( & es ) ;
i = cl . num_statics ;
cl . num_statics + + ;
}
else if ( version = = 1 )
2004-08-23 00:15:46 +00:00
{
2013-07-26 17:19:06 +00:00
//old nq/qw style
2004-08-23 00:15:46 +00:00
CL_ParseBaseline ( & es ) ;
i = cl . num_statics ;
cl . num_statics + + ;
}
2013-07-26 17:19:06 +00:00
else if ( version = = 2 )
2004-08-23 00:15:46 +00:00
{
2013-07-26 17:19:06 +00:00
//new deltaed style ('full' extension support)
2012-07-05 19:42:36 +00:00
if ( cls . fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS )
CLFTE_ParseBaseline ( & es , false ) ;
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
CLQW_ParseDelta ( & nullentitystate , & es , ( unsigned short ) MSG_ReadShort ( ) , true ) ;
2004-08-23 00:15:46 +00:00
2012-09-30 05:52:03 +00:00
if ( ! es . number )
i = cl . num_statics + + ;
else
{
es . number + = MAX_EDICTS ;
2004-08-23 00:15:46 +00:00
2012-09-30 05:52:03 +00:00
for ( i = 0 ; i < cl . num_statics ; i + + )
if ( cl_static_entities [ i ] . ent . keynum = = es . number )
{
pe - > DelinkTrailstate ( & cl_static_entities [ i ] . emit ) ;
break ;
}
if ( i = = cl . num_statics )
cl . num_statics + + ;
}
2004-08-23 00:15:46 +00:00
}
2013-07-26 17:19:06 +00:00
else
return ;
2005-09-26 03:40:09 +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
if ( i = = cl_max_static_entities )
2004-08-23 00:15:46 +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
cl_max_static_entities + = 16 ;
cl_static_entities = BZ_Realloc ( cl_static_entities , sizeof ( * cl_static_entities ) * cl_max_static_entities ) ;
2004-08-23 00:15:46 +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
cl_static_entities [ i ] . mdlidx = es . modelindex ;
cl_static_entities [ i ] . emit = NULL ;
2014-10-05 20:04:11 +00:00
cl_static_entities [ i ] . state = es ;
2010-07-11 02:22:39 +00:00
ent = & cl_static_entities [ i ] . 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
V_ClearEntity ( ent ) ;
2012-11-27 03:23:19 +00:00
memset ( & cl_static_entities [ i ] . pvscache , 0 , sizeof ( cl_static_entities [ i ] . pvscache ) ) ;
2004-08-23 00:15:46 +00:00
ent - > keynum = es . number ;
// copy it to the current state
ent - > model = cl . model_precache [ es . modelindex ] ;
2015-02-07 22:34:22 +00:00
memset ( & ent - > framestate , 0 , sizeof ( ent - > framestate ) ) ;
2008-12-23 02:55:20 +00:00
ent - > framestate . g [ FS_REG ] . frame [ 0 ] = ent - > framestate . g [ FS_REG ] . frame [ 1 ] = es . frame ;
2015-02-07 22:34:22 +00:00
ent - > framestate . g [ FS_REG ] . lerpweight [ 0 ] = 1 ;
2004-08-23 00:15:46 +00:00
ent - > skinnum = es . skinnum ;
2005-05-15 18:49:04 +00:00
ent - > drawflags = es . hexen2flags ;
2004-08-23 00:15:46 +00:00
# ifdef PEXT_SCALE
2005-07-01 19:23:00 +00:00
ent - > scale = es . scale / 16.0 ;
2004-08-23 00:15:46 +00:00
# endif
2012-02-12 05:18:31 +00:00
ent - > shaderRGBAf [ 0 ] = ( 8.0f / 256.0f ) * es . colormod [ 0 ] ;
ent - > shaderRGBAf [ 1 ] = ( 8.0f / 256.0f ) * es . colormod [ 1 ] ;
ent - > shaderRGBAf [ 2 ] = ( 8.0f / 256.0f ) * es . colormod [ 2 ] ;
ent - > shaderRGBAf [ 3 ] = es . trans / 255.0f ;
2006-02-27 00:42:25 +00:00
2009-07-05 18:45:53 +00:00
ent - > fatness = es . fatness / 16.0 ;
2004-08-23 00:15:46 +00:00
ent - > abslight = es . abslight ;
------------------------------------------------------------------------
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
ent - > flags = 0 ;
if ( es . dpflags & RENDER_VIEWMODEL )
2014-03-31 17:06:41 +00:00
ent - > flags | = RF_WEAPONMODEL | Q2RF_MINLIGHT | RF_DEPTHHACK ;
------------------------------------------------------------------------
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 ( es . dpflags & RENDER_EXTERIORMODEL )
2014-03-31 17:06:41 +00:00
ent - > flags | = RF_EXTERNALMODEL ;
2012-02-12 05:18:31 +00:00
if ( es . effects & NQEF_ADDITIVE )
2014-03-31 17:06:41 +00:00
ent - > flags | = RF_ADDITIVE ;
2012-02-12 05:18:31 +00:00
if ( es . effects & EF_NODEPTHTEST )
ent - > flags | = RF_NODEPTHTEST ;
if ( es . effects & DPEF_NOSHADOW )
ent - > flags | = RF_NOSHADOW ;
if ( es . trans ! = 0xff )
2014-03-31 17:06:41 +00:00
ent - > flags | = RF_TRANSLUCENT ;
2012-02-12 05:18:31 +00:00
2004-08-23 00:15:46 +00:00
VectorCopy ( es . origin , ent - > origin ) ;
VectorCopy ( es . angles , ent - > angles ) ;
2004-11-17 17:58:22 +00:00
es . angles [ 0 ] * = - 1 ;
AngleVectors ( es . angles , ent - > axis [ 0 ] , ent - > axis [ 1 ] , ent - > axis [ 2 ] ) ;
2004-11-22 00:00:54 +00:00
VectorInverse ( ent - > axis [ 1 ] ) ;
2004-08-23 00:15:46 +00:00
2014-10-05 20:04:11 +00:00
if ( ! cl . worldmodel | | cl . worldmodel - > loadstate ! = MLS_LOADED )
2004-08-23 00:15:46 +00:00
return ;
2010-07-11 02:22:39 +00:00
if ( ent - > model )
{
2015-01-08 13:09:20 +00:00
//FIXME: wait for model to load so we know the correct size?
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
/*FIXME: compensate for angle*/
2010-07-11 02:22:39 +00:00
VectorAdd ( es . origin , ent - > model - > mins , mins ) ;
VectorAdd ( es . origin , ent - > model - > maxs , maxs ) ;
}
2012-11-27 03:23:19 +00:00
else
{
VectorCopy ( es . origin , mins ) ;
VectorCopy ( es . origin , maxs ) ;
}
cl . worldmodel - > funcs . FindTouchedLeafs ( cl . worldmodel , & cl_static_entities [ i ] . pvscache , mins , maxs ) ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = = = =
CL_ParseStaticSound
= = = = = = = = = = = = = = = = = = =
*/
2012-11-27 03:23:19 +00:00
void CL_ParseStaticSound ( qboolean large )
2004-08-23 00:15:46 +00:00
{
2005-01-13 16:29:20 +00:00
extern cvar_t cl_staticsounds ;
2004-08-23 00:15:46 +00:00
vec3_t org ;
int sound_num , vol , atten ;
int i ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 3 ; i + + )
org [ i ] = MSG_ReadCoord ( ) ;
2012-11-27 03:23:19 +00:00
if ( large )
sound_num = ( unsigned short ) MSG_ReadShort ( ) ;
else
sound_num = MSG_ReadByte ( ) ;
2004-08-23 00:15:46 +00:00
vol = MSG_ReadByte ( ) ;
atten = MSG_ReadByte ( ) ;
2005-01-13 16:29:20 +00:00
2009-11-04 21:16:50 +00:00
vol * = cl_staticsounds . value ;
if ( vol < 0 )
2005-01-13 16:29:20 +00:00
return ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
S_StaticSound ( cl . sound_precache [ sound_num ] , org , vol , atten ) ;
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
ACTION MESSAGES
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
/*
= = = = = = = = = = = = = = = = = =
CL_ParseStartSoundPacket
= = = = = = = = = = = = = = = = = =
*/
------------------------------------------------------------------------
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
void CLQW_ParseStartSoundPacket ( void )
2004-08-23 00:15:46 +00:00
{
vec3_t pos ;
int channel , ent ;
int sound_num ;
int volume ;
2005-09-26 03:40:09 +00:00
float attenuation ;
2004-08-23 00:15:46 +00:00
int i ;
2005-09-26 03:40:09 +00:00
channel = MSG_ReadShort ( ) ;
2004-08-23 00:15:46 +00:00
if ( channel & SND_VOLUME )
volume = MSG_ReadByte ( ) ;
else
volume = DEFAULT_SOUND_PACKET_VOLUME ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
if ( channel & SND_ATTENUATION )
attenuation = MSG_ReadByte ( ) / 64.0 ;
else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
sound_num = MSG_ReadByte ( ) ;
for ( i = 0 ; i < 3 ; i + + )
pos [ i ] = MSG_ReadCoord ( ) ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
ent = ( channel > > 3 ) & 1023 ;
channel & = 7 ;
if ( ent > MAX_EDICTS )
Host_EndGame ( " CL_ParseStartSoundPacket: ent = %i " , ent ) ;
2005-09-26 03:40:09 +00:00
2005-08-03 23:14:59 +00:00
# ifdef PEXT_CSQC
2013-03-12 22:35:33 +00:00
if ( ! CSQC_StartSound ( ent , channel , cl . sound_name [ sound_num ] , pos , volume / 255.0 , attenuation , 100 ) )
2005-08-03 23:14:59 +00:00
# endif
2010-08-21 13:31:39 +00:00
{
if ( ! sound_num )
S_StopSound ( ent , channel ) ;
else
2012-02-27 12:23:15 +00:00
S_StartSound ( ent , channel , cl . sound_precache [ sound_num ] , pos , volume / 255.0 , attenuation , 0 , 0 ) ;
2010-08-21 13:31:39 +00:00
}
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
if ( ent = = cl . playerview [ 0 ] . playernum + 1 )
2005-06-04 04:20:20 +00:00
TP_CheckPickupSound ( cl . sound_name [ sound_num ] , pos ) ;
2004-08-23 00:15:46 +00:00
}
# ifdef Q2CLIENT
void CLQ2_ParseStartSoundPacket ( void )
{
vec3_t pos_v ;
float * pos ;
int channel , ent ;
int sound_num ;
float volume ;
2005-09-26 03:40:09 +00:00
float attenuation ;
2004-08-23 00:15:46 +00:00
int flags ;
float ofs ;
2014-10-05 20:04:11 +00:00
sfx_t * sfx ;
2004-08-23 00:15:46 +00:00
flags = MSG_ReadByte ( ) ;
sound_num = MSG_ReadByte ( ) ;
if ( flags & Q2SND_VOLUME )
volume = MSG_ReadByte ( ) / 255.0 ;
else
volume = Q2DEFAULT_SOUND_PACKET_VOLUME ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
if ( flags & Q2SND_ATTENUATION )
attenuation = MSG_ReadByte ( ) / 64.0 ;
else
2005-09-26 03:40:09 +00:00
attenuation = Q2DEFAULT_SOUND_PACKET_ATTENUATION ;
2004-08-23 00:15:46 +00:00
if ( flags & Q2SND_OFFSET )
ofs = MSG_ReadByte ( ) / 1000.0 ;
else
ofs = 0 ;
if ( flags & Q2SND_ENT )
{ // entity reletive
2005-09-26 03:40:09 +00:00
channel = MSG_ReadShort ( ) ;
2004-08-23 00:15:46 +00:00
ent = channel > > 3 ;
if ( ent > MAX_EDICTS )
Host_EndGame ( " CL_ParseStartSoundPacket: ent = %i " , ent ) ;
channel & = 7 ;
}
else
{
ent = 0 ;
channel = 0 ;
}
if ( flags & Q2SND_POS )
{ // positioned in space
MSG_ReadPos ( pos_v ) ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
pos = pos_v ;
}
else // use entity number
{
CL_GetNumberedEntityInfo ( ent , pos_v , NULL ) ;
pos = pos_v ;
// pos = NULL;
}
if ( ! cl . sound_precache [ sound_num ] )
return ;
2014-10-05 20:04:11 +00:00
sfx = cl . sound_precache [ sound_num ] ;
if ( sfx - > name [ 0 ] = = ' * ' )
2006-04-11 20:09:39 +00:00
{ //a 'sexed' sound
2014-10-05 20:04:11 +00:00
if ( ent > 0 & & ent < = MAX_CLIENTS )
2006-04-11 20:09:39 +00:00
{
2014-10-05 20:04:11 +00:00
char * model = Info_ValueForKey ( cl . players [ ent - 1 ] . userinfo , " skin " ) ;
char * skin ;
skin = strchr ( model , ' / ' ) ;
if ( skin )
* skin = ' \0 ' ;
if ( * model )
sfx = S_PrecacheSound ( va ( " players/%s/%s " , model , cl . sound_precache [ sound_num ] - > name + 1 ) ) ;
}
//fall back to male if it failed to load.
//note: threaded loading can still make it silent the first time we hear it.
if ( sfx - > loadstate = = SLS_FAILED )
sfx = S_PrecacheSound ( va ( " players/male/%s " , cl . sound_precache [ sound_num ] - > name + 1 ) ) ;
}
S_StartSound ( ent , channel , sfx , pos , volume , attenuation , ofs , 0 ) ;
2004-08-23 00:15:46 +00:00
}
# endif
2008-12-01 02:56:32 +00:00
# if defined(NQPROT) || defined(PEXT_SOUNDDBL)
2004-08-23 00:15:46 +00:00
void CLNQ_ParseStartSoundPacket ( void )
{
vec3_t pos ;
int channel , ent ;
int sound_num ;
int volume ;
int field_mask ;
2005-09-26 03:40:09 +00:00
float attenuation ;
2004-08-23 00:15:46 +00:00
int i ;
2010-11-06 23:05:29 +00:00
int pitchadj ;
2005-09-26 03:40:09 +00:00
field_mask = MSG_ReadByte ( ) ;
2004-08-23 00:15:46 +00:00
if ( field_mask & NQSND_VOLUME )
volume = MSG_ReadByte ( ) ;
else
volume = DEFAULT_SOUND_PACKET_VOLUME ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
if ( field_mask & NQSND_ATTENUATION )
attenuation = MSG_ReadByte ( ) / 64.0 ;
else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION ;
2005-09-26 03:40:09 +00:00
2010-11-06 23:05:29 +00:00
if ( field_mask & FTESND_PITCHADJ )
2010-11-06 23:54:36 +00:00
pitchadj = MSG_ReadByte ( ) ;
2010-11-06 23:05:29 +00:00
else
2010-11-06 23:54:36 +00:00
pitchadj = 100 ;
2010-11-06 23:05:29 +00:00
2008-11-09 22:29:28 +00:00
if ( field_mask & DPSND_LARGEENTITY )
{
------------------------------------------------------------------------
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
ent = MSGCL_ReadEntity ( ) ;
2008-11-09 22:29:28 +00:00
channel = MSG_ReadByte ( ) ;
}
else
{ //regular
channel = MSG_ReadShort ( ) ;
ent = channel > > 3 ;
channel & = 7 ;
}
2004-08-23 00:15:46 +00:00
2011-07-30 14:14:56 +00:00
/*unpack mangling*/
channel = ( channel & 7 ) | ( ( channel & 0x0f1 ) < < 1 ) ;
2008-11-09 22:29:28 +00:00
if ( field_mask & DPSND_LARGESOUND )
sound_num = ( unsigned short ) MSG_ReadShort ( ) ;
else
sound_num = MSG_ReadByte ( ) ;
2004-08-23 00:15:46 +00:00
if ( ent > MAX_EDICTS )
Host_EndGame ( " CL_ParseStartSoundPacket: ent = %i " , ent ) ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 3 ; i + + )
pos [ i ] = MSG_ReadCoord ( ) ;
2005-09-26 03:40:09 +00:00
2010-08-21 13:31:39 +00:00
# ifdef PEXT_CSQC
2013-03-12 22:35:33 +00:00
if ( ! CSQC_StartSound ( ent , channel , cl . sound_name [ sound_num ] , pos , volume / 255.0 , attenuation , pitchadj ) )
2010-08-21 13:31:39 +00:00
# endif
{
if ( ! sound_num )
S_StopSound ( ent , channel ) ;
else
2012-02-27 12:23:15 +00:00
S_StartSound ( ent , channel , cl . sound_precache [ sound_num ] , pos , volume / 255.0 , attenuation , 0 , pitchadj ) ;
2010-08-21 13:31:39 +00:00
}
2005-06-04 04:20:20 +00:00
2013-06-23 02:17:02 +00:00
if ( ent = = cl . playerview [ 0 ] . playernum + 1 )
2005-06-04 04:20:20 +00:00
TP_CheckPickupSound ( cl . sound_name [ sound_num ] , pos ) ;
2005-09-26 03:40:09 +00:00
}
2004-08-23 00:15:46 +00:00
# endif
/*
= = = = = = = = = = = = = = = = = =
CL_ParseClientdata
Server information pertaining to this client only , sent every frame
= = = = = = = = = = = = = = = = = =
*/
void CL_ParseClientdata ( void )
{
int i ;
// calculate simulated time of message
oldparsecountmod = parsecountmod ;
i = cls . netchan . incoming_acknowledged ;
2013-07-26 17:40:06 +00:00
# ifdef NQPROT
2013-07-26 17:19:06 +00:00
if ( cls . demoplayback = = DPB_NETQUAKE )
2013-07-26 17:40:06 +00:00
{
2013-07-26 17:19:06 +00:00
i = cls . netchan . incoming_sequence - 1 ;
2013-07-26 17:40:06 +00:00
cl . oldparsecount = i - 1 ;
oldparsecountmod = cl . oldparsecount & UPDATE_MASK ;
}
else
# endif
if ( cls . demoplayback = = DPB_MVD | | cls . demoplayback = = DPB_EZTV )
2012-01-24 04:24:14 +00:00
{
2004-08-27 00:48:03 +00:00
cl . oldparsecount = i - 1 ;
2012-01-24 04:24:14 +00:00
oldparsecountmod = cl . oldparsecount & UPDATE_MASK ;
}
2004-08-23 00:15:46 +00:00
cl . parsecount = i ;
i & = UPDATE_MASK ;
parsecountmod = i ;
2013-03-12 22:53:23 +00:00
parsecounttime = cl . outframes [ i ] . senttime ;
2004-08-23 00:15:46 +00:00
2013-07-26 17:19:06 +00:00
if ( cls . protocol = = CP_QUAKEWORLD )
2013-09-06 22:57:44 +00:00
CL_AckedInputFrame ( cls . netchan . incoming_sequence , cl . parsecount , false ) ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = = = = = =
CL_NewTranslation
= = = = = = = = = = = = = = = = = = = = =
*/
void CL_NewTranslation ( int slot )
{
int top , bottom ;
2014-09-08 23:47:19 +00:00
int local ;
2004-08-23 00:15:46 +00:00
2004-12-29 03:24:21 +00:00
char * s ;
player_info_t * player ;
2005-01-23 17:47:04 +00:00
if ( slot > = MAX_CLIENTS )
2006-03-12 22:01:49 +00:00
Host_Error ( " CL_NewTranslation: slot > MAX_CLIENTS " ) ;
2004-12-29 03:24:21 +00:00
player = & cl . players [ slot ] ;
2014-09-08 23:47:19 +00:00
if ( cls . protocol = = CP_QUAKE2 )
{
char * mod , * skin ;
player - > qwskin = NULL ;
player - > skinid = 0 ;
player - > model = NULL ;
player - > ttopcolor = TOP_DEFAULT ;
player - > tbottomcolor = BOTTOM_DEFAULT ;
mod = Info_ValueForKey ( player - > userinfo , " skin " ) ;
skin = strchr ( mod , ' / ' ) ;
if ( skin )
* skin + + = 0 ;
2015-03-03 00:14:43 +00:00
if ( ! skin | | ! * skin )
skin = " grunt " ;
if ( ! mod | | ! * mod )
mod = " male " ;
2014-09-08 23:47:19 +00:00
player - > model = Mod_ForName ( va ( " players/%s/tris.md2 " , mod ) , 0 ) ;
2015-03-03 00:14:43 +00:00
if ( player - > model - > loadstate = = MLS_FAILED & & strcmp ( mod , " male " ) )
{ //fall back on male if the model doesn't exist. yes, sexist.
mod = " male " ;
player - > model = Mod_ForName ( va ( " players/male/tris.md2 " , mod ) , 0 ) ;
}
2014-09-08 23:47:19 +00:00
player - > skinid = Mod_RegisterSkinFile ( va ( " players/%s/%s.skin " , mod , skin ) ) ;
if ( ! player - > skinid )
player - > skinid = Mod_ReadSkinFile ( va ( " players/%s/%s.skin " , mod , skin ) , va ( " replace \" \" \" players/%s/%s.pcx \" " , mod , skin ) ) ;
return ;
}
2004-12-29 03:24:21 +00:00
s = Skin_FindName ( player ) ;
2006-03-11 03:12:10 +00:00
COM_StripExtension ( s , s , MAX_QPATH ) ;
2014-09-08 23:47:19 +00:00
if ( player - > qwskin & & ! stricmp ( s , player - > qwskin - > name ) )
player - > qwskin = NULL ;
player - > skinid = 0 ;
player - > model = NULL ;
2004-12-29 03:24:21 +00:00
2007-07-23 18:52:11 +00:00
top = player - > rtopcolor ;
bottom = player - > rbottomcolor ;
if ( cl . splitclients < 2 & & ! ( cl . fpd & FPD_NO_FORCE_COLOR ) ) //no colour/skin forcing in splitscreen.
2004-08-23 00:15:46 +00:00
{
2007-07-23 18:52:11 +00:00
if ( cl . teamplay & & cl . spectator )
2004-09-26 00:30:42 +00:00
{
2013-06-23 02:17:02 +00:00
local = Cam_TrackNum ( & cl . playerview [ 0 ] ) ;
2007-07-23 18:52:11 +00:00
if ( local < 0 )
2013-06-23 02:17:02 +00:00
local = cl . playerview [ 0 ] . playernum ;
2004-09-26 00:30:42 +00:00
}
2007-07-23 18:52:11 +00:00
else
2013-06-23 02:17:02 +00:00
local = cl . playerview [ 0 ] . playernum ;
2009-04-01 22:03:56 +00:00
if ( ( cl . teamplay | | cls . protocol = = CP_NETQUAKE ) & & ! strcmp ( player - > team , cl . players [ local ] . team ) )
2007-07-23 18:52:11 +00:00
{
2008-06-01 22:06:22 +00:00
if ( cl_teamtopcolor ! = ~ 0 )
2007-07-23 18:52:11 +00:00
top = cl_teamtopcolor ;
2008-06-01 22:06:22 +00:00
if ( cl_teambottomcolor ! = ~ 0 )
2007-07-23 18:52:11 +00:00
bottom = cl_teambottomcolor ;
2008-06-05 07:45:34 +00:00
if ( player - > colourised )
{
if ( player - > colourised - > topcolour ! = ~ 0 )
top = player - > colourised - > topcolour ;
if ( player - > colourised - > bottomcolour ! = ~ 0 )
bottom = player - > colourised - > bottomcolour ;
}
2007-07-23 18:52:11 +00:00
}
else
{
2008-06-01 22:06:22 +00:00
if ( cl_enemytopcolor ! = ~ 0 )
2007-07-23 18:52:11 +00:00
top = cl_enemytopcolor ;
2008-06-01 22:06:22 +00:00
if ( cl_enemybottomcolor ! = ~ 0 )
2007-07-23 18:52:11 +00:00
bottom = cl_enemybottomcolor ;
}
}
2008-06-01 22:06:22 +00:00
/*
2007-07-23 18:52:11 +00:00
if ( top > 13 | | top < 0 )
top = 13 ;
if ( bottom > 13 | | bottom < 0 )
bottom = 13 ;
2008-06-01 22:06:22 +00:00
*/
2007-07-23 18:52:11 +00:00
//other renderers still need the team stuff set, but that's all
player - > ttopcolor = top ;
player - > tbottomcolor = bottom ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = =
CL_UpdateUserinfo
= = = = = = = = = = = = = =
*/
void CL_ProcessUserInfo ( int slot , player_info_t * player )
{
2008-06-01 22:06:22 +00:00
char * col ;
2004-08-23 00:15:46 +00:00
Q_strncpyz ( player - > name , Info_ValueForKey ( player - > userinfo , " name " ) , sizeof ( player - > name ) ) ;
Q_strncpyz ( player - > team , Info_ValueForKey ( player - > userinfo , " team " ) , sizeof ( player - > team ) ) ;
2008-06-01 22:06:22 +00:00
col = Info_ValueForKey ( player - > userinfo , " topcolor " ) ;
if ( ! strncmp ( col , " 0x " , 2 ) )
player - > rtopcolor = 0xff000000 | strtoul ( col + 2 , NULL , 16 ) ;
else
player - > rtopcolor = atoi ( col ) ;
col = Info_ValueForKey ( player - > userinfo , " bottomcolor " ) ;
if ( ! strncmp ( col , " 0x " , 2 ) )
player - > rbottomcolor = 0xff000000 | strtoul ( col + 2 , NULL , 16 ) ;
else
player - > rbottomcolor = atoi ( col ) ;
2005-01-17 17:40:21 +00:00
if ( atoi ( Info_ValueForKey ( player - > userinfo , " *spectator " ) ) )
2004-08-23 00:15:46 +00:00
player - > spectator = true ;
else
player - > spectator = false ;
2008-06-01 22:06:22 +00:00
/*
if ( player - > rtopcolor > 13 )
player - > rtopcolor = 13 ;
if ( player - > rbottomcolor > 13 )
player - > rbottomcolor = 13 ;
*/
2008-01-28 23:03:42 +00:00
player - > model = NULL ;
2014-09-17 03:04:08 +00:00
# ifdef HEXEN2
2010-08-28 17:14:38 +00:00
/*if we're running hexen2, they have to be some class...*/
player - > h2playerclass = atoi ( Info_ValueForKey ( player - > userinfo , " cl_playerclass " ) ) ;
if ( player - > h2playerclass > 5 )
player - > h2playerclass = 5 ;
if ( player - > h2playerclass < 1 )
player - > h2playerclass = 1 ;
2014-09-17 03:04:08 +00:00
# endif
2010-08-28 17:14:38 +00:00
2008-06-05 07:45:34 +00:00
player - > colourised = TP_FindColours ( player - > name ) ;
2007-11-23 18:27:30 +00:00
// If it's us
2013-06-23 02:17:02 +00:00
if ( slot = = cl . playerview [ 0 ] . playernum & & player - > name [ 0 ] )
2007-11-23 18:27:30 +00:00
{
2004-08-23 00:15:46 +00:00
cl . spectator = player - > spectator ;
2007-11-23 18:27:30 +00:00
// Update the rules since spectators can bypass everything but players can't
CL_CheckServerInfo ( ) ;
2008-01-28 23:03:42 +00:00
Skin_FlushPlayers ( ) ;
}
else if ( cls . state = = ca_active )
2004-08-23 00:15:46 +00:00
Skin_Find ( player ) ;
Sbar_Changed ( ) ;
CL_NewTranslation ( slot ) ;
}
/*
= = = = = = = = = = = = = =
CL_UpdateUserinfo
= = = = = = = = = = = = = =
*/
void CL_UpdateUserinfo ( void )
{
int slot ;
player_info_t * player ;
slot = MSG_ReadByte ( ) ;
if ( slot > = MAX_CLIENTS )
Host_EndGame ( " CL_ParseServerMessage: svc_updateuserinfo > MAX_SCOREBOARD " ) ;
player = & cl . players [ slot ] ;
player - > userid = MSG_ReadLong ( ) ;
Q_strncpyz ( player - > userinfo , MSG_ReadString ( ) , sizeof ( player - > userinfo ) ) ;
CL_ProcessUserInfo ( slot , player ) ;
2006-02-22 23:35:04 +00:00
2013-06-23 02:17:02 +00:00
if ( slot = = cl . playerview [ 0 ] . playernum & & player - > name [ 0 ] )
2006-02-22 23:35:04 +00:00
{
char * qz ;
qz = Info_ValueForKey ( player - > userinfo , " Qizmo " ) ;
if ( * qz )
TP_ExecTrigger ( " f_qizmoconnect " ) ;
}
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = =
CL_SetInfo
= = = = = = = = = = = = = =
*/
2007-02-23 00:21:33 +00:00
void CL_ParseSetInfo ( void )
2004-08-23 00:15:46 +00:00
{
int slot ;
player_info_t * player ;
char key [ MAX_QWMSGLEN ] ;
char value [ MAX_QWMSGLEN ] ;
slot = MSG_ReadByte ( ) ;
if ( slot > = MAX_CLIENTS )
Host_EndGame ( " CL_ParseServerMessage: svc_setinfo > MAX_SCOREBOARD " ) ;
player = & cl . players [ slot ] ;
Q_strncpyz ( key , MSG_ReadString ( ) , sizeof ( key ) ) ;
Q_strncpyz ( value , MSG_ReadString ( ) , sizeof ( value ) ) ;
Con_DPrintf ( " SETINFO %s: %s=%s \n " , player - > name , key , value ) ;
2005-03-07 08:58:26 +00:00
Info_SetValueForStarKey ( player - > userinfo , key , value , sizeof ( player - > userinfo ) ) ;
2004-08-23 00:15:46 +00:00
CL_ProcessUserInfo ( slot , player ) ;
}
/*
= = = = = = = = = = = = = =
CL_ServerInfo
= = = = = = = = = = = = = =
*/
void CL_ServerInfo ( void )
{
// int slot;
// player_info_t *player;
char key [ MAX_QWMSGLEN ] ;
char value [ MAX_QWMSGLEN ] ;
Q_strncpyz ( key , MSG_ReadString ( ) , sizeof ( key ) ) ;
Q_strncpyz ( value , MSG_ReadString ( ) , sizeof ( value ) ) ;
Con_DPrintf ( " SERVERINFO: %s=%s \n " , key , value ) ;
2012-02-27 12:23:15 +00:00
Info_SetValueForStarKey ( cl . serverinfo , key , value , MAX_SERVERINFO_STRING ) ;
2004-08-23 00:15:46 +00:00
CL_CheckServerInfo ( ) ;
}
/*
= = = = = = = = = = = = = = = = = = = = =
CL_SetStat
= = = = = = = = = = = = = = = = = = = = =
*/
2015-02-02 08:01:53 +00:00
static void CL_SetStat_Internal ( int pnum , int stat , int ivalue , float fvalue )
2004-08-23 00:15:46 +00:00
{
int j ;
2015-02-02 08:01:53 +00:00
if ( cl . playerview [ pnum ] . stats [ stat ] ! = ivalue )
2004-12-05 08:19:54 +00:00
Sbar_Changed ( ) ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
if ( stat = = STAT_ITEMS )
{ // set flash times
for ( j = 0 ; j < 32 ; j + + )
2015-02-02 08:01:53 +00:00
if ( ( ivalue & ( 1 < < j ) ) & & ! ( cl . playerview [ pnum ] . stats [ stat ] & ( 1 < < j ) ) )
2012-07-05 19:42:36 +00:00
cl . playerview [ pnum ] . item_gettime [ j ] = cl . time ;
2004-08-23 00:15:46 +00:00
}
2015-03-03 00:14:43 +00:00
if ( stat = = STAT_WEAPONMODELI )
2005-07-14 01:57:34 +00:00
{
2015-02-02 08:01:53 +00:00
if ( cl . playerview [ pnum ] . stats [ stat ] ! = ivalue )
2005-07-14 01:57:34 +00:00
{
2015-02-02 08:01:53 +00:00
if ( ivalue = = 0 )
2005-07-14 01:57:34 +00:00
TP_ExecTrigger ( " f_reloadstart " ) ;
2012-07-05 19:42:36 +00:00
else if ( cl . playerview [ pnum ] . stats [ stat ] = = 0 )
2005-07-14 01:57:34 +00:00
TP_ExecTrigger ( " f_reloadend " ) ;
}
}
2015-02-02 08:01:53 +00:00
if ( stat = = STAT_VIEWHEIGHT & & ( ( cls . z_ext & Z_EXT_VIEWHEIGHT ) | | cls . protocol = = CP_NETQUAKE ) )
cl . playerview [ pnum ] . viewheight = fvalue ;
cl . playerview [ pnum ] . stats [ stat ] = ivalue ;
cl . playerview [ pnum ] . statsf [ stat ] = fvalue ;
2004-09-30 22:42:34 +00:00
if ( pnum = = 0 )
2015-02-02 08:01:53 +00:00
TP_StatChanged ( stat , ivalue ) ;
2004-08-23 00:15:46 +00:00
}
2013-07-26 17:19:06 +00:00
void CL_SetStatMovevar ( int pnum , int stat , float value )
{
switch ( stat )
{
case STAT_MOVEVARS_GRAVITY :
movevars . gravity = value ;
break ;
case STAT_MOVEVARS_STOPSPEED :
movevars . stopspeed = value ;
break ;
case STAT_MOVEVARS_MAXSPEED :
cl . playerview [ pnum ] . maxspeed = value ;
break ;
case STAT_MOVEVARS_SPECTATORMAXSPEED :
movevars . spectatormaxspeed = value ;
break ;
case STAT_MOVEVARS_ACCELERATE :
movevars . accelerate = value ;
break ;
case STAT_MOVEVARS_AIRACCELERATE :
movevars . airaccelerate = value ;
break ;
case STAT_MOVEVARS_WATERACCELERATE :
movevars . wateraccelerate = value ;
break ;
case STAT_MOVEVARS_FRICTION :
movevars . friction = value ;
break ;
case STAT_MOVEVARS_WATERFRICTION :
movevars . waterfriction = value ;
break ;
case STAT_MOVEVARS_ENTGRAVITY :
cl . playerview [ pnum ] . entgravity = value ;
break ;
}
}
2008-05-25 22:23:43 +00:00
void CL_SetStatInt ( int pnum , int stat , int value )
2008-01-09 00:52:31 +00:00
{
if ( stat < 0 | | stat > = MAX_CL_STATS )
return ;
// Host_EndGame ("CL_SetStat: %i is invalid", stat);
if ( stat = = STAT_TIME & & ( cls . fteprotocolextensions & PEXT_ACCURATETIMINGS ) )
{
cl . oldgametime = cl . gametime ;
cl . oldgametimemark = cl . gametimemark ;
cl . gametime = value * 0.001 ;
cl . gametimemark = realtime ;
}
if ( cls . demoplayback = = DPB_MVD | | cls . demoplayback = = DPB_EZTV )
{
extern int cls_lastto ;
cl . players [ cls_lastto ] . stats [ stat ] = value ;
2013-07-26 17:19:06 +00:00
cl . players [ cls_lastto ] . statsf [ stat ] = value ;
2008-01-09 00:52:31 +00:00
for ( pnum = 0 ; pnum < cl . splitclients ; pnum + + )
2013-06-23 02:17:02 +00:00
if ( cl . playerview [ pnum ] . cam_spec_track = = cls_lastto )
2015-02-02 08:01:53 +00:00
CL_SetStat_Internal ( pnum , stat , value , value ) ;
2008-01-09 00:52:31 +00:00
}
else
2015-02-02 08:01:53 +00:00
CL_SetStat_Internal ( pnum , stat , value , value ) ;
2013-07-26 17:19:06 +00:00
if ( cls . protocol = = CP_NETQUAKE & & CPNQ_IS_DP & & ! ( cls . fteprotocolextensions2 & PEXT2_PREDINFO ) )
CL_SetStatMovevar ( pnum , stat , * ( float * ) & value ) ; //DP sucks.
2008-01-09 00:52:31 +00:00
}
2008-05-25 22:23:43 +00:00
void CL_SetStatFloat ( int pnum , int stat , float value )
{
if ( stat < 0 | | stat > = MAX_CL_STATS )
return ;
// Host_EndGame ("CL_SetStat: %i is invalid", stat);
2008-01-09 00:52:31 +00:00
2008-05-25 22:23:43 +00:00
if ( cls . demoplayback = = DPB_MVD | | cls . demoplayback = = DPB_EZTV )
{
extern int cls_lastto ;
cl . players [ cls_lastto ] . statsf [ stat ] = value ;
2013-07-26 17:19:06 +00:00
cl . players [ cls_lastto ] . stats [ stat ] = value ;
2008-05-25 22:23:43 +00:00
for ( pnum = 0 ; pnum < cl . splitclients ; pnum + + )
2013-06-23 02:17:02 +00:00
if ( cl . playerview [ pnum ] . cam_spec_track = = cls_lastto )
2013-07-26 17:19:06 +00:00
{
2012-07-05 19:42:36 +00:00
cl . playerview [ pnum ] . statsf [ stat ] = value ;
2013-07-26 17:19:06 +00:00
cl . playerview [ pnum ] . stats [ stat ] = value ;
}
2008-05-25 22:23:43 +00:00
}
else
2013-07-26 17:19:06 +00:00
{
2012-07-05 19:42:36 +00:00
cl . playerview [ pnum ] . statsf [ stat ] = value ;
2013-07-26 17:19:06 +00:00
cl . playerview [ pnum ] . stats [ stat ] = value ;
}
2011-12-05 15:23:40 +00:00
2015-02-02 08:01:53 +00:00
if ( stat = = STAT_VIEWHEIGHT & & ( ( cls . z_ext & Z_EXT_VIEWHEIGHT ) | | cls . protocol = = CP_NETQUAKE ) )
2013-06-23 02:17:02 +00:00
cl . playerview [ pnum ] . viewheight = value ;
2013-07-26 17:19:06 +00:00
if ( cls . fteprotocolextensions2 & PEXT2_PREDINFO )
CL_SetStatMovevar ( pnum , stat , value ) ;
2008-05-25 22:23:43 +00:00
}
void CL_SetStatString ( int pnum , int stat , char * value )
{
if ( stat < 0 | | stat > = MAX_CL_STATS )
return ;
// Host_EndGame ("CL_SetStat: %i is invalid", stat);
if ( cls . demoplayback = = DPB_MVD | | cls . demoplayback = = DPB_EZTV )
{
/* extern int cls_lastto;
cl . players [ cls_lastto ] . statsstr [ stat ] = value ;
for ( pnum = 0 ; pnum < cl . splitclients ; pnum + + )
if ( spec_track [ pnum ] = = cls_lastto )
cl . statsstr [ pnum ] [ stat ] = value ; */
}
else
{
2012-07-05 19:42:36 +00:00
if ( cl . playerview [ pnum ] . statsstr [ stat ] )
Z_Free ( cl . playerview [ pnum ] . statsstr [ stat ] ) ;
cl . playerview [ pnum ] . statsstr [ stat ] = Z_Malloc ( strlen ( value ) + 1 ) ;
strcpy ( cl . playerview [ pnum ] . statsstr [ stat ] , value ) ;
2008-05-25 22:23:43 +00:00
}
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = =
CL_MuzzleFlash
= = = = = = = = = = = = = =
*/
2014-04-24 01:53:01 +00:00
void CL_MuzzleFlash ( int entnum )
2004-08-23 00:15:46 +00:00
{
2014-04-24 01:53:01 +00:00
dlight_t * dl ;
2004-08-23 00:15:46 +00:00
player_state_t * pl ;
packet_entities_t * pack ;
entity_state_t * s1 ;
int pnum ;
2014-04-24 01:53:01 +00:00
vec3_t org = { 0 , 0 , 0 } ;
vec3_t axis [ 3 ] = { { 0 , 0 , 0 } } ;
int dlightkey = 0 ;
extern int pt_muzzleflash ;
2005-01-13 16:29:20 +00:00
extern cvar_t cl_muzzleflash ;
//was it us?
2009-11-04 21:16:50 +00:00
if ( ! cl_muzzleflash . ival ) // remove all muzzleflashes
2005-06-04 12:40:12 +00:00
return ;
2004-08-23 00:15:46 +00:00
2014-04-24 01:53:01 +00:00
if ( cl_muzzleflash . value = = 2 )
{
//muzzleflash 2 removes muzzleflashes on us
for ( pnum = 0 ; pnum < cl . splitclients ; pnum + + )
if ( entnum - 1 = = cl . playerview [ pnum ] . playernum )
return ;
}
2004-08-23 00:15:46 +00:00
2014-04-24 01:53:01 +00:00
if ( ! dlightkey )
2004-08-23 00:15:46 +00:00
{
2014-04-24 01:53:01 +00:00
pack = & cl . inframes [ cl . validsequence & UPDATE_MASK ] . packet_entities ;
2004-08-23 00:15:46 +00:00
2014-04-24 01:53:01 +00:00
for ( pnum = 0 ; pnum < pack - > num_entities ; pnum + + ) //try looking for an entity with that id first
2004-08-23 00:15:46 +00:00
{
2014-04-24 01:53:01 +00:00
s1 = & pack - > entities [ pnum ] ;
if ( s1 - > number = = entnum )
{
dlightkey = entnum ;
VectorCopy ( s1 - > origin , org ) ;
AngleVectors ( s1 - > angles , axis [ 0 ] , axis [ 1 ] , axis [ 2 ] ) ;
break ;
}
2004-08-23 00:15:46 +00:00
}
}
2014-04-24 01:53:01 +00:00
if ( ! dlightkey )
2004-08-23 00:15:46 +00:00
{ //that ent number doesn't exist, go for a player with that number
2014-04-24 01:53:01 +00:00
if ( ( unsigned ) ( entnum ) < = cl . allocated_client_slots & & entnum > 0 )
2004-08-23 00:15:46 +00:00
{
2014-04-24 01:53:01 +00:00
pl = & cl . inframes [ cl . validsequence & UPDATE_MASK ] . playerstate [ entnum - 1 ] ;
2004-08-23 00:15:46 +00:00
2014-04-24 01:53:01 +00:00
if ( pl - > messagenum = = cl . validsequence )
{
dlightkey = - entnum ;
VectorCopy ( pl - > origin , org ) ;
AngleVectors ( pl - > viewangles , axis [ 0 ] , axis [ 1 ] , axis [ 2 ] ) ;
if ( pl - > szmins [ 2 ] = = 0 ) /*hull is 0-based, so origin is bottom of model, move the light up slightly*/
org [ 2 ] + = pl - > szmaxs [ 2 ] / 2 ;
}
2004-08-23 00:15:46 +00:00
}
}
2014-04-24 01:53:01 +00:00
if ( ! dlightkey )
return ;
2014-10-05 20:04:11 +00:00
if ( P_RunParticleEffectType ( org , axis [ 0 ] , 1 , pt_muzzleflash ) )
2014-04-24 01:53:01 +00:00
{
dl = CL_AllocDlight ( dlightkey ) ;
VectorMA ( org , 15 , axis [ 0 ] , dl - > origin ) ;
memcpy ( dl - > axis , axis , sizeof ( dl - > axis ) ) ;
dl - > radius = 200 + ( rand ( ) & 31 ) ;
dl - > minlight = 32 ;
dl - > die = cl . time + 0.1 ;
dl - > color [ 0 ] = 1.5 ;
dl - > color [ 1 ] = 1.3 ;
dl - > color [ 2 ] = 1.0 ;
dl - > channelfade [ 0 ] = 1.5 ;
dl - > channelfade [ 1 ] = 0.75 ;
dl - > channelfade [ 2 ] = 0.375 ;
dl - > decay = 1000 ;
2014-04-13 04:27:21 +00:00
# ifdef RTLIGHTS
2014-04-24 01:53:01 +00:00
dl - > lightcolourscales [ 2 ] = 4 ;
2014-04-13 04:27:21 +00:00
# endif
2014-04-24 01:53:01 +00:00
}
2004-08-23 00:15:46 +00:00
}
# ifdef Q2CLIENT
void Q2S_StartSound ( vec3_t origin , int entnum , int entchannel , sfx_t * sfx , float fvol , float attenuation , float timeofs ) ;
void CLQ2_ParseMuzzleFlash ( void )
{
vec3_t fv , rv , dummy ;
dlight_t * dl ;
int i , weapon ;
vec3_t org , ang ;
int silenced ;
float volume ;
char soundname [ 64 ] ;
2014-05-04 04:14:52 +00:00
i = ( unsigned short ) ( short ) MSG_ReadShort ( ) ;
2004-08-23 00:15:46 +00:00
if ( i < 1 | | i > = Q2MAX_EDICTS )
Host_Error ( " CL_ParseMuzzleFlash: bad entity " ) ;
weapon = MSG_ReadByte ( ) ;
silenced = weapon & Q2MZ_SILENCED ;
weapon & = ~ Q2MZ_SILENCED ;
CL_GetNumberedEntityInfo ( i , org , ang ) ;
dl = CL_AllocDlight ( i ) ;
VectorCopy ( org , dl - > origin ) ;
AngleVectors ( ang , fv , rv , dummy ) ;
VectorMA ( dl - > origin , 18 , fv , dl - > origin ) ;
VectorMA ( dl - > origin , 16 , rv , dl - > origin ) ;
if ( silenced )
dl - > radius = 100 + ( rand ( ) & 31 ) ;
else
dl - > radius = 200 + ( rand ( ) & 31 ) ;
dl - > minlight = 32 ;
dl - > die = cl . time + 0.05 ; //+ 0.1;
dl - > decay = 1 ;
dl - > channelfade [ 0 ] = 2 ;
dl - > channelfade [ 1 ] = 2 ;
dl - > channelfade [ 2 ] = 2 ;
if ( silenced )
volume = 0.2 ;
else
volume = 1 ;
switch ( weapon )
{
case Q2MZ_BLASTER :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/blastf1a.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
case Q2MZ_BLUEHYPERBLASTER :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 0 ; dl - > color [ 1 ] = 0 ; dl - > color [ 2 ] = 1 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/hyprbf1a.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
case Q2MZ_HYPERBLASTER :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/hyprbf1a.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
case Q2MZ_MACHINEGUN :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2012-07-05 19:42:36 +00:00
Q_snprintfz ( soundname , sizeof ( soundname ) , " weapons/machgf%ib.wav " , ( rand ( ) % 5 ) + 1 ) ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( soundname ) , volume , ATTN_NORM , 0 ) ;
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case Q2MZ_SHOTGUN :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/shotgf1b.wav " ) , volume , ATTN_NORM , 0 ) ;
Q2S_StartSound ( NULL , i , CHAN_AUTO , S_PrecacheSound ( " weapons/shotgr1b.wav " ) , volume , ATTN_NORM , 0.1 ) ;
break ;
case Q2MZ_SSHOTGUN :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/sshotf1b.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
case Q2MZ_CHAINGUN1 :
dl - > radius = 200 + ( rand ( ) & 31 ) ;
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 0.25 ; dl - > color [ 2 ] = 0 ;
2012-07-05 19:42:36 +00:00
Q_snprintfz ( soundname , sizeof ( soundname ) , " weapons/machgf%ib.wav " , ( rand ( ) % 5 ) + 1 ) ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( soundname ) , volume , ATTN_NORM , 0 ) ;
break ;
case Q2MZ_CHAINGUN2 :
dl - > radius = 225 + ( rand ( ) & 31 ) ;
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 0.5 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
dl - > die = cl . time + 0.1 ; // long delay
2012-07-05 19:42:36 +00:00
Q_snprintfz ( soundname , sizeof ( soundname ) , " weapons/machgf%ib.wav " , ( rand ( ) % 5 ) + 1 ) ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( soundname ) , volume , ATTN_NORM , 0 ) ;
2012-07-05 19:42:36 +00:00
Q_snprintfz ( soundname , sizeof ( soundname ) , " weapons/machgf%ib.wav " , ( rand ( ) % 5 ) + 1 ) ;
2006-05-10 07:35:19 +00:00
Q2S_StartSound ( NULL , i , CHAN_AUTO , S_PrecacheSound ( soundname ) , volume , ATTN_NORM , 0.05 ) ;
2004-08-23 00:15:46 +00:00
break ;
case Q2MZ_CHAINGUN3 :
dl - > radius = 250 + ( rand ( ) & 31 ) ;
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
dl - > die = cl . time + 0.1 ; // long delay
2012-07-05 19:42:36 +00:00
Q_snprintfz ( soundname , sizeof ( soundname ) , " weapons/machgf%ib.wav " , ( rand ( ) % 5 ) + 1 ) ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( soundname ) , volume , ATTN_NORM , 0 ) ;
2012-07-05 19:42:36 +00:00
Q_snprintfz ( soundname , sizeof ( soundname ) , " weapons/machgf%ib.wav " , ( rand ( ) % 5 ) + 1 ) ;
2006-05-10 07:35:19 +00:00
Q2S_StartSound ( NULL , i , CHAN_AUTO , S_PrecacheSound ( soundname ) , volume , ATTN_NORM , 0.033 ) ;
2012-07-05 19:42:36 +00:00
Q_snprintfz ( soundname , sizeof ( soundname ) , " weapons/machgf%ib.wav " , ( rand ( ) % 5 ) + 1 ) ;
2006-05-10 07:35:19 +00:00
Q2S_StartSound ( NULL , i , CHAN_AUTO , S_PrecacheSound ( soundname ) , volume , ATTN_NORM , 0.066 ) ;
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case Q2MZ_RAILGUN :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 0.5 ; dl - > color [ 1 ] = 0.5 ; dl - > color [ 2 ] = 1 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/railgf1a.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
case Q2MZ_ROCKET :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 0.5 ; dl - > color [ 2 ] = 0.2 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/rocklf1a.wav " ) , volume , ATTN_NORM , 0 ) ;
Q2S_StartSound ( NULL , i , CHAN_AUTO , S_PrecacheSound ( " weapons/rocklr1b.wav " ) , volume , ATTN_NORM , 0.1 ) ;
break ;
case Q2MZ_GRENADE :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 0.5 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/grenlf1a.wav " ) , volume , ATTN_NORM , 0 ) ;
Q2S_StartSound ( NULL , i , CHAN_AUTO , S_PrecacheSound ( " weapons/grenlr1b.wav " ) , volume , ATTN_NORM , 0.1 ) ;
break ;
case Q2MZ_BFG :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 0 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/bfg__f1y.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
case Q2MZ_LOGIN :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 0 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
dl - > die = cl . time + 1.0 ;
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/grenlf1a.wav " ) , 1 , ATTN_NORM , 0 ) ;
// CL_LogoutEffect (pl->current.origin, weapon);
break ;
case Q2MZ_LOGOUT :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 0 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
dl - > die = cl . time + 1.0 ;
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/grenlf1a.wav " ) , 1 , ATTN_NORM , 0 ) ;
// CL_LogoutEffect (pl->current.origin, weapon);
break ;
case Q2MZ_RESPAWN :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
dl - > die = cl . time + 1.0 ;
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/grenlf1a.wav " ) , 1 , ATTN_NORM , 0 ) ;
// CL_LogoutEffect (pl->current.origin, weapon);
break ;
// RAFAEL
case Q2MZ_PHALANX :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 0.5 ; dl - > color [ 2 ] = 0.5 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/plasshot.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
// RAFAEL
2005-09-26 03:40:09 +00:00
case Q2MZ_IONRIPPER :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 0.5 ; dl - > color [ 2 ] = 0.5 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/rippfire.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
// ======================
// PGM
case Q2MZ_ETF_RIFLE :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 0.9 ; dl - > color [ 1 ] = 0.7 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/nail1.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
case Q2MZ_SHOTGUN2 :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/shotg2.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
case Q2MZ_HEATBEAM :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
dl - > die = cl . time + 100 ;
// Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/bfg__l1a.wav"), volume, ATTN_NORM, 0);
break ;
case Q2MZ_BLASTER2 :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 0 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
// FIXME - different sound for blaster2 ??
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/blastf1a.wav " ) , volume , ATTN_NORM , 0 ) ;
break ;
case Q2MZ_TRACKER :
// negative flashes handled the same in gl/soft until CL_AddDLights
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = - 1 ; dl - > color [ 1 ] = - 1 ; dl - > color [ 2 ] = - 1 ;
2004-08-23 00:15:46 +00:00
Q2S_StartSound ( NULL , i , CHAN_WEAPON , S_PrecacheSound ( " weapons/disint2.wav " ) , volume , ATTN_NORM , 0 ) ;
2005-09-26 03:40:09 +00:00
break ;
2004-08-23 00:15:46 +00:00
case Q2MZ_NUKE1 :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 0 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
dl - > die = cl . time + 100 ;
break ;
case Q2MZ_NUKE2 :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 1 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
dl - > die = cl . time + 100 ;
break ;
case Q2MZ_NUKE4 :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 0 ; dl - > color [ 1 ] = 0 ; dl - > color [ 2 ] = 1 ;
2004-08-23 00:15:46 +00:00
dl - > die = cl . time + 100 ;
break ;
case Q2MZ_NUKE8 :
2014-05-10 13:42:13 +00:00
dl - > color [ 0 ] = 0 ; dl - > color [ 1 ] = 1 ; dl - > color [ 2 ] = 1 ;
2004-08-23 00:15:46 +00:00
dl - > die = cl . time + 100 ;
break ;
// PGM
// ======================
}
}
2005-09-26 03:40:09 +00:00
void CLQ2_ParseMuzzleFlash2 ( void )
2004-08-23 00:15:46 +00:00
{
int ent ;
int flash_number ;
2014-05-04 04:14:52 +00:00
ent = ( unsigned short ) ( short ) MSG_ReadShort ( ) ;
2004-08-23 00:15:46 +00:00
if ( ent < 1 | | ent > = Q2MAX_EDICTS )
Host_EndGame ( " CL_ParseMuzzleFlash2: bad entity " ) ;
flash_number = MSG_ReadByte ( ) ;
2005-03-18 06:14:07 +00:00
CLQ2_RunMuzzleFlash2 ( ent , flash_number ) ;
2004-08-23 00:15:46 +00:00
}
2005-09-04 05:48:26 +00:00
void CLQ2_ParseInventory ( void )
{
2015-03-03 00:14:43 +00:00
unsigned int i ;
2005-09-04 05:48:26 +00:00
for ( i = 0 ; i < Q2MAX_ITEMS ; i + + )
2015-03-03 00:14:43 +00:00
cl . inventory [ i ] = MSG_ReadShort ( ) ;
2005-09-04 05:48:26 +00:00
}
2004-08-23 00:15:46 +00:00
# endif
2004-09-30 22:42:34 +00:00
//return if we want to print the message.
2015-04-14 23:12:17 +00:00
char * CL_ParseChat ( char * text , player_info_t * * player , int * msgflags )
2005-09-26 03:40:09 +00:00
{
2005-12-13 02:31:57 +00:00
extern cvar_t cl_chatsound , cl_nofake , cl_teamchatsound , cl_enemychatsound ;
2005-09-07 14:55:25 +00:00
int flags ;
int offset = 0 ;
qboolean suppress_talksound ;
char * p ;
2004-08-23 00:15:46 +00:00
char * s ;
2005-11-30 01:20:53 +00:00
int check_flood ;
2004-08-30 07:08:13 +00:00
2005-09-07 14:55:25 +00:00
flags = TP_CategorizeMessage ( text , & offset , player ) ;
s = text + offset ;
2004-08-30 07:08:13 +00:00
2005-09-07 14:55:25 +00:00
if ( flags )
2004-08-23 00:15:46 +00:00
{
2005-09-07 14:55:25 +00:00
if ( ! cls . demoplayback )
Sys_ServerActivity ( ) ; //chat always flashes the screen..
2007-09-17 20:35:39 +00:00
2005-09-07 14:55:25 +00:00
//check f_ stuff
2007-09-17 20:35:39 +00:00
if ( * player & & ! strncmp ( s , " f_ " , 2 ) )
2004-09-30 22:42:34 +00:00
{
2007-09-17 20:35:39 +00:00
Validation_Auto_Response ( * player - cl . players , s ) ;
2005-09-08 08:10:06 +00:00
return s ;
2005-09-07 14:55:25 +00:00
}
2007-09-17 20:35:39 +00:00
2005-09-07 14:55:25 +00:00
Validation_CheckIfResponse ( text ) ;
2004-09-30 22:42:34 +00:00
2006-01-13 06:27:18 +00:00
# ifdef PLUGINS
2006-01-01 09:01:15 +00:00
if ( ! Plug_ChatMessage ( text + offset , * player ? ( int ) ( * player - cl . players ) : - 1 , flags ) )
return NULL ;
2006-01-13 06:27:18 +00:00
# endif
2006-01-01 09:01:15 +00:00
2008-11-09 22:29:28 +00:00
if ( flags & ( TPM_TEAM | TPM_OBSERVEDTEAM ) & & ! TP_FilterMessage ( text + offset ) )
return NULL ;
if ( flags & ( TPM_TEAM | TPM_OBSERVEDTEAM ) & & Sbar_UpdateTeamStatus ( * player , text + offset ) )
2005-09-07 14:55:25 +00:00
return NULL ;
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
2005-11-30 01:20:53 +00:00
if ( ( int ) msg_filter . value & flags )
return NULL ; //filter chat
2005-12-13 02:31:57 +00:00
check_flood = Ignore_Check_Flood ( s , flags , offset ) ;
if ( check_flood = = IGNORE_NO_ADD )
2005-11-30 01:20:53 +00:00
return NULL ;
2005-12-13 02:31:57 +00:00
else if ( check_flood = = NO_IGNORE_ADD )
2005-11-30 01:20:53 +00:00
Ignore_Flood_Add ( s ) ;
2005-09-07 14:55:25 +00:00
}
2006-01-13 06:27:18 +00:00
# ifdef PLUGINS
2006-01-01 09:01:15 +00:00
else
{
if ( ! Plug_ServerMessage ( text + offset , PRINT_CHAT ) )
return NULL ;
}
2006-01-13 06:27:18 +00:00
# endif
2004-09-30 22:42:34 +00:00
2005-09-07 14:55:25 +00:00
suppress_talksound = false ;
2004-09-30 22:42:34 +00:00
2005-09-07 14:55:25 +00:00
if ( flags = = 2 | | ( ! cl . teamplay & & flags ) )
suppress_talksound = TP_CheckSoundTrigger ( text + offset ) ;
2004-09-30 22:42:34 +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 ( cls . demoseeking | |
! cl_chatsound . value | | // no sound at all
2005-09-07 14:55:25 +00:00
( cl_chatsound . value = = 2 & & flags ! = 2 ) ) // only play sound in mm2
suppress_talksound = true ;
2004-09-30 22:42:34 +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
2005-09-07 14:55:25 +00:00
if ( ! suppress_talksound )
2005-12-13 02:31:57 +00:00
{
2008-11-09 22:29:28 +00:00
if ( flags & ( TPM_OBSERVEDTEAM | TPM_TEAM ) & & cl . teamplay )
2005-12-13 02:33:03 +00:00
S_LocalSound ( cl_teamchatsound . string ) ;
2005-12-13 02:31:57 +00:00
else
2005-12-13 02:33:03 +00:00
S_LocalSound ( cl_enemychatsound . string ) ;
2005-12-13 02:31:57 +00:00
}
2004-09-30 22:42:34 +00:00
2011-12-23 03:12:29 +00:00
if ( flags )
{
if ( cl_nofake . value = = 1 | | ( cl_nofake . value = = 2 & & flags ! = 2 ) ) {
for ( p = s ; * p ; p + + )
if ( * p = = 13 | | ( * p = = 10 & & p [ 1 ] ) )
* p = ' ' ;
}
2004-09-30 22:42:34 +00:00
}
2005-09-07 14:55:25 +00:00
2015-04-14 23:12:17 +00:00
* msgflags = flags ;
2005-09-08 08:10:06 +00:00
2005-09-07 14:55:25 +00:00
return s ;
2004-08-23 00:15:46 +00:00
}
2005-09-26 08:07:26 +00:00
// CL_PlayerColor: returns color and mask for player_info_t
2009-05-24 10:11:17 +00:00
int CL_PlayerColor ( player_info_t * plr , qboolean * name_coloured )
2005-09-26 08:07:26 +00:00
{
char * t ;
2012-04-24 07:59:11 +00:00
unsigned int c ;
2005-09-26 08:07:26 +00:00
2009-05-24 10:11:17 +00:00
* name_coloured = false ;
2005-09-26 08:07:26 +00:00
if ( cl . teamfortress ) //override based on team
{
2015-04-14 23:12:17 +00:00
//damn spies
if ( ! Q_strcasecmp ( plr - > team , " red " ) )
c = 1 ;
else if ( ! Q_strcasecmp ( plr - > team , " blue " ) )
c = 5 ;
else
2005-09-26 08:07:26 +00:00
// TODO: needs some work
2007-07-23 18:52:11 +00:00
switch ( plr - > rbottomcolor )
2005-09-26 08:07:26 +00:00
{ //translate q1 skin colours to console colours
case 10 :
case 1 :
2009-05-24 10:11:17 +00:00
* name_coloured = true ;
2005-09-26 08:07:26 +00:00
case 4 : //red
c = 1 ;
break ;
case 11 :
2009-05-24 10:11:17 +00:00
* name_coloured = true ;
2005-09-26 08:07:26 +00:00
case 3 : // green
c = 2 ;
break ;
case 5 :
2009-05-24 10:11:17 +00:00
* name_coloured = true ;
2005-09-26 08:07:26 +00:00
case 12 :
c = 3 ;
break ;
case 6 :
case 7 :
2009-05-24 10:11:17 +00:00
* name_coloured = true ;
2005-09-26 08:07:26 +00:00
case 8 :
case 9 :
2006-01-02 22:05:47 +00:00
c = 6 ;
2005-09-26 08:07:26 +00:00
break ;
case 2 : // light blue
2009-05-24 10:11:17 +00:00
* name_coloured = true ;
2005-09-26 08:07:26 +00:00
case 13 : //blue
case 14 : //blue
2006-01-02 22:05:47 +00:00
c = 5 ;
2005-09-26 08:07:26 +00:00
break ;
default :
2009-05-24 10:11:17 +00:00
* name_coloured = true ;
2005-09-26 08:07:26 +00:00
case 0 : // white
c = 7 ;
break ;
}
}
2005-11-01 23:25:15 +00:00
else if ( cl . teamplay )
{
// team name hacks
if ( ! strcmp ( plr - > team , " red " ) )
c = 1 ;
else if ( ! strcmp ( plr - > team , " blue " ) )
2006-01-02 22:05:47 +00:00
c = 5 ;
2005-11-01 23:25:15 +00:00
else
{
char * t ;
t = plr - > team ;
c = 0 ;
for ( t = plr - > team ; * t ; t + + )
{
c > > = 1 ;
c ^ = * t ; // TODO: very weak hash, replace
}
if ( ( c / 7 ) & 1 )
2009-05-24 10:11:17 +00:00
* name_coloured = true ;
2005-11-01 23:25:15 +00:00
c = 1 + ( c % 7 ) ;
}
}
2005-09-26 08:07:26 +00:00
else
{
// override chat color with tc infokey
// 0-6 is standard colors (red to white)
// 7-13 is using secondard charactermask
// 14 and afterwards repeats
t = Info_ValueForKey ( plr - > userinfo , " tc " ) ;
if ( * t )
c = atoi ( t ) ;
else
2005-10-08 22:35:20 +00:00
c = plr - > userid ; // Quake2 can start from 0
2005-09-26 08:07:26 +00:00
if ( ( c / 7 ) & 1 )
2009-05-24 10:11:17 +00:00
* name_coloured = true ;
2005-09-26 08:07:26 +00:00
c = 1 + ( c % 7 ) ;
}
return c ;
}
2012-01-01 15:34:02 +00:00
void TTS_SayChatString ( char * * stringtosay ) ;
2006-01-01 09:01:15 +00:00
// CL_PrintChat: takes chat strings and performs name coloring and cl_parsewhitetext parsing
2005-09-08 08:10:06 +00:00
// NOTE: text in rawmsg/msg is assumed destroyable and should not be used afterwards
2015-04-14 23:12:17 +00:00
void CL_PrintChat ( player_info_t * plr , char * msg , int plrflags )
2005-09-07 14:55:25 +00:00
{
2011-06-16 02:03:57 +00:00
extern cvar_t con_separatechat ;
2005-09-08 08:10:06 +00:00
char * name = NULL ;
2005-09-07 14:55:25 +00:00
int c ;
2009-05-24 10:11:17 +00:00
qboolean name_coloured = false ;
2005-09-07 14:55:25 +00:00
extern cvar_t cl_parsewhitetext ;
qboolean memessage = false ;
2009-05-24 10:11:17 +00:00
char fullchatmessage [ 2048 ] ;
2010-12-23 08:53:23 +00:00
2009-05-24 10:11:17 +00:00
fullchatmessage [ 0 ] = 0 ;
2015-04-14 23:12:17 +00:00
/*if (plrflags & TPM_FAKED)
2005-09-08 08:10:06 +00:00
{
name = rawmsg ; // use rawmsg pointer and msg modification to generate null-terminated string
if ( msg )
* ( msg - 2 ) = 0 ; // it's assumed that msg has 2 chars before it due to strstr
2015-04-14 23:12:17 +00:00
} */
2005-09-08 08:10:06 +00:00
2005-09-07 14:55:25 +00:00
if ( msg [ 0 ] = = ' / ' & & msg [ 1 ] = = ' m ' & & msg [ 2 ] = = ' e ' & & msg [ 3 ] = = ' ' )
{
msg + = 4 ;
memessage = true ; // special /me formatting
}
if ( plr ) // use special formatting with a real chat message
2005-09-08 08:10:06 +00:00
name = plr - > name ; // use player's name
2009-11-04 21:16:50 +00:00
if ( cl_standardchat . ival )
2005-09-07 14:55:25 +00:00
{
2009-05-24 10:11:17 +00:00
name_coloured = true ;
2005-09-08 08:10:06 +00:00
c = 7 ;
}
else
{
if ( plrflags & TPM_SPECTATOR ) // is an observer
2005-09-07 14:55:25 +00:00
{
// TODO: we don't even check for this yet...
2008-11-09 22:29:28 +00:00
if ( plrflags & ( TPM_TEAM | TPM_OBSERVEDTEAM ) ) // is on team
2005-09-07 14:55:25 +00:00
c = 0 ; // blacken () on observers
else
{
2009-05-24 10:11:17 +00:00
name_coloured = true ;
2005-09-07 14:55:25 +00:00
c = 7 ;
}
}
2005-09-08 08:10:06 +00:00
else if ( plr )
2009-05-24 10:11:17 +00:00
c = CL_PlayerColor ( plr , & name_coloured ) ;
2005-09-08 08:10:06 +00:00
else
{
// defaults for fake clients
2009-05-24 10:11:17 +00:00
name_coloured = true ;
2005-09-08 08:10:06 +00:00
c = 7 ;
2005-09-07 14:55:25 +00:00
}
2005-09-08 08:10:06 +00:00
}
2005-09-07 14:55:25 +00:00
2005-09-08 08:10:06 +00:00
c = ' 0 ' + c ;
2005-09-07 14:55:25 +00:00
2005-09-08 08:10:06 +00:00
if ( name )
{
2005-09-07 14:55:25 +00:00
if ( memessage )
{
2005-09-08 08:10:06 +00:00
if ( ! cl_standardchat . value & & ( plrflags & TPM_SPECTATOR ) )
2013-03-12 22:35:33 +00:00
Q_strncatz ( fullchatmessage , " ^0*^7 " , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
else
2013-03-12 22:35:33 +00:00
Q_strncatz ( fullchatmessage , " * " , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
}
2013-03-12 22:35:33 +00:00
else
Q_strncatz ( fullchatmessage , " \1 " , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
2014-03-30 08:55:06 +00:00
# if defined(_WIN32) && !defined(NOMEDIA) && !defined(WINRT)
2012-01-01 15:34:02 +00:00
TTS_SayChatString ( & msg ) ;
# endif
2008-11-09 22:29:28 +00:00
if ( plrflags & ( TPM_TEAM | TPM_OBSERVEDTEAM ) ) // for team chat don't highlight the name, just the brackets
2005-09-07 14:55:25 +00:00
{
2013-03-12 22:47:42 +00:00
Q_strncatz ( fullchatmessage , va ( " (^[^7%s%s^d \\ player \\ %i^]) " , name_coloured ? " ^m " : " " , name , ( int ) ( plr - cl . players ) ) , sizeof ( fullchatmessage ) ) ;
2009-05-24 10:11:17 +00:00
}
2009-11-04 21:16:50 +00:00
else if ( cl_standardchat . ival )
2009-05-24 10:11:17 +00:00
{
2013-03-12 22:47:42 +00:00
Q_strncatz ( fullchatmessage , va ( " ^[^7%s%s^d \\ player \\ %i^] " , name_coloured ? " ^m " : " " , name , ( int ) ( plr - cl . players ) ) , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
}
else
{
2013-03-12 22:47:42 +00:00
Q_strncatz ( fullchatmessage , va ( " ^[^7%s^%c%s^d \\ player \\ %i^] " , name_coloured ? " ^m " : " " , c , name , ( int ) ( plr - cl . players ) ) , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
}
if ( ! memessage )
{
// only print seperator with an actual player name
2005-09-08 08:10:06 +00:00
if ( ! cl_standardchat . value & & ( plrflags & TPM_SPECTATOR ) )
2009-05-24 10:11:17 +00:00
Q_strncatz ( fullchatmessage , " ^0: ^d " , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
else
2009-05-24 10:11:17 +00:00
Q_strncatz ( fullchatmessage , " : " , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
}
else
2009-05-24 10:11:17 +00:00
Q_strncatz ( fullchatmessage , " " , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
}
// print message
2008-11-09 22:29:28 +00:00
if ( cl_parsewhitetext . value & & ( cl_parsewhitetext . value = = 1 | | ( plrflags & ( TPM_TEAM | TPM_OBSERVEDTEAM ) ) ) )
2005-09-07 14:55:25 +00:00
{
2005-09-26 08:07:26 +00:00
char * t , * u ;
2005-09-07 14:55:25 +00:00
2006-02-17 19:54:47 +00:00
while ( ( t = strchr ( msg , ' { ' ) ) )
2005-09-07 14:55:25 +00:00
{
2013-03-12 22:44:00 +00:00
int c ;
if ( t > msg & & t [ - 1 ] = = ' ^ ' )
{
for ( c = 1 ; t - c > msg ; c + + )
{
if ( t [ - c ] = = ' ^ ' )
break ;
}
if ( c & 1 )
{
* t = ' \0 ' ;
Q_strncatz ( fullchatmessage , va ( " %s{ " , msg ) , sizeof ( fullchatmessage ) ) ;
msg = t + 1 ;
continue ;
}
}
u = strchr ( t , ' } ' ) ;
2005-09-07 14:55:25 +00:00
if ( u )
{
* t = 0 ;
* u = 0 ;
2009-05-24 10:11:17 +00:00
Q_strncatz ( fullchatmessage , va ( " %s " , msg ) , sizeof ( fullchatmessage ) ) ;
Q_strncatz ( fullchatmessage , va ( " ^m%s^m " , t + 1 ) , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
msg = u + 1 ;
}
else
break ;
}
2009-05-24 10:11:17 +00:00
Q_strncatz ( fullchatmessage , va ( " %s " , msg ) , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
}
else
{
2009-05-24 10:11:17 +00:00
Q_strncatz ( fullchatmessage , va ( " %s " , msg ) , sizeof ( fullchatmessage ) ) ;
2005-09-07 14:55:25 +00:00
}
2009-05-24 10:28:26 +00:00
# ifdef CSQC_DAT
if ( CSQC_ParsePrint ( fullchatmessage , PRINT_CHAT ) )
return ;
# endif
2011-06-16 02:03:57 +00:00
if ( con_separatechat . ival )
{
if ( ! con_chat )
con_chat = Con_Create ( " chat " , CONF_HIDDEN | CONF_NOTIFY | CONF_NOTIFY_BOTTOM ) ;
if ( con_chat )
{
2014-10-05 20:04:11 +00:00
Con_PrintCon ( con_chat , fullchatmessage , con_chat - > parseflags ) ;
2011-06-16 02:03:57 +00:00
if ( con_separatechat . ival = = 1 )
{
con_main . flags | = CONF_NOTIMES ;
2014-10-05 20:04:11 +00:00
Con_PrintCon ( & con_main , fullchatmessage , con_main . parseflags ) ;
2011-06-16 02:03:57 +00:00
con_main . flags & = CONF_NOTIMES ;
return ;
}
}
}
2009-05-24 10:28:26 +00:00
Con_Printf ( " %s " , fullchatmessage ) ;
2005-09-07 14:55:25 +00:00
}
2005-09-26 08:07:26 +00:00
// CL_PrintStandardMessage: takes non-chat net messages and performs name coloring
// NOTE: msg is considered destroyable
2005-10-16 03:47:32 +00:00
char acceptedchars [ ] = { ' . ' , ' ? ' , ' ! ' , ' \' ' , ' , ' , ' : ' , ' ' , ' \0 ' } ;
2009-05-24 10:11:17 +00:00
void CL_PrintStandardMessage ( char * msg , int printlevel )
2005-09-26 08:07:26 +00:00
{
int i ;
player_info_t * p ;
extern cvar_t cl_standardmsg ;
2005-10-16 03:47:32 +00:00
char * begin = msg ;
2009-05-24 10:11:17 +00:00
char fullmessage [ 2048 ] ;
fullmessage [ 0 ] = 0 ;
2005-09-26 08:07:26 +00:00
// search for player names in message
2013-10-29 17:38:22 +00:00
for ( i = 0 , p = cl . players ; i < cl . allocated_client_slots ; p + + , i + + )
2005-09-26 08:07:26 +00:00
{
char * v ;
char * name ;
int len ;
2009-05-24 10:11:17 +00:00
qboolean coloured ;
2005-09-26 08:07:26 +00:00
char c ;
2005-11-01 23:25:15 +00:00
name = p - > name ;
if ( ! ( * name ) )
2005-09-26 08:07:26 +00:00
continue ;
len = strlen ( name ) ;
v = strstr ( msg , name ) ;
2005-10-16 03:47:32 +00:00
while ( v )
2005-09-26 08:07:26 +00:00
{
2005-10-16 03:47:32 +00:00
// name parsing rules
if ( v ! = begin & & * ( v - 1 ) ! = ' ' ) // must be space before name
{
2005-10-16 19:35:21 +00:00
v = strstr ( v + len , name ) ;
2005-10-16 03:47:32 +00:00
continue ;
}
2005-11-26 03:02:55 +00:00
2005-10-16 03:47:32 +00:00
{
int i ;
char aftername = * ( v + len ) ;
2005-11-26 03:02:55 +00:00
2005-10-16 03:47:32 +00:00
// search for accepted chars in char after name in msg
for ( i = 0 ; i < sizeof ( acceptedchars ) ; i + + )
{
if ( acceptedchars [ i ] = = aftername )
break ;
}
if ( sizeof ( acceptedchars ) = = i )
{
2005-10-16 19:35:21 +00:00
v = strstr ( v + len , name ) ;
2005-10-16 03:47:32 +00:00
continue ; // no accepted char found
}
}
2005-09-26 08:07:26 +00:00
* v = 0 ; // cut off message
2009-05-24 10:11:17 +00:00
2005-09-26 08:07:26 +00:00
// print msg chunk
2009-05-24 10:11:17 +00:00
Q_strncatz ( fullmessage , msg , sizeof ( fullmessage ) ) ;
2005-09-26 08:07:26 +00:00
msg = v + len ; // update search point
// get name color
2009-11-04 21:16:50 +00:00
if ( p - > spectator | | cl_standardmsg . ival )
2005-09-26 08:07:26 +00:00
{
2009-05-24 10:11:17 +00:00
coloured = false ;
2005-09-26 08:07:26 +00:00
c = ' 7 ' ;
}
else
2009-05-24 10:11:17 +00:00
c = ' 0 ' + CL_PlayerColor ( p , & coloured ) ;
2005-09-26 08:07:26 +00:00
// print name
2013-03-12 22:47:42 +00:00
Q_strncatz ( fullmessage , va ( " ^[%s^%c%s^d \\ player \\ %i^] " , coloured ? " ^m " : " " , c , name , ( int ) ( p - cl . players ) ) , sizeof ( fullmessage ) ) ;
2005-10-16 03:47:32 +00:00
break ;
2005-09-26 08:07:26 +00:00
}
}
// print final chunk
2009-05-24 10:11:17 +00:00
Q_strncatz ( fullmessage , msg , sizeof ( fullmessage ) ) ;
2015-04-14 23:12:17 +00:00
Con_Printf ( " %s " , fullmessage ) ;
}
char printtext [ 4096 ] ;
void CL_ParsePrint ( char * msg , int level )
{
char n ;
if ( strlen ( printtext ) + strlen ( msg ) > = sizeof ( printtext ) )
{
Con_Printf ( " %s " , printtext ) ;
Q_strncpyz ( printtext , msg , sizeof ( printtext ) ) ;
}
else
strcat ( printtext , msg ) ; //safe due to size on if.
while ( ( msg = strchr ( printtext , ' \n ' ) ) )
{
n = msg [ 1 ] ;
msg [ 1 ] = 0 ;
if ( ! cls . demoseeking )
{
if ( level = = PRINT_CHAT )
{
char * body ;
int msgflags ;
player_info_t * plr = NULL ;
if ( ! TP_SuppressMessage ( printtext ) )
{
body = CL_ParseChat ( printtext , & plr , & msgflags ) ;
if ( body )
CL_PrintChat ( plr , body , msgflags ) ;
}
}
else
{
# ifdef PLUGINS
if ( Plug_ServerMessage ( printtext , level ) )
# endif
2009-05-24 10:28:26 +00:00
# ifdef CSQC_DAT
2015-04-14 23:12:17 +00:00
if ( ! CSQC_ParsePrint ( printtext , level ) )
2009-05-24 10:28:26 +00:00
# endif
2015-04-14 23:12:17 +00:00
if ( ! Stats_ParsePrintLine ( printtext ) | | ! msg_filter_frags . ival )
CL_PrintStandardMessage ( printtext , level ) ;
}
}
TP_SearchForMsgTriggers ( printtext , level ) ;
msg [ 1 ] = n ;
msg + + ;
memmove ( printtext , msg , strlen ( msg ) + 1 ) ;
}
2005-09-26 08:07:26 +00:00
}
2015-04-14 23:12:17 +00:00
2004-08-23 00:15:46 +00:00
char stufftext [ 4096 ] ;
void CL_ParseStuffCmd ( char * msg , int destsplit ) //this protects stuffcmds from network segregation.
{
strncat ( stufftext , msg , sizeof ( stufftext ) - 1 ) ;
2004-09-13 04:16:52 +00:00
while ( ( msg = strchr ( stufftext , ' \n ' ) ) )
2004-08-23 00:15:46 +00:00
{
* msg = ' \0 ' ;
Con_DPrintf ( " stufftext: %s \n " , stufftext ) ;
if ( ! strncmp ( stufftext , " fullserverinfo " , 15 ) )
2010-12-05 02:46:07 +00:00
{
2005-02-12 18:56:04 +00:00
Cmd_ExecuteString ( stufftext , RESTRICT_SERVER + destsplit ) ; //do this NOW so that it's done before any models or anything are loaded
2010-12-23 08:53:23 +00:00
# if _MSC_VER > 1200
2010-12-05 02:46:07 +00:00
if ( cls . netchan . remote_address . type ! = NA_LOOPBACK )
Sys_RecentServer ( " +connect " , cls . servername , va ( " %s (%s) " , Info_ValueForKey ( cl . serverinfo , " hostname " ) , cls . servername ) , " Join QW Server " ) ;
2010-12-23 08:53:23 +00:00
# endif
2010-12-05 02:46:07 +00:00
}
2004-08-23 00:15:46 +00:00
else
{
2006-11-03 15:53:04 +00:00
if ( ! strncmp ( stufftext , " //querycmd " , 11 ) )
{
COM_Parse ( stufftext + 11 ) ;
if ( Cmd_Exists ( com_token ) )
{
Cbuf_AddText ( " cmd cmdsupported " , RESTRICT_SERVER + destsplit ) ;
Cbuf_AddText ( com_token , RESTRICT_SERVER + destsplit ) ;
Cbuf_AddText ( " \n " , RESTRICT_SERVER + destsplit ) ;
}
}
2011-10-27 15:46:36 +00:00
else if ( ! strncmp ( stufftext , " //paknames " , 11 ) )
{
2011-12-05 15:23:40 +00:00
Q_strncatz ( cl . serverpaknames , stufftext + 11 , sizeof ( cl . serverpaknames ) ) ;
2011-10-27 15:46:36 +00:00
cl . serverpakschanged = true ;
}
else if ( ! strncmp ( stufftext , " //paks " , 7 ) )
{
2011-12-05 15:23:40 +00:00
Q_strncatz ( cl . serverpakcrcs , stufftext + 7 , sizeof ( cl . serverpakcrcs ) ) ;
2011-10-27 15:46:36 +00:00
cl . serverpakschanged = true ;
2011-12-05 15:23:40 +00:00
CL_CheckServerPacks ( ) ;
2011-10-27 15:46:36 +00:00
}
2009-07-06 01:20:20 +00:00
else if ( ! strncmp ( stufftext , " //vwep " , 7 ) )
2009-06-21 17:45:33 +00:00
{
2009-07-06 01:20:20 +00:00
int i ;
char * mname ;
Cmd_TokenizeString ( stufftext + 7 , false , false ) ;
for ( i = 0 ; i < Cmd_Argc ( ) ; i + + )
{
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
mname = Cmd_Argv ( i ) ;
if ( strcmp ( mname , " - " ) )
2009-07-06 01:20:20 +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
mname = va ( " progs/%s.mdl " , Cmd_Argv ( i ) ) ;
Q_strncpyz ( cl . model_name_vwep [ i ] , mname , sizeof ( cl . model_name_vwep [ i ] ) ) ;
if ( cls . state = = ca_active )
{
2014-03-30 08:55:06 +00:00
CL_CheckOrEnqueDownloadFile ( cl . model_name_vwep [ i ] , NULL , 0 ) ;
cl . model_precache_vwep [ i ] = Mod_ForName ( cl . model_name_vwep [ i ] , MLV_WARN ) ;
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
}
2009-07-06 01:20:20 +00:00
}
}
2009-06-21 17:45:33 +00:00
}
2007-01-06 09:36:38 +00:00
else if ( ! strncmp ( stufftext , " //exectrigger " , 14 ) )
{
COM_Parse ( stufftext + 14 ) ;
if ( Cmd_AliasExist ( com_token , RESTRICT_SERVER ) )
Cmd_ExecuteString ( com_token , RESTRICT_SERVER ) ; //do this NOW so that it's done before any models or anything are loaded
}
else if ( ! strncmp ( stufftext , " //set " , 6 ) )
{
Cmd_ExecuteString ( stufftext + 2 , RESTRICT_SERVER + destsplit ) ; //do this NOW so that it's done before any models or anything are loaded
}
2008-01-30 02:32:00 +00:00
else if ( ! strncmp ( stufftext , " //at " , 5 ) )
{
Cam_SetAutoTrack ( atoi ( stufftext + 5 ) ) ;
}
2011-05-20 04:10:46 +00:00
else if ( ! strncmp ( stufftext , " //kickfile " , 11 ) )
{
flocation_t loc ;
Cmd_TokenizeString ( stufftext + 2 , false , false ) ;
if ( FS_FLocateFile ( Cmd_Argv ( 1 ) , FSLFRT_IFFOUND , & loc ) )
2015-04-14 23:12:17 +00:00
Con_Printf ( " You have been kicked due to the file \" %s \" being modified. \n " , Cmd_Argv ( 1 ) ) ;
2011-05-20 04:10:46 +00:00
}
2007-10-05 14:11:17 +00:00
# ifdef PLUGINS
2007-10-05 11:45:18 +00:00
else if ( ! strncmp ( stufftext , " //tinfo " , 8 ) )
{
Cmd_TokenizeString ( stufftext + 2 , false , false ) ;
Plug_Command_f ( ) ;
}
2008-01-30 02:32:00 +00:00
else if ( ! strncmp ( stufftext , " //sn " , 5 ) )
{
Cmd_TokenizeString ( stufftext + 2 , false , false ) ;
Plug_Command_f ( ) ;
}
2007-10-05 14:11:17 +00:00
# endif
2005-02-12 18:56:04 +00:00
# ifdef CSQC_DAT
2010-07-11 02:22:39 +00:00
else if ( CSQC_StuffCmd ( destsplit , stufftext , msg ) )
{
}
2005-02-12 18:56:04 +00:00
# endif
2008-01-30 02:32:00 +00:00
else
2005-02-12 18:56:04 +00:00
{
Cbuf_AddText ( stufftext , RESTRICT_SERVER + destsplit ) ;
Cbuf_AddText ( " \n " , RESTRICT_SERVER + destsplit ) ;
}
2004-08-23 00:15:46 +00:00
}
msg + + ;
memmove ( stufftext , msg , strlen ( msg ) + 1 ) ;
}
}
2005-05-26 12:55:34 +00:00
void CL_ParsePrecache ( void )
{
2011-07-30 14:14:56 +00:00
int i , code = ( unsigned short ) MSG_ReadShort ( ) ;
2005-05-26 12:55:34 +00:00
char * s = MSG_ReadString ( ) ;
2013-03-12 22:44:00 +00:00
i = code & ~ PC_TYPE ;
switch ( code & PC_TYPE )
2005-05-26 12:55:34 +00:00
{
2013-03-12 22:44:00 +00:00
case PC_MODEL :
2014-09-17 03:04:08 +00:00
if ( i > = 1 & & i < MAX_PRECACHE_MODELS )
2005-05-26 12:55:34 +00:00
{
model_t * model ;
2008-11-09 22:29:28 +00:00
CL_CheckOrEnqueDownloadFile ( s , s , 0 ) ;
2014-10-05 20:04:11 +00:00
model = Mod_ForName ( Mod_FixName ( s , cl . model_name [ 1 ] ) , ( i = = 1 ) ? MLV_ERROR : MLV_WARN ) ;
2005-05-26 12:55:34 +00:00
if ( ! model )
Con_Printf ( " svc_precache: Mod_ForName( \" %s \" ) failed \n " , s ) ;
cl . model_precache [ i ] = model ;
2013-11-21 23:02:28 +00:00
Q_strncpyz ( cl . model_name [ i ] , s , sizeof ( cl . model_name [ i ] ) ) ;
2009-03-03 01:52:30 +00:00
cl . model_precaches_added = true ;
2005-05-26 12:55:34 +00:00
}
else
2014-09-17 03:04:08 +00:00
Con_Printf ( " svc_precache: model index %i outside range %i...%i \n " , i , 1 , MAX_PRECACHE_MODELS ) ;
2011-07-30 14:14:56 +00:00
break ;
2013-03-12 22:44:00 +00:00
case PC_UNUSED :
2012-07-05 19:42:36 +00:00
break ;
2013-03-12 22:44:00 +00:00
case PC_SOUND :
2014-09-17 03:04:08 +00:00
if ( i > = 1 & & i < MAX_PRECACHE_SOUNDS )
2005-05-26 12:55:34 +00:00
{
sfx_t * sfx ;
2009-04-06 00:34:32 +00:00
if ( S_HaveOutput ( ) )
CL_CheckOrEnqueDownloadFile ( va ( " sound/%s " , s ) , NULL , 0 ) ;
2005-05-26 12:55:34 +00:00
sfx = S_PrecacheSound ( s ) ;
if ( ! sfx )
Con_Printf ( " svc_precache: S_PrecacheSound( \" %s \" ) failed \n " , s ) ;
cl . sound_precache [ i ] = sfx ;
2013-11-21 23:02:28 +00:00
Q_strncpyz ( cl . sound_name [ i ] , s , sizeof ( cl . sound_name [ i ] ) ) ;
2005-05-26 12:55:34 +00:00
}
else
2014-09-17 03:04:08 +00:00
Con_Printf ( " svc_precache: sound index %i outside range %i...%i \n " , i , 1 , MAX_PRECACHE_SOUNDS ) ;
2011-07-30 14:14:56 +00:00
break ;
2013-03-12 22:44:00 +00:00
case PC_PARTICLE :
if ( i > = 1 & & i < MAX_SSPARTICLESPRE )
2012-07-05 19:42:36 +00:00
{
2013-03-12 22:44:00 +00:00
if ( cl . particle_ssname [ i ] )
free ( cl . particle_ssname [ i ] ) ;
cl . particle_ssname [ i ] = strdup ( s ) ;
2014-03-30 08:55:06 +00:00
cl . particle_ssprecache [ i ] = P_FindParticleType ( s ) ;
2013-03-12 22:44:00 +00:00
cl . particle_ssprecaches = true ;
2012-07-05 19:42:36 +00:00
}
2013-03-12 22:44:00 +00:00
else
Con_Printf ( " svc_precache: particle index %i outside range %i...%i \n " , i , 1 , MAX_SSPARTICLESPRE ) ;
2012-07-05 19:42:36 +00:00
break ;
2005-05-26 12:55:34 +00:00
}
}
2015-04-21 04:12:00 +00:00
void Con_HexDump ( qbyte * packet , size_t len )
2006-01-11 22:24:08 +00:00
{
int i ;
int pos ;
pos = 0 ;
2015-04-21 04:12:00 +00:00
while ( pos < len )
2006-01-11 22:24:08 +00:00
{
Con_Printf ( " %5i " , pos ) ;
for ( i = 0 ; i < 16 ; i + + )
{
2015-04-21 04:12:00 +00:00
if ( pos > = len )
2010-08-16 02:03:02 +00:00
Con_Printf ( " - " ) ;
2006-01-11 22:24:08 +00:00
else
2015-04-21 04:12:00 +00:00
Con_Printf ( " %2x " , packet [ pos ] ) ;
2006-01-11 22:24:08 +00:00
pos + + ;
}
pos - = 16 ;
for ( i = 0 ; i < 16 ; i + + )
{
2015-04-21 04:12:00 +00:00
if ( pos > = len )
2006-01-11 22:24:08 +00:00
Con_Printf ( " X " ) ;
2013-03-12 22:35:33 +00:00
else if ( packet [ pos ] = = 0 | | packet [ pos ] = = ' \t ' | | packet [ pos ] = = ' \r ' | | packet [ pos ] = = ' \n ' )
2006-01-11 22:24:08 +00:00
Con_Printf ( " . " ) ;
else
2015-04-21 04:12:00 +00:00
Con_Printf ( " %c " , packet [ pos ] ) ;
2006-01-11 22:24:08 +00:00
pos + + ;
}
Con_Printf ( " \n " ) ;
}
2015-04-21 04:12:00 +00:00
}
void CL_DumpPacket ( void )
{
Con_HexDump ( net_message . data , net_message . cursize ) ;
2006-01-11 22:24:08 +00:00
}
2005-05-26 12:55:34 +00:00
2014-06-02 16:50:40 +00:00
void CL_ParsePortalState ( void )
{
int mode = MSG_ReadByte ( ) ;
int a1 , a2 ;
2014-06-04 18:29:01 +00:00
switch ( mode & 0xc0 )
2014-06-02 16:50:40 +00:00
{
case 0x80 :
if ( mode & 2 )
a1 = MSG_ReadShort ( ) ;
else
a1 = MSG_ReadByte ( ) ;
2014-06-08 04:59:00 +00:00
# ifdef Q2BSPS
2015-02-02 08:01:53 +00:00
CMQ2_SetAreaPortalState ( cl . worldmodel , a1 , ! ! ( mode & 1 ) ) ;
2014-06-08 04:59:00 +00:00
# endif
2014-06-02 16:50:40 +00:00
break ;
case 0xc0 :
if ( mode & 2 )
{
a1 = MSG_ReadShort ( ) ;
a2 = MSG_ReadShort ( ) ;
}
else
{
a1 = MSG_ReadByte ( ) ;
a2 = MSG_ReadByte ( ) ;
}
2014-06-08 04:59:00 +00:00
# ifdef Q3BSPS
2015-02-02 08:01:53 +00:00
CMQ3_SetAreaPortalState ( cl . worldmodel , a1 , a2 , ! ! ( mode & 1 ) ) ;
2014-06-08 04:59:00 +00:00
# endif
2014-06-02 16:50:40 +00:00
break ;
default :
//to be phased out.
mode | = MSG_ReadByte ( ) < < 8 ;
2014-06-08 04:59:00 +00:00
# ifdef Q2BSPS
2015-02-02 08:01:53 +00:00
CMQ2_SetAreaPortalState ( cl . worldmodel , mode & 0x7fff , ! ! ( mode & 0x8000 ) ) ;
2014-06-08 04:59:00 +00:00
# endif
2014-06-02 16:50:40 +00:00
break ;
}
}
2012-02-12 05:18:31 +00:00
# define SHOWNET(x) if(cl_shownet.value>=2)Con_Printf ("%3i:%s\n", msg_readcount-1, x);
# define SHOWNET2(x, y) if(cl_shownet.value>=2)Con_Printf ("%3i:%3i:%s\n", msg_readcount-1, y, x);
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = = = = =
CL_ParseServerMessage
= = = = = = = = = = = = = = = = = = = = =
*/
int received_framecount ;
2011-09-03 03:49:43 +00:00
void CLQW_ParseServerMessage ( void )
2004-08-23 00:15:46 +00:00
{
int cmd ;
char * s ;
int i , j ;
int destsplit ;
2008-05-25 22:23:43 +00:00
float f ;
2013-04-13 08:15:18 +00:00
qboolean csqcpacket = false ;
2013-07-26 17:19:06 +00:00
inframe_t * inf ;
extern vec3_t demoangles ;
2004-08-23 00:15:46 +00:00
received_framecount = host_framecount ;
cl . last_servermessage = realtime ;
CL_ClearProjectiles ( ) ;
2013-07-26 17:19:06 +00:00
//clear out fixangles stuff
inf = & cl . inframes [ cls . netchan . incoming_sequence & UPDATE_MASK ] ;
for ( j = 0 ; j < MAX_SPLITS ; j + + )
inf - > packet_entities . fixangles [ j ] = false ;
if ( cls . demoplayback = = DPB_QUAKEWORLD )
{
inf - > packet_entities . fixangles [ 0 ] = 2 ;
VectorCopy ( demoangles , inf - > packet_entities . fixedangles [ 0 ] ) ;
}
2004-08-23 00:15:46 +00:00
//
// if recording demos, copy the message out
2005-03-12 23:40:42 +00:00
//
2004-08-23 00:15:46 +00:00
if ( cl_shownet . value = = 1 )
2013-11-29 14:36:47 +00:00
Con_Printf ( " %i " , net_message . cursize ) ;
2012-02-12 05:18:31 +00:00
else if ( cl_shownet . value > = 2 )
2013-11-29 14:36:47 +00:00
Con_Printf ( " ------------------ \n " ) ;
2004-08-23 00:15:46 +00:00
CL_ParseClientdata ( ) ;
2015-03-03 00:14:43 +00:00
//vanilla QW has no timing info in the client and depends upon the client for all timing.
//using the demo's timing for interpolation prevents unneccesary drift, and solves issues with demo seeking and other such things.
if ( cls . demoplayback & & ! ( cls . fteprotocolextensions & PEXT_ACCURATETIMINGS ) )
{
extern float demtime ;
if ( cl . gametime ! = demtime )
{
cl . oldgametime = cl . gametime ;
cl . oldgametimemark = cl . gametimemark ;
cl . gametime = demtime ;
cl . gametimemark = realtime ;
}
}
2004-08-23 00:15:46 +00:00
//
// parse the message
//
while ( 1 )
{
if ( msg_badread )
{
2006-02-12 20:20:01 +00:00
CL_DumpPacket ( ) ;
2004-08-23 00:15:46 +00:00
Host_EndGame ( " CL_ParseServerMessage: Bad server message " ) ;
break ;
}
cmd = MSG_ReadByte ( ) ;
2008-05-25 22:23:43 +00:00
if ( cmd = = svcfte_choosesplitclient )
2004-08-23 00:15:46 +00:00
{
2014-03-30 08:55:06 +00:00
SHOWNET2 ( svc_qwstrings [ cmd ] , cmd ) ;
2004-08-23 00:15:46 +00:00
2010-07-11 02:22:39 +00:00
destsplit = MSG_ReadByte ( ) % MAX_SPLITS ;
2004-08-23 00:15:46 +00:00
cmd = MSG_ReadByte ( ) ;
}
else
destsplit = 0 ;
if ( cmd = = - 1 )
{
msg_readcount + + ; // so the EOM showner has the right value
SHOWNET ( " END OF MESSAGE " ) ;
break ;
}
2014-03-30 08:55:06 +00:00
SHOWNET2 ( svc_qwstrings [ cmd ] , cmd ) ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
// other commands
switch ( cmd )
{
default :
2006-01-11 22:24:08 +00:00
CL_DumpPacket ( ) ;
2013-04-13 08:15:18 +00:00
Host_EndGame ( " CLQW_ParseServerMessage: Illegible server message (%i@%i)%s " , cmd , msg_readcount - 1 , ( ! cl . csqcdebug & & csqcpacket ) ? " \n 'sv_csqcdebug 1' might aid in debugging this. " : " " ) ;
2004-08-23 00:15:46 +00:00
return ;
case svc_time :
2005-05-26 12:55:34 +00:00
cl . oldgametime = cl . gametime ;
2004-08-23 00:15:46 +00:00
cl . gametime = MSG_ReadFloat ( ) ;
cl . gametimemark = realtime ;
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_nop :
// Con_Printf ("svc_nop\n");
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_disconnect :
2008-01-09 00:52:31 +00:00
if ( cls . demoplayback = = DPB_EZTV ) //eztv fails to detect the end of demos.
MSG_ReadString ( ) ;
2011-06-05 01:36:14 +00:00
else if ( cls . demoplayback )
{
CL_Disconnect_f ( ) ;
return ;
}
2008-01-09 00:52:31 +00:00
else if ( cls . state = = ca_connected )
2004-08-23 00:15:46 +00:00
{
2014-09-02 02:44:43 +00:00
Host_EndGame ( " Server disconnected \n " ) ;
2004-08-23 00:15:46 +00:00
}
else
Host_EndGame ( " Server disconnected " ) ;
break ;
case svc_print :
i = MSG_ReadByte ( ) ;
s = MSG_ReadString ( ) ;
2015-04-14 23:12:17 +00:00
CL_ParsePrint ( s , i ) ;
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_centerprint :
2006-01-01 09:01:15 +00:00
s = MSG_ReadString ( ) ;
2006-01-13 06:27:18 +00:00
# ifdef PLUGINS
2006-01-01 09:01:15 +00:00
if ( Plug_CenterPrintMessage ( s , destsplit ) )
2006-01-13 06:27:18 +00:00
# endif
2008-11-09 22:29:28 +00:00
SCR_CenterPrint ( destsplit , s , false ) ;
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_stufftext :
s = MSG_ReadString ( ) ;
2005-09-26 03:40:09 +00:00
CL_ParseStuffCmd ( s , destsplit ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_damage :
2013-06-23 02:17:02 +00:00
V_ParseDamage ( & cl . playerview [ destsplit ] ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_serverdata :
Cbuf_Execute ( ) ; // make sure any stuffed commands are done
2011-07-30 14:14:56 +00:00
CLQW_ParseServerData ( ) ;
2004-08-23 00:15:46 +00:00
break ;
# ifdef PEXT_SETVIEW
case svc_setview :
if ( ! ( cls . fteprotocolextensions & PEXT_SETVIEW ) )
2008-11-09 22:29:28 +00:00
Con_Printf ( " ^1PEXT_SETVIEW is meant to be disabled \n " ) ;
2013-06-23 02:17:02 +00:00
cl . playerview [ destsplit ] . viewentity = MSGCL_ReadEntity ( ) ;
2004-08-23 00:15:46 +00:00
break ;
# endif
2010-12-05 02:46:07 +00:00
case svcfte_setangledelta :
for ( i = 0 ; i < 3 ; i + + )
2012-07-05 19:42:36 +00:00
cl . playerview [ destsplit ] . viewangles [ i ] + = MSG_ReadAngle16 ( ) ;
2013-07-26 17:19:06 +00:00
// VectorCopy (cl.playerview[destsplit].viewangles, cl.playerview[destsplit].simangles);
2010-12-05 02:46:07 +00:00
break ;
2004-08-23 00:15:46 +00:00
case svc_setangle :
2008-01-09 00:52:31 +00:00
if ( cls . demoplayback = = DPB_MVD | | cls . demoplayback = = DPB_EZTV )
2004-08-23 00:15:46 +00:00
{
2013-07-26 17:19:06 +00:00
//I really don't get the point of fixangles in an mvd. to disable interpolation for that frame?
2010-11-06 23:05:29 +00:00
vec3_t ang ;
2004-08-23 00:15:46 +00:00
i = MSG_ReadByte ( ) ;
for ( i = 0 ; i < 3 ; i + + )
2010-11-06 23:05:29 +00:00
ang [ i ] = MSG_ReadAngle ( ) ;
for ( j = 0 ; j < cl . splitclients ; j + + )
{
2013-06-23 02:17:02 +00:00
playerview_t * pv = & cl . playerview [ j ] ;
if ( Cam_TrackNum ( pv ) = = i )
2010-11-06 23:05:29 +00:00
{
2013-07-26 17:19:06 +00:00
inf - > packet_entities . fixangles [ j ] = true ;
VectorCopy ( ang , inf - > packet_entities . fixedangles [ j ] ) ;
2010-11-06 23:05:29 +00:00
}
}
2004-08-23 00:15:46 +00:00
break ;
}
2013-07-26 17:19:06 +00:00
inf - > packet_entities . fixangles [ destsplit ] = true ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 3 ; i + + )
2013-07-26 17:19:06 +00:00
{
cl . playerview [ destsplit ] . viewangles [ i ] = cl . playerview [ destsplit ] . intermissionangles [ i ] = inf - > packet_entities . fixedangles [ destsplit ] [ i ] = MSG_ReadAngle ( ) ;
}
2004-08-23 00:15:46 +00:00
break ;
case svc_lightstyle :
i = MSG_ReadByte ( ) ;
if ( i > = MAX_LIGHTSTYLES )
Host_EndGame ( " svc_lightstyle > MAX_LIGHTSTYLES " ) ;
2014-06-25 03:53:11 +00:00
R_UpdateLightStyle ( i , MSG_ReadString ( ) , 1 , 1 , 1 ) ;
2004-08-23 00:15:46 +00:00
break ;
# ifdef PEXT_LIGHTSTYLECOL
2008-05-25 22:23:43 +00:00
case svcfte_lightstylecol :
2004-08-23 00:15:46 +00:00
if ( ! ( cls . fteprotocolextensions & PEXT_LIGHTSTYLECOL ) )
Host_EndGame ( " PEXT_LIGHTSTYLECOL is meant to be disabled \n " ) ;
i = MSG_ReadByte ( ) ;
if ( i > = MAX_LIGHTSTYLES )
2005-09-18 02:12:30 +00:00
Host_EndGame ( " svc_lightstyle > MAX_LIGHTSTYLES " ) ;
2014-06-25 03:53:11 +00:00
{
int bits ;
vec3_t rgb ;
bits = MSG_ReadByte ( ) ;
if ( bits & 0x80 )
{
rgb [ 0 ] = MSG_ReadShort ( ) / 1024.0 ;
rgb [ 1 ] = MSG_ReadShort ( ) / 1024.0 ;
2014-08-25 07:35:41 +00:00
rgb [ 2 ] = MSG_ReadShort ( ) / 1024.0 ;
2014-06-25 03:53:11 +00:00
}
else
{
rgb [ 0 ] = ( bits & 1 ) ? 1 : 0 ;
rgb [ 1 ] = ( bits & 2 ) ? 1 : 0 ;
rgb [ 2 ] = ( bits & 4 ) ? 1 : 0 ;
}
R_UpdateLightStyle ( i , MSG_ReadString ( ) , rgb [ 0 ] , rgb [ 1 ] , rgb [ 2 ] ) ;
}
2004-08-23 00:15:46 +00:00
break ;
# endif
case svc_sound :
------------------------------------------------------------------------
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
CLQW_ParseStartSoundPacket ( ) ;
2004-08-23 00:15:46 +00:00
break ;
2008-11-28 20:34:51 +00:00
# ifdef PEXT_SOUNDDBL
case svcfte_soundextended :
CLNQ_ParseStartSoundPacket ( ) ;
break ;
# endif
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_stopsound :
i = MSG_ReadShort ( ) ;
S_StopSound ( i > > 3 , i & 7 ) ;
break ;
2005-09-26 03:40:09 +00:00
2010-11-15 02:40:31 +00:00
# ifdef PEXT2_VOICECHAT
case svcfte_voicechat :
2010-11-20 22:01:16 +00:00
S_Voip_Parse ( ) ;
2010-11-15 02:40:31 +00:00
break ;
# endif
2015-04-14 23:12:17 +00:00
# ifdef TERRAIN
case svcfte_brushedit :
CL_Parse_BrushEdit ( ) ;
break ;
# endif
2004-08-23 00:15:46 +00:00
case svc_updatefrags :
Sbar_Changed ( ) ;
i = MSG_ReadByte ( ) ;
if ( i > = MAX_CLIENTS )
Host_EndGame ( " CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD " ) ;
cl . players [ i ] . frags = MSG_ReadShort ( ) ;
2005-09-26 03:40:09 +00:00
break ;
2004-08-23 00:15:46 +00:00
case svc_updateping :
i = MSG_ReadByte ( ) ;
if ( i > = MAX_CLIENTS )
Host_EndGame ( " CL_ParseServerMessage: svc_updateping > MAX_SCOREBOARD " ) ;
cl . players [ i ] . ping = MSG_ReadShort ( ) ;
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_updatepl :
i = MSG_ReadByte ( ) ;
if ( i > = MAX_CLIENTS )
Host_EndGame ( " CL_ParseServerMessage: svc_updatepl > MAX_SCOREBOARD " ) ;
cl . players [ i ] . pl = MSG_ReadByte ( ) ;
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_updateentertime :
// time is sent over as seconds ago
i = MSG_ReadByte ( ) ;
if ( i > = MAX_CLIENTS )
Host_EndGame ( " CL_ParseServerMessage: svc_updateentertime > MAX_SCOREBOARD " ) ;
2005-11-26 03:02:55 +00:00
cl . players [ i ] . entertime = cl . servertime - MSG_ReadFloat ( ) ;
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_spawnbaseline :
------------------------------------------------------------------------
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
i = MSGCL_ReadEntity ( ) ;
2006-07-24 04:24:41 +00:00
if ( ! CL_CheckBaselines ( i ) )
Host_EndGame ( " CL_ParseServerMessage: svc_spawnbaseline failed with size %i " , i ) ;
CL_ParseBaseline ( cl_baselines + i ) ;
2004-08-23 00:15:46 +00:00
break ;
2008-05-25 22:23:43 +00:00
case svcfte_spawnbaseline2 :
2004-08-23 00:15:46 +00:00
CL_ParseBaseline2 ( ) ;
break ;
case svc_spawnstatic :
CL_ParseStatic ( 1 ) ;
break ;
2013-03-12 22:35:33 +00:00
case svcfte_spawnstatic2 :
2004-08-23 00:15:46 +00:00
CL_ParseStatic ( 2 ) ;
break ;
case svc_temp_entity :
# ifdef NQPROT
CL_ParseTEnt ( false ) ;
# else
CL_ParseTEnt ( ) ;
# endif
break ;
2008-05-25 22:23:43 +00:00
case svcfte_customtempent :
2004-08-23 00:15:46 +00:00
CL_ParseCustomTEnt ( ) ;
break ;
case svc_particle :
2005-03-10 03:55:18 +00:00
CLNQ_ParseParticleEffect ( ) ;
2004-08-23 00:15:46 +00:00
break ;
2008-05-25 22:23:43 +00:00
case svcfte_particle2 :
2005-03-10 03:55:18 +00:00
CL_ParseParticleEffect2 ( ) ;
2004-08-23 00:15:46 +00:00
break ;
2008-05-25 22:23:43 +00:00
case svcfte_particle3 :
2005-03-10 03:55:18 +00:00
CL_ParseParticleEffect3 ( ) ;
2004-08-23 00:15:46 +00:00
break ;
2008-05-25 22:23:43 +00:00
case svcfte_particle4 :
2005-03-10 03:55:18 +00:00
CL_ParseParticleEffect4 ( ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_killedmonster :
2013-06-23 02:17:02 +00:00
//fixme: update all player stats
2012-07-05 19:42:36 +00:00
cl . playerview [ destsplit ] . stats [ STAT_MONSTERS ] + + ;
2013-06-23 02:17:02 +00:00
cl . playerview [ destsplit ] . statsf [ STAT_MONSTERS ] + + ;
2004-08-23 00:15:46 +00:00
break ;
case svc_foundsecret :
2013-06-23 02:17:02 +00:00
//fixme: update all player stats
2012-07-05 19:42:36 +00:00
cl . playerview [ destsplit ] . stats [ STAT_SECRETS ] + + ;
2013-06-23 02:17:02 +00:00
cl . playerview [ destsplit ] . statsf [ STAT_SECRETS ] + + ;
2004-08-23 00:15:46 +00:00
break ;
2012-09-30 05:52:03 +00:00
case svcqw_updatestatbyte :
2004-08-23 00:15:46 +00:00
i = MSG_ReadByte ( ) ;
j = MSG_ReadByte ( ) ;
2008-05-25 22:23:43 +00:00
CL_SetStatFloat ( destsplit , i , j ) ;
2014-08-16 05:33:50 +00:00
CL_SetStatInt ( destsplit , i , j ) ;
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
i = MSG_ReadByte ( ) ;
j = MSG_ReadLong ( ) ; //make qbyte if nq compatability?
2008-05-25 22:23:43 +00:00
CL_SetStatFloat ( destsplit , i , j ) ;
2014-08-16 05:33:50 +00:00
CL_SetStatInt ( destsplit , i , j ) ;
2008-05-25 22:23:43 +00:00
break ;
case svcfte_updatestatstring :
i = MSG_ReadByte ( ) ;
s = MSG_ReadString ( ) ;
CL_SetStatString ( destsplit , i , s ) ;
break ;
case svcfte_updatestatfloat :
i = MSG_ReadByte ( ) ;
f = MSG_ReadFloat ( ) ;
CL_SetStatInt ( destsplit , i , f ) ;
CL_SetStatFloat ( destsplit , i , f ) ;
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_spawnstaticsound :
2012-11-27 03:23:19 +00:00
CL_ParseStaticSound ( false ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_cdtrack :
2013-10-08 16:29:54 +00:00
{
2014-06-21 17:58:17 +00:00
//quakeworld got a crippled svc_cdtrack.
2013-10-08 16:29:54 +00:00
unsigned int firsttrack ;
firsttrack = MSG_ReadByte ( ) ;
Media_NumberedTrack ( firsttrack , firsttrack ) ;
}
2004-08-23 00:15:46 +00:00
break ;
case svc_intermission :
2005-07-14 01:57:34 +00:00
if ( ! cl . intermission )
TP_ExecTrigger ( " f_mapend " ) ;
2004-08-23 00:15:46 +00:00
cl . intermission = 1 ;
2011-12-05 15:23:40 +00:00
cl . completed_time = cl . gametime ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 3 ; i + + )
2012-07-05 19:42:36 +00:00
cl . playerview [ destsplit ] . simorg [ i ] = MSG_ReadCoord ( ) ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 3 ; i + + )
2013-07-26 17:19:06 +00:00
cl . playerview [ destsplit ] . intermissionangles [ i ] = MSG_ReadAngle ( ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_finale :
2012-01-17 07:57:46 +00:00
if ( ! cl . intermission )
2013-07-26 17:19:06 +00:00
{
2012-01-17 07:57:46 +00:00
for ( i = 0 ; i < MAX_SPLITS ; i + + )
2013-06-23 02:17:02 +00:00
cl . playerview [ i ] . simorg [ 2 ] + = cl . playerview [ i ] . viewheight ;
2013-07-26 17:19:06 +00:00
VectorCopy ( cl . playerview [ destsplit ] . simangles , cl . playerview [ destsplit ] . intermissionangles ) ;
}
2012-01-17 07:57:46 +00:00
2004-08-23 00:15:46 +00:00
cl . intermission = 2 ;
2011-12-05 15:23:40 +00:00
cl . completed_time = cl . gametime ;
2008-11-09 22:29:28 +00:00
SCR_CenterPrint ( destsplit , MSG_ReadString ( ) , false ) ;
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_sellscreen :
2011-04-20 23:05:45 +00:00
Cmd_ExecuteString ( " help " , RESTRICT_SERVER ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_smallkick :
2013-06-23 02:17:02 +00:00
cl . playerview [ destsplit ] . punchangle = - 2 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_bigkick :
2013-06-23 02:17:02 +00:00
cl . playerview [ destsplit ] . punchangle = - 4 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_muzzleflash :
2014-04-24 01:53:01 +00:00
CL_MuzzleFlash ( MSGCL_ReadEntity ( ) ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_updateuserinfo :
CL_UpdateUserinfo ( ) ;
break ;
case svc_setinfo :
2007-02-23 00:21:33 +00:00
CL_ParseSetInfo ( ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_serverinfo :
CL_ServerInfo ( ) ;
break ;
case svc_download :
CL_ParseDownload ( ) ;
break ;
case svc_playerinfo :
CL_ParsePlayerinfo ( ) ;
break ;
case svc_nails :
2004-12-08 04:14:52 +00:00
CL_ParseProjectiles ( cl_spikeindex , false ) ;
break ;
case svc_nails2 :
CL_ParseProjectiles ( cl_spikeindex , true ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_chokecount : // some preceding packets were choked
i = MSG_ReadByte ( ) ;
for ( j = 0 ; j < i ; j + + )
2013-09-06 22:57:44 +00:00
cl . outframes [ ( cls . netchan . incoming_acknowledged - 1 - j ) & UPDATE_MASK ] . latency = - 2 ;
2004-08-23 00:15:46 +00:00
break ;
case svc_modellist :
CL_ParseModellist ( false ) ;
break ;
2008-05-25 22:23:43 +00:00
case svcfte_modellistshort :
2004-08-23 00:15:46 +00:00
CL_ParseModellist ( true ) ;
break ;
case svc_soundlist :
2008-11-28 20:34:51 +00:00
CL_ParseSoundlist ( false ) ;
break ;
# ifdef PEXT_SOUNDDBL
case svcfte_soundlistshort :
CL_ParseSoundlist ( true ) ;
2004-08-23 00:15:46 +00:00
break ;
2008-11-28 20:34:51 +00:00
# endif
2004-08-23 00:15:46 +00:00
case svc_packetentities :
------------------------------------------------------------------------
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
CLQW_ParsePacketEntities ( false ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_deltapacketentities :
------------------------------------------------------------------------
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
CLQW_ParsePacketEntities ( true ) ;
2004-08-23 00:15:46 +00:00
break ;
2012-02-12 05:18:31 +00:00
case svcfte_updateentities :
CLFTE_ParseEntities ( ) ;
break ;
2004-08-23 00:15:46 +00:00
2011-05-20 04:10:46 +00:00
case svc_maxspeed :
2013-06-23 02:17:02 +00:00
cl . playerview [ destsplit ] . maxspeed = MSG_ReadFloat ( ) ;
2004-08-23 00:15:46 +00:00
break ;
2011-05-20 04:10:46 +00:00
case svc_entgravity :
2013-06-23 02:17:02 +00:00
cl . playerview [ destsplit ] . entgravity = MSG_ReadFloat ( ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_setpause :
cl . paused = MSG_ReadByte ( ) ;
2013-11-21 23:02:28 +00:00
// Media_SetPauseTrack(!!cl.paused);
2004-08-23 00:15:46 +00:00
break ;
------------------------------------------------------------------------
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
// case svc_ftesetclientpersist:
// CL_ParseClientPersist();
// break;
2004-08-23 00:15:46 +00:00
case svc_setportalstate :
2014-06-02 16:50:40 +00:00
CL_ParsePortalState ( ) ;
2004-08-23 00:15:46 +00:00
break ;
2004-09-01 00:01:08 +00:00
2008-05-25 22:23:43 +00:00
case svcfte_showpic :
2004-09-01 00:01:08 +00:00
SCR_ShowPic_Create ( ) ;
break ;
2008-05-25 22:23:43 +00:00
case svcfte_hidepic :
2004-09-01 00:01:08 +00:00
SCR_ShowPic_Hide ( ) ;
break ;
2008-05-25 22:23:43 +00:00
case svcfte_movepic :
2004-09-01 00:01:08 +00:00
SCR_ShowPic_Move ( ) ;
break ;
2008-05-25 22:23:43 +00:00
case svcfte_updatepic :
2004-09-01 00:01:08 +00:00
SCR_ShowPic_Update ( ) ;
break ;
2004-10-10 06:32:29 +00:00
2008-05-25 22:23:43 +00:00
case svcfte_effect :
2004-11-22 00:00:54 +00:00
CL_ParseEffect ( false ) ;
break ;
2008-05-25 22:23:43 +00:00
case svcfte_effect2 :
2004-11-22 00:00:54 +00:00
CL_ParseEffect ( true ) ;
break ;
2005-02-28 07:16:19 +00:00
# ifdef PEXT_CSQC
2008-05-25 22:23:43 +00:00
case svcfte_csqcentities :
2013-04-13 08:15:18 +00:00
csqcpacket = true ;
2005-02-28 07:16:19 +00:00
CSQC_ParseEntities ( ) ;
break ;
# endif
2008-05-25 22:23:43 +00:00
case svcfte_precache :
2005-05-26 12:55:34 +00:00
CL_ParsePrecache ( ) ;
break ;
2008-11-09 22:29:28 +00:00
case svcfte_trailparticles :
2012-07-05 19:42:36 +00:00
CL_ParseTrailParticles ( ) ;
2008-11-09 22:29:28 +00:00
break ;
case svcfte_pointparticles :
2012-07-05 19:42:36 +00:00
CL_ParsePointParticles ( false ) ;
2008-11-09 22:29:28 +00:00
break ;
case svcfte_pointparticles1 :
2012-07-05 19:42:36 +00:00
CL_ParsePointParticles ( true ) ;
2008-11-09 22:29:28 +00:00
break ;
2009-04-01 22:03:56 +00:00
case svcfte_cgamepacket :
2013-04-13 08:15:18 +00:00
csqcpacket = true ;
2009-04-01 22:03:56 +00:00
# ifdef CSQC_DAT
2011-05-20 04:10:46 +00:00
if ( CSQC_ParseGamePacket ( ) )
2009-04-01 22:03:56 +00:00
break ;
2013-12-29 22:48:28 +00:00
# endif
# ifdef HLCLIENT
if ( CLHL_ParseGamePacket ( ) )
break ;
2009-04-01 22:03:56 +00:00
# endif
Con_Printf ( " Unable to parse gamecode packet \n " ) ;
break ;
2004-08-23 00:15:46 +00:00
}
}
}
# ifdef Q2CLIENT
void CLQ2_ParseServerMessage ( void )
{
int cmd ;
char * s ;
int i ;
// int j;
received_framecount = host_framecount ;
cl . last_servermessage = realtime ;
CL_ClearProjectiles ( ) ;
//
// if recording demos, copy the message out
//
if ( cl_shownet . value = = 1 )
2013-11-29 14:36:47 +00:00
Con_Printf ( " %i " , net_message . cursize ) ;
2004-08-23 00:15:46 +00:00
else if ( cl_shownet . value = = 2 )
2013-11-29 14:36:47 +00:00
Con_Printf ( " ------------------ \n " ) ;
2004-08-23 00:15:46 +00:00
CL_ParseClientdata ( ) ;
//
// parse the message
//
while ( 1 )
{
if ( msg_badread )
{
2005-03-18 06:14:07 +00:00
Host_EndGame ( " CLQ2_ParseServerMessage: Bad server message " ) ;
2004-08-23 00:15:46 +00:00
break ;
}
cmd = MSG_ReadByte ( ) ;
if ( cmd = = - 1 )
{
msg_readcount + + ; // so the EOM showner has the right value
SHOWNET ( " END OF MESSAGE " ) ;
break ;
}
SHOWNET ( va ( " %i " , cmd ) ) ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
// other commands
switch ( cmd )
{
default :
2009-11-04 21:16:50 +00:00
Host_EndGame ( " CLQ2_ParseServerMessage: Illegible server message (%i) " , cmd ) ;
2004-08-23 00:15:46 +00:00
return ;
//known to game
case svcq2_muzzleflash :
2005-09-26 03:40:09 +00:00
CLQ2_ParseMuzzleFlash ( ) ;
2004-08-23 00:15:46 +00:00
break ;
case svcq2_muzzleflash2 :
CLQ2_ParseMuzzleFlash2 ( ) ;
return ;
case svcq2_temp_entity :
CLQ2_ParseTEnt ( ) ;
break ;
case svcq2_layout :
s = MSG_ReadString ( ) ;
Q_strncpyz ( cl . q2layout , s , sizeof ( cl . q2layout ) ) ;
2005-09-09 23:40:55 +00:00
# ifdef VM_UI
2004-08-23 00:15:46 +00:00
UI_Q2LayoutChanged ( ) ;
2005-09-09 23:40:55 +00:00
# endif
2004-08-23 00:15:46 +00:00
break ;
case svcq2_inventory :
2005-09-04 05:48:26 +00:00
CLQ2_ParseInventory ( ) ;
break ;
2004-08-23 00:15:46 +00:00
// the rest are private to the client and server
case svcq2_nop : //6
Host_EndGame ( " CL_ParseServerMessage: svcq2_nop not implemented " ) ;
return ;
case svcq2_disconnect :
if ( cls . state = = ca_connected )
Host_EndGame ( " Server disconnected \n "
" Server version may not be compatible " ) ;
else
Host_EndGame ( " Server disconnected " ) ;
return ;
case svcq2_reconnect : //8
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " reconnecting... \n " ) ;
2005-03-23 22:14:08 +00:00
CL_SendClientCommand ( true , " new " ) ;
2004-08-23 00:15:46 +00:00
break ;
case svcq2_sound : //9 // <see code>
CLQ2_ParseStartSoundPacket ( ) ;
break ;
case svcq2_print : //10 // [qbyte] id [string] null terminated string
i = MSG_ReadByte ( ) ;
s = MSG_ReadString ( ) ;
2005-11-30 02:26:12 +00:00
2015-04-14 23:12:17 +00:00
CL_ParsePrint ( s , i ) ;
2004-08-23 00:15:46 +00:00
break ;
case svcq2_stufftext : //11 // [string] stuffed into client's console buffer, should be \n terminated
s = MSG_ReadString ( ) ;
Con_DPrintf ( " stufftext: %s \n " , s ) ;
if ( ! strncmp ( s , " precache " , 8 ) ) //big major hack. Q2 uses a command that q1 has as a cvar.
{ //call the q2 precache function.
CLQ2_Precache_f ( ) ;
}
else
Cbuf_AddText ( s , RESTRICT_SERVER ) ; //don't let the local user cheat
break ;
case svcq2_serverdata : //12 // [long] protocol ...
Cbuf_Execute ( ) ; // make sure any stuffed commands are done
CLQ2_ParseServerData ( ) ;
break ;
case svcq2_configstring : //13 // [short] [string]
CLQ2_ParseConfigString ( ) ;
break ;
2005-09-26 03:40:09 +00:00
case svcq2_spawnbaseline : //14
2004-08-23 00:15:46 +00:00
CLQ2_ParseBaseline ( ) ;
break ;
case svcq2_centerprint : //15 // [string] to put in center of the screen
2006-01-01 09:01:15 +00:00
s = MSG_ReadString ( ) ;
2006-01-13 06:27:18 +00:00
# ifdef PLUGINS
2006-01-01 09:01:15 +00:00
if ( Plug_CenterPrintMessage ( s , 0 ) )
2006-01-13 06:27:18 +00:00
# endif
2008-11-09 22:29:28 +00:00
SCR_CenterPrint ( 0 , s , false ) ;
2004-08-23 00:15:46 +00:00
break ;
case svcq2_download : //16 // [short] size [size bytes]
CL_ParseDownload ( ) ;
break ;
case svcq2_playerinfo : //17 // variable
Host_EndGame ( " CL_ParseServerMessage: svcq2_playerinfo not implemented " ) ;
return ;
case svcq2_packetentities : //18 // [...]
Host_EndGame ( " CL_ParseServerMessage: svcq2_packetentities not implemented " ) ;
return ;
case svcq2_deltapacketentities : //19 // [...]
Host_EndGame ( " CL_ParseServerMessage: svcq2_deltapacketentities not implemented " ) ;
return ;
case svcq2_frame : //20 (the bastard to implement.)
CLQ2_ParseFrame ( ) ;
break ;
}
}
CL_SetSolidEntities ( ) ;
}
# endif
# ifdef NQPROT
2005-10-16 03:53:31 +00:00
//Proquake specific stuff
# define pqc_nop 1
# define pqc_new_team 2
# define pqc_erase_team 3
# define pqc_team_frags 4
# define pqc_match_time 5
# define pqc_match_reset 6
# define pqc_ping_times 7
int MSG_ReadBytePQ ( char * * s )
{
int ret = ( * s ) [ 0 ] * 16 + ( * s ) [ 1 ] - 272 ;
* s + = 2 ;
return ret ;
}
int MSG_ReadShortPQ ( char * * s )
{
return MSG_ReadBytePQ ( s ) * 256 + MSG_ReadBytePQ ( s ) ;
}
void CLNQ_ParseProQuakeMessage ( char * s )
{
2005-11-30 01:20:53 +00:00
int cmd ;
int ping ;
2010-11-21 03:39:12 +00:00
int team , shirt , frags ;
2005-10-16 03:53:31 +00:00
s + + ;
cmd = * s + + ;
2005-11-26 03:02:55 +00:00
2005-10-16 03:53:31 +00:00
switch ( cmd )
{
default :
Con_DPrintf ( " Unrecognised ProQuake Message %i \n " , cmd ) ;
break ;
2010-11-21 03:39:12 +00:00
case pqc_new_team :
cl . teamplay = true ;
team = MSG_ReadBytePQ ( & s ) - 16 ;
shirt = MSG_ReadBytePQ ( & s ) - 16 ;
Sbar_PQ_Team_New ( team , shirt ) ;
2005-10-16 03:53:31 +00:00
break ;
case pqc_erase_team :
2010-11-21 03:39:12 +00:00
team = MSG_ReadBytePQ ( & s ) - 16 ;
Sbar_PQ_Team_New ( team , 0 ) ;
Sbar_PQ_Team_Frags ( team , 0 ) ;
2005-10-16 03:53:31 +00:00
break ;
case pqc_team_frags :
2010-11-21 03:39:12 +00:00
team = MSG_ReadBytePQ ( & s ) - 16 ;
frags = MSG_ReadShortPQ ( & s ) ;
2005-10-16 03:53:31 +00:00
if ( frags & 32768 )
frags = frags - 65536 ;
2010-11-21 03:39:12 +00:00
Sbar_PQ_Team_Frags ( team , frags ) ;
2005-11-26 03:02:55 +00:00
break ;
2005-10-16 03:53:31 +00:00
case pqc_match_time :
2010-11-21 03:39:12 +00:00
cl . matchgametime = MSG_ReadBytePQ ( & s ) * 60 ;
cl . matchgametime + = MSG_ReadBytePQ ( & s ) ;
2005-10-16 03:53:31 +00:00
break ;
case pqc_match_reset :
2010-11-21 03:39:12 +00:00
Sbar_PQ_Team_Reset ( ) ;
2005-10-16 03:53:31 +00:00
break ;
2010-11-21 03:39:12 +00:00
2005-10-16 03:53:31 +00:00
case pqc_ping_times :
2011-12-05 15:23:40 +00:00
cl . last_ping_request = realtime ;
2005-10-16 03:53:31 +00:00
while ( ( ping = MSG_ReadShortPQ ( & s ) ) )
{
if ( ( ping / 4096 ) > = MAX_CLIENTS )
Host_Error ( " CL_ParseProQuakeMessage: pqc_ping_times > MAX_CLIENTS " ) ;
cl . players [ ping / 4096 ] . ping = ping & 4095 ;
}
break ;
}
}
2010-08-16 02:03:02 +00:00
static enum {
CLNQPP_NONE ,
CLNQPP_PINGS
} cl_nqparseprint ;
qboolean CLNQ_ParseNQPrints ( char * s )
{
int i ;
char * start = s ;
if ( cl_nqparseprint = = CLNQPP_PINGS )
{
char * pingstart ;
cl_nqparseprint = CLNQPP_NONE ;
while ( * s = = ' ' )
s + + ;
pingstart = s ;
if ( * s = = ' - ' )
s + + ;
if ( * s > = ' 0 ' & & * s < = ' 9 ' )
2010-12-23 08:53:23 +00:00
{
2010-08-16 02:03:02 +00:00
while ( * s > = ' 0 ' & & * s < = ' 9 ' )
s + + ;
2013-03-12 22:35:33 +00:00
if ( * s = = ' ' & & s - start > = 3 )
2010-08-16 02:03:02 +00:00
{
s + + ;
start = s ;
s = strchr ( s , ' \n ' ) ;
if ( ! s )
return false ;
* s = 0 ;
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < cl . allocated_client_slots ; i + + )
2010-08-16 02:03:02 +00:00
{
if ( ! strcmp ( start , cl . players [ i ] . name ) )
break ;
}
2013-10-29 17:38:22 +00:00
if ( i = = cl . allocated_client_slots )
2010-08-16 02:03:02 +00:00
{
}
2013-10-29 17:38:22 +00:00
if ( i ! = cl . allocated_client_slots )
2010-08-16 02:03:02 +00:00
{
cl . players [ i ] . ping = atoi ( pingstart ) ;
}
cl_nqparseprint = CLNQPP_PINGS ;
return true ;
}
}
s = start ;
}
if ( ! strcmp ( s , " Client ping times: \n " ) )
{
cl_nqparseprint = CLNQPP_PINGS ;
return true ;
}
return false ;
}
2005-10-16 03:53:31 +00:00
2004-08-23 00:15:46 +00:00
void CLNQ_ParseServerMessage ( void )
{
2013-06-23 02:17:02 +00:00
const int destsplit = 0 ;
2004-08-23 00:15:46 +00:00
int cmd ;
char * s ;
int i , j ;
// received_framecount = host_framecount;
// cl.last_servermessage = realtime;
CL_ClearProjectiles ( ) ;
//
// if recording demos, copy the message out
//
if ( cl_shownet . value = = 1 )
2013-11-29 14:36:47 +00:00
Con_Printf ( " %i " , net_message . cursize ) ;
2004-08-23 00:15:46 +00:00
else if ( cl_shownet . value = = 2 )
2013-11-29 14:36:47 +00:00
Con_Printf ( " ------------------ \n " ) ;
2004-08-23 00:15:46 +00:00
CL_ParseClientdata ( ) ;
//
// parse the message
//
while ( 1 )
{
if ( msg_badread )
{
2006-02-12 20:20:01 +00:00
CL_DumpPacket ( ) ;
2004-08-23 00:15:46 +00:00
Host_EndGame ( " CL_ParseServerMessage: Bad server message " ) ;
break ;
}
cmd = MSG_ReadByte ( ) ;
if ( cmd = = - 1 )
{
msg_readcount + + ; // so the EOM showner has the right value
SHOWNET ( " END OF MESSAGE " ) ;
break ;
}
if ( cmd & 128 )
{
SHOWNET ( " fast update " ) ;
CLNQ_ParseEntity ( cmd & 127 ) ;
continue ;
}
2004-11-27 08:16:25 +00:00
SHOWNET2 ( svc_nqstrings [ cmd > ( sizeof ( svc_nqstrings ) / sizeof ( char * ) ) ? 0 : cmd ] , cmd ) ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
// other commands
switch ( cmd )
{
default :
2006-02-12 20:20:01 +00:00
CL_DumpPacket ( ) ;
2004-11-20 01:21:17 +00:00
Host_EndGame ( " CLNQ_ParseServerMessage: Illegible server message (%i) " , cmd ) ;
2004-08-23 00:15:46 +00:00
return ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_nop :
// Con_Printf ("svc_nop\n");
2005-09-26 03:40:09 +00:00
break ;
2004-08-23 00:15:46 +00:00
case svc_print :
s = MSG_ReadString ( ) ;
2005-11-30 02:26:12 +00:00
2004-09-30 22:42:34 +00:00
if ( * s = = 1 | | * s = = 2 )
2015-04-14 23:12:17 +00:00
CL_ParsePrint ( s + 1 , PRINT_CHAT ) ;
else if ( CLNQ_ParseNQPrints ( s ) )
break ;
2004-09-30 22:42:34 +00:00
else
2015-04-14 23:12:17 +00:00
CL_ParsePrint ( s , PRINT_HIGH ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_disconnect :
2005-05-26 12:55:34 +00:00
CL_Disconnect ( ) ;
2013-07-26 17:19:06 +00:00
return ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_centerprint :
2006-01-01 09:01:15 +00:00
s = MSG_ReadString ( ) ;
2006-01-13 06:27:18 +00:00
# ifdef PLUGINS
2006-01-01 09:01:15 +00:00
if ( Plug_CenterPrintMessage ( s , 0 ) )
2006-01-13 06:27:18 +00:00
# endif
2008-11-09 22:29:28 +00:00
SCR_CenterPrint ( 0 , s , false ) ;
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_stufftext :
s = MSG_ReadString ( ) ;
2005-10-16 03:53:31 +00:00
if ( * s = = 1 )
{
Con_DPrintf ( " Proquake: %s \n " , s ) ;
CLNQ_ParseProQuakeMessage ( s ) ;
}
else
{
Con_DPrintf ( " stufftext: %s \n " , s ) ;
2007-06-20 00:02:54 +00:00
if ( ! strncmp ( s , " cl_serverextension_download " , 14 ) )
{
2008-12-03 02:42:05 +00:00
cl_dp_serverextension_download = true ;
2007-06-20 00:02:54 +00:00
}
2013-09-06 22:57:44 +00:00
else if ( ! strncmp ( s , " //svi " , 6 ) )
{
Cmd_TokenizeString ( s + 2 , false , false ) ;
Con_DPrintf ( " SERVERINFO: %s=%s \n " , Cmd_Argv ( 1 ) , Cmd_Argv ( 2 ) ) ;
Info_SetValueForStarKey ( cl . serverinfo , Cmd_Argv ( 1 ) , Cmd_Argv ( 2 ) , MAX_SERVERINFO_STRING ) ;
CL_CheckServerInfo ( ) ;
}
2007-06-20 00:02:54 +00:00
else if ( ! strncmp ( s , " \n cl_downloadbegin " , 17 ) )
CLDP_ParseDownloadBegin ( s ) ;
else if ( ! strncmp ( s , " \n cl_downloadfinished " , 17 ) )
CLDP_ParseDownloadFinished ( s ) ;
2013-03-12 23:24:15 +00:00
else if ( ! strcmp ( s , " \n stopdownload \n " ) )
2014-06-12 23:08:42 +00:00
{
if ( cls . download )
CL_DownloadFailed ( cls . download - > remotename , cls . download ) ;
}
2007-06-20 00:02:54 +00:00
else if ( ! strncmp ( s , " csqc_progname " , 14 ) )
2008-11-09 22:29:28 +00:00
COM_ParseOut ( s + 14 , cl_dp_csqc_progsname , sizeof ( cl_dp_csqc_progsname ) ) ;
2007-06-20 00:02:54 +00:00
else if ( ! strncmp ( s , " csqc_progsize " , 14 ) )
cl_dp_csqc_progssize = atoi ( s + 14 ) ;
else if ( ! strncmp ( s , " csqc_progcrc " , 13 ) )
cl_dp_csqc_progscrc = atoi ( s + 13 ) ;
2009-03-03 01:52:30 +00:00
else if ( ! strncmp ( s , " cl_fullpitch " , 13 ) | | ! strncmp ( s , " pq_fullpitch " , 13 ) )
{
//
}
2007-06-20 00:02:54 +00:00
else
{
Cbuf_AddText ( s , RESTRICT_SERVER ) ; //no cheating here...
}
2005-10-16 03:53:31 +00:00
}
2004-08-23 00:15:46 +00:00
break ;
2013-07-26 17:19:06 +00:00
case svc_version :
CLNQ_ParseProtoVersion ( ) ;
break ;
2004-08-23 00:15:46 +00:00
case svc_serverdata :
Cbuf_Execute ( ) ; // make sure any stuffed commands are done
CLNQ_ParseServerData ( ) ;
break ;
2005-05-26 12:55:34 +00:00
case svcdp_precache :
CL_ParsePrecache ( ) ;
2004-12-05 08:19:54 +00:00
break ;
2004-08-23 00:15:46 +00:00
case svc_cdtrack :
2013-10-08 16:29:54 +00:00
{
unsigned int firsttrack ;
unsigned int looptrack ;
firsttrack = MSG_ReadByte ( ) ;
looptrack = MSG_ReadByte ( ) ;
Media_NumberedTrack ( firsttrack , looptrack ) ;
}
2005-09-26 03:40:09 +00:00
break ;
2004-08-23 00:15:46 +00:00
case svc_setview :
2014-10-05 20:04:11 +00:00
i = MSGCL_ReadEntity ( ) ;
2013-06-23 02:17:02 +00:00
if ( ! cl . playerview [ destsplit ] . viewentity )
2006-01-28 19:04:13 +00:00
{
2015-01-12 12:28:13 +00:00
if ( ! i | | i > cl . allocated_client_slots )
cl . playerview [ destsplit ] . playernum = cl . allocated_client_slots ; //the mvd spectator slot.
else
cl . playerview [ destsplit ] . playernum = ( unsigned int ) i - 1 ;
2006-01-28 19:04:13 +00:00
}
2014-10-05 20:04:11 +00:00
cl . playerview [ destsplit ] . viewentity = i ;
2004-08-23 00:15:46 +00:00
break ;
case svc_signonnum :
i = MSG_ReadByte ( ) ;
if ( i < = cls . signon )
Host_EndGame ( " Received signon %i when at %i " , i , cls . signon ) ;
cls . signon = i ;
CLNQ_SignonReply ( ) ;
break ;
case svc_setpause :
cl . paused = MSG_ReadByte ( ) ;
if ( cl . paused )
CDAudio_Pause ( ) ;
else
CDAudio_Resume ( ) ;
break ;
case svc_spawnstaticsound :
2012-11-27 03:23:19 +00:00
CL_ParseStaticSound ( false ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_spawnstatic :
CL_ParseStatic ( 1 ) ;
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_spawnbaseline :
------------------------------------------------------------------------
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
i = MSGCL_ReadEntity ( ) ;
2006-07-24 04:24:41 +00:00
if ( ! CL_CheckBaselines ( i ) )
2010-12-23 08:53:23 +00:00
Host_EndGame ( " CLNQ_ParseServerMessage: svc_spawnbaseline failed with size %i " , i ) ;
2006-07-24 04:24:41 +00:00
CL_ParseBaseline ( cl_baselines + i ) ;
2004-08-23 00:15:46 +00:00
break ;
2013-03-12 22:35:33 +00:00
//PEXT_REPLACEMENTDELTAS
case svcfte_updateentities :
if ( cls . signon = = 4 - 1 )
{ // first update is the final signon stage
cls . signon = 4 ;
CLNQ_SignonReply ( ) ;
}
CLFTE_ParseEntities ( ) ;
break ;
case svcfte_spawnstatic2 :
CL_ParseStatic ( 2 ) ;
break ;
case svcfte_spawnbaseline2 :
CL_ParseBaseline2 ( ) ;
break ;
2013-08-21 07:14:39 +00:00
case svcfte_cgamepacket :
# ifdef HLCLIENT
if ( CLHL_ParseGamePacket ( ) )
break ;
# endif
# ifdef CSQC_DAT
if ( CSQC_ParseGamePacket ( ) )
break ;
# endif
Con_Printf ( " Unable to parse gamecode packet \n " ) ;
break ;
2004-08-23 00:15:46 +00:00
case svc_time :
2013-06-23 02:17:02 +00:00
//fixme: move this stuff to a common place
2013-07-26 17:19:06 +00:00
// cl.playerview[destsplit].oldfixangle = cl.playerview[destsplit].fixangle;
// VectorCopy(cl.playerview[destsplit].fixangles, cl.playerview[destsplit].oldfixangles);
// cl.playerview[destsplit].fixangle = false;
if ( cls . demoplayback )
{
// extern vec3_t demoangles;
// cl.playerview[destsplit].fixangle = true;
// VectorCopy(demoangles, cl.playerview[destsplit].fixangles);
}
2005-10-01 03:09:17 +00:00
cls . netchan . outgoing_sequence + + ;
cls . netchan . incoming_sequence = cls . netchan . outgoing_sequence - 1 ;
2013-03-12 22:35:33 +00:00
cl . validsequence = cls . netchan . incoming_sequence ;
2005-10-01 03:09:17 +00:00
2004-08-23 00:15:46 +00:00
received_framecount = host_framecount ;
cl . last_servermessage = realtime ;
2005-10-01 03:09:17 +00:00
2005-05-26 12:55:34 +00:00
cl . oldgametime = cl . gametime ;
2005-06-04 04:20:20 +00:00
cl . oldgametimemark = cl . gametimemark ;
2004-08-23 00:15:46 +00:00
cl . gametime = MSG_ReadFloat ( ) ;
cl . gametimemark = realtime ;
2005-10-01 03:09:17 +00:00
2013-07-26 17:19:06 +00:00
{
extern vec3_t demoangles ;
int fr = cls . netchan . incoming_sequence & UPDATE_MASK ;
if ( cls . demoplayback )
{
cl . inframes [ fr & UPDATE_MASK ] . packet_entities . fixangles [ destsplit ] = true ;
VectorCopy ( demoangles , cl . inframes [ fr & UPDATE_MASK ] . packet_entities . fixedangles [ destsplit ] ) ;
}
else
cl . inframes [ fr & UPDATE_MASK ] . packet_entities . fixangles [ destsplit ] = false ;
}
cl . inframes [ cls . netchan . incoming_sequence & UPDATE_MASK ] . receivedtime = realtime ;
2013-09-06 22:57:44 +00:00
cl . inframes [ cls . netchan . incoming_sequence & UPDATE_MASK ] . frameid = cls . netchan . incoming_sequence ;
------------------------------------------------------------------------
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
2012-01-28 10:30:44 +00:00
if ( CPNQ_IS_DP )
{
int n = cls . netchan . incoming_sequence & UPDATE_MASK , o = ( cls . netchan . incoming_sequence - 1 ) & UPDATE_MASK ;
2013-03-12 22:53:23 +00:00
cl . inframes [ n ] . packet_entities . num_entities = cl . inframes [ o ] . packet_entities . num_entities ;
if ( cl . inframes [ n ] . packet_entities . max_entities < cl . inframes [ o ] . packet_entities . num_entities )
2012-01-28 10:30:44 +00:00
{
2013-03-12 22:53:23 +00:00
cl . inframes [ n ] . packet_entities . max_entities = cl . inframes [ o ] . packet_entities . max_entities ;
cl . inframes [ n ] . packet_entities . entities = BZ_Realloc ( cl . inframes [ n ] . packet_entities . entities , sizeof ( entity_state_t ) * cl . inframes [ n ] . packet_entities . max_entities ) ;
2012-01-28 10:30:44 +00:00
}
2013-03-12 22:53:23 +00:00
memcpy ( cl . inframes [ n ] . packet_entities . entities , cl . inframes [ o ] . packet_entities . entities , sizeof ( entity_state_t ) * cl . inframes [ o ] . packet_entities . num_entities ) ;
cl . inframes [ n ] . packet_entities . servertime = cl . inframes [ o ] . packet_entities . servertime ;
2012-01-28 10:30:44 +00:00
}
else
2004-11-27 08:16:25 +00:00
{
2013-03-12 22:53:23 +00:00
// cl.inframes[(cls.netchan.incoming_sequence-1)&UPDATE_MASK].packet_entities = cl.frames[cls.netchan.incoming_sequence&UPDATE_MASK].packet_entities;
cl . inframes [ cl . validsequence & UPDATE_MASK ] . packet_entities . num_entities = 0 ;
cl . inframes [ cl . validsequence & UPDATE_MASK ] . packet_entities . servertime = cl . gametime ;
2004-11-27 08:16:25 +00:00
}
2004-08-23 00:15:46 +00:00
break ;
case svc_updatename :
Sbar_Changed ( ) ;
i = MSG_ReadByte ( ) ;
2005-05-17 02:36:54 +00:00
if ( i > = MAX_CLIENTS )
2006-01-28 19:04:13 +00:00
MSG_ReadString ( ) ;
else
2009-03-03 01:52:30 +00:00
{
2006-01-28 19:04:13 +00:00
strcpy ( cl . players [ i ] . name , MSG_ReadString ( ) ) ;
2009-03-03 01:52:30 +00:00
if ( * cl . players [ i ] . name )
cl . players [ i ] . userid = i + 1 ;
2013-06-23 02:17:02 +00:00
Info_SetValueForKey ( cl . players [ i ] . userinfo , " name " , cl . players [ i ] . name , sizeof ( cl . players [ i ] . userinfo ) ) ;
2009-03-03 01:52:30 +00:00
}
2004-08-23 00:15:46 +00:00
break ;
case svc_updatefrags :
Sbar_Changed ( ) ;
i = MSG_ReadByte ( ) ;
2005-05-17 02:36:54 +00:00
if ( i > = MAX_CLIENTS )
2006-01-28 19:04:13 +00:00
MSG_ReadShort ( ) ;
else
cl . players [ i ] . frags = MSG_ReadShort ( ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_updatecolors :
{
2009-03-03 01:52:30 +00:00
int a ;
i = MSG_ReadByte ( ) ;
a = MSG_ReadByte ( ) ;
2013-10-29 17:38:22 +00:00
if ( i < cl . allocated_client_slots )
2009-03-03 01:52:30 +00:00
{
cl . players [ i ] . rtopcolor = a & 0x0f ;
cl . players [ i ] . rbottomcolor = ( a & 0xf0 ) > > 4 ;
2004-08-23 00:15:46 +00:00
2009-03-03 01:52:30 +00:00
sprintf ( cl . players [ i ] . team , " %2d " , cl . players [ i ] . rbottomcolor ) ;
2004-08-23 00:15:46 +00:00
2009-03-03 01:52:30 +00:00
if ( cls . state = = ca_active )
Skin_Find ( & cl . players [ i ] ) ;
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
if ( i = = cl . playerview [ destsplit ] . playernum )
2009-04-01 22:03:56 +00:00
Skin_FlushPlayers ( ) ;
2009-03-03 01:52:30 +00:00
Sbar_Changed ( ) ;
CL_NewTranslation ( i ) ;
}
2004-08-23 00:15:46 +00:00
}
break ;
case svc_lightstyle :
i = MSG_ReadByte ( ) ;
if ( i > = MAX_LIGHTSTYLES )
2005-10-01 03:09:17 +00:00
{
Con_Printf ( " svc_lightstyle: %i >= MAX_LIGHTSTYLES \n " , i ) ;
MSG_ReadString ( ) ;
break ;
}
2014-06-25 03:53:11 +00:00
R_UpdateLightStyle ( i , MSG_ReadString ( ) , 1 , 1 , 1 ) ;
2004-08-23 00:15:46 +00:00
break ;
2012-09-30 05:52:03 +00:00
case svcnq_updatestatlong :
2005-09-26 03:40:09 +00:00
i = MSG_ReadByte ( ) ;
2004-08-23 00:15:46 +00:00
j = MSG_ReadLong ( ) ;
2008-05-25 22:23:43 +00:00
CL_SetStatFloat ( 0 , i , j ) ;
2015-02-02 08:01:53 +00:00
CL_SetStatInt ( 0 , i , j ) ;
2004-08-23 00:15:46 +00:00
break ;
2005-09-26 03:40:09 +00:00
case svcdp_updatestatbyte :
i = MSG_ReadByte ( ) ;
2004-12-05 08:19:54 +00:00
j = MSG_ReadByte ( ) ;
2008-05-25 22:23:43 +00:00
CL_SetStatFloat ( 0 , i , j ) ;
2015-02-02 08:01:53 +00:00
CL_SetStatInt ( 0 , i , j ) ;
2004-12-05 08:19:54 +00:00
break ;
2004-08-23 00:15:46 +00:00
case svc_setangle :
2013-07-26 17:19:06 +00:00
{
inframe_t * inf = & cl . inframes [ cls . netchan . incoming_sequence & UPDATE_MASK ] ;
inf - > packet_entities . fixangles [ destsplit ] = true ;
for ( i = 0 ; i < 3 ; i + + )
cl . playerview [ destsplit ] . viewangles [ i ] = cl . playerview [ destsplit ] . intermissionangles [ i ] = inf - > packet_entities . fixedangles [ destsplit ] [ i ] = MSG_ReadAngle ( ) ;
}
2004-08-23 00:15:46 +00:00
break ;
2013-07-26 17:19:06 +00:00
case svcnq_clientdata :
2005-09-26 03:40:09 +00:00
CLNQ_ParseClientdata ( ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_sound :
CLNQ_ParseStartSoundPacket ( ) ;
break ;
2012-02-27 12:23:15 +00:00
case svc_stopsound :
i = MSG_ReadShort ( ) ;
S_StopSound ( i > > 3 , i & 7 ) ;
break ;
2004-08-23 00:15:46 +00:00
case svc_temp_entity :
CL_ParseTEnt ( true ) ;
break ;
2005-09-26 03:40:09 +00:00
2004-08-23 00:15:46 +00:00
case svc_particle :
2005-03-10 03:55:18 +00:00
CLNQ_ParseParticleEffect ( ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_killedmonster :
2013-06-23 02:17:02 +00:00
cl . playerview [ destsplit ] . stats [ STAT_MONSTERS ] + + ;
cl . playerview [ destsplit ] . statsf [ STAT_MONSTERS ] + + ;
2004-08-23 00:15:46 +00:00
break ;
case svc_foundsecret :
2013-06-23 02:17:02 +00:00
cl . playerview [ destsplit ] . stats [ STAT_SECRETS ] + + ;
cl . playerview [ destsplit ] . statsf [ STAT_SECRETS ] + + ;
2004-08-23 00:15:46 +00:00
break ;
case svc_intermission :
2005-07-14 01:57:34 +00:00
if ( ! cl . intermission )
TP_ExecTrigger ( " f_mapend " ) ;
2004-08-23 00:15:46 +00:00
cl . intermission = 1 ;
2011-12-05 15:23:40 +00:00
cl . completed_time = cl . gametime ;
2004-08-23 00:15:46 +00:00
break ;
case svc_finale :
cl . intermission = 2 ;
2011-12-05 15:23:40 +00:00
cl . completed_time = cl . gametime ;
2008-11-09 22:29:28 +00:00
SCR_CenterPrint ( 0 , MSG_ReadString ( ) , false ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_cutscene :
cl . intermission = 3 ;
2011-12-05 15:23:40 +00:00
cl . completed_time = cl . gametime ;
2008-11-09 22:29:28 +00:00
SCR_CenterPrint ( 0 , MSG_ReadString ( ) , false ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_sellscreen : //pantsie
2011-04-20 23:05:45 +00:00
Cmd_ExecuteString ( " help 0 " , RESTRICT_SERVER ) ;
2004-08-23 00:15:46 +00:00
break ;
case svc_damage :
2013-06-23 02:17:02 +00:00
V_ParseDamage ( & cl . playerview [ destsplit ] ) ;
2004-08-23 00:15:46 +00:00
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 svcfitz_skybox :
{
extern cvar_t r_skyboxname ;
Cvar_Set ( & r_skyboxname , MSG_ReadString ( ) ) ;
}
break ;
case svcfitz_bf :
2011-04-20 23:05:45 +00:00
Cmd_ExecuteString ( " bf " , RESTRICT_SERVER ) ;
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 svcfitz_fog :
2014-03-30 08:55:06 +00:00
CL_ResetFog ( ) ;
cl . fog . density = MSG_ReadByte ( ) / 255.0f ;
cl . fog . colour [ 0 ] = MSG_ReadByte ( ) / 255.0f ;
cl . fog . colour [ 1 ] = MSG_ReadByte ( ) / 255.0f ;
cl . fog . colour [ 2 ] = MSG_ReadByte ( ) / 255.0f ;
cl . fog . time + = ( ( unsigned short ) MSG_ReadShort ( ) ) / 100.0 ;
cl . fog_locked = ! ! cl . fog . density ;
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 svcfitz_spawnbaseline2 :
------------------------------------------------------------------------
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
i = MSGCL_ReadEntity ( ) ;
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 ( ! CL_CheckBaselines ( i ) )
Host_EndGame ( " CLNQ_ParseServerMessage: svcfitz_spawnbaseline2 failed with ent %i " , i ) ;
CLFitz_ParseBaseline2 ( cl_baselines + i ) ;
break ;
2013-07-26 17:19:06 +00:00
case svcfitz_spawnstatic2 :
CL_ParseStatic ( 3 ) ;
break ;
case svcfitz_spawnstaticsound2 :
2015-04-14 23:12:17 +00:00
CL_ParseStaticSound ( true ) ;
2013-07-26 17:19:06 +00:00
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
2004-11-20 01:21:17 +00:00
case svcnq_effect :
CL_ParseEffect ( false ) ;
break ;
case svcnq_effect2 :
CL_ParseEffect ( true ) ;
break ;
2004-11-27 08:16:25 +00:00
2007-06-20 00:02:54 +00:00
case svcdp_entities :
2004-12-05 08:19:54 +00:00
if ( cls . signon = = 4 - 1 )
{ // first update is the final signon stage
cls . signon = 4 ;
CLNQ_SignonReply ( ) ;
2005-09-26 03:40:09 +00:00
}
2004-11-27 08:16:25 +00:00
//well, it's really any protocol, but we're only going to support version 5.
2012-02-12 05:18:31 +00:00
CLDP_ParseDarkPlaces5Entities ( ) ;
2004-11-27 08:16:25 +00:00
break ;
2007-06-20 00:02:54 +00:00
2012-11-27 03:23:19 +00:00
case svcdp_spawnstaticsound2 :
CL_ParseStaticSound ( true ) ;
break ;
2009-07-18 20:46:42 +00:00
# ifdef PEXT_CSQC
2007-06-20 00:02:54 +00:00
case svcdp_csqcentities :
CSQC_ParseEntities ( ) ;
break ;
2009-07-18 20:46:42 +00:00
# endif
2007-06-20 00:02:54 +00:00
case svcdp_downloaddata :
CLDP_ParseDownloadData ( ) ;
break ;
2008-11-09 22:29:28 +00:00
case svcdp_trailparticles :
2012-07-05 19:42:36 +00:00
CL_ParseTrailParticles ( ) ;
2008-11-09 22:29:28 +00:00
break ;
case svcdp_pointparticles :
2012-07-05 19:42:36 +00:00
CL_ParsePointParticles ( false ) ;
2008-11-09 22:29:28 +00:00
break ;
case svcdp_pointparticles1 :
2012-07-05 19:42:36 +00:00
CL_ParsePointParticles ( true ) ;
2008-11-09 22:29:28 +00:00
break ;
2004-08-23 00:15:46 +00:00
}
2007-06-20 00:02:54 +00:00
2004-08-23 00:15:46 +00:00
}
}
# endif