3DS + PSP draw.h unify

This commit is contained in:
cypress 2024-09-06 16:22:44 -07:00
parent 22de83d643
commit 59cc8a5471
4 changed files with 25 additions and 127 deletions

View file

@ -1483,10 +1483,8 @@ byte *COM_LoadFile (char *path, int usehunk)
((byte *)buf)[len] = 0;
Draw_BeginDisc ();
Sys_FileRead (h, buf, len);
COM_CloseFile (h);
Draw_EndDisc ();
return buf;
}

View file

@ -21,35 +21,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// draw.h -- these are the only functions outside the refresh allowed
// to touch the vid buffer
extern qpic_t *draw_disc; // also used on sbar
void Draw_Init (void);
void Draw_Character (int x, int y, int num);
void Draw_DebugChar (char num);
void Draw_Pic (int x, int y, qpic_t *pic);
#ifdef __PSP__
void Draw_PicIndex (int x, int y, int width, int height, int texture_index);
#endif // __PSP__
void Draw_StretchPic (int x, int y, qpic_t *pic, int x_value, int y_value);
void Draw_ColoredStretchPic (int x, int y, qpic_t *pic, int x_value, int y_value, float r, float g , float b, float a);
void Draw_ColorPic (int x, int y, qpic_t *pic, float r, float g , float b, float a);
void Draw_ColoredStretchPic (int x, int y, qpic_t *pic, int x_value, int y_value, int r, int g, int b, int a);
void Draw_ColoredString (int x, int y, char *text, float r, float g, float b, float a, int scale);
void Draw_ColoredStringCentered(int y, char *text, float r, float g, float b, float a, int scale);
void Draw_TransPic (int x, int y, qpic_t *pic);
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation);
void Draw_ConsoleBackground (int lines);
void Draw_BeginDisc (void);
void Draw_EndDisc (void);
void Draw_TileClear (int x, int y, int w, int h);
void Draw_Fill (int x, int y, int w, int h, float r, float g, float b, float a);
void Draw_FillByColor (int x, int y, int w, int h, float r, float g, float b, float a);
#ifdef __PSP__
void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha);
void Draw_Fill (int x, int y, int w, int h, int c);
void Draw_LoadingFill(void);
#endif // __PSP__
void Draw_FillByColor (int x, int y, int w, int h, int r, int g, int b, int a);
void Draw_FadeScreen (void);
void Draw_String (int x, int y, char *str);
void Draw_ColoredString(int x, int y, char *text, float r, float g, float b, float a, int scale);
void Draw_ColoredStringCentered(int y, char *text, float r, float g, float b, float a, int scale);
qpic_t *Draw_PicFromWad (char *name);
qpic_t *Draw_CachePic (char *path);
int getTextWidth(char *str, int scale);
//other
void Clear_LoadingFill (void);
#ifdef __PSP__
byte *StringToRGB (const char *s);
#endif // __PSP__
extern float loading_cur_step;
extern int loading_step;
extern char loading_name[32];
extern float loading_num_step;
extern int font_kerningamount[96];
void Clear_LoadingFill (void);
qpic_t *Draw_CachePic (char *path);
#ifdef __PSP__
qpic_t *Draw_CacheImg (char *path);
#endif // __PSP__

View file

