diff --git a/src/config.h b/src/config.h index 599bbc181..7f8a722b7 100644 --- a/src/config.h +++ b/src/config.h @@ -42,7 +42,7 @@ #define CRAFT_KEY_CHAT 't' #define CRAFT_KEY_COMMAND '/' #define CRAFT_KEY_SIGN '`' - +#define CRAFT_KEY_RUN GLFW_KEY_LEFT_CONTROL // advanced parameters #define CREATE_CHUNK_RADIUS 10 #define RENDER_CHUNK_RADIUS 10 diff --git a/src/main.c b/src/main.c index a0b622861..eb1e2ed81 100644 --- a/src/main.c +++ b/src/main.c @@ -2413,12 +2413,17 @@ void handle_movement(double dt) { State *s = &g->players->state; int sz = 0; int sx = 0; + int isRunning = 0; if (!g->typing) { float m = dt * 1.0; g->ortho = glfwGetKey(g->window, CRAFT_KEY_ORTHO) ? 64 : 0; g->fov = glfwGetKey(g->window, CRAFT_KEY_ZOOM) ? 15 : 65; if (glfwGetKey(g->window, CRAFT_KEY_FORWARD)) sz--; if (glfwGetKey(g->window, CRAFT_KEY_BACKWARD)) sz++; + if (glfwGetKey(g->window, CRAFT_KEY_FORWARD)) { + if(glfwGetKey(g->window, CRAFT_KEY_RUN)) isRunning = 1; + sz--; + } if (glfwGetKey(g->window, CRAFT_KEY_LEFT)) sx--; if (glfwGetKey(g->window, CRAFT_KEY_RIGHT)) sx++; if (glfwGetKey(g->window, GLFW_KEY_LEFT)) s->rx -= m; @@ -2439,6 +2444,7 @@ void handle_movement(double dt) { } } float speed = g->flying ? 20 : 5; + if(isRunning) speed*=4; int estimate = roundf(sqrtf( powf(vx * speed, 2) + powf(vy * speed + ABS(dy) * 2, 2) +