1 /*
2  *
3  *  Iter Vehemens ad Necem (IVAN)
4  *  Copyright (C) Timo Kiviluoto
5  *  Released under the GNU General
6  *  Public License
7  *
8  *  See LICENSING which should be included
9  *  along with this file for more details
10  *
11  */
12 
13 #ifndef __ICONF_H__
14 #define __ICONF_H__
15 
16 #include "config.h"
17 #include "v2.h"
18 
19 class ivanconfig
20 {
21  public:
GetDefaultName()22   static cfestring& GetDefaultName() { return DefaultName.Value; }
GetFantasyNamePattern()23   static cfestring& GetFantasyNamePattern() { return FantasyNamePattern.Value; }
GetDefaultPetName()24   static cfestring& GetDefaultPetName() { return DefaultPetName.Value; }
GetSelectedBkgColor()25   static cfestring& GetSelectedBkgColor() { return SelectedBkgColor.Value; }
GetAutoPickUpMatching()26   static cfestring& GetAutoPickUpMatching() { return AutoPickUpMatching.Value; }
IsAllWeightIsRelevant()27   static truth IsAllWeightIsRelevant() { return AllWeightIsRelevant.Value; }
GetAutoSaveInterval()28   static long GetAutoSaveInterval() { return AutoSaveInterval.Value; }
GetContrast()29   static long GetContrast() { return Contrast.Value; }
GetHitIndicator()30   static long GetHitIndicator() { return HitIndicator.Value; }
GetShowItemsAtPlayerSquare()31   static long GetShowItemsAtPlayerSquare(){ return ShowItemsAtPlayerSquare.Value; }
GetStartingWindowWidth()32   static long GetStartingWindowWidth() { return iStartingWindowWidth; }
GetStartingWindowHeight()33   static long GetStartingWindowHeight() { return iStartingWindowHeight; }
GetFrameSkip()34   static long GetFrameSkip() { return FrameSkip.Value; }
GetGoOnStopMode()35   static long GetGoOnStopMode() { return GoOnStopMode.Value; }
GetHoldPosMaxDist()36   static long GetHoldPosMaxDist() { return HoldPosMaxDist.Value; }
IsShowVolume()37   static truth IsShowVolume() { return ShowVolume.Value;}
IsAllowImportOldSavegame()38   static truth IsAllowImportOldSavegame(){ return AllowImportOldSavegame.Value; }
GetAltSilhouette()39   static long GetAltSilhouette() { return AltSilhouette.Value; }
IsHideWeirdHitAnimationsThatLookLikeMiss()40   static truth IsHideWeirdHitAnimationsThatLookLikeMiss(){return HideWeirdHitAnimationsThatLookLikeMiss.Value;}
IsUseLightEmiterBasedOnVolume()41   static truth IsUseLightEmiterBasedOnVolume(){return UseLightEmiterBasedOnVolume.Value;}
GetAltSilhouettePreventColorGlitch()42   static int GetAltSilhouettePreventColorGlitch(){return AltSilhouettePreventColorGlitch.Value;}
GetShowMap()43   static int GetShowMap(){return ShowMap.Value;}
IsShowMapAtDetectMaterial()44   static truth IsShowMapAtDetectMaterial() { return ShowMapAtDetectMaterial.Value; }
IsTransparentMapLM()45   static truth IsTransparentMapLM() { return TransparentMapLM.Value; }
IsWaitNeutralsMoveAway()46   static truth IsWaitNeutralsMoveAway() { return WaitNeutralsMoveAway.Value; }
IsEnhancedLights()47   static truth IsEnhancedLights() { return EnhancedLights.Value; }
GetMemorizeEquipmentMode()48   static int GetMemorizeEquipmentMode() { return 2; /*MemorizeEquipmentMode.Value;*/ }
GetDistLimitMagicMushrooms()49   static int GetDistLimitMagicMushrooms() { return DistLimitMagicMushrooms.Value * 4; }
IsShowFullDungeonName()50   static truth IsShowFullDungeonName() { return ShowFullDungeonName.Value; }
IsCenterOnPlayerAfterLook()51   static truth IsCenterOnPlayerAfterLook(){ return CenterOnPlayerAfterLook.Value; }
IsShowGodInfo()52   static truth IsShowGodInfo(){ return ShowGodInfo.Value; }
GetWarnAboutDanger()53   static truth GetWarnAboutDanger() { return WarnAboutDanger.Value; }
GetAutoDropLeftOvers()54   static truth GetAutoDropLeftOvers() { return AutoDropLeftOvers.Value; }
GetLookZoom()55   static truth GetLookZoom() { return LookZoom.Value; }
IsXBRZScale()56   static truth IsXBRZScale() { return XBRZScale.Value; }
IsAutoPickupThrownItems()57   static truth IsAutoPickupThrownItems() { return AutoPickupThrownItems.Value; }
IsAltAdentureInfo()58   static truth IsAltAdentureInfo() { return AltAdentureInfo.Value; }
UseDescriptiveHP()59   static truth UseDescriptiveHP() { return DescriptiveHP.Value; }
GetNoPet()60   static truth GetNoPet() { return StartWithNoPet.Value; }
GetXBRZSquaresAroundPlayer()61   static int GetXBRZSquaresAroundPlayer() { return XBRZSquaresAroundPlayer.Value; }
GetStartingDungeonGfxScale()62   static int GetStartingDungeonGfxScale() { return iStartingDungeonGfxScale; }
GetStartingFontGfx()63   static int GetStartingFontGfx() { return iStartingFontGfx; }
GetSilhouetteScale()64   static int GetSilhouetteScale() { return SilhouetteScale.Value; }
GetRotateTimesPerSquare()65   static int GetRotateTimesPerSquare() { return RotateTimesPerSquare.Value; }
GetDirectionKeyMap()66   static long GetDirectionKeyMap() { return DirectionKeyMap.Value; }
GetAltListItemWidth()67   static int GetAltListItemWidth() { return AltListItemWidth.Value; }
GetStackListPageLength()68   static int GetStackListPageLength() { return StackListPageLength.Value; }
GetSmartOpenCloseApply()69   static truth GetSmartOpenCloseApply() { return SmartOpenCloseApply.Value; }
IsSetupCustomKeys()70   static truth IsSetupCustomKeys() { return SetupCustomKeys.Value; }
GetBeNice()71   static truth GetBeNice() { return BeNice.Value; }
GetAltListItemPos()72   static int GetAltListItemPos() { return AltListItemPos.Value; }
GetPlaySounds()73   static truth GetPlaySounds() { return PlaySounds.Value; }
IsShowTurn()74   static truth IsShowTurn() { return ShowTurn.Value; }
IsAllowMouseOnFelist()75   static truth IsAllowMouseOnFelist(){ return AllowMouseOnFelist.Value; }
IsStartingOutlinedGfx()76   static truth IsStartingOutlinedGfx() { return bStartingOutlinedGfx; }
GetVolume()77   static long GetVolume() { return Volume.Value; }
GetSfxVolume()78   static long GetSfxVolume() { return SfxVolume.Value; }
GetMIDIOutputDevice()79   static long GetMIDIOutputDevice() { return MIDIOutputDevice.Value; }
GetExtraMenuGraphics()80   static truth GetExtraMenuGraphics(){ return UseExtraMenuGraphics.Value; }
81   static v2 GetWorldSizeConfig();
GetLandTypeConfig()82   static int GetLandTypeConfig() { return LandTypeConfig.Value; }
GetWorldShapeConfig()83   static int GetWorldShapeConfig() { return WorldShapeConfig.Value; }
GetWorldSeedConfig()84   static int GetWorldSeedConfig() { return WorldSeedConfig.Value; }
GetWorldSizeNumber()85   static int GetWorldSizeNumber() { return WorldSizeConfig.Value; }
86 
87 #ifndef __DJGPP__
GetGraphicsScale()88   static int GetGraphicsScale() { return GraphicsScale.Value; }
GetScalingQuality()89   static int GetScalingQuality() { return ScalingQuality.Value; }
GetFullScreenMode()90   static truth GetFullScreenMode() { return FullScreenMode.Value; }
91   static void SwitchModeHandler();
92 #else
GetFullScreenMode()93   static truth GetFullScreenMode() { return true; }
94 #endif
95 
96   static long ApplyContrastTo(long);
Save()97   static void Save() { configsystem::Save(); }
Load()98   static void Load() { configsystem::Load(); }
99   static void CalculateContrastLuminance();
GetContrastLuminance()100   static col24 GetContrastLuminance() { return ContrastLuminance; }
101   static void Initialize();
102   static void Show();
103 
104  private:
105   static v2 GetQuestionPos();
106   static void AutoSaveIntervalDisplayer(const numberoption*, festring&);
107   static void XBRZSquaresAroundPlayerDisplayer(const numberoption* O, festring& Entry);
108   static void ShowMapDisplayer(const cycleoption* O, festring& Entry);
109   static void GoOnStopModeDisplayer(const cycleoption* O, festring& Entry);
110   static void ShowItemsAtPlayerSquareDisplayer(const cycleoption* O, festring& Entry);
111   static void RotateTimesPerSquareDisplayer(const cycleoption* O, festring& Entry);
112   static void AltSilhouettePreventColorGlitchDisplayer(const cycleoption* O, festring& Entry);
113   static void HoldPosMaxDistDisplayer(const cycleoption* O, festring& Entry);
114   static void HitIndicatorDisplayer(const cycleoption* O, festring& Entry);
115   static void WindowWidthDisplayer(const numberoption* O, festring& Entry);
116   static void WindowHeightDisplayer(const numberoption* O, festring& Entry);
117   static void StackListPageLengthDisplayer(const numberoption* O, festring& Entry);
118   static void DistLimitMagicMushroomsDisplayer(const cycleoption* O, festring& Entry);
119   static void FrameSkipDisplayer(const numberoption* O, festring& Entry);
120   static void AltListItemWidthDisplayer(const numberoption* O, festring& Entry);
121   static void ContrastDisplayer(const numberoption*, festring&);
122   static void DirectionKeyMapDisplayer(const cycleoption*, festring&);
123   static truth DefaultNameChangeInterface(stringoption*);
124   static truth FantasyNameChangeInterface(stringoption* O);
125   static truth SelectedBkgColorChangeInterface(stringoption* O);
126   static truth AutoPickUpMatchingChangeInterface(stringoption* O);
127   static truth DefaultPetNameChangeInterface(stringoption*);
128   static truth AutoSaveIntervalChangeInterface(numberoption*);
129   static truth XBRZSquaresAroundPlayerChangeInterface(numberoption* O);
130   static truth ShowItemsAtPlayerSquareChangeInterface(cycleoption* O);
131   static truth WindowWidthChangeInterface(numberoption* O);
132   static truth WindowHeightChangeInterface(numberoption* O);
133   static truth StackListPageLengthChangeInterface(numberoption* O);
134   static truth FrameSkipChangeInterface(numberoption* O);
135   static truth AltListItemWidthChangeInterface(numberoption* O);
136   static truth ContrastChangeInterface(numberoption*);
137   static void SelectedBkgColorChanger(stringoption* O, cfestring& What);
138   static void AutoPickUpMatchingChanger(stringoption* O, cfestring& What);
139   static void AutoSaveIntervalChanger(numberoption*, long);
140   static void XBRZSquaresAroundPlayerChanger(numberoption* O, long What);
141   static void ShowItemsAtPlayerSquareChanger(cycleoption* O, long What);
142   static void WindowWidthChanger(numberoption* O, long What);
143   static void WindowHeightChanger(numberoption* O, long What);
144   static void StackListPageLengthChanger(numberoption* O, long What);
145   static void FrameSkipChanger(numberoption* O, long What);
146   static void AltListItemWidthChanger(numberoption* O, long What);
147   static void ContrastChanger(numberoption*, long);
148   static void MemorizeEquipmentModeDisplayer(const cycleoption* O, festring& Entry);
149   static void MIDIOutputDeviceDisplayer(const cycleoption*, festring&);
150   static void VolumeDisplayer(const numberoption*, festring&);
151   static void SfxVolumeDisplayer(const numberoption*, festring&);
152   static truth VolumeChangeInterface(numberoption*);
153   static truth SfxVolumeChangeInterface(numberoption*);
154   static void VolumeChanger(numberoption*, long);
155   static void SfxVolumeChanger(numberoption*, long);
156   static void AltSilhouetteDisplayer(const cycleoption* O, festring& Entry);
157   static void AllowMouseOnFelistChanger(truthoption*, truth);
158   static void UseExtraMenuGraphicsChanger(truthoption*, truth);
159   static void WorldSizeConfigDisplayer(const cycleoption* O, festring& Entry);
160   static void LandTypeConfigDisplayer(const cycleoption* O, festring& Entry);
161   static void WorldShapeConfigDisplayer(const cycleoption* O, festring& Entry);
162   static void WorldSeedConfigDisplayer(const numberoption* O, festring& Entry);
163   static truth WorldSeedConfigChangeInterface(numberoption* O);
164   static void WorldSeedConfigChanger(numberoption* O, long What);
165 
166 #ifndef __DJGPP__
167   static void GraphicsScaleDisplayer(const cycleoption*, festring&);
168   static void ScalingQualityDisplayer(const cycleoption*, festring&);
169   static truth GraphicsScaleChangeInterface(cycleoption*);
170   static void GraphicsScaleChanger(cycleoption*, long);
171   static void FullScreenModeChanger(truthoption*, truth);
172 #endif
173 
174   static void DungeonGfxScaleDisplayer(const cycleoption*, festring&);
175   static void FontGfxDisplayer(const cycleoption*, festring&);
176   static void SilhouetteScaleDisplayer(const cycleoption* O, festring& Entry);
177   static void AltListItemPosDisplayer(const cycleoption* O, festring& Entry);
178   static void SaveGameSortModeDisplayer(const cycleoption* O, festring& Entry);
179   static truth DungeonGfxScaleChangeInterface(cycleoption*);
180   static truth FontGfxChangeInterface(cycleoption*);
181   static truth SilhouetteScaleChangeInterface(cycleoption*);
182   static void DungeonGfxScaleChanger(cycleoption*, long);
183   static void FontGfxChanger(cycleoption*, long);
184   static void SilhouetteScaleChanger(cycleoption*, long);
185   static void SaveGameSortModeChanger(cycleoption* O, long What);
186   static void XBRZScaleChanger(truthoption*, truth);
187   static void SetupCustomKeysChanger(truthoption*, truth);
188   static void ContrastHandler(long);
189   static void VolumeHandler(long);
190   static void SfxVolumeHandler(long);
191   static void BackGroundDrawer();
192 
193   static stringoption DefaultName;
194   static stringoption FantasyNamePattern;
195   static stringoption DefaultPetName;
196   static stringoption SelectedBkgColor;
197   static stringoption AutoPickUpMatching;
198   static numberoption AutoSaveInterval;
199   static truthoption AltAdentureInfo;
200   static truthoption CenterOnPlayerAfterLook;
201   static scrollbaroption Contrast;
202   static truthoption ShowGodInfo;
203 
204   static numberoption WindowWidth;
205   static int iStartingWindowWidth;
206 
207   static numberoption WindowHeight;
208   static int iStartingWindowHeight;
209 
210   static cycleoption HoldPosMaxDist;
211   static numberoption FrameSkip;
212   static truthoption ShowFullDungeonName;
213   static truthoption AllowImportOldSavegame;
214   static cycleoption ShowItemsAtPlayerSquare;
215   static truthoption HideWeirdHitAnimationsThatLookLikeMiss;
216   static truthoption UseLightEmiterBasedOnVolume;
217   static cycleoption AltSilhouettePreventColorGlitch;
218   static cycleoption ShowMap;
219   static truthoption ShowMapAtDetectMaterial;
220   static truthoption TransparentMapLM;
221   static truthoption WaitNeutralsMoveAway;
222   static truthoption AllWeightIsRelevant;
223   static truthoption ShowVolume;
224   static truthoption EnhancedLights;
225 
226   static cycleoption MemorizeEquipmentMode;
227 
228   static truthoption WarnAboutDanger;
229   static truthoption AutoDropLeftOvers;
230   static truthoption LookZoom;
231   static truthoption XBRZScale;
232   static truthoption AutoPickupThrownItems;
233   static truthoption DescriptiveHP;
234   static truthoption StartWithNoPet;
235 
236   static cycleoption SaveGameSortMode;
237   static cycleoption DistLimitMagicMushrooms;
238 
239   static cycleoption  DungeonGfxScale;
240   static int iStartingDungeonGfxScale;
241 
242   static cycleoption  FontGfx;
243   static int iStartingFontGfx;
244 
245   static truthoption   OutlinedGfx;
246   static bool bStartingOutlinedGfx;
247 
248   static numberoption XBRZSquaresAroundPlayer;
249   static cycleoption DirectionKeyMap;
250   static truthoption SetupCustomKeys;
251   static cycleoption GoOnStopMode;
252   static cycleoption SilhouetteScale;
253   static cycleoption AltSilhouette;
254   static cycleoption AltListItemPos;
255   static cycleoption RotateTimesPerSquare;
256   static numberoption AltListItemWidth;
257   static numberoption StackListPageLength;
258   static cycleoption HitIndicator;
259 
260   static truthoption SmartOpenCloseApply;
261   static truthoption BeNice;
262   static scrollbaroption Volume;
263   static scrollbaroption SfxVolume;
264   static cycleoption MIDIOutputDevice;
265 
266   static cycleoption WorldSizeConfig;
267   static cycleoption LandTypeConfig;
268   static cycleoption WorldShapeConfig;
269   static numberoption WorldSeedConfig;
270 
271 #ifndef __DJGPP__
272   static cycleoption GraphicsScale;
273   static truthoption FullScreenMode;
274   static cycleoption ScalingQuality;
275 #endif
276 
277   static col24 ContrastLuminance;
278   static truthoption PlaySounds;
279   static truthoption ShowTurn;
280 
281   static truthoption AllowMouseOnFelist;
282   static truthoption UseExtraMenuGraphics;
283 };
284 
ApplyContrastTo(long L)285 inline long ivanconfig::ApplyContrastTo(long L)
286 {
287   long C = Contrast.Value;
288 
289   if(C == 100)
290     return L;
291   else
292     return MakeRGB24(41 * GetRed24(L) * C >> 12,
293                      41 * GetGreen24(L) * C >> 12,
294                      41 * GetBlue24(L) * C >> 12);
295 }
296 
297 #endif
298