mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 15:01:41 +00:00
Add Draw_Picf to allow smooth placement on low-res consoles.
This commit is contained in:
parent
14c0e22494
commit
a694eed968
8 changed files with 62 additions and 2 deletions
|
@ -212,6 +212,13 @@ qpic_t *Draw_PicFromWad (const char *name);
|
|||
*/
|
||||
void Draw_Pic (int x, int y, qpic_t *pic);
|
||||
|
||||
/** Draw a qpic to the screen
|
||||
\param x horizontal location of the upper left corner of the qpic
|
||||
\param y vertical location of the upper left corner of the qpic
|
||||
\param pic qpic to draw
|
||||
*/
|
||||
void Draw_Picf (float x, float y, qpic_t *pic);
|
||||
|
||||
/** Draw a sub-region of a qpic to the screan
|
||||
\param x horizontal screen location of the upper left corner of the
|
||||
sub-region
|
||||
|
|
|
@ -721,6 +721,26 @@ Draw_Pic (int x, int y, qpic_t *pic)
|
|||
qfglEnd ();
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_Picf (float x, float y, qpic_t *pic)
|
||||
{
|
||||
glpic_t *gl;
|
||||
|
||||
gl = (glpic_t *) pic->data;
|
||||
|
||||
qfglBindTexture (GL_TEXTURE_2D, gl->texnum);
|
||||
qfglBegin (GL_QUADS);
|
||||
qfglTexCoord2f (0, 0);
|
||||
qfglVertex2f (x, y);
|
||||
qfglTexCoord2f (1, 0);
|
||||
qfglVertex2f (x + pic->width, y);
|
||||
qfglTexCoord2f (1, 1);
|
||||
qfglVertex2f (x + pic->width, y + pic->height);
|
||||
qfglTexCoord2f (0, 1);
|
||||
qfglVertex2f (x, y + pic->height);
|
||||
qfglEnd ();
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
||||
int height)
|
||||
|
|
|
@ -195,7 +195,7 @@ pic_data (const char *name, int w, int h, const byte *data)
|
|||
}
|
||||
|
||||
static void
|
||||
make_quad (qpic_t *pic, int x, int y, int w, int h,
|
||||
make_quad (qpic_t *pic, float x, float y, int w, int h,
|
||||
int srcx, int srcy, int srcw, int srch, float verts[6][4])
|
||||
{
|
||||
float sl, sh, tl, th;
|
||||
|
@ -237,7 +237,7 @@ make_quad (qpic_t *pic, int x, int y, int w, int h,
|
|||
}
|
||||
|
||||
static void
|
||||
draw_pic (int x, int y, int w, int h, qpic_t *pic,
|
||||
draw_pic (float x, float y, int w, int h, qpic_t *pic,
|
||||
int srcx, int srcy, int srcw, int srch,
|
||||
float *color)
|
||||
{
|
||||
|
@ -644,6 +644,14 @@ Draw_Pic (int x, int y, qpic_t *pic)
|
|||
0, 0, pic->width, pic->height, color);
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_Picf (float x, float y, qpic_t *pic)
|
||||
{
|
||||
static quat_t color = { 1, 1, 1, 1};
|
||||
draw_pic (x, y, pic->width, pic->height, pic,
|
||||
0, 0, pic->width, pic->height, color);
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
||||
int height)
|
||||
|
|
|
@ -195,6 +195,18 @@ bi_Draw_Pic (progs_t *pr)
|
|||
Draw_Pic (x, y, pic);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Draw_Picf (progs_t *pr)
|
||||
{
|
||||
float x = P_FLOAT (pr, 0);
|
||||
float y = P_FLOAT (pr, 1);
|
||||
bi_qpic_t *bq = &P_STRUCT (pr, bi_qpic_t, 2);
|
||||
qpic_res_t *qp = get_qpic (pr, __FUNCTION__, bq->pic_handle);
|
||||
qpic_t *pic = qp->pic;
|
||||
|
||||
Draw_Picf (x, y, pic);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Draw_SubPic (progs_t *pr)
|
||||
{
|
||||
|
@ -318,6 +330,7 @@ static builtin_t builtins[] = {
|
|||
{"Draw_MakePic", bi_Draw_MakePic, -1},
|
||||
{"Draw_CachePic", bi_Draw_CachePic, -1},
|
||||
{"Draw_Pic", bi_Draw_Pic, -1},
|
||||
{"Draw_Picf", bi_Draw_Picf, -1},
|
||||
{"Draw_SubPic", bi_Draw_SubPic, -1},
|
||||
{"Draw_CenterPic", bi_Draw_CenterPic, -1},
|
||||
{"Draw_Character", bi_Draw_Character, -1},
|
||||
|
|
|
@ -466,6 +466,11 @@ Draw_Pic (int x, int y, qpic_t *pic)
|
|||
}
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_Picf (float x, float y, qpic_t *pic)
|
||||
{
|
||||
Draw_Pic (x, y, pic);
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
||||
|
|
|
@ -579,6 +579,11 @@ Draw_Pic (int x, int y, qpic_t *pic)
|
|||
}
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_Picf (float x, float y, qpic_t *pic)
|
||||
{
|
||||
Draw_Pic (x, y, pic);
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
||||
|
|
|
@ -15,6 +15,7 @@ typedef struct _qpic_t *qpic_t;
|
|||
@extern qpic_t Draw_CachePic (string name, int alpha);
|
||||
|
||||
@extern void Draw_Pic (int x, int y, qpic_t pic);
|
||||
@extern void Draw_Picf (float x, float y, qpic_t pic);
|
||||
@extern void Draw_SubPic (int x, int y, qpic_t pic, int srcx, int srcy, int width, int height);
|
||||
@extern void Draw_CenterPic (int x, int y, qpic_t pic);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ qpic_t Draw_MakePic (int width, int heiight, string data) = #0;
|
|||
qpic_t (string name, int alpha) Draw_CachePic = #0;
|
||||
|
||||
void (int x, int y, qpic_t pic) Draw_Pic = #0;
|
||||
void (float x, float y, qpic_t pic) Draw_Picf = #0;
|
||||
void (int x, int y, qpic_t pic, int srcx, int srcy, int width, int height) Draw_SubPic = #0;
|
||||
void (int x, int y, qpic_t pic) Draw_CenterPic = #0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue