Skip to content
Open
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
23 changes: 23 additions & 0 deletions putt/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
}

/*---------------------------------------------------------------------------*/

2 changes: 2 additions & 0 deletions putt/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 18 additions & 0 deletions putt/st_all.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down