From 8506409d8a7d07a3e3fc13eac74b2c0dc21e4743 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 23 Jan 2019 09:02:57 -0500 Subject: add get_home_angle() comments --- src/sdl/draw.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/sdl/draw.c b/src/sdl/draw.c index 4209016..784601d 100644 --- a/src/sdl/draw.c +++ b/src/sdl/draw.c @@ -145,12 +145,16 @@ get_home_angle( const draw_ctx_t * const draw_ctx ) { if (draw_ctx->state == GAME_STATE_SOLVE) { + // solving (low shake) return 5 * sin(draw_ctx->ticks * M_2_PI / 2000.0); } else if (sok_ctx_is_done(draw_ctx->ctx)) { + // won level (moderate shake) return 10 * sin(draw_ctx->ticks * M_2_PI / 1000.0); } else if ((draw_ctx->ticks - draw_ctx->bump_ticks) < BUMP_TIME) { + // bumped into wall, undo failed (high shake) return 10 * sin(draw_ctx->ticks * M_2_PI / (BUMP_TIME / 2.0)); } else { + // normal (no shake) return 0; } } -- cgit v1.2.3