@ -34,7 +34,6 @@ cvar_t gl_picmip = {"gl_picmip", "0"};
byte *draw_chars; // 8*8 graphic characters
qpic_t *sniper_scope;
qpic_t *draw_disc;
qpic_t *draw_backtile;
int translate_texture;
@ -197,48 +196,6 @@ byte menuplyr_pixels[4096];
int pic_texels;
int pic_count;
qpic_t *Draw_PicFromWad (char *name)
{
qpic_t *p;
glpic_t *gl;
p = W_GetLumpName (name);
gl = (glpic_t *)p->data;
// load little ones into the scrap
if (p->width < 64 && p->height < 64)
{
int x=0, y=0;
int i, j, k;
int texnum;
texnum = Scrap_AllocBlock (p->width, p->height, &x, &y);
scrap_dirty = true;
k = 0;
for (i=0 ; i<p->height ; i++)
for (j=0 ; j<p->width ; j++, k++)
scrap_texels[texnum][(y+i)*BLOCK_WIDTH + x + j] = p->data[k];
texnum += scrap_texnum;
gl->texnum = texnum;
gl->sl = (x+0.01)/(float)BLOCK_WIDTH;
gl->sh = (x+p->width-0.01)/(float)BLOCK_WIDTH;
gl->tl = (y+0.01)/(float)BLOCK_WIDTH;
gl->th = (y+p->height-0.01)/(float)BLOCK_WIDTH;
pic_count++;
pic_texels += p->width*p->height;
}
else
{
gl->texnum = GL_LoadPicTexture (p);
gl->sl = 0;
gl->sh = 1;
gl->tl = 0;
gl->th = 1;
}
return p;
}
/*
================
Draw_CachePic
@ -642,7 +599,7 @@ void Draw_Pic (int x, int y, qpic_t *pic)
Draw_ColoredStretchPic
=============
*/
void Draw_ColoredStretchPic (int x, int y, qpic_t *pic, int x_value, int y_value, float r, float g , float b, float a)
void Draw_ColoredStretchPic (int x, int y, qpic_t *pic, int x_value, int y_value, int r, int g, int b, int a)
{
glpic_t *gl;
@ -813,7 +770,7 @@ Draw_ConsoleBackground
*/
void Draw_ConsoleBackground (int lines)
{
Draw_Fill(0, 0, vid.width, lines, 0, 0, 0, 255);
Draw_FillByColor(0, 0, vid.width, lines, 0, 0, 0, 255);
}
@ -904,19 +861,7 @@ Draw_FillByColor
Fills a box of pixels with a single color
=============
*/
void Draw_FillByColor (int x, int y, int w, int h, float r, float g, float b, float a)
{
Draw_Fill(x, y, w, h, r, g, b, a);
}
/*
=============
Draw_Fill
Fills a box of pixels with a single color
=============
*/
void Draw_Fill (int x, int y, int w, int h, float r, float g, float b, float a)
void Draw_FillByColor (int x, int y, int w, int h, int r, int g, int b, int a)
{
glDisable (GL_TEXTURE_2D);
glEnable (GL_BLEND); //johnfitz -- for alpha
@ -1291,36 +1236,6 @@ void Draw_FadeScreen (void)
//=============================================================================
/*
================
Draw_BeginDisc
Draws the little blue disc in the corner of the screen.
Call before beginning any disc IO.
================
*/
void Draw_BeginDisc (void)
{
if (!draw_disc)
return;
glDrawBuffer (GL_FRONT);
Draw_Pic (vid.width - 24, 0, draw_disc);
glDrawBuffer (GL_BACK);
}
/*
================
Draw_EndDisc
Erases the disc icon.
Call after completing any disc IO
================
*/
void Draw_EndDisc (void)
{
}
/*
================
GL_Set2D

View file

@ -1422,30 +1422,6 @@ void SCR_BringDownConsole (void)
VID_SetPalette (host_basepal);
}
void SCR_TileClear (void)
{
if (r_refdef.vrect.x > 0) {
// left
Draw_TileClear (0, 0, r_refdef.vrect.x, vid.height - sb_lines);
// right
Draw_TileClear (r_refdef.vrect.x + r_refdef.vrect.width, 0,
vid.width - r_refdef.vrect.x + r_refdef.vrect.width,
vid.height - sb_lines);
}
if (r_refdef.vrect.y > 0) {
// top
Draw_TileClear (r_refdef.vrect.x, 0,
r_refdef.vrect.x + r_refdef.vrect.width,
r_refdef.vrect.y);
// bottom
Draw_TileClear (r_refdef.vrect.x,
r_refdef.vrect.y + r_refdef.vrect.height,
r_refdef.vrect.width,
vid.height - sb_lines -
(r_refdef.vrect.height + r_refdef.vrect.y));
}
}
/*
==================
SCR_UpdateScreen