From 300d702619331853c81a4a8a869241efa1e3c8c8 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Tue, 30 Aug 2016 22:57:03 +0200 Subject: [PATCH] add menu to set notexture Allows to reset notexture, to set a high-contrast color to find and fix the areas and to set to a useful default texture. As useful textures, in addition to rock.jpg and concrete.jpg, the menu lists the default wall, floor and ceiling textures of the current map, and also the last watched texture from the texture menu. Also adds a few checks to detect unconverted map config files and misuse of the new bright highlight textures. --- config/menus_edit.cfg | 26 ++++++++++++++++++ packages/textures/map_editor/marker/black.png | Bin 0 -> 82 bytes packages/textures/map_editor/marker/blue.png | Bin 0 -> 100 bytes packages/textures/map_editor/marker/green.png | Bin 0 -> 98 bytes packages/textures/map_editor/marker/red.png | Bin 0 -> 98 bytes .../textures/map_editor/marker/yellow.png | Bin 0 -> 98 bytes source/src/rendermodel.cpp | 2 ++ source/src/texture.cpp | 12 ++++++++ 8 files changed, 40 insertions(+) create mode 100644 packages/textures/map_editor/marker/black.png create mode 100644 packages/textures/map_editor/marker/blue.png create mode 100644 packages/textures/map_editor/marker/green.png create mode 100644 packages/textures/map_editor/marker/red.png create mode 100644 packages/textures/map_editor/marker/yellow.png diff --git a/config/menus_edit.cfg b/config/menus_edit.cfg index a152be51..c2c20951 100644 --- a/config/menus_edit.cfg +++ b/config/menus_edit.cfg @@ -361,6 +361,7 @@ newmenu textures menuitem "Browse official textures" [ showmenu "Official textures" ] menuitem "Browse custom/downloaded textures" [ showmenu "Custom textures" ] menuitem "Edit texture slots of current map" [ showmenu "Edit texture slots" ] +menuitem "Set notexture" [ showmenu "Set notexture" ] newmenu "Official textures" menuinit __rebuildtexturemenus @@ -399,6 +400,31 @@ menuinit [ ] ] +newmenu "Set notexture" +menuinit [ + resetcurmenu + menurenderoffset -20 0 + push m (escape (curmenu)) + push t (concat chmenutexture $m "[]") + if (strlen (getnotexture)) [ + menuitem (concat Current notexture: (getnotexture)) (concat loadnotexture (getnotexture)) (concat chmenutexture $m (getnotexture)) + ] + menuitem "Reset notexture" loadnotexture $t // no preview possible + menuitem "" -1 $t + menuitem "\f1Pick a notexture to highlight the areas" -1 $t + looplist (gettexturelist "map_editor/marker" "" ".png") [tpath tname td] [ + fullname = (concatword $tpath "/" $tname) + menuitem (concat Set notexture to $tname) (concat loadnotexture (escape $fullname)) (concat chmenutexture $m (escape $fullname)) + ] + menuitem "" -1 $t + menuitem "\f1Pick a notexture for actual use" -1 $t + menuitem "\f4(as default texture, if custom texture downloads fail)" -1 $t + looplist (concat makke/rock.jpg makke/concrete.jpg (at (edittextureslot 2) 1) (at (edittextureslot 3) 1) (at (edittextureslot 4) 1) $__lastwatchedtexture) fn [ + menuitem (concat Set notexture to $fn) (concat loadnotexture (escape $fn)) (concat chmenutexture $m (escape $fn)) + ] + pop m t +] + // Browse mapsounds newmenu [Ambient sounds] menuitem "Browse official mapsounds" [ showmenu "Official mapsounds" ] diff --git a/packages/textures/map_editor/marker/black.png b/packages/textures/map_editor/marker/black.png new file mode 100644 index 0000000000000000000000000000000000000000..cac8115261ebc8ff4f6d349fba3e1ba12ac2ec0c GIT binary patch literal 82 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={WBt2amLp+YZJ!r@XFVdQ&MBb@0MH5(zW@LL literal 0 HcmV?d00001 diff --git a/packages/textures/map_editor/marker/blue.png b/packages/textures/map_editor/marker/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..6847f70044f05a2de8fed3500064f1328c17e4b4 GIT binary patch literal 100 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={Wv^`xMLp+YZJ?qHG;K0IQpf^+C xS9qc7k6hMiSB0m?$p~|>Ff}?T2yn1O+burMc-dpmBXyuQ22WQ%mvv4FO#pwY8bbg8 literal 0 HcmV?d00001 diff --git a/packages/textures/map_editor/marker/green.png b/packages/textures/map_editor/marker/green.png new file mode 100644 index 0000000000000000000000000000000000000000..9e14f9675d64b61ded2e7da94b6224e6c60594cc GIT binary patch literal 98 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={WG(BA$Lp+YZJ!{Cwz`(*_pmKS? wi0Y4ROsD7d`HP-sVQO?x5a3{8IyjYelRV@8>jk@GftnaRUHx3vIVCg!09_;+Q2+n{ literal 0 HcmV?d00001 diff --git a/packages/textures/map_editor/marker/red.png b/packages/textures/map_editor/marker/red.png new file mode 100644 index 0000000000000000000000000000000000000000..844ceae3db3684a3939a5115e41e00aa8d16fb3c GIT binary patch literal 98 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={WG(BA$Lp+YZJ!{Cwz`(*_kaA@| wm+FsgOs8M=`HP-sVQO?x5a3{8IyjYe`V7YBUM0ehftnaRUHx3vIVCg!0C0;Mt^fc4 literal 0 HcmV?d00001 diff --git a/packages/textures/map_editor/marker/yellow.png b/packages/textures/map_editor/marker/yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..67209fb348d58ed374d5f9977e53b64087c396aa GIT binary patch literal 98 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={WG(BA$Lp+YZJ!{Cwz`(*_kaA@| wm+FsgOs8k|`HP-sVQO?x5a3{8IyjYegA~)GZR?-g12r*ty85}Sb4q9e0A+g`d;kCd literal 0 HcmV?d00001 diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 1ff253c5..cd019fd4 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -113,6 +113,7 @@ void mapmodel(int *rad, int *h, int *zoff, char *scale, char *name) { if(*scale && *name) // ignore "mapmodel" commands with insufficient parameters { + if(!strchr(name, '/') && !strchr(name, '\\')) flagmapconfigerror(LWW_CONFIGERR * 2); // throw errors for unconverted mapmodels (unspecific, because not all get detected) intret(mapmodels.length()); mapmodelinfo &mmi = mapmodels.add(); mmi.rad = *rad; @@ -131,6 +132,7 @@ void mapmodel(int *rad, int *h, int *zoff, char *scale, char *name) mapmodelchanged = 1; flagmapconfigchange(); } + else flagmapconfigerror(LWW_CONFIGERR * 2); } COMMAND(mapmodel, "iiiss"); diff --git a/source/src/texture.cpp b/source/src/texture.cpp index f80554aa..b4e5cbf4 100644 --- a/source/src/texture.cpp +++ b/source/src/texture.cpp @@ -496,6 +496,15 @@ void _texture(Slot &s, float *scale, char *name) } } +void checktexturefilename(const char *name) +{ + if(execcontext == IEXC_MAPCFG && strstr(name, "map_editor")) + { + conoutf("\f3bad texture: %s", name); + flagmapconfigerror(LWW_CONFIGERR * 4); + } +} + COMMANDF(texture, "fs", (float *scale, char *name) { intret(slots.length()); @@ -506,6 +515,7 @@ COMMANDF(texture, "fs", (float *scale, char *name) conoutf("\f3texture slot #%d \"%s\" error: scale factor %.7g out of range 0..4", slots.length() - 1, name, *scale); flagmapconfigerror(LWW_CONFIGERR * 4); } + checktexturefilename(name); flagmapconfigchange(); }); @@ -578,6 +588,7 @@ bool loadskymap(bool reload) { int n = strlen(legacyprefix); filtertext(loadsky, loadsky, FTXT__MEDIAFILEPATH); + checktexturefilename(loadsky); if(!strncmp(loadsky, legacyprefix, n)) { // remove the prefix char *t = loadsky; @@ -609,6 +620,7 @@ void loadnotexture(char *c) *mapconfigdata.notexturename = '\0'; if(c[0]) { + checktexturefilename(c); filtertext(mapconfigdata.notexturename, c, FTXT__MEDIAFILEPATH); defformatstring(p)("packages/textures/%s", mapconfigdata.notexturename); noworldtexture = textureload(p);