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
This commit is contained in:
Brandon Low 2006-03-12 18:46:05 +00:00
parent c91623b780
commit fea567f9af

View file

@ -31,18 +31,27 @@ use stop to exit
#include "button.h" #include "button.h"
#include "lcd.h" #include "lcd.h"
#define MAX_DICE 12
#define NUM_SIDE_CHOICES 8
#if (CONFIG_KEYPAD == PLAYER_PAD)
#define SELECTIONS_SIZE 9
#define START_DICE_ROW 1
#define ROWS 1
#define LINE_LENGTH 50
#define SELECTIONS_ROW 0
#else
#define SELECTIONS_SIZE 7 #define SELECTIONS_SIZE 7
#define SELECTIONS_ROW 4 #define SELECTIONS_ROW 4
#define LINE_LENGTH 26
#if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == ONDIO_PAD) #if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == ONDIO_PAD)
#define START_DICE_ROW 0 #define START_DICE_ROW 0
#define ROWS 3 #define ROWS 3
#define LINE_LENGTH 18
#else #else
#define START_DICE_ROW 7 #define START_DICE_ROW 7
#define ROWS 2 #define ROWS 2
#define LINE_LENGTH 26
#endif
#endif #endif
#define MAX_DICE 12
#define NUM_SIDE_CHOICES 8
/* Values for selected */ /* Values for selected */
#define CHANGE_DICE 0 #define CHANGE_DICE 0
@ -242,13 +251,16 @@ static void print_dice(const int dice[], const int total) {
space -= count; space -= count;
} }
if (i > start) { if (i > start) {
rb->lcd_puts(0,START_DICE_ROW+row,showdice); rb->lcd_puts_scroll(0,START_DICE_ROW+row,showdice);
} else { } else {
row--; row--;
break; break;
} }
if (i < end || end == MAX_DICE) break; if (i < end || end == MAX_DICE) break;
} }
#if (CONFIG_KEYPAD == PLAYER_PAD)
(void)total;
#else
rb->lcd_puts(0,START_DICE_ROW+(++row)," "); rb->lcd_puts(0,START_DICE_ROW+(++row)," ");
if (total > 0) { if (total > 0) {
rb->snprintf(showdice,LINE_LENGTH,"Total: %4d",total); rb->snprintf(showdice,LINE_LENGTH,"Total: %4d",total);
@ -257,6 +269,7 @@ static void print_dice(const int dice[], const int total) {
while (row < ROWS+2) { while (row < ROWS+2) {
rb->lcd_puts(0,START_DICE_ROW+(++row)," "); rb->lcd_puts(0,START_DICE_ROW+(++row)," ");
} }
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
rb->lcd_update(); rb->lcd_update();
#endif #endif
@ -267,6 +280,12 @@ static void print_selections(const int selected,
const int num_dice, const int num_dice,
const int side_index) { const int side_index) {
char buffer[SELECTIONS_SIZE]; char buffer[SELECTIONS_SIZE];
#if (CONFIG_KEYPAD == PLAYER_PAD)
rb->snprintf(buffer, SELECTIONS_SIZE, "%c%2dd%c%3d",
selected==CHANGE_DICE?'*':' ', num_dice,
selected==CHANGE_SIDES?'*':' ', SIDES[side_index]);
rb->lcd_puts(1,SELECTIONS_ROW,buffer);
#else
rb->snprintf( rb->snprintf(
buffer,SELECTIONS_SIZE,"%2dd%3d",num_dice,SIDES[side_index]); buffer,SELECTIONS_SIZE,"%2dd%3d",num_dice,SIDES[side_index]);
rb->lcd_puts(1,SELECTIONS_ROW,buffer); rb->lcd_puts(1,SELECTIONS_ROW,buffer);
@ -275,16 +294,22 @@ static void print_selections(const int selected,
} else if (selected==CHANGE_SIDES) { } else if (selected==CHANGE_SIDES) {
rb->lcd_puts(1,SELECTIONS_ROW+1," ---"); rb->lcd_puts(1,SELECTIONS_ROW+1," ---");
} }
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
rb->lcd_update(); rb->lcd_update();
#endif #endif
} }
static void print_help() { static void print_help() {
#if (CONFIG_KEYPAD == PLAYER_PAD)
rb->lcd_puts_scroll(1,SELECTIONS_ROW, "</>, +/- setup");
rb->lcd_puts_scroll(1,SELECTIONS_ROW+1, "on roll, menu exit");
#else
rb->lcd_puts(1,START_DICE_ROW,"</> pick dice/sides"); rb->lcd_puts(1,START_DICE_ROW,"</> pick dice/sides");
rb->lcd_puts(1,START_DICE_ROW+1,"+/- change"); rb->lcd_puts(1,START_DICE_ROW+1,"+/- change");
rb->lcd_puts(1,START_DICE_ROW+2,"on/select roll"); rb->lcd_puts(1,START_DICE_ROW+2,"on/select roll");
rb->lcd_puts(1,START_DICE_ROW+3,"off exit"); rb->lcd_puts(1,START_DICE_ROW+3,"off exit");
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
rb->lcd_update(); rb->lcd_update();
#endif #endif