diff --git a/include/QF/draw.h b/include/QF/draw.h index f7bd86416..33c933832 100644 --- a/include/QF/draw.h +++ b/include/QF/draw.h @@ -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 diff --git a/libs/video/renderer/gl/gl_draw.c b/libs/video/renderer/gl/gl_draw.c index 46c3b7848..9cc331a7d 100644 --- a/libs/video/renderer/gl/gl_draw.c +++ b/libs/video/renderer/gl/gl_draw.c @@ -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) diff --git a/libs/video/renderer/glsl/glsl_draw.c b/libs/video/renderer/glsl/glsl_draw.c index 17a43d9c7..9df38f2f4 100644 --- a/libs/video/renderer/glsl/glsl_draw.c +++ b/libs/video/renderer/glsl/glsl_draw.c @@ -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) diff --git a/libs/video/renderer/r_progs.c b/libs/video/renderer/r_progs.c index b71143bc6..4c41eaddc 100644 --- a/libs/video/renderer/r_progs.c +++ b/libs/video/renderer/r_progs.c @@ -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}, diff --git a/libs/video/renderer/sw/draw.c b/libs/video/renderer/sw/draw.c index 0d79e223f..aa1db21f6 100644 --- a/libs/video/renderer/sw/draw.c +++ b/libs/video/renderer/sw/draw.c @@ -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, diff --git a/libs/video/renderer/sw32/draw.c b/libs/video/renderer/sw32/draw.c index 0b71ea9ce..a9756b628 100644 --- a/libs/video/renderer/sw32/draw.c +++ b/libs/video/renderer/sw32/draw.c @@ -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, diff --git a/ruamoko/include/draw.h b/ruamoko/include/draw.h index 353a586b6..df4a1470f 100644 --- a/ruamoko/include/draw.h +++ b/ruamoko/include/draw.h @@ -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); diff --git a/ruamoko/lib/draw.r b/ruamoko/lib/draw.r index 2cb4bcd31..741857bf5 100644 --- a/ruamoko/lib/draw.r +++ b/ruamoko/lib/draw.r @@ -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;