From fedfc2cfa4280730a5456b01401285022554d20f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 20 Mar 2021 16:46:06 +0100 Subject: [PATCH] - removed global variables that were only being used by the automap drawer plus a few other obsolete things. --- source/build/include/build.h | 31 ------------------------ source/build/src/clip.cpp | 1 + source/build/src/engine.cpp | 11 --------- source/build/src/engine_priv.h | 24 ------------------ source/core/rendering/scene/hw_flats.cpp | 2 ++ source/core/rendering/scene/hw_walls.cpp | 4 +++ 6 files changed, 7 insertions(+), 66 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 0a845dec0..6b49ec136 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -648,21 +648,12 @@ static FORCE_INLINE int32_t spriteheightofs(int16_t i, int32_t *height, int32_t int videoCaptureScreen(); -struct OutputFileCounter { - uint16_t count = 0; - FileWriter *opennextfile(char *, char *); - FileWriter *opennextfile_withext(char *, const char *); -}; - // PLAG: line utility functions typedef struct s_equation { float a, b, c; } _equation; -#define STATUS2DSIZ 144 -#define STATUS2DSIZ2 26 - #ifdef USE_OPENGL void renderSetRollAngle(float rolla); #endif @@ -670,21 +661,6 @@ void renderSetRollAngle(float rolla); void PrecacheHardwareTextures(int nTile); void Polymost_Startup(); -typedef uint16_t polytintflags_t; - -enum cutsceneflags { - CUTSCENE_FORCEFILTER = 1, - CUTSCENE_FORCENOFILTER = 2, - CUTSCENE_TEXTUREFILTER = 4, -}; - -enum { - TEXFILTER_OFF = 0, // GL_NEAREST - TEXFILTER_ON = 5, // GL_LINEAR_MIPMAP_LINEAR -}; - -extern int32_t gltexmaxsize; - EXTERN_CVAR(Bool, hw_animsmoothing) EXTERN_CVAR(Bool, hw_hightile) EXTERN_CVAR(Bool, hw_models) @@ -696,7 +672,6 @@ EXTERN_CVAR(Bool, hw_useindexedcolortextures) EXTERN_CVAR(Bool, hw_parallaxskypanning) EXTERN_CVAR(Bool, r_voxels) -extern int32_t r_downsize; extern int32_t mdtims, omdtims; extern int32_t r_rortexture; @@ -709,8 +684,6 @@ int32_t md_loadmodel(const char *fn); int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, float yoffset, int32_t flags); // int32_t md_tilehasmodel(int32_t tilenume, int32_t pal); -extern TArray g_clipMapFiles; - EXTERN int32_t nextvoxid; EXTERN int8_t voxreserve[(MAXVOXELS+7)>>3]; EXTERN int8_t voxrotate[(MAXVOXELS+7)>>3]; @@ -764,10 +737,6 @@ int32_t md_undefinemodel(int32_t modelid); int32_t loaddefinitionsfile(const char *fn, bool loadadds = false); -// if loadboard() fails with -2 return, try loadoldboard(). if it fails with -// -2, board is dodgy -int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); - #ifdef USE_OPENGL # include "polymost.h" #endif diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 6e12a63d4..21280b865 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -12,6 +12,7 @@ #include "printf.h" #include "gamefuncs.h" +enum { MAXCLIPDIST = 1024 }; static int16_t clipnum; static linetype clipit[MAXCLIPNUM]; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 121feb328..ac425c089 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -72,10 +72,6 @@ int32_t globalflags; static int8_t tempbuf[MAXWALLS]; -// referenced from asm -intptr_t asm1, asm2; -int32_t globalx1, globaly2, globalx3, globaly3; - static int32_t no_radarang2 = 0; static int16_t radarang[1280]; static int32_t qradarang[10240]; @@ -144,10 +140,7 @@ static void getclosestpointonwall_internal(vec2_t const p, int32_t const dawall, *closest = { (int32_t)(w.x + ((d.x * i) >> 30)), (int32_t)(w.y + ((d.y * i) >> 30)) }; } -int32_t xb1[MAXWALLSB]; // Polymost uses this as a temp array -int32_t rx1[MAXWALLSB], ry1[MAXWALLSB]; int16_t bunchp2[MAXWALLSB], thesector[MAXWALLSB]; - int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; @@ -178,8 +171,6 @@ static int32_t globaly1, globalx2; int16_t sectorborder[256]; int16_t pointhighlight=-1, linehighlight=-1, highlightcnt=0; -int32_t halfxdim16, midydim16; - static_assert(MAXWALLSB < INT16_MAX); int16_t numscans, numbunches; static int16_t numhits; @@ -187,8 +178,6 @@ static int16_t numhits; char inpreparemirror = 0; static int32_t mirrorsx1, mirrorsy1, mirrorsx2, mirrorsy2; -#define MAXSETVIEW 4 - // // Internal Engine Functions diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index 853664c74..3210d04d5 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -13,28 +13,6 @@ #ifndef ENGINE_PRIV_H #define ENGINE_PRIV_H -#define MAXARTFILES_BASE 200 -#define MAXARTFILES_TOTAL 220 -#define MAXCLIPDIST 1024 - -// Uncomment to clear the screen before each top-level draw (classic only). -// FIXME: doesn't work with mirrors. -//#define ENGINE_CLEAR_SCREEN - - extern intptr_t asm1, asm2; - extern int32_t globalx1, globaly2; - - - -static inline int32_t getclipmask(int32_t a, int32_t b, int32_t c, int32_t d) -{ - // Ken did this - d = ((a<0)<<3) + ((b<0)<<2) + ((c<0)<<1) + (d<0); - return (((d<<4)^0xf0)|d); -} - - - extern int16_t thesector[MAXWALLSB], thewall[MAXWALLSB]; extern int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; extern int16_t maskwall[MAXWALLSB], maskwallcnt; @@ -58,8 +36,6 @@ extern char inpreparemirror; extern int16_t sectorborder[256]; extern int32_t hitallsprites; -extern int32_t xb1[MAXWALLSB]; -extern int32_t rx1[MAXWALLSB], ry1[MAXWALLSB]; extern int16_t bunchp2[MAXWALLSB]; extern int16_t numscans, numbunches; diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index 89a204a3c..a2c61a4a6 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -256,6 +256,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int which) if (alpha != 0.f) { int tilenum = frontsector->floorpicnum; + setgotpic(tilenum); tileUpdatePicnum(&tilenum, tilenum, 0); texture = tileGetTexture(tilenum); if (texture && texture->isValid()) @@ -296,6 +297,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int which) //iboindex = frontsector->iboindex[sector_t::ceiling]; int tilenum = frontsector->ceilingpicnum; + setgotpic(tilenum); tileUpdatePicnum(&tilenum, tilenum, 0); texture = tileGetTexture(tilenum); if (texture && texture->isValid()) diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 9666dc914..7d515b03b 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -984,6 +984,7 @@ void HWWall::Process(HWDrawInfo *di, walltype *wal, sectortype* frontsector, sec // normal texture int tilenum = (wal->cstat & CSTAT_WALL_1WAY) ? wal->overpicnum : wal->picnum; + setgotpic(tilenum); tileUpdatePicnum(&tilenum, int(wal-wall) + 16384, wal->cstat); texture = tileGetTexture(tilenum); if (texture && texture->isValid()) @@ -1021,6 +1022,7 @@ void HWWall::Process(HWDrawInfo *di, walltype *wal, sectortype* frontsector, sec if (bch1a < fch1 || bch2a < fch2) { int tilenum = wal->picnum; + setgotpic(tilenum); tileUpdatePicnum(&tilenum, int(wal - wall) + 16384, wal->cstat); texture = tileGetTexture(tilenum); if (texture && texture->isValid()) @@ -1045,6 +1047,7 @@ void HWWall::Process(HWDrawInfo *di, walltype *wal, sectortype* frontsector, sec if (wal->cstat & (CSTAT_WALL_MASKED | CSTAT_WALL_1WAY)) { int tilenum = wal->overpicnum; + setgotpic(tilenum); tileUpdatePicnum(&tilenum, int(wal - wall) + 16384, wal->cstat); texture = tileGetTexture(tilenum); if (texture && texture->isValid()) @@ -1067,6 +1070,7 @@ void HWWall::Process(HWDrawInfo *di, walltype *wal, sectortype* frontsector, sec { auto w = (wal->cstat & CSTAT_WALL_BOTTOM_SWAP) ? backwall : wal; int tilenum = w->picnum; + setgotpic(tilenum); tileUpdatePicnum(&tilenum, int(wal - wall) + 16384, w->cstat); texture = tileGetTexture(tilenum); if (texture && texture->isValid())