Consolidate POLYMOST preprocessor define into USE_OPENGL, remove SUPERBUILD preprocessor define, add additional mode to neartag() to skip sprite searches and speed up processing (and enable for CON_OPERATE), fix issue with nearby single instance sounds not playing due to out of range sounds blocking their playback, fix issue with settings.cfg being reset to default bindings when running a mod that specifies its own cfg base name, improve CON structure member interface read/write performance, fix a bug with CON "move" pointer validation

git-svn-id: https://svn.eduke32.com/eduke32@1820 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2011-03-04 08:50:58 +00:00
parent 012b620cae
commit 323008432a
44 changed files with 947 additions and 1107 deletions

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -1,7 +1,7 @@
#ifndef _polymost_h_
# define _polymost_h_
#ifdef POLYMOST
#ifdef USE_OPENGL
#include "hightile.h"

View file

@ -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 <gamma>: adjusts gamma ramp",(void *) &vid_gamma, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
{ "vid_contrast","vid_contrast <gamma>: adjusts gamma ramp",(void *) &vid_contrast, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
{ "vid_brightness","vid_brightness <gamma>: 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 <number>: sets the engine's rendering mode.\n"
"Mode numbers are:\n"
" 0 - Classic Build software\n"

View file

@ -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)
{

View file

@ -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

View file

@ -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;

View file

@ -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<MAXVOXELS; i++)
for (j=0; j<MAXVOXMIPS; j++)
@ -6313,7 +6300,6 @@ int32_t initengine(void)
for (i=0; i<MAXTILES; i++)
tiletovox[i] = -1;
clearbuf(&voxscale[0],sizeof(voxscale)>>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<ydim; i++)
writepcxline(ptr+i*bytesperline, xdim, 1, fil);
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
}
#endif
}
@ -13604,7 +13590,7 @@ int32_t screencapture_pcx(const char *filename, char inverseit)
enddrawing(); //}}}
// palette last
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (rendmode < 3 || (rendmode >= 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)

View file

@ -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"

View file

@ -1,6 +1,6 @@
//------------------------------------- MD2/MD3 LIBRARY BEGINS -------------------------------------
#ifdef POLYMOST
#ifdef USE_OPENGL
#include "compat.h"
#include "build.h"

View file

@ -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 = &sector[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);

View file

@ -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;

View file

@ -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);

View file

@ -22,7 +22,7 @@
#include <signal.h>
#include <stdarg.h>
#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)

View file

@ -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;

View file

@ -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

View file

@ -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 {<seconds>|now|tryfix}: sets auto corruption check interval if <seconds> given, otherwise as indicated", osdcmd_vars_pk);
#ifdef POLYMOST
#ifdef USE_OPENGL
OSD_RegisterFunction("tint", "tint <pal> <r> <g> <b> <flags>: 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
{

View file

@ -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 <cfgname>_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# ";

View file

@ -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);

View file

@ -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

View file

@ -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;
}

View file

@ -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

View file

@ -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;

File diff suppressed because it is too large Load diff

View file

@ -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
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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

View file

@ -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;

View file

@ -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];

View file

@ -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);

View file

@ -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;

View file

@ -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

View file

@ -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)
{

View file

@ -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; i<MAXSPRITES; i++)
if (spriteext[i].mdanimtims)
spriteext[i].mdanimtims+=mdtims;
@ -500,8 +500,8 @@ int32_t G_LoadPlayer(int32_t spot)
{
S_StopMusic();
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex);
S_PauseMusic(0);
}
S_PauseMusic(0);
g_player[myconnectindex].ps->gm = MODE_GAME;
ud.recstat = 0;
@ -676,7 +676,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&numsectors,sizeof(numsectors),1,fil);
dfwrite(&sector[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<MAXSPRITES; i++)
if (spriteext[i].mdanimtims)
{
@ -695,7 +695,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&i,sizeof(int32_t),1,fil);
#endif // POLYMER
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
for (i=0; i<MAXSPRITES; i++)if (spriteext[i].mdanimtims)spriteext[i].mdanimtims+=mdtims;
#endif
dfwrite(&headspritesect[0],sizeof(headspritesect[0]),MAXSECTORS+1,fil);
@ -1341,7 +1341,7 @@ static uint32_t calcsz(const dataspec_t *spec)
}
static void sv_postudload();
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
static void sv_prespriteextsave();
static void sv_postspriteext();
#endif
@ -1426,11 +1426,11 @@ static const dataspec_t svgm_secwsp[] =
{ 0, &headspritestat[0], sizeof(headspritestat[0]), MAXSTATUS+1 },
{ 0, &prevspritestat[0], sizeof(prevspritestat[0]), MAXSPRITES },
{ 0, &nextspritestat[0], sizeof(nextspritestat[0]), MAXSPRITES },
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
{ DS_SAVEFN, (void *)&sv_prespriteextsave, 0, 1 },
#endif
{ DS_DYNAMIC, &spriteext, sizeof(spriteext_t), MAXSPRITES },
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
{ DS_SAVEFN|DS_LOADFN, (void *)&sv_postspriteext, 0, 1 },
#endif
{ DS_NOCHK, &SpriteFlags[0], sizeof(SpriteFlags[0]), MAXTILES },
@ -1820,7 +1820,7 @@ static void sv_postudload()
}
//static int32_t lockclock_dummy;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
static void sv_prespriteextsave()
{
int32_t i;

View file

@ -2383,7 +2383,7 @@ void A_DamageObject(int32_t i,int32_t sn)
sprite[i].xvel = -(sprite[sn].extra<<2);
j = SECT;
pushmove((vec3_t *)&sprite[i],&j,128L,(4L<<8),(4L<<8),CLIPMASK0);
if (j != SECT && j >= 0 && j < MAXSECTORS)
if (j != SECT && (unsigned)j < MAXSECTORS)
changespritesect(i,j);
}
}

View file

@ -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);

View file

@ -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