Engine function name cleanup round 2

git-svn-id: https://svn.eduke32.com/eduke32@6828 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-04-12 21:02:51 +00:00
parent ee63d2c070
commit 0340e3cc0f
40 changed files with 668 additions and 679 deletions

View file

@ -49,6 +49,42 @@ extern int32_t nofog;
void calc_ylookup(int32_t bpl, int32_t lastyidx); 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 #ifdef USE_OPENGL
extern int32_t (*baselayer_osdcmd_vidmode_func)(osdfuncparm_t const * const parm); extern int32_t (*baselayer_osdcmd_vidmode_func)(osdfuncparm_t const * const parm);
extern int32_t osdcmd_glinfo(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; extern struct glinfo_t glinfo;
#endif #endif
extern int32_t setvsync(int32_t newSync);
extern vec2_t const g_defaultVideoModes[]; extern vec2_t const g_defaultVideoModes[];
extern char inputdevices; extern char inputdevices;
@ -189,69 +224,31 @@ void keyFlushChars(void);
int32_t mouseInit(void); int32_t mouseInit(void);
void mouseUninit(void); void mouseUninit(void);
int32_t mouseReadAbs(vec2_t *const destination, vec2_t const *const source);
void mouseGrabInput(char a); void mouseGrabInput(char a);
void mouseLockToWindow(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 mouseReadButtons(int32_t *b);
void mouseReadPos(int32_t *x, int32_t *y);
void joyReadButtons(int32_t *b); void joyReadButtons(int32_t *b);
void joySetDeadZone(int32_t axis, uint16_t dead, uint16_t satur); void joySetDeadZone(int32_t axis, uint16_t dead, uint16_t satur);
void joyGetDeadZone(int32_t axis, uint16_t *dead, uint16_t *satur); void joyGetDeadZone(int32_t axis, uint16_t *dead, uint16_t *satur);
extern int32_t inputchecked; extern int32_t inputchecked;
int32_t inittimer(int32_t); int32_t timerInit(int32_t);
void uninittimer(void); void timerUninit(void);
void sampletimer(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 #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 #else
uint32_t getticks(void); uint32_t timerGetTicks(void);
#endif #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_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))); int32_t wm_ynbox(const char *name, const char *fmt, ...) ATTRIBUTE((format(printf,2,3)));

View file

@ -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 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); void squarerotatetile(int16_t tilenume);
int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp); int32_t videoSetGameMode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp);
void nextpage(void); void videoNextPage(void);
void setaspect_new(); void videoSetCorrectedAspect();
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);
void setaspect(int32_t daxrange, int32_t daaspect); void videoSetAspect(int32_t daxrange, int32_t daaspect);
void flushperms(void); void flushperms(void);
void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int col) ATTRIBUTE((nonnull(1,2))); 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); void plotpixel(int32_t x, int32_t y, char col);
char getpixel(int32_t x, int32_t y); char getpixel(int32_t x, int32_t y);
void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz); void videoSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz);
void setviewback(void); void videoRestoreTarget(void);
void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall, void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall,
int32_t *tposx, int32_t *tposy, fix16_t *tang); int32_t *tposx, int32_t *tposy, fix16_t *tang);
void completemirror(void); 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 drawmasks(void);
void clearview(int32_t dacol); void videoClearViewableArea(int32_t dacol);
void clearallviews(int32_t dacol); void videoClearScreen(int32_t dacol);
void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang); 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, 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, 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 qsetmode640350(void);
//void qsetmode640480(void); //void qsetmode640480(void);
void qsetmodeany(int32_t,int32_t); void videoSet2dMode(int32_t,int32_t);
void clear2dscreen(void); void clear2dscreen(void);
void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum,
int16_t ange, int32_t zoome, int16_t gride); int16_t ange, int32_t zoome, int16_t gride);

View file

@ -140,8 +140,8 @@ int32_t dist(const void *s1, const void *s2);
void COMMON_clearbackground(int32_t numcols, int32_t numrows); void COMMON_clearbackground(int32_t numcols, int32_t numrows);
// timer defs for profiling function chunks the simple way // 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_TMRDEF int32_t t[20], ti=0; const char *tmrstr=__func__; fprintf(stderr,"%s\n",tmrstr); t[ti++]=timerGetTicks();
#define EDUKE32_TMRTIC t[ti++]=getticks() #define EDUKE32_TMRTIC t[ti++]=timerGetTicks()
#define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0) #define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0)
void Duke_CommonCleanup(void); void Duke_CommonCleanup(void);

View file

@ -61,9 +61,9 @@ void plotpixel(int32_t x, int32_t y, char col)
} }
#endif #endif
begindrawing(); //{{{ videoBeginDrawing(); //{{{
drawpixel_safe((void *) (ylookup[y]+x+frameplace), col); drawpixel_safe((void *) (ylookup[y]+x+frameplace), col);
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int col) void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int col)
@ -92,10 +92,10 @@ void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int co
int32_t odrawlinepat = drawlinepat; int32_t odrawlinepat = drawlinepat;
drawlinepat = 0xffffffff; drawlinepat = 0xffffffff;
begindrawing(); videoBeginDrawing();
for (i=0; i<numpoints-1; i++) for (i=0; i<numpoints-1; i++)
drawline16(xx[i], yy[i], xx[i+1], yy[i+1], col); drawline16(xx[i], yy[i], xx[i+1], yy[i+1], col);
enddrawing(); videoEndDrawing();
drawlinepat = odrawlinepat; drawlinepat = odrawlinepat;
} }
@ -113,9 +113,9 @@ char getpixel(int32_t x, int32_t y)
if (getrendermode() >= REND_POLYMOST && in3dmode()) return 0; if (getrendermode() >= REND_POLYMOST && in3dmode()) return 0;
#endif #endif
begindrawing(); //{{{ videoBeginDrawing(); //{{{
r = readpixel((void *) (ylookup[y]+x+frameplace)); r = readpixel((void *) (ylookup[y]+x+frameplace));
enddrawing(); //}}} videoEndDrawing(); //}}}
return r; 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); plc = y1+mulscale12((2047-x1)&4095, inc);
i = ((x1+2048)>>12); daend = ((x2+2048)>>12); i = ((x1+2048)>>12); daend = ((x2+2048)>>12);
begindrawing(); //{{{ videoBeginDrawing(); //{{{
for (; i<daend; i++) for (; i<daend; i++)
{ {
j = (plc>>12); j = (plc>>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); drawpixel_safe((void *) (frameplace+ylookup[j]+i), col);
plc += inc; plc += inc;
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
else 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); plc = x1+mulscale12((2047-y1)&4095, inc);
i = ((y1+2048)>>12); daend = ((y2+2048)>>12); i = ((y1+2048)>>12); daend = ((y2+2048)>>12);
begindrawing(); //{{{ videoBeginDrawing(); //{{{
p = ylookup[i]+frameplace; p = ylookup[i]+frameplace;
for (; i<daend; i++) for (; i<daend; i++)
{ {
@ -231,7 +231,7 @@ static void drawlinepixels(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char
drawpixel_safe((void *) (j+p), col); drawpixel_safe((void *) (j+p), col);
plc += inc; p += ylookup[1]; plc += inc; p += ylookup[1];
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
} }
@ -351,7 +351,7 @@ int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col)
int pinc, inc = 1; int pinc, inc = 1;
begindrawing(); //{{{ videoBeginDrawing(); //{{{
intptr_t p = (y1*bytesperline)+x1+frameplace; intptr_t p = (y1*bytesperline)+x1+frameplace;
@ -396,7 +396,7 @@ int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col)
} }
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
return 1; return 1;
} }
@ -427,7 +427,7 @@ int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col)
} }
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
return 1; return 1;
} }
@ -484,7 +484,7 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col)
* b * b
*/ */
begindrawing(); videoBeginDrawing();
intptr_t const p = (y1*bytesperline)+x1+frameplace; intptr_t const p = (y1*bytesperline)+x1+frameplace;
uint32_t patc = UINT_MAX; uint32_t patc = UINT_MAX;
@ -547,7 +547,7 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col)
} }
} while (yp > xp); } while (yp > xp);
enddrawing(); videoEndDrawing();
return; 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 drawpixel_safe((char *) (p + yp - xpbpl), col); // 8
} while (yp > xp); } 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) void clear2dscreen(void)
{ {
int32_t const clearsz = (ydim16 <= yres - STATUS2DSIZ2) ? yres - STATUS2DSIZ2 : yres; int32_t const clearsz = (ydim16 <= yres - STATUS2DSIZ2) ? yres - STATUS2DSIZ2 : yres;
begindrawing(); //{{{ videoBeginDrawing(); //{{{
Bmemset((char *) frameplace, 0, bytesperline*clearsz); 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) if (gride <= 0)
return; return;
begindrawing(); //{{{ videoBeginDrawing(); //{{{
if (m32_sideview) 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(); setup_sideview_sincos();
begindrawing(); //{{{ videoBeginDrawing(); //{{{
if (editstatus == 0) 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]); drawline16mid(x1, j, -y1, +i, editorcolors[15]);
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
// //

View file

@ -218,7 +218,7 @@ int32_t animvpx_nextpic(animvpx_codec_ctx *codec, uint8_t **picptr)
if (codec->initstate <= 0) // not inited or error if (codec->initstate <= 0) // not inited or error
return 1; return 1;
t[0] = getticks(); t[0] = timerGetTicks();
if (codec->decstate == 0) // first time / begin if (codec->decstate == 0) // first time / begin
{ {
@ -282,7 +282,7 @@ read_ivf_frame:
return 5; return 5;
} }
t[1] = getticks(); t[1] = timerGetTicks();
uint8_t *const dstpic = codec->pic; 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[0] += t[1]-t[0];
codec->sumtimes[1] += t[2]-t[1]; 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 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 if (codec->initstate <= 0) // not inited or error
return 1; return 1;
@ -565,7 +565,7 @@ int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect)
glEnd(); glEnd();
t = getticks()-t; t = timerGetTicks()-t;
codec->sumtimes[2] += t; codec->sumtimes[2] += t;
codec->maxtimes[2] = max(codec->maxtimes[2], t); codec->maxtimes[2] = max(codec->maxtimes[2], t);
codec->numframes++; codec->numframes++;

View file

