mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-03-31 23:41:25 +00:00
renders: add support of alt text for scaled image
This commit is contained in:
parent
65abf0188a
commit
37b0e7a1f3
12 changed files with 95 additions and 15 deletions
|
@ -165,7 +165,7 @@ RDraw_StretchPic(int x, int y, int w, int h, const char *pic)
|
|||
}
|
||||
|
||||
void
|
||||
RDraw_PicScaled(int x, int y, const char *pic, float factor)
|
||||
RDraw_PicScaled(int x, int y, const char *pic, float factor, const char *alttext)
|
||||
{
|
||||
image_t *gl;
|
||||
|
||||
|
@ -173,6 +173,20 @@ RDraw_PicScaled(int x, int y, const char *pic, float factor)
|
|||
|
||||
if (!gl)
|
||||
{
|
||||
if (alttext && alttext[0])
|
||||
{
|
||||
/* Show alttext if provided */
|
||||
int l, i;
|
||||
|
||||
l = strlen(alttext);
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
RDraw_CharScaled(x + i * 8 * factor, y, alttext[i], factor);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -484,7 +484,7 @@ int RI_GetSDLVersion();
|
|||
/* g11_draw */
|
||||
extern image_t * RDraw_FindPic(const char *name);
|
||||
extern void RDraw_GetPicSize(int *w, int *h, const char *pic);
|
||||
extern void RDraw_PicScaled(int x, int y, const char *pic, float factor);
|
||||
extern void RDraw_PicScaled(int x, int y, const char *pic, float factor, const char *alttext);
|
||||
extern void RDraw_StretchPic(int x, int y, int w, int h, const char *pic);
|
||||
extern void RDraw_CharScaled(int x, int y, int num, float scale);
|
||||
extern void RDraw_TileClear(int x, int y, int w, int h, const char *pic);
|
||||
|
|
|
@ -214,11 +214,27 @@ GL3_Draw_StretchPic(int x, int y, int w, int h, const char *pic)
|
|||
}
|
||||
|
||||
void
|
||||
GL3_Draw_PicScaled(int x, int y, const char *pic, float factor)
|
||||
GL3_Draw_PicScaled(int x, int y, const char *pic, float factor, const char *alttext)
|
||||
{
|
||||
gl3image_t *gl = R_FindPic(pic, (findimage_t)GL3_FindImage);
|
||||
gl3image_t *gl;
|
||||
|
||||
gl = R_FindPic(pic, (findimage_t)GL3_FindImage);
|
||||
if (!gl)
|
||||
{
|
||||
if (alttext && alttext[0])
|
||||
{
|
||||
/* Show alttext if provided */
|
||||
int l, i;
|
||||
|
||||
l = strlen(alttext);
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
GL3_Draw_CharScaled(x + i * 8 * factor, y, alttext[i], factor);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -417,7 +417,7 @@ extern void GL3_Draw_ShutdownLocal(void);
|
|||
extern gl3image_t * GL3_Draw_FindPic(const char *name);
|
||||
extern void GL3_Draw_GetPicSize(int *w, int *h, const char *pic);
|
||||
|
||||
extern void GL3_Draw_PicScaled(int x, int y, const char *pic, float factor);
|
||||
extern void GL3_Draw_PicScaled(int x, int y, const char *pic, float factor, const char *alttext);
|
||||
extern void GL3_Draw_StretchPic(int x, int y, int w, int h, const char *pic);
|
||||
extern void GL3_Draw_CharScaled(int x, int y, int num, float scale);
|
||||
extern void GL3_Draw_TileClear(int x, int y, int w, int h, const char *pic);
|
||||
|
|
|
@ -214,11 +214,25 @@ GL4_Draw_StretchPic(int x, int y, int w, int h, const char *pic)
|
|||
}
|
||||
|
||||
void
|
||||
GL4_Draw_PicScaled(int x, int y, const char *pic, float factor)
|
||||
GL4_Draw_PicScaled(int x, int y, const char *pic, float factor, const char *alttext)
|
||||
{
|
||||
gl4image_t *gl = R_FindPic(pic, (findimage_t)GL4_FindImage);
|
||||
if (!gl)
|
||||
{
|
||||
if (alttext && alttext[0])
|
||||
{
|
||||
/* Show alttext if provided */
|
||||
int l, i;
|
||||
|
||||
l = strlen(alttext);
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
GL4_Draw_CharScaled(x + i * 8 * factor, y, alttext[i], factor);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -407,7 +407,7 @@ extern void GL4_Draw_ShutdownLocal(void);
|
|||
extern gl4image_t * GL4_Draw_FindPic(const char *name);
|
||||
extern void GL4_Draw_GetPicSize(int *w, int *h, const char *pic);
|
||||
|
||||
extern void GL4_Draw_PicScaled(int x, int y, const char *pic, float factor);
|
||||
extern void GL4_Draw_PicScaled(int x, int y, const char *pic, float factor, const char *alttext);
|
||||
extern void GL4_Draw_StretchPic(int x, int y, int w, int h, const char *pic);
|
||||
extern void GL4_Draw_CharScaled(int x, int y, int num, float scale);
|
||||
extern void GL4_Draw_TileClear(int x, int y, int w, int h, const char *pic);
|
||||
|
|
|
@ -553,7 +553,7 @@ void RE_EndRegistration (void);
|
|||
struct image_s *RE_Draw_FindPic (const char *name);
|
||||
|
||||
void RE_Draw_GetPicSize (int *w, int *h, const char *name);
|
||||
void RE_Draw_PicScaled (int x, int y, const char *name, float scale);
|
||||
void RE_Draw_PicScaled (int x, int y, const char *name, float scale, const char *alttext);
|
||||
void RE_Draw_StretchPic (int x, int y, int w, int h, const char *name);
|
||||
void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *data, int bits);
|
||||
void RE_Draw_CharScaled (int x, int y, int c, float scale);
|
||||
|
|
|
@ -397,13 +397,27 @@ Draw_Pic
|
|||
=============
|
||||
*/
|
||||
void
|
||||
RE_Draw_PicScaled(int x, int y, const char *name, float scale)
|
||||
RE_Draw_PicScaled(int x, int y, const char *name, float scale, const char *alttext)
|
||||
{
|
||||
const image_t *pic;
|
||||
|
||||
pic = R_FindPic (name, (findimage_t)R_FindImage);
|
||||
if (!pic)
|
||||
{
|
||||
if (alttext && alttext[0])
|
||||
{
|
||||
/* Show alttext if provided */
|
||||
int l, i;
|
||||
|
||||
l = strlen(alttext);
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
RE_Draw_CharScaled(x + i * 8 * scale, y, alttext[i], scale);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
R_Printf(PRINT_ALL, "Can't find pic: %s\n", name);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ void R_DrawSkyBox(void);
|
|||
struct image_s *RE_Draw_FindPic (const char *name);
|
||||
|
||||
void RE_Draw_GetPicSize (int *w, int *h, const char *name);
|
||||
void RE_Draw_PicScaled (int x, int y, const char *name, float scale);
|
||||
void RE_Draw_PicScaled (int x, int y, const char *name, float scale, const char *alttext);
|
||||
void RE_Draw_StretchPic (int x, int y, int w, int h, const char *name);
|
||||
void RE_Draw_CharScaled (int x, int y, int num, float scale);
|
||||
void RE_Draw_TileClear (int x, int y, int w, int h, const char *name);
|
||||
|
|
|
@ -151,13 +151,27 @@ void RE_Draw_StretchPic (int x, int y, int w, int h, const char *name)
|
|||
RE_Draw_PicScaled
|
||||
=============
|
||||
*/
|
||||
void RE_Draw_PicScaled (int x, int y, const char *name, float scale)
|
||||
void RE_Draw_PicScaled (int x, int y, const char *name, float scale, const char *alttext)
|
||||
{
|
||||
image_t *vk;
|
||||
|
||||
vk = R_FindPic(name, (findimage_t)Vk_FindImage);
|
||||
if (!vk)
|
||||
{
|
||||
if (alttext && alttext[0])
|
||||
{
|
||||
/* Show alttext if provided */
|
||||
int l, i;
|
||||
|
||||
l = strlen(alttext);
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
RE_Draw_CharScaled(x + i * 8 * scale, y, alttext[i], scale);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
R_Printf(PRINT_ALL, "%s(): Can't find pic: %s\n", __func__, name);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ typedef struct
|
|||
struct image_s * (EXPORT *DrawFindPic)(const char *name);
|
||||
|
||||
void (EXPORT *DrawGetPicSize) (int *w, int *h, const char *name); // will return 0 0 if not found
|
||||
void (EXPORT *DrawPicScaled) (int x, int y, const char *pic, float factor);
|
||||
void (EXPORT *DrawPicScaled) (int x, int y, const char *pic, float factor, const char *alttext);
|
||||
void (EXPORT *DrawStretchPic) (int x, int y, int w, int h, const char *name);
|
||||
void (EXPORT *DrawCharScaled)(int x, int y, int num, float scale);
|
||||
void (EXPORT *DrawTileClear) (int x, int y, int w, int h, const char *name);
|
||||
|
@ -291,14 +291,13 @@ void Draw_GetPicSize(int *w, int *h, const char *name);
|
|||
|
||||
void Draw_StretchPic(int x, int y, int w, int h, const char *name);
|
||||
void Draw_PicScaled(int x, int y, const char *pic, float factor);
|
||||
void Draw_PicScaledAltText(int x, int y, const char *pic, float factor, const char *alttext);
|
||||
|
||||
void Draw_CharScaled(int x, int y, int num, float scale);
|
||||
void Draw_TileClear(int x, int y, int w, int h, const char *name);
|
||||
void Draw_Fill(int x, int y, int w, int h, int c);
|
||||
void Draw_FadeScreen(void);
|
||||
void Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *data, int bits);
|
||||
//int R_Init(void *hinstance, void *hWnd);
|
||||
//void R_Shutdown(void);
|
||||
void R_SetPalette(const unsigned char *palette);
|
||||
void R_BeginFrame(float camera_separation);
|
||||
qboolean R_EndWorldRenderpass(void);
|
||||
|
|
|
@ -725,7 +725,16 @@ Draw_PicScaled(int x, int y, const char *pic, float factor)
|
|||
{
|
||||
if (ref_active)
|
||||
{
|
||||
re.DrawPicScaled(x, y, pic, factor);
|
||||
re.DrawPicScaled(x, y, pic, factor, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Draw_PicScaledAltText(int x, int y, const char *pic, float factor, const char *alttext)
|
||||
{
|
||||
if (ref_active)
|
||||
{
|
||||
re.DrawPicScaled(x, y, pic, factor, alttext);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue