gldraw_transpictranslate -> r2d_transpictranslate, removed old unused code

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3764 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2011-03-31 11:00:23 +00:00
parent ee5d0ba7f3
commit 795406b8e4
13 changed files with 52 additions and 118 deletions

View File

@ -299,43 +299,6 @@ void SCR_StringToRGB (char *rgbstring, float *rgb, float rgbinputscale)
} // i contains the crosshair color
}
// SCR_StringToPalIndex: takes in "<index>" or "<r> <g> <b>" and converts to a
// Quake palette index
int SCR_StringToPalIndex (char *rgbstring, float rgbinputscale)
{
int i;
char *t;
rgbinputscale = 255/rgbinputscale;
t = strstr(rgbstring, " ");
if (t)
{
int r, g, b;
t++;
r = atof(rgbstring) * rgbinputscale;
g = atof(t) * rgbinputscale;
t = strstr(t, " ");
if (t)
b = atof(t) * rgbinputscale;
else
b = 0;
r = bound(0, r, 255);
g = bound(0, g, 255);
b = bound(0, b, 255);
i = GetPaletteIndex(r, g, b);
}
else
{
i = atoi(rgbstring);
i = bound(0, i, 255);
}
return i;
}
/*
==============
SCR_CenterPrint
@ -584,7 +547,6 @@ void SCR_DrawCursor(int prydoncursornum)
{
R2D_ImageColours(1, 1, 1, 1);
R2D_Image(mousecursor_x-cl_cursorbias.value, mousecursor_y-cl_cursorbias.value, cl_cursorsize.value, cl_cursorsize.value, 0, 0, 1, 1, p);
// Draw_TransPic(mousecursor_x-4, mousecursor_y-4, p);
}
else
{

View File

@ -1209,8 +1209,6 @@ void Editor_Init(void);
#endif
void SCR_StringToRGB (char *rgbstring, float *rgb, float rgbinputscale);
int SCR_StringToPalIndex (char *rgbstring, float rgbinputscale);
struct model_s;
void CL_AddVWeapModel(entity_t *player, struct model_s *model);

View File

@ -1460,7 +1460,6 @@ void DrawCursor(int prydoncursornum)
{
R2D_ImageColours(1, 1, 1, 1);
R2D_Image(mousecursor_x-cl_cursorbias.value, mousecursor_y-cl_cursorbias.value, cl_cursorsize.value, cl_cursorsize.value, 0, 0, 1, 1, p);
// Draw_TransPic(mousecursor_x-4, mousecursor_y-4, p);
}
else
{

View File

@ -317,7 +317,7 @@ void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu)
R2D_ScalePic (x-12, y-8, 72, 72, p);
M_BuildTranslationTable(info->topcolour, info->lowercolour);
Draw_TransPicTranslate (x, y, info->tiwidth, info->tiheight, info->translationimage, translationTable);
R2D_TransPicTranslate (x, y, info->tiwidth, info->tiheight, info->translationimage, translationTable);
}
void M_Menu_Setup_f (void)

View File

@ -113,12 +113,6 @@ void M_BuildTranslationTable(int top, int bottom)
}
}
/*
void M_DrawTransPicTranslate (int x, int y, mpic_t *pic)
{
Draw_TransPicTranslate (x + ((vid.width - 320)>>1), y, pic, translationTable);
}*/
void M_DrawTextBox (int x, int y, int width, int lines)
{

View File

@ -382,7 +382,6 @@ void M_SListKey(int key);
//drawing funcs
void M_BuildTranslationTable(int top, int bottom);
FTE_DEPRECATED void M_DrawTransPicTranslate (int x, int y, mpic_t *pic);
void M_DrawCharacter (int cx, int line, unsigned int num);
void M_Print (int cx, int cy, qbyte *str);
void M_PrintWhite (int cx, int cy, qbyte *str);

View File

@ -60,6 +60,7 @@ mpic_t *R2D_SafeCachePic (char *path);
mpic_t *R2D_SafePicFromWad (char *name);
void R2D_ScalePic (int x, int y, int width, int height, mpic_t *pic);
void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight);
void R2D_TransPicTranslate (int x, int y, int width, int height, qbyte *pic, qbyte *translation);
void R2D_TileClear (int x, int y, int w, int h);
void R2D_FadeScreen (void);
@ -75,7 +76,6 @@ void R2D_FillBlock(int x, int y, int w, int h);
extern void (*Draw_Init) (void);
extern void (*Draw_TinyCharacter) (int x, int y, unsigned int num);
extern void (*Draw_Crosshair) (void);
extern void (*Draw_TransPicTranslate) (int x, int y, int width, int height, qbyte *image, qbyte *translation);
extern qboolean (*Draw_IsCached) (char *picname); //can be null
extern void (*R_Init) (void);
@ -181,7 +181,6 @@ typedef struct rendererinfo_s {
void (*Draw_Init) (void);
void (*Draw_Shutdown) (void);
void (*Draw_Crosshair) (void); //TODO: MARKED FOR DEMOLITION
void (*Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation); //TODO: MARKED FOR DEMOLITION
texid_t (*IMG_LoadTexture) (char *identifier, int width, int height, uploadfmt_t fmt, void *data, unsigned int flags);
texid_t (*IMG_LoadTexture8Pal24) (char *identifier, int width, int height, qbyte *data, qbyte *palette24, unsigned int flags);

View File

@ -4,6 +4,10 @@
#include "gl_draw.h"
texid_t missing_texture;
texid_t translate_texture;
shader_t *translate_shader;
static mpic_t *conback;
static mpic_t *draw_backtile;
static shader_t *shader_draw_fill, *shader_draw_fill_trans;
@ -87,6 +91,7 @@ void R2D_Init(void)
#pragma message("Fixme: move conwidth handling into here")
missing_texture = R_LoadTexture8("no_texture", 16, 16, (unsigned char*)r_notexture_mip + r_notexture_mip->offsets[0], IF_NOALPHA|IF_NOGAMMA, 0);
translate_texture = r_nulltex;
draw_backtile = R_RegisterShader("gfx/backtile.lmp",
"{\n"
@ -326,6 +331,50 @@ void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int
R2D_Image(x, y, width, height, newsl, newtl, newsh, newth, pic);
}
/* this is an ugly special case drawing func that's only used for the player color selection menu */
void R2D_TransPicTranslate (int x, int y, int width, int height, qbyte *pic, qbyte *translation)
{
int v, u, c;
unsigned trans[64*64], *dest;
qbyte *src;
int p;
c = width * height;
dest = trans;
for (v=0 ; v<64 ; v++, dest += 64)
{
src = &pic[ ((v*height)>>6) *width];
for (u=0 ; u<64 ; u++)
{
p = src[(u*width)>>6];
if (p == 255)
dest[u] = 0x0;
else
dest[u] = d_8to24rgbtable[translation[p]];
}
}
if (!TEXVALID(translate_texture))
{
translate_texture = R_AllocNewTexture(64, 64);
translate_shader = R_RegisterShader("translatedpic", "{\n"
#ifdef USE_EGL
"program default2d\n"
#endif
"nomipmaps\n"
"{\n"
"map $diffuse\n"
"blendfunc blend\n"
"}\n"
"}\n");
translate_shader->defaulttextures.base = translate_texture;
}
/* could avoid reuploading already translated textures but this func really isn't used enough anyway */
R_Upload(translate_texture, NULL, TF_RGBA32, trans, NULL, 64, 64, IF_NOMIPMAP|IF_NOGAMMA);
R2D_ScalePic(x, y, width, height, translate_shader);
}
/*
================
Draw_ConsoleBackground
@ -426,7 +475,7 @@ void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue)
conback = NULL;
return;
}
if (*var->string)
conback = R_RegisterPic(var->string);
if (!conback || !conback->width)

View File

@ -647,7 +647,6 @@ void (*Draw_Shutdown) (void);
void (*Draw_Crosshair) (void);
void (*Draw_SubPic) (int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight);
void (*Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *image, qbyte *translation);
void (*R_Init) (void);
void (*R_DeInit) (void);
@ -704,7 +703,6 @@ rendererinfo_t dedicatedrendererinfo = {
NULL, //Draw_Init;
NULL, //Draw_Shutdown;
NULL, //Draw_Crosshair;
NULL, //Draw_TransPicTranslate;
NULL, //R_LoadTexture
NULL, //R_LoadTexture8Pal24
@ -1250,7 +1248,6 @@ void R_SetRenderer(rendererinfo_t *ri)
Draw_Init = ri->Draw_Init;
Draw_Shutdown = ri->Draw_Shutdown;
Draw_Crosshair = ri->Draw_Crosshair;
Draw_TransPicTranslate = ri->Draw_TransPicTranslate;
R_Init = ri->R_Init;
R_DeInit = ri->R_DeInit;

View File

@ -1038,9 +1038,6 @@ static void (D3D9_Draw_ReInit) (void)
static void (D3D9_Draw_Crosshair) (void)
{
}
static void (D3D9_Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation)
{
}
static void (D3D9_R_Init) (void)
{
@ -1169,7 +1166,6 @@ rendererinfo_t d3drendererinfo =
D3D9_Draw_Init,
D3D9_Draw_ReInit,
D3D9_Draw_Crosshair,
D3D9_Draw_TransPicTranslate,
D3D9_LoadTexture,
D3D9_LoadTexture8Pal24,

View File

@ -149,7 +149,6 @@ extern cvar_t gl_texturemode, gl_texture_anisotropic_filtering;
extern cvar_t gl_savecompressedtex;
texid_t translate_texture;
texid_t missing_texture; //texture used when one is missing.
texid_t cs_texture; // crosshair texture
@ -387,9 +386,6 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
GL_SetupSceneProcessingTextures();
// save a texture slot for translated picture
translate_texture = GL_AllocNewTexture(0, 0);
//
// get the other pics we need
//
@ -601,58 +597,6 @@ void GLDraw_Crosshair(void)
}
}
/*
=============
Draw_TransPicTranslate
Only used for the player color selection menu
=============
*/
void GLDraw_TransPicTranslate (int x, int y, int width, int height, qbyte *pic, qbyte *translation)
{
int v, u, c;
unsigned trans[64*64], *dest;
qbyte *src;
int p;
if (gl_config.gles)
return; // TODO: NOT FIXED YET
GL_MTBind(0, GL_TEXTURE_2D, translate_texture);
c = width * height;
dest = trans;
for (v=0 ; v<64 ; v++, dest += 64)
{
src = &pic[ ((v*height)>>6) *width];
for (u=0 ; u<64 ; u++)
{
p = src[(u*width)>>6];
if (p == 255)
dest[u] = p;
else
dest[u] = d_8to24rgbtable[translation[p]];
}
}
qglTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
qglColor3f (1,1,1);
qglBegin (GL_QUADS);
qglTexCoord2f (0, 0);
qglVertex2f (x, y);
qglTexCoord2f (1, 0);
qglVertex2f (x+width, y);
qglTexCoord2f (1, 1);
qglVertex2f (x+width, y+height);
qglTexCoord2f (0, 1);
qglVertex2f (x, y+height);
qglEnd ();
}
//=============================================================================

View File

@ -25,9 +25,7 @@ void GLDraw_Init (void);
void GLDraw_ReInit (void);
void GLDraw_DeInit (void);
void Surf_DeInit (void);
void GLDraw_TransPicTranslate (int x, int y, int w, int h, qbyte *pic, qbyte *translation);
void GLDraw_Crosshair(void);
void GLDraw_LevelPic (mpic_t *pic);
void R2D_Init(void);
mpic_t *R2D_SafeCachePic (char *path);

View File

@ -1068,7 +1068,6 @@ rendererinfo_t openglrendererinfo = {
GLDraw_Init,
GLDraw_ReInit,
GLDraw_Crosshair,
GLDraw_TransPicTranslate,
GL_LoadTextureFmt,
GL_LoadTexture8Pal24,