removal of Draw_TranPic. Thanks, Seth.

This commit is contained in:
Bill Currie 2000-11-19 21:34:27 +00:00
parent b948a6c004
commit 06ead88d9d
4 changed files with 60 additions and 130 deletions

View File

@ -333,108 +333,6 @@ Draw_Pic
============= =============
*/ */
void Draw_Pic (int x, int y, qpic_t *pic) void Draw_Pic (int x, int y, qpic_t *pic)
{
byte *dest, *source;
unsigned short *pusdest;
int v, u;
if ((x < 0) ||
(x + pic->width > vid.width) ||
(y < 0) ||
(y + pic->height > vid.height))
{
Sys_Error ("Draw_Pic: bad coordinates");
}
source = pic->data;
if (r_pixbytes == 1)
{
dest = vid.buffer + y * vid.rowbytes + x;
for (v=0 ; v<pic->height ; v++)
{
memcpy (dest, source, pic->width);
dest += vid.rowbytes;
source += pic->width;
}
}
else
{
// FIXME: pretranslate at load time?
pusdest = (unsigned short *)vid.buffer + y * (vid.rowbytes >> 1) + x;
for (v=0 ; v<pic->height ; v++)
{
for (u=0 ; u<pic->width ; u++)
{
pusdest[u] = d_8to16table[source[u]];
}
pusdest += vid.rowbytes >> 1;
source += pic->width;
}
}
}
/*
=============
Draw_SubPic
=============
*/
void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height)
{
byte *dest, *source;
unsigned short *pusdest;
int v, u;
if ((x < 0) ||
(x + width > vid.width) ||
(y < 0) ||
(y + height > vid.height))
{
Sys_Error ("Draw_Pic: bad coordinates");
}
source = pic->data + srcy * pic->width + srcx;
if (r_pixbytes == 1)
{
dest = vid.buffer + y * vid.rowbytes + x;
for (v=0 ; v<height ; v++)
{
memcpy (dest, source, width);
dest += vid.rowbytes;
source += pic->width;
}
}
else
{
// FIXME: pretranslate at load time?
pusdest = (unsigned short *)vid.buffer + y * (vid.rowbytes >> 1) + x;
for (v=0 ; v<height ; v++)
{
for (u=srcx ; u<(srcx+width) ; u++)
{
pusdest[u] = d_8to16table[source[u]];
}
pusdest += vid.rowbytes >> 1;
source += pic->width;
}
}
}
/*
=============
Draw_TransPic
=============
*/
void Draw_TransPic (int x, int y, qpic_t *pic)
{ {
byte *dest, *source, tbyte; byte *dest, *source, tbyte;
unsigned short *pusdest; unsigned short *pusdest;
@ -443,9 +341,9 @@ void Draw_TransPic (int x, int y, qpic_t *pic)
if (x < 0 || (unsigned int)(x + pic->width) > vid.width || y < 0 || if (x < 0 || (unsigned int)(x + pic->width) > vid.width || y < 0 ||
(unsigned int)(y + pic->height) > vid.height) (unsigned int)(y + pic->height) > vid.height)
{ {
Sys_Error ("Draw_TransPic: bad coordinates"); Sys_Error ("Draw_Pic: bad coordinates");
} }
source = pic->data; source = pic->data;
if (r_pixbytes == 1) if (r_pixbytes == 1)
@ -516,6 +414,56 @@ void Draw_TransPic (int x, int y, qpic_t *pic)
} }
/*
=============
Draw_SubPic
=============
*/
void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height)
{
byte *dest, *source;
unsigned short *pusdest;
int v, u;
if ((x < 0) ||
(x + width > vid.width) ||
(y < 0) ||
(y + height > vid.height))
{
Sys_Error ("Draw_Pic: bad coordinates");
}
source = pic->data + srcy * pic->width + srcx;
if (r_pixbytes == 1)
{
dest = vid.buffer + y * vid.rowbytes + x;
for (v=0 ; v<height ; v++)
{
memcpy (dest, source, width);
dest += vid.rowbytes;
source += pic->width;
}
}
else
{
// FIXME: pretranslate at load time?
pusdest = (unsigned short *)vid.buffer + y * (vid.rowbytes >> 1) + x;
for (v=0 ; v<height ; v++)
{
for (u=srcx ; u<(srcx+width) ; u++)
{
pusdest[u] = d_8to16table[source[u]];
}
pusdest += vid.rowbytes >> 1;
source += pic->width;
}
}
}
/* /*
============= =============
Draw_TransPicTranslate Draw_TransPicTranslate

View File

@ -664,24 +664,6 @@ void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int h
glColor3ubv(lighthalf_v); glColor3ubv(lighthalf_v);
} }
/*
=============
Draw_TransPic
=============
*/
void Draw_TransPic (int x, int y, qpic_t *pic)
{
if (x < 0 || (unsigned int)(x + pic->width) > vid.width || y < 0 ||
(unsigned int)(y + pic->height) > vid.height)
{
Sys_Error ("Draw_TransPic: bad coordinates");
}
Draw_Pic (x, y, pic);
}
/* /*
============= =============
Draw_TransPicTranslate Draw_TransPicTranslate
@ -952,11 +934,11 @@ void GL_Set2D (void)
glViewport (glx, gly, glwidth, glheight); glViewport (glx, gly, glwidth, glheight);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity (); glLoadIdentity ();
glOrtho (0, vid.width, vid.height, 0, -99999, 99999); glOrtho (0, vid.width, vid.height, 0, -99999, 99999);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity (); glLoadIdentity ();
glDisable (GL_DEPTH_TEST); glDisable (GL_DEPTH_TEST);
glDisable (GL_CULL_FACE); glDisable (GL_CULL_FACE);
@ -1151,7 +1133,7 @@ static void GL_Upload32 (unsigned int *data, int width, int height, qboolean mip
void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha) void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha)
{ {
#ifdef HAVE_GL_COLOR_INDEX8_EXT #ifdef HAVE_GL_COLOR_INDEX8_EXT
byte *scaled; byte *scaled;
int scaled_width, scaled_height; int scaled_width, scaled_height;
// Snap the height and width to a power of 2. // Snap the height and width to a power of 2.

View File

@ -164,7 +164,7 @@ void M_PrintWhite (int cx, int cy, char *str)
void M_DrawTransPic (int x, int y, qpic_t *pic) void M_DrawTransPic (int x, int y, qpic_t *pic)
{ {
Draw_TransPic (x + ((vid.width - 320)>>1), y, pic); Draw_Pic (x + ((vid.width - 320)>>1), y, pic);
} }
void M_DrawPic (int x, int y, qpic_t *pic) void M_DrawPic (int x, int y, qpic_t *pic)
@ -786,7 +786,7 @@ void M_Keys_Key (int k)
} }
else if (k != '`') else if (k != '`')
{ {
snprintf (cmd, sizeof(cmd), "bind %s \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]); snprintf (cmd, sizeof(cmd), "bind %s \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
Cbuf_InsertText (cmd); Cbuf_InsertText (cmd);
} }

View File

@ -277,7 +277,7 @@ Sbar_DrawTransPic
*/ */
void Sbar_DrawTransPic (int x, int y, qpic_t *pic) void Sbar_DrawTransPic (int x, int y, qpic_t *pic)
{ {
Draw_TransPic (x /*+ ((vid.width - 320)>>1) */, y + (vid.height-SBAR_HEIGHT), pic); Draw_Pic (x /*+ ((vid.width - 320)>>1) */, y + (vid.height-SBAR_HEIGHT), pic);
} }
/* /*
@ -887,7 +887,7 @@ void Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
else else
frame = *ptr -'0'; frame = *ptr -'0';
Draw_TransPic (x,y,sb_nums[color][frame]); Draw_Pic (x,y,sb_nums[color][frame]);
x += 24; x += 24;
ptr++; ptr++;
} }
@ -1330,7 +1330,7 @@ void Sbar_FinaleOverlay (void)
scr_copyeverything = 1; scr_copyeverything = 1;
pic = Draw_CachePic ("gfx/finale.lmp"); pic = Draw_CachePic ("gfx/finale.lmp");
Draw_TransPic ( (vid.width-pic->width)/2, 16, pic); Draw_Pic ( (vid.width-pic->width)/2, 16, pic);
} }