Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the use of the right keys for one-click #3417

Merged
merged 4 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/front_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ int is_game_key_pressed(long key_id, long *val, TbBool ignore_mods)
return 0;
}
}
if ((key_id == Gkey_RotateMod) || (key_id == Gkey_SpeedMod) || (key_id == Gkey_CrtrContrlMod) || (key_id == Gkey_CrtrQueryMod))
if ((key_id == Gkey_RotateMod) || (key_id == Gkey_SpeedMod) || (key_id == Gkey_CrtrContrlMod)
|| (key_id == Gkey_CrtrQueryMod) || (key_id == Gkey_BestRoomSpace) || (key_id == Gkey_SquareRoomSpace)
|| (key_id == Gkey_SellTrapOnSubtile))
{
i = settings.kbkeys[key_id].code;
switch (i)
Expand Down Expand Up @@ -1073,7 +1075,7 @@ TbBool get_dungeon_control_pausable_action_inputs(void)
struct Camera* cam = &player->cameras[CamIV_Isometric];
struct Packet* pckt = get_packet(my_player_number);
int angle = cam->orient_a;
if (lbKeyOn[KC_LCONTROL])
if (key_modifiers & KMod_CONTROL)
{
if ((angle >= 0 && angle < 256) || angle == 2048)
{
Expand Down Expand Up @@ -1108,7 +1110,7 @@ TbBool get_dungeon_control_pausable_action_inputs(void)
angle = 0;
}
}
else if (lbKeyOn[KC_LSHIFT])
else if (key_modifiers & KMod_SHIFT)
{
if (angle > 0 && angle <= 256)
{angle = 2048;}
Expand Down Expand Up @@ -1165,11 +1167,11 @@ TbBool get_dungeon_control_pausable_action_inputs(void)
struct Camera* cam = &player->cameras[CamIV_FrontView];
struct Packet* pckt = get_packet(my_player_number);
int angle = cam->orient_a;
if (lbKeyOn[KC_LCONTROL])
if (key_modifiers & KMod_CONTROL)
{
set_packet_control(pckt, PCtr_ViewRotateCW);
}
else if (lbKeyOn[KC_LSHIFT])
else if (key_modifiers & KMod_SHIFT)
{
set_packet_control(pckt, PCtr_ViewRotateCCW);
}
Expand Down Expand Up @@ -1939,7 +1941,7 @@ int global_frameskipTurn = 0;
void get_isometric_or_front_view_mouse_inputs(struct Packet *pckt,int rotate_pressed,int speed_pressed)
{
// Reserve the scroll wheel for the resurrect and transfer creature specials
if ((menu_is_active(GMnu_RESURRECT_CREATURE) || menu_is_active(GMnu_TRANSFER_CREATURE) || lbKeyOn[KC_LSHIFT] || lbKeyOn[KC_LCONTROL]) == 0)
if ((menu_is_active(GMnu_RESURRECT_CREATURE) || menu_is_active(GMnu_TRANSFER_CREATURE) || rotate_pressed || speed_pressed) == 0)
{
// mouse scroll zoom unaffected by frameskip
if ((pckt->control_flags & PCtr_MapCoordsValid) != 0)
Expand All @@ -1954,7 +1956,7 @@ void get_isometric_or_front_view_mouse_inputs(struct Packet *pckt,int rotate_pre
}
}
}
if (menu_is_active(GMnu_BATTLE) && lbKeyOn[KC_LCONTROL])
if (menu_is_active(GMnu_BATTLE) && (rotate_pressed))
{
if (wheel_scrolled_up)
{
Expand Down
4 changes: 2 additions & 2 deletions src/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ void maintain_scroll_up(struct GuiButton *gbtn)
gbtn->flags ^= (gbtn->flags ^ LbBtnF_Enabled * (scrollwnd->start_y < 0)) & LbBtnF_Enabled;
if (!check_current_gui_layer(GuiLayer_OneClick))
{
if (wheel_scrolled_up & lbKeyOn[KC_LCONTROL])
if (wheel_scrolled_up && (is_game_key_pressed(Gkey_RotateMod, NULL, true)))
{
scrollwnd->action = 1;
}
Expand All @@ -880,7 +880,7 @@ void maintain_scroll_down(struct GuiButton *gbtn)
* (scrollwnd->window_height - scrollwnd->text_height + 2 < scrollwnd->start_y)) & LbBtnF_Enabled;
if (!check_current_gui_layer(GuiLayer_OneClick))
{
if (wheel_scrolled_down & lbKeyOn[KC_LCONTROL])
if (wheel_scrolled_down && (is_game_key_pressed(Gkey_RotateMod, NULL, true)))
{
scrollwnd->action = 2;
}
Expand Down
6 changes: 3 additions & 3 deletions src/frontmenu_ingame_tabs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1796,7 +1796,7 @@ void maintain_activity_up(struct GuiButton *gbtn)
gbtn->flags |= LbBtnF_Visible;
gbtn->flags ^= (gbtn->flags ^ LbBtnF_Enabled * (top_of_breed_list > 0)) & LbBtnF_Enabled;
}
if (wheel_scrolled_up & lbKeyOn[KC_LSHIFT])
if (wheel_scrolled_up && (is_game_key_pressed(Gkey_SpeedMod, NULL, true)))
{
if (top_of_breed_list > 0)
{
Expand All @@ -1817,7 +1817,7 @@ void maintain_activity_down(struct GuiButton *gbtn)
gbtn->flags |= LbBtnF_Visible;
gbtn->flags ^= (gbtn->flags ^ LbBtnF_Enabled * (no_of_breeds_owned - 6 > top_of_breed_list)) & LbBtnF_Enabled;
}
if (wheel_scrolled_down & lbKeyOn[KC_LSHIFT])
if (wheel_scrolled_down && (is_game_key_pressed(Gkey_SpeedMod, NULL, true)))
{
if (top_of_breed_list + 6 < no_of_breeds_owned)
{
Expand Down Expand Up @@ -1997,7 +1997,7 @@ void maintain_event_button(struct GuiButton *gbtn)
{
// Fight icon flashes when there are fights to show
gbtn->sprite_idx += 2;
if(is_game_key_pressed(Gkey_ZoomToFight, &keycode, true) && lbKeyOn[KC_LSHIFT])
if(is_game_key_pressed(Gkey_ZoomToFight, &keycode, true) && (is_game_key_pressed(Gkey_SpeedMod, NULL, true)))
{
if ((evidx == dungeon->visible_event_idx))
{
Expand Down