Populate item menus in PC editor (they're not functional yet though)

This commit is contained in:
2014-04-17 03:37:44 -04:00
parent 9463ecf2fe
commit b960139d6b
7 changed files with 38 additions and 8 deletions

View File

@@ -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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
91B3EF250F969CE300BF5B67 /* bladbase.exs */ = {isa = PBXFileReference; lastKnownFileType = file; name = bladbase.exs; path = "../rsrc/Blades of Exile Bases/bladbase.exs"; sourceTree = "<group>"; };
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 = "<group>"; };
91B3F10A0F9779C300BF5B67 /* graphtool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = graphtool.cpp; sourceTree = "<group>"; };
@@ -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 */,

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -527,6 +527,7 @@
<object class="NSMenu" key="NSSubmenu" id="13814608">
<string key="NSTitle">Items 2</string>
<array class="NSMutableArray" key="NSMenuItems"/>
<bool key="NSNoAutoenable">YES</bool>
</object>
</object>
<object class="NSMenuItem" id="978930519">
@@ -540,6 +541,7 @@
<object class="NSMenu" key="NSSubmenu" id="31045861">
<string key="NSTitle">Items 3</string>
<array class="NSMutableArray" key="NSMenuItems"/>
<bool key="NSNoAutoenable">YES</bool>
</object>
</object>
<object class="NSMenuItem" id="1010608296">
@@ -553,6 +555,7 @@
<object class="NSMenu" key="NSSubmenu" id="188992829">
<string key="NSTitle">Items 4</string>
<array class="NSMutableArray" key="NSMenuItems"/>
<bool key="NSNoAutoenable">YES</bool>
</object>
</object>
<object class="NSMenuItem" id="391199113">

View File

@@ -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];
}
}