diff options
author | Franklin Wei <git@fwei.tk> | 2017-06-03 13:45:07 -0400 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2017-06-03 13:45:07 -0400 |
commit | 552a271c6fea8d36390858ca6d12c4c98f663002 (patch) | |
tree | 046ea6cdc0cbadae014715c02af6ada4e966a92c /apps/plugins/puzzles/rockbox.c | |
parent | cefbde0bbb5f90523233a56ca6c0b0699b4b359e (diff) | |
download | rockbox-552a271c6fea8d36390858ca6d12c4c98f663002.tar.gz rockbox-552a271c6fea8d36390858ca6d12c4c98f663002.zip |
puzzles: remove redundant help content
It used to be that each puzzle had a complete copy of the entire
puzzles manual and the "quick help" text for every single puzzle. This
was obviously a waste, so now each puzzle only has the sections of the
manual that apply to it, saving about 100KB or so per puzzle. This
also has the added benefit of shrinking binary size enough to allow
full help support on the c200v2, which has been enabled.
Change-Id: I76c799635de058e4a48e0c18b79537857af7cf85
Diffstat (limited to 'apps/plugins/puzzles/rockbox.c')
-rw-r--r-- | apps/plugins/puzzles/rockbox.c | 93 |
1 files changed, 17 insertions, 76 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c index eee85b72d0..45e0df7edb 100644 --- a/apps/plugins/puzzles/rockbox.c +++ b/apps/plugins/puzzles/rockbox.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include "plugin.h" | 24 | #include "plugin.h" |
25 | 25 | ||
26 | #include "help.h" | ||
26 | #include "keymaps.h" | 27 | #include "keymaps.h" |
27 | #include "src/puzzles.h" | 28 | #include "src/puzzles.h" |
28 | 29 | ||
@@ -34,6 +35,9 @@ | |||
34 | 35 | ||
35 | /* how many ticks between timer callbacks */ | 36 | /* how many ticks between timer callbacks */ |
36 | #define TIMER_INTERVAL (HZ / 50) | 37 | #define TIMER_INTERVAL (HZ / 50) |
38 | |||
39 | #define DEBUG_MENU | ||
40 | |||
37 | #define BG_R .9f /* very light gray */ | 41 | #define BG_R .9f /* very light gray */ |
38 | #define BG_G .9f | 42 | #define BG_G .9f |
39 | #define BG_B .9f | 43 | #define BG_B .9f |
@@ -61,7 +65,7 @@ static unsigned *colors = NULL; | |||
61 | static int ncolors = 0; | 65 | static int ncolors = 0; |
62 | static long last_keystate = 0; | 66 | static long last_keystate = 0; |
63 | 67 | ||
64 | #ifdef FOR_REAL | 68 | #if defined(FOR_REAL) && defined(DEBUG_MENU) |
65 | /* the "debug menu" is hidden by default in order to avoid the | 69 | /* the "debug menu" is hidden by default in order to avoid the |
66 | * naturally ensuing complaints from users */ | 70 | * naturally ensuing complaints from users */ |
67 | static bool debug_mode = false; | 71 | static bool debug_mode = false; |
@@ -743,7 +747,7 @@ void fatal(char *fmt, ...) | |||
743 | { | 747 | { |
744 | va_list ap; | 748 | va_list ap; |
745 | 749 | ||
746 | rb->splash(HZ, "FATAL ERROR"); | 750 | rb->splash(HZ, "FATAL"); |
747 | 751 | ||
748 | va_start(ap, fmt); | 752 | va_start(ap, fmt); |
749 | char buf[80]; | 753 | char buf[80]; |
@@ -1034,53 +1038,9 @@ static bool presets_menu(void) | |||
1034 | return do_preset_menu(midend_get_presets(me, NULL), NULL, sel) >= 0; | 1038 | return do_preset_menu(midend_get_presets(me, NULL), NULL, sel) >= 0; |
1035 | } | 1039 | } |
1036 | 1040 | ||
1037 | static const struct { | ||
1038 | const char *game, *help; | ||
1039 | } quick_help_text[] = { | ||
1040 | { "Black Box", "Find the hidden balls in the box by bouncing laser beams off them." }, | ||
1041 | { "Bridges", "Connect all the islands with a network of bridges." }, | ||
1042 | { "Cube", "Pick up all the blue squares by rolling the cube over them." }, | ||
1043 | { "Dominosa", "Tile the rectangle with a full set of dominoes." }, | ||
1044 | { "Fifteen", "Slide the tiles around to arrange them into order." }, | ||
1045 | { "Filling", "Mark every square with the area of its containing region." }, | ||
1046 | { "Flip", "Flip groups of squares to light them all up at once." }, | ||
1047 | { "Flood", "Turn the grid the same colour in as few flood fills as possible." }, | ||
1048 | { "Galaxies", "Divide the grid into rotationally symmetric regions each centred on a dot." }, | ||
1049 | { "Guess", "Guess the hidden combination of colours." }, | ||
1050 | { "Inertia", "Collect all the gems without running into any of the mines." }, | ||
1051 | { "Keen", "Complete the latin square in accordance with the arithmetic clues." }, | ||
1052 | { "Light Up", "Place bulbs to light up all the squares." }, | ||
1053 | { "Loopy", "Draw a single closed loop, given clues about number of adjacent edges." }, | ||
1054 | { "Magnets", "Place magnets to satisfy the clues and avoid like poles touching." }, | ||
1055 | { "Map", "Colour the map so that adjacent regions are never the same colour." }, | ||
1056 | { "Mines", "Find all the mines without treading on any of them." }, | ||
1057 | { "Net", "Rotate each tile to reassemble the network." }, | ||
1058 | { "Netslide", "Slide a row at a time to reassemble the network." }, | ||
1059 | { "Palisade", "Divide the grid into equal-sized areas in accordance with the clues." }, | ||
1060 | { "Pattern", "Fill in the pattern in the grid, given only the lengths of runs of black squares." }, | ||
1061 | { "Pearl", "Draw a single closed loop, given clues about corner and straight squares." }, | ||
1062 | { "Pegs", "Jump pegs over each other to remove all but one." }, | ||
1063 | { "Range", "Place black squares to limit the visible distance from each numbered cell." }, | ||
1064 | { "Rectangles", "Divide the grid into rectangles with areas equal to the numbers." }, | ||
1065 | { "Same Game", "Clear the grid by removing touching groups of the same colour squares." }, | ||
1066 | { "Signpost", "Connect the squares into a path following the arrows." }, | ||
1067 | { "Singles", "Black out the right set of duplicate numbers." }, | ||
1068 | { "Sixteen", "Slide a row at a time to arrange the tiles into order." }, | ||
1069 | { "Slant", "Draw a maze of slanting lines that matches the clues." }, | ||
1070 | { "Solo", "Fill in the grid so that each row, column and square block contains one of every digit." }, | ||
1071 | { "Tents", "Place a tent next to each tree." }, | ||
1072 | { "Towers", "Complete the latin square of towers in accordance with the clues." }, | ||
1073 | { "Tracks", "Fill in the railway track according to the clues." }, | ||
1074 | { "Twiddle", "Rotate the tiles around themselves to arrange them into order." }, | ||
1075 | { "Undead", "Place ghosts, vampires and zombies so that the right numbers of them can be seen in mirrors." }, | ||
1076 | { "Unequal", "Complete the latin square in accordance with the > signs." }, | ||
1077 | { "Unruly", "Fill in the black and white grid to avoid runs of three." }, | ||
1078 | { "Untangle", "Reposition the points so that the lines do not cross." }, | ||
1079 | }; | ||
1080 | |||
1081 | static void quick_help(void) | 1041 | static void quick_help(void) |
1082 | { | 1042 | { |
1083 | #ifdef FOR_REAL | 1043 | #if defined(FOR_REAL) && defined(DEBUG_MENU) |
1084 | if(++help_times >= 5) | 1044 | if(++help_times >= 5) |
1085 | { | 1045 | { |
1086 | rb->splash(HZ, "You are now a developer!"); | 1046 | rb->splash(HZ, "You are now a developer!"); |
@@ -1088,25 +1048,10 @@ static void quick_help(void) | |||
1088 | } | 1048 | } |
1089 | #endif | 1049 | #endif |
1090 | 1050 | ||
1091 | for(int i = 0; i < ARRAYLEN(quick_help_text); ++i) | 1051 | rb->splash(0, quick_help_text); |
1092 | { | 1052 | rb->button_get(true); |
1093 | if(!strcmp(midend_which_game(me)->name, quick_help_text[i].game)) | 1053 | return; |
1094 | { | ||
1095 | rb->splash(0, quick_help_text[i].help); | ||
1096 | rb->button_get(true); | ||
1097 | return; | ||
1098 | } | ||
1099 | } | ||
1100 | } | ||
1101 | |||
1102 | #if PLUGIN_BUFFER_SIZE <= 0x14000 | ||
1103 | /* no full help available due to memory constraints, so we provide a | ||
1104 | * dummy function here */ | ||
1105 | void full_help(const char *str) | ||
1106 | { | ||
1107 | (void) str; | ||
1108 | } | 1054 | } |
1109 | #endif | ||
1110 | 1055 | ||
1111 | static void init_default_settings(void) | 1056 | static void init_default_settings(void) |
1112 | { | 1057 | { |
@@ -1118,6 +1063,7 @@ static void init_default_settings(void) | |||
1118 | settings.no_aa = false; | 1063 | settings.no_aa = false; |
1119 | } | 1064 | } |
1120 | 1065 | ||
1066 | #ifdef DEBUG_MENU | ||
1121 | static void bench_aa(void) | 1067 | static void bench_aa(void) |
1122 | { | 1068 | { |
1123 | rb->sleep(0); | 1069 | rb->sleep(0); |
@@ -1202,6 +1148,7 @@ static void debug_menu(void) | |||
1202 | } | 1148 | } |
1203 | } | 1149 | } |
1204 | } | 1150 | } |
1151 | #endif | ||
1205 | 1152 | ||
1206 | static int pausemenu_cb(int action, const struct menu_item_ex *this_item) | 1153 | static int pausemenu_cb(int action, const struct menu_item_ex *this_item) |
1207 | { | 1154 | { |
@@ -1223,11 +1170,7 @@ static int pausemenu_cb(int action, const struct menu_item_ex *this_item) | |||
1223 | return ACTION_EXIT_MENUITEM; | 1170 | return ACTION_EXIT_MENUITEM; |
1224 | break; | 1171 | break; |
1225 | case 7: | 1172 | case 7: |
1226 | #if PLUGIN_BUFFER_SIZE <= 0x14000 | ||
1227 | return ACTION_EXIT_MENUITEM; | ||
1228 | #else | ||
1229 | break; | 1173 | break; |
1230 | #endif | ||
1231 | case 8: | 1174 | case 8: |
1232 | #ifdef COMBINED | 1175 | #ifdef COMBINED |
1233 | /* audio buf is used, so no playback */ | 1176 | /* audio buf is used, so no playback */ |
@@ -1245,7 +1188,7 @@ static int pausemenu_cb(int action, const struct menu_item_ex *this_item) | |||
1245 | return ACTION_EXIT_MENUITEM; | 1188 | return ACTION_EXIT_MENUITEM; |
1246 | break; | 1189 | break; |
1247 | case 10: | 1190 | case 10: |
1248 | #ifdef FOR_REAL | 1191 | #if defined(FOR_REAL) && defined(DEBUG_MENU) |
1249 | if(debug_mode) | 1192 | if(debug_mode) |
1250 | break; | 1193 | break; |
1251 | return ACTION_EXIT_MENUITEM; | 1194 | return ACTION_EXIT_MENUITEM; |
@@ -1309,7 +1252,7 @@ static int pause_menu(void) | |||
1309 | rb->snprintf(title, sizeof(title), "%s Menu", midend_which_game(me)->name); | 1252 | rb->snprintf(title, sizeof(title), "%s Menu", midend_which_game(me)->name); |
1310 | menu__.desc = title; | 1253 | menu__.desc = title; |
1311 | 1254 | ||
1312 | #ifdef FOR_REAL | 1255 | #if defined(FOR_REAL) && defined(DEBUG_MENU) |
1313 | help_times = 0; | 1256 | help_times = 0; |
1314 | #endif | 1257 | #endif |
1315 | 1258 | ||
@@ -1374,7 +1317,9 @@ static int pause_menu(void) | |||
1374 | } | 1317 | } |
1375 | break; | 1318 | break; |
1376 | case 10: | 1319 | case 10: |
1320 | #ifdef DEBUG_MENU | ||
1377 | debug_menu(); | 1321 | debug_menu(); |
1322 | #endif | ||
1378 | break; | 1323 | break; |
1379 | case 11: | 1324 | case 11: |
1380 | if(config_menu()) | 1325 | if(config_menu()) |
@@ -1819,11 +1764,7 @@ static int mainmenu_cb(int action, const struct menu_item_ex *this_item) | |||
1819 | return ACTION_EXIT_MENUITEM; | 1764 | return ACTION_EXIT_MENUITEM; |
1820 | break; | 1765 | break; |
1821 | case 3: | 1766 | case 3: |
1822 | #if PLUGIN_BUFFER_SIZE <= 0x14000 | ||
1823 | return ACTION_EXIT_MENUITEM; | ||
1824 | #else | ||
1825 | break; | 1767 | break; |
1826 | #endif | ||
1827 | case 4: | 1768 | case 4: |
1828 | #ifdef COMBINED | 1769 | #ifdef COMBINED |
1829 | /* audio buf is used, so no playback */ | 1770 | /* audio buf is used, so no playback */ |
@@ -1892,7 +1833,7 @@ enum plugin_status plugin_start(const void *param) | |||
1892 | rb->cpu_boost(false); | 1833 | rb->cpu_boost(false); |
1893 | #endif | 1834 | #endif |
1894 | 1835 | ||
1895 | #ifdef FOR_REAL | 1836 | #if defined(FOR_REAL) && defined(DEBUG_MENU) |
1896 | help_times = 0; | 1837 | help_times = 0; |
1897 | #endif | 1838 | #endif |
1898 | 1839 | ||