diff --git a/source/build/include/build.h b/source/build/include/build.h index 108d13dbd..5b5e4b8a1 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -896,7 +896,7 @@ extern const char *engineerrstr; EXTERN int32_t editorzrange[2]; -static FORCE_INLINE int32_t getrendermode(void) +static FORCE_INLINE int32_t videoGetRenderMode(void) { #ifndef USE_OPENGL return REND_CLASSIC; @@ -1431,7 +1431,7 @@ extern "C" { static FORCE_INLINE void push_nofog(void) { #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { polymost_setFogEnabled(false); } @@ -1441,7 +1441,7 @@ static FORCE_INLINE void push_nofog(void) static FORCE_INLINE void pop_nofog(void) { #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && !nofog) + if (videoGetRenderMode() >= REND_POLYMOST && !nofog) polymost_setFogEnabled(true); #endif } diff --git a/source/build/include/palette.h b/source/build/include/palette.h index 45b995354..cb3cfe02d 100644 --- a/source/build/include/palette.h +++ b/source/build/include/palette.h @@ -20,9 +20,9 @@ extern "C" { extern uint8_t curbasepal; #ifdef LUNATIC -extern const char *(getblendtab) (int32_t blend); +extern const char *(paletteGetBlendTable) (int32_t blend); #else -#define getblendtab(blend) (blendtable[blend]) +#define paletteGetBlendTable(blend) (blendtable[blend]) #endif extern uint32_t PaletteIndexFullbrights[8]; @@ -39,33 +39,33 @@ extern palette_t curpalette[256], curpalettefaded[256], palfadergb; extern char palfadedelta; extern void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f); -extern void fade_screen_black(int32_t moreopaquep); -void makepalookup(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal); -void setbasepal(int32_t id, uint8_t const *table); -void removebasepal(int32_t id); -void setblendtab(int32_t blend, const char *tab); -void removeblendtab(int32_t blend); -int32_t setpalookup(int32_t palnum, const uint8_t *shtab); -void removepalookup(int32_t palnum); -void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags); -void setpalettefade(uint8_t r, uint8_t g, uint8_t b, uint8_t offset); +extern void videoFadeToBlack(int32_t moreopaquep); +void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal); +void paletteSetColorTable(int32_t id, uint8_t const *table); +void paletteFreeColorTable(int32_t id); +void paletteSetBlendTable(int32_t blend, const char *tab); +void paletteFreeBlendTable(int32_t blend); +int32_t paletteSetLookupTable(int32_t palnum, const uint8_t *shtab); +void paletteFreeLookupTable(int32_t palnum); +void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags); +void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset); extern int32_t realmaxshade; extern float frealmaxshade; extern int32_t globalblend; extern uint32_t g_lastpalettesum; -extern palette_t getpal(int32_t col); -extern void loadpalette(void); -extern void E_PostLoadPalette(void); +extern palette_t paletteGetColor(int32_t col); +extern void paletteLoadFromDisk(void); +extern void palettePostLoadTables(void); extern void setup_blend(int32_t blend, int32_t doreverse); extern uint8_t basepalreset; extern int32_t curbrightness, gammabrightness; -extern int32_t loadlookups(int32_t fp); -extern void generatefogpals(void); -extern void fillemptylookups(void); -extern void E_ReplaceTransparentColorWithBlack(void); +extern int32_t paletteLoadLookupTable(int32_t fp); +extern void paletteSetupDefaultFog(void); +extern void palettePostLoadLookups(void); +extern void paletteFixTranslucencyMask(void); extern int8_t g_noFloorPal[MAXPALOOKUPS]; diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index beec313f6..f51690704 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -91,7 +91,7 @@ static inline float getshadefactor(int32_t const shade) { // 8-bit tiles, i.e. non-hightiles and non-models, don't get additional // glColor() shading with r_usetileshades! - if (getrendermode() == REND_POLYMOST && r_usetileshades && + if (videoGetRenderMode() == REND_POLYMOST && r_usetileshades && !(globalflags & GLOBAL_NO_GL_TILESHADES) && eligible_for_tileshades(globalpicnum, globalpal)) return 1.f; @@ -211,7 +211,7 @@ EDUKE32_STATIC_ASSERT(TO_DAMETH_ARTIMMUNITY(HICR_ARTIMMUNITY) == DAMETH_ARTIMMUN // Do we want a NPOT-y-as-classic texture for this and ? static FORCE_INLINE int polymost_want_npotytex(int32_t dameth, int32_t ysiz) { - return getrendermode() != REND_POLYMER && // r_npotwallmode NYI in Polymer + return videoGetRenderMode() != REND_POLYMER && // r_npotwallmode NYI in Polymer polymost_is_npotmode() && (dameth&DAMETH_WALL) && check_nonpow2(ysiz); } diff --git a/source/build/src/2d.cpp b/source/build/src/2d.cpp index e90f13820..b0d14f2fa 100644 --- a/source/build/src/2d.cpp +++ b/source/build/src/2d.cpp @@ -50,9 +50,9 @@ void plotpixel(int32_t x, int32_t y, char col) { // XXX: if we ever want the editor to work under GL ES, find a replacement for the raster functions #if defined USE_OPENGL && !defined EDUKE32_GLES - if (getrendermode() >= REND_POLYMOST && in3dmode()) + if (videoGetRenderMode() >= REND_POLYMOST && in3dmode()) { - palette_t p = getpal(col); + palette_t p = paletteGetColor(col); glRasterPos4i(x, y, 0, 1); glDrawPixels(1, 1, GL_RGB, GL_UNSIGNED_BYTE, &p); @@ -71,9 +71,9 @@ void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int co int32_t i; #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && in3dmode()) + if (videoGetRenderMode() >= REND_POLYMOST && in3dmode()) { - palette_t p = getpal(col); + palette_t p = paletteGetColor(col); polymost_useColorOnly(true); glBegin(GL_LINE_STRIP); @@ -110,7 +110,7 @@ char getpixel(int32_t x, int32_t y) char r; #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && in3dmode()) return 0; + if (videoGetRenderMode() >= REND_POLYMOST && in3dmode()) return 0; #endif videoBeginDrawing(); //{{{ @@ -132,7 +132,7 @@ static void drawlinegl(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, xres, yres, 0, -1, 1); - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); @@ -238,7 +238,7 @@ static void drawlinepixels(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t p) { #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { drawlinegl(x1, y1, x2, y2, p); return; @@ -254,9 +254,9 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) col = palookup[0][col]; #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { - palette_t p = getpal(col); + palette_t p = paletteGetColor(col); p.f = col; drawlinegl(x1, y1, x2, y2, p); return; @@ -1396,7 +1396,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z void setpolymost2dview(void) { #ifdef USE_OPENGL - if (getrendermode() < REND_POLYMOST) return; + if (videoGetRenderMode() < REND_POLYMOST) return; glViewport(0, 0, xres, yres); @@ -1404,7 +1404,7 @@ void setpolymost2dview(void) glLoadIdentity(); glOrtho(0, xres, yres, 0, -1, 1); - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); diff --git a/source/build/src/baselayer.cpp b/source/build/src/baselayer.cpp index d403ac2cc..d5da2aa6f 100644 --- a/source/build/src/baselayer.cpp +++ b/source/build/src/baselayer.cpp @@ -323,7 +323,7 @@ static int32_t osdfunc_setrendermode(osdfuncparm_t const * const parm) char const *renderer; - switch (getrendermode()) + switch (videoGetRenderMode()) { case REND_CLASSIC: renderer = "classic software"; @@ -425,7 +425,7 @@ static int32_t osdcmd_cvar_set_baselayer(osdfuncparm_t const * const parm) if (!Bstrcasecmp(parm->name, "vid_gamma") || !Bstrcasecmp(parm->name, "vid_brightness") || !Bstrcasecmp(parm->name, "vid_contrast")) { - setbrightness(GAMMA_CALC,0,0); + videoSetPalette(GAMMA_CALC,0,0); return r; } diff --git a/source/build/src/build.cpp b/source/build/src/build.cpp index 6e9c3222e..2ed89a685 100644 --- a/source/build/src/build.cpp +++ b/source/build/src/build.cpp @@ -488,7 +488,7 @@ void M32_ResetFakeRORTiles(void) #ifdef POLYMER # ifdef YAX_ENABLE // END_TWEAK ceiling/floor fake 'TROR' pics, see BEGIN_TWEAK in engine.c - if (getrendermode() == REND_POLYMER && showinvisibility) + if (videoGetRenderMode() == REND_POLYMER && showinvisibility) { int32_t i; @@ -536,7 +536,7 @@ void M32_DrawRoomsAndMasks(void) M32_ResetFakeRORTiles(); #ifdef POLYMER - if (getrendermode() == REND_POLYMER && searchit == 2) + if (videoGetRenderMode() == REND_POLYMER && searchit == 2) { polymer_editorpick(); drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); @@ -768,7 +768,7 @@ int app_main(int argc, char const * const * argv) g_videoGamma = g_videoContrast = 1.0; g_videoBrightness = 0.0; - setbrightness(0,0,0); + videoSetPalette(0,0,0); if (videoSetGameMode(fullscreen, xdim2d, ydim2d, 8) < 0) { CallExtUnInit(); @@ -788,7 +788,7 @@ int app_main(int argc, char const * const * argv) vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1; - setbrightness(GAMMA_CALC,0,0); + videoSetPalette(GAMMA_CALC,0,0); } else { @@ -802,7 +802,7 @@ int app_main(int argc, char const * const * argv) system_getcvars(); - setbrightness(GAMMA_CALC,0,0); + videoSetPalette(GAMMA_CALC,0,0); } CANCEL: @@ -1382,7 +1382,7 @@ void editinput(void) rotatepoint(zerovec, da, ang, &da); #ifdef USE_OPENGL - if (getrendermode() == REND_POLYMOST) + if (videoGetRenderMode() == REND_POLYMOST) hit = polymost_hitdata; else #endif @@ -1481,7 +1481,7 @@ void editinput(void) g_videoGamma = g_videoContrast = 1.0; g_videoBrightness = 0.0; - setbrightness(0,0,0); + videoSetPalette(0,0,0); keystatus[buildkeys[BK_MODE2D_3D]] = 0; overheadeditor(); @@ -1493,7 +1493,7 @@ void editinput(void) vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1; - setbrightness(GAMMA_CALC,0,0); + videoSetPalette(GAMMA_CALC,0,0); } } @@ -8270,7 +8270,7 @@ CANCEL: Bexit(1); } - setbrightness(GAMMA_CALC,0,0); + videoSetPalette(GAMMA_CALC,0,0); pos.z = oposz; diff --git a/source/build/src/common.cpp b/source/build/src/common.cpp index 87026a1b7..a16007798 100644 --- a/source/build/src/common.cpp +++ b/source/build/src/common.cpp @@ -244,7 +244,7 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows) UNREFERENCED_PARAMETER(numcols); # ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && in3dmode()) + if (videoGetRenderMode() >= REND_POLYMOST && in3dmode()) { // glPushAttrib(GL_FOG_BIT); polymost_setFogEnabled(false); diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 184601ab4..91ce81316 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -604,7 +604,7 @@ static int32_t defsparser(scriptfile *script) g = clamp(g, 0, 63); b = clamp(b, 0, 63); - makepalookup(p, NULL, r<<2, g<<2, b<<2, 1); + paletteMakeLookupTable(p, NULL, r<<2, g<<2, b<<2, 1); } break; case T_NOFLOORPALRANGE: @@ -2213,7 +2213,7 @@ static int32_t defsparser(scriptfile *script) // NOTE: all palookups are initialized, i.e. non-NULL! // NOTE2: aliasing (pal==remappal) is OK - makepalookup(pal, palookup[remappal], red<<2, green<<2, blue<<2, + paletteMakeLookupTable(pal, palookup[remappal], red<<2, green<<2, blue<<2, remappal==0 ? 1 : (nofloorpal == -1 ? g_noFloorPal[remappal] : nofloorpal)); } break; @@ -2870,7 +2870,7 @@ static int32_t defsparser(scriptfile *script) palbuf[k] <<= shiftleft; } - setbasepal(id, palbuf); + paletteSetColorTable(id, palbuf); didLoadPal = 1; Bfree(palbuf); @@ -2897,13 +2897,13 @@ static int32_t defsparser(scriptfile *script) break; } - setbasepal(id, sourcetable); + paletteSetColorTable(id, sourcetable); didLoadPal = 1; break; } case T_UNDEF: { - removebasepal(id); + paletteFreeColorTable(id); didLoadPal = 0; if (id == 0) @@ -3049,7 +3049,7 @@ static int32_t defsparser(scriptfile *script) { didLoadShade = 1; numshades = 32; - setpalookup(id, (uint8_t *)palookupbuf); + paletteSetLookupTable(id, (uint8_t *)palookupbuf); } else { @@ -3060,7 +3060,7 @@ static int32_t defsparser(scriptfile *script) break; } - makepalookup(id, palookupbuf, 0,0,0, g_noFloorPal[id]); + paletteMakeLookupTable(id, palookupbuf, 0,0,0, g_noFloorPal[id]); } Bfree(palookupbuf); @@ -3094,7 +3094,7 @@ static int32_t defsparser(scriptfile *script) break; } - setpalookup(id, sourcepal); + paletteSetLookupTable(id, sourcepal); didLoadShade = 1; break; } @@ -3140,7 +3140,7 @@ static int32_t defsparser(scriptfile *script) break; } - makepalookup(id, NULL, red, green, blue, 1); + paletteMakeLookupTable(id, NULL, red, green, blue, 1); break; } case T_MAKEPALOOKUP: @@ -3201,7 +3201,7 @@ static int32_t defsparser(scriptfile *script) break; } - makepalookup(id, NULL, red, green, blue, g_noFloorPal[id]); + paletteMakeLookupTable(id, NULL, red, green, blue, g_noFloorPal[id]); break; } @@ -3217,7 +3217,7 @@ static int32_t defsparser(scriptfile *script) } case T_UNDEF: { - removepalookup(id); + paletteFreeLookupTable(id); didLoadShade = 0; if (id == 0) @@ -3344,7 +3344,7 @@ static int32_t defsparser(scriptfile *script) break; } - setblendtab(id, blendbuf); + paletteSetBlendTable(id, blendbuf); didLoadTransluc = 1; Bfree(blendbuf); @@ -3371,7 +3371,7 @@ static int32_t defsparser(scriptfile *script) break; } - setblendtab(id, sourcetable); + paletteSetBlendTable(id, sourcetable); didLoadTransluc = 1; #ifdef USE_OPENGL @@ -3381,7 +3381,7 @@ static int32_t defsparser(scriptfile *script) } case T_UNDEF: { - removeblendtab(id); + paletteFreeBlendTable(id); didLoadTransluc = 0; if (id == 0) @@ -3568,7 +3568,7 @@ static int32_t defsparser(scriptfile *script) } for (bssize_t i = id0; i <= id1; i++) - removebasepal(i); + paletteFreeColorTable(i); if (id0 == 0) paletteloaded &= ~PALETTE_MAIN; @@ -3591,7 +3591,7 @@ static int32_t defsparser(scriptfile *script) } for (bssize_t i = id0; i <= id1; i++) - removepalookup(i); + paletteFreeLookupTable(i); if (id0 == 0) paletteloaded &= ~PALETTE_SHADE; @@ -3614,7 +3614,7 @@ static int32_t defsparser(scriptfile *script) } for (bssize_t i = id0; i <= id1; i++) - removeblendtab(i); + paletteFreeBlendTable(i); if (id0 == 0) paletteloaded &= ~PALETTE_TRANSLUC; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 5f5981d52..ce135cfac 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -712,7 +712,7 @@ static void yax_scanbunches(int32_t bbeg, int32_t numhere, const uint8_t *lastgo if (checkthisec) { numscans = numbunches = 0; - if (getrendermode() == REND_CLASSIC) + if (videoGetRenderMode() == REND_CLASSIC) scansector(k); #ifdef USE_OPENGL else @@ -776,7 +776,7 @@ void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore) } #ifdef POLYMER // will be called only in editor - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { if (!restore) { @@ -851,14 +851,14 @@ static void yax_copytsprites() void yax_preparedrawrooms(void) { - if (getrendermode() == REND_POLYMER || numyaxbunches==0) + if (videoGetRenderMode() == REND_POLYMER || numyaxbunches==0) return; g_nodraw = 1; Bmemset(yax_spritesortcnt, 0, sizeof(yax_spritesortcnt)); Bmemset(haveymost, 0, (numyaxbunches+7)>>3); - if (getrendermode() == REND_CLASSIC && ymostallocsize < xdimen*numyaxbunches) + if (videoGetRenderMode() == REND_CLASSIC && ymostallocsize < xdimen*numyaxbunches) { ymostallocsize = xdimen*numyaxbunches; yumost = (int16_t *)Xrealloc(yumost, ymostallocsize*sizeof(int16_t)); @@ -885,7 +885,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), uint64_t t; #endif - if (getrendermode() == REND_POLYMER || numyaxbunches==0) + if (videoGetRenderMode() == REND_POLYMER || numyaxbunches==0) { #ifdef ENGINE_SCREENSHOT_DEBUG engine_screenshot = 0; @@ -927,7 +927,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), j = yax_getbunch(i, cf); if (j >= 0 && !(havebunch[j>>3]&(1<<(j&7)))) { - if (getrendermode() == REND_CLASSIC && (haveymost[j>>3]&(1<<(j&7)))==0) + if (videoGetRenderMode() == REND_CLASSIC && (haveymost[j>>3]&(1<<(j&7)))==0) { yaxdebug("%s, l %d: skipped bunch %d (no *most)", cf?"v":"^", lev, j); continue; @@ -1016,7 +1016,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), if (editstatus==1 && in3dmode()) { - if (getrendermode() == REND_CLASSIC) + if (videoGetRenderMode() == REND_CLASSIC) { videoBeginDrawing(); draw_rainbow_background(); @@ -1117,7 +1117,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), #endif #ifdef YAX_DEBUG_YMOSTS - if (getrendermode() == REND_CLASSIC && numyaxbunches>0) + if (videoGetRenderMode() == REND_CLASSIC && numyaxbunches>0) { char purple = getclosestcol(255, 0, 255); char yellow = getclosestcol(255, 255, 0); @@ -3226,7 +3226,7 @@ static void nonpow2_thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, uint32 const char *const A_C_RESTRICT buf = (char *)bufplc; const char *const A_C_RESTRICT pal = (char *)asm3; - const char *const A_C_RESTRICT trans = getblendtab(globalblend); + const char *const A_C_RESTRICT trans = paletteGetBlendTable(globalblend); const uint32_t xdiv = globalxspan > 1 ? (uint32_t)ourdivscale32(1, globalxspan) : UINT32_MAX; const uint32_t ydiv = globalyspan > 1 ? (uint32_t)ourdivscale32(1, globalyspan) : UINT32_MAX; @@ -3361,7 +3361,7 @@ static void tslopevlin(uint8_t *p, const intptr_t *slopalptr, bssize_t cnt, int3 { const char *const A_C_RESTRICT buf = ggbuf; const char *const A_C_RESTRICT pal = ggpal; - const char *const A_C_RESTRICT trans = getblendtab(0); + const char *const A_C_RESTRICT trans = paletteGetBlendTable(0); const int32_t bzinc = (asm1>>3), pinc = ggpinc; const int32_t transmode = (globalorientation&128); @@ -5791,7 +5791,7 @@ draw_as_face_sprite: static void drawsprite(int32_t snum) { - switch (getrendermode()) + switch (videoGetRenderMode()) { case REND_CLASSIC: drawsprite_classic(snum); @@ -5824,9 +5824,9 @@ static void drawmaskwall(int16_t damaskwallcnt) { //============================================================================= //POLYMOST BEGINS #ifdef USE_OPENGL - if (getrendermode() == REND_POLYMOST) { polymost_drawmaskwall(damaskwallcnt); return; } + if (videoGetRenderMode() == REND_POLYMOST) { polymost_drawmaskwall(damaskwallcnt); return; } # ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { glEnable(GL_ALPHA_TEST); glEnable(GL_BLEND); @@ -5933,7 +5933,7 @@ static void fillpolygon(int32_t npoints) xb1[z] = 0; #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && in3dmode()) + if (videoGetRenderMode() >= REND_POLYMOST && in3dmode()) { polymost_fillpolygon(npoints); return; @@ -6505,7 +6505,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t //============================================================================= //POLYMOST BEGINS #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && in3dmode()) + if (videoGetRenderMode() >= REND_POLYMOST && in3dmode()) { polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,daalpha,dablend,cx1,cy1,cx2,cy2,uniqid); return; @@ -7744,7 +7744,7 @@ int32_t initengine(void) maxspritesonscreen = MAXSPRITESONSCREEN; - loadpalette(); + paletteLoadFromDisk(); #ifdef USE_OPENGL if (!hicinitcounter) hicinit(); @@ -7778,7 +7778,7 @@ int32_t E_PostInit(void) if (!(paletteloaded & PALETTE_TRANSLUC)) return E_FatalError("No translucency table found."); - E_PostLoadPalette(); + palettePostLoadTables(); return 0; } @@ -7942,7 +7942,7 @@ int32_t drawrooms_q16(int32_t daposx, int32_t daposy, int32_t daposz, i = mulscale16(xdimenscale,viewingrangerecip); globalpisibility = mulscale16(parallaxvisibility,i); - switch (getrendermode()) + switch (videoGetRenderMode()) { // switch on renderers to make fog look almost the same everywhere @@ -7985,7 +7985,7 @@ int32_t drawrooms_q16(int32_t daposx, int32_t daposy, int32_t daposz, Bmemset(gotsector, 0, ((numsectors+7)>>3)); - if (getrendermode() != REND_CLASSIC + if (videoGetRenderMode() != REND_CLASSIC #ifdef YAX_ENABLE || yax_globallev==YAX_MAXDRAWS #endif @@ -8006,7 +8006,7 @@ int32_t drawrooms_q16(int32_t daposx, int32_t daposy, int32_t daposz, #ifdef USE_OPENGL # ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { # ifdef YAX_ENABLE // BEGIN_TWEAK ceiling/floor fake 'TROR' pics, see END_TWEAK in build.c @@ -8048,7 +8048,7 @@ int32_t drawrooms_q16(int32_t daposx, int32_t daposy, int32_t daposz, //============================================================================= //POLYMOST BEGINS polymost_drawrooms(); - if (getrendermode() != REND_CLASSIC) + if (videoGetRenderMode() != REND_CLASSIC) return 0; //============================================================================= //POLYMOST ENDS #endif @@ -8321,7 +8321,7 @@ void drawmasks(void) int32_t dmasknum = 0; # define debugmask_add(dispidx, idx) do { \ - if (g_maskDrawMode && getrendermode()==REND_CLASSIC) { \ + if (g_maskDrawMode && videoGetRenderMode()==REND_CLASSIC) { \ debugmask[dmasknum].di = dispidx; \ debugmask[dmasknum++].i = idx; \ } \ @@ -8475,7 +8475,7 @@ killsprite: while (maskwallcnt) { // PLAG: sorting stuff - const int32_t w = (getrendermode()==REND_POLYMER) ? + const int32_t w = (videoGetRenderMode()==REND_POLYMER) ? maskwall[maskwallcnt-1] : thewall[maskwall[maskwallcnt-1]]; maskwallcnt--; @@ -8494,7 +8494,7 @@ killsprite: i--; if (tspriteptr[i] != NULL #ifdef USE_OPENGL - && (!(tspriteptr[i]->cstat & 1024) || getrendermode() != REND_POLYMOST) + && (!(tspriteptr[i]->cstat & 1024) || videoGetRenderMode() != REND_POLYMOST) #endif ) { @@ -8586,7 +8586,7 @@ killsprite: i--; if (tspriteptr[i] != NULL #ifdef USE_OPENGL - && (!(tspriteptr[i]->cstat & 1024) || getrendermode() != REND_POLYMOST) + && (!(tspriteptr[i]->cstat & 1024) || videoGetRenderMode() != REND_POLYMOST) #endif ) { @@ -8598,7 +8598,7 @@ killsprite: } #ifdef USE_OPENGL - if (getrendermode() == REND_POLYMOST) + if (videoGetRenderMode() == REND_POLYMOST) { glDepthMask(GL_FALSE); @@ -8619,11 +8619,11 @@ killsprite: spritesortcnt = 0; #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_drawmasks(); #endif #ifdef DEBUG_MASK_DRAWING - if (g_maskDrawMode && getrendermode() == REND_CLASSIC) + if (g_maskDrawMode && videoGetRenderMode() == REND_CLASSIC) { for (i=0; i>1); } #ifdef USE_OPENGL - if (getrendermode() == REND_POLYMOST) + if (videoGetRenderMode() == REND_POLYMOST) PolymostProcessVoxels(); - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { //POGOTODO: if we switch to software & then back to GL, this call tries to delete textures that were already lost from the GL Context deletion polymost_glreset(); polymost_glinit(); } # ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { if (!polymer_init()) rendmode = REND_POLYMOST; @@ -12008,7 +12008,7 @@ int32_t setaspect_new_use_dimen = 0; void videoSetCorrectedAspect() { - if (r_usenewaspect && newaspect_enable && getrendermode() != REND_POLYMER) + if (r_usenewaspect && newaspect_enable && videoGetRenderMode() != REND_POLYMER) { // The correction factor 100/107 has been found // out experimentally. Squares FTW! @@ -12216,9 +12216,9 @@ void videoClearViewableArea(int32_t dacol) if (dacol == -1) dacol = 0; #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { - palette_t const p = getpal(dacol); + palette_t const p = paletteGetColor(dacol); glClearColor((float)p.r * (1.f/255.f), (float)p.g * (1.f/255.f), @@ -12254,9 +12254,9 @@ void videoClearScreen(int32_t dacol) //dacol += (dacol<<8); dacol += (dacol<<16); #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { - palette_t const p = getpal(dacol); + palette_t const p = paletteGetColor(dacol); glViewport(0,0,xdim,ydim); glox1 = -1; glClearColor((float)p.r * (1.f/255.f), @@ -12410,7 +12410,7 @@ void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall, void completemirror(void) { #ifdef USE_OPENGL - if (getrendermode() != REND_CLASSIC) + if (videoGetRenderMode() != REND_CLASSIC) return; #endif @@ -12944,7 +12944,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const #ifdef USE_OPENGL if (!polymost_printext256(xpos,ypos,col,backcol,name,fontsize)) return; # if 0 - if (getrendermode() >= REND_POLYMOST && in3dmode()) + if (videoGetRenderMode() >= REND_POLYMOST && in3dmode()) { int32_t xx, yy; int32_t lc=-1; @@ -13102,7 +13102,7 @@ int32_t setrendermode(int32_t renderer) if (!polymer_init()) renderer = REND_POLYMOST; } - else if (getrendermode() == REND_POLYMER) // going from Polymer to another renderer + else if (videoGetRenderMode() == REND_POLYMER) // going from Polymer to another renderer { delete_maphack_lights(); G_Polymer_UnInit(); @@ -13115,7 +13115,7 @@ int32_t setrendermode(int32_t renderer) basepalreset = 1; rendmode = renderer; - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) glrendmode = rendmode; if (renderer == REND_POLYMOST) @@ -13159,7 +13159,7 @@ void invalidatetile(int16_t tilenume, int32_t pal, int32_t how) UNREFERENCED_PARAMETER(pal); UNREFERENCED_PARAMETER(how); #else - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { const int32_t firstpal = (pal < 0) ? 0 : pal; const int32_t numpals = (pal < 0) ? MAXPALOOKUPS : 1; @@ -13172,7 +13172,7 @@ void invalidatetile(int16_t tilenume, int32_t pal, int32_t how) } #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_invalidateartmap(tilenume); #endif } diff --git a/source/build/src/mhk.cpp b/source/build/src/mhk.cpp index 61bb0e1d4..03c960a46 100644 --- a/source/build/src/mhk.cpp +++ b/source/build/src/mhk.cpp @@ -309,7 +309,7 @@ int32_t loadmaphack(const char *filename) light.publicflags.emitshadow = 1; light.publicflags.negative = 0; - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { if (maphacklightcnt == PR_MAXLIGHTS) { diff --git a/source/build/src/osd.cpp b/source/build/src/osd.cpp index 90f14c097..724be3903 100644 --- a/source/build/src/osd.cpp +++ b/source/build/src/osd.cpp @@ -2136,7 +2136,7 @@ int32_t osdcmd_cvar_set(osdfuncparm_t const * const parm) case CVAR_INVALIDATEART: gltexinvalidatetype(INVALIDATE_ART); #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_texinvalidate(); #endif break; diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index d5026621b..d06b00140 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -34,7 +34,7 @@ int8_t g_noFloorPal[MAXPALOOKUPS]; int32_t curbrightness = 0, gammabrightness = 0; -static void setpalettefade_calc(uint8_t offset); +static void paletteSetFade(uint8_t offset); #ifdef USE_OPENGL void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f) @@ -69,10 +69,10 @@ void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f) } #endif -void fade_screen_black(int32_t moreopaquep) +void videoFadeToBlack(int32_t moreopaquep) { #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) fullscreen_tint_gl(0, 0, 0, moreopaquep ? 168 : 84); else #endif @@ -80,26 +80,24 @@ void fade_screen_black(int32_t moreopaquep) Bassert(!offscreenrendering); videoBeginDrawing(); - { - char *const p = (char *) frameplace; - const char *const trans = getblendtab(0); - const int32_t shiftamnt = ((!!moreopaquep)*8); - const int32_t dimprod = xdim*ydim; - int32_t i = 0; + char *const p = (char *) frameplace; + const char *const trans = paletteGetBlendTable(0); + const int32_t shiftamnt = ((!!moreopaquep)*8); + const int32_t dimprod = xdim*ydim; + int32_t i = 0; #ifdef CLASSIC_SLICE_BY_4 - for (; i>2); + paletteSetFade(palfadedelta>>2); + static uint32_t lastpalettesum=0; + uint32_t newpalettesum = XXH32((uint8_t *) curpalettefaded, sizeof(curpalettefaded), sizeof(curpalettefaded)); + + palsumdidchange = (newpalettesum != lastpalettesum); + + if (palsumdidchange || newpalettesum != g_lastpalettesum) { - static uint32_t lastpalettesum=0; - uint32_t newpalettesum = XXH32((uint8_t *) curpalettefaded, sizeof(curpalettefaded), sizeof(curpalettefaded)); - - palsumdidchange = (newpalettesum != lastpalettesum); - - if (palsumdidchange || newpalettesum != g_lastpalettesum) - { - // if ((flags&1) == 0) - videoUpdatePalette(0, 256); - } - - g_lastpalettesum = lastpalettesum = newpalettesum; + // if ((flags&1) == 0) + videoUpdatePalette(0, 256); } + g_lastpalettesum = lastpalettesum = newpalettesum; + #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { // Only reset the textures if the corresponding preserve flags are clear and // either (a) the new palette is different to the last, or (b) the brightness @@ -757,7 +755,7 @@ void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags) if (!(flags&8) && doinvalidate) gltexinvalidatetype(INVALIDATE_ART_NON_INDEXED); #ifdef POLYMER - if ((getrendermode() == REND_POLYMER) && doinvalidate) + if ((videoGetRenderMode() == REND_POLYMER) && doinvalidate) polymer_texinvalidate(); #endif } @@ -770,7 +768,7 @@ void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags) } } -palette_t getpal(int32_t col) +palette_t paletteGetColor(int32_t col) { if (!gammabrightness) { @@ -782,21 +780,15 @@ palette_t getpal(int32_t col) return curpalette[col]; } -static void setpalettefade_calc(uint8_t offset) +static void paletteSetFade(uint8_t offset) { - int32_t i; - palette_t p; - - for (i=0; i<256; i++) + for (native_t i=0; i<256; i++) { - p = getpal(i); + palette_t const p = paletteGetColor(i); - curpalettefaded[i].b = - p.b + (((palfadergb.b - p.b) * offset) >> 8); - curpalettefaded[i].g = - p.g + (((palfadergb.g - p.g) * offset) >> 8); - curpalettefaded[i].r = - p.r + (((palfadergb.r - p.r) * offset) >> 8); + curpalettefaded[i].b = p.b + (((palfadergb.b - p.b) * offset) >> 8); + curpalettefaded[i].g = p.g + (((palfadergb.g - p.g) * offset) >> 8); + curpalettefaded[i].r = p.r + (((palfadergb.r - p.r) * offset) >> 8); curpalettefaded[i].f = 0; } } @@ -806,7 +798,7 @@ static void setpalettefade_calc(uint8_t offset) // // setpalettefade // -void setpalettefade(uint8_t r, uint8_t g, uint8_t b, uint8_t offset) +void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset) { palfadergb.r = r; palfadergb.g = g; @@ -817,15 +809,13 @@ void setpalettefade(uint8_t r, uint8_t g, uint8_t b, uint8_t offset) #endif palfadedelta = offset; - setpalettefade_calc(offset); + paletteSetFade(offset); - { - static uint32_t lastpalettesum=0; - uint32_t newpalettesum = XXH32((uint8_t *) curpalettefaded, sizeof(curpalettefaded), sizeof(curpalettefaded)); + static uint32_t lastpalettesum=0; + uint32_t newpalettesum = XXH32((uint8_t *) curpalettefaded, sizeof(curpalettefaded), sizeof(curpalettefaded)); - if (newpalettesum != lastpalettesum || newpalettesum != g_lastpalettesum) - videoUpdatePalette(0, 256); + if (newpalettesum != lastpalettesum || newpalettesum != g_lastpalettesum) + videoUpdatePalette(0, 256); - g_lastpalettesum = lastpalettesum = newpalettesum; - } + g_lastpalettesum = lastpalettesum = newpalettesum; } diff --git a/source/build/src/polymer.cpp b/source/build/src/polymer.cpp index 2ab811f5d..f7f6a84e7 100644 --- a/source/build/src/polymer.cpp +++ b/source/build/src/polymer.cpp @@ -1068,7 +1068,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, fix16_t d float pos[3]; pthtyp* pth; - if (getrendermode() == REND_CLASSIC) return; + if (videoGetRenderMode() == REND_CLASSIC) return; videoBeginDrawing(); diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index fa2b1465e..3828ca4e9 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -291,7 +291,7 @@ static void bind_2d_texture(GLuint texture, int filter) void gltexapplyprops(void) { - if (getrendermode() == REND_CLASSIC) + if (videoGetRenderMode() == REND_CLASSIC) return; if (glinfo.maxanisotropy > 1.f) @@ -544,7 +544,7 @@ void polymost_resetVertexPointers() void polymost_disableProgram() { - if (getrendermode() == REND_POLYMOST) + if (videoGetRenderMode() == REND_POLYMOST) { useShaderProgram(0); } @@ -552,7 +552,7 @@ void polymost_disableProgram() void polymost_resetProgram() { - if (getrendermode() == REND_POLYMOST) + if (videoGetRenderMode() == REND_POLYMOST) { if (r_enablepolymost2) { @@ -1142,7 +1142,7 @@ static void fogcalc_old(int32_t shade, int32_t vis) static inline void fogcalc(int32_t tile, int32_t shade, int32_t vis, int32_t pal) { - if (shade > 0 && getrendermode() == REND_POLYMOST && r_usetileshades == 1 && + if (shade > 0 && videoGetRenderMode() == REND_POLYMOST && r_usetileshades == 1 && !(globalflags & GLOBAL_NO_GL_TILESHADES) && (!usehightile || !hicfindsubst(tile, pal, hictinting[pal].f & HICTINT_ALWAYSUSEART)) && (!usemodels || md_tilehasmodel(tile, pal) < 0)) @@ -2741,7 +2741,7 @@ static void polymost2_drawVBO(GLenum mode, static void polymost_updatePalette() { - if (getrendermode() != REND_POLYMOST) + if (videoGetRenderMode() != REND_POLYMOST) { return; } @@ -2877,7 +2877,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 if (skyclamphack) method |= DAMETH_CLAMPED; - pthtyp *pth = our_texcache_fetch(method | (getrendermode() == REND_POLYMOST && r_useindexedcolortextures ? PTH_INDEXED : 0)); + pthtyp *pth = our_texcache_fetch(method | (videoGetRenderMode() == REND_POLYMOST && r_useindexedcolortextures ? PTH_INDEXED : 0)); if (!pth) { @@ -2902,7 +2902,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 // If we aren't rendmode 3, we're in Polymer, which means this code is // used for rotatesprite only. Polymer handles all the material stuff, // just submit the geometry and don't mess with textures. - if (getrendermode() == REND_POLYMOST) + if (videoGetRenderMode() == REND_POLYMOST) { glBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : blankTextureID); @@ -2927,7 +2927,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 #ifdef USE_GLEXT int32_t texunits = GL_TEXTURE0; - if (getrendermode() == REND_POLYMOST) + if (videoGetRenderMode() == REND_POLYMOST) { polymost_updatePalette(); texunits += 4; @@ -2943,7 +2943,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 detailpth && detailpth->hicr && detailpth->hicr->palnum == DETAILPAL) { polymost_useDetailMapping(true); - polymost_setupdetailtexture(getrendermode() == REND_POLYMOST ? GL_TEXTURE3 : ++texunits, detailpth->glpic); + polymost_setupdetailtexture(videoGetRenderMode() == REND_POLYMOST ? GL_TEXTURE3 : ++texunits, detailpth->glpic); glMatrixMode(GL_TEXTURE); glLoadIdentity(); @@ -2969,7 +2969,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 glowpth && glowpth->hicr && (glowpth->hicr->palnum == GLOWPAL)) { polymost_useGlowMapping(true); - polymost_setupglowtexture(getrendermode() == REND_POLYMOST ? GL_TEXTURE4 : ++texunits, glowpth->glpic); + polymost_setupglowtexture(videoGetRenderMode() == REND_POLYMOST ? GL_TEXTURE4 : ++texunits, glowpth->glpic); glActiveTexture(GL_TEXTURE0); } } @@ -3013,7 +3013,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 float pc[4]; #ifdef POLYMER - if (getrendermode() == REND_POLYMER && pr_artmapping && !(globalflags & GLOBAL_NO_GL_TILESHADES) && polymer_eligible_for_artmap(globalpicnum, pth)) + if (videoGetRenderMode() == REND_POLYMER && pr_artmapping && !(globalflags & GLOBAL_NO_GL_TILESHADES) && polymer_eligible_for_artmap(globalpicnum, pth)) pc[0] = pc[1] = pc[2] = 1.0f; else #endif @@ -3252,7 +3252,7 @@ do } #ifdef USE_GLEXT - if (getrendermode() != REND_POLYMOST) + if (videoGetRenderMode() != REND_POLYMOST) { while (texunits > GL_TEXTURE0) { @@ -3283,7 +3283,7 @@ do glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - if (getrendermode() != REND_POLYMOST) + if (videoGetRenderMode() != REND_POLYMOST) return; if (pth && !(pth->flags & PTH_INDEXED)) @@ -5189,7 +5189,7 @@ static void polymost_initmosts(const float * px, const float * py, int const n) void polymost_drawrooms() { - if (getrendermode() == REND_CLASSIC) return; + if (videoGetRenderMode() == REND_CLASSIC) return; videoBeginDrawing(); frameoffset = frameplace + windowxy1.y*bytesperline + windowxy1.x; @@ -6759,7 +6759,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a, // In Polymost, we don't care if the model is very big #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { vec3f_t const vec2 = { fglobalposx + (gcosang * vec1.z - gsinang * vec1.x) * 2560.f, fglobalposy + (gsinang * vec1.z + gcosang * vec1.x) * 2560.f, @@ -6794,7 +6794,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a, glox1 = -1; //Force fullscreen (glox1=-1 forces it to restore) } - if (getrendermode() < REND_POLYMER) + if (videoGetRenderMode() < REND_POLYMER) { glMatrixMode(GL_PROJECTION); Bmemset(m, 0, sizeof(m)); @@ -6849,7 +6849,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a, polymost_setFogEnabled(false); - if (getrendermode() == REND_POLYMOST) + if (videoGetRenderMode() == REND_POLYMOST) polymost_mddraw(&tspr); # ifdef POLYMER else @@ -6976,7 +6976,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16 handle_blend(!!(dastat & RS_TRANS1), dablend, !!(dastat & RS_TRANS2)); #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { pr_normalmapping = 0; polymer_inb4rotatesprite(picnum, dapalnum, dashade, method); @@ -7114,7 +7114,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16 } #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { # ifdef USE_GLEXT r_detailmapping = olddetailmapping; @@ -7324,7 +7324,7 @@ void polymost_fillpolygon(int32_t npoints) if (gloy1 != -1) setpolymost2dview(); //disables blending, texturing, and depth testing glEnable(GL_ALPHA_TEST); glEnable(GL_TEXTURE_2D); - pthtyp *pth = our_texcache_fetch(DAMETH_NOMASK | (getrendermode() == REND_POLYMOST && r_useindexedcolortextures ? PTH_INDEXED : 0)); + pthtyp *pth = our_texcache_fetch(DAMETH_NOMASK | (videoGetRenderMode() == REND_POLYMOST && r_useindexedcolortextures ? PTH_INDEXED : 0)); glBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : blankTextureID); if (pth && !(pth->flags & PTH_INDEXED)) { @@ -7366,7 +7366,7 @@ int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, i int32_t i; pthtyp *pth; - if (getrendermode() < REND_POLYMOST || !in3dmode()) + if (videoGetRenderMode() < REND_POLYMOST || !in3dmode()) return -1; if (!glinfo.texnpot) @@ -7399,7 +7399,7 @@ int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, i int32_t const ousehightile = usehightile; usehightile = usehitile && usehightile; - pth = texcache_fetch(wallnum, 0, 0, DAMETH_CLAMPED | (getrendermode() == REND_POLYMOST && r_useindexedcolortextures ? PTH_INDEXED : 0)); + pth = texcache_fetch(wallnum, 0, 0, DAMETH_CLAMPED | (videoGetRenderMode() == REND_POLYMOST && r_useindexedcolortextures ? PTH_INDEXED : 0)); if (usehightile) loadedhitile[wallnum>>3] |= (1<<(wallnum&7)); usehightile = ousehightile; @@ -7530,7 +7530,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba bricolor(&p, col); bricolor(&b, arbackcol); - if (getrendermode() < REND_POLYMOST || !in3dmode() || (!polymosttext && gen_font_glyph_tex() < 0)) + if (videoGetRenderMode() < REND_POLYMOST || !in3dmode() || (!polymosttext && gen_font_glyph_tex() < 0)) return -1; else glBindTexture(GL_TEXTURE_2D, polymosttext); @@ -7849,7 +7849,7 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype) // while sprites are clamped int32_t mid; - if (getrendermode() < REND_POLYMOST) return; + if (videoGetRenderMode() < REND_POLYMOST) return; if ((palookup[dapalnum] == NULL) && (dapalnum < (MAXPALOOKUPS - RESERVEDPALS))) return;//dapalnum = 0; diff --git a/source/build/src/screenshot.cpp b/source/build/src/screenshot.cpp index 53d28d652..13cb9ff20 100644 --- a/source/build/src/screenshot.cpp +++ b/source/build/src/screenshot.cpp @@ -47,7 +47,7 @@ static void screencapture_end(char *fn, BFILE** filptr) } # ifdef USE_OPENGL -# define HICOLOR (getrendermode() >= REND_POLYMOST && in3dmode()) +# define HICOLOR (videoGetRenderMode() >= REND_POLYMOST && in3dmode()) # else # define HICOLOR 0 # endif diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index 8806f7968..4296be583 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -1496,7 +1496,7 @@ void setvideomode_sdlcommonpost(int32_t x, int32_t y, int32_t c, int32_t fs, int } #endif - setpalettefade(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta); + videoFadePalette(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta); if (regrab) mouseGrabInput(g_mouseLockedToWindow); diff --git a/source/build/src/texcache.cpp b/source/build/src/texcache.cpp index bec949aab..17367b6e5 100644 --- a/source/build/src/texcache.cpp +++ b/source/build/src/texcache.cpp @@ -117,7 +117,7 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3 if ((si = hicfindskybox(dapicnum, dapalnum)) == NULL) return NULL; - if (!r_usetileshades || (globalflags & GLOBAL_NO_GL_TILESHADES) || getrendermode() != REND_POLYMOST) + if (!r_usetileshades || (globalflags & GLOBAL_NO_GL_TILESHADES) || videoGetRenderMode() != REND_POLYMOST) dashade = 0; if (!si) diff --git a/source/build/src/tiles.cpp b/source/build/src/tiles.cpp index 40ac08156..9b7afe797 100644 --- a/source/build/src/tiles.cpp +++ b/source/build/src/tiles.cpp @@ -116,7 +116,7 @@ void E_MapArt_Clear(void) //POGOTODO: review this to ensure we're not invalidating more than we have to gltexinvalidatetype(INVALIDATE_ART); # ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_texinvalidate(); # endif #endif @@ -173,7 +173,7 @@ void E_MapArt_Setup(const char *filename) //POGOTODO: review this to ensure we're not invalidating more than we have to gltexinvalidatetype(INVALIDATE_ART); # ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_texinvalidate(); # endif #endif @@ -601,7 +601,7 @@ void loadtile(int16_t tilenume) E_LoadTileIntoBuffer(tilenume, dasiz, (char *) waloff[tilenume]); #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { //POGOTODO: this type stuff won't be necessary down the line -- review this int type; diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index b0ceef079..839a67ede 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -614,7 +614,7 @@ void A_DeleteSprite(int spriteNum) } #ifdef POLYMER - if (actor[spriteNum].lightptr != NULL && getrendermode() == REND_POLYMER) + if (actor[spriteNum].lightptr != NULL && videoGetRenderMode() == REND_POLYMER) A_DeleteLight(spriteNum); #endif @@ -807,7 +807,7 @@ void G_AddGameLight(int lightRadius, int spriteNum, int zOffset, int lightRange, #ifdef POLYMER spritetype *s = &sprite[spriteNum]; - if (getrendermode() != REND_POLYMER || pr_lighting != 1) + if (videoGetRenderMode() != REND_POLYMER || pr_lighting != 1) return; if (actor[spriteNum].lightptr == NULL) @@ -7851,7 +7851,7 @@ static void G_DoEffectorLights(void) // STATNUM 14 #ifdef POLYMER case SE_49_POINT_LIGHT: { - if (!A_CheckSpriteFlags(i, SFLAG_NOLIGHT) && getrendermode() == REND_POLYMER && + if (!A_CheckSpriteFlags(i, SFLAG_NOLIGHT) && videoGetRenderMode() == REND_POLYMER && !(A_CheckSpriteFlags(i, SFLAG_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384)) { if (actor[i].lightptr == NULL) @@ -7917,7 +7917,7 @@ static void G_DoEffectorLights(void) // STATNUM 14 } case SE_50_SPOT_LIGHT: { - if (!A_CheckSpriteFlags(i, SFLAG_NOLIGHT) && getrendermode() == REND_POLYMER && + if (!A_CheckSpriteFlags(i, SFLAG_NOLIGHT) && videoGetRenderMode() == REND_POLYMER && !(A_CheckSpriteFlags(i, SFLAG_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384)) { if (actor[i].lightptr == NULL) @@ -8323,7 +8323,7 @@ int A_CheckSwitchTile(int spriteNum) void G_RefreshLights(void) { #ifdef POLYMER - if (Numsprites && getrendermode() == REND_POLYMER) + if (Numsprites && videoGetRenderMode() == REND_POLYMER) { int statNum = 0; diff --git a/source/duke3d/src/anim.cpp b/source/duke3d/src/anim.cpp index b152e0458..497e829d1 100644 --- a/source/duke3d/src/anim.cpp +++ b/source/duke3d/src/anim.cpp @@ -238,7 +238,7 @@ int32_t Anim_Play(const char *fn) #ifdef USE_LIBVPX uint16_t framenum = 0; - while (getrendermode() >= REND_POLYMOST) // if, really + while (videoGetRenderMode() >= REND_POLYMOST) // if, really { char const * dot = Bstrrchr(fn, '.'); if (!dot) @@ -462,7 +462,7 @@ int32_t Anim_Play(const char *fn) goto end_anim; } - setbasepal(ANIMPAL, ANIM_GetPalette()); + paletteSetColorTable(ANIMPAL, ANIM_GetPalette()); // setpalette(0L,256L,tempbuf); // setbrightness(ud.brightness>>2,tempbuf,2); diff --git a/source/duke3d/src/astub.cpp b/source/duke3d/src/astub.cpp index 874614dd2..ca97167d4 100644 --- a/source/duke3d/src/astub.cpp +++ b/source/duke3d/src/astub.cpp @@ -2358,7 +2358,7 @@ static void m32_showmouse(void) else col = whitecol + mousecol; #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { push_nofog(); glDisable(GL_TEXTURE_2D); @@ -2403,7 +2403,7 @@ static void m32_showmouse(void) } #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { pop_nofog(); polymost_useColorOnly(false); @@ -2512,7 +2512,7 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i static inline void pushDisableFog(void) { #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { glPushAttrib(GL_ENABLE_BIT); polymost_setFogEnabled(false); @@ -2523,7 +2523,7 @@ static inline void pushDisableFog(void) static inline void popDisableFog(void) { #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { glPopAttrib(); } @@ -3273,7 +3273,7 @@ static int32_t OnSelectTile(int32_t tileNum) setpolymost2dview(); #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { glEnable(GL_TEXTURE_2D); } @@ -3507,7 +3507,7 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i #ifdef USE_OPENGL setpolymost2dview(); - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { glEnable(GL_TEXTURE_2D); @@ -3588,7 +3588,7 @@ restart: videoEndDrawing(); videoShowFrame(1); #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && lazyselector) + if (videoGetRenderMode() >= REND_POLYMOST && lazyselector) glDrawBuffer(GL_BACK); #endif return 1; @@ -3603,7 +3603,7 @@ restart: tilescreen_drawrest(iSelected, showmsg); - if (getrendermode() >= REND_POLYMOST && in3dmode() && lazyselector) + if (videoGetRenderMode() >= REND_POLYMOST && in3dmode() && lazyselector) { if (runi==0) { @@ -3620,7 +3620,7 @@ restart: videoShowFrame(1); #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && lazyselector) + if (videoGetRenderMode() >= REND_POLYMOST && lazyselector) glDrawBuffer(GL_BACK); #endif @@ -6332,7 +6332,7 @@ static void Keys3d(void) brightness &= 15; g_videoGamma = 1.0 + ((float)brightness / 10.0); - setbrightness(brightness, 0, 0); + videoSetPalette(brightness, 0, 0); message("Brightness: %d/16", brightness+1); } @@ -10077,9 +10077,9 @@ void ExtPostInit(void) } if (!(duke3d_m32_globalflags & DUKE3D_NO_HARDCODED_FOGPALS)) - generatefogpals(); + paletteSetupDefaultFog(); - fillemptylookups(); + palettePostLoadLookups(); } void ExtUnInit(void) @@ -10180,7 +10180,7 @@ void ExtPreCheckKeys(void) // just before drawrooms #ifdef POLYMER if (sprite[i].lotag == 49) { - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { if (spritelightptr[i] == NULL) { @@ -10213,7 +10213,7 @@ void ExtPreCheckKeys(void) // just before drawrooms } if (sprite[i].lotag == 50) { - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { if (spritelightptr[i] == NULL) { @@ -10959,7 +10959,7 @@ void SetGamePalette(int32_t palid) if ((unsigned)palid >= MAXBASEPALS) palid = 0; - setbrightness(GAMMA_CALC, palid, 2); + videoSetPalette(GAMMA_CALC, palid, 2); } static void SearchSectors(int32_t dir) // <0: backwards, >=0: forwards diff --git a/source/duke3d/src/common.cpp b/source/duke3d/src/common.cpp index aa30139bd..1947051fe 100644 --- a/source/duke3d/src/common.cpp +++ b/source/duke3d/src/common.cpp @@ -1033,7 +1033,7 @@ void G_LoadLookups(void) if ((fp=kopen4loadfrommod("lookup.dat",1)) == -1) return; - j = loadlookups(fp); + j = paletteLoadLookupTable(fp); if (j < 0) { @@ -1056,7 +1056,7 @@ void G_LoadLookups(void) for (bssize_t k = 0; k < 768; k++) paldata[k] <<= 2; - setbasepal(basepalnum, paldata); + paletteSetColorTable(basepalnum, paldata); } kclose(fp); diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 3968bc6cb..0bf71a7d3 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -518,7 +518,7 @@ static void G_SE40(int32_t smoothratio) } #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x), CAMERA(pos.y), fix16_to_int(CAMERA(q16ang)), smoothratio); #endif drawrooms_q16(sprite[sprite2].x + x, sprite[sprite2].y + y, @@ -559,7 +559,7 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t q16horiz { if ((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) #ifdef POLYMER - && (getrendermode() != REND_POLYMER) + && (videoGetRenderMode() != REND_POLYMER) #endif ) { @@ -611,7 +611,7 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t q16horiz int32_t j = g_visibility; g_visibility = (j>>1) + (j>>2); - if (getrendermode() == REND_CLASSIC) + if (videoGetRenderMode() == REND_CLASSIC) { int32_t didmirror; @@ -699,7 +699,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) totalclocklock = totalclock; - if (pub > 0 || getrendermode() >= REND_POLYMOST) // JBF 20040101: redraw background always + if (pub > 0 || videoGetRenderMode() >= REND_POLYMOST) // JBF 20040101: redraw background always { #ifndef EDUKE32_TOUCH_DEVICES if (ud.screen_size >= 8) @@ -710,7 +710,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) VM_OnEvent(EVENT_DISPLAYSTART, pPlayer->i, playerNum); - if (ud.overhead_on == 2 || ud.show_help || (pPlayer->cursectnum == -1 && getrendermode() != REND_CLASSIC)) + if (ud.overhead_on == 2 || ud.show_help || (pPlayer->cursectnum == -1 && videoGetRenderMode() != REND_CLASSIC)) return; if (r_usenewaspect) @@ -755,7 +755,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) G_SE40(smoothRatio); #endif #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_setanimatesprites(G_DoSpriteAnimations, pSprite->x, pSprite->y, fix16_to_int(CAMERA(q16ang)), smoothRatio); #endif yax_preparedrawrooms(); @@ -772,7 +772,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) int pixelDoubling = 0; int const vr = divscale22(1, sprite[pPlayer->i].yrepeat + 28); - int screenTilting = (getrendermode() == REND_CLASSIC && ((ud.screen_tilting && pPlayer->rotscrnang + int screenTilting = (videoGetRenderMode() == REND_CLASSIC && ((ud.screen_tilting && pPlayer->rotscrnang #ifdef SPLITSCREEN_MOD_HACKS && !g_fakeMultiMode #endif @@ -794,7 +794,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) if (waloff[TILE_SAVESHOT] == 0) allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]); - if (getrendermode() == REND_CLASSIC) + if (videoGetRenderMode() == REND_CLASSIC) videoSetTarget(TILE_SAVESHOT, 200, 320); } else if (screenTilting) @@ -883,7 +883,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5); } } - else if (getrendermode() >= REND_POLYMOST && (ud.screen_tilting + else if (videoGetRenderMode() >= REND_POLYMOST && (ud.screen_tilting #ifdef SPLITSCREEN_MOD_HACKS && !g_fakeMultiMode #endif @@ -894,7 +894,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) #endif pPlayer->orotscrnang = pPlayer->rotscrnang; } - else if (ud.detail && getrendermode()==REND_CLASSIC) + else if (ud.detail && videoGetRenderMode()==REND_CLASSIC) { pixelDoubling = 1; g_halveScreenArea = 1; @@ -1021,7 +1021,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) G_SE40(smoothRatio); #endif #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x),CAMERA(pos.y),fix16_to_int(CAMERA(q16ang)),smoothRatio); #endif // for G_PrintCoords @@ -1051,7 +1051,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) invalidatetile(TILE_SAVESHOT, 0, 255); - if (getrendermode() == REND_CLASSIC) + if (videoGetRenderMode() == REND_CLASSIC) { videoRestoreTarget(); // walock[TILE_SAVESHOT] = 1; @@ -3639,7 +3639,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo continue; case CHAIR3__STATIC: #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) + if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { t->cstat &= ~4; break; @@ -3875,7 +3875,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo break; case RPG__STATIC: #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && + if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags & SPREXT_NOTMD)) { int32_t v = getangle(t->xvel, t->zvel>>4); @@ -3891,7 +3891,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo case RECON__STATIC: #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) + if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { t->cstat &= ~4; break; @@ -3989,7 +3989,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo if (pSprite->owner == -1) { #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pSprite->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) + if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pSprite->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { frameOffset = 0; t->cstat &= ~4; @@ -4035,7 +4035,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo { if ((!g_netServer && ud.multimode < 2) || ((g_netServer || ud.multimode > 1) && playerNum == screenpeek)) { - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) t->cstat |= 16384; else { @@ -4045,7 +4045,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo } #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pSprite->picnum, t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) + if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pSprite->picnum, t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { frameOffset = 0; t->cstat &= ~4; @@ -4137,7 +4137,7 @@ PALONLY: l = klabs(l); #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pSprite->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) + if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pSprite->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { frameOffset = 0; t->cstat &= ~4; @@ -4239,7 +4239,7 @@ skip: if (ud.shadows && spritesortcnt < (maxspritesonscreen-2) #ifdef POLYMER - && !(getrendermode() == REND_POLYMER && pr_lighting != 0) + && !(videoGetRenderMode() == REND_POLYMER && pr_lighting != 0) #endif ) { @@ -4266,7 +4266,7 @@ skip: #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { if (usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0) { @@ -4338,7 +4338,7 @@ skip: break; case PLAYERONWATER__STATIC: #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pSprite->picnum,pSprite->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) + if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pSprite->picnum,pSprite->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { frameOffset = 0; t->cstat &= ~4; @@ -4396,7 +4396,7 @@ skip: case CAMERA1__STATIC: case RAT__STATIC: #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pSprite->picnum,pSprite->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) + if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pSprite->picnum,pSprite->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { t->cstat &= ~4; break; @@ -5714,14 +5714,12 @@ static void G_PostLoadPalette(void) } if (!(duke3d_globalflags & DUKE3D_NO_HARDCODED_FOGPALS)) - generatefogpals(); + paletteSetupDefaultFog(); if (!(duke3d_globalflags & DUKE3D_NO_PALETTE_CHANGES)) - { - E_ReplaceTransparentColorWithBlack(); - } + paletteFixTranslucencyMask(); - fillemptylookups(); + palettePostLoadLookups(); } #define SETFLAG(Tilenum, Flag) g_tile[Tilenum].flags |= Flag @@ -6584,7 +6582,7 @@ int app_main(int argc, char const * const * argv) ud.config.ScreenBPP = bpp[bppIdx]; } - setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); + videoSetPalette(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); S_MusicStartup(); S_SoundStartup(); @@ -6821,7 +6819,7 @@ MAIN_LOOP_RESTART: : 65536; G_DrawRooms(screenpeek, smoothRatio); - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) G_DrawBackground(); G_DisplayRest(smoothRatio); } diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index af7c6fec2..f05aa6514 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1240,7 +1240,7 @@ LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int32_t sec G_DoInterpolations(smoothratio); G_HandleMirror(vec.x, vec.y, vec.z, a, horiz, smoothratio); #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_setanimatesprites(G_DoSpriteAnimations, vec.x, vec.y, fix16_to_int(a), smoothratio); #endif yax_preparedrawrooms(); @@ -3849,7 +3849,7 @@ nullquote: { int32_t params[4]; Gv_FillWithVars(params); - setpalettefade(params[0], params[1], params[2], params[3]); + videoFadePalette(params[0], params[1], params[2], params[3]); } continue; diff --git a/source/duke3d/src/m32common.cpp b/source/duke3d/src/m32common.cpp index c19d651b7..33e4c4d63 100644 --- a/source/duke3d/src/m32common.cpp +++ b/source/duke3d/src/m32common.cpp @@ -564,7 +564,7 @@ int32_t map_undoredo(int32_t dir) Bassert(Numsprites == mapstate->num[2]); #ifdef POLYMER - if (in3dmode() && getrendermode() == REND_POLYMER) + if (in3dmode() && videoGetRenderMode() == REND_POLYMER) polymer_loadboard(); #endif #ifdef YAX_ENABLE diff --git a/source/duke3d/src/m32structures.cpp b/source/duke3d/src/m32structures.cpp index 7752abdc0..8e01803b8 100644 --- a/source/duke3d/src/m32structures.cpp +++ b/source/duke3d/src/m32structures.cpp @@ -416,7 +416,7 @@ static int32_t __fastcall VM_AccessTsprite(int32_t how, int32_t lVar1, int32_t l } else { -// check whether getrendermode() == REND_POLYMER ? +// check whether videoGetRenderMode() == REND_POLYMER ? if ((unsigned)i >= PR_MAXLIGHTS) { M32_ERROR("invalid light index (%d)", i); diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 65b430282..21267dd55 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -1922,10 +1922,10 @@ static void Menu_Pre(MenuID_t cm) #ifdef USE_OPENGL case MENU_DISPLAYSETUP: - if (getrendermode() == REND_CLASSIC) + if (videoGetRenderMode() == REND_CLASSIC) MenuMenu_ChangeEntryList(M_DISPLAYSETUP, MEL_DISPLAYSETUP); #ifdef POLYMER - else if (getrendermode() == REND_POLYMER) + else if (videoGetRenderMode() == REND_POLYMER) MenuMenu_ChangeEntryList(M_DISPLAYSETUP, MEL_DISPLAYSETUP_GL_POLYMER); #endif else @@ -1948,13 +1948,13 @@ static void Menu_Pre(MenuID_t cm) (ud.screen_size > 8 && !(ud.statusbarflags & STATUSBAR_NOSHRINK)) * ((ud.screen_size - 8) >> 2) -1; - if (getrendermode() != REND_CLASSIC) + if (videoGetRenderMode() != REND_CLASSIC) { //POGOTODO: allow setting anisotropy again while r_useindexedcolortextures is set when support is added down the line // don't allow setting anisotropy or changing palette emulation while in POLYMOST and r_useindexedcolortextures is enabled - MenuEntry_DisableOnCondition(&ME_DISPLAYSETUP_ANISOTROPY, getrendermode() == REND_POLYMOST && r_useindexedcolortextures); + MenuEntry_DisableOnCondition(&ME_DISPLAYSETUP_ANISOTROPY, videoGetRenderMode() == REND_POLYMOST && r_useindexedcolortextures); #ifdef EDUKE32_SIMPLE_MENU - MenuEntry_DisableOnCondition(&ME_DISPLAYSETUP_PALETTEEMULATION, getrendermode() == REND_POLYMOST && r_useindexedcolortextures); + MenuEntry_DisableOnCondition(&ME_DISPLAYSETUP_PALETTEEMULATION, videoGetRenderMode() == REND_POLYMOST && r_useindexedcolortextures); #endif for (i = (int32_t) ARRAY_SIZE(MEOSV_DISPLAYSETUP_ANISOTROPY) - 1; i >= 0; --i) @@ -1980,7 +1980,7 @@ static void Menu_Pre(MenuID_t cm) MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_GLOWTEX, !usehightile); # endif // don't allow changing palette emulation while in POLYMOST and r_useindexedcolortextures is enabled - MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_PALETTEEMULATION, getrendermode() == REND_POLYMOST && r_useindexedcolortextures); + MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_PALETTEEMULATION, videoGetRenderMode() == REND_POLYMOST && r_useindexedcolortextures); break; #endif @@ -1993,7 +1993,7 @@ static void Menu_Pre(MenuID_t cm) MenuEntry_DisableOnCondition(&ME_VIDEOSETUP_APPLY, (xdim == resolution[nr].xdim && ydim == resolution[nr].ydim && - getrendermode() == newrendermode && fullscreen == newfullscreen + videoGetRenderMode() == newrendermode && fullscreen == newfullscreen && vsync == newvsync ) || (newrendermode != REND_CLASSIC && resolution[nr].bppmax <= 8)); @@ -2237,7 +2237,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin) break; case MENU_RESETPLAYER: - fade_screen_black(1); + videoFadeToBlack(1); Bsprintf(tempbuf, "Load last game:\n\"%s\"" #ifndef EDUKE32_ANDROID_MENU "\n(Y/N)" @@ -2375,7 +2375,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin) #endif case MENU_SAVECLEANVERIFY: - fade_screen_black(1); + videoFadeToBlack(1); if (g_oldSaveCnt) { @@ -2393,7 +2393,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin) case MENU_LOADVERIFY: { - fade_screen_black(1); + videoFadeToBlack(1); menusave_t & msv = g_menusaves[M_LOAD.currentEntry]; if (msv.isOldVer) { @@ -2417,7 +2417,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin) } case MENU_SAVEVERIFY: - fade_screen_black(1); + videoFadeToBlack(1); mgametextcenter(origin.x, origin.y + (90<<16), "Overwrite previous saved game?" #ifndef EDUKE32_ANDROID_MENU "\n(Y/N)" @@ -2428,7 +2428,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin) case MENU_LOADDELVERIFY: case MENU_SAVEDELVERIFY: { - fade_screen_black(1); + videoFadeToBlack(1); menusave_t & msv = cm == MENU_LOADDELVERIFY ? g_menusaves[M_LOAD.currentEntry] : g_menusaves[M_SAVE.currentEntry-1]; Bsprintf(tempbuf, "Delete saved game:\n\"%s\"?" #ifndef EDUKE32_ANDROID_MENU @@ -2440,7 +2440,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin) } case MENU_NEWVERIFY: - fade_screen_black(1); + videoFadeToBlack(1); mgametextcenter(origin.x, origin.y + (90<<16), "Abort this game?" #ifndef EDUKE32_ANDROID_MENU "\n(Y/N)" @@ -2450,7 +2450,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin) case MENU_QUIT: case MENU_QUIT_INGAME: - fade_screen_black(1); + videoFadeToBlack(1); mgametextcenter(origin.x, origin.y + (90<<16), "Are you sure you want to quit?" #ifndef EDUKE32_ANDROID_MENU "\n(Y/N)" @@ -2459,7 +2459,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin) break; case MENU_QUITTOTITLE: - fade_screen_black(1); + videoFadeToBlack(1); mgametextcenter(origin.x, origin.y + (90<<16), "End game and return to title screen?" #ifndef EDUKE32_ANDROID_MENU "\n(Y/N)" @@ -3032,7 +3032,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry) if (entry == &ME_VIDEOSETUP_APPLY) { resolution_t p = { xdim, ydim, fullscreen, bpp, 0 }; - int32_t prend = getrendermode(); + int32_t prend = videoGetRenderMode(); int32_t pvsync = vsync; resolution_t n = { resolution[newresolution].xdim, resolution[newresolution].ydim, @@ -3094,7 +3094,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry) g_videoBrightness = DEFAULT_BRIGHTNESS; ud.brightness = 0; r_ambientlight = r_ambientlightrecip = 1.f; - setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); + videoSetPalette(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); } else if (entry == &ME_KEYBOARDSETUP_RESET) CONFIG_SetDefaultKeys(keydefaults); @@ -3352,11 +3352,11 @@ static int32_t Menu_EntryRangeFloatDidModify(MenuEntry_t *entry) if (entry == &ME_COLCORR_GAMMA) { ud.brightness = GAMMA_CALC<<2; - setbrightness(ud.brightness>>2, g_player[myconnectindex].ps->palette, 0); + videoSetPalette(ud.brightness>>2, g_player[myconnectindex].ps->palette, 0); } else if (entry == &ME_COLCORR_CONTRAST || entry == &ME_COLCORR_BRIGHTNESS) { - setbrightness(ud.brightness>>2, g_player[myconnectindex].ps->palette, 0); + videoSetPalette(ud.brightness>>2, g_player[myconnectindex].ps->palette, 0); } return 0; @@ -4054,7 +4054,7 @@ static void Menu_AboutToStartDisplaying(Menu_t * m) break; } } - newrendermode = getrendermode(); + newrendermode = videoGetRenderMode(); newfullscreen = fullscreen; newvsync = vsync; break; @@ -6828,7 +6828,7 @@ void M_DisplayMenus(void) // need EVENT_DISPLAYMENUBACKGROUND here if (!KXDWN && ((g_player[myconnectindex].ps->gm&MODE_GAME) || ud.recstat==2) && backgroundOK) - fade_screen_black(1); + videoFadeToBlack(1); if (Menu_UpdateScreenOK(g_currentMenu)) G_UpdateScreenArea(); @@ -6875,7 +6875,7 @@ void M_DisplayMenus(void) // hack; need EVENT_DISPLAYMENUBACKGROUND above if (KXDWN && ((g_player[myconnectindex].ps->gm&MODE_GAME) || ud.recstat==2 || m_parentMenu != NULL) && backgroundOK) - fade_screen_black(1); + videoFadeToBlack(1); // Display the menu, with a transition animation if applicable. if (totalclock < m_animation.start + m_animation.length) diff --git a/source/duke3d/src/menus.h b/source/duke3d/src/menus.h index 7a7adcdc8..f719da0f1 100644 --- a/source/duke3d/src/menus.h +++ b/source/duke3d/src/menus.h @@ -481,7 +481,7 @@ extern int32_t m_mouselastactivity; extern int32_t m_mousewake_watchpoint, m_menuchange_watchpoint; // alpha increments of 3 --> 255 / 3 = 85 --> round up to power of 2 --> 128 --> divide by 2 --> 64 alphatabs required // use 16 anyway :P -# define MOUSEUSEALPHA (getrendermode() != REND_CLASSIC || numalphatabs >= 15) +# define MOUSEUSEALPHA (videoGetRenderMode() != REND_CLASSIC || numalphatabs >= 15) # define MOUSEALPHA (MOUSEUSEALPHA ? clamp((totalclock - m_mouselastactivity - 90)*3, 0, 255) : 0) # define CURSORALPHA (MOUSEUSEALPHA ? clamp((totalclock - m_mouselastactivity - 90)*2 + (255/3), (255/3), 255) : 255/3) # define MOUSEACTIVECONDITION (totalclock - m_mouselastactivity < M_MOUSETIMEOUT) diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index bde0c5c1f..ae2c87319 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -831,7 +831,7 @@ void onvideomodechange(int32_t newmode) palid = BASEPAL; #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { int32_t i = 0; @@ -848,7 +848,7 @@ void onvideomodechange(int32_t newmode) } #endif - setbrightness(ud.brightness>>2, palid, 0); + videoSetPalette(ud.brightness>>2, palid, 0); g_restorePalette = -1; g_crosshairSum = -1; } @@ -1518,11 +1518,11 @@ static int32_t osdcmd_cvar_set_game(osdfuncparm_t const * const parm) { ud.brightness = GAMMA_CALC; ud.brightness <<= 2; - setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); + videoSetPalette(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); } else if (!Bstrcasecmp(parm->name, "vid_brightness") || !Bstrcasecmp(parm->name, "vid_contrast")) { - setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); + videoSetPalette(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); } else if (!Bstrcasecmp(parm->name, "hud_scale") || !Bstrcasecmp(parm->name, "hud_statusbarmode") diff --git a/source/duke3d/src/osdfuncs.cpp b/source/duke3d/src/osdfuncs.cpp index 533e96852..57190922b 100644 --- a/source/duke3d/src/osdfuncs.cpp +++ b/source/duke3d/src/osdfuncs.cpp @@ -142,7 +142,7 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows) UNREFERENCED_PARAMETER(numcols); # ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && in3dmode()) + if (videoGetRenderMode() >= REND_POLYMOST && in3dmode()) { const int32_t i8n8 = OSD_SCALE(OSDCHAR_HEIGHT*numrows); // glPushAttrib(GL_FOG_BIT); diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 242fa9f28..4d2c46769 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -842,7 +842,7 @@ static int A_ShootCustom(int const spriteNum, int const projecTile, int shootAng DukePlayer_t *const pPlayer = playerNum >= 0 ? g_player[playerNum].ps : NULL; #ifdef POLYMER - if (getrendermode() == REND_POLYMER && pProj->flashcolor) + if (videoGetRenderMode() == REND_POLYMER && pProj->flashcolor) { int32_t x = ((sintable[(pSprite->ang + 512) & 2047]) >> 7), y = ((sintable[(pSprite->ang) & 2047]) >> 7); @@ -1749,7 +1749,7 @@ static void G_DrawTileScaled(int drawX, int drawY, int tileNum, int drawShade, i #endif #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(tileNum,drawPal) >= 0) + if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(tileNum,drawPal) >= 0) drawYOffset += (224<<16)-weapsc(224<<16); #endif rotatesprite(weapsc(drawX<<16) + (drawXOffset-weapsc(drawXOffset)), @@ -1777,7 +1777,7 @@ static void G_DrawWeaponTile(int weaponX, int weaponY, int weaponTile, int weapo palf = weaponPal; #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { if (weaponTile >= CHAINGUN + 1 && weaponTile <= CHAINGUN + 4) { @@ -1989,7 +1989,7 @@ void P_DisplayScuba(void) // this is a hack to hide the seam that appears between the two halves of the mask in GL #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) G_DrawTileScaled(44, (200 - tilesiz[SCUBAMASK].y), SCUBAMASK, 0, 2 + 16 + DRAWEAP_CENTER, scubaPal); #endif G_DrawTileScaled(43, (200 - tilesiz[SCUBAMASK].y), SCUBAMASK, 0, 2 + 16 + DRAWEAP_CENTER, scubaPal); diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index 56498045e..eee4ea096 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -448,7 +448,7 @@ void G_CacheMapData(void) if (k == MAXPALOOKUPS-RESERVEDPALS-1) break; #ifdef POLYMER - if (getrendermode() != REND_POLYMER || !polymer_havehighpalookup(0, k)) + if (videoGetRenderMode() != REND_POLYMER || !polymer_havehighpalookup(0, k)) #endif polymost_precache(i,k,type); } @@ -460,7 +460,7 @@ void G_CacheMapData(void) polymost_precache(i,GLOWPAL,type); #endif #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) { if (pr_specularmapping && !KB_KeyPressed(sc_Space)) polymost_precache(i,SPECULARPAL,type); diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index 4b7c5f162..bbe88c8b3 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -573,7 +573,7 @@ int32_t G_SavePlayer(savebrief_t & sv, bool isAutoSave) ud.user_map = G_HaveUserMap(); #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_resetlights(); #endif @@ -2239,7 +2239,7 @@ int32_t sv_updatestate(int32_t frominit) if (frominit) postloadplayer(0); #ifdef POLYMER - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_resetlights(); // must do it after polymer_loadboard() !!! #endif @@ -2372,10 +2372,10 @@ static void postloadplayer(int32_t savegamep) #ifdef POLYMER //9 - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_loadboard(); - // this light pointer nulling needs to be outside the getrendermode check + // this light pointer nulling needs to be outside the videoGetRenderMode check // because we might be loading the savegame using another renderer but // change to Polymer later for (i=0; i 99) { - if (shd && ud.screen_size == 4 && getrendermode() >= REND_POLYMOST && althud_shadows) + if (shd && ud.screen_size == 4 && videoGetRenderMode() >= REND_POLYMOST && althud_shadows) { for (i=0; i<=2; i++) rotatesprite_fs(sbarx(x+(-4+4*i)+1), sbyp1, sbscale, 0, THREEBYFIVE+dabuf[i]-'0', @@ -117,7 +117,7 @@ static void G_DrawInvNum(int32_t x, int32_t yofs, int32_t y, char num1, char ha, if (num1 > 9) { - if (shd && ud.screen_size == 4 && getrendermode() >= REND_POLYMOST && althud_shadows) + if (shd && ud.screen_size == 4 && videoGetRenderMode() >= REND_POLYMOST && althud_shadows) { rotatesprite_fs(sbarx(x+1), sbyp1, sbscale, 0, THREEBYFIVE+dabuf[0]-'0', 127, 4, POLYMOSTTRANS|sbits); rotatesprite_fs(sbarx(x+4+1), sbyp1, sbscale, 0, THREEBYFIVE+dabuf[1]-'0', 127, 4, POLYMOSTTRANS|sbits); @@ -359,7 +359,7 @@ static void G_DrawAltDigiNum(int32_t x, int32_t y, int32_t n, char s, int32_t cs for (k=0; k= REND_POLYMOST && althud_shadows) + if (shd && videoGetRenderMode() >= REND_POLYMOST && althud_shadows) rotatesprite_fs(sbarxr(c+j-1), sbary(y+1), sbscale, 0, p, 127, 4, cs|POLYMOSTTRANS2); rotatesprite_fs(sbarxr(c+j), sbary(y), sbscale, 0, p, s, althud_numberpal, cs); j -= tilesiz[p].x+1; @@ -371,7 +371,7 @@ static void G_DrawAltDigiNum(int32_t x, int32_t y, int32_t n, char s, int32_t cs for (k=0; k= REND_POLYMOST && althud_shadows) + if (shd && videoGetRenderMode() >= REND_POLYMOST && althud_shadows) rotatesprite_fs(sbarx(c+j+1), sbary(y+1), sbscale, 0, p, 127, 4, cs|POLYMOSTTRANS2); rotatesprite_fs(sbarx(c+j), sbary(y), sbscale, 0, p, s, althud_numberpal, cs); j += tilesiz[p].x+1; @@ -538,14 +538,14 @@ static int32_t G_GetMorale(int32_t p_i, int32_t snum) static inline void rotatesprite_althud(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat) { - if (getrendermode() >= REND_POLYMOST && althud_shadows) + if (videoGetRenderMode() >= REND_POLYMOST && althud_shadows) rotatesprite_(sbarx(sx+1), sbary(sy+1), z, a, picnum, 127, 4, dastat + POLYMOSTTRANS2, 0, 0, 0, 0, xdim - 1, ydim - 1); rotatesprite_(sbarx(sx), sbary(sy), z, a, picnum, dashade, dapalnum, dastat, 0, 0, 0, 0, xdim - 1, ydim - 1); } static inline void rotatesprite_althudr(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat) { - if (getrendermode() >= REND_POLYMOST && althud_shadows) + if (videoGetRenderMode() >= REND_POLYMOST && althud_shadows) rotatesprite_(sbarxr(sx + 1), sbary(sy + 1), z, a, picnum, 127, 4, dastat + POLYMOSTTRANS2, 0, 0, 0, 0, xdim - 1, ydim - 1); rotatesprite_(sbarxr(sx), sbary(sy), z, a, picnum, dashade, dapalnum, dastat, 0, 0, 0, 0, xdim - 1, ydim - 1); } @@ -581,7 +581,7 @@ void G_DrawStatusBar(int32_t snum) Bmemcpy(item_icons, iicons, sizeof(item_icons)); } - if (getrendermode() >= REND_POLYMOST) pus = NUMPAGES; // JBF 20040101: always redraw in GL + if (videoGetRenderMode() >= REND_POLYMOST) pus = NUMPAGES; // JBF 20040101: always redraw in GL if ((g_netServer || ud.multimode > 1) && ((g_gametypeFlags[ud.coop] & GAMETYPE_FRAGBAR))) { @@ -673,7 +673,7 @@ void G_DrawStatusBar(int32_t snum) if (i >= 0) rotatesprite_althud(231-o, hudoffset-21-2, sb16, 0, i, 0, 0, orient); - if (getrendermode() >= REND_POLYMOST && althud_shadows) + if (videoGetRenderMode() >= REND_POLYMOST && althud_shadows) minitextshade(292-30-o+1, hudoffset-10-3+1, "%", 127, 4, POLYMOSTTRANS+orient+ROTATESPRITE_MAX); minitext(292-30-o, hudoffset-10-3, "%", 6, orient+ROTATESPRITE_MAX); @@ -684,20 +684,20 @@ void G_DrawStatusBar(int32_t snum) if (j > 0) { - if (getrendermode() >= REND_POLYMOST && althud_shadows) + if (videoGetRenderMode() >= REND_POLYMOST && althud_shadows) minitextshade(288-30-o+1, hudoffset-20-3+1, "On", 127, 4, POLYMOSTTRANS+orient+ROTATESPRITE_MAX); minitext(288-30-o, hudoffset-20-3, "On", 0, orient+ROTATESPRITE_MAX); } else if ((uint32_t) j != 0x80000000) { - if (getrendermode() >= REND_POLYMOST && althud_shadows) + if (videoGetRenderMode() >= REND_POLYMOST && althud_shadows) minitextshade(284-30-o+1, hudoffset-20-3+1, "Off", 127, 4, POLYMOSTTRANS+orient+ROTATESPRITE_MAX); minitext(284-30-o, hudoffset-20-3, "Off", 2, orient+ROTATESPRITE_MAX); } if (p->inven_icon >= ICON_SCUBA) { - if (getrendermode() >= REND_POLYMOST && althud_shadows) + if (videoGetRenderMode() >= REND_POLYMOST && althud_shadows) minitextshade(284-35-o+1, hudoffset-20-3+1, "Auto", 127, 4, POLYMOSTTRANS+orient+ROTATESPRITE_MAX); minitext(284-35-o, hudoffset-20-3, "Auto", 2, orient+ROTATESPRITE_MAX); } @@ -1032,7 +1032,7 @@ void G_DrawBackground(void) if ((g_player[myconnectindex].ps->gm&MODE_GAME) == 0 && ud.recstat != 2) { - const int32_t MENUTILE = MENUSCREEN;//(getrendermode() == REND_CLASSIC ? MENUSCREEN : LOADSCREEN); + const int32_t MENUTILE = MENUSCREEN;//(videoGetRenderMode() == REND_CLASSIC ? MENUSCREEN : LOADSCREEN); const int32_t fstilep = tilesiz[MENUTILE].x>=320 && tilesiz[MENUTILE].y==200; int32_t bgtile = (fstilep ? MENUTILE : BIGHOLE); diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 0dde35ecb..35840b2f7 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -91,7 +91,7 @@ void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set) if (player != g_player[screenpeek].ps) return; - setbrightness(ud.brightness>>2, palid, set); + videoSetPalette(ud.brightness>>2, palid, set); } void G_GetCrosshairColor(void) @@ -157,7 +157,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) ii = tilesiz[CROSSHAIR].x * tilesiz[CROSSHAIR].y; if (ii <= 0) return; - if (getrendermode() == REND_CLASSIC) + if (videoGetRenderMode() == REND_CLASSIC) i = getclosestcol(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); else i = getclosestcol(255, 255, 255); // use white in GL so we can tint it to the right color @@ -168,7 +168,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) ptr++; } while (--ii); - makepalookup(CROSSHAIR_PAL, NULL, CrosshairColors.r, CrosshairColors.g, CrosshairColors.b, 1); + paletteMakeLookupTable(CROSSHAIR_PAL, NULL, CrosshairColors.r, CrosshairColors.g, CrosshairColors.b, 1); #ifdef USE_OPENGL // XXX: this makes us also load all hightile textures tinted with the crosshair color! @@ -259,7 +259,7 @@ static void palaccum_add(palaccum_t *pa, const palette_t *pal, int32_t f) static void G_FadePalaccum(const palaccum_t *pa) { - setpalettefade(tabledivide32_noinline(pa->r, pa->sumf)<<2, + videoFadePalette(tabledivide32_noinline(pa->r, pa->sumf)<<2, tabledivide32_noinline(pa->g, pa->sumf)<<2, tabledivide32_noinline(pa->b, pa->sumf)<<2, pa->maxf<<2); } @@ -693,7 +693,7 @@ static void G_PrintCoords(int32_t snum) { y=16; - printcoordsline("rendmode = %d", getrendermode()); + printcoordsline("rendmode = %d", videoGetRenderMode()); printcoordsline("r_ambientlight = %.03f", r_ambientlight); if (rendmode >= 3) @@ -873,7 +873,7 @@ void G_DisplayRest(int32_t smoothratio) #ifdef USE_OPENGL // this takes care of fullscreen tint for OpenGL - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { polytint_t & fstint = hictinting[MAXPALOOKUPS-1]; @@ -1344,7 +1344,7 @@ void G_DisplayRest(int32_t smoothratio) else if (applied) { // be sure to always un-apply a tint. - setpalettefade(0, 0, 0, 0); + videoFadePalette(0, 0, 0, 0); applied = 0; } } @@ -1356,7 +1356,7 @@ void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e) { if (ud.screenfade == 0) return; - setpalettefade(r, g, b, e); + videoFadePalette(r, g, b, e); videoNextPage(); int32_t tc = totalclock; @@ -1370,7 +1370,7 @@ void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_ { if (ud.screenfade == 0) return; - if (getrendermode() >= REND_POLYMOST) + if (videoGetRenderMode() >= REND_POLYMOST) { G_FadePalette(r, g, b, end); return; @@ -1382,7 +1382,7 @@ void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_ if (KB_KeyPressed(sc_Space)) { KB_ClearKeyDown(sc_Space); - setpalettefade(r, g, b, end); // have to set to end fade value if we break! + videoFadePalette(r, g, b, end); // have to set to end fade value if we break! return; } @@ -1411,7 +1411,7 @@ static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t if (KB_KeyPressed(sc_Space)) { KB_ClearKeyDown(sc_Space); - setpalettefade(r, g, b, end); // have to set to end fade value if we break! + videoFadePalette(r, g, b, end); // have to set to end fade value if we break! return; } rotatesprite_fs(160<<16, 100<<16, 65536L, 0, tile, 0, 0, 2+8+64+BGSTRETCH); diff --git a/source/duke3d/src/screentext.cpp b/source/duke3d/src/screentext.cpp index f8a414853..db5107d77 100644 --- a/source/duke3d/src/screentext.cpp +++ b/source/duke3d/src/screentext.cpp @@ -1006,7 +1006,7 @@ int32_t hud_glowingquotes = 1; // alpha increments of 8 --> 256 / 8 = 32 --> round up to power of 2 --> 32 --> divide by 2 --> 16 alphatabs required static inline int32_t textsh(uint32_t t) { - return (hud_glowingquotes && ((getrendermode() == REND_CLASSIC && numalphatabs < 15) || t >= FTAOPAQUETIME)) + return (hud_glowingquotes && ((videoGetRenderMode() == REND_CLASSIC && numalphatabs < 15) || t >= FTAOPAQUETIME)) ? sintable[(t << 7) & 2047] >> 11 : (sintable[(FTAOPAQUETIME << 7) & 2047] >> 11); } @@ -1014,7 +1014,7 @@ static inline int32_t textsh(uint32_t t) // orientation flags depending on time that a quote has still to be displayed static inline int32_t texto(int32_t t) { - if (getrendermode() != REND_CLASSIC || numalphatabs >= 15 || t > 4) + if (videoGetRenderMode() != REND_CLASSIC || numalphatabs >= 15 || t > 4) return 0; if (t > 2) @@ -1025,7 +1025,7 @@ static inline int32_t texto(int32_t t) static inline int32_t texta(int32_t t) { - if (getrendermode() == REND_CLASSIC && numalphatabs < 15) + if (videoGetRenderMode() == REND_CLASSIC && numalphatabs < 15) return 0; return 255 - clamp(t<<3, 0, 255); diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index e35451d43..2121a8634 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -427,7 +427,7 @@ void G_AnimateCamSprite(int smoothRatio) G_SetupCamTile(OW(spriteNum), viewscrTile, smoothRatio); #ifdef POLYMER // Force texture update on viewscreen sprite in Polymer! - if (getrendermode() == REND_POLYMER) + if (videoGetRenderMode() == REND_POLYMER) polymer_invalidatesprite(spriteNum); #endif }