// send the unreliable message
CL_SendMove (&cmd);
}
+#ifndef NOROUTINGFIX
+ else
+ {
+ // LordHavoc: fix for NAT routing of netquake:
+ // bounce back a clc_nop message to the newly allocated server port,
+ // to establish a routing connection for incoming frames,
+ // the server waits for this before sending anything
+ if (realtime > cl.sendnoptime)
+ {
+ Con_DPrintf("sending clc_nop to get server's attention\n");
+ cl.sendnoptime = realtime + 3;
+ MSG_WriteByte(&cls.message, clc_nop);
+ }
+ }
+#endif
if (cls.demoplayback)
{
qboolean dropasap; // has been told to go to another level
qboolean sendsignon; // only valid before spawned
+#ifndef NOROUTINGFIX
+ // LordHavoc: to make netquake protocol get through NAT routers, have to wait for client to ack
+ qboolean waitingforconnect; // waiting for connect from client (stage 1)
+ qboolean sendserverinfo; // send server info in next datagram (stage 2)
+#endif
+
double last_message; // reliable messages must be sent
// periodically
client->spawn_parms[i] = (&pr_global_struct->parm1)[i];
}
+#if NOROUTINGFIX
SV_SendServerinfo (client);
+#else
+ // send serverinfo on first nop
+ client->waitingforconnect = true;
+ client->sendsignon = true;
+ client->spawned = false; // need prespawn, spawn, etc
+#endif
}
MSG_WriteByte (&msg, svc_time);
MSG_WriteFloat (&msg, sv.time);
- if (!client->sendsignon)
+ if (client->spawned)
{
// add the client specific data to the datagram
SV_WriteClientdataToMessage (client->edict, &msg);
if (!host_client->active)
continue;
+#ifndef NOROUTINGFIX
+ if (host_client->sendserverinfo)
+ {
+ host_client->sendserverinfo = false;
+ SV_SendServerinfo (host_client);
+ }
+#endif
+
if (host_client->spawned)
{
if (!SV_SendClientDatagram (host_client))
top[0] = sv_player->v.origin[0] + cosval*(i+3)*12;
top[1] = sv_player->v.origin[1] + sinval*(i+3)*12;
top[2] = sv_player->v.origin[2] + sv_player->v.view_ofs[2];
-
+
bottom[0] = top[0];
bottom[1] = top[1];
bottom[2] = top[2] - 160;
// apply friction
control = speed < sv_stopspeed.value ? sv_stopspeed.value : speed;
newspeed = speed - sv.frametime*control*friction;
-
+
if (newspeed < 0)
newspeed = 0;
else
else
{ // not on ground, so little effect on velocity
SV_AirAccelerate (wishvel);
- }
+ }
}
/*
cmd = MSG_ReadChar ();
+#ifndef NOROUTINGFIX
+ if (cmd != -1 && host_client->waitingforconnect)
+ {
+ host_client->waitingforconnect = false;
+ host_client->sendserverinfo = true;
+ }
+#endif
+
switch (cmd)
{
case -1: