diff --git a/config/menus.cfg b/config/menus.cfg index c40a056c..47e66cfe 100755 --- a/config/menus.cfg +++ b/config/menus.cfg @@ -1,3 +1,7 @@ +// check for an installed mappack +alias mappack_version 0; alias mappack_maps ""; alias mappack_flagmaps "" +exec config/menus_mappack.cfg + // standard menu definitions newmenu main @@ -8,7 +12,7 @@ menuitem "Settings" "showmenu settings" menuitem "Demo" [ showmenu "Play demo" ] menuitem "Editing" "showmenu editing" menuitem "Help" "showmenu help" -menuitem "About" "menu_about" +menuitem "About" "showmenu about" menuitem "Quit" "savequit" @@ -31,21 +35,29 @@ newmenu maps alias defaultmaps "ac_arctic ac_complex ac_depot ac_desert ac_desert2 ac_desert3 ac_douze ac_elevation ac_gothic ac_keller ac_mines ac_power ac_scaffold ac_shine ac_snow ac_sunset ac_toxic ac_urban" genmapitems $defaultmaps menuitem "" -1 +if (&& $mappack_version (listlen $mappack_maps)) [menuitem (concatword "Map-pack (version " $mappack_version ") maps...") [showmenu "mappack maps"]]; menuitem "Show all maps..." [ showmenu "all maps" ] newmenu "all maps" menudirlist "packages/maps" "cgz" "map $arg1" - newmenu maps_flags // Add maps to the below list to include them in the CTF, KTF & TKTF map menu. Maps should contain flags here. alias ctfmaps "ac_depot ac_desert3 ac_douze ac_elevation ac_gothic ac_keller ac_mines ac_power ac_shine ac_sunset ac_urban" genmapitems $ctfmaps menuitem "" -1 +if (&& $mappack_version (listlen $mappack_flagmaps)) [menuitem (concatword "Map-pack (version " $mappack_version ") maps...") [showmenu "mappack flag maps"]]; menuitem "Show all maps.." [showmenu "all maps"] +if $mappack_version [ + newmenu "mappack maps" + genmapitems $mappack_maps + newmenu "mappack flag maps" + genmapitems $mappack_flagmaps +] + newmenu Demo // If in-game (playing demos isn't needed) menuitem "Start recording a demo" "recorddemo" @@ -71,6 +83,7 @@ newmenu about menuitem "AssaultCube v1.0" -1 menuitem " ...Help" "showmenu help" menuitem " ...Credits" "showmenu Credits" +if $mappack_version [ menuitem " ...Map-pack credits" [ showmenu "about mappack" ]]; menuitem "" -1 menuitem "by 'Rabid Viper Productions'" "showmenu Credits" menuitem " 1http://assault.cubers.net/" -1 // URL's are colourised blue, like a hyperlink normally is... @@ -183,10 +196,3 @@ exec config/menus_edit.cfg exec config/menus_settings.cfg exec config/menus_multiplayer.cfg -// Menu-specific stuff for the map-pack. -exec config/menus_mappack.cfg -alias menu_about [ if (= $mappackinstalled 0) [ showmenu about ] [ showmenu "Map-pack: About" ] ] -alias menu_maps [ if (= $mappackinstalled 0) [ showmenu maps ] [ showmenu "Map-pack: Maps" ] ] -alias menu_maps_flags [ if (= $mappackinstalled 0) [ showmenu maps_flags ] [ showmenu "Map-pack: Flag maps" ] ] - - diff --git a/config/menus_multiplayer.cfg b/config/menus_multiplayer.cfg index 2ad737a2..5fcdf104 100644 --- a/config/menus_multiplayer.cfg +++ b/config/menus_multiplayer.cfg @@ -93,18 +93,18 @@ menuitem "Initiate autoteam" "showmenu Auto-team" newmenu Gamemode -menuitem "Team Deathmatch" "mode 0; menu_maps" -menuitem "Deathmatch" "mode 2; menu_maps" -menuitem "Team Survivor" "mode 4; menu_maps" -menuitem "Survivor" "mode 3; menu_maps" -menuitem "Capture the Flag" "mode 5; menu_maps_flags" -menuitem "Hunt the Flag" "mode 13; menu_maps" -menuitem "Keep the Flag" "mode 15; menu_maps_flags" -menuitem "Team Keep the Flag" "mode 14; menu_maps_flags" -menuitem "Pistol Frenzy" "mode 6; menu_maps" -menuitem "Last Swiss Standing" "mode 9; menu_maps" -menuitem "One Shot, One Kill" "mode 10; menu_maps" -menuitem "Team One Shot, One Kill" "mode 11; menu_maps" +menuitem "Team Deathmatch" "mode 0; showmenu maps" +menuitem "Deathmatch" "mode 2; showmenu maps" +menuitem "Team Survivor" "mode 4; showmenu maps" +menuitem "Survivor" "mode 3; showmenu maps" +menuitem "Capture the Flag" "mode 5; showmenu maps_flags" +menuitem "Hunt the Flag" "mode 13; showmenu maps" +menuitem "Keep the Flag" "mode 15; showmenu maps_flags" +menuitem "Team Keep the Flag" "mode 14; showmenu maps_flags" +menuitem "Pistol Frenzy" "mode 6; showmenu maps" +menuitem "Last Swiss Standing" "mode 9; showmenu maps" +menuitem "One Shot, One Kill" "mode 10; showmenu maps" +menuitem "Team One Shot, One Kill" "mode 11; showmenu maps" newmenu Mastermode diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp index 8dac00a8..f24bfc62 100644 --- a/source/src/worldio.cpp +++ b/source/src/worldio.cpp @@ -424,6 +424,8 @@ bool load_world(char *mname) // still supports all map formats that have execfile("config/default_map_settings.cfg"); execfile(pcfname); execfile(mcfname); + const char *pack = getalias("required_mappack"); + int reqpack = pack ? atoi(pack) : 0; persistidents = true; popscontext(); @@ -437,6 +439,9 @@ bool load_world(char *mname) // still supports all map formats that have startmap(mname); + pack = getalias("mappack_version"); + if(pack && atoi(pack) < reqpack) conoutf("\f3this map needs mappack version %d or newer", reqpack); + return true; }