Replace inline "qsetmode==200" checks with in3dmode().

Analogously for the negation; remove a couple of redundant decls of "qsetmode".

git-svn-id: https://svn.eduke32.com/eduke32@3823 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-05-30 09:13:32 +00:00
parent 1715b7631f
commit 560f88b022
10 changed files with 64 additions and 58 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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<numsectors; i++)
@ -1631,7 +1631,7 @@ void ExtShowWallData(int16_t wallnum) //F6
UNREFERENCED_PARAMETER(wallnum);
if (qsetmode==200)
if (in3dmode())
return;
clearmidstatbar16();
@ -1777,10 +1777,10 @@ void ExtShowWallData(int16_t wallnum) //F6
// formerly Show2dText and Show3dText
static void ShowFileText(const char *name)
{
int32_t fp,t, in3dmode=(qsetmode==200);
int32_t fp,t;
uint8_t x=0,y=4,xmax=0,xx=0,col=0;
if (!in3dmode)
if (!in3dmode())
{
clearmidstatbar16();
drawgradient();
@ -1789,7 +1789,7 @@ static void ShowFileText(const char *name)
if ((fp=kopen4load(name,0)) == -1)
{
Bsprintf(tempbuf, "ERROR: file \"%s\" not found.", name);
if (in3dmode)
if (in3dmode())
printext256(1*4,4*8,whitecol,-1,tempbuf,0);
else
printext16(1*4,ydim-STATUS2DSIZ+4*8,editorcolors[11],-1,tempbuf,0);
@ -1813,7 +1813,7 @@ static void ShowFileText(const char *name)
}
tempbuf[x]=0;
if (in3dmode)
if (in3dmode())
printext256(xx*4,(y*6)+2,whitecol,-1,tempbuf,1);
else
printext16(xx*4,ydim-STATUS2DSIZ+(y*6)+2,editorcolors[11],-1,tempbuf,1);
@ -2611,7 +2611,7 @@ static void M32_MoveFX(void)
void ExtShowSpriteData(int16_t spritenum) //F6
{
UNREFERENCED_PARAMETER(spritenum);
if (qsetmode != 200)
if (!in3dmode())
ShowFileText("sehelp.hlp");
}
@ -2816,7 +2816,7 @@ static void SE40Code(int32_t x,int32_t y,int32_t z,int32_t a,int32_t h)
void ExtEditSectorData(int16_t sectnum) //F7
{
if (qsetmode == 200)
if (in3dmode())
return;
if (eitherALT) //ALT
@ -2836,7 +2836,7 @@ void ExtEditSectorData(int16_t sectnum) //F7
void ExtEditWallData(int16_t wallnum) //F8
{
if (qsetmode==200)
if (in3dmode())
return;
if (eitherALT) //ALT
@ -2861,7 +2861,7 @@ static void GenericSpriteSearch(void);
void ExtEditSpriteData(int16_t spritenum) //F8
{
if (qsetmode==200)
if (in3dmode())
return;
if (eitherALT) //ALT
@ -2991,7 +2991,7 @@ static int32_t AskIfSure(const char *text)
{
int32_t retval=1;
if (qsetmode == 200)
if (in3dmode())
{
begindrawing(); //{{{
printext256(0,0,whitecol,0,text?text:"Are you sure you want to proceed?",0);
@ -4161,7 +4161,7 @@ restart:
tilescreen_drawrest(iSelected, showmsg);
if (getrendermode() >= 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();

View file

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

View file

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

View file

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

View file

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