@ -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 }, { "r_tror_nomaskpass", "enable/disable additional pass in TROR software rendering", (void *)&r_tror_nomaskpass, CVAR_BOOL, 0, 1 },
#endif #endif
{ "r_windowpositioning", "enable/disable window position memory", (void *) &windowpos, CVAR_BOOL, 0, 1 }, { "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_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 *) &vid_contrast, 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 *) &vid_brightness, 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 #ifdef DEBUGGINGAIDS
{ "debug1","debug counter",(void *) &debug1, CVAR_FLOAT, -100000, 100000 }, { "debug1","debug counter",(void *) &debug1, CVAR_FLOAT, -100000, 100000 },
{ "debug2","debug counter",(void *) &debug2, CVAR_FLOAT, -100000, 100000 }, { "debug2","debug counter",(void *) &debug2, CVAR_FLOAT, -100000, 100000 },

View file

@ -278,8 +278,8 @@ int32_t osdcmd_restartvid(osdfuncparm_t const * const UNUSED(parm))
if (!in3dmode()) return OSDCMD_OK; if (!in3dmode()) return OSDCMD_OK;
resetvideomode(); videoResetMode();
if (setgamemode(fullscreen,xdim,ydim,bpp)) if (videoSetGameMode(fullscreen,xdim,ydim,bpp))
OSD_Printf("restartvid: Reset failed...\n"); OSD_Printf("restartvid: Reset failed...\n");
return OSDCMD_OK; return OSDCMD_OK;
@ -322,20 +322,20 @@ static int32_t osdcmd_vidmode(osdfuncparm_t const * const parm)
if (!in3dmode()) if (!in3dmode())
{ {
qsetmodeany(newx,newy); videoSet2dMode(newx,newy);
xdim2d = xdim; xdim2d = xdim;
ydim2d = ydim; ydim2d = ydim;
begindrawing(); //{{{ videoBeginDrawing(); //{{{
CLEARLINES2D(0, ydim16, 0); CLEARLINES2D(0, ydim16, 0);
enddrawing(); //}}} videoEndDrawing(); //}}}
ydim16 = ydim-STATUS2DSIZ2; ydim16 = ydim-STATUS2DSIZ2;
return OSDCMD_OK; return OSDCMD_OK;
} }
if (setgamemode(newfullscreen,newx,newy,newbpp)) if (videoSetGameMode(newfullscreen,newx,newy,newbpp))
OSD_Printf("vidmode: Mode change failed!\n"); OSD_Printf("vidmode: Mode change failed!\n");
xdimgame = newx; xdimgame = newx;
@ -366,10 +366,10 @@ static void M32_drawdebug(void)
#endif #endif
if (m32_numdebuglines>0) if (m32_numdebuglines>0)
{ {
begindrawing(); videoBeginDrawing();
for (i=0; i<m32_numdebuglines && y<ydim-8; i++, y+=8) for (i=0; i<m32_numdebuglines && y<ydim-8; i++, y+=8)
printext256(x,y,whitecol,0,m32_debugstr[i],xdimgame>640?0:1); printext256(x,y,whitecol,0,m32_debugstr[i],xdimgame>640?0:1);
enddrawing(); videoEndDrawing();
} }
m32_numdebuglines=0; m32_numdebuglines=0;
} }
@ -510,7 +510,7 @@ void M32_DrawRoomsAndMasks(void)
if (r_usenewaspect) if (r_usenewaspect)
{ {
newaspect_enable = 1; newaspect_enable = 1;
setaspect_new(); videoSetCorrectedAspect();
} }
VM_OnEvent(EVENT_PREDRAW3DSCREEN, -1); VM_OnEvent(EVENT_PREDRAW3DSCREEN, -1);
@ -557,7 +557,7 @@ void M32_DrawRoomsAndMasks(void)
if (r_usenewaspect) if (r_usenewaspect)
{ {
newaspect_enable = 0; newaspect_enable = 0;
setaspect(tmpvr, tmpyx); videoSetAspect(tmpvr, tmpyx);
} }
} }
@ -674,8 +674,8 @@ int app_main(int argc, char const * const * argv)
mouseInit(); mouseInit();
inittimer(TIMERINTSPERSECOND); timerInit(TIMERINTSPERSECOND);
installusertimercallback(keytimerstuff); timerSetCallback(keytimerstuff);
loadpics("tiles000.art", g_maxCacheSize); loadpics("tiles000.art", g_maxCacheSize);
@ -761,15 +761,15 @@ int app_main(int argc, char const * const * argv)
if (cursectnum == -1) if (cursectnum == -1)
{ {
vid_gamma_3d = vid_gamma; vid_gamma_3d = g_videoGamma;
vid_brightness_3d = vid_brightness; vid_brightness_3d = g_videoBrightness;
vid_contrast_3d = vid_contrast; vid_contrast_3d = g_videoContrast;
vid_gamma = vid_contrast = 1.0; g_videoGamma = g_videoContrast = 1.0;
vid_brightness = 0.0; g_videoBrightness = 0.0;
setbrightness(0,0,0); setbrightness(0,0,0);
if (setgamemode(fullscreen, xdim2d, ydim2d, 8) < 0) if (videoSetGameMode(fullscreen, xdim2d, ydim2d, 8) < 0)
{ {
CallExtUnInit(); CallExtUnInit();
uninitengine(); uninitengine();
@ -782,9 +782,9 @@ int app_main(int argc, char const * const * argv)
overheadeditor(); overheadeditor();
keystatus[buildkeys[BK_MODE2D_3D]] = 0; keystatus[buildkeys[BK_MODE2D_3D]] = 0;
vid_gamma = vid_gamma_3d; g_videoGamma = vid_gamma_3d;
vid_contrast = vid_contrast_3d; g_videoContrast = vid_contrast_3d;
vid_brightness = vid_brightness_3d; g_videoBrightness = vid_brightness_3d;
vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1; vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1;
@ -792,7 +792,7 @@ int app_main(int argc, char const * const * argv)
} }
else else
{ {
if (setgamemode(fullscreen, xdimgame, ydimgame, bppgame) < 0) if (videoSetGameMode(fullscreen, xdimgame, ydimgame, bppgame) < 0)
{ {
CallExtUnInit(); CallExtUnInit();
uninitengine(); uninitengine();
@ -820,7 +820,7 @@ CANCEL:
OSD_DispatchQueued(); OSD_DispatchQueued();
nextpage(); videoNextPage();
synctics = totalclock-lockclock; synctics = totalclock-lockclock;
lockclock += synctics; lockclock += synctics;
@ -849,7 +849,7 @@ CANCEL:
printext256(0,0,whitecol,0,"Are you sure you want to quit?",0); printext256(0,0,whitecol,0,"Are you sure you want to quit?",0);
showframe(1); videoShowFrame(1);
synctics = totalclock-lockclock; synctics = totalclock-lockclock;
lockclock += synctics; lockclock += synctics;
@ -886,7 +886,7 @@ CANCEL:
i = CheckMapCorruption(4, 0); i = CheckMapCorruption(4, 0);
printext256(0,8,whitecol,0,i<4?"Save changes?":"Map is heavily corrupt. Save changes?",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) 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 if (keystatus[buildkeys[BK_MODE2D_3D]] && !m32_is2d3dmode()) // Enter
{ {
vid_gamma_3d = vid_gamma; vid_gamma_3d = g_videoGamma;
vid_contrast_3d = vid_contrast; vid_contrast_3d = g_videoContrast;
vid_brightness_3d = vid_brightness; vid_brightness_3d = g_videoBrightness;
vid_gamma = vid_contrast = 1.0; g_videoGamma = g_videoContrast = 1.0;
vid_brightness = 0.0; g_videoBrightness = 0.0;
setbrightness(0,0,0); setbrightness(0,0,0);
@ -1487,9 +1487,9 @@ void editinput(void)
overheadeditor(); overheadeditor();
keystatus[buildkeys[BK_MODE2D_3D]] = 0; keystatus[buildkeys[BK_MODE2D_3D]] = 0;
vid_gamma = vid_gamma_3d; g_videoGamma = vid_gamma_3d;
vid_contrast = vid_contrast_3d; g_videoContrast = vid_contrast_3d;
vid_brightness = vid_brightness_3d; g_videoBrightness = vid_brightness_3d;
vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1; 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-2,y1+0, x2-2,y2-1, backcol);
drawline16(x2-3,y1+0, x2-3,y2+0, 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) 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); drawpixel((char *) (frameplace + ((y2) * bytesperline) + (x2-2)), border);
} }
enddrawing(); videoEndDrawing();
} }
// backup highlighted sectors with sprites as mapinfo for later restoration // 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); int32_t pix, i, threecols = (keepcol >= 256);
char cols[3] = {(char)(keepcol&0xff), (char)((keepcol>>8)&0xff), (char)((keepcol>>16)&0xff)}; char cols[3] = {(char)(keepcol&0xff), (char)((keepcol>>8)&0xff), (char)((keepcol>>16)&0xff)};
begindrawing(); videoBeginDrawing();
cp = (char *)frameplace; cp = (char *)frameplace;
for (i=0; i<bytesperline*(ydim-STATUS2DSIZ2); i++, cp++) for (i=0; i<bytesperline*(ydim-STATUS2DSIZ2); i++, cp++)
{ {
@ -2352,8 +2352,8 @@ void fade_editor_screen(int32_t keepcol)
else if (*cp != blackcol) else if (*cp != blackcol)
*cp = greycol; *cp = greycol;
} }
enddrawing(); videoEndDrawing();
showframe(1); videoShowFrame(1);
} }
static void copy_some_wall_members(int16_t dst, int16_t src, int32_t reset_some) static void copy_some_wall_members(int16_t dst, int16_t src, int32_t reset_some)
@ -2916,15 +2916,15 @@ static int32_t bakframe_fillandfade(char **origframeptr, int32_t sectnum, const
{ {
*origframeptr = (char *)Xmalloc(xdim*ydim); *origframeptr = (char *)Xmalloc(xdim*ydim);
begindrawing(); videoBeginDrawing();
Bmemcpy(*origframeptr, (char *)frameplace, xdim*ydim); Bmemcpy(*origframeptr, (char *)frameplace, xdim*ydim);
enddrawing(); videoEndDrawing();
} }
else else
{ {
begindrawing(); videoBeginDrawing();
Bmemcpy((char *)frameplace, *origframeptr, xdim*ydim); Bmemcpy((char *)frameplace, *origframeptr, xdim*ydim);
enddrawing(); videoEndDrawing();
} }
fillsector_notrans(sectnum, editorcolors[9]); fillsector_notrans(sectnum, editorcolors[9]);
@ -3352,7 +3352,7 @@ void overheadeditor(void)
int32_t sectorhighlightx=0, sectorhighlighty=0; int32_t sectorhighlightx=0, sectorhighlighty=0;
int16_t cursectorhighlight, sectorhighlightstat; int16_t cursectorhighlight, sectorhighlightstat;
int32_t prefixarg = 0, tsign; int32_t prefixarg = 0, tsign;
int32_t resetsynctics = 0, lasttick=getticks(), waitdelay=totalclock, lastdraw=getticks(); int32_t resetsynctics = 0, lasttick=timerGetTicks(), waitdelay=totalclock, lastdraw=timerGetTicks();
int32_t olen[2] = {0, 0}, dragwall[2] = {-1, -1}; int32_t olen[2] = {0, 0}, dragwall[2] = {-1, -1};
int16_t linehighlight2 = -1; int16_t linehighlight2 = -1;
@ -3361,7 +3361,7 @@ void overheadeditor(void)
ovh.splitsect = -1; ovh.splitsect = -1;
ovh.splitstartwall = -1; ovh.splitstartwall = -1;
qsetmodeany(xdim2d,ydim2d); videoSet2dMode(xdim2d,ydim2d);
xdim2d = xdim; xdim2d = xdim;
ydim2d = ydim; ydim2d = ydim;
@ -3374,9 +3374,9 @@ void overheadeditor(void)
yax_updategrays(pos.z); yax_updategrays(pos.z);
begindrawing(); //{{{ videoBeginDrawing(); //{{{
CLEARLINES2D(0, ydim, 0); CLEARLINES2D(0, ydim, 0);
enddrawing(); //}}} videoEndDrawing(); //}}}
ydim16 = ydim-STATUS2DSIZ2; ydim16 = ydim-STATUS2DSIZ2;
@ -3421,14 +3421,14 @@ void overheadeditor(void)
{ {
uint32_t ms = 50;// (highlightsectorcnt>0) ? 75 : 200; uint32_t ms = 50;// (highlightsectorcnt>0) ? 75 : 200;
// wait for event, timeout after 200 ms - (last loop time) // 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 // have synctics reset to 0 after we've slept to avoid zooming out to the max instantly
resetsynctics = 1; resetsynctics = 1;
} }
} }
else waitdelay = totalclock + 6; // should be 50 ms else waitdelay = totalclock + 6; // should be 50 ms
lasttick = getticks(); lasttick = timerGetTicks();
if (handleevents()) if (handleevents())
{ {
@ -3505,11 +3505,11 @@ void overheadeditor(void)
if (numwalls < 0) if (numwalls < 0)
numwalls = numwalls_bak; 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] || mousx || mousy || bstatus || keystatus[0x10] || keystatus[0x11]
|| newnumwalls>=0 || OSD_IsMoving()) || newnumwalls>=0 || OSD_IsMoving())
{ {
lastdraw = getticks(); lastdraw = timerGetTicks();
clear2dscreen(); clear2dscreen();
@ -3526,7 +3526,7 @@ void overheadeditor(void)
show2dsector[i>>3] |= (1<<(i&7)); show2dsector[i>>3] |= (1<<(i&7));
} }
setview(0, 0, xdim-1, ydim16-1); videoSetViewableArea(0, 0, xdim-1, ydim16-1);
if (graphicsmode == 2) if (graphicsmode == 2)
totalclocklock = totalclock; totalclocklock = totalclock;
@ -3546,7 +3546,7 @@ void overheadeditor(void)
int32_t cx = halfxdim16+x2; int32_t cx = halfxdim16+x2;
int32_t cy = midydim16+y2; int32_t cy = midydim16+y2;
begindrawing(); //{{{ LOCK_FRAME_1 videoBeginDrawing(); //{{{ LOCK_FRAME_1
if ((cx >= 2 && cx <= xdim-3) && (cy >= 2 && cy <= ydim16-3)) 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)); inpclamp(&pos.z, cz+(4<<8), fz-(4<<8));
enddrawing(); videoEndDrawing();
setview(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y + YSIZE_2D3D); videoSetViewableArea(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y + YSIZE_2D3D);
clearview(-1); videoClearViewableArea(-1);
vec2_t osearch = { searchx, searchy }; vec2_t osearch = { searchx, searchy };
@ -3886,7 +3886,7 @@ void overheadeditor(void)
searchy -= m32_2d3d.y; searchy -= m32_2d3d.y;
M32_DrawRoomsAndMasks(); M32_DrawRoomsAndMasks();
setview(0, 0, xdim2d-1, ydim2d-1); videoSetViewableArea(0, 0, xdim2d-1, ydim2d-1);
#ifdef USE_OPENGL #ifdef USE_OPENGL
rendmode = bakrendmode; rendmode = bakrendmode;
@ -3896,7 +3896,7 @@ void overheadeditor(void)
searchx = osearch.x; searchx = osearch.x;
searchy = osearch.y; 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, 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 + 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]); 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(); OSD_Draw();
} }
@ -4170,7 +4170,7 @@ void overheadeditor(void)
//__clearscreen_beforecapture__ //__clearscreen_beforecapture__
screencapture("captxxxx.tga", eitherSHIFT); screencapture("captxxxx.tga", eitherSHIFT);
showframe(1); videoShowFrame(1);
} }
if (keystatus[0x30]) // B (clip Blocking xor) (2D) if (keystatus[0x30]) // B (clip Blocking xor) (2D)
{ {
@ -7900,7 +7900,7 @@ end_insert_points:
nokeys: nokeys:
showframe(1); videoShowFrame(1);
synctics = totalclock-lockclock; synctics = totalclock-lockclock;
lockclock += synctics; lockclock += synctics;
@ -7947,7 +7947,7 @@ end_insert_points:
RESET_EDITOR_VARS(); RESET_EDITOR_VARS();
oposz = pos.z; oposz = pos.z;
} }
showframe(1); videoShowFrame(1);
keystatus[0x1c] = 0; keystatus[0x1c] = 0;
keystatus[0x2d]=keystatus[0x13]=0; keystatus[0x2d]=keystatus[0x13]=0;
@ -7975,7 +7975,7 @@ CANCEL:
#endif #endif
printext16(16*8, ydim-STATUS2DSIZ2-12, editorcolors[15], -1, GetSaveBoardFilename(NULL), 0); printext16(16*8, ydim-STATUS2DSIZ2-12, editorcolors[15], -1, GetSaveBoardFilename(NULL), 0);
showframe(1); videoShowFrame(1);
keyFlushChars(); keyFlushChars();
bad = 1; bad = 1;
while (bad == 1) while (bad == 1)
@ -8087,7 +8087,7 @@ CANCEL:
} }
} }
} }
showframe(1); videoShowFrame(1);
keystatus[0x1c] = 0; keystatus[0x1c] = 0;
} }
else if (ch == 'a' || ch == 'A') //A else if (ch == 'a' || ch == 'A') //A
@ -8119,7 +8119,7 @@ CANCEL:
{ {
_printmessage16("%sSave as: ^011%s%s", corrupt>=4?"(map corrupt) ":"", _printmessage16("%sSave as: ^011%s%s", corrupt>=4?"(map corrupt) ":"",
boardfilename, (totalclock&32)?"_":""); boardfilename, (totalclock&32)?"_":"");
showframe(1); videoShowFrame(1);
if (handleevents()) if (handleevents())
quitevent = 0; quitevent = 0;
@ -8150,7 +8150,7 @@ CANCEL:
Bstrcpy(boardfilename, selectedboardfilename); Bstrcpy(boardfilename, selectedboardfilename);
keystatus[1] = 0; keystatus[1] = 0;
printmessage16("Operation cancelled"); printmessage16("Operation cancelled");
showframe(1); videoShowFrame(1);
} }
else if (bad == 2) else if (bad == 2)
{ {
@ -8184,7 +8184,7 @@ CANCEL:
SaveBoardAndPrintMessage(NULL); SaveBoardAndPrintMessage(NULL);
showframe(1); videoShowFrame(1);
} }
else if (ch == 't' || ch == 'T') else if (ch == 't' || ch == 'T')
{ {
@ -8224,7 +8224,7 @@ CANCEL:
keystatus[0x2e] = 0; keystatus[0x2e] = 0;
quitevent = 0; quitevent = 0;
printmessage16("Operation cancelled"); printmessage16("Operation cancelled");
showframe(1); videoShowFrame(1);
goto CANCEL; goto CANCEL;
} }
@ -8236,7 +8236,7 @@ CANCEL:
} }
// printmessage16(""); // printmessage16("");
showframe(1); videoShowFrame(1);
} }
} }
@ -8261,7 +8261,7 @@ CANCEL:
fixspritesectors(); 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); initprintf("%d * %d not supported in this graphics mode\n",xdim,ydim);
CallExtUnInit(); CallExtUnInit();
@ -8292,7 +8292,7 @@ int32_t ask_if_sure(const char *query, uint32_t flags)
_printmessage16("Are you sure?"); _printmessage16("Are you sure?");
else else
_printmessage16("%s", query); _printmessage16("%s", query);
showframe(1); videoShowFrame(1);
keyFlushChars(); keyFlushChars();
while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==-1) 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); _printmessage16("%s", question);
showframe(1); videoShowFrame(1);
keyFlushChars(); keyFlushChars();
// 'c' is cancel too, but can be overridden // 'c' is cancel too, but can be overridden
@ -8368,7 +8368,7 @@ static void SaveBoardAndPrintMessage(const char *fn)
const char *f; const char *f;
_printmessage16("Saving board..."); _printmessage16("Saving board...");
showframe(1); videoShowFrame(1);
f = SaveBoard(fn, M32_SB_ASKOV); f = SaveBoard(fn, M32_SB_ASKOV);
@ -9106,16 +9106,16 @@ void clearmidstatbar16(void)
{ {
int32_t y = overridepm16y<0 ? STATUS2DSIZ : overridepm16y; int32_t y = overridepm16y<0 ? STATUS2DSIZ : overridepm16y;
begindrawing(); videoBeginDrawing();
CLEARLINES2D(ydim-y+25, STATUS2DSIZ+2-(25<<1), 0); CLEARLINES2D(ydim-y+25, STATUS2DSIZ+2-(25<<1), 0);
enddrawing(); videoEndDrawing();
} }
static void clearministatbar16(void) static void clearministatbar16(void)
{ {
int32_t i, col = editorcolors[25]; int32_t i, col = editorcolors[25];
begindrawing(); videoBeginDrawing();
for (i=ydim-STATUS2DSIZ2; i<ydim; i+=2) for (i=ydim-STATUS2DSIZ2; i<ydim; i+=2)
{ {
@ -9135,7 +9135,7 @@ static void clearministatbar16(void)
printext16(xdim2d-(Bstrlen(tempbuf)<<3)-2, ydim2d-STATUS2DSIZ2+9, editorcolors[12],-1, tempbuf, 0); printext16(xdim2d-(Bstrlen(tempbuf)<<3)-2, ydim2d-STATUS2DSIZ2+9, editorcolors[12],-1, tempbuf, 0);
} }
enddrawing(); videoEndDrawing();
} }
// <startwall> has to be the starting wall of a loop! // <startwall> 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); printext16(n<<3, ydim-STATUS2DSIZ+128, editorcolors[11], -1, buffer,0);
} }
showframe(1); videoShowFrame(1);
n = 0; n = 0;
if (getnumber_internal1(ch, &danum, maxnumber, sign) || 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); printmessage256(0, 9, buffer);
} }
showframe(1); videoShowFrame(1);
if (getnumber_internal1(ch, &danum, maxnumber, sign) || if (getnumber_internal1(ch, &danum, maxnumber, sign) ||
getnumber_autocomplete(ournamestart, ch, &danum, flags&(1+2))) getnumber_autocomplete(ournamestart, ch, &danum, flags&(1+2)))
@ -9492,7 +9492,7 @@ const char *getstring_simple(const char *querystr, const char *defaultstr, int32
else else
_printmessage16("%s", buf); _printmessage16("%s", buf);
showframe(1); videoShowFrame(1);
if (handleevents()) if (handleevents())
quitevent = 0; quitevent = 0;
@ -9726,7 +9726,7 @@ static int32_t menuselect(void)
do do
{ {
begindrawing(); //{{{ videoBeginDrawing(); //{{{
CLEARLINES2D(0, ydim16, 0); CLEARLINES2D(0, ydim16, 0);
@ -9795,8 +9795,8 @@ static int32_t menuselect(void)
} }
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
showframe(1); videoShowFrame(1);
keystatus[0xcb] = 0; keystatus[0xcb] = 0;
keystatus[0xcd] = 0; keystatus[0xcd] = 0;
@ -9972,10 +9972,10 @@ static int32_t menuselect(void)
ch = 0; ch = 0;
begindrawing(); videoBeginDrawing();
CLEARLINES2D(0, ydim16, 0); CLEARLINES2D(0, ydim16, 0);
enddrawing(); videoEndDrawing();
showframe(1); videoShowFrame(1);
} }
if (ch == 13 && !findfileshigh) ch = 0; 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..."); message("Board saved to " PLAYTEST_MAPNAME ". Starting the game...");
OSD_Printf("...as `%s'\n", fullparam); OSD_Printf("...as `%s'\n", fullparam);
showframe(1); videoShowFrame(1);
mouseUninit(); mouseUninit();
#ifdef _WIN32 #ifdef _WIN32
{ {

View file

@ -142,9 +142,9 @@ int32_t loadsetup(const char *fn)
#ifdef POLYMER #ifdef POLYMER
if (readconfig(fp, "rendmode", val, VL) > 0) { i = atoi_safe(val); glrendmode = i; } if (readconfig(fp, "rendmode", val, VL) > 0) { i = atoi_safe(val); glrendmode = i; }
#endif #endif
if (readconfig(fp, "vid_gamma", val, VL) > 0) vid_gamma = 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) vid_brightness = 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) vid_contrast = 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 #ifdef RENDERTYPEWIN
if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = atoi_safe(val); if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = atoi_safe(val);
#endif #endif
@ -627,9 +627,9 @@ int32_t writesetup(const char *fn)
maxrefreshfreq, maxrefreshfreq,
#endif #endif
windowpos, windowx, windowy, windowpos, windowx, windowy,
vid_gamma_3d>=0?vid_gamma_3d:vid_gamma, vid_gamma_3d>=0?vid_gamma_3d:g_videoGamma,
vid_brightness_3d>=0?vid_brightness_3d:vid_brightness, vid_brightness_3d>=0?vid_brightness_3d:g_videoBrightness,
vid_contrast_3d>=0?vid_contrast_3d:vid_contrast, vid_contrast_3d>=0?vid_contrast_3d:g_videoContrast,
game_executable, game_executable,
#if 0 #if 0
option[7]>>4, option[2], option[7]>>4, option[2],

View file

