I suppose it's a little cleaner to have separate modes for bashing a door and picking a lock

This commit is contained in:
2020-02-04 00:34:01 -05:00
parent aad9918f13
commit 2520f56fb0
2 changed files with 7 additions and 8 deletions

View File

@@ -116,7 +116,6 @@ short monst_place_count = 0; // 1 - standard place 2 - place last
enum_map(eShopArea, rectangle) shopping_rects[8]; enum_map(eShopArea, rectangle) shopping_rects[8];
std::queue<pending_special_type> special_queue; std::queue<pending_special_type> special_queue;
bool end_scenario = false; bool end_scenario = false;
bool current_bash_is_bash = false;
static void advance_time(bool did_something, bool need_redraw, bool need_reprint); static void advance_time(bool did_something, bool need_redraw, bool need_reprint);
@@ -676,12 +675,11 @@ static void handle_use_space(location destination, bool& did_something, bool& ne
} }
static void handle_bash_pick_select(bool& need_reprint, bool isBash) { static void handle_bash_pick_select(bool& need_reprint, bool isBash) {
if(overall_mode == MODE_BASH_TOWN) { if(overall_mode == MODE_BASH_TOWN || overall_mode == MODE_PICK_TOWN) {
add_string_to_buf(" Cancelled."); add_string_to_buf(" Cancelled.");
overall_mode = MODE_TOWN; overall_mode = MODE_TOWN;
} else { } else {
overall_mode = MODE_BASH_TOWN; overall_mode = isBash ? MODE_BASH_TOWN : MODE_PICK_TOWN;
current_bash_is_bash = isBash;
add_string_to_buf(isBash ? "Bash Door: Select a space." : "Pick Lock: Select a space."); add_string_to_buf(isBash ? "Bash Door: Select a space." : "Pick Lock: Select a space.");
} }
need_reprint = true; need_reprint = true;
@@ -1238,10 +1236,10 @@ bool handle_action(const sf::Event& event) {
} }
// Bashing/lockpicking // Bashing/lockpicking
else if(overall_mode == MODE_BASH_TOWN) { else if(overall_mode == MODE_BASH_TOWN || overall_mode == MODE_PICK_TOWN) {
destination.x += i - 4; destination.x += i - 4;
destination.y += j - 4; destination.y += j - 4;
handle_bash_pick(destination, did_something, need_redraw, current_bash_is_bash); handle_bash_pick(destination, did_something, need_redraw, overall_mode == MODE_BASH_TOWN);
} }
} }
// MARK: End: click in terrain // MARK: End: click in terrain
@@ -2010,7 +2008,7 @@ bool handle_keystroke(const sf::Event& event){
break; break;
case 'L': // Pick lock case 'L': // Pick lock
if(overall_mode == MODE_TOWN || overall_mode == MODE_BASH_TOWN) if(overall_mode == MODE_TOWN || overall_mode == MODE_PICK_TOWN)
handle_bash_pick_select(need_reprint, false); handle_bash_pick_select(need_reprint, false);
break; break;

View File

@@ -20,7 +20,8 @@ enum eGameMode {
MODE_TOWN_TARGET, // spell target, that is MODE_TOWN_TARGET, // spell target, that is
MODE_USE_TOWN, MODE_USE_TOWN,
MODE_DROP_TOWN, MODE_DROP_TOWN,
MODE_BASH_TOWN, MODE_BASH_TOWN, // Bashing down a door
MODE_PICK_TOWN, // Picking a lock
// Combat modes // Combat modes
MODE_COMBAT, MODE_COMBAT,
MODE_SPELL_TARGET, MODE_SPELL_TARGET,