Skip to content

Commit

Permalink
Add fast/slow adjustment on alt1/duck
Browse files Browse the repository at this point in the history
  • Loading branch information
YaLTeR committed Jul 17, 2020
1 parent 90fb708 commit 2929099
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions BunnymodXT/triangle_drawing.cpp
Expand Up @@ -269,6 +269,15 @@ namespace TriangleDrawing
}
right_was_pressed = right_pressed;

float adjustment_speed = 1;

// Like in HwDLL::FreeCamTick().
auto buttons = cl.last_buttons;
if (buttons & IN_ALT1)
adjustment_speed *= 20;
if (buttons & IN_DUCK)
adjustment_speed /= 20;

auto view = cl.last_vieworg;
Vector forward, right, up;
cl.pEngfuncs->pfnAngleVectors(cl.last_viewangles, forward, right, up);
Expand Down Expand Up @@ -617,15 +626,15 @@ namespace TriangleDrawing
if (left_pressed) {
auto mouse_diff = mouse - left_pressed_at;

auto amount = DotProduct(mouse_diff, saved_lmb_diff) * 0.1f;
auto amount = DotProduct(mouse_diff, saved_lmb_diff) * 0.1f * adjustment_speed;
auto new_repeats = static_cast<unsigned>(std::max(1, saved_repeats + static_cast<int>(amount)));
input.set_repeats(closest_edge_prev_frame_bulk_index, new_repeats);
}

if (middle_pressed) {
auto mouse_diff = mouse - middle_pressed_at;

auto amount = DotProduct(mouse_diff, saved_mmb_diff) * 0.1f;
auto amount = DotProduct(mouse_diff, saved_mmb_diff) * 0.1f * adjustment_speed;
auto new_repeats = std::max(1, saved_repeats + static_cast<int>(amount));

if (closest_edge_prev_frame_bulk_index + 1 < input.frame_bulks.size()) {
Expand All @@ -643,7 +652,7 @@ namespace TriangleDrawing
if (right_pressed && frame_bulk.GetYawPresent()) {
auto mouse_diff = mouse - right_pressed_at;

auto amount = DotProduct(mouse_diff, saved_rmb_diff) * 0.1f;
auto amount = DotProduct(mouse_diff, saved_rmb_diff) * 0.1f * adjustment_speed;
auto new_yaw = saved_yaw + amount;
if (frame_bulk.GetYaw() != new_yaw) {
stale_index = closest_edge_prev_frame_bulk_index;
Expand Down

0 comments on commit 2929099

Please sign in to comment.