1 /* 2 options.h: 3 4 Contains headers for game options for tuxmath. 5 6 Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007,2008, 2009, 2010. 7 Authors: Bill Kendrick, David Bruce, Tim Holy. 8 Project email: <tuxmath-devel@lists.sourceforge.net> 9 Project website: http://tux4kids.alioth.debian.org 10 11 12 options.h is part of "Tux, of Math Command", a.k.a. "tuxmath". 13 14 Tuxmath is free software: you can redistribute it and/or modify 15 it under the terms of the GNU General Public License as published by 16 the Free Software Foundation; either version 3 of the License, or 17 (at your option) any later version. 18 19 Tuxmath is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU General Public License for more details. 23 24 You should have received a copy of the GNU General Public License 25 along with this program. If not, see <http://www.gnu.org/licenses/>. 26 */ 27 28 29 30 31 #ifndef OPTIONS_H 32 #define OPTIONS_H 33 34 #include "globals.h" /* needed for PATH_MAX definition */ 35 36 enum { 37 PER_USER_CONFIG, 38 USE_SOUND, 39 MENU_SOUND, 40 MENU_MUSIC, 41 FULLSCREEN, 42 USE_KEYPAD, 43 USE_IGLOOS, 44 NUM_GLOBAL_OPTS 45 }; 46 47 extern const char* const OPTION_TEXT[]; 48 extern const int OPTION_DEFAULTS[]; 49 50 /* contains options that tend to apply to the progam as a whole, rather * 51 * than on a per-game basis */ 52 typedef struct global_option_type { 53 int iopts[NUM_GLOBAL_OPTS]; 54 } global_option_type; 55 56 /* this struct contains all options regarding general */ 57 /* gameplay but not having to do with math questions per se */ 58 typedef struct game_option_type { 59 /* general game options */ 60 char lesson_title[LESSON_TITLE_LENGTH]; 61 char current_font_name[FONT_NAME_LENGTH]; 62 int lan_mode; 63 int use_bkgd; 64 int help_mode; 65 int demo_mode; 66 int oper_override; 67 int allow_pause; 68 int bonus_comet_interval; 69 float bonus_speed_ratio; 70 float speed; 71 int allow_speedup; 72 float speedup_factor; 73 float max_speed; 74 int slow_after_wrong; 75 int starting_comets; 76 int extra_comets_per_wave; 77 int max_comets; 78 int use_powerup_comets; 79 int powerup_freq; 80 char next_mission[PATH_MAX]; 81 int save_summary; 82 int use_feedback; 83 float danger_level; 84 float danger_level_speedup; 85 float danger_level_max; 86 float city_expl_handicap; 87 88 int mp_multiplayer; 89 int mp_round; 90 int mp_playernum; 91 92 /* whether sound system is successfully initialized and sound files loaded: */ 93 /* this flag is set by the program, not the user, and is not in the config file. */ 94 int sound_hw_available; 95 /* place to save score of last game - not read in from file: */ 96 int last_score; 97 /* not sure the rest of these belong in here */ 98 int num_cities; /* MUST BE AN EVEN NUMBER! */ 99 int num_bkgds; 100 int max_city_colors; 101 int keep_score; 102 } game_option_type; 103 104 105 enum { 106 OPT_OP_ADD, 107 OPT_OP_SUB, 108 OPT_OP_MUL, 109 OPT_OP_DIV, 110 OPT_A_MAX, 111 OPT_A_SPEED, 112 OPT_Q_RANGE, 113 NUM_OPTS 114 }; 115 116 /* global struct (until accessor functions completed) */ 117 //extern game_option_type* game_options; /* used by setup.c, options.c, game.c */ 118 119 /* main options function called from title(): */ 120 //int options(void); 121 122 /* "Public methods" of game_option_type struct; program interacts with struct */ 123 /* through these simple functions (rather than directly) to allow for error */ 124 /* checking, etc. */ 125 int Opts_Initialize(void); 126 void Opts_Cleanup(void); 127 128 129 /* "Set" functions for tuxmath options struct: */ 130 131 unsigned int Opts_MapTextToIndex(const char* text); 132 133 int Opts_GetGlobalOpt(unsigned int index); 134 void Opts_SetGlobalOpt(unsigned int index, int val); 135 136 void Opts_SetLessonTitle(char* title); 137 void Opts_SetLanMode(int val); 138 void Opts_SetUseBkgd(int val); 139 void Opts_SetHelpMode(int val); 140 void Opts_SetDemoMode(int val); 141 void Opts_SetOperOverride(int val); 142 void Opts_SetAllowPause(int val); 143 void Opts_SetBonusCometInterval(int val); 144 void Opts_SetBonusSpeedRatio(float val); 145 void Opts_SetSpeed(float val); 146 void Opts_SetAllowSpeedup(int val); 147 void Opts_SetSpeedupFactor(float val); 148 void Opts_SetMaxSpeed(float val); 149 void Opts_SetSlowAfterWrong(int val); 150 void Opts_SetStartingComets(int val); 151 void Opts_SetExtraCometsPerWave(int val); 152 void Opts_SetMaxComets(int val); 153 void Opts_SetUsePowerupComets(int val); 154 void Opts_SetPowerupFreq(int val); 155 void Opts_SetNextMission(char* str); 156 void Opts_SetSaveSummary(int val); 157 void Opts_SetUseFeedback(int val); 158 void Opts_SetDangerLevel(float val); 159 void Opts_SetDangerLevelSpeedup(float val); 160 void Opts_SetDangerLevelMax(float val); 161 void Opts_SetCityExplHandicap(float val); 162 163 /* whether sound system is successfully initialized and sound files loaded: */ 164 /* this flag is set by the program, not the user, and is not in the config file. */ 165 void Opts_SetSoundHWAvailable(int val); 166 /* Used by high score table code, not config file: */ 167 void Opts_SetLastScore(int val); 168 169 void Opts_SetKeepScore(int val); 170 171 /* "Get" functions for tuxmath options struct: */ 172 const char* Opts_LessonTitle(void); 173 const char* Opts_FontName(void); 174 int Opts_LanMode(void); 175 int Opts_UseBkgd(void); 176 int Opts_HelpMode(void); 177 int Opts_DemoMode(void); 178 int Opts_OperOverride(void); 179 int Opts_AllowPause(void); 180 int Opts_BonusCometInterval(void); 181 float Opts_BonusSpeedRatio(void); 182 float Opts_Speed(void); 183 int Opts_AllowSpeedup(void); 184 float Opts_SpeedupFactor(void); 185 float Opts_MaxSpeed(void); 186 int Opts_SlowAfterWrong(void); 187 int Opts_StartingComets(void); 188 int Opts_ExtraCometsPerWave(void); 189 int Opts_MaxComets(void); 190 int Opts_UsePowerupComets(void); 191 int Opts_PowerupFreq(void); 192 const char* Opts_NextMission(void); 193 int Opts_SaveSummary(void); 194 int Opts_UseFeedback(void); 195 float Opts_DangerLevel(void); 196 float Opts_DangerLevelSpeedup(void); 197 float Opts_DangerLevelMax(void); 198 float Opts_CityExplHandicap(void); 199 int Opts_KeepScore(void); 200 201 /* whether sound system is successfully initialized and sound files loaded: */ 202 /* this flag is set by the program, not the user, and is not in the config file. */ 203 int Opts_SoundHWAvailable(void); 204 /* this is the function that says if sound is both desired and actually available: */ 205 int Opts_UsingSound(void); 206 207 /* Returns score of last Arcade-type game this session: */ 208 int Opts_LastScore(void); 209 210 /* print options values to stream - for debugging purposes - has been */ 211 /* superceded by write_config_file() to actually write human-readable file. */ 212 void print_game_options(FILE* fp, int verbose); 213 #endif 214