From 4e132f6b024957ca4bf1b2c45867cda32ddffb11 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 8 Jan 2022 10:00:40 +0000 Subject: [PATCH] Fix up support for ktx's qwprogs.qvm. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6153 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/server/pr_q1qvm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engine/server/pr_q1qvm.c b/engine/server/pr_q1qvm.c index 149ca3d07..160a96730 100755 --- a/engine/server/pr_q1qvm.c +++ b/engine/server/pr_q1qvm.c @@ -2136,7 +2136,7 @@ static int syscallqvm (void *offset, quintptr_t mask, int fn, const int *arg) { qintptr_t args[13]; int i; - for (i = 0; i < 13; i++) + for (i = 0; i < countof(args); i++) args[i] = arg[i]; if (fn >= countof(traps)) return QVM_NotYetImplemented(offset, mask, args); @@ -2419,11 +2419,11 @@ qboolean PR_LoadQ1QVM(void) //WARNING: global is not remapped yet... //This code is written evilly, but works well enough -#define globalint(required, name) pr_global_ptrs->name = Q1QVMPF_PointerToNative(&q1qvmprogfuncs, (qintptr_t)&gvars->name) //the logic of this is somewhat crazy -#define globalfloat(required, name) pr_global_ptrs->name = Q1QVMPF_PointerToNative(&q1qvmprogfuncs, (qintptr_t)&gvars->name) -#define globalstring(required, name) pr_global_ptrs->name = Q1QVMPF_PointerToNative(&q1qvmprogfuncs, (qintptr_t)&gvars->name) -#define globalvec(required, name) pr_global_ptrs->name = Q1QVMPF_PointerToNative(&q1qvmprogfuncs, (qintptr_t)&gvars->name) -#define globalfunc(required, name) pr_global_ptrs->name = Q1QVMPF_PointerToNative(&q1qvmprogfuncs, (qintptr_t)&gvars->name) +#define globalint(required, name) pr_global_ptrs->name = Q1QVMPF_PointerToNative(&q1qvmprogfuncs, (qintptr_t)&gvars->name - (qintptr_t)q1qvmprogfuncs.stringtable) //the logic of this is somewhat crazy +#define globalfloat(required, name) pr_global_ptrs->name = Q1QVMPF_PointerToNative(&q1qvmprogfuncs, (qintptr_t)&gvars->name - (qintptr_t)q1qvmprogfuncs.stringtable) +#define globalstring(required, name) pr_global_ptrs->name = Q1QVMPF_PointerToNative(&q1qvmprogfuncs, (qintptr_t)&gvars->name - (qintptr_t)q1qvmprogfuncs.stringtable) +#define globalvec(required, name) pr_global_ptrs->name = Q1QVMPF_PointerToNative(&q1qvmprogfuncs, (qintptr_t)&gvars->name - (qintptr_t)q1qvmprogfuncs.stringtable) +#define globalfunc(required, name) pr_global_ptrs->name = Q1QVMPF_PointerToNative(&q1qvmprogfuncs, (qintptr_t)&gvars->name - (qintptr_t)q1qvmprogfuncs.stringtable) #define globalnull(required, name) pr_global_ptrs->name = NULL globalint (true, self); //we need the qw ones, but any in standard quake and not quakeworld, we don't really care about. globalint (true, other); @@ -2492,7 +2492,7 @@ qboolean PR_LoadQ1QVM(void) dimensionsend = dimensiondefault = 255; for (i = 0; i < 16; i++) - pr_global_ptrs->spawnparamglobals[i] = (float*)((char*)VM_MemoryBase(q1qvm)+(qintptr_t)(&gvars->parm1 + i)); + pr_global_ptrs->spawnparamglobals[i] = (float*)(&gvars->parm1 + i); for (; i < NUM_SPAWN_PARMS; i++) pr_global_ptrs->spawnparamglobals[i] = NULL; pr_global_ptrs->parm_string = NULL;