From 870900f92fa27e811f6899253f27115e9f6a5728 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Sat, 3 Sep 2016 22:48:49 +0200 Subject: [PATCH] new map settings menu Containing all persistent per-map settings (stored in map config and map header). removed some random number nonsense --- config/menus_edit.cfg | 58 +++++++++++++++++++++++++++++---------- config/menus_licenses.cfg | 2 +- config/scripts.cfg | 18 ------------ source/src/clientgame.cpp | 6 ++-- 4 files changed, 48 insertions(+), 36 deletions(-) diff --git a/config/menus_edit.cfg b/config/menus_edit.cfg index e22e29cc..e7a1e90d 100644 --- a/config/menus_edit.cfg +++ b/config/menus_edit.cfg @@ -11,6 +11,7 @@ menuitem "Skymaps..." [ showmenu skymaps ] menuitem "Ambient sounds..." [ showmenu [Ambient sounds] ] menuitem "Arches and slopes..." [ showmenu Arches ] menuitem "Map operations..." [ showmenu [Map operations] ] +menuitem "Map settings..." [ showmenu [Map settings] ] menuitem "Map config operations..." [ showmenu [Map config operations] ] menuitem "Map checks and statistics..." [ showmenu [Map checks and statistics] ] menuitem "Bots..." [ showmenu [Creating bot waypoints] ] @@ -157,16 +158,52 @@ menuitem "Edit map message" editmapmsg menuitem "Select map license" [ showmenu "Select map license" ] menuitem "Edit map license comment" [ editsvar mapinfo_comment ] menuitem "Show map info" [ showmenu "Show map info" ] // FIXME: move to more appropriate menu -menuitem "Change waterlevel" [ saycommand [/waterlevel ] ] -menuitem "Change watercolour" [ showmenu [Water colour] ] -menuitem "Generate a random watercolour" genwc -menuitem "Generate a random fogcolour" [ fogcolour (genhex) ] menuitem "Print entity stats" entstats menuitem "Select the next closest entity" nextclosestent menuitem "Copy the current closest entity" copyent menuitem "Paste a previously copied entity" pasteent menuitemslider "Select only these entities: " 0 15 "$_closestenttypestatus" 1 [All Light Playerstart Pistol Ammobox Grenades Health Armour Akimbo Mapmodel Ladder CTF-flag Sound Clip Helmet PlayerClip] [ _closestentslider $arg1 ] +tempalias __enableautomapconfig [ if (&& $editing (! (getautomapconfig))) automapconfig ] + +newmenu [Map settings] +menuinit [ + resetcurmenu + if $editing [ + menuheader "" (concat " Settings for map" (curmap)) + menuitemtextinput (concatword "Water level (" (getvarrange min waterlevel) ".." (getvarrange max waterlevel) ", default " (getvarrange default waterlevel) "):\t") $waterlevel [waterlevel $arg1] + looplisti "red 20 green 25 blue 20 alpha 178" [n v] [ + menuitemtextinput (concatword "Water colour (" $n ", default " $v "):\t") (at (getwatercolour) $i) (concat setwatercolour $n "$arg1") + ] + menuitem "Water colour sliders..." [ showmenu [Water colour] ] + menuitem "" -1 + menuitemtextinput (concatword "Shadow yaw (0..360, default " (getvarrange default shadowyaw) "):\t") $shadowyaw [__enableautomapconfig ; shadowyaw $arg1] + menuitem "" -1 + menuitemtextinput (concatword "Fog distance (" (getvarrange min fog) ".." (getvarrange max fog) ", default " (getvarrange default fog) "):\t") $fog [__enableautomapconfig ; fog $arg1] + menuitemtextinput (concatword "Fog colour (0xrrggbb, default 0x" (h0 6 (getvarrange default fogcolour)) "):\t") (concatword "0x" (h0 6 $fogcolour)) [__enableautomapconfig ; fogcolour $arg1] + menuitem "Fog colour sliders..." [ showmenu [Fog colour] ] + menuitem "" -1 + menuitemtextinput (concatword "Ambient light (0..255 or 0xrrggbb, default 0):\t") (if (< $ambient 256) $ambient (concatword "0x" (h0 6 $ambient))) [ambient $arg1] + menuitem "" -1 + push n (getnotexture) + if (! (strlen $n)) [n = ] + menuitem (concatword "Notexture:\t\t\t\t" (pop n)) [showmenu "Set notexture"] + menuitem (concatword "Skymap:\t\t\t\t\t" $loadsky) [showmenu skymaps] + ] [ + menuitem "menu only available in edit mode" -1 + ] +] + +newmenu [Water colour] +looplisti [red green blue alpha] n [ + menuitemslider (concatword "Water colour (" $n "): ") 0 255 (concat "(at (getwatercolour)" $i ")") 5 [] (concat setwatercolour $i "$arg1") +] + +newmenu [Fog colour] +looplist [red 0xff0000 0x10000 green 0xff00 0x100 blue 0xff 1] [n m f] [ + menuitemslider (concatword "Fog colour (" $n "): ") 0 255 (concat "(div (&b $fogcolour " $m ")" $f ")") 5 [] (concat "__enableautomapconfig ; fogcolour (|b (&b $fogcolour" (^b 0xffffff $m) ") (* $arg1" $f "))") +] + // Map config operations newmenu [Map config operations] @@ -228,6 +265,8 @@ menuinit [ if (&& (strlen $__lastwatchedmapmodel) (! (strcmp $__lastwatchedmapmodel (at $info 4)))) [ menuitem (concat " change to" (escape $__lastwatchedmapmodel)) [editmapmodelslot $__mmslot "" "" "" "" $__lastwatchedmapmodel] ] + menuitem "" -1 + menuitem "Duplicate slot" (concat mapmodel $info) ] [ menuitem "\f3Unassigned slot" -1 ] @@ -553,16 +592,6 @@ menuinit [ // "closestenttype" slider... _closestentslider = [ closestenttype (at ["" light playerstart pistol ammobox grenades health armour akimbo mapmodel ladder ctf-flag sound clip helmet plclip] $arg1); _closestenttypestatus = $arg1 ] -redw = 1; greenw = 1; bluew = 1 - -newmenu [Water colour] - -menuitemslider "Red pigment: " 1 255 "$redw" 5 [] [ redw = $arg1 ] -menuitemslider "Green pigment: " 1 255 "$greenw" 5 [] [ greenw = $arg1 ] -menuitemslider "Blue pigment: " 1 255 "$bluew" 5 [] [ bluew = $arg1 ] -menuitem "" -1 -menuitem "\f2\t\t [ OK ]" [ watercolour $redw $greenw $bluew ] - newmenu [Editing settings] menuitemslider "Grid/Selection style: " 0 1 "$oldselstyle" 1 [triangles "squares (default)"] [ oldselstyle $arg1 ] menuitemcheckbox "Show mapmodel clippings: " "$showmodelclipping" [ showmodelclipping $arg1 ] @@ -1022,4 +1051,5 @@ menuinit [ ] ] + persistidents 1 diff --git a/config/menus_licenses.cfg b/config/menus_licenses.cfg index ca844374..fb3f2e77 100644 --- a/config/menus_licenses.cfg +++ b/config/menus_licenses.cfg @@ -125,7 +125,7 @@ tempalias __rebuildmaplicensemenu [ newmenu "Show map info" menuinit [ resetcurmenu - menuitem (concatword "Current map: \f1" (curmap)) -1 + menuitem (concatword "Current map: \fs\f1" (curmap) "\fr rev " $curmaprevision) -1 if (strlen $mapmsg) [ menuitem $mapmsg -1 ] diff --git a/config/scripts.cfg b/config/scripts.cfg index 6c05c716..4c06ae96 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -324,24 +324,6 @@ const countwalls [ pop __cnt ] -// genhex - Randomly generates a valid hexadecimal color value (e.g. 0x2FCAF1) - useful for finding fogcolours. -const genhex [ - push genhex [at [0 1 2 3 4 5 6 7 8 9 A B C D E F] (rnd 16)] - push tmp_hex (concatword 0x (genhex) (genhex) (genhex) (genhex) (genhex) (genhex)) - echo (red)Trying hexadecimal color: (white) $tmp_hex - result (pop tmp_hex genhex) -] - -// genwc - Randomly generates a valid watercolour value (e.g. 2 17 29) - useful for finding watercolours. -const genwc [ - if $editing [ - loop i 3 [push (concatword wc $i) (rrnd 1 256)] - echo (red)Trying water color: (white) $wc0 $wc1 $wc2 - watercolour $wc0 $wc1 $wc2 - pop wc0 wc1 wc2 - ] -] - // gencl - Randomly generates a valid coloured light. const gencl [ if $editing [ diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 370fe4d0..a496572c 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -1091,9 +1091,9 @@ void resetmap(bool mrproper) audiomgr.clearworldsounds(); setvar("gamespeed", 100); setvar("paused", 0); - setvar("fog", 180); - setvar("fogcolour", 0x8099B3); - setvar("shadowyaw", 45); + setvar("fog", DEFAULT_FOG); + setvar("fogcolour", DEFAULT_FOGCOLOUR); + setvar("shadowyaw", DEFAULT_SHADOWYAW); } }