summaryrefslogtreecommitdiff
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
171#define LEVEL_MODE_STEEP 1 171#define LEVEL_MODE_STEEP 1
172 172
173#if LCD_HEIGHT <= 64 173#if LCD_HEIGHT <= 64
174#define CYCLETIME 100 174#define CYCLES 100
175static inline int SCALE(int x) 175static inline int SCALE(int x)
176{ 176{
177 return x == 1 ? x : x >> 1; 177 return x == 1 ? x : x >> 1;
178} 178}
179#define SIZE 2 179#define SIZE 2
180#else 180#else
181#define CYCLETIME 60 181#define CYCLES 60
182#define SCALE(x) (x) 182#define SCALE(x) (x)
183#define SIZE 1 183#define SIZE 1
184#endif 184#endif
185 185
186/* in 10 milisecond (ticks) */
187#define CYCLETIME ((CYCLES*HZ)/1000)
188
186/*Chopper's local variables to track the terrain position etc*/ 189/*Chopper's local variables to track the terrain position etc*/
187static int chopCounter; 190static int chopCounter;
188static int iRotorOffset; 191static int iRotorOffset;
@@ -792,7 +795,7 @@ static int chopGameLoop(void)
792 795
793 while (!exit) { 796 while (!exit) {
794 797
795 end = *rb->current_tick + (CYCLETIME * HZ) / 1000; 798 end = *rb->current_tick + CYCLETIME;
796 799
797 if(chopUpdateTerrainRecycling(&mGround) == 1) 800 if(chopUpdateTerrainRecycling(&mGround) == 1)
798 /* mirror the sky if we've changed the ground */ 801 /* mirror the sky if we've changed the ground */
@@ -907,8 +910,8 @@ static int chopGameLoop(void)
907 return ret; 910 return ret;
908 } 911 }
909 912
910 if (end > *rb->current_tick) 913 if (TIME_BEFORE(*rb->current_tick, end))
911 rb->sleep(end-*rb->current_tick); 914 rb->sleep(end - *rb->current_tick); /* wait until time is over */
912 else 915 else
913 rb->yield(); 916 rb->yield();
914 917