1 /***************************************************************************
2              preferences.h  -  Interface for game preferences
3                              -------------------
4     begin                : Sat Feb 14 2004
5     copyright            : (C) 2004 by Daroth-U
6     email                : daroth-u@ifrance.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef PREFERENCES_H
19 #define PREFERENCES_H
20 #pragma once
21 
22 
23 
24 // All engine action that can be binded
25 // If you change this, ALSO change ENGINE_ACTION_NAMES in userconfiguration.cpp
26 // AND update ENGINE_ACTION_DEBUG_IND (first indice of invisible engine actions)
27 // AND add a corresponding bind line in config file (to have a default value)
28 enum engine_action_int {
29 
30 	SET_MOVE_DOWN = 0,
31 	SET_MOVE_RIGHT,
32 	SET_MOVE_UP,
33 	SET_MOVE_LEFT,
34 
35 	SET_PLAYER_0,
36 	SET_PLAYER_1,
37 	SET_PLAYER_2,
38 	SET_PLAYER_3,
39 	SET_PLAYER_ONLY,
40 
41 	SHOW_BACKPACK,
42 	SHOW_OPTIONS_MENU,
43 	SET_NEXT_FORMATION,
44 
45 	TOGGLE_MINIMAP,
46 
47 	SET_ZOOM_IN,
48 	SET_ZOOM_OUT,
49 
50 	TOGGLE_MAP_CENTER,
51 	INCREASE_GAME_SPEED,
52 	DECREASE_GAME_SPEED,
53 
54 	START_ROUND,
55 
56 	LAYOUT_1,
57 	LAYOUT_2,
58 	LAYOUT_4,
59 
60 	SWITCH_COMBAT,
61 
62 	NEXT_WEAPON,
63 
64 	QUICK_SPELL_1,
65 	QUICK_SPELL_2,
66 	QUICK_SPELL_3,
67 	QUICK_SPELL_4,
68 	QUICK_SPELL_5,
69 	QUICK_SPELL_6,
70 	QUICK_SPELL_7,
71 	QUICK_SPELL_8,
72 	QUICK_SPELL_9,
73 	QUICK_SPELL_10,
74 	QUICK_SPELL_11,
75 	QUICK_SPELL_12,
76 
77 	QUICK_SAVE,
78 	QUICK_LOAD,
79 	AUTO_LOAD,
80 
81 	// must be last
82 	ENGINE_ACTION_COUNT
83 };
84 
85 // All engine actions that have a corresponding keyup action
86 // If you change this, ALSO change ENGINE_ACTION_UP_NAMES in userconfiguration.cpp
87 enum engine_action_up_int {
88 
89 	SET_MOVE_DOWN_STOP = 500,   // Must be first
90 	SET_MOVE_RIGHT_STOP,
91 	SET_MOVE_UP_STOP,
92 	SET_MOVE_LEFT_STOP,
93 	SET_Y_ROT_PLUS_STOP,
94 	SET_Y_ROT_MINUS_STOP,
95 	SET_Z_ROT_PLUS_STOP,
96 	SET_Z_ROT_MINUS_STOP,
97 	SET_ZOOM_IN_STOP,
98 	SET_ZOOM_OUT_STOP,
99 	SET_NEXT_FORMATION_STOP,
100 
101 	// must be the last one
102 	ENGINE_ACTION_UP_COUNT
103 };
104 
105 /// This object holds the game's set preferences.
106 class Preferences {
107 
108 protected:
109 	// was the stencil buf. initialized at start?
110 	bool stencilBufInitialized;
111 
112 public:
113 
114 	enum {
115 		NONE = 0,
116 		SERVER,
117 		CLIENT,
118 		TEST
119 	};
120 
Preferences()121 	Preferences() {
122 		stencilBufInitialized = false;
123 	}
~Preferences()124 	virtual ~Preferences() {}
125 
126 	// engine variables
127 	virtual bool getFullscreen() = 0;
128 	virtual bool getDoublebuf() = 0;
129 	virtual bool getHwpal() = 0;
130 	virtual bool getResizeable() = 0;
131 	virtual bool getForce_hwsurf() = 0;
132 	virtual bool getForce_swsurf() = 0;
133 	virtual bool getHwaccel() = 0;
134 	virtual bool getTest() = 0;
135 	virtual bool getStencilbuf() = 0;
136 	virtual bool getMultitexturing() = 0;
137 	virtual int getBpp() = 0;
138 	virtual int getW() = 0;
139 	virtual int getH() = 0;
140 	virtual int getShadows() = 0;
141 	virtual bool getAnisoFilter() = 0;
142 	virtual int getGameSpeedLevel() = 0; // [0, 1, 2, 3, 4]
143 	virtual bool getAlwaysCenterMap() = 0;
144 	virtual bool getKeepMapSize() = 0;
145 	virtual bool getFrameOnFullScreen() = 0;
146 	virtual bool isBattleTurnBased() = 0;
147 	virtual bool isOvalCutoutShown() = 0;
148 	virtual bool isOutlineInteractiveItems() = 0;
149 	virtual int getCombatInfoDetail() = 0;
150 	virtual int getSoundFreq() = 0;
151 	virtual bool isSoundEnabled() = 0;
152 	virtual int getMusicVolume() = 0;
153 	virtual int getEffectsVolume() = 0;
154 	virtual bool getAlwaysShowPath() = 0;
155 	virtual bool getTooltipEnabled() = 0;
156 	virtual int getTooltipInterval() = 0;
157 	virtual int getGameSpeedTicks() = 0;
158 	virtual int getStandAloneMode() = 0;
159 	virtual char const* getHost() = 0;
160 	virtual char const* getUserName() = 0;
161 	virtual int getPort() = 0;
162 	virtual int getLogLevel() = 0;
163 	virtual int getPathFindingQuality() = 0;
164 	virtual long getMaxPathNodes() = 0;
165 	virtual int getMonsterToughness() = 0;
166 	virtual bool getEnableScreenshots() = 0;
167 	virtual bool getFlaky() = 0;
168 
169 	virtual void setBpp( int t ) = 0;
170 
171 	// returns the action to do for this event
172 	virtual int getEngineAction( SDL_Event *event ) = 0;
173 
setStencilBufInitialized(bool b)174 	inline void setStencilBufInitialized( bool b ) {
175 		stencilBufInitialized = b;
176 	}
getStencilBufInitialized()177 	inline bool getStencilBufInitialized() {
178 		return stencilBufInitialized;
179 	}
180 
181 	virtual void createConfigDir() = 0;
182 
183 	virtual bool isDebugTheme() = 0;
184 };
185 
186 #endif
187 
188