@ -134,9 +134,9 @@ uint32_t r_screenxy = 0;
int32_t globalflags; int32_t globalflags;
float vid_gamma = DEFAULT_GAMMA; float g_videoGamma = DEFAULT_GAMMA;
float vid_contrast = DEFAULT_CONTRAST; float g_videoContrast = DEFAULT_CONTRAST;
float vid_brightness = DEFAULT_BRIGHTNESS; float g_videoBrightness = DEFAULT_BRIGHTNESS;
//Textured Map variables //Textured Map variables
static char globalpolytype; 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... j = bunches[cf][bnchcnt]; // the actual bunchnum...
yax_globalbunch = j; yax_globalbunch = j;
#ifdef YAX_DEBUG #ifdef YAX_DEBUG
t=getu64ticks(); t=timerGetTicksU64();
#endif #endif
k = bunchsec[j]; 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", 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, yax_globallev-YAX_MAXDRAWS, j, k, yax_spritesortcnt[yax_globallev]-odsprcnt,
ourbunch[0],ourbunch[1],sectnum, ourbunch[0],ourbunch[1],sectnum,
(double)(1000*(getu64ticks()-t))/u64tickspersec); (double)(1000*(timerGetTicksU64()-t))/u64tickspersec);
} }
if (ourbunch[cf]==j) 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) if (getrendermode() == REND_CLASSIC)
{ {
begindrawing(); videoBeginDrawing();
draw_rainbow_background(); draw_rainbow_background();
enddrawing(); videoEndDrawing();
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
else 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 k = bunchsec[j]; // best start-drawing sector
yax_globalbunch = j; yax_globalbunch = j;
#ifdef YAX_DEBUG #ifdef YAX_DEBUG
t=getu64ticks(); t=timerGetTicksU64();
#endif #endif
yax_tweakpicnums(j, cf, 0); yax_tweakpicnums(j, cf, 0);
if (k < 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", yaxdebug("nm1 l%d: DRAWN (bn %2d) sec %4d, %.3f ms",
yax_globallev-YAX_MAXDRAWS, j, k, yax_globallev-YAX_MAXDRAWS, j, k,
(double)(1000*(getu64ticks()-t))/u64tickspersec); (double)(1000*(timerGetTicksU64()-t))/u64tickspersec);
if (!yax_nomaskdidit) if (!yax_nomaskdidit)
{ {
@ -1077,7 +1077,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
yax_copytsprites(); yax_copytsprites();
yaxdebug("nm0 l%d: DRAWN (bn %2d) sec %4d,%3d tspr, %.3f ms", yaxdebug("nm0 l%d: DRAWN (bn %2d) sec %4d,%3d tspr, %.3f ms",
yax_globallev-YAX_MAXDRAWS, j, k, spritesortcnt, yax_globallev-YAX_MAXDRAWS, j, k, spritesortcnt,
(double)(1000*(getu64ticks()-t))/u64tickspersec); (double)(1000*(timerGetTicksU64()-t))/u64tickspersec);
SpriteAnimFunc(globalposx, globalposy, globalang, smoothr); SpriteAnimFunc(globalposx, globalposy, globalang, smoothr);
drawmasks(); drawmasks();
@ -1090,7 +1090,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
} }
#ifdef YAX_DEBUG #ifdef YAX_DEBUG
t=getu64ticks(); t=timerGetTicksU64();
#endif #endif
yax_globalcf = -1; yax_globalcf = -1;
yax_globalbunch = -1; yax_globalbunch = -1;
@ -1104,7 +1104,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
// spritesortcnt = 0; // spritesortcnt = 0;
yax_copytsprites(); yax_copytsprites();
yaxdebug("DRAWN base level sec %d,%3d tspr, %.3f ms", osectnum, 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; scansector_collectsprites = 1;
for (cf=0; cf<2; cf++) 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 purple = getclosestcol(255, 0, 255);
char yellow = getclosestcol(255, 255, 0); char yellow = getclosestcol(255, 255, 0);
begindrawing(); videoBeginDrawing();
for (i=0; i<numyaxbunches; i++) for (i=0; i<numyaxbunches; i++)
{ {
int32_t x, x1; int32_t x, x1;
@ -1141,7 +1141,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
*((char *)frameplace + (ydmost[x]-1)*bytesperline + x-x1) = yellow; *((char *)frameplace + (ydmost[x]-1)*bytesperline + x-x1) = yellow;
} }
} }
enddrawing(); videoEndDrawing();
} }
#endif #endif
} }
@ -4319,7 +4319,7 @@ static void drawalls(int32_t bunch)
char yellow = getclosestcol(255, 255, 0); char yellow = getclosestcol(255, 255, 0);
char *bakframe = (char *)Xaligned_alloc(16, xdim*ydim); char *bakframe = (char *)Xaligned_alloc(16, xdim*ydim);
begindrawing(); //{{{ videoBeginDrawing(); //{{{
Bmemcpy(bakframe, (char *)frameplace, xdim*ydim); Bmemcpy(bakframe, (char *)frameplace, xdim*ydim);
for (x=0; x<xdim; x++) for (x=0; x<xdim; x++)
{ {
@ -4346,7 +4346,7 @@ static void drawalls(int32_t bunch)
engine_screenshot++; engine_screenshot++;
Bmemcpy((char *)frameplace, bakframe, xdim*ydim); Bmemcpy((char *)frameplace, bakframe, xdim*ydim);
enddrawing(); //}}} videoEndDrawing(); //}}}
Baligned_free(bakframe); Baligned_free(bakframe);
} }
@ -4450,7 +4450,7 @@ static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasp
longptr = (int32_t *)davoxptr; longptr = (int32_t *)davoxptr;
int32_t xyvoxoffs = (daxsiz+1)<<2; int32_t xyvoxoffs = (daxsiz+1)<<2;
begindrawing(); //{{{ videoBeginDrawing(); //{{{
for (bssize_t cnt=0; cnt<8; cnt++) for (bssize_t cnt=0; cnt<8; cnt++)
{ {
@ -4653,7 +4653,7 @@ static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasp
} }
#endif #endif
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
@ -7599,6 +7599,7 @@ static uspritetype tsprite_s[MAXSPRITESONSCREEN];
int32_t preinitengine(void) int32_t preinitengine(void)
{ {
baselayer_init();
initdivtables(); initdivtables();
if (initsystem()) Bexit(9); if (initsystem()) Bexit(9);
makeasmwriteable(); makeasmwriteable();
@ -7674,7 +7675,7 @@ int32_t preinitengine(void)
#endif #endif
validmodecnt = 0; validmodecnt = 0;
getvalidmodes(); videoGetModes();
initcrc32table(); initcrc32table();
@ -7708,7 +7709,7 @@ int32_t initengine(void)
} }
#ifdef YAX_DEBUG #ifdef YAX_DEBUG
u64tickspersec = (double)getu64tickspersec(); u64tickspersec = (double)timerGetFreqU64();
if (u64tickspersec==0.0) if (u64tickspersec==0.0)
u64tickspersec = 1.0; u64tickspersec = 1.0;
#endif #endif
@ -8052,7 +8053,7 @@ int32_t drawrooms_q16(int32_t daposx, int32_t daposy, int32_t daposz,
//============================================================================= //POLYMOST ENDS //============================================================================= //POLYMOST ENDS
#endif #endif
begindrawing(); //{{{ videoBeginDrawing(); //{{{
#ifdef ENGINE_CLEAR_SCREEN #ifdef ENGINE_CLEAR_SCREEN
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
@ -8104,7 +8105,7 @@ int32_t drawrooms_q16(int32_t daposx, int32_t daposy, int32_t daposz,
// Leave inpreparemirror as is, it's restored by completemirror. // Leave inpreparemirror as is, it's restored by completemirror.
if (numbunches==0) if (numbunches==0)
{ {
enddrawing(); //!!! videoEndDrawing(); //!!!
return 0; return 0;
} }
@ -8164,7 +8165,7 @@ int32_t drawrooms_q16(int32_t daposx, int32_t daposy, int32_t daposz,
bunchlast[closest] = bunchlast[numbunches]; bunchlast[closest] = bunchlast[numbunches];
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
return didmirror; return didmirror;
} }
@ -8441,7 +8442,7 @@ killsprite:
i = j; i = j;
} }
begindrawing(); //{{{ videoBeginDrawing(); //{{{
#if 0 #if 0
for (i=spritesortcnt-1; i>=0; i--) for (i=spritesortcnt-1; i>=0; i--)
{ {
@ -8652,7 +8653,7 @@ killsprite:
} }
#endif #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; int32_t const oyxaspect = yxaspect, oviewingrange = viewingrange;
setaspect(65536, divscale16((320*5)/8, 200)); videoSetAspect(65536, divscale16((320*5)/8, 200));
beforedrawrooms = 0; beforedrawrooms = 0;
@ -8684,7 +8685,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
int32_t sortnum = 0; int32_t sortnum = 0;
begindrawing(); //{{{ videoBeginDrawing(); //{{{
usectortype *sec; 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) if (r_usenewaspect)
setaspect(oviewingrange, oyxaspect); videoSetAspect(oviewingrange, oyxaspect);
else else
setaspect(65536, divscale16(ydim*320, xdim*200)); videoSetAspect(65536, divscale16(ydim*320, xdim*200));
} }
//////////////////// LOADING AND SAVING ROUTINES //////////////////// //////////////////// 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) #define YSAVES ((xdim*MAXSPRITES)>>7)
static void initsmost(void) static void videoAllocateBuffers(void)
{ {
int32_t i; int32_t i;
// Needed for the game's TILT_SETVIEWTOTILE_320. // Needed for the game's TILT_SETVIEWTOTILE_320.
@ -9815,7 +9816,7 @@ static void PolymostProcessVoxels(void)
g_haveVoxels = 0; g_haveVoxels = 0;
OSD_Printf("Generating voxel models for Polymost. This may take a while...\n"); OSD_Printf("Generating voxel models for Polymost. This may take a while...\n");
nextpage(); videoNextPage();
for (bssize_t i=0; i<MAXVOXELS; i++) for (bssize_t i=0; i<MAXVOXELS; i++)
{ {
@ -9833,7 +9834,7 @@ static void PolymostProcessVoxels(void)
// //
// JBF: davidoption now functions as a windowed-mode flag (0 == windowed, 1 == fullscreen) // JBF: davidoption now functions as a windowed-mode flag (0 == windowed, 1 == fullscreen)
extern char videomodereset; extern char videomodereset;
int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp) int32_t videoSetGameMode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp)
{ {
int32_t j; int32_t j;
@ -9861,7 +9862,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
j = bpp; j = bpp;
g_lastpalettesum = 0; g_lastpalettesum = 0;
if (setvideomode(daxdim,daydim,dabpp,davidoption) < 0) return -1; if (videoSetMode(daxdim,daydim,dabpp,davidoption) < 0) return -1;
// Workaround possible bugs in the GL driver // Workaround possible bugs in the GL driver
makeasmwriteable(); makeasmwriteable();
@ -9879,7 +9880,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
fydim = (float) daydim; fydim = (float) daydim;
#endif #endif
initsmost(); videoAllocateBuffers();
#ifdef HIGH_PRECISION_SPRITE #ifdef HIGH_PRECISION_SPRITE
swallf = (float *) Xrealloc(swallf, xdim * sizeof(float)); swallf = (float *) Xrealloc(swallf, xdim * sizeof(float));
@ -9899,8 +9900,8 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
calc_ylookup(bytesperline, ydim); calc_ylookup(bytesperline, ydim);
setview(0L,0L,xdim-1,ydim-1); videoSetViewableArea(0L,0L,xdim-1,ydim-1);
clearallviews(0L); videoClearScreen(0L);
setbrightness(curbrightness,0,0); setbrightness(curbrightness,0,0);
if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); } if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); }
@ -9931,7 +9932,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
// //
// nextpage // nextpage
// //
void nextpage(void) void videoNextPage(void)
{ {
permfifotype *per; permfifotype *per;
@ -9950,7 +9951,7 @@ void nextpage(void)
if (in3dmode()) if (in3dmode())
{ {
begindrawing(); //{{{ videoBeginDrawing(); //{{{
for (bssize_t i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) for (bssize_t i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1)))
{ {
per = &permfifo[i]; per = &permfifo[i];
@ -9959,12 +9960,12 @@ void nextpage(void)
per->dashade,per->dapalnum,per->dastat,per->daalpha,per->dablend, per->dashade,per->dapalnum,per->dastat,per->daalpha,per->dablend,
per->cx1,per->cy1,per->cx2,per->cy2,per->uniqid); per->cx1,per->cy1,per->cx2,per->cy2,per->uniqid);
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
OSD_Draw(); OSD_Draw();
showframe(0); videoShowFrame(0);
begindrawing(); //{{{ videoBeginDrawing(); //{{{
for (bssize_t i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) for (bssize_t i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1)))
{ {
per = &permfifo[i]; per = &permfifo[i];
@ -9977,7 +9978,7 @@ void nextpage(void)
if (((per->pagesleft&127) == 0) && (i == permtail)) if (((per->pagesleft&127) == 0) && (i == permtail))
permtail = ((permtail+1)&(MAXPERMS-1)); permtail = ((permtail+1)&(MAXPERMS-1));
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
faketimerhandler(); faketimerhandler();
@ -9985,7 +9986,7 @@ void nextpage(void)
#ifdef USE_OPENGL #ifdef USE_OPENGL
omdtims = mdtims; omdtims = mdtims;
mdtims = getticks(); mdtims = timerGetTicks();
for (native_t i = 0; i < Numsprites; ++i) for (native_t i = 0; i < Numsprites; ++i)
if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM)) if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM))
@ -12005,7 +12006,7 @@ restart_grand:
int32_t setaspect_new_use_dimen = 0; int32_t setaspect_new_use_dimen = 0;
void setaspect_new() void videoSetCorrectedAspect()
{ {
if (r_usenewaspect && newaspect_enable && getrendermode() != REND_POLYMER) if (r_usenewaspect && newaspect_enable && getrendermode() != REND_POLYMER)
{ {
@ -12047,16 +12048,16 @@ void setaspect_new()
vr = divscale16(x*3, y*4); vr = divscale16(x*3, y*4);
setaspect(vr, yx); videoSetAspect(vr, yx);
} }
else else
setaspect(65536, divscale16(ydim*320, xdim*200)); videoSetAspect(65536, divscale16(ydim*320, xdim*200));
} }
// //
// setview // 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.x = x1; wx1 = (x1<<12);
windowxy1.y = y1; wy1 = (y1<<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 #ifdef USE_OPENGL
fydimen = (float) ydimen; fydimen = (float) ydimen;
#endif #endif
setaspect_new(); videoSetCorrectedAspect();
for (bssize_t i=0; i<windowxy1.x; i++) { startumost[i] = 1, startdmost[i] = 0; } for (bssize_t i=0; i<windowxy1.x; i++) { startumost[i] = 1, startdmost[i] = 0; }
Bassert(windowxy2.x < xdim); // xdim is the number of alloc'd elements in start*most[]. Bassert(windowxy2.x < xdim); // xdim is the number of alloc'd elements in start*most[].
@ -12084,7 +12085,7 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
// //
// setaspect // setaspect
// //
void setaspect(int32_t daxrange, int32_t daaspect) void videoSetAspect(int32_t daxrange, int32_t daaspect)
{ {
viewingrange = daxrange; viewingrange = daxrange;
viewingrangerecip = divscale32(1,daxrange); viewingrangerecip = divscale32(1,daxrange);
@ -12131,9 +12132,9 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
if (((dastat & RS_PERM) == 0) || (numpages < 2) || (beforedrawrooms != 0)) if (((dastat & RS_PERM) == 0) || (numpages < 2) || (beforedrawrooms != 0))
{ {
begindrawing(); //{{{ videoBeginDrawing(); //{{{
dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,daalpha,dablend,cx1,cy1,cx2,cy2,guniqhudid); dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,daalpha,dablend,cx1,cy1,cx2,cy2,guniqhudid);
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
if ((dastat & RS_NOMASK) && (cx1 <= 0) && (cy1 <= 0) && (cx2 >= xdim-1) && (cy2 >= ydim-1) && if ((dastat & RS_NOMASK) && (cx1 <= 0) && (cy1 <= 0) && (cx2 >= 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 // clearview
// //
void clearview(int32_t dacol) void videoClearViewableArea(int32_t dacol)
{ {
if (!in3dmode() && dacol != -1) return; if (!in3dmode() && dacol != -1) return;
@ -12228,7 +12229,7 @@ void clearview(int32_t dacol)
} }
#endif #endif
begindrawing(); //{{{ videoBeginDrawing(); //{{{
//dacol += (dacol<<8); dacol += (dacol<<16); //dacol += (dacol<<8); dacol += (dacol<<16);
int const dx = windowxy2.x-windowxy1.x+1; int const dx = windowxy2.x-windowxy1.x+1;
intptr_t p = frameplace+ylookup[windowxy1.y]+windowxy1.x; intptr_t p = frameplace+ylookup[windowxy1.y]+windowxy1.x;
@ -12238,7 +12239,7 @@ void clearview(int32_t dacol)
Bmemset((void *)p,dacol,dx); Bmemset((void *)p,dacol,dx);
p += ylookup[1]; p += ylookup[1];
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
faketimerhandler(); faketimerhandler();
} }
@ -12247,7 +12248,7 @@ void clearview(int32_t dacol)
// //
// clearallviews // clearallviews
// //
void clearallviews(int32_t dacol) void videoClearScreen(int32_t dacol)
{ {
if (!in3dmode()) return; if (!in3dmode()) return;
//dacol += (dacol<<8); dacol += (dacol<<16); //dacol += (dacol<<8); dacol += (dacol<<16);
@ -12267,9 +12268,9 @@ void clearallviews(int32_t dacol)
} }
#endif #endif
begindrawing(); //{{{ videoBeginDrawing(); //{{{
Bmemset((void *)frameplace,dacol,bytesperline*yres); Bmemset((void *)frameplace,dacol,bytesperline*yres);
enddrawing(); //}}} videoEndDrawing(); //}}}
//nextpage(); //nextpage();
faketimerhandler(); faketimerhandler();
@ -12281,7 +12282,7 @@ void clearallviews(int32_t dacol)
// //
// setviewtotile // 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 //DRAWROOMS TO TILE BACKUP&SET CODE
tilesiz[tilenume].x = xsiz; tilesiz[tilenume].y = ysiz; tilesiz[tilenume].x = xsiz; tilesiz[tilenume].y = ysiz;
@ -12307,8 +12308,8 @@ void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz)
setviewcnt++; setviewcnt++;
offscreenrendering = 1; offscreenrendering = 1;
setview(0,0,ysiz-1,xsiz-1); videoSetViewableArea(0,0,ysiz-1,xsiz-1);
setaspect(65536,65536); videoSetAspect(65536,65536);
calc_ylookup(ysiz, xsiz); calc_ylookup(ysiz, xsiz);
} }
@ -12317,7 +12318,7 @@ void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz)
// //
// setviewback // setviewback
// //
void setviewback(void) void videoRestoreTarget(void)
{ {
if (setviewcnt <= 0) return; if (setviewcnt <= 0) return;
setviewcnt--; setviewcnt--;
@ -12331,7 +12332,7 @@ void setviewback(void)
} }
#endif #endif
setview(bakwindowxy1[setviewcnt].x,bakwindowxy1[setviewcnt].y, videoSetViewableArea(bakwindowxy1[setviewcnt].x,bakwindowxy1[setviewcnt].y,
bakwindowxy2[setviewcnt].x,bakwindowxy2[setviewcnt].y); bakwindowxy2[setviewcnt].x,bakwindowxy2[setviewcnt].y);
copybufbyte(&bakumost[windowxy1.x],&startumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startumost[0])); 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])); 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 // Variables mirrorsx{1,2} refer to the source scene here, the one drawn
// from the inside of the mirror. // from the inside of the mirror.
begindrawing(); videoBeginDrawing();
// Width in pixels (screen x's are inclusive on both sides): // Width in pixels (screen x's are inclusive on both sides):
int const width = mirrorsx2-mirrorsx1+1; int const width = mirrorsx2-mirrorsx1+1;
@ -12457,7 +12458,7 @@ void completemirror(void)
faketimerhandler(); faketimerhandler();
} }
enddrawing(); videoEndDrawing();
} }
@ -12717,7 +12718,7 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall)
// //
// qsetmodeany // qsetmodeany
// //
void qsetmodeany(int32_t daxdim, int32_t daydim) void videoSet2dMode(int32_t daxdim, int32_t daydim)
{ {
if (daxdim < 640) daxdim = 640; if (daxdim < 640) daxdim = 640;
if (daydim < 480) daydim = 480; if (daydim < 480) daydim = 480;
@ -12725,7 +12726,7 @@ void qsetmodeany(int32_t daxdim, int32_t daydim)
if (qsetmode != ((daxdim<<16)|(daydim&0xffff))) if (qsetmode != ((daxdim<<16)|(daydim&0xffff)))
{ {
g_lastpalettesum = 0; g_lastpalettesum = 0;
if (setvideomode(daxdim, daydim, 8, fullscreen) < 0) if (videoSetMode(daxdim, daydim, 8, fullscreen) < 0)
return; return;
xdim = xres; xdim = xres;
@ -12736,15 +12737,15 @@ void qsetmodeany(int32_t daxdim, int32_t daydim)
fydim = (float) yres; fydim = (float) yres;
#endif #endif
initsmost(); videoAllocateBuffers();
ydim16 = yres - STATUS2DSIZ2; ydim16 = yres - STATUS2DSIZ2;
halfxdim16 = xres >> 1; halfxdim16 = xres >> 1;
midydim16 = ydim16 >> 1; // scale(200,yres,480); midydim16 = ydim16 >> 1; // scale(200,yres,480);
begindrawing(); //{{{ videoBeginDrawing(); //{{{
Bmemset((char *)frameplace, 0, yres*bytesperline); Bmemset((char *)frameplace, 0, yres*bytesperline);
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
qsetmode = ((daxdim<<16)|(daydim&0xffff)); 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]; char const * const letptr = &fontptr[name[i]<<3];
begindrawing(); //{{{ videoBeginDrawing(); //{{{
char *ptr = (char *)(bytesperline*ypos + (stx-(fontsize&1)) + frameplace); char *ptr = (char *)(bytesperline*ypos + (stx-(fontsize&1)) + frameplace);
int const trans = (obackcol < -1); 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; ptr += bytesperline;
} }
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
stx += charxsiz; stx += charxsiz;
@ -13011,7 +13012,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const
# endif # endif
#endif #endif
begindrawing(); //{{{ videoBeginDrawing(); //{{{
for (i=0; name[i]; i++) for (i=0; name[i]; i++)
{ {
if (name[i] == '^' && isdigit(name[i+1])) 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; stx += charxsiz;
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
@ -13063,7 +13064,7 @@ static void PolymerProcessModels(void)
if (!warned) if (!warned)
{ {
OSD_Printf("Post-processing MD3 models for Polymer. This may take a while...\n"); OSD_Printf("Post-processing MD3 models for Polymer. This may take a while...\n");
nextpage(); videoNextPage();
warned = 1; warned = 1;
} }

View file

@ -699,7 +699,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
int32_t picfillen = kfilelength(filh); int32_t picfillen = kfilelength(filh);
kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c 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; char hasalpha;
texcacheheader cachead; texcacheheader cachead;
@ -985,7 +985,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
if (willprint) if (willprint)
{ {
int32_t etime = getticks()-startticks; int32_t etime = timerGetTicks()-startticks;
if (etime>=MIN_CACHETIME_PRINT) if (etime>=MIN_CACHETIME_PRINT)
OSD_Printf("Load skin: p%d-e%d \"%s\"... cached... %d ms\n", pal, hicfxmask(pal), fn, etime); OSD_Printf("Load skin: p%d-e%d \"%s\"... cached... %d ms\n", pal, hicfxmask(pal), fn, etime);
willprint = 0; willprint = 0;
@ -997,7 +997,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
if (willprint) if (willprint)
{ {
int32_t etime = getticks()-startticks; int32_t etime = timerGetTicks()-startticks;
if (etime>=MIN_CACHETIME_PRINT) if (etime>=MIN_CACHETIME_PRINT)
OSD_Printf("Load skin: p%d-e%d \"%s\"... %d ms\n", pal, hicfxmask(pal), fn, etime); OSD_Printf("Load skin: p%d-e%d \"%s\"... %d ms\n", pal, hicfxmask(pal), fn, etime);
} }

View file

@ -290,7 +290,7 @@ static int32_t osdfunc_fileinfo(osdfuncparm_t const * const parm)
char buf[256]; char buf[256];
uint32_t length = kfilelength(i); uint32_t length = kfilelength(i);
int32_t crctime = getticks(); int32_t crctime = timerGetTicks();
uint32_t crc = 0; uint32_t crc = 0;
do do
{ {
@ -298,11 +298,11 @@ static int32_t osdfunc_fileinfo(osdfuncparm_t const * const parm)
crc = Bcrc32((uint8_t *)buf,j,crc); crc = Bcrc32((uint8_t *)buf,j,crc);
} }
while (j == 256); while (j == 256);
crctime = getticks() - crctime; crctime = timerGetTicks() - crctime;
klseek(i, 0, BSEEK_SET); klseek(i, 0, BSEEK_SET);
int32_t xxhtime = getticks(); int32_t xxhtime = timerGetTicks();
XXH32_state_t xxh; XXH32_state_t xxh;
XXH32_reset(&xxh, 0x1337); XXH32_reset(&xxh, 0x1337);
do do
@ -312,7 +312,7 @@ static int32_t osdfunc_fileinfo(osdfuncparm_t const * const parm)
} }
while (j == 256); while (j == 256);
uint32_t xxhash = XXH32_digest(&xxh); uint32_t xxhash = XXH32_digest(&xxh);
xxhtime = getticks() - xxhtime; xxhtime = timerGetTicks() - xxhtime;
kclose(i); kclose(i);
@ -321,8 +321,8 @@ static int32_t osdfunc_fileinfo(osdfuncparm_t const * const parm)
" CRC-32: %08X (%g sec)\n" " CRC-32: %08X (%g sec)\n"
" xxHash: %08X (%g sec)\n", " xxHash: %08X (%g sec)\n",
parm->parms[0], length, parm->parms[0], length,
crc, (double)crctime/gettimerfreq(), crc, (double)crctime/timerGetFreq(),
xxhash, (double)xxhtime/gettimerfreq()); xxhash, (double)xxhtime/timerGetFreq());
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1212,7 +1212,7 @@ int OSD_HandleScanCode(uint8_t scanCode, int keyDown)
-draw.scrolling; -draw.scrolling;
osdrowscur += draw.scrolling; osdrowscur += draw.scrolling;
OSD_CaptureInput(draw.scrolling == 1); OSD_CaptureInput(draw.scrolling == 1);
osdscrtime = getticks(); osdscrtime = timerGetTicks();
} }
return -1; return -1;
} }
@ -1240,7 +1240,7 @@ int OSD_HandleScanCode(uint8_t scanCode, int keyDown)
draw.scrolling = -1; draw.scrolling = -1;
osdrowscur--; osdrowscur--;
OSD_CaptureInput(0); OSD_CaptureInput(0);
osdscrtime = getticks(); osdscrtime = timerGetTicks();
break; break;
case sc_PgUp: case sc_PgUp:
@ -1477,7 +1477,7 @@ void OSD_Draw(void)
{ {
if ((osdrowscur < osd->draw.rows && osd->draw.scrolling == 1) || osdrowscur < -1) if ((osdrowscur < osd->draw.rows && osd->draw.scrolling == 1) || osdrowscur < -1)
{ {
int32_t j = (getticks()-osdscrtime); int32_t j = (timerGetTicks()-osdscrtime);
while (j >= 0) while (j >= 0)
{ {
osdrowscur++; osdrowscur++;
@ -1488,7 +1488,7 @@ void OSD_Draw(void)
} }
else if ((osdrowscur > -1 && osd->draw.scrolling == -1) || osdrowscur > osd->draw.rows) 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) while (j >= 0)
{ {
osdrowscur--; osdrowscur--;
@ -1498,7 +1498,7 @@ void OSD_Draw(void)
} }
} }
osdscrtime = getticks(); osdscrtime = timerGetTicks();
} }
if ((osd->flags & OSD_DRAW) == 0 || !osdrowscur) return; if ((osd->flags & OSD_DRAW) == 0 || !osdrowscur) return;
@ -1507,7 +1507,7 @@ void OSD_Draw(void)
row = osdrowscur-1; row = osdrowscur-1;
lines = min(osd->text.lines-osd->draw.head, osdrowscur); lines = min(osd->text.lines-osd->draw.head, osdrowscur);
begindrawing(); videoBeginDrawing();
clearbackground(osd->draw.cols,osdrowscur+1); 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); osd->version.buf, osd->version.len, (sintable[(totalclock<<4)&2047]>>11), osd->version.pal);
} }
enddrawing(); videoEndDrawing();
} }

