forked from fte/fteqw
1
0
Fork 0

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,6 +966,23 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
if (newgametype != svs.gametype)
{
#ifdef HLSERVER
if (newgametype != GT_HALFLIFE)
SVHL_ShutdownGame();
#endif
#ifdef Q3SERVER
if (newgametype != GT_QUAKE3)
SVQ3_ShutdownGame();
#endif
#ifdef Q2SERVER
if (newgametype != GT_QUAKE2) //we don't want the q2 stuff anymore.
SVQ2_ShutdownGameProgs ();
#endif
#ifdef VM_Q1
if (newgametype != GT_Q1QVM)
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)
@ -976,24 +993,6 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
}
svs.gametype = newgametype;
#ifdef HLSERVER
if (newgametype != GT_HALFLIFE)
SVHL_ShutdownGame();
#endif
#ifdef Q3SERVER
if (newgametype != GT_QUAKE3)
SVQ3_ShutdownGame();
#endif
#ifdef Q2SERVER
if (newgametype != GT_QUAKE2) //we don't want the q2 stuff anymore.
SVQ2_ShutdownGameProgs ();
#endif
#ifdef VM_Q1
if (newgametype != GT_Q1QVM)
Q1QVM_Shutdown();
#endif
sv.models[1] = sv.world.worldmodel;
#ifdef VM_Q1
if (svs.gametype == GT_Q1QVM)
@ -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,7 +3206,10 @@ qboolean SV_ReadPackets (void)
svs.stats.packets++;
if (cl->state != cs_zombie)
{
cl->send_message = true; // reply at end of frame
if (cl->send_message)
cl->chokecount++;
else
cl->send_message = true; // reply at end of frame
#ifdef Q2SERVER
if (cl->protocol == SCP_QUAKE2)
@ -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;
}