diff --git a/osx/BoE.xcodeproj/project.pbxproj b/osx/BoE.xcodeproj/project.pbxproj index 28660b5e..c830cb92 100644 --- a/osx/BoE.xcodeproj/project.pbxproj +++ b/osx/BoE.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ buildConfigurationList = 912CF36F0FE44A2A0063B614 /* Build configuration list for PBXAggregateTarget "Common Data Files" */; buildPhases = ( 912CF3560FE4494C0063B614 /* Copy Scenarios */, + 91ACCE6218FFB5F300FAEF8B /* Copy Base Scenarios */, 912CF36D0FE44A2A0063B614 /* Copy Mac Graphics */, 912CF36E0FE44A2A0063B614 /* Copy Mac Cursors */, 914B2B3118E80030007B6799 /* Copy Mac Sounds */, @@ -452,6 +453,7 @@ 91AC620D0FA2853700EEAE67 /* creatlist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91AC620A0FA2853700EEAE67 /* creatlist.cpp */; }; 91AC65520FA3441B00EEAE67 /* universe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91AC61C50FA2729900EEAE67 /* universe.cpp */; }; 91AC65AD0FA34AC600EEAE67 /* universe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91AC61C50FA2729900EEAE67 /* universe.cpp */; }; + 91ACCE6418FFB61A00FAEF8B /* bladbase.exs in Copy Base Scenarios */ = {isa = PBXBuildFile; fileRef = 91B3EF250F969CE300BF5B67 /* bladbase.exs */; }; 91B3EF1F0F969C9C00BF5B67 /* BoECharEd.icns in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EF110F969BD300BF5B67 /* BoECharEd.icns */; }; 91B3EF450F969F1700BF5B67 /* BoE Scenario Editor-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EED90F969BA700BF5B67 /* BoE Scenario Editor-Info.plist */; }; 91B3EF470F969F1700BF5B67 /* BoE Scenario Editor.icns in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EEDB0F969BA700BF5B67 /* BoE Scenario Editor.icns */; }; @@ -1015,6 +1017,17 @@ name = "Copy String Lists"; runOnlyForDeploymentPostprocessing = 0; }; + 91ACCE6218FFB5F300FAEF8B /* Copy Base Scenarios */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "data/BoE Bases"; + dstSubfolderSpec = 16; + files = ( + 91ACCE6418FFB61A00FAEF8B /* bladbase.exs in Copy Base Scenarios */, + ); + name = "Copy Base Scenarios"; + runOnlyForDeploymentPostprocessing = 0; + }; 91B3EF320F969D9900BF5B67 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -1484,7 +1497,7 @@ 91B3EF120F969BD300BF5B67 /* bladespced.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; path = bladespced.rsrc; sourceTree = ""; }; 91B3EF130F969BD300BF5B67 /* Blades of Exile Character Editor-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Blades of Exile Character Editor-Info.plist"; sourceTree = ""; }; 91B3EF180F969C2200BF5B67 /* Blades of Exile Character Editor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Blades of Exile Character Editor.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 91B3EF250F969CE300BF5B67 /* Blades of Exile Base */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Blades of Exile Base"; path = "../rsrc/Blades of Exile Bases/Blades of Exile Base"; sourceTree = ""; }; + 91B3EF250F969CE300BF5B67 /* bladbase.exs */ = {isa = PBXFileReference; lastKnownFileType = file; name = bladbase.exs; path = "../rsrc/Blades of Exile Bases/bladbase.exs"; sourceTree = ""; }; 91B3EF3F0F969F0000BF5B67 /* BoE Scenario Editor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "BoE Scenario Editor.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 91B3F1090F9779C300BF5B67 /* graphtool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphtool.h; sourceTree = ""; }; 91B3F10A0F9779C300BF5B67 /* graphtool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = graphtool.cpp; sourceTree = ""; }; @@ -2303,7 +2316,7 @@ 91364EC818F091300033B58E /* dialogs */, 914701A318F629D4008A6DC9 /* fonts */, 914B2ACB18E7FFEF007B6799 /* sounds.exa */, - 91B3EF250F969CE300BF5B67 /* Blades of Exile Base */, + 91B3EF250F969CE300BF5B67 /* bladbase.exs */, 912CF37D0FE44A9B0063B614 /* graphics.exd */, 91D635A90F90E7B500674AB3 /* Blades of Exile Scenarios */, 914B2BB518E892AA007B6799 /* dialog-converting.txt */, diff --git a/osx/pcedit/pc.fileio.cpp b/osx/pcedit/pc.fileio.cpp index ede9cb68..2aa2e99e 100644 --- a/osx/pcedit/pc.fileio.cpp +++ b/osx/pcedit/pc.fileio.cpp @@ -217,11 +217,11 @@ short init_data(short flag) } void load_base_item_defs(){ - fs::path basePath = progDir/"Scenario Editor"/"BoE Bases"/"bladbase.exs"; - load_scenario(basePath, true); + fs::path basePath = progDir/"data"/"BoE Bases"/"bladbase.exs"; + scen_items_loaded = load_scenario(basePath, true); } bool load_scen_item_defs(std::string scen_name){ - fs::path scenPath = progDir/"Blades of Exile Scenarios"/(scen_name + ".exs"); + fs::path scenPath = progDir/"Blades of Exile Scenarios"/scen_name; return load_scenario(scenPath, true); } diff --git a/osx/pcedit/pc.fileio.h b/osx/pcedit/pc.fileio.h index 90fb69e9..1f950d46 100644 --- a/osx/pcedit/pc.fileio.h +++ b/osx/pcedit/pc.fileio.h @@ -9,3 +9,5 @@ short init_data(short flag); //void save_prefs(); void remove_party_from_scen(); void init_directories(); +void load_base_item_defs(); +bool load_scen_item_defs(std::string scen_name); diff --git a/osx/pcedit/pc.main.cpp b/osx/pcedit/pc.main.cpp index e4724cb1..6eb0e5d4 100644 --- a/osx/pcedit/pc.main.cpp +++ b/osx/pcedit/pc.main.cpp @@ -227,8 +227,14 @@ void handle_file_menu(int item_hit) if(verify_restore_quit(true)){ file = nav_get_party(); if(!file.empty()) { - if(load_party(file)) + if(load_party(file)) { file_in_mem = file; + party_in_scen = !univ.party.scen_name.empty(); + if(party_in_scen && load_scen_item_defs(univ.party.scen_name)) + scen_items_loaded = true; + else load_base_item_defs(); + update_item_menu(); + } } menu_activate(); } diff --git a/osx/pcedit/pc.menu.xib b/osx/pcedit/pc.menu.xib index 350eb7f0..b6d1d55c 100644 --- a/osx/pcedit/pc.menu.xib +++ b/osx/pcedit/pc.menu.xib @@ -527,6 +527,7 @@ Items 2 + YES @@ -540,6 +541,7 @@ Items 3 + YES @@ -553,6 +555,7 @@ Items 4 + YES diff --git a/osx/pcedit/pc.menus.mac.mm b/osx/pcedit/pc.menus.mac.mm index 35f14908..0191607f 100644 --- a/osx/pcedit/pc.menus.mac.mm +++ b/osx/pcedit/pc.menus.mac.mm @@ -25,6 +25,7 @@ extern void handle_item_menu(int item_hit); extern cScenario scenario; extern fs::path file_in_mem; +extern bool scen_items_loaded; MenuHandle menu_bar_handle; MenuHandle apple_menu, file_menu, reg_menu, extra_menu, items_menu[4]; @@ -75,6 +76,7 @@ void init_menubar() { for(int i = 0; i < [extra_menu numberOfItems]; i++) setMenuCallback([extra_menu itemAtIndex: i], handler, @selector(specMenu:), i + 1); + update_item_menu(); menu_activate(); } @@ -91,11 +93,15 @@ void update_item_menu() { cItemRec(& item_list)[400] = scenario.scen_items; for(int j = 0; j < 4; j++){ [items_menu[j] removeAllItems]; - for(int i = 0; i < 100; i++) { + if(!scen_items_loaded) { + [[items_menu[j] addItemWithTitle: @"Items Not Loaded" action: @selector(itemMenu:) keyEquivalent: @""] setEnabled: NO]; + } else for(int i = 0; i < 100; i++) { ItemWrapper* item = [ItemWrapper withItem: i + 100 * j]; NSString* item_name = [NSString stringWithCString: item_list[i + j * 100].full_name.c_str() encoding: NSASCIIStringEncoding]; - NSMenuItem* choice = [items_menu[j] addItemWithTitle: item_name action: @selector(itemMenu:) keyEquivalent: nil]; + NSMenuItem* choice = [items_menu[j] addItemWithTitle: item_name action: @selector(itemMenu:) keyEquivalent: @""]; [choice setTarget: targ]; + // TODO: Also disable gold or food + [choice setEnabled: [item item].variety > 0]; [choice setRepresentedObject: item]; } } diff --git a/rsrc/Blades of Exile Bases/Blades of Exile Base b/rsrc/Blades of Exile Bases/bladbase.exs similarity index 100% rename from rsrc/Blades of Exile Bases/Blades of Exile Base rename to rsrc/Blades of Exile Bases/bladbase.exs