From f7b9395261af5aa14f872d4de9aace1ce07c7128 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 11 Jul 2009 18:22:02 +0000 Subject: [PATCH] Updated to support mvdsv's qvm api version 13 instead. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3255 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/server/pr_q1qvm.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/engine/server/pr_q1qvm.c b/engine/server/pr_q1qvm.c index c57c56637..4ae7f1e9f 100755 --- a/engine/server/pr_q1qvm.c +++ b/engine/server/pr_q1qvm.c @@ -23,12 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef VM_Q1 -#define GAME_API_VERSION 12 +#define GAME_API_VERSION 13 #define MAX_Q1QVM_EDICTS 768 //according to ktx at api version 12 (fte's protocols go to 2048) #define VMFSID_Q1QVM 57235 //a cookie -#define WASTED_EDICT_T_SIZE 112 //qclib has split edict_t and entvars_t. +#define WASTED_EDICT_T_SIZE sizeof(void*) //qclib has split edict_t and entvars_t. //mvdsv and the api we're implementing has them in one lump //so we need to bias our entvars_t and fake the offsets a little. @@ -139,7 +139,7 @@ typedef enum G_PRECACHE_VWEP_MODEL, G_SETPAUSE, - G_SETUSERINFO, + G_SETUSERINFO, G_MOVETOGOAL, @@ -982,7 +982,10 @@ static int syscallqvm (void *offset, unsigned int mask, int fn, const int *arg) if (VM_OOB(arg[1], arg[2])) return -1; cv = Cvar_Get(VM_POINTER(arg[0]), "", 0, "QC variables"); - Q_strncpyz(VM_POINTER(arg[1]), cv->string, VM_LONG(arg[2])); + if (cv) + Q_strncpyz(VM_POINTER(arg[1]), cv->string, VM_LONG(arg[2])); + else + Q_strncpyz(VM_POINTER(arg[1]), "", VM_LONG(arg[2])); } break; @@ -1113,10 +1116,10 @@ Con_DPrintf("PF_readcmd: %s\n%s", s, output); if (*key == '*' && (VM_LONG(arg[3])&1)) return -1; //denied! } - //fallthrough - - case G_MOVETOGOAL: - return !!WrapQCBuiltin(SV_MoveToGoal, offset, mask, arg, "f"); + //fallthrough + + case G_MOVETOGOAL: + return !!WrapQCBuiltin(SV_MoveToGoal, offset, mask, arg, "f"); case G_SetBotUserInfo: WrapQCBuiltin(PF_ForceInfoKey, offset, mask, arg, "ess"); @@ -1427,14 +1430,10 @@ qboolean Q1QVM_ClientSay(edict_t *player, qboolean team) if (!q1qvm) return false; - SV_EndRedirect(); - pr_global_struct->time = sv.physicstime; pr_global_struct->self = Q1QVMPF_EdictToProgs(svprogfuncs, player); washandled = VM_Call(q1qvm, GAME_CLIENT_SAY, team); - SV_BeginRedirect(RD_CLIENT, host_client->language); //put it back to how we expect it was. *shudder* - return washandled; }