View file

@ -79,7 +79,7 @@ void fade_screen_black(int32_t moreopaquep)
{ {
Bassert(!offscreenrendering); Bassert(!offscreenrendering);
begindrawing(); videoBeginDrawing();
{ {
char *const p = (char *) frameplace; char *const p = (char *) frameplace;
const char *const trans = getblendtab(0); const char *const trans = getblendtab(0);
@ -100,7 +100,7 @@ void fade_screen_black(int32_t moreopaquep)
for (; i<dimprod; i++) for (; i<dimprod; i++)
p[i] = trans[p[i]<<shiftamnt]; p[i] = trans[p[i]<<shiftamnt];
} }
enddrawing(); videoEndDrawing();
} }
} }
@ -705,7 +705,7 @@ void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags)
// vid_gamma = 1.0 + ((float)curbrightness / 10.0); // vid_gamma = 1.0 + ((float)curbrightness / 10.0);
} }
setgamma(); videoSetGamma();
j = !gammabrightness ? curbrightness : 0; j = !gammabrightness ? curbrightness : 0;
for (i=0; i<256; i++) for (i=0; i<256; i++)
@ -735,7 +735,7 @@ void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags)
if (palsumdidchange || newpalettesum != g_lastpalettesum) if (palsumdidchange || newpalettesum != g_lastpalettesum)
{ {
// if ((flags&1) == 0) // if ((flags&1) == 0)
setpalette(0, 256); videoUpdatePalette(0, 256);
} }
g_lastpalettesum = lastpalettesum = newpalettesum; g_lastpalettesum = lastpalettesum = newpalettesum;
@ -824,7 +824,7 @@ void setpalettefade(uint8_t r, uint8_t g, uint8_t b, uint8_t offset)
uint32_t newpalettesum = XXH32((uint8_t *) curpalettefaded, sizeof(curpalettefaded), sizeof(curpalettefaded)); uint32_t newpalettesum = XXH32((uint8_t *) curpalettefaded, sizeof(curpalettefaded), sizeof(curpalettefaded));
if (newpalettesum != lastpalettesum || newpalettesum != g_lastpalettesum) if (newpalettesum != lastpalettesum || newpalettesum != g_lastpalettesum)
setpalette(0, 256); videoUpdatePalette(0, 256);
g_lastpalettesum = lastpalettesum = newpalettesum; g_lastpalettesum = lastpalettesum = newpalettesum;
} }

View file

@ -747,7 +747,7 @@ int32_t culledface;
// EXTERNAL FUNCTIONS // EXTERNAL FUNCTIONS
int32_t polymer_init(void) int32_t polymer_init(void)
{ {
int32_t i, j, t = getticks(); int32_t i, j, t = timerGetTicks();
if (pr_verbosity >= 1) OSD_Printf("Initializing Polymer subsystem...\n"); if (pr_verbosity >= 1) OSD_Printf("Initializing Polymer subsystem...\n");
@ -852,7 +852,7 @@ int32_t polymer_init(void)
} }
#endif #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; 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; if (getrendermode() == REND_CLASSIC) return;
begindrawing(); videoBeginDrawing();
// TODO: support for screen resizing // TODO: support for screen resizing
// frameoffset = frameplace + windowxy1.y*bytesperline + windowxy1.x; // 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(); polymer_emptybuckets();
viewangle = daang; viewangle = daang;
enddrawing(); videoEndDrawing();
return; 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); gsinang2 = gsinang*fviewingrange*(1./65536.f);
if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n"); if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n");
enddrawing(); videoEndDrawing();
} }
void polymer_drawmasks(void) void polymer_drawmasks(void)

View file

