1
0
Fork 0
forked from fte/fteqw

Some Q3 fixes some plugin improvements so qvms can actually function correctly, and a couple of minor things.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2469 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2007-02-23 00:21:33 +00:00
parent fa6fd3c9b0
commit 35c93f1f60
20 changed files with 204 additions and 45 deletions

View file

@ -604,7 +604,7 @@ static long CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const long
} }
if (mod) if (mod)
pc = cl.worldmodel->funcs.NativeContents(mod, 0, 0, VM_POINTER(arg[0]), vec3_origin, vec3_origin); pc = mod->funcs.NativeContents(mod, 0, 0, VM_POINTER(arg[0]), vec3_origin, vec3_origin);
else else
pc = 1;//FTECONTENTS_SOLID; pc = 1;//FTECONTENTS_SOLID;
} }
@ -852,6 +852,22 @@ static long CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const long
case CG_S_UPDATEENTITYPOSITION://void trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin ); case CG_S_UPDATEENTITYPOSITION://void trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin );
break; break;
case CG_S_RESPATIALIZE://void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater ); case CG_S_RESPATIALIZE://void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater );
{
float *org = VM_POINTER(arg[1]);
float *axis = VM_POINTER(arg[2]);
/*
vec3_t listener_origin;
vec3_t listener_forward;
vec3_t listener_right;
vec3_t listener_up;
*/
VectorCopy(org, listener_origin);
VectorCopy(axis+0, listener_forward);
VectorCopy(axis+3, listener_right);
VectorCopy(axis+6, listener_up);
// S_Update(origin, axis[0], axis[1], axis[2], false);
}
break; break;
case CG_S_ADDREALLOOPINGSOUND: case CG_S_ADDREALLOOPINGSOUND:

View file

@ -465,6 +465,8 @@ void CL_ParsePacketEntities (qboolean delta)
{ {
from = MSG_ReadByte (); from = MSG_ReadByte ();
// Con_Printf("%i %i from %i\n", cls.netchan.outgoing_sequence, cls.netchan.incoming_sequence, from);
oldpacket = cl.frames[newpacket].delta_sequence; oldpacket = cl.frames[newpacket].delta_sequence;
if (cls.demoplayback == DPB_MVD) if (cls.demoplayback == DPB_MVD)
from = oldpacket = cls.netchan.incoming_sequence - 1; from = oldpacket = cls.netchan.incoming_sequence - 1;
@ -483,7 +485,8 @@ void CL_ParsePacketEntities (qboolean delta)
// return; // return;
} }
if (cls.netchan.outgoing_sequence - oldpacket >= UPDATE_BACKUP - 1) { if (cls.netchan.outgoing_sequence - oldpacket >= UPDATE_BACKUP - 1)
{
// we can't use this, it is too old // we can't use this, it is too old
FlushEntityPacket (); FlushEntityPacket ();
// don't clear cl.validsequence, so that frames can still be rendered; // don't clear cl.validsequence, so that frames can still be rendered;
@ -1594,7 +1597,7 @@ packet_entities_t *CL_ProcessPacketEntities(float *servertime, qboolean nolerp)
} }
if (!packold) //can happem at map start, and really laggy games, but really shouldn't in a normal game if (!packold) //can happem at map start, and really laggy games, but really shouldn't in a normal game
{ {
Con_DPrintf("Warning: No lerp-from frame packet\n"); // Con_DPrintf("Warning: No lerp-from frame packet\n");
packold = packnew; packold = packnew;
} }

View file

@ -1403,6 +1403,7 @@ void CL_SendCmd (float frametime)
{ {
cl.frames[cls.netchan.outgoing_sequence&UPDATE_MASK].delta_sequence = cl.validsequence; cl.frames[cls.netchan.outgoing_sequence&UPDATE_MASK].delta_sequence = cl.validsequence;
MSG_WriteByte (&buf, clc_delta); MSG_WriteByte (&buf, clc_delta);
// Con_Printf("%i\n", cl.validsequence);
MSG_WriteByte (&buf, cl.validsequence&255); MSG_WriteByte (&buf, cl.validsequence&255);
} }
else else

View file

