ScummVM API documentation
settings.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 ULTIMA4_CORE_SETTINGS_H
23 #define ULTIMA4_CORE_SETTINGS_H
24 
25 #include "ultima/ultima4/core/observable.h"
26 #include "ultima/ultima4/core/types.h"
27 #include "ultima/shared/conf/conf_serializer.h"
28 #include "common/hash-str.h"
29 
30 namespace Ultima {
31 namespace Ultima4 {
32 
33 #define MIN_SHAKE_INTERVAL 50
34 
35 #define MAX_BATTLE_SPEED 10
36 #define MAX_KEY_DELAY 1000
37 #define MAX_KEY_INTERVAL 100
38 #define MAX_CYCLES_PER_SECOND 20
39 #define MAX_SPELL_EFFECT_SPEED 10
40 #define MAX_CAMP_TIME 10
41 #define MAX_INN_TIME 10
42 #define MAX_SHRINE_TIME 20
43 #define MAX_SHAKE_INTERVAL 200
44 #define MAX_VOLUME 10
45 
46 #define DEFAULT_GEM_LAYOUT "Standard"
47 #define DEFAULT_LINEOFSIGHT "DOS"
48 #define DEFAULT_SCREEN_SHAKES 1
49 #define DEFAULT_GAMMA 100
50 #define DEFAULT_VOLUME_FADES 1
51 #define DEFAULT_SHORTCUT_COMMANDS 0
52 #define DEFAULT_KEY_DELAY 500
53 #define DEFAULT_KEY_INTERVAL 30
54 #define DEFAULT_FILTER_MOVE_MESSAGES 0
55 #define DEFAULT_BATTLE_SPEED 5
56 #define DEFAULT_ENHANCEMENTS 1
57 #define DEFAULT_CYCLES_PER_SECOND 4
58 #define DEFAULT_ANIMATION_FRAMES_PER_SECOND 24
59 #define DEFAULT_DEBUG 0
60 #define DEFAULT_VALIDATE_XML 1
61 #define DEFAULT_SPELL_EFFECT_SPEED 10
62 #define DEFAULT_CAMP_TIME 10
63 #define DEFAULT_INN_TIME 8
64 #define DEFAULT_SHRINE_TIME 16
65 #define DEFAULT_SHAKE_INTERVAL 100
66 #define DEFAULT_BATTLE_DIFFICULTY "Normal"
67 #define DEFAULT_LOGGING ""
68 #define DEFAULT_TITLE_SPEED_RANDOM 150
69 #define DEFAULT_TITLE_SPEED_OTHER 30
70 
71 //--Tile transparency stuff
72 #define DEFAULT_SHADOW_PIXEL_OPACITY 64
73 #define DEFAULT_SHADOW_PIXEL_SIZE 2
74 
76  bool _activePlayer;
77  bool _u5SpellMixing;
78  bool _u5Shrines;
79  bool _u5Combat;
80  bool _slimeDivides;
81  bool _gazerSpawnsInsects;
82  bool _textColorization;
83  bool _c64ChestTraps;
84  bool _smartEnterKey;
85  bool _peerShowsObjects;
86  bool _u4TileTransparencyHack;
87  int _u4TileTransparencyHackPixelShadowOpacity;
88  int _u4TrileTransparencyHackShadowBreadth;
89 
90  bool operator==(const SettingsEnhancementOptions &s) const;
91 };
92 
93 struct MouseOptions {
94  bool _enabled;
95 
96  bool operator==(const MouseOptions &s) const {
97  return _enabled == s._enabled;
98  }
99 };
100 
105 public:
106  bool operator==(const SettingsData &) const;
107  bool operator!=(const SettingsData &) const;
108 
109  int _battleSpeed;
110  bool _campingAlwaysCombat;
111  int _campTime;
112  bool _debug;
113  bool _enhancements;
114  SettingsEnhancementOptions _enhancementsOptions;
115  bool _filterMoveMessages;
116  int _gameCyclesPerSecond;
117  int _screenAnimationFramesPerSecond;
118  bool _innAlwaysCombat;
119  int _innTime;
120  MouseOptions _mouseOptions;
121  uint _scale;
122  bool _screenShakes;
123  int _gamma;
124  int _shakeInterval;
125  bool _shortcutCommands;
126  int _shrineTime;
127  int _spellEffectSpeed;
128  bool _validateXml;
129  bool _volumeFades;
130  int _titleSpeedRandom;
131  int _titleSpeedOther;
132 
133  int _eventTimerGranularity;
134  Common::String _filter;
135  Common::String _gemLayout;
136  Common::String _lineOfSight;
137  Common::String _videoType;
138  Common::String _battleDiff;
139  Common::String _logging;
140  Common::String _game;
141 };
142 
147 class Settings : public SettingsData, public Observable<Settings *> {
149 private:
150  static Settings *_instance;
151  Std::vector<Common::String> _battleDiffs;
152 private:
156  Settings();
157 
161  void synchronize(Shared::ConfSerializer &s);
162 public:
163  /* Methods */
164 
168  static Settings &getInstance();
169  void setData(const SettingsData &data);
170 
175  bool write();
176 
177  const Std::vector<Common::String> &getBattleDiffs();
178 };
179 
180 /* the global settings */
181 #define settings (Settings::getInstance())
182 
183 } // End of namespace Ultima4
184 } // End of namespace Ultima
185 
186 #endif
Definition: conf_serializer.h:33
Definition: str.h:59
Definition: settings.h:147
Definition: detection.h:27
Definition: settings.h:104
Definition: observable.h:45
Definition: settings.h:93