@ -2227,7 +2227,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
int32_t picfillen = kfilelength(filh); int32_t picfillen = kfilelength(filh);
kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c 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; char hasalpha;
texcacheheader cachead; texcacheheader cachead;
@ -2502,7 +2502,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
if (willprint) if (willprint)
{ {
int32_t etime = getticks() - startticks; int32_t etime = timerGetTicks() - startticks;
if (etime >= MIN_CACHETIME_PRINT) 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, OSD_Printf("Load tile %4d: p%d-m%d-e%d %s... cached... %d ms\n", dapic, dapalnum, dameth, effect,
willprint == 2 ? fn : "", etime); willprint == 2 ? fn : "", etime);
@ -2515,7 +2515,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
if (willprint) if (willprint)
{ {
int32_t etime = getticks()-startticks; int32_t etime = timerGetTicks()-startticks;
if (etime>=MIN_CACHETIME_PRINT) if (etime>=MIN_CACHETIME_PRINT)
OSD_Printf("Load tile %4d: p%d-m%d-e%d %s... %d ms\n", dapic, dapalnum, dameth, effect, OSD_Printf("Load tile %4d: p%d-m%d-e%d %s... %d ms\n", dapic, dapalnum, dameth, effect,
willprint==2 ? fn : "", etime); willprint==2 ? fn : "", etime);
@ -5191,7 +5191,7 @@ void polymost_drawrooms()
{ {
if (getrendermode() == REND_CLASSIC) return; if (getrendermode() == REND_CLASSIC) return;
begindrawing(); videoBeginDrawing();
frameoffset = frameplace + windowxy1.y*bytesperline + windowxy1.x; frameoffset = frameplace + windowxy1.y*bytesperline + windowxy1.x;
resizeglcheck(); resizeglcheck();
@ -5282,7 +5282,7 @@ void polymost_drawrooms()
} }
} }
if (n < 3) { enddrawing(); return; } if (n < 3) { videoEndDrawing(); return; }
float sx[4], sy[4]; float sx[4], sy[4];
@ -5355,7 +5355,7 @@ void polymost_drawrooms()
glDepthFunc(GL_LEQUAL); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS glDepthFunc(GL_LEQUAL); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
// glDepthRange(0.0, 1.0); //<- this is more widely supported than glPolygonOffset // glDepthRange(0.0, 1.0); //<- this is more widely supported than glPolygonOffset
enddrawing(); videoEndDrawing();
} }
void polymost_drawmaskwall(int32_t damaskwallcnt) 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 (r == OSDCMD_OK)
{ {
if (!Bstrcasecmp(parm->name, "r_swapinterval")) if (!Bstrcasecmp(parm->name, "r_swapinterval"))
vsync = setvsync(vsync); vsync = videoSetVsync(vsync);
else if (!Bstrcasecmp(parm->name, "r_downsize")) else if (!Bstrcasecmp(parm->name, "r_downsize"))
{ {
if (r_downsizevar == -1) 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) if (in3dmode() && r_downsize != r_downsizevar)
{ {
texcache_invalidate(); texcache_invalidate();
resetvideomode(); videoResetMode();
if (setgamemode(fullscreen,xdim,ydim,bpp)) if (videoSetGameMode(fullscreen,xdim,ydim,bpp))
OSD_Printf("restartvid: Reset failed...\n"); OSD_Printf("restartvid: Reset failed...\n");
} }

View file

@ -65,7 +65,7 @@ int screencapture(const char *filename, char inverseit)
uint8_t * const imgBuf = (uint8_t *) Xmalloc(xdim * ydim * (HICOLOR ? 3 : 1)); uint8_t * const imgBuf = (uint8_t *) Xmalloc(xdim * ydim * (HICOLOR ? 3 : 1));
begindrawing(); //{{{ videoBeginDrawing(); //{{{
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (HICOLOR) if (HICOLOR)
@ -119,7 +119,7 @@ int screencapture(const char *filename, char inverseit)
Bmemcpy(imgBuf + i * xdim, (uint8_t *)frameplace + ylookup[i], xdim); Bmemcpy(imgBuf + i * xdim, (uint8_t *)frameplace + ylookup[i], xdim);
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
png_set_text("Software", osd->version.buf); png_set_text("Software", osd->version.buf);
png_write(fp, xdim, ydim, HICOLOR ? PNG_TRUECOLOR : PNG_INDEXED, imgBuf); 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 # ifdef USE_OPENGL
if (HICOLOR) if (HICOLOR)
@ -215,7 +215,7 @@ int screencapture_tga(const char *filename, char inverseit)
Bfwrite(ptr + i * bytesperline, xdim, 1, fil); Bfwrite(ptr + i * bytesperline, xdim, 1, fil);
} }
enddrawing(); //}}} videoEndDrawing(); //}}}
screencapture_end(fn, &fil); screencapture_end(fn, &fil);

View file

@ -1,7 +1,4 @@
// SDL interface layer // SDL interface layer for the Build Engine
// for the Build Engine
// by Jonathon Fowler (jf@jonof.id.au)
//
// Use SDL 1.2 or 2.0 from http://www.libsdl.org // Use SDL 1.2 or 2.0 from http://www.libsdl.org
#include "compat.h" #include "compat.h"
@ -484,7 +481,6 @@ int main(int argc, char *argv[])
startwin_open(); startwin_open();
maybe_redirect_outputs(); maybe_redirect_outputs();
baselayer_init();
#ifdef _WIN32 #ifdef _WIN32
char *argvbuf; char *argvbuf;
@ -517,7 +513,7 @@ int main(int argc, char *argv[])
#if SDL_MAJOR_VERSION != 1 #if SDL_MAJOR_VERSION != 1
int32_t setvsync(int32_t newSync) int32_t videoSetVsync(int32_t newSync)
{ {
if (vsync_renderlayer == newSync) if (vsync_renderlayer == newSync)
return newSync; return newSync;
@ -549,8 +545,8 @@ int32_t setvsync(int32_t newSync)
{ {
vsync_renderlayer = newSync; vsync_renderlayer = newSync;
resetvideomode(); videoResetMode();
if (setgamemode(fullscreen, xdim, ydim, bpp)) if (videoSetGameMode(fullscreen, xdim, ydim, bpp))
OSD_Printf("restartvid: Reset failed...\n"); OSD_Printf("restartvid: Reset failed...\n");
} }
@ -663,7 +659,7 @@ int32_t initsystem(void)
void uninitsystem(void) void uninitsystem(void)
{ {
uninitinput(); uninitinput();
uninittimer(); timerUninit();
if (appicon) if (appicon)
{ {
@ -691,7 +687,7 @@ void uninitsystem(void)
// //
void system_getcvars(void) void system_getcvars(void)
{ {
vsync = setvsync(vsync); vsync = videoSetVsync(vsync);
} }
// //
@ -1011,7 +1007,7 @@ static void(*usertimercallback)(void) = NULL;
// //
// inittimer() -- initialize timer // inittimer() -- initialize timer
// //
int32_t inittimer(int32_t tickspersecond) int32_t timerInit(int32_t tickspersecond)
{ {
if (timerfreq) return 0; // already installed if (timerfreq) return 0; // already installed
@ -1029,7 +1025,7 @@ int32_t inittimer(int32_t tickspersecond)
usertimercallback = NULL; usertimercallback = NULL;
msperu64tick = 1000.0 / (double)getu64tickspersec(); msperu64tick = 1000.0 / (double)timerGetFreqU64();
return 0; return 0;
} }
@ -1037,7 +1033,7 @@ int32_t inittimer(int32_t tickspersecond)
// //
// uninittimer() -- shut down timer // uninittimer() -- shut down timer
// //
void uninittimer(void) void timerUninit(void)
{ {
timerfreq=0; timerfreq=0;
#if defined(_WIN32) && SDL_MAJOR_VERSION==1 #if defined(_WIN32) && SDL_MAJOR_VERSION==1
@ -1049,7 +1045,7 @@ void uninittimer(void)
// //
// sampletimer() -- update totalclock // sampletimer() -- update totalclock
// //
void sampletimer(void) void timerUpdate(void)
{ {
if (!timerfreq) return; if (!timerfreq) return;
@ -1069,7 +1065,7 @@ void sampletimer(void)
// //
// getticks() -- returns the sdl ticks count // getticks() -- returns the sdl ticks count
// //
uint32_t getticks(void) uint32_t timerGetTicks(void)
{ {
return (uint32_t)SDL_GetTicks(); return (uint32_t)SDL_GetTicks();
} }
@ -1078,12 +1074,12 @@ uint32_t getticks(void)
// high-resolution timers for profiling // high-resolution timers for profiling
#if SDL_MAJOR_VERSION != 1 #if SDL_MAJOR_VERSION != 1
uint64_t getu64ticks(void) uint64_t timerGetTicksU64(void)
{ {
return SDL_GetPerformanceCounter(); return SDL_GetPerformanceCounter();
} }
uint64_t getu64tickspersec(void) uint64_t timerGetFreqU64(void)
{ {
return SDL_GetPerformanceFrequency(); return SDL_GetPerformanceFrequency();
} }
@ -1092,15 +1088,15 @@ uint64_t getu64tickspersec(void)
// Returns the time since an unspecified starting time in milliseconds. // Returns the time since an unspecified starting time in milliseconds.
// (May be not monotonic for certain configurations.) // (May be not monotonic for certain configurations.)
ATTRIBUTE((flatten)) 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 // gettimerfreq() -- returns the number of ticks per second the timer is configured to generate
// //
int32_t gettimerfreq(void) int32_t timerGetFreq(void)
{ {
return timerticspersec; return timerticspersec;
} }
@ -1109,7 +1105,7 @@ int32_t gettimerfreq(void)
// //
// installusertimercallback() -- set up a callback function to be called when the timer is fired // 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); void(*oldtimercallback)(void);
@ -1153,7 +1149,7 @@ static int sortmodes(const void *a_, const void *b_)
static char modeschecked=0; static char modeschecked=0;
#if SDL_MAJOR_VERSION != 1 #if SDL_MAJOR_VERSION != 1
void getvalidmodes(void) void videoGetModes(void)
{ {
int32_t i, maxx = 0, maxy = 0; int32_t i, maxx = 0, maxy = 0;
SDL_DisplayMode dispmode; SDL_DisplayMode dispmode;
@ -1214,11 +1210,11 @@ void getvalidmodes(void)
// //
// checkvideomode() -- makes sure the video mode passed is legal // 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; int32_t i, nearest=-1, dx, dy, odx=9999, ody=9999;
getvalidmodes(); videoGetModes();
if (c>8 if (c>8
#ifdef USE_OPENGL #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; return 0;
} }
if (checkvideomode(x, y, c, fs, 0) < 0) if (videoCheckMode(x, y, c, fs, 0) < 0)
return -1; return -1;
#ifdef GEKKO #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); mouseGrabInput(0);
} }
while (lockcount) enddrawing(); while (lockcount) videoEndDrawing();
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (bpp > 8 && sdl_surface) 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; gammabrightness = 1;
// see if gamma really is working by trying to set the brightness // see if gamma really is working by trying to set the brightness
if (gammabrightness && setgamma() < 0) if (gammabrightness && videoSetGamma() < 0)
gammabrightness = 0; // nope gammabrightness = 0; // nope
} }
#endif #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; 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 // resetvideomode() -- resets the video system
// //
void resetvideomode(void) void videoResetMode(void)
{ {
videomodereset = 1; videomodereset = 1;
modeschecked = 0; modeschecked = 0;
@ -1712,7 +1708,7 @@ uint32_t begindrawing_line[BEGINDRAWING_SIZE];
const char *begindrawing_file[BEGINDRAWING_SIZE]; const char *begindrawing_file[BEGINDRAWING_SIZE];
void begindrawing_real(void) void begindrawing_real(void)
#else #else
void begindrawing(void) void videoBeginDrawing(void)
#endif #endif
{ {
if (bpp > 8) if (bpp > 8)
@ -1747,7 +1743,7 @@ void begindrawing(void)
// //
// enddrawing() -- unlocks the framebuffer // enddrawing() -- unlocks the framebuffer
// //
void enddrawing(void) void videoEndDrawing(void)
{ {
if (bpp > 8) if (bpp > 8)
{ {
@ -1775,7 +1771,7 @@ void enddrawing(void)
extern "C" void AndroidDrawControls(); extern "C" void AndroidDrawControls();
#endif #endif
void showframe(int32_t w) void videoShowFrame(int32_t w)
{ {
UNREFERENCED_PARAMETER(w); UNREFERENCED_PARAMETER(w);
@ -1810,7 +1806,7 @@ void showframe(int32_t w)
if (lockcount) if (lockcount)
{ {
printf("Frame still locked %d times when showframe() called.\n", lockcount); printf("Frame still locked %d times when showframe() called.\n", lockcount);
while (lockcount) enddrawing(); while (lockcount) videoEndDrawing();
} }
// deferred palette updating // deferred palette updating
@ -1845,16 +1841,14 @@ void showframe(int32_t w)
// //
// setpalette() -- set palette values // 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) if (bpp > 8)
return 0; // no palette in opengl return 0; // no palette in opengl
Bmemcpy(sdlayer_pal, curpalettefaded, 256 * 4); 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 = curpalettefaded[i].f =
#if SDL_MAJOR_VERSION == 1 #if SDL_MAJOR_VERSION == 1
sdlayer_pal[i].unused sdlayer_pal[i].unused
@ -1871,22 +1865,20 @@ int32_t setpalette(int32_t start, int32_t num)
// //
// setgamma // setgamma
// //
int32_t setgamma(void) int32_t videoSetGamma(void)
{ {
// return 0; if (novideo)
return 0;
int32_t i; int32_t i;
uint16_t gammaTable[768]; uint16_t gammaTable[768];
float gamma = max(0.1f, min(4.f, vid_gamma)); float gamma = max(0.1f, min(4.f, g_videoGamma));
float contrast = max(0.1f, min(3.f, vid_contrast)); float contrast = max(0.1f, min(3.f, g_videoContrast));
float bright = max(-0.8f, min(0.8f, vid_brightness)); float bright = max(-0.8f, min(0.8f, g_videoBrightness));
float invgamma = 1.f / gamma; float invgamma = 1.f / gamma;
float norm = powf(255.f, invgamma - 1.f); float norm = powf(255.f, invgamma - 1.f);
if (novideo)
return 0;
if (lastvidgcb[0] == gamma && lastvidgcb[1] == contrast && lastvidgcb[2] == bright) if (lastvidgcb[0] == gamma && lastvidgcb[1] == contrast && lastvidgcb[2] == bright)
return 0; return 0;
@ -2403,7 +2395,7 @@ int32_t handleevents(void)
rv = handleevents_pollsdl(); rv = handleevents_pollsdl();
inputchecked = 0; inputchecked = 0;
sampletimer(); timerUpdate();
#ifndef _WIN32 #ifndef _WIN32
startwin_idle(NULL); startwin_idle(NULL);

View file

@ -18,15 +18,15 @@ HWND win_gethwnd(void)
} }
#endif #endif
int32_t setvsync(int32_t newSync) int32_t videoSetVsync(int32_t newSync)
{ {
if (vsync_renderlayer == newSync) if (vsync_renderlayer == newSync)
return newSync; return newSync;
vsync_renderlayer = newSync; vsync_renderlayer = newSync;
resetvideomode(); videoResetMode();
if (setgamemode(fullscreen, xdim, ydim, bpp)) if (videoSetGameMode(fullscreen, xdim, ydim, bpp))
OSD_Printf("restartvid: Reset failed...\n"); OSD_Printf("restartvid: Reset failed...\n");
return newSync; return newSync;
@ -174,7 +174,7 @@ static inline char grabmouse_low(char a)
} }
// high-resolution timers for profiling // high-resolution timers for profiling
uint64_t getu64ticks(void) uint64_t timerGetTicksU64(void)
{ {
# if defined _WIN32 # if defined _WIN32
return win_getu64ticks(); return win_getu64ticks();
@ -201,7 +201,7 @@ uint64_t getu64ticks(void)
# endif # endif
} }
uint64_t getu64tickspersec(void) uint64_t timerGetFreqU64(void)
{ {
# if defined _WIN32 # if defined _WIN32
return win_timerfreq; return win_timerfreq;
@ -219,7 +219,7 @@ uint64_t getu64tickspersec(void)
# endif # endif
} }
void getvalidmodes(void) void videoGetModes(void)
{ {
int32_t i, maxx = 0, maxy = 0; int32_t i, maxx = 0, maxy = 0;
int32_t j; int32_t j;
@ -317,7 +317,7 @@ void getvalidmodes(void)
// //
// setvideomode() -- set SDL video mode // 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; int32_t regrab = 0, ret;
#ifdef USE_OPENGL #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 // showframe() -- update the display
// //
void showframe(int32_t w) void videoShowFrame(int32_t w)
{ {
UNREFERENCED_PARAMETER(w); UNREFERENCED_PARAMETER(w);
@ -453,7 +453,7 @@ void showframe(int32_t w)
if (lockcount) if (lockcount)
{ {
printf("Frame still locked %d times when showframe() called.\n", lockcount); printf("Frame still locked %d times when showframe() called.\n", lockcount);
while (lockcount) enddrawing(); while (lockcount) videoEndDrawing();
} }
// deferred palette updating // deferred palette updating

View file

@ -155,8 +155,8 @@ static void PopulateForm(void)
GtkComboBox *box2d, *box3d; GtkComboBox *box2d, *box3d;
char buf[64]; char buf[64];
mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); mode2d = videoCheckMode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1);
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
if (mode2d < 0) mode2d = 0; if (mode2d < 0) mode2d = 0;
if (mode3d < 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 (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; }
for (; cd[i]; i++) 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; if (mode3d < 0) continue;
settings.bpp3d = cd[i]; settings.bpp3d = cd[i];
break; break;

View file

@ -43,8 +43,8 @@ static void PopulateForm(void)
hwnd2d = GetDlgItem(pages[TAB_CONFIG], IDC2DVMODE); hwnd2d = GetDlgItem(pages[TAB_CONFIG], IDC2DVMODE);
hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE); hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE);
mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); mode2d = videoCheckMode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1);
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
if (mode2d < 0) mode2d = 0; if (mode2d < 0) mode2d = 0;
if (mode3d < 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 (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; }
for (; cd[i]; i++) 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; if (mode3d < 0) continue;
settings.bpp3d = cd[i]; settings.bpp3d = cd[i];
break; break;

View file

@ -399,7 +399,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
// atexit(uninitsystem); // atexit(uninitsystem);
startwin_open(); startwin_open();
baselayer_init();
r = app_main(_buildargc, _buildargv); r = app_main(_buildargc, _buildargv);
@ -539,7 +538,7 @@ void uninitsystem(void)
startwin_close(); startwin_close();
uninitinput(); uninitinput();
uninittimer(); timerUninit();
win_uninit(); win_uninit();
@ -559,7 +558,7 @@ void uninitsystem(void)
// //
void system_getcvars(void) void system_getcvars(void)
{ {
vsync = setvsync(vsync); vsync = videoSetVsync(vsync);
} }
@ -675,7 +674,7 @@ int32_t handleevents(void)
if (!appactive || quitevent) rv = -1; if (!appactive || quitevent) rv = -1;
sampletimer(); timerUpdate();
return rv; return rv;
} }
@ -721,7 +720,7 @@ void uninitinput(void)
void idle_waitevent_timeout(uint32_t timeout) void idle_waitevent_timeout(uint32_t timeout)
{ {
// timeout becomes a completion deadline // timeout becomes a completion deadline
timeout += getticks(); timeout += timerGetTicks();
do do
{ {
@ -738,7 +737,7 @@ void idle_waitevent_timeout(uint32_t timeout)
Sleep(10); 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 // 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); void (*oldtimercallback)(void);
@ -1399,7 +1398,7 @@ void (*installusertimercallback(void (*callback)(void)))(void)
// //
// inittimer() -- initialize timer // inittimer() -- initialize timer
// //
int32_t inittimer(int32_t tickspersecond) int32_t timerInit(int32_t tickspersecond)
{ {
int64_t t; int64_t t;
@ -1417,7 +1416,7 @@ int32_t inittimer(int32_t tickspersecond)
usertimercallback = NULL; usertimercallback = NULL;
msperu64tick = 1000.0 / (double)getu64tickspersec(); msperu64tick = 1000.0 / (double)timerGetFreqU64();
return 0; return 0;
} }
@ -1425,7 +1424,7 @@ int32_t inittimer(int32_t tickspersecond)
// //
// uninittimer() -- shut down timer // uninittimer() -- shut down timer
// //
void uninittimer(void) void timerUninit(void)
{ {
if (!win_timerfreq) return; if (!win_timerfreq) return;
@ -1438,7 +1437,7 @@ void uninittimer(void)
// //
// sampletimer() -- update totalclock // sampletimer() -- update totalclock
// //
void sampletimer(void) void timerUpdate(void)
{ {
int64_t i; int64_t i;
int32_t n; int32_t n;
@ -1460,7 +1459,7 @@ void sampletimer(void)
// //
// getticks() -- returns the windows ticks count // getticks() -- returns the windows ticks count
// //
uint32_t getticks(void) uint32_t timerGetTicks(void)
{ {
int64_t i; int64_t i;
if (win_timerfreq == 0) return 0; if (win_timerfreq == 0) return 0;
@ -1469,27 +1468,27 @@ uint32_t getticks(void)
} }
// high-resolution timers for profiling // high-resolution timers for profiling
uint64_t getu64ticks(void) uint64_t timerGetTicksU64(void)
{ {
return win_getu64ticks(); return win_getu64ticks();
} }
uint64_t getu64tickspersec(void) uint64_t timerGetFreqU64(void)
{ {
return win_timerfreq; return win_timerfreq;
} }
// Returns the time since an unspecified starting time in milliseconds. // Returns the time since an unspecified starting time in milliseconds.
ATTRIBUTE((flatten)) 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 // gettimerfreq() -- returns the number of ticks per second the timer is configured to generate
// //
int32_t gettimerfreq(void) int32_t timerGetFreq(void)
{ {
return timerticspersec; return timerticspersec;
} }
@ -1524,11 +1523,11 @@ static int32_t getgammaramp(LPDDGAMMARAMP gt);
// //
// checkvideomode() -- makes sure the video mode passed is legal // 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; int32_t i, nearest=-1, dx, dy, odx=9999, ody=9999;
getvalidmodes(); videoGetModes();
// fix up the passed resolution values to be multiples of 8 // fix up the passed resolution values to be multiples of 8
// and at least 320x200 or at most MAXXDIMxMAXYDIM // 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; static HWND hGLWindow = NULL;
#endif #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; char inp;
int32_t modenum; int32_t modenum;
@ -1599,7 +1598,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
return 0; return 0;
} }
modenum = checkvideomode(&x,&y,c,fs,0); modenum = videoCheckMode(&x,&y,c,fs,0);
if (modenum < 0) return -1; if (modenum < 0) return -1;
if (modenum == 0x7fffffff) 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); // float f = 1.0 + ((float)curbrightness / 10.0);
if (getgammaramp(&sysgamma) >= 0) gammabrightness = 1; 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 #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)) #define CHECK(w,h) if ((w < maxx) && (h < maxy))
int32_t setvsync(int32_t newSync) int32_t videoSetVsync(int32_t newSync)
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (!glinfo.vsync) if (!glinfo.vsync)
@ -1766,7 +1765,7 @@ static int sortmodes(const void *a_, const void *b_)
return 0; return 0;
} }
void getvalidmodes(void) void videoGetModes(void)
{ {
int32_t cdepths[2] = { 8, 0 }; int32_t cdepths[2] = { 8, 0 };
int32_t i, j, maxx=0, maxy=0; int32_t i, j, maxx=0, maxy=0;
@ -1827,7 +1826,7 @@ void getvalidmodes(void)
// //
// resetvideomode() -- resets the video system // resetvideomode() -- resets the video system
// //
void resetvideomode(void) void videoResetMode(void)
{ {
videomodereset = 1; videomodereset = 1;
modeschecked = 0; modeschecked = 0;
@ -1842,7 +1841,7 @@ uint32_t begindrawing_line[BEGINDRAWING_SIZE];
const char *begindrawing_file[BEGINDRAWING_SIZE]; const char *begindrawing_file[BEGINDRAWING_SIZE];
void begindrawing_real(void) void begindrawing_real(void)
#else #else
void begindrawing(void) void videoBeginDrawing(void)
#endif #endif
{ {
if (bpp > 8) if (bpp > 8)
@ -1881,7 +1880,7 @@ void begindrawing(void)
// //
// enddrawing() -- unlocks the framebuffer // enddrawing() -- unlocks the framebuffer
// //
void enddrawing(void) void videoEndDrawing(void)
{ {
if (bpp > 8) if (bpp > 8)
{ {
@ -1899,7 +1898,7 @@ void enddrawing(void)
// //
// showframe() -- update the display // showframe() -- update the display
// //
void showframe(int32_t w) void videoShowFrame(int32_t w)
{ {
HRESULT result; HRESULT result;
DDSURFACEDESC ddsd; DDSURFACEDESC ddsd;
@ -1924,7 +1923,7 @@ void showframe(int32_t w)
if (lockcount) if (lockcount)
{ {
initprintf("Frame still locked %d times when showframe() called.\n", lockcount); initprintf("Frame still locked %d times when showframe() called.\n", lockcount);
while (lockcount) enddrawing(); while (lockcount) videoEndDrawing();
} }
if (!fullscreen) if (!fullscreen)
@ -2000,7 +1999,7 @@ void showframe(int32_t w)
// New behaviour: curpalettefaded is the live palette, and any changes this function // New behaviour: curpalettefaded is the live palette, and any changes this function
// makes are done to it and not the base palette. // 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; int32_t i, n;
HRESULT result; HRESULT result;
@ -2116,13 +2115,13 @@ static int32_t setgammaramp(LPDDGAMMARAMP gt)
return 0; return 0;
} }
int32_t setgamma(void) int32_t videoSetGamma(void)
{ {
int32_t i; int32_t i;
static DDGAMMARAMP gammaTable; static DDGAMMARAMP gammaTable;
float gamma = max(0.1f,min(4.f,vid_gamma)); float gamma = max(0.1f,min(4.f,g_videoGamma));
float contrast = max(0.1f,min(3.f,vid_contrast)); float contrast = max(0.1f,min(3.f,g_videoContrast));
float bright = max(-0.8f,min(0.8f,vid_brightness)); float bright = max(-0.8f,min(0.8f,g_videoBrightness));
double invgamma = 1 / gamma; double invgamma = 1 / gamma;
double norm = pow(255., invgamma - 1); double norm = pow(255., invgamma - 1);
@ -2809,7 +2808,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
unloadwgl(); unloadwgl();
nogl = 1; nogl = 1;
modeschecked = 0; modeschecked = 0;
getvalidmodes(); videoGetModes();
return TRUE; return TRUE;
} }
@ -3515,7 +3514,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
} }
realfs = fullscreen; realfs = fullscreen;
silentvideomodeswitch = 1; silentvideomodeswitch = 1;
setgamemode(!fullscreen,xdim,ydim,bpp); videoSetGameMode(!fullscreen,xdim,ydim,bpp);
ShowWindow(hWindow, SW_MINIMIZE); ShowWindow(hWindow, SW_MINIMIZE);
} }
else if (appactive && realfs) else if (appactive && realfs)
@ -3528,7 +3527,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
ShowWindow(hWindow, SW_RESTORE); ShowWindow(hWindow, SW_RESTORE);
SetForegroundWindow(hWindow); SetForegroundWindow(hWindow);
SetFocus(hWindow); SetFocus(hWindow);
setgamemode(realfs,xdim,ydim,bpp); videoSetGameMode(realfs,xdim,ydim,bpp);
silentvideomodeswitch = 0; silentvideomodeswitch = 0;
realfs = 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)); initprintf("Palette set failed: %s\n", GetDDrawError(result));
break; break;
} }
setpalette(0,256); videoUpdatePalette(0,256);
break; break;
} }
if (appactive && (HWND)wParam != hWindow) setpalette(0,256); if (appactive && (HWND)wParam != hWindow) videoUpdatePalette(0,256);
break; break;
case WM_DISPLAYCHANGE: case WM_DISPLAYCHANGE:
@ -3580,7 +3579,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
desktopxdim = LOWORD(lParam); desktopxdim = LOWORD(lParam);
desktopydim = HIWORD(lParam); desktopydim = HIWORD(lParam);
desktopbpp = wParam; desktopbpp = wParam;
getvalidmodes(); videoGetModes();
break; break;
case WM_PAINT: case WM_PAINT:

View file

@ -8388,7 +8388,7 @@ static void G_DoEventGame(int const nEventID)
void G_MoveWorld(void) void G_MoveWorld(void)
{ {
extern double g_moveActorsTime, g_moveWorldTime; extern double g_moveActorsTime, g_moveWorldTime;
const double worldTime = gethiticks(); const double worldTime = timerGetHiTicks();
VM_OnEvent(EVENT_PREWORLD, -1, -1); VM_OnEvent(EVENT_PREWORLD, -1, -1);
@ -8402,11 +8402,11 @@ void G_MoveWorld(void)
G_MoveFallers(); //ST 12 G_MoveFallers(); //ST 12
G_MoveMisc(); //ST 5 G_MoveMisc(); //ST 5
const double actorsTime = gethiticks(); const double actorsTime = timerGetHiTicks();
G_MoveActors(); //ST 1 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? // XXX: Has to be before effectors, in particular movers?
// TODO: lights in moving sectors ought to be interpolated // TODO: lights in moving sectors ought to be interpolated
@ -8423,5 +8423,5 @@ void G_MoveWorld(void)
G_DoSectorAnimations(); G_DoSectorAnimations();
G_MoveFX(); //ST 11 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);
} }

View file

@ -304,7 +304,7 @@ int32_t Anim_Play(const char *fn)
uint32_t const convdenom = info.fpsnumer * origanim->framedelay; uint32_t const convdenom = info.fpsnumer * origanim->framedelay;
uint32_t const msecsperframe = scale(info.fpsdenom, 1000, info.fpsnumer); uint32_t const msecsperframe = scale(info.fpsdenom, 1000, info.fpsnumer);
uint32_t nextframetime = getticks(); uint32_t nextframetime = timerGetTicks();
uint8_t *pic; uint8_t *pic;
// OSD_Printf("msecs per frame: %d\n", msecsperframe); // 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); VM_OnEventWithReturn(EVENT_PRECUTSCENE, g_player[screenpeek].ps->i, screenpeek, framenum);
clearallviews(0); videoClearScreen(0);
ototalclock = totalclock + 1; // pause game like ANMs 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 // this and showframe() instead of nextpage() are so that
// nobody tramples on our carefully set up GL state! // nobody tramples on our carefully set up GL state!
palfadedelta = 0; palfadedelta = 0;
showframe(0); videoShowFrame(0);
// I_ClearAllInput(); // I_ClearAllInput();
@ -398,7 +398,7 @@ int32_t Anim_Play(const char *fn)
running = 0; running = 0;
break; break;
} }
} while (getticks() < nextframetime); } while (timerGetTicks() < nextframetime);
} while (running); } while (running);
animvpx_print_stats(&codec); animvpx_print_stats(&codec);
@ -513,7 +513,7 @@ int32_t Anim_Play(const char *fn)
frametime = totalclock; frametime = totalclock;
clearallviews(0); videoClearScreen(0);
int32_t z; int32_t z;
if (anim->frameaspect1 > 0 && anim->frameaspect2 > 0 && ((anim->frameaspect1 / anim->frameaspect2) != (tilesiz[TILE_ANIM].y / (tilesiz[TILE_ANIM].x * 1.2)))) 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 else
z = divscale16(lrint(320 * ydim * anim->frameaspect1), lrint(tilesiz[TILE_ANIM].y * xdim * anim->frameaspect2)); 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)); 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); rotatesprite_fs(160<<16, 100<<16, z, 512, TILE_ANIM, 0, 0, 2|4|8|64|1024);
setaspect(viewingrange, oyxaspect); videoSetAspect(viewingrange, oyxaspect);
} }
else else
{ {
@ -541,7 +541,7 @@ int32_t Anim_Play(const char *fn)
i = VM_OnEventWithReturn(EVENT_CUTSCENE, g_player[screenpeek].ps->i, screenpeek, i); i = VM_OnEventWithReturn(EVENT_CUTSCENE, g_player[screenpeek].ps->i, screenpeek, i);
g_animPtr = NULL; g_animPtr = NULL;
nextpage(); videoNextPage();
I_ClearAllInput(); I_ClearAllInput();

View file

@ -1038,7 +1038,7 @@ void ExtShowSectorData(int16_t sectnum) //F5
ydim -= 8; // vvvvvv reset at end!! ydim -= 8; // vvvvvv reset at end!!
begindrawing(); //{{{ videoBeginDrawing(); //{{{
x=1; x2=14; x=1; x2=14;
y=4; yi=2; y=4; yi=2;
@ -1102,7 +1102,7 @@ void ExtShowSectorData(int16_t sectnum) //F5
PrintStatus("Skill 4 =", totalactors4, 65, 13, 11); PrintStatus("Skill 4 =", totalactors4, 65, 13, 11);
PrintStatus("Respawn =", totalrespawn, 65, 14, 11); PrintStatus("Respawn =", totalrespawn, 65, 14, 11);
enddrawing(); //}}} videoEndDrawing(); //}}}
ydim += 8; // ^^^^^^ see above! ydim += 8; // ^^^^^^ see above!
} }
@ -1220,7 +1220,7 @@ void ExtShowWallData(int16_t wallnum) //F6
for (i=0; i<MAXTILES; i++) for (i=0; i<MAXTILES; i++)
total += multisprite[i]; total += multisprite[i];
begindrawing(); //{{{ videoBeginDrawing(); //{{{
x=2+runi*34; x=2+runi*34;
y=4; y=4;
@ -1251,7 +1251,7 @@ void ExtShowWallData(int16_t wallnum) //F6
PRSTAT("Boss4 =", BOSS4); PRSTAT("Boss4 =", BOSS4);
#undef PRSTAT #undef PRSTAT
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
} }
@ -1278,7 +1278,7 @@ static void ShowFileText(const char *name)
} }
t=65; t=65;
begindrawing(); videoBeginDrawing();
while (t!=EOF && col<5) while (t!=EOF && col<5)
{ {
t = 0; t = 0;
@ -1309,7 +1309,7 @@ static void ShowFileText(const char *name)
xmax=0; xmax=0;
} }
} }
enddrawing(); videoEndDrawing();
kclose(fp); kclose(fp);
@ -1468,9 +1468,9 @@ static void IntegratedHelp(void)
Bmemset(oldpattern, 0, sizeof(char)); Bmemset(oldpattern, 0, sizeof(char));
// clearmidstatbar16(); // clearmidstatbar16();
begindrawing(); videoBeginDrawing();
CLEARLINES2D(0, ydim, 0); CLEARLINES2D(0, ydim, 0);
enddrawing(); videoEndDrawing();
while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F1]==0) while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F1]==0)
{ {
@ -1486,9 +1486,9 @@ static void IntegratedHelp(void)
} }
else else
{ {
begindrawing(); videoBeginDrawing();
CLEARLINES2D(0, ydim, 0); CLEARLINES2D(0, ydim, 0);
enddrawing(); videoEndDrawing();
} }
// based on 'save as' dialog in overheadeditor() // based on 'save as' dialog in overheadeditor()
@ -1503,7 +1503,7 @@ static void IntegratedHelp(void)
while (bad == 0) while (bad == 0)
{ {
_printmessage16("Search: %s_", pattern); _printmessage16("Search: %s_", pattern);
showframe(1); videoShowFrame(1);
idle_waitevent(); idle_waitevent();
@ -1653,11 +1653,11 @@ ENDFOR1:
// drawgradient(); // drawgradient();
begindrawing(); videoBeginDrawing();
printext16(9, ydim2d-overridepm16y+9, editorcolors[4], -1, "Help Mode", 0); printext16(9, ydim2d-overridepm16y+9, editorcolors[4], -1, "Help Mode", 0);
printext16(8, ydim2d-overridepm16y+8, editorcolors[12], -1, "Help Mode", 0); printext16(8, ydim2d-overridepm16y+8, editorcolors[12], -1, "Help Mode", 0);
printext16(8 + 9*8 + 2*8, ydim2d-overridepm16y+8, editorcolors[15], -1, "(S:search)", 0); printext16(8 + 9*8 + 2*8, ydim2d-overridepm16y+8, editorcolors[15], -1, "(S:search)", 0);
enddrawing(); videoEndDrawing();
if (curhp < helppage[0]->numlines) if (curhp < helppage[0]->numlines)
_printmessage16("%s", helppage[0]->line[curhp]); _printmessage16("%s", helppage[0]->line[curhp]);
@ -1677,7 +1677,7 @@ ENDFOR1:
disptext[i], 0); disptext[i], 0);
} }
showframe(1); videoShowFrame(1);
} }
clearkeys(); clearkeys();
@ -1838,9 +1838,9 @@ static void SoundDisplay(void)
while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F2]==0 while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F2]==0
&& keystatus[buildkeys[BK_MODE2D_3D]]==0) // quickjump to 3d mode && keystatus[buildkeys[BK_MODE2D_3D]]==0) // quickjump to 3d mode
{ {
begindrawing(); videoBeginDrawing();
CLEARLINES2D(0, ydim16, 0); CLEARLINES2D(0, ydim16, 0);
enddrawing(); videoEndDrawing();
idle_waitevent(); idle_waitevent();
if (handleevents()) if (handleevents())
@ -1848,11 +1848,11 @@ static void SoundDisplay(void)
// drawgradient(); // drawgradient();
begindrawing(); videoBeginDrawing();
printext16(9, ydim2d-overridepm16y+9, editorcolors[4], -1, "Sound Index", 0); printext16(9, ydim2d-overridepm16y+9, editorcolors[4], -1, "Sound Index", 0);
printext16(8, ydim2d-overridepm16y+8, editorcolors[12], -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); 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# if (PRESSED_KEYSC(G)) // goto specified sound#
{ {
@ -1968,7 +1968,7 @@ static void SoundDisplay(void)
char ch, bad=0; char ch, bad=0;
_printmessage16("Sort by: (S)oundnum (D)ef (F)ile ori(g) or flags (12345)"); _printmessage16("Sort by: (S)oundnum (D)ef (F)ile ori(g) or flags (12345)");
showframe(1); videoShowFrame(1);
i=0; i=0;
keyFlushChars(); keyFlushChars();
@ -1993,7 +1993,7 @@ static void SoundDisplay(void)
clearkeys(); clearkeys();
} }
else else
showframe(1); videoShowFrame(1);
} }
overridepm16y = -1; overridepm16y = -1;
@ -2417,16 +2417,16 @@ int32_t AskIfSure(const char *text)
if (in3dmode()) if (in3dmode())
{ {
begindrawing(); //{{{ videoBeginDrawing(); //{{{
printext256(0,0,whitecol,0,text?text:"Are you sure you want to proceed?",0); printext256(0,0,whitecol,0,text?text:"Are you sure you want to proceed?",0);
enddrawing(); //}}} videoEndDrawing(); //}}}
} }
else else
{ {
_printmessage16("%s", text?text:"Are you sure you want to proceed?"); _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) 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 { \ #define TMPERRMSG_PRINT(Msg, ...) do { \
Bsprintf(tilesel_errmsg, Msg, ## __VA_ARGS__); \ Bsprintf(tilesel_errmsg, Msg, ## __VA_ARGS__); \
TMPERRMSG_SHOW(1); \ TMPERRMSG_SHOW(1); \
showframe(1); \ videoShowFrame(1); \
tilesel_showerr = 1; \ tilesel_showerr = 1; \
} while (0) } while (0)
@ -3278,7 +3278,7 @@ static int32_t OnSelectTile(int32_t tileNum)
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
#endif #endif
clearview(-1); videoClearViewableArea(-1);
// //
// Await appropriate selection keypress. // Await appropriate selection keypress.
@ -3312,7 +3312,7 @@ static int32_t OnSelectTile(int32_t tileNum)
} }
} }
} }
showframe(1); videoShowFrame(1);
ch = keyGetChar(); ch = keyGetChar();
@ -3327,7 +3327,7 @@ static int32_t OnSelectTile(int32_t tileNum)
} }
} }
showframe(1); videoShowFrame(1);
clearkeys(); clearkeys();
@ -3515,9 +3515,9 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i
glDrawBuffer(GL_FRONT_AND_BACK); glDrawBuffer(GL_FRONT_AND_BACK);
} }
#endif #endif
clearview(-1); videoClearViewableArea(-1);
begindrawing(); videoBeginDrawing();
restart: restart:
for (YTile = 0-(offset>0); YTile < nYTiles+(offset<0)+1; YTile++) for (YTile = 0-(offset>0); YTile < nYTiles+(offset<0)+1; YTile++)
@ -3585,8 +3585,8 @@ restart:
} }
if (k) if (k)
{ {
enddrawing(); videoEndDrawing();
showframe(1); videoShowFrame(1);
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST && lazyselector) if (getrendermode() >= REND_POLYMOST && lazyselector)
glDrawBuffer(GL_BACK); glDrawBuffer(GL_BACK);
@ -3594,9 +3594,9 @@ restart:
return 1; return 1;
} }
enddrawing(); videoEndDrawing();
showframe(1); videoShowFrame(1);
begindrawing(); videoBeginDrawing();
} }
} }
} }
@ -3607,17 +3607,17 @@ restart:
{ {
if (runi==0) if (runi==0)
{ {
enddrawing(); videoEndDrawing();
showframe(1); videoShowFrame(1);
begindrawing(); videoBeginDrawing();
runi = 1; runi = 1;
goto restart; goto restart;
} }
} }
enddrawing(); videoEndDrawing();
showframe(1); videoShowFrame(1);
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST && lazyselector) 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 scale = (int32_t)(65536.0/scalediv);
const int32_t oviewingrange=viewingrange, oyxaspect=yxaspect; 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 // +1024: prevents rotatesprite from setting aspect itself
rotatesprite_fs((x1+13)<<16,(y+11)<<16,scale,0, picnum,shade,pal, 2+1024); 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); x = (int32_t)(x * xdimgame/320.0);
y = (int32_t)(y * ydimgame/200.0); y = (int32_t)(y * ydimgame/200.0);
begindrawing(); videoBeginDrawing();
printext256(x+2,y+2,0,-1,title,small); printext256(x+2,y+2,0,-1,title,small);
printext256(x,y,editorcolors[14],-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, "Hit", hitag, 0, 6);
tileinfo_doprint(x, y, buf, (flags&2)?"Ex*":"Ext", extra, statnum, 7); tileinfo_doprint(x, y, buf, (flags&2)?"Ex*":"Ext", extra, statnum, 7);
enddrawing(); videoEndDrawing();
} }
//int32_t snap=0; //int32_t snap=0;
//int32_t saveval1,saveval2,saveval3; //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)); Bsprintf(buffer,"%s",(char *)func((int32_t)danum));
printmessage256(0, 9, buffer); printmessage256(0, 9, buffer);
} }
showframe(1); videoShowFrame(1);
if (getnumber_internal1(ch, &danum, maxnumber, sign) || if (getnumber_internal1(ch, &danum, maxnumber, sign) ||
getnumber_autocomplete(namestart, ch, &danum, flags)) getnumber_autocomplete(namestart, ch, &danum, flags))
@ -3979,7 +3979,7 @@ ENDFOR1:
Bsprintf(buffer, "Hgap=%d, Vgap=%d, SPCgap=%d, Shd=%d, Pal=%d", Bsprintf(buffer, "Hgap=%d, Vgap=%d, SPCgap=%d, Shd=%d, Pal=%d",
hgap, vgap, spcgap[alphidx], TrackerCast(sprite[linebegspr].shade), TrackerCast(sprite[linebegspr].pal)); hgap, vgap, spcgap[alphidx], TrackerCast(sprite[linebegspr].shade), TrackerCast(sprite[linebegspr].pal));
printmessage256(0, 9, buffer); printmessage256(0, 9, buffer);
showframe(1); videoShowFrame(1);
// --- // ---
sp = &sprite[curspr]; sp = &sprite[curspr];
@ -4447,14 +4447,14 @@ static void Keys3d(void)
Bsprintf(lines[num++], "^%d%s", editorcolors[10], getmessage); Bsprintf(lines[num++], "^%d%s", editorcolors[10], getmessage);
} }
begindrawing(); videoBeginDrawing();
for (i=0; i<num; i++) for (i=0; i<num; i++)
{ {
printext256(x+2, y+2, 0, -1, lines[i], xdimgame<=640); printext256(x+2, y+2, 0, -1, lines[i], xdimgame<=640);
printext256(x, y, whitecol, -1, lines[i], xdimgame<=640); printext256(x, y, whitecol, -1, lines[i], xdimgame<=640);
y += ydimgame>>6; y += ydimgame>>6;
} }
enddrawing(); videoEndDrawing();
} }
VM_OnEvent(EVENT_PREKEYS3D, -1); VM_OnEvent(EVENT_PREKEYS3D, -1);
@ -5438,7 +5438,7 @@ static void Keys3d(void)
static int32_t LastSec = 0; static int32_t LastSec = 0;
static int32_t LastMS = 0; static int32_t LastMS = 0;
int32_t ms = getticks(); int32_t ms = timerGetTicks();
int32_t howlong = ms - LastMS; int32_t howlong = ms - LastMS;
if (howlong >= 0) if (howlong >= 0)
@ -5537,10 +5537,10 @@ static void Keys3d(void)
int32_t small = !(xdimgame > 640); int32_t small = !(xdimgame > 640);
for (i=0; i<MAXHELP3D; i++) for (i=0; i<MAXHELP3D; i++)
{ {
begindrawing(); videoBeginDrawing();
printext256(2, 8+(i*(8+!small))+2, 0, -1, Help3d[i], small); printext256(2, 8+(i*(8+!small))+2, 0, -1, Help3d[i], small);
printext256(0, 8+(i*(8+!small)), whitecol, -1, Help3d[i], small); printext256(0, 8+(i*(8+!small)), whitecol, -1, Help3d[i], small);
enddrawing(); videoEndDrawing();
switch (i) switch (i)
{ {
@ -5567,7 +5567,7 @@ static void Keys3d(void)
break; break;
} }
begindrawing(); videoBeginDrawing();
if (!Bstrcmp(tempbuf,"0")) if (!Bstrcmp(tempbuf,"0"))
Bsprintf(tempbuf,"OFF"); Bsprintf(tempbuf,"OFF");
else if (!Bstrcmp(tempbuf,"1")) else if (!Bstrcmp(tempbuf,"1"))
@ -5577,7 +5577,7 @@ static void Keys3d(void)
printext256((20+(!small * 20))*8+2, 8+(i*(8+!small))+2, 0, -1, tempbuf, small); printext256((20+(!small * 20))*8+2, 8+(i*(8+!small))+2, 0, -1, tempbuf, small);
printext256((20+(!small * 20))*8, 8+(i*(8+!small)), whitecol, -1, tempbuf, small); printext256((20+(!small * 20))*8, 8+(i*(8+!small)), whitecol, -1, tempbuf, small);
enddrawing(); videoEndDrawing();
} }
} }
@ -6326,12 +6326,12 @@ static void Keys3d(void)
static int16_t brightness = -1; static int16_t brightness = -1;
if (brightness==-1) if (brightness==-1)
brightness = ((int16_t)((vid_gamma-1.0)*10.0))&15; brightness = ((int16_t)((g_videoGamma-1.0)*10.0))&15;
brightness = brightness + (1-2*eitherSHIFT); brightness = brightness + (1-2*eitherSHIFT);
brightness &= 15; brightness &= 15;
vid_gamma = 1.0 + ((float)brightness / 10.0); g_videoGamma = 1.0 + ((float)brightness / 10.0);
setbrightness(brightness, 0, 0); setbrightness(brightness, 0, 0);
message("Brightness: %d/16", brightness+1); message("Brightness: %d/16", brightness+1);
} }
@ -10276,13 +10276,13 @@ void ExtPreCheckKeys(void) // just before drawrooms
} }
if (floor_over_floor) SE40Code(pos.x,pos.y,pos.z,ang,horiz); if (floor_over_floor) SE40Code(pos.x,pos.y,pos.z,ang,horiz);
if (purpleon) clearview(255); if (purpleon) videoClearViewableArea(255);
return; return;
} }
begindrawing(); //{{{ videoBeginDrawing(); //{{{
// if (cursectornum >= 0) // if (cursectornum >= 0)
// fillsector(cursectornum, 31); // fillsector(cursectornum, 31);
@ -10409,10 +10409,10 @@ void ExtPreCheckKeys(void) // just before drawrooms
continue; continue;
const int32_t oviewingrange=viewingrange, oyxaspect=yxaspect; 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, rotatesprite(xp1<<16,yp1<<16,zoom<<5,daang,picnum,
shade,sprite[i].pal,flags|1024,0,0,xdim-1,ydim16-1); 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) void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr)
@ -10951,7 +10951,7 @@ void ExtCheckKeys(void)
void faketimerhandler(void) void faketimerhandler(void)
{ {
sampletimer(); timerUpdate();
} }
void SetGamePalette(int32_t palid) void SetGamePalette(int32_t palid)
@ -11272,13 +11272,13 @@ static void EditSectorData(int16_t sectnum)
if (med_editval) if (med_editval)
med_editval = 0; med_editval = 0;
showframe(1); videoShowFrame(1);
} }
med_printcurline(xpos, ypos, row, 0); med_printcurline(xpos, ypos, row, 0);
// printmessage16(""); // printmessage16("");
showframe(1); videoShowFrame(1);
keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ESC] = 0;
} }
@ -11374,13 +11374,13 @@ static void EditWallData(int16_t wallnum)
//// printmessage16(""); //// printmessage16("");
} }
showframe(1); videoShowFrame(1);
} }
med_printcurline(xpos, ypos, row, 0); med_printcurline(xpos, ypos, row, 0);
// printmessage16(""); // printmessage16("");
showframe(1); videoShowFrame(1);
keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ESC] = 0;
} }
@ -11613,12 +11613,12 @@ static void EditSpriteData(int16_t spritenum)
if (med_editval) if (med_editval)
med_editval = 0; med_editval = 0;
showframe(1); videoShowFrame(1);
} }
med_printcurline(xpos, ypos, row, 0); med_printcurline(xpos, ypos, row, 0);
// printmessage16(""); // printmessage16("");
showframe(1); videoShowFrame(1);
keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ESC] = 0;
} }
@ -11777,12 +11777,12 @@ static void GenericSpriteSearch(void)
printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[1],disptext,0); 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); printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0);
printmessage16("Search sprite"); printmessage16("Search sprite");
showframe(1); videoShowFrame(1);
keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ESC] = 0;
} }

