summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-10-08 19:04:53 +0000
committerThomas Martitz <kugel@rockbox.org>2009-10-08 19:04:53 +0000
commit284ccb8d4ed84ebf77a5525643c3e5187f425c76 (patch)
tree1c16d5b3059aa01ddf852aca9d48209f701ad448
parent3e57104c5a9bc9f0532efe86cf892319afc3532f (diff)
downloadrockbox-284ccb8d4ed84ebf77a5525643c3e5187f425c76.tar.gz
rockbox-284ccb8d4ed84ebf77a5525643c3e5187f425c76.zip
Use TIME_BEFORE() and redo a macro slightly.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23010 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/chopper.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c
index 4dfef9d8ae..05ef7fcaf4 100644
--- a/apps/plugins/chopper.c
+++ b/apps/plugins/chopper.c
@@ -171,18 +171,21 @@ CONFIG_KEYPAD == MROBE500_PAD
#define LEVEL_MODE_STEEP 1
#if LCD_HEIGHT <= 64
-#define CYCLETIME 100
+#define CYCLES 100
static inline int SCALE(int x)
{
return x == 1 ? x : x >> 1;
}
#define SIZE 2
#else
-#define CYCLETIME 60
+#define CYCLES 60
#define SCALE(x) (x)
#define SIZE 1
#endif
+/* in 10 milisecond (ticks) */
+#define CYCLETIME ((CYCLES*HZ)/1000)
+
/*Chopper's local variables to track the terrain position etc*/
static int chopCounter;
static int iRotorOffset;
@@ -792,7 +795,7 @@ static int chopGameLoop(void)
while (!exit) {
- end = *rb->current_tick + (CYCLETIME * HZ) / 1000;
+ end = *rb->current_tick + CYCLETIME;
if(chopUpdateTerrainRecycling(&mGround) == 1)
/* mirror the sky if we've changed the ground */
@@ -907,8 +910,8 @@ static int chopGameLoop(void)
return ret;
}
- if (end > *rb->current_tick)
- rb->sleep(end-*rb->current_tick);
+ if (TIME_BEFORE(*rb->current_tick, end))
+ rb->sleep(end - *rb->current_tick); /* wait until time is over */
else
rb->yield();