A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

FS13585: Display corruption in robotfindskitten game

When you're using a "large" screen device, and the message doesn't need
to scroll, parts of the previous mesage are left behind.

Work around this by explicitly clearing the messgage with a loooong
blank string.

Change-Id: I02f7789eb6567e92ecca174c40dabc4b580ac045

+24 -26
+24 -26
apps/plugins/robotfindskitten.c
··· 9 9 * 10 10 * robotfindskitten: A Zen simulation 11 11 * 12 - * Copyright (C) 1997,2000 Leonard Richardson 12 + * Copyright (C) 1997,2000 Leonard Richardson 13 13 * leonardr@segfault.org 14 14 * http://www.crummy.com/devel/ 15 15 * ··· 39 39 /*Be sure to change MESSAGES when you change the array, or bad things 40 40 will happen.*/ 41 41 42 - /*Also, take note that robotfindskitten.c and configure.in 43 - currently have the version number hardcoded into them, and they 42 + /*Also, take note that robotfindskitten.c and configure.in 43 + currently have the version number hardcoded into them, and they 44 44 should reflect MESSAGES. */ 45 45 46 46 /* Watch out for fenceposts.*/ ··· 327 327 "A discredited cosmology, relic of a bygone era.", 328 328 "A hollow voice says \"Plugh\".", 329 329 "A knight who says \"Either I am an insane knave, or you will find kitten.\"", 330 - "The secret meeting place of the Knights of the Lambda Calculus.", 330 + "The secret meeting place of the Knights of the Lambda Calculus.", 331 331 "A neural net -- maybe it's trying to recognize kitten.", 332 332 "A screwdriver.", 333 333 "A statue of a girl holding a goose like the one in Gottingen, Germany.", ··· 350 350 "Sutro Tower is visible at some distance through the fog.", 351 351 "The Digital Millennium Copyright Act of 1998.", 352 352 "The United States Court of Appeals for the Federal Circuit.", 353 - "The non-kitten item like this but with \"false\" and \"true\" switched is true.", 353 + "The non-kitten item like this but with \"false\" and \"true\" switched is true.", 354 354 "The non-kitten item like this but with \"true\" and \"false\" switched is false.", 355 - "This is the chapter called \"A Map of the Cat?\" from Feynman's autobiography.", 355 + "This is the chapter called \"A Map of the Cat?\" from Feynman's autobiography.", 356 356 "This is the forest primeval.", 357 357 "Werner's \"Pocket Field Guide to Things That Are Not Kitten\".", 358 358 "You found nettik, but that's backwards.", 359 - "You have found some zinc, but you must not stop here, for you must find kitten.", 359 + "You have found some zinc, but you must not stop here, for you must find kitten.", 360 360 "\"50 Years Among the Non-Kitten Items\", by Ann Droyd.", 361 361 "\"Robot may not injure kitten, or, through inaction, ...\"", 362 362 "\"Address Allocation for Private Internets\" by Yakov Rekhter et al.", 363 363 "\"Mail Routing and the Domain System\" by Craig Partridge.", 364 - "\"The Theory and Practice of Oligarchical Collectivism\" by Emmanuel Goldstein.", 364 + "\"The Theory and Practice of Oligarchical Collectivism\" by Emmanuel Goldstein.", 365 365 "\"201 Kitten Verbs, Fully Conjugated\". You look for \"find\".", 366 366 "A card shark sits here, practicing his Faro shuffle. He ignores you.", 367 367 "A copy of DeCSS. They're a dime a dozen these days.", ··· 645 645 while (input != RFK_QUIT && exit_rfk == false) 646 646 { 647 647 process_input(input); 648 - 648 + 649 649 /*Redraw robot, where applicable. We're your station, robot.*/ 650 650 if (!(old_x == robot.x && old_y == robot.y)) 651 651 { 652 652 /*Get rid of the old robot*/ 653 653 drawchar(old_x, old_y, ' '); 654 654 screen[old_x][old_y] = EMPTY; 655 - 655 + 656 656 /*Meet the new robot, same as the old robot.*/ 657 657 draw(robot); 658 658 refresh(); 659 659 screen[robot.x][robot.y] = ROBOT; 660 - 660 + 661 661 old_x = robot.x; 662 662 old_y = robot.y; 663 663 } 664 664 input = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, 665 665 ARRAYLEN(plugin_contexts)); 666 666 } 667 + 668 + message(" "); 667 669 message("Bye!"); 668 670 refresh(); 669 671 } ··· 696 698 check_x++; 697 699 break; 698 700 } 699 - 701 + 700 702 /*Check for going off the edge of the screen.*/ 701 703 if (check_y < Y_MIN || check_y > Y_MAX || check_x < X_MIN || check_x > X_MAX) 702 704 { 703 705 return; /*Do nothing.*/ 704 706 } 705 707 706 - /* 707 - * Clear textline 708 - * disabled because it breaks the scrolling for some reason 709 - */ 710 - /* rb->lcd_puts_scroll(0, ADV_ROW, " "); */ 711 - 712 708 /*Check for collision*/ 713 709 if (screen[check_x][check_y] != EMPTY) 714 710 { ··· 724 720 rfkpause(); 725 721 break; 726 722 default: /*We hit a bogus object; print its message.*/ 723 + message(" "); 727 724 message(messages[bogus_messages[screen[check_x][check_y]-2]]); 728 725 refresh(); 729 726 break; ··· 776 773 { 777 774 int counter; 778 775 /* Clear the message line */ 779 - message(" "); 776 + message(" "); 780 777 struct screen_object left; 781 778 struct screen_object right; 782 779 /*The grand cinema scene.*/ ··· 810 807 rb->sleep(HZ); 811 808 } 812 809 810 + message(" "); 813 811 message("You found kitten! Way to go, robot!"); 814 812 refresh(); 815 813 finish(0); ··· 857 855 #endif 858 856 empty.bold = false; 859 857 empty.character = ' '; 860 - 858 + 861 859 for (counter = 0; counter <= X_MAX; counter++) 862 860 { 863 861 for (counter2 = 0; counter2 <= Y_MAX; counter2++) ··· 865 863 screen[counter][counter2] = EMPTY; 866 864 } 867 865 } 868 - 866 + 869 867 /*Initialize the other arrays.*/ 870 868 for (counter = 0; counter < MESSAGES; counter++) 871 869 { ··· 899 897 kitten.x = randx(); 900 898 kitten.y = randy(); 901 899 } while (screen[kitten.x][kitten.y] != EMPTY); 902 - 900 + 903 901 /*Assign the kitten a character and a color.*/ 904 902 do { 905 903 kitten.character = randchar(); ··· 919 917 /*Give it a color.*/ 920 918 bogus[counter].color = colors[randcolor()]; 921 919 bogus[counter].bold = randbold(); 922 - 920 + 923 921 /*Give it a character.*/ 924 922 do { 925 923 bogus[counter].character = randchar(); 926 924 } while (!(validchar(bogus[counter].character))); 927 - 925 + 928 926 /*Give it a position.*/ 929 927 do { 930 928 bogus[counter].x = randx(); ··· 932 930 } while (screen[bogus[counter].x][bogus[counter].y] != EMPTY); 933 931 934 932 screen[bogus[counter].x][bogus[counter].y] = counter+2; 935 - 933 + 936 934 /*Find a message for this object.*/ 937 935 do { 938 936 index = rb->rand() % MESSAGES; ··· 957 955 rb->snprintf(buf, sizeof(buf), "robotfindskitten %s", RFK_VERSION); 958 956 rb->lcd_puts_scroll(0, 0, buf); 959 957 refresh(); 960 - 958 + 961 959 /*Draw a line across the screen.*/ 962 960 for (counter = X_MIN; counter <= X_MAX + 1; counter++) 963 961 {