View file

@ -399,14 +399,14 @@ static void Demo_StopProfiling(void)
static void Demo_GToc(double t) static void Demo_GToc(double t)
{ {
g_prof.numtics++; g_prof.numtics++;
g_prof.totalgamems += gethiticks()-t; g_prof.totalgamems += timerGetHiTicks()-t;
} }
static void Demo_RToc(double t1, double t2) static void Demo_RToc(double t1, double t2)
{ {
g_prof.numframes++; g_prof.numframes++;
g_prof.totalroomsdrawms += t2-t1; g_prof.totalroomsdrawms += t2-t1;
g_prof.totalrestdrawms += gethiticks()-t2; g_prof.totalrestdrawms += timerGetHiTicks()-t2;
} }
static void Demo_DisplayProfStatus(void) static void Demo_DisplayProfStatus(void)
@ -420,11 +420,11 @@ static void Demo_DisplayProfStatus(void)
return; return;
lastpercent = percent; lastpercent = percent;
clearallviews(0); videoClearScreen(0);
Bsnprintf(buf, sizeof(buf), "timing... %d/%d game tics (%d %%)", Bsnprintf(buf, sizeof(buf), "timing... %d/%d game tics (%d %%)",
g_demo_cnt, g_demo_totalCnt, percent); g_demo_cnt, g_demo_totalCnt, percent);
gametext_center(60, buf); gametext_center(60, buf);
nextpage(); videoNextPage();
} }
static void Demo_SetupProfile(void) static void Demo_SetupProfile(void)
@ -436,7 +436,7 @@ static void Demo_SetupProfile(void)
Bmemset(&g_prof, 0, sizeof(g_prof)); Bmemset(&g_prof, 0, sizeof(g_prof));
g_prof.starthiticks = gethiticks(); g_prof.starthiticks = timerGetHiTicks();
} }
static void Demo_FinishProfile(void) static void Demo_FinishProfile(void)
@ -468,7 +468,7 @@ static void Demo_FinishProfile(void)
{ {
double totalprofms = gms+dms1+dms2; double totalprofms = gms+dms1+dms2;
double totalms = gethiticks()-g_prof.starthiticks; double totalms = timerGetHiTicks()-g_prof.starthiticks;
if (totalprofms != 0) if (totalprofms != 0)
OSD_Printf("== demo %d: non-profiled time overhead: %.02f %%\n", OSD_Printf("== demo %d: non-profiled time overhead: %.02f %%\n",
dn, 100.0*totalms/totalprofms - 100.0); dn, 100.0*totalms/totalprofms - 100.0);
@ -532,7 +532,7 @@ RECHECK:
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
G_DrawBackground(); G_DrawBackground();
M_DisplayMenus(); M_DisplayMenus();
nextpage(); videoNextPage();
fadepal(0,0,0, 252,0,-28); fadepal(0,0,0, 252,0,-28);
ud.reccnt = 0; ud.reccnt = 0;
} }
@ -738,7 +738,7 @@ nextdemo_nomenu:
if (Demo_IsProfiling()) if (Demo_IsProfiling())
{ {
double t = gethiticks(); double t = timerGetHiTicks();
G_DoMoveThings(); G_DoMoveThings();
Demo_GToc(t); Demo_GToc(t);
} }
@ -813,7 +813,7 @@ nextdemo_nomenu:
for (i=0; i<num; i++) for (i=0; i<num; i++)
{ {
double t1 = gethiticks(), t2; double t1 = timerGetHiTicks(), t2;
// initprintf("t=%d, o=%d, t-o = %d\n", totalclock, // initprintf("t=%d, o=%d, t-o = %d\n", totalclock,
// ototalclock, totalclock-ototalclock); // ototalclock, totalclock-ototalclock);
@ -826,7 +826,7 @@ nextdemo_nomenu:
G_DrawRooms(screenpeek, j); G_DrawRooms(screenpeek, j);
t2 = gethiticks(); t2 = timerGetHiTicks();
G_DisplayRest(j); G_DisplayRest(j);

View file

@ -188,10 +188,10 @@ void G_HandleSpecialKeys(void)
if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && KB_KeyPressed(sc_Enter)) if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
{ {
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))
{ {
OSD_Printf(OSD_ERROR "Failed setting fullscreen video mode.\n"); OSD_Printf(OSD_ERROR "Failed setting fullscreen video mode.\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("Failed to recover from failure to set fullscreen video mode.\n"); G_GameExit("Failed to recover from failure to set fullscreen video mode.\n");
} }
else ud.config.ScreenMode = !ud.config.ScreenMode; else ud.config.ScreenMode = !ud.config.ScreenMode;
@ -282,7 +282,7 @@ void G_GameExit(const char *msg)
g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ') g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ')
{ {
G_BonusScreen(1); 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 // shareware and TEN screens
@ -324,10 +324,10 @@ static void M32_drawdebug(void)
if (m32_numdebuglines>0) if (m32_numdebuglines>0)
{ {
begindrawing(); videoBeginDrawing();
for (i=0; i<m32_numdebuglines && y<ydim-8; i++, y+=8) for (i=0; i<m32_numdebuglines && y<ydim-8; i++, y+=8)
printext256(x,y,col,0,m32_debugstr[i],xdim>640?0:1); printext256(x,y,col,0,m32_debugstr[i],xdim>640?0:1);
enddrawing(); videoEndDrawing();
} }
m32_numdebuglines=0; m32_numdebuglines=0;
} }
@ -669,9 +669,9 @@ static void G_ReadGLFrame(void)
return; return;
} }
begindrawing(); videoBeginDrawing();
glReadPixels(0, 0, xdim, ydim, GL_RGBA, GL_UNSIGNED_BYTE, frame); glReadPixels(0, 0, xdim, ydim, GL_RGBA, GL_UNSIGNED_BYTE, frame);
enddrawing(); videoEndDrawing();
for (y = 0; y < 200; y++) for (y = 0; y < 200; y++)
{ {
@ -716,7 +716,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (r_usenewaspect) if (r_usenewaspect)
{ {
newaspect_enable = 1; newaspect_enable = 1;
setaspect_new(); videoSetCorrectedAspect();
} }
if (ud.pause_on || pPlayer->on_crane > -1) if (ud.pause_on || pPlayer->on_crane > -1)
@ -779,13 +779,13 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
))); )));
if (!r_usenewaspect) if (!r_usenewaspect)
setaspect(vr, yxaspect); videoSetAspect(vr, yxaspect);
else else
{ {
viewingRange = vr; viewingRange = vr;
yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5); yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5);
setaspect(mulscale16(viewingRange,viewingrange), yxaspect); videoSetAspect(mulscale16(viewingRange,viewingrange), yxaspect);
} }
if (g_screenCapture) 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]); allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]);
if (getrendermode() == REND_CLASSIC) if (getrendermode() == REND_CLASSIC)
setviewtotile(TILE_SAVESHOT, 200, 320); videoSetTarget(TILE_SAVESHOT, 200, 320);
} }
else if (screenTilting) else if (screenTilting)
{ {
@ -854,7 +854,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (waloff[TILE_TILT] == 0) if (waloff[TILE_TILT] == 0)
allocache(&waloff[TILE_TILT], maxTiltSize, &walock[TILE_TILT]); allocache(&waloff[TILE_TILT], maxTiltSize, &walock[TILE_TILT]);
setviewtotile(TILE_TILT, viewtilexsiz, viewtileysiz); videoSetTarget(TILE_TILT, viewtilexsiz, viewtileysiz);
if ((tang&1023) == 512) 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; vRange = sintable[vRange + 512] * 8 + sintable[vRange] * 5;
// setaspect(i>>1, yxaspect); // setaspect(i>>1, yxaspect);
setaspect(mulscale16(oviewingrange, vRange >> 1), yxaspect); videoSetAspect(mulscale16(oviewingrange, vRange >> 1), yxaspect);
viewingRange = vRange >> 1; viewingRange = vRange >> 1;
yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5); 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) if (getrendermode() == REND_CLASSIC)
{ {
setviewback(); videoRestoreTarget();
// walock[TILE_SAVESHOT] = 1; // walock[TILE_SAVESHOT] = 1;
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
@ -1067,7 +1067,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (screenTilting == 2) // tang == 1024 if (screenTilting == 2) // tang == 1024
{ {
begindrawing(); videoBeginDrawing();
{ {
const int32_t height = windowxy2.y-windowxy1.y+1; const int32_t height = windowxy2.y-windowxy1.y+1;
const int32_t width = windowxy2.x-windowxy1.x+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++) for (x=0; x<(width>>1); x++)
swapchar(&f[x], &f[width-1-x]); swapchar(&f[x], &f[width-1-x]);
} }
enddrawing(); videoEndDrawing();
} }
else else
{ {
setviewback(); videoRestoreTarget();
picanm[TILE_TILT].xofs = picanm[TILE_TILT].yofs = 0; picanm[TILE_TILT].xofs = picanm[TILE_TILT].yofs = 0;
int tiltZoom = (tang&511); int tiltZoom = (tang&511);
@ -1111,7 +1111,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
g_halveScreenArea = 0; g_halveScreenArea = 0;
G_UpdateScreenArea(); G_UpdateScreenArea();
begindrawing(); videoBeginDrawing();
{ {
uint8_t *const f = (uint8_t *)frameplace; uint8_t *const f = (uint8_t *)frameplace;
const int32_t x1=g_halfScreen.x1, y1=g_halfScreen.y1; 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)); 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) if (r_usenewaspect)
{ {
newaspect_enable = 0; newaspect_enable = 0;
setaspect(viewingRange, yxAspect); videoSetAspect(viewingRange, yxAspect);
} }
VM_OnEvent(EVENT_DISPLAYROOMSEND, g_player[screenpeek].ps->i, screenpeek); VM_OnEvent(EVENT_DISPLAYROOMSEND, g_player[screenpeek].ps->i, screenpeek);
@ -4473,8 +4473,8 @@ void G_InitTimer(int32_t ticspersec)
{ {
if (g_timerTicsPerSecond != ticspersec) if (g_timerTicsPerSecond != ticspersec)
{ {
uninittimer(); timerUninit();
inittimer(ticspersec); timerInit(ticspersec);
g_timerTicsPerSecond = ticspersec; g_timerTicsPerSecond = ticspersec;
} }
} }
@ -5841,7 +5841,7 @@ static void G_Startup(void)
set_memerr_handler(&G_HandleMemErr); set_memerr_handler(&G_HandleMemErr);
inittimer(TICRATE); timerInit(TICRATE);
initcrc32table(); initcrc32table();
@ -6172,10 +6172,10 @@ int G_FPSLimit(void)
if (frameWaiting) if (frameWaiting)
{ {
frameWaiting--; frameWaiting--;
nextpage(); videoNextPage();
} }
uint64_t const frameTicks = getu64ticks(); uint64_t const frameTicks = timerGetTicksU64();
if (!r_maxfps || frameTicks >= nextPageTicks) if (!r_maxfps || frameTicks >= nextPageTicks)
{ {
@ -6444,10 +6444,10 @@ int app_main(int argc, char const * const * argv)
Anim_Init(); Anim_Init();
const char *defsfile = G_DefFile(); const char *defsfile = G_DefFile();
uint32_t stime = getticks(); uint32_t stime = timerGetTicks();
if (!loaddefinitionsfile(defsfile)) if (!loaddefinitionsfile(defsfile))
{ {
uint32_t etime = getticks(); uint32_t etime = timerGetTicks();
initprintf("Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime-stime); initprintf("Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime-stime);
} }
loaddefinitions_game(defsfile, FALSE); loaddefinitions_game(defsfile, FALSE);
@ -6548,7 +6548,7 @@ int app_main(int argc, char const * const * argv)
if (g_networkMode != NET_DEDICATED_SERVER) 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[] = { vec2_t const res[] = {
{ ud.config.ScreenWidth, ud.config.ScreenHeight }, { 800, 600 }, { 640, 480 }, { 320, 240 }, { 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 resIdx = 0;
int bppIdx = 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, initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n", res[resIdx].x, res[resIdx].y,
bpp[bppIdx]); bpp[bppIdx]);
@ -6711,7 +6711,7 @@ MAIN_LOOP_RESTART:
quitevent = 0; quitevent = 0;
} }
sampletimer(); timerUpdate();
Net_GetPackets(); Net_GetPackets();
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo // 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 do
{ {
sampletimer(); timerUpdate();
if (ready2send == 0) break; if (ready2send == 0) break;
@ -6783,7 +6783,7 @@ MAIN_LOOP_RESTART:
#endif #endif
} }
sampletimer(); timerUpdate();
if (totalclock - moveClock >= TICSPERFRAME) if (totalclock - moveClock >= TICSPERFRAME)
{ {
@ -6830,7 +6830,7 @@ MAIN_LOOP_RESTART:
if (g_saveRequested) if (g_saveRequested)
{ {
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
nextpage(); videoNextPage();
g_screenCapture = 1; g_screenCapture = 1;
G_DrawRooms(myconnectindex, 65536); G_DrawRooms(myconnectindex, 65536);

View file

@ -6627,7 +6627,7 @@ void C_Compile(const char *fileName)
g_logFlushWindow = 0; g_logFlushWindow = 0;
uint32_t const startcompiletime = getticks(); uint32_t const startcompiletime = timerGetTicks();
char * mptr = (char *)Xmalloc(kFileLen+1); char * mptr = (char *)Xmalloc(kFileLen+1);
mptr[kFileLen] = 0; mptr[kFileLen] = 0;
@ -6701,7 +6701,7 @@ void C_Compile(const char *fileName)
C_SetScriptSize(g_scriptPtr-apScript+8); 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)); (unsigned long)(g_scriptPtr-apScript), C_ScriptVersionString(g_scriptVersion));
for (unsigned i=0; i < ARRAY_SIZE(tables_free); i++) for (unsigned i=0; i < ARRAY_SIZE(tables_free); i++)

View file

@ -142,12 +142,12 @@ intptr_t apScriptEvents[MAXEVENTS];
#ifdef LUNATIC #ifdef LUNATIC
static FORCE_INLINE int32_t VM_EventCommon_(int eventNum, int spriteNum, int playerNum, int playerDist, int32_t returnValue) 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); 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 // NOTE: the run times are those of the called event plus any events
// called by it, *not* "self" time. // called by it, *not* "self" time.
g_eventTotalMs[eventNum] += gethiticks()-t; g_eventTotalMs[eventNum] += timerGetHiTicks()-t;
g_eventCalls[eventNum]++; g_eventCalls[eventNum]++;
if (ret == 1) 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, static FORCE_INLINE int32_t VM_EventCommon_(int const eventNum, int const spriteNum, int const playerNum,
int const playerDist, int32_t returnValue) 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 }; 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; aGameVars[g_returnVarID].global = backupReturnVar;
g_eventTotalMs[eventNum] += gethiticks()-t; g_eventTotalMs[eventNum] += timerGetHiTicks()-t;
g_eventCalls[eventNum]++; g_eventCalls[eventNum]++;
return returnValue; 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) if (offscreenrendering)
{ {
clearview(0); videoClearViewableArea(0);
return; 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; int const onewaspect = newaspect_enable;
newaspect_enable = r_usenewaspect; newaspect_enable = r_usenewaspect;
setaspect_new_use_dimen = 1; setaspect_new_use_dimen = 1;
setview(x1,y1,x2,y2); videoSetViewableArea(x1,y1,x2,y2);
setaspect_new_use_dimen = 0; setaspect_new_use_dimen = 0;
newaspect_enable = onewaspect; newaspect_enable = onewaspect;
@ -1270,7 +1270,7 @@ void Screen_Play(void)
if (!G_FPSLimit()) if (!G_FPSLimit())
continue; continue;
clearallviews(0); videoClearScreen(0);
if (VM_OnEventWithReturn(EVENT_SCREEN, g_player[screenpeek].ps->i, screenpeek, I_CheckAllInput())) if (VM_OnEventWithReturn(EVENT_SCREEN, g_player[screenpeek].ps->i, screenpeek, I_CheckAllInput()))
running = 0; running = 0;
@ -1975,7 +1975,7 @@ skip_check:
insptr++; insptr++;
{ {
int const xRange = Gv_GetVarX(*insptr++); int const xRange = Gv_GetVarX(*insptr++);
setaspect(xRange, Gv_GetVarX(*insptr++)); videoSetAspect(xRange, Gv_GetVarX(*insptr++));
break; break;
} }
@ -5815,7 +5815,7 @@ finish_qsprintf:
case CON_GETTICKS: case CON_GETTICKS:
insptr++; insptr++;
Gv_SetVarX(*insptr++, getticks()); Gv_SetVarX(*insptr++, timerGetTicks());
continue; continue;
case CON_GETCURRADDRESS: case CON_GETCURRADDRESS:
@ -5947,24 +5947,24 @@ void A_Execute(int spriteNum, int playerNum, int playerDist)
if (L_IsInitialized(&g_ElState) && El_HaveActor(picnum)) if (L_IsInitialized(&g_ElState) && El_HaveActor(picnum))
{ {
double t = gethiticks(); double t = timerGetHiTicks();
killit = (El_CallActor(&g_ElState, picnum, spriteNum, playerNum, playerDist)==1); killit = (El_CallActor(&g_ElState, picnum, spriteNum, playerNum, playerDist)==1);
t = gethiticks()-t; t = timerGetHiTicks()-t;
g_actorTotalMs[picnum] += t; g_actorTotalMs[picnum] += t;
g_actorMinMs[picnum] = min(g_actorMinMs[picnum], t); g_actorMinMs[picnum] = min(g_actorMinMs[picnum], t);
g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], t); g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], t);
g_actorCalls[picnum]++; g_actorCalls[picnum]++;
} }
#else #else
double t = gethiticks(); double t = timerGetHiTicks();
int const picnum = vm.pSprite->picnum; int const picnum = vm.pSprite->picnum;
insptr = 4 + (g_tile[vm.pSprite->picnum].execPtr); insptr = 4 + (g_tile[vm.pSprite->picnum].execPtr);
VM_Execute(1); VM_Execute(1);
insptr = NULL; insptr = NULL;
t = gethiticks()-t; t = timerGetHiTicks()-t;
g_actorTotalMs[picnum] += t; g_actorTotalMs[picnum] += t;
g_actorMinMs[picnum] = min(g_actorMinMs[picnum], t); g_actorMinMs[picnum] = min(g_actorMinMs[picnum], t);
g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], t); g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], t);

