From 1bca4574ab6ad7789c608e74439b8cb9a1d265db Mon Sep 17 00:00:00 2001 From: esteel Date: Sat, 25 Nov 2006 13:24:27 +0000 Subject: [PATCH] Basic multi-campaign menu support, cl_curl_maxspeed added to player options git-svn-id: svn://svn.icculus.org/nexuiz/trunk@1933 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/default.cfg | 1 + data/maps/campaign.txt | 1 + data/menu/campaign/campaign.menu | 70 ++++++++++++++---- data/menu/data/player.menu | 13 ++++ data/menu/options/player.menu | 5 ++ data/qcsrc/menu/custom/campaign.qc | 114 +++++++++++++++++++++-------- 6 files changed, 161 insertions(+), 43 deletions(-) diff --git a/data/default.cfg b/data/default.cfg index 6f040d580..7482a9f0e 100644 --- a/data/default.cfg +++ b/data/default.cfg @@ -727,6 +727,7 @@ set lastlevel "" // singleplayer campaign set g_campaign 0 +seta g_campaign_name "" seta g_campaign_index 0 set g_campaign_skill 0 diff --git a/data/maps/campaign.txt b/data/maps/campaign.txt index 4df957c37..c8ac5dc9f 100644 --- a/data/maps/campaign.txt +++ b/data/maps/campaign.txt @@ -1,3 +1,4 @@ +"//campaign:Nexuiz Campaign" "//game","mapname","bots","skill","frag","mutator-sets","description","long description" "dm","downer","2","1","15",,"Downer","Welcome to your first taste of campaign deathmatch!\n\nYou will face off against two unskilled bots in the decaying industrial arena known as Downer with a fraglimit of 15, this should be good practice for later, so make the best of it." "dm","basement","3","1","10",,"Basement","Frenzied deathmatch in Basement against three bots, fraglimit is 10." diff --git a/data/menu/campaign/campaign.menu b/data/menu/campaign/campaign.menu index a37bcdf20..0cf437c3f 100644 --- a/data/menu/campaign/campaign.menu +++ b/data/menu/campaign/campaign.menu @@ -9,27 +9,27 @@ Item Window Campaign flag [FlagEmbedded] - Derive Picture PrevPicture + Derive Picture PrevPictureCampaign { size '30 18' picture "gfx/create_map_nav" pos '30 25' } - Derive TextButton Prev + Derive TextButton PrevCampaign { normal "<<" pos '33 29' - action Nex_Action_Campaign_Prev + action Nex_Action_Campaign_Prev_Campaign } - Derive Picture NamePicture + Derive Picture NamePictureCampaign { picture "gfx/create_map_nav_background" size '409 18' pos '60 24' } - Derive MultiLabel ShortDescription + Derive MultiLabel ShortDescriptionCampaign { alignment [AlignCenter] color "1 1 1" @@ -37,33 +37,75 @@ Item Window Campaign pos '64 29' } - Derive Picture NextPicture + Derive Picture NextPictureCampaign { size '30 18' picture "gfx/create_map_nav" pos '471 25' } - Derive TextButton Next + Derive TextButton NextCampaign { normal ">>" pos '474 29' - action Nex_Action_Campaign_Next + action Nex_Action_Campaign_Next_Campaign + } + + Derive Picture PrevPictureEntry + { + size '30 18' + picture "gfx/create_map_nav" + pos '30 45' + } + Derive TextButton PrevEntry + { + normal "<<" + pos '33 49' + action Nex_Action_Campaign_Prev_Entry + } + + Derive Picture NamePictureEntry + { + picture "gfx/create_map_nav_background" + size '409 18' + pos '60 44' + } + + Derive MultiLabel ShortDescriptionEntry + { + alignment [AlignCenter] + color "1 1 1" + size '409 14' + pos '64 49' + } + + Derive Picture NextPictureEntry + { + size '30 18' + picture "gfx/create_map_nav" + pos '471 45' + } + Derive TextButton NextEntry + { + normal ">>" + pos '474 49' + + action Nex_Action_Campaign_Next_Entry } Derive Picture Table1 { picture "gfx/create_map_border" - pos '70 35' - size '385 275' + pos '70 55' + size '385 255' } - Derive Picture Picture + Derive Picture PictureEntry { picture "gfx/m_white" - size '323 226' - pos '101 60' + size '323 206' + pos '101 80' } Derive Picture Table2 { @@ -72,7 +114,7 @@ Item Window Campaign size '500 200' } - Derive MultiLabel LongDescription + Derive MultiLabel LongDescriptionEntry { pos '44 315' size '480 200' diff --git a/data/menu/data/player.menu b/data/menu/data/player.menu index 11456cb52..bae74a6a8 100644 --- a/data/menu/data/player.menu +++ b/data/menu/data/player.menu @@ -157,4 +157,17 @@ Item DataContainer Player } } } + Item Data_Cvar MapDLSpeed + { + cvarName "cl_curl_maxspeed" + defValue "300" + + Item DataLink_Value Value + { + minValue 10.0 + maxValue 1000.0 + stepValue 10.0 + link "##up" + } + } } diff --git a/data/menu/options/player.menu b/data/menu/options/player.menu index ef915471a..db89eb4ac 100644 --- a/data/menu/options/player.menu +++ b/data/menu/options/player.menu @@ -187,6 +187,11 @@ Item Window Player text "Show player names" target "::Data::Player::PlayerShowNames::Switch" } + Derive Nex_Option_Slider MapDLSpeed + { + text "Download Speed" + target "::Data::Player::MapDLSpeed::Value" + } Derive Nex_Void Seperator1 {} Derive PictureButton Apply diff --git a/data/qcsrc/menu/custom/campaign.qc b/data/qcsrc/menu/custom/campaign.qc index a62daa7c0..7b7a7f31d 100644 --- a/data/qcsrc/menu/custom/campaign.qc +++ b/data/qcsrc/menu/custom/campaign.qc @@ -52,11 +52,11 @@ void Campaign_JumpLevel(float n) CampaignSetup(n); } -float campaign_index; +float campaign_entry_index; void() Nex_Action_Campaign_Start = { - Campaign_JumpLevel(campaign_index); + Campaign_JumpLevel(campaign_entry_index); // force the menu to hide m_hide(); @@ -64,48 +64,104 @@ void() Nex_Action_Campaign_Start = void() Nex_Action_Campaign_Update = { - local entity lItem; - local string longdesc; - local string shortdesc; - lItem = Menu_GetItem( "ShortDescription" ); - shortdesc = campaign_shortdesc[campaign_index]; - shortdesc = strcat("Level ", ftos(campaign_index + 1), ": ", shortdesc); - String_EntitySet( lItem, text, shortdesc); - - lItem = Menu_GetItem( "LongDescription" ); - longdesc = wordwrap(campaign_longdesc[campaign_index], lItem.wrap - 1); - String_EntitySet( lItem, text, longdesc ); - - lItem = Menu_GetItem( "Picture" ); - String_EntitySet( lItem, picture, strcat("maps/",campaign_mapname[campaign_index], ".jpg") ); + local entity item; + local string desc; + local float handle; + local string line; + + handle = fopen(strcat("maps/campaign", campaign_name, ".txt"), FILE_READ); + if(handle >= 0) { + while (line = fgets(handle)) { + if(substring(line, 0, 12) == "\"//campaign:") { + desc = substring(line, 12, (strlen(line) - (12 + 1))); + break; + } else { + continue; + } + } + } + fclose(handle); + + item = Menu_GetItem("ShortDescriptionCampaign"); + desc = strcat("Campaign: ", desc); + String_EntitySet(item, text, desc); + + item = Menu_GetItem("ShortDescriptionEntry"); + desc = campaign_shortdesc[campaign_entry_index]; + desc = strcat("Level ", ftos(campaign_entry_index + 1), ": ", desc); + String_EntitySet(item, text, desc); + + item = Menu_GetItem("LongDescriptionEntry"); + desc = wordwrap(campaign_longdesc[campaign_entry_index], item.wrap - 1); + String_EntitySet(item, text, desc); + + item = Menu_GetItem("PictureEntry"); + String_EntitySet(item, picture, strcat("maps/",campaign_mapname[campaign_entry_index], ".jpg")); }; -void() Nex_Action_Campaign_Init = +void(float index) Nex_Action_Campaign_Find_Entry = { - campaign_index = cvar(campaign_index_var); + campaign_entry_index+=index; + if (campaign_entry_index < 0) campaign_entry_index = min((campaign_entries - 1), cvar(campaign_index_var)); + if (campaign_entry_index > min((campaign_entries - 1), cvar(campaign_index_var))) campaign_entry_index = 0; +} +void() Nex_Action_Campaign_Prev_Entry = +{ + Nex_Action_Campaign_Find_Entry(-1); Nex_Action_Campaign_Update(); }; -void() Nex_Action_Campaign_Prev = +void() Nex_Action_Campaign_Next_Entry = { - if (campaign_index <= 0) { - campaign_index = min(campaign_entries, cvar(campaign_index_var)); - } else { - campaign_index -= 1; - } + Nex_Action_Campaign_Find_Entry(1); + Nex_Action_Campaign_Update(); +}; + +void() Nex_Action_Campaign_Init = +{ + Campaign_Init(); + + campaign_entry_index = cvar(campaign_index_var); + Nex_Action_Campaign_Find_Entry(0); // set campaign_index_var back into range if too high or low Nex_Action_Campaign_Update(); }; -void() Nex_Action_Campaign_Next = +void(float index) Nex_Action_Campaign_Find_Campaign = { - if (campaign_index >= min(campaign_entries, cvar(campaign_index_var))) { - campaign_index = 0; - } else { - campaign_index += 1; + local float handle; + local float count; + float i; + local string filename; + handle = search_begin("maps/campaign*.txt", true, true); + if(handle >= 0) { + count = search_getsize(handle); + for (i = 0; i < count; i++) { + filename = search_getfilename(handle, i); + if (filename == strcat("maps/campaign", campaign_name, ".txt")) { + index+=i; + if (index < 0) index = (count - 1); + if (index > (count - 1)) index = 0; + filename = search_getfilename(handle, index); + break; + } + } + count = strlen(filename); + cvar_set("g_campaign_name", substring(filename, 13, (count - (13 + 4)))); } + search_end(handle); + Nex_Action_Campaign_Init(); +} +void() Nex_Action_Campaign_Prev_Campaign = +{ + Nex_Action_Campaign_Find_Campaign(-1); Nex_Action_Campaign_Update(); }; +void() Nex_Action_Campaign_Next_Campaign = +{ + Nex_Action_Campaign_Find_Campaign(1); + Nex_Action_Campaign_Update(); +}; -- 2.39.2