#include "irender.h"
#include "ientity.h"
#include "editable.h"
+#include "iarchive.h"
#include "ifilesystem.h"
#include "namespace.h"
#include "moduleobserver.h"
#include "xywindow.h"
#include "mainframe.h"
#include "preferences.h"
+#include "preferencesystem.h"
#include "referencecache.h"
#include "mru.h"
#include "commands.h"
void RemoveRegionBrushes( void );
+
/*
================
Map_Free
}
};
+CopiedString g_strLastFolder = "";
+
/*
================
Map_LoadFile
globalOutputStream() << "Loading map from " << filename << "\n";
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Map" );
+ MRU_AddFile( filename );
+ g_strLastFolder = g_path_get_dirname( filename );
+
{
ScopeTimer timer( "map load" );
Map_StartPosition();
g_currentMap = &g_map;
+
+ // restart VFS to apply new pak filtering based on mapname
+ // needed for daemon DPK VFS
+ VFS_Restart();
}
class Excluder
Map_UpdateTitle( g_map );
g_map.m_resource->attach( g_map );
+ // refresh VFS to apply new pak filtering based on mapname
+ // needed for daemon DPK VFS
+ VFS_Refresh();
}
void Map_Rename( const char* filename ){
FocusViews( g_vector3_identity, 0 );
g_currentMap = &g_map;
+
+ // restart VFS to apply new pak filtering based on mapname
+ // needed for daemon DPK VFS
+ VFS_Restart();
}
extern void ConstructRegionBrushes( scene::Node * brushes[6], const Vector3 ®ion_mins, const Vector3 ®ion_maxs );
bool Map_ImportFile( const char* filename ){
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Map" );
+ g_strLastFolder = g_path_get_dirname( filename );
+
bool success = false;
if ( extension_equal( path_get_extension( filename ), "bsp" ) ) {
*/
bool Map_SaveFile( const char* filename ){
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Saving Map" );
- return MapResource_saveFile( MapFormat_forFile( filename ), GlobalSceneGraph().root(), Map_Traverse, filename );
+ bool success = MapResource_saveFile( MapFormat_forFile( filename ), GlobalSceneGraph().root(), Map_Traverse, filename );
+ if ( success ) {
+ // refresh VFS to apply new pak filtering based on mapname
+ // needed for daemon DPK VFS
+ VFS_Refresh();
+ }
+ return success;
}
//
return g_mapsPath.c_str();
}
+const char* getLastFolderPath(){
+ if (g_strLastFolder.empty()) {
+ GlobalPreferenceSystem().registerPreference( "LastFolder", CopiedStringImportStringCaller( g_strLastFolder ), CopiedStringExportStringCaller( g_strLastFolder ) );
+ if (g_strLastFolder.empty()) {
+ g_strLastFolder = g_qeglobals.m_userGamePath;
+ }
+ }
+ return g_strLastFolder.c_str();
+}
+
const char* map_open( const char* title ){
- return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, title, getMapsPath(), MapFormat::Name(), true, false, false );
+ return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, title, getLastFolderPath(), MapFormat::Name(), false, true, false );
}
const char* map_import( const char* title ){
- return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, title, getMapsPath(), MapFormat::Name(), false, true, false );
+ return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, title, getLastFolderPath(), MapFormat::Name(), false, true, false );
}
const char* map_save( const char* title ){
- return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, title, getMapsPath(), MapFormat::Name(), false, false, true );
+ return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, title, getLastFolderPath(), MapFormat::Name(), false, false, true );
}
void OpenMap(){
const char* filename = map_open( "Open Map" );
- if ( filename != 0 ) {
+ if ( filename != NULL ) {
MRU_AddFile( filename );
Map_RegionOff();
Map_Free();
void ImportMap(){
const char* filename = map_import( "Import Map" );
- if ( filename != 0 ) {
+ if ( filename != NULL ) {
UndoableCommand undo( "mapImport" );
Map_ImportFile( filename );
}
bool Map_SaveAs(){
const char* filename = map_save( "Save Map" );
- if ( filename != 0 ) {
+ if ( filename != NULL ) {
+ g_strLastFolder = g_path_get_dirname( filename );
MRU_AddFile( filename );
Map_Rename( filename );
return Map_Save();
void ExportMap(){
const char* filename = map_save( "Export Selection" );
- if ( filename != 0 ) {
+ if ( filename != NULL ) {
+ g_strLastFolder = g_path_get_dirname( filename );
Map_SaveSelected( filename );
}
}
void SaveRegion(){
const char* filename = map_save( "Export Region" );
- if ( filename != 0 ) {
+ if ( filename != NULL ) {
+ g_strLastFolder = g_path_get_dirname( filename );
Map_SaveRegion( filename );
}
}
MapModuleObserver g_MapModuleObserver;
-#include "preferencesystem.h"
-
CopiedString g_strLastMap;
bool g_bLoadLastMap = false;