1
0
Fork 0
forked from fte/fteqw

Fix Q2 server issues (broken predition, deltaing, gamecode cvar crashes, choke info).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3773 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2011-04-20 03:34:32 +00:00
parent 253048dd0b
commit cea945ad5e
6 changed files with 44 additions and 29 deletions

View file

@ -313,5 +313,6 @@ game_export_t *GetGameApi (game_import_t *import);
extern game_export_t *ge;
extern int svq2_maxclients;
#endif

View file

@ -966,16 +966,6 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
if (newgametype != svs.gametype)
{
for (i=0 ; i<MAX_CLIENTS ; i++) //server type changed, so we need to drop all clients. :(
{
if (svs.clients[i].state)
SV_DropClient(&svs.clients[i]);
svs.clients[i].namebuf[0] = '\0'; //kill all bots
}
}
svs.gametype = newgametype;
#ifdef HLSERVER
if (newgametype != GT_HALFLIFE)
SVHL_ShutdownGame();
@ -993,6 +983,15 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
Q1QVM_Shutdown();
#endif
for (i=0 ; i<MAX_CLIENTS ; i++) //server type changed, so we need to drop all clients. :(
{
if (svs.clients[i].state)
SV_DropClient(&svs.clients[i]);
svs.clients[i].namebuf[0] = '\0'; //kill all bots
}
}
svs.gametype = newgametype;
sv.models[1] = sv.world.worldmodel;
#ifdef VM_Q1
@ -1147,7 +1146,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
q2ent->s.number = i+1;
svs.clients[i].q2edict = q2ent;
}
sv.allocated_client_slots = i;
sv.allocated_client_slots = svq2_maxclients;
#endif
break;
case GT_QUAKE3:

View file

@ -3206,6 +3206,9 @@ qboolean SV_ReadPackets (void)
svs.stats.packets++;
if (cl->state != cs_zombie)
{
if (cl->send_message)
cl->chokecount++;
else
cl->send_message = true; // reply at end of frame
#ifdef Q2SERVER
@ -3484,6 +3487,8 @@ void SV_Frame (void)
start = Sys_DoubleTime ();
svs.stats.idle += start - end;
end = start;
//qw qc uses this for newmis handling
svs.framenum++;
if (svs.framenum > 0x10000)
svs.framenum = 0;
@ -3595,6 +3600,7 @@ void SV_MVDStream_Poll(void);
}
else
{
isidle = idletime < 0.1;
#ifdef VM_Q1
if (svs.gametype == GT_Q1QVM)
{
@ -3607,8 +3613,10 @@ void SV_MVDStream_Poll(void);
}
}
if (!isidle || idletime > 0.1)
if (!isidle || idletime > 0.15)
{
//this is the q2 frame number found in the q2 protocol. each packet should contain a new frame or interpolation gets confused
sv.framenum++;
#ifdef SQL
PR_SQLCycle();

View file

@ -2029,8 +2029,6 @@ qboolean SV_Physics (void)
host_frametime = sv_maxtic.value;
sv.world.physicstime = sv.time;
sv.framenum++;
switch(svs.gametype)
{
#ifdef Q2SERVER

View file

@ -570,8 +570,8 @@ void SV_WriteFrameToClient (client_t *client, sizebuf_t *msg)
MSG_WriteByte (msg, svcq2_frame);
MSG_WriteLong (msg, sv.framenum);
MSG_WriteLong (msg, lastframe); // what we are delta'ing from
MSG_WriteByte (msg, 0);//client->surpressCount); // rate dropped packets
// client->surpressCount = 0;
MSG_WriteByte (msg, client->chokecount); // rate dropped packets
client->chokecount = 0;
// send over the areabits
MSG_WriteByte (msg, frame->areabytes);
@ -650,6 +650,9 @@ void SV_BuildClientFrame (client_t *client)
// grab the current player_state_t
frame->ps = clent->client->ps;
if (sv.paused)
frame->ps.pmove.pm_type = Q2PM_FREEZE;
sv.world.worldmodel->funcs.FatPVS(sv.world.worldmodel, org, clientpvs, sizeof(clientpvs), false);
clientphs = CM_ClusterPHS (sv.world.worldmodel, clientcluster);

View file

@ -9,14 +9,12 @@ qboolean SVQ2_InitGameProgs(void)
}
#else
game_export_t *ge;
int svq2_maxclients;
void Sys_UnloadGame (void);
void *Sys_GetGameAPI (void *parms);
/*
===============
PF_Unicast
@ -644,6 +642,7 @@ void SVQ2_InitWorld(void)
qboolean SVQ2_InitGameProgs(void)
{
extern cvar_t maxclients;
volatile static game_import_t import; //volatile because msvc sucks
if (COM_CheckParm("-noq2dll"))
{
@ -748,9 +747,16 @@ qboolean SVQ2_InitGameProgs(void)
return false;
}
if (maxclients.value > MAX_CLIENTS)
Cvar_SetValue(&maxclients, MAX_CLIENTS);
svq2_maxclients = maxclients.value;
maxclients.flags |= CVAR_LATCH;
deathmatch.flags |= CVAR_LATCH;
coop.flags |= CVAR_LATCH;
SVQ2_InitWorld();
ge->Init ();
return true;
}