From 96b3ae2ba0a03740ed50394f629c20cd115eedf0 Mon Sep 17 00:00:00 2001 From: blackhc Date: Thu, 11 Aug 2005 21:31:02 +0000 Subject: [PATCH] Commit round I. Im too tired to write the selector and maplist reset code right now. Clean Wazat's changes a bit and changed some hard-coded stuff to not be hard-coded anymore, etc. git-svn-id: svn://svn.icculus.org/nexuiz/trunk@494 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- scmenu/creategame/basic.menu | 16 ++--- scmenu/creategame/gamemodes/ctf.menu | 14 ---- scmenu/creategame/gamemodes/domination.menu | 14 ---- scmenu/creategame/gamemodes/gamemisc.menu | 14 ---- scmenu/creategame/gamemodes/runematch.menu | 37 +++------- scmenu/creategame/gamemodes/teamplay.menu | 14 ---- scmenu/creategame/maplist.menu | 16 ++--- scmenu/creategame/weapon.menu | 14 ---- scmenu/data/server.menu | 31 ++++----- scmenu/source/custom/creategame.qm | 43 +++++++++++- scmenu/source/custom/creategame/creategame.qh | 3 + scmenu/source/custom/creategame/maps.qc | 67 +++---------------- scmenu/templates.menu | 13 ++++ 13 files changed, 106 insertions(+), 190 deletions(-) diff --git a/scmenu/creategame/basic.menu b/scmenu/creategame/basic.menu index 192cd8a49..2cc3d6628 100644 --- a/scmenu/creategame/basic.menu +++ b/scmenu/creategame/basic.menu @@ -16,7 +16,7 @@ Item Window Basic DeriveTemplate SwitchButton Switch { size '200 12' - action Nex_MapDB_RefreshFiles + action Nex_Action_Maplist_ChangeMapType } } @@ -65,7 +65,7 @@ Item Window Basic { pos '50 5' text "Filter" - target "Data::Server::MapType::Switch" + target "Data::Server::Map::Query::Switch" } Item Task_Job UpdateJob { @@ -81,7 +81,7 @@ Item Window Basic direction [Nex_DefaultVertDirection] flag [FlagEmbedded] - DeriveTemplate Nex_Composition Nex_Option_EditBox + DeriveTemplate Nex_Composition Option_EditBox { DeriveTemplate Nex_Automation_Option_EditBox Automation {} @@ -95,7 +95,7 @@ Item Window Basic } } - Derive Nex_Option_EditBox Hostname + Derive Option_EditBox Hostname { text "Server Name" target "Data::Server::Hostname::Text" @@ -115,14 +115,14 @@ Item Window Basic text "Public Server" target "Data::Server::PublicServer::Switch" } - Derive Nex_Option_EditBox MaxPlayer + Derive Option_EditBox MaxPlayer { text "Max Players" target "Data::Server::MaxPlayers::Text" } Derive Nex_Line Seperator1 {} - Derive Nex_Option_EditBox NumBots + Derive Option_EditBox NumBots { text "Bot Count" target "Data::Server::NumBots::Text" @@ -134,12 +134,12 @@ Item Window Basic } Derive Nex_Line Seperator2 {} - Derive Nex_Option_EditBox ServerFrameTime + Derive Option_EditBox ServerFrameTime { text "Server Frame Time" target "Data::Server::ServerFrameTime::Text" } - Derive Nex_Option_EditBox ServerMaxRate + Derive Option_EditBox ServerMaxRate { text "Server Max Rate" target "Data::Server::ServerMaxRate::Text" diff --git a/scmenu/creategame/gamemodes/ctf.menu b/scmenu/creategame/gamemodes/ctf.menu index ee84bfda3..fbd4a0232 100644 --- a/scmenu/creategame/gamemodes/ctf.menu +++ b/scmenu/creategame/gamemodes/ctf.menu @@ -5,20 +5,6 @@ Item Layout CTF origin '450 0' alignment [AlignFirst] - DeriveTemplate Nex_Composition Nex_Option_EditBox - { - DeriveTemplate Nex_Automation_Option_EditBox Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate EditBox EditBox - { - size '260 12' - action Nex_Action_TestOnChange - select Nex_Action_TestOnSelect - } - } - Derive Nex_Option_EditBox CaptureLimit { text "CTF Point Limit Override" diff --git a/scmenu/creategame/gamemodes/domination.menu b/scmenu/creategame/gamemodes/domination.menu index 0acd8ee8f..f4fde6498 100644 --- a/scmenu/creategame/gamemodes/domination.menu +++ b/scmenu/creategame/gamemodes/domination.menu @@ -5,20 +5,6 @@ Item Layout Domination origin '450 0' alignment [AlignFirst] - DeriveTemplate Nex_Composition Nex_Option_EditBox - { - DeriveTemplate Nex_Automation_Option_EditBox Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate EditBox EditBox - { - size '260 12' - action Nex_Action_TestOnChange - select Nex_Action_TestOnSelect - } - } - //Derive Nex_Option_Switch Domination_Active //{ // text "Play Domination" diff --git a/scmenu/creategame/gamemodes/gamemisc.menu b/scmenu/creategame/gamemodes/gamemisc.menu index 22d5458c4..7bd7e4c0c 100644 --- a/scmenu/creategame/gamemodes/gamemisc.menu +++ b/scmenu/creategame/gamemodes/gamemisc.menu @@ -8,20 +8,6 @@ Item Layout GameMisc origin '450 0' alignment [AlignFirst] - DeriveTemplate Nex_Composition Nex_Option_EditBox - { - DeriveTemplate Nex_Automation_Option_EditBox Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate EditBox EditBox - { - size '260 12' - action Nex_Action_TestOnChange - select Nex_Action_TestOnSelect - } - } - Derive Nex_Option_EditBox JoinMessageTime { text "Join Message Display Time" diff --git a/scmenu/creategame/gamemodes/runematch.menu b/scmenu/creategame/gamemodes/runematch.menu index 69aaa8ef9..8f5288392 100644 --- a/scmenu/creategame/gamemodes/runematch.menu +++ b/scmenu/creategame/gamemodes/runematch.menu @@ -30,23 +30,6 @@ Item Layout Runematch } } - DeriveTemplate Nex_Composition Nex_Option_EditBox - { - DeriveTemplate Nex_Automation_Option_EditBox Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate EditBox EditBox - { - size '260 12' - action Nex_Action_TestOnChange - select Nex_Action_TestOnSelect - } - } - - - - Derive Nex_Option_EditBox TimeLimit { text "Time Limit Override" @@ -58,7 +41,7 @@ Item Layout Runematch text "Score Limit Override" target "Data::Runematch::RunematchFragLimit::Text" } - + Derive Nex_Option_EditBox PointAmt { text "Score per Rune" @@ -99,7 +82,7 @@ Item Layout Runematch text "Max Runes to Drop on Death" target "Data::Runematch::MaxRunesToDrop::Text" } - + Derive Nex_Line SeperatorStrength {} Derive Nex_Option_EditBox StrengthDamage @@ -132,8 +115,8 @@ Item Layout Runematch text "Combined Force" target "Data::Runematch::StrengthComboForce::Text" } - - + + Derive Nex_Line SeperatorDefense {} Derive Nex_Option_EditBox DefenseDamage @@ -151,8 +134,8 @@ Item Layout Runematch text "Combined TakeDamage" target "Data::Runematch::DefenseComboDamage::Text" } - - + + Derive Nex_Line SeperatorVampire {} Derive Nex_Option_EditBox VampireDamage @@ -170,8 +153,8 @@ Item Layout Runematch text "Combined Absorb or Take" target "Data::Runematch::VampireComboDamage::Text" } - - + + Derive Nex_Line SeperatorRegen {} Derive Nex_Option_EditBox RegenHP @@ -209,8 +192,8 @@ Item Layout Runematch text "Combined Degenerate Speed" target "Data::Runematch::RegenComboDegenSpeed::Text" } - - + + Derive Nex_Line SeperatorSpeed {} Derive Nex_Option_EditBox SpeedMoverate diff --git a/scmenu/creategame/gamemodes/teamplay.menu b/scmenu/creategame/gamemodes/teamplay.menu index b3ed07106..d49559d0e 100644 --- a/scmenu/creategame/gamemodes/teamplay.menu +++ b/scmenu/creategame/gamemodes/teamplay.menu @@ -5,20 +5,6 @@ Item Layout Teamplay origin '450 0' alignment [AlignFirst] - DeriveTemplate Nex_Composition Nex_Option_EditBox - { - DeriveTemplate Nex_Automation_Option_EditBox Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate EditBox EditBox - { - size '260 12' - action Nex_Action_TestOnChange - select Nex_Action_TestOnSelect - } - } - Derive Nex_Option_EditBox FragLimit { text "Frag Limit Override" diff --git a/scmenu/creategame/maplist.menu b/scmenu/creategame/maplist.menu index 06a6fdf76..09ebbec11 100644 --- a/scmenu/creategame/maplist.menu +++ b/scmenu/creategame/maplist.menu @@ -38,23 +38,23 @@ Item Window MapList flag [FlagEmbedded] direction '50 0' - DeriveTemplate Nex_Composition Nex_Option_EditBox + DeriveTemplate Nex_Composition Nex_Option_MapType { - DeriveTemplate Nex_Automation_Option_EditBox Automation + DeriveTemplate Nex_Automation_Option_Switch Automation {} DeriveTemplate TextButton Description {} - DeriveTemplate EditBox EditBox + DeriveTemplate SwitchButton Switch { - size '260 12' - action Nex_Action_TestOnChange - select Nex_Action_TestOnSelect + size '200 12' + action Nex_Action_Maplist_ChangeMapType } } - Derive Nex_Option_EditBox MapType + + Derive Nex_Option_MapType MapQuery { text "Map Type" - target "Data::Server::MapType::Switch" + target "Data::Server::Map::Query::Switch" } } diff --git a/scmenu/creategame/weapon.menu b/scmenu/creategame/weapon.menu index d74bc3924..0c49188a4 100644 --- a/scmenu/creategame/weapon.menu +++ b/scmenu/creategame/weapon.menu @@ -33,20 +33,6 @@ Item Window Weapon } } - DeriveTemplate Nex_Composition Nex_Option_EditBox - { - DeriveTemplate Nex_Automation_Option_EditBox Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate EditBox EditBox - { - size '260 12' - action Nex_Action_TestOnChange - select Nex_Action_TestOnSelect - } - } - Derive Nex_Option_EditBox InvincibleTakeDamage { text "Invincible Take Damage" diff --git a/scmenu/data/server.menu b/scmenu/data/server.menu index 7edef002b..dd3151077 100644 --- a/scmenu/data/server.menu +++ b/scmenu/data/server.menu @@ -6,6 +6,19 @@ Item DataContainer Server { Item DataContainer Map { + Item Data_Container Query + { + defValue "maps/*.mapcfg" + value "maps/*.mapcfg" + + Item DataLink_TextSwitch Switch + { + valueList "'maps/*.mapcfg' 'maps/dm_*.mapcfg' 'maps/tdm_*.mapcfg' 'maps/dom_*.mapcfg' 'maps/ctf_*.mapcfg' 'maps/rune_*.mapcfg'" + descList "'List All''Classic Deathmatch''Team Deathmatch''Domination''Capture The Flag''Rune Match'" + + link "##up" + } + } Item Nex_MapDB DataBase { } @@ -215,22 +228,4 @@ Item DataContainer Server } } } - - - Item Data_Cvar MapType - { - cvarName "menu_map_type" - defValue 1 - - Item DataLink_ValueSwitch Switch - { - minValue 1 - stepValue 1 - maxValue 6 - descList "'List All''Classic Deathmatch''Team Deathmatch''Domination''Capture The Flag''Rune Match'" - - link "##up" - } - } - } diff --git a/scmenu/source/custom/creategame.qm b/scmenu/source/custom/creategame.qm index b651b244c..08d19f8ef 100644 --- a/scmenu/source/custom/creategame.qm +++ b/scmenu/source/custom/creategame.qm @@ -15,6 +15,18 @@ void() Nex_MapSelector_UpdateMap = lIndex = lSelector._realValue; lInfo = Nex_MapDB_GetByIndex( lIndex ); + if( lInfo == null_entity ) { + lItem = Menu_GetItem( "Picture" ); + String_EntitySet( lItem, picture, "gfx/m_nomap" ); + + lItem = Menu_GetItem( "Name" ); + String_EntitySet( lItem, text, "No maps found" ); + + lItem = Menu_GetItem( "Description" ); + String_EntitySet( lItem, text, "---" ); + return; + } + // If there is a new selected map, the info panel is updated accordingly if( lIndex != self.minValue ) { self.minValue = lIndex; @@ -95,7 +107,7 @@ void() Nex_Action_Map_Start = lItem = Menu_GetItem( "::Data::Server::Map::Cycle" ); - // if an old exit cfg file was set up, exec it + // if an old exit cfg file was set up, exec it // to reset old values before starting the server exit_cfg = cvar_string("exit_cfg"); if(exit_cfg) @@ -398,3 +410,32 @@ void() Nex_Action_Management_TypeMapList = { Nex_Management_SetType( 2 ); }; + +// FIXME: hackish +void() Nex_Action_Maplist_ChangeMapType = { + local entity lOldSelf; + + // HACK + Nex_Action_TestOnChange(); + + lOldSelf = self; + + Nex_MapDB_RefreshFiles(); + + self = Menu_GetItem( "::Data::Server::Map::Selector" ); + Item_DataLink_Nex_MapList_InitWithMapList(); + //DataLink_Nex_MapList_UpdateRange(self); + //Item_DataLink_Nex_MapList_Load(); + + // fixme: need to change which map the map selector is pointing to right now + + Raise_DataEvent( self, ITEM_DATALINK_GET ); + if(self._realValue > self.maxValue) + self._realValue = self.maxValue; + Raise_DataEvent( self, ITEM_DATALINK_SET ); + + //Nex_MapSelector_UpdateMap(); + //Nex_MapSelector_Synchronize(); + + self = lOldSelf; +}; diff --git a/scmenu/source/custom/creategame/creategame.qh b/scmenu/source/custom/creategame/creategame.qh index 4a3ec0c27..5418152c6 100644 --- a/scmenu/source/custom/creategame/creategame.qh +++ b/scmenu/source/custom/creategame/creategame.qh @@ -13,6 +13,9 @@ void() Item_Nex_Map_Info_Spawn; // Map ""database"" Singleton Item_Nex_MapDB +// AK late function (doesnt fit and breaks singleton abstraction) FIXME +void() Nex_MapDB_RefreshFiles; + // pRoot should be an item with no other children void() Item_Nex_MapDB_EnumFiles; void() Item_Nex_MapDB_Destroy; diff --git a/scmenu/source/custom/creategame/maps.qc b/scmenu/source/custom/creategame/maps.qc index 1587aedad..0b1d7c7a9 100644 --- a/scmenu/source/custom/creategame/maps.qc +++ b/scmenu/source/custom/creategame/maps.qc @@ -46,12 +46,9 @@ string _Nex_MapList_FullPath; string _Nex_MapList_Name; entity _Nex_MapList_Root; - - - /* =================== -Nex_MapDB_RefreshFiles +Item_Nex_MapDB_RefreshFiles =================== */ @@ -69,8 +66,8 @@ Nex_MapDB_RefreshFiles void() Nex_MapDB_RefreshFiles = { - local entity oldself; - oldself = self; + local entity lOldSelf; + lOldSelf = self; Nex_Action_TestOnChange(); @@ -83,26 +80,7 @@ void() Nex_MapDB_RefreshFiles = self = _Nex_MapList_Root; Item_Nex_MapDB_EnumFiles(); - - - self = Menu_GetItem( "::Data::Server::Map::Selector" ); - Item_DataLink_Nex_MapList_InitWithMapList(); - //DataLink_Nex_MapList_UpdateRange(self); - //Item_DataLink_Nex_MapList_Load(); - - - // fixme: need to change which map the map selector is pointing to right now - - Raise_DataEvent( self, ITEM_DATALINK_GET ); - if(self._realValue > self.maxValue) - self._realValue = self.maxValue; - Raise_DataEvent( self, ITEM_DATALINK_SET ); - - //Nex_MapSelector_UpdateMap(); - //Nex_MapSelector_Synchronize(); - - - self = oldself; + self = lOldSelf; }; /* @@ -118,39 +96,12 @@ void() Item_Nex_MapDB_EnumFiles = local float lSearchHandle; local float lSearchSize; local float lSearchCounter; - local entity lMap;//, lMapType; - local string map_query; - local float lMapType; - - lMapType = cvar("menu_map_type"); - //lMapType = Menu_GetItem( "::Data::Server::MapType" ); - if(lMapType == 6)//.value == "Rune Match") - { - map_query = "maps/rune_*.mapcfg"; - } - else if(lMapType == 5)//.value == "CTF") - { - map_query = "maps/ctf_*.mapcfg"; - } - else if(lMapType == 4)//.value == "Domination") - { - map_query = "maps/dom_*.mapcfg"; - } - else if(lMapType == 3)//.value == "Team Deathmatch") - { - map_query = "maps/tdm_*.mapcfg"; - } - else if(lMapType == 2)//.value == "Classic Deathmatch") - { - map_query = "maps/dm_*.mapcfg"; - } - else // list all - { - map_query = "maps/*.mapcfg"; - } + local entity lMap; + local entity lMapQuery; + lMapQuery = Menu_GetItem( "::Data::Server::Map::Query" ); - lSearchHandle = search_begin( map_query, true, true ); // "maps/*.mapcfg" + lSearchHandle = search_begin( lMapQuery.value, true, true ); if( lSearchHandle < 0 ) return; for( lSearchSize = search_getsize( lSearchHandle ), lSearchCounter = 0; @@ -165,7 +116,7 @@ void() Item_Nex_MapDB_EnumFiles = local string lTitle; lFilename = search_getfilename( lSearchHandle, lSearchCounter ); - lStripped = String_Zone( substring( lFilename, 0, strlen( lFilename ) - 7 ) ); // - 4 + lStripped = String_Zone( substring( lFilename, 0, strlen( lFilename ) - 7 ) ); lName = String_Zone( substring( lStripped, 5, 100000 ) ); lHandle = fopen( strcat( lStripped, ".txt" ), FILE_READ ); diff --git a/scmenu/templates.menu b/scmenu/templates.menu index df4a83b17..3628708fc 100644 --- a/scmenu/templates.menu +++ b/scmenu/templates.menu @@ -254,3 +254,16 @@ DeriveTemplate Nex_Composition Nex_Option_Switch action Nex_Action_TestOnChange } } +DeriveTemplate Nex_Composition Nex_Option_EditBox +{ + DeriveTemplate Nex_Automation_Option_EditBox Automation + {} + DeriveTemplate TextButton Description + {} + DeriveTemplate EditBox EditBox + { + size '260 12' + action Nex_Action_TestOnChange + select Nex_Action_TestOnSelect + } +} -- 2.39.2