summaryrefslogtreecommitdiffstats
path: root/apps/plugins/jackpot.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/jackpot.c')
-rw-r--r--apps/plugins/jackpot.c70
1 files changed, 2 insertions, 68 deletions
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c
index b380e85180..26f8f47e8f 100644
--- a/apps/plugins/jackpot.c
+++ b/apps/plugins/jackpot.c
@@ -30,24 +30,7 @@ const struct button_mapping* plugin_contexts[]={pla_main_ctx};
#define NB_PICTURES 9
#define NB_SLOTS 3
-#ifdef HAVE_LCD_CHARCELLS
-#define PICTURE_ROTATION_STEPS 7
-static unsigned char jackpot_slots_patterns[]={
- 0x00, 0x0A, 0x1F, 0x1F, 0x1F, 0x0e, 0x04, /* (+00)Heart */
- 0x00, 0x04, 0x0E, 0x1F, 0x1F, 0x04, 0x0E, /* (+07)Spade */
- 0x00, 0x04, 0x0E, 0x1F, 0x0E, 0x04, 0x00, /* (+14)Diamond */
- 0x00, 0x15, 0x0E, 0x1F, 0x0E, 0x15, 0x00, /* (+21)Club */
- 0x03, 0x04, 0x0e, 0x1F, 0x1F, 0x1F, 0x0e, /* (+28)Cherry */
- 0x00, 0x04, 0x04, 0x1F, 0x04, 0x0E, 0x1F, /* (+35)Cross */
- 0x04, 0x0E, 0x15, 0x04, 0x0A, 0x0A, 0x11, /* (+42)Man */
- 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, /* (+49)Square */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* (+56)Empty */
- 0x00, 0x0A, 0x1F, 0x1F, 0x1F, 0x0e, 0x04 /* (+63)Heart */
-};
-static unsigned long char_patterns[NB_SLOTS];
-#define SLEEP_TIME (HZ/24)
-#else /* bitmaps LCDs */
-
+#ifdef HAVE_LCD_BITMAP
#define PICTURE_HEIGHT (BMPHEIGHT_jackpot_slots/(NB_PICTURES+1))
#if NB_SCREENS==1
#define PICTURE_ROTATION_STEPS PICTURE_HEIGHT
@@ -72,7 +55,7 @@ const struct picture jackpot_pictures[]={
};
#define SLEEP_TIME (HZ/200)
-#endif /* HAVE_LCD_CHARCELLS */
+#endif /* HAVE_LCD_BITMAP */
struct jackpot
{
@@ -92,29 +75,9 @@ struct jackpot
int money;
};
-#ifdef HAVE_LCD_CHARCELLS
-static void patterns_init(struct screen* display)
-{
- int i;
- for(i=0;i<NB_SLOTS;i++)
- char_patterns[i]=display->get_locked_pattern();
-}
-
-static void patterns_deinit(struct screen* display)
-{
- /* Restore the old pattern */
- int i;
- for(i=0;i<NB_SLOTS;i++)
- display->unlock_pattern(char_patterns[i]);
-}
-#endif /* HAVE_LCD_CHARCELLS */
-
/*Call when the program exit*/
static void jackpot_exit(void)
{
-#ifdef HAVE_LCD_CHARCELLS
- patterns_deinit(rb->screens[SCREEN_MAIN]);
-#endif /* HAVE_LCD_CHARCELLS */
}
static void jackpot_init(struct jackpot* game)
@@ -168,47 +131,25 @@ static void jackpot_display_slot_machine(struct jackpot* game, struct screen* di
char str[20];
int i;
bool changes=false;
-#ifdef HAVE_LCD_CHARCELLS
- display->putchar(0, 0, '[');
-#else
const struct picture* picture= &(jackpot_pictures[display->screen_type]);
int pos_x=(display->getwidth()-NB_SLOTS*(picture->width+1))/2;
int pos_y=(display->getheight()-(picture->slide_height))/2;
-#endif /* HAVE_LCD_CHARCELLS */
for(i=0;i<NB_SLOTS;i++)
{
-#ifdef HAVE_LCD_CHARCELLS
- /* the only charcell lcd is 7 pixel high */
- int state_y=(game->slot_state[i]*7)/PICTURE_ROTATION_STEPS;
-#else
int state_y=
(picture->slide_height*game->slot_state[i])/PICTURE_ROTATION_STEPS;
-#endif /* HAVE_LCD_CHARCELLS */
int previous_state_y=game->state_y[display->screen_type][i];
if(state_y==previous_state_y)
continue;/*no need to update the picture
as it's the same as previous displayed one*/
changes=true;
game->state_y[display->screen_type][i]=state_y;
-#ifdef HAVE_LCD_CHARCELLS
- char* current_pattern=&(jackpot_slots_patterns[state_y]);
- display->define_pattern(char_patterns[i],
- current_pattern);
- display->putchar(i+1, 0, char_patterns[i]);
-#else
vertical_picture_draw_part(display, picture, state_y, pos_x, pos_y);
pos_x+=(picture->width+1);
-#endif
}
if(changes){
-#ifdef HAVE_LCD_CHARCELLS
- rb->snprintf(str,sizeof(str),"$%d", game->money);
- display->putchar(++i, 0, ']');
- display->puts(++i, 0, str);
-#else
rb->snprintf(str,sizeof(str),"money : $%d", game->money);
display->puts(0, 0, str);
-#endif
display->update();
}
}
@@ -216,9 +157,6 @@ static void jackpot_display_slot_machine(struct jackpot* game, struct screen* di
static void jackpot_info_message(struct screen* display, char* message)
{
-#ifdef HAVE_LCD_CHARCELLS
- display->puts_scroll(0,1,message);
-#else
int xpos, ypos;
int message_height, message_width;
display->getstringsize(message, &message_width, &message_height);
@@ -228,7 +166,6 @@ static void jackpot_info_message(struct screen* display, char* message)
message_height);
display->putsxy(xpos,ypos,message);
display->update();
-#endif /* HAVE_LCD_CHARCELLS */
}
static void jackpot_print_turn_result(struct jackpot* game,
@@ -299,9 +236,6 @@ enum plugin_status plugin_start(const void* parameter)
(void)parameter;
atexit(jackpot_exit);
rb->srand(*rb->current_tick);
-#ifdef HAVE_LCD_CHARCELLS
- patterns_init(rb->screens[SCREEN_MAIN]);
-#endif /* HAVE_LCD_CHARCELLS */
jackpot_init(&game);
FOR_NB_SCREENS(i){