View file

@ -65,11 +65,11 @@ const char *YUPDOWNWALL[2] = {"UPWALL","DOWNWALL"};
void drawgradient(void) void drawgradient(void)
{ {
int32_t i, col = editorcolors[25]; int32_t i, col = editorcolors[25];
begindrawing(); videoBeginDrawing();
for (i=ydim-STATUS2DSIZ+16; i<ydim && col>0; i++,col--) for (i=ydim-STATUS2DSIZ+16; i<ydim && col>0; i++,col--)
CLEARLINES2D(i, 1, (col<<24)|(col<<16)|(col<<8)|col); CLEARLINES2D(i, 1, (col<<24)|(col<<16)|(col<<8)|col);
CLEARLINES2D(i, ydim-i, 0); CLEARLINES2D(i, ydim-i, 0);
enddrawing(); videoEndDrawing();
} }
static void message_common1(const char *tmpstr) static void message_common1(const char *tmpstr)
@ -1655,11 +1655,11 @@ static void M_EnterMainLoop(StatusBarMenu *m)
} }
#endif #endif
printext16(xpos, ypos+row*MENU_Y_SPACING, MENU_FG_COLOR, MENU_BG_COLOR_SEL, disptext, 0); 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); printext16(xpos, ypos+row*MENU_Y_SPACING, MENU_FG_COLOR, MENU_BG_COLOR, disptext, 0);
showframe(1); videoShowFrame(1);
keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ESC] = 0;
} }

View file

@ -3739,7 +3739,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
// flushlogwindow = 0; // flushlogwindow = 0;
startcompiletime = getticks(); startcompiletime = timerGetTicks();
if (isfilename) if (isfilename)
{ {
@ -3809,7 +3809,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
// C_SetScriptSize(g_scriptPtr-script+8); // C_SetScriptSize(g_scriptPtr-script+8);
if (isfilename) if (isfilename)
{ {
int32_t ct = getticks() - startcompiletime; int32_t ct = timerGetTicks() - startcompiletime;
if (ct > 50) if (ct > 50)
initprintf("Script compiled in %dms\n", ct); initprintf("Script compiled in %dms\n", ct);
C_CompilationInfo(); C_CompilationInfo();

View file

@ -2887,7 +2887,7 @@ dodefault:
insptr++; insptr++;
{ {
int32_t j=*insptr++; int32_t j=*insptr++;
Gv_SetVarX(j, getticks()); Gv_SetVarX(j, timerGetTicks());
} }
continue; continue;
@ -2899,7 +2899,7 @@ dodefault:
if (daxrange > (1<<20)) daxrange = (1<<20); if (daxrange > (1<<20)) daxrange = (1<<20);
if (dayxaspect < (1<<12)) dayxaspect = (1<<12); if (dayxaspect < (1<<12)) dayxaspect = (1<<12);
if (dayxaspect > (1<<20)) dayxaspect = (1<<20); if (dayxaspect > (1<<20)) dayxaspect = (1<<20);
setaspect(daxrange, dayxaspect); videoSetAspect(daxrange, dayxaspect);
continue; continue;
} }

View file

@ -1097,14 +1097,14 @@ static MenuEntry_t *MEL_RENDERERSETUP_POLYMER [] = {
#endif #endif
#ifdef EDUKE32_ANDROID_MENU #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 #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 #endif
static MenuEntry_t ME_COLCORR_GAMMA = MAKE_MENUENTRY( "Gamma:", &MF_Redfont, &MEF_ColorCorrect, &MEO_COLCORR_GAMMA, RangeFloat ); 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 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_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 ); static MenuEntry_t ME_COLCORR_RESET = MAKE_MENUENTRY( "Reset To Defaults", &MF_Redfont, &MEF_ColorCorrect, &MEO_NULL, Link );
#ifdef EDUKE32_ANDROID_MENU #ifdef EDUKE32_ANDROID_MENU
@ -3041,9 +3041,9 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
int32_t nrend = newrendermode; int32_t nrend = newrendermode;
int32_t nvsync = newvsync; 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); setrendermode(prend);
G_GameExit("Failed restoring old video mode."); G_GameExit("Failed restoring old video mode.");
@ -3051,7 +3051,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
else else
{ {
onvideomodechange(p.bppmax > 8); onvideomodechange(p.bppmax > 8);
vsync = setvsync(pvsync); vsync = videoSetVsync(pvsync);
} }
} }
else onvideomodechange(n.bppmax > 8); else onvideomodechange(n.bppmax > 8);
@ -3059,7 +3059,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
g_restorePalette = -1; g_restorePalette = -1;
G_UpdateScreenArea(); G_UpdateScreenArea();
setrendermode(nrend); setrendermode(nrend);
vsync = setvsync(nvsync); vsync = videoSetVsync(nvsync);
ud.config.ScreenMode = fullscreen; ud.config.ScreenMode = fullscreen;
ud.config.ScreenWidth = xdim; ud.config.ScreenWidth = xdim;
ud.config.ScreenHeight = ydim; ud.config.ScreenHeight = ydim;
@ -3089,9 +3089,9 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
} }
else if (entry == &ME_COLCORR_RESET) else if (entry == &ME_COLCORR_RESET)
{ {
vid_gamma = DEFAULT_GAMMA; g_videoGamma = DEFAULT_GAMMA;
vid_contrast = DEFAULT_CONTRAST; g_videoContrast = DEFAULT_CONTRAST;
vid_brightness = DEFAULT_BRIGHTNESS; g_videoBrightness = DEFAULT_BRIGHTNESS;
ud.brightness = 0; ud.brightness = 0;
r_ambientlight = r_ambientlightrecip = 1.f; r_ambientlight = r_ambientlightrecip = 1.f;
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); 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) else if (entry == &ME_VIDEOSETUP_FRAMELIMIT)
{ {
g_frameDelay = newOption ? (getu64tickspersec()/newOption) : 0; g_frameDelay = newOption ? (timerGetFreqU64()/newOption) : 0;
} }
switch (g_currentMenu) switch (g_currentMenu)
@ -3289,8 +3289,8 @@ static void Menu_EntryOptionDidModify(MenuEntry_t *entry)
if (domodechange) if (domodechange)
{ {
resetvideomode(); videoResetMode();
if (setgamemode(fullscreen, xdim, ydim, bpp)) if (videoSetGameMode(fullscreen, xdim, ydim, bpp))
OSD_Printf("restartvid: Reset failed...\n"); OSD_Printf("restartvid: Reset failed...\n");
onvideomodechange(ud.config.ScreenBPP>8); onvideomodechange(ud.config.ScreenBPP>8);
G_RefreshLights(); G_RefreshLights();
@ -6964,7 +6964,7 @@ void M_DisplayMenus(void)
int32_t alpha; int32_t alpha;
if (KXDWN) if (KXDWN)
{ {
setaspect(viewingrange, 65536); videoSetAspect(viewingrange, 65536);
cursorpos.x = scale(cursorpos.x - (320<<15), ydim << 2, xdim * 3) + (320<<15); 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); cursorpos.y = scale(cursorpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15);
z = scale(32768, ydim << 2, xdim * 3); 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); rotatesprite_fs_alpha(cursorpos.x, cursorpos.y, z, 0, a, 0, p, o, alpha);
if (KXDWN) if (KXDWN)
setaspect(viewingrange, oyxaspect); videoSetAspect(viewingrange, oyxaspect);
} }
} }
else else

View file

@ -411,7 +411,7 @@ void Net_ReceiveDisconnect(ENetEvent *event)
void Net_GetPackets(void) void Net_GetPackets(void)
{ {
sampletimer(); timerUpdate();
MUSIC_Update(); MUSIC_Update();
S_Update(); S_Update();

View file

@ -419,8 +419,8 @@ static int32_t osdcmd_music(osdfuncparm_t const * const parm)
int32_t osdcmd_restartvid(osdfuncparm_t const * const UNUSED(parm)) int32_t osdcmd_restartvid(osdfuncparm_t const * const UNUSED(parm))
{ {
UNREFERENCED_CONST_PARAMETER(parm); UNREFERENCED_CONST_PARAMETER(parm);
resetvideomode(); videoResetMode();
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("restartvid: Reset failed...\n"); G_GameExit("restartvid: Reset failed...\n");
onvideomodechange(ud.config.ScreenBPP>8); onvideomodechange(ud.config.ScreenBPP>8);
G_UpdateScreenArea(); G_UpdateScreenArea();
@ -471,10 +471,10 @@ static int32_t osdcmd_vidmode(osdfuncparm_t const * const parm)
break; break;
} }
if (setgamemode(newfs,newwidth,newheight,newbpp)) if (videoSetGameMode(newfs,newwidth,newheight,newbpp))
{ {
initprintf("vidmode: Mode change failed!\n"); 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"); G_GameExit("vidmode: Reset failed!\n");
} }
ud.config.ScreenBPP = newbpp; 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")) else if (!Bstrcasecmp(parm->name, "r_maxfps"))
{ {
if (r_maxfps != 0) r_maxfps = clamp(r_maxfps, 30, 1000); 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")) 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 }, { "touch_invert", "invert look up/down touch input", (void *) &droidinput.invertLook, CVAR_INT, 0, 1 },
#endif #endif
{ "vid_gamma","adjusts gamma component of gamma ramp",(void *)&vid_gamma, 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 *)&vid_contrast, 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 *)&vid_brightness, 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 }, { "wchoice","sets weapon autoselection order", (void *)ud.wchoice, CVAR_STRING|CVAR_FUNCPTR, 0, MAX_WEAPONS },
}; };

View file

