diff options
author | Brandon Low <lostlogic@rockbox.org> | 2006-03-12 18:46:05 +0000 |
---|---|---|
committer | Brandon Low <lostlogic@rockbox.org> | 2006-03-12 18:46:05 +0000 |
commit | fea567f9af5bf1de2611c97be8eff609eef63235 (patch) | |
tree | c8601634f628bdba8d46b6d0719152cc31ed36ec | |
parent | c91623b7801650d38a3492ca3e7ce66e3523b51c (diff) | |
download | rockbox-fea567f9af5bf1de2611c97be8eff609eef63235.tar.gz rockbox-fea567f9af5bf1de2611c97be8eff609eef63235.zip |
Fix dice on the player (sim at least, my player is acting up)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9014 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/dice.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c index 1ee0e2ac17..7d4745ed00 100644 --- a/apps/plugins/dice.c +++ b/apps/plugins/dice.c | |||
@@ -31,18 +31,27 @@ use stop to exit | |||
31 | #include "button.h" | 31 | #include "button.h" |
32 | #include "lcd.h" | 32 | #include "lcd.h" |
33 | 33 | ||
34 | #define SELECTIONS_SIZE 7 | ||
35 | #define SELECTIONS_ROW 4 | ||
36 | #define LINE_LENGTH 26 | ||
37 | #if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == ONDIO_PAD) | ||
38 | #define START_DICE_ROW 0 | ||
39 | #define ROWS 3 | ||
40 | #else | ||
41 | #define START_DICE_ROW 7 | ||
42 | #define ROWS 2 | ||
43 | #endif | ||
44 | #define MAX_DICE 12 | 34 | #define MAX_DICE 12 |
45 | #define NUM_SIDE_CHOICES 8 | 35 | #define NUM_SIDE_CHOICES 8 |
36 | #if (CONFIG_KEYPAD == PLAYER_PAD) | ||
37 | #define SELECTIONS_SIZE 9 | ||
38 | #define START_DICE_ROW 1 | ||
39 | #define ROWS 1 | ||
40 | #define LINE_LENGTH 50 | ||
41 | #define SELECTIONS_ROW 0 | ||
42 | #else | ||
43 | #define SELECTIONS_SIZE 7 | ||
44 | #define SELECTIONS_ROW 4 | ||
45 | #if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == ONDIO_PAD) | ||
46 | #define START_DICE_ROW 0 | ||
47 | #define ROWS 3 | ||
48 | #define LINE_LENGTH 18 | ||
49 | #else | ||
50 | #define START_DICE_ROW 7 | ||
51 | #define ROWS 2 | ||
52 | #define LINE_LENGTH 26 | ||
53 | #endif | ||
54 | #endif | ||
46 | 55 | ||
47 | /* Values for selected */ | 56 | /* Values for selected */ |
48 | #define CHANGE_DICE 0 | 57 | #define CHANGE_DICE 0 |
@@ -242,13 +251,16 @@ static void print_dice(const int dice[], const int total) { | |||
242 | space -= count; | 251 | space -= count; |
243 | } | 252 | } |
244 | if (i > start) { | 253 | if (i > start) { |
245 | rb->lcd_puts(0,START_DICE_ROW+row,showdice); | 254 | rb->lcd_puts_scroll(0,START_DICE_ROW+row,showdice); |
246 | } else { | 255 | } else { |
247 | row--; | 256 | row--; |
248 | break; | 257 | break; |
249 | } | 258 | } |
250 | if (i < end || end == MAX_DICE) break; | 259 | if (i < end || end == MAX_DICE) break; |
251 | } | 260 | } |
261 | #if (CONFIG_KEYPAD == PLAYER_PAD) | ||
262 | (void)total; | ||
263 | #else | ||
252 | rb->lcd_puts(0,START_DICE_ROW+(++row)," "); | 264 | rb->lcd_puts(0,START_DICE_ROW+(++row)," "); |
253 | if (total > 0) { | 265 | if (total > 0) { |
254 | rb->snprintf(showdice,LINE_LENGTH,"Total: %4d",total); | 266 | rb->snprintf(showdice,LINE_LENGTH,"Total: %4d",total); |
@@ -257,6 +269,7 @@ static void print_dice(const int dice[], const int total) { | |||
257 | while (row < ROWS+2) { | 269 | while (row < ROWS+2) { |
258 | rb->lcd_puts(0,START_DICE_ROW+(++row)," "); | 270 | rb->lcd_puts(0,START_DICE_ROW+(++row)," "); |
259 | } | 271 | } |
272 | #endif | ||
260 | #ifdef HAVE_LCD_BITMAP | 273 | #ifdef HAVE_LCD_BITMAP |
261 | rb->lcd_update(); | 274 | rb->lcd_update(); |
262 | #endif | 275 | #endif |
@@ -267,6 +280,12 @@ static void print_selections(const int selected, | |||
267 | const int num_dice, | 280 | const int num_dice, |
268 | const int side_index) { | 281 | const int side_index) { |
269 | char buffer[SELECTIONS_SIZE]; | 282 | char buffer[SELECTIONS_SIZE]; |
283 | #if (CONFIG_KEYPAD == PLAYER_PAD) | ||
284 | rb->snprintf(buffer, SELECTIONS_SIZE, "%c%2dd%c%3d", | ||
285 | selected==CHANGE_DICE?'*':' ', num_dice, | ||
286 | selected==CHANGE_SIDES?'*':' ', SIDES[side_index]); | ||
287 | rb->lcd_puts(1,SELECTIONS_ROW,buffer); | ||
288 | #else | ||
270 | rb->snprintf( | 289 | rb->snprintf( |
271 | buffer,SELECTIONS_SIZE,"%2dd%3d",num_dice,SIDES[side_index]); | 290 | buffer,SELECTIONS_SIZE,"%2dd%3d",num_dice,SIDES[side_index]); |
272 | rb->lcd_puts(1,SELECTIONS_ROW,buffer); | 291 | rb->lcd_puts(1,SELECTIONS_ROW,buffer); |
@@ -275,16 +294,22 @@ static void print_selections(const int selected, | |||
275 | } else if (selected==CHANGE_SIDES) { | 294 | } else if (selected==CHANGE_SIDES) { |
276 | rb->lcd_puts(1,SELECTIONS_ROW+1," ---"); | 295 | rb->lcd_puts(1,SELECTIONS_ROW+1," ---"); |
277 | } | 296 | } |
297 | #endif | ||
278 | #ifdef HAVE_LCD_BITMAP | 298 | #ifdef HAVE_LCD_BITMAP |
279 | rb->lcd_update(); | 299 | rb->lcd_update(); |
280 | #endif | 300 | #endif |
281 | } | 301 | } |
282 | 302 | ||
283 | static void print_help() { | 303 | static void print_help() { |
304 | #if (CONFIG_KEYPAD == PLAYER_PAD) | ||
305 | rb->lcd_puts_scroll(1,SELECTIONS_ROW, "</>, +/- setup"); | ||
306 | rb->lcd_puts_scroll(1,SELECTIONS_ROW+1, "on roll, menu exit"); | ||
307 | #else | ||
284 | rb->lcd_puts(1,START_DICE_ROW,"</> pick dice/sides"); | 308 | rb->lcd_puts(1,START_DICE_ROW,"</> pick dice/sides"); |
285 | rb->lcd_puts(1,START_DICE_ROW+1,"+/- change"); | 309 | rb->lcd_puts(1,START_DICE_ROW+1,"+/- change"); |
286 | rb->lcd_puts(1,START_DICE_ROW+2,"on/select roll"); | 310 | rb->lcd_puts(1,START_DICE_ROW+2,"on/select roll"); |
287 | rb->lcd_puts(1,START_DICE_ROW+3,"off exit"); | 311 | rb->lcd_puts(1,START_DICE_ROW+3,"off exit"); |
312 | #endif | ||
288 | #ifdef HAVE_LCD_BITMAP | 313 | #ifdef HAVE_LCD_BITMAP |
289 | rb->lcd_update(); | 314 | rb->lcd_update(); |
290 | #endif | 315 | #endif |