diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 6d4946aa5..58df36edf 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -224,7 +224,7 @@ ifeq ($(PRETTY_OUTPUT),1) endif $(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" $@ #\ - SUPERBUILD=$(SUPERBUILD) POLYMOST=$(POLYMOST) DEBUGANYWAY=$(DEBUGANYWAY) KRANDDEBUG=$(KRANDDEBUG)\ + DEBUGANYWAY=$(DEBUGANYWAY) KRANDDEBUG=$(KRANDDEBUG)\ USE_OPENGL=$(USE_OPENGL) BUILD32_ON_64=$(BUILD32_ON_64) PROFILER=$(PROFILER)\ NOASM=$(NOASM) NEDMALLOC=$(NEDMALLOC) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) $@ ifeq ($(PRETTY_OUTPUT),1) diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index 5d502a898..02f636251 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -11,14 +11,11 @@ PRETTY_OUTPUT ?= 1 DXROOT_OVERRIDE:= # Engine options -# SUPERBUILD - enables voxels -# POLYMOST - enables Polymost renderer -# USE_OPENGL - enables OpenGL support in Polymost +# USE_OPENGL - enables basic OpenGL Polymost renderer +# POLYMER - enables fancy Polymer renderer # NOASM - disables the use of inline assembly pragmas # LINKED_GTK - enables compile-time linkage to GTK # -SUPERBUILD = 1 -POLYMOST = 1 POLYMER = 1 USE_OPENGL = 1 NOASM = 0 @@ -27,7 +24,6 @@ BUILD32_ON_64 = 0 NEDMALLOC = 1 ifeq (0,$(USE_OPENGL)) - POLYMOST = 0 POLYMER = 0 endif diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index 4a8fbd8d5..36d15829a 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -33,7 +33,7 @@ flags_cl=/O2 /GL /arch:SSE /MP /I$(WDKROOT)\inc\crt flags_link=/RELEASE /LTCG /LIBPATH:$(WDKROOT)\lib\wxp\i386 /LIBPATH:$(WDKROOT)\lib\Crt\i386 !endif -ENGINEOPTS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DPOLYMER +ENGINEOPTS=/DUSE_OPENGL /DPOLYMER CC=cl AS=ml diff --git a/polymer/eduke32/build/Makefile b/polymer/eduke32/build/Makefile index 6ee120a67..6799afdc7 100644 --- a/polymer/eduke32/build/Makefile +++ b/polymer/eduke32/build/Makefile @@ -46,7 +46,7 @@ else LIBS+= $(L_SSP) -Wl,--enable-auto-import endif -OURCFLAGS=$(BASECFLAGS) -Wno-char-subscripts -DKSFORBUILD -I$(INC) $(ARCH) +OURCFLAGS=$(BASECFLAGS) -Wno-char-subscripts -I$(INC) $(ARCH) OURCXXFLAGS=$(BASECXXFLAGS) ASFLAGS=$(BASEASFLAGS) diff --git a/polymer/eduke32/build/Makefile.msvc b/polymer/eduke32/build/Makefile.msvc index f1300c6d1..d78bcbb10 100644 --- a/polymer/eduke32/build/Makefile.msvc +++ b/polymer/eduke32/build/Makefile.msvc @@ -9,7 +9,7 @@ OBJ=obj.msc !endif INC=include\ # !ifndef CFLAGS -CFLAGS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DKSFORBUILD /DPOLYMER # /DNEDMALLOC +CFLAGS=/DUSE_OPENGL /DPOLYMER # /DNEDMALLOC !endif o=obj diff --git a/polymer/eduke32/build/Makefile.shared b/polymer/eduke32/build/Makefile.shared index 0003731e1..ae1348889 100644 --- a/polymer/eduke32/build/Makefile.shared +++ b/polymer/eduke32/build/Makefile.shared @@ -183,12 +183,6 @@ endif BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 -ifneq (0,$(SUPERBUILD)) - BUILDCFLAGS+= -DSUPERBUILD -endif -ifneq (0,$(POLYMOST)) - BUILDCFLAGS+= -DPOLYMOST -endif ifneq (0,$(USE_OPENGL)) BUILDCFLAGS+= -DUSE_OPENGL endif @@ -200,10 +194,8 @@ ifneq (0,$(LINKED_GTK)) endif ifneq (0,$(POLYMER)) - ifneq (0,$(POLYMOST)) - ifneq (0,$(USE_OPENGL)) - BUILDCFLAGS+= -DPOLYMER - endif + ifneq (0,$(USE_OPENGL)) + BUILDCFLAGS+= -DPOLYMER endif endif diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 2723dcd33..369d5a98d 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -307,11 +307,10 @@ extern int32_t dommxoverlay, novoxmips; extern float debug1, debug2; -#ifdef SUPERBUILD extern int32_t tiletovox[MAXTILES]; extern int32_t usevoxels, voxscale[MAXVOXELS]; -#endif -#ifdef POLYMOST + +#ifdef USE_OPENGL extern int32_t usemodels, usehightile; extern int32_t rendmode; #endif @@ -328,7 +327,7 @@ EXTERN int32_t connecthead, connectpoint2[MAXPLAYERS]; static inline int32_t getrendermode(void) { -#ifndef POLYMOST +#ifndef USE_OPENGL return 0; #else return rendmode; @@ -506,7 +505,7 @@ int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_ int32_t pushmove(vec3_t *vect, int16_t *sectnum, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2))); void getzrange(const vec3_t *vect, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6))); int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, hitdata_t *hitinfo, uint32_t cliptype) ATTRIBUTE((nonnull(1,6))); -int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, char tagsearch) ATTRIBUTE((nonnull(6,7,8))); +int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch) ATTRIBUTE((nonnull(6,7,8))); int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2); void updatesector(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3))); void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t *excludesectbitmap) ATTRIBUTE((nonnull(3))); @@ -618,7 +617,7 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col); int32_t setrendermode(int32_t renderer); int32_t getrendermode(void); -#ifdef POLYMOST +#ifdef USE_OPENGL void setrollangle(int32_t rolla); #endif @@ -643,7 +642,7 @@ int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, i void polymost_glreset(void); void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL extern int32_t glanisotropy; extern int32_t glusetexcompr; extern int32_t gltexfiltermode; @@ -684,7 +683,7 @@ int32_t md_loadmodel(const char *fn); int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, int32_t flags); // int32_t md_tilehasmodel(int32_t tilenume, int32_t pal); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL typedef struct { // maps build tiles to particular animation frames of a model @@ -744,7 +743,7 @@ void hash_add(hashtable_t *t, const char *s, int32_t key, int32_t replace); #ifdef POLYMER # include "polymer.h" #else -#ifdef POLYMOST +#ifdef USE_OPENGL # include "polymost.h" #endif #endif diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index c87c73f92..d81bac2be 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -93,9 +93,7 @@ extern int32_t ExtInit(void); extern int32_t ExtPreInit(int32_t argc,const char **argv); extern void ExtUnInit(void); extern void ExtPreCheckKeys(void); -#ifdef SUPERBUILD extern void ExtAnalyzeSprites(void); -#endif extern void ExtCheckKeys(void); extern void ExtPreLoadMap(void); extern void ExtLoadMap(const char *mapname); diff --git a/polymer/eduke32/build/include/polymost.h b/polymer/eduke32/build/include/polymost.h index 1e4526f4a..720c24e06 100644 --- a/polymer/eduke32/build/include/polymost.h +++ b/polymer/eduke32/build/include/polymost.h @@ -1,7 +1,7 @@ #ifndef _polymost_h_ # define _polymost_h_ -#ifdef POLYMOST +#ifdef USE_OPENGL #include "hightile.h" diff --git a/polymer/eduke32/build/src/baselayer.c b/polymer/eduke32/build/src/baselayer.c index 19135c063..04d60ba30 100644 --- a/polymer/eduke32/build/src/baselayer.c +++ b/polymer/eduke32/build/src/baselayer.c @@ -149,7 +149,7 @@ int32_t flushlogwindow = 1; static void onvideomodechange(int32_t newmode) { UNREFERENCED_PARAMETER(newmode); } void (*baselayer_onvideomodechange)(int32_t) = onvideomodechange; -#if defined(POLYMOST) +#ifdef USE_OPENGL static int32_t osdfunc_setrendermode(const osdfuncparm_t *parm) { int32_t m; @@ -320,7 +320,6 @@ int32_t baselayer_init(void) cvar_t cvars_engine[] = { -#ifdef SUPERBUILD { "r_usenewaspect","r_usenewaspect: enable/disable new screen aspect ratio determination code",(void *) &r_usenewaspect, CVAR_BOOL, 0, 1 }, { "r_screenaspect","r_screenaspect: if using the new aspect code and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",(void *) &r_screenxy, CVAR_UINT, 100, 9999 }, { "r_novoxmips","r_novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",(void *) &novoxmips, CVAR_BOOL, 0, 1 }, @@ -329,7 +328,6 @@ int32_t baselayer_init(void) { "vid_gamma","vid_gamma : adjusts gamma ramp",(void *) &vid_gamma, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, { "vid_contrast","vid_contrast : adjusts gamma ramp",(void *) &vid_contrast, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, { "vid_brightness","vid_brightness : adjusts gamma ramp",(void *) &vid_brightness, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, -#endif { "debug1","debug counter",(void *) &debug1, CVAR_FLOAT, -100000, 100000 }, { "debug2","debug counter",(void *) &debug2, CVAR_FLOAT, -100000, 100000 }, }; @@ -343,7 +341,7 @@ int32_t baselayer_init(void) (cvars_engine[i].type & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set); } -#ifdef POLYMOST +#ifdef USE_OPENGL OSD_RegisterFunction("setrendermode","setrendermode : sets the engine's rendering mode.\n" "Mode numbers are:\n" " 0 - Classic Build software\n" diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 6731236f9..e57ddc185 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -29,9 +29,7 @@ extern int32_t ExtInit(void); extern int32_t ExtPreInit(int32_t argc,const char **argv); extern void ExtUnInit(void); extern void ExtPreCheckKeys(void); -#ifdef SUPERBUILD extern void ExtAnalyzeSprites(void); -#endif extern void ExtCheckKeys(void); extern void ExtLoadMap(const char *mapname); extern void ExtSaveMap(const char *mapname); @@ -559,10 +557,9 @@ CANCEL: lockclock += synctics; drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); -#ifdef SUPERBUILD ExtAnalyzeSprites(); -#endif drawmasks(); + #ifdef POLYMER if (rendmode == 4 && searchit == 2) { @@ -5879,10 +5876,9 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha quitevent = 0; drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); -#ifdef SUPERBUILD ExtAnalyzeSprites(); -#endif drawmasks(); + #ifdef POLYMER if (rendmode == 4 && searchit == 2) { diff --git a/polymer/eduke32/build/src/config.c b/polymer/eduke32/build/src/config.c index cdaef54f3..90eaf66c3 100644 --- a/polymer/eduke32/build/src/config.c +++ b/polymer/eduke32/build/src/config.c @@ -155,7 +155,7 @@ int32_t loadsetup(const char *fn) #ifdef RENDERTYPEWIN if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val); #endif -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (readconfig(fp, "usemodels", val, VL) > 0) usemodels = Batoi(val)?1:0; if (readconfig(fp, "usehightile", val, VL) > 0) usehightile = Batoi(val)?1:0; @@ -345,7 +345,7 @@ int32_t writesetup(const char *fn) "; Startup grid size (0-8, 9 is automatic)\n" "grid = %d\n" "\n" -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL "; OpenGL mode options\n" "usemodels = %d\n" "usehightile = %d\n" @@ -511,7 +511,7 @@ int32_t writesetup(const char *fn) glrendmode, #endif editorgridextent, min(max(0, default_grid), 9), -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL usemodels, usehightile, glusetexcache, gltexfiltermode, glanisotropy,r_downsize,glusetexcompr, #endif diff --git a/polymer/eduke32/build/src/defs.c b/polymer/eduke32/build/src/defs.c index d730ba79b..daed7423f 100644 --- a/polymer/eduke32/build/src/defs.c +++ b/polymer/eduke32/build/src/defs.c @@ -106,7 +106,7 @@ static int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens) static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0; extern int32_t nextvoxid; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL extern float alphahackarray[MAXTILES]; #endif @@ -306,7 +306,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getsymbol(script,&tile)) break; if (scriptfile_getdouble(script,&alpha)) break; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if ((uint32_t)tile < MAXTILES) alphahackarray[tile] = alpha; #endif } @@ -326,7 +326,7 @@ static int32_t defsparser(scriptfile *script) tilenume2 = tilenume1; tilenume1 = i; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if ((tilenume1 >= 0 && tilenume1 < MAXTILES) && (tilenume2 >= 0 && tilenume2 < MAXTILES)) { for (i=tilenume1; i<=tilenume2; i++) @@ -702,7 +702,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getdouble(script,&scale)) break; if (scriptfile_getnumber(script,&shadeoffs)) break; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL lastmodelid = md_loadmodel(modelfn); if (lastmodelid < 0) { @@ -718,7 +718,7 @@ static int32_t defsparser(scriptfile *script) case T_DEFINEMODELFRAME: { char *framename; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL char happy=1; #endif int32_t ftilenume, ltilenume, tilex; @@ -739,7 +739,7 @@ static int32_t defsparser(scriptfile *script) initprintf("Warning: Ignoring frame definition.\n"); break; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) { switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), 0.0f,0)) @@ -780,7 +780,7 @@ static int32_t defsparser(scriptfile *script) initprintf("Warning: Ignoring animation definition.\n"); break; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL switch (md_defineanimation(lastmodelid, startframe, endframe, (int32_t)(dfps*(65536.0*.001)), flags)) { case 0: @@ -826,7 +826,7 @@ static int32_t defsparser(scriptfile *script) if (seenframe) { modelskin = ++lastmodelskin; } seenframe = 0; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), 0, 0.0f, 1.0f, 1.0f)) { case 0: @@ -866,7 +866,6 @@ static int32_t defsparser(scriptfile *script) break; } -#ifdef SUPERBUILD if (qloadkvx(nextvoxid, fn)) { initprintf("Failure loading voxel file \"%s\"\n",fn); @@ -874,7 +873,6 @@ static int32_t defsparser(scriptfile *script) } lastvoxid = nextvoxid++; -#endif } break; case T_DEFINEVOXELTILES: @@ -904,12 +902,9 @@ static int32_t defsparser(scriptfile *script) initprintf("Warning: Ignoring voxel tiles definition.\n"); break; } -#ifdef SUPERBUILD + for (tilex = ftilenume; tilex <= ltilenume; tilex++) - { tiletovox[tilex] = lastvoxid; - } -#endif } break; @@ -941,7 +936,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getstring(script,&modelfn)) break; if (scriptfile_getbraces(script,&modelend)) break; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL lastmodelid = md_loadmodel(modelfn); if (lastmodelid < 0) { @@ -1019,7 +1014,7 @@ static int32_t defsparser(scriptfile *script) initprintf("Warning: Ignoring frame definition.\n"); break; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) { switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), smoothduration,pal)) @@ -1084,7 +1079,7 @@ static int32_t defsparser(scriptfile *script) initprintf("Warning: Ignoring animation definition.\n"); break; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL switch (md_defineanimation(lastmodelid, startframe, endframe, (int32_t)(dfps*(65536.0*.001)), flags)) { case 0: @@ -1173,7 +1168,7 @@ static int32_t defsparser(scriptfile *script) break; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), surfnum, param, specpower, specfactor)) { case 0: @@ -1268,7 +1263,7 @@ static int32_t defsparser(scriptfile *script) initprintf("Warning: Ignoring frame definition.\n"); break; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) { switch (md_definehud(lastmodelid, tilex, xadd, yadd, zadd, angadd, flags, fov)) @@ -1295,7 +1290,7 @@ static int32_t defsparser(scriptfile *script) } } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL md_setmisc(lastmodelid,(float)scale,shadeoffs,(float)mzadd,flags); #endif @@ -1320,10 +1315,8 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getstring(script,&fn)) break; //voxel filename if (nextvoxid == MAXVOXELS) { initprintf("Maximum number of voxels already defined.\n"); break; } -#ifdef SUPERBUILD if (qloadkvx(nextvoxid, fn)) { initprintf("Failure loading voxel file \"%s\"\n",fn); break; } lastvoxid = nextvoxid++; -#endif if (scriptfile_getbraces(script,&modelend)) break; while (script->textptr < modelend) @@ -1333,10 +1326,8 @@ static int32_t defsparser(scriptfile *script) //case T_ERROR: initprintf("Error on line %s:%d in voxel tokens\n", script->filename,linenum); break; case T_TILE: scriptfile_getsymbol(script,&tilex); -#ifdef SUPERBUILD if ((uint32_t)tilex < MAXTILES) tiletovox[tilex] = lastvoxid; else initprintf("Invalid tile number on line %s:%d\n",script->filename, scriptfile_getlinum(script,voxeltokptr)); -#endif break; case T_TILE0: scriptfile_getsymbol(script,&tile0); break; //1st tile # @@ -1349,17 +1340,13 @@ static int32_t defsparser(scriptfile *script) } if ((tile1 < 0) || (tile0 >= MAXTILES)) { initprintf("Invalid tile range on line %s:%d\n",script->filename, scriptfile_getlinum(script,voxeltokptr)); break; } -#ifdef SUPERBUILD for (tilex=tile0; tilex<=tile1; tilex++) tiletovox[tilex] = lastvoxid; -#endif break; //last tile number (inclusive) case T_SCALE: { double scale=1.0; scriptfile_getdouble(script,&scale); -#ifdef SUPERBUILD voxscale[lastvoxid] = (int32_t)(65536*scale); -#endif break; } } @@ -1829,7 +1816,7 @@ static int32_t defsparser(scriptfile *script) break; } } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL for (; r0 <= r1; r0++) md_undefinetile(r0); #endif } @@ -1838,7 +1825,7 @@ static int32_t defsparser(scriptfile *script) case T_UNDEFMODELOF: { int32_t r0; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL int32_t mid; #endif @@ -1849,7 +1836,7 @@ static int32_t defsparser(scriptfile *script) break; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL mid = md_tilehasmodel(r0,0); if (mid < 0) break; diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 7f8c657c1..e1b9f628c 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -6,8 +6,6 @@ // by Jonathon Fowler (jonof@edgenetwk.com) -//#define POLYMOST -//#define SUPERBUILD #define ENGINE #include "compat.h" @@ -22,7 +20,7 @@ #include "baselayer.h" #include "scriptfile.h" -#ifdef POLYMOST +#ifdef USE_OPENGL # ifdef USE_OPENGL # include "glbuild.h" # include "mdsprite.h" @@ -71,7 +69,6 @@ static void drawpixel_safe(void *s, char a) #endif } -#ifdef SUPERBUILD void loadvoxel(int32_t voxindex) { voxindex=0; } int32_t tiletovox[MAXTILES]; int32_t usevoxels = 1; @@ -91,7 +88,6 @@ int32_t voxscale[MAXVOXELS]; static int32_t ggxinc[MAXXSIZ+1], ggyinc[MAXXSIZ+1]; static int32_t lowrecip[1024], nytooclose, nytoofar; static uint32_t distrecip[65536]; -#endif static intptr_t *lookups = NULL; static char lookupsalloctype = 255; @@ -1163,7 +1159,7 @@ static int32_t colscan[27]; static int16_t clipnum, hitwalls[4]; const int32_t hitscangoalx = (1<<29)-1, hitscangoaly = (1<<29)-1; -#ifdef POLYMOST +#ifdef USE_OPENGL int32_t hitallsprites = 0; #endif @@ -1217,7 +1213,7 @@ static int32_t setviewcnt = 0; // interface layers use this now static int32_t bakframeplace[4], bakxsiz[4], bakysiz[4]; static int32_t bakwindowx1[4], bakwindowy1[4]; static int32_t bakwindowx2[4], bakwindowy2[4]; -#ifdef POLYMOST +#ifdef USE_OPENGL static int32_t bakrendmode,baktile; #endif @@ -3451,7 +3447,6 @@ static void drawalls(int32_t bunch) // // drawvox // -#ifdef SUPERBUILD static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasprang, int32_t daxscale, int32_t dayscale, char daindex, int8_t dashade, char dapal, int32_t *daumost, int32_t *dadmost) @@ -3700,7 +3695,6 @@ static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasp enddrawing(); //}}} } -#endif // // drawsprite (internal) @@ -3720,7 +3714,7 @@ static void drawsprite(int32_t snum) char swapped, daclip; //============================================================================= //POLYMOST BEGINS -#ifdef POLYMOST +#ifdef USE_OPENGL if (rendmode == 3) { polymost_drawsprite(snum); @@ -3755,10 +3749,9 @@ static void drawsprite(int32_t snum) if (tilenum < 0 || tilenum >= MAXSPRITES) return; -#ifdef SUPERBUILD if ((cstat&48)==48) vtilenum = tilenum; // if the game wants voxels, it gets voxels else if ((cstat&48)!=48 && (usevoxels) && (tiletovox[tilenum] != -1) -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL && (!(spriteext[tspr->owner].flags&SPREXT_NOTMD)) #endif ) @@ -3766,7 +3759,6 @@ static void drawsprite(int32_t snum) vtilenum = tiletovox[tilenum]; cstat |= 48; } -#endif if ((cstat&48) != 48) { @@ -4517,7 +4509,6 @@ static void drawsprite(int32_t snum) //Draw it! ceilspritescan(lx,rx-1); } -#ifdef SUPERBUILD else if ((cstat&48) == 48) { int32_t nxrepeat, nyrepeat; @@ -4643,12 +4634,11 @@ static void drawsprite(int32_t snum) } i = (int32_t)tspr->ang+1536; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL i += spriteext[tspr->owner].angoff; #endif drawvox(tspr->x,tspr->y,tspr->z,i,(int32_t)tspr->xrepeat,(int32_t)tspr->yrepeat,vtilenum,tspr->shade,tspr->pal,lwall,swall); } -#endif if (automapping == 1) show2dsprite[spritenum>>3] |= pow2char[spritenum&7]; } @@ -4663,7 +4653,7 @@ static void drawmaskwall(int16_t damaskwallcnt) walltype *wal; //============================================================================= //POLYMOST BEGINS -#ifdef POLYMOST +#ifdef USE_OPENGL if (rendmode == 3) { polymost_drawmaskwall(damaskwallcnt); return; } # ifdef POLYMER if (rendmode == 4) @@ -4780,7 +4770,7 @@ static void fillpolygon(int32_t npoints) int16_t *ptr, *ptr2; intptr_t p; -#if defined POLYMOST && defined USE_OPENGL +#ifdef USE_OPENGL if (rendmode >= 3 && qsetmode == 200) { polymost_fillpolygon(npoints); return; } #endif @@ -5173,7 +5163,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t UNREFERENCED_PARAMETER(uniqid); //============================================================================= //POLYMOST BEGINS -#ifdef POLYMOST +#ifdef USE_OPENGL if (rendmode >= 3 && qsetmode == 200) { polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2,uniqid); return; } #endif //============================================================================= //POLYMOST ENDS @@ -5692,11 +5682,9 @@ static void dosetaspect(void) if (j != 0) j = mulscale16((int32_t)radarang[k+1]-(int32_t)radarang[k],j); radarang2[i] = (int16_t)(((int32_t)radarang[k]+j)>>6); } -#ifdef SUPERBUILD for (i=1; i<65536; i++) distrecip[i] = divscale20(xdimen,i); nytooclose = xdimen*2100; nytoofar = 65536*16384-1048576; -#endif } } @@ -6302,7 +6290,6 @@ int32_t initengine(void) parallaxtype = 2; parallaxyoffs = 0L; parallaxyscale = 65536; showinvisibility = 0; -#ifdef SUPERBUILD for (i=1; i<1024; i++) lowrecip[i] = ((1<<24)-1)/i; for (i=0; i>2,65536L); -#endif paletteloaded = 0; @@ -6339,7 +6325,7 @@ int32_t initengine(void) captureformat = 0; loadpalette(); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (!hicfirstinit) hicinit(); if (!mdinited) mdinit(); #endif @@ -6357,7 +6343,7 @@ void uninitengine(void) //OSD_Printf("cacheresets = %d, cacheinvalidates = %d\n", cacheresets, cacheinvalidates); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL polymost_glreset(); hicinit(); freeallmodels(); @@ -6494,7 +6480,7 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, umost[0] = shortptr1[0]-windowy1; dmost[0] = shortptr2[0]-windowy1; -#ifdef POLYMOST +#ifdef USE_OPENGL # ifdef POLYMER if (rendmode == 4) { @@ -6869,7 +6855,7 @@ void drawmasks(void) }*/ { -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL curpolygonoffset = 0; cullcheckcnt = 0; #endif @@ -6928,7 +6914,7 @@ void drawmasks(void) if (tspriteptr[spritesortcnt] != NULL) drawsprite(spritesortcnt); } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL if (totalclock < lastcullcheck - CULL_DELAY) lastcullcheck = totalclock; if (totalclock >= lastcullcheck + CULL_DELAY) @@ -7423,7 +7409,7 @@ int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy, { Bmemset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID)); // polymost_cachesync(); @@ -7891,7 +7877,7 @@ int32_t loadoldboard(char *filename, char fromwhere, int32_t *daposx, int32_t *d kclose(fil); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); memset(spritesmooth, 0, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID)); #endif @@ -7920,7 +7906,7 @@ void delete_maphack_lights() {} // int32_t loadmaphack(const char *filename) { -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL enum { T_EOF = -2, @@ -8393,7 +8379,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da { int32_t i, j; -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL extern char nogl; if (nogl) dabpp = 8; @@ -8423,7 +8409,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da // Workaround possible bugs in the GL driver makeasmwriteable(); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (dabpp > 8) rendmode = glrendmode; // GL renderer else if (dabpp == 8 && j > 8) rendmode = 0; // going from GL to software activates softpolymost #endif @@ -8462,7 +8448,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3) { polymost_glreset(); @@ -8544,7 +8530,7 @@ void nextpage(void) if ((totalclock >= lastageclock+CACHEAGETIME) || (totalclock < lastageclock)) { lastageclock = totalclock; agecache(); } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL omdtims = mdtims; mdtims = getticks(); { @@ -8812,7 +8798,6 @@ void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, in // // qloadkvx // -#ifdef SUPERBUILD int32_t qloadkvx(int32_t voxindex, const char *filename) { int32_t i, fil, dasiz, lengcnt, lengtot; @@ -8837,7 +8822,7 @@ int32_t qloadkvx(int32_t voxindex, const char *filename) } kclose(fil); -#if defined POLYMOST && defined USE_OPENGL +#ifdef USE_OPENGL if (voxmodels[voxindex]) { voxfree(voxmodels[voxindex]); @@ -8847,7 +8832,6 @@ int32_t qloadkvx(int32_t voxindex, const char *filename) #endif return 0; } -#endif // @@ -9396,7 +9380,7 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32 { spr = &sprite[z]; cstat = spr->cstat; -#ifdef POLYMOST +#ifdef USE_OPENGL if (!hitallsprites) #endif if ((cstat&dasprclipmask) == 0) continue; @@ -9551,7 +9535,8 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32 // // neartag // -int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, char tagsearch) +int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, + int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch) { walltype *wal, *wal2; spritetype *spr; @@ -9563,8 +9548,7 @@ int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ang *neartagsector = -1; *neartagwall = -1; *neartagsprite = -1; *neartaghitdist = 0; - if (sectnum < 0) return(0); - if ((tagsearch < 1) || (tagsearch > 3)) return(0); + if (sectnum < 0 || (tagsearch & 3) == 0) return(0); vx = mulscale14(sintable[(ange+2560)&2047],neartagrange); xe = xs+vx; vy = mulscale14(sintable[(ange+2048)&2047],neartagrange); ye = ys+vy; @@ -9616,6 +9600,10 @@ int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ang } } + tempshortcnt++; + + if (tagsearch & 4) continue; // skip sprite search + for (z=headspritesect[dasector]; z>=0; z=nextspritesect[z]) { spr = &sprite[z]; @@ -9663,8 +9651,6 @@ int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ang } } } - - tempshortcnt++; } while (tempshortcnt < tempshortnum); return(0); @@ -11253,7 +11239,7 @@ void setbrightness(char dabrightness, uint8_t dapalid, char noapply) if ((noapply&1) == 0) setpalette(0,256); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3) { static uint32_t lastpalettesum = 0; @@ -11331,7 +11317,7 @@ void clearview(int32_t dacol) if (qsetmode != 200) return; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3) { palette_t p = getpal(dacol); @@ -11369,7 +11355,7 @@ void clearallviews(int32_t dacol) if (qsetmode != 200) return; //dacol += (dacol<<8); dacol += (dacol<<16); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3) { palette_t p = getpal(dacol); @@ -11399,7 +11385,7 @@ void clearallviews(int32_t dacol) // void plotpixel(int32_t x, int32_t y, char col) { -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3 && qsetmode == 200) { palette_t p = getpal(col); @@ -11426,7 +11412,7 @@ void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, char c { int32_t i; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3 && qsetmode == 200) { palette_t p = getpal(col); @@ -11463,7 +11449,7 @@ char getpixel(int32_t x, int32_t y) { char r; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3 && qsetmode == 200) return 0; #endif @@ -11489,7 +11475,7 @@ void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz) bakframeplace[setviewcnt] = frameplace; frameplace = waloff[tilenume]; bakwindowx1[setviewcnt] = windowx1; bakwindowy1[setviewcnt] = windowy1; bakwindowx2[setviewcnt] = windowx2; bakwindowy2[setviewcnt] = windowy2; -#ifdef POLYMOST +#ifdef USE_OPENGL if (setviewcnt == 0) { bakrendmode = rendmode; @@ -11521,7 +11507,7 @@ void setviewback(void) setviewcnt--; offscreenrendering = (setviewcnt>0); -#ifdef POLYMOST +#ifdef USE_OPENGL if (setviewcnt == 0) { rendmode = bakrendmode; @@ -11597,7 +11583,7 @@ void completemirror(void) int32_t i, dy; intptr_t p; -#ifdef POLYMOST +#ifdef USE_OPENGL if (rendmode) return; #endif @@ -11868,7 +11854,7 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) col = palookup[0][col]; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3) { palette_t p; @@ -13202,7 +13188,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const if (fontsize) { fontptr = smalltextfont; charxsiz = 4; } else { fontptr = textfont; charxsiz = 8; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (!polymost_printext256(xpos,ypos,col,backcol,name,fontsize)) return; if (rendmode >= 3 && qsetmode == 200) @@ -13343,7 +13329,7 @@ int32_t screencapture_tga(const char *filename, char inverseit) return -1; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3 && qsetmode == 200) { head[1] = 0; // no colourmap @@ -13368,7 +13354,7 @@ int32_t screencapture_tga(const char *filename, char inverseit) ptr = (char *)frameplace; // palette first -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode < 3 || (rendmode >= 3 && qsetmode != 200)) { #endif @@ -13379,7 +13365,7 @@ int32_t screencapture_tga(const char *filename, char inverseit) Bfputc(curpalettefaded[i].g, fil); // g Bfputc(curpalettefaded[i].r, fil); // r } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL } #endif @@ -13400,7 +13386,7 @@ int32_t screencapture_tga(const char *filename, char inverseit) } else { -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3 && qsetmode == 200) { char c; @@ -13425,7 +13411,7 @@ int32_t screencapture_tga(const char *filename, char inverseit) #endif for (i=ydim-1; i>=0; i--) Bfwrite(ptr+i*bytesperline, xdim, 1, fil); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL } #endif } @@ -13535,7 +13521,7 @@ int32_t screencapture_pcx(const char *filename, char inverseit) head[65] = 1; // 8-bit head[68] = 1; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3 && qsetmode == 200) { head[65] = 3; // 24-bit @@ -13574,7 +13560,7 @@ int32_t screencapture_pcx(const char *filename, char inverseit) } else { -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode >= 3 && qsetmode == 200) { // 24bit @@ -13596,7 +13582,7 @@ int32_t screencapture_pcx(const char *filename, char inverseit) #endif for (i=0; i= 3 && qsetmode != 200)) { #endif @@ -13616,7 +13602,7 @@ int32_t screencapture_pcx(const char *filename, char inverseit) Bfputc(curpalettefaded[i].g, fil); // g Bfputc(curpalettefaded[i].b, fil); // r } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL } #endif @@ -13641,7 +13627,7 @@ int32_t screencapture(const char *filename, char inverseit) int32_t setrendermode(int32_t renderer) { UNREFERENCED_PARAMETER(renderer); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (bpp == 8) renderer = 0; # ifdef POLYMER else renderer = min(4,max(3,renderer)); @@ -13692,7 +13678,7 @@ int32_t setrendermode(int32_t renderer) // // setrollangle // -#ifdef POLYMOST +#ifdef USE_OPENGL void setrollangle(int32_t rolla) { UNREFERENCED_PARAMETER(rolla); @@ -13718,7 +13704,7 @@ void setrollangle(int32_t rolla) // void invalidatetile(int16_t tilenume, int32_t pal, int32_t how) { -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL int32_t numpal, firstpal, np; int32_t hp; @@ -13757,7 +13743,7 @@ void invalidatetile(int16_t tilenume, int32_t pal, int32_t how) // void setpolymost2dview(void) { -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (rendmode < 3) return; if (gloy1 != -1) diff --git a/polymer/eduke32/build/src/hightile.c b/polymer/eduke32/build/src/hightile.c index 435dac2d9..c05b268a6 100644 --- a/polymer/eduke32/build/src/hightile.c +++ b/polymer/eduke32/build/src/hightile.c @@ -4,7 +4,7 @@ * See the included license file "BUILDLIC.TXT" for license info. */ -#ifdef POLYMOST +#ifdef USE_OPENGL #include "build.h" #include "compat.h" diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index 1833213af..d5835cb43 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -1,6 +1,6 @@ //------------------------------------- MD2/MD3 LIBRARY BEGINS ------------------------------------- -#ifdef POLYMOST +#ifdef USE_OPENGL #include "compat.h" #include "build.h" diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index ac577a3fd..7a2c49781 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -1,6 +1,6 @@ // blah -#ifdef POLYMOST +#ifdef USE_OPENGL #define POLYMER_C #include "polymer.h" @@ -2744,7 +2744,7 @@ static void polymer_updatewall(int16_t wallnum) // it also works, bitches sec = §or[sectofwall]; - if (sectofwall < 0 || sectofwall > numsectors || + if (sectofwall < 0 || sectofwall >= numsectors || wallnum < 0 || wallnum > numwalls || sec->wallptr > wallnum || wallnum >= (sec->wallptr + sec->wallnum)) return; // yay, corrupt map @@ -2837,7 +2837,7 @@ static void polymer_updatewall(int16_t wallnum) else xref = 0; - if (wal->nextsector < 0 || wal->nextsector > numsectors) + if (wal->nextsector < 0 || wal->nextsector >= numsectors) { Bmemcpy(w->wall.buffer, &s->floor.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); Bmemcpy(&w->wall.buffer[5], &s->floor.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index f00447582..5e455e7be 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -66,7 +66,7 @@ Low priority: **************************************************************************************************/ -#ifdef POLYMOST +#ifdef USE_OPENGL #include "compat.h" #include "build.h" @@ -6399,7 +6399,7 @@ Description of Ken's filter to improve LZW compression of DXT1 format by ~15%: ( I think this improved compression by a few % :) */ -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, uint32_t miplen) { void *writebuf; diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 3313484c9..4ee6ab552 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -202,7 +202,7 @@ int32_t main(int32_t argc, char *argv[]) } } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL if ((argp = Bgetenv("BUILD_NOFOG")) != NULL) nofog = Batol(argp); #endif @@ -217,7 +217,7 @@ int32_t main(int32_t argc, char *argv[]) return r; } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL void setvsync(int32_t sync) { if (vsync == sync) return; @@ -984,7 +984,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) if (lockcount) while (lockcount) enddrawing(); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (bpp > 8 && sdl_surface) polymost_glreset(); #endif @@ -995,7 +995,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) gammabrightness = 0; // redetect on next mode switch } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (c > 8) { int32_t i, j, multisamplecheck = (glmultisample > 0); diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index ab1125d25..38368ce12 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -22,7 +22,7 @@ #include #include -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL #include "glbuild.h" #endif @@ -60,7 +60,7 @@ int32_t backgroundidle = 1; static WORD sysgamma[3][256]; extern int32_t curbrightness, gammabrightness; -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL // OpenGL stuff static HGLRC hGLRC = 0; char nofog=0; @@ -464,7 +464,7 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in *stderr = *fp; } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL if ((argp = Bgetenv("BUILD_NOFOG")) != NULL) nofog = Batol(argp); if (Bgetenv("BUILD_FORCEGL") != NULL) @@ -626,7 +626,7 @@ int32_t initsystem(void) win_printversion(); -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL if (loadgldriver(getenv("BUILD_GLDRV"))) { initprintf("Failure loading OpenGL. GL modes are unavailable.\n"); @@ -658,7 +658,7 @@ void uninitsystem(void) win_allowtaskswitching(1); -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL unloadgldriver(); #endif @@ -1688,7 +1688,7 @@ int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t fo // setvideomode() -- set the video mode // -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL static HWND hGLWindow = NULL; #endif @@ -1738,7 +1738,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) if (gammabrightness && setgamma() < 0) gammabrightness = 0; } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL if (hGLWindow && glinfo.vsync) bwglSwapIntervalEXT(vsync); #endif if (inp) AcquireInputDevices(1); @@ -1767,7 +1767,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) #define CHECK(w,h) if ((w < maxx) && (h < maxy)) -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL void setvsync(int32_t sync) { if (!glinfo.vsync) @@ -1861,7 +1861,7 @@ void getvalidmodes(void) int32_t i, j, maxx=0, maxy=0; HRESULT result; -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL if (desktopbpp > 8 && !nogl) cdepths[1] = desktopbpp; else cdepths[1] = 0; #endif @@ -1887,7 +1887,7 @@ void getvalidmodes(void) } } } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL cdsenummodes(); #endif @@ -1997,7 +1997,7 @@ void showframe(int32_t w) char *p,*q; int32_t i,j; -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL if (bpp > 8) { if (palfadedelta) @@ -2675,7 +2675,7 @@ static int32_t SetupDIB(int32_t width, int32_t height) return FALSE; } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL // // ReleaseOpenGL() -- cleans up OpenGL rendering stuff // @@ -3011,7 +3011,7 @@ static BOOL CreateAppWindow(int32_t modenum) { if (bpp > 8) { -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL ReleaseOpenGL(); #endif } @@ -3024,7 +3024,7 @@ static BOOL CreateAppWindow(int32_t modenum) { // restore previous display mode and set to normal cooperative level RestoreDirectDrawMode(); -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL } else if (fs && fullscreen) { @@ -3116,7 +3116,7 @@ static BOOL CreateAppWindow(int32_t modenum) { if (bitspp > 8) { -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL // yes, start up opengl if (SetupOpenGL(width,height,bitspp)) return TRUE; @@ -3141,7 +3141,7 @@ static BOOL CreateAppWindow(int32_t modenum) return TRUE; } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL if (bitspp > 8) { DEVMODE dmScreenSettings; @@ -3195,7 +3195,7 @@ static BOOL CreateAppWindow(int32_t modenum) if (bitspp > 8) { -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL // we want an opengl mode if (SetupOpenGL(width,height,bitspp)) { @@ -3213,7 +3213,7 @@ static BOOL CreateAppWindow(int32_t modenum) } } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL if (bitspp > 8) loadglextensions(); #endif @@ -3250,7 +3250,7 @@ static void DestroyAppWindow(void) gammabrightness = 0; } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL UninitOpenGL(); #endif UninitDirectDraw(); @@ -3561,7 +3561,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA POINT pt; HRESULT result; */ -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (hWnd == hGLWindow) return DefWindowProc(hWnd,uMsg,wParam,lParam); #endif @@ -3580,7 +3580,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA case WM_ACTIVATEAPP: { appactive = wParam; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (hGLWindow) { if (!appactive && fullscreen) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index af475f51a..f10e516d8 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -33,8 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # define ACTOR_STATIC static #endif - -#define KILLIT(KX) {deletesprite(KX);goto BOLT;} +#define KILLIT(KX) { deletesprite(KX); goto BOLT; } extern int32_t g_numEnvSoundsPlaying; extern int32_t g_noEnemies; @@ -2497,7 +2496,7 @@ ACTOR_STATIC void G_MoveWeapons(void) } if (!(SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS) && - s->yvel >= 0 && sprite[s->yvel].sectnum < MAXSECTORS) + s->yvel >= 0 && sprite[s->yvel].sectnum != MAXSECTORS) if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256) j = 49152|s->yvel; diff --git a/polymer/eduke32/source/anim.c b/polymer/eduke32/source/anim.c index a7a73691d..71824e6ad 100644 --- a/polymer/eduke32/source/anim.c +++ b/polymer/eduke32/source/anim.c @@ -202,7 +202,7 @@ void G_PlayAnim(const char *fn,char t) { char *animbuf; int32_t i, length=0, numframes=0; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL int32_t ogltexfiltermode=gltexfiltermode; #endif int32_t handle=-1; @@ -243,7 +243,7 @@ void G_PlayAnim(const char *fn,char t) //setbrightness(ud.brightness>>2,tempbuf,2); P_SetGamePalette(g_player[myconnectindex].ps,ANIMPAL,10); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL gltexfiltermode = 0; gltexapplyprops(); #endif @@ -302,7 +302,7 @@ void G_PlayAnim(const char *fn,char t) } ENDOFANIMLOOP: -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL gltexfiltermode = ogltexfiltermode; gltexapplyprops(); #endif diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index b87c5055a..23953d6d7 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -3812,9 +3812,7 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int quitevent = 0; drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); -#ifdef SUPERBUILD ExtAnalyzeSprites(); -#endif drawmasks(); #ifdef POLYMER if (rendmode == 4 && searchit == 2) @@ -4038,9 +4036,7 @@ ENDFOR1: sprite[linebegspr].pal -= (sprite[linebegspr].pal>0); drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); -#ifdef SUPERBUILD ExtAnalyzeSprites(); -#endif drawmasks(); #ifdef POLYMER if (rendmode == 4 && searchit == 2) @@ -7416,7 +7412,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) { if (argc > i+1) { -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL extern char TEXCACHEFILE[BMAX_PATH]; Bsprintf(tempbuf,"%s/%s",argv[i+1],TEXCACHEFILE); @@ -7898,7 +7894,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm) return OSDCMD_OK; } -#ifdef POLYMOST +#ifdef USE_OPENGL static int32_t osdcmd_tint(const osdfuncparm_t *parm) { int32_t i; @@ -8173,7 +8169,7 @@ static int32_t registerosdcommands(void) OSD_RegisterFunction("show_heightindicators", "show_heightindicators {0, 1 or 2}: sets display of height indicators in 2D mode", osdcmd_vars_pk); OSD_RegisterFunction("show_ambiencesounds", "show_ambiencesounds {0, 1 or 2}>: sets display of MUSICANDSFX circles in 2D mode", osdcmd_vars_pk); OSD_RegisterFunction("corruptcheck", "corruptcheck {|now|tryfix}: sets auto corruption check interval if given, otherwise as indicated", osdcmd_vars_pk); -#ifdef POLYMOST +#ifdef USE_OPENGL OSD_RegisterFunction("tint", "tint : queries or sets hightile tinting", osdcmd_tint); #endif @@ -8264,7 +8260,7 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows) { UNREFERENCED_PARAMETER(numcols); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL // if (getrendermode() < 3) bits = BITS; // else if (rendmode>=3 && qsetmode==200) @@ -9146,7 +9142,7 @@ int32_t ExtInit(void) bpp = 32; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL glusetexcache = -1; if (Bstrcmp(setupfilename, "mapster32.cfg")) @@ -9741,7 +9737,7 @@ void ExtAnalyzeSprites(void) } // else tspr->cstat&=32767; -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL if (!usemodels || md_tilehasmodel(tspr->picnum,tspr->pal) < 0) #endif { diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index e8836ed0c..7f3127b31 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -187,7 +187,7 @@ void CONFIG_SetDefaults(void) ud.config.ScreenWidth = 1024; ud.config.ScreenHeight = 768; ud.config.ScreenMode = 0; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL ud.config.ScreenBPP = 32; #else ud.config.ScreenBPP = 8; @@ -832,7 +832,7 @@ void CONFIG_WriteBinds(void) // save binds and aliases to _settings.cfg Bfree(ptr); } -void CONFIG_WriteSetup(void) +void CONFIG_WriteSetup(uint32_t flags) { int32_t dummy; char tempbuf[1024]; @@ -844,12 +844,6 @@ void CONFIG_WriteSetup(void) SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",++ud.executions,FALSE,FALSE); - for (dummy=0; dummy<10; dummy++) - { - Bsprintf(buf,"WeaponChoice%d",dummy); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],FALSE,FALSE); - } - SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_JF,FALSE,FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,FALSE,FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad",ud.config.NoAutoLoad,FALSE,FALSE); @@ -858,23 +852,44 @@ void CONFIG_WriteSetup(void) SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == 4 && bpp > 8,FALSE,FALSE); #endif - if (!NAM) - { - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE); - SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout); - } - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP",ud.config.ScreenBPP,FALSE,FALSE); // JBF 20040523 SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",ud.config.ScreenHeight,FALSE,FALSE); // JBF 20031206 SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",ud.config.ScreenMode,FALSE,FALSE); // JBF 20031206 SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",ud.config.ScreenWidth,FALSE,FALSE); // JBF 20031206 + + SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&g_grpNamePtr[0]); + + if (g_noSetup == 0) + SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]); + + // exit early after only updating the values that can be changed from the startup window + if (flags & 1) + { + SCRIPT_Save(ud.config.scripthandle, setupfilename); + SCRIPT_Free(ud.config.scripthandle); + OSD_Printf("Updated %s\n",setupfilename); + + return; + } + #ifdef RENDERTYPEWIN SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE); #endif + for (dummy=0; dummy<10; dummy++) + { + Bsprintf(buf,"WeaponChoice%d",dummy); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],FALSE,FALSE); + } + + if (!NAM) + { + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE); + SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout); + } #ifdef _WIN32 SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, FALSE, FALSE); @@ -984,13 +999,6 @@ void CONFIG_WriteSetup(void) SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]); SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]); - SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&g_grpNamePtr[0]); - -// #ifdef _WIN32 - if (g_noSetup == 0) - SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]); -// #endif - { char commmacro[] = "CommbatMacro# "; diff --git a/polymer/eduke32/source/config.h b/polymer/eduke32/source/config.h index 60374e425..f993e9261 100644 --- a/polymer/eduke32/source/config.h +++ b/polymer/eduke32/source/config.h @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int32_t CONFIG_ReadSetup( void ); void CONFIG_GetSetupFilename( void ); -void CONFIG_WriteSetup( void ); +void CONFIG_WriteSetup(uint32_t flags); void CONFIG_SetupMouse( void ); void CONFIG_SetupJoystick( void ); void CONFIG_SetDefaultKeys(int32_t type); diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index c5edf7c81..b926975d6 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -35,7 +35,7 @@ extern "C" { #ifdef POLYMER #include "polymer.h" #else -#ifdef POLYMOST +#ifdef USE_OPENGL #include "polymost.h" #endif #endif @@ -52,16 +52,16 @@ extern "C" { #define VERSION "2.0.0devel" #define HEAD2 APPNAME" "VERSION -#define GAMEDUKE 0 -#define GAMENAM 1 -#define GAMEWW2 3 +#define GAME_DUKE 0 +#define GAME_NAM 1 +#define GAME_WW2 3 #define VOLUMEALL (g_Shareware == 0) #define PLUTOPAK (g_scriptVersion == 14) #define VOLUMEONE (g_Shareware == 1) -#define NAM (g_gameType & 1) -#define WW2GI (g_gameType & 2) +#define NAM (g_gameType & GAME_NAM) +#define WW2GI (g_gameType & GAME_WW2) // increase by 3, because atomic GRP adds 1, and Shareware adds 2 #define BYTEVERSION_JF 198 diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 5d42ea06f..de2511e30 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -2480,7 +2480,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) makepalookup(CROSSHAIR_PAL,tempbuf,CrosshairColors.r>>2, CrosshairColors.g>>2, CrosshairColors.b>>2,1); -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL Bmemcpy(&hictinting[CROSSHAIR_PAL], &CrosshairColors, sizeof(palette_t)); hictinting[CROSSHAIR_PAL].f = 9; #endif @@ -2536,7 +2536,7 @@ void G_DisplayRest(int32_t smoothratio) walltype *wal; int32_t cposx, cposy, cang; -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL // this takes care of fullscreen tint for OpenGL if (getrendermode() >= 3) @@ -2792,7 +2792,7 @@ void G_DisplayRest(int32_t smoothratio) if (ud.coords) G_PrintCoords(screenpeek); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL { extern int32_t mdpause; @@ -3348,7 +3348,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) } else if (getrendermode() > 0 && ud.screen_tilting /*&& (p->rotscrnang || p->orotscrnang)*/) { -#ifdef POLYMOST +#ifdef USE_OPENGL setrollangle(p->orotscrnang + mulscale16(((p->rotscrnang - p->orotscrnang + 1024)&2047)-1024,smoothratio)); #endif p->orotscrnang = p->rotscrnang; // JBF: save it for next time @@ -3419,7 +3419,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) VM_OnEvent(EVENT_DISPLAYROOMS, g_player[screenpeek].ps->i, screenpeek, -1); if (((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0) -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL && (getrendermode() != 4) #endif ) @@ -5636,7 +5636,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) t->xrepeat = t->yrepeat = 0; continue; case CHAIR3__STATIC: -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { t->cstat &= ~4; @@ -5902,7 +5902,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) t->picnum = GROWSPARK+((totalclock>>4)&3); break; case RPG__STATIC: -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags & SPREXT_NOTMD)) { @@ -5925,7 +5925,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) case RECON__STATIC: -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { t->cstat &= ~4; @@ -5965,7 +5965,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) } else*/ t->ang = g_player[p].ps->ang+mulscale16((int32_t)(((g_player[p].ps->ang+1024- g_player[p].ps->oang)&2047)-1024),smoothratio); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum, t->pal) >= 0) { static int32_t targetang = 0; @@ -6046,7 +6046,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) if (s->owner == -1) { -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { k = 0; @@ -6101,7 +6101,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) continue; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { k = 0; @@ -6195,77 +6195,77 @@ PALONLY: t->ang = sprpos[i].ang; } */ + if ((unsigned)((intptr_t *)t4-&script[0]) > (unsigned)(&script[g_scriptSize]-&script[0])) + goto skip; + + l = *(((intptr_t *)t4)+2); //For TerminX: was *(int32_t *)(t4+8) - if ((intptr_t *)t4 >= &script[0] && (intptr_t *)t4 <= (&script[0]+g_scriptSize)) +#ifdef USE_OPENGL + if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { - l = *(((intptr_t *)t4)+2); //For TerminX: was *(int32_t *)(t4+8) - -#if defined(POLYMOST) && defined(USE_OPENGL) - if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) - { - k = 0; - t->cstat &= ~4; - } - else -#endif - switch (l) - { - case 2: - k = (((s->ang+3072+128-a)&2047)>>8)&1; - break; - - case 3: - case 4: - k = (((s->ang+3072+128-a)&2047)>>7)&7; - if (k > 3) - { - t->cstat |= 4; - k = 7-k; - } - else t->cstat &= ~4; - break; - - case 5: - k = getangle(s->x-x,s->y-y); - k = (((s->ang+3072+128-k)&2047)>>8)&7; - if (k>4) - { - k = 8-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - break; - case 7: - k = getangle(s->x-x,s->y-y); - k = (((s->ang+3072+128-k)&2047)/170); - if (k>6) - { - k = 12-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - break; - case 8: - k = (((s->ang+3072+128-a)&2047)>>8)&7; - t->cstat &= ~4; - break; - default: - k = 0; - break; - } - - t->picnum += k + (*(intptr_t *)t4) + l * t3; - - if (l > 0) while (tilesizx[t->picnum] == 0 && t->picnum > 0) - t->picnum -= l; //Hack, for actors - - if (actor[i].dispicnum >= 0) - actor[i].dispicnum = t->picnum; + k = 0; + t->cstat &= ~4; } - else if (display_mirror == 1) - t->cstat |= 4; - } + else +#endif + switch (l) + { + case 2: + k = (((s->ang+3072+128-a)&2047)>>8)&1; + break; + case 3: + case 4: + k = (((s->ang+3072+128-a)&2047)>>7)&7; + if (k > 3) + { + t->cstat |= 4; + k = 7-k; + } + else t->cstat &= ~4; + break; + + case 5: + k = getangle(s->x-x,s->y-y); + k = (((s->ang+3072+128-k)&2047)>>8)&7; + if (k>4) + { + k = 8-k; + t->cstat |= 4; + } + else t->cstat &= ~4; + break; + case 7: + k = getangle(s->x-x,s->y-y); + k = (((s->ang+3072+128-k)&2047)/170); + if (k>6) + { + k = 12-k; + t->cstat |= 4; + } + else t->cstat &= ~4; + break; + case 8: + k = (((s->ang+3072+128-a)&2047)>>8)&7; + t->cstat &= ~4; + break; + default: + k = 0; + break; + } + + t->picnum += k + (*(intptr_t *)t4) + l * t3; + + if (l > 0) while (tilesizx[t->picnum] == 0 && t->picnum > 0) + t->picnum -= l; //Hack, for actors + + if (actor[i].dispicnum >= 0) + actor[i].dispicnum = t->picnum; + } + else if (display_mirror == 1) + t->cstat |= 4; + +skip: if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on && (A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER)) { @@ -6312,7 +6312,7 @@ PALONLY: yrep = tsprite[spritesortcnt].yrepeat;// - (klabs(daz-t->z)>>11); tsprite[spritesortcnt].yrepeat = yrep; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0) { tsprite[spritesortcnt].yrepeat = 0; @@ -6379,7 +6379,7 @@ PALONLY: t->picnum += (s->shade>>1); break; case PLAYERONWATER__STATIC: -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,s->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { k = 0; @@ -6442,7 +6442,7 @@ PALONLY: case CAMERA1__STATIC: case RAT__STATIC: -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,s->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { t->cstat &= ~4; @@ -8261,7 +8261,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) Bsprintf(defaultduke3dgrp, "nam.grp"); Bsprintf(defaultduke3ddef, "nam.def"); Bsprintf(defaultconfilename, "nam.con"); - g_gameType = GAMENAM; + g_gameType = GAME_NAM; i++; continue; } @@ -8270,7 +8270,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) Bsprintf(defaultduke3dgrp, "ww2gi.grp"); Bsprintf(defaultduke3ddef, "ww2gi.def"); Bsprintf(defaultconfilename, "ww2gi.con"); - g_gameType = GAMEWW2; + g_gameType = GAME_WW2; i++; continue; } @@ -8898,7 +8898,7 @@ static void G_Cleanup(void) void G_Shutdown(void) { - CONFIG_WriteSetup(); + CONFIG_WriteSetup(0); S_SoundShutdown(); S_MusicShutdown(); CONTROL_Shutdown(); @@ -9450,7 +9450,7 @@ int32_t app_main(int32_t argc,const char **argv) Bfree(str); } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL glusetexcache = -1; #endif @@ -9498,7 +9498,7 @@ int32_t app_main(int32_t argc,const char **argv) } #endif -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (glusetexcache == -1) { ud.config.useprecache = glusetexcompr = 1; @@ -9589,14 +9589,14 @@ int32_t app_main(int32_t argc,const char **argv) } } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL Bsprintf(tempbuf,"%s/%s",g_modDir,TEXCACHEFILE); Bstrcpy(TEXCACHEFILE,tempbuf); #endif } // shitcan the old cache directory -#if 0 && defined(POLYMOST) && defined(USE_OPENGL) +#if 0 && defined(USE_OPENGL) { struct stat st; char dir[BMAX_PATH]; @@ -9904,7 +9904,7 @@ CLEAN_DIRECTORY: initprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...\n", ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.config.ScreenMode?"fullscreen":"windowed"); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL { int32_t j = 0; while (setgamemode(0,xres[i],yres[i],bpp[j]) < 0) @@ -10123,13 +10123,13 @@ MAIN_LOOP_RESTART: clockbeforetic = totalclock; if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) && - (g_player[myconnectindex].ps->gm&MODE_GAME)) { + (g_player[myconnectindex].ps->gm&MODE_GAME)) G_MoveLoop(); - } sampletimer(); - if (totalclock - clockbeforetic >= TICSPERFRAME) { + if (totalclock - clockbeforetic >= TICSPERFRAME) + { // computing a tic takes longer than a tic, so we're slowing // the game down. rather than tightly spinning here, go draw // a frame since we're fucked anyway @@ -10223,7 +10223,7 @@ GAME_STATIC GAME_INLINE int32_t G_MoveLoop() int32_t G_DoMoveThings(void) { - int32_t i, j; + int32_t i; ud.camerasprite = -1; lockclock += TICSPERFRAME; @@ -10366,42 +10366,7 @@ int32_t G_DoMoveThings(void) } if (g_netClient) //Slave - { - input_t *nsyn = (input_t *)&inputfifo[0][myconnectindex]; - - packbuf[0] = PACKET_SLAVE_TO_MASTER; - j = 1; - - Bmemcpy(&packbuf[j], &nsyn[0], offsetof(input_t, filler)); - j += offsetof(input_t, filler); - - Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->pos.x, sizeof(vec3_t) * 2); - j += sizeof(vec3_t) * 2; - - Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->vel.x, sizeof(vec3_t)); - j += sizeof(vec3_t); - - *(int16_t *)&packbuf[j] = g_player[myconnectindex].ps->ang; - j += sizeof(int16_t); - - Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->horiz, sizeof(int16_t) * 2); - j += sizeof(int16_t) * 2; - - i = g_player[myconnectindex].ps->i; - - { - char buf[1024]; - - j = qlz_compress((char *)(packbuf)+1, (char *)buf, j, state_compress); - Bmemcpy((char *)(packbuf)+1, (char *)buf, j); - j++; - } - - packbuf[j++] = myconnectindex; - - enet_peer_send(g_netClientPeer, CHAN_MOVE, enet_packet_create(packbuf, j, 0)); - - } + Net_ClientMove(); return 0; } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index d2eac042d..152e37bdc 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1084,38 +1084,37 @@ void C_InitHashes() #define IFELSE_MAGIC 31337 static int32_t g_ifElseAborted; -static int32_t C_SetScriptSize(int32_t size) +static int32_t C_SetScriptSize(int32_t newsize) { intptr_t oscriptPtr = (unsigned)(g_scriptPtr-script); intptr_t ocaseScriptPtr = (unsigned)(g_caseScriptPtr-script); intptr_t oparsingEventPtr = (unsigned)(g_parsingEventPtr-script); intptr_t oparsingActorPtr = (unsigned)(g_parsingActorPtr-script); - char *scriptptrs; intptr_t *newscript; intptr_t i, j; int32_t osize = g_scriptSize; + char *scriptptrs; char *newbitptr; for (i=MAXSECTORS-1; i>=0; i--) - { if (labelcode[i] && labeltype[i] != LABEL_DEFINE) { - labelcode[i] -= (intptr_t)&script[0]; + j = (intptr_t)labelcode[i]-(intptr_t)&script[0]; + labelcode[i] = (intptr_t)j; } - } - scriptptrs = Bcalloc(1,g_scriptSize * sizeof(uint8_t)); + scriptptrs = Bcalloc(1, g_scriptSize * sizeof(uint8_t)); + for (i=g_scriptSize-1; i>=0; i--) { - if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) && !((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize]))) - { - g_numCompilerErrors++; - initprintf("Internal compiler error at %"PRIdPTR" (0x%"PRIxPTR")\n",i,i); - } -// if (bitptr[i] == 0 && ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize]))) -// initprintf("oh no!\n"); if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7))) { + if ((intptr_t)script[i] < (intptr_t)&script[0] || (intptr_t)script[i] >= (intptr_t)&script[g_scriptSize]) + { + g_numCompilerErrors++; + initprintf("Internal compiler error at %"PRIdPTR" (0x%"PRIxPTR")\n",i,i); + } + scriptptrs[i] = 1; script[i] -= (intptr_t)&script[0]; } @@ -1129,6 +1128,7 @@ static int32_t C_SetScriptSize(int32_t size) j = (intptr_t)actorscrptr[i]-(intptr_t)&script[0]; actorscrptr[i] = (intptr_t *)j; } + if (actorLoadEventScrptr[i]) { j = (intptr_t)actorLoadEventScrptr[i]-(intptr_t)&script[0]; @@ -1143,14 +1143,10 @@ static int32_t C_SetScriptSize(int32_t size) apScriptGameEvent[i] = (intptr_t *)j; } - //initprintf("offset: %d\n",(unsigned)(g_scriptPtr-script)); - g_scriptSize = size; - initprintf("Resizing code buffer to %d*%d bytes\n",g_scriptSize, (int32_t)sizeof(intptr_t)); + initprintf("Resizing code buffer to %d*%d bytes\n",newsize, (int32_t)sizeof(intptr_t)); - newscript = (intptr_t *)Brealloc(script, g_scriptSize * sizeof(intptr_t)); - -// bitptr = (char *)Brealloc(bitptr, g_scriptSize * sizeof(uint8_t)); - newbitptr = Bcalloc(1,(((size+7)>>3)+1) * sizeof(uint8_t)); + newscript = (intptr_t *)Brealloc(script, newsize * sizeof(intptr_t)); + newbitptr = Bcalloc(1,(((newsize+7)>>3)+1) * sizeof(uint8_t)); if (newscript == NULL || newbitptr == NULL) { @@ -1161,14 +1157,13 @@ static int32_t C_SetScriptSize(int32_t size) return 1; } - if (size >= osize) + if (newsize >= osize) { - Bmemset(&newscript[osize],0,(size-osize) * sizeof(intptr_t)); -// Bmemset(&bitptr[osize],0,size-osize); + Bmemset(&newscript[0]+osize,0,(newsize-osize) * sizeof(uint8_t)); Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((osize+7)>>3)); } else - Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((size+7)>>3)); + Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((newsize+7)>>3)); Bfree(bitptr); bitptr = newbitptr; @@ -1178,10 +1173,8 @@ static int32_t C_SetScriptSize(int32_t size) script = newscript; } + g_scriptSize = newsize; g_scriptPtr = (intptr_t *)(script+oscriptPtr); -// initprintf("script: %d, bitptr: %d\n",script,bitptr); - - //initprintf("offset: %d\n",(unsigned)(g_scriptPtr-script)); if (g_caseScriptPtr) g_caseScriptPtr = (intptr_t *)(script+ocaseScriptPtr); @@ -1196,28 +1189,17 @@ static int32_t C_SetScriptSize(int32_t size) { if (labelcode[i] && labeltype[i] != LABEL_DEFINE) { - labelcode[i] += (intptr_t)&script[0]; + j = (intptr_t)labelcode[i]+(intptr_t)&script[0]; + labelcode[i] = j; } } - if (size >= osize) - { - for (i=g_scriptSize-(size-osize)-1; i>=0; i--) - if (scriptptrs[i]) - { - j = (intptr_t)script[i]+(intptr_t)&script[0]; - script[i] = j; - } - } - else - { - for (i=g_scriptSize-1; i>=0; i--) - if (scriptptrs[i]) - { - j = (intptr_t)script[i]+(intptr_t)&script[0]; - script[i] = j; - } - } + for (i=(((newsize>=osize)?osize:newsize))-1; i>=0; i--) + if (scriptptrs[i]) + { + j = (intptr_t)script[i]+(intptr_t)&script[0]; + script[i] = j; + } for (i=MAXTILES-1; i>=0; i--) { @@ -2788,6 +2770,8 @@ static int32_t C_ParseCommand(void) return 0; case CON_ACTOR: + case CON_USERACTOR: + case CON_EVENTLOADACTOR: if (g_processingState || g_parsingActorPtr) { C_ReportError(ERROR_FOUNDWITHIN); @@ -2798,6 +2782,12 @@ static int32_t C_ParseCommand(void) g_scriptPtr--; g_parsingActorPtr = g_scriptPtr; + if (tw == CON_USERACTOR) + { + C_GetNextValue(LABEL_DEFINE); + g_scriptPtr--; + } + C_SkipComments(); j = 0; while (isaltok(*(textptr+j))) @@ -2806,11 +2796,35 @@ static int32_t C_ParseCommand(void) j++; } g_szCurrentBlockName[j] = 0; + + if (tw == CON_USERACTOR) + { + j = *g_scriptPtr; + + if (j > 2) + { + C_ReportError(-1); + initprintf("%s:%d: warning: invalid useractor type.\n",g_szScriptFileName,g_lineNumber); + g_numCompilerWarnings++; + j = 0; + } + } + C_GetNextValue(LABEL_DEFINE); - // Bsprintf(g_szCurrentBlockName,"%s",label+(g_numLabels<<6)); g_scriptPtr--; + + if (tw == CON_EVENTLOADACTOR) + { + actorLoadEventScrptr[*g_scriptPtr] = g_parsingActorPtr; + g_checkingIfElse = 0; + return 0; + } + actorscrptr[*g_scriptPtr] = g_parsingActorPtr; + if (tw == CON_USERACTOR) + ActorType[*g_scriptPtr] = j; + for (j=0; j<4; j++) { bitptr[(g_parsingActorPtr+j-script)>>3] &= ~(1<<((g_parsingActorPtr+j-script)&7)); @@ -2913,127 +2927,6 @@ static int32_t C_ParseCommand(void) return 0; - case CON_EVENTLOADACTOR: - if (g_processingState || g_parsingActorPtr) - { - C_ReportError(ERROR_FOUNDWITHIN); - g_numCompilerErrors++; - } - - g_numBraces = 0; - g_scriptPtr--; - g_parsingActorPtr = g_scriptPtr; - - C_SkipComments(); - j = 0; - while (isaltok(*(textptr+j))) - { - g_szCurrentBlockName[j] = textptr[j]; - j++; - } - g_szCurrentBlockName[j] = 0; - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - actorLoadEventScrptr[*g_scriptPtr] = g_parsingActorPtr; - - g_checkingIfElse = 0; - return 0; - - case CON_USERACTOR: - if (g_processingState || g_parsingActorPtr) - { - C_ReportError(ERROR_FOUNDWITHIN); - g_numCompilerErrors++; - } - - g_numBraces = 0; - g_scriptPtr--; - g_parsingActorPtr = g_scriptPtr; - - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - - C_SkipComments(); - j = 0; - while (isaltok(*(textptr+j))) - { - g_szCurrentBlockName[j] = textptr[j]; - j++; - } - g_szCurrentBlockName[j] = 0; - - j = *g_scriptPtr; - - if (j > 2) - { - C_ReportError(-1); - initprintf("%s:%d: warning: invalid useractor type.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerWarnings++; - j = 0; - } - - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - actorscrptr[*g_scriptPtr] = g_parsingActorPtr; - ActorType[*g_scriptPtr] = j; - - for (j=0; j<4; j++) - { - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *(g_parsingActorPtr+j) = 0; - if (j == 3) - { - j = 0; - while (C_GetKeyword() == -1) - { - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j |= *g_scriptPtr; - } - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr = j; - g_scriptPtr++; - break; - } - else - { - if (C_GetKeyword() >= 0) - { - for (i=4-j; i; i--) - { - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *(g_scriptPtr++) = 0; - } - break; - } - switch (j) - { - case 0: - C_GetNextValue(LABEL_DEFINE); - break; - case 1: - C_GetNextValue(LABEL_ACTION); - break; - case 2: - if ((C_GetNextValue(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(g_scriptPtr-1) != 0) && (*(g_scriptPtr-1) != 1)) - { - C_ReportError(-1); - bitptr[(g_scriptPtr-script-1)>>3] &= ~(1<<((g_scriptPtr-script-1)&7)); - *(g_scriptPtr-1) = 0; - initprintf("%s:%d: warning: expected a move, found a constant.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerWarnings++; - } - break; - } - if (*(g_scriptPtr-1) >= (intptr_t)&script[0] && *(g_scriptPtr-1) < (intptr_t)&script[g_scriptSize]) - bitptr[(g_parsingActorPtr+j-script)>>3] |= (BITPTR_POINTER<<((g_parsingActorPtr+j-script)&7)); - else bitptr[(g_parsingActorPtr+j-script)>>3] &= ~(1<<((g_parsingActorPtr+j-script)&7)); - *(g_parsingActorPtr+j) = *(g_scriptPtr-1); - } - } - g_checkingIfElse = 0; - return 0; - case CON_INSERTSPRITEQ: /* if (!C_CheckEventSync(g_currentEvent)) @@ -5375,7 +5268,7 @@ repeatcase: int32_t fullscreen = ud.config.ScreenMode; int32_t xdim = ud.config.ScreenWidth, ydim = ud.config.ScreenHeight, bpp = ud.config.ScreenBPP; int32_t usemouse = ud.config.UseMouse, usejoy = ud.config.UseJoystick; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL int32_t glrm = glrendmode; #endif @@ -5403,7 +5296,7 @@ repeatcase: } Bstrcpy(temp,tempbuf); - CONFIG_WriteSetup(); + CONFIG_WriteSetup(1); if (g_modDir[0] != '/') Bsprintf(setupfilename,"%s/",g_modDir); else setupfilename[0] = 0; @@ -5419,7 +5312,7 @@ repeatcase: ud.config.ScreenBPP = bpp; ud.config.UseMouse = usemouse; ud.config.UseJoystick = usejoy; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL glrendmode = glrm; #endif diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index e58a19353..80cbb9b73 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -372,7 +372,7 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void VM_AlterAng(int32_t a) intptr_t *moveptr; int32_t ticselapsed = (vm.g_t[0])&31; - if ((moveptr = (intptr_t *)vm.g_t[1]) < &script[0] || moveptr > (&script[0]+g_scriptSize)) + if ((moveptr = (intptr_t *)vm.g_t[1]) < &script[0] || moveptr > &script[g_scriptSize]) { vm.g_t[1] = 0; OSD_Printf(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum); @@ -506,18 +506,16 @@ GAMEEXEC_STATIC void VM_Move(void) vm.g_sp->ang += angdif; } - if ((moveptr = (intptr_t *)vm.g_t[1]) >= &script[0] && moveptr <= (&script[0]+g_scriptSize)) - { - if (a&geth) vm.g_sp->xvel += ((*moveptr)-vm.g_sp->xvel)>>1; - if (a&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1; - } - else + if ((moveptr = (intptr_t *)vm.g_t[1]) < &script[0] || moveptr > &script[g_scriptSize]) { vm.g_t[1] = 0; OSD_Printf(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum); return; } + if (a&geth) vm.g_sp->xvel += ((*moveptr)-vm.g_sp->xvel)>>1; + if (a&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1; + if (a&dodgebullet && !deadflag) A_Dodge(vm.g_sp); @@ -869,15 +867,13 @@ skip_check: continue; case CON_IFPDISTL: - insptr++; - VM_DoConditional(vm.g_x < *insptr); + VM_DoConditional(vm.g_x < *(++insptr)); if (vm.g_x > MAXSLEEPDIST && actor[vm.g_i].timetosleep == 0) actor[vm.g_i].timetosleep = SLEEPTIME; continue; case CON_IFPDISTG: - insptr++; - VM_DoConditional(vm.g_x > *insptr); + VM_DoConditional(vm.g_x > *(++insptr)); if (vm.g_x > MAXSLEEPDIST && actor[vm.g_i].timetosleep == 0) actor[vm.g_i].timetosleep = SLEEPTIME; continue; @@ -944,8 +940,7 @@ skip_check: continue; case CON_MIKESND: - insptr++; - if ((vm.g_sp->yvel<0 || vm.g_sp->yvel>=MAXSOUNDS)) + if (((unsigned)*(++insptr) >= MAXSOUNDS)) { OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->yvel); insptr++; @@ -997,8 +992,7 @@ skip_check: continue; case CON_SOUNDONCE: - insptr++; - if ((*insptr<0 || *insptr>=MAXSOUNDS)) + if (((unsigned)*(++insptr) >= MAXSOUNDS)) { OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr++); continue; @@ -1012,7 +1006,7 @@ skip_check: { int32_t i = Gv_GetVarX(*insptr++), j = Gv_GetVarX(*insptr++); - if ((j<0 || j>=MAXSOUNDS)) + if (((unsigned)j >= MAXSOUNDS)) { OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); insptr++; @@ -1024,8 +1018,7 @@ skip_check: continue; case CON_IFSOUND: - insptr++; - if ((*insptr<0 || *insptr>=MAXSOUNDS)) + if (((unsigned)*(++insptr) >= MAXSOUNDS)) { OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); insptr++; @@ -1036,8 +1029,7 @@ skip_check: continue; case CON_STOPSOUND: - insptr++; - if ((*insptr<0 || *insptr>=MAXSOUNDS)) + if (((unsigned)*(++insptr) >= MAXSOUNDS)) { OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); insptr++; @@ -1066,8 +1058,7 @@ skip_check: } case CON_GLOBALSOUND: - insptr++; - if ((*insptr<0 || *insptr>=MAXSOUNDS)) + if (((unsigned)*(++insptr) >= MAXSOUNDS)) { OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); insptr++; @@ -1079,8 +1070,7 @@ skip_check: continue; case CON_SOUND: - insptr++; - if ((*insptr<0 || *insptr>=MAXSOUNDS)) + if ((unsigned)*(++insptr) >= MAXSOUNDS) { OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); insptr++; @@ -1142,7 +1132,7 @@ skip_check: { j = vm.g_sp->sectnum; pushmove((vec3_t *)vm.g_sp,(int16_t *)&j,128L,(4L<<8),(4L<<8),CLIPMASK0); - if (j != vm.g_sp->sectnum && j >= 0 && j < MAXSECTORS) + if ((unsigned)j < MAXSECTORS) changespritesect(vm.g_i,j); A_PlaySound(THUD,vm.g_i); } @@ -1164,8 +1154,10 @@ skip_check: // fix for flying/jumping monsters getting stuck in water { intptr_t *moveptr = (intptr_t *)vm.g_t[1]; - if (vm.g_sp->hitag & jumptoplayer || (actorscrptr[vm.g_sp->picnum] && - moveptr >= &script[0] && moveptr <= (&script[0]+g_scriptSize) && *(moveptr+1))) + if (vm.g_sp->hitag & jumptoplayer || + (actorscrptr[vm.g_sp->picnum] && + (unsigned int)(moveptr - &script[0]) <= (unsigned int)(&script[g_scriptSize] - &script[0]) && + *(moveptr+1))) { // OSD_Printf("%d\n",*(moveptr+1)); break; @@ -1193,8 +1185,7 @@ skip_check: insptr++; return 1; case CON_ADDAMMO: - insptr++; - if ((*insptr<0 || *insptr>=MAX_WEAPONS)) + if (((unsigned)*(++insptr) >= MAX_WEAPONS)) { OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); insptr += 2; break; @@ -1251,8 +1242,7 @@ skip_check: continue; case CON_ADDWEAPON: - insptr++; - if ((*insptr<0 ||*insptr>=MAX_WEAPONS)) + if (((unsigned)*(++insptr) >= MAX_WEAPONS)) { OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); insptr += 2; @@ -1439,7 +1429,7 @@ skip_check: setaspect(var1, var2); break; case CON_SSP: - if ((var1<0 || var1>=MAXSPRITES)) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],var1); break;} + if ((unsigned)var1 >= MAXSPRITES) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],var1); break;} A_SetSprite(var1, var2); break; } @@ -1451,9 +1441,9 @@ skip_check: { int32_t lVar1 = Gv_GetVarX(*insptr++), lVar2 = Gv_GetVarX(*insptr++), res; - if ((lVar1<0 || lVar1>=MAXSPRITES || lVar2<0 || lVar2>=MAXSPRITES)) + if ((unsigned)lVar1 >= MAXSPRITES || (unsigned)lVar2 >= MAXSPRITES) { - OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],lVar1<0||lVar1>=MAXSPRITES?lVar1:lVar2); + OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],(unsigned)lVar1 >= MAXSPRITES ? lVar1 : lVar2); res=0; } else res=cansee(sprite[lVar1].x,sprite[lVar1].y,sprite[lVar1].z,sprite[lVar1].sectnum, @@ -1510,7 +1500,7 @@ skip_check: { int32_t i=*insptr++; int32_t j=Gv_GetVarX(*insptr++); - if ((j < 0 || j > MAXSTATUS)) + if ((unsigned)j > MAXSTATUS) { OSD_Printf(CON_ERROR "invalid status list %d\n",g_errorLineNum,keyw[g_tw],j); continue; @@ -1524,7 +1514,7 @@ skip_check: { int32_t i=*insptr++; int32_t j=Gv_GetVarX(*insptr++); - if ((j < 0 || j >= MAXSPRITES)) + if ((unsigned)j >= MAXSPRITES) { OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); continue; @@ -1538,7 +1528,7 @@ skip_check: { int32_t i=*insptr++; int32_t j=Gv_GetVarX(*insptr++); - if ((j < 0 || j >= MAXSPRITES)) + if ((unsigned)j >= MAXSPRITES) { OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); continue; @@ -1552,7 +1542,7 @@ skip_check: { int32_t i=*insptr++; int32_t j=Gv_GetVarX(*insptr++); - if ((j < 0 || j > numsectors)) + if ((unsigned)j >= (unsigned)numsectors) { OSD_Printf(CON_ERROR "invalid sector %d\n",g_errorLineNum,keyw[g_tw],j); continue; @@ -1566,7 +1556,7 @@ skip_check: { int32_t i=*insptr++; int32_t j=Gv_GetVarX(*insptr++); - if ((j < 0 || j >= MAXSPRITES)) + if ((unsigned)j >= MAXSPRITES) { OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); continue; @@ -1580,7 +1570,7 @@ skip_check: { int32_t i=*insptr++; int32_t j=Gv_GetVarX(*insptr++); - if ((j < 0 || j >= MAXSPRITES)) + if ((unsigned)j >= MAXSPRITES) { OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); continue; @@ -1733,12 +1723,12 @@ skip_check: Bstrcpy(ScriptQuotes[i],ScriptQuotes[j]); break; case CON_CHANGESPRITESECT: - if ((i<0 || i>=MAXSPRITES)) + if ((unsigned)i >= MAXSPRITES) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],i); break; } - if ((j<0 || j>=numsectors)) + if ((unsigned)j >= (unsigned)numsectors) { OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],j); break; @@ -1759,12 +1749,12 @@ nullquote: int32_t i = Gv_GetVarX(*insptr++); int32_t j = Gv_GetVarX(*insptr++); - if ((i<0 || i>=MAXSPRITES)) + if ((unsigned)i >= MAXSPRITES) { OSD_Printf(CON_ERROR "Invalid sprite: %d\n",g_errorLineNum,keyw[g_tw],i); continue; } - if ((j<0 || j>=MAXSTATUS)) + if ((unsigned)j >= MAXSTATUS) { OSD_Printf(CON_ERROR "Invalid statnum: %d\n",g_errorLineNum,keyw[g_tw],j); continue; @@ -1962,7 +1952,7 @@ nullquote: { int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++); - if ((xvar < 0 || yvar < 0 || xvar >= MAXSPRITES || yvar >= MAXSPRITES)) + if ((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES) { OSD_Printf(CON_ERROR "invalid sprite\n",g_errorLineNum,keyw[g_tw]); continue; @@ -1977,7 +1967,7 @@ nullquote: { int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++); - if ((xvar < 0 || yvar < 0 || xvar >= MAXSPRITES || yvar >= MAXSPRITES)) + if ((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES) { OSD_Printf(CON_ERROR "invalid sprite\n",g_errorLineNum,keyw[g_tw]); continue; @@ -2043,7 +2033,7 @@ nullquote: { int32_t lIn=Gv_GetVarX(*insptr++); int32_t j; - if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors)) + if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) { OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); continue; @@ -2073,7 +2063,7 @@ nullquote: { int32_t j; - if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors)) + if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) { OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); insptr++; @@ -2113,7 +2103,7 @@ nullquote: actor[vm.g_i].shootzvel = 1; } - if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors)) + if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) { OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); insptr++; @@ -2136,7 +2126,7 @@ nullquote: { int32_t j=Gv_GetVarX(*insptr++); - if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors)) + if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) { OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); actor[vm.g_i].shootzvel=0; @@ -2162,7 +2152,7 @@ nullquote: { int32_t j=Gv_GetVarX(*insptr++); - if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors)) + if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) { OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); actor[vm.g_i].shootzvel=0; @@ -2264,7 +2254,7 @@ nullquote: int32_t x2=scale(Gv_GetVarX(*insptr++),xdim,320); int32_t y2=scale(Gv_GetVarX(*insptr++),ydim,200); int32_t smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536); -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL int32_t j; #endif @@ -2284,7 +2274,7 @@ nullquote: continue; } -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL j = glprojectionhacks; glprojectionhacks = 0; #endif @@ -2346,7 +2336,7 @@ nullquote: drawmasks(); G_RestoreInterpolations(); G_UpdateScreenArea(); -#if defined(USE_OPENGL) && defined(POLYMOST) +#ifdef USE_OPENGL glprojectionhacks = j; #endif continue; @@ -2696,7 +2686,7 @@ nullquote: if (tw == CON_SETSPRITE) { - if ((spritenum < 0 || spritenum >= MAXSPRITES)) + if ((unsigned)spritenum >= MAXSPRITES) { OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],spritenum); continue; @@ -2708,7 +2698,7 @@ nullquote: { int32_t cliptype = Gv_GetVarX(*insptr++); - if ((spritenum < 0 && spritenum >= MAXSPRITES)) + if ((unsigned)spritenum >= MAXSPRITES) { OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],spritenum); insptr++; @@ -2758,7 +2748,7 @@ nullquote: case CON_SPAWN: insptr++; - if (vm.g_sp->sectnum >= 0 && vm.g_sp->sectnum < MAXSECTORS) + if ((unsigned)vm.g_sp->sectnum < MAXSECTORS) A_Spawn(vm.g_i,*insptr); insptr++; continue; @@ -2794,7 +2784,7 @@ nullquote: int32_t dnum = *insptr++; int32_t s, l, j; - if (vm.g_sp->sectnum >= 0 && vm.g_sp->sectnum < MAXSECTORS) + if ((unsigned)vm.g_sp->sectnum < MAXSECTORS) for (j=(*insptr)-1; j>=0; j--) { if (vm.g_sp->picnum == BLIMP && dnum == SCRAP1) @@ -3126,7 +3116,7 @@ nullquote: insptr++; { int32_t j = Gv_GetVarX(*insptr++); - if ((j < 0 || j >= MAXVOLUMES*MAXLEVELS)) + if ((unsigned)j >= MAXVOLUMES*MAXLEVELS) { OSD_Printf(CON_ERROR "Invalid map number: %d\n",g_errorLineNum,keyw[g_tw],j); continue; @@ -3171,7 +3161,8 @@ nullquote: insptr++; if (sector[vm.g_sp->sectnum].lotag == 0) { - neartag(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(32<<8),vm.g_sp->sectnum,vm.g_sp->ang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,768L,1); + neartag(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(32<<8),vm.g_sp->sectnum,vm.g_sp->ang, + &neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,768L,5); if (neartagsector >= 0 && isanearoperator(sector[neartagsector].lotag)) if ((sector[neartagsector].lotag&0xff) == 23 || sector[neartagsector].floorz == sector[neartagsector].ceilingz) if ((sector[neartagsector].lotag&16384) == 0) @@ -3387,7 +3378,7 @@ nullquote: intptr_t *oinsptr = insptr++; int32_t index = Gv_GetVarX(*insptr++); insptr = oinsptr; - if (index < 0 || index >= MAXSPRITES-1) + if ((unsigned)index >= MAXSPRITES-1) { OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]); Gv_GetVarX(*insptr++); @@ -3769,7 +3760,7 @@ nullquote: int32_t lSprite=Gv_GetVarX(*insptr++), lVar1=*insptr++; int32_t lVar2=*insptr++; - if ((lSprite < 0 || lSprite >= MAXSPRITES)) + if ((unsigned)lSprite >= MAXSPRITES) { OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],lSprite); if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++; @@ -3799,7 +3790,7 @@ nullquote: { int32_t lVar1=*insptr++, lVar2=*insptr++; - if ((iPlayer < 0 || iPlayer >= playerswhenstarted)) + if ((unsigned)iPlayer >= (unsigned)playerswhenstarted) { OSD_Printf(CON_ERROR "invalid player ID %d\n",g_errorLineNum,keyw[g_tw],iPlayer); if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++; @@ -3895,7 +3886,7 @@ nullquote: insptr++; - if ((j < 0 || j >= playerswhenstarted)) + if ((unsigned)j >= (unsigned)playerswhenstarted) { OSD_Printf(CON_ERROR "Invalid player ID %d\n",g_errorLineNum,keyw[g_tw],j); continue; @@ -4032,10 +4023,10 @@ nullquote: insptr++; { int32_t j=*insptr++; - int32_t index = Gv_GetVar(*insptr++, vm.g_i, vm.g_p); + int32_t index = Gv_GetVarX(*insptr++); int32_t j1=*insptr++; - int32_t index1 = Gv_GetVar(*insptr++, vm.g_i, vm.g_p); - int32_t value = Gv_GetVar(*insptr++, vm.g_i, vm.g_p); + int32_t index1 = Gv_GetVarX(*insptr++); + int32_t value = Gv_GetVarX(*insptr++); if (index > aGameArrays[j].size || index1 > aGameArrays[j1].size) continue; if ((index+value)>aGameArrays[j].size) value=aGameArrays[j].size-index; @@ -4626,7 +4617,7 @@ nullquote: continue; } - if ((vm.g_p < 0 || vm.g_p >= MAXPLAYERS)) + if ((unsigned)vm.g_p >= MAXPLAYERS) { OSD_Printf(CON_ERROR "bad player for quote %d: (%d)\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr,vm.g_p); insptr++; @@ -4776,7 +4767,7 @@ void A_LoadActor(int32_t iActor) vm.g_flags &= ~(VM_RETURN|VM_KILL|VM_NOEXECUTE); - if (vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= MAXSECTORS) + if ((unsigned)vm.g_sp->sectnum >= MAXSECTORS) { // if(A_CheckEnemySprite(vm.g_sp)) // g_player[vm.g_p].ps->actors_killed++; @@ -4809,7 +4800,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist) insptr = 4 + (actorscrptr[vm.g_sp->picnum]); - if (vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= MAXSECTORS) + if ((unsigned)vm.g_sp->sectnum >= MAXSECTORS) { if (A_CheckEnemySprite(vm.g_sp)) g_player[vm.g_p].ps->actors_killed++; @@ -4820,8 +4811,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist) /* Qbix: Changed variables to be aware of the sizeof *insptr * (whether it is int32_t vs intptr_t), Although it is specifically cast to intptr_t* * which might be corrected if the code is converted to use offsets */ - - if (vm.g_t[4] > (intptr_t)&script[0] && vm.g_t[4] < (intptr_t)&script[g_scriptSize]) + if ((unsigned)(vm.g_t[4]-(intptr_t)&script[0]) <= (unsigned)((intptr_t)&script[g_scriptSize]-(intptr_t)&script[0])) { vm.g_sp->lotag += TICSPERFRAME; diff --git a/polymer/eduke32/source/gamestructures.c b/polymer/eduke32/source/gamestructures.c index f9795776b..dc7aab420 100644 --- a/polymer/eduke32/source/gamestructures.c +++ b/polymer/eduke32/source/gamestructures.c @@ -42,7 +42,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t } if (iSet) - lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); + lValue=Gv_GetVarX(lVar2); switch (lLabelID) { @@ -52,7 +52,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.god = lValue; return; } - Gv_SetVar(lVar2, ud.god, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.god); return; case USERDEFS_WARP_ON: @@ -61,7 +61,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.warp_on = lValue; return; } - Gv_SetVar(lVar2, ud.warp_on, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.warp_on); return; case USERDEFS_CASHMAN: @@ -70,7 +70,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.cashman = lValue; return; } - Gv_SetVar(lVar2, ud.cashman, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.cashman); return; case USERDEFS_EOG: @@ -79,7 +79,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.eog = lValue; return; } - Gv_SetVar(lVar2, ud.eog, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.eog); return; case USERDEFS_SHOWALLMAP: @@ -88,7 +88,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.showallmap = lValue; return; } - Gv_SetVar(lVar2, ud.showallmap, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.showallmap); return; case USERDEFS_SHOW_HELP: @@ -97,7 +97,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.show_help = lValue; return; } - Gv_SetVar(lVar2, ud.show_help, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.show_help); return; case USERDEFS_SCROLLMODE: @@ -106,7 +106,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.scrollmode = lValue; return; } - Gv_SetVar(lVar2, ud.scrollmode, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.scrollmode); return; case USERDEFS_CLIPPING: @@ -115,7 +115,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.clipping = lValue; return; } - Gv_SetVar(lVar2, ud.clipping, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.clipping); return; // case USERDEFS_USER_NAME: @@ -124,7 +124,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t // ud.user_name[MAXPLAYERS][32] = lValue; // return; // } - // Gv_SetVar(lVar2, ud.user_name[MAXPLAYERS][32], vm.g_i, vm.g_p); + // Gv_SetVarX(lVar2, ud.user_name[MAXPLAYERS][32]); // return; // case USERDEFS_RIDECULE: @@ -133,7 +133,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t // ud.ridecule = lValue; // return; // } - // Gv_SetVar(lVar2, ud.ridecule, vm.g_i, vm.g_p); + // Gv_SetVarX(lVar2, ud.ridecule); // return; // case USERDEFS_SAVEGAME: @@ -142,7 +142,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t // ud.savegame = lValue; // return; // } - // Gv_SetVar(lVar2, ud.savegame, vm.g_i, vm.g_p); + // Gv_SetVarX(lVar2, ud.savegame); // return; // case USERDEFS_PWLOCKOUT: @@ -151,7 +151,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t // ud.pwlockout = lValue; // return; // } - // Gv_SetVar(lVar2, ud.pwlockout, vm.g_i, vm.g_p); + // Gv_SetVarX(lVar2, ud.pwlockout); // return; // case USERDEFS_RTSNAME: @@ -160,7 +160,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t // ud.rtsname = lValue; // return; // } - // Gv_SetVar(lVar2, ud.rtsname, vm.g_i, vm.g_p); + // Gv_SetVarX(lVar2, ud.rtsname); // return; case USERDEFS_OVERHEAD_ON: @@ -169,7 +169,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.overhead_on = lValue; return; } - Gv_SetVar(lVar2, ud.overhead_on, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.overhead_on); return; case USERDEFS_LAST_OVERHEAD: @@ -178,7 +178,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.last_overhead = lValue; return; } - Gv_SetVar(lVar2, ud.last_overhead, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.last_overhead); return; case USERDEFS_SHOWWEAPONS: @@ -187,7 +187,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.showweapons = lValue; return; } - Gv_SetVar(lVar2, ud.showweapons, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.showweapons); return; case USERDEFS_PAUSE_ON: @@ -196,7 +196,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.pause_on = lValue; return; } - Gv_SetVar(lVar2, ud.pause_on, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.pause_on); return; case USERDEFS_FROM_BONUS: @@ -205,7 +205,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.from_bonus = lValue; return; } - Gv_SetVar(lVar2, ud.from_bonus, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.from_bonus); return; case USERDEFS_CAMERASPRITE: @@ -214,7 +214,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.camerasprite = lValue; return; } - Gv_SetVar(lVar2, ud.camerasprite, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.camerasprite); return; case USERDEFS_LAST_CAMSPRITE: @@ -223,7 +223,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.last_camsprite = lValue; return; } - Gv_SetVar(lVar2, ud.last_camsprite, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.last_camsprite); return; case USERDEFS_LAST_LEVEL: @@ -232,7 +232,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.last_level = lValue; return; } - Gv_SetVar(lVar2, ud.last_level, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.last_level); return; case USERDEFS_SECRETLEVEL: @@ -241,7 +241,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.secretlevel = lValue; return; } - Gv_SetVar(lVar2, ud.secretlevel, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.secretlevel); return; case USERDEFS_CONST_VISIBILITY: @@ -250,7 +250,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.const_visibility = lValue; return; } - Gv_SetVar(lVar2, ud.const_visibility, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.const_visibility); return; case USERDEFS_UW_FRAMERATE: @@ -259,7 +259,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.uw_framerate = lValue; return; } - Gv_SetVar(lVar2, ud.uw_framerate, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.uw_framerate); return; case USERDEFS_CAMERA_TIME: @@ -268,7 +268,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.camera_time = lValue; return; } - Gv_SetVar(lVar2, ud.camera_time, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.camera_time); return; case USERDEFS_FOLFVEL: @@ -277,7 +277,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.folfvel = lValue; return; } - Gv_SetVar(lVar2, ud.folfvel, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.folfvel); return; case USERDEFS_FOLAVEL: @@ -286,7 +286,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.folavel = lValue; return; } - Gv_SetVar(lVar2, ud.folavel, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.folavel); return; case USERDEFS_FOLX: @@ -295,7 +295,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.folx = lValue; return; } - Gv_SetVar(lVar2, ud.folx, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.folx); return; case USERDEFS_FOLY: @@ -304,7 +304,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.foly = lValue; return; } - Gv_SetVar(lVar2, ud.foly, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.foly); return; case USERDEFS_FOLA: @@ -313,7 +313,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.fola = lValue; return; } - Gv_SetVar(lVar2, ud.fola, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.fola); return; case USERDEFS_RECCNT: @@ -322,7 +322,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.reccnt = lValue; return; } - Gv_SetVar(lVar2, ud.reccnt, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.reccnt); return; case USERDEFS_ENTERED_NAME: @@ -331,7 +331,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.entered_name = lValue; return; } - Gv_SetVar(lVar2, ud.entered_name, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.entered_name); return; case USERDEFS_SCREEN_TILTING: @@ -340,7 +340,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.screen_tilting = lValue; return; } - Gv_SetVar(lVar2, ud.screen_tilting, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.screen_tilting); return; case USERDEFS_SHADOWS: @@ -349,7 +349,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.shadows = lValue; return; } - Gv_SetVar(lVar2, ud.shadows, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.shadows); return; case USERDEFS_FTA_ON: @@ -358,7 +358,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.fta_on = lValue; return; } - Gv_SetVar(lVar2, ud.fta_on, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.fta_on); return; case USERDEFS_EXECUTIONS: @@ -367,7 +367,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.executions = lValue; return; } - Gv_SetVar(lVar2, ud.executions, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.executions); return; case USERDEFS_AUTO_RUN: @@ -376,7 +376,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.auto_run = lValue; return; } - Gv_SetVar(lVar2, ud.auto_run, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.auto_run); return; case USERDEFS_COORDS: @@ -385,7 +385,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.coords = lValue; return; } - Gv_SetVar(lVar2, ud.coords, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.coords); return; case USERDEFS_TICKRATE: @@ -394,7 +394,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.tickrate = lValue; return; } - Gv_SetVar(lVar2, ud.tickrate, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.tickrate); return; case USERDEFS_M_COOP: @@ -403,7 +403,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_coop = lValue; return; } - Gv_SetVar(lVar2, ud.m_coop, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_coop); return; case USERDEFS_COOP: @@ -412,7 +412,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.coop = lValue; return; } - Gv_SetVar(lVar2, ud.coop, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.coop); return; case USERDEFS_SCREEN_SIZE: @@ -425,7 +425,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t } return; } - Gv_SetVar(lVar2, ud.screen_size, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.screen_size); return; case USERDEFS_LOCKOUT: @@ -434,7 +434,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.lockout = lValue; return; } - Gv_SetVar(lVar2, ud.lockout, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.lockout); return; case USERDEFS_CROSSHAIR: @@ -443,7 +443,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.crosshair = lValue; return; } - Gv_SetVar(lVar2, ud.crosshair, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.crosshair); return; // case USERDEFS_WCHOICE: @@ -452,7 +452,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t // ud.wchoice = lValue; // return; // } - // Gv_SetVar(lVar2, ud.wchoice, vm.g_i, vm.g_p); + // Gv_SetVarX(lVar2, ud.wchoice); // return; case USERDEFS_PLAYERAI: @@ -461,7 +461,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.playerai = lValue; return; } - Gv_SetVar(lVar2, ud.playerai, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.playerai); return; case USERDEFS_RESPAWN_MONSTERS: @@ -470,7 +470,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.respawn_monsters = lValue; return; } - Gv_SetVar(lVar2, ud.respawn_monsters, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.respawn_monsters); return; case USERDEFS_RESPAWN_ITEMS: @@ -479,7 +479,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.respawn_items = lValue; return; } - Gv_SetVar(lVar2, ud.respawn_items, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.respawn_items); return; case USERDEFS_RESPAWN_INVENTORY: @@ -488,7 +488,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.respawn_inventory = lValue; return; } - Gv_SetVar(lVar2, ud.respawn_inventory, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.respawn_inventory); return; case USERDEFS_RECSTAT: @@ -497,7 +497,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.recstat = lValue; return; } - Gv_SetVar(lVar2, ud.recstat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.recstat); return; case USERDEFS_MONSTERS_OFF: @@ -506,7 +506,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.monsters_off = lValue; return; } - Gv_SetVar(lVar2, ud.monsters_off, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.monsters_off); return; case USERDEFS_BRIGHTNESS: @@ -515,7 +515,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.brightness = lValue; return; } - Gv_SetVar(lVar2, ud.brightness, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.brightness); return; case USERDEFS_M_RESPAWN_ITEMS: @@ -524,7 +524,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_respawn_items = lValue; return; } - Gv_SetVar(lVar2, ud.m_respawn_items, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_respawn_items); return; case USERDEFS_M_RESPAWN_MONSTERS: @@ -533,7 +533,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_respawn_monsters = lValue; return; } - Gv_SetVar(lVar2, ud.m_respawn_monsters, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_respawn_monsters); return; case USERDEFS_M_RESPAWN_INVENTORY: @@ -542,7 +542,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_respawn_inventory = lValue; return; } - Gv_SetVar(lVar2, ud.m_respawn_inventory, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_respawn_inventory); return; case USERDEFS_M_RECSTAT: @@ -551,7 +551,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_recstat = lValue; return; } - Gv_SetVar(lVar2, ud.m_recstat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_recstat); return; case USERDEFS_M_MONSTERS_OFF: @@ -560,7 +560,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_monsters_off = lValue; return; } - Gv_SetVar(lVar2, ud.m_monsters_off, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_monsters_off); return; case USERDEFS_DETAIL: @@ -569,7 +569,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.detail = lValue; return; } - Gv_SetVar(lVar2, ud.detail, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.detail); return; case USERDEFS_M_FFIRE: @@ -578,7 +578,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_ffire = lValue; return; } - Gv_SetVar(lVar2, ud.m_ffire, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_ffire); return; case USERDEFS_FFIRE: @@ -587,7 +587,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.ffire = lValue; return; } - Gv_SetVar(lVar2, ud.ffire, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.ffire); return; case USERDEFS_M_PLAYER_SKILL: @@ -596,7 +596,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_player_skill = lValue; return; } - Gv_SetVar(lVar2, ud.m_player_skill, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_player_skill); return; case USERDEFS_M_LEVEL_NUMBER: @@ -605,7 +605,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_level_number = lValue; return; } - Gv_SetVar(lVar2, ud.m_level_number, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_level_number); return; case USERDEFS_M_VOLUME_NUMBER: @@ -614,7 +614,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_volume_number = lValue; return; } - Gv_SetVar(lVar2, ud.m_volume_number, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_volume_number); return; case USERDEFS_MULTIMODE: @@ -623,7 +623,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.multimode = lValue; return; } - Gv_SetVar(lVar2, ud.multimode, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.multimode); return; case USERDEFS_PLAYER_SKILL: @@ -632,7 +632,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.player_skill = lValue; return; } - Gv_SetVar(lVar2, ud.player_skill, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.player_skill); return; case USERDEFS_LEVEL_NUMBER: @@ -641,7 +641,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.level_number = lValue; return; } - Gv_SetVar(lVar2, ud.level_number, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.level_number); return; case USERDEFS_VOLUME_NUMBER: @@ -650,7 +650,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.volume_number = lValue; return; } - Gv_SetVar(lVar2, ud.volume_number, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.volume_number); return; case USERDEFS_M_MARKER: @@ -659,7 +659,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_marker = lValue; return; } - Gv_SetVar(lVar2, ud.m_marker, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_marker); return; case USERDEFS_MARKER: @@ -668,7 +668,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.marker = lValue; return; } - Gv_SetVar(lVar2, ud.marker, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.marker); return; case USERDEFS_MOUSEFLIP: @@ -677,7 +677,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.mouseflip = lValue; return; } - Gv_SetVar(lVar2, ud.mouseflip, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.mouseflip); return; case USERDEFS_STATUSBARSCALE: @@ -686,7 +686,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.statusbarscale = lValue; return; } - Gv_SetVar(lVar2, ud.statusbarscale, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.statusbarscale); return; case USERDEFS_DRAWWEAPON: @@ -695,7 +695,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.drawweapon = lValue; return; } - Gv_SetVar(lVar2, ud.drawweapon, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.drawweapon); return; case USERDEFS_MOUSEAIMING: @@ -704,7 +704,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.mouseaiming = lValue; return; } - Gv_SetVar(lVar2, ud.mouseaiming, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.mouseaiming); return; case USERDEFS_WEAPONSWITCH: @@ -713,7 +713,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.weaponswitch = lValue; return; } - Gv_SetVar(lVar2, ud.weaponswitch, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.weaponswitch); return; case USERDEFS_DEMOCAMS: @@ -722,7 +722,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.democams = lValue; return; } - Gv_SetVar(lVar2, ud.democams, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.democams); return; case USERDEFS_COLOR: @@ -731,7 +731,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.color = lValue; return; } - Gv_SetVar(lVar2, ud.color, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.color); return; case USERDEFS_MSGDISPTIME: @@ -740,7 +740,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.msgdisptime = lValue; return; } - Gv_SetVar(lVar2, ud.msgdisptime, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.msgdisptime); return; case USERDEFS_STATUSBARMODE: @@ -749,7 +749,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.statusbarmode = lValue; return; } - Gv_SetVar(lVar2, ud.statusbarmode, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.statusbarmode); return; case USERDEFS_M_NOEXITS: @@ -758,7 +758,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.m_noexits = lValue; return; } - Gv_SetVar(lVar2, ud.m_noexits, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.m_noexits); return; case USERDEFS_NOEXITS: @@ -767,7 +767,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.noexits = lValue; return; } - Gv_SetVar(lVar2, ud.noexits, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.noexits); return; case USERDEFS_AUTOVOTE: @@ -776,7 +776,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.autovote = lValue; return; } - Gv_SetVar(lVar2, ud.autovote, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.autovote); return; case USERDEFS_AUTOMSG: @@ -785,7 +785,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.automsg = lValue; return; } - Gv_SetVar(lVar2, ud.automsg, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.automsg); return; case USERDEFS_IDPLAYERS: @@ -794,7 +794,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.idplayers = lValue; return; } - Gv_SetVar(lVar2, ud.idplayers, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.idplayers); return; case USERDEFS_TEAM: @@ -803,7 +803,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.team = lValue; return; } - Gv_SetVar(lVar2, ud.team, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.team); return; case USERDEFS_VIEWBOB: @@ -812,7 +812,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.viewbob = lValue; return; } - Gv_SetVar(lVar2, ud.viewbob, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.viewbob); return; case USERDEFS_WEAPONSWAY: @@ -821,7 +821,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.weaponsway = lValue; return; } - Gv_SetVar(lVar2, ud.weaponsway, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.weaponsway); return; case USERDEFS_ANGLEINTERPOLATION: @@ -830,7 +830,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.angleinterpolation = lValue; return; } - Gv_SetVar(lVar2, ud.angleinterpolation, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.angleinterpolation); return; case USERDEFS_OBITUARIES: @@ -839,7 +839,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.obituaries = lValue; return; } - Gv_SetVar(lVar2, ud.obituaries, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.obituaries); return; case USERDEFS_LEVELSTATS: @@ -848,7 +848,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.levelstats = lValue; return; } - Gv_SetVar(lVar2, ud.levelstats, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.levelstats); return; case USERDEFS_CROSSHAIRSCALE: @@ -857,7 +857,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.crosshairscale = lValue; return; } - Gv_SetVar(lVar2, ud.crosshairscale, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.crosshairscale); return; case USERDEFS_ALTHUD: @@ -866,7 +866,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.althud = lValue; return; } - Gv_SetVar(lVar2, ud.althud, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.althud); return; case USERDEFS_DISPLAY_BONUS_SCREEN: @@ -875,7 +875,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.display_bonus_screen = lValue; return; } - Gv_SetVar(lVar2, ud.display_bonus_screen, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.display_bonus_screen); return; case USERDEFS_SHOW_LEVEL_TEXT: @@ -884,7 +884,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.show_level_text = lValue; return; } - Gv_SetVar(lVar2, ud.show_level_text, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.show_level_text); return; case USERDEFS_WEAPONSCALE: @@ -893,7 +893,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.weaponscale = lValue; return; } - Gv_SetVar(lVar2, ud.weaponscale, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.weaponscale); return; case USERDEFS_TEXTSCALE: @@ -902,7 +902,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t ud.textscale = lValue; return; } - Gv_SetVar(lVar2, ud.textscale, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ud.textscale); return; default: @@ -915,9 +915,9 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in int32_t lValue=0,proj=vm.g_i; if (lVar1 != g_iThisActorID) - proj=Gv_GetVar(lVar1, vm.g_i, vm.g_p); + proj=Gv_GetVarX(lVar1); - if ((proj < 0 || proj >= MAXSPRITES) /* && g_scriptSanityChecks */) + if ((unsigned)proj >= MAXSPRITES) { // OSD_Printf("VM_AccessActiveProjectile(): invalid projectile (%d)\n",proj); OSD_Printf(CON_ERROR "tried to %s %s on invalid target projectile (%d) %d %d from %s\n",g_errorLineNum,keyw[g_tw], @@ -928,7 +928,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in } if (iSet) - lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); + lValue=Gv_GetVarX(lVar2); switch (lLabelID) { @@ -938,7 +938,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].workslike=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].workslike, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].workslike); return; case PROJ_SPAWNS: @@ -947,7 +947,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].spawns=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].spawns, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].spawns); return; case PROJ_SXREPEAT: @@ -956,7 +956,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].sxrepeat=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].sxrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].sxrepeat); return; case PROJ_SYREPEAT: @@ -965,7 +965,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].syrepeat=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].syrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].syrepeat); return; case PROJ_SOUND: @@ -974,7 +974,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].sound=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].sound, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].sound); return; case PROJ_ISOUND: @@ -983,7 +983,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].isound=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].isound, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].isound); return; case PROJ_VEL: @@ -992,7 +992,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].vel=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].vel, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].vel); return; case PROJ_EXTRA: @@ -1001,7 +1001,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].extra=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].extra, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].extra); return; case PROJ_DECAL: @@ -1010,7 +1010,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].decal=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].decal, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].decal); return; case PROJ_TRAIL: @@ -1019,7 +1019,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].trail=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].trail, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].trail); return; case PROJ_TXREPEAT: @@ -1028,7 +1028,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].txrepeat=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].txrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].txrepeat); return; case PROJ_TYREPEAT: @@ -1037,7 +1037,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].tyrepeat=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].tyrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].tyrepeat); return; case PROJ_TOFFSET: @@ -1046,7 +1046,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].toffset=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].toffset, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].toffset); return; case PROJ_TNUM: @@ -1055,7 +1055,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].tnum=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].tnum, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].tnum); return; case PROJ_DROP: @@ -1064,7 +1064,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].drop=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].drop, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].drop); return; case PROJ_CSTAT: @@ -1073,7 +1073,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].cstat=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].cstat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].cstat); return; case PROJ_CLIPDIST: @@ -1082,7 +1082,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].clipdist=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].clipdist, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].clipdist); return; case PROJ_SHADE: @@ -1091,7 +1091,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].shade=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].shade, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].shade); return; case PROJ_XREPEAT: @@ -1100,7 +1100,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].xrepeat=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].xrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].xrepeat); return; case PROJ_YREPEAT: @@ -1109,7 +1109,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].yrepeat=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].yrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].yrepeat); return; case PROJ_PAL: @@ -1118,7 +1118,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].pal=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].pal, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].pal); return; case PROJ_EXTRA_RAND: @@ -1127,7 +1127,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].extra_rand=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].extra_rand, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].extra_rand); return; case PROJ_HITRADIUS: @@ -1136,7 +1136,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].hitradius=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].hitradius, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].hitradius); return; case PROJ_VEL_MULT: @@ -1145,7 +1145,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].velmult=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].velmult, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].velmult); return; case PROJ_OFFSET: @@ -1154,7 +1154,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].offset=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].offset, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].offset); return; case PROJ_BOUNCES: @@ -1163,7 +1163,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].bounces=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].bounces, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].bounces); return; case PROJ_BSOUND: @@ -1172,7 +1172,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].bsound=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].bsound, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].bsound); return; case PROJ_RANGE: @@ -1181,7 +1181,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].range=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].range, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].range); return; case PROJ_FLASH_COLOR: @@ -1190,7 +1190,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in SpriteProjectile[proj].flashcolor=lValue; return; } - Gv_SetVar(lVar2, SpriteProjectile[proj].flashcolor, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, SpriteProjectile[proj].flashcolor); return; default: @@ -1203,7 +1203,7 @@ static void __fastcall VM_GetPlayer(register int32_t lVar1, register int32_t lLa register int32_t iPlayer=vm.g_p; if (lVar1 != g_iThisActorID) - iPlayer=Gv_GetVar(lVar1, vm.g_i, vm.g_p); + iPlayer=Gv_GetVarX(lVar1); if ((iPlayer<0 || iPlayer >= playerswhenstarted) /* && g_scriptSanityChecks */) goto badplayer; @@ -1214,302 +1214,302 @@ static void __fastcall VM_GetPlayer(register int32_t lVar1, register int32_t lLa switch (lLabelID) { case PLAYER_ZOOM: - Gv_SetVar(lVar2, g_player[iPlayer].ps->zoom, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->zoom); return; case PLAYER_EXITX: - Gv_SetVar(lVar2, g_player[iPlayer].ps->exitx, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->exitx); return; case PLAYER_EXITY: - Gv_SetVar(lVar2, g_player[iPlayer].ps->exity, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->exity); return; case PLAYER_LOOGIEX: - Gv_SetVar(lVar2, g_player[iPlayer].ps->loogiex[lParm2], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->loogiex[lParm2]); return; case PLAYER_LOOGIEY: - Gv_SetVar(lVar2, g_player[iPlayer].ps->loogiey[lParm2], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->loogiey[lParm2]); return; case PLAYER_NUMLOOGS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->numloogs, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->numloogs); return; case PLAYER_LOOGCNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->loogcnt, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->loogcnt); return; case PLAYER_POSX: - Gv_SetVar(lVar2, g_player[iPlayer].ps->pos.x, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->pos.x); return; case PLAYER_POSY: - Gv_SetVar(lVar2, g_player[iPlayer].ps->pos.y, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->pos.y); return; case PLAYER_POSZ: - Gv_SetVar(lVar2, g_player[iPlayer].ps->pos.z, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->pos.z); return; case PLAYER_HORIZ: - Gv_SetVar(lVar2, g_player[iPlayer].ps->horiz, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->horiz); return; case PLAYER_OHORIZ: - Gv_SetVar(lVar2, g_player[iPlayer].ps->ohoriz, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->ohoriz); return; case PLAYER_OHORIZOFF: - Gv_SetVar(lVar2, g_player[iPlayer].ps->ohorizoff, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->ohorizoff); return; case PLAYER_INVDISPTIME: - Gv_SetVar(lVar2, g_player[iPlayer].ps->invdisptime, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->invdisptime); return; case PLAYER_BOBPOSX: - Gv_SetVar(lVar2, g_player[iPlayer].ps->bobposx, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->bobposx); return; case PLAYER_BOBPOSY: - Gv_SetVar(lVar2, g_player[iPlayer].ps->bobposy, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->bobposy); return; case PLAYER_OPOSX: - Gv_SetVar(lVar2, g_player[iPlayer].ps->opos.x, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->opos.x); return; case PLAYER_OPOSY: - Gv_SetVar(lVar2, g_player[iPlayer].ps->opos.y, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->opos.y); return; case PLAYER_OPOSZ: - Gv_SetVar(lVar2, g_player[iPlayer].ps->opos.z, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->opos.z); return; case PLAYER_PYOFF: - Gv_SetVar(lVar2, g_player[iPlayer].ps->pyoff, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->pyoff); return; case PLAYER_OPYOFF: - Gv_SetVar(lVar2, g_player[iPlayer].ps->opyoff, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->opyoff); return; case PLAYER_POSXV: - Gv_SetVar(lVar2, g_player[iPlayer].ps->vel.x, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->vel.x); return; case PLAYER_POSYV: - Gv_SetVar(lVar2, g_player[iPlayer].ps->vel.y, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->vel.y); return; case PLAYER_POSZV: - Gv_SetVar(lVar2, g_player[iPlayer].ps->vel.z, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->vel.z); return; case PLAYER_LAST_PISSED_TIME: - Gv_SetVar(lVar2, g_player[iPlayer].ps->last_pissed_time, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->last_pissed_time); return; case PLAYER_TRUEFZ: - Gv_SetVar(lVar2, g_player[iPlayer].ps->truefz, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->truefz); return; case PLAYER_TRUECZ: - Gv_SetVar(lVar2, g_player[iPlayer].ps->truecz, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->truecz); return; case PLAYER_PLAYER_PAR: - Gv_SetVar(lVar2, g_player[iPlayer].ps->player_par, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->player_par); return; case PLAYER_VISIBILITY: - Gv_SetVar(lVar2, g_player[iPlayer].ps->visibility, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->visibility); return; case PLAYER_BOBCOUNTER: - Gv_SetVar(lVar2, g_player[iPlayer].ps->bobcounter, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->bobcounter); return; case PLAYER_WEAPON_SWAY: - Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_sway, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->weapon_sway); return; case PLAYER_PALS_TIME: - Gv_SetVar(lVar2, g_player[iPlayer].ps->pals.f, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->pals.f); return; case PLAYER_RANDOMFLAMEX: - Gv_SetVar(lVar2, g_player[iPlayer].ps->randomflamex, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->randomflamex); return; case PLAYER_CRACK_TIME: - Gv_SetVar(lVar2, g_player[iPlayer].ps->crack_time, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->crack_time); return; case PLAYER_AIM_MODE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->aim_mode, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->aim_mode); return; case PLAYER_ANG: - Gv_SetVar(lVar2, g_player[iPlayer].ps->ang, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->ang); return; case PLAYER_OANG: - Gv_SetVar(lVar2, g_player[iPlayer].ps->oang, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->oang); return; case PLAYER_ANGVEL: - Gv_SetVar(lVar2, g_player[iPlayer].ps->angvel, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->angvel); return; case PLAYER_CURSECTNUM: - Gv_SetVar(lVar2, g_player[iPlayer].ps->cursectnum, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->cursectnum); return; case PLAYER_LOOK_ANG: - Gv_SetVar(lVar2, g_player[iPlayer].ps->look_ang, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->look_ang); return; case PLAYER_LAST_EXTRA: - Gv_SetVar(lVar2, g_player[iPlayer].ps->last_extra, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->last_extra); return; case PLAYER_SUBWEAPON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->subweapon, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->subweapon); return; case PLAYER_AMMO_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->ammo_amount[lParm2], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->ammo_amount[lParm2]); return; case PLAYER_WACKEDBYACTOR: - Gv_SetVar(lVar2, g_player[iPlayer].ps->wackedbyactor, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->wackedbyactor); return; case PLAYER_FRAG: - Gv_SetVar(lVar2, g_player[iPlayer].ps->frag, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->frag); return; case PLAYER_FRAGGEDSELF: - Gv_SetVar(lVar2, g_player[iPlayer].ps->fraggedself, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->fraggedself); return; case PLAYER_CURR_WEAPON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->curr_weapon, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->curr_weapon); return; case PLAYER_LAST_WEAPON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->last_weapon, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->last_weapon); return; case PLAYER_TIPINCS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->tipincs, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->tipincs); return; case PLAYER_HORIZOFF: - Gv_SetVar(lVar2, g_player[iPlayer].ps->horizoff, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->horizoff); return; case PLAYER_WANTWEAPONFIRE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->wantweaponfire, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->wantweaponfire); return; case PLAYER_HOLODUKE_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_HOLODUKE], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_HOLODUKE]); return; case PLAYER_NEWOWNER: - Gv_SetVar(lVar2, g_player[iPlayer].ps->newowner, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->newowner); return; case PLAYER_HURT_DELAY: - Gv_SetVar(lVar2, g_player[iPlayer].ps->hurt_delay, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->hurt_delay); return; case PLAYER_HBOMB_HOLD_DELAY: - Gv_SetVar(lVar2, g_player[iPlayer].ps->hbomb_hold_delay, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->hbomb_hold_delay); return; case PLAYER_JUMPING_COUNTER: - Gv_SetVar(lVar2, g_player[iPlayer].ps->jumping_counter, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->jumping_counter); return; case PLAYER_AIRLEFT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->airleft, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->airleft); return; case PLAYER_KNEE_INCS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->knee_incs, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->knee_incs); return; case PLAYER_ACCESS_INCS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->access_incs, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->access_incs); return; case PLAYER_FTA: - Gv_SetVar(lVar2, g_player[iPlayer].ps->fta, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->fta); return; case PLAYER_FTQ: - Gv_SetVar(lVar2, g_player[iPlayer].ps->ftq, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->ftq); return; case PLAYER_ACCESS_WALLNUM: - Gv_SetVar(lVar2, g_player[iPlayer].ps->access_wallnum, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->access_wallnum); return; case PLAYER_ACCESS_SPRITENUM: - Gv_SetVar(lVar2, g_player[iPlayer].ps->access_spritenum, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->access_spritenum); return; case PLAYER_KICKBACK_PIC: - Gv_SetVar(lVar2, g_player[iPlayer].ps->kickback_pic, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->kickback_pic); return; case PLAYER_GOT_ACCESS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->got_access, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->got_access); return; case PLAYER_WEAPON_ANG: - Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_ang, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->weapon_ang); return; case PLAYER_FIRSTAID_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_FIRSTAID], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_FIRSTAID]); return; case PLAYER_SOMETHINGONPLAYER: - Gv_SetVar(lVar2, g_player[iPlayer].ps->somethingonplayer, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->somethingonplayer); return; case PLAYER_ON_CRANE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->on_crane, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->on_crane); return; case PLAYER_I: - Gv_SetVar(lVar2, g_player[iPlayer].ps->i, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->i); return; case PLAYER_ONE_PARALLAX_SECTNUM: - Gv_SetVar(lVar2, g_player[iPlayer].ps->one_parallax_sectnum, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->one_parallax_sectnum); return; case PLAYER_OVER_SHOULDER_ON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->over_shoulder_on, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->over_shoulder_on); return; case PLAYER_RANDOM_CLUB_FRAME: - Gv_SetVar(lVar2, g_player[iPlayer].ps->random_club_frame, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->random_club_frame); return; case PLAYER_FIST_INCS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->fist_incs, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->fist_incs); return; case PLAYER_ONE_EIGHTY_COUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->one_eighty_count, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->one_eighty_count); return; case PLAYER_CHEAT_PHASE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->cheat_phase, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->cheat_phase); return; case PLAYER_DUMMYPLAYERSPRITE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->dummyplayersprite, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->dummyplayersprite); return; case PLAYER_EXTRA_EXTRA8: - Gv_SetVar(lVar2, g_player[iPlayer].ps->extra_extra8, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->extra_extra8); return; case PLAYER_QUICK_KICK: - Gv_SetVar(lVar2, g_player[iPlayer].ps->quick_kick, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->quick_kick); return; case PLAYER_HEAT_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_HEATS], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_HEATS]); return; case PLAYER_ACTORSQU: - Gv_SetVar(lVar2, g_player[iPlayer].ps->actorsqu, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->actorsqu); return; case PLAYER_TIMEBEFOREEXIT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->timebeforeexit, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->timebeforeexit); return; case PLAYER_CUSTOMEXITSOUND: - Gv_SetVar(lVar2, g_player[iPlayer].ps->customexitsound, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->customexitsound); return; case PLAYER_WEAPRECS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->weaprecs[lParm2], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->weaprecs[lParm2]); return; case PLAYER_WEAPRECCNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->weapreccnt, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->weapreccnt); return; case PLAYER_INTERFACE_TOGGLE_FLAG: - Gv_SetVar(lVar2, g_player[iPlayer].ps->interface_toggle_flag, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->interface_toggle_flag); return; case PLAYER_ROTSCRNANG: - Gv_SetVar(lVar2, g_player[iPlayer].ps->rotscrnang, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->rotscrnang); return; case PLAYER_DEAD_FLAG: - Gv_SetVar(lVar2, g_player[iPlayer].ps->dead_flag, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->dead_flag); return; case PLAYER_SHOW_EMPTY_WEAPON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->show_empty_weapon, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->show_empty_weapon); return; case PLAYER_SCUBA_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_SCUBA], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_SCUBA]); return; case PLAYER_JETPACK_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_JETPACK], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_JETPACK]); return; case PLAYER_STEROIDS_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_STEROIDS], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_STEROIDS]); return; case PLAYER_SHIELD_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_SHIELD], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_SHIELD]); return; case PLAYER_HOLODUKE_ON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->holoduke_on, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->holoduke_on); return; case PLAYER_PYCOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->pycount, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->pycount); return; case PLAYER_WEAPON_POS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_pos, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->weapon_pos); return; case PLAYER_FRAG_PS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->frag_ps, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->frag_ps); return; case PLAYER_TRANSPORTER_HOLD: - Gv_SetVar(lVar2, g_player[iPlayer].ps->transporter_hold, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->transporter_hold); return; case PLAYER_LAST_FULL_WEAPON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->last_full_weapon, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->last_full_weapon); return; case PLAYER_FOOTPRINTSHADE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintshade, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->footprintshade); return; case PLAYER_BOOT_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_BOOTS], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_BOOTS]); return; case PLAYER_SCREAM_VOICE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->scream_voice, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->scream_voice); return; case PLAYER_GM: - Gv_SetVar(lVar2, g_player[iPlayer].ps->gm, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->gm); return; case PLAYER_ON_WARPING_SECTOR: - Gv_SetVar(lVar2, g_player[iPlayer].ps->on_warping_sector, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->on_warping_sector); return; case PLAYER_FOOTPRINTCOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintcount, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->footprintcount); return; case PLAYER_HBOMB_ON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->hbomb_on, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->hbomb_on); return; case PLAYER_JUMPING_TOGGLE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->jumping_toggle, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->jumping_toggle); return; case PLAYER_RAPID_FIRE_HOLD: - Gv_SetVar(lVar2, g_player[iPlayer].ps->rapid_fire_hold, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->rapid_fire_hold); return; case PLAYER_ON_GROUND: - Gv_SetVar(lVar2, g_player[iPlayer].ps->on_ground, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->on_ground); return; case PLAYER_INVEN_ICON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->inven_icon, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->inven_icon); return; case PLAYER_BUTTONPALETTE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->buttonpalette, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->buttonpalette); return; case PLAYER_JETPACK_ON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->jetpack_on, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->jetpack_on); return; case PLAYER_SPRITEBRIDGE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->spritebridge, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->spritebridge); return; case PLAYER_LASTRANDOMSPOT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->lastrandomspot, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->lastrandomspot); return; case PLAYER_SCUBA_ON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->scuba_on, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->scuba_on); return; case PLAYER_FOOTPRINTPAL: - Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintpal, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->footprintpal); return; case PLAYER_HEAT_ON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->heat_on, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->heat_on); return; case PLAYER_HOLSTER_WEAPON: - Gv_SetVar(lVar2, g_player[iPlayer].ps->holster_weapon, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->holster_weapon); return; case PLAYER_FALLING_COUNTER: - Gv_SetVar(lVar2, g_player[iPlayer].ps->falling_counter, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->falling_counter); return; case PLAYER_GOTWEAPON: - Gv_SetVar(lVar2, (g_player[iPlayer].ps->gotweapon & (1<gotweapon & (1<refresh_inventory, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->refresh_inventory); return; case PLAYER_TOGGLE_KEY_FLAG: - Gv_SetVar(lVar2, g_player[iPlayer].ps->toggle_key_flag, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->toggle_key_flag); return; case PLAYER_KNUCKLE_INCS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->knuckle_incs, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->knuckle_incs); return; case PLAYER_WALKING_SND_TOGGLE: - Gv_SetVar(lVar2, g_player[iPlayer].ps->walking_snd_toggle, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->walking_snd_toggle); return; case PLAYER_PALOOKUP: - Gv_SetVar(lVar2, g_player[iPlayer].ps->palookup, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->palookup); return; case PLAYER_HARD_LANDING: - Gv_SetVar(lVar2, g_player[iPlayer].ps->hard_landing, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->hard_landing); return; case PLAYER_MAX_SECRET_ROOMS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->max_secret_rooms, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->max_secret_rooms); return; case PLAYER_SECRET_ROOMS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->secret_rooms, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->secret_rooms); return; case PLAYER_PALS: switch (lParm2) { case 0: - Gv_SetVar(lVar2, g_player[iPlayer].ps->pals.r, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->pals.r); return; case 1: - Gv_SetVar(lVar2, g_player[iPlayer].ps->pals.g, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->pals.g); return; case 2: - Gv_SetVar(lVar2, g_player[iPlayer].ps->pals.b, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->pals.b); return; } return; case PLAYER_MAX_ACTORS_KILLED: - Gv_SetVar(lVar2, g_player[iPlayer].ps->max_actors_killed, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->max_actors_killed); return; case PLAYER_ACTORS_KILLED: - Gv_SetVar(lVar2, g_player[iPlayer].ps->actors_killed, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->actors_killed); return; case PLAYER_RETURN_TO_CENTER: - Gv_SetVar(lVar2, g_player[iPlayer].ps->return_to_center, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->return_to_center); return; case PLAYER_RUNSPEED: - Gv_SetVar(lVar2, g_player[iPlayer].ps->runspeed, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->runspeed); return; case PLAYER_SBS: - Gv_SetVar(lVar2, g_player[iPlayer].ps->sbs, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->sbs); return; case PLAYER_RELOADING: - Gv_SetVar(lVar2, g_player[iPlayer].ps->reloading, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->reloading); return; case PLAYER_AUTO_AIM: - Gv_SetVar(lVar2, g_player[iPlayer].ps->auto_aim, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->auto_aim); return; case PLAYER_MOVEMENT_LOCK: - Gv_SetVar(lVar2, g_player[iPlayer].ps->movement_lock, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->movement_lock); return; case PLAYER_SOUND_PITCH: - Gv_SetVar(lVar2, g_player[iPlayer].ps->sound_pitch, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->sound_pitch); return; case PLAYER_WEAPONSWITCH: - Gv_SetVar(lVar2, g_player[iPlayer].ps->weaponswitch, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->weaponswitch); return; case PLAYER_TEAM: - Gv_SetVar(lVar2, g_player[iPlayer].ps->team, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->team); return; case PLAYER_MAX_PLAYER_HEALTH: - Gv_SetVar(lVar2, g_player[iPlayer].ps->max_player_health, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->max_player_health); return; case PLAYER_MAX_SHIELD_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->max_shield_amount, vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->max_shield_amount); return; case PLAYER_MAX_AMMO_AMOUNT: - Gv_SetVar(lVar2, g_player[iPlayer].ps->max_ammo_amount[lParm2], vm.g_i, vm.g_p); return; + Gv_SetVarX(lVar2, g_player[iPlayer].ps->max_ammo_amount[lParm2]); return; case PLAYER_LAST_QUICK_KICK: - Gv_SetVar(lVar2, g_player[iPlayer].ps->last_quick_kick, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, g_player[iPlayer].ps->last_quick_kick); return; default: @@ -1534,7 +1534,7 @@ static void __fastcall VM_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVa register int32_t iPlayer=vm.g_p; if (lVar1 != g_iThisActorID) - iPlayer=Gv_GetVar(lVar1, vm.g_i, vm.g_p); + iPlayer=Gv_GetVarX(lVar1); if ((iPlayer<0 || iPlayer >= playerswhenstarted) /* && g_scriptSanityChecks */) goto badplayer; @@ -1542,7 +1542,7 @@ static void __fastcall VM_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVa if ((PlayerLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= PlayerLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) goto badpos; - lVar1=Gv_GetVar(lVar2, vm.g_i, vm.g_p); + lVar1=Gv_GetVarX(lVar2); switch (lLabelID) { @@ -1881,13 +1881,13 @@ static void __fastcall VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t int32_t iPlayer=vm.g_p; if (lVar1 != g_iThisActorID) - iPlayer=Gv_GetVar(lVar1, vm.g_i, vm.g_p); + iPlayer=Gv_GetVarX(lVar1); if ((iPlayer<0 || iPlayer >= playerswhenstarted) /* && g_scriptSanityChecks */) goto badplayer; if (iSet) - lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); + lValue=Gv_GetVarX(lVar2); switch (lLabelID) { @@ -1897,7 +1897,7 @@ static void __fastcall VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t g_player[iPlayer].sync->avel=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->avel, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, g_player[iPlayer].sync->avel); return; case INPUT_HORZ: @@ -1906,7 +1906,7 @@ static void __fastcall VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t g_player[iPlayer].sync->horz=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->horz, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, g_player[iPlayer].sync->horz); return; case INPUT_FVEL: @@ -1915,7 +1915,7 @@ static void __fastcall VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t g_player[iPlayer].sync->fvel=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->fvel, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, g_player[iPlayer].sync->fvel); return; case INPUT_SVEL: @@ -1924,7 +1924,7 @@ static void __fastcall VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t g_player[iPlayer].sync->svel=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->svel, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, g_player[iPlayer].sync->svel); return; case INPUT_BITS: @@ -1933,7 +1933,7 @@ static void __fastcall VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t g_player[iPlayer].sync->bits=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->bits, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, g_player[iPlayer].sync->bits); return; case INPUT_EXTBITS: @@ -1942,7 +1942,7 @@ static void __fastcall VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t g_player[iPlayer].sync->extbits=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->extbits, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, g_player[iPlayer].sync->extbits); return; default: return; @@ -1957,13 +1957,13 @@ badplayer: static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2) { int32_t lValue=0; - int32_t iWall = Gv_GetVar(lVar1, vm.g_i, vm.g_p); + int32_t iWall = Gv_GetVarX(lVar1); if ((iWall<0 || iWall >= numwalls) /* && g_scriptSanityChecks */) goto badwall; if (iSet) - lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); + lValue=Gv_GetVarX(lVar2); switch (lLabelID) { @@ -1973,7 +1973,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].x=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].x, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].x); return; case WALL_Y: @@ -1982,7 +1982,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].y=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].y, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].y); return; case WALL_POINT2: @@ -1991,7 +1991,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].point2=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].point2, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].point2); return; case WALL_NEXTWALL: @@ -2000,7 +2000,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].nextwall=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].nextwall, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].nextwall); return; case WALL_NEXTSECTOR: @@ -2009,7 +2009,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].nextsector=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].nextsector, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].nextsector); return; case WALL_CSTAT: @@ -2018,7 +2018,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].cstat=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].cstat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].cstat); return; case WALL_PICNUM: @@ -2027,7 +2027,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].picnum=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].picnum, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].picnum); return; case WALL_OVERPICNUM: @@ -2036,7 +2036,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].overpicnum=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].overpicnum, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].overpicnum); return; case WALL_SHADE: @@ -2045,7 +2045,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].shade=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].shade, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].shade); return; case WALL_PAL: @@ -2054,7 +2054,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].pal=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].pal, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].pal); return; case WALL_XREPEAT: @@ -2063,7 +2063,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].xrepeat=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].xrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].xrepeat); return; case WALL_YREPEAT: @@ -2072,7 +2072,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].yrepeat=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].yrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].yrepeat); return; case WALL_XPANNING: @@ -2081,7 +2081,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].xpanning=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].xpanning, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].xpanning); return; case WALL_YPANNING: @@ -2090,7 +2090,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].ypanning=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].ypanning, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].ypanning); return; case WALL_LOTAG: @@ -2099,7 +2099,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].lotag=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].lotag, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].lotag); return; case WALL_HITAG: @@ -2108,7 +2108,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].hitag=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].hitag, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].hitag); return; case WALL_EXTRA: @@ -2117,7 +2117,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel wall[iWall].extra=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].extra, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, wall[iWall].extra); return; default: return; @@ -2135,13 +2135,13 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab int32_t iSector=sprite[vm.g_i].sectnum; if (lVar1 != g_iThisActorID) - iSector=Gv_GetVar(lVar1, vm.g_i, vm.g_p); + iSector=Gv_GetVarX(lVar1); if ((iSector<0 || iSector >= numsectors) /* && g_scriptSanityChecks */) goto badsector; if (iSet) - lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); + lValue=Gv_GetVarX(lVar2); switch (lLabelID) { @@ -2151,7 +2151,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].wallptr=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].wallptr,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].wallptr); return; case SECTOR_WALLNUM: @@ -2160,7 +2160,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].wallnum=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].wallnum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].wallnum); return; case SECTOR_CEILINGZ: @@ -2169,7 +2169,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].ceilingz=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingz,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].ceilingz); return; case SECTOR_FLOORZ: @@ -2178,7 +2178,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].floorz=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorz,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].floorz); return; case SECTOR_CEILINGSTAT: @@ -2187,7 +2187,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].ceilingstat=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingstat,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].ceilingstat); return; case SECTOR_FLOORSTAT: @@ -2196,7 +2196,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].floorstat=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorstat,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].floorstat); return; case SECTOR_CEILINGPICNUM: @@ -2205,7 +2205,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].ceilingpicnum=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingpicnum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].ceilingpicnum); return; case SECTOR_CEILINGSLOPE: @@ -2214,7 +2214,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].ceilingheinum=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingheinum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].ceilingheinum); return; case SECTOR_CEILINGSHADE: @@ -2223,7 +2223,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].ceilingshade=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingshade,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].ceilingshade); return; case SECTOR_CEILINGPAL: @@ -2232,7 +2232,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].ceilingpal=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingpal,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].ceilingpal); return; case SECTOR_CEILINGXPANNING: @@ -2241,7 +2241,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].ceilingxpanning=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingxpanning,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].ceilingxpanning); return; case SECTOR_CEILINGYPANNING: @@ -2250,7 +2250,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].ceilingypanning=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingypanning,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].ceilingypanning); return; case SECTOR_FLOORPICNUM: @@ -2259,7 +2259,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].floorpicnum=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorpicnum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].floorpicnum); return; case SECTOR_FLOORSLOPE: @@ -2268,7 +2268,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].floorheinum=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorheinum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].floorheinum); return; case SECTOR_FLOORSHADE: @@ -2277,7 +2277,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].floorshade=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorshade,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].floorshade); return; case SECTOR_FLOORPAL: @@ -2286,7 +2286,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].floorpal=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorpal,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].floorpal); return; case SECTOR_FLOORXPANNING: @@ -2295,7 +2295,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].floorxpanning=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorxpanning,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].floorxpanning); return; case SECTOR_FLOORYPANNING: @@ -2304,7 +2304,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].floorypanning=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorypanning,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].floorypanning); return; case SECTOR_VISIBILITY: @@ -2313,7 +2313,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].visibility=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].visibility,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].visibility); return; case SECTOR_ALIGNTO: @@ -2322,7 +2322,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].filler=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].filler,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].filler); return; case SECTOR_LOTAG: @@ -2331,7 +2331,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].lotag=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].lotag,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].lotag); return; case SECTOR_HITAG: @@ -2340,7 +2340,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].hitag=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].hitag,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].hitag); return; case SECTOR_EXTRA: @@ -2349,7 +2349,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab sector[iSector].extra=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].extra,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sector[iSector].extra); return; default: @@ -2367,15 +2367,15 @@ static void __fastcall VM_SetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVa register int32_t iActor=vm.g_i; if (lVar1 != g_iThisActorID) - iActor=Gv_GetVar(lVar1, vm.g_i, vm.g_p); + iActor=Gv_GetVarX(lVar1); - if ((iActor < 0 || iActor >= MAXSPRITES) /* && g_scriptSanityChecks */) + if ((unsigned)iActor >= MAXSPRITES) goto badactor; if ((ActorLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) goto badpos; - lVar1=Gv_GetVar(lVar2, vm.g_i, vm.g_p); + lVar1=Gv_GetVarX(lVar2); switch (lLabelID) { @@ -2611,9 +2611,9 @@ static void __fastcall VM_GetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVa register int32_t iActor=vm.g_i; if (lVar1 != g_iThisActorID) - iActor=Gv_GetVar(lVar1, vm.g_i, vm.g_p); + iActor=Gv_GetVarX(lVar1); - if ((iActor < 0 || iActor >= MAXSPRITES) /* && g_scriptSanityChecks */) + if ((unsigned)iActor >= MAXSPRITES) goto badactor; if ((ActorLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) @@ -2622,211 +2622,211 @@ static void __fastcall VM_GetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVa switch (lLabelID) { case ACTOR_X: - Gv_SetVar(lVar2, sprite[iActor].x,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].x); return; case ACTOR_Y: - Gv_SetVar(lVar2, sprite[iActor].y,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].y); return; case ACTOR_Z: - Gv_SetVar(lVar2, sprite[iActor].z,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].z); return; case ACTOR_CSTAT: - Gv_SetVar(lVar2, sprite[iActor].cstat,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].cstat); return; case ACTOR_PICNUM: - Gv_SetVar(lVar2, sprite[iActor].picnum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].picnum); return; case ACTOR_SHADE: - Gv_SetVar(lVar2, sprite[iActor].shade,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].shade); return; case ACTOR_PAL: - Gv_SetVar(lVar2, sprite[iActor].pal,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].pal); return; case ACTOR_CLIPDIST: - Gv_SetVar(lVar2, sprite[iActor].clipdist,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].clipdist); return; case ACTOR_DETAIL: - Gv_SetVar(lVar2, sprite[iActor].filler,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].filler); return; case ACTOR_XREPEAT: - Gv_SetVar(lVar2, sprite[iActor].xrepeat,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].xrepeat); return; case ACTOR_YREPEAT: - Gv_SetVar(lVar2, sprite[iActor].yrepeat,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].yrepeat); return; case ACTOR_XOFFSET: - Gv_SetVar(lVar2, sprite[iActor].xoffset,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].xoffset); return; case ACTOR_YOFFSET: - Gv_SetVar(lVar2, sprite[iActor].yoffset,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].yoffset); return; case ACTOR_SECTNUM: - Gv_SetVar(lVar2, sprite[iActor].sectnum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].sectnum); return; case ACTOR_STATNUM: - Gv_SetVar(lVar2, sprite[iActor].statnum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].statnum); return; case ACTOR_ANG: - Gv_SetVar(lVar2, sprite[iActor].ang,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].ang); return; case ACTOR_OWNER: - Gv_SetVar(lVar2, sprite[iActor].owner,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].owner); return; case ACTOR_XVEL: - Gv_SetVar(lVar2, sprite[iActor].xvel,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].xvel); return; case ACTOR_YVEL: - Gv_SetVar(lVar2, sprite[iActor].yvel,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].yvel); return; case ACTOR_ZVEL: - Gv_SetVar(lVar2, sprite[iActor].zvel,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].zvel); return; case ACTOR_LOTAG: - Gv_SetVar(lVar2, sprite[iActor].lotag,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].lotag); return; case ACTOR_HITAG: - Gv_SetVar(lVar2, sprite[iActor].hitag,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].hitag); return; case ACTOR_EXTRA: - Gv_SetVar(lVar2, sprite[iActor].extra,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, sprite[iActor].extra); return; case ACTOR_HTCGG: - Gv_SetVar(lVar2, actor[iActor].cgg, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, actor[iActor].cgg); return; case ACTOR_HTPICNUM : - Gv_SetVar(lVar2, actor[iActor].picnum, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, actor[iActor].picnum); return; case ACTOR_HTANG: - Gv_SetVar(lVar2, actor[iActor].ang, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, actor[iActor].ang); return; case ACTOR_HTEXTRA: - Gv_SetVar(lVar2,actor[iActor].extra, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].extra); return; case ACTOR_HTOWNER: - Gv_SetVar(lVar2,actor[iActor].owner, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].owner); return; case ACTOR_HTMOVFLAG: - Gv_SetVar(lVar2,actor[iActor].movflag, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].movflag); return; case ACTOR_HTTEMPANG: - Gv_SetVar(lVar2,actor[iActor].tempang, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].tempang); return; case ACTOR_HTACTORSTAYPUT: - Gv_SetVar(lVar2,actor[iActor].actorstayput, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].actorstayput); return; case ACTOR_HTDISPICNUM: - Gv_SetVar(lVar2,actor[iActor].dispicnum, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].dispicnum); return; case ACTOR_HTTIMETOSLEEP: - Gv_SetVar(lVar2,actor[iActor].timetosleep, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].timetosleep); return; case ACTOR_HTFLOORZ: - Gv_SetVar(lVar2,actor[iActor].floorz, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].floorz); return; case ACTOR_HTCEILINGZ: - Gv_SetVar(lVar2,actor[iActor].ceilingz, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].ceilingz); return; case ACTOR_HTLASTVX: - Gv_SetVar(lVar2,actor[iActor].lastvx, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].lastvx); return; case ACTOR_HTLASTVY: - Gv_SetVar(lVar2,actor[iActor].lastvy, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].lastvy); return; case ACTOR_HTBPOSX: - Gv_SetVar(lVar2,actor[iActor].bposx, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].bposx); return; case ACTOR_HTBPOSY: - Gv_SetVar(lVar2,actor[iActor].bposy, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].bposy); return; case ACTOR_HTBPOSZ: - Gv_SetVar(lVar2,actor[iActor].bposz, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].bposz); return; case ACTOR_HTG_T: - Gv_SetVar(lVar2, actor[iActor].t_data[lParm2], vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, actor[iActor].t_data[lParm2]); return; case ACTOR_ANGOFF: - Gv_SetVar(lVar2,spriteext[iActor].angoff, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,spriteext[iActor].angoff); return; case ACTOR_PITCH: - Gv_SetVar(lVar2,spriteext[iActor].pitch, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,spriteext[iActor].pitch); return; case ACTOR_ROLL: - Gv_SetVar(lVar2,spriteext[iActor].roll, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,spriteext[iActor].roll); return; case ACTOR_MDXOFF: - Gv_SetVar(lVar2,spriteext[iActor].xoff, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,spriteext[iActor].xoff); return; case ACTOR_MDYOFF: - Gv_SetVar(lVar2,spriteext[iActor].yoff, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,spriteext[iActor].yoff); return; case ACTOR_MDZOFF: - Gv_SetVar(lVar2,spriteext[iActor].zoff, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,spriteext[iActor].zoff); return; case ACTOR_MDFLAGS: - Gv_SetVar(lVar2,spriteext[iActor].flags, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,spriteext[iActor].flags); return; case ACTOR_XPANNING: - Gv_SetVar(lVar2, spriteext[iActor].xpanning,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].xpanning); return; case ACTOR_YPANNING: - Gv_SetVar(lVar2, spriteext[iActor].ypanning,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].ypanning); return; case ACTOR_HTFLAGS: - Gv_SetVar(lVar2,actor[iActor].flags, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2,actor[iActor].flags); return; case ACTOR_ALPHA: - Gv_SetVar(lVar2, (uint8_t)(spriteext[iActor].alpha * 255.0f), vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, (uint8_t)(spriteext[iActor].alpha * 255.0f)); return; default: @@ -2854,13 +2854,13 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa int32_t iActor=vm.g_i; if (lVar1 != g_iThisActorID) - iActor=Gv_GetVar(lVar1, vm.g_i, vm.g_p); + iActor=Gv_GetVarX(lVar1); - if ((iActor < 0 || iActor >= MAXSPRITES) && g_scriptSanityChecks) + if ((unsigned)iActor >= MAXSPRITES) goto badsprite; if (iSet) - lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); + lValue=Gv_GetVarX(lVar2); if ((!spriteext[iActor].tspr) && g_scriptSanityChecks) goto badtspr; @@ -2873,7 +2873,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->x=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->x,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->x); return; case ACTOR_Y: @@ -2882,7 +2882,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->y=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->y,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->y); return; case ACTOR_Z: @@ -2891,7 +2891,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->z=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->z,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->z); return; case ACTOR_CSTAT: @@ -2900,7 +2900,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->cstat=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->cstat,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->cstat); return; case ACTOR_PICNUM: @@ -2909,7 +2909,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->picnum=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->picnum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->picnum); return; case ACTOR_SHADE: @@ -2918,7 +2918,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->shade=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->shade,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->shade); return; case ACTOR_PAL: @@ -2927,7 +2927,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->pal=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->pal,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->pal); return; case ACTOR_CLIPDIST: @@ -2936,7 +2936,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->clipdist=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->clipdist,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->clipdist); return; case ACTOR_DETAIL: @@ -2945,7 +2945,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->filler=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->filler,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->filler); return; case ACTOR_XREPEAT: @@ -2954,7 +2954,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->xrepeat=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->xrepeat,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->xrepeat); return; case ACTOR_YREPEAT: @@ -2963,7 +2963,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->yrepeat=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->yrepeat,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->yrepeat); return; case ACTOR_XOFFSET: @@ -2972,7 +2972,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->xoffset=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->xoffset,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->xoffset); return; case ACTOR_YOFFSET: @@ -2981,7 +2981,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->yoffset=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->yoffset,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->yoffset); return; case ACTOR_SECTNUM: @@ -2990,7 +2990,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->sectnum=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->sectnum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->sectnum); return; case ACTOR_STATNUM: @@ -2999,7 +2999,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->statnum=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->statnum,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->statnum); return; case ACTOR_ANG: @@ -3008,7 +3008,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->ang=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->ang,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->ang); return; case ACTOR_OWNER: @@ -3017,7 +3017,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->owner=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->owner,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->owner); return; #if 1 @@ -3027,7 +3027,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->xvel=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->xvel,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->xvel); return; case ACTOR_YVEL: @@ -3036,7 +3036,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->yvel=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->yvel,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->yvel); return; case ACTOR_ZVEL: @@ -3045,7 +3045,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->zvel=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->zvel,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->zvel); return; case ACTOR_LOTAG: @@ -3054,7 +3054,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->lotag=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->lotag,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->lotag); return; case ACTOR_HITAG: @@ -3063,7 +3063,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->hitag=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->hitag,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->hitag); return; case ACTOR_EXTRA: @@ -3072,7 +3072,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa spriteext[iActor].tspr->extra=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->extra,vm.g_i,vm.g_p); + Gv_SetVarX(lVar2, spriteext[iActor].tspr->extra); return; #endif @@ -3098,7 +3098,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t goto badtile; if (iSet) - lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); + lValue=Gv_GetVarX(lVar2); switch (lLabelID) { @@ -3108,7 +3108,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].workslike=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].workslike, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].workslike); return; case PROJ_SPAWNS: @@ -3117,7 +3117,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].spawns=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].spawns, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].spawns); return; case PROJ_SXREPEAT: @@ -3126,7 +3126,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].sxrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].sxrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].sxrepeat); return; case PROJ_SYREPEAT: @@ -3135,7 +3135,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].syrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].syrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].syrepeat); return; case PROJ_SOUND: @@ -3144,7 +3144,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].sound=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].sound, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].sound); return; case PROJ_ISOUND: @@ -3153,7 +3153,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].isound=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].isound, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].isound); return; case PROJ_VEL: @@ -3162,7 +3162,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].vel=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].vel, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].vel); return; case PROJ_EXTRA: @@ -3171,7 +3171,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].extra=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].extra, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].extra); return; case PROJ_DECAL: @@ -3180,7 +3180,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].decal=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].decal, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].decal); return; case PROJ_TRAIL: @@ -3189,7 +3189,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].trail=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].trail, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].trail); return; case PROJ_TXREPEAT: @@ -3198,7 +3198,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].txrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].txrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].txrepeat); return; case PROJ_TYREPEAT: @@ -3207,7 +3207,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].tyrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].tyrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].tyrepeat); return; case PROJ_TOFFSET: @@ -3216,7 +3216,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].toffset=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].toffset, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].toffset); return; case PROJ_TNUM: @@ -3225,7 +3225,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].tnum=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].tnum, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].tnum); return; case PROJ_DROP: @@ -3234,7 +3234,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].drop=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].drop, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].drop); return; case PROJ_CSTAT: @@ -3243,7 +3243,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].cstat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].cstat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].cstat); return; case PROJ_CLIPDIST: @@ -3252,7 +3252,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].clipdist=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].clipdist, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].clipdist); return; case PROJ_SHADE: @@ -3261,7 +3261,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].shade=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].shade, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].shade); return; case PROJ_XREPEAT: @@ -3270,7 +3270,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].xrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].xrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].xrepeat); return; case PROJ_YREPEAT: @@ -3279,7 +3279,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].yrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].yrepeat, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].yrepeat); return; case PROJ_PAL: @@ -3288,7 +3288,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].pal=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].pal, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].pal); return; case PROJ_EXTRA_RAND: @@ -3297,7 +3297,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].extra_rand=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].extra_rand, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].extra_rand); return; case PROJ_HITRADIUS: @@ -3306,7 +3306,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].hitradius=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].hitradius, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].hitradius); return; case PROJ_VEL_MULT: @@ -3315,7 +3315,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].velmult=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].velmult, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].velmult); return; case PROJ_OFFSET: @@ -3324,7 +3324,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].offset=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].offset, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].offset); return; case PROJ_BOUNCES: @@ -3333,7 +3333,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].bounces=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].bounces, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].bounces); return; case PROJ_BSOUND: @@ -3342,7 +3342,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].bsound=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].bsound, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].bsound); return; case PROJ_RANGE: @@ -3351,7 +3351,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t ProjectileData[lVar1].range=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].range, vm.g_i, vm.g_p); + Gv_SetVarX(lVar2, ProjectileData[lVar1].range); return; default: diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 1553f3b29..e87f0639b 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -635,10 +635,10 @@ int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, regis default: return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult); case GAMEVAR_PERPLAYER: - if (iPlayer < 0 || iPlayer >= MAXPLAYERS) goto bad_id; + if ((unsigned)iPlayer >= MAXPLAYERS) goto bad_id; return ((aGameVars[id].val.plValues[iPlayer] ^ -negateResult) + negateResult); case GAMEVAR_PERACTOR: - if (iActor < 0 || iActor >= MAXSPRITES) goto bad_id; + if ((unsigned)iActor >= MAXSPRITES) goto bad_id; return ((aGameVars[id].val.plValues[iActor] ^ -negateResult) + negateResult); case GAMEVAR_INTPTR: return (((*((int32_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult); @@ -667,12 +667,12 @@ void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register aGameVars[id].val.lValue=lValue; return; case GAMEVAR_PERPLAYER: - if (iPlayer < 0 || iPlayer > MAXPLAYERS-1) goto badplayer; + if ((unsigned)iPlayer > MAXPLAYERS-1) goto badindex; // for the current player aGameVars[id].val.plValues[iPlayer]=lValue; return; case GAMEVAR_PERACTOR: - if (iActor < 0 || iActor > MAXSPRITES-1) goto badactor; + if ((unsigned)iActor > MAXSPRITES-1) goto badindex; aGameVars[id].val.plValues[iActor]=lValue; return; case GAMEVAR_INTPTR: @@ -691,14 +691,11 @@ badvarid: g_errorLineNum,keyw[g_tw],id,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); return; -badplayer: - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid player (%d) for gamevar %s from sprite %d, player %d\n", - g_errorLineNum,keyw[g_tw],iPlayer,aGameVars[id].szLabel,vm.g_i,vm.g_p); - return; - -badactor: - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid actor (%d) for gamevar %s from sprite %d (%d), player %d\n", - g_errorLineNum,keyw[g_tw],iActor,aGameVars[id].szLabel,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); +badindex: + OSD_Printf(CON_ERROR "Gv_SetVar(): invalid index (%d) for gamevar %s from sprite %d, player %d\n", + g_errorLineNum,keyw[g_tw], + aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? iActor : iPlayer, + aGameVars[id].szLabel,vm.g_i,vm.g_p); return; } @@ -805,11 +802,11 @@ void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue) aGameVars[id].val.lValue=lValue; return; case GAMEVAR_PERPLAYER: - if (vm.g_p < 0 || vm.g_p > MAXPLAYERS-1) goto badplayer; + if ((unsigned)vm.g_p > MAXPLAYERS-1) goto badindex; aGameVars[id].val.plValues[vm.g_p]=lValue; return; case GAMEVAR_PERACTOR: - if (vm.g_i < 0 || vm.g_i > MAXSPRITES-1) goto badactor; + if ((unsigned)vm.g_i > MAXSPRITES-1) goto badindex; aGameVars[id].val.plValues[vm.g_i]=lValue; return; case GAMEVAR_INTPTR: @@ -823,14 +820,11 @@ void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue) return; } -badplayer: - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid player (%d) for gamevar %s\n", - g_errorLineNum,keyw[g_tw],vm.g_p,aGameVars[id].szLabel); - return; - -badactor: - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid actor (%d) for gamevar %s\n", - g_errorLineNum,keyw[g_tw],vm.g_i,aGameVars[id].szLabel); +badindex: + OSD_Printf(CON_ERROR "Gv_SetVar(): invalid index (%d) for gamevar %s\n", + g_errorLineNum,keyw[g_tw], + aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? vm.g_i : vm.g_p, + aGameVars[id].szLabel); return; } @@ -1532,7 +1526,7 @@ static void Gv_AddSystemVars(void) Gv_NewVar("NUMSECTORS",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY); Gv_NewVar("lastsavepos",(intptr_t)&g_lastSaveSlot, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); -#ifdef POLYMOST +#ifdef USE_OPENGL Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); #else Gv_NewVar("rendmode", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); @@ -1689,7 +1683,7 @@ void Gv_RefreshPointers(void) aGameVars[Gv_GetVarIndex("NUMSECTORS")].val.lValue = (intptr_t)&numsectors; aGameVars[Gv_GetVarIndex("lastsavepos")].val.lValue = (intptr_t)&g_lastSaveSlot; -#ifdef POLYMOST +#ifdef USE_OPENGL aGameVars[Gv_GetVarIndex("rendmode")].val.lValue = (intptr_t)&rendmode; #endif } diff --git a/polymer/eduke32/source/grpscan.c b/polymer/eduke32/source/grpscan.c index 3d8650230..72f6a5107 100644 --- a/polymer/eduke32/source/grpscan.c +++ b/polymer/eduke32/source/grpscan.c @@ -32,14 +32,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct grpfile grpfiles[numgrpfiles] = { - { "Duke Nukem 3D", 0xBBC9CE44, 26524524, GAMEDUKE, NULL }, - { "Duke Nukem 3D: Atomic Edition", 0xF514A6AC, 44348015, GAMEDUKE, NULL }, - { "Duke Nukem 3D: Atomic Edition", 0xFD3DCFF1, 44356548, GAMEDUKE, NULL }, - { "Duke Nukem 3D Shareware", 0x983AD923, 11035779, GAMEDUKE, NULL }, - { "Duke Nukem 3D Mac Shareware", 0xC5F71561, 10444391, GAMEDUKE, NULL }, - { "NAM", 0x75C1F07B, 43448927, GAMENAM, NULL }, - { "Napalm", 0x3DE1589A, 44365728, GAMENAM, NULL }, - { "WW2GI", 0x907B82BF, 77939508, GAMEWW2, NULL }, + { "Duke Nukem 3D", 0xBBC9CE44, 26524524, GAME_DUKE, NULL }, + { "Duke Nukem 3D: Atomic Edition", 0xF514A6AC, 44348015, GAME_DUKE, NULL }, + { "Duke Nukem 3D: Atomic Edition", 0xFD3DCFF1, 44356548, GAME_DUKE, NULL }, + { "Duke Nukem 3D Shareware", 0x983AD923, 11035779, GAME_DUKE, NULL }, + { "Duke Nukem 3D Mac Shareware", 0xC5F71561, 10444391, GAME_DUKE, NULL }, + { "NAM", 0x75C1F07B, 43448927, GAME_NAM, NULL }, + { "Napalm", 0x3DE1589A, 44365728, GAME_NAM, NULL }, + { "WW2GI", 0x907B82BF, 77939508, GAME_WW2, NULL }, }; struct grpfile *foundgrps = NULL; diff --git a/polymer/eduke32/source/jaudiolib/src/multivoc.c b/polymer/eduke32/source/jaudiolib/src/multivoc.c index be0881a14..bf1ec3e77 100644 --- a/polymer/eduke32/source/jaudiolib/src/multivoc.c +++ b/polymer/eduke32/source/jaudiolib/src/multivoc.c @@ -1012,14 +1012,13 @@ VoiceNode *MV_AllocVoice(int32_t priority) if (LL_Empty(&VoicePool, next, prev)) { // check if we have a higher priority than a voice that is playing. - voice = VoiceList.next; - for (node = voice->next; node != &VoiceList; node = node->next) + for (voice = node = VoiceList.next; node != &VoiceList; node = node->next) { if (node->priority < voice->priority) voice = node; } - if (priority >= voice->priority && voice->handle > MV_Ok) + if (priority >= voice->priority && voice != &VoiceList && voice->handle >= MV_MinVoiceHandle) MV_Kill(voice->handle); if (LL_Empty(&VoicePool, next, prev)) @@ -1074,14 +1073,14 @@ int32_t MV_VoiceAvailable(int32_t priority) voice = node; } - if ((voice != &VoiceList) && (priority >= voice->priority)) + if ((voice == &VoiceList) || (priority < voice->priority)) { RestoreInterrupts(); - return TRUE; + return FALSE; } RestoreInterrupts(); - return FALSE; + return TRUE; } diff --git a/polymer/eduke32/source/m32vars.c b/polymer/eduke32/source/m32vars.c index 93e324309..3fa53709e 100644 --- a/polymer/eduke32/source/m32vars.c +++ b/polymer/eduke32/source/m32vars.c @@ -563,7 +563,7 @@ static void Gv_AddSystemVars(void) Gv_NewVar("numsprites",(intptr_t)&numsprites, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); Gv_NewVar("numtiles",(intptr_t)&numtiles, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); -#ifdef POLYMOST +#ifdef USE_OPENGL Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM); #endif diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 6dbee5512..022aa2b59 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -2358,7 +2358,7 @@ cheat_for_port_credits: menutext(c,70+19+19+19,MENUHIGHLIGHT(3),PHX(-5),SkillNames[3]); break; case 230: -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); menutext(320>>1,24,0,0,"RENDERER SETUP"); @@ -2784,7 +2784,7 @@ cheat_for_port_credits: break; case 9: if (x==io) ud.screen_tilting = 1-ud.screen_tilting; -#ifdef POLYMOST +#ifdef USE_OPENGL if (!ud.screen_tilting) setrollangle(0); #endif modval(0,1,(int32_t *)&ud.screen_tilting,1,probey==io); @@ -3078,7 +3078,7 @@ cheat_for_port_credits: c = (320>>1)-120; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL x = (7/*+(getrendermode() >= 3)*/); #else x = 7; @@ -3282,7 +3282,7 @@ cheat_for_port_credits: nfs = newfullscreen; nbpp = (newvidmode==validmodecnt)?bpp:validmode[newvidmode].bpp; nrend = (vidsets[newvidset] & 0x20000) ? (nbpp==8?2: -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL glrendmode #else 0 @@ -3326,7 +3326,7 @@ cheat_for_port_credits: ud.detail = 1-ud.detail; break; } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL /* switch (gltexfiltermode) { case 0: @@ -3398,7 +3398,7 @@ cheat_for_port_credits: r_ambientlightrecip = 1.f/r_ambientlight; } } -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL else { int32_t filter = gltexfiltermode; diff --git a/polymer/eduke32/source/net.c b/polymer/eduke32/source/net.c index 6e92ae72a..4ed92e94c 100644 --- a/polymer/eduke32/source/net.c +++ b/polymer/eduke32/source/net.c @@ -1728,7 +1728,7 @@ void Net_ParseServerPacket(ENetEvent *event) // Bmemcpy(&g_player[i].ps->opos.x, &g_player[i].ps->pos.x, sizeof(vec3_t)); - Bmemcpy(&g_player[i].ps->pos.x, &pbuf[j], sizeof(vec3_t) * 2); +// Bmemcpy(&g_player[i].ps->pos.x, &pbuf[j], sizeof(vec3_t) * 2); Bmemcpy(&sprite[g_player[i].ps->i], &pbuf[j], sizeof(vec3_t)); sprite[g_player[i].ps->i].z += PHEIGHT; @@ -1737,13 +1737,19 @@ void Net_ParseServerPacket(ENetEvent *event) Bmemcpy(&g_player[i].ps->vel.x, &pbuf[j], sizeof(vec3_t)); j += sizeof(vec3_t); - g_player[i].ps->oang = g_player[i].ps->ang; - g_player[i].ps->ang = sprite[g_player[i].ps->i].ang = *(int16_t *)&pbuf[j]; - j += sizeof(int16_t); + if (i != myconnectindex) + { + g_player[i].ps->oang = g_player[i].ps->ang; + g_player[i].ps->ang = sprite[g_player[i].ps->i].ang = *(int16_t *)&pbuf[j]; + j += sizeof(int16_t); + + Bmemcpy(&g_player[i].ps->ohoriz, &g_player[i].ps->horiz, sizeof(int16_t) * 2); + Bmemcpy(&g_player[i].ps->horiz, &pbuf[j], sizeof(int16_t) * 2); + j += sizeof(int16_t) * 2; + } + else j += sizeof(int16_t) * 3; + - Bmemcpy(&g_player[i].ps->ohoriz, &g_player[i].ps->horiz, sizeof(int16_t) * 2); - Bmemcpy(&g_player[i].ps->horiz, &pbuf[j], sizeof(int16_t) * 2); - j += sizeof(int16_t) * 2; //process: g_player[i].ps->gotweapon = *(uint16_t *)&pbuf[j]; @@ -2600,6 +2606,43 @@ void Net_GetPackets(void) } } +void Net_ClientMove(void) +{ + int32_t j; + input_t *nsyn = (input_t *)&inputfifo[0][myconnectindex]; + + packbuf[0] = PACKET_SLAVE_TO_MASTER; + j = 1; + + Bmemcpy(&packbuf[j], &nsyn[0], offsetof(input_t, filler)); + j += offsetof(input_t, filler); + + Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->pos.x, sizeof(vec3_t) * 2); + j += sizeof(vec3_t) * 2; + + Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->vel.x, sizeof(vec3_t)); + j += sizeof(vec3_t); + + *(int16_t *)&packbuf[j] = g_player[myconnectindex].ps->ang; + j += sizeof(int16_t); + + Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->horiz, sizeof(int16_t) * 2); + j += sizeof(int16_t) * 2; + + { + char buf[1024]; + + j = qlz_compress((char *)(packbuf)+1, (char *)buf, j, state_compress); + Bmemcpy((char *)(packbuf)+1, (char *)buf, j); + j++; + } + + packbuf[j++] = myconnectindex; + + enet_peer_send(g_netClientPeer, CHAN_MOVE, enet_packet_create(packbuf, j, 0)); + +} + void Net_UpdateClients(void) { input_t *osyn = (input_t *)&inputfifo[1][0]; diff --git a/polymer/eduke32/source/net.h b/polymer/eduke32/source/net.h index f1ee01322..281a75dc4 100644 --- a/polymer/eduke32/source/net.h +++ b/polymer/eduke32/source/net.h @@ -187,6 +187,7 @@ extern mapstate_t *g_multiMapState; int32_t Net_PackSprite(int32_t i,uint8_t *pbuf); int32_t Net_UnpackSprite(int32_t i,uint8_t *pbuf); +void Net_ClientMove(void); void Net_Connect(const char *srvaddr); void Net_Disconnect(void); void Net_EnterMessage(void); diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index 729f6dd96..9aa37500b 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -31,7 +31,7 @@ int32_t osdhightile = 0; void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal) { int16_t ac; -#if !defined(POLYMOST) || !defined(USE_OPENGL) +#ifndef USE_OPENGL int32_t usehightile = 0; #endif int32_t ht = usehightile; @@ -49,7 +49,7 @@ void GAME_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, int32_t shade, int16_t ac; char *ptr = OSD_GetTextPtr(); char *fmt = OSD_GetFmtPtr(); -#if !defined(POLYMOST) || !defined(USE_OPENGL) +#ifndef USE_OPENGL int32_t usehightile = 0; #endif int32_t ht = usehightile; diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 59ef7b88a..392ada811 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -2007,7 +2007,7 @@ static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shad if (orientation&4) a = 1024; -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL if (getrendermode() >= 3 && usemodels && md_tilehasmodel(tilenum,p) > 0) y += (224-weapsc(224)); #endif diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 43347b13c..59b1b28b4 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -489,7 +489,7 @@ void G_CacheMapData(void) if (waloff[i] == 0) loadtile((int16_t)i); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL // PRECACHE if (ud.config.useprecache) { diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 9311e11c0..d024c95ea 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -255,7 +255,7 @@ int32_t G_LoadPlayer(int32_t spot) if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt; #endif // POLYMER -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL for (i=0; igm = MODE_GAME; ud.recstat = 0; @@ -676,7 +676,7 @@ int32_t G_SavePlayer(int32_t spot) dfwrite(&numsectors,sizeof(numsectors),1,fil); dfwrite(§or[0],sizeof(sectortype),MAXSECTORS,fil); dfwrite(&sprite[0],sizeof(spritetype),MAXSPRITES,fil); -#if defined(POLYMOST) && defined(USE_OPENGL) +#ifdef USE_OPENGL for (i=0; i= 0 && j < MAXSECTORS) + if (j != SECT && (unsigned)j < MAXSECTORS) changespritesect(i,j); } } diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index ae95c173b..6e6da5209 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -386,7 +386,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) ((g_sounds[num].m&8) && ud.lockout) || ud.config.SoundToggle == 0 || g_sounds[num].num >= MAXSOUNDINSTANCES || - i < 0 || i >= MAXSPRITES || + (unsigned)i >= MAXSPRITES || FX_VoiceAvailable(g_sounds[num].pr) == 0 || (g_player[myconnectindex].ps->timebeforeexit > 0 && g_player[myconnectindex].ps->timebeforeexit <= GAMETICSPERSEC*3) || g_player[myconnectindex].ps->gm&MODE_MENU) return -1; @@ -458,6 +458,8 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) pitch -= 1024; break; default: + if (sndist > 32767 && PN != MUSICANDSFX && (g_sounds[num].m & 3) == 0) + return -1; if (g_player[screenpeek].ps->cursectnum > -1 && sector[g_player[screenpeek].ps->cursectnum].lotag == 2 && (g_sounds[num].m&4) == 0) pitch = -768; break; @@ -611,7 +613,7 @@ int32_t S_PlaySound(int32_t num) int32_t A_PlaySound(uint32_t num, int32_t i) { - if ((int32_t)num > g_maxSoundPos) return -1; + if ((unsigned)num > (unsigned)g_maxSoundPos) return -1; return i < 0 ? S_PlaySound(num) : S_PlaySound3D(num, i, (vec3_t *)&sprite[i]); } @@ -619,7 +621,7 @@ void S_StopEnvSound(int32_t num, int32_t i) { int32_t j, iter = 0; - if (num < 0 || num > g_maxSoundPos || g_sounds[num].num <= 0) + if ((unsigned)num > (unsigned)g_maxSoundPos || g_sounds[num].num <= 0) return; do @@ -690,7 +692,7 @@ void S_Update(void) { i = g_sounds[j].SoundOwner[k].i; - if (i < 0 || i >= MAXSPRITES || g_sounds[j].num == 0 || g_sounds[j].SoundOwner[k].voice <= FX_Ok) + if ((unsigned)i >= MAXSPRITES || g_sounds[j].num == 0 || g_sounds[j].SoundOwner[k].voice <= FX_Ok) continue; if (!FX_SoundActive(g_sounds[j].SoundOwner[k].voice)) @@ -734,9 +736,7 @@ void S_Update(void) break; } - if (g_sounds[j].m&16) sndist = 0; - - if (sndist < ((255-LOUDESTVOLUME)<<6)) + if (g_sounds[j].m&16 || sndist < ((255-LOUDESTVOLUME)<<6)) sndist = ((255-LOUDESTVOLUME)<<6); FX_Pan3D(g_sounds[j].SoundOwner[k].voice, sndang>>4, sndist>>6); diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index 16c83627e..028b1feb3 100644 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -95,7 +95,7 @@ static inline int32_t getfilenames(char *path) #define POPULATE_GAME 4 #define POPULATE_GAMEDIRS 8 -#if defined(POLYMOST) +#ifdef USE_OPENGL extern char TEXCACHEFILE[]; #endif