1
0
Fork 0
forked from fte/fteqw

reworked texture loading. now favours shallower files over preferred extensions.

attempt to use wad/*.png for hud images too (ezquake compat).
image_list can now be used to show the filename the texture loader actually picked (including which package its from).
reworked loading screens a little. hopefully this should give qc a better chance of working with them.
added invert mouse pitch option to menusys menus, a couple of other tweaks too.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5049 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-01-24 20:15:14 +00:00
parent e23267b295
commit 1fcba85e20
20 changed files with 278 additions and 122 deletions

View file

@ -851,13 +851,13 @@ static qintptr_t CG_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
if (!*(char*)VM_POINTER(arg[0]))
VM_LONG(ret) = 0;
else
VM_LONG(ret) = VM_TOSHANDLE(R_RegisterPic(VM_POINTER(arg[0])));
VM_LONG(ret) = VM_TOSHANDLE(R_RegisterPic(VM_POINTER(arg[0]), NULL));
break;
case CG_R_REGISTERSHADERNOMIP:
if (!*(char*)VM_POINTER(arg[0]))
VM_LONG(ret) = 0;
else
VM_LONG(ret) = VM_TOSHANDLE(R_RegisterPic(VM_POINTER(arg[0])));
VM_LONG(ret) = VM_TOSHANDLE(R_RegisterPic(VM_POINTER(arg[0]), NULL));
break;
case CG_R_CLEARSCENE: //clear scene (not rtlights, only dynamic ones)

View file

@ -4674,13 +4674,14 @@ void Host_DoRunFile(hrf_t *f)
char *fdata = BZ_Malloc(len+1);
foo = VFS_READ(f->srcfile, fdata, len);
fdata[len] = 0;
if (foo != len)
if (foo != len || !len)
{
Con_Printf("Host_DoRunFile: unable to read file properly\n");
BZ_Free(fdata);
}
else
{
host_parms.manifest = Z_StrDup(fdata);
man = FS_Manifest_Parse(NULL, fdata);
if (man)
{

View file

@ -1709,7 +1709,11 @@ void SCR_DrawLoading (qboolean opaque)
return; //will be drawn as part of the regular screen updates
#ifdef MENU_DAT
if (MP_UsingGamecodeLoadingScreen())
{
if (opaque)
MP_Draw();
return; //menuqc should have just drawn whatever overlays it wanted.
}
#endif
//int mtype = M_GameType(); //unused variable
@ -1892,11 +1896,14 @@ void SCR_BeginLoadingPlaque (void)
// return;
// redraw with no console and the loading plaque
if (!scr_disabled_for_loading)
{
Sbar_Changed ();
scr_drawloading = true;
scr_disabled_for_loading = true;
SCR_UpdateScreen ();
scr_drawloading = false;
scr_disabled_for_loading = true;
}
scr_disabled_time = Sys_DoubleTime(); //realtime tends to change... Hmmm....
}
@ -1924,15 +1931,27 @@ void SCR_ImageName (const char *mapname)
if (!R_GetShaderSizes(R2D_SafeCachePic (levelshotname), NULL, NULL, true))
{
*levelshotname = '\0';
if (scr_disabled_for_loading)
return;
}
}
else
{
*levelshotname = '\0';
if (scr_disabled_for_loading)
return;
}
if (!scr_disabled_for_loading)
{
Sbar_Changed ();
scr_drawloading = true;
SCR_UpdateScreen ();
scr_drawloading = false;
scr_disabled_for_loading = true;
}
else
{
scr_disabled_for_loading = false;
scr_drawloading = true;
#ifdef GLQUAKE
@ -1944,6 +1963,7 @@ void SCR_ImageName (const char *mapname)
SCR_DrawConsole(!!*levelshotname);
}
#endif
}
scr_drawloading = false;
scr_disabled_time = Sys_DoubleTime(); //realtime tends to change... Hmmm....
@ -2920,6 +2940,9 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
SCR_DrawLoading(false);
SCR_ShowPics_Draw();
if (!scr_disabled_for_loading)
consolefocused = false;
}
else if (nohud)
{

View file

@ -676,7 +676,7 @@ void UI_RegisterFont(char *fontName, int pointSize, fontInfo_t *font)
Q_strncpyz(font->name, name, sizeof(font->name));
for (i = GLYPH_START; i < GLYPH_END; i++)
{
font->glyphs[i].glyph = VM_TOSHANDLE(R_RegisterPic(font->glyphs[i].shaderName));
font->glyphs[i].glyph = VM_TOSHANDLE(R_RegisterPic(font->glyphs[i].shaderName, NULL));
}
}
}
@ -899,7 +899,7 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
if (!*(char*)VM_POINTER(arg[0]))
VM_LONG(ret) = 0;
else
VM_LONG(ret) = VM_TOSHANDLE(R_RegisterPic(VM_POINTER(arg[0])));
VM_LONG(ret) = VM_TOSHANDLE(R_RegisterPic(VM_POINTER(arg[0]), NULL));
break;
case UI_R_CLEARSCENE: //clear scene

View file

@ -1962,7 +1962,7 @@ static int Con_DrawConsoleLines(console_t *con, conline_t *l, int sx, int ex, in
imgname = Info_ValueForKey(linkinfo, "img");
if (*imgname)
{
pic = R_RegisterPic(imgname);
pic = R_RegisterPic(imgname, NULL);
if (pic)
{
imgname = Info_ValueForKey(linkinfo, "w");
@ -2317,7 +2317,7 @@ void Con_DrawConsole (int lines, qboolean noback)
{
shader_t *shader = w->backshader;
if (!shader)
shader = w->backshader = R_RegisterPic(w->backimage);// R_RegisterCustom(w->backimage, SUF_NONE, Shader_DefaultCinematic, w->backimage);
shader = w->backshader = R_RegisterPic(w->backimage, NULL);// R_RegisterCustom(w->backimage, SUF_NONE, Shader_DefaultCinematic, w->backimage);
if (shader)
{
int top = 8;

View file

@ -4426,19 +4426,19 @@ static qboolean Image_LoadCubemapTexture(texid_t tex, char *nicename)
return true;
}
static void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t b)
static qboolean Image_LocateHighResTexture(image_t *tex, flocation_t *bestloc, char *bestname, size_t bestnamesize, unsigned int *bestflags)
{
image_t *tex = ctx;
char fname[MAX_QPATH], iname[MAX_QPATH], nicename[MAX_QPATH];
char fname[MAX_QPATH], nicename[MAX_QPATH];
int i, e;
char *buf;
size_t fsize;
int firstex = (tex->flags & IF_EXACTEXTENSION)?tex_extensions_count-1:0;
char *altname;
char *nextalt;
qboolean exactext = !!(tex->flags & IF_EXACTEXTENSION);
// Sys_Sleep(0.3);
int locflags = FSLF_DEPTH_INEXPLICIT|FSLF_DEEPONFAILURE;
int bestdepth = 0x7fffffff, depth;
int firstex = (tex->flags & IF_EXACTEXTENSION)?tex_extensions_count-1:0;
flocation_t loc;
for(altname = tex->ident;altname;altname = nextalt)
{
@ -4477,30 +4477,18 @@ static void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t
else
COM_StripExtension(altname, nicename, sizeof(nicename));
if ((tex->flags & IF_TEXTYPE) == IF_CUBEMAP)
{ //cubemaps require special handling because they are (normally) 6 files instead of 1.
//the exception is single-file dds cubemaps, but we don't support those.
if (!Image_LoadCubemapTexture(tex, nicename))
{
if (tex->flags & IF_NOWORKER)
Image_LoadTexture_Failed(tex, NULL, 0, 0);
else
COM_AddWork(WG_MAIN, Image_LoadTexture_Failed, tex, NULL, 0, 0);
}
return;
}
if (!tex->fallbackdata || (gl_load24bit.ival && !(tex->flags & IF_NOREPLACE)))
{
Q_snprintfz(fname, sizeof(fname), "dds/%s.dds", nicename);
if ((buf = COM_LoadFile (fname, 5, &fsize)))
depth = FS_FLocateFile(fname, locflags, &loc);
if (depth < bestdepth)
{
Q_snprintfz(iname, sizeof(iname), "dds/%s", nicename); /*should be safe if its null*/
if (Image_LoadTextureFromMemory(tex, tex->flags, iname, fname, buf, fsize))
return;
Q_strncpyz(bestname, fname, bestnamesize);
bestdepth = depth;
*bestloc = loc;
bestflags = 0;
}
if (strchr(nicename, '/') || strchr(nicename, '\\')) //never look in a root dir for the pic
i = 0;
else
@ -4553,11 +4541,13 @@ static void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t
if (!strcmp(tex_extensions[e].name, ".pcx"))
continue;
Q_snprintfz(fname, sizeof(fname), tex_path[i].path, subpath, basename, tex_extensions[e].name);
if ((buf = COM_LoadFile (fname, 5, &fsize)))
depth = FS_FLocateFile(fname, locflags, &loc);
if (depth < bestdepth)
{
Q_snprintfz(iname, sizeof(iname), "%s/%s", subpath, nicename); /*should be safe if its null*/
if (Image_LoadTextureFromMemory(tex, tex->flags, iname, fname, buf, fsize))
return;
Q_strncpyz(bestname, fname, bestnamesize);
bestdepth = depth;
*bestloc = loc;
bestflags = 0;
}
}
}
@ -4570,9 +4560,14 @@ static void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t
if (!strcmp(tex_extensions[e].name, ".pcx"))
continue;
Q_snprintfz(fname, sizeof(fname), tex_path[i].path, nicename, tex_extensions[e].name);
if ((buf = COM_LoadFile (fname, 5, &fsize)))
if (Image_LoadTextureFromMemory(tex, tex->flags, nicename, fname, buf, fsize))
return;
depth = FS_FLocateFile(fname, locflags, &loc);
if (depth < bestdepth)
{
Q_strncpyz(bestname, fname, bestnamesize);
bestdepth = depth;
*bestloc = loc;
bestflags = 0;
}
}
}
@ -4585,7 +4580,8 @@ static void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t
}
else
{
char bumpname[MAX_QPATH], *n, *b;
char bumpname[MAX_QPATH], *b;
const char *n;
b = bumpname;
n = nicename;
while(*n)
@ -4607,23 +4603,15 @@ static void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t
if (!strcmp(tex_extensions[e].name, ".tga"))
{
Q_snprintfz(fname, sizeof(fname), tex_path[i].path, bumpname, tex_extensions[e].name);
if ((buf = COM_LoadFile (fname, 5, &fsize)))
Q_snprintfz(fname, sizeof(fname), tex_path[i].path, nicename, tex_extensions[e].name);
depth = FS_FLocateFile(fname, locflags, &loc);
if (depth < bestdepth)
{
int w, h;
qboolean a;
qbyte *d;
if ((d = ReadTargaFile(buf, fsize, &w, &h, &a, 2))) //Only load a greyscale image.
{
BZ_Free(buf);
if (Image_LoadRawTexture(tex, tex->flags, d, NULL, w, h, TF_HEIGHT8))
{
BZ_Free(tex->fallbackdata);
tex->fallbackdata = NULL;
return;
}
}
else
BZ_Free(buf);
Q_strncpyz(bestname, fname, bestnamesize);
bestdepth = depth;
*bestloc = loc;
*bestflags = IF_TRYBUMP;
}
}
}
@ -4635,32 +4623,127 @@ static void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t
/*still failed? attempt to load quake lmp files, which have no real format id (hence why they're not above)*/
Q_strncpyz(fname, nicename, sizeof(fname));
COM_DefaultExtension(fname, ".lmp", sizeof(fname));
if (!(tex->flags & IF_NOPCX) && (buf = COM_LoadFile (fname, 5, &fsize)))
if (!(tex->flags & IF_NOPCX))
{
if (Image_LoadTextureFromMemory(tex, tex->flags, nicename, fname, buf, fsize))
return;
depth = FS_FLocateFile(fname, locflags, &loc);
if (depth < bestdepth)
{
Q_strncpyz(bestname, fname, bestnamesize);
bestdepth = depth;
*bestloc = loc;
bestflags = 0;
}
else
{
}
}
}
return bestdepth != 0x7fffffff;
}
static void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t b)
{
image_t *tex = ctx;
char fname[MAX_QPATH];
char *altname;
char *nextalt;
qboolean exactext = !!(tex->flags & IF_EXACTEXTENSION);
flocation_t loc;
unsigned int locflags;
vfsfile_t *f;
size_t fsize;
char *buf;
int imgwidth;
int imgheight;
qboolean alphaed;
//now look in wad files. (halflife compatability)
buf = W_GetTexture(nicename, &imgwidth, &imgheight, &alphaed);
// Sys_Sleep(0.3);
if ((tex->flags & IF_TEXTYPE) == IF_CUBEMAP)
{ //cubemaps require special handling because they are (normally) 6 files instead of 1.
//the exception is single-file dds cubemaps, but we don't support those.
for(altname = tex->ident;altname;altname = nextalt)
{
nextalt = strchr(altname, ':');
if (nextalt)
{
nextalt++;
if (nextalt-altname >= sizeof(fname))
continue; //too long...
memcpy(fname, altname, nextalt-altname-1);
fname[nextalt-altname-1] = 0;
altname = fname;
}
if (!Image_LoadCubemapTexture(tex, altname))
{
if (tex->flags & IF_NOWORKER)
Image_LoadTexture_Failed(tex, NULL, 0, 0);
else
COM_AddWork(WG_MAIN, Image_LoadTexture_Failed, tex, NULL, 0, 0);
}
}
return;
}
if (Image_LocateHighResTexture(tex, &loc, fname, sizeof(fname), &locflags))
{
f = FS_OpenReadLocation(&loc);
if (f)
{
fsize = VFS_GETLEN(f);
buf = BZ_Malloc(fsize);
if (buf)
{
if (Image_LoadRawTexture(tex, tex->flags, buf, NULL, imgwidth, imgheight, TF_RGBA32))
VFS_READ(f, buf, fsize);
VFS_CLOSE(f);
if (locflags & IF_TRYBUMP)
{ //it was supposed to be a heightmap image (that we need to convert to normalmap)
qbyte *d;
int w, h;
qboolean a;
if ((d = ReadTargaFile(buf, fsize, &w, &h, &a, 2))) //Only load a greyscale image.
{
BZ_Free(buf);
if (Image_LoadRawTexture(tex, tex->flags, d, NULL, w, h, TF_HEIGHT8))
{
BZ_Free(tex->fallbackdata);
tex->fallbackdata = NULL;
return;
}
BZ_Free(buf);
}
//guess not, fall back to normalmaps
}
if (Image_LoadTextureFromMemory(tex, tex->flags, tex->ident, loc.rawname, buf, fsize))
{
BZ_Free(tex->fallbackdata);
tex->fallbackdata = NULL;
return;
}
}
else
VFS_CLOSE(f);
}
}
//now look in wad files and swap over the fallback. (halflife compatability)
COM_StripExtension(tex->ident, fname, sizeof(fname));
buf = W_GetTexture(fname, &imgwidth, &imgheight, &alphaed);
if (buf)
{
BZ_Free(tex->fallbackdata);
tex->fallbackdata = buf;
tex->fallbackfmt = TF_RGBA32;
tex->fallbackwidth = imgwidth;
tex->fallbackheight = imgheight;
}
if (tex->fallbackdata)
{
if (Image_LoadRawTexture(tex, tex->flags, tex->fallbackdata, (char*)tex->fallbackdata+(tex->fallbackwidth*tex->fallbackheight), tex->fallbackwidth, tex->fallbackheight, tex->fallbackfmt))
@ -5072,14 +5155,26 @@ void Image_Purge(void)
void Image_List_f(void)
{
flocation_t loc;
image_t *tex, *a;
int loaded = 0, total = 0;
size_t mem = 0;
unsigned int loadflags;
char fname[MAX_QPATH];
for (tex = imagelist; tex; tex = tex->next)
{
total++;
if (tex->subpath)
Con_Printf("^h(%s)^h%s: ", tex->subpath, tex->ident);
Con_Printf("^h(%s)^h", tex->subpath);
if (Image_LocateHighResTexture(tex, &loc, fname, sizeof(fname), &loadflags))
{
char defuck[MAX_OSPATH], *bullshit;
Q_strncpyz(defuck, loc.search->logicalpath, sizeof(defuck));
while((bullshit=strchr(defuck, '\\')))
*bullshit = '/';
Con_Printf("^[%s\\desc\\%s/%s^]: ", tex->ident, defuck, fname);
}
else
Con_Printf("%s: ", tex->ident);

View file

@ -2805,7 +2805,7 @@ void M_Download_UpdateStatus(struct menu_s *m)
package_t *p = m->selecteditem->custom.dptr;
if (p->previewimage)
{
shader_t *sh = R_RegisterPic(p->previewimage);
shader_t *sh = R_RegisterPic(p->previewimage, NULL);
if (R_GetShaderSizes(sh, NULL, NULL, false) > 0)
R2D_Image(0, 0, vid.width, vid.height, 0, 0, 1, 1, sh);
}

View file

@ -164,7 +164,7 @@ static void M_Menu_LoadSave_Preview_Draw(int x, int y, menucustom_t *item, menu_
Image_UnloadTexture(info->picshader->defaulttextures->base);
R_UnloadShader(info->picshader);
}
info->picshader = R_RegisterPic(va("saves/%s/screeny.tga", m_saves[slot].sname));
info->picshader = R_RegisterPic(va("saves/%s/screeny.tga", m_saves[slot].sname), NULL);
}
if (info->picshader)
{
@ -176,7 +176,7 @@ static void M_Menu_LoadSave_Preview_Draw(int x, int y, menucustom_t *item, menu_
break;
case 0:
if (*m_saves[slot].map)
pic = R_RegisterPic(va("levelshots/%s", m_saves[slot].map));
pic = R_RegisterPic(va("levelshots/%s", m_saves[slot].map), NULL);
break;
}
if (pic)

View file

@ -1375,7 +1375,7 @@ void QCBUILTIN PF_R_PolygonBegin(pubprogfuncs_t *prinst, struct globalvars_s *pr
beflags |= BEF_FORCETWOSIDED;
if (twod)
shader = R_RegisterPic(PR_GetStringOfs(prinst, OFS_PARM0));
shader = R_RegisterPic(PR_GetStringOfs(prinst, OFS_PARM0), NULL);
else
shader = R_RegisterSkin(PR_GetStringOfs(prinst, OFS_PARM0), NULL);
@ -1524,7 +1524,7 @@ void QCBUILTIN PF_R_AddTrisoup(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
beflags |= BEF_FORCETWOSIDED;
if (twod)
shader = R_RegisterPic(PR_GetStringOfs(prinst, OFS_PARM0));
shader = R_RegisterPic(PR_GetStringOfs(prinst, OFS_PARM0), NULL);
else
shader = R_RegisterSkin(PR_GetStringOfs(prinst, OFS_PARM0), NULL);

View file

@ -2761,8 +2761,11 @@ void MP_Draw(void)
((float *)pr_globals)[OFS_PARM0+0] = vid.width;
((float *)pr_globals)[OFS_PARM0+1] = vid.height;
((float *)pr_globals)[OFS_PARM0+2] = 0;
if (mp_drawloading_function && scr_drawloading)
if (mp_drawloading_function && (scr_drawloading||scr_disabled_for_loading))
{
((float *)pr_globals)[OFS_PARM1] = scr_disabled_for_loading;
PR_ExecuteProgram(menu_world.progs, mp_drawloading_function);
}
else if (mp_draw_function)
PR_ExecuteProgram(menu_world.progs, mp_draw_function);
inmenuprogs--;

View file

@ -406,7 +406,7 @@ mpic_t *R2D_SafeCachePic (const char *path)
shader_t *s;
if (!qrenderer)
return NULL;
s = R_RegisterPic(path);
s = R_RegisterPic(path, NULL);
return s;
}
@ -526,7 +526,7 @@ apic_t *R2D_LoadAtlasedPic(const char *name)
}
else if (1)
{
apic->atlas = R_RegisterPic(va("gfx/%s", name));
apic->atlas = R_RegisterPic(va("gfx/%s", name), "wad");
apic->sl = 0;
apic->sh = 1;
apic->tl = 0;
@ -871,7 +871,7 @@ void QDECL R2D_Conback_Callback(struct cvar_s *var, char *oldvalue)
}
if (*var->string)
conback = R_RegisterPic(var->string);
conback = R_RegisterPic(var->string, NULL);
if (!R_GetShaderSizes(conback, NULL, NULL, true))
{
conback = R_RegisterCustom("console", SUF_2D, NULL, NULL); //quake3
@ -879,13 +879,13 @@ void QDECL R2D_Conback_Callback(struct cvar_s *var, char *oldvalue)
{
#ifdef HEXEN2
if (M_GameType() == MGT_HEXEN2)
conback = R_RegisterPic("gfx/menu/conback.lmp");
conback = R_RegisterPic("gfx/menu/conback.lmp", NULL);
else
#endif
if (M_GameType() == MGT_QUAKE2)
conback = R_RegisterPic("pics/conback.pcx");
conback = R_RegisterPic("pics/conback.pcx", NULL);
else
conback = R_RegisterPic("gfx/conback.lmp");
conback = R_RegisterPic("gfx/conback.lmp", NULL);
}
}
}

View file

@ -715,14 +715,18 @@ void Sys_Sleep (double seconds)
#ifdef HAVEAUTOUPDATE
int Sys_GetAutoUpdateSetting(void)
{
return UPD_UNSUPPORTED;
}
void Sys_SetAutoUpdateSetting(int newval)
{
}
//legacy, so old build can still deal with updates properly
void Sys_SetUpdatedBinary(const char *fname)
{
}
//says whether the system code is able to invoke new binaries properly
qboolean Sys_EngineCanUpdate(void)
{
return false; //nope, nothing here
}
//invoke the given system-path binary
qboolean Sys_EngineWasUpdated(char *newbinary)
{
return false; //sorry
}
#endif

View file

@ -202,6 +202,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef AVAIL_OPENAL //just bloat...
#define NOMEDIA //NO playing of avis/cins/roqs
#define Q1BSPS
#define SPRMODELS //quake1 sprite models
#define MD3MODELS //we DO want to use quake3 alias models. This might be a minimal build, but we still want this.
#define PLUGINS

View file

@ -88,6 +88,9 @@ qboolean GLSCR_UpdateScreen (void)
{
scr_drawloading = true;
SCR_DrawLoading (true);
SCR_SetUpToDrawConsole();
if (Key_Dest_Has(kdm_console))
SCR_DrawConsole(false);
scr_drawloading = false;
if (R2D_Flush)
R2D_Flush();

View file

@ -6972,10 +6972,10 @@ int R_GetShaderSizes(shader_t *shader, int *width, int *height, qboolean blockti
return false;
}
}
shader_t *R_RegisterPic (const char *name)
shader_t *R_RegisterPic (const char *name, const char *subdirs)
{
shader_t *shader;
shader = R_LoadShader (name, SUF_2D, Shader_Default2D, NULL);
shader = R_LoadShader (name, SUF_2D, Shader_Default2D, subdirs);
return shader;
}

View file

@ -617,7 +617,7 @@ extern int be_maxpasses;
char *Shader_GetShaderBody(shader_t *s, char *fname, size_t fnamesize);
void R_UnloadShader(shader_t *shader);
int R_GetShaderSizes(shader_t *shader, int *width, int *height, qboolean blocktillloaded);
shader_t *R_RegisterPic (const char *name);
shader_t *R_RegisterPic (const char *name, const char *subdirs);
shader_t *QDECL R_RegisterShader (const char *name, unsigned int usageflags, const char *shaderscript);
shader_t *R_RegisterShader_Lightmap (const char *name);
shader_t *R_RegisterShader_Vertex (const char *name);

View file

@ -66,7 +66,6 @@ crosses a waterline.
int needcleanup;
//int fatbytes;
int glowsize, glowcolor; // made it a global variable, to suppress msvc warning.
#ifdef Q2BSPS
unsigned int SV_Q2BSP_FatPVS (model_t *mod, vec3_t org, qbyte *resultbuf, unsigned int buffersize, qboolean add)
@ -2837,7 +2836,7 @@ int glowsize=0, glowcolour=0, colourmod=0;
glowsize = ent->glowsize;
glowcolor = ent->glowcolour;
glowcolour = ent->glowcolour;
colourmod = ((int)bound(0, ent->colormod[0] * (7.0f / 32.0f), 7) << 5) | ((int)bound(0, ent->colormod[1] * (7.0f / 32.0f), 7) << 2) | ((int)bound(0, ent->colormod[2] * (3.0f / 32.0f), 3) << 0);
@ -2916,7 +2915,7 @@ int glowsize=0, glowcolour=0, colourmod=0;
if (bits & DPU_SCALE) MSG_WriteByte(msg, ent->scale);
if (bits & DPU_EFFECTS2) MSG_WriteByte(msg, eff >> 8);
if (bits & DPU_GLOWSIZE) MSG_WriteByte(msg, glowsize);
if (bits & DPU_GLOWCOLOR) MSG_WriteByte(msg, glowcolor);
if (bits & DPU_GLOWCOLOR) MSG_WriteByte(msg, glowcolour);
if (bits & DPU_COLORMOD) MSG_WriteByte(msg, colourmod);
if (bits & DPU_FRAME2) MSG_WriteByte(msg, ent->frame >> 8);
if (bits & DPU_MODEL2) MSG_WriteByte(msg, ent->modelindex >> 8);

View file

@ -31,10 +31,35 @@ static string() skinopts =
return opts;
};
var float autocvar_m_pitch = 0.022;
class options_basic : mitem_exmenu
{
virtual string(string key) get =
{
if (key == "m_pitchsign")
return (autocvar_m_pitch<0)?"1":"0";
return super::get(key);
};
virtual void(string key, string newval) set =
{
if (key == "m_pitchsign")
{
float invert;
if (stof(newval))
invert = autocvar_m_pitch > 0;
else
invert = autocvar_m_pitch < 0;
if (invert)
cvar_set("m_pitch", ftos(-autocvar_m_pitch));
}
else
super::set(key, newval);
};
};
nonstatic void(mitem_desktop desktop) M_Options_Basic =
{
mitem_exmenu m;
m = spawn(mitem_exmenu, item_text:_("Basic Options"), item_flags:IF_SELECTABLE, item_command:"m_options");
m = spawn(options_basic, item_text:_("Basic Options"), item_flags:IF_SELECTABLE, item_command:"m_options");
desktop.add(m, RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MIN | RS_X_MAX_PARENT_MAX|RS_Y_MAX_PARENT_MAX, '0 0', '0 0');
desktop.item_focuschange(m, IF_KFOCUSED);
m.totop();
@ -60,9 +85,7 @@ nonstatic void(mitem_desktop desktop) M_Options_Basic =
if (assumefalsecheckcommand("bottomcolor"))
fr.add(menuitemcolour_spawn(_("Lower Colour"), "bottomcolor", '280 8'), fl, [0, pos], [0, 8]); pos += 8; /*aka: arse colour*/
pos += 8;
// it = spawn(mitem_check, item_text:_("Invert Mouse"), item_command:"m_pitch", item_scale:8, item_size:'280 8');
// it.item_dynamicvalue = idv_cvar_invert;
// fr.add(it, fr, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemcheck_spawn (_("Invert Mouse"), "m_pitchsign", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemslider_spawn(_("Sensitivity"), "sensitivity", '3 20 1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemslider_spawn(_("Fov"), "fov", '80 130 5', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemslider_spawn(_("Gamma"), dp("v_gamma", "gamma"), '0.4 1.3 0.1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;

View file

@ -18,6 +18,10 @@ nonstatic void(mitem_desktop desktop) M_Options_Effects =
fr.add(menuitemcheck_spawn(_("Show Framerate"), dp("showfps", "show_fps"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemcheck_spawn(_("Bloom"), "r_bloom", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
if (assumefalsecheckcommand("r_drawflat"))
fr.add(menuitemcheck_spawn(_("Simple Textures"), "r_drawflat", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
if (assumefalsecheckcommand("r_softwarebanding"))
fr.add(menuitemcheck_spawn(_("Colourmapped Rendering"), "r_softwarebanding", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemcheck_spawn(_("HDR"), "r_hdr_irisadaptation", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemcheck_spawn(_("Coronas"), "r_coronas", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemcheck_spawn(_("High Res Textures"), "gl_load24bit", '280 8'), fl, [0, pos], [0, 8]); pos += 8;

View file

@ -73,13 +73,13 @@ nonstatic void(mitem_desktop desktop) M_Options_Video =
// "60 \"60\" "
// "75 \"75\" "
)), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemcheck_spawn(_("VSync"), dp("vid_vsync", "vid_wait"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemcheck_spawn(_("Show Framerate"), dp("showfps", "show_fps"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemslider_spawn(_("View Size"), "viewsize", '50 120 10', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemslider_spawn(_("Field Of View"), "fov", '50 140 5', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemslider_spawn(_("Gamma"), "gamma", '1.3 0.5 -0.1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemslider_spawn(_("Contrast"), "contrast", '0.7 2 0.1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemslider_spawn(_("Brightness"), "brightness", '0 0.4 0.05', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemcheck_spawn(_("VSync"), dp("vid_vsync", "vid_wait"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemcheck_spawn(_("Show Framerate"), dp("showfps", "show_fps"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
addmenuback(m);
};