00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00022
00023 #include "crogue.h"
00024 #include "export.h"
00025
00027 typedef struct option
00028 {
00029 const char *description;
00030 const char **choices;
00031 uchar num_choices;
00032 uchar default_value;
00033 } option;
00034
00035 static const char *choices_yesnoprompt[] = {
00036 gettext("Yes"),
00037 gettext("No"),
00038 gettext("Prompt") };
00039 #ifdef IS_CALCULATOR
00040 static const char *choices_smalllarge[] = {
00041 gettext("Small"),
00042 gettext("Large") };
00043 static const char *choices_fontsize[] = {
00044 gettext("Small"),
00045 gettext("Medium"),
00046 gettext("Large") };
00047 #endif
00048
00049
00050 static const option options[NUM_OPTIONS] = {
00051 { gettext("Auto-pickup"),
00052 choices_yesnoprompt,
00053 3, 2
00054 },
00055 { gettext("Auto-follow-stairs"),
00056 choices_yesnoprompt,
00057 3, 2
00058 },
00059 #ifdef IS_CALCULATOR
00060 { gettext("Tile size"),
00061 choices_smalllarge,
00062 2, 0
00063 },
00064 { gettext("Font size"),
00065 choices_fontsize,
00066 3, 0
00067 },
00068 { gettext("Archive saves"),
00069 choices_yesnoprompt,
00070 2, 1
00071 },
00072 { gettext("Archive scores"),
00073 choices_yesnoprompt,
00074 2, 0
00075 },
00076 { gettext("Use grayscale"),
00077 choices_yesnoprompt,
00078 2, 0
00079 }
00080
00081
00082
00083
00084 #endif
00085 };
00086
00087
00088 static void cb_options_menu(int n, char *buf)
00089 {
00090 sprintf(buf, "%s\t%s", options[n].description, options[n].choices[w->options[n]]);
00091 }
00092
00093
00094
00095 void init_options(void)
00096 {
00097 int i;
00098 for(i=0; i<NUM_OPTIONS; i++)
00099 w->options[i] = options[i].default_value;
00100 }
00101
00102
00103 void options_menu(void)
00104 {
00105 int choice;
00106 setTabStops(options_menu_tabs);
00107 UI_Menu_Set_Persist(1);
00108 while(1) {
00109 choice = UI_Menu_Pick( options_rect, NUM_OPTIONS, &cb_options_menu, 0);
00110 if(choice<0)
00111 break;
00112 w->options[choice] ++;
00113 w->options[choice] %= options[choice].num_choices;
00114
00115 #ifdef IS_CALCULATOR
00116 if(choice == OPTION_GRAYSCALE)
00117 {
00118 if(w->options[OPTION_GRAYSCALE] == OPTION_GRAY_ON)
00119 GrayOnThrow();
00120 else
00121 GrayOff();
00122 if(w->level)
00123 full_redraw();
00124 }
00125 #endif
00126 }
00127 UI_Menu_Set_Persist(0);
00128 }
00129