1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2020 Winch Gate Property Limited
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>
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/>.
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"
36 #include "client_cfg.h"
38 #include "cursor_functions.h"
39 #include "debug_client.h"
40 #include "view.h" // For the cameraDistance funtion
41 #include "user_entity.h"
43 #include "user_agent.h"
46 #include "nel/3d/u_driver.h"
47 #include "nel/3d/u_scene.h"
49 #include "game_share/time_weather_season/time_and_season.h"
56 #include "app_bundle_utils.h"
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 */ \
71 ClientCfg.variableName = varPtr->asInt() ? true : false; \
72 /* Use the Default Value */ \
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 */ \
85 ClientCfg.variableName = varPtr->asInt(); \
86 /* Use the Default Value */ \
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 */ \
99 ClientCfg.variableName = varPtr->asFloat(); \
100 /* Use the Default Value */ \
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 */ \
114 ClientCfg.variableName = varPtr->asFloat(); \
115 /* Use the Default Value */ \
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 */ \
128 ClientCfg.variableName = varPtr->asDouble(); \
129 /* Use the Default Value */ \
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 */ \
142 ClientCfg.variableName = varPtr->asString(); \
143 /* Use the Default Value */ \
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); \
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); \
164 cfgWarning("CFG: Bad params for '"#variableName"' !!!"); \
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 */ \
179 ClientCfg.variableName = (type)varPtr->asInt(); \
180 /* Use the Default Value */ \
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 */ \
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 */ \
202 cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
204 //-----------------------------------------------
205 // Macro for the dev version
206 //-----------------------------------------------
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)
247 using namespace NLMISC
;
248 using namespace NL3D
;
254 CClientConfig LastClientCfg
;
255 CClientConfig ClientCfg
;
256 const string ConfigFileName
= "client.cfg";
263 extern NL3D::UScene
*Scene
;
264 extern NL3D::UDriver
*Driver
;
265 extern CRyzomTime RT
;
266 extern string Cookie
;
267 extern string FSAddr
;
270 extern NLMISC::CCmdArgs Args
;
276 // diplay only one time warning "Default values...."
277 static bool DisplayCFGWarning
= false;
278 static void cfgWarning(const char *s
)
280 if(DisplayCFGWarning
)
284 //---------------------------------------------------
287 //---------------------------------------------------
288 CClientConfig::CClientConfig()
290 IsInvalidated
= false;
293 Light
= false; // Default is no client light version
301 SelectCharacter
= -1; // Default is no auto select
302 SelectedSlot
= 0; // Default is slot 0
304 Windowed
= false; // Default is windowed mode.
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;
320 WindowSnapInvert
= false;
321 WindowSnapDistance
= 10;
324 VRDisplayDevice
= "Auto";
325 VRDisplayDeviceId
= "";
327 Local
= false; // Default is Net Mode.
328 FSHost
= ""; // Default Host.
330 TexturesInterface
.push_back("texture_interfaces_v3");
331 TexturesInterfaceDXTC
.push_back("texture_interfaces_dxtc");
333 TexturesOutGameInterface
.push_back("texture_interfaces_v3_outgame_ui");
335 TexturesLoginInterface
.push_back("texture_interfaces_v3_login");
337 DisplayAccountButtons
= true;
338 CreateAccountURL
= RYZOM_CLIENT_CREATE_ACCOUNT_URL
; // "https://open.ryzom.dev/ams/";
339 EditAccountURL
= RYZOM_CLIENT_EDIT_ACCOUNT_URL
; // "https://open.ryzom.dev/ams/";
340 ForgetPwdURL
= RYZOM_CLIENT_FORGET_PASSWORD_URL
; // "https://open.ryzom.dev/ams/";
341 Position
= CVector(0.f
, 0.f
, 0.f
); // Default Position.
342 Heading
= CVector(0.f
, 1.f
, 0.f
); // Default Heading.
343 EyesHeight
= 1.5f
; // Default User Eyes Height.
344 Walk
= 1.66f
; // Default Velocity for the Walk.
345 Run
= 6.0f
; // Default Velocity for the Run.
346 Fly
= 25.0f
; // Default Velocity for the Fly.
347 DmWalk
= 6.0f
; // Default Velocity for the Walk in Ring/DM or Ring/Editor.
348 DmRun
= 20.0f
; // Default Velocity for the Run in Ring/DM or Ring/Editor.
350 FlyAccel
= 1000.f
; // Default Acceleration for the fly, in m.s-2
352 AllowDebugCommands
= false; // Add debug commands at startup
354 ForceDeltaTime
= 0; // Default ForceDeltaTime, disabled by default
356 HardwareCursor
= true; // Default HardwareCursor
357 HardwareCursorScale
= 0.85f
;
358 CursorSpeed
= 1.f
; // Default CursorSpeed
359 CursorAcceleration
= 0; // Default CursorAcceleration
360 FreeLookSpeed
= 0.001f
; // Default FreeLookSpeed
361 FreeLookAcceleration
= 0; // Default FreeLookAcceleration
362 FreeLookSmoothingPeriod
= 0.f
; // when in absolute mode, free look factor is used instead of speed, the mouse gives the absolute angle
363 FreeLookInverted
= false;
364 FreeLookTablet
= false; // Mouse reports absolute coordinates, so avoid mouse recentering
365 AutomaticCamera
= true;
366 DblClickMode
= true; // when in dbl click mode, a double click is needed to execute default contextual action
367 AutoEquipTool
= true; // when true player will auto-equip last used weapon or forage tool when doing an action
369 BGColor
= CRGBA(100,100,255); // Default Background Color.
370 LandscapeTileNear
= 50.0f
; // Default Landscape Tile Near.
371 LandscapeThreshold
= 1000.0f
; // Default Landscape Threshold.
372 Vision
= 500.f
; // Player vision.
373 Vision_min
= 200.f
; // Player vision min.
374 Vision_max
= 800.f
; // Player vision max.
375 SkinNbMaxPoly
= 40000;
378 CloudQuality
= 160.0f
;
380 NbMaxSkeletonNotCLod
= 20;
381 CharacterFarClip
= 200.f
;
382 ScreenAspectRatio
= 0.f
; // Default commmon Screen Aspect Ratio (no relation with the resolution) - 0.f = auto
383 FoV
= 75.f
; // Default value for the FoV.
384 ForceDXTC
= false; // Default is no DXTC Compression.
385 AnisotropicFilter
= 0; // Default is disabled (-1 = maximum value, 0 = disabled, 1+ = enabled)
386 DivideTextureSizeBy2
= false; // Divide texture by 2
387 DisableVtxProgram
= false; // Disable Hardware Vertex Program.
388 DisableVtxAGP
= false; // Disable Hardware Vertex AGP.
389 DisableTextureShdr
= false; // Disable Hardware Texture Shader.
390 MicroVeget
= true; // Default is with MicroVeget.
391 MicroVegetDensity
= 100.0f
;
392 HDEntityTexture
= false;
393 HDTextureInstalled
= false;
394 Fog
= true; // Fog is on by default
402 DensityBloom
= 255.f
;
404 GlobalWindPower
= 0.10f
; // Default is 0.25
405 GlobalWindDirection
= CVector(1,0,0); // Default direction is X>0
407 MovieShooterMemory
= 0; // MovieShooter disabled
408 MovieShooterFramePeriod
= 0.040f
; // default is 25 fps
409 MovieShooterBlend
= false;
410 MovieShooterFrameSkip
= 0; // default not skip frame
411 MovieShooterPrefix
= "shot_";
413 CameraRecorderPrefix
= "cam_rec";
414 CameraRecorderBlend
= true;
417 ScreenShotHeight
= 0;
418 ScreenShotFullDetail
= true;
419 ScreenShotZBuffer
= false;
421 MaxNumberOfTimedFXInstances
= 20;
422 SelectionFX
= "sfx_selection_mouseover.ps";
423 MouseOverFX
= "sfx_selection_mouseover.ps";
424 SelectionFXSize
= 0.8f
;
434 PatchVersion
.clear();
436 WebIgMainDomain
= RYZOM_WEBIG_MAIN_URL
; // https://open.ryzom.dev/"
437 WebIgTrustedDomains
.push_back(RYZOM_WEBIG_TRUSTED_DOMAIN
); // open.ryzom.dev
438 WebIgNotifInterval
= 10; // time in minutes
440 CurlMaxConnections
= 5;
441 CurlCABundle
.clear();
443 RingReleaseNotePath
= WebIgMainDomain
+ "/releasenotes_ring/index.php";
444 ReleaseNotePath
= WebIgMainDomain
+ "/releasenotes/index.php";
449 // With a bigger angle, rotation is animated.
450 AnimatedAngleThreshold
= 25.0; //
451 BlendFrameNumber
= 5; //
452 DestThreshold
= 0.01; // Destination Threshold
453 PositionLimiterRadius
= 0.1;
454 SignificantDist
= 0.0001; // Significant Distance
457 SoundOn
= true; // Default is with sound.
458 DriverSound
= SoundDrvAuto
;
459 SoundForceSoftwareBuffer
= true;
460 StartMusic
= "main theme air.ogg"; // Use at game startup (originally no music)
461 EmptySlotMusic
= "loading music loop.ogg"; // Use in character selection for empty slots
462 LoadingMusic
= "main menu loop.ogg"; // Main loading used after leaving character selection, and when going back to character selection
463 KamiTeleportMusic
= "kami teleport.ogg"; // Kami teleport
464 KaravanTeleportMusic
= "karavan teleport.ogg"; // Karavan teleport
465 TeleportLoadingMusic
= "loading music loop.ogg"; // Use for generic teleportations
466 DeathMusic
= "death.ogg"; // Player death
467 SoundSFXVolume
= 1.f
;
468 SoundGameMusicVolume
= 1.f
;
470 EnableBackgroundMusicTimeConstraint
= true;
472 SoundPackedSheetPath
= "data/sound/"; // Default path for sound packed sheets
473 SampleBankDir
= "data/sound/samplebanks"; // Default path for samples
474 UserEntitySoundLevel
= 0.5f
; // Default volume for sound in 1st person
475 UseEax
= true; // Default to use EAX;
476 UseADPCM
= false; // Defualt to PCM sample, NO ADPCM
477 MaxTrack
= 32; // Default to 32 track
479 ColorShout
= CRGBA(150,0,0,255); // Default Shout color.
480 ColorTalk
= CRGBA(255,255,255,255); // Default Talk color.
482 StreamedPackagePath
= "stream";
485 MediaPlayerDirectory
= "music";
486 MediaPlayerAutoPlay
= false;
488 // PreDataPath.push_back("data/gamedev/language/"); // Default Path for the language data
490 // DataPath.push_back("data/"); // Default Path for the Data.
491 // DataPath.push_back("data_leveldesign/"); // Default Path for the Level Design Directory.
492 // DataPath.push_back("data_common/"); // Default Path for the Level Design Directory.
494 DataPathNoRecurse
.push_back("data_leveldesign/leveldesign/Game_Elem");
496 UpdatePackedSheetPath
.push_back("data_leveldesign");
498 UpdatePackedSheet
= false; // Update packed sheet if needed
500 EndScreenTimeOut
= 0.f
; // Default time out for the screen at the end of the application.
501 Loading_BG
= "loading_bg.tga"; // Default name for the loading background file.
502 LoadingFreeTrial_BG
= "loading_free_trial_bg.tga"; // Default name for the loading background file in FreeTrial mode.
503 Launch_BG
= "launcher_bg.tga"; // Default name for the launch background file.
504 TeleportKami_BG
= "teleport_kami_bg.tga";
505 TeleportKaravan_BG
= "teleport_caravan_bg.tga";
506 Elevator_BG
= "elevator_bg.tga"; // Default name for the loading background file.
507 ResurectKami_BG
= "resurect_kami_bg.tga";
508 ResurectKaravan_BG
= "resurect_caravane_bg.tga";
509 End_BG
= "end_bg.tga"; // Default name for the last background file.
510 IntroNevrax_BG
= "launcher_nevrax.tga";
511 IntroNVidia_BG
= "launcher_nvidia.tga";
514 TeleportInfoY
= 0.23f
;
517 IdFilePath
= "sheet_id.bin";
518 PacsPrimDir
.push_back("data/3d/");
520 Shadows
= true; // Draw Shadows by default.
521 ShadowsClipFar
= 10.f
; // Shadows are disabled after this distance.
522 ShadowsLodDist
= 3.f
; // Shadows draw with just 1 part after this distance.
523 ShadowZDirClampLandscape
= -0.5f
; // On landscape, allow a minimum Phi angle of -30 degrees
524 ShadowZDirClampInterior
= -0.86f
; // On Interior, allow a minimum Phi angle of -60 degrees
525 ShadowZDirClampSmoothSpeed
= 0.5f
;
526 ShadowMaxDepthLandscape
= 8.f
;
527 ShadowMaxDepthInterior
= 2.f
;
528 ShadowMaxDepthSmoothSpeed
= 6.f
;
531 Names
= false; // Don't draw Names by default.
533 Sleep
= -1; // Default : client does not sleep.
534 ProcessPriority
= 0; // Default : NORMAL
535 CPUMask
= 0; // Default : auto detection
536 ShowPath
= false; // Default : do not display the path.
537 DrawBoxes
= false; // Default : Do not draw the selection.
539 UserSheet
= "fyros.race_stats"; // Default sheet used.
540 Sex
= GSGENDER::male
; // Default : male.
542 PrimitiveHeightAddition
= 2.f
; // Default : 2.f
548 ManualWeatherSetup
= false;
550 ChaseReactionTime
= 0.4f
; // Reaction time before chasing someone.
552 TimeToAdjustCamera
= 1000.0;
553 ChangeDirAngle
= 1.70f
; // Default Angle.
555 GuildSymbolSize
= 0.3f
; // Default Guild Symbol Size.
556 SelectionDist
= 150.f
; // Default dist in meter.
557 SelectionOutBBoxWeight
= 16.f
; // Default factor
558 LootDist
= 4.f
; // Default loot/harvest distance (in meter).
559 SpaceSelectionDist
= 50.f
;
560 SpaceSelectionMaxCycle
= 1;
562 ForceLanguage
= false;
563 LanguageCode
= "en"; // Default to english
564 DebugStringManager
= false; // Default to no debug
567 WaterOffset
= -1.085f
;
568 FyrosWaterOffset
= -1.0f
;
569 MatisWaterOffset
= -1.08f
;
570 TrykerWaterOffset
= -0.88f
;
571 ZoraiWaterOffset
= -1.25f
;
572 WaterOffsetCreature
= -1.6f
;
573 TimeToRemoveCol
= 1000;
574 MoveToTimeToStopStall
= 500;
577 MaxHeadTargetDist
= 30.0f
;
578 DeadFXName
= "misc_dead.ps";
579 ImpactFXName
= "impact.ps";
580 SkillUpFXName
= "misc_levelup.ps";
582 NameScale
= 1.0f
; // Default Scale to display Names.
586 ConstNameSizeDist
= 20.0f
;
587 StaticNameHeight
= true;
592 ForageInterfaceZBias
= -10.f
;
597 EnableRacialAnimation
= true;
600 RunAtTheBeginning
= true;
601 SelectWithRClick
= false; // Default right click cannot select.
602 RotKeySpeedMax
= 3.0f
;
603 RotKeySpeedMin
= 1.0f
;
605 PutBackItems
= false;
606 ShowNameUnderCursor
= true;
607 ShowNameSelected
= true;
608 ShowNameBelowDistanceSqr
= 20.f
* 20.f
;
609 ForceIndoorFPV
= false;
612 TransparentUnderCursor
= false;
613 ItemGroupAllowGuild
= false;
617 CameraDistance
= 3.0f
;
618 CameraDistStep
= 1.0f
;
619 CameraDistMin
= 1.0f
;
620 CameraDistMax
= 100.0f
;
621 DmCameraDistMax
= 25.0f
;
623 CameraSpeedMin
= 0.2f
;
624 CameraSpeedMax
= 1.0f
;
625 CameraResetSpeed
= 2.0f
;
628 R2EDMaxMapScale
= 8.0f
;
630 TargetChangeCompass
= true;
634 VerboseAnimUser
= false;
635 VerboseAnimSelection
= false;
636 VerboseAllTraffic
= false;
639 DisplayMissingAnimFile
= false;
640 DefaultEntity
= "ccafb1.creature";
644 HelpFontColor
= CRGBA(255,255,255);
645 HelpLineStep
= 0.025f
;
647 DebugFontColor
= CRGBA(250, 250, 250);
648 DebugLineStep
= 0.02f
;
649 HeadOffset
= CVector(0.f
, 0.f
, 0.f
);
653 FPExceptions
= false; // Disable Floating Point Exceptions.
654 DisplayWeapons
= false; // Do not dusplay weapons in first person.
655 NeedComputeVS
= false; // Do not need to compute Visual Slots.
657 GroundFXMaxDist
= 40.f
;
659 GroundFXCacheSize
= 10;
661 AutoReloadFiles
= false;
662 BlendShapePatched
= true;
663 ExtendedCommands
= false;
665 WaterEnvMapUpdateTime
= 1.f
;
667 NumFrameForProfile
= 0;
668 SimulateServerTick
= false;
673 PreCacheShapes
= true;
674 ResetShapeBankOnRetCharSelect
= false;
675 LandscapeEnabled
= true;
676 VillagesEnabled
= true;
678 CacheUIParsing
= false;
679 MicroLifeEnabled
= true;
683 StageLCTUsage
= StageUsePosOnlyLCT
;
685 SimulatePacketLossRatio
= 0;
687 CheckMemoryEveryNFrame
= -1;
688 LogMemoryAllocation
=false;
689 LogMemoryAllocationSize
=8;
691 DamageShieldEnabled
= false;
693 LevelDesignEnabled
= false;
697 R2EDExtendedDebug
= false;
698 R2EDVerboseParseTime
= false;
699 R2EDDontReparseUnchangedUIFiles
= false;
700 R2EDLightPalette
= false;
701 R2EDAutoSaveWait
= 60*5;
702 R2EDAutoSaveSlot
= 9;
703 R2EDMustVerifyRingAccessWhileLoadingAnimation
= false;
704 R2EDUseVerboseRingAccess
= false;
707 DamageShieldEnabled
= false;
709 AllowDebugLua
= false;
710 DisplayLuaDebugInfo
= false;
711 BeepWhenLaunched
= false;
715 LoadingStringCount
= 0;
717 LuaDebugInfoGotoButtonEnabled
= false;
719 FogDistAndDepthLookupBias
= 0.f
;
721 R2EDLoadDynamicFeatures
= 0;
723 CheckR2ScenarioMD5
= true;
725 DisplayTPReason
= false;
727 //TPCancelButtonX = 988;
728 //TPCancelButtonY = 138;
730 //TPQuitButtonY = 138;
735 ScenarioSavePath
= "./my_scenarios/";
737 R2EDClippedEntityBlendTime
= 0.18f
;
739 BackgroundDownloader
= false;
744 //---------------------------------------------------
746 // Load the client config file.
747 //---------------------------------------------------
748 void CClientConfig::setValuesOnFileChange()
750 // ClientCfg.ConfigFile.print (InfoLog);
752 // display an info only when the file change
753 nlinfo ("reloading the config file!");
758 //---------------------------------------------------
760 // Load the client config file.
761 //---------------------------------------------------
762 void CClientConfig::setValues()
764 CConfigFile::CVar
*varPtr
= 0;
765 static bool firstTimeSetValues
= true;
767 //////////////////////
768 // INTERFACE CONFIG //
770 READ_STRING_FV(XMLInputFile
)
773 READ_BOOL_FV(SkipIntro
);
774 READ_BOOL_DEV(SkipEULA
);
775 READ_INT_DEV(SelectCharacter
);
777 READ_INT_FV(SelectedSlot
);
778 if( ClientCfg
.SelectedSlot
>4 )
780 ClientCfg
.SelectedSlot
= 0;
783 // interface textures login menus
784 READ_STRINGVECTOR_FV(TexturesLoginInterface
);
785 READ_STRINGVECTOR_FV(TexturesLoginInterfaceDXTC
);
787 // interface textures outgame menus
788 READ_STRINGVECTOR_FV(TexturesOutGameInterface
);
789 READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC
);
791 // interface textures ingame and r2
792 READ_STRINGVECTOR_FV(TexturesInterface
);
793 READ_STRINGVECTOR_FV(TexturesInterfaceDXTC
);
795 // interface files login menus
796 READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles
);
798 // interface files outgame menus
799 READ_STRINGVECTOR_FV(XMLOutGameInterfaceFiles
);
802 READ_STRINGVECTOR_FV(XMLInterfaceFiles
);
805 READ_STRINGVECTOR_FV(XMLR2EDInterfaceFiles
);
808 READ_STRINGVECTOR_FV(Logos
);
811 READ_BOOL_DEV(TestBrowser
);
812 READ_STRING_DEV(TestBrowserUrl
);
816 varPtr
= ClientCfg
.ConfigFile
.getVarPtr ("ClientLight");
818 ClientCfg
.Light
= varPtr
->asInt() ? true : false;
819 #endif // !FINAL_VERSION
822 READ_BOOL_DEV(LandscapeEnabled
)
823 READ_BOOL_DEV(VillagesEnabled
)
824 READ_BOOL_DEV(EAMEnabled
)
825 READ_BOOL_DEV(CacheUIParsing
)
826 READ_BOOL_DEV(MicroLifeEnabled
)
828 READ_BOOL_DEV(LevelDesignEnabled
)
835 READ_BOOL_FV(SaveConfig
)
838 READ_INT_FV(PositionX
)
839 READ_INT_FV(PositionY
)
842 READ_INT_FV(Frequency
)
844 CConfigFile::CVar
*pcvFullScreen
= ClientCfg
.ConfigFile
.getVarPtr("FullScreen");
847 ClientCfg
.Windowed
= pcvFullScreen
->asInt() ? false : true;
850 cfgWarning("Default value used for 'Fullscreen'");
852 READ_STRING_FV(MonitorName
);
857 // Depth : Bit Per Pixel
860 READ_FLOAT_FV(Contrast
)
862 READ_FLOAT_FV(Luminosity
)
866 READ_FLOAT_FV(InterfaceScale
);
867 READ_FLOAT_FV(InterfaceScale_min
);
868 READ_FLOAT_FV(InterfaceScale_max
);
869 READ_FLOAT_FV(InterfaceScale_step
);
870 clamp(ClientCfg
.InterfaceScale
, ClientCfg
.InterfaceScale_min
, ClientCfg
.InterfaceScale_max
);
871 READ_BOOL_FV(BilinearUI
);
872 READ_BOOL_FV(WindowSnapInvert
);
873 READ_INT_FV(WindowSnapDistance
);
875 varPtr
= ClientCfg
.ConfigFile
.getVarPtr ("Driver3D");
878 if (nlstricmp(varPtr
->asString(), "Auto") == 0 || nlstricmp(varPtr
->asString(), "0") == 0) ClientCfg
.Driver3D
= CClientConfig::DrvAuto
;
879 else if (nlstricmp(varPtr
->asString(), "OpenGL") == 0 || nlstricmp(varPtr
->asString(), "1") == 0) ClientCfg
.Driver3D
= CClientConfig::OpenGL
;
880 else if (nlstricmp(varPtr
->asString(), "Direct3D") == 0 || nlstricmp(varPtr
->asString(), "2") == 0) ClientCfg
.Driver3D
= CClientConfig::Direct3D
;
881 else if (nlstricmp(varPtr
->asString(), "OpenGLES") == 0 || nlstricmp(varPtr
->asString(), "3") == 0) ClientCfg
.Driver3D
= CClientConfig::OpenGLES
;
884 cfgWarning ("Default value used for 'Driver3D' !!!");
886 READ_BOOL_FV(VREnable
)
887 READ_STRING_FV(VRDisplayDevice
)
888 READ_STRING_FV(VRDisplayDeviceId
)
892 READ_BOOL_FV(HardwareCursor
)
893 READ_FLOAT_FV(HardwareCursorScale
)
894 READ_FLOAT_FV(CursorSpeed
)
895 READ_INT_FV(CursorAcceleration
)
896 READ_FLOAT_FV(FreeLookSpeed
)
897 READ_INT_FV(FreeLookAcceleration
)
898 READ_FLOAT_FV(FreeLookSmoothingPeriod
)
899 READ_BOOL_FV(FreeLookInverted
)
900 READ_BOOL_FV(FreeLookTablet
)
901 READ_BOOL_FV(AutomaticCamera
)
902 READ_BOOL_FV(DblClickMode
)
903 READ_BOOL_FV(AutoEquipTool
)
908 // Local : local mode or network mode
910 #endif // FINAL_VERSION
912 READ_STRING_FV(FSHost
)
914 READ_BOOL_DEV(DisplayAccountButtons
)
915 READ_STRING_DEV(CreateAccountURL
)
916 READ_STRING_DEV(EditAccountURL
)
917 READ_STRING_DEV(ForgetPwdURL
)
918 READ_STRING_DEV(BetaAccountURL
)
919 READ_STRING_DEV(FreeTrialURL
)
921 // defined in client_default.cfg
922 READ_STRING_FV(ConditionsTermsURL
)
923 READ_STRING_FV(NamingPolicyURL
)
924 READ_STRING_FV(LoginSupportURL
)
927 // if cookie is not empty, it means that the client was launch
928 // by the nel_launcher, so it can't be local
931 nlassert (!FSAddr
.empty());
932 ClientCfg
.Local
= false;
936 nlassert (FSAddr
.empty());
942 READ_CVECTOR_DEV(Position
)
943 READ_CVECTOR_DEV(Heading
)
945 READ_FLOAT_DEV(EyesHeight
)
952 //When editing or Dm ing a session in ring mode the player move quicker
954 READ_FLOAT_DEV(DmWalk
)
956 READ_FLOAT_DEV(DmRun
)
962 READ_FLOAT_DEV(FlyAccel
)
964 READ_BOOL_FV(AllowDebugCommands
)
967 READ_INT_DEV(ForceDeltaTime
)
973 CConfigFile::CVar
*pcvBackColor
= ClientCfg
.ConfigFile
.getVarPtr("Background");
974 if( pcvBackColor
&& (pcvBackColor
->size()==3) )
976 ClientCfg
.BGColor
.R
= pcvBackColor
->asInt(0);
977 ClientCfg
.BGColor
.G
= pcvBackColor
->asInt(1);
978 ClientCfg
.BGColor
.B
= pcvBackColor
->asInt(2);
979 ClientCfg
.BGColor
.A
= 255;
982 cfgWarning("Default value used for 'Background'");
983 #endif // !FINAL_VERSION
985 READ_FLOAT_FV(LandscapeTileNear
)
986 // LandscapeThreshold
987 READ_FLOAT_FV(LandscapeThreshold
)
988 // to be backward compatible, suppose a value<1 is for the old System!!! => invert it!
989 if( ClientCfg
.LandscapeThreshold
<1)
991 ClientCfg
.LandscapeThreshold
= 1.f
/ ClientCfg
.LandscapeThreshold
;
992 // must re-write in the CFG database, to be ok with the in-game configurator
993 varPtr
= ClientCfg
.ConfigFile
.getVarPtr("LandscapeThreshold");
995 varPtr
->forceAsDouble(ClientCfg
.LandscapeThreshold
);
998 READ_FLOAT_FV(Vision
)
999 READ_FLOAT_FV(Vision_min
)
1000 READ_FLOAT_FV(Vision_max
)
1002 READ_INT_FV(SkinNbMaxPoly
)
1004 READ_INT_FV(FxNbMaxPoly
)
1006 READ_FLOAT_FV(CloudQuality
)
1007 READ_INT_FV(CloudUpdate
)
1008 // NbMaxSkeletonNotCLod
1009 READ_INT_FV(NbMaxSkeletonNotCLod
)
1011 READ_FLOAT_FV(CharacterFarClip
)
1015 READ_BOOL_FV(SquareBloom
)
1016 READ_FLOAT_FV(DensityBloom
)
1021 // ScreenAspectRatio.
1022 READ_FLOAT_FV(ScreenAspectRatio
)
1026 READ_BOOL_FV(ForceDXTC
)
1027 // AnisotropicFilter
1028 READ_INT_FV(AnisotropicFilter
)
1029 // DivideTextureSizeBy2
1030 READ_BOOL_FV(DivideTextureSizeBy2
)
1031 // DisableVtxProgram
1032 READ_BOOL_FV(DisableVtxProgram
)
1034 READ_BOOL_FV(DisableVtxAGP
)
1035 // DisableTextureShdr
1036 READ_BOOL_FV(DisableTextureShdr
)
1038 READ_BOOL_FV(MicroVeget
)
1039 // MicroVeget Density
1040 READ_FLOAT_FV(MicroVegetDensity
)
1041 // GlobalWindPower: Global Wind Power
1042 READ_FLOAT_DEV(GlobalWindPower
)
1043 // Global Wind Direction
1044 READ_CVECTOR_DEV(GlobalWindDirection
)
1046 READ_BOOL_FV(HDEntityTexture
)
1047 // HDTextureInstalled
1048 READ_BOOL_FV(HDTextureInstalled
)
1054 READ_BOOL_FV(WaitVBL
)
1056 READ_INT_FV(VideoMemory
);
1058 READ_INT_DEV(TimerMode
)
1060 // MovieShooterMemory
1061 CConfigFile::CVar
*pcv
= ClientCfg
.ConfigFile
.getVarPtr("MovieShooterMemory");
1064 ClientCfg
.MovieShooterMemory
= pcv
->asInt();
1065 // Transform to octet
1066 ClientCfg
.MovieShooterMemory
*= 1024*1024;
1069 cfgWarning("'MovieShooterMemory' not found => MovieShooter Disabled");
1071 READ_STRING_FV(MovieShooterPath
)
1072 // MovieShooterFramePeriod
1073 READ_FLOAT_FV(MovieShooterFramePeriod
)
1074 // MovieShooterBlend
1075 READ_BOOL_FV(MovieShooterBlend
)
1076 // MovieShooterFrameSkip
1077 READ_INT_FV(MovieShooterFrameSkip
)
1080 READ_STRING_FV(CameraRecorderPath
)
1081 READ_STRING_FV(CameraRecorderPrefix
)
1082 READ_BOOL_FV(CameraRecorderBlend
)
1085 READ_INT_FV(ScreenShotWidth
)
1086 READ_INT_FV(ScreenShotHeight
)
1087 READ_BOOL_FV(ScreenShotFullDetail
)
1088 READ_BOOL_FV(ScreenShotZBuffer
)
1090 /////////////////////////
1091 // NEW PATCHING SYSTEM //
1092 READ_BOOL_FV(PatchWanted
)
1094 #ifdef RZ_USE_CUSTOM_PATCH_SERVER
1095 READ_STRING_FV(PatchUrl
)
1096 READ_STRING_FV(PatchVersion
)
1097 READ_STRING_FV(RingReleaseNotePath
)
1098 READ_STRING_FV(ReleaseNotePath
)
1100 READ_STRING_DEV(PatchUrl
)
1101 READ_STRING_DEV(PatchVersion
)
1102 READ_STRING_DEV(RingReleaseNotePath
)
1103 READ_STRING_DEV(ReleaseNotePath
)
1106 /////////////////////////
1107 // NEW PATCHLET SYSTEM //
1108 READ_STRING_FV(PatchletUrl
)
1112 READ_STRING_FV(WebIgMainDomain
);
1113 if (ClientCfg
.WebIgMainDomain
.find("http://") == std::string::npos
1114 || ClientCfg
.WebIgMainDomain
.find("https://") == std::string::npos
)
1115 ClientCfg
.WebIgMainDomain
= "http://" + ClientCfg
.WebIgMainDomain
;
1116 READ_STRINGVECTOR_FV(WebIgTrustedDomains
);
1117 READ_INT_FV(WebIgNotifInterval
);
1118 READ_INT_FV(CurlMaxConnections
);
1119 if (ClientCfg
.CurlMaxConnections
< 0)
1120 ClientCfg
.CurlMaxConnections
= 2;
1122 READ_STRING_FV(CurlCABundle
);
1123 if (!ClientCfg
.CurlCABundle
.empty() && ClientCfg
.CurlCABundle
[0] == '%') // Path is relative to client_default.cfg path (used by ryzom patch)
1125 string defaultConfigFileName
;
1126 if (ClientCfg
.getDefaultConfigLocation(defaultConfigFileName
))
1127 ClientCfg
.CurlCABundle
= CFile::getPath(defaultConfigFileName
)+ClientCfg
.CurlCABundle
.substr(1);
1132 // AnimatedAngleThreshold
1133 READ_DOUBLE_DEV(AnimatedAngleThreshold
)
1135 READ_INT_DEV(BlendFrameNumber
)
1137 READ_DOUBLE_DEV(DestThreshold
)
1138 // PositionLimiterRadius
1139 READ_DOUBLE_DEV(PositionLimiterRadius
)
1141 READ_DOUBLE_DEV(SignificantDist
)
1143 READ_ENUM_ASINT_DEV(TStageLCTUsage
, StageLCTUsage
)
1148 READ_FLOAT_DEV(WaterOffset
)
1151 READ_FLOAT_DEV(FyrosWaterOffset
)
1152 READ_FLOAT_DEV(MatisWaterOffset
)
1153 READ_FLOAT_DEV(TrykerWaterOffset
)
1154 READ_FLOAT_DEV(ZoraiWaterOffset
)
1155 #endif // FINAL_VERSION
1157 // Water Offset for creature
1158 READ_FLOAT_DEV(WaterOffsetCreature
)
1160 READ_INT_DEV(TimeToRemoveCol
)
1161 // MoveToTimeToStopStall
1162 READ_INT_DEV(MoveToTimeToStopStall
)
1163 // TimeToAdjustCamera
1164 READ_DOUBLE_DEV(TimeToAdjustCamera
)
1166 READ_DOUBLE_DEV(ChangeDirAngle
)
1168 READ_FLOAT_DEV(GuildSymbolSize
)
1170 READ_FLOAT_DEV(SelectionDist
)
1171 // SelectionOutBBoxWeight
1172 READ_FLOAT_DEV(SelectionOutBBoxWeight
)
1174 READ_FLOAT_DEV(LootDist
)
1175 // SpaceSelectionDist
1176 READ_FLOAT_DEV(SpaceSelectionDist
)
1177 // SpaceSelectionMaxCycle
1178 READ_INT_DEV(SpaceSelectionMaxCycle
)
1179 // Third Person View Min Pitch.
1180 READ_FLOAT_DEV(TPVMinPitch
)
1181 // Third Person View Max Pitch.
1182 READ_FLOAT_DEV(TPVMaxPitch
)
1183 // The character look at the target before this distance.
1184 READ_FLOAT_DEV(MaxHeadTargetDist
)
1185 // FX played when dead
1186 READ_STRING_DEV(DeadFXName
)
1187 // FX played for each impact
1188 READ_STRING_DEV(ImpactFXName
)
1189 // FX Played at skill up
1190 READ_STRING_DEV(SkillUpFXName
)
1192 READ_DOUBLE_DEV(MinDistFactor
)
1194 READ_FLOAT_DEV(NameScale
)
1196 READ_FLOAT_DEV(NamePos
)
1198 READ_INT_DEV(NameFontSize
)
1200 READ_FLOAT_DEV(MaxNameDist
)
1201 // ConstNameSizeDist
1202 READ_FLOAT_DEV(ConstNameSizeDist
)
1204 READ_BOOL_FV(StaticNameHeight
)
1206 READ_FLOAT_DEV(BarsHeight
)
1208 READ_FLOAT_DEV(BarsWidth
)
1210 READ_BOOL_FV(DisplayWeapons
)
1212 READ_DOUBLE_DEV(FightAreaSize
)
1214 READ_FLOAT_DEV(AttackDist
)
1216 READ_FLOAT_DEV(BubbleZBias
);
1217 // ForageInterfaceZBias
1218 READ_FLOAT_DEV(ForageInterfaceZBias
);
1220 // EnableRacialAnimation
1221 READ_BOOL_FV(EnableRacialAnimation
);
1224 READ_FLOAT_DEV(FyrosScale
);
1225 READ_FLOAT_DEV(MatisScale
);
1226 READ_FLOAT_DEV(TrykerScale
);
1227 READ_FLOAT_DEV(ZoraiScale
);
1229 #endif // FINAL_VERSION
1234 READ_BOOL_FV(SoundOn
)
1236 varPtr
= ClientCfg
.ConfigFile
.getVarPtr ("DriverSound");
1239 if (nlstricmp(varPtr
->asString(), "Auto") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvAuto
;
1240 else if (nlstricmp(varPtr
->asString(), "FMod") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvFMod
;
1241 else if (nlstricmp(varPtr
->asString(), "OpenAL") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvOpenAL
;
1242 else if (nlstricmp(varPtr
->asString(), "DirectSound") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvDirectSound
;
1243 else if (nlstricmp(varPtr
->asString(), "XAudio2") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvXAudio2
;
1246 cfgWarning ("Default value used for 'DriverSound' !!!");
1247 // SoundForceSoftwareBuffer
1248 READ_BOOL_FV(SoundForceSoftwareBuffer
);
1249 // SoundOutGameMusic
1250 READ_STRING_DEV(StartMusic
)
1251 READ_STRING_DEV(EmptySlotMusic
)
1252 READ_STRING_DEV(LoadingMusic
)
1253 READ_STRING_DEV(KamiTeleportMusic
)
1254 READ_STRING_DEV(KaravanTeleportMusic
)
1255 READ_STRING_DEV(TeleportLoadingMusic
)
1256 READ_STRING_DEV(DeathMusic
)
1258 READ_FLOAT_FV(SoundSFXVolume
);
1259 // SoundGameMusicVolume
1260 READ_FLOAT_FV(SoundGameMusicVolume
);
1262 READ_INT_DEV(SoundTPFade
);
1263 // EnableBackgroundMusicTimeConstraint
1264 READ_BOOL_DEV(EnableBackgroundMusicTimeConstraint
);
1265 // SoundPackedSheetPath
1266 READ_STRING_DEV(SoundPackedSheetPath
)
1268 READ_STRING_DEV(SampleBankDir
)
1269 // UserEntitySoundLevel : UserEntity sound level
1270 READ_FLOAT_FV(UserEntitySoundLevel
)
1272 READ_BOOL_FV(UseEax
)
1274 READ_BOOL_DEV(UseADPCM
)
1276 READ_INT_FV(MaxTrack
)
1279 READ_STRING_FV(MediaPlayerDirectory
);
1280 READ_BOOL_FV(MediaPlayerAutoPlay
);
1285 CConfigFile::CVar
*pcvColorShout
= ClientCfg
.ConfigFile
.getVarPtr("ColorShout");
1286 if( pcvColorShout
&& (pcvColorShout
->size() == 3) )
1288 ClientCfg
.ColorShout
.R
= pcvColorShout
->asInt(0);
1289 ClientCfg
.ColorShout
.G
= pcvColorShout
->asInt(1);
1290 ClientCfg
.ColorShout
.B
= pcvColorShout
->asInt(2);
1291 ClientCfg
.ColorShout
.A
= 255;
1294 cfgWarning("Default value used for 'ColorShout'");
1297 CConfigFile::CVar
*pcvColorTalk
= ClientCfg
.ConfigFile
.getVarPtr("ColorTalk");
1298 if( pcvColorTalk
&& (pcvColorTalk
->size() == 3) )
1300 ClientCfg
.ColorTalk
.R
= pcvColorTalk
->asInt(0);
1301 ClientCfg
.ColorTalk
.G
= pcvColorTalk
->asInt(1);
1302 ClientCfg
.ColorTalk
.B
= pcvColorTalk
->asInt(2);
1303 ClientCfg
.ColorTalk
.A
= 255;
1306 cfgWarning("Default value used for 'ColorTalk'");
1312 READ_STRINGVECTOR_FV(PreDataPath
);
1315 READ_STRINGVECTOR_FV(DataPath
);
1317 // Data Path no recurse.
1318 READ_STRINGVECTOR_FV(DataPathNoRecurse
);
1321 READ_STRING_DEV(PreLoadPath
);
1323 // Streamed package path
1324 READ_STRING_FV(StreamedPackagePath
);
1326 // Streamed package hosts
1327 READ_STRINGVECTOR_FV(StreamedPackageHosts
);
1329 // List of files that trigger R2ED reload when touched
1330 READ_STRINGVECTOR_FV(R2EDReloadFiles
);
1332 // Update packed sheet Path
1333 READ_STRINGVECTOR_FV(UpdatePackedSheetPath
);
1335 // UpdatePackedSheet
1336 READ_BOOL_DEV(UpdatePackedSheet
)
1339 READ_FLOAT_DEV(EndScreenTimeOut
)
1341 READ_STRING_FV(Loading_BG
)
1342 READ_STRING_FV(LoadingFreeTrial_BG
)
1343 READ_STRING_FV(Launch_BG
)
1344 READ_STRING_FV(TeleportKami_BG
)
1345 READ_STRING_FV(TeleportKaravan_BG
)
1346 READ_STRING_FV(Elevator_BG
)
1347 READ_STRING_FV(ResurectKami_BG
)
1348 READ_STRING_FV(ResurectKaravan_BG
)
1349 READ_STRING_FV(End_BG
)
1350 READ_STRING_FV(IntroNevrax_BG
)
1351 READ_STRING_FV(IntroNVidia_BG
)
1353 READ_FLOAT_DEV(TipsY
)
1354 READ_FLOAT_DEV(TeleportInfoY
)
1356 READ_STRING_DEV(SceneName
)
1358 READ_STRING_DEV(IdFilePath
)
1361 READ_STRINGVECTOR_DEV(PacsPrimDir
);
1366 CConfigFile::CVar
*pcvTmp
= ClientCfg
.ConfigFile
.getVarPtr("NegFiltersDebug");
1369 int iSz
= pcvTmp
->size();
1370 for(int k
= 0; k
< iSz
; ++k
)
1372 DebugLog
->addNegativeFilter (pcvTmp
->asString(k
).c_str());
1376 cfgWarning("Default value used for 'NegFiltersDebug'");
1378 pcvTmp
= ClientCfg
.ConfigFile
.getVarPtr("NegFiltersInfo");
1381 int iSz
= pcvTmp
->size();
1382 for(int k
= 0; k
< iSz
; ++k
)
1384 InfoLog
->addNegativeFilter (pcvTmp
->asString(k
).c_str());
1388 cfgWarning("Default value used for 'NegFiltersInfo'");
1390 pcvTmp
= ClientCfg
.ConfigFile
.getVarPtr("NegFiltersWarning");
1393 int iSz
= pcvTmp
->size();
1394 for(int k
= 0; k
< iSz
; ++k
)
1396 WarningLog
->addNegativeFilter (pcvTmp
->asString(k
).c_str());
1400 cfgWarning("Default value used for 'NegFiltersWarning'");
1403 READ_STRINGVECTOR_FV(StartCommands
);
1407 // Colors for system infos
1408 ClientCfg
.SystemInfoParams
.clear();
1409 CConfigFile::CVar
*sic
= ClientCfg
.ConfigFile
.getVarPtr("SystemInfoColors");
1412 cfgWarning("Can't read SystemInfoColors, all colors defaulting to white");
1416 if (sic
->size() & 1)
1418 cfgWarning("Expecting odd size for SystemInfoColors. Last entry ignored.");
1420 uint numCol
= sic
->size() >> 1;
1421 for(uint k
= 0; k
< numCol
; ++k
)
1427 if (sscanf(sic
->asString((2 * k
) + 1).c_str(), "%d %d %d %d %s %s", &r
, &g
, &b
, &a
, mode
, fx
) < 5)
1429 if(DisplayCFGWarning
)
1430 nlwarning("Can't parse color for entry %s", sic
->asString(2 * k
).c_str());
1436 p
.Color
= CRGBA(r
, g
, b
, a
);
1437 p
.Mode
= SSysInfoParam::Normal
;
1438 p
.SysInfoFxName
= string(fx
);
1439 if (stricmp(mode
, "over") == 0) p
.Mode
= SSysInfoParam::Over
;
1440 else if (stricmp(mode
, "overonly") == 0) p
.Mode
= SSysInfoParam::OverOnly
;
1441 else if (stricmp(mode
, "center") == 0) p
.Mode
= SSysInfoParam::Center
;
1442 else if (stricmp(mode
, "centeraround") == 0) p
.Mode
= SSysInfoParam::CenterAround
;
1443 else if (stricmp(mode
, "around") == 0) p
.Mode
= SSysInfoParam::Around
;
1445 ClientCfg
.SystemInfoParams
[toLowerAscii(sic
->asString(2 * k
))] = p
;
1450 #ifndef RZ_NO_CLIENT
1451 // printf commands in loading screens
1452 ClientCfg
.PrintfCommands
.clear();
1453 ClientCfg
.PrintfCommandsFreeTrial
.clear();
1454 std::vector
< std::string
> printfCommands(2);
1455 printfCommands
[0] = "PrintfCommands";
1456 printfCommands
[1] = "PrintfCommandsFreeTrial";
1457 for(uint p
=0; p
<2; p
++)
1459 CConfigFile::CVar
*pc
= ClientCfg
.ConfigFile
.getVarPtr(printfCommands
[p
].c_str());
1462 if( pc
->size()%5 == 0 && pc
->size() >= 5)
1464 for (uint i
= 0; i
< pc
->size(); i
+=5)
1466 SPrintfCommand pcom
;
1467 pcom
.X
= pc
->asInt(i
);
1468 pcom
.Y
= pc
->asInt(i
+1);
1469 pcom
.Color
= CRGBA::stringToRGBA( pc
->asString(i
+2).c_str() );
1470 pcom
.FontSize
= pc
->asInt(i
+3);
1471 pcom
.Text
= pc
->asString(i
+4);
1473 if(p
==0) ClientCfg
.PrintfCommands
.push_back( pcom
);
1474 else ClientCfg
.PrintfCommandsFreeTrial
.push_back( pcom
);
1479 cfgWarning(("Missing or too many parameters in " + printfCommands
[p
]).c_str());
1485 READ_INT_FV(LoadingStringCount
)
1488 READ_INT_DEV(CheckMemoryEveryNFrame
)
1489 READ_BOOL_DEV(LogMemoryAllocation
)
1490 READ_INT_DEV(LogMemoryAllocationSize
)
1493 READ_BOOL_FV(SelectWithRClick
)
1494 READ_BOOL_DEV(RunAtTheBeginning
)
1495 READ_FLOAT_FV(RotKeySpeedMax
)
1496 READ_FLOAT_FV(RotKeySpeedMin
)
1497 READ_FLOAT_FV(RotAccel
)
1498 READ_BOOL_DEV(PutBackItems
)
1499 READ_BOOL_DEV(ShowNameUnderCursor
)
1500 READ_BOOL_DEV(ShowNameSelected
)
1501 READ_FLOAT_DEV(ShowNameBelowDistanceSqr
)
1502 READ_BOOL_DEV(ForceIndoorFPV
)
1503 READ_BOOL_FV(FollowOnAtk
);
1504 READ_BOOL_FV(AtkOnSelect
);
1505 READ_BOOL_DEV(TransparentUnderCursor
);
1507 READ_BOOL_FV(ItemGroupAllowGuild
);
1512 // Read the view mode at load time only, cause prefer keep ingame player setup
1513 if(firstTimeSetValues
)
1517 READ_FLOAT_FV(CameraDistStep
)
1518 READ_FLOAT_FV(CameraDistMin
)
1519 READ_FLOAT_FV(CameraDistMax
)
1520 READ_FLOAT_FV(DmCameraDistMax
)
1521 READ_FLOAT_FV(CameraAccel
)
1522 READ_FLOAT_FV(CameraSpeedMin
)
1523 READ_FLOAT_FV(CameraSpeedMax
)
1524 READ_FLOAT_FV(CameraResetSpeed
)
1525 // Read the camera height and distance at load time only, cause prefer keep ingame player setup
1526 if(firstTimeSetValues
)
1528 READ_FLOAT_FV(CameraHeight
)
1529 READ_FLOAT_FV(CameraDistance
)
1532 // Default values for CGroupMap
1533 READ_FLOAT_FV(MaxMapScale
);
1534 READ_FLOAT_FV(R2EDMaxMapScale
);
1536 // /tar to update compass or not
1537 READ_BOOL_FV(TargetChangeCompass
);
1541 // Shadows : Get Shadows state
1542 READ_BOOL_FV(Shadows
)
1543 // ShadowsClipFar : Get Shadows Clip Far.
1544 READ_FLOAT_DEV(ShadowsClipFar
)
1545 // ShadowsLodDist : Get Shadows Lod Distance.
1546 READ_FLOAT_DEV(ShadowsLodDist
)
1548 READ_FLOAT_DEV(ShadowZDirClampLandscape
);
1549 READ_FLOAT_DEV(ShadowZDirClampInterior
);
1550 READ_FLOAT_DEV(ShadowZDirClampSmoothSpeed
);
1552 READ_FLOAT_DEV(ShadowMaxDepthLandscape
);
1553 READ_FLOAT_DEV(ShadowMaxDepthInterior
);
1554 READ_FLOAT_DEV(ShadowMaxDepthSmoothSpeed
);
1560 READ_FLOAT_DEV(GroundFXMaxDist
)
1561 READ_INT_DEV(GroundFXMaxNB
)
1562 READ_INT_DEV(GroundFXCacheSize
)
1564 // Names : Get Names state
1569 READ_INT_FV(ProcessPriority
)
1571 READ_INT_FV(CPUMask
)
1572 // ShowPath : Get the ShowPath value.
1573 READ_BOOL_DEV(ShowPath
)
1574 // UserSheet : Get the sheet to used for the use rin Local mode.
1575 READ_STRING_DEV(UserSheet
)
1578 varPtr
= ClientCfg
.ConfigFile
.getVarPtr("Sex");
1580 ClientCfg
.Sex
= (GSGENDER::EGender
)varPtr
->asInt();
1582 cfgWarning("Default value used for 'Sex' !!!");
1583 #endif // FINAL_VERSION
1584 // PrimitiveHeightAddition
1585 READ_BOOL_DEV(PrimitiveHeightAddition
)
1587 READ_BOOL_DEV(DrawBoxes
)
1590 // ChaseReactionTime
1591 READ_FLOAT_DEV(ChaseReactionTime
)
1593 READ_FLOAT_DEV(RyzomTime
)
1595 READ_INT_DEV(RyzomDay
)
1596 // ManualWeatherSetup
1597 READ_BOOL_DEV(ManualWeatherSetup
)
1599 READ_BOOL_DEV(ForceLanguage
)
1600 if (!ClientCfg
.ForceLanguage
)
1602 READ_STRING_FV(LanguageCode
)
1604 // DebugStringManager
1605 READ_BOOL_DEV(DebugStringManager
)
1608 READ_STRING_FV(LastLogin
)
1612 READ_BOOL_DEV(VerboseVP
)
1613 READ_BOOL_DEV(VerboseAnimUser
)
1614 READ_BOOL_DEV(VerboseAnimSelection
)
1615 READ_BOOL_DEV(VerboseAllTraffic
)
1617 READ_STRING_DEV(LigoPrimitiveClass
);
1621 READ_INT_DEV(SimulatePacketLossRatio
)
1622 READ_BOOL_DEV(PreCacheShapes
)
1623 READ_BOOL_FV(ResetShapeBankOnRetCharSelect
)
1624 READ_BOOL_DEV(DisplayMissingAnimFile
)
1625 READ_STRING_DEV(DefaultEntity
)
1626 READ_BOOL_DEV(RestrainPI
)
1627 READ_BOOL_DEV(DumpVSIndex
)
1628 READ_INT_DEV(HelpFontSize
)
1632 CConfigFile::CVar
*cvHelpFontColor
= ClientCfg
.ConfigFile
.getVarPtr("HelpFontColor");
1633 if(cvHelpFontColor
&& cvHelpFontColor
->size() == 3)
1635 ClientCfg
.HelpFontColor
.R
= cvHelpFontColor
->asInt(0);
1636 ClientCfg
.HelpFontColor
.G
= cvHelpFontColor
->asInt(1);
1637 ClientCfg
.HelpFontColor
.B
= cvHelpFontColor
->asInt(2);
1638 ClientCfg
.HelpFontColor
.A
= 255;
1641 cfgWarning("Default value used for 'HelpFontColor' !!!");
1643 #endif // !FINAL_VERSION
1645 READ_FLOAT_DEV(HelpLineStep
)
1647 READ_INT_DEV(DebugFontSize
)
1650 CConfigFile::CVar
*pcvDebugFontColor
= ClientCfg
.ConfigFile
.getVarPtr("DebugFontColor");
1651 if( pcvDebugFontColor
&& (pcvDebugFontColor
->size() == 3) )
1653 ClientCfg
.DebugFontColor
.R
= pcvDebugFontColor
->asInt(0);
1654 ClientCfg
.DebugFontColor
.G
= pcvDebugFontColor
->asInt(1);
1655 ClientCfg
.DebugFontColor
.B
= pcvDebugFontColor
->asInt(2);
1656 ClientCfg
.DebugFontColor
.A
= 255;
1659 cfgWarning("Default value used for 'DebugFontColor'");
1660 #endif // !FINAL_VERSION
1661 READ_FLOAT_DEV(DebugLineStep
)
1664 READ_CVECTOR_DEV(HeadOffset
)
1665 READ_BOOL_DEV(FPExceptions
)
1666 READ_BOOL_DEV(NeedComputeVS
)
1667 READ_BOOL_DEV(Check
)
1668 READ_BOOL_DEV(UsePACSForAll
)
1669 READ_FLOAT_DEV(WaterEnvMapUpdateTime
)
1670 READ_BOOL_DEV(BlendForward
)
1672 ClientCfg
.ZCPacsPrim
= "gen_bt_col_ext.pacs_prim";
1673 READ_STRING_DEV(ZCPacsPrim
)
1675 READ_BOOL_FV(AutoReloadFiles
)
1676 READ_BOOL_DEV(BlendShapePatched
)
1678 READ_INT_DEV(MaxNumberOfTimedFXInstances
);
1680 READ_STRING_DEV(SelectionFX
);
1681 READ_STRING_DEV(MouseOverFX
);
1682 READ_FLOAT_DEV(SelectionFXSize
);
1684 if(ClientCfg
.ConfigFile
.exists("ExtendedCommands") && ClientCfg
.ConfigFile
.getVar("ExtendedCommands").asString() == "Enable")
1685 ClientCfg
.ExtendedCommands
= true;
1688 READ_BOOL_DEV(R2Mode
);
1689 if (ClientCfg
.Local
) // R2EDEnabled is now set by the server
1691 READ_BOOL_DEV(R2EDEnabled
)
1693 READ_INT_FV(R2EDDssNetwork
)
1696 if (ClientCfg
.Local
)
1698 ClientCfg
.R2EDDssNetwork
= 1;
1701 READ_BOOL_DEV(R2EDExtendedDebug
)
1704 CConfigFile::CVar
*var
= ClientCfg
.ConfigFile
.getVarPtr("R2EDExtendedDebug");
1709 // else no-op -> will resolve to 'nil' into lua
1714 READ_BOOL_DEV(R2EDVerboseParseTime
)
1715 READ_BOOL_DEV(R2EDDontReparseUnchangedUIFiles
)
1716 READ_BOOL_DEV(R2EDLightPalette
)
1717 READ_INT_FV(R2EDAutoSaveWait
)
1718 READ_INT_FV(R2EDAutoSaveSlot
)
1719 READ_BOOL_DEV(R2EDMustVerifyRingAccessWhileLoadingAnimation
)
1720 READ_BOOL_FV(R2EDUseVerboseRingAccess
)
1726 // Array with the name of all offensive impact FXs.
1727 READ_STRINGVECTOR_DEV(OffImpactFX
);
1729 #ifndef RZ_NO_CLIENT
1734 #ifdef NL_OS_WINDOWS
1735 if(ClientCfg
.FPExceptions
)
1736 _control87(_EM_DENORMAL
/*|_EM_INVALID|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW
|_EM_INEXACT
, _MCW_EM
);
1738 _control87(_EM_INVALID
|_EM_DENORMAL
|_EM_ZERODIVIDE
|_EM_OVERFLOW
|_EM_UNDERFLOW
|_EM_INEXACT
, _MCW_EM
);
1740 // Set the process priority
1741 static DWORD priority
[6]=
1743 0x40, // IDLE_PRIORITY_CLASS
1744 0x4000, // BELOW_NORMAL_PRIORITY_CLASS
1745 0x20, // NORMAL_PRIORITY_CLASS
1746 0x8000, // ABOVE_NORMAL_PRIORITY_CLASS
1747 0x80, // HIGH_PRIORITY_CLASS
1748 0x100, // REALTIME_PRIORITY_CLASS
1751 int index
= ClientCfg
.ProcessPriority
+2;
1753 SetPriorityClass (GetCurrentProcess(), priority
[index
]);
1754 #endif // NL_OS_WINDOWS
1756 // Init Verbose Modes (at the beginning to be able to display them as soon as possible).
1757 ::VerboseVP
= ClientCfg
.VerboseVP
;
1758 ::VerboseAnimUser
= ClientCfg
.VerboseAnimUser
;
1759 ::VerboseAnimSelection
= ClientCfg
.VerboseAnimSelection
;
1760 #ifdef LOG_ALL_TRAFFIC
1761 NLMISC::VerboseAllTraffic
= ClientCfg
.VerboseAllTraffic
;
1764 // (re-)Initialize contextual cursors.
1765 if (!ClientCfg
.R2EDEnabled
)
1767 initContextualCursor();
1771 READ_STRINGVECTOR_DEV(PrimFiles
);
1773 // Reset GlobalWind Setup
1776 Scene
->setGlobalWindPower(ClientCfg
.GlobalWindPower
);
1777 Scene
->setGlobalWindDirection(ClientCfg
.GlobalWindDirection
);
1782 // Set the monitor color properties
1783 CMonitorColorProperties monitorColor
;
1784 for(uint i
=0; i
<3; i
++)
1786 monitorColor
.Contrast
[i
] = ClientCfg
.Contrast
;
1787 monitorColor
.Luminosity
[i
] = ClientCfg
.Luminosity
;
1788 monitorColor
.Gamma
[i
] = ClientCfg
.Gamma
;
1790 if(!Driver
->setMonitorColorProperties(monitorColor
))
1791 cfgWarning("reloadCFG: setMonitorColorProperties fails");
1795 // Show/hide all or parts of the user body.
1798 UserEntity
->eyesHeight(ClientCfg
.EyesHeight
);
1799 UserEntity
->updateVisualDisplay();
1801 // Run speed and camera dist max are set according to R2 char mode
1802 UserEntity
->flushR2CharMode();
1805 // Initialize the camera distance (after camera dist max)
1806 View
.setCameraDistanceMaxForPlayer();
1808 // draw in client light?
1811 ClientCfg
.DrawBoxes
= true;
1812 ClientCfg
.Names
= true;
1816 if (ClientCfg
.Local
)
1818 uint32 tickOffset
= (uint32
)(ClientCfg
.RyzomDay
* RYZOM_HOURS_IN_TICKS
* 24 + ClientCfg
.RyzomTime
* RYZOM_HOURS_IN_TICKS
);
1819 RT
.resetTickOffset();
1820 RT
.increaseTickOffset( tickOffset
);
1824 // for reset effect of variable in mainLoop(), set true
1825 ClientCfg
.IsInvalidated
= true;
1827 // Allow warning display only first time.
1828 DisplayCFGWarning
= false;
1830 // If it is the load time, backup the ClientCfg into LastClientCfg
1831 if(firstTimeSetValues
)
1832 LastClientCfg
= ClientCfg
;
1835 firstTimeSetValues
= false;
1837 READ_INT_DEV(NumFrameForProfile
);
1838 READ_STRING_FV(KlientChatPort
);
1839 READ_BOOL_DEV(SimulateServerTick
);
1841 READ_BOOL_DEV(DamageShieldEnabled
)
1843 READ_BOOL_FV(AllowDebugLua
)
1844 READ_BOOL_FV(DisplayLuaDebugInfo
)
1846 READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled
)
1847 READ_STRING_DEV(LuaDebugInfoGotoButtonTemplate
)
1848 READ_STRING_DEV(LuaDebugInfoGotoButtonCaption
)
1849 READ_STRING_DEV(LuaDebugInfoGotoButtonFunction
)
1852 READ_BOOL_DEV(BeepWhenLaunched
)
1854 READ_STRING_DEV(R2ClientGw
)
1856 READ_FLOAT_FV(FogDistAndDepthLookupBias
)
1858 READ_INT_DEV(R2EDLoadDynamicFeatures
)
1860 READ_BOOL_DEV(CheckR2ScenarioMD5
);
1862 CConfigFile::CVar
*pcvHardwareCursors
= ClientCfg
.ConfigFile
.getVarPtr("HardwareCursors");
1863 if(pcvHardwareCursors
)
1865 ClientCfg
.HardwareCursors
.clear ();
1866 int iSz
= pcvHardwareCursors
->size();
1867 for (int i
= 0; i
< iSz
; i
++)
1868 ClientCfg
.HardwareCursors
.insert(toLowerAscii(pcvHardwareCursors
->asString(i
)));
1872 cfgWarning("Default value used for 'HardwareCursors'");
1873 // default list of harware cursors
1874 ClientCfg
.HardwareCursors
.insert("curs_can_pan.tga");
1875 ClientCfg
.HardwareCursors
.insert("curs_can_pan_dup.tga");
1876 ClientCfg
.HardwareCursors
.insert("curs_create.tga");
1877 ClientCfg
.HardwareCursors
.insert("curs_create_multi.tga");
1878 ClientCfg
.HardwareCursors
.insert("curs_create_vertex_invalid.tga");
1879 ClientCfg
.HardwareCursors
.insert("curs_default.tga");
1880 ClientCfg
.HardwareCursors
.insert("curs_dup.tga");
1881 ClientCfg
.HardwareCursors
.insert("curs_L.tga");
1882 ClientCfg
.HardwareCursors
.insert("curs_M.tga");
1883 ClientCfg
.HardwareCursors
.insert("curs_pan.tga");
1884 ClientCfg
.HardwareCursors
.insert("curs_pan_dup.tga");
1885 ClientCfg
.HardwareCursors
.insert("curs_pick.tga");
1886 ClientCfg
.HardwareCursors
.insert("curs_pick_dup.tga");
1887 ClientCfg
.HardwareCursors
.insert("curs_R.tga");
1888 ClientCfg
.HardwareCursors
.insert("curs_resize_BL_TR.tga");
1889 ClientCfg
.HardwareCursors
.insert("curs_resize_BR_TL.tga");
1890 ClientCfg
.HardwareCursors
.insert("curs_resize_LR.tga");
1891 ClientCfg
.HardwareCursors
.insert("curs_resize_TB.tga");
1892 ClientCfg
.HardwareCursors
.insert("curs_rotate.tga");
1893 ClientCfg
.HardwareCursors
.insert("curs_scale.tga");
1894 ClientCfg
.HardwareCursors
.insert("curs_stop.tga");
1895 ClientCfg
.HardwareCursors
.insert("text_cursor.tga");
1896 ClientCfg
.HardwareCursors
.insert("r2_hand_can_pan.tga");
1897 ClientCfg
.HardwareCursors
.insert("r2_hand_pan.tga");
1898 ClientCfg
.HardwareCursors
.insert("r2ed_tool_can_pick.tga");
1899 ClientCfg
.HardwareCursors
.insert("r2ed_tool_can_rotate.tga");
1900 ClientCfg
.HardwareCursors
.insert("r2ed_tool_pick.tga");
1901 ClientCfg
.HardwareCursors
.insert("r2ed_tool_rotate.tga");
1902 ClientCfg
.HardwareCursors
.insert("r2ed_tool_rotating.tga");
1905 // languages and types of Ring Scenarii
1906 READ_STRINGVECTOR_FV(ScenarioLanguages
);
1907 READ_STRINGVECTOR_FV(ScenarioTypes
);
1910 READ_STRING_FV(BuildName
)
1912 READ_BOOL_DEV(DisplayTPReason
)
1914 //READ_INT_FV(TPQuitButtonX)
1915 //READ_INT_FV(TPQuitButtonY)
1916 //READ_INT_FV(TPCancelButtonX)
1917 //READ_INT_FV(TPCancelButtonY)
1918 READ_INT_FV(TPButtonW
)
1919 READ_INT_FV(TPButtonH
)
1921 READ_STRING_FV(ScenarioSavePath
)
1924 ClientCfg
.R2EDClippedEntityBlendTime
= 0.18f
;
1925 READ_FLOAT_FV(R2EDClippedEntityBlendTime
)
1927 // vl: BackgroundDownloader is hardcoded to false and we don't want to run it, even if the cfg wants it
1928 //READ_BOOL_FV(BackgroundDownloader)
1933 //-----------------------------------------------
1936 //-----------------------------------------------
1937 void CClientConfig::serial(NLMISC::IStream
&f
)
1939 // Start the opening of a new node named ClientCFG.
1940 f
.xmlPush("ClientCFG");
1942 f
.xmlPushBegin("Light");
1947 f
.xmlPushBegin("MonitorName");
1949 f
.serial(MonitorName
);
1952 f
.xmlPushBegin("Windowed");
1957 f
.xmlPushBegin("Width");
1962 f
.xmlPushBegin("Height");
1967 f
.xmlPushBegin("Depth");
1972 f
.xmlPushBegin("Contrast");
1977 f
.xmlPushBegin("Luminosity");
1979 f
.serial(Luminosity
);
1982 f
.xmlPushBegin("Gamma");
1988 f
.xmlPushBegin("AttackDist");
1990 f
.serial(AttackDist
);
1994 f
.xmlPushBegin("SelectWithRClick");
1996 f
.serial(SelectWithRClick
);
1999 // Close the serial for the Client CFG.
2004 //-----------------------------------------------
2006 //-----------------------------------------------
2007 void CClientConfig::init(const string
&configFileName
)
2009 // if the users client config does not exist
2010 if(!CFile::fileExists(configFileName
))
2012 // create the basic .cfg
2013 FILE *fp
= nlfopen(configFileName
, "w");
2016 nlerror("CFG::init: Can't create config file '%s'", configFileName
.c_str());
2018 nlwarning("CFG::init: creating '%s' with default values", configFileName
.c_str ());
2020 // get current locale
2021 std::string lang
= CI18N::getSystemLanguageCode();
2023 const std::vector
<std::string
> &languages
= CI18N::getLanguageCodes();
2025 // search if current locale is defined in language codes
2026 for(uint i
= 0; i
< languages
.size(); ++i
)
2028 if (lang
== languages
[i
])
2030 // store the language code in the config file
2031 fprintf(fp
, "LanguageCode = \"%s\";\n", lang
.c_str());
2039 // read the exising config file (don't parse it yet!)
2040 ucstring content
; // UTF-16 and UTF-8 textfile support
2041 NLMISC::CI18N::readTextFile(configFileName
, content
);
2042 std::string contentUtf8
= content
.toUtf8();
2044 // while there are "RootConfigFilename" values, remove them
2046 while((pos
= contentUtf8
.find("RootConfigFilename")) != configFileName
.npos
)
2048 size_t endOfLine
= contentUtf8
.find("\n", pos
);
2049 contentUtf8
.erase(pos
, (endOfLine
- pos
) + 1);
2052 // get current location of the root config file (client_default.cfg)
2053 std::string defaultConfigLocation
;
2054 if(!getDefaultConfigLocation(defaultConfigLocation
))
2055 nlerror("cannot find client_default.cfg");
2057 // and store it in the RootConfigFilename value in the very first line
2058 contentUtf8
.insert(0, std::string("RootConfigFilename = \"") +
2059 defaultConfigLocation
+ "\";\n");
2061 // save the updated config file
2062 NLMISC::COFile
configFile(configFileName
, false, true, false);
2063 configFile
.serialBuffer((uint8
*)contentUtf8
.c_str(), (uint
)contentUtf8
.size());
2066 // now we can continue loading and parsing the config file
2068 // if the config file will be modified, it calls automatically the function setValuesOnFileChange()
2069 ClientCfg
.ConfigFile
.setCallback (CClientConfig::setValuesOnFileChange
);
2071 // load the config files
2072 ClientCfg
.ConfigFile
.load (configFileName
);
2074 CConfigFile::CVar
*pCV
;
2075 // check language code is supported
2076 pCV
= ClientCfg
.ConfigFile
.getVarPtr("LanguageCode");
2079 std::string lang
= pCV
->asString();
2080 if (!CI18N::isLanguageCodeSupported(lang
))
2082 nlinfo("Unsupported language code \"%s\" fallback on default", lang
.c_str());
2083 // fallback to default language
2084 ClientCfg
.LanguageCode
= CI18N::getSystemLanguageCode();
2085 // update ConfigFile variable
2086 pCV
->setAsString(ClientCfg
.LanguageCode
);
2087 ClientCfg
.ConfigFile
.save();
2091 // update the ConfigFile variable in the config file
2092 pCV
= ClientCfg
.ConfigFile
.getVarPtr("ClientVersion");
2095 std::string str
= pCV
->asString ();
2096 if (str
!= getVersion() && ClientCfg
.SaveConfig
)
2098 nlinfo ("Update and save the ClientVersion variable in config file %s -> %s", str
.c_str(), getVersion().c_str());
2099 pCV
->setAsString(getVersion());
2100 ClientCfg
.ConfigFile
.save();
2104 nlwarning ("There's no ClientVersion variable in the config file!");
2109 //-----------------------------------------------
2111 //-----------------------------------------------
2112 void CClientConfig::release ()
2114 #ifndef RZ_NO_CLIENT
2115 // Do we have to save the cfg file ?
2116 if (ClientCfg
.SaveConfig
)
2121 CConfigFile::CVar
*varPtr
= NULL
;
2123 // Driver still alive ?
2124 if (Driver
&& Driver
->isActive ())
2127 uint32 width
, height
;
2129 Driver
->getWindowPos(x
, y
);
2130 Driver
->getWindowSize(width
, height
);
2132 // Are we in window mode ?
2133 if (ClientCfg
.Windowed
/* && !isWindowMaximized() */)
2135 // Save windows position. width/height are saved when leaving ingame.
2136 writeInt("PositionX", x
);
2137 writeInt("PositionY", y
);
2141 // Save if in FPV or TPV.
2142 writeBool("FPV", ClientCfg
.FPV
);
2144 // Save the camera distance
2145 writeDouble("CameraDistance", ClientCfg
.CameraDistance
);
2147 catch (const Exception
&e
)
2149 nlwarning ("Error while set config file variables : %s", e
.what ());
2153 ClientCfg
.ConfigFile
.save ();
2158 bool CClientConfig::readBool (const std::string
&varName
)
2161 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2163 bVal
= varPtr
->asInt() ? true : false;
2165 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2169 void CClientConfig::writeBool (const std::string
&varName
, bool bVal
, bool bForce
)
2171 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2173 varPtr
->forceAsInt(bVal
? 1:0);
2175 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2178 sint32
CClientConfig::readInt (const std::string
&varName
)
2181 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2183 bVal
= varPtr
->asInt();
2185 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2189 void CClientConfig::writeInt (const std::string
&varName
, sint32 bVal
, bool bForce
)
2191 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2193 varPtr
->forceAsInt(bVal
);
2195 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2198 double CClientConfig::readDouble (const std::string
&varName
)
2201 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2203 bVal
= varPtr
->asDouble();
2205 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2209 void CClientConfig::writeDouble (const std::string
&varName
, double dVal
, bool bForce
)
2211 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2213 varPtr
->forceAsDouble(dVal
);
2215 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2218 string
CClientConfig::readString (const std::string
&varName
)
2221 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2223 sVal
= varPtr
->asString();
2225 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2229 void CClientConfig::writeString (const std::string
&varName
, const std::string
&strVal
, bool bForce
)
2231 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2233 varPtr
->forceAsString(strVal
);
2235 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2238 // ***************************************************************************
2239 bool CClientConfig::readBoolNoWarning(const std::string
&varName
)
2242 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2244 bVal
= varPtr
->asInt() ? true : false;
2248 sint32
CClientConfig::readIntNoWarning(const std::string
&varName
)
2251 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2253 bVal
= varPtr
->asInt();
2257 double CClientConfig::readDoubleNoWarning(const std::string
&varName
)
2260 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2262 bVal
= varPtr
->asDouble();
2266 // ***************************************************************************
2267 float CClientConfig::getActualLandscapeThreshold() const
2269 // The threshold to set in landscape is the inverse of the CFG one
2270 return 1.0f
/LandscapeThreshold
;
2273 // ***************************************************************************
2274 string
CClientConfig::getHtmlLanguageCode() const
2276 if(LanguageCode
=="wk")
2279 return LanguageCode
;
2282 // ***************************************************************************
2283 string
CClientConfig::buildLoadingString( const string
& ucstr
) const
2285 if( LoadingStringCount
> 0 )
2287 uint index
= rand()%LoadingStringCount
;
2288 string tipId
= "uiLoadingString" + toString(index
);
2289 return CI18N::get(tipId
);
2295 // ***************************************************************************
2296 bool CClientConfig::getDefaultConfigLocation(std::string
& p_name
) const
2298 std::string defaultConfigFileName
= "client_default.cfg";
2299 std::string defaultConfigPath
;
2304 // on mac, client_default.cfg should be searched in .app/Contents/Resources/
2305 defaultConfigPath
= getAppBundlePath() + "/Contents/Resources/";
2307 // unders Windows or Linux, search client_default.cfg is same directory as executable
2308 defaultConfigPath
= Args
.getProgramPath();
2311 std::string currentPath
= CPath::standardizePath(CPath::getCurrentPath());
2312 std::string etcPath
= CPath::standardizePath(getRyzomEtcPrefix());
2314 // look in the current working directory first
2315 if (CFile::isExists(currentPath
+ defaultConfigFileName
))
2316 p_name
= currentPath
+ defaultConfigFileName
;
2318 // look in startup directory
2319 else if (CFile::isExists(Args
.getStartupPath() + defaultConfigFileName
))
2320 p_name
= Args
.getStartupPath() + defaultConfigFileName
;
2322 // look in application directory
2323 else if (CFile::isExists(defaultConfigPath
+ defaultConfigFileName
))
2324 p_name
= defaultConfigPath
+ defaultConfigFileName
;
2326 // look in etc prefix path
2327 else if (!etcPath
.empty() && CFile::isExists(etcPath
+ defaultConfigFileName
))
2328 p_name
= etcPath
+ defaultConfigFileName
;
2330 // if some client_default.cfg was found return true
2331 return !p_name
.empty();