diff --git a/polymer/eduke32/build/include/baselayer.h b/polymer/eduke32/build/include/baselayer.h index 1901bc53f..8c565ab8d 100644 --- a/polymer/eduke32/build/include/baselayer.h +++ b/polymer/eduke32/build/include/baselayer.h @@ -100,6 +100,11 @@ extern int32_t joyaxespresent; extern int32_t qsetmode; +static inline int32_t in3dmode(void) +{ + return (qsetmode==200); +} + int32_t initsystem(void); void uninitsystem(void); diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 5d1863faf..c5ed0051b 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -237,7 +237,7 @@ int32_t osdcmd_restartvid(const osdfuncparm_t *parm) { UNREFERENCED_PARAMETER(parm); - if (qsetmode != 200) return OSDCMD_OK; + if (!in3dmode()) return OSDCMD_OK; resetvideomode(); if (setgamemode(fullscreen,xdim,ydim,bpp)) @@ -279,7 +279,7 @@ static int32_t osdcmd_vidmode(const osdfuncparm_t *parm) return OSDCMD_SHOWHELP; } - if (qsetmode != 200) + if (!in3dmode()) { qsetmodeany(newx,newy); xdim2d = xdim; @@ -9030,10 +9030,10 @@ const char *getstring_simple(const char *querystr, const char *defaultstr, int32 while (1) { - if (qsetmode==200) + if (in3dmode()) getnumber_clearline(); - if (qsetmode==200) + if (in3dmode()) printext256(0, 0, whitecol, 0, buf, 0); else _printmessage16("%s", buf); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 51eee2094..86dabd8bb 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -6670,7 +6670,7 @@ static void fillpolygon(int32_t npoints) xb1[z] = 0; #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && qsetmode == 200) { polymost_fillpolygon(npoints); return; } + if (getrendermode() >= REND_POLYMOST && in3dmode()) { polymost_fillpolygon(npoints); return; } #endif 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 #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && qsetmode == 200) + if (getrendermode() >= REND_POLYMOST && in3dmode()) { polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,daalpha,cx1,cy1,cx2,cy2,uniqid); return; @@ -10733,7 +10733,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da daxdim = max(320, daxdim); daydim = max(200, daydim); - if ((qsetmode == 200) && (videomodereset == 0) && + if (in3dmode() && videomodereset == 0 && (davidoption == fullscreen) && (xdim == daxdim) && (ydim == daydim) && (bpp == dabpp)) return(0); @@ -14438,7 +14438,7 @@ void clearview(int32_t dacol) intptr_t p; int32_t y, dx; - if (qsetmode != 200) return; + if (!in3dmode()) return; #ifdef USE_OPENGL if (getrendermode() >= REND_POLYMOST) @@ -14475,7 +14475,7 @@ void clearview(int32_t dacol) // void clearallviews(int32_t dacol) { - if (qsetmode != 200) return; + if (!in3dmode()) return; //dacol += (dacol<<8); dacol += (dacol<<16); #ifdef USE_OPENGL @@ -14508,7 +14508,7 @@ void clearallviews(int32_t dacol) void plotpixel(int32_t x, int32_t y, char col) { #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && qsetmode == 200) + if (getrendermode() >= REND_POLYMOST && in3dmode()) { palette_t p = getpal(col); @@ -14529,7 +14529,7 @@ void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, char c int32_t i; #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && qsetmode == 200) + if (getrendermode() >= REND_POLYMOST && in3dmode()) { palette_t p = getpal(col); @@ -14566,7 +14566,7 @@ char getpixel(int32_t x, int32_t y) char r; #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && qsetmode == 200) return 0; + if (getrendermode() >= REND_POLYMOST && in3dmode()) return 0; #endif begindrawing(); //{{{ @@ -16052,7 +16052,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z uint8_t *graybitmap = (uint8_t *)tempbuf; int32_t alwaysshowgray = get_alwaysshowgray(); - if (qsetmode == 200) return; + if (in3dmode()) return; setup_sideview_sincos(); @@ -16345,7 +16345,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const #ifdef USE_OPENGL if (!polymost_printext256(xpos,ypos,col,backcol,name,fontsize)) return; # if 0 - if (getrendermode() >= REND_POLYMOST && qsetmode == 200) + if (getrendermode() >= REND_POLYMOST && in3dmode()) { int32_t xx, yy; int32_t lc=-1; @@ -16492,7 +16492,7 @@ static int32_t screencapture_png(const char *filename, char inverseit, const cha int32_t i; BFILE *fp; # ifdef USE_OPENGL -# define HICOLOR (getrendermode() >= REND_POLYMOST && qsetmode==200) +# define HICOLOR (getrendermode() >= REND_POLYMOST && in3dmode()) # else # define HICOLOR 0 # endif @@ -16656,7 +16656,7 @@ static int32_t screencapture_tga(const char *filename, char inverseit) } # ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && qsetmode == 200) + if (getrendermode() >= REND_POLYMOST && in3dmode()) { head[1] = 0; // no colourmap head[2] = 2; // uncompressed truecolour @@ -16681,7 +16681,7 @@ static int32_t screencapture_tga(const char *filename, char inverseit) // palette first # ifdef USE_OPENGL - if (getrendermode() < REND_POLYMOST || (getrendermode() >= REND_POLYMOST && qsetmode != 200)) + if (getrendermode() < REND_POLYMOST || (getrendermode() >= REND_POLYMOST && !in3dmode())) # endif { //getpalette(0,256,palette); @@ -16694,7 +16694,7 @@ static int32_t screencapture_tga(const char *filename, char inverseit) } # ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && qsetmode == 200) + if (getrendermode() >= REND_POLYMOST && in3dmode()) { char c; // 24bit diff --git a/polymer/eduke32/build/src/osd.c b/polymer/eduke32/build/src/osd.c index 345dda684..81560fef3 100644 --- a/polymer/eduke32/build/src/osd.c +++ b/polymer/eduke32/build/src/osd.c @@ -323,6 +323,7 @@ static inline void swapptr(void *a, void *b) void OSD_SetTextMode(int32_t mode) { osdtextmode = (mode != 0); + if (osdtextmode) { if (drawosdchar != _internal_drawosdchar) @@ -342,7 +343,8 @@ void OSD_SetTextMode(int32_t mode) swapptr(&_getcolumnwidth,&getcolumnwidth); swapptr(&_getrowheight,&getrowheight); } - if (qsetmode == 200) + + if (in3dmode()) OSD_ResizeDisplay(xdim, ydim); } diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 5dc789221..2d824ef92 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -4767,7 +4767,7 @@ int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, i int32_t i; pthtyp *pth; - if ((getrendermode() < REND_POLYMOST) || (qsetmode != 200)) return(-1); + if (getrendermode() < REND_POLYMOST || !in3dmode()) return(-1); if (!glinfo.texnpot) { @@ -4925,7 +4925,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba bricolor(&p, col); bricolor(&b, arbackcol); - if ((getrendermode() < REND_POLYMOST) || (qsetmode != 200)) return(-1); + if (getrendermode() < REND_POLYMOST || !in3dmode()) return(-1); if (!polymosttext) { diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index f4c4ed8aa..ec91fd54f 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -608,7 +608,7 @@ int32_t map_undoredo(int32_t dir) Bassert(Numsprites == mapstate->num[2]); #ifdef POLYMER - if (qsetmode == 200 && getrendermode() == REND_POLYMER) + if (in3dmode() && getrendermode() == REND_POLYMER) polymer_loadboard(); #endif #ifdef YAX_ENABLE @@ -1246,13 +1246,13 @@ const char *ExtGetSectorCaption(int16_t sectnum) Bmemset(tempbuf, 0, sizeof(tempbuf)); - if (qsetmode != 200 && ((onnames!=1 && onnames!=4 && onnames!=7) || onnames==8)) + if (!in3dmode() && ((onnames!=1 && onnames!=4 && onnames!=7) || onnames==8)) return tempbuf; - if (qsetmode == 200 || (sector[sectnum].lotag|sector[sectnum].hitag)) + if (in3dmode() || (sector[sectnum].lotag|sector[sectnum].hitag)) { Bstrcpy(lo, ExtGetSectorType(sector[sectnum].lotag)); - if (qsetmode != 200) + if (!in3dmode()) Bsprintf_nowarn(tempbuf,"%hu,%hu %s", TrackerCast(sector[sectnum].hitag), TrackerCast(sector[sectnum].lotag), lo); else Bsprintf_nowarn(tempbuf,"%hu %s", TrackerCast(sector[sectnum].lotag), lo); @@ -1506,7 +1506,7 @@ void ExtShowSectorData(int16_t sectnum) //F5 int32_t totalrespawn=0; UNREFERENCED_PARAMETER(sectnum); - if (qsetmode==200) + if (in3dmode()) return; for (i=0; i= REND_POLYMOST && qsetmode==200 && lazyselector) + if (getrendermode() >= REND_POLYMOST && in3dmode() && lazyselector) { if (runi==0) { @@ -9409,7 +9409,7 @@ static int32_t osdcmd_do(const osdfuncparm_t *parm) insptr = script + oscrofs; Bmemcpy(&vm, &vm_default, sizeof(vmstate_t)); - if (qsetmode==200 && AIMING_AT_SPRITE) + if (in3dmode() && AIMING_AT_SPRITE) { vm.g_i = searchwall; vm.g_sp = &sprite[vm.g_i]; @@ -10543,7 +10543,7 @@ void ExtPreCheckKeys(void) // just before drawrooms { int32_t i = 0, ii; - if (qsetmode == 200) //In 3D mode + if (in3dmode()) { if (shadepreview) { @@ -11058,7 +11058,7 @@ static void Keys2d3d(void) #endif if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(A)) // 'A { - if (qsetmode == 200) + if (in3dmode()) autosave = autosave?0:getnumber256("Autosave interval, in seconds: ",180,3600,0); else autosave = autosave?0:getnumber16("Autosave interval, in seconds: ",180,3600,0); @@ -11084,7 +11084,7 @@ static void Keys2d3d(void) if (eitherCTRL) //CTRL { - if (qsetmode != 200) + if (!in3dmode()) if (PRESSED_KEYSC(P)) // Ctrl-P: Map playtesting test_map(eitherALT); @@ -11146,7 +11146,7 @@ static void Keys2d3d(void) if (getmessageleng > 0) { - if (qsetmode != 200) + if (!in3dmode()) printmessage16("%s", getmessage); if (totalclock > getmessagetimeoff) getmessageleng = 0; @@ -11175,7 +11175,7 @@ void ExtCheckKeys(void) soundinit = 1; } - if (qsetmode == 200 && shadepreview) + if (in3dmode() && shadepreview) { int32_t i = 0, ii; int32_t w, isec, start_wall, end_wall; @@ -11233,7 +11233,7 @@ void ExtCheckKeys(void) Keys2d3d(); - if (qsetmode == 200) //In 3D mode + if (in3dmode()) { Keys3d(); editinput(); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 0dfac9b21..8cd052f4c 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -2150,7 +2150,7 @@ static void G_DisplayExtraScreens(void) } } -extern int32_t qsetmode; + extern int32_t g_doQuickSave; void G_GameExit(const char *msg) @@ -2181,7 +2181,7 @@ void G_GameExit(const char *msg) if (*msg != 0) initprintf("%s\n",msg); - if (qsetmode == 200) + if (in3dmode()) G_Shutdown(); if (*msg != 0) diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index c2dd75b75..f35b4511d 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -255,7 +255,6 @@ extern int32_t hud_glowingquotes; extern int32_t hud_showmapname; extern int32_t lastvisinc; extern int32_t rts_numlumps; -extern int32_t qsetmode; extern int32_t quotebot; extern int32_t quotebotgoal; extern int32_t r_maxfps; diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index 91e2ff334..7bbda50f6 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -116,7 +116,7 @@ void M32_PostScriptExec(void) if (vm.miscflags&VMFLAG_MISC_UPDATEHLSECT) { update_highlightsector(); - if (qsetmode != 200) + if (!in3dmode()) ovh_whiteoutgrab(1); vm.miscflags &= ~VMFLAG_MISC_UPDATEHLSECT; } @@ -2377,7 +2377,7 @@ badindex: //OSD_Printf("max:%d, sign:%d\n", max, sign); if (tw==CON_GETNUMBERFROMUSER) { - Gv_SetVarX(var, (qsetmode==200) ? + Gv_SetVarX(var, in3dmode() ? getnumber256(quotetext, Gv_GetVarX(var), max, sign) : getnumber16(quotetext, Gv_GetVarX(var), max, sign)); } @@ -2424,17 +2424,17 @@ badindex: } else if (tw==CON_PRINTMESSAGE16) { - if (qsetmode != 200) + if (!in3dmode()) printmessage16("%s", quotetext); } else if (tw==CON_PRINTMESSAGE256) { - if (qsetmode == 200) + if (in3dmode()) printmessage256(x, y, quotetext); } else if (tw==CON_PRINTEXT256) { - if (qsetmode == 200) + if (in3dmode()) { if (col>=256) col=0; @@ -2449,13 +2449,13 @@ badindex: } else if (tw==CON_PRINTEXT16) { - if (qsetmode != 200) + if (!in3dmode()) printext16(x, y, editorcolors[col&255], backcol<0 ? -1 : editorcolors[backcol&255], quotetext, fontsize); } else if (tw==CON_DRAWLABEL) { - if (qsetmode != 200) + if (!in3dmode()) { drawsmallabel(quotetext, editorcolors[backcol&255], // col @@ -2976,15 +2976,15 @@ dodefault: continue; case CON_IFIN3DMODE: - VM_DoConditional(qsetmode==200); + VM_DoConditional(in3dmode()); continue; // ifaimingsprite and -wall also work in 2d mode, but you must "and" with 16383 yourself case CON_IFAIMINGSPRITE: - VM_DoConditional(AIMING_AT_SPRITE || (qsetmode!=200 && pointhighlight>=16384)); + VM_DoConditional(AIMING_AT_SPRITE || (!in3dmode() && pointhighlight>=16384)); continue; case CON_IFAIMINGWALL: - VM_DoConditional(AIMING_AT_WALL_OR_MASK || (qsetmode!=200 && linehighlight>=0)); + VM_DoConditional(AIMING_AT_WALL_OR_MASK || (!in3dmode() && linehighlight>=0)); continue; case CON_IFAIMINGSECTOR: VM_DoConditional(AIMING_AT_CEILING_OR_FLOOR); diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index b9a4f9a1b..342f428fe 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -580,7 +580,7 @@ void G_SetupCamTile(int32_t i,int32_t wn) void G_UpdateScreenArea(void) { - if (qsetmode != 200) + if (!in3dmode()) return; ud.screen_size = clamp(ud.screen_size, 0, 64);