mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-02 22:11:22 +00:00
Add support for loading 24bit replacements for the original content. Add PRECACHE_PIC_WRAP(from dp, disables npot padding+scrap, we already don't otherwise clamp), and PRECACHE_PIC_TEST(from fte, for consistency).
This commit is contained in:
parent
4decec980e
commit
1d9e73a36f
9 changed files with 153 additions and 54 deletions
|
@ -143,6 +143,9 @@ void CL_ClearState (void)
|
|||
#ifdef PSET_SCRIPT
|
||||
PScript_Shutdown();
|
||||
#endif
|
||||
|
||||
if (!sv.active)
|
||||
Draw_ReloadTextures(false);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -2939,11 +2939,7 @@ static void COM_Game_f (void)
|
|||
Cache_Flush ();
|
||||
Mod_ResetAll();
|
||||
if (!isDedicated)
|
||||
{
|
||||
TexMgr_NewGame ();
|
||||
Draw_NewGame ();
|
||||
R_NewGame ();
|
||||
}
|
||||
Draw_ReloadTextures(true);
|
||||
ExtraMaps_NewGame ();
|
||||
DemoList_Rebuild ();
|
||||
|
||||
|
|
|
@ -39,10 +39,12 @@ void Draw_TileClear (int x, int y, int w, int h);
|
|||
void Draw_Fill (int x, int y, int w, int h, int c, float alpha); //johnfitz -- added alpha
|
||||
void Draw_FadeScreen (void);
|
||||
void Draw_String (int x, int y, const char *str);
|
||||
qpic_t *Draw_PicFromWad2 (const char *name, unsigned int texflags);
|
||||
qpic_t *Draw_PicFromWad (const char *name);
|
||||
qpic_t *Draw_CachePic (const char *path);
|
||||
qpic_t *Draw_TryCachePic (const char *path);
|
||||
qpic_t *Draw_TryCachePic (const char *path, unsigned int texflags);
|
||||
void Draw_NewGame (void);
|
||||
qboolean Draw_ReloadTextures(qboolean force);
|
||||
|
||||
//Spike -- this is for csqc
|
||||
typedef struct
|
||||
|
|
117
Quake/gl_draw.c
117
Quake/gl_draw.c
|
@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
//extern unsigned char d_15to8table[65536]; //johnfitz -- never used
|
||||
|
||||
qboolean draw_load24bit;
|
||||
qboolean premul_hud = false;//true;
|
||||
cvar_t scr_conalpha = {"scr_conalpha", "0.5", CVAR_ARCHIVE}; //johnfitz
|
||||
|
||||
|
@ -214,7 +215,7 @@ void Scrap_Upload (void)
|
|||
Draw_PicFromWad
|
||||
================
|
||||
*/
|
||||
qpic_t *Draw_PicFromWad (const char *name)
|
||||
qpic_t *Draw_PicFromWad2 (const char *name, unsigned int texflags)
|
||||
{
|
||||
int i;
|
||||
cachepic_t *pic;
|
||||
|
@ -223,6 +224,8 @@ qpic_t *Draw_PicFromWad (const char *name)
|
|||
src_offset_t offset; //johnfitz
|
||||
lumpinfo_t *info;
|
||||
|
||||
texflags |= (premul_hud?TEXPREF_PREMULTIPLY:0);
|
||||
|
||||
//Spike -- added cachepic stuff here, to avoid glitches if the function is called multiple times with the same image.
|
||||
for (pic=menu_cachepics, i=0 ; i<menu_numcachepics ; pic++, i++)
|
||||
{
|
||||
|
@ -238,11 +241,19 @@ qpic_t *Draw_PicFromWad (const char *name)
|
|||
Con_SafePrintf ("W_GetLumpName: %s not found\n", name);
|
||||
return pic_nul; //johnfitz
|
||||
}
|
||||
if (info->size < sizeof(int)*2 || 8+p->width*p->height < info->size) Sys_Error ("Draw_PicFromWad: pic \"%s\" truncated", name);
|
||||
if (info->type != TYP_QPIC) Sys_Error ("Draw_PicFromWad: lump \"%s\" is not a qpic", name);
|
||||
if (info->size < sizeof(int)*2 || 8+p->width*p->height < info->size) Sys_Error ("Draw_PicFromWad: pic \"%s\" truncated", name);
|
||||
|
||||
//Spike -- if we're loading external images, and one exists, then use that instead.
|
||||
if (draw_load24bit && (gl.gltexture=TexMgr_LoadImage (NULL, name, 0, 0, SRC_EXTERNAL, NULL, va("gfx/%s", name), 0, texflags|TEXPREF_MIPMAP|TEXPREF_ALLOWMISSING)))
|
||||
{
|
||||
gl.sl = 0;
|
||||
gl.sh = (texflags&TEXPREF_PAD)?(float)gl.gltexture->source_width/(float)TexMgr_PadConditional(gl.gltexture->source_width):1;
|
||||
gl.tl = 0;
|
||||
gl.th = (texflags&TEXPREF_PAD)?(float)gl.gltexture->source_height/(float)TexMgr_PadConditional(gl.gltexture->source_height):1;
|
||||
}
|
||||
// load little ones into the scrap
|
||||
if (p->width < 64 && p->height < 64)
|
||||
else if (p->width < 64 && p->height < 64 && texflags==((premul_hud?TEXPREF_PREMULTIPLY:0)|TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP))
|
||||
{
|
||||
int x, y;
|
||||
int i, j, k;
|
||||
|
@ -271,11 +282,11 @@ qpic_t *Draw_PicFromWad (const char *name)
|
|||
offset = (src_offset_t)p - (src_offset_t)wad_base + sizeof(int)*2; //johnfitz
|
||||
|
||||
gl.gltexture = TexMgr_LoadImage (NULL, texturename, p->width, p->height, SRC_INDEXED, p->data, WADFILENAME,
|
||||
offset, (premul_hud?TEXPREF_PREMULTIPLY:0)|TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
|
||||
offset, texflags); //johnfitz -- TexMgr
|
||||
gl.sl = 0;
|
||||
gl.sh = (float)p->width/(float)TexMgr_PadConditional(p->width); //johnfitz
|
||||
gl.sh = (texflags&TEXPREF_PAD)?(float)p->width/(float)TexMgr_PadConditional(p->width):1; //johnfitz
|
||||
gl.tl = 0;
|
||||
gl.th = (float)p->height/(float)TexMgr_PadConditional(p->height); //johnfitz
|
||||
gl.th = (texflags&TEXPREF_PAD)?(float)p->height/(float)TexMgr_PadConditional(p->height):1; //johnfitz
|
||||
}
|
||||
|
||||
menu_numcachepics++;
|
||||
|
@ -286,6 +297,11 @@ qpic_t *Draw_PicFromWad (const char *name)
|
|||
return &pic->pic;
|
||||
}
|
||||
|
||||
qpic_t *Draw_PicFromWad (const char *name)
|
||||
{
|
||||
return Draw_PicFromWad2(name, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP);
|
||||
}
|
||||
|
||||
qpic_t *Draw_GetCachedPic (const char *path)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
|
@ -304,12 +320,15 @@ qpic_t *Draw_GetCachedPic (const char *path)
|
|||
Draw_CachePic
|
||||
================
|
||||
*/
|
||||
qpic_t *Draw_TryCachePic (const char *path)
|
||||
qpic_t *Draw_TryCachePic (const char *path, unsigned int texflags)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
qpic_t *dat;
|
||||
glpic_t gl;
|
||||
char newname[MAX_QPATH];
|
||||
|
||||
texflags |= (premul_hud?TEXPREF_PREMULTIPLY:0);
|
||||
|
||||
for (pic=menu_cachepics, i=0 ; i<menu_numcachepics ; pic++, i++)
|
||||
{
|
||||
|
@ -325,15 +344,15 @@ qpic_t *Draw_TryCachePic (const char *path)
|
|||
{
|
||||
char npath[MAX_QPATH];
|
||||
COM_StripExtension(path, npath, sizeof(npath));
|
||||
gl.gltexture = TexMgr_LoadImage (NULL, npath, 0, 0, SRC_EXTERNAL, NULL, npath, 0, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP);
|
||||
gl.gltexture = TexMgr_LoadImage (NULL, npath, 0, 0, SRC_EXTERNAL, NULL, npath, 0, texflags);
|
||||
|
||||
pic->pic.width = gl.gltexture->width;
|
||||
pic->pic.height = gl.gltexture->height;
|
||||
|
||||
gl.sl = 0;
|
||||
gl.sh = (float)pic->pic.width/(float)TexMgr_PadConditional(pic->pic.width); //johnfitz
|
||||
gl.sh = (texflags&TEXPREF_PAD)?(float)pic->pic.width/(float)TexMgr_PadConditional(pic->pic.width):1; //johnfitz
|
||||
gl.tl = 0;
|
||||
gl.th = (float)pic->pic.height/(float)TexMgr_PadConditional(pic->pic.height); //johnfitz
|
||||
gl.th = (texflags&TEXPREF_PAD)?(float)pic->pic.height/(float)TexMgr_PadConditional(pic->pic.height):1; //johnfitz
|
||||
memcpy (pic->pic.data, &gl, sizeof(glpic_t));
|
||||
|
||||
return &pic->pic;
|
||||
|
@ -356,12 +375,24 @@ qpic_t *Draw_TryCachePic (const char *path)
|
|||
pic->pic.width = dat->width;
|
||||
pic->pic.height = dat->height;
|
||||
|
||||
gl.gltexture = TexMgr_LoadImage (NULL, path, dat->width, dat->height, SRC_INDEXED, dat->data, path,
|
||||
sizeof(int)*2, (premul_hud?TEXPREF_PREMULTIPLY:0)|TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
|
||||
gl.sl = 0;
|
||||
gl.sh = (float)dat->width/(float)TexMgr_PadConditional(dat->width); //johnfitz
|
||||
gl.tl = 0;
|
||||
gl.th = (float)dat->height/(float)TexMgr_PadConditional(dat->height); //johnfitz
|
||||
//Spike -- if we're loading external images, and one exists, then use that instead (but with the sizes of the lmp).
|
||||
COM_StripExtension(path, newname, sizeof(newname));
|
||||
if (draw_load24bit && (gl.gltexture=TexMgr_LoadImage (NULL, path, 0, 0, SRC_EXTERNAL, NULL, newname, 0, texflags|TEXPREF_MIPMAP|TEXPREF_ALLOWMISSING)))
|
||||
{
|
||||
gl.sl = 0;
|
||||
gl.sh = (texflags&TEXPREF_PAD)?(float)gl.gltexture->source_width/(float)TexMgr_PadConditional(gl.gltexture->source_width):1;
|
||||
gl.tl = 0;
|
||||
gl.th = (texflags&TEXPREF_PAD)?(float)gl.gltexture->source_height/(float)TexMgr_PadConditional(gl.gltexture->source_height):1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gl.gltexture = TexMgr_LoadImage (NULL, path, dat->width, dat->height, SRC_INDEXED, dat->data, path,
|
||||
sizeof(int)*2, texflags | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
|
||||
gl.sl = 0;
|
||||
gl.sh = (texflags&TEXPREF_PAD)?(float)dat->width/(float)TexMgr_PadConditional(dat->width):1; //johnfitz
|
||||
gl.tl = 0;
|
||||
gl.th = (texflags&TEXPREF_PAD)?(float)dat->height/(float)TexMgr_PadConditional(dat->height):1; //johnfitz
|
||||
}
|
||||
memcpy (pic->pic.data, &gl, sizeof(glpic_t));
|
||||
|
||||
return &pic->pic;
|
||||
|
@ -369,7 +400,7 @@ qpic_t *Draw_TryCachePic (const char *path)
|
|||
|
||||
qpic_t *Draw_CachePic (const char *path)
|
||||
{
|
||||
qpic_t *pic = Draw_TryCachePic(path);
|
||||
qpic_t *pic = Draw_TryCachePic(path, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP);
|
||||
if (!pic)
|
||||
Sys_Error ("Draw_CachePic: failed to load %s", path);
|
||||
return pic;
|
||||
|
@ -416,17 +447,33 @@ void Draw_LoadPics (void)
|
|||
byte *data;
|
||||
src_offset_t offset;
|
||||
lumpinfo_t *info;
|
||||
extern cvar_t gl_load24bit;
|
||||
|
||||
data = (byte *) W_GetLumpName ("conchars", &info);
|
||||
if (!data || info->size < 128*128) Sys_Error ("Draw_LoadPics: couldn't load conchars");
|
||||
if (info->size != 128*128) Con_Warning("Invalid size for gfx.wad conchars lump (%u, expected %u) - attempting to ignore for compat.\n", info->size, 128*128);
|
||||
else if (info->type != TYP_MIPTEX) Con_DWarning("Invalid type for gfx.wad conchars lump - attempting to ignore for compat.\n"); //not really a miptex, but certainly NOT a qpic.
|
||||
offset = (src_offset_t)data - (src_offset_t)wad_base;
|
||||
char_texture = TexMgr_LoadImage (NULL, WADFILENAME":conchars", 128, 128, SRC_INDEXED, data,
|
||||
WADFILENAME, offset, (premul_hud?TEXPREF_PREMULTIPLY:0)|TEXPREF_ALPHA | TEXPREF_NEAREST | TEXPREF_NOPICMIP | TEXPREF_CONCHARS);
|
||||
const unsigned int conchar_texflags = (premul_hud?TEXPREF_PREMULTIPLY:0)|TEXPREF_ALPHA | TEXPREF_NOPICMIP | TEXPREF_CONCHARS; //Spike - we use nearest with 8bit, but not replacements. replacements also use mipmaps because they're just noise otherwise.
|
||||
|
||||
draw_load24bit = !!gl_load24bit.value;
|
||||
|
||||
char_texture = NULL;
|
||||
//logical path
|
||||
if (!char_texture)
|
||||
char_texture = draw_load24bit?TexMgr_LoadImage (NULL, WADFILENAME":conchars", 0, 0, SRC_EXTERNAL, NULL, "gfx/conchars", 0, conchar_texflags | /*TEXPREF_MIPMAP |*/ TEXPREF_ALLOWMISSING):NULL;
|
||||
//stupid quakeworldism
|
||||
if (!char_texture)
|
||||
char_texture = draw_load24bit?TexMgr_LoadImage (NULL, WADFILENAME":conchars", 0, 0, SRC_EXTERNAL, NULL, "charsets/conchars", 0, conchar_texflags | /*TEXPREF_MIPMAP |*/ TEXPREF_ALLOWMISSING):NULL;
|
||||
//vanilla.
|
||||
if (!char_texture)
|
||||
{
|
||||
data = (byte *) W_GetLumpName ("conchars", &info);
|
||||
if (!data || info->size < 128*128) Sys_Error ("Draw_LoadPics: couldn't load conchars");
|
||||
if (info->size != 128*128) Con_Warning("Invalid size for gfx.wad conchars lump (%u, expected %u) - attempting to ignore for compat.\n", info->size, 128*128);
|
||||
else if (info->type != TYP_MIPTEX) Con_DWarning("Invalid type for gfx.wad conchars lump - attempting to ignore for compat.\n"); //not really a miptex, but certainly NOT a qpic.
|
||||
offset = (src_offset_t)data - (src_offset_t)wad_base;
|
||||
char_texture = TexMgr_LoadImage (NULL, WADFILENAME":conchars", 128, 128, SRC_INDEXED, data,
|
||||
WADFILENAME, offset, conchar_texflags | TEXPREF_NEAREST);
|
||||
}
|
||||
|
||||
draw_disc = Draw_PicFromWad ("disc");
|
||||
draw_backtile = Draw_PicFromWad ("backtile");
|
||||
draw_backtile = Draw_PicFromWad2 ("backtile", TEXPREF_NOPICMIP); //do NOT use PAD because that breaks wrapping. do NOT use alpha, because that could result in glitches.
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -458,6 +505,26 @@ void Draw_NewGame (void)
|
|||
PR_ReloadPics(false);
|
||||
}
|
||||
|
||||
qboolean Draw_ReloadTextures(qboolean force)
|
||||
{
|
||||
extern cvar_t gl_load24bit;
|
||||
if (draw_load24bit != !!gl_load24bit.value)
|
||||
force = true;
|
||||
|
||||
if (force)
|
||||
{
|
||||
TexMgr_NewGame ();
|
||||
Draw_NewGame ();
|
||||
R_NewGame ();
|
||||
|
||||
|
||||
Cache_Flush ();
|
||||
Mod_ResetAll();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Draw_Init -- johnfitz -- rewritten
|
||||
|
|
|
@ -1424,10 +1424,10 @@ gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int width, int
|
|||
byte *data, const char *source_file, src_offset_t source_offset, unsigned flags)
|
||||
{
|
||||
unsigned short crc;
|
||||
gltexture_t *glt;
|
||||
gltexture_t *glt = NULL;
|
||||
int mark;
|
||||
qboolean malloced;
|
||||
enum srcformat fmt;
|
||||
qboolean malloced = false;
|
||||
enum srcformat fmt = format;
|
||||
|
||||
if (isDedicated)
|
||||
return NULL;
|
||||
|
@ -1442,7 +1442,15 @@ gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int width, int
|
|||
if (glt->source_crc == crc)
|
||||
return glt;
|
||||
}
|
||||
else
|
||||
|
||||
if (format == SRC_EXTERNAL)
|
||||
{
|
||||
data = Image_LoadImage (source_file, &width, &height, &fmt, &malloced); //simple file
|
||||
if (!data && (flags & TEXPREF_ALLOWMISSING))
|
||||
return NULL; //don't allocate anything.
|
||||
}
|
||||
|
||||
if (!glt)
|
||||
glt = TexMgr_NewTexture ();
|
||||
|
||||
// copy data
|
||||
|
@ -1472,7 +1480,6 @@ gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int width, int
|
|||
TexMgr_LoadLightmap (glt, data);
|
||||
break;
|
||||
case SRC_EXTERNAL:
|
||||
data = Image_LoadImage (glt->source_file, (int *)&glt->source_width, (int *)&glt->source_height, &fmt, &malloced); //simple file
|
||||
if (!data)
|
||||
{
|
||||
glt->source_width = glt->source_height = 1;
|
||||
|
|
|
@ -39,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define TEXPREF_CONCHARS 0x0400 // use conchars palette
|
||||
#define TEXPREF_WARPIMAGE 0x0800 // resize this texture when warpimagesize changes
|
||||
#define TEXPREF_PREMULTIPLY 0x1000 // rgb = rgb*a; a=a;
|
||||
#define TEXPREF_ALLOWMISSING 0x2000 // TexMgr_LoadImage should return NULL if anything goes wrong (for use with SRC_EXTERNAL).
|
||||
|
||||
enum srcformat {SRC_INDEXED, SRC_LIGHTMAP, SRC_RGBA, SRC_EXTERNAL, SRC_FIRSTCOMPRESSED};
|
||||
extern qboolean gl_texture_s3tc, gl_texture_rgtc, gl_texture_bptc, gl_texture_etc2, gl_texture_astc;
|
||||
|
|
|
@ -4868,7 +4868,7 @@ static void PF_cl_getstat_string(void)
|
|||
static struct
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
int type;
|
||||
unsigned int flags;
|
||||
qpic_t *pic;
|
||||
} *qcpics;
|
||||
static size_t numqcpics;
|
||||
|
@ -4881,9 +4881,18 @@ void PR_ReloadPics(qboolean purge)
|
|||
qcpics = NULL;
|
||||
maxqcpics = 0;
|
||||
}
|
||||
static qpic_t *DrawQC_CachePic(const char *picname, int cachetype)
|
||||
#define PICFLAG_AUTO 0 //value used when no flags known
|
||||
#define PICFLAG_WAD (1u<<0) //name matches that of a wad lump
|
||||
//#define PICFLAG_TEMP (1u<<1)
|
||||
#define PICFLAG_WRAP (1u<<2) //make sure npot stuff doesn't break wrapping.
|
||||
#define PICFLAG_MIPMAP (1u<<3) //disable use of scrap...
|
||||
//#define PICFLAG_DOWNLOAD (1u<<8) //request to download it from the gameserver if its not stored locally.
|
||||
#define PICFLAG_BLOCK (1u<<9) //wait until the texture is fully loaded.
|
||||
#define PICFLAG_NOLOAD (1u<<31)
|
||||
static qpic_t *DrawQC_CachePic(const char *picname, unsigned int flags)
|
||||
{ //okay, so this is silly. we've ended up with 3 different cache levels. qcpics, pics, and images.
|
||||
size_t i;
|
||||
unsigned int texflags;
|
||||
for (i = 0; i < numqcpics; i++)
|
||||
{ //binary search? something more sane?
|
||||
if (!strcmp(picname, qcpics[i].name))
|
||||
|
@ -4897,7 +4906,7 @@ static qpic_t *DrawQC_CachePic(const char *picname, int cachetype)
|
|||
if (strlen(picname) >= MAX_QPATH)
|
||||
return NULL; //too long. get lost.
|
||||
|
||||
if (cachetype < 0)
|
||||
if (flags & PICFLAG_NOLOAD)
|
||||
return NULL; //its a query, not actually needed.
|
||||
|
||||
if (i+1 > maxqcpics)
|
||||
|
@ -4907,19 +4916,25 @@ static qpic_t *DrawQC_CachePic(const char *picname, int cachetype)
|
|||
}
|
||||
|
||||
strcpy(qcpics[i].name, picname);
|
||||
qcpics[i].type = cachetype;
|
||||
qcpics[i].flags = flags;
|
||||
qcpics[i].pic = NULL;
|
||||
|
||||
texflags = TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP;
|
||||
if (flags & PICFLAG_WRAP)
|
||||
texflags &= ~TEXPREF_PAD; //don't allow padding if its going to need to wrap (even if we don't enable clamp-to-edge normally). I just hope we have npot support.
|
||||
if (flags & PICFLAG_MIPMAP)
|
||||
texflags |= TEXPREF_MIPMAP;
|
||||
|
||||
//try to load it from a wad if applicable.
|
||||
//the extra gfx/ crap is because DP insists on it for wad images. and its a nightmare to get things working in all engines if we don't accept that quirk too.
|
||||
if (cachetype == 1)
|
||||
qcpics[i].pic = Draw_PicFromWad(picname + (strncmp(picname, "gfx/", 4)?0:4));
|
||||
if (flags & PICFLAG_WAD)
|
||||
qcpics[i].pic = Draw_PicFromWad2(picname + (strncmp(picname, "gfx/", 4)?0:4), texflags);
|
||||
else if (!strncmp(picname, "gfx/", 4) && !strchr(picname+4, '.'))
|
||||
qcpics[i].pic = Draw_PicFromWad(picname+4);
|
||||
qcpics[i].pic = Draw_PicFromWad2(picname+4, texflags);
|
||||
|
||||
//okay, not a wad pic, try and load a lmp/tga/etc
|
||||
if (!qcpics[i].pic)
|
||||
qcpics[i].pic = Draw_TryCachePic(picname);
|
||||
qcpics[i].pic = Draw_TryCachePic(picname, texflags);
|
||||
|
||||
if (i == numqcpics)
|
||||
numqcpics++;
|
||||
|
@ -5065,16 +5080,17 @@ static void PF_cl_drawresetclip(void)
|
|||
static void PF_cl_precachepic(void)
|
||||
{
|
||||
const char *name = G_STRING(OFS_PARM0);
|
||||
int trywad = (qcvm->argc>1)?!!G_FLOAT(OFS_PARM1):false;
|
||||
unsigned int flags = G_FLOAT(OFS_PARM1);
|
||||
|
||||
G_INT(OFS_RETURN) = G_INT(OFS_PARM0); //return input string, for convienience
|
||||
|
||||
DrawQC_CachePic(name, trywad);
|
||||
if (!DrawQC_CachePic(name, flags) && (flags & PICFLAG_BLOCK))
|
||||
G_INT(OFS_RETURN) = 0; //return input string, for convienience
|
||||
}
|
||||
static void PF_cl_iscachedpic(void)
|
||||
{
|
||||
const char *name = G_STRING(OFS_PARM0);
|
||||
if (DrawQC_CachePic(name, -1))
|
||||
if (DrawQC_CachePic(name, PICFLAG_NOLOAD))
|
||||
G_FLOAT(OFS_RETURN) = true;
|
||||
else
|
||||
G_FLOAT(OFS_RETURN) = false;
|
||||
|
@ -5083,7 +5099,7 @@ static void PF_cl_iscachedpic(void)
|
|||
static void PF_cl_drawpic(void)
|
||||
{
|
||||
float *pos = G_VECTOR(OFS_PARM0);
|
||||
qpic_t *pic = DrawQC_CachePic(G_STRING(OFS_PARM1), false);
|
||||
qpic_t *pic = DrawQC_CachePic(G_STRING(OFS_PARM1), PICFLAG_AUTO);
|
||||
float *size = G_VECTOR(OFS_PARM2);
|
||||
float *rgb = G_VECTOR(OFS_PARM3);
|
||||
float alpha = G_FLOAT (OFS_PARM4);
|
||||
|
@ -5098,7 +5114,7 @@ static void PF_cl_drawpic(void)
|
|||
|
||||
static void PF_cl_getimagesize(void)
|
||||
{
|
||||
qpic_t *pic = DrawQC_CachePic(G_STRING(OFS_PARM0), false);
|
||||
qpic_t *pic = DrawQC_CachePic(G_STRING(OFS_PARM0), PICFLAG_AUTO);
|
||||
if (pic)
|
||||
G_VECTORSET(OFS_RETURN, pic->width, pic->height, 0);
|
||||
else
|
||||
|
@ -5109,7 +5125,7 @@ static void PF_cl_drawsubpic(void)
|
|||
{
|
||||
float *pos = G_VECTOR(OFS_PARM0);
|
||||
float *size = G_VECTOR(OFS_PARM1);
|
||||
qpic_t *pic = DrawQC_CachePic(G_STRING(OFS_PARM2), false);
|
||||
qpic_t *pic = DrawQC_CachePic(G_STRING(OFS_PARM2), PICFLAG_AUTO);
|
||||
float *srcpos = G_VECTOR(OFS_PARM3);
|
||||
float *srcsize = G_VECTOR(OFS_PARM4);
|
||||
float *rgb = G_VECTOR(OFS_PARM5);
|
||||
|
@ -5152,7 +5168,7 @@ static polygonvert_t polygon_verts[256];
|
|||
static unsigned int polygon_numverts;
|
||||
static void PF_R_PolygonBegin(void)
|
||||
{
|
||||
qpic_t *pic = DrawQC_CachePic(G_STRING(OFS_PARM0), false);
|
||||
qpic_t *pic = DrawQC_CachePic(G_STRING(OFS_PARM0), PICFLAG_AUTO);
|
||||
int flags = (qcvm->argc>1)?G_FLOAT(OFS_PARM1):0;
|
||||
int is2d = (qcvm->argc>2)?G_FLOAT(OFS_PARM2):0;
|
||||
|
||||
|
@ -6988,7 +7004,7 @@ static struct
|
|||
// {"drawtextfield", PF_NoSSQC, PF_FullCSQCOnly, 0, PF_NoMenu, D("void(vector pos, vector size, float alignflags, string text)", "Draws a multi-line block of text, including word wrapping and alignment. alignflags bits are RTLB, typically 3.")},// (EXT_CSQC)
|
||||
// {"drawline", PF_NoSSQC, PF_FullCSQCOnly, 315, PF_NoMenu, D("void(float width, vector pos1, vector pos2, vector rgb, float alpha, optional float drawflag)", "Draws a 2d line between the two 2d points.")},// (EXT_CSQC)
|
||||
{"iscachedpic", PF_NoSSQC, PF_cl_iscachedpic, 316, PF_cl_iscachedpic,451, D("float(string name)", "Checks to see if the image is currently loaded. Engines might lie, or cache between maps.")},// (EXT_CSQC)
|
||||
{"precache_pic", PF_NoSSQC, PF_cl_precachepic, 317, PF_cl_precachepic,452, D("string(string name, optional float trywad)", "Forces the engine to load the named image. If trywad is specified, the specified name must any lack path and extension.")},// (EXT_CSQC)
|
||||
{"precache_pic", PF_NoSSQC, PF_cl_precachepic, 317, PF_cl_precachepic,452, D("string(string name, optional float flags)", "Forces the engine to load the named image. If trywad is specified, the specified name must any lack path and extension.")},// (EXT_CSQC)
|
||||
// {"r_uploadimage", PF_NoSSQC, PF_FullCSQCOnly, 0, PF_NoMenu, D("void(string imagename, int width, int height, int *pixeldata)", "Updates a texture with the specified rgba data. Will be created if needed.")},
|
||||
// {"r_readimage", PF_NoSSQC, PF_FullCSQCOnly, 0, PF_NoMenu, D("int*(string filename, __out int width, __out int height)", "Reads and decodes an image from disk, providing raw pixel data. Returns __NULL__ if the image could not be read for any reason. Use memfree to free the data once you're done with it.")},
|
||||
{"drawgetimagesize",PF_NoSSQC, PF_cl_getimagesize, 318, PF_cl_getimagesize,460, D("#define draw_getimagesize drawgetimagesize\nvector(string picname)", "Returns the dimensions of the named image. Images specified with .lmp should give the original .lmp's dimensions even if texture replacements use a different resolution.")},// (EXT_CSQC)
|
||||
|
@ -8069,6 +8085,11 @@ void PR_DumpPlatform_f(void)
|
|||
fprintf(f, "const float RF_NOSHADOW = %i;", RF_NOSHADOW);
|
||||
fprintf(f, "const float RF_WEIRDFRAMETIMES = %i;", RF_WEIRDFRAMETIMES);
|
||||
|
||||
fprintf(f, "const float PRECACHE_PIC_FROMWAD = %i;", PICFLAG_WAD);
|
||||
fprintf(f, "const float PRECACHE_PIC_WRAP = %i;", PICFLAG_WRAP);
|
||||
fprintf(f, "const float PRECACHE_PIC_MIPMAP = %i;", PICFLAG_MIPMAP);
|
||||
fprintf(f, "const float PRECACHE_PIC_TEST = %i;", PICFLAG_BLOCK);
|
||||
|
||||
fprintf(f, "const float SLIST_HOSTCACHEVIEWCOUNT = %i;", SLIST_HOSTCACHEVIEWCOUNT);
|
||||
fprintf(f, "const float SLIST_HOSTCACHETOTALCOUNT = %i;", SLIST_HOSTCACHETOTALCOUNT);
|
||||
fprintf(f, "const float SLIST_SORTFIELD = %i;", SLIST_SORTFIELD);
|
||||
|
|
|
@ -228,8 +228,8 @@ void Sbar_LoadPics (void)
|
|||
sb_face_invis_invuln = Draw_PicFromWad ("face_inv2");
|
||||
sb_face_quad = Draw_PicFromWad ("face_quad");
|
||||
|
||||
sb_sbar = Draw_PicFromWad ("sbar");
|
||||
sb_ibar = Draw_PicFromWad ("ibar");
|
||||
sb_sbar = Draw_PicFromWad2 ("sbar", TEXPREF_PAD|TEXPREF_NOPICMIP);
|
||||
sb_ibar = Draw_PicFromWad2 ("ibar", TEXPREF_PAD|TEXPREF_NOPICMIP);
|
||||
sb_scorebar = Draw_PicFromWad ("scorebar");
|
||||
|
||||
hudtype = 0;
|
||||
|
|
|
@ -3265,6 +3265,8 @@ void SV_SpawnServer (const char *server)
|
|||
//
|
||||
//memset (&sv, 0, sizeof(sv));
|
||||
Host_ClearMemory ();
|
||||
if(!isDedicated)
|
||||
Draw_ReloadTextures(false);
|
||||
|
||||
q_strlcpy (sv.name, server, sizeof(sv.name));
|
||||
|
||||
|
|
Loading…
Reference in a new issue