A couple of trivial/cleanup changes. setvgapalette() is removed from the

engine, since it had no users.

git-svn-id: https://svn.eduke32.com/eduke32@2014 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-09-10 15:44:53 +00:00
parent 009d405803
commit 01676d7431
4 changed files with 47 additions and 104 deletions

View file

@ -534,7 +534,7 @@ int32_t qloadkvx(int32_t voxindex, const char *filename);
int32_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz); int32_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 makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat); void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat);
void setvgapalette(void); //void setvgapalette(void);
void setbasepaltable(uint8_t **basepaltable, uint8_t basepalcount); void setbasepaltable(uint8_t **basepaltable, uint8_t basepalcount);
void setbrightness(char dabrightness, uint8_t dapalid, char noapply); void setbrightness(char dabrightness, uint8_t dapalid, char noapply);
void setpalettefade(char r, char g, char b, char offset); void setpalettefade(char r, char g, char b, char offset);

View file

@ -12995,7 +12995,7 @@ void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b,
} }
} }
#if 0
void setvgapalette(void) void setvgapalette(void)
{ {
int32_t i; int32_t i;
@ -13008,6 +13008,7 @@ void setvgapalette(void)
} }
setpalette(0,256); setpalette(0,256);
} }
#endif
// //
// setbasepaltable // setbasepaltable
@ -13097,9 +13098,9 @@ static inline palette_t getpal(int32_t col)
p.b = britable[curbrightness][ curpalette[col].b ]; p.b = britable[curbrightness][ curpalette[col].b ];
p.g = britable[curbrightness][ curpalette[col].g ]; p.g = britable[curbrightness][ curpalette[col].g ];
p.r = britable[curbrightness][ curpalette[col].r ]; p.r = britable[curbrightness][ curpalette[col].r ];
#ifdef __APPLE__ //#ifdef __APPLE__
p.f = 0; // make gcc on osx happy p.f = 0; // make gcc on osx happy
#endif //#endif
return p; return p;
} }
} }
@ -13966,6 +13967,8 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col)
intptr_t p; intptr_t p;
int32_t xp, yp, xpbpl, ypbpl, d, de, dse, patc=0; int32_t xp, yp, xpbpl, ypbpl, d, de, dse, patc=0;
uint32_t uxres = xres, uydim16 = ydim16;
if (r < 0) r = -r; if (r < 0) r = -r;
if (x1+r < 0 || x1-r >= xres) return; if (x1+r < 0 || x1-r >= xres) return;
if (y1+r < 0 || y1-r >= ydim16) return; if (y1+r < 0 || y1-r >= ydim16) return;
@ -13993,14 +13996,14 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col)
if (drawlinepat & pow2long[(patc++)&31]) if (drawlinepat & pow2long[(patc++)&31])
{ {
if ((uint32_t)y1 < (uint32_t)ydim16 && (uint32_t)(x1+r) < (uint32_t)xres) if ((uint32_t)y1 < uydim16 && (uint32_t)(x1+r) < uxres)
drawpixel_safe((char *)(p+r), col); // a drawpixel((char *)(p+r), col); // a
if ((uint32_t)x1 < (uint32_t)xres && (uint32_t)(y1+r) < (uint32_t)ydim16) if ((uint32_t)x1 < uxres && (uint32_t)(y1+r) < uydim16)
drawpixel_safe((char *)(p+(r*bytesperline)), col); // b drawpixel((char *)(p+(r*bytesperline)), col); // b
if ((uint32_t)y1 < (uint32_t)ydim16 && (uint32_t)(x1-r) < (uint32_t)xres) if ((uint32_t)y1 < uydim16 && (uint32_t)(x1-r) < uxres)
drawpixel_safe((char *)(p-r), col); // c drawpixel((char *)(p-r), col); // c
if ((uint32_t)x1 < (uint32_t)xres && (uint32_t)(y1-r) < (uint32_t)ydim16) if ((uint32_t)x1 < uxres && (uint32_t)(y1-r) < uydim16)
drawpixel_safe((char *)(p-(r*bytesperline)), col); // d drawpixel((char *)(p-(r*bytesperline)), col); // d
} }
do do
@ -14025,21 +14028,21 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col)
xpbpl = xp*bytesperline; xpbpl = xp*bytesperline;
if (drawlinepat & pow2long[(patc++)&31]) if (drawlinepat & pow2long[(patc++)&31])
{ {
if ((uint32_t)(x1+yp) < (uint32_t)xres && (uint32_t)(y1+xp) < (uint32_t)ydim16) if ((uint32_t)(x1+yp) < uxres && (uint32_t)(y1+xp) < uydim16)
drawpixel_safe((char *)(p+yp+xpbpl), col); // 1 drawpixel_safe((char *)(p+yp+xpbpl), col); // 1
if ((uint32_t)(x1+xp) < (uint32_t)xres && (uint32_t)(y1+yp) < (uint32_t)ydim16) if ((uint32_t)(x1+xp) < uxres && (uint32_t)(y1+yp) < uydim16)
drawpixel_safe((char *)(p+xp+ypbpl), col); // 2 drawpixel_safe((char *)(p+xp+ypbpl), col); // 2
if ((uint32_t)(x1-xp) < (uint32_t)xres && (uint32_t)(y1+yp) < (uint32_t)ydim16) if ((uint32_t)(x1-xp) < uxres && (uint32_t)(y1+yp) < uydim16)
drawpixel_safe((char *)(p-xp+ypbpl), col); // 3 drawpixel_safe((char *)(p-xp+ypbpl), col); // 3
if ((uint32_t)(x1-yp) < (uint32_t)xres && (uint32_t)(y1+xp) < (uint32_t)ydim16) if ((uint32_t)(x1-yp) < uxres && (uint32_t)(y1+xp) < uydim16)
drawpixel_safe((char *)(p-yp+xpbpl), col); // 4 drawpixel_safe((char *)(p-yp+xpbpl), col); // 4
if ((uint32_t)(x1-yp) < (uint32_t)xres && (uint32_t)(y1-xp) < (uint32_t)ydim16) if ((uint32_t)(x1-yp) < uxres && (uint32_t)(y1-xp) < uydim16)
drawpixel_safe((char *)(p-yp-xpbpl), col); // 5 drawpixel_safe((char *)(p-yp-xpbpl), col); // 5
if ((uint32_t)(x1-xp) < (uint32_t)xres && (uint32_t)(y1-yp) < (uint32_t)ydim16) if ((uint32_t)(x1-xp) < uxres && (uint32_t)(y1-yp) < uydim16)
drawpixel_safe((char *)(p-xp-ypbpl), col); // 6 drawpixel_safe((char *)(p-xp-ypbpl), col); // 6
if ((uint32_t)(x1+xp) < (uint32_t)xres && (uint32_t)(y1-yp) < (uint32_t)ydim16) if ((uint32_t)(x1+xp) < uxres && (uint32_t)(y1-yp) < uydim16)
drawpixel_safe((char *)(p+xp-ypbpl), col); // 7 drawpixel_safe((char *)(p+xp-ypbpl), col); // 7
if ((uint32_t)(x1+yp) < (uint32_t)xres && (uint32_t)(y1-xp) < (uint32_t)ydim16) if ((uint32_t)(x1+yp) < uxres && (uint32_t)(y1-xp) < uydim16)
drawpixel_safe((char *)(p+yp-xpbpl), col); // 8 drawpixel_safe((char *)(p+yp-xpbpl), col); // 8
} }
} }
@ -14069,70 +14072,6 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col)
} }
} }
#if 0
//
// qsetmode640350
//
void qsetmode640350(void)
{
if (qsetmode != 350)
{
if (setvideomode(640, 350, 8, fullscreen) < 0)
{
//fprintf(stderr, "Couldn't set 640x350 video mode for some reason.\n");
return;
}
xdim = xres;
ydim = yres;
// setvgapalette();
ydim16 = 350;
halfxdim16 = 320;
midydim16 = 146;
begindrawing(); //{{{
clearbuf((char *)frameplace, (bytesperline*350L) >> 2, 0);
enddrawing(); //}}}
}
qsetmode = 350;
}
//
// qsetmode640480
//
void qsetmode640480(void)
{
if (qsetmode != 480)
{
if (setvideomode(640, 480, 8, fullscreen) < 0)
{
//fprintf(stderr, "Couldn't set 640x480 video mode for some reason.\n");
return;
}
xdim = xres;
ydim = yres;
// setvgapalette();
ydim16 = 336;
halfxdim16 = 320;
midydim16 = 200;
begindrawing(); //{{{
clearbuf((char *)(frameplace + (336l*bytesperline)), (bytesperline*144L) >> 2, 0x08080808l);
clearbuf((char *)frameplace, (bytesperline*336L) >> 2, 0L);
enddrawing(); //}}}
}
qsetmode = 480;
}
#endif
// //
// qsetmodeany // qsetmodeany
// //
@ -14149,15 +14088,12 @@ void qsetmodeany(int32_t daxdim, int32_t daydim)
xdim = xres; xdim = xres;
ydim = yres; ydim = yres;
// setvgapalette();
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(); //{{{ begindrawing(); //{{{
clearbuf((char *)(frameplace + (ydim16*bytesperline)), (bytesperline*STATUS2DSIZ2) >> 2, 0x08080808l); Bmemset((char *)frameplace, 0, yres*bytesperline);
clearbuf((char *)frameplace, (ydim16*bytesperline) >> 2, 0L);
enddrawing(); //}}} enddrawing(); //}}}
} }
@ -14173,13 +14109,11 @@ void clear2dscreen(void)
int32_t clearsz; int32_t clearsz;
begindrawing(); //{{{ begindrawing(); //{{{
if (qsetmode == 350) clearsz = 350; if (ydim16 <= yres-STATUS2DSIZ2)
clearsz = yres - STATUS2DSIZ2;
else else
{ clearsz = yres;
if (ydim16 <= yres-STATUS2DSIZ2) clearsz = yres - STATUS2DSIZ2; Bmemset((char *)frameplace, 0, bytesperline*clearsz);
else clearsz = yres;
}
clearbuf((char *)frameplace, (bytesperline*clearsz) >> 2, 0);
enddrawing(); //}}} enddrawing(); //}}}
} }

