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_2x");
331 TexturesInterfaceDXTC
.push_back("texture_interfaces_dxtc_2x");
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;
416 ScreenShotDirectory
= "screenshots";
418 ScreenShotHeight
= 0;
419 ScreenShotFullDetail
= true;
420 ScreenShotZBuffer
= false;
422 MaxNumberOfTimedFXInstances
= 20;
423 SelectionFX
= "sfx_selection_mouseover.ps";
424 MouseOverFX
= "sfx_selection_mouseover.ps";
425 SelectionFXSize
= 0.8f
;
435 PatchVersion
.clear();
437 WebIgMainDomain
= RYZOM_WEBIG_MAIN_URL
; // https://open.ryzom.dev/"
438 WebIgTrustedDomains
.push_back(RYZOM_WEBIG_TRUSTED_DOMAIN
); // open.ryzom.dev
439 WebIgNotifInterval
= 10; // time in minutes
441 CurlMaxConnections
= 5;
442 CurlCABundle
.clear();
444 RingReleaseNotePath
= WebIgMainDomain
+ "/app_releasenotes/index.php";
445 ReleaseNotePath
= WebIgMainDomain
+ "/app_releasenotes/index.php";
450 // With a bigger angle, rotation is animated.
451 AnimatedAngleThreshold
= 25.0; //
452 BlendFrameNumber
= 5; //
453 DestThreshold
= 0.01; // Destination Threshold
454 PositionLimiterRadius
= 0.1;
455 SignificantDist
= 0.0001; // Significant Distance
458 SoundOn
= true; // Default is with sound.
459 DriverSound
= SoundDrvAuto
;
460 SoundForceSoftwareBuffer
= true;
461 StartMusic
= "main theme air.ogg"; // Use at game startup (originally no music)
462 EmptySlotMusic
= "loading music loop.ogg"; // Use in character selection for empty slots
463 LoadingMusic
= "main menu loop.ogg"; // Main loading used after leaving character selection, and when going back to character selection
464 KamiTeleportMusic
= "kami teleport.ogg"; // Kami teleport
465 KaravanTeleportMusic
= "karavan teleport.ogg"; // Karavan teleport
466 TeleportLoadingMusic
= "loading music loop.ogg"; // Use for generic teleportations
467 DeathMusic
= "death.ogg"; // Player death
468 SoundSFXVolume
= 1.f
;
469 SoundGameMusicVolume
= 1.f
;
471 EnableBackgroundMusicTimeConstraint
= true;
473 SoundPackedSheetPath
= "data/sound/"; // Default path for sound packed sheets
474 SampleBankDir
= "data/sound/samplebanks"; // Default path for samples
475 UserEntitySoundLevel
= 0.5f
; // Default volume for sound in 1st person
476 UseEax
= true; // Default to use EAX;
477 UseADPCM
= false; // Defualt to PCM sample, NO ADPCM
478 MaxTrack
= 32; // Default to 32 track
480 ColorShout
= CRGBA(150,0,0,255); // Default Shout color.
481 ColorTalk
= CRGBA(255,255,255,255); // Default Talk color.
483 StreamedPackagePath
= "stream";
486 MediaPlayerDirectory
= "music";
487 MediaPlayerAutoPlay
= false;
489 // PreDataPath.push_back("data/gamedev/language/"); // Default Path for the language data
491 // DataPath.push_back("data/"); // Default Path for the Data.
492 // DataPath.push_back("data_leveldesign/"); // Default Path for the Level Design Directory.
493 // DataPath.push_back("data_common/"); // Default Path for the Level Design Directory.
495 DataPathNoRecurse
.push_back("data_leveldesign/leveldesign/Game_Elem");
497 UpdatePackedSheetPath
.push_back("data_leveldesign");
499 UpdatePackedSheet
= false; // Update packed sheet if needed
501 EndScreenTimeOut
= 0.f
; // Default time out for the screen at the end of the application.
502 Loading_BG
= "loading_bg.tga"; // Default name for the loading background file.
503 LoadingFreeTrial_BG
= "loading_free_trial_bg.tga"; // Default name for the loading background file in FreeTrial mode.
504 Launch_BG
= "launcher_bg.tga"; // Default name for the launch background file.
505 TeleportKami_BG
= "teleport_kami_bg.tga";
506 TeleportKaravan_BG
= "teleport_caravan_bg.tga";
507 Elevator_BG
= "elevator_bg.tga"; // Default name for the loading background file.
508 ResurectKami_BG
= "resurect_kami_bg.tga";
509 ResurectKaravan_BG
= "resurect_caravane_bg.tga";
510 End_BG
= "end_bg.tga"; // Default name for the last background file.
511 IntroNevrax_BG
= "launcher_nevrax.tga";
512 IntroNVidia_BG
= "launcher_nvidia.tga";
515 TeleportInfoY
= 0.23f
;
518 IdFilePath
= "sheet_id.bin";
519 PacsPrimDir
.push_back("data/3d/");
521 Shadows
= true; // Draw Shadows by default.
522 ShadowsClipFar
= 10.f
; // Shadows are disabled after this distance.
523 ShadowsLodDist
= 3.f
; // Shadows draw with just 1 part after this distance.
524 ShadowZDirClampLandscape
= -0.5f
; // On landscape, allow a minimum Phi angle of -30 degrees
525 ShadowZDirClampInterior
= -0.86f
; // On Interior, allow a minimum Phi angle of -60 degrees
526 ShadowZDirClampSmoothSpeed
= 0.5f
;
527 ShadowMaxDepthLandscape
= 8.f
;
528 ShadowMaxDepthInterior
= 2.f
;
529 ShadowMaxDepthSmoothSpeed
= 6.f
;
532 Names
= false; // Don't draw Names by default.
534 Sleep
= -1; // Default : client does not sleep.
535 ProcessPriority
= 0; // Default : NORMAL
536 CPUMask
= 0; // Default : auto detection
537 ShowPath
= false; // Default : do not display the path.
538 DrawBoxes
= false; // Default : Do not draw the selection.
540 UserSheet
= "fyros.race_stats"; // Default sheet used.
541 Sex
= GSGENDER::male
; // Default : male.
543 PrimitiveHeightAddition
= 2.f
; // Default : 2.f
549 ManualWeatherSetup
= false;
551 ChaseReactionTime
= 0.4f
; // Reaction time before chasing someone.
553 TimeToAdjustCamera
= 1000.0;
554 ChangeDirAngle
= 1.70f
; // Default Angle.
556 GuildSymbolSize
= 0.3f
; // Default Guild Symbol Size.
557 SelectionDist
= 150.f
; // Default dist in meter.
558 SelectionOutBBoxWeight
= 16.f
; // Default factor
559 LootDist
= 4.f
; // Default loot/harvest distance (in meter).
560 SpaceSelectionDist
= 50.f
;
561 SpaceSelectionMaxCycle
= 1;
563 ForceLanguage
= false;
564 LanguageCode
= "en"; // Default to english
565 DebugStringManager
= false; // Default to no debug
568 WaterOffset
= -1.085f
;
569 FyrosWaterOffset
= -1.0f
;
570 MatisWaterOffset
= -1.08f
;
571 TrykerWaterOffset
= -0.88f
;
572 ZoraiWaterOffset
= -1.25f
;
573 WaterOffsetCreature
= -1.6f
;
574 TimeToRemoveCol
= 1000;
575 MoveToTimeToStopStall
= 500;
578 MaxHeadTargetDist
= 30.0f
;
579 DeadFXName
= "misc_dead.ps";
580 ImpactFXName
= "impact.ps";
581 SkillUpFXName
= "misc_levelup.ps";
583 NameScale
= 1.0f
; // Default Scale to display Names.
587 ConstNameSizeDist
= 20.0f
;
588 StaticNameHeight
= true;
593 ForageInterfaceZBias
= -10.f
;
598 EnableRacialAnimation
= true;
601 RunAtTheBeginning
= true;
602 SelectWithRClick
= false; // Default right click cannot select.
603 RotKeySpeedMax
= 3.0f
;
604 RotKeySpeedMin
= 1.0f
;
606 PutBackItems
= false;
607 ShowNameUnderCursor
= true;
608 ShowNameSelected
= true;
609 ShowNameBelowDistanceSqr
= 20.f
* 20.f
;
610 ForceIndoorFPV
= false;
613 TransparentUnderCursor
= false;
614 ItemGroupAllowGuild
= false;
618 CameraDistance
= 3.0f
;
619 CameraDistStep
= 1.0f
;
620 CameraDistMin
= 1.0f
;
621 CameraDistMax
= 100.0f
;
622 DmCameraDistMax
= 25.0f
;
624 CameraSpeedMin
= 0.2f
;
625 CameraSpeedMax
= 1.0f
;
626 CameraResetSpeed
= 2.0f
;
629 R2EDMaxMapScale
= 8.0f
;
631 TargetChangeCompass
= true;
635 VerboseAnimUser
= false;
636 VerboseAnimSelection
= false;
637 VerboseAllTraffic
= false;
640 DisplayMissingAnimFile
= false;
641 DefaultEntity
= "ccafb1.creature";
645 HelpFontColor
= CRGBA(255,255,255);
646 HelpLineStep
= 0.025f
;
648 DebugFontColor
= CRGBA(250, 250, 250);
649 DebugLineStep
= 0.02f
;
650 HeadOffset
= CVector(0.f
, 0.f
, 0.f
);
654 FPExceptions
= false; // Disable Floating Point Exceptions.
655 DisplayWeapons
= false; // Do not dusplay weapons in first person.
656 NeedComputeVS
= false; // Do not need to compute Visual Slots.
658 GroundFXMaxDist
= 40.f
;
660 GroundFXCacheSize
= 10;
662 AutoReloadFiles
= false;
663 BlendShapePatched
= true;
664 ExtendedCommands
= false;
666 WaterEnvMapUpdateTime
= 1.f
;
668 NumFrameForProfile
= 0;
669 SimulateServerTick
= false;
674 PreCacheShapes
= true;
675 ResetShapeBankOnRetCharSelect
= false;
676 LandscapeEnabled
= true;
677 VillagesEnabled
= true;
679 CacheUIParsing
= false;
680 MicroLifeEnabled
= true;
684 StageLCTUsage
= StageUsePosOnlyLCT
;
686 SimulatePacketLossRatio
= 0;
688 CheckMemoryEveryNFrame
= -1;
689 LogMemoryAllocation
=false;
690 LogMemoryAllocationSize
=8;
692 DamageShieldEnabled
= false;
694 LevelDesignEnabled
= false;
698 R2EDExtendedDebug
= false;
699 R2EDVerboseParseTime
= false;
700 R2EDDontReparseUnchangedUIFiles
= false;
701 R2EDLightPalette
= false;
702 R2EDAutoSaveWait
= 60*5;
703 R2EDAutoSaveSlot
= 9;
704 R2EDMustVerifyRingAccessWhileLoadingAnimation
= false;
705 R2EDUseVerboseRingAccess
= false;
708 DamageShieldEnabled
= false;
710 AllowDebugLua
= false;
711 DisplayLuaDebugInfo
= false;
712 BeepWhenLaunched
= false;
716 LoadingStringCount
= 0;
718 LuaDebugInfoGotoButtonEnabled
= false;
720 FogDistAndDepthLookupBias
= 0.f
;
722 R2EDLoadDynamicFeatures
= 0;
724 CheckR2ScenarioMD5
= true;
726 DisplayTPReason
= false;
728 //TPCancelButtonX = 988;
729 //TPCancelButtonY = 138;
731 //TPQuitButtonY = 138;
736 ScenarioSavePath
= "./my_scenarios/";
738 R2EDClippedEntityBlendTime
= 0.18f
;
740 BackgroundDownloader
= false;
745 //---------------------------------------------------
747 // Load the client config file.
748 //---------------------------------------------------
749 void CClientConfig::setValuesOnFileChange()
751 // ClientCfg.ConfigFile.print (InfoLog);
753 // display an info only when the file change
754 nlinfo ("reloading the config file!");
759 //---------------------------------------------------
761 // Load the client config file.
762 //---------------------------------------------------
763 void CClientConfig::setValues()
765 CConfigFile::CVar
*varPtr
= 0;
766 static bool firstTimeSetValues
= true;
768 //////////////////////
769 // INTERFACE CONFIG //
771 READ_STRING_FV(XMLInputFile
)
774 READ_BOOL_FV(SkipIntro
);
775 READ_BOOL_DEV(SkipEULA
);
776 READ_INT_DEV(SelectCharacter
);
778 READ_INT_FV(SelectedSlot
);
779 if( ClientCfg
.SelectedSlot
>4 )
781 ClientCfg
.SelectedSlot
= 0;
784 // interface textures login menus
785 READ_STRINGVECTOR_FV(TexturesLoginInterface
);
786 READ_STRINGVECTOR_FV(TexturesLoginInterfaceDXTC
);
788 // interface textures outgame menus
789 READ_STRINGVECTOR_FV(TexturesOutGameInterface
);
790 READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC
);
792 // interface textures ingame and r2
793 //READ_STRINGVECTOR_FV(TexturesInterface);
794 //READ_STRINGVECTOR_FV(TexturesInterfaceDXTC);
796 // interface files login menus
797 READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles
);
799 // interface files outgame menus
800 READ_STRINGVECTOR_FV(XMLOutGameInterfaceFiles
);
803 READ_STRINGVECTOR_FV(XMLInterfaceFiles
);
806 READ_STRINGVECTOR_FV(XMLR2EDInterfaceFiles
);
809 READ_STRINGVECTOR_FV(Logos
);
812 READ_BOOL_DEV(TestBrowser
);
813 READ_STRING_DEV(TestBrowserUrl
);
817 varPtr
= ClientCfg
.ConfigFile
.getVarPtr ("ClientLight");
819 ClientCfg
.Light
= varPtr
->asInt() ? true : false;
820 #endif // !FINAL_VERSION
823 READ_BOOL_DEV(LandscapeEnabled
)
824 READ_BOOL_DEV(VillagesEnabled
)
825 READ_BOOL_DEV(EAMEnabled
)
826 READ_BOOL_DEV(CacheUIParsing
)
827 READ_BOOL_DEV(MicroLifeEnabled
)
829 READ_BOOL_DEV(LevelDesignEnabled
)
836 READ_BOOL_FV(SaveConfig
)
839 READ_INT_FV(PositionX
)
840 READ_INT_FV(PositionY
)
843 READ_INT_FV(Frequency
)
845 CConfigFile::CVar
*pcvFullScreen
= ClientCfg
.ConfigFile
.getVarPtr("FullScreen");
848 ClientCfg
.Windowed
= pcvFullScreen
->asInt() ? false : true;
851 cfgWarning("Default value used for 'Fullscreen'");
853 READ_STRING_FV(MonitorName
);
858 // Depth : Bit Per Pixel
861 READ_FLOAT_FV(Contrast
)
863 READ_FLOAT_FV(Luminosity
)
867 READ_FLOAT_FV(InterfaceScale
);
868 READ_FLOAT_FV(InterfaceScale_min
);
869 READ_FLOAT_FV(InterfaceScale_max
);
870 READ_FLOAT_FV(InterfaceScale_step
);
871 clamp(ClientCfg
.InterfaceScale
, ClientCfg
.InterfaceScale_min
, ClientCfg
.InterfaceScale_max
);
872 READ_BOOL_FV(BilinearUI
);
873 READ_BOOL_FV(WindowSnapInvert
);
874 READ_INT_FV(WindowSnapDistance
);
876 varPtr
= ClientCfg
.ConfigFile
.getVarPtr ("Driver3D");
879 if (nlstricmp(varPtr
->asString(), "Auto") == 0 || nlstricmp(varPtr
->asString(), "0") == 0) ClientCfg
.Driver3D
= CClientConfig::DrvAuto
;
880 else if (nlstricmp(varPtr
->asString(), "OpenGL") == 0 || nlstricmp(varPtr
->asString(), "1") == 0) ClientCfg
.Driver3D
= CClientConfig::OpenGL
;
881 else if (nlstricmp(varPtr
->asString(), "Direct3D") == 0 || nlstricmp(varPtr
->asString(), "2") == 0) ClientCfg
.Driver3D
= CClientConfig::Direct3D
;
882 else if (nlstricmp(varPtr
->asString(), "OpenGLES") == 0 || nlstricmp(varPtr
->asString(), "3") == 0) ClientCfg
.Driver3D
= CClientConfig::OpenGLES
;
885 cfgWarning ("Default value used for 'Driver3D' !!!");
887 READ_BOOL_FV(VREnable
)
888 READ_STRING_FV(VRDisplayDevice
)
889 READ_STRING_FV(VRDisplayDeviceId
)
893 READ_BOOL_FV(HardwareCursor
)
894 READ_FLOAT_FV(HardwareCursorScale
)
895 READ_FLOAT_FV(CursorSpeed
)
896 READ_INT_FV(CursorAcceleration
)
897 READ_FLOAT_FV(FreeLookSpeed
)
898 READ_INT_FV(FreeLookAcceleration
)
899 READ_FLOAT_FV(FreeLookSmoothingPeriod
)
900 READ_BOOL_FV(FreeLookInverted
)
901 READ_BOOL_FV(FreeLookTablet
)
902 READ_BOOL_FV(AutomaticCamera
)
903 READ_BOOL_FV(DblClickMode
)
904 READ_BOOL_FV(AutoEquipTool
)
909 // Local : local mode or network mode
911 #endif // FINAL_VERSION
913 READ_STRING_FV(FSHost
)
915 READ_BOOL_DEV(DisplayAccountButtons
)
918 READ_STRING_FV(CreateAccountURL
)
919 READ_STRING_FV(EditAccountURL
)
920 READ_STRING_FV(ForgetPwdURL
)
922 READ_STRING_DEV(BetaAccountURL
)
923 READ_STRING_DEV(FreeTrialURL
)
925 // defined in client_default.cfg
926 READ_STRING_FV(LoginSupportURL
)
928 // read NamingPolicyURL from client_default.cfg
929 //READ_STRING_FV(NamingPolicyURL)
931 std::string languageCo
= "wk";
932 CConfigFile::CVar
*languageCodeVarPtr
= ClientCfg
.ConfigFile
.getVarPtr("LanguageCode");
934 if (languageCodeVarPtr
)
936 languageCo
= languageCodeVarPtr
->asString();
939 CConfigFile::CVar
*policyurl
= ClientCfg
.ConfigFile
.getVarPtr("NamingPolicyURL");
943 for (uint i
= 0; i
< policyurl
->size(); ++i
)
945 std::string entry
= policyurl
->asString(i
);
946 if (entry
.size() >= languageCo
.size())
948 if (nlstricmp(entry
.substr(0, languageCo
.size()), languageCo
) == 0)
950 std::string::size_type pos
= entry
.find("=");
952 if (pos
!= std::string::npos
)
954 ClientCfg
.NamingPolicyURL
= entry
.substr(pos
+ 1);
961 // read NamingPolicyURL from client_default.cfg
962 //READ_STRING_FV(ConditionsTermsURL)
963 CConfigFile::CVar
*coturl
= ClientCfg
.ConfigFile
.getVarPtr("ConditionsTermsURL");
967 for (uint i
= 0; i
< coturl
->size(); ++i
)
969 std::string entry
= coturl
->asString(i
);
971 if (entry
.size() >= languageCo
.size())
973 if (nlstricmp(entry
.substr(0, languageCo
.size()), languageCo
) == 0)
975 std::string::size_type pos
= entry
.find("=");
977 if (pos
!= std::string::npos
)
979 ClientCfg
.ConditionsTermsURL
= entry
.substr(pos
+ 1);
988 // if cookie is not empty, it means that the client was launch
989 // by the nel_launcher, so it can't be local
992 nlassert (!FSAddr
.empty());
993 ClientCfg
.Local
= false;
997 nlassert (FSAddr
.empty());
1003 READ_CVECTOR_DEV(Position
)
1004 READ_CVECTOR_DEV(Heading
)
1006 READ_FLOAT_DEV(EyesHeight
)
1009 READ_FLOAT_DEV(Walk
)
1013 //When editing or Dm ing a session in ring mode the player move quicker
1015 READ_FLOAT_DEV(DmWalk
)
1017 READ_FLOAT_DEV(DmRun
)
1023 READ_FLOAT_DEV(FlyAccel
)
1025 READ_BOOL_FV(AllowDebugCommands
)
1028 READ_INT_DEV(ForceDeltaTime
)
1034 CConfigFile::CVar
*pcvBackColor
= ClientCfg
.ConfigFile
.getVarPtr("Background");
1035 if( pcvBackColor
&& (pcvBackColor
->size()==3) )
1037 ClientCfg
.BGColor
.R
= pcvBackColor
->asInt(0);
1038 ClientCfg
.BGColor
.G
= pcvBackColor
->asInt(1);
1039 ClientCfg
.BGColor
.B
= pcvBackColor
->asInt(2);
1040 ClientCfg
.BGColor
.A
= 255;
1043 cfgWarning("Default value used for 'Background'");
1044 #endif // !FINAL_VERSION
1045 // LandscapeTileNear
1046 READ_FLOAT_FV(LandscapeTileNear
)
1047 // LandscapeThreshold
1048 READ_FLOAT_FV(LandscapeThreshold
)
1049 // to be backward compatible, suppose a value<1 is for the old System!!! => invert it!
1050 if( ClientCfg
.LandscapeThreshold
<1)
1052 ClientCfg
.LandscapeThreshold
= 1.f
/ ClientCfg
.LandscapeThreshold
;
1053 // must re-write in the CFG database, to be ok with the in-game configurator
1054 varPtr
= ClientCfg
.ConfigFile
.getVarPtr("LandscapeThreshold");
1056 varPtr
->forceAsDouble(ClientCfg
.LandscapeThreshold
);
1059 READ_FLOAT_FV(Vision
)
1060 READ_FLOAT_FV(Vision_min
)
1061 READ_FLOAT_FV(Vision_max
)
1063 READ_INT_FV(SkinNbMaxPoly
)
1065 READ_INT_FV(FxNbMaxPoly
)
1067 READ_FLOAT_FV(CloudQuality
)
1068 READ_INT_FV(CloudUpdate
)
1069 // NbMaxSkeletonNotCLod
1070 READ_INT_FV(NbMaxSkeletonNotCLod
)
1072 READ_FLOAT_FV(CharacterFarClip
)
1076 READ_BOOL_FV(SquareBloom
)
1077 READ_FLOAT_FV(DensityBloom
)
1082 // ScreenAspectRatio.
1083 READ_FLOAT_FV(ScreenAspectRatio
)
1087 READ_BOOL_FV(ForceDXTC
)
1088 // AnisotropicFilter
1089 READ_INT_FV(AnisotropicFilter
)
1090 // DivideTextureSizeBy2
1091 READ_BOOL_FV(DivideTextureSizeBy2
)
1092 // DisableVtxProgram
1093 READ_BOOL_FV(DisableVtxProgram
)
1095 READ_BOOL_FV(DisableVtxAGP
)
1096 // DisableTextureShdr
1097 READ_BOOL_FV(DisableTextureShdr
)
1099 READ_BOOL_FV(MicroVeget
)
1100 // MicroVeget Density
1101 READ_FLOAT_FV(MicroVegetDensity
)
1102 // GlobalWindPower: Global Wind Power
1103 READ_FLOAT_DEV(GlobalWindPower
)
1104 // Global Wind Direction
1105 READ_CVECTOR_DEV(GlobalWindDirection
)
1107 READ_BOOL_FV(HDEntityTexture
)
1108 // HDTextureInstalled
1109 READ_BOOL_FV(HDTextureInstalled
)
1115 READ_BOOL_FV(WaitVBL
)
1117 READ_INT_FV(VideoMemory
);
1119 READ_INT_DEV(TimerMode
)
1121 // MovieShooterMemory
1122 CConfigFile::CVar
*pcv
= ClientCfg
.ConfigFile
.getVarPtr("MovieShooterMemory");
1125 ClientCfg
.MovieShooterMemory
= pcv
->asInt();
1126 // Transform to octet
1127 ClientCfg
.MovieShooterMemory
*= 1024*1024;
1130 cfgWarning("'MovieShooterMemory' not found => MovieShooter Disabled");
1132 READ_STRING_FV(MovieShooterPath
)
1133 // MovieShooterFramePeriod
1134 READ_FLOAT_FV(MovieShooterFramePeriod
)
1135 // MovieShooterBlend
1136 READ_BOOL_FV(MovieShooterBlend
)
1137 // MovieShooterFrameSkip
1138 READ_INT_FV(MovieShooterFrameSkip
)
1141 READ_STRING_FV(CameraRecorderPath
)
1142 READ_STRING_FV(CameraRecorderPrefix
)
1143 READ_BOOL_FV(CameraRecorderBlend
)
1146 READ_STRING_FV(ScreenShotDirectory
)
1147 READ_INT_FV(ScreenShotWidth
)
1148 READ_INT_FV(ScreenShotHeight
)
1149 READ_BOOL_FV(ScreenShotFullDetail
)
1150 READ_BOOL_FV(ScreenShotZBuffer
)
1152 /////////////////////////
1153 // NEW PATCHING SYSTEM //
1154 READ_BOOL_FV(PatchWanted
)
1156 #ifdef RZ_USE_CUSTOM_PATCH_SERVER
1157 READ_STRING_FV(PatchUrl
)
1158 READ_STRING_FV(PatchVersion
)
1159 READ_STRING_FV(RingReleaseNotePath
)
1160 READ_STRING_FV(ReleaseNotePath
)
1162 READ_STRING_DEV(PatchUrl
)
1163 READ_STRING_DEV(PatchVersion
)
1164 READ_STRING_DEV(RingReleaseNotePath
)
1165 READ_STRING_DEV(ReleaseNotePath
)
1168 /////////////////////////
1169 // NEW PATCHLET SYSTEM //
1170 READ_STRING_FV(PatchletUrl
)
1174 READ_STRING_FV(WebIgMainDomain
);
1175 if (ClientCfg
.WebIgMainDomain
.find("http://") == std::string::npos
1176 || ClientCfg
.WebIgMainDomain
.find("https://") == std::string::npos
)
1177 ClientCfg
.WebIgMainDomain
= "http://" + ClientCfg
.WebIgMainDomain
;
1178 READ_STRINGVECTOR_FV(WebIgTrustedDomains
);
1179 READ_INT_FV(WebIgNotifInterval
);
1180 READ_INT_FV(CurlMaxConnections
);
1181 if (ClientCfg
.CurlMaxConnections
< 0)
1182 ClientCfg
.CurlMaxConnections
= 2;
1184 READ_STRING_FV(CurlCABundle
);
1185 if (!ClientCfg
.CurlCABundle
.empty() && ClientCfg
.CurlCABundle
[0] == '%') // Path is relative to client_default.cfg path (used by ryzom patch)
1187 string defaultConfigFileName
;
1188 if (ClientCfg
.getDefaultConfigLocation(defaultConfigFileName
))
1189 ClientCfg
.CurlCABundle
= CFile::getPath(defaultConfigFileName
)+ClientCfg
.CurlCABundle
.substr(1);
1194 // AnimatedAngleThreshold
1195 READ_DOUBLE_DEV(AnimatedAngleThreshold
)
1197 READ_INT_DEV(BlendFrameNumber
)
1199 READ_DOUBLE_DEV(DestThreshold
)
1200 // PositionLimiterRadius
1201 READ_DOUBLE_DEV(PositionLimiterRadius
)
1203 READ_DOUBLE_DEV(SignificantDist
)
1205 READ_ENUM_ASINT_DEV(TStageLCTUsage
, StageLCTUsage
)
1210 READ_FLOAT_DEV(WaterOffset
)
1213 READ_FLOAT_DEV(FyrosWaterOffset
)
1214 READ_FLOAT_DEV(MatisWaterOffset
)
1215 READ_FLOAT_DEV(TrykerWaterOffset
)
1216 READ_FLOAT_DEV(ZoraiWaterOffset
)
1217 #endif // FINAL_VERSION
1219 // Water Offset for creature
1220 READ_FLOAT_DEV(WaterOffsetCreature
)
1222 READ_INT_DEV(TimeToRemoveCol
)
1223 // MoveToTimeToStopStall
1224 READ_INT_DEV(MoveToTimeToStopStall
)
1225 // TimeToAdjustCamera
1226 READ_DOUBLE_DEV(TimeToAdjustCamera
)
1228 READ_DOUBLE_DEV(ChangeDirAngle
)
1230 READ_FLOAT_DEV(GuildSymbolSize
)
1232 READ_FLOAT_DEV(SelectionDist
)
1233 // SelectionOutBBoxWeight
1234 READ_FLOAT_DEV(SelectionOutBBoxWeight
)
1236 READ_FLOAT_DEV(LootDist
)
1237 // SpaceSelectionDist
1238 READ_FLOAT_DEV(SpaceSelectionDist
)
1239 // SpaceSelectionMaxCycle
1240 READ_INT_DEV(SpaceSelectionMaxCycle
)
1241 // Third Person View Min Pitch.
1242 READ_FLOAT_DEV(TPVMinPitch
)
1243 // Third Person View Max Pitch.
1244 READ_FLOAT_DEV(TPVMaxPitch
)
1245 // The character look at the target before this distance.
1246 READ_FLOAT_DEV(MaxHeadTargetDist
)
1247 // FX played when dead
1248 READ_STRING_DEV(DeadFXName
)
1249 // FX played for each impact
1250 READ_STRING_DEV(ImpactFXName
)
1251 // FX Played at skill up
1252 READ_STRING_DEV(SkillUpFXName
)
1254 READ_DOUBLE_DEV(MinDistFactor
)
1256 READ_FLOAT_DEV(NameScale
)
1258 READ_FLOAT_DEV(NamePos
)
1260 READ_INT_DEV(NameFontSize
)
1262 READ_FLOAT_DEV(MaxNameDist
)
1263 // ConstNameSizeDist
1264 READ_FLOAT_DEV(ConstNameSizeDist
)
1266 READ_BOOL_FV(StaticNameHeight
)
1268 READ_FLOAT_DEV(BarsHeight
)
1270 READ_FLOAT_DEV(BarsWidth
)
1272 READ_BOOL_FV(DisplayWeapons
)
1274 READ_DOUBLE_DEV(FightAreaSize
)
1276 READ_FLOAT_DEV(AttackDist
)
1278 READ_FLOAT_DEV(BubbleZBias
);
1279 // ForageInterfaceZBias
1280 READ_FLOAT_DEV(ForageInterfaceZBias
);
1282 // EnableRacialAnimation
1283 READ_BOOL_FV(EnableRacialAnimation
);
1286 READ_FLOAT_DEV(FyrosScale
);
1287 READ_FLOAT_DEV(MatisScale
);
1288 READ_FLOAT_DEV(TrykerScale
);
1289 READ_FLOAT_DEV(ZoraiScale
);
1291 #endif // FINAL_VERSION
1296 READ_BOOL_FV(SoundOn
)
1298 varPtr
= ClientCfg
.ConfigFile
.getVarPtr ("DriverSound");
1301 if (nlstricmp(varPtr
->asString(), "Auto") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvAuto
;
1302 else if (nlstricmp(varPtr
->asString(), "OpenAL") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvOpenAL
;
1303 else if (nlstricmp(varPtr
->asString(), "DirectSound") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvDirectSound
;
1304 else if (nlstricmp(varPtr
->asString(), "XAudio2") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvXAudio2
;
1307 cfgWarning ("Default value used for 'DriverSound' !!!");
1308 // SoundForceSoftwareBuffer
1309 READ_BOOL_FV(SoundForceSoftwareBuffer
);
1310 // SoundOutGameMusic
1311 READ_STRING_DEV(StartMusic
)
1312 READ_STRING_DEV(EmptySlotMusic
)
1313 READ_STRING_DEV(LoadingMusic
)
1314 READ_STRING_DEV(KamiTeleportMusic
)
1315 READ_STRING_DEV(KaravanTeleportMusic
)
1316 READ_STRING_DEV(TeleportLoadingMusic
)
1317 READ_STRING_DEV(DeathMusic
)
1319 READ_FLOAT_FV(SoundSFXVolume
);
1320 // SoundGameMusicVolume
1321 READ_FLOAT_FV(SoundGameMusicVolume
);
1323 READ_INT_DEV(SoundTPFade
);
1324 // EnableBackgroundMusicTimeConstraint
1325 READ_BOOL_DEV(EnableBackgroundMusicTimeConstraint
);
1326 // SoundPackedSheetPath
1327 READ_STRING_DEV(SoundPackedSheetPath
)
1329 READ_STRING_DEV(SampleBankDir
)
1330 // UserEntitySoundLevel : UserEntity sound level
1331 READ_FLOAT_FV(UserEntitySoundLevel
)
1333 READ_BOOL_FV(UseEax
)
1335 READ_BOOL_DEV(UseADPCM
)
1337 READ_INT_FV(MaxTrack
)
1340 READ_STRING_FV(MediaPlayerDirectory
);
1341 READ_BOOL_FV(MediaPlayerAutoPlay
);
1346 CConfigFile::CVar
*pcvColorShout
= ClientCfg
.ConfigFile
.getVarPtr("ColorShout");
1347 if( pcvColorShout
&& (pcvColorShout
->size() == 3) )
1349 ClientCfg
.ColorShout
.R
= pcvColorShout
->asInt(0);
1350 ClientCfg
.ColorShout
.G
= pcvColorShout
->asInt(1);
1351 ClientCfg
.ColorShout
.B
= pcvColorShout
->asInt(2);
1352 ClientCfg
.ColorShout
.A
= 255;
1355 cfgWarning("Default value used for 'ColorShout'");
1358 CConfigFile::CVar
*pcvColorTalk
= ClientCfg
.ConfigFile
.getVarPtr("ColorTalk");
1359 if( pcvColorTalk
&& (pcvColorTalk
->size() == 3) )
1361 ClientCfg
.ColorTalk
.R
= pcvColorTalk
->asInt(0);
1362 ClientCfg
.ColorTalk
.G
= pcvColorTalk
->asInt(1);
1363 ClientCfg
.ColorTalk
.B
= pcvColorTalk
->asInt(2);
1364 ClientCfg
.ColorTalk
.A
= 255;
1367 cfgWarning("Default value used for 'ColorTalk'");
1373 READ_STRINGVECTOR_FV(PreDataPath
);
1376 READ_STRINGVECTOR_FV(DataPath
);
1378 // Data Path no recurse.
1379 READ_STRINGVECTOR_FV(DataPathNoRecurse
);
1382 READ_STRING_DEV(PreLoadPath
);
1384 // Streamed package path
1385 READ_STRING_FV(StreamedPackagePath
);
1387 // Streamed package hosts
1388 READ_STRINGVECTOR_FV(StreamedPackageHosts
);
1390 // List of files that trigger R2ED reload when touched
1391 READ_STRINGVECTOR_FV(R2EDReloadFiles
);
1393 // Update packed sheet Path
1394 READ_STRINGVECTOR_FV(UpdatePackedSheetPath
);
1396 // UpdatePackedSheet
1397 READ_BOOL_DEV(UpdatePackedSheet
)
1400 READ_FLOAT_DEV(EndScreenTimeOut
)
1402 READ_STRING_FV(Loading_BG
)
1403 READ_STRING_FV(LoadingFreeTrial_BG
)
1404 READ_STRING_FV(Launch_BG
)
1405 READ_STRING_FV(TeleportKami_BG
)
1406 READ_STRING_FV(TeleportKaravan_BG
)
1407 READ_STRING_FV(Elevator_BG
)
1408 READ_STRING_FV(ResurectKami_BG
)
1409 READ_STRING_FV(ResurectKaravan_BG
)
1410 READ_STRING_FV(End_BG
)
1411 READ_STRING_FV(IntroNevrax_BG
)
1412 READ_STRING_FV(IntroNVidia_BG
)
1414 READ_FLOAT_DEV(TipsY
)
1415 READ_FLOAT_DEV(TeleportInfoY
)
1417 READ_STRING_DEV(SceneName
)
1419 READ_STRING_DEV(IdFilePath
)
1422 READ_STRINGVECTOR_DEV(PacsPrimDir
);
1427 CConfigFile::CVar
*pcvTmp
= ClientCfg
.ConfigFile
.getVarPtr("NegFiltersDebug");
1430 int iSz
= pcvTmp
->size();
1431 for(int k
= 0; k
< iSz
; ++k
)
1433 DebugLog
->addNegativeFilter (pcvTmp
->asString(k
).c_str());
1437 cfgWarning("Default value used for 'NegFiltersDebug'");
1439 pcvTmp
= ClientCfg
.ConfigFile
.getVarPtr("NegFiltersInfo");
1442 int iSz
= pcvTmp
->size();
1443 for(int k
= 0; k
< iSz
; ++k
)
1445 InfoLog
->addNegativeFilter (pcvTmp
->asString(k
).c_str());
1449 cfgWarning("Default value used for 'NegFiltersInfo'");
1451 pcvTmp
= ClientCfg
.ConfigFile
.getVarPtr("NegFiltersWarning");
1454 int iSz
= pcvTmp
->size();
1455 for(int k
= 0; k
< iSz
; ++k
)
1457 WarningLog
->addNegativeFilter (pcvTmp
->asString(k
).c_str());
1461 cfgWarning("Default value used for 'NegFiltersWarning'");
1464 READ_STRINGVECTOR_FV(StartCommands
);
1468 // Colors for system infos
1469 ClientCfg
.SystemInfoParams
.clear();
1470 CConfigFile::CVar
*sic
= ClientCfg
.ConfigFile
.getVarPtr("SystemInfoColors");
1473 cfgWarning("Can't read SystemInfoColors, all colors defaulting to white");
1477 if (sic
->size() & 1)
1479 cfgWarning("Expecting odd size for SystemInfoColors. Last entry ignored.");
1481 uint numCol
= sic
->size() >> 1;
1482 for(uint k
= 0; k
< numCol
; ++k
)
1488 if (sscanf(sic
->asString((2 * k
) + 1).c_str(), "%d %d %d %d %s %s", &r
, &g
, &b
, &a
, mode
, fx
) < 5)
1490 if(DisplayCFGWarning
)
1491 nlwarning("Can't parse color for entry %s", sic
->asString(2 * k
).c_str());
1497 p
.Color
= CRGBA(r
, g
, b
, a
);
1498 p
.Mode
= SSysInfoParam::Normal
;
1499 p
.SysInfoFxName
= string(fx
);
1500 if (stricmp(mode
, "over") == 0) p
.Mode
= SSysInfoParam::Over
;
1501 else if (stricmp(mode
, "overonly") == 0) p
.Mode
= SSysInfoParam::OverOnly
;
1502 else if (stricmp(mode
, "center") == 0) p
.Mode
= SSysInfoParam::Center
;
1503 else if (stricmp(mode
, "centeraround") == 0) p
.Mode
= SSysInfoParam::CenterAround
;
1504 else if (stricmp(mode
, "around") == 0) p
.Mode
= SSysInfoParam::Around
;
1506 ClientCfg
.SystemInfoParams
[toLowerAscii(sic
->asString(2 * k
))] = p
;
1511 #ifndef RZ_NO_CLIENT
1512 // printf commands in loading screens
1513 ClientCfg
.loadingTexts
.clear();
1514 CConfigFile::CVar
*pc
= ClientCfg
.ConfigFile
.getVarPtr("loadingTexts");
1517 if( pc
->size()%5 == 0 && pc
->size() >= 5)
1519 for (uint i
= 0; i
< pc
->size(); i
+=5)
1521 SPrintfCommand pcom
;
1522 pcom
.X
= pc
->asInt(i
);
1523 pcom
.Y
= pc
->asInt(i
+1);
1524 pcom
.Color
= CRGBA::stringToRGBA( pc
->asString(i
+2).c_str() );
1525 pcom
.FontSize
= pc
->asInt(i
+3);
1526 pcom
.Text
= pc
->asString(i
+4);
1528 ClientCfg
.loadingTexts
.push_back( pcom
);
1533 cfgWarning("Missing or too many parameters in loadingTexts");
1538 READ_INT_FV(LoadingStringCount
)
1541 READ_INT_DEV(CheckMemoryEveryNFrame
)
1542 READ_BOOL_DEV(LogMemoryAllocation
)
1543 READ_INT_DEV(LogMemoryAllocationSize
)
1546 READ_BOOL_FV(SelectWithRClick
)
1547 READ_BOOL_DEV(RunAtTheBeginning
)
1548 READ_FLOAT_FV(RotKeySpeedMax
)
1549 READ_FLOAT_FV(RotKeySpeedMin
)
1550 READ_FLOAT_FV(RotAccel
)
1551 READ_BOOL_DEV(PutBackItems
)
1552 READ_BOOL_DEV(ShowNameUnderCursor
)
1553 READ_BOOL_DEV(ShowNameSelected
)
1554 READ_FLOAT_DEV(ShowNameBelowDistanceSqr
)
1555 READ_BOOL_DEV(ForceIndoorFPV
)
1556 READ_BOOL_FV(FollowOnAtk
);
1557 READ_BOOL_FV(AtkOnSelect
);
1558 READ_BOOL_DEV(TransparentUnderCursor
);
1560 READ_BOOL_FV(ItemGroupAllowGuild
);
1565 // Read the view mode at load time only, cause prefer keep ingame player setup
1566 if(firstTimeSetValues
)
1570 READ_FLOAT_FV(CameraDistStep
)
1571 READ_FLOAT_FV(CameraDistMin
)
1572 READ_FLOAT_FV(CameraDistMax
)
1573 READ_FLOAT_FV(DmCameraDistMax
)
1574 READ_FLOAT_FV(CameraAccel
)
1575 READ_FLOAT_FV(CameraSpeedMin
)
1576 READ_FLOAT_FV(CameraSpeedMax
)
1577 READ_FLOAT_FV(CameraResetSpeed
)
1578 // Read the camera height and distance at load time only, cause prefer keep ingame player setup
1579 if(firstTimeSetValues
)
1581 READ_FLOAT_FV(CameraHeight
)
1582 READ_FLOAT_FV(CameraDistance
)
1585 // Default values for CGroupMap
1586 READ_FLOAT_FV(MaxMapScale
);
1587 READ_FLOAT_FV(R2EDMaxMapScale
);
1589 // /tar to update compass or not
1590 READ_BOOL_FV(TargetChangeCompass
);
1594 // Shadows : Get Shadows state
1595 READ_BOOL_FV(Shadows
)
1596 // ShadowsClipFar : Get Shadows Clip Far.
1597 READ_FLOAT_DEV(ShadowsClipFar
)
1598 // ShadowsLodDist : Get Shadows Lod Distance.
1599 READ_FLOAT_DEV(ShadowsLodDist
)
1601 READ_FLOAT_DEV(ShadowZDirClampLandscape
);
1602 READ_FLOAT_DEV(ShadowZDirClampInterior
);
1603 READ_FLOAT_DEV(ShadowZDirClampSmoothSpeed
);
1605 READ_FLOAT_DEV(ShadowMaxDepthLandscape
);
1606 READ_FLOAT_DEV(ShadowMaxDepthInterior
);
1607 READ_FLOAT_DEV(ShadowMaxDepthSmoothSpeed
);
1613 READ_FLOAT_DEV(GroundFXMaxDist
)
1614 READ_INT_DEV(GroundFXMaxNB
)
1615 READ_INT_DEV(GroundFXCacheSize
)
1617 // Names : Get Names state
1622 READ_INT_FV(ProcessPriority
)
1624 READ_INT_FV(CPUMask
)
1625 // ShowPath : Get the ShowPath value.
1626 READ_BOOL_DEV(ShowPath
)
1627 // UserSheet : Get the sheet to used for the use rin Local mode.
1628 READ_STRING_DEV(UserSheet
)
1631 varPtr
= ClientCfg
.ConfigFile
.getVarPtr("Sex");
1633 ClientCfg
.Sex
= (GSGENDER::EGender
)varPtr
->asInt();
1635 cfgWarning("Default value used for 'Sex' !!!");
1636 #endif // FINAL_VERSION
1637 // PrimitiveHeightAddition
1638 READ_BOOL_DEV(PrimitiveHeightAddition
)
1640 READ_BOOL_DEV(DrawBoxes
)
1643 // ChaseReactionTime
1644 READ_FLOAT_DEV(ChaseReactionTime
)
1646 READ_FLOAT_DEV(RyzomTime
)
1648 READ_INT_DEV(RyzomDay
)
1649 // ManualWeatherSetup
1650 READ_BOOL_DEV(ManualWeatherSetup
)
1652 READ_BOOL_DEV(ForceLanguage
)
1653 if (!ClientCfg
.ForceLanguage
)
1655 READ_STRING_FV(LanguageCode
)
1657 // DebugStringManager
1658 READ_BOOL_DEV(DebugStringManager
)
1661 READ_STRING_FV(LastLogin
)
1665 READ_BOOL_DEV(VerboseVP
)
1666 READ_BOOL_DEV(VerboseAnimUser
)
1667 READ_BOOL_DEV(VerboseAnimSelection
)
1668 READ_BOOL_DEV(VerboseAllTraffic
)
1670 READ_STRING_DEV(LigoPrimitiveClass
);
1674 READ_INT_DEV(SimulatePacketLossRatio
)
1675 READ_BOOL_DEV(PreCacheShapes
)
1676 READ_BOOL_FV(ResetShapeBankOnRetCharSelect
)
1677 READ_BOOL_DEV(DisplayMissingAnimFile
)
1678 READ_STRING_DEV(DefaultEntity
)
1679 READ_BOOL_DEV(RestrainPI
)
1680 READ_BOOL_DEV(DumpVSIndex
)
1681 READ_INT_DEV(HelpFontSize
)
1685 CConfigFile::CVar
*cvHelpFontColor
= ClientCfg
.ConfigFile
.getVarPtr("HelpFontColor");
1686 if(cvHelpFontColor
&& cvHelpFontColor
->size() == 3)
1688 ClientCfg
.HelpFontColor
.R
= cvHelpFontColor
->asInt(0);
1689 ClientCfg
.HelpFontColor
.G
= cvHelpFontColor
->asInt(1);
1690 ClientCfg
.HelpFontColor
.B
= cvHelpFontColor
->asInt(2);
1691 ClientCfg
.HelpFontColor
.A
= 255;
1694 cfgWarning("Default value used for 'HelpFontColor' !!!");
1696 #endif // !FINAL_VERSION
1698 READ_FLOAT_DEV(HelpLineStep
)
1700 READ_INT_DEV(DebugFontSize
)
1703 CConfigFile::CVar
*pcvDebugFontColor
= ClientCfg
.ConfigFile
.getVarPtr("DebugFontColor");
1704 if( pcvDebugFontColor
&& (pcvDebugFontColor
->size() == 3) )
1706 ClientCfg
.DebugFontColor
.R
= pcvDebugFontColor
->asInt(0);
1707 ClientCfg
.DebugFontColor
.G
= pcvDebugFontColor
->asInt(1);
1708 ClientCfg
.DebugFontColor
.B
= pcvDebugFontColor
->asInt(2);
1709 ClientCfg
.DebugFontColor
.A
= 255;
1712 cfgWarning("Default value used for 'DebugFontColor'");
1713 #endif // !FINAL_VERSION
1714 READ_FLOAT_DEV(DebugLineStep
)
1717 READ_CVECTOR_DEV(HeadOffset
)
1718 READ_BOOL_DEV(FPExceptions
)
1719 READ_BOOL_DEV(NeedComputeVS
)
1720 READ_BOOL_DEV(Check
)
1721 READ_BOOL_DEV(UsePACSForAll
)
1722 READ_FLOAT_DEV(WaterEnvMapUpdateTime
)
1723 READ_BOOL_DEV(BlendForward
)
1725 ClientCfg
.ZCPacsPrim
= "gen_bt_col_ext.pacs_prim";
1726 READ_STRING_DEV(ZCPacsPrim
)
1728 READ_BOOL_FV(AutoReloadFiles
)
1729 READ_BOOL_DEV(BlendShapePatched
)
1731 READ_INT_DEV(MaxNumberOfTimedFXInstances
);
1733 READ_STRING_DEV(SelectionFX
);
1734 READ_STRING_DEV(MouseOverFX
);
1735 READ_FLOAT_DEV(SelectionFXSize
);
1737 if(ClientCfg
.ConfigFile
.exists("ExtendedCommands") && ClientCfg
.ConfigFile
.getVar("ExtendedCommands").asString() == "Enable")
1738 ClientCfg
.ExtendedCommands
= true;
1741 READ_BOOL_DEV(R2Mode
);
1742 if (ClientCfg
.Local
) // R2EDEnabled is now set by the server
1744 READ_BOOL_DEV(R2EDEnabled
)
1746 READ_INT_FV(R2EDDssNetwork
)
1749 if (ClientCfg
.Local
)
1751 ClientCfg
.R2EDDssNetwork
= 1;
1754 READ_BOOL_DEV(R2EDExtendedDebug
)
1757 CConfigFile::CVar
*var
= ClientCfg
.ConfigFile
.getVarPtr("R2EDExtendedDebug");
1762 // else no-op -> will resolve to 'nil' into lua
1767 READ_BOOL_DEV(R2EDVerboseParseTime
)
1768 READ_BOOL_DEV(R2EDDontReparseUnchangedUIFiles
)
1769 READ_BOOL_DEV(R2EDLightPalette
)
1770 READ_INT_FV(R2EDAutoSaveWait
)
1771 READ_INT_FV(R2EDAutoSaveSlot
)
1772 READ_BOOL_DEV(R2EDMustVerifyRingAccessWhileLoadingAnimation
)
1773 READ_BOOL_FV(R2EDUseVerboseRingAccess
)
1779 // Array with the name of all offensive impact FXs.
1780 READ_STRINGVECTOR_DEV(OffImpactFX
);
1782 #ifndef RZ_NO_CLIENT
1787 #ifdef NL_OS_WINDOWS
1788 if(ClientCfg
.FPExceptions
)
1789 _control87(_EM_DENORMAL
/*|_EM_INVALID|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW
|_EM_INEXACT
, _MCW_EM
);
1791 _control87(_EM_INVALID
|_EM_DENORMAL
|_EM_ZERODIVIDE
|_EM_OVERFLOW
|_EM_UNDERFLOW
|_EM_INEXACT
, _MCW_EM
);
1793 // Set the process priority
1794 static DWORD priority
[6]=
1796 0x40, // IDLE_PRIORITY_CLASS
1797 0x4000, // BELOW_NORMAL_PRIORITY_CLASS
1798 0x20, // NORMAL_PRIORITY_CLASS
1799 0x8000, // ABOVE_NORMAL_PRIORITY_CLASS
1800 0x80, // HIGH_PRIORITY_CLASS
1801 0x100, // REALTIME_PRIORITY_CLASS
1804 int index
= ClientCfg
.ProcessPriority
+2;
1806 SetPriorityClass (GetCurrentProcess(), priority
[index
]);
1807 #endif // NL_OS_WINDOWS
1809 // Init Verbose Modes (at the beginning to be able to display them as soon as possible).
1810 ::VerboseVP
= ClientCfg
.VerboseVP
;
1811 ::VerboseAnimUser
= ClientCfg
.VerboseAnimUser
;
1812 ::VerboseAnimSelection
= ClientCfg
.VerboseAnimSelection
;
1813 #ifdef LOG_ALL_TRAFFIC
1814 NLMISC::VerboseAllTraffic
= ClientCfg
.VerboseAllTraffic
;
1817 // (re-)Initialize contextual cursors.
1818 if (!ClientCfg
.R2EDEnabled
)
1820 initContextualCursor();
1824 READ_STRINGVECTOR_DEV(PrimFiles
);
1826 // Reset GlobalWind Setup
1829 Scene
->setGlobalWindPower(ClientCfg
.GlobalWindPower
);
1830 Scene
->setGlobalWindDirection(ClientCfg
.GlobalWindDirection
);
1835 // Set the monitor color properties
1836 CMonitorColorProperties monitorColor
;
1837 for(uint i
=0; i
<3; i
++)
1839 monitorColor
.Contrast
[i
] = ClientCfg
.Contrast
;
1840 monitorColor
.Luminosity
[i
] = ClientCfg
.Luminosity
;
1841 monitorColor
.Gamma
[i
] = ClientCfg
.Gamma
;
1843 if(!Driver
->setMonitorColorProperties(monitorColor
))
1844 cfgWarning("reloadCFG: setMonitorColorProperties fails");
1848 // Show/hide all or parts of the user body.
1851 UserEntity
->eyesHeight(ClientCfg
.EyesHeight
);
1852 UserEntity
->updateVisualDisplay();
1854 // Run speed and camera dist max are set according to R2 char mode
1855 UserEntity
->flushR2CharMode();
1858 // Initialize the camera distance (after camera dist max)
1859 View
.setCameraDistanceMaxForPlayer();
1861 // draw in client light?
1864 ClientCfg
.DrawBoxes
= true;
1865 ClientCfg
.Names
= true;
1869 if (ClientCfg
.Local
)
1871 uint32 tickOffset
= (uint32
)(ClientCfg
.RyzomDay
* RYZOM_HOURS_IN_TICKS
* 24 + ClientCfg
.RyzomTime
* RYZOM_HOURS_IN_TICKS
);
1872 RT
.resetTickOffset();
1873 RT
.increaseTickOffset( tickOffset
);
1877 // for reset effect of variable in mainLoop(), set true
1878 ClientCfg
.IsInvalidated
= true;
1880 // Allow warning display only first time.
1881 DisplayCFGWarning
= false;
1883 // If it is the load time, backup the ClientCfg into LastClientCfg
1884 if(firstTimeSetValues
)
1885 LastClientCfg
= ClientCfg
;
1888 firstTimeSetValues
= false;
1890 READ_INT_DEV(NumFrameForProfile
);
1891 READ_STRING_FV(KlientChatPort
);
1892 READ_BOOL_DEV(SimulateServerTick
);
1894 READ_BOOL_DEV(DamageShieldEnabled
)
1896 READ_BOOL_FV(AllowDebugLua
)
1897 READ_BOOL_FV(DisplayLuaDebugInfo
)
1899 READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled
)
1900 READ_STRING_DEV(LuaDebugInfoGotoButtonTemplate
)
1901 READ_STRING_DEV(LuaDebugInfoGotoButtonCaption
)
1902 READ_STRING_DEV(LuaDebugInfoGotoButtonFunction
)
1905 READ_BOOL_DEV(BeepWhenLaunched
)
1907 READ_STRING_DEV(R2ClientGw
)
1909 READ_FLOAT_FV(FogDistAndDepthLookupBias
)
1911 READ_INT_DEV(R2EDLoadDynamicFeatures
)
1913 READ_BOOL_DEV(CheckR2ScenarioMD5
);
1915 CConfigFile::CVar
*pcvHardwareCursors
= ClientCfg
.ConfigFile
.getVarPtr("HardwareCursors");
1916 if(pcvHardwareCursors
)
1918 ClientCfg
.HardwareCursors
.clear ();
1919 int iSz
= pcvHardwareCursors
->size();
1920 for (int i
= 0; i
< iSz
; i
++)
1921 ClientCfg
.HardwareCursors
.insert(toLowerAscii(pcvHardwareCursors
->asString(i
)));
1925 cfgWarning("Default value used for 'HardwareCursors'");
1926 // default list of harware cursors
1927 ClientCfg
.HardwareCursors
.insert("curs_can_pan.tga");
1928 ClientCfg
.HardwareCursors
.insert("curs_can_pan_dup.tga");
1929 ClientCfg
.HardwareCursors
.insert("curs_create.tga");
1930 ClientCfg
.HardwareCursors
.insert("curs_create_multi.tga");
1931 ClientCfg
.HardwareCursors
.insert("curs_create_vertex_invalid.tga");
1932 ClientCfg
.HardwareCursors
.insert("curs_default.tga");
1933 ClientCfg
.HardwareCursors
.insert("curs_dup.tga");
1934 ClientCfg
.HardwareCursors
.insert("curs_L.tga");
1935 ClientCfg
.HardwareCursors
.insert("curs_M.tga");
1936 ClientCfg
.HardwareCursors
.insert("curs_pan.tga");
1937 ClientCfg
.HardwareCursors
.insert("curs_pan_dup.tga");
1938 ClientCfg
.HardwareCursors
.insert("curs_pick.tga");
1939 ClientCfg
.HardwareCursors
.insert("curs_pick_dup.tga");
1940 ClientCfg
.HardwareCursors
.insert("curs_R.tga");
1941 ClientCfg
.HardwareCursors
.insert("curs_resize_BL_TR.tga");
1942 ClientCfg
.HardwareCursors
.insert("curs_resize_BR_TL.tga");
1943 ClientCfg
.HardwareCursors
.insert("curs_resize_LR.tga");
1944 ClientCfg
.HardwareCursors
.insert("curs_resize_TB.tga");
1945 ClientCfg
.HardwareCursors
.insert("curs_rotate.tga");
1946 ClientCfg
.HardwareCursors
.insert("curs_scale.tga");
1947 ClientCfg
.HardwareCursors
.insert("curs_stop.tga");
1948 ClientCfg
.HardwareCursors
.insert("text_cursor.tga");
1949 ClientCfg
.HardwareCursors
.insert("r2_hand_can_pan.tga");
1950 ClientCfg
.HardwareCursors
.insert("r2_hand_pan.tga");
1951 ClientCfg
.HardwareCursors
.insert("r2ed_tool_can_pick.tga");
1952 ClientCfg
.HardwareCursors
.insert("r2ed_tool_can_rotate.tga");
1953 ClientCfg
.HardwareCursors
.insert("r2ed_tool_pick.tga");
1954 ClientCfg
.HardwareCursors
.insert("r2ed_tool_rotate.tga");
1955 ClientCfg
.HardwareCursors
.insert("r2ed_tool_rotating.tga");
1958 // languages and types of Ring Scenarii
1959 READ_STRINGVECTOR_FV(ScenarioLanguages
);
1960 READ_STRINGVECTOR_FV(ScenarioTypes
);
1963 READ_STRING_FV(BuildName
)
1965 READ_BOOL_DEV(DisplayTPReason
)
1967 //READ_INT_FV(TPQuitButtonX)
1968 //READ_INT_FV(TPQuitButtonY)
1969 //READ_INT_FV(TPCancelButtonX)
1970 //READ_INT_FV(TPCancelButtonY)
1971 READ_INT_FV(TPButtonW
)
1972 READ_INT_FV(TPButtonH
)
1974 READ_STRING_FV(ScenarioSavePath
)
1977 ClientCfg
.R2EDClippedEntityBlendTime
= 0.18f
;
1978 READ_FLOAT_FV(R2EDClippedEntityBlendTime
)
1980 // vl: BackgroundDownloader is hardcoded to false and we don't want to run it, even if the cfg wants it
1981 //READ_BOOL_FV(BackgroundDownloader)
1986 //-----------------------------------------------
1989 //-----------------------------------------------
1990 void CClientConfig::serial(NLMISC::IStream
&f
)
1992 // Start the opening of a new node named ClientCFG.
1993 f
.xmlPush("ClientCFG");
1995 f
.xmlPushBegin("Light");
2000 f
.xmlPushBegin("MonitorName");
2002 f
.serial(MonitorName
);
2005 f
.xmlPushBegin("Windowed");
2010 f
.xmlPushBegin("Width");
2015 f
.xmlPushBegin("Height");
2020 f
.xmlPushBegin("Depth");
2025 f
.xmlPushBegin("Contrast");
2030 f
.xmlPushBegin("Luminosity");
2032 f
.serial(Luminosity
);
2035 f
.xmlPushBegin("Gamma");
2041 f
.xmlPushBegin("AttackDist");
2043 f
.serial(AttackDist
);
2047 f
.xmlPushBegin("SelectWithRClick");
2049 f
.serial(SelectWithRClick
);
2052 // Close the serial for the Client CFG.
2057 //-----------------------------------------------
2059 //-----------------------------------------------
2060 void CClientConfig::init(const string
&configFileName
)
2062 // if the users client config does not exist
2063 if(!CFile::fileExists(configFileName
))
2065 // create the basic .cfg
2066 FILE *fp
= nlfopen(configFileName
, "w");
2069 nlerror("CFG::init: Can't create config file '%s'", configFileName
.c_str());
2071 nlwarning("CFG::init: creating '%s' with default values", configFileName
.c_str ());
2073 // get current locale
2074 std::string lang
= CI18N::getSystemLanguageCode();
2076 const std::vector
<std::string
> &languages
= CI18N::getLanguageCodes();
2078 // search if current locale is defined in language codes
2079 for(uint i
= 0; i
< languages
.size(); ++i
)
2081 if (lang
== languages
[i
])
2083 // store the language code in the config file
2084 fprintf(fp
, "LanguageCode = \"%s\";\n", lang
.c_str());
2092 // read the exising config file (don't parse it yet!)
2093 ucstring content
; // UTF-16 and UTF-8 textfile support
2094 NLMISC::CI18N::readTextFile(configFileName
, content
);
2095 std::string contentUtf8
= content
.toUtf8();
2097 // while there are "RootConfigFilename" values, remove them
2099 while((pos
= contentUtf8
.find("RootConfigFilename")) != configFileName
.npos
)
2101 size_t endOfLine
= contentUtf8
.find("\n", pos
);
2102 contentUtf8
.erase(pos
, (endOfLine
- pos
) + 1);
2105 // get current location of the root config file (client_default.cfg)
2106 std::string defaultConfigLocation
;
2107 if(!getDefaultConfigLocation(defaultConfigLocation
))
2108 nlerror("cannot find client_default.cfg");
2110 // and store it in the RootConfigFilename value in the very first line
2111 contentUtf8
.insert(0, std::string("RootConfigFilename = \"") +
2112 defaultConfigLocation
+ "\";\n");
2114 // save the updated config file
2115 NLMISC::COFile
configFile(configFileName
, false, true, false);
2116 configFile
.serialBuffer((uint8
*)contentUtf8
.c_str(), (uint
)contentUtf8
.size());
2119 // now we can continue loading and parsing the config file
2121 // if the config file will be modified, it calls automatically the function setValuesOnFileChange()
2122 ClientCfg
.ConfigFile
.setCallback (CClientConfig::setValuesOnFileChange
);
2124 // load the config files
2125 ClientCfg
.ConfigFile
.load (configFileName
);
2127 CConfigFile::CVar
*pCV
;
2128 // check language code is supported
2129 pCV
= ClientCfg
.ConfigFile
.getVarPtr("LanguageCode");
2132 std::string lang
= pCV
->asString();
2133 if (!CI18N::isLanguageCodeSupported(lang
))
2135 nlinfo("Unsupported language code \"%s\" fallback on default", lang
.c_str());
2136 // fallback to default language
2137 ClientCfg
.LanguageCode
= CI18N::getSystemLanguageCode();
2138 // update ConfigFile variable
2139 pCV
->setAsString(ClientCfg
.LanguageCode
);
2140 ClientCfg
.ConfigFile
.save();
2144 // update the ConfigFile variable in the config file
2145 pCV
= ClientCfg
.ConfigFile
.getVarPtr("ClientVersion");
2148 std::string str
= pCV
->asString ();
2149 if (str
!= getVersion() && ClientCfg
.SaveConfig
)
2151 nlinfo ("Update and save the ClientVersion variable in config file %s -> %s", str
.c_str(), getVersion().c_str());
2152 pCV
->setAsString(getVersion());
2153 ClientCfg
.ConfigFile
.save();
2157 nlwarning ("There's no ClientVersion variable in the config file!");
2162 //-----------------------------------------------
2164 //-----------------------------------------------
2165 void CClientConfig::release ()
2167 #ifndef RZ_NO_CLIENT
2168 // Do we have to save the cfg file ?
2169 if (ClientCfg
.SaveConfig
)
2174 CConfigFile::CVar
*varPtr
= NULL
;
2176 // Driver still alive ?
2177 if (Driver
&& Driver
->isActive ())
2180 uint32 width
, height
;
2182 Driver
->getWindowPos(x
, y
);
2183 Driver
->getWindowSize(width
, height
);
2185 // Are we in window mode ?
2186 if (ClientCfg
.Windowed
/* && !isWindowMaximized() */)
2188 // Save windows position. width/height are saved when leaving ingame.
2189 writeInt("PositionX", x
);
2190 writeInt("PositionY", y
);
2194 // Save if in FPV or TPV.
2195 writeBool("FPV", ClientCfg
.FPV
);
2197 // Save the camera distance
2198 writeDouble("CameraDistance", ClientCfg
.CameraDistance
);
2200 catch (const Exception
&e
)
2202 nlwarning ("Error while set config file variables : %s", e
.what ());
2206 ClientCfg
.ConfigFile
.save ();
2211 bool CClientConfig::readBool (const std::string
&varName
)
2214 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2216 bVal
= varPtr
->asInt() ? true : false;
2218 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2222 void CClientConfig::writeBool (const std::string
&varName
, bool bVal
, bool bForce
)
2224 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2226 varPtr
->forceAsInt(bVal
? 1:0);
2228 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2231 sint32
CClientConfig::readInt (const std::string
&varName
)
2234 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2236 bVal
= varPtr
->asInt();
2238 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2242 void CClientConfig::writeInt (const std::string
&varName
, sint32 bVal
, bool bForce
)
2244 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2246 varPtr
->forceAsInt(bVal
);
2248 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2251 double CClientConfig::readDouble (const std::string
&varName
)
2254 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2256 bVal
= varPtr
->asDouble();
2258 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2262 void CClientConfig::writeDouble (const std::string
&varName
, double dVal
, bool bForce
)
2264 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2266 varPtr
->forceAsDouble(dVal
);
2268 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2271 string
CClientConfig::readString (const std::string
&varName
)
2274 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2276 sVal
= varPtr
->asString();
2278 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2282 void CClientConfig::writeString (const std::string
&varName
, const std::string
&strVal
, bool bForce
)
2284 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2286 varPtr
->forceAsString(strVal
);
2288 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2291 // ***************************************************************************
2292 bool CClientConfig::readBoolNoWarning(const std::string
&varName
)
2295 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2297 bVal
= varPtr
->asInt() ? true : false;
2301 sint32
CClientConfig::readIntNoWarning(const std::string
&varName
)
2304 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2306 bVal
= varPtr
->asInt();
2310 double CClientConfig::readDoubleNoWarning(const std::string
&varName
)
2313 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2315 bVal
= varPtr
->asDouble();
2319 // ***************************************************************************
2320 float CClientConfig::getActualLandscapeThreshold() const
2322 // The threshold to set in landscape is the inverse of the CFG one
2323 return 1.0f
/LandscapeThreshold
;
2326 // ***************************************************************************
2327 string
CClientConfig::getHtmlLanguageCode() const
2329 if(LanguageCode
=="wk")
2332 return LanguageCode
;
2335 // ***************************************************************************
2336 string
CClientConfig::buildLoadingString( const string
& ucstr
) const
2338 if( LoadingStringCount
> 0 )
2340 uint index
= rand()%LoadingStringCount
;
2341 string tipId
= "uiLoadingString" + toString(index
);
2342 return CI18N::get(tipId
);
2348 // ***************************************************************************
2349 bool CClientConfig::getDefaultConfigLocation(std::string
& p_name
) const
2351 std::string defaultConfigFileName
= "client_default.cfg";
2352 std::string defaultConfigPath
;
2357 // on mac, client_default.cfg should be searched in .app/Contents/Resources/
2358 defaultConfigPath
= getAppBundlePath() + "/Contents/Resources/";
2360 // unders Windows or Linux, search client_default.cfg is same directory as executable
2361 defaultConfigPath
= Args
.getProgramPath();
2364 std::string currentPath
= CPath::standardizePath(CPath::getCurrentPath());
2365 std::string etcPath
= CPath::standardizePath(getRyzomEtcPrefix());
2367 // look in the current working directory first
2368 if (CFile::isExists(currentPath
+ defaultConfigFileName
))
2369 p_name
= currentPath
+ defaultConfigFileName
;
2371 // look in startup directory
2372 else if (CFile::isExists(Args
.getStartupPath() + defaultConfigFileName
))
2373 p_name
= Args
.getStartupPath() + defaultConfigFileName
;
2375 // look in application directory
2376 else if (CFile::isExists(defaultConfigPath
+ defaultConfigFileName
))
2377 p_name
= defaultConfigPath
+ defaultConfigFileName
;
2379 // look in etc prefix path
2380 else if (!etcPath
.empty() && CFile::isExists(etcPath
+ defaultConfigFileName
))
2381 p_name
= etcPath
+ defaultConfigFileName
;
2383 // if some client_default.cfg was found return true
2384 return !p_name
.empty();