MSG_WriteShort (VM_WriteDest(), PRVM_G_EDICTNUM(OFS_PARM0));
}
+//string(void) getextresponse = #624; // returns the next extResponse packet that was sent to this client
+void VM_M_getextresponse (void)
+{
+ VM_SAFEPARMCOUNT(0,VM_argv);
+
+ if (net_extresponse_count <= 0)
+ {
+ PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(NULL);
+ }
+ else
+ {
+ int first;
+ --net_extresponse_count;
+ first = (net_extresponse_last + NET_EXTRESPONSE_MAX - net_extresponse_count) % NET_EXTRESPONSE_MAX;
+ PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(net_extresponse[first]);
+ }
+}
+
prvm_builtin_t vm_m_builtins[] = {
0, // to be consistent with the old vm
// common builtings (mostly)
VM_M_refreshserverlist,
VM_M_getserverlistnumber,
VM_M_getserverlistindexforkey,
- VM_M_addwantedserverlistkey // 623
+ VM_M_addwantedserverlistkey, // 623
+ VM_M_getextresponse
};
const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
cvar_t net_address = {0, "net_address", "0.0.0.0", "network address to open ports on"};
//cvar_t net_netaddress_ipv6 = {0, "net_address_ipv6", "[0:0:0:0:0:0:0:0]", "network address to open ipv6 ports on"};
+char net_extresponse[NET_EXTRESPONSE_MAX][1400];
+int net_extresponse_count = 0;
+int net_extresponse_last = 0;
+
// ServerList interface
serverlist_mask_t serverlist_andmasks[SERVERLIST_ANDMASKCOUNT];
serverlist_mask_t serverlist_ormasks[SERVERLIST_ORMASKCOUNT];
serverlist_querywaittime = realtime + 3;
return true;
}
+ if (!strncmp(string, "extResponse ", 12))
+ {
+ ++net_extresponse_count;
+ if(net_extresponse_count > NET_EXTRESPONSE_MAX)
+ net_extresponse_count = NET_EXTRESPONSE_MAX;
+ net_extresponse_last = (net_extresponse_last + 1) % NET_EXTRESPONSE_MAX;
+ dpsnprintf(net_extresponse[net_extresponse_last], sizeof(net_extresponse[net_extresponse_last]), "%s %s", addressstring2, string + 12);
+ return true;
+ }
if (!strncmp(string, "ping", 4))
{
if (developer.integer >= 10)
#define NET_PROTOCOL_VERSION 3
+#define NET_EXTRESPONSE_MAX 16
// This is the network info/connection protocol. It is used to find Quake
// servers, get info about them, and connect to them. Once connected, the
//
//============================================================================
+extern char net_extresponse[NET_EXTRESPONSE_MAX][1400];
+extern int net_extresponse_count;
+extern int net_extresponse_last;
+
extern double masterquerytime;
extern int masterquerycount;
extern int masterreplycount;