summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/robotfindskitten.c60
1 files changed, 35 insertions, 25 deletions
diff --git a/apps/plugins/robotfindskitten.c b/apps/plugins/robotfindskitten.c
index 9fabfcb54f..e08c99c0cc 100644
--- a/apps/plugins/robotfindskitten.c
+++ b/apps/plugins/robotfindskitten.c
@@ -411,32 +411,42 @@ static void play_animation(int input)
411 411
412static void instructions() 412static void instructions()
413{ 413{
414 char buf[X_MAX + 5]; 414 unsigned short row = 0, col = 0, len = 0, i = 0;
415 rb->snprintf(buf, sizeof(buf), "robotfindskitten %s", RFK_VERSION); 415#define WORDS (sizeof instructions / sizeof (char*))
416 /* 416 static char* instructions[] = {
417 * fixme: Find a nice way of portably putting a lot of 417#if 0
418 * text on the screen. Fixing it for all these sizes is just a horrible job 418 /* Not sure if we want to include this? */
419 */ 419 "robotfindskitten", RFK_VERSION, "", "",
420#if X_MAX >= 52 /* 320 pixels wide */ 420 "By", "the", "illustrious", "Leonard", "Richardson", "(C)", "1997,", "2000", "",
421 rb->lcd_putsxy(0,0, buf); 421 "Written", "originally", "for", "the", "Nerth", "Pork", "robotfindskitten", "contest", "", "",
422 rb->lcd_putsxy(0,SYSFONT_HEIGHT*1, "By the illustrious Leonard Richardson (C) 1997, 2000");
423 rb->lcd_putsxy(0,SYSFONT_HEIGHT*2, "Written originally for the Nerth Pork");
424 rb->lcd_putsxy(0,SYSFONT_HEIGHT*3, "robotfindskitten contest");
425 rb->lcd_putsxy(0,SYSFONT_HEIGHT*5, "In this game you are robot (#). Your job is to find");
426 rb->lcd_putsxy(0,SYSFONT_HEIGHT*6, "kitten. This task is complicated by the existence of");
427 rb->lcd_putsxy(0,SYSFONT_HEIGHT*7, "various things which are not kitten. Robot must");
428 rb->lcd_putsxy(0,SYSFONT_HEIGHT*8, "touch items to determine if they are kitten or not.");
429 rb->lcd_putsxy(0,SYSFONT_HEIGHT*9, "The game ends when robotfindskitten.");
430 rb->lcd_putsxy(0,SYSFONT_HEIGHT*11, "Press any key to start");
431 rb->lcd_update();
432 rb->button_get(true);
433#elif X_MAX >= 39 /* 240 pixels wide */
434#elif X_MAX >= 35 /* 220 pixels wide */
435#elif X_MAX >= 28 /* 176 pixels wide */
436#elif X_MAX >= 25 /* 160 pixels wide */
437#elif X_MAX >= 20 /* 128 pixels wide */
438#elif X_MAX >= 17 /* 112 pixels wide */
439#endif 422#endif
423 "In", "this", "game", "you", "are", "robot", "(#).", "Your", "job", "is", "to", "find", "kitten.", "This", "task", "is", "complicated", "by", "the", "existence", "of", "various", "things", "which", "are", "not", "kitten.", "Robot", "must", "touch", "items", "to", "determine", "if", "they", "are", "kitten", "or", "not.", "",
424 "The", "game", "ends", "when", "robotfindskitten.", "", "",
425 "Press", "any", "key", "to", "start",
426 };
427 for (i = 0; i < WORDS; i++) {
428 len = rb->strlen(instructions[i]);
429 /* Skip to next line if the current one can't fit the word */
430 if (col+len > X_MAX) {
431 col = 0;
432 row++;
433 }
434 /* .. or if the word is the empty string */
435 if (rb->strcmp(instructions[i], "") == 0) {
436 col = 0;
437 row++;
438 continue;
439 }
440 /* We filled the screen */
441 if (row > Y_MAX) {
442 row = 0;
443 pause();
444 rb->lcd_clear_display();
445 }
446 rb->lcd_putsxy(SYSFONT_WIDTH*col, row*SYSFONT_HEIGHT, instructions[i]);
447 col += len + 1;
448 }
449 pause();
440} 450}
441 451
442static void initialize_arrays() 452static void initialize_arrays()