From 856646b4c9c1e1533f6ff4a9dd97a59d8cefaa34 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Wed, 14 May 2008 22:15:45 +0000 Subject: [PATCH] allow GL extension checking from cfgs git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1973 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/menus_settings.cfg | 7 ++++++- source/src/clientgame.cpp | 2 +- source/src/command.cpp | 2 ++ source/src/command.h | 1 + source/src/docs.cpp | 2 +- source/src/rendergl.cpp | 9 ++++++++- source/src/weapon.cpp | 4 ++-- 7 files changed, 21 insertions(+), 6 deletions(-) diff --git a/config/menus_settings.cfg b/config/menus_settings.cfg index 9b50c9f4..315116bc 100644 --- a/config/menus_settings.cfg +++ b/config/menus_settings.cfg @@ -114,7 +114,12 @@ alias new_gfx_quality [ fpsrange 30 40 watersubdiv 4 dynlight 16 - waterreflect 1 + if (glext "GL_ARB_fragment_program") [ + // make sure the 3D card is powerful enough for this + waterreflect 1 + ] [ + waterreflect 0 + ] dynshadow 40 lighterror 4 scorch 1 diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 0a9092fd..8ef5c3ba 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -131,7 +131,7 @@ int curteam() { return team_int(player1->team); } COMMANDN(team, newteam, ARG_1STR); COMMANDN(name, newname, ARG_1STR); COMMANDN(skin, newskin, ARG_1INT); -COMMAND(curteam, ARG_1EXP); +COMMAND(curteam, ARG_IVAL); VARP(showscoresondeath, 0, 1, 1); void deathstate(playerent *pl) diff --git a/source/src/command.cpp b/source/src/command.cpp index 77e9ff4e..bdd3e403 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -289,6 +289,8 @@ char *executeret(const char *p) // all evaluation hap case ARG_2EXP: intret(((int (__cdecl *)(int, int))id->fun)(ATOI(w[1]), ATOI(w[2]))); break; case ARG_1EST: intret(((int (__cdecl *)(char *))id->fun)(w[1])); break; case ARG_2EST: intret(((int (__cdecl *)(char *, char *))id->fun)(w[1], w[2])); break; + case ARG_IVAL: intret(((int (__cdecl *)())id->fun)()); break; + case ARG_SVAL: result(((const char * (__cdecl *)())id->fun)()); break; case ARG_VARI: case ARG_VARIW: { diff --git a/source/src/command.h b/source/src/command.h index 9814bdb1..18d1ac3b 100644 --- a/source/src/command.h +++ b/source/src/command.h @@ -71,6 +71,7 @@ enum // function signatures for script functions, see command.cpp ARG_DOWN, ARG_1EXP, ARG_2EXP, ARG_1EST, ARG_2EST, + ARG_IVAL, ARG_SVAL, ARG_VARI, ARG_VARIW }; diff --git a/source/src/docs.cpp b/source/src/docs.cpp index 252cfb99..a9784bd3 100644 --- a/source/src/docs.cpp +++ b/source/src/docs.cpp @@ -248,7 +248,7 @@ void docwritebaseref(char *ref, char *schemalocation, char *transformation) if(id.type != ID_COMMAND) continue; fprintf(f, "\t\t\t\t\n", xmlstringenc(name, id.name, _MAXDEFSTR)); fprintf(f, "\t\t\t\t\t%s\n", desc); - if(id.narg != ARG_NONE && id.narg != ARG_DOWN) + if(id.narg != ARG_NONE && id.narg != ARG_DOWN && id.narg != ARG_IVAL && id.narg != ARG_SVAL) { fprintf(f, "\t\t\t\t\t\n"); if(id.narg == ARG_VARI) fprintf(f, "\t\t\t\t\t\t\n"); diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index 24884aba..96e8cc6f 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -21,6 +21,13 @@ void *getprocaddress(const char *name) return SDL_GL_GetProcAddress(name); } +int glext(char *ext) +{ + const char *exts = (const char *)glGetString(GL_EXTENSIONS); + return strstr(exts, ext) != NULL; +} +COMMAND(glext, ARG_1EST); + void gl_checkextensions() { const char *vendor = (const char *)glGetString(GL_VENDOR); @@ -49,7 +56,7 @@ void gl_checkextensions() hasMDA = true; } - if(!strstr(exts, "GL_EXT_fragment_program")) + if(!strstr(exts, "GL_ARB_fragment_program")) { // not a required extension, but ensures the card has enough power to do reflections extern int waterreflect, waterrefract; diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 505259e7..313409c7 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -69,8 +69,8 @@ int magreserve(int w) { if(w > 0 && w < NUMGUNS) return player1->weapons[w]->amm COMMANDN(weapon, selectweaponi, ARG_1INT); COMMAND(shiftweapon, ARG_1INT); -COMMAND(currentprimary, ARG_1EST); -COMMAND(curweapon, ARG_1EXP); +COMMAND(currentprimary, ARG_IVAL); +COMMAND(curweapon, ARG_IVAL); COMMAND(magcontent, ARG_1EXP); COMMAND(magreserve, ARG_1EXP);