@ -286,19 +286,19 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
i = ud.screen_size; i = ud.screen_size;
ud.screen_size = 0; ud.screen_size = 0;
G_UpdateScreenArea(); G_UpdateScreenArea();
clearallviews(0L); videoClearScreen(0L);
} }
if ((uint32_t)j < 2*MAXTILES) 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, rotatesprite_fs(320<<15,200<<15,65536L,0, j > MAXTILES-1?j-MAXTILES:j,0,0,
2+8+64+BGSTRETCH); 2+8+64+BGSTRETCH);
} }
else else
{ {
nextpage(); videoNextPage();
return; 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); VM_OnEventWithReturn(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, percent);
nextpage(); videoNextPage();
if (!statustext) if (!statustext)
{ {
@ -340,7 +340,7 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
{ {
if (!statustext) if (!statustext)
{ {
clearallviews(0L); videoClearScreen(0L);
//g_player[myconnectindex].ps->palette = palette; //g_player[myconnectindex].ps->palette = palette;
//G_FadePalette(0,0,0,0); //G_FadePalette(0,0,0,0);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 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 else
{ {
nextpage(); videoNextPage();
return; return;
} }
menutext_center(105,"Loading..."); menutext_center(105,"Loading...");
if (statustext) gametext_center_number(180, statustext); if (statustext) gametext_center_number(180, statustext);
VM_OnEventWithReturn(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, percent); VM_OnEventWithReturn(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, percent);
nextpage(); videoNextPage();
} }
} }
@ -385,7 +385,7 @@ void G_CacheMapData(void)
polymost_glreset(); polymost_glreset();
#endif #endif
starttime = getticks(); starttime = timerGetTicks();
S_PrecacheSounds(); S_PrecacheSounds();
G_PrecacheSprites(); G_PrecacheSprites();
@ -490,7 +490,7 @@ void G_CacheMapData(void)
{ {
Bsprintf(tempbuf, "Loaded %d%% (%d/%d textures)\n", lpc, pc, g_precacheCount); Bsprintf(tempbuf, "Loaded %d%% (%d/%d textures)\n", lpc, pc, g_precacheCount);
G_DoLoadScreen(tempbuf, lpc); G_DoLoadScreen(tempbuf, lpc);
sampletimer(); timerUpdate();
if (totalclock - tc >= 1) if (totalclock - tc >= 1)
{ {
@ -507,7 +507,7 @@ void G_CacheMapData(void)
Bmemset(gotpic, 0, sizeof(gotpic)); Bmemset(gotpic, 0, sizeof(gotpic));
endtime = getticks(); endtime = timerGetTicks();
OSD_Printf("Cache time: %dms\n", endtime-starttime); OSD_Printf("Cache time: %dms\n", endtime-starttime);
} }
@ -579,7 +579,7 @@ void G_UpdateScreenArea(void)
y2 = y1 + (ourydimen>>1); y2 = y1 + (ourydimen>>1);
} }
setview(x1,y1,x2-1,y2-1); videoSetViewableArea(x1,y1,x2-1,y2-1);
} }
G_GetCrosshairColor(); G_GetCrosshairColor();
@ -1359,25 +1359,25 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
S_PlaySpecialMusicOrNothing(MUS_BRIEFING); S_PlaySpecialMusicOrNothing(MUS_BRIEFING);
flushperms(); flushperms();
setview(0,0,xdim-1,ydim-1); videoSetViewableArea(0,0,xdim-1,ydim-1);
clearview(0L); videoClearViewableArea(0L);
nextpage(); videoNextPage();
int animReturn = Anim_Play("vol41a.anm"); int animReturn = Anim_Play("vol41a.anm");
clearview(0L); videoClearViewableArea(0L);
nextpage(); videoNextPage();
if (animReturn) if (animReturn)
goto end_vol4a; goto end_vol4a;
animReturn = Anim_Play("vol42a.anm"); animReturn = Anim_Play("vol42a.anm");
clearview(0L); videoClearViewableArea(0L);
nextpage(); videoNextPage();
if (animReturn) if (animReturn)
goto end_vol4a; goto end_vol4a;
Anim_Play("vol43a.anm"); Anim_Play("vol43a.anm");
clearview(0L); videoClearViewableArea(0L);
nextpage(); videoNextPage();
end_vol4a: end_vol4a:
FX_StopAllSounds(); FX_StopAllSounds();
@ -1772,7 +1772,7 @@ int G_EnterLevel(int gameMode)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
FX_SetReverb(0); 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()) if (Menu_HaveUserMap())
@ -2000,7 +2000,7 @@ int G_EnterLevel(int gameMode)
g_restorePalette = -1; g_restorePalette = -1;
G_UpdateScreenArea(); G_UpdateScreenArea();
clearview(0L); videoClearViewableArea(0L);
G_DrawBackground(); G_DrawBackground();
G_DrawRooms(myconnectindex,65536); G_DrawRooms(myconnectindex,65536);

View file

@ -363,7 +363,7 @@ int32_t G_LoadPlayer(savebrief_t & sv)
G_UpdateScreenArea(); G_UpdateScreenArea();
G_DrawBackground(); G_DrawBackground();
menutext_center(100, "Loading..."); menutext_center(100, "Loading...");
nextpage(); videoNextPage();
} }
Net_WaitForServer(); Net_WaitForServer();
@ -439,7 +439,7 @@ static void G_SaveTimers(void)
static void G_RestoreTimers(void) static void G_RestoreTimers(void)
{ {
sampletimer(); timerUpdate();
totalclock = g_timers.totalclock; totalclock = g_timers.totalclock;
totalclocklock = g_timers.totalclocklock; totalclocklock = g_timers.totalclocklock;
@ -2046,7 +2046,7 @@ static void sv_restload()
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS
# define PRINTSIZE(name) do { if (mem) OSD_Printf(name ": %d\n", (int32_t)(mem-tmem)); \ # 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 #else
# define PRINTSIZE(name) do { } while (0) # define PRINTSIZE(name) do { } while (0)
#endif #endif
@ -2061,7 +2061,7 @@ static uint8_t *dosaveplayer2(FILE *fil, uint8_t *mem)
{ {
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS
uint8_t *tmem = mem; uint8_t *tmem = mem;
int32_t t=getticks(); int32_t t=timerGetTicks();
#endif #endif
mem=writespecdata(svgm_udnetw, fil, mem); // user settings, players & net mem=writespecdata(svgm_udnetw, fil, mem); // user settings, players & net
PRINTSIZE("ud"); PRINTSIZE("ud");
@ -2172,7 +2172,7 @@ static int32_t doloadplayer2(int32_t fil, uint8_t **memptr)
uint8_t *mem = memptr ? *memptr : NULL; uint8_t *mem = memptr ? *memptr : NULL;
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS
uint8_t *tmem=mem; uint8_t *tmem=mem;
int32_t t=getticks(); int32_t t=timerGetTicks();
#endif #endif
if (readspecdata(svgm_udnetw, fil, &mem)) return -2; if (readspecdata(svgm_udnetw, fil, &mem)) return -2;
PRINTSIZE("ud"); PRINTSIZE("ud");

View file

@ -1036,7 +1036,7 @@ void G_DrawBackground(void)
const int32_t fstilep = tilesiz[MENUTILE].x>=320 && tilesiz[MENUTILE].y==200; const int32_t fstilep = tilesiz[MENUTILE].x>=320 && tilesiz[MENUTILE].y==200;
int32_t bgtile = (fstilep ? MENUTILE : BIGHOLE); int32_t bgtile = (fstilep ? MENUTILE : BIGHOLE);
clearallviews(0); videoClearScreen(0);
// when not rendering a game, fullscreen wipe // when not rendering a game, fullscreen wipe
// Gv_SetVar(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1); // Gv_SetVar(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1);

View file

@ -329,7 +329,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
int32_t tmpydim = (xdim*5)/8; 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; xvect = sintable[(-cang)&2047] * czoom;
yvect = sintable[(1536-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(); pop_nofog();
setaspect_new(); videoSetCorrectedAspect();
for (TRAVERSE_CONNECT(p)) 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 frameCount = 0, lastFPS = 0, lastFrameTime = 0, cumulativeFrameDelay = 0;
static int32_t minFPS = -1, maxFPS = 0; static int32_t minFPS = -1, maxFPS = 0;
int32_t frameTime = getticks(); int32_t frameTime = timerGetTicks();
int32_t frameDelay = frameTime - lastFrameTime; int32_t frameDelay = frameTime - lastFrameTime;
cumulativeFrameDelay += frameDelay; cumulativeFrameDelay += frameDelay;
@ -1067,7 +1067,7 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.overhead_on == 2) if (ud.overhead_on == 2)
{ {
clearview(0L); videoClearViewableArea(0L);
drawmapview(cposx, cposy, pp->zoom, cang); drawmapview(cposx, cposy, pp->zoom, cang);
} }
G_DrawOverheadMap(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_scale = scale(crosshair_scale, ydim << 2, xdim * 3) >> 1;
crosshair_pal = 0; crosshair_pal = 0;
crosshair_o |= 1024; crosshair_o |= 1024;
setaspect(viewingrange, 65536); videoSetAspect(viewingrange, 65536);
} }
rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, crosshair_pal, crosshair_o); rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, crosshair_pal, crosshair_o);
if (KXDWN) 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_scale = scale(pointer_scale, ydim << 2, xdim * 3) >> 1;
pointer_pal = 0; pointer_pal = 0;
pointer_o |= 1024; pointer_o |= 1024;
setaspect(viewingrange, 65536); videoSetAspect(viewingrange, 65536);
} }
rotatesprite_win(pointerpos.x, pointerpos.y, pointer_scale, 0, a, 0, pointer_pal, pointer_o); rotatesprite_win(pointerpos.x, pointerpos.y, pointer_scale, 0, a, 0, pointer_pal, pointer_o);
if (KXDWN) if (KXDWN)
setaspect(viewingrange, oyxaspect); videoSetAspect(viewingrange, oyxaspect);
} }
} }
#endif #endif
@ -1233,7 +1233,7 @@ void G_DisplayRest(int32_t smoothratio)
{ {
int32_t vr=viewingrange, asp=yxaspect; int32_t vr=viewingrange, asp=yxaspect;
VM_OnEvent_(EVENT_DISPLAYREST, g_player[screenpeek].ps->i, screenpeek); 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) 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) if (ud.screenfade == 0)
return; return;
setpalettefade(r, g, b, e); setpalettefade(r, g, b, e);
nextpage(); videoNextPage();
int32_t tc = totalclock; int32_t tc = totalclock;
while (totalclock < tc + 4) 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 // STEP must evenly divide END-START
Bassert(klabs(end-start)%step == 0); Bassert(klabs(end-start)%step == 0);
clearallviews(0); videoClearScreen(0);
// (end-start)/step + 1 iterations // (end-start)/step + 1 iterations
do do
{ {
#ifdef __ANDROID__ //Needed for N7 2013 to stop corruption while fading video #ifdef __ANDROID__ //Needed for N7 2013 to stop corruption while fading video
clearview(0); videoClearViewableArea(0);
#endif #endif
if (KB_KeyPressed(sc_Space)) if (KB_KeyPressed(sc_Space))
{ {
@ -1441,7 +1441,7 @@ void G_DisplayExtraScreens(void)
#ifdef __ANDROID__ #ifdef __ANDROID__
inExtraScreens = 1; inExtraScreens = 1;
#endif #endif
setview(0, 0, xdim-1, ydim-1); videoSetViewableArea(0, 0, xdim-1, ydim-1);
flushperms(); flushperms();
//g_player[myconnectindex].ps->palette = palette; //g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
@ -1469,7 +1469,7 @@ void G_DisplayExtraScreens(void)
#ifdef __ANDROID__ #ifdef __ANDROID__
inExtraScreens = 1; inExtraScreens = 1;
#endif #endif
setview(0, 0, xdim-1, ydim-1); videoSetViewableArea(0, 0, xdim-1, ydim-1);
flushperms(); flushperms();
//g_player[myconnectindex].ps->palette = palette; //g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
@ -1498,12 +1498,12 @@ void G_DisplayLogo(void)
I_ClearAllInput(); I_ClearAllInput();
setview(0, 0, xdim-1, ydim-1); videoSetViewableArea(0, 0, xdim-1, ydim-1);
clearallviews(0L); videoClearScreen(0L);
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
flushperms(); flushperms();
nextpage(); videoNextPage();
G_UpdateAppTitle(); G_UpdateAppTitle();
@ -1528,8 +1528,8 @@ void G_DisplayLogo(void)
I_ClearAllInput(); I_ClearAllInput();
} }
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
if (logoflags & LOGO_STOPANIMSOUNDS) if (logoflags & LOGO_STOPANIMSOUNDS)
{ {
@ -1567,13 +1567,13 @@ void G_DisplayLogo(void)
} }
else else
{ {
clearallviews(0); videoClearScreen(0);
P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, 8 + 2 + 1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, 8 + 2 + 1); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28); fadepal(0, 0, 0, 0, 252, 28);
flushperms(); flushperms();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH); 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); fadepaltile(0, 0, 0, 252, 0, -28, DREALMS);
totalclock = 0; totalclock = 0;
@ -1581,7 +1581,7 @@ void G_DisplayLogo(void)
{ {
if (G_FPSLimit()) if (G_FPSLimit())
{ {
clearallviews(0); videoClearScreen(0);
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH);
G_HandleAsync(); G_HandleAsync();
@ -1597,19 +1597,19 @@ void G_DisplayLogo(void)
} }
} }
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
} }
I_ClearAllInput(); I_ClearAllInput();
} }
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
if (logoflags & LOGO_TITLESCREEN) if (logoflags & LOGO_TITLESCREEN)
{ {
clearallviews(0); videoClearScreen(0);
//g_player[myconnectindex].ps->palette = titlepal; //g_player[myconnectindex].ps->palette = titlepal;
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 8+2+1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 8+2+1); // JBF 20040308
@ -1627,7 +1627,7 @@ void G_DisplayLogo(void)
{ {
if (G_FPSLimit()) if (G_FPSLimit())
{ {
clearallviews(0); videoClearScreen(0);
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH);
if (logoflags & LOGO_DUKENUKEM) if (logoflags & LOGO_DUKENUKEM)
{ {
@ -1710,8 +1710,8 @@ void G_DisplayLogo(void)
} }
flushperms(); flushperms();
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
//g_player[myconnectindex].ps->palette = palette; //g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
@ -1719,7 +1719,7 @@ void G_DisplayLogo(void)
S_PlaySound(NITEVISION_ONOFF); S_PlaySound(NITEVISION_ONOFF);
//G_FadePalette(0,0,0,0); //G_FadePalette(0,0,0,0);
clearallviews(0L); videoClearScreen(0L);
} }
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
@ -1727,7 +1727,7 @@ void G_DoOrderScreen(void)
{ {
int32_t i; 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 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 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); 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); fadepal(0, 0, 0, 252, 0, -4);
I_ClearAllInput(); I_ClearAllInput();
@ -1783,7 +1783,7 @@ static void G_BonusCutscenes(void)
{ {
if (G_FPSLimit()) if (G_FPSLimit())
{ {
clearallviews(0L); videoClearScreen(0L);
rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH);
// boss // boss
@ -1862,19 +1862,19 @@ static void G_BonusCutscenes(void)
if ((G_GetLogoFlags() & LOGO_NOE2BONUSSCENE) && (G_GetLogoFlags() & LOGO_NOE2ENDSCREEN)) if ((G_GetLogoFlags() & LOGO_NOE2BONUSSCENE) && (G_GetLogoFlags() & LOGO_NOE2ENDSCREEN))
return; return;
setview(0, 0, xdim-1, ydim-1); videoSetViewableArea(0, 0, xdim-1, ydim-1);
S_StopMusic(); S_StopMusic();
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE2BONUSSCENE)) if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE2BONUSSCENE))
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
Anim_Play("cineov2.anm"); Anim_Play("cineov2.anm");
I_ClearAllInput(); I_ClearAllInput();
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
S_PlaySound(PIPEBOMB_EXPLODE); S_PlaySound(PIPEBOMB_EXPLODE);
fadepal(0, 0, 0, 0, 252, 4); 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)) if ((G_GetLogoFlags() & LOGO_NOE4BONUSSCENE) && (G_GetLogoFlags() & LOGO_NODUKETEAMTEXT) && (G_GetLogoFlags() & LOGO_NODUKETEAMPIC))
return; return;
setview(0, 0, xdim-1, ydim-1); videoSetViewableArea(0, 0, xdim-1, ydim-1);
S_StopMusic(); S_StopMusic();
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE4BONUSSCENE)) if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE4BONUSSCENE))
{ {
@ -1908,20 +1908,20 @@ static void G_BonusCutscenes(void)
I_ClearAllInput(); I_ClearAllInput();
int t = Anim_Play("vol4e1.anm"); int t = Anim_Play("vol4e1.anm");
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
if (t) if (t)
goto end_vol4e; goto end_vol4e;
t = Anim_Play("vol4e2.anm"); t = Anim_Play("vol4e2.anm");
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
if (t) if (t)
goto end_vol4e; goto end_vol4e;
Anim_Play("vol4e3.anm"); Anim_Play("vol4e3.anm");
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
} }
end_vol4e: end_vol4e:
@ -1939,16 +1939,16 @@ static void G_BonusCutscenes(void)
G_FadePalette(0, 0, 0, 0); G_FadePalette(0, 0, 0, 0);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
// G_FadePalette(0,0,0,252); // G_FadePalette(0,0,0,252);
clearallviews(0L); videoClearScreen(0L);
menutext_center(60, "Thanks to all our"); menutext_center(60, "Thanks to all our");
menutext_center(60+16, "fans for giving"); menutext_center(60+16, "fans for giving");
menutext_center(60+16+16, "us big heads."); 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, "Look for a Duke Nukem 3D");
menutext_center(70+16+16+16+16, "sequel soon."); menutext_center(70+16+16+16+16, "sequel soon.");
nextpage(); videoNextPage();
fadepal(0, 0, 0, 252, 0, -12); fadepal(0, 0, 0, 252, 0, -12);
nextpage(); videoNextPage();
I_ClearAllInput(); I_ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
fadepal(0, 0, 0, 0, 252, 12); fadepal(0, 0, 0, 0, 252, 12);
@ -1957,16 +1957,16 @@ static void G_BonusCutscenes(void)
goto VOL4_END; goto VOL4_END;
VOL4_DUKETEAM: VOL4_DUKETEAM:
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
Anim_Play("DUKETEAM.ANM"); Anim_Play("DUKETEAM.ANM");
I_ClearAllInput(); I_ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
VOL4_END: VOL4_END:
@ -1981,8 +1981,8 @@ static void G_BonusCutscenes(void)
return; return;
S_StopMusic(); S_StopMusic();
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE3BONUSSCENE)) if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE3BONUSSCENE))
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
@ -1991,8 +1991,8 @@ static void G_BonusCutscenes(void)
ototalclock = totalclock+200; ototalclock = totalclock+200;
while (totalclock < ototalclock) while (totalclock < ototalclock)
G_HandleAsync(); G_HandleAsync();
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
@ -2034,16 +2034,16 @@ static void G_BonusCutscenes(void)
S_ClearSoundLocks(); S_ClearSoundLocks();
S_PlaySound(ENDSEQVOL3SND4); S_PlaySound(ENDSEQVOL3SND4);
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
Anim_Play("DUKETEAM.ANM"); Anim_Play("DUKETEAM.ANM");
I_ClearAllInput(); I_ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
} }
@ -2051,7 +2051,7 @@ static void G_BonusCutscenes(void)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
clearallviews(0L); videoClearScreen(0L);
break; break;
} }
@ -2208,9 +2208,9 @@ void G_BonusScreen(int32_t bonusonly)
fadepal(0, 0, 0, 0, 252, 28); fadepal(0, 0, 0, 0, 252, 28);
setview(0, 0, xdim-1, ydim-1); videoSetViewableArea(0, 0, xdim-1, ydim-1);
clearallviews(0L); videoClearScreen(0L);
nextpage(); videoNextPage();
flushperms(); flushperms();
FX_StopAllSounds(); FX_StopAllSounds();
@ -2235,13 +2235,13 @@ void G_BonusScreen(int32_t bonusonly)
if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET)) if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
{ {
clearallviews(0); videoClearScreen(0);
G_DisplayMPResultsScreen(); G_DisplayMPResultsScreen();
if (ud.config.MusicToggle) if (ud.config.MusicToggle)
S_PlaySound(BONUSMUSIC); S_PlaySound(BONUSMUSIC);
nextpage(); videoNextPage();
I_ClearAllInput(); I_ClearAllInput();
fadepal(0, 0, 0, 252, 0, -28); fadepal(0, 0, 0, 252, 0, -28);
totalclock = 0; totalclock = 0;
@ -2253,7 +2253,7 @@ void G_BonusScreen(int32_t bonusonly)
if (G_FPSLimit()) if (G_FPSLimit())
{ {
clearallviews(0); videoClearScreen(0);
G_DisplayMPResultsScreen(); G_DisplayMPResultsScreen();
} }
@ -2281,7 +2281,7 @@ void G_BonusScreen(int32_t bonusonly)
if (ud.config.MusicToggle) if (ud.config.MusicToggle)
S_PlaySound(BONUSMUSIC); S_PlaySound(BONUSMUSIC);
nextpage(); videoNextPage();
I_ClearAllInput(); I_ClearAllInput();
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
bonuscnt = 0; bonuscnt = 0;
@ -2298,7 +2298,7 @@ void G_BonusScreen(int32_t bonusonly)
{ {
if (g_player[myconnectindex].ps->gm&MODE_EOL) 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); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BONUSSCREEN+gfx_offset, 0, 0, 2+8+64+128+BGSTRETCH);
if (totalclock >= 1000000000 && totalclock < 1000000320) if (totalclock >= 1000000000 && totalclock < 1000000320)

View file

@ -380,7 +380,7 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio)
int const saveMirror = display_mirror; int const saveMirror = display_mirror;
//if (waloff[wn] == 0) loadtile(wn); //if (waloff[wn] == 0) loadtile(wn);
setviewtotile(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x); videoSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x);
yax_preparedrawrooms(); yax_preparedrawrooms();
drawrooms(camera.x, camera.y, camera.z, SA(spriteNum), 100 + sprite[spriteNum].shade, SECT(spriteNum)); 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; display_mirror = saveMirror;
drawmasks(); drawmasks();
setviewback(); videoRestoreTarget();
squarerotatetile(tileNum); squarerotatetile(tileNum);
invalidatetile(tileNum, -1, 255); invalidatetile(tileNum, -1, 255);
} }

View file

@ -316,7 +316,7 @@ static void PopulateForm(unsigned char pgs)
GtkTreeIter iter; GtkTreeIter iter;
char buf[64]; 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) if (mode3d < 0)
{ {
int32_t i, cd[] = { 32, 24, 16, 15, 8, 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 (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; }
for (; cd[i]; i++) 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; if (mode3d < 0) continue;
settings.bpp3d = cd[i]; settings.bpp3d = cd[i];
break; break;

View file

@ -147,7 +147,7 @@ static void PopulateForm(int32_t pgs)
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE); 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))) if (mode < 0 || (settings.bpp < 15 && (settings.flags & 2)))
{ {
int32_t cd[] = { 32, 24, 16, 15, 8, 0 }; int32_t cd[] = { 32, 24, 16, 15, 8, 0 };
@ -158,7 +158,7 @@ static void PopulateForm(int32_t pgs)
} }
for (; cd[i]; i++) 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; if (mode < 0) continue;
settings.bpp = cd[i]; settings.bpp = cd[i];
break; break;