diff --git a/putt/game.c b/putt/game.c index 654489503..4c559a508 100644 --- a/putt/game.c +++ b/putt/game.c @@ -57,6 +57,8 @@ static float jump_p[3]; /* Jump destination */ static float idle_t; /* Idling timeout */ +static int fast_timescale; /* Whether fast-timescale mode is on */ + /*---------------------------------------------------------------------------*/ static void view_init(void) @@ -509,6 +511,15 @@ int game_step(const float g[3], float dt) if (!state) return GAME_NONE; + if (config_cheat()) + { + if (fast_timescale) + { + /* Apply timescale when shift is pressed down. */ + dt *= 3.0f; + } + } + s = (7.f * s + dt) / 8.f; t = s; @@ -708,5 +719,17 @@ void game_set_pos(float p[3], float e[3][3]) v_cpy(file.vary.uv[ball].e[2], e[2]); } +void game_set_fast(int d) +{ + if (!config_cheat()) + { + fast_timescale = 0; + } + else + { + fast_timescale = d; + } +} + /*---------------------------------------------------------------------------*/ diff --git a/putt/game.h b/putt/game.h index 0dfb62f69..cf2a0c7d5 100644 --- a/putt/game.h +++ b/putt/game.h @@ -52,6 +52,8 @@ void game_ball(int); void game_set_pos(float[3], float[3][3]); void game_get_pos(float[3], float[3][3]); +void game_set_fast(int); + /*---------------------------------------------------------------------------*/ #endif diff --git a/putt/st_all.c b/putt/st_all.c index c6538532b..27041c283 100644 --- a/putt/st_all.c +++ b/putt/st_all.c @@ -696,6 +696,12 @@ static int pause_click(int b, int d) static int pause_keybd(int c, int d) { + if (config_tst_d(CONFIG_KEY_ROTATE_FAST, c)) + { + game_set_fast(d); + return 1; + } + if (d && c == KEY_EXIT) return pause_action(PAUSE_CONTINUE); return 1; @@ -718,6 +724,12 @@ static int pause_buttn(int b, int d) static int shared_keybd(int c, int d) { + if (config_tst_d(CONFIG_KEY_ROTATE_FAST, c)) + { + game_set_fast(d); + return 1; + } + if (d) { if (c == KEY_EXIT) @@ -810,6 +822,12 @@ static int next_click(int b, int d) static int next_keybd(int c, int d) { + if (config_tst_d(CONFIG_KEY_ROTATE_FAST, c)) + { + game_set_fast(d); + return 1; + } + if (d) { if (c == KEY_POSE)