Sanitize hard coded render mode numbers... replace all references to rendmode 0, 3, 4, etc with proper REND_CLASSIC, REND_POLYMOST, REND_POLYMER labels.

git-svn-id: https://svn.eduke32.com/eduke32@3784 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2013-05-17 03:44:09 +00:00
parent dc0b74e846
commit f8cc394fa3
17 changed files with 91 additions and 91 deletions

View file

@ -1359,7 +1359,7 @@ extern void initialize_engine_globals(void);
static inline void push_nofog(void) static inline void push_nofog(void)
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= REND_POLYMOST) if (getrendermode() >= REND_POLYMOST)
{ {
bglPushAttrib(GL_ENABLE_BIT); bglPushAttrib(GL_ENABLE_BIT);
bglDisable(GL_FOG); bglDisable(GL_FOG);
@ -1370,7 +1370,7 @@ static inline void push_nofog(void)
static inline void pop_nofog(void) static inline void pop_nofog(void)
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= REND_POLYMOST) if (getrendermode() >= REND_POLYMOST)
bglPopAttrib(); bglPopAttrib();
#endif #endif
} }

View file

@ -59,7 +59,7 @@ static inline float getshadefactor(int32_t shade)
{ {
int32_t shadebound = (shadescale_unbounded || shade>=numshades) ? numshades : numshades-1; int32_t shadebound = (shadescale_unbounded || shade>=numshades) ? numshades : numshades-1;
float clamped_shade = min(max(shade*shadescale, 0), shadebound); float clamped_shade = min(max(shade*shadescale, 0), shadebound);
if (rendmode == REND_POLYMOST && r_usetileshades && if (getrendermode() == REND_POLYMOST && r_usetileshades &&
(!usehightile || !hicfindsubst(globalpicnum, globalpal, 0)) && (!usehightile || !hicfindsubst(globalpicnum, globalpal, 0)) &&
(!usemodels || md_tilehasmodel(globalpicnum, globalpal) < 0)) return 1.f; (!usemodels || md_tilehasmodel(globalpicnum, globalpal) < 0)) return 1.f;
return ((float)(numshades-clamped_shade))/(float)numshades; return ((float)(numshades-clamped_shade))/(float)numshades;

View file

@ -446,7 +446,7 @@ void M32_ResetFakeRORTiles(void)
#ifdef POLYMER #ifdef POLYMER
# ifdef YAX_ENABLE # ifdef YAX_ENABLE
// END_TWEAK ceiling/floor fake 'TROR' pics, see BEGIN_TWEAK in engine.c // END_TWEAK ceiling/floor fake 'TROR' pics, see BEGIN_TWEAK in engine.c
if (rendmode==4 && showinvisibility) if (getrendermode() == REND_POLYMER && showinvisibility)
{ {
int32_t i; int32_t i;
@ -473,7 +473,7 @@ void M32_DrawRoomsAndMasks(void)
M32_ResetFakeRORTiles(); M32_ResetFakeRORTiles();
#ifdef POLYMER #ifdef POLYMER
if (rendmode == 4 && searchit == 2) if (getrendermode() == REND_POLYMER && searchit == 2)
{ {
polymer_editorpick(); polymer_editorpick();
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);

View file

@ -708,7 +708,7 @@ static int32_t defsparser(scriptfile *script)
} }
md_setmisc(lastmodelid,(float)scale, shadeoffs,0.0,0.0,0); md_setmisc(lastmodelid,(float)scale, shadeoffs,0.0,0.0,0);
# ifdef POLYMER # ifdef POLYMER
if (glrendmode==4) if (glrendmode == REND_POLYMER)
md3postload_polymer((md3model_t *)models[lastmodelid]); md3postload_polymer((md3model_t *)models[lastmodelid]);
# endif # endif
#endif #endif
@ -1345,7 +1345,7 @@ static int32_t defsparser(scriptfile *script)
} }
# endif # endif
if (glrendmode==4) if (glrendmode == REND_POLYMER)
md3postload_polymer((md3model_t *)models[lastmodelid]); md3postload_polymer((md3model_t *)models[lastmodelid]);
#endif #endif

View file

@ -803,7 +803,7 @@ void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore)
} }
#ifdef POLYMER #ifdef POLYMER
// will be called only in editor // will be called only in editor
if (rendmode==4) if (getrendermode() == REND_POLYMER)
{ {
if (!restore) if (!restore)
{ {
@ -4506,7 +4506,7 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i
// WGR2 SVN: select new episode after playing wgmicky1 with Polymer // WGR2 SVN: select new episode after playing wgmicky1 with Polymer
// (maybe switched to classic earlier). // (maybe switched to classic earlier).
// --> rendmode==0, glrendmode==4, we end up with globalpicnum==266, // --> rendmode==0, glgetrendermode() == REND_POLYMER, we end up with globalpicnum==266,
// picsiz...==9 and dapskybits==3 // picsiz...==9 and dapskybits==3
// FIXME ? // FIXME ?
if (k < 0) if (k < 0)
@ -5532,13 +5532,13 @@ static void drawsprite_opengl(int32_t snum)
{ {
//============================================================================= //POLYMOST BEGINS //============================================================================= //POLYMOST BEGINS
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode == 3) if (getrendermode() == REND_POLYMOST)
{ {
polymost_drawsprite(snum); polymost_drawsprite(snum);
bglDisable(GL_POLYGON_OFFSET_FILL); bglDisable(GL_POLYGON_OFFSET_FILL);
} }
# ifdef POLYMER # ifdef POLYMER
else if (rendmode == 4) else if (getrendermode() == REND_POLYMER)
{ {
bglEnable(GL_ALPHA_TEST); bglEnable(GL_ALPHA_TEST);
bglEnable(GL_BLEND); bglEnable(GL_BLEND);
@ -6559,9 +6559,9 @@ static void drawmaskwall(int16_t damaskwallcnt)
//============================================================================= //POLYMOST BEGINS //============================================================================= //POLYMOST BEGINS
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode == 3) { polymost_drawmaskwall(damaskwallcnt); return; } if (getrendermode() == REND_POLYMOST) { polymost_drawmaskwall(damaskwallcnt); return; }
# ifdef POLYMER # ifdef POLYMER
if (rendmode == 4) if (getrendermode() == REND_POLYMER)
{ {
bglEnable(GL_ALPHA_TEST); bglEnable(GL_ALPHA_TEST);
bglEnable(GL_BLEND); bglEnable(GL_BLEND);
@ -6670,7 +6670,7 @@ static void fillpolygon(int32_t npoints)
xb1[z] = 0; xb1[z] = 0;
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3 && qsetmode == 200) { polymost_fillpolygon(npoints); return; } if (getrendermode() >= REND_POLYMOST && qsetmode == 200) { polymost_fillpolygon(npoints); return; }
#endif #endif
miny = INT32_MAX; maxy = INT32_MIN; miny = INT32_MAX; maxy = INT32_MIN;
@ -7190,7 +7190,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t
//============================================================================= //POLYMOST BEGINS //============================================================================= //POLYMOST BEGINS
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3 && qsetmode == 200) if (getrendermode() >= REND_POLYMOST && qsetmode == 200)
{ {
polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,daalpha,cx1,cy1,cx2,cy2,uniqid); polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,daalpha,cx1,cy1,cx2,cy2,uniqid);
return; return;
@ -8819,7 +8819,7 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
#ifdef USE_OPENGL #ifdef USE_OPENGL
# ifdef POLYMER # ifdef POLYMER
if (rendmode == 4) if (getrendermode() == REND_POLYMER)
{ {
# ifdef YAX_ENABLE # ifdef YAX_ENABLE
// BEGIN_TWEAK ceiling/floor fake 'TROR' pics, see END_TWEAK in build.c // BEGIN_TWEAK ceiling/floor fake 'TROR' pics, see END_TWEAK in build.c
@ -8842,7 +8842,8 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
//============================================================================= //POLYMOST BEGINS //============================================================================= //POLYMOST BEGINS
polymost_drawrooms(); polymost_drawrooms();
if (rendmode)
if (getrendermode() != REND_CLASSIC)
return 0; return 0;
//============================================================================= //POLYMOST ENDS //============================================================================= //POLYMOST ENDS
#endif #endif
@ -9328,7 +9329,7 @@ killsprite:
} }
#ifdef POLYMER #ifdef POLYMER
if (rendmode == 4) if (getrendermode() == REND_POLYMER)
polymer_drawmasks(); polymer_drawmasks();
#endif #endif
@ -9729,7 +9730,7 @@ static int32_t finish_loadboard(const vec3_t *dapos, int16_t *dacursectnum, int1
Bmemset(spritesmooth, 0, sizeof(spritesmooth_t)*(MAXSPRITES+MAXUNIQHUDID)); Bmemset(spritesmooth, 0, sizeof(spritesmooth_t)*(MAXSPRITES+MAXUNIQHUDID));
# ifdef POLYMER # ifdef POLYMER
if (rendmode == 4) if (getrendermode() == REND_POLYMER)
{ {
if ((myflags&4)==0) if ((myflags&4)==0)
polymer_loadboard(); polymer_loadboard();
@ -10465,7 +10466,7 @@ int32_t loadmaphack(const char *filename)
light.publicflags.emitshadow = 1; light.publicflags.emitshadow = 1;
light.publicflags.negative = 0; light.publicflags.negative = 0;
if (rendmode == 4) if (getrendermode() == REND_POLYMER)
{ {
if (maphacklightcnt == PR_MAXLIGHTS) if (maphacklightcnt == PR_MAXLIGHTS)
{ {
@ -10755,7 +10756,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (dabpp > 8) rendmode = glrendmode; // GL renderer if (dabpp > 8) rendmode = glrendmode; // GL renderer
else if (dabpp == 8 && j > 8) rendmode = 0; // going from GL to software activates softpolymost else if (dabpp == 8 && j > 8) rendmode = REND_CLASSIC;
#endif #endif
xdim = daxdim; ydim = daydim; xdim = daxdim; ydim = daydim;
@ -10789,16 +10790,16 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); } if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); }
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
polymost_glreset(); polymost_glreset();
polymost_glinit(); polymost_glinit();
} }
# ifdef POLYMER # ifdef POLYMER
if (rendmode == 4) if (getrendermode() == REND_POLYMER)
{ {
if (!polymer_init()) if (!polymer_init())
rendmode = 3; rendmode = REND_POLYMOST;
} }
#endif #endif
#endif #endif
@ -14317,7 +14318,7 @@ void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags)
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
// Only reset the textures if the corresponding preserve flags are clear and // Only reset the textures if the corresponding preserve flags are clear and
// either (a) the new palette is different to the last, or (b) the brightness // either (a) the new palette is different to the last, or (b) the brightness
@ -14332,7 +14333,7 @@ void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags)
if (!(flags&8) && doinvalidate) if (!(flags&8) && doinvalidate)
gltexinvalidatetype(INVALIDATE_ART); gltexinvalidatetype(INVALIDATE_ART);
#ifdef POLYMER #ifdef POLYMER
if ((rendmode == 4) && doinvalidate) if ((getrendermode() == REND_POLYMER) && doinvalidate)
polymer_texinvalidate(); polymer_texinvalidate();
#endif #endif
} }
@ -14423,7 +14424,7 @@ void clearview(int32_t dacol)
if (qsetmode != 200) return; if (qsetmode != 200) return;
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
palette_t p = getpal(dacol); palette_t p = getpal(dacol);
@ -14461,7 +14462,7 @@ void clearallviews(int32_t dacol)
//dacol += (dacol<<8); dacol += (dacol<<16); //dacol += (dacol<<8); dacol += (dacol<<16);
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
palette_t p = getpal(dacol); palette_t p = getpal(dacol);
@ -14490,7 +14491,7 @@ void clearallviews(int32_t dacol)
void plotpixel(int32_t x, int32_t y, char col) void plotpixel(int32_t x, int32_t y, char col)
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3 && qsetmode == 200) if (getrendermode() >= REND_POLYMOST && qsetmode == 200)
{ {
palette_t p = getpal(col); palette_t p = getpal(col);
@ -14511,7 +14512,7 @@ void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, char c
int32_t i; int32_t i;
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3 && qsetmode == 200) if (getrendermode() >= REND_POLYMOST && qsetmode == 200)
{ {
palette_t p = getpal(col); palette_t p = getpal(col);
@ -14548,7 +14549,7 @@ char getpixel(int32_t x, int32_t y)
char r; char r;
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3 && qsetmode == 200) return 0; if (getrendermode() >= REND_POLYMOST && qsetmode == 200) return 0;
#endif #endif
begindrawing(); //{{{ begindrawing(); //{{{
@ -14577,7 +14578,7 @@ void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz)
bakrendmode = rendmode; bakrendmode = rendmode;
baktile = tilenume; baktile = tilenume;
} }
rendmode = 0;//2; rendmode = REND_CLASSIC;//2;
#endif #endif
copybufbyte(&startumost[windowx1],&bakumost[windowx1],(windowx2-windowx1+1)*sizeof(bakumost[0])); copybufbyte(&startumost[windowx1],&bakumost[windowx1],(windowx2-windowx1+1)*sizeof(bakumost[0]));
copybufbyte(&startdmost[windowx1],&bakdmost[windowx1],(windowx2-windowx1+1)*sizeof(bakdmost[0])); copybufbyte(&startdmost[windowx1],&bakdmost[windowx1],(windowx2-windowx1+1)*sizeof(bakdmost[0]));
@ -14680,7 +14681,7 @@ void preparemirror(int32_t dax, int32_t day, int16_t daang, int16_t dawall,
void completemirror(void) void completemirror(void)
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode) if (getrendermode() != REND_CLASSIC)
return; return;
#endif #endif
@ -15018,7 +15019,7 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
col = palookup[0][col]; col = palookup[0][col];
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
palette_t p = getpal(col); palette_t p = getpal(col);
@ -16327,7 +16328,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (!polymost_printext256(xpos,ypos,col,backcol,name,fontsize)) return; if (!polymost_printext256(xpos,ypos,col,backcol,name,fontsize)) return;
# if 0 # if 0
if (rendmode >= 3 && qsetmode == 200) if (getrendermode() >= REND_POLYMOST && qsetmode == 200)
{ {
int32_t xx, yy; int32_t xx, yy;
int32_t lc=-1; int32_t lc=-1;
@ -16474,7 +16475,7 @@ static int32_t screencapture_png(const char *filename, char inverseit, const cha
int32_t i; int32_t i;
BFILE *fp; BFILE *fp;
# ifdef USE_OPENGL # ifdef USE_OPENGL
# define HICOLOR (rendmode>=3 && qsetmode==200) # define HICOLOR (getrendermode() >= REND_POLYMOST && qsetmode==200)
# else # else
# define HICOLOR 0 # define HICOLOR 0
# endif # endif
@ -16638,7 +16639,7 @@ static int32_t screencapture_tga(const char *filename, char inverseit)
} }
# ifdef USE_OPENGL # ifdef USE_OPENGL
if (rendmode >= 3 && qsetmode == 200) if (getrendermode() >= REND_POLYMOST && qsetmode == 200)
{ {
head[1] = 0; // no colourmap head[1] = 0; // no colourmap
head[2] = 2; // uncompressed truecolour head[2] = 2; // uncompressed truecolour
@ -16663,7 +16664,7 @@ static int32_t screencapture_tga(const char *filename, char inverseit)
// palette first // palette first
# ifdef USE_OPENGL # ifdef USE_OPENGL
if (rendmode < 3 || (rendmode >= 3 && qsetmode != 200)) if (getrendermode() < REND_POLYMOST || (getrendermode() >= REND_POLYMOST && qsetmode != 200))
# endif # endif
{ {
//getpalette(0,256,palette); //getpalette(0,256,palette);
@ -16676,7 +16677,7 @@ static int32_t screencapture_tga(const char *filename, char inverseit)
} }
# ifdef USE_OPENGL # ifdef USE_OPENGL
if (rendmode >= 3 && qsetmode == 200) if (getrendermode() >= REND_POLYMOST && qsetmode == 200)
{ {
char c; char c;
// 24bit // 24bit
@ -16768,7 +16769,7 @@ int32_t setrendermode(int32_t renderer)
if (!polymer_init()) if (!polymer_init())
renderer = 3; renderer = 3;
} }
else if (rendmode==4) // going from Polymer to another renderer else if (getrendermode() == REND_POLYMER) // going from Polymer to another renderer
{ {
delete_maphack_lights(); delete_maphack_lights();
G_Polymer_UnInit(); G_Polymer_UnInit();
@ -16781,7 +16782,7 @@ int32_t setrendermode(int32_t renderer)
basepalreset = 1; basepalreset = 1;
rendmode = renderer; rendmode = renderer;
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
glrendmode = rendmode; glrendmode = rendmode;
#endif #endif
@ -16821,7 +16822,7 @@ void invalidatetile(int16_t tilenume, int32_t pal, int32_t how)
int32_t numpal, firstpal, np; int32_t numpal, firstpal, np;
int32_t hp; int32_t hp;
if (rendmode < 3) return; if (getrendermode() < REND_POLYMOST) return;
if (pal < 0) if (pal < 0)
{ {
@ -16857,7 +16858,7 @@ void invalidatetile(int16_t tilenume, int32_t pal, int32_t how)
void setpolymost2dview(void) void setpolymost2dview(void)
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode < 3) return; if (getrendermode() < REND_POLYMOST) return;
bglViewport(0,0,xres,yres); bglViewport(0,0,xres,yres);
bglMatrixMode(GL_PROJECTION); bglMatrixMode(GL_PROJECTION);

View file

@ -3353,7 +3353,7 @@ mdmodel_t *mdload(const char *filnam)
md3postload_common(vm3); md3postload_common(vm3);
#ifdef POLYMER #ifdef POLYMER
if (glrendmode!=4) if (glrendmode != REND_POLYMER)
if (!md3postload_polymer_check(vm3)) if (!md3postload_polymer_check(vm3))
{ {
mdfree(vm); mdfree(vm);

View file

@ -982,7 +982,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
float pos[3]; float pos[3];
pthtyp* pth; pthtyp* pth;
if (!rendmode) return; if (getrendermode() == REND_CLASSIC) return;
begindrawing(); begindrawing();

View file

@ -151,7 +151,7 @@ int32_t glpolygonmode = 0; // 0:GL_FILL,1:GL_LINE,2:GL_POINT //FUK
int32_t glwidescreen = 0; int32_t glwidescreen = 0;
int32_t glprojectionhacks = 1; int32_t glprojectionhacks = 1;
static GLuint polymosttext = 0; static GLuint polymosttext = 0;
int32_t glrendmode = 3; int32_t glrendmode = REND_POLYMOST;
// This variable, and 'shadeforfullbrightpass' control the drawing of // This variable, and 'shadeforfullbrightpass' control the drawing of
// fullbright tiles. Also see 'fullbrightloadingpass'. // fullbright tiles. Also see 'fullbrightloadingpass'.
@ -314,7 +314,7 @@ void gltexapplyprops(void)
int32_t i; int32_t i;
pthtyp *pth; pthtyp *pth;
if (rendmode == REND_CLASSIC) if (getrendermode() == REND_CLASSIC)
return; return;
if (glinfo.maxanisotropy > 1.0) if (glinfo.maxanisotropy > 1.0)
@ -1323,7 +1323,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
loadtile(globalpicnum); loadtile(globalpicnum);
if (!waloff[globalpicnum]) if (!waloff[globalpicnum])
{ {
if (rendmode < 3) return; if (getrendermode() < REND_POLYMOST) return;
tsizx = tsizy = 1; method = 1; //Hack to update Z-buffer for invalid mirror textures tsizx = tsizy = 1; method = 1; //Hack to update Z-buffer for invalid mirror textures
} }
} }
@ -1372,7 +1372,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
n = j; n = j;
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
float hackscx, hackscy; float hackscx, hackscy;
@ -1401,7 +1401,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
// If we aren't rendmode 3, we're in Polymer, which means this code is // If we aren't rendmode 3, we're in Polymer, which means this code is
// used for rotatesprite only. Polymer handles all the material stuff, // used for rotatesprite only. Polymer handles all the material stuff,
// just submit the geometry and don't mess with textures. // just submit the geometry and don't mess with textures.
if (rendmode == 3) if (getrendermode() == REND_POLYMOST)
{ {
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0); bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
@ -1722,7 +1722,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
texunits--; texunits--;
} }
if (rendmode == 3) if (getrendermode() == REND_POLYMOST)
{ {
if (srepeat) if (srepeat)
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
@ -1745,6 +1745,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
} }
#endif #endif
/*
if (rendmode == 1) if (rendmode == 1)
{ {
if (method&3) //Only draw border around sprites/maskwalls if (method&3) //Only draw border around sprites/maskwalls
@ -1757,6 +1758,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
//ox /= (double)n; oy /= (double)n; //ox /= (double)n; oy /= (double)n;
//for(i=0,j=n-1;i<n;j=i,i++) drawline2d(px[i]+(ox-px[i])*.125,py[i]+(oy-py[i])*.125,px[j]+(ox-px[j])*.125,py[j]+(oy-py[j])*.125,31); //for(i=0,j=n-1;i<n;j=i,i++) drawline2d(px[i]+(ox-px[i])*.125,py[i]+(oy-py[i])*.125,px[j]+(ox-px[j])*.125,py[j]+(oy-py[j])*.125,31);
} }
*/
} }
@ -2391,7 +2393,7 @@ static void polymost_drawalls(int32_t bunch)
{ {
//Parallaxing sky... hacked for Ken's mountain texture; paper-sky only :/ //Parallaxing sky... hacked for Ken's mountain texture; paper-sky only :/
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
calc_and_apply_fog_factor(sec->floorpicnum, sec->floorshade, sec->visibility, sec->floorpal, 0.005); calc_and_apply_fog_factor(sec->floorpicnum, sec->floorshade, sec->visibility, sec->floorpal, 0.005);
@ -2625,7 +2627,7 @@ static void polymost_drawalls(int32_t bunch)
#endif #endif
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
skyclamphack = 0; skyclamphack = 0;
if (!nofog) if (!nofog)
@ -2670,7 +2672,7 @@ static void polymost_drawalls(int32_t bunch)
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1))) else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1)))
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
calc_and_apply_fog_factor(sec->ceilingpicnum, sec->ceilingshade, sec->visibility, sec->ceilingpal, 0.005); calc_and_apply_fog_factor(sec->ceilingpicnum, sec->ceilingshade, sec->visibility, sec->ceilingpal, 0.005);
@ -2907,7 +2909,7 @@ static void polymost_drawalls(int32_t bunch)
#endif #endif
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
skyclamphack = 0; skyclamphack = 0;
if (!nofog) if (!nofog)
@ -3190,13 +3192,13 @@ void polymost_drawrooms()
int32_t i, j, n, n2, closest; int32_t i, j, n, n2, closest;
double ox, oy, oz, ox2, oy2, oz2, r, px[6], py[6], pz[6], px2[6], py2[6], pz2[6], sx[6], sy[6]; double ox, oy, oz, ox2, oy2, oz2, r, px[6], py[6], pz[6], px2[6], py2[6], pz2[6], sx[6], sy[6];
if (!rendmode) return; if (getrendermode() == REND_CLASSIC) return;
begindrawing(); begindrawing();
frameoffset = frameplace + windowy1*bytesperline + windowx1; frameoffset = frameplace + windowy1*bytesperline + windowx1;
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
resizeglcheck(); resizeglcheck();
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
@ -3502,7 +3504,7 @@ void polymost_drawrooms()
bunchlast[closest] = bunchlast[numbunches]; bunchlast[closest] = bunchlast[numbunches];
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
bglDepthFunc(GL_LEQUAL); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS bglDepthFunc(GL_LEQUAL); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
@ -3721,7 +3723,7 @@ void polymost_drawsprite(int32_t snum)
#ifdef USE_OPENGL #ifdef USE_OPENGL
calc_and_apply_fog(tspr->picnum, globalshade, sector[tspr->sectnum].visibility, sector[tspr->sectnum].floorpal); calc_and_apply_fog(tspr->picnum, globalshade, sector[tspr->sectnum].visibility, sector[tspr->sectnum].floorpal);
while (rendmode >= 3 && !(spriteext[spritenum].flags&SPREXT_NOTMD)) while (getrendermode() >= REND_POLYMOST && !(spriteext[spritenum].flags&SPREXT_NOTMD))
{ {
if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0) if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0)
{ {
@ -4153,7 +4155,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
#endif #endif
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3 && usemodels && hudmem[(dastat&4)>>2][picnum].angadd) if (getrendermode() >= REND_POLYMOST && usemodels && hudmem[(dastat&4)>>2][picnum].angadd)
{ {
const int32_t tilenum = Ptile2tile(picnum,dapalnum); const int32_t tilenum = Ptile2tile(picnum,dapalnum);
@ -4232,7 +4234,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
if (dastat&4) { x1 = -x1; y1 = -y1; } if (dastat&4) { x1 = -x1; y1 = -y1; }
// In Polymost, we don't care if the model is very big // In Polymost, we don't care if the model is very big
if (rendmode < 4) if (getrendermode() < REND_POLYMER)
{ {
tspr.xrepeat = tspr.yrepeat = 32; tspr.xrepeat = tspr.yrepeat = 32;
@ -4269,7 +4271,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
glox1 = -1; //Force fullscreen (glox1=-1 forces it to restore) glox1 = -1; //Force fullscreen (glox1=-1 forces it to restore)
} }
if (rendmode < 4) if (getrendermode() < REND_POLYMER)
{ {
bglMatrixMode(GL_PROJECTION); bglMatrixMode(GL_PROJECTION);
memset(m,0,sizeof(m)); memset(m,0,sizeof(m));
@ -4303,7 +4305,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
spriteext[tspr.owner].alpha = daalpha / 255.0f; spriteext[tspr.owner].alpha = daalpha / 255.0f;
if (!nofog) bglDisable(GL_FOG); if (!nofog) bglDisable(GL_FOG);
if (rendmode < 4) if (getrendermode() < REND_POLYMER)
mddraw(&tspr); mddraw(&tspr);
# ifdef POLYMER # ifdef POLYMER
else else
@ -4376,7 +4378,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
ogstang = gstang; gstang = 0.0; ogstang = gstang; gstang = 0.0;
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
bglViewport(0,0,xdim,ydim); glox1 = -1; //Force fullscreen (glox1=-1 forces it to restore) bglViewport(0,0,xdim,ydim); glox1 = -1; //Force fullscreen (glox1=-1 forces it to restore)
bglMatrixMode(GL_PROJECTION); bglMatrixMode(GL_PROJECTION);
@ -4392,7 +4394,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
bglEnable(GL_TEXTURE_2D); bglEnable(GL_TEXTURE_2D);
# ifdef POLYMER # ifdef POLYMER
if (rendmode >= 4) { if (getrendermode() == REND_POLYMER) {
polymer_inb4rotatesprite(picnum, dapalnum, dashade); polymer_inb4rotatesprite(picnum, dapalnum, dashade);
r_detailmapping = 0; r_detailmapping = 0;
r_glowmapping = 0; r_glowmapping = 0;
@ -4523,10 +4525,10 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
# ifdef POLYMER # ifdef POLYMER
if (rendmode >= 4) { if (getrendermode() == REND_POLYMER) {
r_detailmapping = olddetailmapping; r_detailmapping = olddetailmapping;
r_glowmapping = oldglowmapping; r_glowmapping = oldglowmapping;
polymer_postrotatesprite(); polymer_postrotatesprite();
@ -4765,7 +4767,7 @@ int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, i
int32_t i; int32_t i;
pthtyp *pth; pthtyp *pth;
if ((rendmode < 3) || (qsetmode != 200)) return(-1); if ((getrendermode() < REND_POLYMOST) || (qsetmode != 200)) return(-1);
if (!glinfo.texnpot) if (!glinfo.texnpot)
{ {
@ -4923,7 +4925,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
bricolor(&p, col); bricolor(&p, col);
bricolor(&b, arbackcol); bricolor(&b, arbackcol);
if ((rendmode < 3) || (qsetmode != 200)) return(-1); if ((getrendermode() < REND_POLYMOST) || (qsetmode != 200)) return(-1);
if (!polymosttext) if (!polymosttext)
{ {
@ -5226,7 +5228,7 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
// while sprites are clamped // while sprites are clamped
int32_t mid; int32_t mid;
if (rendmode < 3) return; if (getrendermode() < REND_POLYMOST) return;
if ((palookup[dapalnum] == NULL) && (dapalnum < (MAXPALOOKUPS - RESERVEDPALS))) return;//dapalnum = 0; if ((palookup[dapalnum] == NULL) && (dapalnum < (MAXPALOOKUPS - RESERVEDPALS))) return;//dapalnum = 0;

View file

@ -608,7 +608,7 @@ int32_t map_undoredo(int32_t dir)
Bassert(Numsprites == mapstate->num[2]); Bassert(Numsprites == mapstate->num[2]);
#ifdef POLYMER #ifdef POLYMER
if (qsetmode == 200 && rendmode == 4) if (qsetmode == 200 && getrendermode() == REND_POLYMER)
polymer_loadboard(); polymer_loadboard();
#endif #endif
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
@ -4071,7 +4071,7 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i
#ifdef USE_OPENGL #ifdef USE_OPENGL
setpolymost2dview(); setpolymost2dview();
if (rendmode >= 3) if (getrendermode() >= REND_POLYMOST)
{ {
bglEnable(GL_TEXTURE_2D); bglEnable(GL_TEXTURE_2D);
@ -4146,7 +4146,7 @@ restart:
enddrawing(); enddrawing();
showframe(1); showframe(1);
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3 && lazyselector) if (getrendermode() >= REND_POLYMOST && lazyselector)
bglDrawBuffer(GL_BACK); bglDrawBuffer(GL_BACK);
#endif #endif
return 1; return 1;
@ -4178,7 +4178,7 @@ restart:
showframe(1); showframe(1);
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3 && lazyselector) if (getrendermode() >= REND_POLYMOST && lazyselector)
bglDrawBuffer(GL_BACK); bglDrawBuffer(GL_BACK);
#endif #endif

View file

@ -537,7 +537,7 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows)
UNREFERENCED_PARAMETER(numcols); UNREFERENCED_PARAMETER(numcols);
# ifdef USE_OPENGL # ifdef USE_OPENGL
if (rendmode>=3 && qsetmode==200) if (getrendermode() >= REND_POLYMOST && qsetmode==200)
{ {
setpolymost2dview(); setpolymost2dview();
bglColor4f(0,0,0,0.67f); bglColor4f(0,0,0,0.67f);

View file

@ -653,8 +653,8 @@ int32_t CONFIG_ReadSetup(void)
#ifdef POLYMER #ifdef POLYMER
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Polymer", &dummy); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Polymer", &dummy);
if (dummy > 0 && ud.config.ScreenBPP >= 16) glrendmode = 4; if (dummy > 0 && ud.config.ScreenBPP >= 16) glrendmode = REND_POLYMER;
else glrendmode = 3; else glrendmode = REND_POLYMOST;
#endif #endif
/* /*
@ -793,7 +793,7 @@ void CONFIG_WriteSetup(uint32_t flags)
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad",ud.config.NoAutoLoad,FALSE,FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad",ud.config.NoAutoLoad,FALSE,FALSE);
#ifdef POLYMER #ifdef POLYMER
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == 4,FALSE,FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == REND_POLYMER,FALSE,FALSE);
#endif #endif
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP",ud.config.ScreenBPP,FALSE,FALSE); // JBF 20040523 SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP",ud.config.ScreenBPP,FALSE,FALSE); // JBF 20040523

View file

@ -416,7 +416,7 @@ static int32_t __fastcall VM_AccessTsprite(int32_t how, int32_t lVar1, int32_t l
} }
else else
{ {
// check whether rendmode==4 ? // check whether getrendermode() == REND_POLYMER ?
if ((unsigned)i >= PR_MAXLIGHTS) if ((unsigned)i >= PR_MAXLIGHTS)
{ {
M32_ERROR("invalid light index (%d)", i); M32_ERROR("invalid light index (%d)", i);

View file

@ -514,7 +514,7 @@ void G_CacheMapData(void)
if (k == MAXPALOOKUPS-RESERVEDPALS-1) if (k == MAXPALOOKUPS-RESERVEDPALS-1)
break; break;
#ifdef POLYMER #ifdef POLYMER
if (rendmode!=4 || !polymer_havehighpalookup(0, k)) if (getrendermode() != REND_POLYMER || !polymer_havehighpalookup(0, k))
#endif #endif
polymost_precache(i,k,type); polymost_precache(i,k,type);
} }
@ -524,7 +524,7 @@ void G_CacheMapData(void)
if (r_glowmapping && !KB_KeyPressed(sc_Space)) if (r_glowmapping && !KB_KeyPressed(sc_Space))
polymost_precache(i,GLOWPAL,type); polymost_precache(i,GLOWPAL,type);
#ifdef POLYMER #ifdef POLYMER
if (rendmode==4) if (getrendermode() == REND_POLYMER)
{ {
if (pr_specularmapping && !KB_KeyPressed(sc_Space)) if (pr_specularmapping && !KB_KeyPressed(sc_Space))
polymost_precache(i,SPECULARPAL,type); polymost_precache(i,SPECULARPAL,type);

View file

@ -343,7 +343,7 @@ int32_t G_SavePlayer(int32_t spot)
} }
#ifdef POLYMER #ifdef POLYMER
if (rendmode == 4) if (getrendermode() == REND_POLYMER)
polymer_resetlights(); polymer_resetlights();
#endif #endif

View file

@ -367,7 +367,7 @@ void G_AnimateCamSprite(void)
G_SetupCamTile(OW, TILE_VIEWSCR); G_SetupCamTile(OW, TILE_VIEWSCR);
#ifdef POLYMER #ifdef POLYMER
// HACK: force texture update on viewscreen sprite in Polymer! // HACK: force texture update on viewscreen sprite in Polymer!
if (rendmode==4) if (getrendermode() == REND_POLYMER)
sprite[i].filler ^= (1<<1); sprite[i].filler ^= (1<<1);
#endif #endif
} }

View file

@ -35,9 +35,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "common.h" #include "common.h"
#include "common_game.h" #include "common_game.h"
#define RDR_POLYMOST 3 // sould be defined elsewhere
#define RDR_POLYMER 4 // sould be defined elsewhere
enum enum
{ {
NONE, NONE,
@ -156,7 +153,7 @@ static void on_polymercheck_toggled(GtkToggleButton *togglebutton, gpointer user
UNREFERENCED_PARAMETER(user_data); UNREFERENCED_PARAMETER(user_data);
if (gtk_toggle_button_get_active(togglebutton)) if (gtk_toggle_button_get_active(togglebutton))
{ {
glrendmode = RDR_POLYMER; glrendmode = REND_POLYMER;
settings.polymer = TRUE; settings.polymer = TRUE;
if (settings.bpp3d == 8) if (settings.bpp3d == 8)
{ {
@ -166,7 +163,7 @@ static void on_polymercheck_toggled(GtkToggleButton *togglebutton, gpointer user
} }
else else
{ {
glrendmode = RDR_POLYMOST; glrendmode = REND_POLYMOST;
settings.polymer = FALSE; settings.polymer = FALSE;
} }
} }

View file

@ -741,7 +741,7 @@ int32_t startwin_run(void)
settings.flags = 0; settings.flags = 0;
if (ud.config.ScreenMode) settings.flags |= 1; if (ud.config.ScreenMode) settings.flags |= 1;
#ifdef POLYMER #ifdef POLYMER
if (glrendmode == 4) settings.flags |= 2; if (glrendmode == REND_POLYMER) settings.flags |= 2;
#endif #endif
if (ud.config.NoAutoLoad) settings.flags |= 4; if (ud.config.NoAutoLoad) settings.flags |= 4;
settings.xdim = ud.config.ScreenWidth; settings.xdim = ud.config.ScreenWidth;
@ -779,8 +779,8 @@ int32_t startwin_run(void)
{ {
ud.config.ScreenMode = (settings.flags&1); ud.config.ScreenMode = (settings.flags&1);
#ifdef POLYMER #ifdef POLYMER
if (settings.flags & 2) glrendmode = 4; if (settings.flags & 2) glrendmode = REND_POLYMER;
else glrendmode = 3; else glrendmode = REND_POLYMOST;
#endif #endif
if (settings.flags & 4) ud.config.NoAutoLoad = 1; if (settings.flags & 4) ud.config.NoAutoLoad = 1;
else ud.config.NoAutoLoad = 0; else ud.config.NoAutoLoad = 0;