boe.actions.cpp: allow more escaping in the first phase of spell/missile/throw mode
+ allow to use arrows in scrollable mode...
This commit is contained in:
@@ -1577,27 +1577,22 @@ bool handle_keystroke(const sf::Event& event){
|
||||
kb::Numpad4,kb::Numpad5,kb::Numpad6,
|
||||
kb::Numpad7,kb::Numpad8,kb::Numpad9
|
||||
};
|
||||
location terrain_click[10] = {
|
||||
{150,185},{120,215},{150,215},{180,215},
|
||||
{120,185},{150,185},{180,185},
|
||||
{120,155},{150,155},{180,135}
|
||||
};
|
||||
Key talk_chars[9] = {kb::L,kb::N,kb::J,kb::B,kb::S,kb::R,kb::D,kb::G,kb::A};
|
||||
Key shop_chars[8] = {kb::A,kb::B,kb::C,kb::D,kb::E,kb::F,kb::G,kb::H};
|
||||
|
||||
if(event.key.code == kb::Escape) {
|
||||
bool abort=true;
|
||||
if (overall_mode == MODE_TALK_TOWN || overall_mode == MODE_LOOK_TOWN)
|
||||
if (overall_mode == MODE_TALK_TOWN || overall_mode == MODE_LOOK_TOWN || overall_mode == MODE_TOWN_TARGET)
|
||||
overall_mode = MODE_TOWN;
|
||||
else if(overall_mode == MODE_LOOK_OUTDOORS)
|
||||
overall_mode = MODE_OUTDOORS;
|
||||
else if (overall_mode == MODE_LOOK_COMBAT)
|
||||
else if (overall_mode == MODE_LOOK_COMBAT || overall_mode == MODE_SPELL_TARGET || overall_mode == MODE_FANCY_TARGET || overall_mode == MODE_FIRING || overall_mode == MODE_THROWING)
|
||||
overall_mode = MODE_COMBAT;
|
||||
else
|
||||
abort = false;
|
||||
if (abort) {
|
||||
play_sound(37);
|
||||
add_string_to_buf("Aborted.");
|
||||
add_string_to_buf("Cancelled.");
|
||||
print_buf();
|
||||
obscureCursor();
|
||||
return false;
|
||||
@@ -1681,19 +1676,40 @@ bool handle_keystroke(const sf::Event& event){
|
||||
are_done = handle_action(pass_event);
|
||||
}
|
||||
} else {
|
||||
for(short i = 0; i < 10; i++)
|
||||
if(chr2 == keypad[i]) {
|
||||
if(i == 0) {
|
||||
chr2 = kb::Z;
|
||||
}
|
||||
else {
|
||||
pass_point = mainPtr.mapCoordsToPixel(terrain_click[i], mainView);
|
||||
pass_event.mouseButton.x = pass_point.x;
|
||||
pass_event.mouseButton.y = pass_point.y;
|
||||
are_done = handle_action(pass_event);
|
||||
return are_done;
|
||||
}
|
||||
for(short i = 0; i < 10; i++) {
|
||||
if(chr2 != keypad[i])
|
||||
continue;
|
||||
if(i == 0) {
|
||||
chr2 = kb::Z;
|
||||
}
|
||||
else if (overall_mode == MODE_FIRING || overall_mode == MODE_THROWING || overall_mode == MODE_SPELL_TARGET || overall_mode == MODE_TOWN_TARGET || overall_mode == MODE_FANCY_TARGET) {
|
||||
bool need_redraw=true;
|
||||
if (i>=1 && i<=3 && center.y < univ.town->in_town_rect.bottom && center.y < univ.town->max_dim - 5)
|
||||
center.y++;
|
||||
else if (i>=6 && i<=9 && center.y > univ.town->in_town_rect.top && center.y > 4)
|
||||
center.y--;
|
||||
if ((i%3)==1 && center.x > univ.town->in_town_rect.left && center.x > 4)
|
||||
center.x--;
|
||||
else if ((i%3)==0 && center.x < univ.town->in_town_rect.right && center.x < univ.town->max_dim - 5)
|
||||
center.x++;
|
||||
else
|
||||
need_redraw=false;
|
||||
if (need_redraw)
|
||||
draw_terrain();
|
||||
}
|
||||
else {
|
||||
location terrain_click[10] = {
|
||||
{150,185},{120,215},{150,215},{180,215},
|
||||
{120,185},{150,185},{180,185},
|
||||
{120,155},{150,155},{180,135}
|
||||
};
|
||||
pass_point = mainPtr.mapCoordsToPixel(terrain_click[i], mainView);
|
||||
pass_event.mouseButton.x = pass_point.x;
|
||||
pass_event.mouseButton.y = pass_point.y;
|
||||
are_done = handle_action(pass_event);
|
||||
return are_done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool did_something = false, need_redraw = false, need_reprint = false;
|
||||
|
Reference in New Issue
Block a user