Add internal drawlinergb function.

git-svn-id: https://svn.eduke32.com/eduke32@6260 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-06-24 09:20:58 +00:00
parent 517517a1bb
commit 4dbeb30907
2 changed files with 64 additions and 37 deletions

View file

@ -1037,6 +1037,7 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnu
int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend,
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2);
void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col);
void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t col);
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol,
const char *name, char fontsize) ATTRIBUTE((nonnull(5)));
void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol,

View file

@ -121,18 +121,9 @@ char getpixel(int32_t x, int32_t y)
//
// drawline256
//
void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
{
int32_t dx, dy, i, j, inc, plc, daend;
intptr_t p;
col = palookup[0][col];
#ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST)
{
palette_t p = getpal(col);
static void drawlinegl(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t p)
{
// setpolymost2dview(); // JBF 20040205: more efficient setup
bglViewport(0, 0, xres, yres);
@ -157,11 +148,14 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
bglVertex2f((float) x2 * (1.f/4096.f), (float) y2 * (1.f/4096.f));
bglEnd();
return;
}
}
#endif
static void drawlinepixels(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
{
int32_t dx, dy, i, j, inc, plc, daend;
intptr_t p;
dx = x2-x1; dy = y2-y1;
if (dx >= 0)
{
@ -236,6 +230,38 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
}
}
void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t p)
{
#ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST)
{
drawlinegl(x1, y1, x2, y2, p);
return;
}
#endif
char const col = palookup[0][p.f];
drawlinepixels(x1, y1, x2, y2, col);
}
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)
{
palette_t p = getpal(col);
p.f = col;
drawlinegl(x1, y1, x2, y2, p);
return;
}
#endif
drawlinepixels(x1, y1, x2, y2, col);
}
//static void attach_here() {}
//