@ -72,6 +72,7 @@ cvar_t cl_predict_players = SCVAR("cl_predict_players", "1");
cvar_t cl_predict_players2 = SCVAR("cl_predict_players2", "1"); cvar_t cl_predict_players2 = SCVAR("cl_predict_players2", "1");
cvar_t cl_solid_players = SCVAR("cl_solid_players", "1"); cvar_t cl_solid_players = SCVAR("cl_solid_players", "1");
cvar_t cl_noblink = SCVAR("cl_noblink", "0"); cvar_t cl_noblink = SCVAR("cl_noblink", "0");
cvar_t cl_servername = SCVAR("cl_servername", "none");
cvar_t cl_demospeed = FCVAR("cl_demospeed", "demo_setspeed", "1", 0); cvar_t cl_demospeed = FCVAR("cl_demospeed", "demo_setspeed", "1", 0);
@ -139,7 +140,7 @@ cvar_t cl_parsewhitetext = SCVAR("cl_parsewhitetext", "1");
cvar_t cl_dlemptyterminate = SCVAR("cl_dlemptyterminate", "1"); cvar_t cl_dlemptyterminate = SCVAR("cl_dlemptyterminate", "1");
cvar_t host_mapname = FCVAR("host_mapname", "mapname", "", 0); cvar_t host_mapname = FCVAR("mapname", "host_mapname", "", 0);
extern cvar_t cl_hightrack; extern cvar_t cl_hightrack;
@ -538,6 +539,8 @@ void CL_CheckForResend (void)
if (!cls.state && sv.state) if (!cls.state && sv.state)
{ {
Q_strncpyz (cls.servername, "internalserver", sizeof(cls.servername)); Q_strncpyz (cls.servername, "internalserver", sizeof(cls.servername));
Cvar_ForceSet(&cl_servername, cls.servername);
cls.state = ca_disconnected; cls.state = ca_disconnected;
switch (svs.gametype) switch (svs.gametype)
{ {
@ -611,6 +614,8 @@ void CL_CheckForResend (void)
connect_time = realtime+t2-t1; // for retransmit requests connect_time = realtime+t2-t1; // for retransmit requests
Cvar_ForceSet(&cl_servername, cls.servername);
#ifdef Q3CLIENT #ifdef Q3CLIENT
//Q3 clients send thier cdkey to the q3 authorize server. //Q3 clients send thier cdkey to the q3 authorize server.
//they send this packet with the challenge. //they send this packet with the challenge.
@ -1158,6 +1163,8 @@ void CL_Disconnect (void)
#endif #endif
cls.qport++; //a hack I picked up from qizmo cls.qport++; //a hack I picked up from qizmo
Cvar_ForceSet(&cl_servername, "none");
} }
#undef serverrunning #undef serverrunning
@ -1554,6 +1561,27 @@ void CL_FullInfo_f (void)
} }
} }
void CL_SetInfo (char *key, char *value)
{
cvar_t *var;
var = Cvar_FindVar(key);
if (var && (var->flags & CVAR_USERINFO))
{ //get the cvar code to set it. the server might have locked it.
Cvar_Set(var, value);
return;
}
Info_SetValueForStarKey (cls.userinfo, key, value, MAX_INFO_STRING);
if (cls.state >= ca_connected)
{
#ifdef Q2CLIENT
if (cls.protocol == CP_QUAKE2 || cls.protocol == CP_QUAKE3)
cls.resendinfo = true;
else
#endif
Cmd_ForwardToServer ();
}
}
/* /*
================== ==================
CL_SetInfo_f CL_SetInfo_f
@ -1591,7 +1619,7 @@ void CL_SetInfo_f (void)
break; //no more. break; //no more.
else if (*k == '*') else if (*k == '*')
i++; //can't remove * keys i++; //can't remove * keys
else if ((var = Cvar_FindVar(k)) && var->flags&CVAR_SERVERINFO) else if ((var = Cvar_FindVar(k)) && var->flags&CVAR_USERINFO)
i++; //this one is a cvar. i++; //this one is a cvar.
else else
Info_RemoveKey(cls.userinfo, k); //we can remove this one though, so yay. Info_RemoveKey(cls.userinfo, k); //we can remove this one though, so yay.
@ -1603,23 +1631,8 @@ void CL_SetInfo_f (void)
return; return;
} }
var = Cvar_FindVar(Cmd_Argv(1));
if (var && (var->flags & CVAR_USERINFO))
{ //get the cvar code to set it. the server might have locked it.
Cvar_Set(var, Cmd_Argv(2));
return;
}
Info_SetValueForKey (cls.userinfo, Cmd_Argv(1), Cmd_Argv(2), MAX_INFO_STRING); CL_SetInfo(Cmd_Argv(1), Cmd_Argv(2));
if (cls.state >= ca_connected)
{
#ifdef Q2CLIENT
if (cls.protocol == CP_QUAKE2 || cls.protocol == CP_QUAKE3)
cls.resendinfo = true;
else
#endif
Cmd_ForwardToServer ();
}
} }
void CL_SaveInfo(vfsfile_t *f) void CL_SaveInfo(vfsfile_t *f)
@ -2447,6 +2460,12 @@ void CL_ReadPackets (void)
} }
else if (!Netchan_Process(&cls.netchan)) else if (!Netchan_Process(&cls.netchan))
continue; // wasn't accepted for some reason continue; // wasn't accepted for some reason
if (cls.netchan.incoming_sequence >= cls.netchan.outgoing_sequence)
{
Con_Printf("Server is in a timewarp (%i packets)\n", cls.netchan.incoming_sequence - cls.netchan.outgoing_sequence+1);
cls.netchan.outgoing_sequence = cls.netchan.incoming_sequence + 1;
}
CL_ParseServerMessage (); CL_ParseServerMessage ();
break; break;
} }
@ -2707,6 +2726,7 @@ void CL_Init (void)
Cvar_Register (&cfg_save_name, cl_controlgroup); Cvar_Register (&cfg_save_name, cl_controlgroup);
Cvar_Register (&cl_servername, cl_controlgroup);
Cvar_Register (&cl_demospeed, "Demo playback"); Cvar_Register (&cl_demospeed, "Demo playback");
Cvar_Register (&cl_warncmd, "Warnings"); Cvar_Register (&cl_warncmd, "Warnings");
Cvar_Register (&cl_upspeed, cl_inputgroup); Cvar_Register (&cl_upspeed, cl_inputgroup);
@ -3220,7 +3240,12 @@ void Host_Frame (double time)
else else
#endif #endif
if (cls.state == ca_active) if (cls.state == ca_active)
S_Update (r_origin, vpn, vright, vup); {
if (cls.protocol == CP_QUAKE3)
S_ExtraUpdate();
else
S_Update (r_origin, vpn, vright, vup);
}
else else
S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin); S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin);

View file

@ -2876,7 +2876,7 @@ void CL_UpdateUserinfo (void)
CL_SetInfo CL_SetInfo
============== ==============
*/ */
void CL_SetInfo (void) void CL_ParseSetInfo (void)
{ {
int slot; int slot;
player_info_t *player; player_info_t *player;
@ -3291,7 +3291,7 @@ char *CL_ParseChat(char *text, player_info_t **player)
{ {
if (!cls.demoplayback) if (!cls.demoplayback)
Sys_ServerActivity(); //chat always flashes the screen.. Sys_ServerActivity(); //chat always flashes the screen..
/*
//check f_ stuff //check f_ stuff
if (!strncmp(s, "f_", 2)) if (!strncmp(s, "f_", 2))
{ {
@ -3322,7 +3322,7 @@ char *CL_ParseChat(char *text, player_info_t **player)
} }
return s; return s;
} }
*/
Validation_CheckIfResponse(text); Validation_CheckIfResponse(text);
#ifdef PLUGINS #ifdef PLUGINS
@ -4170,7 +4170,7 @@ void CL_ParseServerMessage (void)
break; break;
case svc_setinfo: case svc_setinfo:
CL_SetInfo (); CL_ParseSetInfo ();
break; break;
case svc_serverinfo: case svc_serverinfo:

View file

@ -398,6 +398,33 @@ int VARGS Plug_GetPlayerInfo(void *offset, unsigned int mask, const long *arg)
return pt == i; return pt == i;
} }
int VARGS Plug_LocalPlayerNumber(void *offset, unsigned int mask, const long *arg)
{
return cl.playernum[0];
}
int VARGS Plug_GetServerInfo(void *offset, unsigned int mask, const long *arg)
{
char *outptr = VM_POINTER(arg[0]);
int outlen = VM_LONG(arg[1]);
if (VM_OOB(arg[0], outlen))
return false;
Q_strncpyz(outptr, cl.serverinfo, outlen);
return true;
}
int VARGS Plug_SetUserInfo(void *offset, unsigned int mask, const long *arg)
{
char *key = VM_POINTER(arg[0]);
char *value = VM_POINTER(arg[1]);
CL_SetInfo(key, value);
return true;
}
int VARGS Plug_Con_SubPrint(void *offset, unsigned int mask, const long *arg) int VARGS Plug_Con_SubPrint(void *offset, unsigned int mask, const long *arg)
{ {
@ -519,6 +546,9 @@ void Plug_Client_Init(void)
Plug_RegisterBuiltin("Media_ShowFrameRGBA_32", Plug_Media_ShowFrameRGBA_32, PLUG_BIF_NEEDSRENDERER); Plug_RegisterBuiltin("Media_ShowFrameRGBA_32", Plug_Media_ShowFrameRGBA_32, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("GetPlayerInfo", Plug_GetPlayerInfo, PLUG_BIF_NEEDSRENDERER); Plug_RegisterBuiltin("GetPlayerInfo", Plug_GetPlayerInfo, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("LocalPlayerNumber", Plug_LocalPlayerNumber, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("GetServerInfo", Plug_GetServerInfo, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("SetUserInfo", Plug_SetUserInfo, PLUG_BIF_NEEDSRENDERER);
} }
void Plug_Client_Close(plugin_t *plug) void Plug_Client_Close(plugin_t *plug)

View file

@ -84,9 +84,9 @@ void CLQ3_ParseServerCommand(void)
ccs.lastServerCommandNum++; ccs.lastServerCommandNum++;
if( number > ccs.lastServerCommandNum ) if( number > ccs.lastServerCommandNum+TEXTCMD_MASK-1 )
{ {
Host_EndGame("Lost %i reliable serverCommands\n", Con_Printf("Warning: Lost %i reliable serverCommands\n",
number - ccs.lastServerCommandNum ); number - ccs.lastServerCommandNum );
} }
@ -723,6 +723,7 @@ qboolean CLQ3_Netchan_Process(void)
bitmask = sequence ^ cls.challenge; bitmask = sequence ^ cls.challenge;
string = ccs.clientCommands[lastClientCommandNum & TEXTCMD_MASK]; string = ccs.clientCommands[lastClientCommandNum & TEXTCMD_MASK];
#ifndef Q3_NOENCRYPT
// decrypt the packet // decrypt the packet
for(i=msg_readcount+4,j=0 ; i<net_message.cursize ; i++,j++) for(i=msg_readcount+4,j=0 ; i<net_message.cursize ; i++,j++)
{ {
@ -738,6 +739,7 @@ qboolean CLQ3_Netchan_Process(void)
bitmask ^= c << (i & 1); bitmask ^= c << (i & 1);
net_message.data[i] ^= bitmask; net_message.data[i] ^= bitmask;
} }
#endif
return true; return true;
} }
@ -772,6 +774,7 @@ void CL_Netchan_Transmit( int length, const qbyte *data )
bitmask = lastSequence ^ serverid ^ cls.challenge; bitmask = lastSequence ^ serverid ^ cls.challenge;
string = ccs.serverCommands[lastServerCommandNum & TEXTCMD_MASK]; string = ccs.serverCommands[lastServerCommandNum & TEXTCMD_MASK];
#ifndef Q3_NOENCRYPT
// encrypt the packet // encrypt the packet
for( i=12,j=0 ; i<msg.cursize ; i++,j++ ) for( i=12,j=0 ; i<msg.cursize ; i++,j++ )
{ {
@ -787,6 +790,7 @@ void CL_Netchan_Transmit( int length, const qbyte *data )
bitmask ^= c << (i & 1); bitmask ^= c << (i & 1);
msg.data[i] ^= bitmask; msg.data[i] ^= bitmask;
} }
#endif
Netchan_TransmitQ3( &cls.netchan, msg.cursize, msg.data ); Netchan_TransmitQ3( &cls.netchan, msg.cursize, msg.data );
#undef msg #undef msg

View file

@ -15,6 +15,7 @@ typedef struct {
int entityNum; // entity the contacted surface is a part of int entityNum; // entity the contacted surface is a part of
} q3trace_t; } q3trace_t;
#define Q3_NOENCRYPT //a debugging property, makes it incompatable with q3
#define MAX_Q3_STATS 16 #define MAX_Q3_STATS 16
#define MAX_Q3_PERSISTANT 16 #define MAX_Q3_PERSISTANT 16

View file

@ -2160,13 +2160,6 @@ static void PF_cs_findradius (progfuncs_t *prinst, struct globalvars_s *pr_globa
RETURN_EDICT(prinst, (void*)chain); RETURN_EDICT(prinst, (void*)chain);
} }
void PF_WasFreed (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *ent;
ent = (edict_t*)G_EDICT(prinst, OFS_PARM0);
G_FLOAT(OFS_RETURN) = ent->isfree;
}
static void PF_cl_te_gunshot (progfuncs_t *prinst, struct globalvars_s *pr_globals) static void PF_cl_te_gunshot (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
float *pos = G_VECTOR(OFS_PARM0); float *pos = G_VECTOR(OFS_PARM0);

View file

@ -883,7 +883,7 @@ rendererinfo_t softwarerendererinfo = {
SWVID_ShiftPalette, SWVID_ShiftPalette,
SWVID_GetRGBInfo, SWVID_GetRGBInfo,
NULL, SWVID_SetCaption,
SWSCR_UpdateScreen, SWSCR_UpdateScreen,
@ -980,7 +980,7 @@ rendererinfo_t openglrendererinfo = {
GLVID_ShiftPalette, GLVID_ShiftPalette,
GLVID_GetRGBInfo, GLVID_GetRGBInfo,
NULL, //setcaption GLVID_SetCaption, //setcaption
GLSCR_UpdateScreen, GLSCR_UpdateScreen,

View file

@ -315,6 +315,12 @@ void Validation_CheckIfResponse(char *text)
return; //looks like a validation, but it's not from a known client. return; //looks like a validation, but it's not from a known client.
} }
{
char *match = DISTRIBUTION"Quake v";
if (strncmp(versionstring, match, strlen(match)))
return; //this is not us
}
//now do the validation //now do the validation
{ {
f_query_t *query = NULL; f_query_t *query = NULL;

View file

@ -112,6 +112,7 @@ qboolean GLVID_Is8bit();
void GLD_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height); void GLD_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height);
void GLD_EndDirectRect (int x, int y, int width, int height); void GLD_EndDirectRect (int x, int y, int width, int height);
char *GLVID_GetRGBInfo(int prepadbytes, int *truewidth, int *trueheight); char *GLVID_GetRGBInfo(int prepadbytes, int *truewidth, int *trueheight);
void GLVID_SetCaption(char *caption);
#endif #endif
#ifdef SWQUAKE #ifdef SWQUAKE

View file

@ -1020,6 +1020,10 @@ char *VARGS Cmd_Args (void)
return cmd_args; return cmd_args;
} }
void Cmd_Args_Set(char *newargs)
{
cmd_args = newargs;
}
/* /*
============ ============

View file

@ -927,7 +927,7 @@ int VARGS Plug_Net_SetTLSClient(void *offset, unsigned int mask, const long *arg
pluginstream_t *stream; pluginstream_t *stream;
int handle = VM_LONG(arg[0]); int handle = VM_LONG(arg[0]);
qboolean anon = false; qboolean anon = true;
if (handle < 0 || handle >= pluginstreamarraylen || pluginstreamarray[handle].plugin != currentplug) if (handle < 0 || handle >= pluginstreamarraylen || pluginstreamarray[handle].plugin != currentplug)
{ {
Con_Printf("Plug_Net_SetTLSClient: socket does not belong to you (or is invalid)\n"); Con_Printf("Plug_Net_SetTLSClient: socket does not belong to you (or is invalid)\n");
@ -940,6 +940,8 @@ int VARGS Plug_Net_SetTLSClient(void *offset, unsigned int mask, const long *arg
return -2; return -2;
} }
ioctlsocket (stream->socket, FIONBIO, &_false);
{ {
static qboolean needinit = true; static qboolean needinit = true;
@ -978,7 +980,6 @@ int VARGS Plug_Net_SetTLSClient(void *offset, unsigned int mask, const long *arg
// Perform the TLS handshake // Perform the TLS handshake
ioctlsocket (stream->socket, FIONBIO, &_false);
ret = GNUTLS_E_AGAIN; ret = GNUTLS_E_AGAIN;
while ((ret == GNUTLS_E_AGAIN) || (ret == GNUTLS_E_INTERRUPTED)) while ((ret == GNUTLS_E_AGAIN) || (ret == GNUTLS_E_INTERRUPTED))
@ -988,7 +989,7 @@ int VARGS Plug_Net_SetTLSClient(void *offset, unsigned int mask, const long *arg
if (ret < 0) if (ret < 0)
{ {
Con_Printf (S_ERROR "*** TLS handshake failed\n"); Con_Printf (S_ERROR "*** TLS handshake failed (%i)\n", ret);
gnutls_perror (ret); gnutls_perror (ret);
stream->type = STREAM_SOCKET; //go back to regular socket stream->type = STREAM_SOCKET; //go back to regular socket
@ -1600,14 +1601,19 @@ qboolean Plug_ServerMessage(char *buffer, int messagelevel)
{ {
qboolean ret = true; qboolean ret = true;
Cmd_TokenizeString(buffer, false, false);
Cmd_Args_Set(buffer);
for (currentplug = plugs; currentplug; currentplug = currentplug->next) for (currentplug = plugs; currentplug; currentplug = currentplug->next)
{ {
if (currentplug->svmsgfunction) if (currentplug->svmsgfunction)
{ {
ret &= VM_Call(currentplug->vm, currentplug->svmsgfunction, buffer, messagelevel); ret &= VM_Call(currentplug->vm, currentplug->svmsgfunction, messagelevel);
} }
} }
Cmd_Args_Set(NULL);
return ret; // true to display message, false to supress return ret; // true to display message, false to supress
} }
@ -1615,14 +1621,19 @@ qboolean Plug_ChatMessage(char *buffer, int talkernum, int tpflags)
{ {
qboolean ret = true; qboolean ret = true;
Cmd_TokenizeString(buffer, false, false);
Cmd_Args_Set(buffer);
for (currentplug = plugs; currentplug; currentplug = currentplug->next) for (currentplug = plugs; currentplug; currentplug = currentplug->next)
{ {
if (currentplug->chatmsgfunction) if (currentplug->chatmsgfunction)
{ {
ret &= VM_Call(currentplug->vm, currentplug->chatmsgfunction, buffer, talkernum, tpflags); ret &= VM_Call(currentplug->vm, currentplug->chatmsgfunction, talkernum, tpflags);
} }
} }
Cmd_Args_Set(NULL);
return ret; // true to display message, false to supress return ret; // true to display message, false to supress
} }
@ -1630,14 +1641,19 @@ qboolean Plug_CenterPrintMessage(char *buffer, int clientnum)
{ {
qboolean ret = true; qboolean ret = true;
Cmd_TokenizeString(buffer, false, false);
Cmd_Args_Set(buffer);
for (currentplug = plugs; currentplug; currentplug = currentplug->next) for (currentplug = plugs; currentplug; currentplug = currentplug->next)
{ {
if (currentplug->centerprintfunction) if (currentplug->centerprintfunction)
{ {
ret &= VM_Call(currentplug->vm, currentplug->centerprintfunction, buffer, clientnum); ret &= VM_Call(currentplug->vm, currentplug->centerprintfunction, clientnum);
} }
} }
Cmd_Args_Set(NULL);
return ret; // true to display message, false to supress return ret; // true to display message, false to supress
} }
@ -1683,6 +1699,10 @@ void Plug_Close_f(void)
Con_Printf("Close which plugin?\n"); Con_Printf("Close which plugin?\n");
return; return;
} }
if (currentplug)
Sys_Error("Plug_CloseAll_f called inside a plugin!\n");
for (plug = plugs; plug; plug = plug->next) for (plug = plugs; plug; plug = plug->next)
{ {
if (!strcmp(plug->name, name)) if (!strcmp(plug->name, name))

View file

@ -68,6 +68,7 @@ void PF_search_begin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_end (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_search_end (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WasFreed (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PR_fclose_progs (progfuncs_t *prinst); void PR_fclose_progs (progfuncs_t *prinst);
char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_globals); char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_globals);

View file

@ -431,6 +431,11 @@ qboolean VID_SetWindowedMode (rendererstate_t *info)
return true; return true;
} }
void GLVID_SetCaption(char *text)
{
SetWindowText(mainwindow, text);
}
qboolean VID_SetFullDIBMode (rendererstate_t *info) qboolean VID_SetFullDIBMode (rendererstate_t *info)
{ {

View file

@ -9256,6 +9256,13 @@ void PF_SendPacket(progfuncs_t *prinst, struct globalvars_s *pr_globals)
NET_SendPacket(NS_SERVER, strlen(contents), contents, to); NET_SendPacket(NS_SERVER, strlen(contents), contents, to);
} }
void PF_WasFreed (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *ent;
ent = (edict_t*)G_EDICT(prinst, OFS_PARM0);
G_FLOAT(OFS_RETURN) = ent->isfree;
}
BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"fixme", PF_Fixme, 0, 0, 0}, {"fixme", PF_Fixme, 0, 0, 0},
{"ignore", PF_Ignore, 0, 0, 0}, {"ignore", PF_Ignore, 0, 0, 0},
@ -9569,6 +9576,23 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"bulleten", PF_bulleten, 0, 0, 0, 243}, {"bulleten", PF_bulleten, 0, 0, 0, 243},
#endif #endif
//EXT_CSQC
// {"setmodelindex", PF_sv_SetModelIndex,0, 0, 0, 333}, // #333 void(entity e, float mdlindex) setmodelindex (EXT_CSQC)
// {"modelnameforindex",PF_sv_ModelnameForIndex,0, 0, 0, 334}, // #334 string(float mdlindex) modelnameforindex (EXT_CSQC)
// {"particleeffectnum",PF_sv_particlesloaded,0, 0, 0, 335}, // #335 float(string effectname) particleeffectnum (EXT_CSQC)
// {"trailparticles", PF_sv_trailparticles,0, 0, 0, 336}, // #336 void(entity ent, float effectnum, vector start, vector end) trailparticles (EXT_CSQC),
// {"pointparticles", PF_sv_pointparticles,0, 0, 0, 337}, // #337 void(float effectnum, vector origin [, vector dir, float count]) pointparticles (EXT_CSQC)
// {"cprint", PF_sv_cprint, 0, 0, 0, 338}, // #338 void(string s) cprint (EXT_CSQC)
// {"print", PF_sv_print, 0, 0, 0, 339}, // #339 void(string s) print (EXT_CSQC)
// {"runningserver", PF_sv_runningserver,0, 0, 0, 350}, // #350 float() isserver (EXT_CSQC)
// {"registercommand", PF_sv_registercommand,0, 0, 0, 352}, // #352 void(string cmdname) registercommand (EXT_CSQC)
{"wasfreed", PF_WasFreed, 0, 0, 0, 353}, // #353 float(entity ent) wasfreed (EXT_CSQC) (should be availabe on server too)
// {"serverkey", PF_sv_serverkey, 0, 0, 0, 354}, // #354 string(string key) serverkey;
//END EXT_CSQC
//end fte extras //end fte extras
//DP extras //DP extras

View file

@ -423,6 +423,11 @@ void SV_MapList_f(void)
COM_EnumerateFiles("maps/*.bsp", ShowMapList, NULL); COM_EnumerateFiles("maps/*.bsp", ShowMapList, NULL);
} }
void gtcallback(struct cvar_s *var, char *oldvalue)
{
Con_Printf("g_gametype changed\n");
}
/* /*
====================== ======================
SV_Map_f SV_Map_f
@ -570,7 +575,13 @@ void SV_Map_f (void)
#ifdef Q3SERVER #ifdef Q3SERVER
{ {
cvar_t *gametype; cvar_t *gametype;
gametype = Cvar_Get("g_gametype", "0", CVAR_LATCH, "Q3 compatability");
gametype = Cvar_Get("mapname", "0", CVAR_LATCH|CVAR_SERVERINFO, "Q3 compatability");
gametype->flags |= CVAR_SERVERINFO;
Cvar_ForceSet(gametype, level);
gametype = Cvar_Get("g_gametype", "0", CVAR_LATCH|CVAR_SERVERINFO, "Q3 compatability");
gametype->callback = gtcallback;
if (wasspmap) if (wasspmap)
Cvar_ForceSet(gametype, "2"); Cvar_ForceSet(gametype, "2");
else if (gametype->value == 2) //singleplayer else if (gametype->value == 2) //singleplayer

View file

@ -1837,6 +1837,10 @@ client_t *SVC_DirectConnect(void)
} }
newcl->zquake_extensions = atoi(Info_ValueForKey(newcl->userinfo, "*z_ext")); newcl->zquake_extensions = atoi(Info_ValueForKey(newcl->userinfo, "*z_ext"));
if (*Info_ValueForKey(newcl->userinfo, "*fuhquake")) //fuhquake doesn't claim to support z_ext but does look at our z_ext serverinfo key.
{ //so switch on the bits that it should be sending.
newcl->zquake_extensions |= Z_EXT_PM_TYPE|Z_EXT_PM_TYPE_NEW;
}
//dmw - delayed - Netchan_OutOfBandPrint (adr, "%c", S2C_CONNECTION ); //dmw - delayed - Netchan_OutOfBandPrint (adr, "%c", S2C_CONNECTION );

View file

@ -1821,7 +1821,10 @@ void SV_InitBotLib()
// Z_FreeTags(Z_TAG_BOTLIB); // Z_FreeTags(Z_TAG_BOTLIB);
botlibmemoryavailable = 1024*1024*16; botlibmemoryavailable = 1024*1024*16;
botlib = FTE_GetBotLibAPI(BOTLIB_API_VERSION, &import); if (bot_enable->value)
botlib = FTE_GetBotLibAPI(BOTLIB_API_VERSION, &import);
else
botlib = NULL;
if (!botlib) if (!botlib)
{ {
bot_enable->flags |= CVAR_LATCH; bot_enable->flags |= CVAR_LATCH;
@ -2572,6 +2575,7 @@ static qboolean SVQ3_Netchan_Process(client_t *client)
bitmask = serverid ^ lastSequence ^ client->challenge; bitmask = serverid ^ lastSequence ^ client->challenge;
string = client->server_commands[lastServerCommandNum & TEXTCMD_MASK]; string = client->server_commands[lastServerCommandNum & TEXTCMD_MASK];
#ifndef Q3_NOENCRYPT
// decrypt the packet // decrypt the packet
for( i=msg_readcount+12,j=0 ; i<net_message.cursize ; i++,j++ ) for( i=msg_readcount+12,j=0 ; i<net_message.cursize ; i++,j++ )
{ {
@ -2587,6 +2591,7 @@ static qboolean SVQ3_Netchan_Process(client_t *client)
bitmask ^= c << (i & 1); bitmask ^= c << (i & 1);
net_message.data[i] ^= bitmask; net_message.data[i] ^= bitmask;
} }
#endif
return true; return true;
} }
@ -2603,6 +2608,7 @@ void SVQ3_Netchan_Transmit( client_t *client, int length, qbyte *data )
bitmask = client->netchan.outgoing_sequence ^ client->challenge; bitmask = client->netchan.outgoing_sequence ^ client->challenge;
string = client->last_client_command; string = client->last_client_command;
#ifndef Q3_NOENCRYPT
//first four bytes are not encrypted. //first four bytes are not encrypted.
for( i=0; i<4 ; i++) for( i=0; i<4 ; i++)
buffer[i] = data[i]; buffer[i] = data[i];
@ -2620,6 +2626,10 @@ void SVQ3_Netchan_Transmit( client_t *client, int length, qbyte *data )
bitmask ^= c << (i & 1); bitmask ^= c << (i & 1);
buffer[i] = data[i]^bitmask; buffer[i] = data[i]^bitmask;
} }
#else
for( i=0 ; i<length ; i++ )
buffer[i] = data[i];
#endif
// deliver the message // deliver the message
Netchan_TransmitQ3( &client->netchan, length, buffer); Netchan_TransmitQ3( &client->netchan, length, buffer);