3436{
3438 int i;
3440 unsigned char cmdlog[32];
3441 const char *cmdlogname[32], *temp;
3442 int cmdindex, cmdcount = 0;
3443 qbool qwplayerupdatereceived;
3445 char vabuf[1024];
3446 size_t cl_readstring_len;
3447
3448
3449
3450
3451
3452
3453
3454 cl.last_received_message =
host.realtime;
3455
3457
3458
3459
3460
3465
3466
3467
3468
3469
3470
3472
3474 {
3476
3477
3478 cl.qw_num_nails = 0;
3479
3480
3481 cl.qw_weaponkick =
min(
cl.qw_weaponkick + 10 *
bound(0,
cl.time -
cl.oldtime, 0.1), 0);
3482
3483 cls.servermovesequence =
cls.netcon->qw.incoming_sequence;
3484
3485 qwplayerupdatereceived = false;
3486
3487 while (1)
3488 {
3490 Host_Error (
"CL_ParseServerMessage: Bad QW server message");
3491
3493
3495 {
3497 break;
3498 }
3499
3500 cmdindex = cmdcount & 31;
3501 cmdcount++;
3502 cmdlog[cmdindex] =
cmd;
3503
3506 if (!cmdlogname[cmdindex])
3507 {
3508
3509 const char *d = "<unknown>";
3510 cmdlogname[cmdindex] = d;
3511 }
3512
3513
3515 {
3516 default:
3517 {
3518 char description[32*64], logtemp[64];
3520 dp_strlcpy(description,
"packet dump: ",
sizeof(description));
3521 i = cmdcount - 32;
3522 if (i < 0)
3523 i = 0;
3524 count = cmdcount - i;
3525 i &= 31;
3527 {
3528 dpsnprintf(logtemp,
sizeof(logtemp),
"%3i:%s ", cmdlog[i], cmdlogname[i]);
3529 dp_strlcat(description, logtemp,
sizeof(description));
3531 i++;
3532 i &= 31;
3533 }
3534 description[
strlen(description)-1] =
'\n';
3536 Host_Error(
"CL_ParseServerMessage: Illegible server message");
3537 }
3538 break;
3539
3541
3542 break;
3543
3545 if (
cls.demonum != -1)
3547 else
3549 break;
3550
3556 {
3557 if (i == 3)
3558 {
3559 cl_readstring_len =
dpsnprintf(vabuf,
sizeof(vabuf),
"\1%s", temp);
3561 }
3562 else
3564 }
3565 break;
3566
3570 break;
3571
3575 break;
3576
3578
3580 break;
3581
3583
3585 break;
3586
3588 for (i=0 ; i<3 ; i++)
3590 if (!
cls.demoplayback)
3591 {
3592 cl.fixangle[0] =
true;
3594
3595 if (!
cl.fixangle[1])
3597 }
3598 break;
3599
3602 if (i >=
cl.max_lightstyle)
3603 {
3604 Con_Printf (
"svc_lightstyle >= MAX_LIGHTSTYLES");
3605 break;
3606 }
3609 cl.lightstyle[i].length = (
int)
strlen(
cl.lightstyle[i].map);
3610 break;
3611
3614 break;
3615
3619 break;
3620
3623 if (i >=
cl.maxclients)
3624 Host_Error(
"CL_ParseServerMessage: svc_updatefrags >= cl.maxclients");
3626 break;
3627
3630 if (i >=
cl.maxclients)
3631 Host_Error(
"CL_ParseServerMessage: svc_updateping >= cl.maxclients");
3633 break;
3634
3637 if (i >=
cl.maxclients)
3638 Host_Error(
"CL_ParseServerMessage: svc_updatepl >= cl.maxclients");
3640 break;
3641
3644 if (i >=
cl.maxclients)
3645 Host_Error(
"CL_ParseServerMessage: svc_updateentertime >= cl.maxclients");
3646
3648 break;
3649
3653 Host_Error (
"CL_ParseServerMessage: svc_spawnbaseline: invalid entity number %i", i);
3654 if (i >=
cl.max_entities)
3657 break;
3660 break;
3664 break;
3665
3668 break;
3669
3672 break;
3673
3677 Host_Error (
"svc_updatestat: %i is invalid", i);
3679 break;
3680
3684 Host_Error (
"svc_updatestatlong: %i is invalid", i);
3686 break;
3687
3690 break;
3691
3694 if ( (
cls.demoplayback ||
cls.demorecording) && (
cls.forcetrack != -1) )
3696 else
3698 break;
3699
3701 if(!
cl.intermission)
3702 cl.completed_time =
cl.time;
3703 cl.intermission = 1;
3705 for (i = 0;i < 3;i++)
3707 break;
3708
3710 if(!
cl.intermission)
3711 cl.completed_time =
cl.time;
3712 cl.intermission = 2;
3714 break;
3715
3718 break;
3719
3721 cl.qw_weaponkick = -2;
3722 break;
3724 cl.qw_weaponkick = -4;
3725 break;
3726
3729
3731 Host_Error(
"CL_ParseServerMessage: svc_spawnbaseline: invalid entity number %i", i);
3732 if (i >=
cl.max_entities)
3734 cl.entities[i].persistent.muzzleflash = 1.0f;
3735 break;
3736
3739 break;
3740
3743 break;
3744
3747 break;
3748
3751 break;
3752
3754
3755
3756 if (!qwplayerupdatereceived)
3757 {
3758 qwplayerupdatereceived = true;
3759 for (i = 1;i <
cl.maxclients;i++)
3760 cl.entities_active[i] =
false;
3761 }
3763 break;
3764
3767 break;
3768
3771
3772
3773
3774 break;
3775
3778 break;
3779
3782 break;
3783
3786
3789 break;
3790
3793
3796 break;
3797
3800 break;
3801
3804 if (!
cl.movevars_entgravity)
3805 cl.movevars_entgravity = 1.0f;
3806 break;
3807
3815 break;
3816 }
3817 }
3818
3819 if (qwplayerupdatereceived)
3820 {
3821
3822 for (i = 1;i <=
cl.maxclients;i++)
3823 if (!
cl.entities_active[i])
3824 cl.entities[i].state_current.active =
false;
3825 }
3826 }
3827 else
3828 {
3829 while (1)
3830 {
3832 Host_Error (
"CL_ParseServerMessage: Bad server message");
3833
3835
3837 {
3838
3840 break;
3841 }
3842
3843 cmdindex = cmdcount & 31;
3844 cmdcount++;
3845 cmdlog[cmdindex] =
cmd;
3846
3847
3849 {
3850
3851 temp = "entity";
3852 cmdlogname[cmdindex] = temp;
3855
3858 continue;
3859 }
3860
3863 if (!cmdlogname[cmdindex])
3864 {
3865
3866 const char *d = "<unknown>";
3867 cmdlogname[cmdindex] = d;
3868 }
3869
3870
3872 {
3873 default:
3874 {
3875 char description[32*64], tempdesc[64];
3877 dp_strlcpy (description,
"packet dump: ",
sizeof(description));
3878 i = cmdcount - 32;
3879 if (i < 0)
3880 i = 0;
3881 count = cmdcount - i;
3882 i &= 31;
3884 {
3885 dpsnprintf (tempdesc,
sizeof (tempdesc),
"%3i:%s ", cmdlog[i], cmdlogname[i]);
3886 dp_strlcat (description, tempdesc,
sizeof (description));
3888 i++;
3889 i &= 31;
3890 }
3891 description[
strlen(description)-1] =
'\n';
3893 Host_Error (
"CL_ParseServerMessage: Illegible server message");
3894 }
3895 break;
3896
3899 Con_Print(
"<-- server to client keepalive\n");
3900 break;
3901
3904 break;
3905
3908 break;
3909
3914 Host_Error(
"CL_ParseServerMessage: Server is unrecognized protocol number (%i)", i);
3915
3918 cls.protocol = protocol;
3919 break;
3920
3922 if (
cls.demonum != -1)
3924 else
3926 break;
3927
3933 break;
3934
3938 break;
3939
3943
3944
3945
3946
3947
3948
3949 switch(
cls.protocol)
3950 {
3953
3954
3955 strip_pqc = true;
3956 break;
3958 default:
3959
3960
3961 strip_pqc = false;
3962 break;
3963 }
3964 if(strip_pqc)
3965 {
3966
3967
3968
3969
3970 if(*temp == 0x01)
3971 {
3972 ++temp;
3973 --cl_readstring_len;
3974 while(*temp >= 0x01 && *temp <= 0x1F)
3975 {
3976 ++temp;
3977 --cl_readstring_len;
3978 }
3979 }
3980 }
3982 break;
3983
3986 break;
3987
3990 break;
3991
3993 for (i=0 ; i<3 ; i++)
3995 if (!
cls.demoplayback)
3996 {
3997 cl.fixangle[0] =
true;
3999
4000 if (!
cl.fixangle[1])
4002 }
4003 break;
4004
4009 if (
cl.viewentity >=
cl.max_entities)
4011
4012 if (!
cl.realplayerentity)
4013 cl.realplayerentity =
cl.viewentity;
4014
4015 if (
cl.viewentity >= 1 &&
cl.viewentity <=
cl.maxclients)
4016 cl.playerentity =
cl.viewentity;
4017 break;
4018
4021 if (i >=
cl.max_lightstyle)
4022 {
4023 Con_Printf (
"svc_lightstyle >= MAX_LIGHTSTYLES");
4024 break;
4025 }
4028 cl.lightstyle[i].length = (
int)
strlen(
cl.lightstyle[i].map);
4029 break;
4030
4033 break;
4034
4037 {
4038
4040 }
4041 else
4042 {
4043 char *s;
4046 if (i < 32768)
4047 {
4049 {
4052 Con_DPrintf(
"svc_precache: Mod_ForName(\"%s\") failed\n", s);
4054 }
4055 else
4057 }
4058 else
4059 {
4060 i -= 32768;
4062 {
4065 Con_DPrintf(
"svc_precache: S_PrecacheSound(\"%s\") failed\n", s);
4066 cl.sound_precache[i] = sfx;
4067 }
4068 else
4070 }
4071 }
4072 break;
4073
4077 break;
4078
4081 if (i >=
cl.maxclients)
4082 Host_Error (
"CL_ParseServerMessage: svc_updatename >= cl.maxclients");
4084 break;
4085
4088 if (i >=
cl.maxclients)
4089 Host_Error (
"CL_ParseServerMessage: svc_updatefrags >= cl.maxclients");
4091 break;
4092
4095 if (i >=
cl.maxclients)
4096 Host_Error (
"CL_ParseServerMessage: svc_updatecolors >= cl.maxclients");
4098 break;
4099
4102 break;
4103
4106 break;
4107
4110 break;
4111
4115 Host_Error (
"CL_ParseServerMessage: svc_spawnbaseline: invalid entity number %i", i);
4116 if (i >=
cl.max_entities)
4119 break;
4123 Host_Error (
"CL_ParseServerMessage: svc_spawnbaseline2: invalid entity number %i", i);
4124 if (i >=
cl.max_entities)
4127 break;
4130 break;
4133 break;
4137 break;
4138
4146 break;
4147
4150
4151
4152 if (i <=
cls.signon && i != 1)
4153 Host_Error (
"Received signon %i when at %i", i,
cls.signon);
4155 break;
4156
4159 break;
4160
4163 break;
4164
4168 Host_Error (
"svc_updatestat: %i is invalid", i);
4170 break;
4171
4175 Host_Error (
"svc_updatestat: %i is invalid", i);
4177 break;
4178
4181 break;
4182
4185 break;
4186
4190 if ( (
cls.demoplayback ||
cls.demorecording) && (
cls.forcetrack != -1) )
4192 else
4194 break;
4195
4197 if(!
cl.intermission)
4198 cl.completed_time =
cl.time;
4199 cl.intermission = 1;
4201 break;
4202
4204 if(!
cl.intermission)
4205 cl.completed_time =
cl.time;
4206 cl.intermission = 2;
4209 break;
4210
4212 if(!
cl.intermission)
4213 cl.completed_time =
cl.time;
4214 cl.intermission = 3;
4217 break;
4218
4221 break;
4224 {
4225
4236 }
4237 else
4239 break;
4242 {
4243
4249 }
4250 else
4252 break;
4255 break;
4258
4264 else
4266 break;
4269 break;
4272 break;
4275 break;
4278 break;
4281 break;
4282 }
4283
4284 }
4285 }
4286
4289
4290
4292
4293
4295
4296
4298
4299
4300
4301 if (
cls.demorecording)
4302 {
4304
4305 }
4306}
void CDAudio_Resume(void)
void CDAudio_Play(int track, qbool looping)
void CL_WriteDemoMessage(sizebuf_t *message)
void EntityFrame4_CL_ReadFrame(void)
void EntityFrame5_CL_ReadFrame(void)
void EntityFrame_CL_ReadFrame(void)
void EntityFrameQuake_ReadEntity(int bits)
void EntityFrameQuake_ISeeDeadEntities(void)
void EntityStateQW_ReadPlayerUpdate(void)
void EntityFrameQW_CL_ReadFrame(qbool delta)
void CL_DisconnectEx(qbool kicked, const char *fmt,...)
void CL_ExpandEntities(int num)
static void QW_CL_ParseDownload(void)
static void CL_ParseTempEntity(void)
static void CL_SignonReply(int signon_stage)
static void CL_ParsePointParticles1(void)
static void CL_ParseBaseline(entity_t *ent, int large)
static void QW_CL_ServerInfo(void)
static void QW_CL_ParseModelList(void)
static void CL_ParseEffect2(void)
static void CL_UpdateItemsAndWeapon(void)
static void CL_ParseTrailParticles(void)
static void QW_CL_UpdateUserInfo(void)
static void CL_ParseServerInfo(void)
static void CL_ParseStatic(int large)
static void CL_ParseStaticSound(int large)
static void CL_ParseDownload(void)
void CL_KeepaliveMessage(qbool readmessages)
static qbool CL_ExaminePrintString(const char *text)
static void CL_NetworkTimeReceived(double newtime)
static void QW_CL_SetInfo(void)
static void CL_ParseStartSoundPacket(int largesoundindex)
static void QW_CL_ParseNails(void)
const char * svc_strings[128]
const char * qw_svc_strings[128]
static void CL_ParseClientdata(void)
static void CL_ParseEffect(void)
static void QW_CL_ParseSoundList(void)
static void CL_ParsePointParticles(void)
void CL_ParseParticleEffect(void)
void SCR_CenterPrint(const char *str)
void SHOWLMP_decodehide(void)
void SHOWLMP_decodeshow(void)
void Cmd_ExecuteString(cmd_state_t *cmd, const char *text, size_t textlen, cmd_source_t src, qbool lockmutex)
Parses a single line of text into arguments and tries to execute it.
@ src_local
from the command buffer
@ GAME_TENEBRAE
full of evil hackery
char * MSG_ReadString(sizebuf_t *sb, char *string, size_t maxstring)
float MSG_ReadAngle(sizebuf_t *sb, protocolversion_t protocol)
void MSG_ReadVector(sizebuf_t *sb, vec3_t v, protocolversion_t protocol)
float MSG_ReadCoord(sizebuf_t *sb, protocolversion_t protocol)
size_t MSG_ReadString_len(sizebuf_t *sb, char *string, size_t maxstring)
Same as MSG_ReadString except it returns the number of bytes written to *string excluding the \0 term...
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
@ PROTOCOL_DARKPLACES2
various changes
@ PROTOCOL_DARKPLACES4
various changes
@ PROTOCOL_NEHAHRABJP2
same as NEHAHRABJP but with 16bit soundindex
@ PROTOCOL_DARKPLACES3
uses EntityFrame4 entity snapshot encoder/decoder which is broken, this attempted to do partial snaps...
@ PROTOCOL_DARKPLACES7
added QuakeWorld-style movement protocol to allow more consistent prediction
@ PROTOCOL_QUAKEDP
darkplaces extended quake protocol (used by TomazQuake and others), backwards compatible as long as n...
@ PROTOCOL_QUAKE
quake (aka netquake/normalquake/nq) protocol
@ PROTOCOL_DARKPLACES8
added parting messages. WIP
@ PROTOCOL_NEHAHRABJP3
same as NEHAHRABJP2 but with some changes
@ PROTOCOL_NEHAHRAMOVIE
Nehahra movie protocol, a big nasty hack dating back to early days of the Quake Standards Group (but ...
@ PROTOCOL_DARKPLACES1
uses EntityFrame entity snapshot encoder/decoder which is a QuakeWorld-like entity snapshot delta com...
#define dp_strlcat(dst, src, dsize)
#define dp_strlcpy(dst, src, dsize)
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
void CSQC_AddPrintText(const char *msg, size_t msg_len)
void CL_VM_Parse_StuffCmd(const char *msg, size_t msg_len)
void CL_VM_UpdateIntermissionState(int intermission)
void CSQC_ReadEntities(void)
qbool CL_VM_Parse_TempEntity(void)
void CL_VM_Parse_CenterPrint(const char *msg, size_t msg_len)
static int(ZEXPORT *qz_inflate)(z_stream *strm
GLenum GLenum GLsizei count
void Host_Error(const char *error,...)
#define bound(min, num, max)
#define VectorCopy(in, out)
model_t * Mod_ForName(const char *name, qbool crash, qbool checkdisk, const char *parentname)
char cl_readstring[MAX_INPUTLINE]
protocolversion_t Protocol_EnumForNumber(int n)
#define svc_pointparticles1
#define qw_svc_packetentities
#define qw_svc_entgravity
#define qw_svc_sellscreen
#define svc_spawnstaticsound2
#define svc_spawnstaticsound
#define qw_svc_updateuserinfo
#define qw_svc_spawnstaticsound
#define qw_svc_serverinfo
#define qw_svc_updatefrags
#define svc_killedmonster
#define qw_svc_updatestat
#define svc_spawnbaseline2
#define qw_svc_serverdata
#define qw_svc_updateping
#define qw_svc_playerinfo
#define qw_svc_lightstyle
#define qw_svc_temp_entity
#define svc_updatestatubyte
#define svc_pointparticles
#define svc_trailparticles
#define qw_svc_muzzleflash
#define qw_svc_spawnstatic
#define qw_svc_deltapacketentities
#define qw_svc_updatestatlong
#define qw_svc_spawnbaseline
#define svc_spawnbaseline
#define qw_svc_intermission
#define qw_svc_updateentertime
#define qw_svc_disconnect
#define qw_svc_chokecount
#define qw_svc_foundsecret
#define qw_svc_killedmonster
#define qw_svc_centerprint
#define MAX_STYLESTRING
max length of flicker pattern for light style
#define MAX_EDICTS
max number of objects in game world at once (32768 protocol limit)
#define MAX_SOUNDS
max number of sounds loaded at once
#define MAX_MODELS
max number of models loaded at once (including during level transitions)
#define STAT_MONSTERS
bumped by svc_killedmonster
#define STAT_SECRETS
bumped on client side by svc_foundsecret
int R_SetSkyBox(const char *sky)
void S_PauseGameSounds(qbool toggle)
void S_StopSound(int entnum, int entchannel)
sfx_t * S_PrecacheSound(const char *name, qbool complain, qbool levelsound)