From f2f334551c7dfc3fe5b7739040344a7af8c5d5c2 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 14 Feb 2015 22:58:41 -0500 Subject: [PATCH 1/4] Fix town advanced dialog - Also remove now-unused Windows accelerator table resources --- rsrc/dialogs/edit-town-advanced.xml | 14 +++++------ src/BoE.vsproj/Game/Blades of Exile.rc | 18 +------------ src/BoE.vsproj/PcEdit/Char Editor.rc | 15 +---------- src/BoE.vsproj/PcEdit/resource.h | 1 - src/BoE.vsproj/ScenEdit/Scen Editor.rc | 35 +------------------------- src/BoE.vsproj/ScenEdit/resource.h | 1 - 6 files changed, 10 insertions(+), 74 deletions(-) diff --git a/rsrc/dialogs/edit-town-advanced.xml b/rsrc/dialogs/edit-town-advanced.xml index 641056a0..e5b0b8c7 100644 --- a/rsrc/dialogs/edit-town-advanced.xml +++ b/rsrc/dialogs/edit-town-advanced.xml @@ -56,13 +56,13 @@ - Town Properties: - + Town Properties: + Town hidden? - (This town cannot be seen until it's made visible with a special encounter.) + (Can't be seen until it's made visible with a special encounter.) - No automap in this town - Defy scrying (Magic Map doesn't work) - Magical barriers are stronger in this town - You can create new PCs in this town + No automap in this town + Defy scrying (Magic Map doesn't work) + Magical barriers are stronger in this town + You can create new PCs in this town \ No newline at end of file diff --git a/src/BoE.vsproj/Game/Blades of Exile.rc b/src/BoE.vsproj/Game/Blades of Exile.rc index 5c29e6bc..95d1f1ab 100644 --- a/src/BoE.vsproj/Game/Blades of Exile.rc +++ b/src/BoE.vsproj/Game/Blades of Exile.rc @@ -22,6 +22,7 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) ///////////////////////////////////////////////////////////////////////////// // @@ -111,23 +112,6 @@ BEGIN END -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDC_BLADESOFEXILE ACCELERATORS -BEGIN - "^O", IDM_FILE_OPEN, ASCII, NOINVERT - "^S", IDM_FILE_SAVE, ASCII, NOINVERT - "^N", IDM_FILE_NEW, ASCII, NOINVERT - "^Q", IDM_FILE_QUIT, ASCII, NOINVERT - "^A", IDM_ACTIONS_ALCHEMY, ASCII, NOINVERT - "^W", IDM_ACTIONS_WAIT, ASCII, NOINVERT - "^M", IDM_ACTIONS_MAP, ASCII, NOINVERT -END - - #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // diff --git a/src/BoE.vsproj/PcEdit/Char Editor.rc b/src/BoE.vsproj/PcEdit/Char Editor.rc index 3326e083..7b454723 100644 --- a/src/BoE.vsproj/PcEdit/Char Editor.rc +++ b/src/BoE.vsproj/PcEdit/Char Editor.rc @@ -123,23 +123,10 @@ BEGIN POPUP "&Help" BEGIN MENUITEM "About Blades of Exile Editor", IDM_ABOUT - MENUITEM "Blades of Exile Editor Help", IDM_HELP + MENUITEM "Blades of Exile Editor Help", IDM_HELP END END - -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_ACCELERATOR1 ACCELERATORS -BEGIN - "^O", 2, ASCII - "^S", 1, ASCII - "^Q", 4, ASCII -END - #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/src/BoE.vsproj/PcEdit/resource.h b/src/BoE.vsproj/PcEdit/resource.h index 6a685c06..44ad4c6d 100644 --- a/src/BoE.vsproj/PcEdit/resource.h +++ b/src/BoE.vsproj/PcEdit/resource.h @@ -6,7 +6,6 @@ #define IDM_FILE_OPEN 101 #define IDM_FILE_CLOSE 102 #define IDM_FILE_SAVE 103 -#define IDR_ACCELERATOR1 104 #define IDM_FILE_SAVE_AS 104 #define IDM_FILE_REVERT 105 #define IDM_FILE_QUIT 106 diff --git a/src/BoE.vsproj/ScenEdit/Scen Editor.rc b/src/BoE.vsproj/ScenEdit/Scen Editor.rc index e35b6e57..3445acd8 100644 --- a/src/BoE.vsproj/ScenEdit/Scen Editor.rc +++ b/src/BoE.vsproj/ScenEdit/Scen Editor.rc @@ -90,7 +90,7 @@ BEGIN MENUITEM "&Scenario Details", IDM_SCEN_DETAILS MENUITEM "Scenario Intr&o Text", IDM_SCEN_INTRO MENUITEM "Set Starting &Location", IDM_SCEN_START - MENUITEM "Classify Custom &Graphics" IDM_SCEN_CUSTOM_PICS + MENUITEM "Classify Custom &Graphics", IDM_SCEN_CUSTOM_PICS MENUITEM SEPARATOR MENUITEM "Advanced:", IDM_SCEN_NEW_TOWN, GRAYED MENUITEM " Edit Special &Nodes", IDM_SCEN_ADV_SPECIALS @@ -215,39 +215,6 @@ BEGIN END END - -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_ACCELERATOR1 ACCELERATORS -BEGIN - VK_F1, 801, VIRTKEY - "^O", 1, ASCII - "^S", 2, ASCII - "^N", 3, ASCII - "^Q", 5, ASCII - "^B", 214, ASCII - "^U", 311, ASCII - "^T", 401, ASCII - "^R", 402, ASCII - "^L", 403, ASCII - "^E", 404, ASCII - "^F", 405, ASCII - "^G", 406, ASCII - "^M", 407, ASCII - "\t", 408, ASCII - "^J", 409, ASCII - "^K", 410, ASCII - "^P", 414, ASCII - VK_TAB, 408, VIRTKEY, CONTROL, NOINVERT - VK_LEFT, 409, VIRTKEY, CONTROL, NOINVERT - VK_RIGHT, 410, VIRTKEY, CONTROL, NOINVERT - VK_UP, 412, VIRTKEY, CONTROL, NOINVERT - VK_DOWN, 413, VIRTKEY, CONTROL, NOINVERT -END - #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/src/BoE.vsproj/ScenEdit/resource.h b/src/BoE.vsproj/ScenEdit/resource.h index f3451a34..9f12036e 100644 --- a/src/BoE.vsproj/ScenEdit/resource.h +++ b/src/BoE.vsproj/ScenEdit/resource.h @@ -4,7 +4,6 @@ // #define IDR_MENU1 101 #define IDM_FILE_NEW 101 -#define IDR_ACCELERATOR1 102 #define IDM_FILE_OPEN 102 #define IDM_FILE_CLOSE 103 #define IDM_FILE_SAVE 104 From 50e3d7b37871a0355a4aed57804c0ff0434acaa0 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Thu, 19 Feb 2015 22:24:19 -0500 Subject: [PATCH 2/4] Add OpenAL to list of included DLLs on Windows. --- src/BoE.vsproj/Common/CopyFiles.bat | 3 ++- src/BoE.vsproj/Installer/main.nsi | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/BoE.vsproj/Common/CopyFiles.bat b/src/BoE.vsproj/Common/CopyFiles.bat index a59fafa3..31535a18 100644 --- a/src/BoE.vsproj/Common/CopyFiles.bat +++ b/src/BoE.vsproj/Common/CopyFiles.bat @@ -50,4 +50,5 @@ if %Config% == "Debug" ( ) xcopy "%DllSrcDir%\zlib1.dll" %TargetDir% /s /y /i /d -xcopy "%DllSrcDir%\libsndfile-1.dll" %TargetDir% /s /y /i /d \ No newline at end of file +xcopy "%DllSrcDir%\libsndfile-1.dll" %TargetDir% /s /y /i /d +xcopy "%DllSrcDir%\openal32.dll" %TargetDir% /s /y /i /d diff --git a/src/BoE.vsproj/Installer/main.nsi b/src/BoE.vsproj/Installer/main.nsi index bb0a5e0c..57e9a13f 100644 --- a/src/BoE.vsproj/Installer/main.nsi +++ b/src/BoE.vsproj/Installer/main.nsi @@ -53,6 +53,7 @@ Section "Blades of Exile" Section1 File "..\Release\Blades of Exile.exe" ; Required DLLs File "..\Release\libsndfile-1.dll" + File "..\Release\openal32.dll" File "..\Release\sfml-audio-2.dll" File "..\Release\sfml-graphics-2.dll" File "..\Release\sfml-system-2.dll" From 3fc1b8cd7edf6b6d9ac7c9c3840e93aa51d878c7 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Fri, 20 Feb 2015 12:18:38 -0500 Subject: [PATCH 3/4] Fix most of the warnings in the Visual Studio build - Fix energy-draining weapons - Specials called when a spell is targeted on a space now work a little differently if the spell is multi-target. For each target, the special is triggered if it exists; otherwise the normal spell behaviour occurs. --- src/boe.combat.cpp | 17 +++++++++-------- src/boe.graphics.cpp | 4 +++- src/boe.items.cpp | 15 ++++++++------- src/boe.specials.cpp | 4 ++-- src/classes/monster.cpp | 3 ++- src/classes/universe.h | 4 ++-- src/pcedit/pc.editors.cpp | 2 +- src/tools/fileio_scen.cpp | 2 +- 8 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/boe.combat.cpp b/src/boe.combat.cpp index 89071494..7bbbe78b 100644 --- a/src/boe.combat.cpp +++ b/src/boe.combat.cpp @@ -843,7 +843,7 @@ void pc_attack_weapon(short who_att,iLiving& target,short hit_adj,short dam_adj, target.drain_sp(weap.abil_data[0]); if(before > target.get_magic()) { add_string_to_buf(" Blade drains energy."); - univ.party[who_att].restore_sp((before > target.get_magic()) / 3); + univ.party[who_att].restore_sp(before / 3); } } else if(weap.ability == eItemAbil::WEAPON_CALL_SPECIAL) { short s1,s2,s3; @@ -1027,11 +1027,6 @@ void do_combat_cast(location target) { } force_wall_position = 10; - // TODO: Should we do this here? Or in the handling of targeting modes? - // (It really depends whether we want to be able to trigger it for targeting something other than a spell.) - if(adjust <= 4 && !cast_spell_on_space(target, spell_being_cast)) - return; // The special node intercepted and cancelled regular spell behaviour. - caster.void_sanctuary(); if(overall_mode == MODE_SPELL_TARGET) { spell_targets[0] = target; @@ -1066,8 +1061,14 @@ void do_combat_cast(location target) { caster.cur_sp -= store_sum_monst_cost; cost_taken = true; } - - if((adjust = can_see_light(caster.combat_pos,target,sight_obscurity)) > 4) { + + adjust = can_see_light(caster.combat_pos, target, sight_obscurity); + // TODO: Should we do this here? Or in the handling of targeting modes? + // (It really depends whether we want to be able to trigger it for targeting something other than a spell.) + if(adjust <= 4 && !cast_spell_on_space(target, spell_being_cast)) + continue; // The special node intercepted and cancelled regular spell behaviour. + + if(adjust > 4) { add_string_to_buf(" Can't see target."); } else if(loc_off_act_area(target)) { diff --git a/src/boe.graphics.cpp b/src/boe.graphics.cpp index a4c0ca0f..9f2e853a 100644 --- a/src/boe.graphics.cpp +++ b/src/boe.graphics.cpp @@ -62,6 +62,7 @@ extern cCustomGraphics spec_scen_g; extern sf::RenderWindow mini_map; bool map_visible = false; extern bool show_startup_splash; +extern std::string save_talk_str1, save_talk_str2; rectangle menuBarRect; Region originalGrayRgn, newGrayRgn, underBarRgn; @@ -575,7 +576,8 @@ void redraw_screen(int refresh) { draw_startup(0); break; case MODE_TALKING: - if(refresh & REFRESH_DLOG); // TODO: Should call place_talk_str, but we don't have the strings + if(refresh & REFRESH_DLOG) + place_talk_str(save_talk_str1, save_talk_str2, 0, rectangle()); refresh_talking(); break; case MODE_SHOPPING: diff --git a/src/boe.items.cpp b/src/boe.items.cpp index 1b26bb5e..b904dcc8 100644 --- a/src/boe.items.cpp +++ b/src/boe.items.cpp @@ -378,16 +378,17 @@ void set_town_attitude(short lo,short hi,short att) { return; give_help(53,0); univ.town.monst.friendly = 1; + long long num_monst = univ.town.monst.size(); // Nice smart indexing, like Python :D - if(lo <= -univ.town.monst.size()) + if(lo <= -num_monst) lo = 0; if(lo < 0) - lo = univ.town.monst.size() + lo; - if(hi <= -univ.town.monst.size()) + lo = num_monst + lo; + if(hi <= -num_monst) hi = 0; if(hi < 0) - hi = univ.town.monst.size() + hi; + hi = num_monst + hi; if(hi < lo) std::swap(lo, hi); @@ -970,9 +971,9 @@ void refresh_store_items() { continue; } else if(entry.type == eShopItemType::CLASS) { std::set choices; - for(int i = 0; i < univ.scenario.scen_items.size(); i++) { - if(univ.scenario.scen_items[i].special_class == entry.item.special_class) - choices.insert(i); + for(int k = 0; k < univ.scenario.scen_items.size(); k++) { + if(univ.scenario.scen_items[k].special_class == entry.item.special_class) + choices.insert(k); } int choice = get_ran(1,0,choices.size()); if(choice < choices.size()) { diff --git a/src/boe.specials.cpp b/src/boe.specials.cpp index d3171c60..f6614deb 100644 --- a/src/boe.specials.cpp +++ b/src/boe.specials.cpp @@ -3529,7 +3529,7 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, if(i > 0) *next_spec = spec.ex1b; break; case eSpecType::IF_RECIPE: - if(i < 0 || i >= 20) { + if(spec.ex1a < 0 || spec.ex1a >= 20) { giveError("Alchemy recipe out of range (0 - 19)."); break; } @@ -3734,7 +3734,7 @@ void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, *next_spec = -1; } else { - if(handle_lever(loc(PSD[SDF_SPEC_LOC_X], PSD[SDF_SPEC_LOC_Y])) > 0) + if(handle_lever(loc(PSD[SDF_SPEC_LOC_X], PSD[SDF_SPEC_LOC_Y]))) *next_spec = spec.ex1b; } break; diff --git a/src/classes/monster.cpp b/src/classes/monster.cpp index c9361940..b0e00725 100644 --- a/src/classes/monster.cpp +++ b/src/classes/monster.cpp @@ -1008,7 +1008,8 @@ void cMonster::readFrom(std::istream& file) { m_name = read_maybe_quoted_string(line); } else if(cur == "ATTACK") { int which; - line >> which >> a[which].dice >> a[which].sides >> a[which].type; + line >> which; + line >> a[which].dice >> a[which].sides >> a[which].type; which--; } else if(cur == "SIZE") { line >> temp1 >> temp2; diff --git a/src/classes/universe.h b/src/classes/universe.h index 4d131bd6..3d182068 100644 --- a/src/classes/universe.h +++ b/src/classes/universe.h @@ -169,9 +169,9 @@ public: cParty party; std::map stored_pcs; cCurTown town; - char town_maps[200][8][64]; // formerly stored_town_maps_type + unsigned char town_maps[200][8][64]; // formerly stored_town_maps_type cCurOut out; - char out_maps[100][6][48]; // formerly stored_outdoor_maps_type + unsigned char out_maps[100][6][48]; // formerly stored_outdoor_maps_type fs::path file; void clear_stored_pcs(); diff --git a/src/pcedit/pc.editors.cpp b/src/pcedit/pc.editors.cpp index 41f06ff5..455db285 100644 --- a/src/pcedit/pc.editors.cpp +++ b/src/pcedit/pc.editors.cpp @@ -240,7 +240,7 @@ void display_alchemy(bool allowEdit) { if(!allowEdit) showAlch->getControl(id).attachClickHandler(&cLed::noAction); cLed& led = dynamic_cast(showAlch->getControl(id)); - if(univ.party.alchemy[i] > 0) + if(univ.party.alchemy[i]) led.setState(led_red); else led.setState(led_off); } diff --git a/src/tools/fileio_scen.cpp b/src/tools/fileio_scen.cpp index 30e9e65d..4c2892f2 100644 --- a/src/tools/fileio_scen.cpp +++ b/src/tools/fileio_scen.cpp @@ -467,7 +467,7 @@ static void readShopFromXml(ticpp::Element& data, cShop& shop, cScenario& scen) shop.setPrompt(boost::lexical_cast(val)); } else if(type == "face") { pic_num_t face; - elem->GetText(face); + elem->GetText(&face); shop.setFace(face); } else if(type == "entries") { int entries_found = 0; From c99b205088fbb4e9c7e4fc024dacb606e56d59a3 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Fri, 20 Feb 2015 12:19:03 -0500 Subject: [PATCH 4/4] Remove old versions of dialog box schema --- .gitignore | 3 + rsrc/schemas/dialog.dtd | 84 --------- rsrc/schemas/dialog.rng | 407 ---------------------------------------- 3 files changed, 3 insertions(+), 491 deletions(-) delete mode 100644 rsrc/schemas/dialog.dtd delete mode 100644 rsrc/schemas/dialog.rng diff --git a/.gitignore b/.gitignore index 5ed15a42..fc14d263 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,9 @@ src/tools/*.sbproj src/doxy/html/ src/doxy/doxy_warnings.txt +# Mac junk files +.DS_Store + # Windows junk files Thumbs.db diff --git a/rsrc/schemas/dialog.dtd b/rsrc/schemas/dialog.dtd deleted file mode 100644 index 75bc361b..00000000 --- a/rsrc/schemas/dialog.dtd +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rsrc/schemas/dialog.rng b/rsrc/schemas/dialog.rng deleted file mode 100644 index 14b9ae2b..00000000 --- a/rsrc/schemas/dialog.rng +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NUMBER - - - - - true - false - - - - - blank - ter - teranim - monst - dlog - talk - scen - item - pc - field - boom - missile - full - map - status - - - - - small - regular - large - help - left - right - up - down - tiny - done - tall - trait - push - - - - - left - right - up - down - esc - enter - return - tab - help - space - - - - - - - - - - - - - - - - - - - - - - - - - dungeon - geneva - silom - maidenword - - - - - - - small - large - - - - - - - - - - - - - - - light - dark - - - - - - - - - - - - - - - - - - - - - - - - - - - num - text - - - - - - - - - - - - - - - - - - - - - - none - - - - - - - - - - - - none - CDATA - - - - - - - - - - - - - - - - - - - - - - - small - wide - tall - large - - - - - - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - none - - - - - - - none - CDATA - - - - - - - - - - - - - - - red - green - off - - - - - - - none - CDATA - - - - - - - - - - - - - - - - none - CDATA - - - - - - - - - - - - - - - - - - - -