about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-10-06 23:07:35 +0200
committeroy <Tom_Adams@web.de>2010-10-06 23:07:35 +0200
commit3a98f7a048c044ce0d870320fc0b1def0db4f7fb (patch)
tree7dfa1826e537355b37d00e77558ca623a915bac2 /src/game
parenta62a7413d1ff25c8e07657b96a485f001004619a (diff)
downloadzcatch-3a98f7a048c044ce0d870320fc0b1def0db4f7fb.tar.gz
zcatch-3a98f7a048c044ce0d870320fc0b1def0db4f7fb.zip
added mod system. Closes #34
Diffstat (limited to 'src/game')
-rw-r--r--src/game/client/components/console.cpp2
-rw-r--r--src/game/client/components/mapimages.cpp3
-rw-r--r--src/game/client/components/maplayers.cpp2
-rw-r--r--src/game/client/components/menus.cpp3
-rw-r--r--src/game/client/components/menus.h4
-rw-r--r--src/game/client/components/menus_demo.cpp18
-rw-r--r--src/game/client/components/menus_settings.cpp6
-rw-r--r--src/game/client/components/skins.cpp2
-rw-r--r--src/game/client/gameclient.cpp11
-rw-r--r--src/game/editor/ed_editor.cpp46
-rw-r--r--src/game/editor/ed_editor.h22
-rw-r--r--src/game/editor/ed_io.cpp4
-rw-r--r--src/game/localization.cpp5
-rw-r--r--src/game/localization.h2
14 files changed, 78 insertions, 52 deletions
diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp
index cdf4239a..5fa328dd 100644
--- a/src/game/client/components/console.cpp
+++ b/src/game/client/components/console.cpp
@@ -588,7 +588,7 @@ void CGameConsole::Dump(int Type)
 	{
 		IOHANDLE io;
 		str_format(aFilename, sizeof(aFilename), "dumps/%s_dump%s-%05d.txt", Type==1?"remote_console":"local_console", aDate, i);
-		io = Storage()->OpenFile(aFilename, IOFLAG_WRITE);
+		io = Storage()->OpenFile(aFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE);
 		if(io)
 		{
 			#if defined(CONF_FAMILY_WINDOWS)
diff --git a/src/game/client/components/mapimages.cpp b/src/game/client/components/mapimages.cpp
index 9be450d1..8870c5c6 100644
--- a/src/game/client/components/mapimages.cpp
+++ b/src/game/client/components/mapimages.cpp
@@ -1,5 +1,6 @@
 #include <engine/graphics.h>
 #include <engine/map.h>
+#include <engine/storage.h>
 #include <game/client/component.h>
 #include <game/mapitems.h>
 
@@ -36,7 +37,7 @@ void CMapImages::OnMapLoad()
 			char Buf[256];
 			char *pName = (char *)pMap->GetData(pImg->m_ImageName);
 			str_format(Buf, sizeof(Buf), "mapres/%s.png", pName);
-			m_aTextures[i] = Graphics()->LoadTexture(Buf, CImageInfo::FORMAT_AUTO, 0);
+			m_aTextures[i] = Graphics()->LoadTexture(Buf, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
 		}
 		else
 		{
diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp
index 9c93c771..d3a819c0 100644
--- a/src/game/client/components/maplayers.cpp
+++ b/src/game/client/components/maplayers.cpp
@@ -135,7 +135,7 @@ void CMapLayers::OnRender()
 				Client()->GetServerInfo(&CurrentServerInfo);
 				char aFilename[256];
 				str_format(aFilename, sizeof(aFilename), "dumps/tilelayer_dump_%s-%d-%d-%dx%d.txt", CurrentServerInfo.m_aMap, g, l, pTMap->m_Width, pTMap->m_Height);
-				IOHANDLE File = Storage()->OpenFile(aFilename, IOFLAG_WRITE);
+				IOHANDLE File = Storage()->OpenFile(aFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE);
 				if(File)
 				{
 					#if defined(CONF_FAMILY_WINDOWS)
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp
index 4a53d29b..caad5a80 100644
--- a/src/game/client/components/menus.cpp
+++ b/src/game/client/components/menus.cpp
@@ -12,6 +12,7 @@
 #include <engine/textrender.h>
 #include <engine/serverbrowser.h>
 #include <engine/keys.h>
+#include <engine/storage.h>
 #include <engine/shared/config.h>
 
 #include <game/version.h>
@@ -1259,7 +1260,7 @@ void CMenus::RenderBackground()
 	//Graphics()->Clear(1,1,1);
 	//render_sunrays(0,0);
 	if(gs_TextureBlob == -1)
-		gs_TextureBlob = Graphics()->LoadTexture("blob.png", CImageInfo::FORMAT_AUTO, 0);
+		gs_TextureBlob = Graphics()->LoadTexture("blob.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
 
 
 	float sw = 300*Graphics()->ScreenAspect();
diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h
index a1e75f61..ea8be21f 100644
--- a/src/game/client/components/menus.h
+++ b/src/game/client/components/menus.h
@@ -159,7 +159,7 @@ class CMenus : public CComponent
 		char m_aFilename[128];
 		char m_aName[128];
 		bool m_IsDir;
-		int m_DirType;
+		int m_StorageType;
 		
 		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 :
@@ -174,7 +174,7 @@ class CMenus : public CComponent
 	
 	void DemolistOnUpdate(bool Reset);
 	void DemolistPopulate();
-	static void DemolistFetchCallback(const char *pName, int IsDir, int DirType, void *pUser);
+	static void DemolistFetchCallback(const char *pName, int IsDir, int StorageType, void *pUser);
 	
 	// found in menus.cpp
 	int Render();
diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp
index e08114ad..e960769a 100644
--- a/src/game/client/components/menus_demo.cpp
+++ b/src/game/client/components/menus_demo.cpp
@@ -417,7 +417,7 @@ int CMenus::UiDoListboxEnd(float *pScrollValue, bool *pItemActivated)
 	return gs_ListBoxNewSelected;
 }
 
-void CMenus::DemolistFetchCallback(const char *pName, int IsDir, int DirType, void *pUser)
+void CMenus::DemolistFetchCallback(const char *pName, int IsDir, int StorageType, void *pUser)
 {
 	CMenus *pSelf = (CMenus *)pUser;
 	int Length = str_length(pName);
@@ -433,14 +433,14 @@ void CMenus::DemolistFetchCallback(const char *pName, int IsDir, int DirType, vo
 	else
 		str_format(Item.m_aName, min(static_cast<int>(sizeof(Item.m_aName)), Length), "    %s", pName);
 	Item.m_IsDir = IsDir != 0;
-	Item.m_DirType = DirType;
+	Item.m_StorageType = StorageType;
 	pSelf->m_lDemos.add(Item);
 }
 
 void CMenus::DemolistPopulate()
 {
 	m_lDemos.clear();
-	Storage()->ListDirectory(IStorage::TYPE_SAVE|IStorage::TYPE_CURRENT, m_aCurrentDemoFolder, DemolistFetchCallback, this);
+	Storage()->ListDirectory(IStorage::TYPE_ALL, m_aCurrentDemoFolder, DemolistFetchCallback, this);
 }
 
 void CMenus::DemolistOnUpdate(bool Reset)
@@ -466,10 +466,8 @@ void CMenus::RenderDemoList(CUIRect MainView)
 		if(m_DemolistSelectedIndex >= 0 && !m_DemolistSelectedIsDir)
 		{
 			char aBuf[512];
-			str_format(aBuf, sizeof(aBuf), "%s%s%s/%s", Storage()->GetDirectory(m_lDemos[m_DemolistSelectedIndex].m_DirType),
-				Storage()->GetDirectory(m_lDemos[m_DemolistSelectedIndex].m_DirType)[0] ? "/" : "",
-				m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
-			Storage()->RemoveFile(aBuf);
+			str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
+			Storage()->RemoveFile(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType);
 			DemolistPopulate();
 			DemolistOnUpdate(false);
 		}
@@ -529,10 +527,8 @@ void CMenus::RenderDemoList(CUIRect MainView)
 			else // file
 			{
 				char aBuf[512];
-				str_format(aBuf, sizeof(aBuf), "%s%s%s/%s", Storage()->GetDirectory(m_lDemos[m_DemolistSelectedIndex].m_DirType),
-					Storage()->GetDirectory(m_lDemos[m_DemolistSelectedIndex].m_DirType)[0] ? "/" : "",
-					m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
-				const char *pError = Client()->DemoPlayer_Play(aBuf);
+				str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
+				const char *pError = Client()->DemoPlayer_Play(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType);
 				if(pError)
 					PopupMessage(Localize("Error"), str_comp(pError, "error loading demo") ? pError : Localize("error loading demo"), Localize("Ok"));
 				else
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp
index c8040bfa..f3c4afe7 100644
--- a/src/game/client/components/menus_settings.cpp
+++ b/src/game/client/components/menus_settings.cpp
@@ -650,7 +650,7 @@ public:
 
 void LoadLanguageIndexfile(IStorage *pStorage, IConsole *pConsole, sorted_array<CLanguage> *pLanguages)
 {
-	IOHANDLE File = pStorage->OpenFile("data/languages/index.txt", IOFLAG_READ);
+	IOHANDLE File = pStorage->OpenFile("languages/index.txt", IOFLAG_READ, IStorage::TYPE_ALL);
 	if(!File)
 	{
 		pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "localization", "couldn't open index file");
@@ -681,7 +681,7 @@ void LoadLanguageIndexfile(IStorage *pStorage, IConsole *pConsole, sorted_array<
 		}
 		
 		char aFileName[128];
-		str_format(aFileName, sizeof(aFileName), "data/languages/%s.txt", pLine);
+		str_format(aFileName, sizeof(aFileName), "languages/%s.txt", pLine);
 		pLanguages->add(CLanguage(pReplacement+3, aFileName));
 	}
 	io_close(File);
@@ -724,7 +724,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
 	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, Console());
+		g_Localization.Load(s_Languages[s_SelectedLanguage].m_FileName, Storage(), Console());
 	}
 }
 
diff --git a/src/game/client/components/skins.cpp b/src/game/client/components/skins.cpp
index 098111ee..52c79220 100644
--- a/src/game/client/components/skins.cpp
+++ b/src/game/client/components/skins.cpp
@@ -20,7 +20,7 @@ void CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
 	char aBuf[512];
 	str_format(aBuf, sizeof(aBuf), "skins/%s", pName);
 	CImageInfo Info;
-	if(!pSelf->Graphics()->LoadPNG(&Info, aBuf))
+	if(!pSelf->Graphics()->LoadPNG(&Info, aBuf, DirType))
 	{
 		str_format(aBuf, sizeof(aBuf), "failed to load skin from %s", pName);
 		pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "game", aBuf);
diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp
index 11841e5b..2805800d 100644
--- a/src/game/client/gameclient.cpp
+++ b/src/game/client/gameclient.cpp
@@ -224,7 +224,7 @@ void CGameClient::OnInit()
 	//m_pServerBrowser = Kernel()->RequestInterface<IServerBrowser>();
 	
 	// set the language
-	g_Localization.Load(g_Config.m_ClLanguagefile, Console());
+	g_Localization.Load(g_Config.m_ClLanguagefile, Storage(), Console());
 	
 	// init all components
 	for(int i = 0; i < m_All.m_Num; i++)
@@ -239,7 +239,12 @@ void CGameClient::OnInit()
 	// load default font	
 	static CFont *pDefaultFont;
 	//default_font = gfx_font_load("data/fonts/sazanami-gothic.ttf");
-	pDefaultFont = TextRender()->LoadFont("data/fonts/vera.ttf");
+
+	char aFilename[512];
+	IOHANDLE File = Storage()->OpenFile("fonts/vera.ttf", IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename));
+	if(File)
+		io_close(File);
+	pDefaultFont = TextRender()->LoadFont(aFilename);
 	TextRender()->SetDefaultFont(pDefaultFont);
 
 	g_Config.m_ClThreadsoundloading = 0;
@@ -254,7 +259,7 @@ void CGameClient::OnInit()
 	for(int i = 0; i < g_pData->m_NumImages; i++)
 	{
 		g_GameClient.m_pMenus->RenderLoading(gs_LoadCurrent/(float)gs_LoadTotal);
-		g_pData->m_aImages[i].m_Id = Graphics()->LoadTexture(g_pData->m_aImages[i].m_pFilename, CImageInfo::FORMAT_AUTO, 0);
+		g_pData->m_aImages[i].m_Id = Graphics()->LoadTexture(g_pData->m_aImages[i].m_pFilename, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
 		gs_LoadCurrent++;
 	}
 
diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp
index b1dce3f9..ea83fb73 100644
--- a/src/game/editor/ed_editor.cpp
+++ b/src/game/editor/ed_editor.cpp
@@ -559,6 +559,7 @@ CQuad *CEditor::GetSelectedQuad()
 	return 0;
 }
 
+// TODO: fix/rework the whole file dialog stuff
 static void CallbackOpenDir(const char *pFileName, void *pUser)
 {
 	CEditor *pEditor = (CEditor*)pUser;
@@ -586,7 +587,7 @@ static void CallbackOpenMap(const char *pFileName, void *pUser)
 		return;
 	}
 	char aCompleteFilename[512];
-	str_format(aCompleteFilename, sizeof(aCompleteFilename), "%s/%s", pEditor->Client()->UserDirectory(), pFileName);
+	//str_format(aCompleteFilename, sizeof(aCompleteFilename), "%s/%s", pEditor->Client()->UserDirectory(), pFileName);
 	if(fs_is_dir(aCompleteFilename))
 	{
 		CallbackOpenDir(pFileName, pUser);
@@ -609,7 +610,7 @@ static void CallbackAppendMap(const char *pFileName, void *pUser)
 		return;
 	}
 	char aCompleteFilename[512];
-	str_format(aCompleteFilename, sizeof(aCompleteFilename), "%s/%s", pEditor->Client()->UserDirectory(), pFileName);
+	//str_format(aCompleteFilename, sizeof(aCompleteFilename), "%s/%s", pEditor->Client()->UserDirectory(), pFileName);
 	if(fs_is_dir(aCompleteFilename))
 	{
 		CallbackOpenDir(pFileName, pUser);
@@ -632,7 +633,7 @@ static void CallbackSaveMap(const char *pFileName, void *pUser)
 		return;
 	}
 	char aCompleteFilename[512];
-	str_format(aCompleteFilename, sizeof(aCompleteFilename), "%s/%s", pEditor->Client()->UserDirectory(), pFileName);
+	//str_format(aCompleteFilename, sizeof(aCompleteFilename), "%s/%s", pEditor->Client()->UserDirectory(), pFileName);
 	if(fs_is_dir(aCompleteFilename))
 	{
 		CallbackOpenDir(pFileName, pUser);
@@ -1899,7 +1900,7 @@ void CEditor::ReplaceImage(const char *pFileName, void *pUser)
 {
 	CEditor *pEditor = (CEditor *)pUser;
 	CEditorImage ImgInfo(pEditor);
-	if(!pEditor->Graphics()->LoadPNG(&ImgInfo, pFileName))
+	if(!pEditor->Graphics()->LoadPNG(&ImgInfo, pFileName, IStorage::TYPE_ALL))
 		return;
 
 	CEditorImage *pImg = pEditor->m_Map.m_lImages[pEditor->m_SelectedImage];
@@ -1914,7 +1915,7 @@ void CEditor::AddImage(const char *pFileName, void *pUser)
 {
 	CEditor *pEditor = (CEditor *)pUser;
 	CEditorImage ImgInfo(pEditor);
-	if(!pEditor->Graphics()->LoadPNG(&ImgInfo, pFileName))
+	if(!pEditor->Graphics()->LoadPNG(&ImgInfo, pFileName, IStorage::TYPE_ALL))
 		return;
 
 	CEditorImage *pImg = new CEditorImage(pEditor);
@@ -2146,17 +2147,26 @@ void CEditor::RenderImages(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
 }
 
 
-static void EditorListdirCallback(const char *pName, int IsDir, int DirType, void *pUser)
+static void EditorListdirCallback(const char *pName, int IsDir, int StorageType, void *pUser)
 {
 	CEditor *pEditor = (CEditor*)pUser;
+	int Length = str_length(pName);
 	if(pName[0] == '.' && (pName[1] == 0 ||
 		(pName[1] == '.' && pName[2] == 0 && (!str_comp(pEditor->m_aFileDialogPath, "maps") || !str_comp(pEditor->m_aFileDialogPath, "mapres")))))
 		return;
 
-	pEditor->m_FileList.add(string(pName));
+	CEditor::CFilelistItem Item;
+	str_copy(Item.m_aFilename, pName, sizeof(Item.m_aFilename));
+	if(IsDir)
+		str_format(Item.m_aName, sizeof(Item.m_aName), "%s/", pName);
+	else
+		str_format(Item.m_aName, static_cast<int>(sizeof(Item.m_aName)), "    %s", pName);
+	Item.m_IsDir = IsDir != 0;
+	Item.m_StorageType = StorageType;
+	pEditor->m_FileList.add(Item);
 }
 
-void CEditor::AddFileDialogEntry(const char *pName, CUIRect *pView)
+void CEditor::AddFileDialogEntry(const CFilelistItem *pItem, CUIRect *pView)
 {
 	if(m_FilesCur > m_FilesNum)
 		m_FilesNum = m_FilesCur;
@@ -2169,9 +2179,9 @@ void CEditor::AddFileDialogEntry(const char *pName, CUIRect *pView)
 	pView->HSplitTop(15.0f, &Button, pView);
 	pView->HSplitTop(2.0f, 0, pView);
 
-	if(DoButton_File((void*)(10+(int)Button.y), pName, 0, &Button, 0, 0))
+	if(DoButton_File((void*)(10+(int)Button.y), pItem->m_aName, 0, &Button, 0, 0))
 	{
-		str_copy(m_aFileDialogFileName, pName, sizeof(m_aFileDialogFileName));
+		str_copy(m_aFileDialogFileName, pItem->m_aFilename, sizeof(m_aFileDialogFileName));
 		
 		str_format(m_aFileDialogCompleteFilename, sizeof(m_aFileDialogCompleteFilename), "%s/%s", m_aFileDialogPath, m_aFileDialogFileName);
 
@@ -2248,7 +2258,7 @@ void CEditor::RenderFileDialog()
 	UI()->ClipEnable(&View);
 
 	for(int i = 0; i < m_FileList.size(); i++)
-		AddFileDialogEntry(m_FileList[i].cstr(), &View);
+		AddFileDialogEntry(&m_FileList[i], &View);
 
 	// disable clipping again
 	UI()->ClipDisable();
@@ -2274,14 +2284,14 @@ void CEditor::RenderFileDialog()
 void CEditor::FilelistPopulate()
 {
 	m_FileList.clear();
-	Storage()->ListDirectory(m_FileDialogDirTypes, m_aFileDialogPath, EditorListdirCallback, this);
+	Storage()->ListDirectory(m_FileDialogStorageType, m_aFileDialogPath, EditorListdirCallback, this);
 }
 
-void CEditor::InvokeFileDialog(int ListDirTypes, const char *pTitle, const char *pButtonText,
+void CEditor::InvokeFileDialog(int StorageType, const char *pTitle, const char *pButtonText,
 	const char *pBasePath, const char *pDefaultName,
 	void (*pfnFunc)(const char *pFileName, void *pUser), void *pUser)
 {
-	m_FileDialogDirTypes = ListDirTypes;
+	m_FileDialogStorageType = StorageType;
 	m_pFileDialogTitle = pTitle;
 	m_pFileDialogButtonText = pButtonText;
 	m_pfnFileDialogFunc = pfnFunc;
@@ -3072,10 +3082,10 @@ void CEditor::Init()
 	m_UI.SetGraphics(m_pGraphics, m_pTextRender);
 	m_Map.m_pEditor = this;
 
-	ms_CheckerTexture = Graphics()->LoadTexture("editor/checker.png", CImageInfo::FORMAT_AUTO, 0);
-	ms_BackgroundTexture = Graphics()->LoadTexture("editor/background.png", CImageInfo::FORMAT_AUTO, 0);
-	ms_CursorTexture = Graphics()->LoadTexture("editor/cursor.png", CImageInfo::FORMAT_AUTO, 0);
-	ms_EntitiesTexture = Graphics()->LoadTexture("editor/entities.png", CImageInfo::FORMAT_AUTO, 0);
+	ms_CheckerTexture = Graphics()->LoadTexture("editor/checker.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
+	ms_BackgroundTexture = Graphics()->LoadTexture("editor/background.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
+	ms_CursorTexture = Graphics()->LoadTexture("editor/cursor.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
+	ms_EntitiesTexture = Graphics()->LoadTexture("editor/entities.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
 
 	m_TilesetPicker.m_pEditor = this;
 	m_TilesetPicker.MakePalette();
diff --git a/src/game/editor/ed_editor.h b/src/game/editor/ed_editor.h
index 30ec7203..225ff4ab 100644
--- a/src/game/editor/ed_editor.h
+++ b/src/game/editor/ed_editor.h
@@ -459,7 +459,7 @@ public:
 
 		m_aFileName[0] = 0;
 		
-		m_FileDialogDirTypes = 0;
+		m_FileDialogStorageType = 0;
 		m_pFileDialogTitle = 0;
 		m_pFileDialogButtonText = 0;
 		m_pFileDialogUser = 0;
@@ -508,7 +508,7 @@ public:
 	virtual void UpdateAndRender();
 	
 	void FilelistPopulate();
-	void InvokeFileDialog(int ListdirType, const char *pTitle, const char *pButtonText,
+	void InvokeFileDialog(int StorageType, const char *pTitle, const char *pButtonText,
 		const char *pBasepath, const char *pDefaultName,
 		void (*pfnFunc)(const char *pFilename, void *pUser), void *pUser);
 	
@@ -531,7 +531,7 @@ public:
 
 	char m_aFileName[512];
 	
-	int m_FileDialogDirTypes;
+	int m_FileDialogStorageType;
 	const char *m_pFileDialogTitle;
 	const char *m_pFileDialogButtonText;
 	void (*m_pfnFileDialogFunc)(const char *pFileName, void *pUser);
@@ -540,7 +540,19 @@ public:
 	char m_aFileDialogPath[512];
 	char m_aFileDialogCompleteFilename[512];
 	int m_FilesNum;
-	sorted_array<string> m_FileList;
+
+	struct CFilelistItem
+	{
+		char m_aFilename[128];
+		char m_aName[128];
+		bool m_IsDir;
+		int m_StorageType;
+		
+		bool operator<(const CFilelistItem &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 :
+														str_comp_filenames(m_aFilename, Other.m_aFilename) < 0; }
+	};
+	sorted_array<CFilelistItem> m_FileList;
 	int m_FilesStartAt;
 	int m_FilesCur;
 	int m_FilesStopAt;
@@ -643,7 +655,7 @@ public:
 	void RenderMenubar(CUIRect Menubar);
 	void RenderFileDialog();
 
-	void AddFileDialogEntry(const char *pName, CUIRect *pView);
+	void AddFileDialogEntry(const CFilelistItem *pItem, CUIRect *pView);
 	void SortImages();
 };
 
diff --git a/src/game/editor/ed_io.cpp b/src/game/editor/ed_io.cpp
index 6eae9fb5..62e3cf65 100644
--- a/src/game/editor/ed_io.cpp
+++ b/src/game/editor/ed_io.cpp
@@ -372,7 +372,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName)
 {
 	CDataFileReader DataFile;
 	//DATAFILE *df = datafile_load(filename);
-	if(!DataFile.Open(pStorage, pFileName))
+	if(!DataFile.Open(pStorage, pFileName, IStorage::TYPE_ALL))
 		return 0;
 		
 	Clean();
@@ -411,7 +411,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName)
 					
 					// load external
 					CEditorImage ImgInfo(m_pEditor);
-					if(m_pEditor->Graphics()->LoadPNG(&ImgInfo, aBuf))
+					if(m_pEditor->Graphics()->LoadPNG(&ImgInfo, aBuf, IStorage::TYPE_ALL))
 					{
 						*pImg = ImgInfo;
 						pImg->m_TexId = m_pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0);
diff --git a/src/game/localization.cpp b/src/game/localization.cpp
index fc9ac3df..82de858f 100644
--- a/src/game/localization.cpp
+++ b/src/game/localization.cpp
@@ -4,6 +4,7 @@
 
 #include <engine/shared/linereader.h>
 #include <engine/console.h>
+#include <engine/storage.h>
 
 const char *Localize(const char *pStr)
 {
@@ -40,7 +41,7 @@ void CLocalizationDatabase::AddString(const char *pOrgStr, const char *pNewStr)
 	m_Strings.add(s);
 }
 
-bool CLocalizationDatabase::Load(const char *pFilename, IConsole *pConsole)
+bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, IConsole *pConsole)
 {
 	// empty string means unload
 	if(pFilename[0] == 0)
@@ -50,7 +51,7 @@ bool CLocalizationDatabase::Load(const char *pFilename, IConsole *pConsole)
 		return true;
 	}
 	
-	IOHANDLE IoHandle = io_open(pFilename, IOFLAG_READ);
+	IOHANDLE IoHandle = pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
 	if(!IoHandle)
 		return false;
 	
diff --git a/src/game/localization.h b/src/game/localization.h
index e117c4ff..9a2016c8 100644
--- a/src/game/localization.h
+++ b/src/game/localization.h
@@ -24,7 +24,7 @@ class CLocalizationDatabase
 public:
 	CLocalizationDatabase();
 
-	bool Load(const char *pFilename, class IConsole *pConsole);
+	bool Load(const char *pFilename, class IStorage *pStorage, class IConsole *pConsole);
 
 	int Version() { return m_CurrentVersion; }