summaryrefslogtreecommitdiff
path: root/apps/plugins/bounce.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/bounce.c')
-rw-r--r--apps/plugins/bounce.c55
1 files changed, 48 insertions, 7 deletions
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c
index e7fc7dedd1..232d9a9cc5 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -46,14 +46,55 @@
46 46
47static struct plugin_api* rb; 47static struct plugin_api* rb;
48 48
49#define TABLE_SIZE (sizeof(table)/sizeof(table[0]))
50
51#if LCD_HEIGHT < 128
52
49static unsigned char table[]={ 53static unsigned char table[]={
5026,28,30,33,35,37,39,40,42,43,45,46,46,47,47,47,47,47,46,46,45,43,42,40,39,37,35,33,30,28,26,24,21,19,17,14,12,10,8,7,5,4,2,1,1,0,0,0,0,0,1,1,2,4,5,7,8,10,12,14,17,19,21,23, 5426,28,30,33,35,37,39,40,42,43,45,46,46,47,47,47,47,47,46,46,45,43,42,40,39,37,35,33,30,28,26,24,21,19,17,14,12,10,8,7,5,4,2,1,1,0,0,0,0,0,1,1,2,4,5,7,8,10,12,14,17,19,21,23,
51}; 55};
52 56
53static unsigned char xtable[]={ 57static unsigned char xtable[]={
5454,58,63,67,71,75,79,82,85,88,91,93,95,97,98,99,99,99,99,99,97,96,94,92,90,87,84,80,77,73,69,65,60,56,52,47,43,39,34,30,26,22,19,15,12,9,7,5,3,2,0,0,0,0,0,1,2,4,6,8,11,14,17,20,24,28,32,36,41,45,49 58 50, 54, 59, 64, 69, 73, 77, 81, 85, 88, 91, 94, 96, 97, 99, 99, 99, 99,
59 99, 97, 96, 94, 91, 88, 85, 81, 77, 73, 69, 64, 59, 54, 50, 45, 40, 35,
60 30, 26, 22, 18, 14, 11, 8, 5, 3, 2, 0, 0, 0, 0, 0, 2, 3, 5, 8, 11, 14,
61 18, 22, 26, 30, 35, 40, 45,
62};
63#else
64
65/* 160 - 12 = 148
66 148 / 2 = 74 (radius)
67*/
68
69static unsigned char xtable[]={
7074, 77, 81, 84, 88, 91, 95, 98, 102, 105, 108, 112, 115, 118, 120, 123,
71126, 128, 131, 133, 135, 137, 139, 140, 142, 143, 144, 145, 146, 147, 147,
72147, 147, 147, 147, 147, 146, 145, 144, 143, 142, 140, 139, 137, 135, 133,
73131, 128, 126, 123, 120, 118, 115, 112, 108, 105, 102, 98, 95, 91, 88,
7484, 81, 77, 74, 70, 66, 63, 59, 56, 52, 49, 45, 42, 39, 35, 32, 29, 27,
7524, 21, 19, 16, 14, 12, 10, 8, 7, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1,
762, 3, 4, 5, 7, 8, 10, 12, 14, 16, 19, 21, 24, 27, 29, 32, 35, 39, 42, 45,
7749, 52, 56, 59, 63, 66, 70,
78
55}; 79};
56 80
81/* 128 - 16 = 116
82 112 / 2 = 56 (radius)
83*/
84static unsigned char table[]={
8556, 58, 61, 64, 66, 69, 72, 74, 77, 79, 82, 84, 87, 89, 91, 93, 95, 97,
8699, 100, 102, 104, 105, 106, 107, 108, 109, 110, 110, 111, 111, 111, 111,
87111, 111, 111, 110, 110, 109, 108, 107, 106, 105, 104, 102, 100, 99, 97,
8895, 93, 91, 89, 87, 84, 82, 79, 77, 74, 72, 69, 66, 64, 61, 58, 56, 53,
8950, 47, 45, 42, 39, 37, 34, 32, 29, 27, 24, 22, 20, 18, 16, 14, 12, 11,
909, 7, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 7,
919, 11, 12, 14, 16, 18, 20, 22, 24, 27, 29, 32, 34, 37, 39, 42, 45, 47,
9250, 53,
93
94};
95
96#endif
97
57static signed char speed[]={ 98static signed char speed[]={
58 1,2,3,3,3,2,1,0,-1,-2,-2,-2,-1,0,0,1, 99 1,2,3,3,3,2,1,0,-1,-2,-2,-2,-1,0,0,1,
59}; 100};
@@ -181,7 +222,7 @@ struct counter values[]={
181 {"xsanke", 1}, 222 {"xsanke", 1},
182 {"ysanke", 1}, 223 {"ysanke", 1},
183 {"xadd", 1}, 224 {"xadd", 1},
184 {"yadd", 1}, 225 {"yadd", 2},
185 {"xdist", -4}, 226 {"xdist", -4},
186 {"ydist", -6}, 227 {"ydist", -6},
187}; 228};
@@ -267,7 +308,7 @@ static int scrollit(void)
267 letter = rock[(i+textpos) % rocklen ]; 308 letter = rock[(i+textpos) % rocklen ];
268 309
269 rb->lcd_bitmap((char *)char_gen_12x16[letter-0x20], 310 rb->lcd_bitmap((char *)char_gen_12x16[letter-0x20],
270 xx, table[yy&63], 311 xx, table[yy&(TABLE_SIZE-1)],
271 11, 16, false); 312 11, 16, false);
272 yy += YADD; 313 yy += YADD;
273 xx+= LCD_WIDTH/LETTERS_ON_SCREEN; 314 xx+= LCD_WIDTH/LETTERS_ON_SCREEN;
@@ -349,15 +390,15 @@ static int loopit(void)
349 } 390 }
350 rb->snprintf(buffer, 30, "%s: %d", 391 rb->snprintf(buffer, 30, "%s: %d",
351 values[show].what, values[show].num); 392 values[show].what, values[show].num);
352 rb->lcd_putsxy(0, 56, buffer); 393 rb->lcd_putsxy(0, LCD_HEIGHT - 8, buffer);
353 timeout--; 394 timeout--;
354 } 395 }
355 for(i=0, yy=y, xx=x; 396 for(i=0, yy=y, xx=x;
356 i<rocklen; 397 i<rocklen;
357 i++, yy+=values[NUM_YDIST].num, xx+=values[NUM_XDIST].num) 398 i++, yy+=values[NUM_YDIST].num, xx+=values[NUM_XDIST].num)
358 rb->lcd_bitmap((char *)char_gen_12x16[rock[i]-0x20], 399 rb->lcd_bitmap((char *)char_gen_12x16[rock[i]-0x20],
359 xtable[xx%71], table[yy&63], 400 xtable[xx&(TABLE_SIZE-1)], table[yy&(TABLE_SIZE-1)],
360 11, 16, false); 401 11, 16, false);
361 rb->lcd_update(); 402 rb->lcd_update();
362 403
363 ysanke+= values[NUM_YSANKE].num; 404 ysanke+= values[NUM_YSANKE].num;