ScummVM API documentation
game_options.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef WATCHMAKER_GAME_OPTIONS_H
23 #define WATCHMAKER_GAME_OPTIONS_H
24 #include "common/stream.h"
25 #include "watchmaker/t3d.h"
26 #include "watchmaker/types.h"
27 #include "watchmaker/work_dirs.h"
28 
29 namespace Watchmaker {
30 
31 class GameOptions {
32 public:
33  uint8 sound_on = 1;
34  uint8 sound_volume = 100;
35  uint8 music_on = 1;
36  uint8 music_volume = 100;
37  uint8 speech_on = 1;
38  uint8 speech_volume = 100;
39  uint8 subtitles_on = 1;
40  bool bShowRoomDescriptions = true;
41  bool bShowExtraLocalizationStrings = false;
42  bool load(WorkDirs &workDirs) {
43  warning("TODO: Game options");
44 #if 0
45  Common::String path = workDirs._gameDir + workDirs._savesDir + "options.dat";
46 
47  auto stream = openFile(path);
48 
49  sound_on = stream->readByte();
50  sound_volume = stream->readByte();
51  music_on = stream->readByte();
52  music_volume = stream->readByte();
53  speech_on = stream->readByte();
54  speech_volume = stream->readByte();
55  subtitles_on = stream->readByte();
56  bShowRoomDescriptions = stream->readByte();
57  bShowExtraLocalizationStrings = stream->readByte();
58  warning("Done loading options");
59 #endif
60  return true;
61  }
62 
63  bool save(WorkDirs &workDirs) {
64  warning("TODO: Game options");
65 #if 0
66  FILE *fp;
67  char str[T3D_NAMELEN];
68 
69  sprintf(str, "%sOptions.dat", workDirs._savesDir.c_str());
70  fp = fopen(str, "wb");
71 
72  if (!fp) {
73  assert(false);
74  }
75 
76  fwrite(&sound_on, sizeof(uint8), 1, fp);
77  fwrite(&sound_volume, sizeof(uint8), 1, fp);
78  fwrite(&music_on, sizeof(uint8), 1, fp);
79  fwrite(&music_volume, sizeof(uint8), 1, fp);
80  fwrite(&speech_on, sizeof(uint8), 1, fp);
81  fwrite(&speech_volume, sizeof(uint8), 1, fp);
82  fwrite(&subtitles_on, sizeof(uint8), 1, fp);
83  fwrite(&bShowRoomDescriptions, sizeof(uint8), 1, fp);
84  fwrite(&bShowExtraLocalizationStrings, sizeof(uint8), 1, fp);
85 
86  fclose(fp);
87 #endif
88  return true;
89  }
90 };
91 
92 
93 
94 } // End of namespace Watchmaker
95 
96 #endif // WATCHMAKER_GAME_OPTIONS_H
Definition: 2d_stuff.h:30
Definition: str.h:59
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: work_dirs.h:30
Definition: game_options.h:31