Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / client_cfg.cpp
blob8e46e028a69f4f8a7f92e674db14014510a8c7a6
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2019 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2010 Robert TIMM (rti) <mail@rtti.de>
6 // Copyright (C) 2010-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 // Copyright (C) 2011-2012 Matt RAYKOWSKI (sfb) <matt.raykowski@gmail.com>
8 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
9 //
10 // This program is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Affero General Public License as
12 // published by the Free Software Foundation, either version 3 of the
13 // License, or (at your option) any later version.
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Affero General Public License for more details.
20 // You should have received a copy of the GNU Affero General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
26 /////////////
27 // INCLUDE //
28 /////////////
29 #include "stdpch.h"
30 // Misc.
31 #include "nel/misc/config_file.h"
32 #include "nel/misc/bit_mem_stream.h"
33 #include "nel/misc/i18n.h"
34 #include "nel/misc/cmd_args.h"
35 // Client.
36 #include "client_cfg.h"
37 #include "entities.h"
38 #include "cursor_functions.h"
39 #include "debug_client.h"
40 #include "view.h" // For the cameraDistance funtion
41 #include "user_entity.h"
42 #include "misc.h"
43 #include "user_agent.h"
45 // 3D Interface.
46 #include "nel/3d/u_driver.h"
47 #include "nel/3d/u_scene.h"
48 // Game Share.
49 #include "game_share/time_weather_season/time_and_season.h"
51 #ifdef HAVE_CONFIG_H
52 #include "config.h"
53 #endif
55 #ifdef NL_OS_MAC
56 #include "app_bundle_utils.h"
57 #endif // NL_OS_MAC
59 ///////////
60 // MACRO //
61 ///////////
62 //-----------------------------------------------
63 /// Macro to read a Bool from the CFG.
64 /// variableName : Variable Name to Read and Set.
65 //-----------------------------------------------
66 #define _READ_BOOL(variableName) \
67 /* Read the Variable Value From Script */ \
68 varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \
69 /* Value found, set the Variable */ \
70 if(varPtr) \
71 ClientCfg.variableName = varPtr->asInt() ? true : false; \
72 /* Use the Default Value */ \
73 else \
74 cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
76 //-----------------------------------------------
77 /// Macro to read an Int from the CFG.
78 /// variableName : Variable Name to Read and Set.
79 //-----------------------------------------------
80 #define _READ_INT(variableName) \
81 /* Read the Variable Value From Script */ \
82 varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \
83 /* Value found, set the Variable */ \
84 if(varPtr) \
85 ClientCfg.variableName = varPtr->asInt(); \
86 /* Use the Default Value */ \
87 else \
88 cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
90 //-----------------------------------------------
91 /// Macro to read a Float from the CFG.
92 /// variableName : Variable Name to Read and Set.
93 //-----------------------------------------------
94 #define _READ_FLOAT(variableName) \
95 /* Read the Variable Value From Script */ \
96 varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \
97 /* Value found, set the Variable */ \
98 if(varPtr) \
99 ClientCfg.variableName = varPtr->asFloat(); \
100 /* Use the Default Value */ \
101 else \
102 cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
104 //-----------------------------------------------
105 /// Macro to read a Float from the CFG.
106 /// cfgVariableName : Variable Name to Read.
107 /// variableName : Variable Name to Set.
108 //-----------------------------------------------
109 #define _READ_FLOAT2(cfgVariableName,variableName) \
110 /* Read the Variable Value From Script */ \
111 varPtr = ClientCfg.ConfigFile.getVarPtr(#cfgVariableName); \
112 /* Value found, set the Variable */ \
113 if(varPtr) \
114 ClientCfg.variableName = varPtr->asFloat(); \
115 /* Use the Default Value */ \
116 else \
117 cfgWarning("CFG: Default value used for '"#cfgVariableName"' !!!"); \
119 //-----------------------------------------------
120 /// Macro to read a Double from the CFG.
121 /// variableName : Variable Name to Read and Set.
122 //-----------------------------------------------
123 #define _READ_DOUBLE(variableName) \
124 /* Read the Variable Value From Script */ \
125 varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \
126 /* Value found, set the Variable */ \
127 if(varPtr) \
128 ClientCfg.variableName = varPtr->asDouble(); \
129 /* Use the Default Value */ \
130 else \
131 cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
133 //-----------------------------------------------
134 /// Macro to read a String from the CFG.
135 /// variableName : Variable Name to Read and Set.
136 //-----------------------------------------------
137 #define _READ_STRING(variableName) \
138 /* Read the Variable Value From Script */ \
139 varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \
140 /* Value found, set the Variable */ \
141 if(varPtr) \
142 ClientCfg.variableName = varPtr->asString(); \
143 /* Use the Default Value */ \
144 else \
145 cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
147 //-----------------------------------------------
148 /// Macro to read a CVector from the CFG.
149 /// variableName : Variable Name to Read and Set.
150 //-----------------------------------------------
151 #define _READ_CVECTOR(variableName) \
152 /* Read the Variable Value From Script */ \
153 varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \
154 if(varPtr) \
156 /* Check params */ \
157 if(varPtr->size()==3) \
159 ClientCfg.variableName.x = varPtr->asFloat(0); \
160 ClientCfg.variableName.y = varPtr->asFloat(1); \
161 ClientCfg.variableName.z = varPtr->asFloat(2); \
163 else \
164 cfgWarning("CFG: Bad params for '"#variableName"' !!!"); \
166 else \
167 cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
170 //-----------------------------------------------
171 /// Macro to read an Enum, as int from the CFG.
172 /// variableName : Variable Name to Read and Set.
173 //-----------------------------------------------
174 #define _READ_ENUM_ASINT(type, variableName) \
175 /* Read the Variable Value From Script */ \
176 varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \
177 /* Value found, set the Variable */ \
178 if(varPtr) \
179 ClientCfg.variableName = (type)varPtr->asInt(); \
180 /* Use the Default Value */ \
181 else \
182 cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
184 //-----------------------------------------------
185 /// Macro to read a String Vector from the CFG.
186 /// variableName : Variable Name to Read and Set.
187 //-----------------------------------------------
188 #define _READ_STRINGVECTOR(variableName) \
189 /* Read the Variable Value From Script */ \
190 varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \
191 /* Value found, set the Variable */ \
192 if(varPtr) \
194 ClientCfg.variableName.clear (); \
195 int iSz = varPtr->size(); \
196 ClientCfg.variableName.reserve(iSz); \
197 for (int i = 0; i < iSz; i++) \
198 ClientCfg.variableName.push_back(varPtr->asString(i)); \
200 /* Use the Default Value */ \
201 else \
202 cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
204 //-----------------------------------------------
205 // Macro for the dev version
206 //-----------------------------------------------
208 #if !FINAL_VERSION
209 #define READ_BOOL_DEV(variableName) _READ_BOOL(variableName)
210 #define READ_INT_DEV(variableName) _READ_INT(variableName)
211 #define READ_FLOAT_DEV(variableName) _READ_FLOAT(variableName)
212 #define READ_FLOAT2_DEV(cfgVariableName,variableName) _READ_FLOAT2(cfgVariableName,variableName)
213 #define READ_DOUBLE_DEV(variableName) _READ_DOUBLE(variableName)
214 #define READ_STRING_DEV(variableName) _READ_STRING(variableName)
215 #define READ_CVECTOR_DEV(variableName) _READ_CVECTOR(variableName)
216 #define READ_ENUM_ASINT_DEV(type, variableName) _READ_ENUM_ASINT(type, variableName)
217 #define READ_STRINGVECTOR_DEV(variableName) _READ_STRINGVECTOR(variableName)
218 #else // !FINAL_VERSION
219 #define READ_BOOL_DEV(variableName)
220 #define READ_INT_DEV(variableName)
221 #define READ_FLOAT_DEV(variableName)
222 #define READ_FLOAT2_DEV(cfgVariableName,variableName)
223 #define READ_DOUBLE_DEV(variableName)
224 #define READ_STRING_DEV(variableName)
225 #define READ_CVECTOR_DEV(variableName)
226 #define READ_ENUM_ASINT_DEV(type, variableName)
227 #define READ_STRINGVECTOR_DEV(variableName)
228 #endif // !FINAL_VERSION
230 //-----------------------------------------------
231 // Macro for the dev & final version
232 //-----------------------------------------------
234 #define READ_BOOL_FV(variableName) _READ_BOOL(variableName)
235 #define READ_INT_FV(variableName) _READ_INT(variableName)
236 #define READ_FLOAT_FV(variableName) _READ_FLOAT(variableName)
237 #define READ_FLOAT2_FV(cfgVariableName,variableName) _READ_FLOAT2(cfgVariableName,variableName)
238 #define READ_DOUBLE_FV(variableName) _READ_DOUBLE(variableName)
239 #define READ_STRING_FV(variableName) _READ_STRING(variableName)
240 #define READ_CVECTOR_FV(variableName) _READ_CVECTOR(variableName)
241 #define READ_ENUM_ASINT_FV(type, variableName) _READ_ENUM_ASINT(type, variableName)
242 #define READ_STRINGVECTOR_FV(variableName) _READ_STRINGVECTOR(variableName)
244 ///////////
245 // USING //
246 ///////////
247 using namespace NLMISC;
248 using namespace NL3D;
251 ////////////
252 // GLOBAL //
253 ////////////
254 CClientConfig LastClientCfg;
255 CClientConfig ClientCfg;
256 const string ConfigFileName = "client.cfg";
259 ////////////
260 // EXTERN //
261 ////////////
262 #ifndef RZ_NO_CLIENT
263 extern NL3D::UScene *Scene;
264 extern NL3D::UDriver *Driver;
265 extern CRyzomTime RT;
266 extern string Cookie;
267 extern string FSAddr;
268 #endif
270 extern NLMISC::CCmdArgs Args;
272 /////////////
273 // METHODS //
274 /////////////
276 // diplay only one time warning "Default values...."
277 static bool DisplayCFGWarning= false;
278 static void cfgWarning(const char *s)
280 if(DisplayCFGWarning)
281 nlwarning(s);
284 //---------------------------------------------------
285 // CClientConfig :
286 // Constructor.
287 //---------------------------------------------------
288 CClientConfig::CClientConfig()
290 IsInvalidated = false;
292 TestBrowser = false;
293 Light = false; // Default is no client light version
294 SaveConfig = false;
296 PositionX = 0;
297 PositionY = 0;
298 Frequency = 60;
300 SkipIntro = false;
301 SelectCharacter = -1; // Default is no auto select
302 SelectedSlot = 0; // Default is slot 0
304 Windowed = false; // Default is windowed mode.
305 Width = 0; // Default Width for the window (0 = current screen resolution).
306 Height = 0; // Default Height for the window (0 = current screen resolution).
307 Depth = 32; // Default Bit per Pixel.
308 Driver3D = DrvAuto; // Select best driver depending on hardware.
309 Contrast = 0.f; // Default Monitor Contrast.
310 Luminosity = 0.f; // Default Monitor Luminosity.
311 Gamma = 0.f; // Default Monitor Gamma.
313 InterfaceScale = 1.0f; // Resize UI
314 InterfaceScale_min = 0.8f;
315 InterfaceScale_max = 2.0f;
316 InterfaceScale_step = 0.05;
317 BilinearUI = true;
319 WindowSnapInvert = false;
320 WindowSnapDistance = 10;
322 VREnable = false;
323 VRDisplayDevice = "Auto";
324 VRDisplayDeviceId = "";
326 Local = false; // Default is Net Mode.
327 FSHost = ""; // Default Host.
329 TexturesInterface.push_back("texture_interfaces_v3");
330 TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc");
332 TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui");
334 TexturesLoginInterface.push_back("texture_interfaces_v3_login");
336 DisplayAccountButtons = true;
337 CreateAccountURL = RYZOM_CLIENT_CREATE_ACCOUNT_URL; // "https://open.ryzom.dev/ams/";
338 EditAccountURL = RYZOM_CLIENT_EDIT_ACCOUNT_URL; // "https://open.ryzom.dev/ams/";
339 ForgetPwdURL = RYZOM_CLIENT_FORGET_PASSWORD_URL; // "https://open.ryzom.dev/ams/";
340 Position = CVector(0.f, 0.f, 0.f); // Default Position.
341 Heading = CVector(0.f, 1.f, 0.f); // Default Heading.
342 EyesHeight = 1.5f; // Default User Eyes Height.
343 Walk = 1.66f; // Default Velocity for the Walk.
344 Run = 6.0f; // Default Velocity for the Run.
345 Fly = 25.0f; // Default Velocity for the Fly.
346 DmWalk = 6.0f; // Default Velocity for the Walk in Ring/DM or Ring/Editor.
347 DmRun = 20.0f; // Default Velocity for the Run in Ring/DM or Ring/Editor.
349 FlyAccel = 1000.f; // Default Acceleration for the fly, in m.s-2
351 AllowDebugCommands = false; // Add debug commands at startup
353 ForceDeltaTime = 0; // Default ForceDeltaTime, disabled by default
355 HardwareCursor = true; // Default HardwareCursor
356 HardwareCursorScale = 0.85f;
357 CursorSpeed = 1.f; // Default CursorSpeed
358 CursorAcceleration = 0; // Default CursorAcceleration
359 FreeLookSpeed = 0.001f; // Default FreeLookSpeed
360 FreeLookAcceleration = 0; // Default FreeLookAcceleration
361 FreeLookSmoothingPeriod = 0.f; // when in absolute mode, free look factor is used instead of speed, the mouse gives the absolute angle
362 FreeLookInverted = false;
363 FreeLookTablet = false; // Mouse reports absolute coordinates, so avoid mouse recentering
364 AutomaticCamera = true;
365 DblClickMode = true; // when in dbl click mode, a double click is needed to execute default contextual action
366 AutoEquipTool = true; // when true player will auto-equip last used weapon or forage tool when doing an action
368 BGColor = CRGBA(100,100,255); // Default Background Color.
369 LandscapeTileNear = 50.0f; // Default Landscape Tile Near.
370 LandscapeThreshold = 1000.0f; // Default Landscape Threshold.
371 Vision = 500.f; // Player vision.
372 Vision_min = 200.f; // Player vision min.
373 Vision_max = 800.f; // Player vision max.
374 SkinNbMaxPoly = 40000;
375 FxNbMaxPoly = 10000;
376 Cloud = true;
377 CloudQuality = 160.0f;
378 CloudUpdate = 1;
379 NbMaxSkeletonNotCLod= 20;
380 CharacterFarClip = 200.f;
381 ScreenAspectRatio = 0.f; // Default commmon Screen Aspect Ratio (no relation with the resolution) - 0.f = auto
382 FoV = 75.f; // Default value for the FoV.
383 ForceDXTC = false; // Default is no DXTC Compression.
384 AnisotropicFilter = 0; // Default is disabled (-1 = maximum value, 0 = disabled, 1+ = enabled)
385 DivideTextureSizeBy2= false; // Divide texture by 2
386 DisableVtxProgram = false; // Disable Hardware Vertex Program.
387 DisableVtxAGP = false; // Disable Hardware Vertex AGP.
388 DisableTextureShdr = false; // Disable Hardware Texture Shader.
389 MicroVeget = true; // Default is with MicroVeget.
390 MicroVegetDensity = 100.0f;
391 HDEntityTexture = false;
392 HDTextureInstalled = false;
393 Fog = true; // Fog is on by default
394 WaitVBL = false;
395 VideoMemory = 0;
397 FXAA = true;
399 Bloom = true;
400 SquareBloom = true;
401 DensityBloom = 255.f;
403 GlobalWindPower = 0.10f; // Default is 0.25
404 GlobalWindDirection = CVector(1,0,0); // Default direction is X>0
406 MovieShooterMemory = 0; // MovieShooter disabled
407 MovieShooterFramePeriod = 0.040f; // default is 25 fps
408 MovieShooterBlend = false;
409 MovieShooterFrameSkip = 0; // default not skip frame
410 MovieShooterPrefix = "shot_";
412 CameraRecorderPrefix = "cam_rec";
413 CameraRecorderBlend = true;
415 ScreenShotWidth = 0;
416 ScreenShotHeight = 0;
417 ScreenShotFullDetail = true;
418 ScreenShotZBuffer = false;
420 MaxNumberOfTimedFXInstances = 20;
421 SelectionFX = "sfx_selection_mouseover.ps";
422 MouseOverFX = "sfx_selection_mouseover.ps";
423 SelectionFXSize = 0.8f;
425 #if RZ_USE_PATCH
426 PatchWanted = true;
427 #else
428 PatchWanted = false;
429 #endif
431 PatchUrl.clear();
432 PatchletUrl.clear();
433 PatchVersion.clear();
435 WebIgMainDomain = RYZOM_WEBIG_MAIN_URL; // https://open.ryzom.dev/"
436 WebIgTrustedDomains.push_back(RYZOM_WEBIG_TRUSTED_DOMAIN); // open.ryzom.dev
437 WebIgNotifInterval = 10; // time in minutes
439 CurlMaxConnections = 5;
440 CurlCABundle.clear();
442 RingReleaseNotePath = WebIgMainDomain + "/releasenotes_ring/index.php";
443 ReleaseNotePath = WebIgMainDomain + "/releasenotes/index.php";
446 ///////////////
447 // ANIMATION //
448 // With a bigger angle, rotation is animated.
449 AnimatedAngleThreshold = 25.0; //
450 BlendFrameNumber = 5; //
451 DestThreshold = 0.01; // Destination Threshold
452 PositionLimiterRadius = 0.1;
453 SignificantDist = 0.0001; // Significant Distance
454 ///////////
455 // SOUND //
456 SoundOn = true; // Default is with sound.
457 DriverSound = SoundDrvAuto;
458 SoundForceSoftwareBuffer = true;
459 StartMusic = "main theme air.ogg"; // Use at game startup (originally no music)
460 EmptySlotMusic = "loading music loop.ogg"; // Use in character selection for empty slots
461 LoadingMusic = "main menu loop.ogg"; // Main loading used after leaving character selection, and when going back to character selection
462 KamiTeleportMusic = "kami teleport.ogg"; // Kami teleport
463 KaravanTeleportMusic = "karavan teleport.ogg"; // Karavan teleport
464 TeleportLoadingMusic = "loading music loop.ogg"; // Use for generic teleportations
465 DeathMusic = "death.ogg"; // Player death
466 SoundSFXVolume = 1.f;
467 SoundGameMusicVolume = 1.f;
468 SoundTPFade = 500;
469 EnableBackgroundMusicTimeConstraint = true;
471 SoundPackedSheetPath= "data/sound/"; // Default path for sound packed sheets
472 SampleBankDir = "data/sound/samplebanks"; // Default path for samples
473 UserEntitySoundLevel = 0.5f; // Default volume for sound in 1st person
474 UseEax = true; // Default to use EAX;
475 UseADPCM = false; // Defualt to PCM sample, NO ADPCM
476 MaxTrack = 32; // Default to 32 track
478 ColorShout = CRGBA(150,0,0,255); // Default Shout color.
479 ColorTalk = CRGBA(255,255,255,255); // Default Talk color.
481 StreamedPackagePath = "stream";
483 // MP3 player
484 MediaPlayerDirectory = "music";
485 MediaPlayerAutoPlay = false;
487 // PreDataPath.push_back("data/gamedev/language/"); // Default Path for the language data
489 // DataPath.push_back("data/"); // Default Path for the Data.
490 // DataPath.push_back("data_leveldesign/"); // Default Path for the Level Design Directory.
491 // DataPath.push_back("data_common/"); // Default Path for the Level Design Directory.
493 DataPathNoRecurse.push_back("data_leveldesign/leveldesign/Game_Elem");
495 UpdatePackedSheetPath.push_back("data_leveldesign");
497 UpdatePackedSheet = false; // Update packed sheet if needed
499 EndScreenTimeOut = 0.f; // Default time out for the screen at the end of the application.
500 Loading_BG = "loading_bg.tga"; // Default name for the loading background file.
501 LoadingFreeTrial_BG = "loading_free_trial_bg.tga"; // Default name for the loading background file in FreeTrial mode.
502 Launch_BG = "launcher_bg.tga"; // Default name for the launch background file.
503 TeleportKami_BG = "teleport_kami_bg.tga";
504 TeleportKaravan_BG = "teleport_caravan_bg.tga";
505 Elevator_BG = "elevator_bg.tga"; // Default name for the loading background file.
506 ResurectKami_BG = "resurect_kami_bg.tga";
507 ResurectKaravan_BG = "resurect_caravane_bg.tga";
508 End_BG = "end_bg.tga"; // Default name for the last background file.
509 IntroNevrax_BG = "launcher_nevrax.tga";
510 IntroNVidia_BG = "launcher_nvidia.tga";
512 TipsY = 0.07f;
513 TeleportInfoY = 0.23f;
515 SceneName = "";
516 IdFilePath = "sheet_id.bin";
517 PacsPrimDir.push_back("data/3d/");
519 Shadows = true; // Draw Shadows by default.
520 ShadowsClipFar = 10.f; // Shadows are disabled after this distance.
521 ShadowsLodDist = 3.f; // Shadows draw with just 1 part after this distance.
522 ShadowZDirClampLandscape = -0.5f; // On landscape, allow a minimum Phi angle of -30 degrees
523 ShadowZDirClampInterior = -0.86f; // On Interior, allow a minimum Phi angle of -60 degrees
524 ShadowZDirClampSmoothSpeed = 0.5f;
525 ShadowMaxDepthLandscape = 8.f;
526 ShadowMaxDepthInterior = 2.f;
527 ShadowMaxDepthSmoothSpeed = 6.f;
530 Names = false; // Don't draw Names by default.
532 Sleep = -1; // Default : client does not sleep.
533 ProcessPriority = 0; // Default : NORMAL
534 CPUMask = 0; // Default : auto detection
535 ShowPath = false; // Default : do not display the path.
536 DrawBoxes = false; // Default : Do not draw the selection.
538 UserSheet = "fyros.race_stats"; // Default sheet used.
539 Sex = GSGENDER::male; // Default : male.
541 PrimitiveHeightAddition = 2.f; // Default : 2.f
543 AttackDist = 0.5f;
544 RyzomDay = 0;
545 RyzomTime = 0.0f;
547 ManualWeatherSetup = false;
549 ChaseReactionTime = 0.4f; // Reaction time before chasing someone.
551 TimeToAdjustCamera = 1000.0;
552 ChangeDirAngle = 1.70f; // Default Angle.
554 GuildSymbolSize = 0.3f; // Default Guild Symbol Size.
555 SelectionDist = 150.f; // Default dist in meter.
556 SelectionOutBBoxWeight = 16.f; // Default factor
557 LootDist = 4.f; // Default loot/harvest distance (in meter).
558 SpaceSelectionDist = 50.f;
559 SpaceSelectionMaxCycle = 1;
561 ForceLanguage = false;
562 LanguageCode = "en"; // Default to english
563 DebugStringManager = false; // Default to no debug
565 // TUNING
566 WaterOffset = -1.085f;
567 FyrosWaterOffset = -1.0f;
568 MatisWaterOffset = -1.08f;
569 TrykerWaterOffset = -0.88f;
570 ZoraiWaterOffset = -1.25f;
571 WaterOffsetCreature = -1.6f;
572 TimeToRemoveCol = 1000;
573 MoveToTimeToStopStall = 500;
574 TPVMinPitch = -1.5f;
575 TPVMaxPitch = 1.5f;
576 MaxHeadTargetDist = 30.0f;
577 DeadFXName = "misc_dead.ps";
578 ImpactFXName = "impact.ps";
579 SkillUpFXName = "misc_levelup.ps";
580 MinDistFactor = 0.5;
581 NameScale = 1.0f; // Default Scale to display Names.
582 NamePos = 0.02f;
583 NameFontSize = 20;
584 MaxNameDist = 50.0f;
585 ConstNameSizeDist = 20.0f;
586 StaticNameHeight = true;
587 BarsHeight = 0.002f;
588 BarsWidth = 0.05f;
589 FightAreaSize = 1.5;
590 BubbleZBias = -3.f;
591 ForageInterfaceZBias= -10.f;
592 FyrosScale = 1.0f;
593 MatisScale = 1.08f;
594 TrykerScale = 0.88f;
595 ZoraiScale = 1.25f;
596 EnableRacialAnimation = true;
598 // OPTIONS
599 RunAtTheBeginning = true;
600 SelectWithRClick = false; // Default right click cannot select.
601 RotKeySpeedMax = 3.0f;
602 RotKeySpeedMin = 1.0f;
603 RotAccel = 0.001f;
604 PutBackItems = false;
605 ShowNameUnderCursor = true;
606 ShowNameSelected = true;
607 ShowNameBelowDistanceSqr = 20.f * 20.f;
608 ForceIndoorFPV = false;
609 FollowOnAtk = true;
610 AtkOnSelect = false;
611 TransparentUnderCursor = false;
612 ItemGroupAllowGuild = false;
613 // PREFERENCES
614 FPV = false;
615 CameraHeight = 2.5f;
616 CameraDistance = 3.0f;
617 CameraDistStep = 1.0f;
618 CameraDistMin = 1.0f;
619 CameraDistMax = 100.0f;
620 DmCameraDistMax = 25.0f;
621 CameraAccel = 0.2f;
622 CameraSpeedMin = 0.2f;
623 CameraSpeedMax = 1.0f;
624 CameraResetSpeed = 2.0f;
626 MaxMapScale = 2.0f;
627 R2EDMaxMapScale = 8.0f;
629 TargetChangeCompass = true;
631 // VERBOSES
632 VerboseVP = false;
633 VerboseAnimUser = false;
634 VerboseAnimSelection = false;
635 VerboseAllTraffic = false;
637 // DEBUG
638 DisplayMissingAnimFile = false;
639 DefaultEntity = "ccafb1.creature";
640 RestrainPI = true;
641 DumpVSIndex = false;
642 HelpFontSize = 12;
643 HelpFontColor = CRGBA(255,255,255);
644 HelpLineStep = 0.025f;
645 DebugFontSize = 16;
646 DebugFontColor = CRGBA(250, 250, 250);
647 DebugLineStep = 0.02f;
648 HeadOffset = CVector(0.f, 0.f, 0.f);
649 Check = false;
650 BlendForward = true;
652 FPExceptions = false; // Disable Floating Point Exceptions.
653 DisplayWeapons = false; // Do not dusplay weapons in first person.
654 NeedComputeVS = false; // Do not need to compute Visual Slots.
656 GroundFXMaxDist = 40.f;
657 GroundFXMaxNB = 10;
658 GroundFXCacheSize = 10;
660 AutoReloadFiles = false;
661 BlendShapePatched = true;
662 ExtendedCommands = false;
664 WaterEnvMapUpdateTime = 1.f;
666 NumFrameForProfile = 0;
667 SimulateServerTick = false;
668 TimerMode= 0;
670 KlientChatPort= "";
672 PreCacheShapes = true;
673 ResetShapeBankOnRetCharSelect = false;
674 LandscapeEnabled = true;
675 VillagesEnabled = true;
676 EAMEnabled = true;
677 CacheUIParsing = false;
678 MicroLifeEnabled = true;
680 SkipEULA = false;
682 StageLCTUsage= StageUsePosOnlyLCT;
684 SimulatePacketLossRatio= 0;
686 CheckMemoryEveryNFrame= -1;
687 LogMemoryAllocation=false;
688 LogMemoryAllocationSize=8;
690 DamageShieldEnabled = false;
692 LevelDesignEnabled = false;
694 R2Mode = true;
695 R2EDEnabled = false;
696 R2EDExtendedDebug = false;
697 R2EDVerboseParseTime = false;
698 R2EDDontReparseUnchangedUIFiles = false;
699 R2EDLightPalette = false;
700 R2EDAutoSaveWait = 60*5;
701 R2EDAutoSaveSlot = 9;
702 R2EDMustVerifyRingAccessWhileLoadingAnimation = false;
703 R2EDUseVerboseRingAccess = false;
704 R2EDDssNetwork = 3;
706 DamageShieldEnabled = false;
708 AllowDebugLua = false;
709 DisplayLuaDebugInfo = false;
710 BeepWhenLaunched = false;
714 LoadingStringCount = 0;
716 LuaDebugInfoGotoButtonEnabled = false;
718 FogDistAndDepthLookupBias = 0.f;
720 R2EDLoadDynamicFeatures = 0;
722 CheckR2ScenarioMD5 = true;
724 DisplayTPReason = false;
726 //TPCancelButtonX = 988;
727 //TPCancelButtonY = 138;
728 //TPQuitButtonX = 8;
729 //TPQuitButtonY = 138;
730 TPButtonW = 32;
731 TPButtonH = 32;
733 //SAVE
734 ScenarioSavePath = "./my_scenarios/";
736 R2EDClippedEntityBlendTime = 0.18f;
738 BackgroundDownloader = false;
740 }// CClientConfig //
743 //---------------------------------------------------
744 // load :
745 // Load the client config file.
746 //---------------------------------------------------
747 void CClientConfig::setValuesOnFileChange()
749 // ClientCfg.ConfigFile.print (InfoLog);
751 // display an info only when the file change
752 nlinfo ("reloading the config file!");
754 setValues();
757 //---------------------------------------------------
758 // load :
759 // Load the client config file.
760 //---------------------------------------------------
761 void CClientConfig::setValues()
763 CConfigFile::CVar *varPtr = 0;
764 static bool firstTimeSetValues= true;
766 //////////////////////
767 // INTERFACE CONFIG //
768 // input files
769 READ_STRING_FV(XMLInputFile)
772 READ_BOOL_FV(SkipIntro);
773 READ_BOOL_DEV(SkipEULA);
774 READ_INT_DEV(SelectCharacter);
776 READ_INT_FV(SelectedSlot);
777 if( ClientCfg.SelectedSlot>4 )
779 ClientCfg.SelectedSlot = 0;
782 // interface textures login menus
783 READ_STRINGVECTOR_FV(TexturesLoginInterface);
784 READ_STRINGVECTOR_FV(TexturesLoginInterfaceDXTC);
786 // interface textures outgame menus
787 READ_STRINGVECTOR_FV(TexturesOutGameInterface);
788 READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC);
790 // interface textures ingame and r2
791 READ_STRINGVECTOR_FV(TexturesInterface);
792 READ_STRINGVECTOR_FV(TexturesInterfaceDXTC);
794 // interface files login menus
795 READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles);
797 // interface files outgame menus
798 READ_STRINGVECTOR_FV(XMLOutGameInterfaceFiles);
800 // interface files
801 READ_STRINGVECTOR_FV(XMLInterfaceFiles);
803 // r2ed interfaces
804 READ_STRINGVECTOR_FV(XMLR2EDInterfaceFiles);
806 // logos
807 READ_STRINGVECTOR_FV(Logos);
809 // browser test mode
810 READ_BOOL_DEV(TestBrowser);
811 READ_STRING_DEV(TestBrowserUrl);
813 // ClientLight
814 #if !FINAL_VERSION
815 varPtr = ClientCfg.ConfigFile.getVarPtr ("ClientLight");
816 if (varPtr)
817 ClientCfg.Light = varPtr->asInt() ? true : false;
818 #endif // !FINAL_VERSION
821 READ_BOOL_DEV(LandscapeEnabled)
822 READ_BOOL_DEV(VillagesEnabled)
823 READ_BOOL_DEV(EAMEnabled)
824 READ_BOOL_DEV(CacheUIParsing)
825 READ_BOOL_DEV(MicroLifeEnabled)
827 READ_BOOL_DEV(LevelDesignEnabled)
829 ///////////////////
830 // WINDOW CONFIG //
831 // Mode.
833 // SaveConfig
834 READ_BOOL_FV(SaveConfig)
836 // Window Positon
837 READ_INT_FV(PositionX)
838 READ_INT_FV(PositionY)
840 // Window frequency
841 READ_INT_FV(Frequency)
843 CConfigFile::CVar *pcvFullScreen = ClientCfg.ConfigFile.getVarPtr("FullScreen");
844 if( pcvFullScreen )
846 ClientCfg.Windowed = pcvFullScreen->asInt() ? false : true;
848 else
849 cfgWarning("Default value used for 'Fullscreen'");
850 // Width
851 READ_INT_FV(Width)
852 // Height
853 READ_INT_FV(Height)
854 // Depth : Bit Per Pixel
855 READ_INT_FV(Depth)
856 // Contrast
857 READ_FLOAT_FV(Contrast)
858 // Luminosity
859 READ_FLOAT_FV(Luminosity)
860 // Gamma
861 READ_FLOAT_FV(Gamma)
862 // UI scaling
863 READ_FLOAT_FV(InterfaceScale);
864 READ_FLOAT_FV(InterfaceScale_min);
865 READ_FLOAT_FV(InterfaceScale_max);
866 READ_FLOAT_FV(InterfaceScale_step);
867 clamp(ClientCfg.InterfaceScale, ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max);
868 READ_BOOL_FV(BilinearUI);
869 READ_BOOL_FV(WindowSnapInvert);
870 READ_INT_FV(WindowSnapDistance);
871 // 3D Driver
872 varPtr = ClientCfg.ConfigFile.getVarPtr ("Driver3D");
873 if (varPtr)
875 if (nlstricmp(varPtr->asString(), "Auto") == 0 || nlstricmp(varPtr->asString(), "0") == 0) ClientCfg.Driver3D = CClientConfig::DrvAuto;
876 else if (nlstricmp(varPtr->asString(), "OpenGL") == 0 || nlstricmp(varPtr->asString(), "1") == 0) ClientCfg.Driver3D = CClientConfig::OpenGL;
877 else if (nlstricmp(varPtr->asString(), "Direct3D") == 0 || nlstricmp(varPtr->asString(), "2") == 0) ClientCfg.Driver3D = CClientConfig::Direct3D;
878 else if (nlstricmp(varPtr->asString(), "OpenGLES") == 0 || nlstricmp(varPtr->asString(), "3") == 0) ClientCfg.Driver3D = CClientConfig::OpenGLES;
880 else
881 cfgWarning ("Default value used for 'Driver3D' !!!");
883 READ_BOOL_FV(VREnable)
884 READ_STRING_FV(VRDisplayDevice)
885 READ_STRING_FV(VRDisplayDeviceId)
887 ////////////
888 // INPUTS //
889 READ_BOOL_FV(HardwareCursor)
890 READ_FLOAT_FV(HardwareCursorScale)
891 READ_FLOAT_FV(CursorSpeed)
892 READ_INT_FV(CursorAcceleration)
893 READ_FLOAT_FV(FreeLookSpeed)
894 READ_INT_FV(FreeLookAcceleration)
895 READ_FLOAT_FV(FreeLookSmoothingPeriod)
896 READ_BOOL_FV(FreeLookInverted)
897 READ_BOOL_FV(FreeLookTablet)
898 READ_BOOL_FV(AutomaticCamera)
899 READ_BOOL_FV(DblClickMode)
900 READ_BOOL_FV(AutoEquipTool)
902 /////////
903 // NET //
904 #if !FINAL_VERSION
905 // Local : local mode or network mode
906 READ_BOOL_DEV(Local)
907 #endif // FINAL_VERSION
908 // FSHost
909 READ_STRING_FV(FSHost)
911 READ_BOOL_DEV(DisplayAccountButtons)
912 READ_STRING_DEV(CreateAccountURL)
913 READ_STRING_DEV(EditAccountURL)
914 READ_STRING_DEV(ForgetPwdURL)
915 READ_STRING_DEV(BetaAccountURL)
916 READ_STRING_DEV(FreeTrialURL)
918 // defined in client_default.cfg
919 READ_STRING_FV(ConditionsTermsURL)
920 READ_STRING_FV(NamingPolicyURL)
921 READ_STRING_FV(LoginSupportURL)
923 #ifndef RZ_NO_CLIENT
924 // if cookie is not empty, it means that the client was launch
925 // by the nel_launcher, so it can't be local
926 if(!Cookie.empty())
928 nlassert (!FSAddr.empty());
929 ClientCfg.Local = false;
931 else
933 nlassert (FSAddr.empty());
935 #endif
937 /////////////////
938 // USER ENTITY //
939 READ_CVECTOR_DEV(Position)
940 READ_CVECTOR_DEV(Heading)
941 // EyesHeight
942 READ_FLOAT_DEV(EyesHeight)
944 // Walk
945 READ_FLOAT_DEV(Walk)
946 // Run
947 READ_FLOAT_DEV(Run)
949 //When editing or Dm ing a session in ring mode the player move quicker
950 // DM Walk
951 READ_FLOAT_DEV(DmWalk)
952 // DM Run
953 READ_FLOAT_DEV(DmRun)
957 // Fly
958 READ_FLOAT_DEV(Fly)
959 READ_FLOAT_DEV(FlyAccel)
961 READ_BOOL_FV(AllowDebugCommands)
963 // ForceDeltaTime
964 READ_INT_DEV(ForceDeltaTime)
966 ////////////
967 // RENDER //
968 // Background Color
969 #if !FINAL_VERSION
970 CConfigFile::CVar *pcvBackColor = ClientCfg.ConfigFile.getVarPtr("Background");
971 if( pcvBackColor && (pcvBackColor->size()==3) )
973 ClientCfg.BGColor.R = pcvBackColor->asInt(0);
974 ClientCfg.BGColor.G = pcvBackColor->asInt(1);
975 ClientCfg.BGColor.B = pcvBackColor->asInt(2);
976 ClientCfg.BGColor.A = 255;
978 else
979 cfgWarning("Default value used for 'Background'");
980 #endif // !FINAL_VERSION
981 // LandscapeTileNear
982 READ_FLOAT_FV(LandscapeTileNear)
983 // LandscapeThreshold
984 READ_FLOAT_FV(LandscapeThreshold)
985 // to be backward compatible, suppose a value<1 is for the old System!!! => invert it!
986 if( ClientCfg.LandscapeThreshold<1)
988 ClientCfg.LandscapeThreshold= 1.f/ ClientCfg.LandscapeThreshold;
989 // must re-write in the CFG database, to be ok with the in-game configurator
990 varPtr = ClientCfg.ConfigFile.getVarPtr("LandscapeThreshold");
991 if(varPtr)
992 varPtr->forceAsDouble(ClientCfg.LandscapeThreshold);
994 // Vision
995 READ_FLOAT_FV(Vision)
996 READ_FLOAT_FV(Vision_min)
997 READ_FLOAT_FV(Vision_max)
998 // SkinNbMaxPoly
999 READ_INT_FV(SkinNbMaxPoly)
1000 // FxNbMaxPoly
1001 READ_INT_FV(FxNbMaxPoly)
1002 READ_BOOL_FV(Cloud)
1003 READ_FLOAT_FV(CloudQuality)
1004 READ_INT_FV(CloudUpdate)
1005 // NbMaxSkeletonNotCLod
1006 READ_INT_FV(NbMaxSkeletonNotCLod)
1007 // CharacterFarClip
1008 READ_FLOAT_FV(CharacterFarClip)
1010 // Bloom
1011 READ_BOOL_FV(Bloom)
1012 READ_BOOL_FV(SquareBloom)
1013 READ_FLOAT_FV(DensityBloom)
1015 // FXAA
1016 READ_BOOL_FV(FXAA)
1018 // ScreenAspectRatio.
1019 READ_FLOAT_FV(ScreenAspectRatio)
1020 // FoV.
1021 READ_FLOAT_FV(FoV)
1022 // ForceDXTC
1023 READ_BOOL_FV(ForceDXTC)
1024 // AnisotropicFilter
1025 READ_INT_FV(AnisotropicFilter)
1026 // DivideTextureSizeBy2
1027 READ_BOOL_FV(DivideTextureSizeBy2)
1028 // DisableVtxProgram
1029 READ_BOOL_FV(DisableVtxProgram)
1030 // DisableVtxAGP
1031 READ_BOOL_FV(DisableVtxAGP)
1032 // DisableTextureShdr
1033 READ_BOOL_FV(DisableTextureShdr)
1034 // MicroVeget
1035 READ_BOOL_FV(MicroVeget)
1036 // MicroVeget Density
1037 READ_FLOAT_FV(MicroVegetDensity)
1038 // GlobalWindPower: Global Wind Power
1039 READ_FLOAT_DEV(GlobalWindPower)
1040 // Global Wind Direction
1041 READ_CVECTOR_DEV(GlobalWindDirection)
1042 // HDEntityTexture
1043 READ_BOOL_FV(HDEntityTexture)
1044 // HDTextureInstalled
1045 READ_BOOL_FV(HDTextureInstalled)
1047 // Fog
1048 READ_BOOL_DEV(Fog)
1050 // WaitVBL
1051 READ_BOOL_FV(WaitVBL)
1052 // VideoMemory
1053 READ_INT_FV(VideoMemory);
1055 READ_INT_DEV(TimerMode)
1057 // MovieShooterMemory
1058 CConfigFile::CVar *pcv = ClientCfg.ConfigFile.getVarPtr("MovieShooterMemory");
1059 if( pcv )
1061 ClientCfg.MovieShooterMemory = pcv->asInt();
1062 // Transform to octet
1063 ClientCfg.MovieShooterMemory *= 1024*1024;
1065 else
1066 cfgWarning("'MovieShooterMemory' not found => MovieShooter Disabled");
1067 // MovieShooterPath
1068 READ_STRING_FV(MovieShooterPath)
1069 // MovieShooterFramePeriod
1070 READ_FLOAT_FV(MovieShooterFramePeriod)
1071 // MovieShooterBlend
1072 READ_BOOL_FV(MovieShooterBlend)
1073 // MovieShooterFrameSkip
1074 READ_INT_FV(MovieShooterFrameSkip)
1076 // Camera Recorder
1077 READ_STRING_FV(CameraRecorderPath)
1078 READ_STRING_FV(CameraRecorderPrefix)
1079 READ_BOOL_FV(CameraRecorderBlend)
1081 // Screenshot
1082 READ_INT_FV(ScreenShotWidth)
1083 READ_INT_FV(ScreenShotHeight)
1084 READ_BOOL_FV(ScreenShotFullDetail)
1085 READ_BOOL_FV(ScreenShotZBuffer)
1087 /////////////////////////
1088 // NEW PATCHING SYSTEM //
1089 READ_BOOL_FV(PatchWanted)
1091 #ifdef RZ_USE_CUSTOM_PATCH_SERVER
1092 READ_STRING_FV(PatchUrl)
1093 READ_STRING_FV(PatchVersion)
1094 READ_STRING_FV(RingReleaseNotePath)
1095 READ_STRING_FV(ReleaseNotePath)
1096 #else
1097 READ_STRING_DEV(PatchUrl)
1098 READ_STRING_DEV(PatchVersion)
1099 READ_STRING_DEV(RingReleaseNotePath)
1100 READ_STRING_DEV(ReleaseNotePath)
1101 #endif
1103 /////////////////////////
1104 // NEW PATCHLET SYSTEM //
1105 READ_STRING_FV(PatchletUrl)
1107 ///////////
1108 // WEBIG //
1109 READ_STRING_FV(WebIgMainDomain);
1110 if (ClientCfg.WebIgMainDomain.find("http://") == std::string::npos
1111 || ClientCfg.WebIgMainDomain.find("https://") == std::string::npos)
1112 ClientCfg.WebIgMainDomain = "http://" + ClientCfg.WebIgMainDomain;
1113 READ_STRINGVECTOR_FV(WebIgTrustedDomains);
1114 READ_INT_FV(WebIgNotifInterval);
1115 READ_INT_FV(CurlMaxConnections);
1116 if (ClientCfg.CurlMaxConnections < 0)
1117 ClientCfg.CurlMaxConnections = 2;
1119 READ_STRING_FV(CurlCABundle);
1120 if (!ClientCfg.CurlCABundle.empty() && ClientCfg.CurlCABundle[0] == '%') // Path is relative to client_default.cfg path (used by ryzom patch)
1122 string defaultConfigFileName;
1123 if (ClientCfg.getDefaultConfigLocation(defaultConfigFileName))
1124 ClientCfg.CurlCABundle = CFile::getPath(defaultConfigFileName)+ClientCfg.CurlCABundle.substr(1);
1127 ///////////////
1128 // ANIMATION //
1129 // AnimatedAngleThreshold
1130 READ_DOUBLE_DEV(AnimatedAngleThreshold)
1131 // BlendFrameNumber
1132 READ_INT_DEV(BlendFrameNumber)
1133 // DestThreshold
1134 READ_DOUBLE_DEV(DestThreshold)
1135 // PositionLimiterRadius
1136 READ_DOUBLE_DEV(PositionLimiterRadius)
1137 // SignificantDist
1138 READ_DOUBLE_DEV(SignificantDist)
1139 // Stage LCT usage
1140 READ_ENUM_ASINT_DEV(TStageLCTUsage, StageLCTUsage)
1142 ////////////
1143 // TUNING //
1144 // Water Offset
1145 READ_FLOAT_DEV(WaterOffset)
1147 #if !FINAL_VERSION
1148 READ_FLOAT_DEV(FyrosWaterOffset)
1149 READ_FLOAT_DEV(MatisWaterOffset)
1150 READ_FLOAT_DEV(TrykerWaterOffset)
1151 READ_FLOAT_DEV(ZoraiWaterOffset)
1152 #endif // FINAL_VERSION
1154 // Water Offset for creature
1155 READ_FLOAT_DEV(WaterOffsetCreature)
1156 // TimeToRemoveCol
1157 READ_INT_DEV(TimeToRemoveCol)
1158 // MoveToTimeToStopStall
1159 READ_INT_DEV(MoveToTimeToStopStall)
1160 // TimeToAdjustCamera
1161 READ_DOUBLE_DEV(TimeToAdjustCamera)
1162 // ChangeDirAngle
1163 READ_DOUBLE_DEV(ChangeDirAngle)
1164 // GuildSymbolSize
1165 READ_FLOAT_DEV(GuildSymbolSize)
1166 // SelectionDist
1167 READ_FLOAT_DEV(SelectionDist)
1168 // SelectionOutBBoxWeight
1169 READ_FLOAT_DEV(SelectionOutBBoxWeight)
1170 // LootDist
1171 READ_FLOAT_DEV(LootDist)
1172 // SpaceSelectionDist
1173 READ_FLOAT_DEV(SpaceSelectionDist)
1174 // SpaceSelectionMaxCycle
1175 READ_INT_DEV(SpaceSelectionMaxCycle)
1176 // Third Person View Min Pitch.
1177 READ_FLOAT_DEV(TPVMinPitch)
1178 // Third Person View Max Pitch.
1179 READ_FLOAT_DEV(TPVMaxPitch)
1180 // The character look at the target before this distance.
1181 READ_FLOAT_DEV(MaxHeadTargetDist)
1182 // FX played when dead
1183 READ_STRING_DEV(DeadFXName)
1184 // FX played for each impact
1185 READ_STRING_DEV(ImpactFXName)
1186 // FX Played at skill up
1187 READ_STRING_DEV(SkillUpFXName)
1188 // MinDistFactor
1189 READ_DOUBLE_DEV(MinDistFactor)
1190 // NameScale
1191 READ_FLOAT_DEV(NameScale)
1192 // NamePos
1193 READ_FLOAT_DEV(NamePos)
1194 // NameFontSize
1195 READ_INT_DEV(NameFontSize)
1196 // MaxNameDist
1197 READ_FLOAT_DEV(MaxNameDist)
1198 // ConstNameSizeDist
1199 READ_FLOAT_DEV(ConstNameSizeDist)
1200 // StaticNameHeight
1201 READ_BOOL_FV(StaticNameHeight)
1202 // BarsHeight
1203 READ_FLOAT_DEV(BarsHeight)
1204 // BarsWidth
1205 READ_FLOAT_DEV(BarsWidth)
1206 // DisplayWeapons
1207 READ_BOOL_FV(DisplayWeapons)
1208 // FightAreaSize
1209 READ_DOUBLE_DEV(FightAreaSize)
1210 // AttackDist
1211 READ_FLOAT_DEV(AttackDist)
1212 // BubbleZBias
1213 READ_FLOAT_DEV(BubbleZBias);
1214 // ForageInterfaceZBias
1215 READ_FLOAT_DEV(ForageInterfaceZBias);
1217 // EnableRacialAnimation
1218 READ_BOOL_FV(EnableRacialAnimation);
1220 #if !FINAL_VERSION
1221 READ_FLOAT_DEV(FyrosScale);
1222 READ_FLOAT_DEV(MatisScale);
1223 READ_FLOAT_DEV(TrykerScale);
1224 READ_FLOAT_DEV(ZoraiScale);
1226 #endif // FINAL_VERSION
1228 //////////////////
1229 // SOUND CONFIG //
1230 // SoundOn
1231 READ_BOOL_FV(SoundOn)
1232 // Sound Driver
1233 varPtr = ClientCfg.ConfigFile.getVarPtr ("DriverSound");
1234 if (varPtr)
1236 if (nlstricmp(varPtr->asString(), "Auto") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvAuto;
1237 else if (nlstricmp(varPtr->asString(), "FMod") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvFMod;
1238 else if (nlstricmp(varPtr->asString(), "OpenAL") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvOpenAL;
1239 else if (nlstricmp(varPtr->asString(), "DirectSound") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvDirectSound;
1240 else if (nlstricmp(varPtr->asString(), "XAudio2") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvXAudio2;
1242 else
1243 cfgWarning ("Default value used for 'DriverSound' !!!");
1244 // SoundForceSoftwareBuffer
1245 READ_BOOL_FV(SoundForceSoftwareBuffer);
1246 // SoundOutGameMusic
1247 READ_STRING_DEV(StartMusic)
1248 READ_STRING_DEV(EmptySlotMusic)
1249 READ_STRING_DEV(LoadingMusic)
1250 READ_STRING_DEV(KamiTeleportMusic)
1251 READ_STRING_DEV(KaravanTeleportMusic)
1252 READ_STRING_DEV(TeleportLoadingMusic)
1253 READ_STRING_DEV(DeathMusic)
1254 // SoundSFXVolume
1255 READ_FLOAT_FV(SoundSFXVolume);
1256 // SoundGameMusicVolume
1257 READ_FLOAT_FV(SoundGameMusicVolume);
1258 // SoundTPFade
1259 READ_INT_DEV(SoundTPFade);
1260 // EnableBackgroundMusicTimeConstraint
1261 READ_BOOL_DEV(EnableBackgroundMusicTimeConstraint);
1262 // SoundPackedSheetPath
1263 READ_STRING_DEV(SoundPackedSheetPath)
1264 // SampleBankDir
1265 READ_STRING_DEV(SampleBankDir)
1266 // UserEntitySoundLevel : UserEntity sound level
1267 READ_FLOAT_FV(UserEntitySoundLevel)
1268 // Use EAX
1269 READ_BOOL_FV(UseEax)
1270 // UseADPCM
1271 READ_BOOL_DEV(UseADPCM)
1272 // Max track
1273 READ_INT_FV(MaxTrack)
1275 // MP3 Player
1276 READ_STRING_FV(MediaPlayerDirectory);
1277 READ_BOOL_FV(MediaPlayerAutoPlay);
1279 /////////////////
1280 // USER COLORS //
1281 // Shout Color
1282 CConfigFile::CVar *pcvColorShout = ClientCfg.ConfigFile.getVarPtr("ColorShout");
1283 if( pcvColorShout && (pcvColorShout->size() == 3) )
1285 ClientCfg.ColorShout.R = pcvColorShout->asInt(0);
1286 ClientCfg.ColorShout.G = pcvColorShout->asInt(1);
1287 ClientCfg.ColorShout.B = pcvColorShout->asInt(2);
1288 ClientCfg.ColorShout.A = 255;
1290 else
1291 cfgWarning("Default value used for 'ColorShout'");
1293 // Talk Color
1294 CConfigFile::CVar *pcvColorTalk = ClientCfg.ConfigFile.getVarPtr("ColorTalk");
1295 if( pcvColorTalk && (pcvColorTalk->size() == 3) )
1297 ClientCfg.ColorTalk.R = pcvColorTalk->asInt(0);
1298 ClientCfg.ColorTalk.G = pcvColorTalk->asInt(1);
1299 ClientCfg.ColorTalk.B = pcvColorTalk->asInt(2);
1300 ClientCfg.ColorTalk.A = 255;
1302 else
1303 cfgWarning("Default value used for 'ColorTalk'");
1305 //////////
1306 // MISC //
1308 // Pre Data Path.
1309 READ_STRINGVECTOR_FV(PreDataPath);
1311 // Data Path.
1312 READ_STRINGVECTOR_FV(DataPath);
1314 // Data Path no recurse.
1315 READ_STRINGVECTOR_FV(DataPathNoRecurse);
1317 // Streamed package path
1318 READ_STRING_FV(StreamedPackagePath);
1320 // Streamed package hosts
1321 READ_STRINGVECTOR_FV(StreamedPackageHosts);
1323 // List of files that trigger R2ED reload when touched
1324 READ_STRINGVECTOR_FV(R2EDReloadFiles);
1326 // Update packed sheet Path
1327 READ_STRINGVECTOR_FV(UpdatePackedSheetPath);
1329 // UpdatePackedSheet
1330 READ_BOOL_DEV(UpdatePackedSheet)
1332 // EndScreenTimeOut
1333 READ_FLOAT_DEV(EndScreenTimeOut)
1334 // Backgrounds
1335 READ_STRING_FV(Loading_BG)
1336 READ_STRING_FV(LoadingFreeTrial_BG)
1337 READ_STRING_FV(Launch_BG)
1338 READ_STRING_FV(TeleportKami_BG)
1339 READ_STRING_FV(TeleportKaravan_BG)
1340 READ_STRING_FV(Elevator_BG)
1341 READ_STRING_FV(ResurectKami_BG)
1342 READ_STRING_FV(ResurectKaravan_BG)
1343 READ_STRING_FV(End_BG)
1344 READ_STRING_FV(IntroNevrax_BG)
1345 READ_STRING_FV(IntroNVidia_BG)
1347 READ_FLOAT_DEV(TipsY)
1348 READ_FLOAT_DEV(TeleportInfoY)
1349 // SceneName
1350 READ_STRING_DEV(SceneName)
1351 // IdFile Path
1352 READ_STRING_DEV(IdFilePath)
1354 // PacsPrimDir
1355 READ_STRINGVECTOR_DEV(PacsPrimDir);
1357 /////////////
1358 // FILTERS //
1359 createDebug ();
1360 CConfigFile::CVar *pcvTmp = ClientCfg.ConfigFile.getVarPtr("NegFiltersDebug");
1361 if( pcvTmp )
1363 int iSz = pcvTmp->size();
1364 for(int k = 0; k < iSz; ++k)
1366 DebugLog->addNegativeFilter (pcvTmp->asString(k).c_str());
1369 else
1370 cfgWarning("Default value used for 'NegFiltersDebug'");
1372 pcvTmp = ClientCfg.ConfigFile.getVarPtr("NegFiltersInfo");
1373 if( pcvTmp )
1375 int iSz = pcvTmp->size();
1376 for(int k = 0; k < iSz; ++k)
1378 InfoLog->addNegativeFilter (pcvTmp->asString(k).c_str());
1381 else
1382 cfgWarning("Default value used for 'NegFiltersInfo'");
1384 pcvTmp = ClientCfg.ConfigFile.getVarPtr("NegFiltersWarning");
1385 if( pcvTmp )
1387 int iSz = pcvTmp->size();
1388 for(int k = 0; k < iSz; ++k)
1390 WarningLog->addNegativeFilter (pcvTmp->asString(k).c_str());
1393 else
1394 cfgWarning("Default value used for 'NegFiltersWarning'");
1396 // Script Files
1397 READ_STRINGVECTOR_FV(StartCommands);
1399 /////////////
1400 // OPTIONS //
1401 // Colors for system infos
1402 ClientCfg.SystemInfoParams.clear();
1403 CConfigFile::CVar *sic = ClientCfg.ConfigFile.getVarPtr("SystemInfoColors");
1404 if (!sic)
1406 cfgWarning("Can't read SystemInfoColors, all colors defaulting to white");
1408 else
1410 if (sic->size() & 1)
1412 cfgWarning("Expecting odd size for SystemInfoColors. Last entry ignored.");
1414 uint numCol = sic->size() >> 1;
1415 for(uint k = 0; k < numCol; ++k)
1417 uint r, g, b, a;
1418 char mode[64];
1419 char fx[64];
1420 fx[0]='\0';
1421 if (sscanf(sic->asString((2 * k) + 1).c_str(), "%d %d %d %d %s %s", &r, &g, &b, &a, mode, fx) < 5)
1423 if(DisplayCFGWarning)
1424 nlwarning("Can't parse color for entry %s", sic->asString(2 * k).c_str());
1426 else
1428 SSysInfoParam p;
1430 p.Color = CRGBA(r, g, b, a);
1431 p.Mode = SSysInfoParam::Normal;
1432 p.SysInfoFxName = string(fx);
1433 if (stricmp(mode, "over") == 0) p.Mode = SSysInfoParam::Over;
1434 else if (stricmp(mode, "overonly") == 0) p.Mode = SSysInfoParam::OverOnly;
1435 else if (stricmp(mode, "center") == 0) p.Mode = SSysInfoParam::Center;
1436 else if (stricmp(mode, "centeraround") == 0) p.Mode = SSysInfoParam::CenterAround;
1437 else if (stricmp(mode, "around") == 0) p.Mode = SSysInfoParam::Around;
1439 ClientCfg.SystemInfoParams[toLowerAscii(sic->asString(2 * k))] = p;
1444 #ifndef RZ_NO_CLIENT
1445 // printf commands in loading screens
1446 ClientCfg.PrintfCommands.clear();
1447 ClientCfg.PrintfCommandsFreeTrial.clear();
1448 std::vector< std::string > printfCommands(2);
1449 printfCommands[0] = "PrintfCommands";
1450 printfCommands[1] = "PrintfCommandsFreeTrial";
1451 for(uint p=0; p<2; p++)
1453 CConfigFile::CVar *pc = ClientCfg.ConfigFile.getVarPtr(printfCommands[p].c_str());
1454 if (pc)
1456 if( pc->size()%5 == 0 && pc->size() >= 5)
1458 for (uint i = 0; i < pc->size(); i+=5)
1460 SPrintfCommand pcom;
1461 pcom.X = pc->asInt(i);
1462 pcom.Y = pc->asInt(i+1);
1463 pcom.Color = CRGBA::stringToRGBA( pc->asString(i+2).c_str() );
1464 pcom.FontSize = pc->asInt(i+3);
1465 pcom.Text = pc->asString(i+4);
1467 if(p==0) ClientCfg.PrintfCommands.push_back( pcom );
1468 else ClientCfg.PrintfCommandsFreeTrial.push_back( pcom );
1471 else
1473 cfgWarning(("Missing or too many parameters in " + printfCommands[p]).c_str());
1477 #endif
1479 READ_INT_FV(LoadingStringCount)
1481 // DEBUG MEMORY
1482 READ_INT_DEV(CheckMemoryEveryNFrame)
1483 READ_BOOL_DEV(LogMemoryAllocation)
1484 READ_INT_DEV(LogMemoryAllocationSize)
1486 // SelectWithRClick
1487 READ_BOOL_FV(SelectWithRClick)
1488 READ_BOOL_DEV(RunAtTheBeginning)
1489 READ_FLOAT_FV(RotKeySpeedMax)
1490 READ_FLOAT_FV(RotKeySpeedMin)
1491 READ_FLOAT_FV(RotAccel)
1492 READ_BOOL_DEV(PutBackItems)
1493 READ_BOOL_DEV(ShowNameUnderCursor)
1494 READ_BOOL_DEV(ShowNameSelected)
1495 READ_FLOAT_DEV(ShowNameBelowDistanceSqr)
1496 READ_BOOL_DEV(ForceIndoorFPV)
1497 READ_BOOL_FV(FollowOnAtk);
1498 READ_BOOL_FV(AtkOnSelect);
1499 READ_BOOL_DEV(TransparentUnderCursor);
1501 READ_BOOL_FV(ItemGroupAllowGuild);
1504 /////////////////
1505 // PREFERENCES //
1506 // Read the view mode at load time only, cause prefer keep ingame player setup
1507 if(firstTimeSetValues)
1509 READ_BOOL_FV(FPV)
1511 READ_FLOAT_FV(CameraDistStep)
1512 READ_FLOAT_FV(CameraDistMin)
1513 READ_FLOAT_FV(CameraDistMax)
1514 READ_FLOAT_FV(DmCameraDistMax)
1515 READ_FLOAT_FV(CameraAccel)
1516 READ_FLOAT_FV(CameraSpeedMin)
1517 READ_FLOAT_FV(CameraSpeedMax)
1518 READ_FLOAT_FV(CameraResetSpeed)
1519 // Read the camera height and distance at load time only, cause prefer keep ingame player setup
1520 if(firstTimeSetValues)
1522 READ_FLOAT_FV(CameraHeight)
1523 READ_FLOAT_FV(CameraDistance)
1526 // Default values for CGroupMap
1527 READ_FLOAT_FV(MaxMapScale);
1528 READ_FLOAT_FV(R2EDMaxMapScale);
1530 // /tar to update compass or not
1531 READ_BOOL_FV(TargetChangeCompass);
1533 /////////////
1534 // SHADOWS //
1535 // Shadows : Get Shadows state
1536 READ_BOOL_FV(Shadows)
1537 // ShadowsClipFar : Get Shadows Clip Far.
1538 READ_FLOAT_DEV(ShadowsClipFar)
1539 // ShadowsLodDist : Get Shadows Lod Distance.
1540 READ_FLOAT_DEV(ShadowsLodDist)
1541 // ZClamp
1542 READ_FLOAT_DEV(ShadowZDirClampLandscape);
1543 READ_FLOAT_DEV(ShadowZDirClampInterior);
1544 READ_FLOAT_DEV(ShadowZDirClampSmoothSpeed);
1545 // MaxDepth
1546 READ_FLOAT_DEV(ShadowMaxDepthLandscape);
1547 READ_FLOAT_DEV(ShadowMaxDepthInterior);
1548 READ_FLOAT_DEV(ShadowMaxDepthSmoothSpeed);
1551 ////////////////
1552 // GROUND FXS //
1553 ////////////////
1554 READ_FLOAT_DEV(GroundFXMaxDist)
1555 READ_INT_DEV(GroundFXMaxNB)
1556 READ_INT_DEV(GroundFXCacheSize)
1558 // Names : Get Names state
1559 READ_BOOL_FV(Names)
1560 // Sleep
1561 READ_INT_FV(Sleep)
1562 // ProcessPriority
1563 READ_INT_FV(ProcessPriority)
1564 // CPUMask
1565 READ_INT_FV(CPUMask)
1566 // ShowPath : Get the ShowPath value.
1567 READ_BOOL_DEV(ShowPath)
1568 // UserSheet : Get the sheet to used for the use rin Local mode.
1569 READ_STRING_DEV(UserSheet)
1570 #if !FINAL_VERSION
1571 // Sex
1572 varPtr = ClientCfg.ConfigFile.getVarPtr("Sex");
1573 if(varPtr)
1574 ClientCfg.Sex = (GSGENDER::EGender)varPtr->asInt();
1575 else
1576 cfgWarning("Default value used for 'Sex' !!!");
1577 #endif // FINAL_VERSION
1578 // PrimitiveHeightAddition
1579 READ_BOOL_DEV(PrimitiveHeightAddition)
1580 // DrawBoxes
1581 READ_BOOL_DEV(DrawBoxes)
1584 // ChaseReactionTime
1585 READ_FLOAT_DEV(ChaseReactionTime)
1586 // RyzomTime
1587 READ_FLOAT_DEV(RyzomTime)
1588 // RyzomDay
1589 READ_INT_DEV(RyzomDay)
1590 // ManualWeatherSetup
1591 READ_BOOL_DEV(ManualWeatherSetup)
1592 // LanguageCode
1593 READ_BOOL_DEV(ForceLanguage)
1594 if (!ClientCfg.ForceLanguage)
1596 READ_STRING_FV(LanguageCode)
1598 // DebugStringManager
1599 READ_BOOL_DEV(DebugStringManager)
1601 // LastLogin
1602 READ_STRING_FV(LastLogin)
1604 //////////////
1605 // VERBOSES //
1606 READ_BOOL_DEV(VerboseVP)
1607 READ_BOOL_DEV(VerboseAnimUser)
1608 READ_BOOL_DEV(VerboseAnimSelection)
1609 READ_BOOL_DEV(VerboseAllTraffic)
1611 READ_STRING_DEV(LigoPrimitiveClass);
1613 ///////////
1614 // DEBUG //
1615 READ_INT_DEV(SimulatePacketLossRatio)
1616 READ_BOOL_DEV(PreCacheShapes)
1617 READ_BOOL_FV(ResetShapeBankOnRetCharSelect)
1618 READ_BOOL_DEV(DisplayMissingAnimFile)
1619 READ_STRING_DEV(DefaultEntity)
1620 READ_BOOL_DEV(RestrainPI)
1621 READ_BOOL_DEV(DumpVSIndex)
1622 READ_INT_DEV(HelpFontSize)
1623 #if !FINAL_VERSION
1624 // HelpFontColor
1626 CConfigFile::CVar *cvHelpFontColor = ClientCfg.ConfigFile.getVarPtr("HelpFontColor");
1627 if(cvHelpFontColor && cvHelpFontColor->size() == 3)
1629 ClientCfg.HelpFontColor.R = cvHelpFontColor->asInt(0);
1630 ClientCfg.HelpFontColor.G = cvHelpFontColor->asInt(1);
1631 ClientCfg.HelpFontColor.B = cvHelpFontColor->asInt(2);
1632 ClientCfg.HelpFontColor.A = 255;
1634 else
1635 cfgWarning("Default value used for 'HelpFontColor' !!!");
1637 #endif // !FINAL_VERSION
1638 // HelpLineStep
1639 READ_FLOAT_DEV(HelpLineStep)
1641 READ_INT_DEV(DebugFontSize)
1642 #if !FINAL_VERSION
1643 // DebugFontColor
1644 CConfigFile::CVar *pcvDebugFontColor = ClientCfg.ConfigFile.getVarPtr("DebugFontColor");
1645 if( pcvDebugFontColor && (pcvDebugFontColor->size() == 3) )
1647 ClientCfg.DebugFontColor.R = pcvDebugFontColor->asInt(0);
1648 ClientCfg.DebugFontColor.G = pcvDebugFontColor->asInt(1);
1649 ClientCfg.DebugFontColor.B = pcvDebugFontColor->asInt(2);
1650 ClientCfg.DebugFontColor.A = 255;
1652 else
1653 cfgWarning("Default value used for 'DebugFontColor'");
1654 #endif // !FINAL_VERSION
1655 READ_FLOAT_DEV(DebugLineStep)
1657 // HeadOffset
1658 READ_CVECTOR_DEV(HeadOffset)
1659 READ_BOOL_DEV(FPExceptions)
1660 READ_BOOL_DEV(NeedComputeVS)
1661 READ_BOOL_DEV(Check)
1662 READ_BOOL_DEV(UsePACSForAll)
1663 READ_FLOAT_DEV(WaterEnvMapUpdateTime)
1664 READ_BOOL_DEV(BlendForward)
1666 ClientCfg.ZCPacsPrim = "gen_bt_col_ext.pacs_prim";
1667 READ_STRING_DEV(ZCPacsPrim)
1669 READ_BOOL_FV(AutoReloadFiles)
1670 READ_BOOL_DEV(BlendShapePatched)
1672 READ_INT_DEV(MaxNumberOfTimedFXInstances);
1674 READ_STRING_DEV(SelectionFX);
1675 READ_STRING_DEV(MouseOverFX);
1676 READ_FLOAT_DEV(SelectionFXSize);
1678 if(ClientCfg.ConfigFile.exists("ExtendedCommands") && ClientCfg.ConfigFile.getVar("ExtendedCommands").asString() == "Enable")
1679 ClientCfg.ExtendedCommands = true;
1682 READ_BOOL_DEV(R2Mode);
1683 if (ClientCfg.Local) // R2EDEnabled is now set by the server
1685 READ_BOOL_DEV(R2EDEnabled)
1687 READ_INT_FV(R2EDDssNetwork)
1690 if (ClientCfg.Local)
1692 ClientCfg.R2EDDssNetwork = 1;
1695 READ_BOOL_DEV(R2EDExtendedDebug)
1696 #if FINAL_VERSION
1698 CConfigFile::CVar *var = ClientCfg.ConfigFile.getVarPtr("R2EDExtendedDebug");
1699 if (var)
1701 var->setAsInt(0);
1703 // else no-op -> will resolve to 'nil' into lua
1705 #endif
1708 READ_BOOL_DEV(R2EDVerboseParseTime)
1709 READ_BOOL_DEV(R2EDDontReparseUnchangedUIFiles)
1710 READ_BOOL_DEV(R2EDLightPalette)
1711 READ_INT_FV(R2EDAutoSaveWait)
1712 READ_INT_FV(R2EDAutoSaveSlot)
1713 READ_BOOL_DEV(R2EDMustVerifyRingAccessWhileLoadingAnimation)
1714 READ_BOOL_FV(R2EDUseVerboseRingAccess)
1718 //////////
1719 // TEMP //
1720 // Array with the name of all offensive impact FXs.
1721 READ_STRINGVECTOR_DEV(OffImpactFX);
1723 #ifndef RZ_NO_CLIENT
1725 //////////
1726 // INIT //
1727 // FPU
1728 #ifdef NL_OS_WINDOWS
1729 if(ClientCfg.FPExceptions)
1730 _control87(_EM_DENORMAL/*|_EM_INVALID|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM);
1731 else
1732 _control87(_EM_INVALID|_EM_DENORMAL|_EM_ZERODIVIDE|_EM_OVERFLOW|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM);
1734 // Set the process priority
1735 static DWORD priority[6]=
1737 0x40, // IDLE_PRIORITY_CLASS
1738 0x4000, // BELOW_NORMAL_PRIORITY_CLASS
1739 0x20, // NORMAL_PRIORITY_CLASS
1740 0x8000, // ABOVE_NORMAL_PRIORITY_CLASS
1741 0x80, // HIGH_PRIORITY_CLASS
1742 0x100, // REALTIME_PRIORITY_CLASS
1745 int index = ClientCfg.ProcessPriority+2;
1746 clamp(index, 0, 6);
1747 SetPriorityClass (GetCurrentProcess(), priority[index]);
1748 #endif // NL_OS_WINDOWS
1750 // Init Verbose Modes (at the beginning to be able to display them as soon as possible).
1751 ::VerboseVP = ClientCfg.VerboseVP;
1752 ::VerboseAnimUser = ClientCfg.VerboseAnimUser;
1753 ::VerboseAnimSelection = ClientCfg.VerboseAnimSelection;
1754 #ifdef LOG_ALL_TRAFFIC
1755 NLMISC::VerboseAllTraffic = ClientCfg.VerboseAllTraffic;
1756 #endif
1758 // (re-)Initialize contextual cursors.
1759 if (!ClientCfg.R2EDEnabled)
1761 initContextualCursor();
1764 // Prim files
1765 READ_STRINGVECTOR_DEV(PrimFiles);
1767 // Reset GlobalWind Setup
1768 if(Scene)
1770 Scene->setGlobalWindPower(ClientCfg.GlobalWindPower);
1771 Scene->setGlobalWindDirection(ClientCfg.GlobalWindDirection);
1774 if (Driver)
1776 // Set the monitor color properties
1777 CMonitorColorProperties monitorColor;
1778 for(uint i=0; i<3; i++)
1780 monitorColor.Contrast[i] = ClientCfg.Contrast;
1781 monitorColor.Luminosity[i] = ClientCfg.Luminosity;
1782 monitorColor.Gamma[i] = ClientCfg.Gamma;
1784 if(!Driver->setMonitorColorProperties(monitorColor))
1785 cfgWarning("reloadCFG: setMonitorColorProperties fails");
1789 // Show/hide all or parts of the user body.
1790 if (UserEntity)
1792 UserEntity->eyesHeight(ClientCfg.EyesHeight);
1793 UserEntity->updateVisualDisplay();
1795 // Run speed and camera dist max are set according to R2 char mode
1796 UserEntity->flushR2CharMode();
1799 // Initialize the camera distance (after camera dist max)
1800 View.setCameraDistanceMaxForPlayer();
1802 // draw in client light?
1803 if(ClientCfg.Light)
1805 ClientCfg.DrawBoxes = true;
1806 ClientCfg.Names = true;
1809 // Set Day / Time
1810 if (ClientCfg.Local)
1812 uint32 tickOffset = (uint32)(ClientCfg.RyzomDay * RYZOM_HOURS_IN_TICKS * 24 + ClientCfg.RyzomTime * RYZOM_HOURS_IN_TICKS);
1813 RT.resetTickOffset();
1814 RT.increaseTickOffset( tickOffset );
1816 #endif
1818 // for reset effect of variable in mainLoop(), set true
1819 ClientCfg.IsInvalidated= true;
1821 // Allow warning display only first time.
1822 DisplayCFGWarning= false;
1824 // If it is the load time, backup the ClientCfg into LastClientCfg
1825 if(firstTimeSetValues)
1826 LastClientCfg = ClientCfg;
1828 // no more true.
1829 firstTimeSetValues= false;
1831 READ_INT_DEV(NumFrameForProfile);
1832 READ_STRING_FV(KlientChatPort);
1833 READ_BOOL_DEV(SimulateServerTick);
1835 READ_BOOL_DEV(DamageShieldEnabled)
1837 READ_BOOL_FV(AllowDebugLua)
1838 READ_BOOL_FV(DisplayLuaDebugInfo)
1840 READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled)
1841 READ_STRING_DEV(LuaDebugInfoGotoButtonTemplate)
1842 READ_STRING_DEV(LuaDebugInfoGotoButtonCaption)
1843 READ_STRING_DEV(LuaDebugInfoGotoButtonFunction)
1846 READ_BOOL_DEV(BeepWhenLaunched)
1848 READ_STRING_DEV(R2ClientGw)
1850 READ_FLOAT_FV(FogDistAndDepthLookupBias)
1852 READ_INT_DEV(R2EDLoadDynamicFeatures)
1854 READ_BOOL_DEV(CheckR2ScenarioMD5);
1856 CConfigFile::CVar *pcvHardwareCursors = ClientCfg.ConfigFile.getVarPtr("HardwareCursors");
1857 if(pcvHardwareCursors)
1859 ClientCfg.HardwareCursors.clear ();
1860 int iSz = pcvHardwareCursors->size();
1861 for (int i = 0; i < iSz; i++)
1862 ClientCfg.HardwareCursors.insert(toLowerAscii(pcvHardwareCursors->asString(i)));
1864 else
1866 cfgWarning("Default value used for 'HardwareCursors'");
1867 // default list of harware cursors
1868 ClientCfg.HardwareCursors.insert("curs_can_pan.tga");
1869 ClientCfg.HardwareCursors.insert("curs_can_pan_dup.tga");
1870 ClientCfg.HardwareCursors.insert("curs_create.tga");
1871 ClientCfg.HardwareCursors.insert("curs_create_multi.tga");
1872 ClientCfg.HardwareCursors.insert("curs_create_vertex_invalid.tga");
1873 ClientCfg.HardwareCursors.insert("curs_default.tga");
1874 ClientCfg.HardwareCursors.insert("curs_dup.tga");
1875 ClientCfg.HardwareCursors.insert("curs_L.tga");
1876 ClientCfg.HardwareCursors.insert("curs_M.tga");
1877 ClientCfg.HardwareCursors.insert("curs_pan.tga");
1878 ClientCfg.HardwareCursors.insert("curs_pan_dup.tga");
1879 ClientCfg.HardwareCursors.insert("curs_pick.tga");
1880 ClientCfg.HardwareCursors.insert("curs_pick_dup.tga");
1881 ClientCfg.HardwareCursors.insert("curs_R.tga");
1882 ClientCfg.HardwareCursors.insert("curs_resize_BL_TR.tga");
1883 ClientCfg.HardwareCursors.insert("curs_resize_BR_TL.tga");
1884 ClientCfg.HardwareCursors.insert("curs_resize_LR.tga");
1885 ClientCfg.HardwareCursors.insert("curs_resize_TB.tga");
1886 ClientCfg.HardwareCursors.insert("curs_rotate.tga");
1887 ClientCfg.HardwareCursors.insert("curs_scale.tga");
1888 ClientCfg.HardwareCursors.insert("curs_stop.tga");
1889 ClientCfg.HardwareCursors.insert("text_cursor.tga");
1890 ClientCfg.HardwareCursors.insert("r2_hand_can_pan.tga");
1891 ClientCfg.HardwareCursors.insert("r2_hand_pan.tga");
1892 ClientCfg.HardwareCursors.insert("r2ed_tool_can_pick.tga");
1893 ClientCfg.HardwareCursors.insert("r2ed_tool_can_rotate.tga");
1894 ClientCfg.HardwareCursors.insert("r2ed_tool_pick.tga");
1895 ClientCfg.HardwareCursors.insert("r2ed_tool_rotate.tga");
1896 ClientCfg.HardwareCursors.insert("r2ed_tool_rotating.tga");
1899 // languages and types of Ring Scenarii
1900 READ_STRINGVECTOR_FV(ScenarioLanguages);
1901 READ_STRINGVECTOR_FV(ScenarioTypes);
1903 // build name
1904 READ_STRING_FV(BuildName)
1906 READ_BOOL_DEV(DisplayTPReason)
1908 //READ_INT_FV(TPQuitButtonX)
1909 //READ_INT_FV(TPQuitButtonY)
1910 //READ_INT_FV(TPCancelButtonX)
1911 //READ_INT_FV(TPCancelButtonY)
1912 READ_INT_FV(TPButtonW)
1913 READ_INT_FV(TPButtonH)
1915 READ_STRING_FV(ScenarioSavePath)
1918 ClientCfg.R2EDClippedEntityBlendTime = 0.18f;
1919 READ_FLOAT_FV(R2EDClippedEntityBlendTime)
1921 // vl: BackgroundDownloader is hardcoded to false and we don't want to run it, even if the cfg wants it
1922 //READ_BOOL_FV(BackgroundDownloader)
1924 }// load //
1927 //-----------------------------------------------
1928 // serial :
1929 // Serialize CFG.
1930 //-----------------------------------------------
1931 void CClientConfig::serial(NLMISC::IStream &f)
1933 // Start the opening of a new node named ClientCFG.
1934 f.xmlPush("ClientCFG");
1936 f.xmlPushBegin("Light");
1937 f.xmlPushEnd();
1938 f.serial(Light);
1939 f.xmlPop();
1941 f.xmlPushBegin("Windowed");
1942 f.xmlPushEnd();
1943 f.serial(Windowed);
1944 f.xmlPop();
1946 f.xmlPushBegin("Width");
1947 f.xmlPushEnd();
1948 f.serial(Width);
1949 f.xmlPop();
1951 f.xmlPushBegin("Height");
1952 f.xmlPushEnd();
1953 f.serial(Height);
1954 f.xmlPop();
1956 f.xmlPushBegin("Depth");
1957 f.xmlPushEnd();
1958 f.serial(Depth);
1959 f.xmlPop();
1961 f.xmlPushBegin("Contrast");
1962 f.xmlPushEnd();
1963 f.serial(Contrast);
1964 f.xmlPop();
1966 f.xmlPushBegin("Luminosity");
1967 f.xmlPushEnd();
1968 f.serial(Luminosity);
1969 f.xmlPop();
1971 f.xmlPushBegin("Gamma");
1972 f.xmlPushEnd();
1973 f.serial(Gamma);
1974 f.xmlPop();
1977 f.xmlPushBegin("AttackDist");
1978 f.xmlPushEnd();
1979 f.serial(AttackDist);
1980 f.xmlPop();
1982 // SelectWithRClick
1983 f.xmlPushBegin("SelectWithRClick");
1984 f.xmlPushEnd();
1985 f.serial(SelectWithRClick);
1986 f.xmlPop();
1988 // Close the serial for the Client CFG.
1989 f.xmlPop();
1990 }// serial //
1993 //-----------------------------------------------
1994 // init :
1995 //-----------------------------------------------
1996 void CClientConfig::init(const string &configFileName)
1998 // if the users client config does not exist
1999 if(!CFile::fileExists(configFileName))
2001 // create the basic .cfg
2002 FILE *fp = nlfopen(configFileName, "w");
2004 if (fp == NULL)
2005 nlerror("CFG::init: Can't create config file '%s'", configFileName.c_str());
2006 else
2007 nlwarning("CFG::init: creating '%s' with default values", configFileName.c_str ());
2009 // get current locale
2010 std::string lang = CI18N::getSystemLanguageCode();
2012 const std::vector<std::string> &languages = CI18N::getLanguageCodes();
2014 // search if current locale is defined in language codes
2015 for(uint i = 0; i < languages.size(); ++i)
2017 if (lang == languages[i])
2019 // store the language code in the config file
2020 fprintf(fp, "LanguageCode = \"%s\";\n", lang.c_str());
2021 break;
2025 fclose(fp);
2028 // read the exising config file (don't parse it yet!)
2029 ucstring content; // UTF-16 and UTF-8 textfile support
2030 NLMISC::CI18N::readTextFile(configFileName, content);
2031 std::string contentUtf8 = content.toUtf8();
2033 // while there are "RootConfigFilename" values, remove them
2034 size_t pos = 0;
2035 while((pos = contentUtf8.find("RootConfigFilename")) != configFileName.npos)
2037 size_t endOfLine = contentUtf8.find("\n", pos);
2038 contentUtf8.erase(pos, (endOfLine - pos) + 1);
2041 // get current location of the root config file (client_default.cfg)
2042 std::string defaultConfigLocation;
2043 if(!getDefaultConfigLocation(defaultConfigLocation))
2044 nlerror("cannot find client_default.cfg");
2046 // and store it in the RootConfigFilename value in the very first line
2047 contentUtf8.insert(0, std::string("RootConfigFilename = \"") +
2048 defaultConfigLocation + "\";\n");
2050 // save the updated config file
2051 NLMISC::COFile configFile(configFileName, false, true, false);
2052 configFile.serialBuffer((uint8*)contentUtf8.c_str(), (uint)contentUtf8.size());
2053 configFile.close();
2055 // now we can continue loading and parsing the config file
2057 // if the config file will be modified, it calls automatically the function setValuesOnFileChange()
2058 ClientCfg.ConfigFile.setCallback (CClientConfig::setValuesOnFileChange);
2060 // load the config files
2061 ClientCfg.ConfigFile.load (configFileName);
2063 CConfigFile::CVar *pCV;
2064 // check language code is supported
2065 pCV = ClientCfg.ConfigFile.getVarPtr("LanguageCode");
2066 if (pCV)
2068 std::string lang = pCV->asString();
2069 if (!CI18N::isLanguageCodeSupported(lang))
2071 nlinfo("Unsupported language code \"%s\" fallback on default", lang.c_str());
2072 // fallback to default language
2073 ClientCfg.LanguageCode = CI18N::getSystemLanguageCode();
2074 // update ConfigFile variable
2075 pCV->setAsString(ClientCfg.LanguageCode);
2076 ClientCfg.ConfigFile.save();
2080 // update the ConfigFile variable in the config file
2081 pCV = ClientCfg.ConfigFile.getVarPtr("ClientVersion");
2082 if (pCV)
2084 std::string str = pCV->asString ();
2085 if (str != getVersion() && ClientCfg.SaveConfig)
2087 nlinfo ("Update and save the ClientVersion variable in config file %s -> %s", str.c_str(), getVersion().c_str());
2088 pCV->setAsString(getVersion());
2089 ClientCfg.ConfigFile.save();
2092 else
2093 nlwarning ("There's no ClientVersion variable in the config file!");
2095 }// init //
2098 //-----------------------------------------------
2099 // init :
2100 //-----------------------------------------------
2101 void CClientConfig::release ()
2103 #ifndef RZ_NO_CLIENT
2104 // Do we have to save the cfg file ?
2105 if (ClientCfg.SaveConfig)
2107 // Save values
2110 CConfigFile::CVar *varPtr = NULL;
2112 // Driver still alive ?
2113 if (Driver && Driver->isActive ())
2115 sint32 x, y;
2116 uint32 width, height;
2118 Driver->getWindowPos(x, y);
2119 Driver->getWindowSize(width, height);
2121 // Are we in window mode ?
2122 if (ClientCfg.Windowed /* && !isWindowMaximized() */)
2124 // Save windows position. width/height are saved when leaving ingame.
2125 writeInt("PositionX", x);
2126 writeInt("PositionY", y);
2130 // Save if in FPV or TPV.
2131 writeBool("FPV", ClientCfg.FPV);
2133 // Save the camera distance
2134 writeDouble("CameraDistance", ClientCfg.CameraDistance);
2136 catch (const Exception &e)
2138 nlwarning ("Error while set config file variables : %s", e.what ());
2141 // Save it
2142 ClientCfg.ConfigFile.save ();
2144 #endif
2147 bool CClientConfig::readBool (const std::string &varName)
2149 bool bVal = false;
2150 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2151 if(varPtr)
2152 bVal = varPtr->asInt() ? true : false;
2153 else
2154 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2155 return bVal;
2158 void CClientConfig::writeBool (const std::string &varName, bool bVal, bool bForce)
2160 CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
2161 if(varPtr)
2162 varPtr->forceAsInt(bVal ? 1:0);
2163 else
2164 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2167 sint32 CClientConfig::readInt (const std::string &varName)
2169 sint32 bVal = 0;
2170 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2171 if(varPtr)
2172 bVal = varPtr->asInt();
2173 else
2174 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2175 return bVal;
2178 void CClientConfig::writeInt (const std::string &varName, sint32 bVal, bool bForce)
2180 CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
2181 if(varPtr)
2182 varPtr->forceAsInt(bVal);
2183 else
2184 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2187 double CClientConfig::readDouble (const std::string &varName)
2189 double bVal = 0;
2190 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2191 if(varPtr)
2192 bVal = varPtr->asDouble();
2193 else
2194 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2195 return bVal;
2198 void CClientConfig::writeDouble (const std::string &varName, double dVal, bool bForce)
2200 CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
2201 if(varPtr)
2202 varPtr->forceAsDouble(dVal);
2203 else
2204 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2207 string CClientConfig::readString (const std::string &varName)
2209 string sVal;
2210 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2211 if(varPtr)
2212 sVal = varPtr->asString();
2213 else
2214 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2215 return sVal;
2218 void CClientConfig::writeString (const std::string &varName, const std::string &strVal, bool bForce)
2220 CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
2221 if(varPtr)
2222 varPtr->forceAsString(strVal);
2223 else
2224 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2227 // ***************************************************************************
2228 bool CClientConfig::readBoolNoWarning(const std::string &varName)
2230 bool bVal = false;
2231 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2232 if(varPtr)
2233 bVal = varPtr->asInt() ? true : false;
2234 return bVal;
2237 sint32 CClientConfig::readIntNoWarning(const std::string &varName)
2239 sint32 bVal = 0;
2240 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2241 if(varPtr)
2242 bVal = varPtr->asInt();
2243 return bVal;
2246 double CClientConfig::readDoubleNoWarning(const std::string &varName)
2248 double bVal = 0;
2249 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2250 if(varPtr)
2251 bVal = varPtr->asDouble();
2252 return bVal;
2255 // ***************************************************************************
2256 float CClientConfig::getActualLandscapeThreshold() const
2258 // The threshold to set in landscape is the inverse of the CFG one
2259 return 1.0f/LandscapeThreshold;
2262 // ***************************************************************************
2263 string CClientConfig::getHtmlLanguageCode() const
2265 if(LanguageCode=="wk")
2266 return "en";
2267 else
2268 return LanguageCode;
2271 // ***************************************************************************
2272 string CClientConfig::buildLoadingString( const string& ucstr ) const
2274 if( LoadingStringCount > 0 )
2276 uint index = rand()%LoadingStringCount;
2277 string tipId = "uiLoadingString" + toString(index);
2278 return CI18N::get(tipId);
2280 else
2281 return ucstr;
2284 // ***************************************************************************
2285 bool CClientConfig::getDefaultConfigLocation(std::string& p_name) const
2287 std::string defaultConfigFileName = "client_default.cfg";
2288 std::string defaultConfigPath;
2290 p_name.clear();
2292 #ifdef NL_OS_MAC
2293 // on mac, client_default.cfg should be searched in .app/Contents/Resources/
2294 defaultConfigPath = getAppBundlePath() + "/Contents/Resources/";
2295 #else
2296 // unders Windows or Linux, search client_default.cfg is same directory as executable
2297 defaultConfigPath = Args.getProgramPath();
2298 #endif
2300 std::string currentPath = CPath::standardizePath(CPath::getCurrentPath());
2301 std::string etcPath = CPath::standardizePath(getRyzomEtcPrefix());
2303 // look in the current working directory first
2304 if (CFile::isExists(currentPath + defaultConfigFileName))
2305 p_name = currentPath + defaultConfigFileName;
2307 // look in startup directory
2308 else if (CFile::isExists(Args.getStartupPath() + defaultConfigFileName))
2309 p_name = Args.getStartupPath() + defaultConfigFileName;
2311 // look in application directory
2312 else if (CFile::isExists(defaultConfigPath + defaultConfigFileName))
2313 p_name = defaultConfigPath + defaultConfigFileName;
2315 // look in etc prefix path
2316 else if (!etcPath.empty() && CFile::isExists(etcPath + defaultConfigFileName))
2317 p_name = etcPath + defaultConfigFileName;
2319 // if some client_default.cfg was found return true
2320 return !p_name.empty();