about summary refs log tree commit diff
path: root/src/game/client/components
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-12-12 19:20:30 +0100
committeroy <Tom_Adams@web.de>2010-12-12 19:20:30 +0100
commitc0530b0d0910e85941b6b4158f2e4b1c9e406ff1 (patch)
treee1b64798269efbf37dd74eae87075f0dc3a4cf5c /src/game/client/components
parentc75a75b64ff804e7a14374e17b31377aabff0d63 (diff)
downloadzcatch-c0530b0d0910e85941b6b4158f2e4b1c9e406ff1.tar.gz
zcatch-c0530b0d0910e85941b6b4158f2e4b1c9e406ff1.zip
added language popup on first start. Closes #336
Diffstat (limited to 'src/game/client/components')
-rw-r--r--src/game/client/components/menus.cpp19
-rw-r--r--src/game/client/components/menus.h2
-rw-r--r--src/game/client/components/menus_settings.cpp41
3 files changed, 43 insertions, 19 deletions
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp
index 2145ccab..5d9c1bde 100644
--- a/src/game/client/components/menus.cpp
+++ b/src/game/client/components/menus.cpp
@@ -737,7 +737,7 @@ void CMenus::OnInit()
 	// */
 	
 	if(g_Config.m_ClShowWelcome)
-		m_Popup = POPUP_FIRST_LAUNCH;
+		m_Popup = POPUP_LANGUAGE;
 	g_Config.m_ClShowWelcome = 0;
 
 	Console()->Chain("add_favorite", ConchainServerbrowserUpdate, this);
@@ -971,6 +971,23 @@ int CMenus::Render()
 			static float Offset = 0.0f;
 			DoEditBox(&g_Config.m_Password, &TextBox, g_Config.m_Password, sizeof(g_Config.m_Password), 12.0f, &Offset, true);
 		}
+		else if(m_Popup == POPUP_LANGUAGE)
+		{
+			Box = Screen;
+			Box.VMargin(150.0f, &Box);
+			Box.HMargin(150.0f, &Box);
+			Box.HSplitTop(20.f, &Part, &Box);
+			Box.HSplitBottom(20.f, &Box, &Part);
+			Box.HSplitBottom(24.f, &Box, &Part);
+			Box.HSplitBottom(20.f, &Box, 0);
+			Box.VMargin(20.0f, &Box);
+			RenderLanguageSelection(Box);
+			Part.VMargin(120.0f, &Part);
+
+			static int s_Button = 0;
+			if(DoButton_Menu(&s_Button, Localize("Ok"), 0, &Part) || m_EscapePressed || m_EnterPressed)
+				m_Popup = POPUP_FIRST_LAUNCH;
+		}
 		else if(m_Popup == POPUP_DELETE_DEMO)
 		{
 			CUIRect Yes, No;
diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h
index 8efb7969..9ca21dae 100644
--- a/src/game/client/components/menus.h
+++ b/src/game/client/components/menus.h
@@ -95,6 +95,7 @@ class CMenus : public CComponent
 		POPUP_MESSAGE,
 		POPUP_DISCONNECTED,
 		POPUP_PURE,
+		POPUP_LANGUAGE,
 		POPUP_DELETE_DEMO,
 		POPUP_PASSWORD,
 		POPUP_QUIT, 
@@ -210,6 +211,7 @@ class CMenus : public CComponent
 	static void ConchainServerbrowserUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
 	
 	// found in menus_settings.cpp
+	void RenderLanguageSelection(CUIRect MainView);
 	void RenderSettingsGeneral(CUIRect MainView);
 	void RenderSettingsPlayer(CUIRect MainView);
 	void RenderSettingsControls(CUIRect MainView);
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp
index c0ea2b5a..f1b701ed 100644
--- a/src/game/client/components/menus_settings.cpp
+++ b/src/game/client/components/menus_settings.cpp
@@ -708,7 +708,7 @@ void LoadLanguageIndexfile(IStorage *pStorage, IConsole *pConsole, sorted_array<
 	io_close(File);
 }
 
-void CMenus::RenderSettingsGeneral(CUIRect MainView)
+void CMenus::RenderLanguageSelection(CUIRect MainView)
 {
 	static int s_LanguageList  = 0;
 	static int s_SelectedLanguage = 0;
@@ -729,6 +729,27 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
 
 	int OldSelected = s_SelectedLanguage;
 
+	UiDoListboxStart(&s_LanguageList , &MainView, 24.0f, Localize("Language"), "", s_Languages.size(), 1, s_SelectedLanguage, s_ScrollValue);
+
+	for(sorted_array<CLanguage>::range r = s_Languages.all(); !r.empty(); r.pop_front())
+	{
+		CListboxItem Item = UiDoListboxNextItem(&r.front());
+
+		if(Item.m_Visible)
+			UI()->DoLabel(&Item.m_Rect, r.front().m_Name, 16.0f, -1);
+	}
+
+	s_SelectedLanguage = UiDoListboxEnd(&s_ScrollValue, 0);
+
+	if(OldSelected != s_SelectedLanguage)
+	{
+		str_copy(g_Config.m_ClLanguagefile, s_Languages[s_SelectedLanguage].m_FileName, sizeof(g_Config.m_ClLanguagefile));
+		g_Localization.Load(s_Languages[s_SelectedLanguage].m_FileName, Storage(), Console());
+	}
+}
+
+void CMenus::RenderSettingsGeneral(CUIRect MainView)
+{
 	CUIRect List, Button, Label, Left, Right;
 	MainView.HSplitBottom(10.0f, &MainView, 0);
 	MainView.HSplitBottom(70.0f, &MainView, &Left);
@@ -769,23 +790,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
 		g_Config.m_ClAutoScreenshotMax = static_cast<int>(DoScrollbarH(&g_Config.m_ClAutoScreenshotMax, &Button, g_Config.m_ClAutoScreenshotMax/1000.0f)*1000.0f+0.1f);
 	}
 
-	UiDoListboxStart(&s_LanguageList , &List, 24.0f, Localize("Language"), "", s_Languages.size(), 1, s_SelectedLanguage, s_ScrollValue);
-
-	for(sorted_array<CLanguage>::range r = s_Languages.all(); !r.empty(); r.pop_front())
-	{
-		CListboxItem Item = UiDoListboxNextItem(&r.front());
-
-		if(Item.m_Visible)
-			UI()->DoLabel(&Item.m_Rect, r.front().m_Name, 16.0f, -1);
-	}
-
-	s_SelectedLanguage = UiDoListboxEnd(&s_ScrollValue, 0);
-
-	if(OldSelected != s_SelectedLanguage)
-	{
-		str_copy(g_Config.m_ClLanguagefile, s_Languages[s_SelectedLanguage].m_FileName, sizeof(g_Config.m_ClLanguagefile));
-		g_Localization.Load(s_Languages[s_SelectedLanguage].m_FileName, Storage(), Console());
-	}
+	RenderLanguageSelection(List);
 }
 
 void CMenus::RenderSettings(CUIRect MainView)