diff options
| author | oy <Tom_Adams@web.de> | 2010-10-09 13:27:21 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-10-09 13:27:21 +0200 |
| commit | 85b9c60158adee3aae6d02a9e5529ea57ed39611 (patch) | |
| tree | 874dc6a0cfe834c47fc084aa3b6cc1d88df665b9 /src/game/client | |
| parent | 7ad4d3224c22216b1131df56172995be33d48405 (diff) | |
| download | zcatch-85b9c60158adee3aae6d02a9e5529ea57ed39611.tar.gz zcatch-85b9c60158adee3aae6d02a9e5529ea57ed39611.zip | |
added info in the demo browser by Choupom
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/components/menus.h | 2 | ||||
| -rw-r--r-- | src/game/client/components/menus_demo.cpp | 27 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index 7ab03b81..3d11cf91 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -160,6 +160,8 @@ class CMenus : public CComponent char m_aName[128]; bool m_IsDir; int m_StorageType; + bool m_Valid; + char m_aMap[64]; bool operator<(const CDemoItem &Other) { return !str_comp(m_aFilename, "..") ? true : !str_comp(Other.m_aFilename, "..") ? false : m_IsDir && !Other.m_IsDir ? true : !m_IsDir && Other.m_IsDir ? false : diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index 9a8a7706..20aee00f 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -429,9 +429,19 @@ void CMenus::DemolistFetchCallback(const char *pName, int IsDir, int StorageType CDemoItem Item; str_copy(Item.m_aFilename, pName, sizeof(Item.m_aFilename)); if(IsDir) + { str_format(Item.m_aName, sizeof(Item.m_aName), "%s/", pName); + Item.m_aMap[0] = 0; + Item.m_Valid = false; + } else + { str_format(Item.m_aName, min(static_cast<int>(sizeof(Item.m_aName)), Length), " %s", pName); + char aBuffer[512]; + str_format(aBuffer, sizeof(aBuffer), "%s/%s", pSelf->m_aCurrentDemoFolder, Item.m_aFilename); + // TODO: many items slow this down, don't load the info from every file when making the filelist + Item.m_Valid = pSelf->DemoPlayer()->GetDemoInfo(pSelf->Storage(), aBuffer, StorageType, Item.m_aMap, sizeof(Item.m_aMap)); + } Item.m_IsDir = IsDir != 0; Item.m_StorageType = StorageType; pSelf->m_lDemos.add(Item); @@ -475,6 +485,19 @@ void CMenus::RenderDemoList(CUIRect MainView) } m_DemolistDelEntry = false; } + + char aFooterLabel[128] = {0}; + if(m_DemolistSelectedIndex >= 0) + { + if(str_comp(m_lDemos[m_DemolistSelectedIndex].m_aFilename, "..") == 0) + str_copy(aFooterLabel, Localize("Parent Folder"), sizeof(aFooterLabel)); + else if(m_DemolistSelectedIsDir) + str_copy(aFooterLabel, Localize("Folder"), sizeof(aFooterLabel)); + else if(!m_lDemos[m_DemolistSelectedIndex].m_Valid) + str_copy(aFooterLabel, Localize("Invalid Demo"), sizeof(aFooterLabel)); + else + str_format(aFooterLabel, sizeof(aFooterLabel), "%s: %s", Localize("Map"), m_lDemos[m_DemolistSelectedIndex].m_aMap); + } // render background RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f); @@ -490,7 +513,7 @@ void CMenus::RenderDemoList(CUIRect MainView) static int s_DemoListId = 0; static float s_ScrollValue = 0; - UiDoListboxStart(&s_DemoListId, &MainView, 17.0f, Localize("Demos"), "", m_lDemos.size(), 1, m_DemolistSelectedIndex, s_ScrollValue); + UiDoListboxStart(&s_DemoListId, &MainView, 17.0f, Localize("Demos"), aFooterLabel, m_lDemos.size(), 1, m_DemolistSelectedIndex, s_ScrollValue); for(sorted_array<CDemoItem>::range r = m_lDemos.all(); !r.empty(); r.pop_front()) { CListboxItem Item = UiDoListboxNextItem((void*)(&r.front())); @@ -507,7 +530,7 @@ void CMenus::RenderDemoList(CUIRect MainView) DemolistPopulate(); DemolistOnUpdate(false); } - + static int s_PlayButton = 0; if(DoButton_Menu(&s_PlayButton, m_DemolistSelectedIsDir?Localize("Open"):Localize("Play"), 0, &PlayRect) || Activated) { |