Add infos into target window
[ryzomcore.git] / ryzom / client / src / client_cfg.cpp
blobe5a8b662bae949ab1a32c49194e518a32f8f987b
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2020 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 MonitorName = "";
306 Width = 0; // Default Width for the window (0 = current screen resolution).
307 Height = 0; // Default Height for the window (0 = current screen resolution).
308 Depth = 32; // Default Bit per Pixel.
309 Driver3D = DrvAuto; // Select best driver depending on hardware.
310 Contrast = 0.f; // Default Monitor Contrast.
311 Luminosity = 0.f; // Default Monitor Luminosity.
312 Gamma = 0.f; // Default Monitor Gamma.
314 InterfaceScale = 1.0f; // Resize UI
315 InterfaceScale_min = 0.8f;
316 InterfaceScale_max = 2.0f;
317 InterfaceScale_step = 0.05;
318 InterfaceScaleAuto = false;
319 BilinearUI = true;
321 WindowSnapInvert = false;
322 WindowSnapDistance = 10;
324 VREnable = false;
325 VRDisplayDevice = "Auto";
326 VRDisplayDeviceId = "";
328 Local = false; // Default is Net Mode.
329 FSHost = ""; // Default Host.
331 TexturesInterface.push_back("texture_interfaces_v3_2x");
332 TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc_2x");
334 TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui");
336 TexturesLoginInterface.push_back("texture_interfaces_v3_login");
338 DisplayAccountButtons = true;
339 CreateAccountURL = RYZOM_CLIENT_CREATE_ACCOUNT_URL; // "https://open.ryzom.dev/ams/";
340 EditAccountURL = RYZOM_CLIENT_EDIT_ACCOUNT_URL; // "https://open.ryzom.dev/ams/";
341 ForgetPwdURL = RYZOM_CLIENT_FORGET_PASSWORD_URL; // "https://open.ryzom.dev/ams/";
342 Position = CVector(0.f, 0.f, 0.f); // Default Position.
343 Heading = CVector(0.f, 1.f, 0.f); // Default Heading.
344 EyesHeight = 1.5f; // Default User Eyes Height.
345 Walk = 1.66f; // Default Velocity for the Walk.
346 Run = 6.0f; // Default Velocity for the Run.
347 Fly = 25.0f; // Default Velocity for the Fly.
348 DmWalk = 6.0f; // Default Velocity for the Walk in Ring/DM or Ring/Editor.
349 DmRun = 20.0f; // Default Velocity for the Run in Ring/DM or Ring/Editor.
351 FlyAccel = 1000.f; // Default Acceleration for the fly, in m.s-2
353 AllowDebugCommands = false; // Add debug commands at startup
355 ForceDeltaTime = 0; // Default ForceDeltaTime, disabled by default
357 HardwareCursor = true; // Default HardwareCursor
358 HardwareCursorScale = 0.85f;
359 CursorSpeed = 1.f; // Default CursorSpeed
360 CursorAcceleration = 0; // Default CursorAcceleration
361 FreeLookSpeed = 0.001f; // Default FreeLookSpeed
362 FreeLookAcceleration = 0; // Default FreeLookAcceleration
363 FreeLookSmoothingPeriod = 0.f; // when in absolute mode, free look factor is used instead of speed, the mouse gives the absolute angle
364 FreeLookInverted = false;
365 FreeLookTablet = false; // Mouse reports absolute coordinates, so avoid mouse recentering
366 AutomaticCamera = true;
367 DblClickMode = true; // when in dbl click mode, a double click is needed to execute default contextual action
368 AutoEquipTool = true; // when true player will auto-equip last used weapon or forage tool when doing an action
370 BGColor = CRGBA(100,100,255); // Default Background Color.
371 LandscapeTileNear = 50.0f; // Default Landscape Tile Near.
372 LandscapeThreshold = 1000.0f; // Default Landscape Threshold.
373 Vision = 500.f; // Player vision.
374 Vision_min = 200.f; // Player vision min.
375 Vision_max = 800.f; // Player vision max.
376 SkinNbMaxPoly = 40000;
377 FxNbMaxPoly = 10000;
378 Cloud = true;
379 CloudQuality = 160.0f;
380 CloudUpdate = 1;
381 NbMaxSkeletonNotCLod= 20;
382 CharacterFarClip = 200.f;
383 ScreenAspectRatio = 0.f; // Default commmon Screen Aspect Ratio (no relation with the resolution) - 0.f = auto
384 FoV = 75.f; // Default value for the FoV.
385 ForceDXTC = false; // Default is no DXTC Compression.
386 AnisotropicFilter = 0; // Default is disabled (-1 = maximum value, 0 = disabled, 1+ = enabled)
387 DivideTextureSizeBy2= false; // Divide texture by 2
388 DisableVtxProgram = false; // Disable Hardware Vertex Program.
389 DisableVtxAGP = false; // Disable Hardware Vertex AGP.
390 DisableTextureShdr = false; // Disable Hardware Texture Shader.
391 MicroVeget = true; // Default is with MicroVeget.
392 MicroVegetDensity = 100.0f;
393 HDEntityTexture = false;
394 HDTextureInstalled = false;
395 Fog = true; // Fog is on by default
396 WaitVBL = false;
397 VideoMemory = 0;
399 FXAA = true;
401 Bloom = true;
402 SquareBloom = true;
403 DensityBloom = 255.f;
405 GlobalWindPower = 0.10f; // Default is 0.25
406 GlobalWindDirection = CVector(1,0,0); // Default direction is X>0
408 MovieShooterMemory = 0; // MovieShooter disabled
409 MovieShooterFramePeriod = 0.040f; // default is 25 fps
410 MovieShooterBlend = false;
411 MovieShooterFrameSkip = 0; // default not skip frame
412 MovieShooterPrefix = "shot_";
414 CameraRecorderPrefix = "cam_rec";
415 CameraRecorderBlend = true;
417 ScreenShotDirectory = "screenshots";
418 ScreenShotWidth = 0;
419 ScreenShotHeight = 0;
420 ScreenShotFullDetail = true;
421 ScreenShotZBuffer = false;
423 MaxNumberOfTimedFXInstances = 20;
424 SelectionFX = "sfx_selection_mouseover.ps";
425 MouseOverFX = "sfx_selection_mouseover.ps";
426 SelectionFXSize = 0.8f;
428 #if RZ_USE_PATCH
429 PatchWanted = true;
430 #else
431 PatchWanted = false;
432 #endif
434 PatchUrl.clear();
435 PatchletUrl.clear();
436 PatchVersion.clear();
438 WebIgMainDomain = RYZOM_WEBIG_MAIN_URL; // https://open.ryzom.dev/"
439 WebIgTrustedDomains.push_back(RYZOM_WEBIG_TRUSTED_DOMAIN); // open.ryzom.dev
440 WebIgNotifInterval = 10; // time in minutes
442 CurlMaxConnections = 5;
443 CurlCABundle.clear();
445 RingReleaseNotePath = WebIgMainDomain + "/app_releasenotes/index.php";
446 ReleaseNotePath = WebIgMainDomain + "/app_releasenotes/index.php";
449 ///////////////
450 // ANIMATION //
451 // With a bigger angle, rotation is animated.
452 AnimatedAngleThreshold = 25.0; //
453 BlendFrameNumber = 5; //
454 DestThreshold = 0.01; // Destination Threshold
455 PositionLimiterRadius = 0.1;
456 SignificantDist = 0.0001; // Significant Distance
457 ///////////
458 // SOUND //
459 SoundOn = true; // Default is with sound.
460 DriverSound = SoundDrvAuto;
461 SoundForceSoftwareBuffer = true;
462 StartMusic = "main theme air.ogg"; // Use at game startup (originally no music)
463 EmptySlotMusic = "loading music loop.ogg"; // Use in character selection for empty slots
464 LoadingMusic = "main menu loop.ogg"; // Main loading used after leaving character selection, and when going back to character selection
465 KamiTeleportMusic = "kami teleport.ogg"; // Kami teleport
466 KaravanTeleportMusic = "karavan teleport.ogg"; // Karavan teleport
467 TeleportLoadingMusic = "loading music loop.ogg"; // Use for generic teleportations
468 DeathMusic = "death.ogg"; // Player death
469 SoundSFXVolume = 1.f;
470 SoundGameMusicVolume = 1.f;
471 SoundTPFade = 500;
472 EnableBackgroundMusicTimeConstraint = true;
474 SoundPackedSheetPath= "data/sound/"; // Default path for sound packed sheets
475 SampleBankDir = "data/sound/samplebanks"; // Default path for samples
476 UserEntitySoundLevel = 0.5f; // Default volume for sound in 1st person
477 UseEax = true; // Default to use EAX;
478 UseADPCM = false; // Defualt to PCM sample, NO ADPCM
479 MaxTrack = 32; // Default to 32 track
481 ColorShout = CRGBA(150,0,0,255); // Default Shout color.
482 ColorTalk = CRGBA(255,255,255,255); // Default Talk color.
484 StreamedPackagePath = "stream";
486 // MP3 player
487 MediaPlayerDirectory = "music";
488 MediaPlayerAutoPlay = false;
490 // PreDataPath.push_back("data/gamedev/language/"); // Default Path for the language data
492 // DataPath.push_back("data/"); // Default Path for the Data.
493 // DataPath.push_back("data_leveldesign/"); // Default Path for the Level Design Directory.
494 // DataPath.push_back("data_common/"); // Default Path for the Level Design Directory.
496 DataPathNoRecurse.push_back("data_leveldesign/leveldesign/Game_Elem");
498 UpdatePackedSheetPath.push_back("data_leveldesign");
500 UpdatePackedSheet = false; // Update packed sheet if needed
502 EndScreenTimeOut = 0.f; // Default time out for the screen at the end of the application.
503 Loading_BG = "loading_bg.tga"; // Default name for the loading background file.
504 LoadingFreeTrial_BG = "loading_free_trial_bg.tga"; // Default name for the loading background file in FreeTrial mode.
505 Launch_BG = "launcher_bg.tga"; // Default name for the launch background file.
506 TeleportKami_BG = "teleport_kami_bg.tga";
507 TeleportKaravan_BG = "teleport_caravan_bg.tga";
508 Elevator_BG = "elevator_bg.tga"; // Default name for the loading background file.
509 ResurectKami_BG = "resurect_kami_bg.tga";
510 ResurectKaravan_BG = "resurect_caravane_bg.tga";
511 End_BG = "end_bg.tga"; // Default name for the last background file.
512 IntroNevrax_BG = "launcher_nevrax.tga";
513 IntroNVidia_BG = "launcher_nvidia.tga";
515 TipsY = 0.07f;
516 TeleportInfoY = 0.23f;
518 SceneName = "";
519 IdFilePath = "sheet_id.bin";
520 PacsPrimDir.push_back("data/3d/");
522 Shadows = true; // Draw Shadows by default.
523 ShadowsClipFar = 10.f; // Shadows are disabled after this distance.
524 ShadowsLodDist = 3.f; // Shadows draw with just 1 part after this distance.
525 ShadowZDirClampLandscape = -0.5f; // On landscape, allow a minimum Phi angle of -30 degrees
526 ShadowZDirClampInterior = -0.86f; // On Interior, allow a minimum Phi angle of -60 degrees
527 ShadowZDirClampSmoothSpeed = 0.5f;
528 ShadowMaxDepthLandscape = 8.f;
529 ShadowMaxDepthInterior = 2.f;
530 ShadowMaxDepthSmoothSpeed = 6.f;
533 Names = false; // Don't draw Names by default.
535 Sleep = -1; // Default : client does not sleep.
536 ProcessPriority = 0; // Default : NORMAL
537 CPUMask = 0; // Default : auto detection
538 ShowPath = false; // Default : do not display the path.
539 DrawBoxes = false; // Default : Do not draw the selection.
541 UserSheet = "fyros.race_stats"; // Default sheet used.
542 Sex = GSGENDER::male; // Default : male.
544 PrimitiveHeightAddition = 2.f; // Default : 2.f
546 AttackDist = 0.5f;
547 RyzomDay = 0;
548 RyzomTime = 0.0f;
550 ManualWeatherSetup = false;
552 ChaseReactionTime = 0.4f; // Reaction time before chasing someone.
554 TimeToAdjustCamera = 1000.0;
555 ChangeDirAngle = 1.70f; // Default Angle.
557 GuildSymbolSize = 0.3f; // Default Guild Symbol Size.
558 SelectionDist = 150.f; // Default dist in meter.
559 SelectionOutBBoxWeight = 16.f; // Default factor
560 LootDist = 4.f; // Default loot/harvest distance (in meter).
561 SpaceSelectionDist = 50.f;
562 SpaceSelectionMaxCycle = 1;
564 ForceLanguage = false;
565 LanguageCode = "en"; // Default to english
566 DebugStringManager = false; // Default to no debug
568 // TUNING
569 WaterOffset = -1.085f;
570 FyrosWaterOffset = -1.0f;
571 MatisWaterOffset = -1.08f;
572 TrykerWaterOffset = -0.88f;
573 ZoraiWaterOffset = -1.25f;
574 WaterOffsetCreature = -1.6f;
575 TimeToRemoveCol = 1000;
576 MoveToTimeToStopStall = 500;
577 TPVMinPitch = -1.5f;
578 TPVMaxPitch = 1.5f;
579 MaxHeadTargetDist = 30.0f;
580 DeadFXName = "misc_dead.ps";
581 ImpactFXName = "impact.ps";
582 SkillUpFXName = "misc_levelup.ps";
583 MinDistFactor = 0.5;
584 NameScale = 1.0f; // Default Scale to display Names.
585 NamePos = 0.02f;
586 NameFontSize = 20;
587 MaxNameDist = 50.0f;
588 ConstNameSizeDist = 20.0f;
589 StaticNameHeight = true;
590 BarsHeight = 0.002f;
591 BarsWidth = 0.05f;
592 FightAreaSize = 1.5;
593 BubbleZBias = -3.f;
594 ForageInterfaceZBias= -10.f;
595 FyrosScale = 1.0f;
596 MatisScale = 1.08f;
597 TrykerScale = 0.88f;
598 ZoraiScale = 1.25f;
599 EnableRacialAnimation = true;
601 // OPTIONS
602 RunAtTheBeginning = true;
603 SelectWithRClick = false; // Default right click cannot select.
604 RotKeySpeedMax = 3.0f;
605 RotKeySpeedMin = 1.0f;
606 RotAccel = 0.001f;
607 PutBackItems = false;
608 ShowNameUnderCursor = true;
609 ShowNameSelected = true;
610 ShowNameBelowDistanceSqr = 20.f * 20.f;
611 ForceIndoorFPV = false;
612 FollowOnAtk = true;
613 AtkOnSelect = false;
614 TransparentUnderCursor = false;
615 ItemGroupAllowGuild = false;
616 // PREFERENCES
617 FPV = false;
618 CameraHeight = 2.5f;
619 CameraDistance = 3.0f;
620 CameraDistStep = 1.0f;
621 CameraDistMin = 1.0f;
622 CameraDistMax = 100.0f;
623 DmCameraDistMax = 25.0f;
624 CameraAccel = 0.2f;
625 CameraSpeedMin = 0.2f;
626 CameraSpeedMax = 1.0f;
627 CameraResetSpeed = 2.0f;
629 MaxMapScale = 2.0f;
630 R2EDMaxMapScale = 8.0f;
632 TargetChangeCompass = true;
634 // VERBOSES
635 VerboseVP = false;
636 VerboseAnimUser = false;
637 VerboseAnimSelection = false;
638 VerboseAllTraffic = false;
640 // DEBUG
641 DisplayMissingAnimFile = false;
642 DefaultEntity = "ccafb1.creature";
643 RestrainPI = true;
644 DumpVSIndex = false;
645 HelpFontSize = 12;
646 HelpFontColor = CRGBA(255,255,255);
647 HelpLineStep = 0.025f;
648 DebugFontSize = 16;
649 DebugFontColor = CRGBA(250, 250, 250);
650 DebugLineStep = 0.02f;
651 HeadOffset = CVector(0.f, 0.f, 0.f);
652 Check = false;
653 BlendForward = true;
655 FPExceptions = false; // Disable Floating Point Exceptions.
656 DisplayWeapons = false; // Do not dusplay weapons in first person.
657 NeedComputeVS = false; // Do not need to compute Visual Slots.
659 GroundFXMaxDist = 40.f;
660 GroundFXMaxNB = 10;
661 GroundFXCacheSize = 10;
663 AutoReloadFiles = false;
664 BlendShapePatched = true;
665 ExtendedCommands = false;
667 WaterEnvMapUpdateTime = 1.f;
669 NumFrameForProfile = 0;
670 SimulateServerTick = false;
671 TimerMode= 0;
673 KlientChatPort= "";
675 PreCacheShapes = true;
676 ResetShapeBankOnRetCharSelect = false;
677 LandscapeEnabled = true;
678 VillagesEnabled = true;
679 EAMEnabled = true;
680 CacheUIParsing = false;
681 MicroLifeEnabled = true;
683 SkipEULA = false;
685 StageLCTUsage= StageUsePosOnlyLCT;
687 SimulatePacketLossRatio= 0;
689 CheckMemoryEveryNFrame= -1;
690 LogMemoryAllocation=false;
691 LogMemoryAllocationSize=8;
693 DamageShieldEnabled = false;
695 LevelDesignEnabled = false;
697 R2Mode = true;
698 R2EDEnabled = false;
699 R2EDExtendedDebug = false;
700 R2EDVerboseParseTime = false;
701 R2EDDontReparseUnchangedUIFiles = false;
702 R2EDLightPalette = false;
703 R2EDAutoSaveWait = 60*5;
704 R2EDAutoSaveSlot = 9;
705 R2EDMustVerifyRingAccessWhileLoadingAnimation = false;
706 R2EDUseVerboseRingAccess = false;
707 R2EDDssNetwork = 3;
709 DamageShieldEnabled = false;
711 AllowDebugLua = false;
712 DisplayLuaDebugInfo = false;
713 BeepWhenLaunched = false;
717 LoadingStringCount = 0;
719 LuaDebugInfoGotoButtonEnabled = false;
721 FogDistAndDepthLookupBias = 0.f;
723 R2EDLoadDynamicFeatures = 0;
725 CheckR2ScenarioMD5 = true;
727 DisplayTPReason = false;
729 //TPCancelButtonX = 988;
730 //TPCancelButtonY = 138;
731 //TPQuitButtonX = 8;
732 //TPQuitButtonY = 138;
733 TPButtonW = 32;
734 TPButtonH = 32;
736 //SAVE
737 ScenarioSavePath = "./my_scenarios/";
739 R2EDClippedEntityBlendTime = 0.18f;
741 BackgroundDownloader = false;
743 }// CClientConfig //
746 //---------------------------------------------------
747 // load :
748 // Load the client config file.
749 //---------------------------------------------------
750 void CClientConfig::setValuesOnFileChange()
752 // ClientCfg.ConfigFile.print (InfoLog);
754 // display an info only when the file change
755 nlinfo ("reloading the config file!");
757 setValues();
760 //---------------------------------------------------
761 // load :
762 // Load the client config file.
763 //---------------------------------------------------
764 void CClientConfig::setValues()
766 CConfigFile::CVar *varPtr = 0;
767 static bool firstTimeSetValues= true;
769 //////////////////////
770 // INTERFACE CONFIG //
771 // input files
772 READ_STRING_FV(XMLInputFile)
775 READ_BOOL_FV(SkipIntro);
776 READ_BOOL_DEV(SkipEULA);
777 READ_INT_DEV(SelectCharacter);
779 READ_INT_FV(SelectedSlot);
780 if( ClientCfg.SelectedSlot>4 )
782 ClientCfg.SelectedSlot = 0;
785 // interface textures login menus
786 READ_STRINGVECTOR_FV(TexturesLoginInterface);
787 READ_STRINGVECTOR_FV(TexturesLoginInterfaceDXTC);
789 // interface textures outgame menus
790 READ_STRINGVECTOR_FV(TexturesOutGameInterface);
791 READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC);
793 // interface textures ingame and r2
794 //READ_STRINGVECTOR_FV(TexturesInterface);
795 //READ_STRINGVECTOR_FV(TexturesInterfaceDXTC);
797 // interface files login menus
798 READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles);
800 // interface files outgame menus
801 READ_STRINGVECTOR_FV(XMLOutGameInterfaceFiles);
803 // interface files
804 READ_STRINGVECTOR_FV(XMLInterfaceFiles);
806 // r2ed interfaces
807 READ_STRINGVECTOR_FV(XMLR2EDInterfaceFiles);
809 // logos
810 READ_STRINGVECTOR_FV(Logos);
812 // browser test mode
813 READ_BOOL_DEV(TestBrowser);
814 READ_STRING_DEV(TestBrowserUrl);
816 // ClientLight
817 #if !FINAL_VERSION
818 varPtr = ClientCfg.ConfigFile.getVarPtr ("ClientLight");
819 if (varPtr)
820 ClientCfg.Light = varPtr->asInt() ? true : false;
821 #endif // !FINAL_VERSION
824 READ_BOOL_DEV(LandscapeEnabled)
825 READ_BOOL_DEV(VillagesEnabled)
826 READ_BOOL_DEV(EAMEnabled)
827 READ_BOOL_DEV(CacheUIParsing)
828 READ_BOOL_DEV(MicroLifeEnabled)
830 READ_BOOL_DEV(LevelDesignEnabled)
832 ///////////////////
833 // WINDOW CONFIG //
834 // Mode.
836 // SaveConfig
837 READ_BOOL_FV(SaveConfig)
839 // Window Positon
840 READ_INT_FV(PositionX)
841 READ_INT_FV(PositionY)
843 // Window frequency
844 READ_INT_FV(Frequency)
846 CConfigFile::CVar *pcvFullScreen = ClientCfg.ConfigFile.getVarPtr("FullScreen");
847 if( pcvFullScreen )
849 ClientCfg.Windowed = pcvFullScreen->asInt() ? false : true;
851 else
852 cfgWarning("Default value used for 'Fullscreen'");
854 READ_STRING_FV(MonitorName);
855 // Width
856 READ_INT_FV(Width)
857 // Height
858 READ_INT_FV(Height)
859 // Depth : Bit Per Pixel
860 READ_INT_FV(Depth)
861 // Contrast
862 READ_FLOAT_FV(Contrast)
863 // Luminosity
864 READ_FLOAT_FV(Luminosity)
865 // Gamma
866 READ_FLOAT_FV(Gamma)
867 // UI scaling
868 READ_BOOL_FV(InterfaceScaleAuto);
869 READ_FLOAT_FV(InterfaceScale);
870 READ_FLOAT_FV(InterfaceScale_min);
871 READ_FLOAT_FV(InterfaceScale_max);
872 READ_FLOAT_FV(InterfaceScale_step);
873 clamp(ClientCfg.InterfaceScale, ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max);
875 READ_BOOL_FV(BilinearUI);
876 READ_BOOL_FV(WindowSnapInvert);
877 READ_INT_FV(WindowSnapDistance);
878 // 3D Driver
879 varPtr = ClientCfg.ConfigFile.getVarPtr ("Driver3D");
880 if (varPtr)
882 if (nlstricmp(varPtr->asString(), "Auto") == 0 || nlstricmp(varPtr->asString(), "0") == 0) ClientCfg.Driver3D = CClientConfig::DrvAuto;
883 else if (nlstricmp(varPtr->asString(), "OpenGL") == 0 || nlstricmp(varPtr->asString(), "1") == 0) ClientCfg.Driver3D = CClientConfig::OpenGL;
884 else if (nlstricmp(varPtr->asString(), "Direct3D") == 0 || nlstricmp(varPtr->asString(), "2") == 0) ClientCfg.Driver3D = CClientConfig::Direct3D;
885 else if (nlstricmp(varPtr->asString(), "OpenGLES") == 0 || nlstricmp(varPtr->asString(), "3") == 0) ClientCfg.Driver3D = CClientConfig::OpenGLES;
887 else
888 cfgWarning ("Default value used for 'Driver3D' !!!");
890 READ_BOOL_FV(VREnable)
891 READ_STRING_FV(VRDisplayDevice)
892 READ_STRING_FV(VRDisplayDeviceId)
894 ////////////
895 // INPUTS //
896 READ_BOOL_FV(HardwareCursor)
897 READ_FLOAT_FV(HardwareCursorScale)
898 READ_FLOAT_FV(CursorSpeed)
899 READ_INT_FV(CursorAcceleration)
900 READ_FLOAT_FV(FreeLookSpeed)
901 READ_INT_FV(FreeLookAcceleration)
902 READ_FLOAT_FV(FreeLookSmoothingPeriod)
903 READ_BOOL_FV(FreeLookInverted)
904 READ_BOOL_FV(FreeLookTablet)
905 READ_BOOL_FV(AutomaticCamera)
906 READ_BOOL_FV(DblClickMode)
907 READ_BOOL_FV(AutoEquipTool)
909 /////////
910 // NET //
911 #if !FINAL_VERSION
912 // Local : local mode or network mode
913 READ_BOOL_DEV(Local)
914 #endif // FINAL_VERSION
915 // FSHost
916 READ_STRING_FV(FSHost)
918 READ_BOOL_DEV(DisplayAccountButtons)
921 READ_STRING_FV(CreateAccountURL)
922 READ_STRING_FV(EditAccountURL)
923 READ_STRING_FV(ForgetPwdURL)
925 READ_STRING_DEV(BetaAccountURL)
926 READ_STRING_DEV(FreeTrialURL)
928 // defined in client_default.cfg
929 READ_STRING_FV(LoginSupportURL)
931 // read NamingPolicyURL from client_default.cfg
932 //READ_STRING_FV(NamingPolicyURL)
934 std::string languageCo = "wk";
935 CConfigFile::CVar *languageCodeVarPtr = ClientCfg.ConfigFile.getVarPtr("LanguageCode");
937 if (languageCodeVarPtr)
939 languageCo = languageCodeVarPtr->asString();
942 CConfigFile::CVar *policyurl = ClientCfg.ConfigFile.getVarPtr("NamingPolicyURL");
944 if (policyurl)
946 for (uint i = 0; i < policyurl->size(); ++i)
948 std::string entry = policyurl->asString(i);
949 if (entry.size() >= languageCo.size())
951 if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0)
953 std::string::size_type pos = entry.find("=");
955 if (pos != std::string::npos)
957 ClientCfg.NamingPolicyURL = entry.substr(pos + 1);
964 // read NamingPolicyURL from client_default.cfg
965 //READ_STRING_FV(ConditionsTermsURL)
966 CConfigFile::CVar *coturl = ClientCfg.ConfigFile.getVarPtr("ConditionsTermsURL");
968 if (coturl)
970 for (uint i = 0; i < coturl->size(); ++i)
972 std::string entry = coturl->asString(i);
974 if (entry.size() >= languageCo.size())
976 if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0)
978 std::string::size_type pos = entry.find("=");
980 if (pos != std::string::npos)
982 ClientCfg.ConditionsTermsURL = entry.substr(pos + 1);
990 #ifndef RZ_NO_CLIENT
991 // if cookie is not empty, it means that the client was launch
992 // by the nel_launcher, so it can't be local
993 if(!Cookie.empty())
995 nlassert (!FSAddr.empty());
996 ClientCfg.Local = false;
998 else
1000 nlassert (FSAddr.empty());
1002 #endif
1004 /////////////////
1005 // USER ENTITY //
1006 READ_CVECTOR_DEV(Position)
1007 READ_CVECTOR_DEV(Heading)
1008 // EyesHeight
1009 READ_FLOAT_DEV(EyesHeight)
1011 // Walk
1012 READ_FLOAT_DEV(Walk)
1013 // Run
1014 READ_FLOAT_DEV(Run)
1016 //When editing or Dm ing a session in ring mode the player move quicker
1017 // DM Walk
1018 READ_FLOAT_DEV(DmWalk)
1019 // DM Run
1020 READ_FLOAT_DEV(DmRun)
1024 // Fly
1025 READ_FLOAT_DEV(Fly)
1026 READ_FLOAT_DEV(FlyAccel)
1028 READ_BOOL_FV(AllowDebugCommands)
1030 // ForceDeltaTime
1031 READ_INT_DEV(ForceDeltaTime)
1033 ////////////
1034 // RENDER //
1035 // Background Color
1036 #if !FINAL_VERSION
1037 CConfigFile::CVar *pcvBackColor = ClientCfg.ConfigFile.getVarPtr("Background");
1038 if( pcvBackColor && (pcvBackColor->size()==3) )
1040 ClientCfg.BGColor.R = pcvBackColor->asInt(0);
1041 ClientCfg.BGColor.G = pcvBackColor->asInt(1);
1042 ClientCfg.BGColor.B = pcvBackColor->asInt(2);
1043 ClientCfg.BGColor.A = 255;
1045 else
1046 cfgWarning("Default value used for 'Background'");
1047 #endif // !FINAL_VERSION
1048 // LandscapeTileNear
1049 READ_FLOAT_FV(LandscapeTileNear)
1050 // LandscapeThreshold
1051 READ_FLOAT_FV(LandscapeThreshold)
1052 // to be backward compatible, suppose a value<1 is for the old System!!! => invert it!
1053 if( ClientCfg.LandscapeThreshold<1)
1055 ClientCfg.LandscapeThreshold= 1.f/ ClientCfg.LandscapeThreshold;
1056 // must re-write in the CFG database, to be ok with the in-game configurator
1057 varPtr = ClientCfg.ConfigFile.getVarPtr("LandscapeThreshold");
1058 if(varPtr)
1059 varPtr->forceAsDouble(ClientCfg.LandscapeThreshold);
1061 // Vision
1062 READ_FLOAT_FV(Vision)
1063 READ_FLOAT_FV(Vision_min)
1064 READ_FLOAT_FV(Vision_max)
1065 // SkinNbMaxPoly
1066 READ_INT_FV(SkinNbMaxPoly)
1067 // FxNbMaxPoly
1068 READ_INT_FV(FxNbMaxPoly)
1069 READ_BOOL_FV(Cloud)
1070 READ_FLOAT_FV(CloudQuality)
1071 READ_INT_FV(CloudUpdate)
1072 // NbMaxSkeletonNotCLod
1073 READ_INT_FV(NbMaxSkeletonNotCLod)
1074 // CharacterFarClip
1075 READ_FLOAT_FV(CharacterFarClip)
1077 // Bloom
1078 READ_BOOL_FV(Bloom)
1079 READ_BOOL_FV(SquareBloom)
1080 READ_FLOAT_FV(DensityBloom)
1082 // FXAA
1083 READ_BOOL_FV(FXAA)
1085 // ScreenAspectRatio.
1086 READ_FLOAT_FV(ScreenAspectRatio)
1087 // FoV.
1088 READ_FLOAT_FV(FoV)
1089 // ForceDXTC
1090 READ_BOOL_FV(ForceDXTC)
1091 // AnisotropicFilter
1092 READ_INT_FV(AnisotropicFilter)
1093 // DivideTextureSizeBy2
1094 READ_BOOL_FV(DivideTextureSizeBy2)
1095 // DisableVtxProgram
1096 READ_BOOL_FV(DisableVtxProgram)
1097 // DisableVtxAGP
1098 READ_BOOL_FV(DisableVtxAGP)
1099 // DisableTextureShdr
1100 READ_BOOL_FV(DisableTextureShdr)
1101 // MicroVeget
1102 READ_BOOL_FV(MicroVeget)
1103 // MicroVeget Density
1104 READ_FLOAT_FV(MicroVegetDensity)
1105 // GlobalWindPower: Global Wind Power
1106 READ_FLOAT_DEV(GlobalWindPower)
1107 // Global Wind Direction
1108 READ_CVECTOR_DEV(GlobalWindDirection)
1109 // HDEntityTexture
1110 READ_BOOL_FV(HDEntityTexture)
1111 // HDTextureInstalled
1112 READ_BOOL_FV(HDTextureInstalled)
1114 // Fog
1115 READ_BOOL_DEV(Fog)
1117 // WaitVBL
1118 READ_BOOL_FV(WaitVBL)
1119 // VideoMemory
1120 READ_INT_FV(VideoMemory);
1122 READ_INT_DEV(TimerMode)
1124 // MovieShooterMemory
1125 CConfigFile::CVar *pcv = ClientCfg.ConfigFile.getVarPtr("MovieShooterMemory");
1126 if( pcv )
1128 ClientCfg.MovieShooterMemory = pcv->asInt();
1129 // Transform to octet
1130 ClientCfg.MovieShooterMemory *= 1024*1024;
1132 else
1133 cfgWarning("'MovieShooterMemory' not found => MovieShooter Disabled");
1134 // MovieShooterPath
1135 READ_STRING_FV(MovieShooterPath)
1136 // MovieShooterFramePeriod
1137 READ_FLOAT_FV(MovieShooterFramePeriod)
1138 // MovieShooterBlend
1139 READ_BOOL_FV(MovieShooterBlend)
1140 // MovieShooterFrameSkip
1141 READ_INT_FV(MovieShooterFrameSkip)
1143 // Camera Recorder
1144 READ_STRING_FV(CameraRecorderPath)
1145 READ_STRING_FV(CameraRecorderPrefix)
1146 READ_BOOL_FV(CameraRecorderBlend)
1148 // Screenshot
1149 READ_STRING_FV(ScreenShotDirectory)
1150 READ_INT_FV(ScreenShotWidth)
1151 READ_INT_FV(ScreenShotHeight)
1152 READ_BOOL_FV(ScreenShotFullDetail)
1153 READ_BOOL_FV(ScreenShotZBuffer)
1155 /////////////////////////
1156 // NEW PATCHING SYSTEM //
1157 READ_BOOL_FV(PatchWanted)
1159 #ifdef RZ_USE_CUSTOM_PATCH_SERVER
1160 READ_STRING_FV(PatchUrl)
1161 READ_STRING_FV(PatchVersion)
1162 READ_STRING_FV(RingReleaseNotePath)
1163 READ_STRING_FV(ReleaseNotePath)
1164 #else
1165 READ_STRING_DEV(PatchUrl)
1166 READ_STRING_DEV(PatchVersion)
1167 READ_STRING_DEV(RingReleaseNotePath)
1168 READ_STRING_DEV(ReleaseNotePath)
1169 #endif
1171 /////////////////////////
1172 // NEW PATCHLET SYSTEM //
1173 READ_STRING_FV(PatchletUrl)
1175 ///////////
1176 // WEBIG //
1177 READ_STRING_FV(WebIgMainDomain);
1178 if (ClientCfg.WebIgMainDomain.find("http://") == std::string::npos
1179 || ClientCfg.WebIgMainDomain.find("https://") == std::string::npos)
1180 ClientCfg.WebIgMainDomain = "http://" + ClientCfg.WebIgMainDomain;
1181 READ_STRINGVECTOR_FV(WebIgTrustedDomains);
1182 READ_INT_FV(WebIgNotifInterval);
1183 READ_INT_FV(CurlMaxConnections);
1184 if (ClientCfg.CurlMaxConnections < 0)
1185 ClientCfg.CurlMaxConnections = 2;
1187 READ_STRING_FV(CurlCABundle);
1188 if (!ClientCfg.CurlCABundle.empty() && ClientCfg.CurlCABundle[0] == '%') // Path is relative to client_default.cfg path (used by ryzom patch)
1190 string defaultConfigFileName;
1191 if (ClientCfg.getDefaultConfigLocation(defaultConfigFileName))
1192 ClientCfg.CurlCABundle = CFile::getPath(defaultConfigFileName)+ClientCfg.CurlCABundle.substr(1);
1195 ///////////////
1196 // ANIMATION //
1197 // AnimatedAngleThreshold
1198 READ_DOUBLE_DEV(AnimatedAngleThreshold)
1199 // BlendFrameNumber
1200 READ_INT_DEV(BlendFrameNumber)
1201 // DestThreshold
1202 READ_DOUBLE_DEV(DestThreshold)
1203 // PositionLimiterRadius
1204 READ_DOUBLE_DEV(PositionLimiterRadius)
1205 // SignificantDist
1206 READ_DOUBLE_DEV(SignificantDist)
1207 // Stage LCT usage
1208 READ_ENUM_ASINT_DEV(TStageLCTUsage, StageLCTUsage)
1210 ////////////
1211 // TUNING //
1212 // Water Offset
1213 READ_FLOAT_DEV(WaterOffset)
1215 #if !FINAL_VERSION
1216 READ_FLOAT_DEV(FyrosWaterOffset)
1217 READ_FLOAT_DEV(MatisWaterOffset)
1218 READ_FLOAT_DEV(TrykerWaterOffset)
1219 READ_FLOAT_DEV(ZoraiWaterOffset)
1220 #endif // FINAL_VERSION
1222 // Water Offset for creature
1223 READ_FLOAT_DEV(WaterOffsetCreature)
1224 // TimeToRemoveCol
1225 READ_INT_DEV(TimeToRemoveCol)
1226 // MoveToTimeToStopStall
1227 READ_INT_DEV(MoveToTimeToStopStall)
1228 // TimeToAdjustCamera
1229 READ_DOUBLE_DEV(TimeToAdjustCamera)
1230 // ChangeDirAngle
1231 READ_DOUBLE_DEV(ChangeDirAngle)
1232 // GuildSymbolSize
1233 READ_FLOAT_DEV(GuildSymbolSize)
1234 // SelectionDist
1235 READ_FLOAT_DEV(SelectionDist)
1236 // SelectionOutBBoxWeight
1237 READ_FLOAT_DEV(SelectionOutBBoxWeight)
1238 // LootDist
1239 READ_FLOAT_DEV(LootDist)
1240 // SpaceSelectionDist
1241 READ_FLOAT_DEV(SpaceSelectionDist)
1242 // SpaceSelectionMaxCycle
1243 READ_INT_DEV(SpaceSelectionMaxCycle)
1244 // Third Person View Min Pitch.
1245 READ_FLOAT_DEV(TPVMinPitch)
1246 // Third Person View Max Pitch.
1247 READ_FLOAT_DEV(TPVMaxPitch)
1248 // The character look at the target before this distance.
1249 READ_FLOAT_DEV(MaxHeadTargetDist)
1250 // FX played when dead
1251 READ_STRING_DEV(DeadFXName)
1252 // FX played for each impact
1253 READ_STRING_DEV(ImpactFXName)
1254 // FX Played at skill up
1255 READ_STRING_DEV(SkillUpFXName)
1256 // MinDistFactor
1257 READ_DOUBLE_DEV(MinDistFactor)
1258 // NameScale
1259 READ_FLOAT_DEV(NameScale)
1260 // NamePos
1261 READ_FLOAT_DEV(NamePos)
1262 // NameFontSize
1263 READ_INT_DEV(NameFontSize)
1264 // MaxNameDist
1265 READ_FLOAT_DEV(MaxNameDist)
1266 // ConstNameSizeDist
1267 READ_FLOAT_DEV(ConstNameSizeDist)
1268 // StaticNameHeight
1269 READ_BOOL_FV(StaticNameHeight)
1270 // BarsHeight
1271 READ_FLOAT_DEV(BarsHeight)
1272 // BarsWidth
1273 READ_FLOAT_DEV(BarsWidth)
1274 // DisplayWeapons
1275 READ_BOOL_FV(DisplayWeapons)
1276 // FightAreaSize
1277 READ_DOUBLE_DEV(FightAreaSize)
1278 // AttackDist
1279 READ_FLOAT_DEV(AttackDist)
1280 // BubbleZBias
1281 READ_FLOAT_DEV(BubbleZBias);
1282 // ForageInterfaceZBias
1283 READ_FLOAT_DEV(ForageInterfaceZBias);
1285 // EnableRacialAnimation
1286 READ_BOOL_FV(EnableRacialAnimation);
1288 #if !FINAL_VERSION
1289 READ_FLOAT_DEV(FyrosScale);
1290 READ_FLOAT_DEV(MatisScale);
1291 READ_FLOAT_DEV(TrykerScale);
1292 READ_FLOAT_DEV(ZoraiScale);
1294 #endif // FINAL_VERSION
1296 //////////////////
1297 // SOUND CONFIG //
1298 // SoundOn
1299 READ_BOOL_FV(SoundOn)
1300 // Sound Driver
1301 varPtr = ClientCfg.ConfigFile.getVarPtr ("DriverSound");
1302 if (varPtr)
1304 if (nlstricmp(varPtr->asString(), "Auto") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvAuto;
1305 else if (nlstricmp(varPtr->asString(), "OpenAL") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvOpenAL;
1306 else if (nlstricmp(varPtr->asString(), "DirectSound") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvDirectSound;
1307 else if (nlstricmp(varPtr->asString(), "XAudio2") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvXAudio2;
1309 else
1310 cfgWarning ("Default value used for 'DriverSound' !!!");
1311 // SoundForceSoftwareBuffer
1312 READ_BOOL_FV(SoundForceSoftwareBuffer);
1313 // SoundOutGameMusic
1314 READ_STRING_DEV(StartMusic)
1315 READ_STRING_DEV(EmptySlotMusic)
1316 READ_STRING_DEV(LoadingMusic)
1317 READ_STRING_DEV(KamiTeleportMusic)
1318 READ_STRING_DEV(KaravanTeleportMusic)
1319 READ_STRING_DEV(TeleportLoadingMusic)
1320 READ_STRING_DEV(DeathMusic)
1321 // SoundSFXVolume
1322 READ_FLOAT_FV(SoundSFXVolume);
1323 // SoundGameMusicVolume
1324 READ_FLOAT_FV(SoundGameMusicVolume);
1325 // SoundTPFade
1326 READ_INT_DEV(SoundTPFade);
1327 // EnableBackgroundMusicTimeConstraint
1328 READ_BOOL_DEV(EnableBackgroundMusicTimeConstraint);
1329 // SoundPackedSheetPath
1330 READ_STRING_DEV(SoundPackedSheetPath)
1331 // SampleBankDir
1332 READ_STRING_DEV(SampleBankDir)
1333 // UserEntitySoundLevel : UserEntity sound level
1334 READ_FLOAT_FV(UserEntitySoundLevel)
1335 // Use EAX
1336 READ_BOOL_FV(UseEax)
1337 // UseADPCM
1338 READ_BOOL_DEV(UseADPCM)
1339 // Max track
1340 READ_INT_FV(MaxTrack)
1342 // MP3 Player
1343 READ_STRING_FV(MediaPlayerDirectory);
1344 READ_BOOL_FV(MediaPlayerAutoPlay);
1346 /////////////////
1347 // USER COLORS //
1348 // Shout Color
1349 CConfigFile::CVar *pcvColorShout = ClientCfg.ConfigFile.getVarPtr("ColorShout");
1350 if( pcvColorShout && (pcvColorShout->size() == 3) )
1352 ClientCfg.ColorShout.R = pcvColorShout->asInt(0);
1353 ClientCfg.ColorShout.G = pcvColorShout->asInt(1);
1354 ClientCfg.ColorShout.B = pcvColorShout->asInt(2);
1355 ClientCfg.ColorShout.A = 255;
1357 else
1358 cfgWarning("Default value used for 'ColorShout'");
1360 // Talk Color
1361 CConfigFile::CVar *pcvColorTalk = ClientCfg.ConfigFile.getVarPtr("ColorTalk");
1362 if( pcvColorTalk && (pcvColorTalk->size() == 3) )
1364 ClientCfg.ColorTalk.R = pcvColorTalk->asInt(0);
1365 ClientCfg.ColorTalk.G = pcvColorTalk->asInt(1);
1366 ClientCfg.ColorTalk.B = pcvColorTalk->asInt(2);
1367 ClientCfg.ColorTalk.A = 255;
1369 else
1370 cfgWarning("Default value used for 'ColorTalk'");
1372 //////////
1373 // MISC //
1375 // Pre Data Path.
1376 READ_STRINGVECTOR_FV(PreDataPath);
1378 // Data Path.
1379 READ_STRINGVECTOR_FV(DataPath);
1381 // Data Path no recurse.
1382 READ_STRINGVECTOR_FV(DataPathNoRecurse);
1384 // Pre-load path
1385 READ_STRING_DEV(PreLoadPath);
1387 // Streamed package path
1388 READ_STRING_FV(StreamedPackagePath);
1390 // Streamed package hosts
1391 READ_STRINGVECTOR_FV(StreamedPackageHosts);
1393 // List of files that trigger R2ED reload when touched
1394 READ_STRINGVECTOR_FV(R2EDReloadFiles);
1396 // Update packed sheet Path
1397 READ_STRINGVECTOR_FV(UpdatePackedSheetPath);
1399 // UpdatePackedSheet
1400 READ_BOOL_DEV(UpdatePackedSheet)
1402 // EndScreenTimeOut
1403 READ_FLOAT_DEV(EndScreenTimeOut)
1404 // Backgrounds
1405 READ_STRING_FV(Loading_BG)
1406 READ_STRING_FV(LoadingFreeTrial_BG)
1407 READ_STRING_FV(Launch_BG)
1408 READ_STRING_FV(TeleportKami_BG)
1409 READ_STRING_FV(TeleportKaravan_BG)
1410 READ_STRING_FV(Elevator_BG)
1411 READ_STRING_FV(ResurectKami_BG)
1412 READ_STRING_FV(ResurectKaravan_BG)
1413 READ_STRING_FV(End_BG)
1414 READ_STRING_FV(IntroNevrax_BG)
1415 READ_STRING_FV(IntroNVidia_BG)
1417 READ_FLOAT_DEV(TipsY)
1418 READ_FLOAT_DEV(TeleportInfoY)
1419 // SceneName
1420 READ_STRING_DEV(SceneName)
1421 // IdFile Path
1422 READ_STRING_DEV(IdFilePath)
1424 // PacsPrimDir
1425 READ_STRINGVECTOR_DEV(PacsPrimDir);
1427 /////////////
1428 // FILTERS //
1429 createDebug ();
1430 CConfigFile::CVar *pcvTmp = ClientCfg.ConfigFile.getVarPtr("NegFiltersDebug");
1431 if( pcvTmp )
1433 int iSz = pcvTmp->size();
1434 for(int k = 0; k < iSz; ++k)
1436 DebugLog->addNegativeFilter (pcvTmp->asString(k).c_str());
1439 else
1440 cfgWarning("Default value used for 'NegFiltersDebug'");
1442 pcvTmp = ClientCfg.ConfigFile.getVarPtr("NegFiltersInfo");
1443 if( pcvTmp )
1445 int iSz = pcvTmp->size();
1446 for(int k = 0; k < iSz; ++k)
1448 InfoLog->addNegativeFilter (pcvTmp->asString(k).c_str());
1451 else
1452 cfgWarning("Default value used for 'NegFiltersInfo'");
1454 pcvTmp = ClientCfg.ConfigFile.getVarPtr("NegFiltersWarning");
1455 if( pcvTmp )
1457 int iSz = pcvTmp->size();
1458 for(int k = 0; k < iSz; ++k)
1460 WarningLog->addNegativeFilter (pcvTmp->asString(k).c_str());
1463 else
1464 cfgWarning("Default value used for 'NegFiltersWarning'");
1466 // Script Files
1467 READ_STRINGVECTOR_FV(StartCommands);
1469 /////////////
1470 // OPTIONS //
1471 // Colors for system infos
1472 ClientCfg.SystemInfoParams.clear();
1473 CConfigFile::CVar *sic = ClientCfg.ConfigFile.getVarPtr("SystemInfoColors");
1474 if (!sic)
1476 cfgWarning("Can't read SystemInfoColors, all colors defaulting to white");
1478 else
1480 if (sic->size() & 1)
1482 cfgWarning("Expecting odd size for SystemInfoColors. Last entry ignored.");
1484 uint numCol = sic->size() >> 1;
1485 for(uint k = 0; k < numCol; ++k)
1487 uint r, g, b, a;
1488 char mode[64];
1489 char fx[64];
1490 fx[0]='\0';
1491 if (sscanf(sic->asString((2 * k) + 1).c_str(), "%d %d %d %d %s %s", &r, &g, &b, &a, mode, fx) < 5)
1493 if(DisplayCFGWarning)
1494 nlwarning("Can't parse color for entry %s", sic->asString(2 * k).c_str());
1496 else
1498 SSysInfoParam p;
1500 p.Color = CRGBA(r, g, b, a);
1501 p.Mode = SSysInfoParam::Normal;
1502 p.SysInfoFxName = string(fx);
1503 if (stricmp(mode, "over") == 0) p.Mode = SSysInfoParam::Over;
1504 else if (stricmp(mode, "overonly") == 0) p.Mode = SSysInfoParam::OverOnly;
1505 else if (stricmp(mode, "center") == 0) p.Mode = SSysInfoParam::Center;
1506 else if (stricmp(mode, "centeraround") == 0) p.Mode = SSysInfoParam::CenterAround;
1507 else if (stricmp(mode, "around") == 0) p.Mode = SSysInfoParam::Around;
1509 ClientCfg.SystemInfoParams[toLowerAscii(sic->asString(2 * k))] = p;
1514 #ifndef RZ_NO_CLIENT
1515 // printf commands in loading screens
1516 ClientCfg.loadingTexts.clear();
1517 CConfigFile::CVar *pc = ClientCfg.ConfigFile.getVarPtr("loadingTexts");
1518 if (pc)
1520 if( pc->size()%5 == 0 && pc->size() >= 5)
1522 for (uint i = 0; i < pc->size(); i+=5)
1524 SPrintfCommand pcom;
1525 pcom.X = pc->asInt(i);
1526 pcom.Y = pc->asInt(i+1);
1527 pcom.Color = CRGBA::stringToRGBA( pc->asString(i+2).c_str() );
1528 pcom.FontSize = pc->asInt(i+3);
1529 pcom.Text = pc->asString(i+4);
1531 ClientCfg.loadingTexts.push_back( pcom );
1534 else
1536 cfgWarning("Missing or too many parameters in loadingTexts");
1539 #endif
1541 READ_INT_FV(LoadingStringCount)
1543 // DEBUG MEMORY
1544 READ_INT_DEV(CheckMemoryEveryNFrame)
1545 READ_BOOL_DEV(LogMemoryAllocation)
1546 READ_INT_DEV(LogMemoryAllocationSize)
1548 // SelectWithRClick
1549 READ_BOOL_FV(SelectWithRClick)
1550 READ_BOOL_DEV(RunAtTheBeginning)
1551 READ_FLOAT_FV(RotKeySpeedMax)
1552 READ_FLOAT_FV(RotKeySpeedMin)
1553 READ_FLOAT_FV(RotAccel)
1554 READ_BOOL_DEV(PutBackItems)
1555 READ_BOOL_DEV(ShowNameUnderCursor)
1556 READ_BOOL_DEV(ShowNameSelected)
1557 READ_FLOAT_DEV(ShowNameBelowDistanceSqr)
1558 READ_BOOL_DEV(ForceIndoorFPV)
1559 READ_BOOL_FV(FollowOnAtk);
1560 READ_BOOL_FV(AtkOnSelect);
1561 READ_BOOL_DEV(TransparentUnderCursor);
1563 READ_BOOL_FV(ItemGroupAllowGuild);
1566 /////////////////
1567 // PREFERENCES //
1568 // Read the view mode at load time only, cause prefer keep ingame player setup
1569 if(firstTimeSetValues)
1571 READ_BOOL_FV(FPV)
1573 READ_FLOAT_FV(CameraDistStep)
1574 READ_FLOAT_FV(CameraDistMin)
1575 READ_FLOAT_FV(CameraDistMax)
1576 READ_FLOAT_FV(DmCameraDistMax)
1577 READ_FLOAT_FV(CameraAccel)
1578 READ_FLOAT_FV(CameraSpeedMin)
1579 READ_FLOAT_FV(CameraSpeedMax)
1580 READ_FLOAT_FV(CameraResetSpeed)
1581 // Read the camera height and distance at load time only, cause prefer keep ingame player setup
1582 if(firstTimeSetValues)
1584 READ_FLOAT_FV(CameraHeight)
1585 READ_FLOAT_FV(CameraDistance)
1588 // Default values for CGroupMap
1589 READ_FLOAT_FV(MaxMapScale);
1590 READ_FLOAT_FV(R2EDMaxMapScale);
1592 // /tar to update compass or not
1593 READ_BOOL_FV(TargetChangeCompass);
1595 /////////////
1596 // SHADOWS //
1597 // Shadows : Get Shadows state
1598 READ_BOOL_FV(Shadows)
1599 // ShadowsClipFar : Get Shadows Clip Far.
1600 READ_FLOAT_DEV(ShadowsClipFar)
1601 // ShadowsLodDist : Get Shadows Lod Distance.
1602 READ_FLOAT_DEV(ShadowsLodDist)
1603 // ZClamp
1604 READ_FLOAT_DEV(ShadowZDirClampLandscape);
1605 READ_FLOAT_DEV(ShadowZDirClampInterior);
1606 READ_FLOAT_DEV(ShadowZDirClampSmoothSpeed);
1607 // MaxDepth
1608 READ_FLOAT_DEV(ShadowMaxDepthLandscape);
1609 READ_FLOAT_DEV(ShadowMaxDepthInterior);
1610 READ_FLOAT_DEV(ShadowMaxDepthSmoothSpeed);
1613 ////////////////
1614 // GROUND FXS //
1615 ////////////////
1616 READ_FLOAT_DEV(GroundFXMaxDist)
1617 READ_INT_DEV(GroundFXMaxNB)
1618 READ_INT_DEV(GroundFXCacheSize)
1620 // Names : Get Names state
1621 READ_BOOL_FV(Names)
1622 // Sleep
1623 READ_INT_FV(Sleep)
1624 // ProcessPriority
1625 READ_INT_FV(ProcessPriority)
1626 // CPUMask
1627 READ_INT_FV(CPUMask)
1628 // ShowPath : Get the ShowPath value.
1629 READ_BOOL_DEV(ShowPath)
1630 // UserSheet : Get the sheet to used for the use rin Local mode.
1631 READ_STRING_DEV(UserSheet)
1632 #if !FINAL_VERSION
1633 // Sex
1634 varPtr = ClientCfg.ConfigFile.getVarPtr("Sex");
1635 if(varPtr)
1636 ClientCfg.Sex = (GSGENDER::EGender)varPtr->asInt();
1637 else
1638 cfgWarning("Default value used for 'Sex' !!!");
1639 #endif // FINAL_VERSION
1640 // PrimitiveHeightAddition
1641 READ_BOOL_DEV(PrimitiveHeightAddition)
1642 // DrawBoxes
1643 READ_BOOL_DEV(DrawBoxes)
1646 // ChaseReactionTime
1647 READ_FLOAT_DEV(ChaseReactionTime)
1648 // RyzomTime
1649 READ_FLOAT_DEV(RyzomTime)
1650 // RyzomDay
1651 READ_INT_DEV(RyzomDay)
1652 // ManualWeatherSetup
1653 READ_BOOL_DEV(ManualWeatherSetup)
1654 // LanguageCode
1655 READ_BOOL_DEV(ForceLanguage)
1656 if (!ClientCfg.ForceLanguage)
1658 READ_STRING_FV(LanguageCode)
1660 // DebugStringManager
1661 READ_BOOL_DEV(DebugStringManager)
1663 // LastLogin
1664 READ_STRING_FV(LastLogin)
1666 //////////////
1667 // VERBOSES //
1668 READ_BOOL_DEV(VerboseVP)
1669 READ_BOOL_DEV(VerboseAnimUser)
1670 READ_BOOL_DEV(VerboseAnimSelection)
1671 READ_BOOL_DEV(VerboseAllTraffic)
1673 READ_STRING_DEV(LigoPrimitiveClass);
1675 ///////////
1676 // DEBUG //
1677 READ_INT_DEV(SimulatePacketLossRatio)
1678 READ_BOOL_DEV(PreCacheShapes)
1679 READ_BOOL_FV(ResetShapeBankOnRetCharSelect)
1680 READ_BOOL_DEV(DisplayMissingAnimFile)
1681 READ_STRING_DEV(DefaultEntity)
1682 READ_BOOL_DEV(RestrainPI)
1683 READ_BOOL_DEV(DumpVSIndex)
1684 READ_INT_DEV(HelpFontSize)
1685 #if !FINAL_VERSION
1686 // HelpFontColor
1688 CConfigFile::CVar *cvHelpFontColor = ClientCfg.ConfigFile.getVarPtr("HelpFontColor");
1689 if(cvHelpFontColor && cvHelpFontColor->size() == 3)
1691 ClientCfg.HelpFontColor.R = cvHelpFontColor->asInt(0);
1692 ClientCfg.HelpFontColor.G = cvHelpFontColor->asInt(1);
1693 ClientCfg.HelpFontColor.B = cvHelpFontColor->asInt(2);
1694 ClientCfg.HelpFontColor.A = 255;
1696 else
1697 cfgWarning("Default value used for 'HelpFontColor' !!!");
1699 #endif // !FINAL_VERSION
1700 // HelpLineStep
1701 READ_FLOAT_DEV(HelpLineStep)
1703 READ_INT_DEV(DebugFontSize)
1704 #if !FINAL_VERSION
1705 // DebugFontColor
1706 CConfigFile::CVar *pcvDebugFontColor = ClientCfg.ConfigFile.getVarPtr("DebugFontColor");
1707 if( pcvDebugFontColor && (pcvDebugFontColor->size() == 3) )
1709 ClientCfg.DebugFontColor.R = pcvDebugFontColor->asInt(0);
1710 ClientCfg.DebugFontColor.G = pcvDebugFontColor->asInt(1);
1711 ClientCfg.DebugFontColor.B = pcvDebugFontColor->asInt(2);
1712 ClientCfg.DebugFontColor.A = 255;
1714 else
1715 cfgWarning("Default value used for 'DebugFontColor'");
1716 #endif // !FINAL_VERSION
1717 READ_FLOAT_DEV(DebugLineStep)
1719 // HeadOffset
1720 READ_CVECTOR_DEV(HeadOffset)
1721 READ_BOOL_DEV(FPExceptions)
1722 READ_BOOL_DEV(NeedComputeVS)
1723 READ_BOOL_DEV(Check)
1724 READ_BOOL_DEV(UsePACSForAll)
1725 READ_FLOAT_DEV(WaterEnvMapUpdateTime)
1726 READ_BOOL_DEV(BlendForward)
1728 ClientCfg.ZCPacsPrim = "gen_bt_col_ext.pacs_prim";
1729 READ_STRING_DEV(ZCPacsPrim)
1731 READ_BOOL_FV(AutoReloadFiles)
1732 READ_BOOL_DEV(BlendShapePatched)
1734 READ_INT_DEV(MaxNumberOfTimedFXInstances);
1736 READ_STRING_DEV(SelectionFX);
1737 READ_STRING_DEV(MouseOverFX);
1738 READ_FLOAT_DEV(SelectionFXSize);
1740 if(ClientCfg.ConfigFile.exists("ExtendedCommands") && ClientCfg.ConfigFile.getVar("ExtendedCommands").asString() == "Enable")
1741 ClientCfg.ExtendedCommands = true;
1744 READ_BOOL_DEV(R2Mode);
1745 if (ClientCfg.Local) // R2EDEnabled is now set by the server
1747 READ_BOOL_DEV(R2EDEnabled)
1749 READ_INT_FV(R2EDDssNetwork)
1752 if (ClientCfg.Local)
1754 ClientCfg.R2EDDssNetwork = 1;
1757 READ_BOOL_DEV(R2EDExtendedDebug)
1758 #if FINAL_VERSION
1760 CConfigFile::CVar *var = ClientCfg.ConfigFile.getVarPtr("R2EDExtendedDebug");
1761 if (var)
1763 var->setAsInt(0);
1765 // else no-op -> will resolve to 'nil' into lua
1767 #endif
1770 READ_BOOL_DEV(R2EDVerboseParseTime)
1771 READ_BOOL_DEV(R2EDDontReparseUnchangedUIFiles)
1772 READ_BOOL_DEV(R2EDLightPalette)
1773 READ_INT_FV(R2EDAutoSaveWait)
1774 READ_INT_FV(R2EDAutoSaveSlot)
1775 READ_BOOL_DEV(R2EDMustVerifyRingAccessWhileLoadingAnimation)
1776 READ_BOOL_FV(R2EDUseVerboseRingAccess)
1780 //////////
1781 // TEMP //
1782 // Array with the name of all offensive impact FXs.
1783 READ_STRINGVECTOR_DEV(OffImpactFX);
1785 #ifndef RZ_NO_CLIENT
1787 //////////
1788 // INIT //
1789 // FPU
1790 #ifdef NL_OS_WINDOWS
1791 if(ClientCfg.FPExceptions)
1792 _control87(_EM_DENORMAL/*|_EM_INVALID|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM);
1793 else
1794 _control87(_EM_INVALID|_EM_DENORMAL|_EM_ZERODIVIDE|_EM_OVERFLOW|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM);
1796 // Set the process priority
1797 static DWORD priority[6]=
1799 0x40, // IDLE_PRIORITY_CLASS
1800 0x4000, // BELOW_NORMAL_PRIORITY_CLASS
1801 0x20, // NORMAL_PRIORITY_CLASS
1802 0x8000, // ABOVE_NORMAL_PRIORITY_CLASS
1803 0x80, // HIGH_PRIORITY_CLASS
1804 0x100, // REALTIME_PRIORITY_CLASS
1807 int index = ClientCfg.ProcessPriority+2;
1808 clamp(index, 0, 6);
1809 SetPriorityClass (GetCurrentProcess(), priority[index]);
1810 #endif // NL_OS_WINDOWS
1812 // Init Verbose Modes (at the beginning to be able to display them as soon as possible).
1813 ::VerboseVP = ClientCfg.VerboseVP;
1814 ::VerboseAnimUser = ClientCfg.VerboseAnimUser;
1815 ::VerboseAnimSelection = ClientCfg.VerboseAnimSelection;
1816 #ifdef LOG_ALL_TRAFFIC
1817 NLMISC::VerboseAllTraffic = ClientCfg.VerboseAllTraffic;
1818 #endif
1820 // (re-)Initialize contextual cursors.
1821 if (!ClientCfg.R2EDEnabled)
1823 initContextualCursor();
1826 // Prim files
1827 READ_STRINGVECTOR_DEV(PrimFiles);
1829 // Reset GlobalWind Setup
1830 if(Scene)
1832 Scene->setGlobalWindPower(ClientCfg.GlobalWindPower);
1833 Scene->setGlobalWindDirection(ClientCfg.GlobalWindDirection);
1836 if (Driver)
1838 // Set the monitor color properties
1839 CMonitorColorProperties monitorColor;
1840 for(uint i=0; i<3; i++)
1842 monitorColor.Contrast[i] = ClientCfg.Contrast;
1843 monitorColor.Luminosity[i] = ClientCfg.Luminosity;
1844 monitorColor.Gamma[i] = ClientCfg.Gamma;
1846 if(!Driver->setMonitorColorProperties(monitorColor))
1847 cfgWarning("reloadCFG: setMonitorColorProperties fails");
1851 // Show/hide all or parts of the user body.
1852 if (UserEntity)
1854 UserEntity->eyesHeight(ClientCfg.EyesHeight);
1855 UserEntity->updateVisualDisplay();
1857 // Run speed and camera dist max are set according to R2 char mode
1858 UserEntity->flushR2CharMode();
1861 // Initialize the camera distance (after camera dist max)
1862 View.setCameraDistanceMaxForPlayer();
1864 // draw in client light?
1865 if(ClientCfg.Light)
1867 ClientCfg.DrawBoxes = true;
1868 ClientCfg.Names = true;
1871 // Set Day / Time
1872 if (ClientCfg.Local)
1874 uint32 tickOffset = (uint32)(ClientCfg.RyzomDay * RYZOM_HOURS_IN_TICKS * 24 + ClientCfg.RyzomTime * RYZOM_HOURS_IN_TICKS);
1875 RT.resetTickOffset();
1876 RT.increaseTickOffset( tickOffset );
1878 #endif
1880 // for reset effect of variable in mainLoop(), set true
1881 ClientCfg.IsInvalidated= true;
1883 // Allow warning display only first time.
1884 DisplayCFGWarning= false;
1886 // If it is the load time, backup the ClientCfg into LastClientCfg
1887 if(firstTimeSetValues)
1888 LastClientCfg = ClientCfg;
1890 // no more true.
1891 firstTimeSetValues= false;
1893 READ_INT_DEV(NumFrameForProfile);
1894 READ_STRING_FV(KlientChatPort);
1895 READ_BOOL_DEV(SimulateServerTick);
1897 READ_BOOL_DEV(DamageShieldEnabled)
1899 READ_BOOL_FV(AllowDebugLua)
1900 READ_BOOL_FV(DisplayLuaDebugInfo)
1902 READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled)
1903 READ_STRING_DEV(LuaDebugInfoGotoButtonTemplate)
1904 READ_STRING_DEV(LuaDebugInfoGotoButtonCaption)
1905 READ_STRING_DEV(LuaDebugInfoGotoButtonFunction)
1908 READ_BOOL_DEV(BeepWhenLaunched)
1910 READ_STRING_DEV(R2ClientGw)
1912 READ_FLOAT_FV(FogDistAndDepthLookupBias)
1914 READ_INT_DEV(R2EDLoadDynamicFeatures)
1916 READ_BOOL_DEV(CheckR2ScenarioMD5);
1918 CConfigFile::CVar *pcvHardwareCursors = ClientCfg.ConfigFile.getVarPtr("HardwareCursors");
1919 if(pcvHardwareCursors)
1921 ClientCfg.HardwareCursors.clear ();
1922 int iSz = pcvHardwareCursors->size();
1923 for (int i = 0; i < iSz; i++)
1924 ClientCfg.HardwareCursors.insert(toLowerAscii(pcvHardwareCursors->asString(i)));
1926 else
1928 cfgWarning("Default value used for 'HardwareCursors'");
1929 // default list of harware cursors
1930 ClientCfg.HardwareCursors.insert("curs_can_pan.tga");
1931 ClientCfg.HardwareCursors.insert("curs_can_pan_dup.tga");
1932 ClientCfg.HardwareCursors.insert("curs_create.tga");
1933 ClientCfg.HardwareCursors.insert("curs_create_multi.tga");
1934 ClientCfg.HardwareCursors.insert("curs_create_vertex_invalid.tga");
1935 ClientCfg.HardwareCursors.insert("curs_default.tga");
1936 ClientCfg.HardwareCursors.insert("curs_dup.tga");
1937 ClientCfg.HardwareCursors.insert("curs_L.tga");
1938 ClientCfg.HardwareCursors.insert("curs_M.tga");
1939 ClientCfg.HardwareCursors.insert("curs_pan.tga");
1940 ClientCfg.HardwareCursors.insert("curs_pan_dup.tga");
1941 ClientCfg.HardwareCursors.insert("curs_pick.tga");
1942 ClientCfg.HardwareCursors.insert("curs_pick_dup.tga");
1943 ClientCfg.HardwareCursors.insert("curs_R.tga");
1944 ClientCfg.HardwareCursors.insert("curs_resize_BL_TR.tga");
1945 ClientCfg.HardwareCursors.insert("curs_resize_BR_TL.tga");
1946 ClientCfg.HardwareCursors.insert("curs_resize_LR.tga");
1947 ClientCfg.HardwareCursors.insert("curs_resize_TB.tga");
1948 ClientCfg.HardwareCursors.insert("curs_rotate.tga");
1949 ClientCfg.HardwareCursors.insert("curs_scale.tga");
1950 ClientCfg.HardwareCursors.insert("curs_stop.tga");
1951 ClientCfg.HardwareCursors.insert("text_cursor.tga");
1952 ClientCfg.HardwareCursors.insert("r2_hand_can_pan.tga");
1953 ClientCfg.HardwareCursors.insert("r2_hand_pan.tga");
1954 ClientCfg.HardwareCursors.insert("r2ed_tool_can_pick.tga");
1955 ClientCfg.HardwareCursors.insert("r2ed_tool_can_rotate.tga");
1956 ClientCfg.HardwareCursors.insert("r2ed_tool_pick.tga");
1957 ClientCfg.HardwareCursors.insert("r2ed_tool_rotate.tga");
1958 ClientCfg.HardwareCursors.insert("r2ed_tool_rotating.tga");
1961 // languages and types of Ring Scenarii
1962 READ_STRINGVECTOR_FV(ScenarioLanguages);
1963 READ_STRINGVECTOR_FV(ScenarioTypes);
1965 // build name
1966 READ_STRING_FV(BuildName)
1968 READ_BOOL_DEV(DisplayTPReason)
1970 //READ_INT_FV(TPQuitButtonX)
1971 //READ_INT_FV(TPQuitButtonY)
1972 //READ_INT_FV(TPCancelButtonX)
1973 //READ_INT_FV(TPCancelButtonY)
1974 READ_INT_FV(TPButtonW)
1975 READ_INT_FV(TPButtonH)
1977 READ_STRING_FV(ScenarioSavePath)
1980 ClientCfg.R2EDClippedEntityBlendTime = 0.18f;
1981 READ_FLOAT_FV(R2EDClippedEntityBlendTime)
1983 // vl: BackgroundDownloader is hardcoded to false and we don't want to run it, even if the cfg wants it
1984 //READ_BOOL_FV(BackgroundDownloader)
1986 }// load //
1989 //-----------------------------------------------
1990 // serial :
1991 // Serialize CFG.
1992 //-----------------------------------------------
1993 void CClientConfig::serial(NLMISC::IStream &f)
1995 // Start the opening of a new node named ClientCFG.
1996 f.xmlPush("ClientCFG");
1998 f.xmlPushBegin("Light");
1999 f.xmlPushEnd();
2000 f.serial(Light);
2001 f.xmlPop();
2003 f.xmlPushBegin("MonitorName");
2004 f.xmlPushEnd();
2005 f.serial(MonitorName);
2006 f.xmlPop();
2008 f.xmlPushBegin("Windowed");
2009 f.xmlPushEnd();
2010 f.serial(Windowed);
2011 f.xmlPop();
2013 f.xmlPushBegin("Width");
2014 f.xmlPushEnd();
2015 f.serial(Width);
2016 f.xmlPop();
2018 f.xmlPushBegin("Height");
2019 f.xmlPushEnd();
2020 f.serial(Height);
2021 f.xmlPop();
2023 f.xmlPushBegin("Depth");
2024 f.xmlPushEnd();
2025 f.serial(Depth);
2026 f.xmlPop();
2028 f.xmlPushBegin("Contrast");
2029 f.xmlPushEnd();
2030 f.serial(Contrast);
2031 f.xmlPop();
2033 f.xmlPushBegin("Luminosity");
2034 f.xmlPushEnd();
2035 f.serial(Luminosity);
2036 f.xmlPop();
2038 f.xmlPushBegin("Gamma");
2039 f.xmlPushEnd();
2040 f.serial(Gamma);
2041 f.xmlPop();
2044 f.xmlPushBegin("AttackDist");
2045 f.xmlPushEnd();
2046 f.serial(AttackDist);
2047 f.xmlPop();
2049 // SelectWithRClick
2050 f.xmlPushBegin("SelectWithRClick");
2051 f.xmlPushEnd();
2052 f.serial(SelectWithRClick);
2053 f.xmlPop();
2055 // Close the serial for the Client CFG.
2056 f.xmlPop();
2057 }// serial //
2060 //-----------------------------------------------
2061 // init :
2062 //-----------------------------------------------
2063 void CClientConfig::init(const string &configFileName)
2065 // if the users client config does not exist
2066 if(!CFile::fileExists(configFileName))
2068 // create the basic .cfg
2069 FILE *fp = nlfopen(configFileName, "w");
2071 if (fp == NULL)
2072 nlerror("CFG::init: Can't create config file '%s'", configFileName.c_str());
2073 else
2074 nlwarning("CFG::init: creating '%s' with default values", configFileName.c_str ());
2076 // get current locale
2077 std::string lang = CI18N::getSystemLanguageCode();
2079 const std::vector<std::string> &languages = CI18N::getLanguageCodes();
2081 // search if current locale is defined in language codes
2082 for(uint i = 0; i < languages.size(); ++i)
2084 if (lang == languages[i])
2086 // store the language code in the config file
2087 fprintf(fp, "LanguageCode = \"%s\";\n", lang.c_str());
2088 break;
2092 fclose(fp);
2095 // read the exising config file (don't parse it yet!)
2096 ucstring content; // UTF-16 and UTF-8 textfile support
2097 NLMISC::CI18N::readTextFile(configFileName, content);
2098 std::string contentUtf8 = content.toUtf8();
2100 // while there are "RootConfigFilename" values, remove them
2101 size_t pos = 0;
2102 while((pos = contentUtf8.find("RootConfigFilename")) != configFileName.npos)
2104 size_t endOfLine = contentUtf8.find("\n", pos);
2105 contentUtf8.erase(pos, (endOfLine - pos) + 1);
2108 // get current location of the root config file (client_default.cfg)
2109 std::string defaultConfigLocation;
2110 if(!getDefaultConfigLocation(defaultConfigLocation))
2111 nlerror("cannot find client_default.cfg");
2113 // and store it in the RootConfigFilename value in the very first line
2114 contentUtf8.insert(0, std::string("RootConfigFilename = \"") +
2115 defaultConfigLocation + "\";\n");
2117 // save the updated config file
2118 NLMISC::COFile configFile(configFileName, false, true, false);
2119 configFile.serialBuffer((uint8*)contentUtf8.c_str(), (uint)contentUtf8.size());
2120 configFile.close();
2122 // now we can continue loading and parsing the config file
2124 // if the config file will be modified, it calls automatically the function setValuesOnFileChange()
2125 ClientCfg.ConfigFile.setCallback (CClientConfig::setValuesOnFileChange);
2127 // load the config files
2128 ClientCfg.ConfigFile.load (configFileName);
2130 CConfigFile::CVar *pCV;
2131 // check language code is supported
2132 pCV = ClientCfg.ConfigFile.getVarPtr("LanguageCode");
2133 if (pCV)
2135 std::string lang = pCV->asString();
2136 if (!CI18N::isLanguageCodeSupported(lang))
2138 nlinfo("Unsupported language code \"%s\" fallback on default", lang.c_str());
2139 // fallback to default language
2140 ClientCfg.LanguageCode = CI18N::getSystemLanguageCode();
2141 // update ConfigFile variable
2142 pCV->setAsString(ClientCfg.LanguageCode);
2143 ClientCfg.ConfigFile.save();
2147 // update the ConfigFile variable in the config file
2148 pCV = ClientCfg.ConfigFile.getVarPtr("ClientVersion");
2149 if (pCV)
2151 std::string str = pCV->asString ();
2152 if (str != getVersion() && ClientCfg.SaveConfig)
2154 nlinfo ("Update and save the ClientVersion variable in config file %s -> %s", str.c_str(), getVersion().c_str());
2155 pCV->setAsString(getVersion());
2156 ClientCfg.ConfigFile.save();
2159 else
2160 nlwarning ("There's no ClientVersion variable in the config file!");
2162 }// init //
2165 //-----------------------------------------------
2166 // init :
2167 //-----------------------------------------------
2168 void CClientConfig::release ()
2170 #ifndef RZ_NO_CLIENT
2171 // Do we have to save the cfg file ?
2172 if (ClientCfg.SaveConfig)
2174 // Save values
2177 CConfigFile::CVar *varPtr = NULL;
2179 // Driver still alive ?
2180 if (Driver && Driver->isActive ())
2182 sint32 x, y;
2183 uint32 width, height;
2185 Driver->getWindowPos(x, y);
2186 Driver->getWindowSize(width, height);
2188 // Are we in window mode ?
2189 if (ClientCfg.Windowed /* && !isWindowMaximized() */)
2191 // Save windows position. width/height are saved when leaving ingame.
2192 writeInt("PositionX", x);
2193 writeInt("PositionY", y);
2197 // Save if in FPV or TPV.
2198 writeBool("FPV", ClientCfg.FPV);
2200 // Save the camera distance
2201 writeDouble("CameraDistance", ClientCfg.CameraDistance);
2203 catch (const Exception &e)
2205 nlwarning ("Error while set config file variables : %s", e.what ());
2208 // Save it
2209 ClientCfg.ConfigFile.save ();
2211 #endif
2214 bool CClientConfig::readBool (const std::string &varName)
2216 bool bVal = false;
2217 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2218 if(varPtr)
2219 bVal = varPtr->asInt() ? true : false;
2220 else
2221 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2222 return bVal;
2225 void CClientConfig::writeBool (const std::string &varName, bool bVal, bool bForce)
2227 CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
2228 if(varPtr)
2229 varPtr->forceAsInt(bVal ? 1:0);
2230 else
2231 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2234 sint32 CClientConfig::readInt (const std::string &varName)
2236 sint32 bVal = 0;
2237 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2238 if(varPtr)
2239 bVal = varPtr->asInt();
2240 else
2241 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2242 return bVal;
2245 void CClientConfig::writeInt (const std::string &varName, sint32 bVal, bool bForce)
2247 CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
2248 if(varPtr)
2249 varPtr->forceAsInt(bVal);
2250 else
2251 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2254 double CClientConfig::readDouble (const std::string &varName)
2256 double bVal = 0;
2257 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2258 if(varPtr)
2259 bVal = varPtr->asDouble();
2260 else
2261 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2262 return bVal;
2265 void CClientConfig::writeDouble (const std::string &varName, double dVal, bool bForce)
2267 CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
2268 if(varPtr)
2269 varPtr->forceAsDouble(dVal);
2270 else
2271 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2274 string CClientConfig::readString (const std::string &varName)
2276 string sVal;
2277 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2278 if(varPtr)
2279 sVal = varPtr->asString();
2280 else
2281 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2282 return sVal;
2285 void CClientConfig::writeString (const std::string &varName, const std::string &strVal, bool bForce)
2287 CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
2288 if(varPtr)
2289 varPtr->forceAsString(strVal);
2290 else
2291 nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
2294 // ***************************************************************************
2295 bool CClientConfig::readBoolNoWarning(const std::string &varName)
2297 bool bVal = false;
2298 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2299 if(varPtr)
2300 bVal = varPtr->asInt() ? true : false;
2301 return bVal;
2304 sint32 CClientConfig::readIntNoWarning(const std::string &varName)
2306 sint32 bVal = 0;
2307 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2308 if(varPtr)
2309 bVal = varPtr->asInt();
2310 return bVal;
2313 double CClientConfig::readDoubleNoWarning(const std::string &varName)
2315 double bVal = 0;
2316 CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
2317 if(varPtr)
2318 bVal = varPtr->asDouble();
2319 return bVal;
2322 // ***************************************************************************
2323 float CClientConfig::getActualLandscapeThreshold() const
2325 // The threshold to set in landscape is the inverse of the CFG one
2326 return 1.0f/LandscapeThreshold;
2329 // ***************************************************************************
2330 string CClientConfig::getHtmlLanguageCode() const
2332 if(LanguageCode=="wk")
2333 return "en";
2334 else
2335 return LanguageCode;
2338 // ***************************************************************************
2339 string CClientConfig::buildLoadingString( const string& ucstr ) const
2341 if( LoadingStringCount > 0 )
2343 uint index = rand()%LoadingStringCount;
2344 string tipId = "uiLoadingString" + toString(index);
2345 return CI18N::get(tipId);
2347 else
2348 return ucstr;
2351 // ***************************************************************************
2352 bool CClientConfig::getDefaultConfigLocation(std::string& p_name) const
2354 std::string defaultConfigFileName = "client_default.cfg";
2355 std::string defaultConfigPath;
2357 p_name.clear();
2359 #ifdef NL_OS_MAC
2360 // on mac, client_default.cfg should be searched in .app/Contents/Resources/
2361 defaultConfigPath = getAppBundlePath() + "/Contents/Resources/";
2362 #else
2363 // unders Windows or Linux, search client_default.cfg is same directory as executable
2364 defaultConfigPath = Args.getProgramPath();
2365 #endif
2367 std::string currentPath = CPath::standardizePath(CPath::getCurrentPath());
2368 std::string etcPath = CPath::standardizePath(getRyzomEtcPrefix());
2370 // look in the current working directory first
2371 if (CFile::isExists(currentPath + defaultConfigFileName))
2372 p_name = currentPath + defaultConfigFileName;
2374 // look in startup directory
2375 else if (CFile::isExists(Args.getStartupPath() + defaultConfigFileName))
2376 p_name = Args.getStartupPath() + defaultConfigFileName;
2378 // look in application directory
2379 else if (CFile::isExists(defaultConfigPath + defaultConfigFileName))
2380 p_name = defaultConfigPath + defaultConfigFileName;
2382 // look in etc prefix path
2383 else if (!etcPath.empty() && CFile::isExists(etcPath + defaultConfigFileName))
2384 p_name = etcPath + defaultConfigFileName;
2386 // if some client_default.cfg was found return true
2387 return !p_name.empty();