View file

@ -677,6 +677,9 @@ void polymost_glreset()
} }
polymost_cachesync(); polymost_cachesync();
#ifdef DEBUGGINGAIDS
OSD_Printf("polymost_glreset()\n");
#endif
} }
// one-time initialization of OpenGL for polymost // one-time initialization of OpenGL for polymost
@ -855,6 +858,9 @@ void invalidatecache(void)
{ {
int32_t i; int32_t i;
#ifdef DEBUGGINGAIDS
OSD_Printf("invalidatecache()\n");
#endif
r_downsizevar = r_downsize; // update the cvar representation when the menu changes r_downsize r_downsizevar = r_downsize; // update the cvar representation when the menu changes r_downsize
polymost_glreset(); polymost_glreset();
@ -1993,7 +1999,10 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
// backup of the n for possible redrawing of fullbright // backup of the n for possible redrawing of fullbright
int32_t n_ = n, method_ = method; int32_t n_ = n, method_ = method;
if (method == -1 || g_nodraw) return; if (method == -1) return;
#ifdef YAX_ENABLE
if (g_nodraw) return;
#endif
if (n == 3) if (n == 3)
{ {

View file

@ -990,7 +990,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
} }
attributes[] = attributes[] =
{ {
#if 0 # if 0
{ SDL_GL_RED_SIZE, 8 }, { SDL_GL_RED_SIZE, 8 },
{ SDL_GL_GREEN_SIZE, 8 }, { SDL_GL_GREEN_SIZE, 8 },
{ SDL_GL_BLUE_SIZE, 8 }, { SDL_GL_BLUE_SIZE, 8 },
@ -1002,14 +1002,14 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
{ SDL_GL_ACCUM_BLUE_SIZE, 0 }, { SDL_GL_ACCUM_BLUE_SIZE, 0 },
{ SDL_GL_ACCUM_ALPHA_SIZE, 0 }, { SDL_GL_ACCUM_ALPHA_SIZE, 0 },
{ SDL_GL_DEPTH_SIZE, 24 }, { SDL_GL_DEPTH_SIZE, 24 },
#endif # endif
{ SDL_GL_DOUBLEBUFFER, 1 }, { SDL_GL_DOUBLEBUFFER, 1 },
{ SDL_GL_MULTISAMPLEBUFFERS, glmultisample > 0 }, { SDL_GL_MULTISAMPLEBUFFERS, glmultisample > 0 },
{ SDL_GL_MULTISAMPLESAMPLES, glmultisample }, { SDL_GL_MULTISAMPLESAMPLES, glmultisample },
{ SDL_GL_STENCIL_SIZE, 1 }, { SDL_GL_STENCIL_SIZE, 1 },
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) # if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3)
{ SDL_GL_SWAP_CONTROL, vsync }, { SDL_GL_SWAP_CONTROL, vsync },
#endif # endif
}; };
if (nogl) return -1; if (nogl) return -1;
@ -1034,7 +1034,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
/* HACK: changing SDL GL attribs only works before surface creation, /* HACK: changing SDL GL attribs only works before surface creation,
so we have to create a new surface in a different format first so we have to create a new surface in a different format first
to force the surface we WANT to be recreated instead of reused. */ to force the surface we WANT to be recreated instead of reused. */
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) # if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3)
if (vsync != ovsync) if (vsync != ovsync)
{ {
if (sdl_surface) if (sdl_surface)
@ -1045,7 +1045,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
} }
ovsync = vsync; ovsync = vsync;
} }
#endif # endif
sdl_surface = SDL_SetVideoMode(x, y, c, SDL_OPENGL | ((fs&1)?SDL_FULLSCREEN:0)); sdl_surface = SDL_SetVideoMode(x, y, c, SDL_OPENGL | ((fs&1)?SDL_FULLSCREEN:0));
if (!sdl_surface) if (!sdl_surface)
{ {
@ -1062,7 +1062,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
while (multisamplecheck--); while (multisamplecheck--);
} }
else else
#endif #endif // defined USE_OPENGL
{ {
initprintf("Setting video mode %dx%d (%d-bpp %s)\n", initprintf("Setting video mode %dx%d (%d-bpp %s)\n",
x,y,c, ((fs&1) ? "fullscreen" : "windowed")); x,y,c, ((fs&1) ? "fullscreen" : "windowed"));
@ -1648,9 +1648,9 @@ int32_t handleevents(void)
} }
break; break;
*/ */
// #print "Using SDL 1.3" // #warning "Using SDL 1.3"
#else // SDL 1.3 ^^^ | vvv SDL 1.2 #else // SDL 1.3 ^^^ | vvv SDL 1.2
// #print "Using SDL 1.2" // #warning "Using SDL 1.2"
case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:
code = keytranslation[ev.key.keysym.sym]; code = keytranslation[ev.key.keysym.sym];