diff --git a/config/firstrun.cfg b/config/firstrun.cfg index ffd7936d..5524a3b2 100644 --- a/config/firstrun.cfg +++ b/config/firstrun.cfg @@ -3,6 +3,7 @@ music "pingpong/03-pp-kamikadze.ogg" (* 89 1000) " " // 90 secs, fade alias delayed_firstrun [ + new_gfx_quality 2 showmenu "QUICK setup" ] diff --git a/config/menus_settings.cfg b/config/menus_settings.cfg index 15f98919..174623f4 100644 --- a/config/menus_settings.cfg +++ b/config/menus_settings.cfg @@ -84,7 +84,6 @@ alias new_gfx_quality [ watersubdiv 2 dynlight 16 waterreflect 1 - stencilshadow 40 stencilbits 8 dynshadow 40 lighterror 1 @@ -101,7 +100,6 @@ alias new_gfx_quality [ watersubdiv 2 dynlight 16 waterreflect 1 - stencilshadow 40 stencilbits 8 dynshadow 40 lighterror 4 @@ -124,10 +122,8 @@ alias new_gfx_quality [ waterreflect 0 ] if (|| (glext "GL_EXT_stencil_two_side") (glext "GL_ATI_separate_stencil")) [ - stencilshadow 40 stencilbits 8 ] [ - stencilshadow 0 stencilbits 0 ] dynshadow 40 diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 07ba2cec..6ffad527 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -660,7 +660,9 @@ void startmap(const char *name) // called just after a map load // run once if(firstrun) { + persistidents = false; execfile("config/firstrun.cfg"); + persistidents = true; firstrun = false; } // execute mapstart event diff --git a/source/src/command.cpp b/source/src/command.cpp index 49651c8b..9def120e 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -5,7 +5,7 @@ #include "cube.h" bool allowidentaccess(ident *id); -char *exchangestr(char *o, char *n) { delete[] o; return newstring(n); } +char *exchangestr(char *o, const char *n) { delete[] o; return newstring(n); } int execcontext; @@ -124,22 +124,35 @@ char *svariable(const char *name, const char *cur, char **storage, void (*fun)() return newstring(cur); } -void setvar(const char *name, int i) { *idents->access(name)->storage.i = i; } -int getvar(const char *name) { return *idents->access(name)->storage.i; } -bool identexists(const char *name) { return idents->access(name)!=NULL; } - -void touchvar(const char *name) +#define _GETVAR(id, vartype, name, retval) \ + ident *id = idents->access(name); \ + if(!id || id->type!=vartype) return retval; +#define GETVAR(id, name, retval) _GETVAR(id, ID_VAR, name, retval) +void setvar(const char *name, int i, bool dofunc) { - ident *id = idents->access(name); - if(id) switch(id->type) - { - case ID_VAR: - case ID_FVAR: - case ID_SVAR: - if(id->fun) ((void (__cdecl *)())id->fun)(); // call trigger function if available - break; - } + GETVAR(id, name, ); + *id->storage.i = clamp(i, id->minval, id->maxval); + if(dofunc && id->fun) ((void (__cdecl *)())id->fun)(); // call trigger function if available } +void setfvar(const char *name, float f, bool dofunc) +{ + _GETVAR(id, ID_FVAR, name, ); + *id->storage.f = f; + if(dofunc && id->fun) ((void (__cdecl *)())id->fun)(); // call trigger function if available +} +void setsvar(const char *name, const char *str, bool dofunc) +{ + _GETVAR(id, ID_SVAR, name, ); + *id->storage.s = exchangestr(*id->storage.s, str); + if(dofunc && id->fun) ((void (__cdecl *)())id->fun)(); // call trigger function if available +} +int getvar(const char *name) +{ + GETVAR(id, name, 0); + return *id->storage.i; +} + +bool identexists(const char *name) { return idents->access(name)!=NULL; } const char *getalias(const char *name) { diff --git a/source/src/main.cpp b/source/src/main.cpp index 95a20544..f525a3a8 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -574,6 +574,7 @@ int main(int argc, char **argv) if(!notexture) fatal("could not find core textures (hint: run AssaultCube from the parent of the bin directory)"); initlog("console"); + persistidents = false; if(!execfile("config/font.cfg")) fatal("cannot find font definitions"); if(!setfont("default")) fatal("no default font specified"); @@ -597,7 +598,6 @@ int main(int argc, char **argv) docmenu = addmenu("reference", NULL, true, renderdocmenu); applymenu = addmenu("apply", "apply changes now?", true, refreshapplymenu); - persistidents = false; exec("config/scontext.cfg"); exec("config/keymap.cfg"); exec("config/menus.cfg"); @@ -641,7 +641,9 @@ int main(int argc, char **argv) preload_entmodels(); initlog("docs"); + persistidents = false; execfile("config/docs.cfg"); + persistidents = true; initlog("localconnect"); localconnect(); diff --git a/source/src/md2.h b/source/src/md2.h index 80f6c85f..5a36263e 100644 --- a/source/src/md2.h +++ b/source/src/md2.h @@ -247,11 +247,13 @@ struct md2 : vertmodel if(skin==notexture) conoutf("could not load model skin for %s", name1); loadingmd2 = this; s_sprintfd(name2)("packages/models/%s/md2.cfg", loadname); + persistidents = false; if(!execfile(name2)) { s_sprintf(name2)("packages/models/%s/md2.cfg", pname); execfile(name2); } + persistidents = true; loadingmd2 = 0; loopv(parts) parts[i]->scaleverts(scale/16.0f, vec(translate.x, -translate.y, translate.z)); radius = calcradius(); diff --git a/source/src/md3.h b/source/src/md3.h index 6cdc751f..1bed526a 100644 --- a/source/src/md3.h +++ b/source/src/md3.h @@ -211,14 +211,17 @@ struct md3 : vertmodel s_sprintfd(cfgname)("packages/models/%s/md3.cfg", loadname); loadingmd3 = this; + persistidents = false; if(execfile(cfgname) && parts.length()) // configured md3, will call the md3* commands below { + persistidents = true; loadingmd3 = NULL; if(parts.empty()) return false; loopv(parts) if(!parts[i]->filename) return false; } else // md3 without configuration, try default tris and skin { + persistidents = false; loadingmd3 = NULL; md3part &mdl = *new md3part; parts.add(&mdl); diff --git a/source/src/protos.h b/source/src/protos.h index ad5f1149..ecfeb21f 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -37,8 +37,9 @@ extern bool persistidents; extern int variable(const char *name, int min, int cur, int max, int *storage, void (*fun)(), bool persist); extern float fvariable(const char *name, float cur, float *storage, void (*fun)(), bool persist); extern char *svariable(const char *name, const char *cur, char **storage, void (*fun)(), bool persist); -extern void setvar(const char *name, int i); -extern void touchvar(const char *name); +extern void setvar(const char *name, int i, bool dofunc = false); +extern void setfvar(const char *name, float f, bool dofunc = false); +extern void setsvar(const char *name, const char *str, bool dofunc = false); extern int getvar(const char *name); extern bool identexists(const char *name); extern bool addcommand(const char *name, void (*fun)(), int narg); diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index 5bff2424..b2e28c45 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -87,12 +87,6 @@ void gl_checkextensions() if(strstr(exts, "GL_EXT_stencil_wrap")) hasSTW = true; - if((!hasST2 && !hasSTS) || !hasSTW) - { - // only enable stencil shadows by default if card is efficient at rendering them - stencilshadow = 0; - } - if(!strstr(exts, "GL_ARB_fragment_program")) { // not a required extension, but ensures the card has enough power to do reflections diff --git a/source/src/sound.cpp b/source/src/sound.cpp index b03442ae..fe0874f7 100644 --- a/source/src/sound.cpp +++ b/source/src/sound.cpp @@ -13,7 +13,7 @@ #include "vorbis/vorbisfile.h" #endif -VARF(audio, 0, 1, 1, initwarning("audio", INIT_RESET, CHANGE_SOUND)); +VARF(audio, 0, 1, 1, initwarning("sound configuration", INIT_RESET, CHANGE_SOUND)); VARP(audiodebug, 0, 0, 1); VARP(gainscale, 1, 100, 100); @@ -273,7 +273,7 @@ struct source // AC sound scheduler, manages available sound sources // under load it uses priority and distance information to reassign its resources -VARF(soundchannels, 4, 32, 1024, initwarning("soundchannels", INIT_RESET, CHANGE_SOUND)); +VARF(soundchannels, 4, 32, 1024, initwarning("sound configuration", INIT_RESET, CHANGE_SOUND)); struct sourcescheduler { diff --git a/source/src/world.cpp b/source/src/world.cpp index 0bae1240..ff519e22 100644 --- a/source/src/world.cpp +++ b/source/src/world.cpp @@ -339,9 +339,11 @@ void empty_world(int factor, bool force) // main empty world creation routine { toggleedit(); pushscontext(IEXC_MAPCFG); + persistidents = false; execfile("config/default_map_settings.cfg"); + persistidents = true; popscontext(); - execute("fullbright 1"); + setvar("fullbright", 1, true); } } } diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp index 0b440a06..28210d59 100644 --- a/source/src/worldio.cpp +++ b/source/src/worldio.cpp @@ -424,9 +424,11 @@ bool load_world(char *mname) // still supports all map formats that have startmap(mname); pushscontext(IEXC_MAPCFG); // untrusted altogether + persistidents = false; execfile("config/default_map_settings.cfg"); execfile(pcfname); execfile(mcfname); + persistidents = true; popscontext(); c2skeepalive();