diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index 1e6ce125e..295e78c56 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -49,6 +49,42 @@ extern int32_t nofog; void calc_ylookup(int32_t bpl, int32_t lastyidx); +int32_t videoCheckMode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced); +int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs); +void videoGetModes(void); +void videoResetMode(void); +void videoEndDrawing(void); +void videoShowFrame(int32_t); +int32_t videoUpdatePalette(int32_t start, int32_t num); +int32_t videoSetGamma(void); +int32_t videoSetVsync(int32_t newSync); + +//#define DEBUG_FRAME_LOCKING +#if !defined DEBUG_FRAME_LOCKING +void videoBeginDrawing(void); +#else +void begindrawing_real(void); +# define BEGINDRAWING_SIZE 256 +extern uint32_t begindrawing_line[BEGINDRAWING_SIZE]; +extern const char *begindrawing_file[BEGINDRAWING_SIZE]; +extern int32_t lockcount; +# define videoBeginDrawing() do { \ + if (lockcount < BEGINDRAWING_SIZE) { \ + begindrawing_line[lockcount] = __LINE__; \ + begindrawing_file[lockcount] = __FILE__; \ + } \ + begindrawing_real(); \ +} while(0) +#endif + +extern float g_videoGamma, g_videoContrast, g_videoBrightness; + +#define DEFAULT_GAMMA 1.0f +#define DEFAULT_CONTRAST 1.0f +#define DEFAULT_BRIGHTNESS 0.0f + +#define GAMMA_CALC ((int32_t)(min(max((float)((g_videoGamma - 1.0f) * 10.0f), 0.f), 15.f))) + #ifdef USE_OPENGL extern int32_t (*baselayer_osdcmd_vidmode_func)(osdfuncparm_t const * const parm); extern int32_t osdcmd_glinfo(osdfuncparm_t const * const parm); @@ -86,7 +122,6 @@ struct glinfo_t { extern struct glinfo_t glinfo; #endif -extern int32_t setvsync(int32_t newSync); extern vec2_t const g_defaultVideoModes[]; extern char inputdevices; @@ -189,69 +224,31 @@ void keyFlushChars(void); int32_t mouseInit(void); void mouseUninit(void); +int32_t mouseReadAbs(vec2_t *const destination, vec2_t const *const source); void mouseGrabInput(char a); void mouseLockToWindow(char a); -void mouseReadPos(int32_t *x, int32_t *y); -int32_t mouseReadAbs(vec2_t * const destination, vec2_t const * const source); void mouseReadButtons(int32_t *b); +void mouseReadPos(int32_t *x, int32_t *y); void joyReadButtons(int32_t *b); void joySetDeadZone(int32_t axis, uint16_t dead, uint16_t satur); void joyGetDeadZone(int32_t axis, uint16_t *dead, uint16_t *satur); extern int32_t inputchecked; -int32_t inittimer(int32_t); -void uninittimer(void); -void sampletimer(void); +int32_t timerInit(int32_t); +void timerUninit(void); +void timerUpdate(void); +int32_t timerGetFreq(void); +uint64_t timerGetTicksU64(void); +uint64_t timerGetFreqU64(void); +double timerGetHiTicks(void); +void (*timerSetCallback(void (*callback)(void)))(void); + #if defined RENDERTYPESDL && !defined LUNATIC -static FORCE_INLINE uint32_t getticks(void) { return (uint32_t)SDL_GetTicks(); } +static FORCE_INLINE uint32_t timerGetTicks(void) { return (uint32_t)SDL_GetTicks(); } #else -uint32_t getticks(void); +uint32_t timerGetTicks(void); #endif -int32_t gettimerfreq(void); -uint64_t getu64ticks(void); -uint64_t getu64tickspersec(void); -double gethiticks(void); -void (*installusertimercallback(void (*callback)(void)))(void); - -int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced); -int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs); -void getvalidmodes(void); -void resetvideomode(void); - -//#define DEBUG_FRAME_LOCKING - -void enddrawing(void); -void showframe(int32_t); -#if !defined DEBUG_FRAME_LOCKING -void begindrawing(void); -#else -void begindrawing_real(void); -# define BEGINDRAWING_SIZE 256 -extern uint32_t begindrawing_line[BEGINDRAWING_SIZE]; -extern const char *begindrawing_file[BEGINDRAWING_SIZE]; -extern int32_t lockcount; -# define begindrawing() do { \ - if (lockcount < BEGINDRAWING_SIZE) { \ - begindrawing_line[lockcount] = __LINE__; \ - begindrawing_file[lockcount] = __FILE__; \ - } \ - begindrawing_real(); \ -} while(0) -#endif - -int32_t setpalette(int32_t start, int32_t num); -//int32_t getpalette(int32_t start, int32_t num, char *dapal); -int32_t setgamma(void); -extern float vid_gamma, vid_contrast, vid_brightness; - -#define DEFAULT_GAMMA 1.0f -#define DEFAULT_CONTRAST 1.0f -#define DEFAULT_BRIGHTNESS 0.0f - -#define GAMMA_CALC ((int32_t)(min(max((float)((vid_gamma-1.0f)*10.0f),0.f),15.f))) - -//int32_t switchrendermethod(int32_t,int32_t); // 0 = software, 1 = opengl | bool = reinit int32_t wm_msgbox(const char *name, const char *fmt, ...) ATTRIBUTE((format(printf,2,3))); int32_t wm_ynbox(const char *name, const char *fmt, ...) ATTRIBUTE((format(printf,2,3))); diff --git a/source/build/include/build.h b/source/build/include/build.h index ae61ec458..108d13dbd 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -1056,19 +1056,19 @@ intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz); void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2); void squarerotatetile(int16_t tilenume); -int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp); -void nextpage(void); -void setaspect_new(); -void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2); -void setaspect(int32_t daxrange, int32_t daaspect); +int32_t videoSetGameMode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp); +void videoNextPage(void); +void videoSetCorrectedAspect(); +void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2); +void videoSetAspect(int32_t daxrange, int32_t daaspect); void flushperms(void); void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int col) ATTRIBUTE((nonnull(1,2))); void plotpixel(int32_t x, int32_t y, char col); char getpixel(int32_t x, int32_t y); -void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz); -void setviewback(void); +void videoSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz); +void videoRestoreTarget(void); void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall, int32_t *tposx, int32_t *tposy, fix16_t *tang); void completemirror(void); @@ -1081,8 +1081,8 @@ static FORCE_INLINE int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t da } void drawmasks(void); -void clearview(int32_t dacol); -void clearallviews(int32_t dacol); +void videoClearViewableArea(int32_t dacol); +void videoClearScreen(int32_t dacol); void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang); void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, @@ -1262,7 +1262,7 @@ int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum); //void qsetmode640350(void); //void qsetmode640480(void); -void qsetmodeany(int32_t,int32_t); +void videoSet2dMode(int32_t,int32_t); void clear2dscreen(void); void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride); diff --git a/source/build/include/common.h b/source/build/include/common.h index 8328c5675..6bef3be38 100644 --- a/source/build/include/common.h +++ b/source/build/include/common.h @@ -140,8 +140,8 @@ int32_t dist(const void *s1, const void *s2); void COMMON_clearbackground(int32_t numcols, int32_t numrows); // timer defs for profiling function chunks the simple way -#define EDUKE32_TMRDEF int32_t t[20], ti=0; const char *tmrstr=__func__; fprintf(stderr,"%s\n",tmrstr); t[ti++]=getticks(); -#define EDUKE32_TMRTIC t[ti++]=getticks() +#define EDUKE32_TMRDEF int32_t t[20], ti=0; const char *tmrstr=__func__; fprintf(stderr,"%s\n",tmrstr); t[ti++]=timerGetTicks(); +#define EDUKE32_TMRTIC t[ti++]=timerGetTicks() #define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii= REND_POLYMOST && in3dmode()) return 0; #endif - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ r = readpixel((void *) (ylookup[y]+x+frameplace)); - enddrawing(); //}}} + videoEndDrawing(); //}}} return r; } @@ -200,7 +200,7 @@ static void drawlinepixels(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char plc = y1+mulscale12((2047-x1)&4095, inc); i = ((x1+2048)>>12); daend = ((x2+2048)>>12); - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ for (; i>12); @@ -208,7 +208,7 @@ static void drawlinepixels(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char drawpixel_safe((void *) (frameplace+ylookup[j]+i), col); plc += inc; } - enddrawing(); //}}} + videoEndDrawing(); //}}} } else { @@ -222,7 +222,7 @@ static void drawlinepixels(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char plc = x1+mulscale12((2047-y1)&4095, inc); i = ((y1+2048)>>12); daend = ((y2+2048)>>12); - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ p = ylookup[i]+frameplace; for (; i xp); - enddrawing(); + videoEndDrawing(); return; } @@ -589,7 +589,7 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col) drawpixel_safe((char *) (p + yp - xpbpl), col); // 8 } while (yp > xp); - enddrawing(); + videoEndDrawing(); } // @@ -598,9 +598,9 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col) void clear2dscreen(void) { int32_t const clearsz = (ydim16 <= yres - STATUS2DSIZ2) ? yres - STATUS2DSIZ2 : yres; - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ Bmemset((char *) frameplace, 0, bytesperline*clearsz); - enddrawing(); //}}} + videoEndDrawing(); //}}} } @@ -719,7 +719,7 @@ void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, if (gride <= 0) return; - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ if (m32_sideview) { @@ -841,7 +841,7 @@ void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, } } - enddrawing(); //}}} + videoEndDrawing(); //}}} } @@ -1245,7 +1245,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z setup_sideview_sincos(); - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ if (editstatus == 0) @@ -1386,7 +1386,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z drawline16mid(x1, j, -y1, +i, editorcolors[15]); - enddrawing(); //}}} + videoEndDrawing(); //}}} } // diff --git a/source/build/src/animvpx.cpp b/source/build/src/animvpx.cpp index 8b09f6fe2..0eb3c1061 100644 --- a/source/build/src/animvpx.cpp +++ b/source/build/src/animvpx.cpp @@ -218,7 +218,7 @@ int32_t animvpx_nextpic(animvpx_codec_ctx *codec, uint8_t **picptr) if (codec->initstate <= 0) // not inited or error return 1; - t[0] = getticks(); + t[0] = timerGetTicks(); if (codec->decstate == 0) // first time / begin { @@ -282,7 +282,7 @@ read_ivf_frame: return 5; } - t[1] = getticks(); + t[1] = timerGetTicks(); uint8_t *const dstpic = codec->pic; @@ -352,7 +352,7 @@ read_ivf_frame: } } - t[2] = getticks(); + t[2] = timerGetTicks(); codec->sumtimes[0] += t[1]-t[0]; codec->sumtimes[1] += t[2]-t[1]; @@ -505,7 +505,7 @@ void animvpx_restore_glstate(void) int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect) { - int32_t t = getticks(); + int32_t t = timerGetTicks(); if (codec->initstate <= 0) // not inited or error return 1; @@ -565,7 +565,7 @@ int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect) glEnd(); - t = getticks()-t; + t = timerGetTicks()-t; codec->sumtimes[2] += t; codec->maxtimes[2] = max(codec->maxtimes[2], t); codec->numframes++; diff --git a/source/build/src/baselayer.cpp b/source/build/src/baselayer.cpp index 8072cf58d..d403ac2cc 100644 --- a/source/build/src/baselayer.cpp +++ b/source/build/src/baselayer.cpp @@ -454,9 +454,9 @@ int32_t baselayer_init(void) { "r_tror_nomaskpass", "enable/disable additional pass in TROR software rendering", (void *)&r_tror_nomaskpass, CVAR_BOOL, 0, 1 }, #endif { "r_windowpositioning", "enable/disable window position memory", (void *) &windowpos, CVAR_BOOL, 0, 1 }, - { "vid_gamma","adjusts gamma component of gamma ramp",(void *) &vid_gamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, - { "vid_contrast","adjusts contrast component of gamma ramp",(void *) &vid_contrast, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, - { "vid_brightness","adjusts brightness component of gamma ramp",(void *) &vid_brightness, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, + { "vid_gamma","adjusts gamma component of gamma ramp",(void *) &g_videoGamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, + { "vid_contrast","adjusts contrast component of gamma ramp",(void *) &g_videoContrast, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, + { "vid_brightness","adjusts brightness component of gamma ramp",(void *) &g_videoBrightness, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, #ifdef DEBUGGINGAIDS { "debug1","debug counter",(void *) &debug1, CVAR_FLOAT, -100000, 100000 }, { "debug2","debug counter",(void *) &debug2, CVAR_FLOAT, -100000, 100000 }, diff --git a/source/build/src/build.cpp b/source/build/src/build.cpp index e41b0e27b..6e9c3222e 100644 --- a/source/build/src/build.cpp +++ b/source/build/src/build.cpp @@ -278,8 +278,8 @@ int32_t osdcmd_restartvid(osdfuncparm_t const * const UNUSED(parm)) if (!in3dmode()) return OSDCMD_OK; - resetvideomode(); - if (setgamemode(fullscreen,xdim,ydim,bpp)) + videoResetMode(); + if (videoSetGameMode(fullscreen,xdim,ydim,bpp)) OSD_Printf("restartvid: Reset failed...\n"); return OSDCMD_OK; @@ -322,20 +322,20 @@ static int32_t osdcmd_vidmode(osdfuncparm_t const * const parm) if (!in3dmode()) { - qsetmodeany(newx,newy); + videoSet2dMode(newx,newy); xdim2d = xdim; ydim2d = ydim; - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ CLEARLINES2D(0, ydim16, 0); - enddrawing(); //}}} + videoEndDrawing(); //}}} ydim16 = ydim-STATUS2DSIZ2; return OSDCMD_OK; } - if (setgamemode(newfullscreen,newx,newy,newbpp)) + if (videoSetGameMode(newfullscreen,newx,newy,newbpp)) OSD_Printf("vidmode: Mode change failed!\n"); xdimgame = newx; @@ -366,10 +366,10 @@ static void M32_drawdebug(void) #endif if (m32_numdebuglines>0) { - begindrawing(); + videoBeginDrawing(); for (i=0; i640?0:1); - enddrawing(); + videoEndDrawing(); } m32_numdebuglines=0; } @@ -510,7 +510,7 @@ void M32_DrawRoomsAndMasks(void) if (r_usenewaspect) { newaspect_enable = 1; - setaspect_new(); + videoSetCorrectedAspect(); } VM_OnEvent(EVENT_PREDRAW3DSCREEN, -1); @@ -557,7 +557,7 @@ void M32_DrawRoomsAndMasks(void) if (r_usenewaspect) { newaspect_enable = 0; - setaspect(tmpvr, tmpyx); + videoSetAspect(tmpvr, tmpyx); } } @@ -674,8 +674,8 @@ int app_main(int argc, char const * const * argv) mouseInit(); - inittimer(TIMERINTSPERSECOND); - installusertimercallback(keytimerstuff); + timerInit(TIMERINTSPERSECOND); + timerSetCallback(keytimerstuff); loadpics("tiles000.art", g_maxCacheSize); @@ -761,15 +761,15 @@ int app_main(int argc, char const * const * argv) if (cursectnum == -1) { - vid_gamma_3d = vid_gamma; - vid_brightness_3d = vid_brightness; - vid_contrast_3d = vid_contrast; + vid_gamma_3d = g_videoGamma; + vid_brightness_3d = g_videoBrightness; + vid_contrast_3d = g_videoContrast; - vid_gamma = vid_contrast = 1.0; - vid_brightness = 0.0; + g_videoGamma = g_videoContrast = 1.0; + g_videoBrightness = 0.0; setbrightness(0,0,0); - if (setgamemode(fullscreen, xdim2d, ydim2d, 8) < 0) + if (videoSetGameMode(fullscreen, xdim2d, ydim2d, 8) < 0) { CallExtUnInit(); uninitengine(); @@ -782,9 +782,9 @@ int app_main(int argc, char const * const * argv) overheadeditor(); keystatus[buildkeys[BK_MODE2D_3D]] = 0; - vid_gamma = vid_gamma_3d; - vid_contrast = vid_contrast_3d; - vid_brightness = vid_brightness_3d; + g_videoGamma = vid_gamma_3d; + g_videoContrast = vid_contrast_3d; + g_videoBrightness = vid_brightness_3d; vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1; @@ -792,7 +792,7 @@ int app_main(int argc, char const * const * argv) } else { - if (setgamemode(fullscreen, xdimgame, ydimgame, bppgame) < 0) + if (videoSetGameMode(fullscreen, xdimgame, ydimgame, bppgame) < 0) { CallExtUnInit(); uninitengine(); @@ -820,7 +820,7 @@ CANCEL: OSD_DispatchQueued(); - nextpage(); + videoNextPage(); synctics = totalclock-lockclock; lockclock += synctics; @@ -849,7 +849,7 @@ CANCEL: printext256(0,0,whitecol,0,"Are you sure you want to quit?",0); - showframe(1); + videoShowFrame(1); synctics = totalclock-lockclock; lockclock += synctics; @@ -886,7 +886,7 @@ CANCEL: i = CheckMapCorruption(4, 0); printext256(0,8,whitecol,0,i<4?"Save changes?":"Map is heavily corrupt. Save changes?",0); - showframe(1); + videoShowFrame(1); while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]|keystatus[0x2e]) == 0) { @@ -1474,12 +1474,12 @@ void editinput(void) if (keystatus[buildkeys[BK_MODE2D_3D]] && !m32_is2d3dmode()) // Enter { - vid_gamma_3d = vid_gamma; - vid_contrast_3d = vid_contrast; - vid_brightness_3d = vid_brightness; + vid_gamma_3d = g_videoGamma; + vid_contrast_3d = g_videoContrast; + vid_brightness_3d = g_videoBrightness; - vid_gamma = vid_contrast = 1.0; - vid_brightness = 0.0; + g_videoGamma = g_videoContrast = 1.0; + g_videoBrightness = 0.0; setbrightness(0,0,0); @@ -1487,9 +1487,9 @@ void editinput(void) overheadeditor(); keystatus[buildkeys[BK_MODE2D_3D]] = 0; - vid_gamma = vid_gamma_3d; - vid_contrast = vid_contrast_3d; - vid_brightness = vid_brightness_3d; + g_videoGamma = vid_gamma_3d; + g_videoContrast = vid_contrast_3d; + g_videoBrightness = vid_brightness_3d; vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1; @@ -1620,7 +1620,7 @@ void drawsmallabel(const char *text, char col, char backcol, char border, int32_ drawline16(x2-2,y1+0, x2-2,y2-1, backcol); drawline16(x2-3,y1+0, x2-3,y2+0, backcol); - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ if ((unsigned)y1-1 < ydim16+0u && (unsigned) (x1-2) < xdim2d+0u && (unsigned) (x2-2) < xdim2d+0u) { @@ -1634,7 +1634,7 @@ void drawsmallabel(const char *text, char col, char backcol, char border, int32_ drawpixel((char *) (frameplace + ((y2) * bytesperline) + (x2-2)), border); } - enddrawing(); + videoEndDrawing(); } // backup highlighted sectors with sprites as mapinfo for later restoration @@ -2335,7 +2335,7 @@ void fade_editor_screen(int32_t keepcol) int32_t pix, i, threecols = (keepcol >= 256); char cols[3] = {(char)(keepcol&0xff), (char)((keepcol>>8)&0xff), (char)((keepcol>>16)&0xff)}; - begindrawing(); + videoBeginDrawing(); cp = (char *)frameplace; for (i=0; i0) ? 75 : 200; // wait for event, timeout after 200 ms - (last loop time) - idle_waitevent_timeout(ms - min(getticks()-lasttick, ms)); + idle_waitevent_timeout(ms - min(timerGetTicks()-lasttick, ms)); // have synctics reset to 0 after we've slept to avoid zooming out to the max instantly resetsynctics = 1; } } else waitdelay = totalclock + 6; // should be 50 ms - lasttick = getticks(); + lasttick = timerGetTicks(); if (handleevents()) { @@ -3505,11 +3505,11 @@ void overheadeditor(void) if (numwalls < 0) numwalls = numwalls_bak; - if ((getticks() - lastdraw) >= 5 || (vel|angvel|svel) || DOWN_BK(MOVEUP) || DOWN_BK(MOVEDOWN) + if ((timerGetTicks() - lastdraw) >= 5 || (vel|angvel|svel) || DOWN_BK(MOVEUP) || DOWN_BK(MOVEDOWN) || mousx || mousy || bstatus || keystatus[0x10] || keystatus[0x11] || newnumwalls>=0 || OSD_IsMoving()) { - lastdraw = getticks(); + lastdraw = timerGetTicks(); clear2dscreen(); @@ -3526,7 +3526,7 @@ void overheadeditor(void) show2dsector[i>>3] |= (1<<(i&7)); } - setview(0, 0, xdim-1, ydim16-1); + videoSetViewableArea(0, 0, xdim-1, ydim16-1); if (graphicsmode == 2) totalclocklock = totalclock; @@ -3546,7 +3546,7 @@ void overheadeditor(void) int32_t cx = halfxdim16+x2; int32_t cy = midydim16+y2; - begindrawing(); //{{{ LOCK_FRAME_1 + videoBeginDrawing(); //{{{ LOCK_FRAME_1 if ((cx >= 2 && cx <= xdim-3) && (cy >= 2 && cy <= ydim16-3)) { @@ -3876,9 +3876,9 @@ void overheadeditor(void) inpclamp(&pos.z, cz+(4<<8), fz-(4<<8)); - enddrawing(); - setview(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y + YSIZE_2D3D); - clearview(-1); + videoEndDrawing(); + videoSetViewableArea(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y + YSIZE_2D3D); + videoClearViewableArea(-1); vec2_t osearch = { searchx, searchy }; @@ -3886,7 +3886,7 @@ void overheadeditor(void) searchy -= m32_2d3d.y; M32_DrawRoomsAndMasks(); - setview(0, 0, xdim2d-1, ydim2d-1); + videoSetViewableArea(0, 0, xdim2d-1, ydim2d-1); #ifdef USE_OPENGL rendmode = bakrendmode; @@ -3896,7 +3896,7 @@ void overheadeditor(void) searchx = osearch.x; searchy = osearch.y; - begindrawing(); + videoBeginDrawing(); drawline16(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y, editorcolors[15]); drawline16(m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y + YSIZE_2D3D, editorcolors[15]); drawline16(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x, m32_2d3d.y + YSIZE_2D3D, editorcolors[15]); @@ -3995,7 +3995,7 @@ void overheadeditor(void) } } - enddrawing(); //}}} LOCK_FRAME_1 + videoEndDrawing(); //}}} LOCK_FRAME_1 OSD_Draw(); } @@ -4170,7 +4170,7 @@ void overheadeditor(void) //__clearscreen_beforecapture__ screencapture("captxxxx.tga", eitherSHIFT); - showframe(1); + videoShowFrame(1); } if (keystatus[0x30]) // B (clip Blocking xor) (2D) { @@ -7900,7 +7900,7 @@ end_insert_points: nokeys: - showframe(1); + videoShowFrame(1); synctics = totalclock-lockclock; lockclock += synctics; @@ -7947,7 +7947,7 @@ end_insert_points: RESET_EDITOR_VARS(); oposz = pos.z; } - showframe(1); + videoShowFrame(1); keystatus[0x1c] = 0; keystatus[0x2d]=keystatus[0x13]=0; @@ -7975,7 +7975,7 @@ CANCEL: #endif printext16(16*8, ydim-STATUS2DSIZ2-12, editorcolors[15], -1, GetSaveBoardFilename(NULL), 0); - showframe(1); + videoShowFrame(1); keyFlushChars(); bad = 1; while (bad == 1) @@ -8087,7 +8087,7 @@ CANCEL: } } } - showframe(1); + videoShowFrame(1); keystatus[0x1c] = 0; } else if (ch == 'a' || ch == 'A') //A @@ -8119,7 +8119,7 @@ CANCEL: { _printmessage16("%sSave as: ^011%s%s", corrupt>=4?"(map corrupt) ":"", boardfilename, (totalclock&32)?"_":""); - showframe(1); + videoShowFrame(1); if (handleevents()) quitevent = 0; @@ -8150,7 +8150,7 @@ CANCEL: Bstrcpy(boardfilename, selectedboardfilename); keystatus[1] = 0; printmessage16("Operation cancelled"); - showframe(1); + videoShowFrame(1); } else if (bad == 2) { @@ -8184,7 +8184,7 @@ CANCEL: SaveBoardAndPrintMessage(NULL); - showframe(1); + videoShowFrame(1); } else if (ch == 't' || ch == 'T') { @@ -8224,7 +8224,7 @@ CANCEL: keystatus[0x2e] = 0; quitevent = 0; printmessage16("Operation cancelled"); - showframe(1); + videoShowFrame(1); goto CANCEL; } @@ -8236,7 +8236,7 @@ CANCEL: } // printmessage16(""); - showframe(1); + videoShowFrame(1); } } @@ -8261,7 +8261,7 @@ CANCEL: fixspritesectors(); - if (setgamemode(fullscreen,xdimgame,ydimgame,bppgame) < 0) + if (videoSetGameMode(fullscreen,xdimgame,ydimgame,bppgame) < 0) { initprintf("%d * %d not supported in this graphics mode\n",xdim,ydim); CallExtUnInit(); @@ -8292,7 +8292,7 @@ int32_t ask_if_sure(const char *query, uint32_t flags) _printmessage16("Are you sure?"); else _printmessage16("%s", query); - showframe(1); + videoShowFrame(1); keyFlushChars(); while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==-1) @@ -8333,7 +8333,7 @@ int32_t editor_ask_function(const char *question, const char *dachars, int32_t n _printmessage16("%s", question); - showframe(1); + videoShowFrame(1); keyFlushChars(); // 'c' is cancel too, but can be overridden @@ -8368,7 +8368,7 @@ static void SaveBoardAndPrintMessage(const char *fn) const char *f; _printmessage16("Saving board..."); - showframe(1); + videoShowFrame(1); f = SaveBoard(fn, M32_SB_ASKOV); @@ -9106,16 +9106,16 @@ void clearmidstatbar16(void) { int32_t y = overridepm16y<0 ? STATUS2DSIZ : overridepm16y; - begindrawing(); + videoBeginDrawing(); CLEARLINES2D(ydim-y+25, STATUS2DSIZ+2-(25<<1), 0); - enddrawing(); + videoEndDrawing(); } static void clearministatbar16(void) { int32_t i, col = editorcolors[25]; - begindrawing(); + videoBeginDrawing(); for (i=ydim-STATUS2DSIZ2; i has to be the starting wall of a loop! @@ -9339,7 +9339,7 @@ int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char printext16(n<<3, ydim-STATUS2DSIZ+128, editorcolors[11], -1, buffer,0); } - showframe(1); + videoShowFrame(1); n = 0; if (getnumber_internal1(ch, &danum, maxnumber, sign) || @@ -9424,7 +9424,7 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha printmessage256(0, 9, buffer); } - showframe(1); + videoShowFrame(1); if (getnumber_internal1(ch, &danum, maxnumber, sign) || getnumber_autocomplete(ournamestart, ch, &danum, flags&(1+2))) @@ -9492,7 +9492,7 @@ const char *getstring_simple(const char *querystr, const char *defaultstr, int32 else _printmessage16("%s", buf); - showframe(1); + videoShowFrame(1); if (handleevents()) quitevent = 0; @@ -9726,7 +9726,7 @@ static int32_t menuselect(void) do { - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ CLEARLINES2D(0, ydim16, 0); @@ -9795,8 +9795,8 @@ static int32_t menuselect(void) } } - enddrawing(); //}}} - showframe(1); + videoEndDrawing(); //}}} + videoShowFrame(1); keystatus[0xcb] = 0; keystatus[0xcd] = 0; @@ -9972,10 +9972,10 @@ static int32_t menuselect(void) ch = 0; - begindrawing(); + videoBeginDrawing(); CLEARLINES2D(0, ydim16, 0); - enddrawing(); - showframe(1); + videoEndDrawing(); + videoShowFrame(1); } if (ch == 13 && !findfileshigh) ch = 0; @@ -10997,7 +10997,7 @@ void test_map(int32_t mode) message("Board saved to " PLAYTEST_MAPNAME ". Starting the game..."); OSD_Printf("...as `%s'\n", fullparam); - showframe(1); + videoShowFrame(1); mouseUninit(); #ifdef _WIN32 { diff --git a/source/build/src/config.cpp b/source/build/src/config.cpp index becbbb037..de0890730 100644 --- a/source/build/src/config.cpp +++ b/source/build/src/config.cpp @@ -142,9 +142,9 @@ int32_t loadsetup(const char *fn) #ifdef POLYMER if (readconfig(fp, "rendmode", val, VL) > 0) { i = atoi_safe(val); glrendmode = i; } #endif - if (readconfig(fp, "vid_gamma", val, VL) > 0) vid_gamma = clampd(Bstrtod(val, NULL), 0.0, 10.0); - if (readconfig(fp, "vid_brightness", val, VL) > 0) vid_brightness = clampd(Bstrtod(val, NULL), 0.0, 10.0); - if (readconfig(fp, "vid_contrast", val, VL) > 0) vid_contrast = clampd(Bstrtod(val, NULL), 0.0, 10.0); + if (readconfig(fp, "vid_gamma", val, VL) > 0) g_videoGamma = clampd(Bstrtod(val, NULL), 0.0, 10.0); + if (readconfig(fp, "vid_brightness", val, VL) > 0) g_videoBrightness = clampd(Bstrtod(val, NULL), 0.0, 10.0); + if (readconfig(fp, "vid_contrast", val, VL) > 0) g_videoContrast = clampd(Bstrtod(val, NULL), 0.0, 10.0); #ifdef RENDERTYPEWIN if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = atoi_safe(val); #endif @@ -627,9 +627,9 @@ int32_t writesetup(const char *fn) maxrefreshfreq, #endif windowpos, windowx, windowy, - vid_gamma_3d>=0?vid_gamma_3d:vid_gamma, - vid_brightness_3d>=0?vid_brightness_3d:vid_brightness, - vid_contrast_3d>=0?vid_contrast_3d:vid_contrast, + vid_gamma_3d>=0?vid_gamma_3d:g_videoGamma, + vid_brightness_3d>=0?vid_brightness_3d:g_videoBrightness, + vid_contrast_3d>=0?vid_contrast_3d:g_videoContrast, game_executable, #if 0 option[7]>>4, option[2], diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 3694f0ec8..5f5981d52 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -134,9 +134,9 @@ uint32_t r_screenxy = 0; int32_t globalflags; -float vid_gamma = DEFAULT_GAMMA; -float vid_contrast = DEFAULT_CONTRAST; -float vid_brightness = DEFAULT_BRIGHTNESS; +float g_videoGamma = DEFAULT_GAMMA; +float g_videoContrast = DEFAULT_CONTRAST; +float g_videoBrightness = DEFAULT_BRIGHTNESS; //Textured Map variables static char globalpolytype; @@ -961,7 +961,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), j = bunches[cf][bnchcnt]; // the actual bunchnum... yax_globalbunch = j; #ifdef YAX_DEBUG - t=getu64ticks(); + t=timerGetTicksU64(); #endif k = bunchsec[j]; @@ -985,7 +985,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), yaxdebug("l%d: faked (bn %2d) sec %4d,%3d dspr, ob=[%2d,%2d], sn=%4d, %.3f ms", yax_globallev-YAX_MAXDRAWS, j, k, yax_spritesortcnt[yax_globallev]-odsprcnt, ourbunch[0],ourbunch[1],sectnum, - (double)(1000*(getu64ticks()-t))/u64tickspersec); + (double)(1000*(timerGetTicksU64()-t))/u64tickspersec); } if (ourbunch[cf]==j) @@ -1018,9 +1018,9 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), { if (getrendermode() == REND_CLASSIC) { - begindrawing(); + videoBeginDrawing(); draw_rainbow_background(); - enddrawing(); + videoEndDrawing(); } #ifdef USE_OPENGL else @@ -1045,7 +1045,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), k = bunchsec[j]; // best start-drawing sector yax_globalbunch = j; #ifdef YAX_DEBUG - t=getu64ticks(); + t=timerGetTicksU64(); #endif yax_tweakpicnums(j, cf, 0); if (k < 0) @@ -1061,7 +1061,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), { yaxdebug("nm1 l%d: DRAWN (bn %2d) sec %4d, %.3f ms", yax_globallev-YAX_MAXDRAWS, j, k, - (double)(1000*(getu64ticks()-t))/u64tickspersec); + (double)(1000*(timerGetTicksU64()-t))/u64tickspersec); if (!yax_nomaskdidit) { @@ -1077,7 +1077,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), yax_copytsprites(); yaxdebug("nm0 l%d: DRAWN (bn %2d) sec %4d,%3d tspr, %.3f ms", yax_globallev-YAX_MAXDRAWS, j, k, spritesortcnt, - (double)(1000*(getu64ticks()-t))/u64tickspersec); + (double)(1000*(timerGetTicksU64()-t))/u64tickspersec); SpriteAnimFunc(globalposx, globalposy, globalang, smoothr); drawmasks(); @@ -1090,7 +1090,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), } #ifdef YAX_DEBUG - t=getu64ticks(); + t=timerGetTicksU64(); #endif yax_globalcf = -1; yax_globalbunch = -1; @@ -1104,7 +1104,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), // spritesortcnt = 0; yax_copytsprites(); yaxdebug("DRAWN base level sec %d,%3d tspr, %.3f ms", osectnum, - spritesortcnt, (double)(1000*(getu64ticks()-t))/u64tickspersec); + spritesortcnt, (double)(1000*(timerGetTicksU64()-t))/u64tickspersec); scansector_collectsprites = 1; for (cf=0; cf<2; cf++) @@ -1122,7 +1122,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), char purple = getclosestcol(255, 0, 255); char yellow = getclosestcol(255, 255, 0); - begindrawing(); + videoBeginDrawing(); for (i=0; i=0; i--) { @@ -8652,7 +8653,7 @@ killsprite: } #endif - enddrawing(); //}}} + videoEndDrawing(); //}}} } // @@ -8666,7 +8667,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) int32_t const oyxaspect = yxaspect, oviewingrange = viewingrange; - setaspect(65536, divscale16((320*5)/8, 200)); + videoSetAspect(65536, divscale16((320*5)/8, 200)); beforedrawrooms = 0; @@ -8684,7 +8685,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) int32_t sortnum = 0; - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ usectortype *sec; @@ -8953,12 +8954,12 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) } } - enddrawing(); //}}} + videoEndDrawing(); //}}} if (r_usenewaspect) - setaspect(oviewingrange, oyxaspect); + videoSetAspect(oviewingrange, oyxaspect); else - setaspect(65536, divscale16(ydim*320, xdim*200)); + videoSetAspect(65536, divscale16(ydim*320, xdim*200)); } //////////////////// LOADING AND SAVING ROUTINES //////////////////// @@ -9763,7 +9764,7 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1 #define YSAVES ((xdim*MAXSPRITES)>>7) -static void initsmost(void) +static void videoAllocateBuffers(void) { int32_t i; // Needed for the game's TILT_SETVIEWTOTILE_320. @@ -9815,7 +9816,7 @@ static void PolymostProcessVoxels(void) g_haveVoxels = 0; OSD_Printf("Generating voxel models for Polymost. This may take a while...\n"); - nextpage(); + videoNextPage(); for (bssize_t i=0; i>1); } @@ -9931,7 +9932,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da // // nextpage // -void nextpage(void) +void videoNextPage(void) { permfifotype *per; @@ -9950,7 +9951,7 @@ void nextpage(void) if (in3dmode()) { - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ for (bssize_t i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) { per = &permfifo[i]; @@ -9959,12 +9960,12 @@ void nextpage(void) per->dashade,per->dapalnum,per->dastat,per->daalpha,per->dablend, per->cx1,per->cy1,per->cx2,per->cy2,per->uniqid); } - enddrawing(); //}}} + videoEndDrawing(); //}}} OSD_Draw(); - showframe(0); + videoShowFrame(0); - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ for (bssize_t i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) { per = &permfifo[i]; @@ -9977,7 +9978,7 @@ void nextpage(void) if (((per->pagesleft&127) == 0) && (i == permtail)) permtail = ((permtail+1)&(MAXPERMS-1)); } - enddrawing(); //}}} + videoEndDrawing(); //}}} } faketimerhandler(); @@ -9985,7 +9986,7 @@ void nextpage(void) #ifdef USE_OPENGL omdtims = mdtims; - mdtims = getticks(); + mdtims = timerGetTicks(); for (native_t i = 0; i < Numsprites; ++i) if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM)) @@ -12005,7 +12006,7 @@ restart_grand: int32_t setaspect_new_use_dimen = 0; -void setaspect_new() +void videoSetCorrectedAspect() { if (r_usenewaspect && newaspect_enable && getrendermode() != REND_POLYMER) { @@ -12047,16 +12048,16 @@ void setaspect_new() vr = divscale16(x*3, y*4); - setaspect(vr, yx); + videoSetAspect(vr, yx); } else - setaspect(65536, divscale16(ydim*320, xdim*200)); + videoSetAspect(65536, divscale16(ydim*320, xdim*200)); } // // setview // -void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2) +void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2) { windowxy1.x = x1; wx1 = (x1<<12); windowxy1.y = y1; wy1 = (y1<<12); @@ -12071,7 +12072,7 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2) #ifdef USE_OPENGL fydimen = (float) ydimen; #endif - setaspect_new(); + videoSetCorrectedAspect(); for (bssize_t i=0; i= xdim-1) && (cy2 >= ydim-1) && @@ -12208,7 +12209,7 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, // // clearview // -void clearview(int32_t dacol) +void videoClearViewableArea(int32_t dacol) { if (!in3dmode() && dacol != -1) return; @@ -12228,7 +12229,7 @@ void clearview(int32_t dacol) } #endif - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ //dacol += (dacol<<8); dacol += (dacol<<16); int const dx = windowxy2.x-windowxy1.x+1; intptr_t p = frameplace+ylookup[windowxy1.y]+windowxy1.x; @@ -12238,7 +12239,7 @@ void clearview(int32_t dacol) Bmemset((void *)p,dacol,dx); p += ylookup[1]; } - enddrawing(); //}}} + videoEndDrawing(); //}}} faketimerhandler(); } @@ -12247,7 +12248,7 @@ void clearview(int32_t dacol) // // clearallviews // -void clearallviews(int32_t dacol) +void videoClearScreen(int32_t dacol) { if (!in3dmode()) return; //dacol += (dacol<<8); dacol += (dacol<<16); @@ -12267,9 +12268,9 @@ void clearallviews(int32_t dacol) } #endif - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ Bmemset((void *)frameplace,dacol,bytesperline*yres); - enddrawing(); //}}} + videoEndDrawing(); //}}} //nextpage(); faketimerhandler(); @@ -12281,7 +12282,7 @@ void clearallviews(int32_t dacol) // // setviewtotile // -void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz) +void videoSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz) { //DRAWROOMS TO TILE BACKUP&SET CODE tilesiz[tilenume].x = xsiz; tilesiz[tilenume].y = ysiz; @@ -12307,8 +12308,8 @@ void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz) setviewcnt++; offscreenrendering = 1; - setview(0,0,ysiz-1,xsiz-1); - setaspect(65536,65536); + videoSetViewableArea(0,0,ysiz-1,xsiz-1); + videoSetAspect(65536,65536); calc_ylookup(ysiz, xsiz); } @@ -12317,7 +12318,7 @@ void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz) // // setviewback // -void setviewback(void) +void videoRestoreTarget(void) { if (setviewcnt <= 0) return; setviewcnt--; @@ -12331,7 +12332,7 @@ void setviewback(void) } #endif - setview(bakwindowxy1[setviewcnt].x,bakwindowxy1[setviewcnt].y, + videoSetViewableArea(bakwindowxy1[setviewcnt].x,bakwindowxy1[setviewcnt].y, bakwindowxy2[setviewcnt].x,bakwindowxy2[setviewcnt].y); copybufbyte(&bakumost[windowxy1.x],&startumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startumost[0])); copybufbyte(&bakdmost[windowxy1.x],&startdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startdmost[0])); @@ -12430,7 +12431,7 @@ void completemirror(void) // Variables mirrorsx{1,2} refer to the source scene here, the one drawn // from the inside of the mirror. - begindrawing(); + videoBeginDrawing(); // Width in pixels (screen x's are inclusive on both sides): int const width = mirrorsx2-mirrorsx1+1; @@ -12457,7 +12458,7 @@ void completemirror(void) faketimerhandler(); } - enddrawing(); + videoEndDrawing(); } @@ -12717,7 +12718,7 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall) // // qsetmodeany // -void qsetmodeany(int32_t daxdim, int32_t daydim) +void videoSet2dMode(int32_t daxdim, int32_t daydim) { if (daxdim < 640) daxdim = 640; if (daydim < 480) daydim = 480; @@ -12725,7 +12726,7 @@ void qsetmodeany(int32_t daxdim, int32_t daydim) if (qsetmode != ((daxdim<<16)|(daydim&0xffff))) { g_lastpalettesum = 0; - if (setvideomode(daxdim, daydim, 8, fullscreen) < 0) + if (videoSetMode(daxdim, daydim, 8, fullscreen) < 0) return; xdim = xres; @@ -12736,15 +12737,15 @@ void qsetmodeany(int32_t daxdim, int32_t daydim) fydim = (float) yres; #endif - initsmost(); + videoAllocateBuffers(); ydim16 = yres - STATUS2DSIZ2; halfxdim16 = xres >> 1; midydim16 = ydim16 >> 1; // scale(200,yres,480); - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ Bmemset((char *)frameplace, 0, yres*bytesperline); - enddrawing(); //}}} + videoEndDrawing(); //}}} } qsetmode = ((daxdim<<16)|(daydim&0xffff)); @@ -12882,7 +12883,7 @@ int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, con char const * const letptr = &fontptr[name[i]<<3]; - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ char *ptr = (char *)(bytesperline*ypos + (stx-(fontsize&1)) + frameplace); int const trans = (obackcol < -1); @@ -12915,7 +12916,7 @@ int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, con ptr += bytesperline; } } - enddrawing(); //}}} + videoEndDrawing(); //}}} stx += charxsiz; @@ -13011,7 +13012,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const # endif #endif - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ for (i=0; name[i]; i++) { if (name[i] == '^' && isdigit(name[i+1])) @@ -13046,7 +13047,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const } stx += charxsiz; } - enddrawing(); //}}} + videoEndDrawing(); //}}} } @@ -13063,7 +13064,7 @@ static void PolymerProcessModels(void) if (!warned) { OSD_Printf("Post-processing MD3 models for Polymer. This may take a while...\n"); - nextpage(); + videoNextPage(); warned = 1; } diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index fdaedac17..46f697a77 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -699,7 +699,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf) int32_t picfillen = kfilelength(filh); kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c - int32_t startticks = getticks(), willprint = 0; + int32_t startticks = timerGetTicks(), willprint = 0; char hasalpha; texcacheheader cachead; @@ -985,7 +985,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf) if (willprint) { - int32_t etime = getticks()-startticks; + int32_t etime = timerGetTicks()-startticks; if (etime>=MIN_CACHETIME_PRINT) OSD_Printf("Load skin: p%d-e%d \"%s\"... cached... %d ms\n", pal, hicfxmask(pal), fn, etime); willprint = 0; @@ -997,7 +997,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf) if (willprint) { - int32_t etime = getticks()-startticks; + int32_t etime = timerGetTicks()-startticks; if (etime>=MIN_CACHETIME_PRINT) OSD_Printf("Load skin: p%d-e%d \"%s\"... %d ms\n", pal, hicfxmask(pal), fn, etime); } diff --git a/source/build/src/osd.cpp b/source/build/src/osd.cpp index 0f4d430a1..90f14c097 100644 --- a/source/build/src/osd.cpp +++ b/source/build/src/osd.cpp @@ -290,7 +290,7 @@ static int32_t osdfunc_fileinfo(osdfuncparm_t const * const parm) char buf[256]; uint32_t length = kfilelength(i); - int32_t crctime = getticks(); + int32_t crctime = timerGetTicks(); uint32_t crc = 0; do { @@ -298,11 +298,11 @@ static int32_t osdfunc_fileinfo(osdfuncparm_t const * const parm) crc = Bcrc32((uint8_t *)buf,j,crc); } while (j == 256); - crctime = getticks() - crctime; + crctime = timerGetTicks() - crctime; klseek(i, 0, BSEEK_SET); - int32_t xxhtime = getticks(); + int32_t xxhtime = timerGetTicks(); XXH32_state_t xxh; XXH32_reset(&xxh, 0x1337); do @@ -312,7 +312,7 @@ static int32_t osdfunc_fileinfo(osdfuncparm_t const * const parm) } while (j == 256); uint32_t xxhash = XXH32_digest(&xxh); - xxhtime = getticks() - xxhtime; + xxhtime = timerGetTicks() - xxhtime; kclose(i); @@ -321,8 +321,8 @@ static int32_t osdfunc_fileinfo(osdfuncparm_t const * const parm) " CRC-32: %08X (%g sec)\n" " xxHash: %08X (%g sec)\n", parm->parms[0], length, - crc, (double)crctime/gettimerfreq(), - xxhash, (double)xxhtime/gettimerfreq()); + crc, (double)crctime/timerGetFreq(), + xxhash, (double)xxhtime/timerGetFreq()); return OSDCMD_OK; } @@ -1212,7 +1212,7 @@ int OSD_HandleScanCode(uint8_t scanCode, int keyDown) -draw.scrolling; osdrowscur += draw.scrolling; OSD_CaptureInput(draw.scrolling == 1); - osdscrtime = getticks(); + osdscrtime = timerGetTicks(); } return -1; } @@ -1240,7 +1240,7 @@ int OSD_HandleScanCode(uint8_t scanCode, int keyDown) draw.scrolling = -1; osdrowscur--; OSD_CaptureInput(0); - osdscrtime = getticks(); + osdscrtime = timerGetTicks(); break; case sc_PgUp: @@ -1477,7 +1477,7 @@ void OSD_Draw(void) { if ((osdrowscur < osd->draw.rows && osd->draw.scrolling == 1) || osdrowscur < -1) { - int32_t j = (getticks()-osdscrtime); + int32_t j = (timerGetTicks()-osdscrtime); while (j >= 0) { osdrowscur++; @@ -1488,7 +1488,7 @@ void OSD_Draw(void) } else if ((osdrowscur > -1 && osd->draw.scrolling == -1) || osdrowscur > osd->draw.rows) { - int32_t j = (getticks()-osdscrtime); + int32_t j = (timerGetTicks()-osdscrtime); while (j >= 0) { osdrowscur--; @@ -1498,7 +1498,7 @@ void OSD_Draw(void) } } - osdscrtime = getticks(); + osdscrtime = timerGetTicks(); } if ((osd->flags & OSD_DRAW) == 0 || !osdrowscur) return; @@ -1507,7 +1507,7 @@ void OSD_Draw(void) row = osdrowscur-1; lines = min(osd->text.lines-osd->draw.head, osdrowscur); - begindrawing(); + videoBeginDrawing(); clearbackground(osd->draw.cols,osdrowscur+1); @@ -1547,7 +1547,7 @@ void OSD_Draw(void) osd->version.buf, osd->version.len, (sintable[(totalclock<<4)&2047]>>11), osd->version.pal); } - enddrawing(); + videoEndDrawing(); } diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index 4a4b8ffdc..d5026621b 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -79,7 +79,7 @@ void fade_screen_black(int32_t moreopaquep) { Bassert(!offscreenrendering); - begindrawing(); + videoBeginDrawing(); { char *const p = (char *) frameplace; const char *const trans = getblendtab(0); @@ -100,7 +100,7 @@ void fade_screen_black(int32_t moreopaquep) for (; i= 1) OSD_Printf("Initializing Polymer subsystem...\n"); @@ -852,7 +852,7 @@ int32_t polymer_init(void) } #endif - if (pr_verbosity >= 1) OSD_Printf("PR : Initialization complete in %d ms.\n", getticks()-t); + if (pr_verbosity >= 1) OSD_Printf("PR : Initialization complete in %d ms.\n", timerGetTicks()-t); return 1; } @@ -1070,7 +1070,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, fix16_t d if (getrendermode() == REND_CLASSIC) return; - begindrawing(); + videoBeginDrawing(); // TODO: support for screen resizing // frameoffset = frameplace + windowxy1.y*bytesperline + windowxy1.x; @@ -1215,7 +1215,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, fix16_t d polymer_emptybuckets(); viewangle = daang; - enddrawing(); + videoEndDrawing(); return; } @@ -1235,7 +1235,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, fix16_t d gsinang2 = gsinang*fviewingrange*(1./65536.f); if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n"); - enddrawing(); + videoEndDrawing(); } void polymer_drawmasks(void) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 2429b354d..fa2b1465e 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -2227,7 +2227,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp int32_t picfillen = kfilelength(filh); kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c - int32_t startticks = getticks(), willprint = 0; + int32_t startticks = timerGetTicks(), willprint = 0; char hasalpha; texcacheheader cachead; @@ -2502,7 +2502,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp if (willprint) { - int32_t etime = getticks() - startticks; + int32_t etime = timerGetTicks() - startticks; if (etime >= MIN_CACHETIME_PRINT) OSD_Printf("Load tile %4d: p%d-m%d-e%d %s... cached... %d ms\n", dapic, dapalnum, dameth, effect, willprint == 2 ? fn : "", etime); @@ -2515,7 +2515,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp if (willprint) { - int32_t etime = getticks()-startticks; + int32_t etime = timerGetTicks()-startticks; if (etime>=MIN_CACHETIME_PRINT) OSD_Printf("Load tile %4d: p%d-m%d-e%d %s... %d ms\n", dapic, dapalnum, dameth, effect, willprint==2 ? fn : "", etime); @@ -5191,7 +5191,7 @@ void polymost_drawrooms() { if (getrendermode() == REND_CLASSIC) return; - begindrawing(); + videoBeginDrawing(); frameoffset = frameplace + windowxy1.y*bytesperline + windowxy1.x; resizeglcheck(); @@ -5282,7 +5282,7 @@ void polymost_drawrooms() } } - if (n < 3) { enddrawing(); return; } + if (n < 3) { videoEndDrawing(); return; } float sx[4], sy[4]; @@ -5355,7 +5355,7 @@ void polymost_drawrooms() glDepthFunc(GL_LEQUAL); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS // glDepthRange(0.0, 1.0); //<- this is more widely supported than glPolygonOffset - enddrawing(); + videoEndDrawing(); } void polymost_drawmaskwall(int32_t damaskwallcnt) @@ -7696,7 +7696,7 @@ static int32_t osdcmd_cvar_set_polymost(osdfuncparm_t const * const parm) if (r == OSDCMD_OK) { if (!Bstrcasecmp(parm->name, "r_swapinterval")) - vsync = setvsync(vsync); + vsync = videoSetVsync(vsync); else if (!Bstrcasecmp(parm->name, "r_downsize")) { if (r_downsizevar == -1) @@ -7705,8 +7705,8 @@ static int32_t osdcmd_cvar_set_polymost(osdfuncparm_t const * const parm) if (in3dmode() && r_downsize != r_downsizevar) { texcache_invalidate(); - resetvideomode(); - if (setgamemode(fullscreen,xdim,ydim,bpp)) + videoResetMode(); + if (videoSetGameMode(fullscreen,xdim,ydim,bpp)) OSD_Printf("restartvid: Reset failed...\n"); } diff --git a/source/build/src/screenshot.cpp b/source/build/src/screenshot.cpp index 59ecc8906..53d28d652 100644 --- a/source/build/src/screenshot.cpp +++ b/source/build/src/screenshot.cpp @@ -65,7 +65,7 @@ int screencapture(const char *filename, char inverseit) uint8_t * const imgBuf = (uint8_t *) Xmalloc(xdim * ydim * (HICOLOR ? 3 : 1)); - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ #ifdef USE_OPENGL if (HICOLOR) @@ -119,7 +119,7 @@ int screencapture(const char *filename, char inverseit) Bmemcpy(imgBuf + i * xdim, (uint8_t *)frameplace + ylookup[i], xdim); } - enddrawing(); //}}} + videoEndDrawing(); //}}} png_set_text("Software", osd->version.buf); png_write(fp, xdim, ydim, HICOLOR ? PNG_TRUECOLOR : PNG_INDEXED, imgBuf); @@ -189,7 +189,7 @@ int screencapture_tga(const char *filename, char inverseit) } } - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ # ifdef USE_OPENGL if (HICOLOR) @@ -215,7 +215,7 @@ int screencapture_tga(const char *filename, char inverseit) Bfwrite(ptr + i * bytesperline, xdim, 1, fil); } - enddrawing(); //}}} + videoEndDrawing(); //}}} screencapture_end(fn, &fil); diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index 2d2e97f33..8806f7968 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -1,7 +1,4 @@ -// SDL interface layer -// for the Build Engine -// by Jonathon Fowler (jf@jonof.id.au) -// +// SDL interface layer for the Build Engine // Use SDL 1.2 or 2.0 from http://www.libsdl.org #include "compat.h" @@ -484,7 +481,6 @@ int main(int argc, char *argv[]) startwin_open(); maybe_redirect_outputs(); - baselayer_init(); #ifdef _WIN32 char *argvbuf; @@ -517,7 +513,7 @@ int main(int argc, char *argv[]) #if SDL_MAJOR_VERSION != 1 -int32_t setvsync(int32_t newSync) +int32_t videoSetVsync(int32_t newSync) { if (vsync_renderlayer == newSync) return newSync; @@ -549,8 +545,8 @@ int32_t setvsync(int32_t newSync) { vsync_renderlayer = newSync; - resetvideomode(); - if (setgamemode(fullscreen, xdim, ydim, bpp)) + videoResetMode(); + if (videoSetGameMode(fullscreen, xdim, ydim, bpp)) OSD_Printf("restartvid: Reset failed...\n"); } @@ -663,7 +659,7 @@ int32_t initsystem(void) void uninitsystem(void) { uninitinput(); - uninittimer(); + timerUninit(); if (appicon) { @@ -691,7 +687,7 @@ void uninitsystem(void) // void system_getcvars(void) { - vsync = setvsync(vsync); + vsync = videoSetVsync(vsync); } // @@ -1011,7 +1007,7 @@ static void(*usertimercallback)(void) = NULL; // // inittimer() -- initialize timer // -int32_t inittimer(int32_t tickspersecond) +int32_t timerInit(int32_t tickspersecond) { if (timerfreq) return 0; // already installed @@ -1029,7 +1025,7 @@ int32_t inittimer(int32_t tickspersecond) usertimercallback = NULL; - msperu64tick = 1000.0 / (double)getu64tickspersec(); + msperu64tick = 1000.0 / (double)timerGetFreqU64(); return 0; } @@ -1037,7 +1033,7 @@ int32_t inittimer(int32_t tickspersecond) // // uninittimer() -- shut down timer // -void uninittimer(void) +void timerUninit(void) { timerfreq=0; #if defined(_WIN32) && SDL_MAJOR_VERSION==1 @@ -1049,7 +1045,7 @@ void uninittimer(void) // // sampletimer() -- update totalclock // -void sampletimer(void) +void timerUpdate(void) { if (!timerfreq) return; @@ -1069,7 +1065,7 @@ void sampletimer(void) // // getticks() -- returns the sdl ticks count // -uint32_t getticks(void) +uint32_t timerGetTicks(void) { return (uint32_t)SDL_GetTicks(); } @@ -1078,12 +1074,12 @@ uint32_t getticks(void) // high-resolution timers for profiling #if SDL_MAJOR_VERSION != 1 -uint64_t getu64ticks(void) +uint64_t timerGetTicksU64(void) { return SDL_GetPerformanceCounter(); } -uint64_t getu64tickspersec(void) +uint64_t timerGetFreqU64(void) { return SDL_GetPerformanceFrequency(); } @@ -1092,15 +1088,15 @@ uint64_t getu64tickspersec(void) // Returns the time since an unspecified starting time in milliseconds. // (May be not monotonic for certain configurations.) ATTRIBUTE((flatten)) -double gethiticks(void) +double timerGetHiTicks(void) { - return (double)getu64ticks() * msperu64tick; + return (double)timerGetTicksU64() * msperu64tick; } // // gettimerfreq() -- returns the number of ticks per second the timer is configured to generate // -int32_t gettimerfreq(void) +int32_t timerGetFreq(void) { return timerticspersec; } @@ -1109,7 +1105,7 @@ int32_t gettimerfreq(void) // // installusertimercallback() -- set up a callback function to be called when the timer is fired // -void(*installusertimercallback(void(*callback)(void)))(void) +void(*timerSetCallback(void(*callback)(void)))(void) { void(*oldtimercallback)(void); @@ -1153,7 +1149,7 @@ static int sortmodes(const void *a_, const void *b_) static char modeschecked=0; #if SDL_MAJOR_VERSION != 1 -void getvalidmodes(void) +void videoGetModes(void) { int32_t i, maxx = 0, maxy = 0; SDL_DisplayMode dispmode; @@ -1214,11 +1210,11 @@ void getvalidmodes(void) // // checkvideomode() -- makes sure the video mode passed is legal // -int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced) +int32_t videoCheckMode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced) { int32_t i, nearest=-1, dx, dy, odx=9999, ody=9999; - getvalidmodes(); + videoGetModes(); if (c>8 #ifdef USE_OPENGL @@ -1432,7 +1428,7 @@ int32_t setvideomode_sdlcommon(int32_t *x, int32_t *y, int32_t c, int32_t fs, in return 0; } - if (checkvideomode(x, y, c, fs, 0) < 0) + if (videoCheckMode(x, y, c, fs, 0) < 0) return -1; #ifdef GEKKO @@ -1448,7 +1444,7 @@ int32_t setvideomode_sdlcommon(int32_t *x, int32_t *y, int32_t c, int32_t fs, in mouseGrabInput(0); } - while (lockcount) enddrawing(); + while (lockcount) videoEndDrawing(); #ifdef USE_OPENGL if (bpp > 8 && sdl_surface) @@ -1495,7 +1491,7 @@ void setvideomode_sdlcommonpost(int32_t x, int32_t y, int32_t c, int32_t fs, int gammabrightness = 1; // see if gamma really is working by trying to set the brightness - if (gammabrightness && setgamma() < 0) + if (gammabrightness && videoSetGamma() < 0) gammabrightness = 0; // nope } #endif @@ -1575,7 +1571,7 @@ static void sdl_trycreaterenderer(int32_t const x, int32_t const y) } } -int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) +int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs) { int32_t regrab = 0, ret; @@ -1697,7 +1693,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) // // resetvideomode() -- resets the video system // -void resetvideomode(void) +void videoResetMode(void) { videomodereset = 1; modeschecked = 0; @@ -1712,7 +1708,7 @@ uint32_t begindrawing_line[BEGINDRAWING_SIZE]; const char *begindrawing_file[BEGINDRAWING_SIZE]; void begindrawing_real(void) #else -void begindrawing(void) +void videoBeginDrawing(void) #endif { if (bpp > 8) @@ -1747,7 +1743,7 @@ void begindrawing(void) // // enddrawing() -- unlocks the framebuffer // -void enddrawing(void) +void videoEndDrawing(void) { if (bpp > 8) { @@ -1775,7 +1771,7 @@ void enddrawing(void) extern "C" void AndroidDrawControls(); #endif -void showframe(int32_t w) +void videoShowFrame(int32_t w) { UNREFERENCED_PARAMETER(w); @@ -1810,7 +1806,7 @@ void showframe(int32_t w) if (lockcount) { printf("Frame still locked %d times when showframe() called.\n", lockcount); - while (lockcount) enddrawing(); + while (lockcount) videoEndDrawing(); } // deferred palette updating @@ -1845,16 +1841,14 @@ void showframe(int32_t w) // // setpalette() -- set palette values // -int32_t setpalette(int32_t start, int32_t num) +int32_t videoUpdatePalette(int32_t start, int32_t num) { - int32_t i, n; - if (bpp > 8) return 0; // no palette in opengl Bmemcpy(sdlayer_pal, curpalettefaded, 256 * 4); - for (i = start, n = num; n > 0; i++, n--) + for (native_t i = start, n = num; n > 0; i++, n--) curpalettefaded[i].f = #if SDL_MAJOR_VERSION == 1 sdlayer_pal[i].unused @@ -1871,22 +1865,20 @@ int32_t setpalette(int32_t start, int32_t num) // // setgamma // -int32_t setgamma(void) +int32_t videoSetGamma(void) { - // return 0; + if (novideo) + return 0; int32_t i; uint16_t gammaTable[768]; - float gamma = max(0.1f, min(4.f, vid_gamma)); - float contrast = max(0.1f, min(3.f, vid_contrast)); - float bright = max(-0.8f, min(0.8f, vid_brightness)); + float gamma = max(0.1f, min(4.f, g_videoGamma)); + float contrast = max(0.1f, min(3.f, g_videoContrast)); + float bright = max(-0.8f, min(0.8f, g_videoBrightness)); float invgamma = 1.f / gamma; float norm = powf(255.f, invgamma - 1.f); - if (novideo) - return 0; - if (lastvidgcb[0] == gamma && lastvidgcb[1] == contrast && lastvidgcb[2] == bright) return 0; @@ -2403,7 +2395,7 @@ int32_t handleevents(void) rv = handleevents_pollsdl(); inputchecked = 0; - sampletimer(); + timerUpdate(); #ifndef _WIN32 startwin_idle(NULL); diff --git a/source/build/src/sdlayer12.cpp b/source/build/src/sdlayer12.cpp index e0ee91d64..a1e3d8ab3 100644 --- a/source/build/src/sdlayer12.cpp +++ b/source/build/src/sdlayer12.cpp @@ -18,15 +18,15 @@ HWND win_gethwnd(void) } #endif -int32_t setvsync(int32_t newSync) +int32_t videoSetVsync(int32_t newSync) { if (vsync_renderlayer == newSync) return newSync; vsync_renderlayer = newSync; - resetvideomode(); - if (setgamemode(fullscreen, xdim, ydim, bpp)) + videoResetMode(); + if (videoSetGameMode(fullscreen, xdim, ydim, bpp)) OSD_Printf("restartvid: Reset failed...\n"); return newSync; @@ -174,7 +174,7 @@ static inline char grabmouse_low(char a) } // high-resolution timers for profiling -uint64_t getu64ticks(void) +uint64_t timerGetTicksU64(void) { # if defined _WIN32 return win_getu64ticks(); @@ -201,7 +201,7 @@ uint64_t getu64ticks(void) # endif } -uint64_t getu64tickspersec(void) +uint64_t timerGetFreqU64(void) { # if defined _WIN32 return win_timerfreq; @@ -219,7 +219,7 @@ uint64_t getu64tickspersec(void) # endif } -void getvalidmodes(void) +void videoGetModes(void) { int32_t i, maxx = 0, maxy = 0; int32_t j; @@ -317,7 +317,7 @@ void getvalidmodes(void) // // setvideomode() -- set SDL video mode // -int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) +int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs) { int32_t regrab = 0, ret; #ifdef USE_OPENGL @@ -433,7 +433,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) // // showframe() -- update the display // -void showframe(int32_t w) +void videoShowFrame(int32_t w) { UNREFERENCED_PARAMETER(w); @@ -453,7 +453,7 @@ void showframe(int32_t w) if (lockcount) { printf("Frame still locked %d times when showframe() called.\n", lockcount); - while (lockcount) enddrawing(); + while (lockcount) videoEndDrawing(); } // deferred palette updating diff --git a/source/build/src/startgtk.editor.cpp b/source/build/src/startgtk.editor.cpp index 393929090..1df9dffd7 100644 --- a/source/build/src/startgtk.editor.cpp +++ b/source/build/src/startgtk.editor.cpp @@ -155,8 +155,8 @@ static void PopulateForm(void) GtkComboBox *box2d, *box3d; char buf[64]; - mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); - mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); + mode2d = videoCheckMode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); + mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); if (mode2d < 0) mode2d = 0; if (mode3d < 0) { @@ -164,7 +164,7 @@ static void PopulateForm(void) for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; } for (; cd[i]; i++) { - mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); + mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); if (mode3d < 0) continue; settings.bpp3d = cd[i]; break; diff --git a/source/build/src/startwin.editor.cpp b/source/build/src/startwin.editor.cpp index 79304b380..f8780f94f 100644 --- a/source/build/src/startwin.editor.cpp +++ b/source/build/src/startwin.editor.cpp @@ -43,8 +43,8 @@ static void PopulateForm(void) hwnd2d = GetDlgItem(pages[TAB_CONFIG], IDC2DVMODE); hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE); - mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); - mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); + mode2d = videoCheckMode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); + mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); if (mode2d < 0) mode2d = 0; if (mode3d < 0) { @@ -52,7 +52,7 @@ static void PopulateForm(void) for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; } for (; cd[i]; i++) { - mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); + mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); if (mode3d < 0) continue; settings.bpp3d = cd[i]; break; diff --git a/source/build/src/winlayer.cpp b/source/build/src/winlayer.cpp index 1f50584f8..8c1388536 100644 --- a/source/build/src/winlayer.cpp +++ b/source/build/src/winlayer.cpp @@ -399,7 +399,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC // atexit(uninitsystem); startwin_open(); - baselayer_init(); r = app_main(_buildargc, _buildargv); @@ -539,7 +538,7 @@ void uninitsystem(void) startwin_close(); uninitinput(); - uninittimer(); + timerUninit(); win_uninit(); @@ -559,7 +558,7 @@ void uninitsystem(void) // void system_getcvars(void) { - vsync = setvsync(vsync); + vsync = videoSetVsync(vsync); } @@ -675,7 +674,7 @@ int32_t handleevents(void) if (!appactive || quitevent) rv = -1; - sampletimer(); + timerUpdate(); return rv; } @@ -721,7 +720,7 @@ void uninitinput(void) void idle_waitevent_timeout(uint32_t timeout) { // timeout becomes a completion deadline - timeout += getticks(); + timeout += timerGetTicks(); do { @@ -738,7 +737,7 @@ void idle_waitevent_timeout(uint32_t timeout) Sleep(10); } - while (timeout > (getticks() + 10)); + while (timeout > (timerGetTicks() + 10)); } @@ -1385,7 +1384,7 @@ static void (*usertimercallback)(void) = NULL; // // installusertimercallback() -- set up a callback function to be called when the timer is fired // -void (*installusertimercallback(void (*callback)(void)))(void) +void (*timerSetCallback(void (*callback)(void)))(void) { void (*oldtimercallback)(void); @@ -1399,7 +1398,7 @@ void (*installusertimercallback(void (*callback)(void)))(void) // // inittimer() -- initialize timer // -int32_t inittimer(int32_t tickspersecond) +int32_t timerInit(int32_t tickspersecond) { int64_t t; @@ -1417,7 +1416,7 @@ int32_t inittimer(int32_t tickspersecond) usertimercallback = NULL; - msperu64tick = 1000.0 / (double)getu64tickspersec(); + msperu64tick = 1000.0 / (double)timerGetFreqU64(); return 0; } @@ -1425,7 +1424,7 @@ int32_t inittimer(int32_t tickspersecond) // // uninittimer() -- shut down timer // -void uninittimer(void) +void timerUninit(void) { if (!win_timerfreq) return; @@ -1438,7 +1437,7 @@ void uninittimer(void) // // sampletimer() -- update totalclock // -void sampletimer(void) +void timerUpdate(void) { int64_t i; int32_t n; @@ -1460,7 +1459,7 @@ void sampletimer(void) // // getticks() -- returns the windows ticks count // -uint32_t getticks(void) +uint32_t timerGetTicks(void) { int64_t i; if (win_timerfreq == 0) return 0; @@ -1469,27 +1468,27 @@ uint32_t getticks(void) } // high-resolution timers for profiling -uint64_t getu64ticks(void) +uint64_t timerGetTicksU64(void) { return win_getu64ticks(); } -uint64_t getu64tickspersec(void) +uint64_t timerGetFreqU64(void) { return win_timerfreq; } // Returns the time since an unspecified starting time in milliseconds. ATTRIBUTE((flatten)) -double gethiticks(void) +double timerGetHiTicks(void) { - return (double)getu64ticks() * msperu64tick; + return (double)timerGetTicksU64() * msperu64tick; } // // gettimerfreq() -- returns the number of ticks per second the timer is configured to generate // -int32_t gettimerfreq(void) +int32_t timerGetFreq(void) { return timerticspersec; } @@ -1524,11 +1523,11 @@ static int32_t getgammaramp(LPDDGAMMARAMP gt); // // checkvideomode() -- makes sure the video mode passed is legal // -int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced) +int32_t videoCheckMode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced) { int32_t i, nearest=-1, dx, dy, odx=9999, ody=9999; - getvalidmodes(); + videoGetModes(); // fix up the passed resolution values to be multiples of 8 // and at least 320x200 or at most MAXXDIMxMAXYDIM @@ -1588,7 +1587,7 @@ int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t fo static HWND hGLWindow = NULL; #endif -int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) +int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs) { char inp; int32_t modenum; @@ -1599,7 +1598,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) return 0; } - modenum = checkvideomode(&x,&y,c,fs,0); + modenum = videoCheckMode(&x,&y,c,fs,0); if (modenum < 0) return -1; if (modenum == 0x7fffffff) { @@ -1630,7 +1629,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) { // float f = 1.0 + ((float)curbrightness / 10.0); if (getgammaramp(&sysgamma) >= 0) gammabrightness = 1; - if (gammabrightness && setgamma() < 0) gammabrightness = 0; + if (gammabrightness && videoSetGamma() < 0) gammabrightness = 0; } #if defined USE_OPENGL && defined USE_GLEXT @@ -1668,7 +1667,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)) -int32_t setvsync(int32_t newSync) +int32_t videoSetVsync(int32_t newSync) { #ifdef USE_OPENGL if (!glinfo.vsync) @@ -1766,7 +1765,7 @@ static int sortmodes(const void *a_, const void *b_) return 0; } -void getvalidmodes(void) +void videoGetModes(void) { int32_t cdepths[2] = { 8, 0 }; int32_t i, j, maxx=0, maxy=0; @@ -1827,7 +1826,7 @@ void getvalidmodes(void) // // resetvideomode() -- resets the video system // -void resetvideomode(void) +void videoResetMode(void) { videomodereset = 1; modeschecked = 0; @@ -1842,7 +1841,7 @@ uint32_t begindrawing_line[BEGINDRAWING_SIZE]; const char *begindrawing_file[BEGINDRAWING_SIZE]; void begindrawing_real(void) #else -void begindrawing(void) +void videoBeginDrawing(void) #endif { if (bpp > 8) @@ -1881,7 +1880,7 @@ void begindrawing(void) // // enddrawing() -- unlocks the framebuffer // -void enddrawing(void) +void videoEndDrawing(void) { if (bpp > 8) { @@ -1899,7 +1898,7 @@ void enddrawing(void) // // showframe() -- update the display // -void showframe(int32_t w) +void videoShowFrame(int32_t w) { HRESULT result; DDSURFACEDESC ddsd; @@ -1924,7 +1923,7 @@ void showframe(int32_t w) if (lockcount) { initprintf("Frame still locked %d times when showframe() called.\n", lockcount); - while (lockcount) enddrawing(); + while (lockcount) videoEndDrawing(); } if (!fullscreen) @@ -2000,7 +1999,7 @@ void showframe(int32_t w) // New behaviour: curpalettefaded is the live palette, and any changes this function // makes are done to it and not the base palette. // -int32_t setpalette(int32_t start, int32_t num) +int32_t videoUpdatePalette(int32_t start, int32_t num) { int32_t i, n; HRESULT result; @@ -2116,13 +2115,13 @@ static int32_t setgammaramp(LPDDGAMMARAMP gt) return 0; } -int32_t setgamma(void) +int32_t videoSetGamma(void) { int32_t i; static DDGAMMARAMP gammaTable; - float gamma = max(0.1f,min(4.f,vid_gamma)); - float contrast = max(0.1f,min(3.f,vid_contrast)); - float bright = max(-0.8f,min(0.8f,vid_brightness)); + float gamma = max(0.1f,min(4.f,g_videoGamma)); + float contrast = max(0.1f,min(3.f,g_videoContrast)); + float bright = max(-0.8f,min(0.8f,g_videoBrightness)); double invgamma = 1 / gamma; double norm = pow(255., invgamma - 1); @@ -2809,7 +2808,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp) unloadwgl(); nogl = 1; modeschecked = 0; - getvalidmodes(); + videoGetModes(); return TRUE; } @@ -3515,7 +3514,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA } realfs = fullscreen; silentvideomodeswitch = 1; - setgamemode(!fullscreen,xdim,ydim,bpp); + videoSetGameMode(!fullscreen,xdim,ydim,bpp); ShowWindow(hWindow, SW_MINIMIZE); } else if (appactive && realfs) @@ -3528,7 +3527,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA ShowWindow(hWindow, SW_RESTORE); SetForegroundWindow(hWindow); SetFocus(hWindow); - setgamemode(realfs,xdim,ydim,bpp); + videoSetGameMode(realfs,xdim,ydim,bpp); silentvideomodeswitch = 0; realfs = 0; } @@ -3569,10 +3568,10 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA initprintf("Palette set failed: %s\n", GetDDrawError(result)); break; } - setpalette(0,256); + videoUpdatePalette(0,256); break; } - if (appactive && (HWND)wParam != hWindow) setpalette(0,256); + if (appactive && (HWND)wParam != hWindow) videoUpdatePalette(0,256); break; case WM_DISPLAYCHANGE: @@ -3580,7 +3579,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA desktopxdim = LOWORD(lParam); desktopydim = HIWORD(lParam); desktopbpp = wParam; - getvalidmodes(); + videoGetModes(); break; case WM_PAINT: diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 18257829c..b0ceef079 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -8388,7 +8388,7 @@ static void G_DoEventGame(int const nEventID) void G_MoveWorld(void) { extern double g_moveActorsTime, g_moveWorldTime; - const double worldTime = gethiticks(); + const double worldTime = timerGetHiTicks(); VM_OnEvent(EVENT_PREWORLD, -1, -1); @@ -8402,11 +8402,11 @@ void G_MoveWorld(void) G_MoveFallers(); //ST 12 G_MoveMisc(); //ST 5 - const double actorsTime = gethiticks(); + const double actorsTime = timerGetHiTicks(); G_MoveActors(); //ST 1 - g_moveActorsTime = (1-0.033)*g_moveActorsTime + 0.033*(gethiticks()-actorsTime); + g_moveActorsTime = (1-0.033)*g_moveActorsTime + 0.033*(timerGetHiTicks()-actorsTime); // XXX: Has to be before effectors, in particular movers? // TODO: lights in moving sectors ought to be interpolated @@ -8423,5 +8423,5 @@ void G_MoveWorld(void) G_DoSectorAnimations(); G_MoveFX(); //ST 11 - g_moveWorldTime = (1-0.033)*g_moveWorldTime + 0.033*(gethiticks()-worldTime); + g_moveWorldTime = (1-0.033)*g_moveWorldTime + 0.033*(timerGetHiTicks()-worldTime); } diff --git a/source/duke3d/src/anim.cpp b/source/duke3d/src/anim.cpp index 258ad0c86..b152e0458 100644 --- a/source/duke3d/src/anim.cpp +++ b/source/duke3d/src/anim.cpp @@ -304,7 +304,7 @@ int32_t Anim_Play(const char *fn) uint32_t const convdenom = info.fpsnumer * origanim->framedelay; uint32_t const msecsperframe = scale(info.fpsdenom, 1000, info.fpsnumer); - uint32_t nextframetime = getticks(); + uint32_t nextframetime = timerGetTicks(); uint8_t *pic; // OSD_Printf("msecs per frame: %d\n", msecsperframe); @@ -331,7 +331,7 @@ int32_t Anim_Play(const char *fn) VM_OnEventWithReturn(EVENT_PRECUTSCENE, g_player[screenpeek].ps->i, screenpeek, framenum); - clearallviews(0); + videoClearScreen(0); ototalclock = totalclock + 1; // pause game like ANMs @@ -385,7 +385,7 @@ int32_t Anim_Play(const char *fn) // this and showframe() instead of nextpage() are so that // nobody tramples on our carefully set up GL state! palfadedelta = 0; - showframe(0); + videoShowFrame(0); // I_ClearAllInput(); @@ -398,7 +398,7 @@ int32_t Anim_Play(const char *fn) running = 0; break; } - } while (getticks() < nextframetime); + } while (timerGetTicks() < nextframetime); } while (running); animvpx_print_stats(&codec); @@ -513,7 +513,7 @@ int32_t Anim_Play(const char *fn) frametime = totalclock; - clearallviews(0); + videoClearScreen(0); int32_t z; if (anim->frameaspect1 > 0 && anim->frameaspect2 > 0 && ((anim->frameaspect1 / anim->frameaspect2) != (tilesiz[TILE_ANIM].y / (tilesiz[TILE_ANIM].x * 1.2)))) @@ -524,9 +524,9 @@ int32_t Anim_Play(const char *fn) else z = divscale16(lrint(320 * ydim * anim->frameaspect1), lrint(tilesiz[TILE_ANIM].y * xdim * anim->frameaspect2)); int32_t aspect = divscale16(lrint(tilesiz[TILE_ANIM].y * anim->frameaspect2), lrint(tilesiz[TILE_ANIM].x * anim->frameaspect1)); - setaspect(viewingrange, aspect); + videoSetAspect(viewingrange, aspect); rotatesprite_fs(160<<16, 100<<16, z, 512, TILE_ANIM, 0, 0, 2|4|8|64|1024); - setaspect(viewingrange, oyxaspect); + videoSetAspect(viewingrange, oyxaspect); } else { @@ -541,7 +541,7 @@ int32_t Anim_Play(const char *fn) i = VM_OnEventWithReturn(EVENT_CUTSCENE, g_player[screenpeek].ps->i, screenpeek, i); g_animPtr = NULL; - nextpage(); + videoNextPage(); I_ClearAllInput(); diff --git a/source/duke3d/src/astub.cpp b/source/duke3d/src/astub.cpp index e8b225e67..874614dd2 100644 --- a/source/duke3d/src/astub.cpp +++ b/source/duke3d/src/astub.cpp @@ -1038,7 +1038,7 @@ void ExtShowSectorData(int16_t sectnum) //F5 ydim -= 8; // vvvvvv reset at end!! - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ x=1; x2=14; y=4; yi=2; @@ -1102,7 +1102,7 @@ void ExtShowSectorData(int16_t sectnum) //F5 PrintStatus("Skill 4 =", totalactors4, 65, 13, 11); PrintStatus("Respawn =", totalrespawn, 65, 14, 11); - enddrawing(); //}}} + videoEndDrawing(); //}}} ydim += 8; // ^^^^^^ see above! } @@ -1220,7 +1220,7 @@ void ExtShowWallData(int16_t wallnum) //F6 for (i=0; inumlines) _printmessage16("%s", helppage[0]->line[curhp]); @@ -1677,7 +1677,7 @@ ENDFOR1: disptext[i], 0); } - showframe(1); + videoShowFrame(1); } clearkeys(); @@ -1838,9 +1838,9 @@ static void SoundDisplay(void) while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F2]==0 && keystatus[buildkeys[BK_MODE2D_3D]]==0) // quickjump to 3d mode { - begindrawing(); + videoBeginDrawing(); CLEARLINES2D(0, ydim16, 0); - enddrawing(); + videoEndDrawing(); idle_waitevent(); if (handleevents()) @@ -1848,11 +1848,11 @@ static void SoundDisplay(void) // drawgradient(); - begindrawing(); + videoBeginDrawing(); printext16(9, ydim2d-overridepm16y+9, editorcolors[4], -1, "Sound Index", 0); printext16(8, ydim2d-overridepm16y+8, editorcolors[12], -1, "Sound Index", 0); printext16(8 + 11*8 + 2*8, ydim2d-overridepm16y+8, editorcolors[15], -1, "(SPACE:play, S:sort)", 0); - enddrawing(); + videoEndDrawing(); if (PRESSED_KEYSC(G)) // goto specified sound# { @@ -1968,7 +1968,7 @@ static void SoundDisplay(void) char ch, bad=0; _printmessage16("Sort by: (S)oundnum (D)ef (F)ile ori(g) or flags (12345)"); - showframe(1); + videoShowFrame(1); i=0; keyFlushChars(); @@ -1993,7 +1993,7 @@ static void SoundDisplay(void) clearkeys(); } else - showframe(1); + videoShowFrame(1); } overridepm16y = -1; @@ -2417,16 +2417,16 @@ int32_t AskIfSure(const char *text) if (in3dmode()) { - begindrawing(); //{{{ + videoBeginDrawing(); //{{{ printext256(0,0,whitecol,0,text?text:"Are you sure you want to proceed?",0); - enddrawing(); //}}} + videoEndDrawing(); //}}} } else { _printmessage16("%s", text?text:"Are you sure you want to proceed?"); } - showframe(1); + videoShowFrame(1); while ((keystatus[KEYSC_ESC]|keystatus[KEYSC_ENTER]|keystatus[KEYSC_SPACE]|keystatus[KEYSC_N]) == 0) { @@ -2498,7 +2498,7 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i #define TMPERRMSG_PRINT(Msg, ...) do { \ Bsprintf(tilesel_errmsg, Msg, ## __VA_ARGS__); \ TMPERRMSG_SHOW(1); \ - showframe(1); \ + videoShowFrame(1); \ tilesel_showerr = 1; \ } while (0) @@ -3278,7 +3278,7 @@ static int32_t OnSelectTile(int32_t tileNum) glEnable(GL_TEXTURE_2D); } #endif - clearview(-1); + videoClearViewableArea(-1); // // Await appropriate selection keypress. @@ -3312,7 +3312,7 @@ static int32_t OnSelectTile(int32_t tileNum) } } } - showframe(1); + videoShowFrame(1); ch = keyGetChar(); @@ -3327,7 +3327,7 @@ static int32_t OnSelectTile(int32_t tileNum) } } - showframe(1); + videoShowFrame(1); clearkeys(); @@ -3515,9 +3515,9 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i glDrawBuffer(GL_FRONT_AND_BACK); } #endif - clearview(-1); + videoClearViewableArea(-1); - begindrawing(); + videoBeginDrawing(); restart: for (YTile = 0-(offset>0); YTile < nYTiles+(offset<0)+1; YTile++) @@ -3585,8 +3585,8 @@ restart: } if (k) { - enddrawing(); - showframe(1); + videoEndDrawing(); + videoShowFrame(1); #ifdef USE_OPENGL if (getrendermode() >= REND_POLYMOST && lazyselector) glDrawBuffer(GL_BACK); @@ -3594,9 +3594,9 @@ restart: return 1; } - enddrawing(); - showframe(1); - begindrawing(); + videoEndDrawing(); + videoShowFrame(1); + videoBeginDrawing(); } } } @@ -3607,17 +3607,17 @@ restart: { if (runi==0) { - enddrawing(); - showframe(1); - begindrawing(); + videoEndDrawing(); + videoShowFrame(1); + videoBeginDrawing(); runi = 1; goto restart; } } - enddrawing(); - showframe(1); + videoEndDrawing(); + videoShowFrame(1); #ifdef USE_OPENGL if (getrendermode() >= REND_POLYMOST && lazyselector) @@ -3670,16 +3670,16 @@ static void drawtileinfo(const char *title,int32_t x,int32_t y,int32_t picnum,in const int32_t scale = (int32_t)(65536.0/scalediv); const int32_t oviewingrange=viewingrange, oyxaspect=yxaspect; - setaspect(65536, divscale16(ydim*320, xdim*200)); + videoSetAspect(65536, divscale16(ydim*320, xdim*200)); // +1024: prevents rotatesprite from setting aspect itself rotatesprite_fs((x1+13)<<16,(y+11)<<16,scale,0, picnum,shade,pal, 2+1024); - setaspect(oviewingrange, oyxaspect); + videoSetAspect(oviewingrange, oyxaspect); } x = (int32_t)(x * xdimgame/320.0); y = (int32_t)(y * ydimgame/200.0); - begindrawing(); + videoBeginDrawing(); printext256(x+2,y+2,0,-1,title,small); printext256(x,y,editorcolors[14],-1,title,small); @@ -3709,7 +3709,7 @@ static void drawtileinfo(const char *title,int32_t x,int32_t y,int32_t picnum,in tileinfo_doprint(x, y, buf, "Hit", hitag, 0, 6); tileinfo_doprint(x, y, buf, (flags&2)?"Ex*":"Ext", extra, statnum, 7); - enddrawing(); + videoEndDrawing(); } //int32_t snap=0; //int32_t saveval1,saveval2,saveval3; @@ -3788,7 +3788,7 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int Bsprintf(buffer,"%s",(char *)func((int32_t)danum)); printmessage256(0, 9, buffer); } - showframe(1); + videoShowFrame(1); if (getnumber_internal1(ch, &danum, maxnumber, sign) || getnumber_autocomplete(namestart, ch, &danum, flags)) @@ -3979,7 +3979,7 @@ ENDFOR1: Bsprintf(buffer, "Hgap=%d, Vgap=%d, SPCgap=%d, Shd=%d, Pal=%d", hgap, vgap, spcgap[alphidx], TrackerCast(sprite[linebegspr].shade), TrackerCast(sprite[linebegspr].pal)); printmessage256(0, 9, buffer); - showframe(1); + videoShowFrame(1); // --- sp = &sprite[curspr]; @@ -4447,14 +4447,14 @@ static void Keys3d(void) Bsprintf(lines[num++], "^%d%s", editorcolors[10], getmessage); } - begindrawing(); + videoBeginDrawing(); for (i=0; i>6; } - enddrawing(); + videoEndDrawing(); } VM_OnEvent(EVENT_PREKEYS3D, -1); @@ -5438,7 +5438,7 @@ static void Keys3d(void) static int32_t LastSec = 0; static int32_t LastMS = 0; - int32_t ms = getticks(); + int32_t ms = timerGetTicks(); int32_t howlong = ms - LastMS; if (howlong >= 0) @@ -5537,10 +5537,10 @@ static void Keys3d(void) int32_t small = !(xdimgame > 640); for (i=0; i= 0) // fillsector(cursectornum, 31); @@ -10409,10 +10409,10 @@ void ExtPreCheckKeys(void) // just before drawrooms continue; const int32_t oviewingrange=viewingrange, oyxaspect=yxaspect; - setaspect(yxaspect, divscale16(sprite[i].yrepeat, sprite[i].xrepeat)); + videoSetAspect(yxaspect, divscale16(sprite[i].yrepeat, sprite[i].xrepeat)); rotatesprite(xp1<<16,yp1<<16,zoom<<5,daang,picnum, shade,sprite[i].pal,flags|1024,0,0,xdim-1,ydim16-1); - setaspect(oviewingrange, oyxaspect); + videoSetAspect(oviewingrange, oyxaspect); } } @@ -10449,7 +10449,7 @@ void ExtPreCheckKeys(void) // just before drawrooms } } - enddrawing(); //}}} + videoEndDrawing(); //}}} } void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr) @@ -10951,7 +10951,7 @@ void ExtCheckKeys(void) void faketimerhandler(void) { - sampletimer(); + timerUpdate(); } void SetGamePalette(int32_t palid) @@ -11272,13 +11272,13 @@ static void EditSectorData(int16_t sectnum) if (med_editval) med_editval = 0; - showframe(1); + videoShowFrame(1); } med_printcurline(xpos, ypos, row, 0); // printmessage16(""); - showframe(1); + videoShowFrame(1); keystatus[KEYSC_ESC] = 0; } @@ -11374,13 +11374,13 @@ static void EditWallData(int16_t wallnum) //// printmessage16(""); } - showframe(1); + videoShowFrame(1); } med_printcurline(xpos, ypos, row, 0); // printmessage16(""); - showframe(1); + videoShowFrame(1); keystatus[KEYSC_ESC] = 0; } @@ -11613,12 +11613,12 @@ static void EditSpriteData(int16_t spritenum) if (med_editval) med_editval = 0; - showframe(1); + videoShowFrame(1); } med_printcurline(xpos, ypos, row, 0); // printmessage16(""); - showframe(1); + videoShowFrame(1); keystatus[KEYSC_ESC] = 0; } @@ -11777,12 +11777,12 @@ static void GenericSpriteSearch(void) printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[1],disptext,0); - showframe(1); + videoShowFrame(1); } printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); printmessage16("Search sprite"); - showframe(1); + videoShowFrame(1); keystatus[KEYSC_ESC] = 0; } diff --git a/source/duke3d/src/demo.cpp b/source/duke3d/src/demo.cpp index d3f33ca35..f97588999 100644 --- a/source/duke3d/src/demo.cpp +++ b/source/duke3d/src/demo.cpp @@ -399,14 +399,14 @@ static void Demo_StopProfiling(void) static void Demo_GToc(double t) { g_prof.numtics++; - g_prof.totalgamems += gethiticks()-t; + g_prof.totalgamems += timerGetHiTicks()-t; } static void Demo_RToc(double t1, double t2) { g_prof.numframes++; g_prof.totalroomsdrawms += t2-t1; - g_prof.totalrestdrawms += gethiticks()-t2; + g_prof.totalrestdrawms += timerGetHiTicks()-t2; } static void Demo_DisplayProfStatus(void) @@ -420,11 +420,11 @@ static void Demo_DisplayProfStatus(void) return; lastpercent = percent; - clearallviews(0); + videoClearScreen(0); Bsnprintf(buf, sizeof(buf), "timing... %d/%d game tics (%d %%)", g_demo_cnt, g_demo_totalCnt, percent); gametext_center(60, buf); - nextpage(); + videoNextPage(); } static void Demo_SetupProfile(void) @@ -436,7 +436,7 @@ static void Demo_SetupProfile(void) Bmemset(&g_prof, 0, sizeof(g_prof)); - g_prof.starthiticks = gethiticks(); + g_prof.starthiticks = timerGetHiTicks(); } static void Demo_FinishProfile(void) @@ -468,7 +468,7 @@ static void Demo_FinishProfile(void) { double totalprofms = gms+dms1+dms2; - double totalms = gethiticks()-g_prof.starthiticks; + double totalms = timerGetHiTicks()-g_prof.starthiticks; if (totalprofms != 0) OSD_Printf("== demo %d: non-profiled time overhead: %.02f %%\n", dn, 100.0*totalms/totalprofms - 100.0); @@ -532,7 +532,7 @@ RECHECK: P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 G_DrawBackground(); M_DisplayMenus(); - nextpage(); + videoNextPage(); fadepal(0,0,0, 252,0,-28); ud.reccnt = 0; } @@ -738,7 +738,7 @@ nextdemo_nomenu: if (Demo_IsProfiling()) { - double t = gethiticks(); + double t = timerGetHiTicks(); G_DoMoveThings(); Demo_GToc(t); } @@ -813,7 +813,7 @@ nextdemo_nomenu: for (i=0; i 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ') { G_BonusScreen(1); - setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP); + videoSetGameMode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP); } // shareware and TEN screens @@ -324,10 +324,10 @@ static void M32_drawdebug(void) if (m32_numdebuglines>0) { - begindrawing(); + videoBeginDrawing(); for (i=0; i640?0:1); - enddrawing(); + videoEndDrawing(); } m32_numdebuglines=0; } @@ -669,9 +669,9 @@ static void G_ReadGLFrame(void) return; } - begindrawing(); + videoBeginDrawing(); glReadPixels(0, 0, xdim, ydim, GL_RGBA, GL_UNSIGNED_BYTE, frame); - enddrawing(); + videoEndDrawing(); for (y = 0; y < 200; y++) { @@ -716,7 +716,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) if (r_usenewaspect) { newaspect_enable = 1; - setaspect_new(); + videoSetCorrectedAspect(); } if (ud.pause_on || pPlayer->on_crane > -1) @@ -779,13 +779,13 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) ))); if (!r_usenewaspect) - setaspect(vr, yxaspect); + videoSetAspect(vr, yxaspect); else { viewingRange = vr; yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5); - setaspect(mulscale16(viewingRange,viewingrange), yxaspect); + videoSetAspect(mulscale16(viewingRange,viewingrange), yxaspect); } if (g_screenCapture) @@ -795,7 +795,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]); if (getrendermode() == REND_CLASSIC) - setviewtotile(TILE_SAVESHOT, 200, 320); + videoSetTarget(TILE_SAVESHOT, 200, 320); } else if (screenTilting) { @@ -854,7 +854,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) if (waloff[TILE_TILT] == 0) allocache(&waloff[TILE_TILT], maxTiltSize, &walock[TILE_TILT]); - setviewtotile(TILE_TILT, viewtilexsiz, viewtileysiz); + videoSetTarget(TILE_TILT, viewtilexsiz, viewtileysiz); if ((tang&1023) == 512) { @@ -877,7 +877,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) vRange = sintable[vRange + 512] * 8 + sintable[vRange] * 5; // setaspect(i>>1, yxaspect); - setaspect(mulscale16(oviewingrange, vRange >> 1), yxaspect); + videoSetAspect(mulscale16(oviewingrange, vRange >> 1), yxaspect); viewingRange = vRange >> 1; yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5); @@ -1053,7 +1053,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) if (getrendermode() == REND_CLASSIC) { - setviewback(); + videoRestoreTarget(); // walock[TILE_SAVESHOT] = 1; } #ifdef USE_OPENGL @@ -1067,7 +1067,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) if (screenTilting == 2) // tang == 1024 { - begindrawing(); + videoBeginDrawing(); { const int32_t height = windowxy2.y-windowxy1.y+1; const int32_t width = windowxy2.x-windowxy1.x+1; @@ -1086,11 +1086,11 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) for (x=0; x<(width>>1); x++) swapchar(&f[x], &f[width-1-x]); } - enddrawing(); + videoEndDrawing(); } else { - setviewback(); + videoRestoreTarget(); picanm[TILE_TILT].xofs = picanm[TILE_TILT].yofs = 0; int tiltZoom = (tang&511); @@ -1111,7 +1111,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) g_halveScreenArea = 0; G_UpdateScreenArea(); - begindrawing(); + videoBeginDrawing(); { uint8_t *const f = (uint8_t *)frameplace; const int32_t x1=g_halfScreen.x1, y1=g_halfScreen.y1; @@ -1136,7 +1136,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) B_BUF32(&f[yldst+x1+dx], pixl|(pixl<<8)|(pixr<<16)|(pixr<<24)); } } - enddrawing(); + videoEndDrawing(); } } @@ -1173,7 +1173,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) if (r_usenewaspect) { newaspect_enable = 0; - setaspect(viewingRange, yxAspect); + videoSetAspect(viewingRange, yxAspect); } VM_OnEvent(EVENT_DISPLAYROOMSEND, g_player[screenpeek].ps->i, screenpeek); @@ -4473,8 +4473,8 @@ void G_InitTimer(int32_t ticspersec) { if (g_timerTicsPerSecond != ticspersec) { - uninittimer(); - inittimer(ticspersec); + timerUninit(); + timerInit(ticspersec); g_timerTicsPerSecond = ticspersec; } } @@ -5841,7 +5841,7 @@ static void G_Startup(void) set_memerr_handler(&G_HandleMemErr); - inittimer(TICRATE); + timerInit(TICRATE); initcrc32table(); @@ -6172,10 +6172,10 @@ int G_FPSLimit(void) if (frameWaiting) { frameWaiting--; - nextpage(); + videoNextPage(); } - uint64_t const frameTicks = getu64ticks(); + uint64_t const frameTicks = timerGetTicksU64(); if (!r_maxfps || frameTicks >= nextPageTicks) { @@ -6444,10 +6444,10 @@ int app_main(int argc, char const * const * argv) Anim_Init(); const char *defsfile = G_DefFile(); - uint32_t stime = getticks(); + uint32_t stime = timerGetTicks(); if (!loaddefinitionsfile(defsfile)) { - uint32_t etime = getticks(); + uint32_t etime = timerGetTicks(); initprintf("Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime-stime); } loaddefinitions_game(defsfile, FALSE); @@ -6548,7 +6548,7 @@ int app_main(int argc, char const * const * argv) if (g_networkMode != NET_DEDICATED_SERVER) { - if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0) + if (videoSetGameMode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0) { vec2_t const res[] = { { ud.config.ScreenWidth, ud.config.ScreenHeight }, { 800, 600 }, { 640, 480 }, { 320, 240 }, @@ -6566,7 +6566,7 @@ int app_main(int argc, char const * const * argv) int resIdx = 0; int bppIdx = 0; - while (setgamemode(0, res[resIdx].x, res[resIdx].y, bpp[bppIdx]) < 0) + while (videoSetGameMode(0, res[resIdx].x, res[resIdx].y, bpp[bppIdx]) < 0) { initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n", res[resIdx].x, res[resIdx].y, bpp[bppIdx]); @@ -6711,7 +6711,7 @@ MAIN_LOOP_RESTART: quitevent = 0; } - sampletimer(); + timerUpdate(); Net_GetPackets(); // only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo @@ -6763,7 +6763,7 @@ MAIN_LOOP_RESTART: do { - sampletimer(); + timerUpdate(); if (ready2send == 0) break; @@ -6783,7 +6783,7 @@ MAIN_LOOP_RESTART: #endif } - sampletimer(); + timerUpdate(); if (totalclock - moveClock >= TICSPERFRAME) { @@ -6830,7 +6830,7 @@ MAIN_LOOP_RESTART: if (g_saveRequested) { KB_FlushKeyboardQueue(); - nextpage(); + videoNextPage(); g_screenCapture = 1; G_DrawRooms(myconnectindex, 65536); diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 32e9ca0e8..6fcb76fb2 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -6627,7 +6627,7 @@ void C_Compile(const char *fileName) g_logFlushWindow = 0; - uint32_t const startcompiletime = getticks(); + uint32_t const startcompiletime = timerGetTicks(); char * mptr = (char *)Xmalloc(kFileLen+1); mptr[kFileLen] = 0; @@ -6701,7 +6701,7 @@ void C_Compile(const char *fileName) C_SetScriptSize(g_scriptPtr-apScript+8); - initprintf("Script compiled in %dms, %ld bytes%s\n", getticks() - startcompiletime, + initprintf("Script compiled in %dms, %ld bytes%s\n", timerGetTicks() - startcompiletime, (unsigned long)(g_scriptPtr-apScript), C_ScriptVersionString(g_scriptVersion)); for (unsigned i=0; i < ARRAY_SIZE(tables_free); i++) diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 52cbcb2d8..af7c6fec2 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -142,12 +142,12 @@ intptr_t apScriptEvents[MAXEVENTS]; #ifdef LUNATIC static FORCE_INLINE int32_t VM_EventCommon_(int eventNum, int spriteNum, int playerNum, int playerDist, int32_t returnValue) { - const double t = gethiticks(); + const double t = timerGetHiTicks(); int32_t ret = El_CallEvent(&g_ElState, eventNum, spriteNum, playerNum, playerDist, &returnValue); // NOTE: the run times are those of the called event plus any events // called by it, *not* "self" time. - g_eventTotalMs[eventNum] += gethiticks()-t; + g_eventTotalMs[eventNum] += timerGetHiTicks()-t; g_eventCalls[eventNum]++; if (ret == 1) @@ -170,7 +170,7 @@ static void VM_DummySprite(void) static FORCE_INLINE int32_t VM_EventCommon_(int const eventNum, int const spriteNum, int const playerNum, int const playerDist, int32_t returnValue) { - const double t = gethiticks(); + const double t = timerGetHiTicks(); const vmstate_t tempvm = { spriteNum, playerNum, playerDist, 0, NULL, NULL, g_player[playerNum].ps, NULL }; @@ -215,7 +215,7 @@ static FORCE_INLINE int32_t VM_EventCommon_(int const eventNum, int const sprite aGameVars[g_returnVarID].global = backupReturnVar; - g_eventTotalMs[eventNum] += gethiticks()-t; + g_eventTotalMs[eventNum] += timerGetHiTicks()-t; g_eventCalls[eventNum]++; return returnValue; @@ -1200,7 +1200,7 @@ LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int32_t sec if (offscreenrendering) { - clearview(0); + videoClearViewableArea(0); return; } @@ -1232,7 +1232,7 @@ LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int32_t sec int const onewaspect = newaspect_enable; newaspect_enable = r_usenewaspect; setaspect_new_use_dimen = 1; - setview(x1,y1,x2,y2); + videoSetViewableArea(x1,y1,x2,y2); setaspect_new_use_dimen = 0; newaspect_enable = onewaspect; @@ -1270,7 +1270,7 @@ void Screen_Play(void) if (!G_FPSLimit()) continue; - clearallviews(0); + videoClearScreen(0); if (VM_OnEventWithReturn(EVENT_SCREEN, g_player[screenpeek].ps->i, screenpeek, I_CheckAllInput())) running = 0; @@ -1975,7 +1975,7 @@ skip_check: insptr++; { int const xRange = Gv_GetVarX(*insptr++); - setaspect(xRange, Gv_GetVarX(*insptr++)); + videoSetAspect(xRange, Gv_GetVarX(*insptr++)); break; } @@ -5815,7 +5815,7 @@ finish_qsprintf: case CON_GETTICKS: insptr++; - Gv_SetVarX(*insptr++, getticks()); + Gv_SetVarX(*insptr++, timerGetTicks()); continue; case CON_GETCURRADDRESS: @@ -5947,24 +5947,24 @@ void A_Execute(int spriteNum, int playerNum, int playerDist) if (L_IsInitialized(&g_ElState) && El_HaveActor(picnum)) { - double t = gethiticks(); + double t = timerGetHiTicks(); killit = (El_CallActor(&g_ElState, picnum, spriteNum, playerNum, playerDist)==1); - t = gethiticks()-t; + t = timerGetHiTicks()-t; g_actorTotalMs[picnum] += t; g_actorMinMs[picnum] = min(g_actorMinMs[picnum], t); g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], t); g_actorCalls[picnum]++; } #else - double t = gethiticks(); + double t = timerGetHiTicks(); int const picnum = vm.pSprite->picnum; insptr = 4 + (g_tile[vm.pSprite->picnum].execPtr); VM_Execute(1); insptr = NULL; - t = gethiticks()-t; + t = timerGetHiTicks()-t; g_actorTotalMs[picnum] += t; g_actorMinMs[picnum] = min(g_actorMinMs[picnum], t); g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], t); diff --git a/source/duke3d/src/m32common.cpp b/source/duke3d/src/m32common.cpp index 1f46eb72f..c19d651b7 100644 --- a/source/duke3d/src/m32common.cpp +++ b/source/duke3d/src/m32common.cpp @@ -65,11 +65,11 @@ const char *YUPDOWNWALL[2] = {"UPWALL","DOWNWALL"}; void drawgradient(void) { int32_t i, col = editorcolors[25]; - begindrawing(); + videoBeginDrawing(); for (i=ydim-STATUS2DSIZ+16; i0; i++,col--) CLEARLINES2D(i, 1, (col<<24)|(col<<16)|(col<<8)|col); CLEARLINES2D(i, ydim-i, 0); - enddrawing(); + videoEndDrawing(); } static void message_common1(const char *tmpstr) @@ -1655,11 +1655,11 @@ static void M_EnterMainLoop(StatusBarMenu *m) } #endif printext16(xpos, ypos+row*MENU_Y_SPACING, MENU_FG_COLOR, MENU_BG_COLOR_SEL, disptext, 0); - showframe(1); + videoShowFrame(1); } printext16(xpos, ypos+row*MENU_Y_SPACING, MENU_FG_COLOR, MENU_BG_COLOR, disptext, 0); - showframe(1); + videoShowFrame(1); keystatus[KEYSC_ESC] = 0; } diff --git a/source/duke3d/src/m32def.cpp b/source/duke3d/src/m32def.cpp index c135007c9..0ed1c4575 100644 --- a/source/duke3d/src/m32def.cpp +++ b/source/duke3d/src/m32def.cpp @@ -3739,7 +3739,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename) // flushlogwindow = 0; - startcompiletime = getticks(); + startcompiletime = timerGetTicks(); if (isfilename) { @@ -3809,7 +3809,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename) // C_SetScriptSize(g_scriptPtr-script+8); if (isfilename) { - int32_t ct = getticks() - startcompiletime; + int32_t ct = timerGetTicks() - startcompiletime; if (ct > 50) initprintf("Script compiled in %dms\n", ct); C_CompilationInfo(); diff --git a/source/duke3d/src/m32exec.cpp b/source/duke3d/src/m32exec.cpp index 7fbe9ddc7..8bc3c21d7 100644 --- a/source/duke3d/src/m32exec.cpp +++ b/source/duke3d/src/m32exec.cpp @@ -2887,7 +2887,7 @@ dodefault: insptr++; { int32_t j=*insptr++; - Gv_SetVarX(j, getticks()); + Gv_SetVarX(j, timerGetTicks()); } continue; @@ -2899,7 +2899,7 @@ dodefault: if (daxrange > (1<<20)) daxrange = (1<<20); if (dayxaspect < (1<<12)) dayxaspect = (1<<12); if (dayxaspect > (1<<20)) dayxaspect = (1<<20); - setaspect(daxrange, dayxaspect); + videoSetAspect(daxrange, dayxaspect); continue; } diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 82b9fece8..65b430282 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -1097,14 +1097,14 @@ static MenuEntry_t *MEL_RENDERERSETUP_POLYMER [] = { #endif #ifdef EDUKE32_ANDROID_MENU -static MenuRangeFloat_t MEO_COLCORR_GAMMA = MAKE_MENURANGE( &vid_gamma, &MF_Bluefont, 1.f, 2.5f, 0.f, 39, 1 ); +static MenuRangeFloat_t MEO_COLCORR_GAMMA = MAKE_MENURANGE( &g_videoGamma, &MF_Bluefont, 1.f, 2.5f, 0.f, 39, 1 ); #else -static MenuRangeFloat_t MEO_COLCORR_GAMMA = MAKE_MENURANGE( &vid_gamma, &MF_Bluefont, 0.3f, 4.f, 0.f, 38, 1 ); +static MenuRangeFloat_t MEO_COLCORR_GAMMA = MAKE_MENURANGE( &g_videoGamma, &MF_Bluefont, 0.3f, 4.f, 0.f, 38, 1 ); #endif static MenuEntry_t ME_COLCORR_GAMMA = MAKE_MENUENTRY( "Gamma:", &MF_Redfont, &MEF_ColorCorrect, &MEO_COLCORR_GAMMA, RangeFloat ); -static MenuRangeFloat_t MEO_COLCORR_CONTRAST = MAKE_MENURANGE( &vid_contrast, &MF_Bluefont, 0.1f, 2.7f, 0.f, 53, 1 ); +static MenuRangeFloat_t MEO_COLCORR_CONTRAST = MAKE_MENURANGE( &g_videoContrast, &MF_Bluefont, 0.1f, 2.7f, 0.f, 53, 1 ); static MenuEntry_t ME_COLCORR_CONTRAST = MAKE_MENUENTRY( "Contrast:", &MF_Redfont, &MEF_ColorCorrect, &MEO_COLCORR_CONTRAST, RangeFloat ); -static MenuRangeFloat_t MEO_COLCORR_BRIGHTNESS = MAKE_MENURANGE( &vid_brightness, &MF_Bluefont, -0.8f, 0.8f, 0.f, 33, 1 ); +static MenuRangeFloat_t MEO_COLCORR_BRIGHTNESS = MAKE_MENURANGE( &g_videoBrightness, &MF_Bluefont, -0.8f, 0.8f, 0.f, 33, 1 ); static MenuEntry_t ME_COLCORR_BRIGHTNESS = MAKE_MENUENTRY( "Brightness:", &MF_Redfont, &MEF_ColorCorrect, &MEO_COLCORR_BRIGHTNESS, RangeFloat ); static MenuEntry_t ME_COLCORR_RESET = MAKE_MENUENTRY( "Reset To Defaults", &MF_Redfont, &MEF_ColorCorrect, &MEO_NULL, Link ); #ifdef EDUKE32_ANDROID_MENU @@ -3041,9 +3041,9 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry) int32_t nrend = newrendermode; int32_t nvsync = newvsync; - if (setgamemode(n.flags, n.xdim, n.ydim, n.bppmax) < 0) + if (videoSetGameMode(n.flags, n.xdim, n.ydim, n.bppmax) < 0) { - if (setgamemode(p.flags, p.xdim, p.ydim, p.bppmax) < 0) + if (videoSetGameMode(p.flags, p.xdim, p.ydim, p.bppmax) < 0) { setrendermode(prend); G_GameExit("Failed restoring old video mode."); @@ -3051,7 +3051,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry) else { onvideomodechange(p.bppmax > 8); - vsync = setvsync(pvsync); + vsync = videoSetVsync(pvsync); } } else onvideomodechange(n.bppmax > 8); @@ -3059,7 +3059,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry) g_restorePalette = -1; G_UpdateScreenArea(); setrendermode(nrend); - vsync = setvsync(nvsync); + vsync = videoSetVsync(nvsync); ud.config.ScreenMode = fullscreen; ud.config.ScreenWidth = xdim; ud.config.ScreenHeight = ydim; @@ -3089,9 +3089,9 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry) } else if (entry == &ME_COLCORR_RESET) { - vid_gamma = DEFAULT_GAMMA; - vid_contrast = DEFAULT_CONTRAST; - vid_brightness = DEFAULT_BRIGHTNESS; + g_videoGamma = DEFAULT_GAMMA; + g_videoContrast = DEFAULT_CONTRAST; + g_videoBrightness = DEFAULT_BRIGHTNESS; ud.brightness = 0; r_ambientlight = r_ambientlightrecip = 1.f; setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); @@ -3226,7 +3226,7 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption) } else if (entry == &ME_VIDEOSETUP_FRAMELIMIT) { - g_frameDelay = newOption ? (getu64tickspersec()/newOption) : 0; + g_frameDelay = newOption ? (timerGetFreqU64()/newOption) : 0; } switch (g_currentMenu) @@ -3289,8 +3289,8 @@ static void Menu_EntryOptionDidModify(MenuEntry_t *entry) if (domodechange) { - resetvideomode(); - if (setgamemode(fullscreen, xdim, ydim, bpp)) + videoResetMode(); + if (videoSetGameMode(fullscreen, xdim, ydim, bpp)) OSD_Printf("restartvid: Reset failed...\n"); onvideomodechange(ud.config.ScreenBPP>8); G_RefreshLights(); @@ -6964,7 +6964,7 @@ void M_DisplayMenus(void) int32_t alpha; if (KXDWN) { - setaspect(viewingrange, 65536); + videoSetAspect(viewingrange, 65536); cursorpos.x = scale(cursorpos.x - (320<<15), ydim << 2, xdim * 3) + (320<<15); cursorpos.y = scale(cursorpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15); z = scale(32768, ydim << 2, xdim * 3); @@ -6980,7 +6980,7 @@ void M_DisplayMenus(void) rotatesprite_fs_alpha(cursorpos.x, cursorpos.y, z, 0, a, 0, p, o, alpha); if (KXDWN) - setaspect(viewingrange, oyxaspect); + videoSetAspect(viewingrange, oyxaspect); } } else diff --git a/source/duke3d/src/net.cpp b/source/duke3d/src/net.cpp index 4938f280f..26b8f12a8 100644 --- a/source/duke3d/src/net.cpp +++ b/source/duke3d/src/net.cpp @@ -411,7 +411,7 @@ void Net_ReceiveDisconnect(ENetEvent *event) void Net_GetPackets(void) { - sampletimer(); + timerUpdate(); MUSIC_Update(); S_Update(); diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index 4a7fb399b..bde0c5c1f 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -419,8 +419,8 @@ static int32_t osdcmd_music(osdfuncparm_t const * const parm) int32_t osdcmd_restartvid(osdfuncparm_t const * const UNUSED(parm)) { UNREFERENCED_CONST_PARAMETER(parm); - resetvideomode(); - if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP)) + videoResetMode(); + if (videoSetGameMode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP)) G_GameExit("restartvid: Reset failed...\n"); onvideomodechange(ud.config.ScreenBPP>8); G_UpdateScreenArea(); @@ -471,10 +471,10 @@ static int32_t osdcmd_vidmode(osdfuncparm_t const * const parm) break; } - if (setgamemode(newfs,newwidth,newheight,newbpp)) + if (videoSetGameMode(newfs,newwidth,newheight,newbpp)) { initprintf("vidmode: Mode change failed!\n"); - if (setgamemode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP)) + if (videoSetGameMode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP)) G_GameExit("vidmode: Reset failed!\n"); } ud.config.ScreenBPP = newbpp; @@ -1498,7 +1498,7 @@ static int32_t osdcmd_cvar_set_game(osdfuncparm_t const * const parm) else if (!Bstrcasecmp(parm->name, "r_maxfps")) { if (r_maxfps != 0) r_maxfps = clamp(r_maxfps, 30, 1000); - g_frameDelay = r_maxfps ? (getu64tickspersec()/r_maxfps) : 0; + g_frameDelay = r_maxfps ? (timerGetFreqU64()/r_maxfps) : 0; } else if (!Bstrcasecmp(parm->name, "r_ambientlight")) { @@ -1743,9 +1743,9 @@ int32_t registerosdcommands(void) { "touch_invert", "invert look up/down touch input", (void *) &droidinput.invertLook, CVAR_INT, 0, 1 }, #endif - { "vid_gamma","adjusts gamma component of gamma ramp",(void *)&vid_gamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, - { "vid_contrast","adjusts contrast component of gamma ramp",(void *)&vid_contrast, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, - { "vid_brightness","adjusts brightness component of gamma ramp",(void *)&vid_brightness, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, + { "vid_gamma","adjusts gamma component of gamma ramp",(void *)&g_videoGamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, + { "vid_contrast","adjusts contrast component of gamma ramp",(void *)&g_videoContrast, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, + { "vid_brightness","adjusts brightness component of gamma ramp",(void *)&g_videoBrightness, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, { "wchoice","sets weapon autoselection order", (void *)ud.wchoice, CVAR_STRING|CVAR_FUNCPTR, 0, MAX_WEAPONS }, }; diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index 79df7b92d..56498045e 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -286,19 +286,19 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent) i = ud.screen_size; ud.screen_size = 0; G_UpdateScreenArea(); - clearallviews(0L); + videoClearScreen(0L); } if ((uint32_t)j < 2*MAXTILES) { - clearallviews(0); + videoClearScreen(0); rotatesprite_fs(320<<15,200<<15,65536L,0, j > MAXTILES-1?j-MAXTILES:j,0,0, 2+8+64+BGSTRETCH); } else { - nextpage(); + videoNextPage(); return; } @@ -328,7 +328,7 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent) } VM_OnEventWithReturn(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, percent); - nextpage(); + videoNextPage(); if (!statustext) { @@ -340,7 +340,7 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent) { if (!statustext) { - clearallviews(0L); + videoClearScreen(0L); //g_player[myconnectindex].ps->palette = palette; //G_FadePalette(0,0,0,0); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 @@ -356,14 +356,14 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent) } else { - nextpage(); + videoNextPage(); return; } menutext_center(105,"Loading..."); if (statustext) gametext_center_number(180, statustext); VM_OnEventWithReturn(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, percent); - nextpage(); + videoNextPage(); } } @@ -385,7 +385,7 @@ void G_CacheMapData(void) polymost_glreset(); #endif - starttime = getticks(); + starttime = timerGetTicks(); S_PrecacheSounds(); G_PrecacheSprites(); @@ -490,7 +490,7 @@ void G_CacheMapData(void) { Bsprintf(tempbuf, "Loaded %d%% (%d/%d textures)\n", lpc, pc, g_precacheCount); G_DoLoadScreen(tempbuf, lpc); - sampletimer(); + timerUpdate(); if (totalclock - tc >= 1) { @@ -507,7 +507,7 @@ void G_CacheMapData(void) Bmemset(gotpic, 0, sizeof(gotpic)); - endtime = getticks(); + endtime = timerGetTicks(); OSD_Printf("Cache time: %dms\n", endtime-starttime); } @@ -579,7 +579,7 @@ void G_UpdateScreenArea(void) y2 = y1 + (ourydimen>>1); } - setview(x1,y1,x2-1,y2-1); + videoSetViewableArea(x1,y1,x2-1,y2-1); } G_GetCrosshairColor(); @@ -1359,25 +1359,25 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum) S_PlaySpecialMusicOrNothing(MUS_BRIEFING); flushperms(); - setview(0,0,xdim-1,ydim-1); - clearview(0L); - nextpage(); + videoSetViewableArea(0,0,xdim-1,ydim-1); + videoClearViewableArea(0L); + videoNextPage(); int animReturn = Anim_Play("vol41a.anm"); - clearview(0L); - nextpage(); + videoClearViewableArea(0L); + videoNextPage(); if (animReturn) goto end_vol4a; animReturn = Anim_Play("vol42a.anm"); - clearview(0L); - nextpage(); + videoClearViewableArea(0L); + videoNextPage(); if (animReturn) goto end_vol4a; Anim_Play("vol43a.anm"); - clearview(0L); - nextpage(); + videoClearViewableArea(0L); + videoNextPage(); end_vol4a: FX_StopAllSounds(); @@ -1772,7 +1772,7 @@ int G_EnterLevel(int gameMode) FX_StopAllSounds(); S_ClearSoundLocks(); FX_SetReverb(0); - setgamemode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP); + videoSetGameMode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP); } if (Menu_HaveUserMap()) @@ -2000,7 +2000,7 @@ int G_EnterLevel(int gameMode) g_restorePalette = -1; G_UpdateScreenArea(); - clearview(0L); + videoClearViewableArea(0L); G_DrawBackground(); G_DrawRooms(myconnectindex,65536); diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index 06e807c42..4b7c5f162 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -363,7 +363,7 @@ int32_t G_LoadPlayer(savebrief_t & sv) G_UpdateScreenArea(); G_DrawBackground(); menutext_center(100, "Loading..."); - nextpage(); + videoNextPage(); } Net_WaitForServer(); @@ -439,7 +439,7 @@ static void G_SaveTimers(void) static void G_RestoreTimers(void) { - sampletimer(); + timerUpdate(); totalclock = g_timers.totalclock; totalclocklock = g_timers.totalclocklock; @@ -2046,7 +2046,7 @@ static void sv_restload() #ifdef DEBUGGINGAIDS # define PRINTSIZE(name) do { if (mem) OSD_Printf(name ": %d\n", (int32_t)(mem-tmem)); \ - OSD_Printf(name ": %d ms\n", getticks()-t); t=getticks(); tmem=mem; } while (0) + OSD_Printf(name ": %d ms\n", timerGetTicks()-t); t=timerGetTicks(); tmem=mem; } while (0) #else # define PRINTSIZE(name) do { } while (0) #endif @@ -2061,7 +2061,7 @@ static uint8_t *dosaveplayer2(FILE *fil, uint8_t *mem) { #ifdef DEBUGGINGAIDS uint8_t *tmem = mem; - int32_t t=getticks(); + int32_t t=timerGetTicks(); #endif mem=writespecdata(svgm_udnetw, fil, mem); // user settings, players & net PRINTSIZE("ud"); @@ -2172,7 +2172,7 @@ static int32_t doloadplayer2(int32_t fil, uint8_t **memptr) uint8_t *mem = memptr ? *memptr : NULL; #ifdef DEBUGGINGAIDS uint8_t *tmem=mem; - int32_t t=getticks(); + int32_t t=timerGetTicks(); #endif if (readspecdata(svgm_udnetw, fil, &mem)) return -2; PRINTSIZE("ud"); diff --git a/source/duke3d/src/sbar.cpp b/source/duke3d/src/sbar.cpp index aa2ba1bb5..9a3ca50cf 100644 --- a/source/duke3d/src/sbar.cpp +++ b/source/duke3d/src/sbar.cpp @@ -1036,7 +1036,7 @@ void G_DrawBackground(void) const int32_t fstilep = tilesiz[MENUTILE].x>=320 && tilesiz[MENUTILE].y==200; int32_t bgtile = (fstilep ? MENUTILE : BIGHOLE); - clearallviews(0); + videoClearScreen(0); // when not rendering a game, fullscreen wipe // Gv_SetVar(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1); diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 6b186154f..0dde35ecb 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -329,7 +329,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 int32_t tmpydim = (xdim*5)/8; - setaspect(65536, divscale16(tmpydim*320, xdim*200)); + videoSetAspect(65536, divscale16(tmpydim*320, xdim*200)); xvect = sintable[(-cang)&2047] * czoom; yvect = sintable[(1536-cang)&2047] * czoom; @@ -571,7 +571,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 pop_nofog(); - setaspect_new(); + videoSetCorrectedAspect(); for (TRAVERSE_CONNECT(p)) { @@ -791,7 +791,7 @@ static void G_PrintFPS(void) static int32_t frameCount = 0, lastFPS = 0, lastFrameTime = 0, cumulativeFrameDelay = 0; static int32_t minFPS = -1, maxFPS = 0; - int32_t frameTime = getticks(); + int32_t frameTime = timerGetTicks(); int32_t frameDelay = frameTime - lastFrameTime; cumulativeFrameDelay += frameDelay; @@ -1067,7 +1067,7 @@ void G_DisplayRest(int32_t smoothratio) if (ud.overhead_on == 2) { - clearview(0L); + videoClearViewableArea(0L); drawmapview(cposx, cposy, pp->zoom, cang); } G_DrawOverheadMap(cposx, cposy, pp->zoom, cang); @@ -1173,13 +1173,13 @@ void G_DisplayRest(int32_t smoothratio) crosshair_scale = scale(crosshair_scale, ydim << 2, xdim * 3) >> 1; crosshair_pal = 0; crosshair_o |= 1024; - setaspect(viewingrange, 65536); + videoSetAspect(viewingrange, 65536); } rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, crosshair_pal, crosshair_o); if (KXDWN) - setaspect(viewingrange, oyxaspect); + videoSetAspect(viewingrange, oyxaspect); } } @@ -1204,13 +1204,13 @@ void G_DisplayRest(int32_t smoothratio) pointer_scale = scale(pointer_scale, ydim << 2, xdim * 3) >> 1; pointer_pal = 0; pointer_o |= 1024; - setaspect(viewingrange, 65536); + videoSetAspect(viewingrange, 65536); } rotatesprite_win(pointerpos.x, pointerpos.y, pointer_scale, 0, a, 0, pointer_pal, pointer_o); if (KXDWN) - setaspect(viewingrange, oyxaspect); + videoSetAspect(viewingrange, oyxaspect); } } #endif @@ -1233,7 +1233,7 @@ void G_DisplayRest(int32_t smoothratio) { int32_t vr=viewingrange, asp=yxaspect; VM_OnEvent_(EVENT_DISPLAYREST, g_player[screenpeek].ps->i, screenpeek); - setaspect(vr, asp); + videoSetAspect(vr, asp); } if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) @@ -1357,7 +1357,7 @@ void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e) if (ud.screenfade == 0) return; setpalettefade(r, g, b, e); - nextpage(); + videoNextPage(); int32_t tc = totalclock; while (totalclock < tc + 4) @@ -1400,13 +1400,13 @@ static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t // STEP must evenly divide END-START Bassert(klabs(end-start)%step == 0); - clearallviews(0); + videoClearScreen(0); // (end-start)/step + 1 iterations do { #ifdef __ANDROID__ //Needed for N7 2013 to stop corruption while fading video - clearview(0); + videoClearViewableArea(0); #endif if (KB_KeyPressed(sc_Space)) { @@ -1441,7 +1441,7 @@ void G_DisplayExtraScreens(void) #ifdef __ANDROID__ inExtraScreens = 1; #endif - setview(0, 0, xdim-1, ydim-1); + videoSetViewableArea(0, 0, xdim-1, ydim-1); flushperms(); //g_player[myconnectindex].ps->palette = palette; P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 @@ -1469,7 +1469,7 @@ void G_DisplayExtraScreens(void) #ifdef __ANDROID__ inExtraScreens = 1; #endif - setview(0, 0, xdim-1, ydim-1); + videoSetViewableArea(0, 0, xdim-1, ydim-1); flushperms(); //g_player[myconnectindex].ps->palette = palette; P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 @@ -1498,12 +1498,12 @@ void G_DisplayLogo(void) I_ClearAllInput(); - setview(0, 0, xdim-1, ydim-1); - clearallviews(0L); + videoSetViewableArea(0, 0, xdim-1, ydim-1); + videoClearScreen(0L); G_FadePalette(0, 0, 0, 252); flushperms(); - nextpage(); + videoNextPage(); G_UpdateAppTitle(); @@ -1528,8 +1528,8 @@ void G_DisplayLogo(void) I_ClearAllInput(); } - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); if (logoflags & LOGO_STOPANIMSOUNDS) { @@ -1567,13 +1567,13 @@ void G_DisplayLogo(void) } else { - clearallviews(0); + videoClearScreen(0); P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, 8 + 2 + 1); // JBF 20040308 fadepal(0, 0, 0, 0, 252, 28); flushperms(); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH); - nextpage(); + videoNextPage(); fadepaltile(0, 0, 0, 252, 0, -28, DREALMS); totalclock = 0; @@ -1581,7 +1581,7 @@ void G_DisplayLogo(void) { if (G_FPSLimit()) { - clearallviews(0); + videoClearScreen(0); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH); G_HandleAsync(); @@ -1597,19 +1597,19 @@ void G_DisplayLogo(void) } } - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); } I_ClearAllInput(); } - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); if (logoflags & LOGO_TITLESCREEN) { - clearallviews(0); + videoClearScreen(0); //g_player[myconnectindex].ps->palette = titlepal; P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 8+2+1); // JBF 20040308 @@ -1627,7 +1627,7 @@ void G_DisplayLogo(void) { if (G_FPSLimit()) { - clearallviews(0); + videoClearScreen(0); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH); if (logoflags & LOGO_DUKENUKEM) { @@ -1710,8 +1710,8 @@ void G_DisplayLogo(void) } flushperms(); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); //g_player[myconnectindex].ps->palette = palette; P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 @@ -1719,7 +1719,7 @@ void G_DisplayLogo(void) S_PlaySound(NITEVISION_ONOFF); //G_FadePalette(0,0,0,0); - clearallviews(0L); + videoClearScreen(0L); } #ifndef EDUKE32_STANDALONE @@ -1727,7 +1727,7 @@ void G_DoOrderScreen(void) { int32_t i; - setview(0, 0, xdim-1, ydim-1); + videoSetViewableArea(0, 0, xdim-1, ydim-1); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 @@ -1771,9 +1771,9 @@ static void G_BonusCutscenes(void) }; P_SetGamePalette(g_player[myconnectindex].ps, ENDINGPAL, 8+2+1); // JBF 20040308 - clearallviews(0L); + videoClearScreen(0L); rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH); - nextpage(); + videoNextPage(); fadepal(0, 0, 0, 252, 0, -4); I_ClearAllInput(); @@ -1783,7 +1783,7 @@ static void G_BonusCutscenes(void) { if (G_FPSLimit()) { - clearallviews(0L); + videoClearScreen(0L); rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH); // boss @@ -1862,19 +1862,19 @@ static void G_BonusCutscenes(void) if ((G_GetLogoFlags() & LOGO_NOE2BONUSSCENE) && (G_GetLogoFlags() & LOGO_NOE2ENDSCREEN)) return; - setview(0, 0, xdim-1, ydim-1); + videoSetViewableArea(0, 0, xdim-1, ydim-1); S_StopMusic(); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE2BONUSSCENE)) { fadepal(0, 0, 0, 252, 0, -4); Anim_Play("cineov2.anm"); I_ClearAllInput(); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); S_PlaySound(PIPEBOMB_EXPLODE); fadepal(0, 0, 0, 0, 252, 4); @@ -1896,11 +1896,11 @@ static void G_BonusCutscenes(void) if ((G_GetLogoFlags() & LOGO_NOE4BONUSSCENE) && (G_GetLogoFlags() & LOGO_NODUKETEAMTEXT) && (G_GetLogoFlags() & LOGO_NODUKETEAMPIC)) return; - setview(0, 0, xdim-1, ydim-1); + videoSetViewableArea(0, 0, xdim-1, ydim-1); S_StopMusic(); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE4BONUSSCENE)) { @@ -1908,20 +1908,20 @@ static void G_BonusCutscenes(void) I_ClearAllInput(); int t = Anim_Play("vol4e1.anm"); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); if (t) goto end_vol4e; t = Anim_Play("vol4e2.anm"); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); if (t) goto end_vol4e; Anim_Play("vol4e3.anm"); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); } end_vol4e: @@ -1939,16 +1939,16 @@ static void G_BonusCutscenes(void) G_FadePalette(0, 0, 0, 0); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308 // G_FadePalette(0,0,0,252); - clearallviews(0L); + videoClearScreen(0L); menutext_center(60, "Thanks to all our"); menutext_center(60+16, "fans for giving"); menutext_center(60+16+16, "us big heads."); menutext_center(70+16+16+16, "Look for a Duke Nukem 3D"); menutext_center(70+16+16+16+16, "sequel soon."); - nextpage(); + videoNextPage(); fadepal(0, 0, 0, 252, 0, -12); - nextpage(); + videoNextPage(); I_ClearAllInput(); G_HandleEventsWhileNoInput(); fadepal(0, 0, 0, 0, 252, 12); @@ -1957,16 +1957,16 @@ static void G_BonusCutscenes(void) goto VOL4_END; VOL4_DUKETEAM: - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); Anim_Play("DUKETEAM.ANM"); I_ClearAllInput(); G_HandleEventsWhileNoInput(); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); G_FadePalette(0, 0, 0, 252); VOL4_END: @@ -1981,8 +1981,8 @@ static void G_BonusCutscenes(void) return; S_StopMusic(); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE3BONUSSCENE)) { fadepal(0, 0, 0, 252, 0, -4); @@ -1991,8 +1991,8 @@ static void G_BonusCutscenes(void) ototalclock = totalclock+200; while (totalclock < ototalclock) G_HandleAsync(); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); FX_StopAllSounds(); S_ClearSoundLocks(); @@ -2034,16 +2034,16 @@ static void G_BonusCutscenes(void) S_ClearSoundLocks(); S_PlaySound(ENDSEQVOL3SND4); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); Anim_Play("DUKETEAM.ANM"); I_ClearAllInput(); G_HandleEventsWhileNoInput(); - clearallviews(0L); - nextpage(); + videoClearScreen(0L); + videoNextPage(); G_FadePalette(0, 0, 0, 252); } @@ -2051,7 +2051,7 @@ static void G_BonusCutscenes(void) FX_StopAllSounds(); S_ClearSoundLocks(); - clearallviews(0L); + videoClearScreen(0L); break; } @@ -2208,9 +2208,9 @@ void G_BonusScreen(int32_t bonusonly) fadepal(0, 0, 0, 0, 252, 28); - setview(0, 0, xdim-1, ydim-1); - clearallviews(0L); - nextpage(); + videoSetViewableArea(0, 0, xdim-1, ydim-1); + videoClearScreen(0L); + videoNextPage(); flushperms(); FX_StopAllSounds(); @@ -2235,13 +2235,13 @@ void G_BonusScreen(int32_t bonusonly) if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET)) { - clearallviews(0); + videoClearScreen(0); G_DisplayMPResultsScreen(); if (ud.config.MusicToggle) S_PlaySound(BONUSMUSIC); - nextpage(); + videoNextPage(); I_ClearAllInput(); fadepal(0, 0, 0, 252, 0, -28); totalclock = 0; @@ -2253,7 +2253,7 @@ void G_BonusScreen(int32_t bonusonly) if (G_FPSLimit()) { - clearallviews(0); + videoClearScreen(0); G_DisplayMPResultsScreen(); } @@ -2281,7 +2281,7 @@ void G_BonusScreen(int32_t bonusonly) if (ud.config.MusicToggle) S_PlaySound(BONUSMUSIC); - nextpage(); + videoNextPage(); I_ClearAllInput(); fadepal(0, 0, 0, 252, 0, -4); bonuscnt = 0; @@ -2298,7 +2298,7 @@ void G_BonusScreen(int32_t bonusonly) { if (g_player[myconnectindex].ps->gm&MODE_EOL) { - clearallviews(0); + videoClearScreen(0); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BONUSSCREEN+gfx_offset, 0, 0, 2+8+64+128+BGSTRETCH); if (totalclock >= 1000000000 && totalclock < 1000000320) diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 472c1a34d..e35451d43 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -380,7 +380,7 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) int const saveMirror = display_mirror; //if (waloff[wn] == 0) loadtile(wn); - setviewtotile(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x); + videoSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x); yax_preparedrawrooms(); drawrooms(camera.x, camera.y, camera.z, SA(spriteNum), 100 + sprite[spriteNum].shade, SECT(spriteNum)); @@ -391,7 +391,7 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) display_mirror = saveMirror; drawmasks(); - setviewback(); + videoRestoreTarget(); squarerotatetile(tileNum); invalidatetile(tileNum, -1, 255); } diff --git a/source/duke3d/src/startgtk.game.cpp b/source/duke3d/src/startgtk.game.cpp index 1b4949028..3fd2bb661 100644 --- a/source/duke3d/src/startgtk.game.cpp +++ b/source/duke3d/src/startgtk.game.cpp @@ -316,7 +316,7 @@ static void PopulateForm(unsigned char pgs) GtkTreeIter iter; char buf[64]; - mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); + mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); if (mode3d < 0) { int32_t i, cd[] = { 32, 24, 16, 15, 8, 0 }; @@ -324,7 +324,7 @@ static void PopulateForm(unsigned char pgs) for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; } for (; cd[i]; i++) { - mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); + mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); if (mode3d < 0) continue; settings.bpp3d = cd[i]; break; diff --git a/source/duke3d/src/startwin.game.cpp b/source/duke3d/src/startwin.game.cpp index 5307d32e8..124eaf252 100644 --- a/source/duke3d/src/startwin.game.cpp +++ b/source/duke3d/src/startwin.game.cpp @@ -147,7 +147,7 @@ static void PopulateForm(int32_t pgs) hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE); - mode = checkvideomode(&settings.xdim, &settings.ydim, settings.bpp, settings.flags&1, 1); + mode = videoCheckMode(&settings.xdim, &settings.ydim, settings.bpp, settings.flags&1, 1); if (mode < 0 || (settings.bpp < 15 && (settings.flags & 2))) { int32_t cd[] = { 32, 24, 16, 15, 8, 0 }; @@ -158,7 +158,7 @@ static void PopulateForm(int32_t pgs) } for (; cd[i]; i++) { - mode = checkvideomode(&settings.xdim, &settings.ydim, cd[i], settings.flags&1, 1); + mode = videoCheckMode(&settings.xdim, &settings.ydim, cd[i], settings.flags&1, 1); if (mode < 0) continue; settings.bpp = cd[i]; break;