1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2019 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.
305 Width
= 0; // Default Width for the window (0 = current screen resolution).
306 Height
= 0; // Default Height for the window (0 = current screen resolution).
307 Depth
= 32; // Default Bit per Pixel.
308 Driver3D
= DrvAuto
; // Select best driver depending on hardware.
309 Contrast
= 0.f
; // Default Monitor Contrast.
310 Luminosity
= 0.f
; // Default Monitor Luminosity.
311 Gamma
= 0.f
; // Default Monitor Gamma.
313 InterfaceScale
= 1.0f
; // Resize UI
314 InterfaceScale_min
= 0.8f
;
315 InterfaceScale_max
= 2.0f
;
316 InterfaceScale_step
= 0.05;
319 WindowSnapInvert
= false;
320 WindowSnapDistance
= 10;
323 VRDisplayDevice
= "Auto";
324 VRDisplayDeviceId
= "";
326 Local
= false; // Default is Net Mode.
327 FSHost
= ""; // Default Host.
329 TexturesInterface
.push_back("texture_interfaces_v3");
330 TexturesInterfaceDXTC
.push_back("texture_interfaces_dxtc");
332 TexturesOutGameInterface
.push_back("texture_interfaces_v3_outgame_ui");
334 TexturesLoginInterface
.push_back("texture_interfaces_v3_login");
336 DisplayAccountButtons
= true;
337 CreateAccountURL
= RYZOM_CLIENT_CREATE_ACCOUNT_URL
; // "https://open.ryzom.dev/ams/";
338 EditAccountURL
= RYZOM_CLIENT_EDIT_ACCOUNT_URL
; // "https://open.ryzom.dev/ams/";
339 ForgetPwdURL
= RYZOM_CLIENT_FORGET_PASSWORD_URL
; // "https://open.ryzom.dev/ams/";
340 Position
= CVector(0.f
, 0.f
, 0.f
); // Default Position.
341 Heading
= CVector(0.f
, 1.f
, 0.f
); // Default Heading.
342 EyesHeight
= 1.5f
; // Default User Eyes Height.
343 Walk
= 1.66f
; // Default Velocity for the Walk.
344 Run
= 6.0f
; // Default Velocity for the Run.
345 Fly
= 25.0f
; // Default Velocity for the Fly.
346 DmWalk
= 6.0f
; // Default Velocity for the Walk in Ring/DM or Ring/Editor.
347 DmRun
= 20.0f
; // Default Velocity for the Run in Ring/DM or Ring/Editor.
349 FlyAccel
= 1000.f
; // Default Acceleration for the fly, in m.s-2
351 AllowDebugCommands
= false; // Add debug commands at startup
353 ForceDeltaTime
= 0; // Default ForceDeltaTime, disabled by default
355 HardwareCursor
= true; // Default HardwareCursor
356 HardwareCursorScale
= 0.85f
;
357 CursorSpeed
= 1.f
; // Default CursorSpeed
358 CursorAcceleration
= 0; // Default CursorAcceleration
359 FreeLookSpeed
= 0.001f
; // Default FreeLookSpeed
360 FreeLookAcceleration
= 0; // Default FreeLookAcceleration
361 FreeLookSmoothingPeriod
= 0.f
; // when in absolute mode, free look factor is used instead of speed, the mouse gives the absolute angle
362 FreeLookInverted
= false;
363 FreeLookTablet
= false; // Mouse reports absolute coordinates, so avoid mouse recentering
364 AutomaticCamera
= true;
365 DblClickMode
= true; // when in dbl click mode, a double click is needed to execute default contextual action
366 AutoEquipTool
= true; // when true player will auto-equip last used weapon or forage tool when doing an action
368 BGColor
= CRGBA(100,100,255); // Default Background Color.
369 LandscapeTileNear
= 50.0f
; // Default Landscape Tile Near.
370 LandscapeThreshold
= 1000.0f
; // Default Landscape Threshold.
371 Vision
= 500.f
; // Player vision.
372 Vision_min
= 200.f
; // Player vision min.
373 Vision_max
= 800.f
; // Player vision max.
374 SkinNbMaxPoly
= 40000;
377 CloudQuality
= 160.0f
;
379 NbMaxSkeletonNotCLod
= 20;
380 CharacterFarClip
= 200.f
;
381 ScreenAspectRatio
= 0.f
; // Default commmon Screen Aspect Ratio (no relation with the resolution) - 0.f = auto
382 FoV
= 75.f
; // Default value for the FoV.
383 ForceDXTC
= false; // Default is no DXTC Compression.
384 AnisotropicFilter
= 0; // Default is disabled (-1 = maximum value, 0 = disabled, 1+ = enabled)
385 DivideTextureSizeBy2
= false; // Divide texture by 2
386 DisableVtxProgram
= false; // Disable Hardware Vertex Program.
387 DisableVtxAGP
= false; // Disable Hardware Vertex AGP.
388 DisableTextureShdr
= false; // Disable Hardware Texture Shader.
389 MicroVeget
= true; // Default is with MicroVeget.
390 MicroVegetDensity
= 100.0f
;
391 HDEntityTexture
= false;
392 HDTextureInstalled
= false;
393 Fog
= true; // Fog is on by default
401 DensityBloom
= 255.f
;
403 GlobalWindPower
= 0.10f
; // Default is 0.25
404 GlobalWindDirection
= CVector(1,0,0); // Default direction is X>0
406 MovieShooterMemory
= 0; // MovieShooter disabled
407 MovieShooterFramePeriod
= 0.040f
; // default is 25 fps
408 MovieShooterBlend
= false;
409 MovieShooterFrameSkip
= 0; // default not skip frame
410 MovieShooterPrefix
= "shot_";
412 CameraRecorderPrefix
= "cam_rec";
413 CameraRecorderBlend
= true;
416 ScreenShotHeight
= 0;
417 ScreenShotFullDetail
= true;
418 ScreenShotZBuffer
= false;
420 MaxNumberOfTimedFXInstances
= 20;
421 SelectionFX
= "sfx_selection_mouseover.ps";
422 MouseOverFX
= "sfx_selection_mouseover.ps";
423 SelectionFXSize
= 0.8f
;
433 PatchVersion
.clear();
435 WebIgMainDomain
= RYZOM_WEBIG_MAIN_URL
; // https://open.ryzom.dev/"
436 WebIgTrustedDomains
.push_back(RYZOM_WEBIG_TRUSTED_DOMAIN
); // open.ryzom.dev
437 WebIgNotifInterval
= 10; // time in minutes
439 CurlMaxConnections
= 5;
440 CurlCABundle
.clear();
442 RingReleaseNotePath
= WebIgMainDomain
+ "/releasenotes_ring/index.php";
443 ReleaseNotePath
= WebIgMainDomain
+ "/releasenotes/index.php";
448 // With a bigger angle, rotation is animated.
449 AnimatedAngleThreshold
= 25.0; //
450 BlendFrameNumber
= 5; //
451 DestThreshold
= 0.01; // Destination Threshold
452 PositionLimiterRadius
= 0.1;
453 SignificantDist
= 0.0001; // Significant Distance
456 SoundOn
= true; // Default is with sound.
457 DriverSound
= SoundDrvAuto
;
458 SoundForceSoftwareBuffer
= true;
459 StartMusic
= "main theme air.ogg"; // Use at game startup (originally no music)
460 EmptySlotMusic
= "loading music loop.ogg"; // Use in character selection for empty slots
461 LoadingMusic
= "main menu loop.ogg"; // Main loading used after leaving character selection, and when going back to character selection
462 KamiTeleportMusic
= "kami teleport.ogg"; // Kami teleport
463 KaravanTeleportMusic
= "karavan teleport.ogg"; // Karavan teleport
464 TeleportLoadingMusic
= "loading music loop.ogg"; // Use for generic teleportations
465 DeathMusic
= "death.ogg"; // Player death
466 SoundSFXVolume
= 1.f
;
467 SoundGameMusicVolume
= 1.f
;
469 EnableBackgroundMusicTimeConstraint
= true;
471 SoundPackedSheetPath
= "data/sound/"; // Default path for sound packed sheets
472 SampleBankDir
= "data/sound/samplebanks"; // Default path for samples
473 UserEntitySoundLevel
= 0.5f
; // Default volume for sound in 1st person
474 UseEax
= true; // Default to use EAX;
475 UseADPCM
= false; // Defualt to PCM sample, NO ADPCM
476 MaxTrack
= 32; // Default to 32 track
478 ColorShout
= CRGBA(150,0,0,255); // Default Shout color.
479 ColorTalk
= CRGBA(255,255,255,255); // Default Talk color.
481 StreamedPackagePath
= "stream";
484 MediaPlayerDirectory
= "music";
485 MediaPlayerAutoPlay
= false;
487 // PreDataPath.push_back("data/gamedev/language/"); // Default Path for the language data
489 // DataPath.push_back("data/"); // Default Path for the Data.
490 // DataPath.push_back("data_leveldesign/"); // Default Path for the Level Design Directory.
491 // DataPath.push_back("data_common/"); // Default Path for the Level Design Directory.
493 DataPathNoRecurse
.push_back("data_leveldesign/leveldesign/Game_Elem");
495 UpdatePackedSheetPath
.push_back("data_leveldesign");
497 UpdatePackedSheet
= false; // Update packed sheet if needed
499 EndScreenTimeOut
= 0.f
; // Default time out for the screen at the end of the application.
500 Loading_BG
= "loading_bg.tga"; // Default name for the loading background file.
501 LoadingFreeTrial_BG
= "loading_free_trial_bg.tga"; // Default name for the loading background file in FreeTrial mode.
502 Launch_BG
= "launcher_bg.tga"; // Default name for the launch background file.
503 TeleportKami_BG
= "teleport_kami_bg.tga";
504 TeleportKaravan_BG
= "teleport_caravan_bg.tga";
505 Elevator_BG
= "elevator_bg.tga"; // Default name for the loading background file.
506 ResurectKami_BG
= "resurect_kami_bg.tga";
507 ResurectKaravan_BG
= "resurect_caravane_bg.tga";
508 End_BG
= "end_bg.tga"; // Default name for the last background file.
509 IntroNevrax_BG
= "launcher_nevrax.tga";
510 IntroNVidia_BG
= "launcher_nvidia.tga";
513 TeleportInfoY
= 0.23f
;
516 IdFilePath
= "sheet_id.bin";
517 PacsPrimDir
.push_back("data/3d/");
519 Shadows
= true; // Draw Shadows by default.
520 ShadowsClipFar
= 10.f
; // Shadows are disabled after this distance.
521 ShadowsLodDist
= 3.f
; // Shadows draw with just 1 part after this distance.
522 ShadowZDirClampLandscape
= -0.5f
; // On landscape, allow a minimum Phi angle of -30 degrees
523 ShadowZDirClampInterior
= -0.86f
; // On Interior, allow a minimum Phi angle of -60 degrees
524 ShadowZDirClampSmoothSpeed
= 0.5f
;
525 ShadowMaxDepthLandscape
= 8.f
;
526 ShadowMaxDepthInterior
= 2.f
;
527 ShadowMaxDepthSmoothSpeed
= 6.f
;
530 Names
= false; // Don't draw Names by default.
532 Sleep
= -1; // Default : client does not sleep.
533 ProcessPriority
= 0; // Default : NORMAL
534 CPUMask
= 0; // Default : auto detection
535 ShowPath
= false; // Default : do not display the path.
536 DrawBoxes
= false; // Default : Do not draw the selection.
538 UserSheet
= "fyros.race_stats"; // Default sheet used.
539 Sex
= GSGENDER::male
; // Default : male.
541 PrimitiveHeightAddition
= 2.f
; // Default : 2.f
547 ManualWeatherSetup
= false;
549 ChaseReactionTime
= 0.4f
; // Reaction time before chasing someone.
551 TimeToAdjustCamera
= 1000.0;
552 ChangeDirAngle
= 1.70f
; // Default Angle.
554 GuildSymbolSize
= 0.3f
; // Default Guild Symbol Size.
555 SelectionDist
= 150.f
; // Default dist in meter.
556 SelectionOutBBoxWeight
= 16.f
; // Default factor
557 LootDist
= 4.f
; // Default loot/harvest distance (in meter).
558 SpaceSelectionDist
= 50.f
;
559 SpaceSelectionMaxCycle
= 1;
561 ForceLanguage
= false;
562 LanguageCode
= "en"; // Default to english
563 DebugStringManager
= false; // Default to no debug
566 WaterOffset
= -1.085f
;
567 FyrosWaterOffset
= -1.0f
;
568 MatisWaterOffset
= -1.08f
;
569 TrykerWaterOffset
= -0.88f
;
570 ZoraiWaterOffset
= -1.25f
;
571 WaterOffsetCreature
= -1.6f
;
572 TimeToRemoveCol
= 1000;
573 MoveToTimeToStopStall
= 500;
576 MaxHeadTargetDist
= 30.0f
;
577 DeadFXName
= "misc_dead.ps";
578 ImpactFXName
= "impact.ps";
579 SkillUpFXName
= "misc_levelup.ps";
581 NameScale
= 1.0f
; // Default Scale to display Names.
585 ConstNameSizeDist
= 20.0f
;
586 StaticNameHeight
= true;
591 ForageInterfaceZBias
= -10.f
;
596 EnableRacialAnimation
= true;
599 RunAtTheBeginning
= true;
600 SelectWithRClick
= false; // Default right click cannot select.
601 RotKeySpeedMax
= 3.0f
;
602 RotKeySpeedMin
= 1.0f
;
604 PutBackItems
= false;
605 ShowNameUnderCursor
= true;
606 ShowNameSelected
= true;
607 ShowNameBelowDistanceSqr
= 20.f
* 20.f
;
608 ForceIndoorFPV
= false;
611 TransparentUnderCursor
= false;
612 ItemGroupAllowGuild
= false;
616 CameraDistance
= 3.0f
;
617 CameraDistStep
= 1.0f
;
618 CameraDistMin
= 1.0f
;
619 CameraDistMax
= 100.0f
;
620 DmCameraDistMax
= 25.0f
;
622 CameraSpeedMin
= 0.2f
;
623 CameraSpeedMax
= 1.0f
;
624 CameraResetSpeed
= 2.0f
;
627 R2EDMaxMapScale
= 8.0f
;
629 TargetChangeCompass
= true;
633 VerboseAnimUser
= false;
634 VerboseAnimSelection
= false;
635 VerboseAllTraffic
= false;
638 DisplayMissingAnimFile
= false;
639 DefaultEntity
= "ccafb1.creature";
643 HelpFontColor
= CRGBA(255,255,255);
644 HelpLineStep
= 0.025f
;
646 DebugFontColor
= CRGBA(250, 250, 250);
647 DebugLineStep
= 0.02f
;
648 HeadOffset
= CVector(0.f
, 0.f
, 0.f
);
652 FPExceptions
= false; // Disable Floating Point Exceptions.
653 DisplayWeapons
= false; // Do not dusplay weapons in first person.
654 NeedComputeVS
= false; // Do not need to compute Visual Slots.
656 GroundFXMaxDist
= 40.f
;
658 GroundFXCacheSize
= 10;
660 AutoReloadFiles
= false;
661 BlendShapePatched
= true;
662 ExtendedCommands
= false;
664 WaterEnvMapUpdateTime
= 1.f
;
666 NumFrameForProfile
= 0;
667 SimulateServerTick
= false;
672 PreCacheShapes
= true;
673 ResetShapeBankOnRetCharSelect
= false;
674 LandscapeEnabled
= true;
675 VillagesEnabled
= true;
677 CacheUIParsing
= false;
678 MicroLifeEnabled
= true;
682 StageLCTUsage
= StageUsePosOnlyLCT
;
684 SimulatePacketLossRatio
= 0;
686 CheckMemoryEveryNFrame
= -1;
687 LogMemoryAllocation
=false;
688 LogMemoryAllocationSize
=8;
690 DamageShieldEnabled
= false;
692 LevelDesignEnabled
= false;
696 R2EDExtendedDebug
= false;
697 R2EDVerboseParseTime
= false;
698 R2EDDontReparseUnchangedUIFiles
= false;
699 R2EDLightPalette
= false;
700 R2EDAutoSaveWait
= 60*5;
701 R2EDAutoSaveSlot
= 9;
702 R2EDMustVerifyRingAccessWhileLoadingAnimation
= false;
703 R2EDUseVerboseRingAccess
= false;
706 DamageShieldEnabled
= false;
708 AllowDebugLua
= false;
709 DisplayLuaDebugInfo
= false;
710 BeepWhenLaunched
= false;
714 LoadingStringCount
= 0;
716 LuaDebugInfoGotoButtonEnabled
= false;
718 FogDistAndDepthLookupBias
= 0.f
;
720 R2EDLoadDynamicFeatures
= 0;
722 CheckR2ScenarioMD5
= true;
724 DisplayTPReason
= false;
726 //TPCancelButtonX = 988;
727 //TPCancelButtonY = 138;
729 //TPQuitButtonY = 138;
734 ScenarioSavePath
= "./my_scenarios/";
736 R2EDClippedEntityBlendTime
= 0.18f
;
738 BackgroundDownloader
= false;
743 //---------------------------------------------------
745 // Load the client config file.
746 //---------------------------------------------------
747 void CClientConfig::setValuesOnFileChange()
749 // ClientCfg.ConfigFile.print (InfoLog);
751 // display an info only when the file change
752 nlinfo ("reloading the config file!");
757 //---------------------------------------------------
759 // Load the client config file.
760 //---------------------------------------------------
761 void CClientConfig::setValues()
763 CConfigFile::CVar
*varPtr
= 0;
764 static bool firstTimeSetValues
= true;
766 //////////////////////
767 // INTERFACE CONFIG //
769 READ_STRING_FV(XMLInputFile
)
772 READ_BOOL_FV(SkipIntro
);
773 READ_BOOL_DEV(SkipEULA
);
774 READ_INT_DEV(SelectCharacter
);
776 READ_INT_FV(SelectedSlot
);
777 if( ClientCfg
.SelectedSlot
>4 )
779 ClientCfg
.SelectedSlot
= 0;
782 // interface textures login menus
783 READ_STRINGVECTOR_FV(TexturesLoginInterface
);
784 READ_STRINGVECTOR_FV(TexturesLoginInterfaceDXTC
);
786 // interface textures outgame menus
787 READ_STRINGVECTOR_FV(TexturesOutGameInterface
);
788 READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC
);
790 // interface textures ingame and r2
791 READ_STRINGVECTOR_FV(TexturesInterface
);
792 READ_STRINGVECTOR_FV(TexturesInterfaceDXTC
);
794 // interface files login menus
795 READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles
);
797 // interface files outgame menus
798 READ_STRINGVECTOR_FV(XMLOutGameInterfaceFiles
);
801 READ_STRINGVECTOR_FV(XMLInterfaceFiles
);
804 READ_STRINGVECTOR_FV(XMLR2EDInterfaceFiles
);
807 READ_STRINGVECTOR_FV(Logos
);
810 READ_BOOL_DEV(TestBrowser
);
811 READ_STRING_DEV(TestBrowserUrl
);
815 varPtr
= ClientCfg
.ConfigFile
.getVarPtr ("ClientLight");
817 ClientCfg
.Light
= varPtr
->asInt() ? true : false;
818 #endif // !FINAL_VERSION
821 READ_BOOL_DEV(LandscapeEnabled
)
822 READ_BOOL_DEV(VillagesEnabled
)
823 READ_BOOL_DEV(EAMEnabled
)
824 READ_BOOL_DEV(CacheUIParsing
)
825 READ_BOOL_DEV(MicroLifeEnabled
)
827 READ_BOOL_DEV(LevelDesignEnabled
)
834 READ_BOOL_FV(SaveConfig
)
837 READ_INT_FV(PositionX
)
838 READ_INT_FV(PositionY
)
841 READ_INT_FV(Frequency
)
843 CConfigFile::CVar
*pcvFullScreen
= ClientCfg
.ConfigFile
.getVarPtr("FullScreen");
846 ClientCfg
.Windowed
= pcvFullScreen
->asInt() ? false : true;
849 cfgWarning("Default value used for 'Fullscreen'");
854 // Depth : Bit Per Pixel
857 READ_FLOAT_FV(Contrast
)
859 READ_FLOAT_FV(Luminosity
)
863 READ_FLOAT_FV(InterfaceScale
);
864 READ_FLOAT_FV(InterfaceScale_min
);
865 READ_FLOAT_FV(InterfaceScale_max
);
866 READ_FLOAT_FV(InterfaceScale_step
);
867 clamp(ClientCfg
.InterfaceScale
, ClientCfg
.InterfaceScale_min
, ClientCfg
.InterfaceScale_max
);
868 READ_BOOL_FV(BilinearUI
);
869 READ_BOOL_FV(WindowSnapInvert
);
870 READ_INT_FV(WindowSnapDistance
);
872 varPtr
= ClientCfg
.ConfigFile
.getVarPtr ("Driver3D");
875 if (nlstricmp(varPtr
->asString(), "Auto") == 0 || nlstricmp(varPtr
->asString(), "0") == 0) ClientCfg
.Driver3D
= CClientConfig::DrvAuto
;
876 else if (nlstricmp(varPtr
->asString(), "OpenGL") == 0 || nlstricmp(varPtr
->asString(), "1") == 0) ClientCfg
.Driver3D
= CClientConfig::OpenGL
;
877 else if (nlstricmp(varPtr
->asString(), "Direct3D") == 0 || nlstricmp(varPtr
->asString(), "2") == 0) ClientCfg
.Driver3D
= CClientConfig::Direct3D
;
878 else if (nlstricmp(varPtr
->asString(), "OpenGLES") == 0 || nlstricmp(varPtr
->asString(), "3") == 0) ClientCfg
.Driver3D
= CClientConfig::OpenGLES
;
881 cfgWarning ("Default value used for 'Driver3D' !!!");
883 READ_BOOL_FV(VREnable
)
884 READ_STRING_FV(VRDisplayDevice
)
885 READ_STRING_FV(VRDisplayDeviceId
)
889 READ_BOOL_FV(HardwareCursor
)
890 READ_FLOAT_FV(HardwareCursorScale
)
891 READ_FLOAT_FV(CursorSpeed
)
892 READ_INT_FV(CursorAcceleration
)
893 READ_FLOAT_FV(FreeLookSpeed
)
894 READ_INT_FV(FreeLookAcceleration
)
895 READ_FLOAT_FV(FreeLookSmoothingPeriod
)
896 READ_BOOL_FV(FreeLookInverted
)
897 READ_BOOL_FV(FreeLookTablet
)
898 READ_BOOL_FV(AutomaticCamera
)
899 READ_BOOL_FV(DblClickMode
)
900 READ_BOOL_FV(AutoEquipTool
)
905 // Local : local mode or network mode
907 #endif // FINAL_VERSION
909 READ_STRING_FV(FSHost
)
911 READ_BOOL_DEV(DisplayAccountButtons
)
912 READ_STRING_DEV(CreateAccountURL
)
913 READ_STRING_DEV(EditAccountURL
)
914 READ_STRING_DEV(ForgetPwdURL
)
915 READ_STRING_DEV(BetaAccountURL
)
916 READ_STRING_DEV(FreeTrialURL
)
918 // defined in client_default.cfg
919 READ_STRING_FV(ConditionsTermsURL
)
920 READ_STRING_FV(NamingPolicyURL
)
921 READ_STRING_FV(LoginSupportURL
)
924 // if cookie is not empty, it means that the client was launch
925 // by the nel_launcher, so it can't be local
928 nlassert (!FSAddr
.empty());
929 ClientCfg
.Local
= false;
933 nlassert (FSAddr
.empty());
939 READ_CVECTOR_DEV(Position
)
940 READ_CVECTOR_DEV(Heading
)
942 READ_FLOAT_DEV(EyesHeight
)
949 //When editing or Dm ing a session in ring mode the player move quicker
951 READ_FLOAT_DEV(DmWalk
)
953 READ_FLOAT_DEV(DmRun
)
959 READ_FLOAT_DEV(FlyAccel
)
961 READ_BOOL_FV(AllowDebugCommands
)
964 READ_INT_DEV(ForceDeltaTime
)
970 CConfigFile::CVar
*pcvBackColor
= ClientCfg
.ConfigFile
.getVarPtr("Background");
971 if( pcvBackColor
&& (pcvBackColor
->size()==3) )
973 ClientCfg
.BGColor
.R
= pcvBackColor
->asInt(0);
974 ClientCfg
.BGColor
.G
= pcvBackColor
->asInt(1);
975 ClientCfg
.BGColor
.B
= pcvBackColor
->asInt(2);
976 ClientCfg
.BGColor
.A
= 255;
979 cfgWarning("Default value used for 'Background'");
980 #endif // !FINAL_VERSION
982 READ_FLOAT_FV(LandscapeTileNear
)
983 // LandscapeThreshold
984 READ_FLOAT_FV(LandscapeThreshold
)
985 // to be backward compatible, suppose a value<1 is for the old System!!! => invert it!
986 if( ClientCfg
.LandscapeThreshold
<1)
988 ClientCfg
.LandscapeThreshold
= 1.f
/ ClientCfg
.LandscapeThreshold
;
989 // must re-write in the CFG database, to be ok with the in-game configurator
990 varPtr
= ClientCfg
.ConfigFile
.getVarPtr("LandscapeThreshold");
992 varPtr
->forceAsDouble(ClientCfg
.LandscapeThreshold
);
995 READ_FLOAT_FV(Vision
)
996 READ_FLOAT_FV(Vision_min
)
997 READ_FLOAT_FV(Vision_max
)
999 READ_INT_FV(SkinNbMaxPoly
)
1001 READ_INT_FV(FxNbMaxPoly
)
1003 READ_FLOAT_FV(CloudQuality
)
1004 READ_INT_FV(CloudUpdate
)
1005 // NbMaxSkeletonNotCLod
1006 READ_INT_FV(NbMaxSkeletonNotCLod
)
1008 READ_FLOAT_FV(CharacterFarClip
)
1012 READ_BOOL_FV(SquareBloom
)
1013 READ_FLOAT_FV(DensityBloom
)
1018 // ScreenAspectRatio.
1019 READ_FLOAT_FV(ScreenAspectRatio
)
1023 READ_BOOL_FV(ForceDXTC
)
1024 // AnisotropicFilter
1025 READ_INT_FV(AnisotropicFilter
)
1026 // DivideTextureSizeBy2
1027 READ_BOOL_FV(DivideTextureSizeBy2
)
1028 // DisableVtxProgram
1029 READ_BOOL_FV(DisableVtxProgram
)
1031 READ_BOOL_FV(DisableVtxAGP
)
1032 // DisableTextureShdr
1033 READ_BOOL_FV(DisableTextureShdr
)
1035 READ_BOOL_FV(MicroVeget
)
1036 // MicroVeget Density
1037 READ_FLOAT_FV(MicroVegetDensity
)
1038 // GlobalWindPower: Global Wind Power
1039 READ_FLOAT_DEV(GlobalWindPower
)
1040 // Global Wind Direction
1041 READ_CVECTOR_DEV(GlobalWindDirection
)
1043 READ_BOOL_FV(HDEntityTexture
)
1044 // HDTextureInstalled
1045 READ_BOOL_FV(HDTextureInstalled
)
1051 READ_BOOL_FV(WaitVBL
)
1053 READ_INT_FV(VideoMemory
);
1055 READ_INT_DEV(TimerMode
)
1057 // MovieShooterMemory
1058 CConfigFile::CVar
*pcv
= ClientCfg
.ConfigFile
.getVarPtr("MovieShooterMemory");
1061 ClientCfg
.MovieShooterMemory
= pcv
->asInt();
1062 // Transform to octet
1063 ClientCfg
.MovieShooterMemory
*= 1024*1024;
1066 cfgWarning("'MovieShooterMemory' not found => MovieShooter Disabled");
1068 READ_STRING_FV(MovieShooterPath
)
1069 // MovieShooterFramePeriod
1070 READ_FLOAT_FV(MovieShooterFramePeriod
)
1071 // MovieShooterBlend
1072 READ_BOOL_FV(MovieShooterBlend
)
1073 // MovieShooterFrameSkip
1074 READ_INT_FV(MovieShooterFrameSkip
)
1077 READ_STRING_FV(CameraRecorderPath
)
1078 READ_STRING_FV(CameraRecorderPrefix
)
1079 READ_BOOL_FV(CameraRecorderBlend
)
1082 READ_INT_FV(ScreenShotWidth
)
1083 READ_INT_FV(ScreenShotHeight
)
1084 READ_BOOL_FV(ScreenShotFullDetail
)
1085 READ_BOOL_FV(ScreenShotZBuffer
)
1087 /////////////////////////
1088 // NEW PATCHING SYSTEM //
1089 READ_BOOL_FV(PatchWanted
)
1091 #ifdef RZ_USE_CUSTOM_PATCH_SERVER
1092 READ_STRING_FV(PatchUrl
)
1093 READ_STRING_FV(PatchVersion
)
1094 READ_STRING_FV(RingReleaseNotePath
)
1095 READ_STRING_FV(ReleaseNotePath
)
1097 READ_STRING_DEV(PatchUrl
)
1098 READ_STRING_DEV(PatchVersion
)
1099 READ_STRING_DEV(RingReleaseNotePath
)
1100 READ_STRING_DEV(ReleaseNotePath
)
1103 /////////////////////////
1104 // NEW PATCHLET SYSTEM //
1105 READ_STRING_FV(PatchletUrl
)
1109 READ_STRING_FV(WebIgMainDomain
);
1110 if (ClientCfg
.WebIgMainDomain
.find("http://") == std::string::npos
1111 || ClientCfg
.WebIgMainDomain
.find("https://") == std::string::npos
)
1112 ClientCfg
.WebIgMainDomain
= "http://" + ClientCfg
.WebIgMainDomain
;
1113 READ_STRINGVECTOR_FV(WebIgTrustedDomains
);
1114 READ_INT_FV(WebIgNotifInterval
);
1115 READ_INT_FV(CurlMaxConnections
);
1116 if (ClientCfg
.CurlMaxConnections
< 0)
1117 ClientCfg
.CurlMaxConnections
= 2;
1119 READ_STRING_FV(CurlCABundle
);
1120 if (!ClientCfg
.CurlCABundle
.empty() && ClientCfg
.CurlCABundle
[0] == '%') // Path is relative to client_default.cfg path (used by ryzom patch)
1122 string defaultConfigFileName
;
1123 if (ClientCfg
.getDefaultConfigLocation(defaultConfigFileName
))
1124 ClientCfg
.CurlCABundle
= CFile::getPath(defaultConfigFileName
)+ClientCfg
.CurlCABundle
.substr(1);
1129 // AnimatedAngleThreshold
1130 READ_DOUBLE_DEV(AnimatedAngleThreshold
)
1132 READ_INT_DEV(BlendFrameNumber
)
1134 READ_DOUBLE_DEV(DestThreshold
)
1135 // PositionLimiterRadius
1136 READ_DOUBLE_DEV(PositionLimiterRadius
)
1138 READ_DOUBLE_DEV(SignificantDist
)
1140 READ_ENUM_ASINT_DEV(TStageLCTUsage
, StageLCTUsage
)
1145 READ_FLOAT_DEV(WaterOffset
)
1148 READ_FLOAT_DEV(FyrosWaterOffset
)
1149 READ_FLOAT_DEV(MatisWaterOffset
)
1150 READ_FLOAT_DEV(TrykerWaterOffset
)
1151 READ_FLOAT_DEV(ZoraiWaterOffset
)
1152 #endif // FINAL_VERSION
1154 // Water Offset for creature
1155 READ_FLOAT_DEV(WaterOffsetCreature
)
1157 READ_INT_DEV(TimeToRemoveCol
)
1158 // MoveToTimeToStopStall
1159 READ_INT_DEV(MoveToTimeToStopStall
)
1160 // TimeToAdjustCamera
1161 READ_DOUBLE_DEV(TimeToAdjustCamera
)
1163 READ_DOUBLE_DEV(ChangeDirAngle
)
1165 READ_FLOAT_DEV(GuildSymbolSize
)
1167 READ_FLOAT_DEV(SelectionDist
)
1168 // SelectionOutBBoxWeight
1169 READ_FLOAT_DEV(SelectionOutBBoxWeight
)
1171 READ_FLOAT_DEV(LootDist
)
1172 // SpaceSelectionDist
1173 READ_FLOAT_DEV(SpaceSelectionDist
)
1174 // SpaceSelectionMaxCycle
1175 READ_INT_DEV(SpaceSelectionMaxCycle
)
1176 // Third Person View Min Pitch.
1177 READ_FLOAT_DEV(TPVMinPitch
)
1178 // Third Person View Max Pitch.
1179 READ_FLOAT_DEV(TPVMaxPitch
)
1180 // The character look at the target before this distance.
1181 READ_FLOAT_DEV(MaxHeadTargetDist
)
1182 // FX played when dead
1183 READ_STRING_DEV(DeadFXName
)
1184 // FX played for each impact
1185 READ_STRING_DEV(ImpactFXName
)
1186 // FX Played at skill up
1187 READ_STRING_DEV(SkillUpFXName
)
1189 READ_DOUBLE_DEV(MinDistFactor
)
1191 READ_FLOAT_DEV(NameScale
)
1193 READ_FLOAT_DEV(NamePos
)
1195 READ_INT_DEV(NameFontSize
)
1197 READ_FLOAT_DEV(MaxNameDist
)
1198 // ConstNameSizeDist
1199 READ_FLOAT_DEV(ConstNameSizeDist
)
1201 READ_BOOL_FV(StaticNameHeight
)
1203 READ_FLOAT_DEV(BarsHeight
)
1205 READ_FLOAT_DEV(BarsWidth
)
1207 READ_BOOL_FV(DisplayWeapons
)
1209 READ_DOUBLE_DEV(FightAreaSize
)
1211 READ_FLOAT_DEV(AttackDist
)
1213 READ_FLOAT_DEV(BubbleZBias
);
1214 // ForageInterfaceZBias
1215 READ_FLOAT_DEV(ForageInterfaceZBias
);
1217 // EnableRacialAnimation
1218 READ_BOOL_FV(EnableRacialAnimation
);
1221 READ_FLOAT_DEV(FyrosScale
);
1222 READ_FLOAT_DEV(MatisScale
);
1223 READ_FLOAT_DEV(TrykerScale
);
1224 READ_FLOAT_DEV(ZoraiScale
);
1226 #endif // FINAL_VERSION
1231 READ_BOOL_FV(SoundOn
)
1233 varPtr
= ClientCfg
.ConfigFile
.getVarPtr ("DriverSound");
1236 if (nlstricmp(varPtr
->asString(), "Auto") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvAuto
;
1237 else if (nlstricmp(varPtr
->asString(), "FMod") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvFMod
;
1238 else if (nlstricmp(varPtr
->asString(), "OpenAL") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvOpenAL
;
1239 else if (nlstricmp(varPtr
->asString(), "DirectSound") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvDirectSound
;
1240 else if (nlstricmp(varPtr
->asString(), "XAudio2") == 0) ClientCfg
.DriverSound
= CClientConfig::SoundDrvXAudio2
;
1243 cfgWarning ("Default value used for 'DriverSound' !!!");
1244 // SoundForceSoftwareBuffer
1245 READ_BOOL_FV(SoundForceSoftwareBuffer
);
1246 // SoundOutGameMusic
1247 READ_STRING_DEV(StartMusic
)
1248 READ_STRING_DEV(EmptySlotMusic
)
1249 READ_STRING_DEV(LoadingMusic
)
1250 READ_STRING_DEV(KamiTeleportMusic
)
1251 READ_STRING_DEV(KaravanTeleportMusic
)
1252 READ_STRING_DEV(TeleportLoadingMusic
)
1253 READ_STRING_DEV(DeathMusic
)
1255 READ_FLOAT_FV(SoundSFXVolume
);
1256 // SoundGameMusicVolume
1257 READ_FLOAT_FV(SoundGameMusicVolume
);
1259 READ_INT_DEV(SoundTPFade
);
1260 // EnableBackgroundMusicTimeConstraint
1261 READ_BOOL_DEV(EnableBackgroundMusicTimeConstraint
);
1262 // SoundPackedSheetPath
1263 READ_STRING_DEV(SoundPackedSheetPath
)
1265 READ_STRING_DEV(SampleBankDir
)
1266 // UserEntitySoundLevel : UserEntity sound level
1267 READ_FLOAT_FV(UserEntitySoundLevel
)
1269 READ_BOOL_FV(UseEax
)
1271 READ_BOOL_DEV(UseADPCM
)
1273 READ_INT_FV(MaxTrack
)
1276 READ_STRING_FV(MediaPlayerDirectory
);
1277 READ_BOOL_FV(MediaPlayerAutoPlay
);
1282 CConfigFile::CVar
*pcvColorShout
= ClientCfg
.ConfigFile
.getVarPtr("ColorShout");
1283 if( pcvColorShout
&& (pcvColorShout
->size() == 3) )
1285 ClientCfg
.ColorShout
.R
= pcvColorShout
->asInt(0);
1286 ClientCfg
.ColorShout
.G
= pcvColorShout
->asInt(1);
1287 ClientCfg
.ColorShout
.B
= pcvColorShout
->asInt(2);
1288 ClientCfg
.ColorShout
.A
= 255;
1291 cfgWarning("Default value used for 'ColorShout'");
1294 CConfigFile::CVar
*pcvColorTalk
= ClientCfg
.ConfigFile
.getVarPtr("ColorTalk");
1295 if( pcvColorTalk
&& (pcvColorTalk
->size() == 3) )
1297 ClientCfg
.ColorTalk
.R
= pcvColorTalk
->asInt(0);
1298 ClientCfg
.ColorTalk
.G
= pcvColorTalk
->asInt(1);
1299 ClientCfg
.ColorTalk
.B
= pcvColorTalk
->asInt(2);
1300 ClientCfg
.ColorTalk
.A
= 255;
1303 cfgWarning("Default value used for 'ColorTalk'");
1309 READ_STRINGVECTOR_FV(PreDataPath
);
1312 READ_STRINGVECTOR_FV(DataPath
);
1314 // Data Path no recurse.
1315 READ_STRINGVECTOR_FV(DataPathNoRecurse
);
1317 // Streamed package path
1318 READ_STRING_FV(StreamedPackagePath
);
1320 // Streamed package hosts
1321 READ_STRINGVECTOR_FV(StreamedPackageHosts
);
1323 // List of files that trigger R2ED reload when touched
1324 READ_STRINGVECTOR_FV(R2EDReloadFiles
);
1326 // Update packed sheet Path
1327 READ_STRINGVECTOR_FV(UpdatePackedSheetPath
);
1329 // UpdatePackedSheet
1330 READ_BOOL_DEV(UpdatePackedSheet
)
1333 READ_FLOAT_DEV(EndScreenTimeOut
)
1335 READ_STRING_FV(Loading_BG
)
1336 READ_STRING_FV(LoadingFreeTrial_BG
)
1337 READ_STRING_FV(Launch_BG
)
1338 READ_STRING_FV(TeleportKami_BG
)
1339 READ_STRING_FV(TeleportKaravan_BG
)
1340 READ_STRING_FV(Elevator_BG
)
1341 READ_STRING_FV(ResurectKami_BG
)
1342 READ_STRING_FV(ResurectKaravan_BG
)
1343 READ_STRING_FV(End_BG
)
1344 READ_STRING_FV(IntroNevrax_BG
)
1345 READ_STRING_FV(IntroNVidia_BG
)
1347 READ_FLOAT_DEV(TipsY
)
1348 READ_FLOAT_DEV(TeleportInfoY
)
1350 READ_STRING_DEV(SceneName
)
1352 READ_STRING_DEV(IdFilePath
)
1355 READ_STRINGVECTOR_DEV(PacsPrimDir
);
1360 CConfigFile::CVar
*pcvTmp
= ClientCfg
.ConfigFile
.getVarPtr("NegFiltersDebug");
1363 int iSz
= pcvTmp
->size();
1364 for(int k
= 0; k
< iSz
; ++k
)
1366 DebugLog
->addNegativeFilter (pcvTmp
->asString(k
).c_str());
1370 cfgWarning("Default value used for 'NegFiltersDebug'");
1372 pcvTmp
= ClientCfg
.ConfigFile
.getVarPtr("NegFiltersInfo");
1375 int iSz
= pcvTmp
->size();
1376 for(int k
= 0; k
< iSz
; ++k
)
1378 InfoLog
->addNegativeFilter (pcvTmp
->asString(k
).c_str());
1382 cfgWarning("Default value used for 'NegFiltersInfo'");
1384 pcvTmp
= ClientCfg
.ConfigFile
.getVarPtr("NegFiltersWarning");
1387 int iSz
= pcvTmp
->size();
1388 for(int k
= 0; k
< iSz
; ++k
)
1390 WarningLog
->addNegativeFilter (pcvTmp
->asString(k
).c_str());
1394 cfgWarning("Default value used for 'NegFiltersWarning'");
1397 READ_STRINGVECTOR_FV(StartCommands
);
1401 // Colors for system infos
1402 ClientCfg
.SystemInfoParams
.clear();
1403 CConfigFile::CVar
*sic
= ClientCfg
.ConfigFile
.getVarPtr("SystemInfoColors");
1406 cfgWarning("Can't read SystemInfoColors, all colors defaulting to white");
1410 if (sic
->size() & 1)
1412 cfgWarning("Expecting odd size for SystemInfoColors. Last entry ignored.");
1414 uint numCol
= sic
->size() >> 1;
1415 for(uint k
= 0; k
< numCol
; ++k
)
1421 if (sscanf(sic
->asString((2 * k
) + 1).c_str(), "%d %d %d %d %s %s", &r
, &g
, &b
, &a
, mode
, fx
) < 5)
1423 if(DisplayCFGWarning
)
1424 nlwarning("Can't parse color for entry %s", sic
->asString(2 * k
).c_str());
1430 p
.Color
= CRGBA(r
, g
, b
, a
);
1431 p
.Mode
= SSysInfoParam::Normal
;
1432 p
.SysInfoFxName
= string(fx
);
1433 if (stricmp(mode
, "over") == 0) p
.Mode
= SSysInfoParam::Over
;
1434 else if (stricmp(mode
, "overonly") == 0) p
.Mode
= SSysInfoParam::OverOnly
;
1435 else if (stricmp(mode
, "center") == 0) p
.Mode
= SSysInfoParam::Center
;
1436 else if (stricmp(mode
, "centeraround") == 0) p
.Mode
= SSysInfoParam::CenterAround
;
1437 else if (stricmp(mode
, "around") == 0) p
.Mode
= SSysInfoParam::Around
;
1439 ClientCfg
.SystemInfoParams
[toLowerAscii(sic
->asString(2 * k
))] = p
;
1444 #ifndef RZ_NO_CLIENT
1445 // printf commands in loading screens
1446 ClientCfg
.PrintfCommands
.clear();
1447 ClientCfg
.PrintfCommandsFreeTrial
.clear();
1448 std::vector
< std::string
> printfCommands(2);
1449 printfCommands
[0] = "PrintfCommands";
1450 printfCommands
[1] = "PrintfCommandsFreeTrial";
1451 for(uint p
=0; p
<2; p
++)
1453 CConfigFile::CVar
*pc
= ClientCfg
.ConfigFile
.getVarPtr(printfCommands
[p
].c_str());
1456 if( pc
->size()%5 == 0 && pc
->size() >= 5)
1458 for (uint i
= 0; i
< pc
->size(); i
+=5)
1460 SPrintfCommand pcom
;
1461 pcom
.X
= pc
->asInt(i
);
1462 pcom
.Y
= pc
->asInt(i
+1);
1463 pcom
.Color
= CRGBA::stringToRGBA( pc
->asString(i
+2).c_str() );
1464 pcom
.FontSize
= pc
->asInt(i
+3);
1465 pcom
.Text
= pc
->asString(i
+4);
1467 if(p
==0) ClientCfg
.PrintfCommands
.push_back( pcom
);
1468 else ClientCfg
.PrintfCommandsFreeTrial
.push_back( pcom
);
1473 cfgWarning(("Missing or too many parameters in " + printfCommands
[p
]).c_str());
1479 READ_INT_FV(LoadingStringCount
)
1482 READ_INT_DEV(CheckMemoryEveryNFrame
)
1483 READ_BOOL_DEV(LogMemoryAllocation
)
1484 READ_INT_DEV(LogMemoryAllocationSize
)
1487 READ_BOOL_FV(SelectWithRClick
)
1488 READ_BOOL_DEV(RunAtTheBeginning
)
1489 READ_FLOAT_FV(RotKeySpeedMax
)
1490 READ_FLOAT_FV(RotKeySpeedMin
)
1491 READ_FLOAT_FV(RotAccel
)
1492 READ_BOOL_DEV(PutBackItems
)
1493 READ_BOOL_DEV(ShowNameUnderCursor
)
1494 READ_BOOL_DEV(ShowNameSelected
)
1495 READ_FLOAT_DEV(ShowNameBelowDistanceSqr
)
1496 READ_BOOL_DEV(ForceIndoorFPV
)
1497 READ_BOOL_FV(FollowOnAtk
);
1498 READ_BOOL_FV(AtkOnSelect
);
1499 READ_BOOL_DEV(TransparentUnderCursor
);
1501 READ_BOOL_FV(ItemGroupAllowGuild
);
1506 // Read the view mode at load time only, cause prefer keep ingame player setup
1507 if(firstTimeSetValues
)
1511 READ_FLOAT_FV(CameraDistStep
)
1512 READ_FLOAT_FV(CameraDistMin
)
1513 READ_FLOAT_FV(CameraDistMax
)
1514 READ_FLOAT_FV(DmCameraDistMax
)
1515 READ_FLOAT_FV(CameraAccel
)
1516 READ_FLOAT_FV(CameraSpeedMin
)
1517 READ_FLOAT_FV(CameraSpeedMax
)
1518 READ_FLOAT_FV(CameraResetSpeed
)
1519 // Read the camera height and distance at load time only, cause prefer keep ingame player setup
1520 if(firstTimeSetValues
)
1522 READ_FLOAT_FV(CameraHeight
)
1523 READ_FLOAT_FV(CameraDistance
)
1526 // Default values for CGroupMap
1527 READ_FLOAT_FV(MaxMapScale
);
1528 READ_FLOAT_FV(R2EDMaxMapScale
);
1530 // /tar to update compass or not
1531 READ_BOOL_FV(TargetChangeCompass
);
1535 // Shadows : Get Shadows state
1536 READ_BOOL_FV(Shadows
)
1537 // ShadowsClipFar : Get Shadows Clip Far.
1538 READ_FLOAT_DEV(ShadowsClipFar
)
1539 // ShadowsLodDist : Get Shadows Lod Distance.
1540 READ_FLOAT_DEV(ShadowsLodDist
)
1542 READ_FLOAT_DEV(ShadowZDirClampLandscape
);
1543 READ_FLOAT_DEV(ShadowZDirClampInterior
);
1544 READ_FLOAT_DEV(ShadowZDirClampSmoothSpeed
);
1546 READ_FLOAT_DEV(ShadowMaxDepthLandscape
);
1547 READ_FLOAT_DEV(ShadowMaxDepthInterior
);
1548 READ_FLOAT_DEV(ShadowMaxDepthSmoothSpeed
);
1554 READ_FLOAT_DEV(GroundFXMaxDist
)
1555 READ_INT_DEV(GroundFXMaxNB
)
1556 READ_INT_DEV(GroundFXCacheSize
)
1558 // Names : Get Names state
1563 READ_INT_FV(ProcessPriority
)
1565 READ_INT_FV(CPUMask
)
1566 // ShowPath : Get the ShowPath value.
1567 READ_BOOL_DEV(ShowPath
)
1568 // UserSheet : Get the sheet to used for the use rin Local mode.
1569 READ_STRING_DEV(UserSheet
)
1572 varPtr
= ClientCfg
.ConfigFile
.getVarPtr("Sex");
1574 ClientCfg
.Sex
= (GSGENDER::EGender
)varPtr
->asInt();
1576 cfgWarning("Default value used for 'Sex' !!!");
1577 #endif // FINAL_VERSION
1578 // PrimitiveHeightAddition
1579 READ_BOOL_DEV(PrimitiveHeightAddition
)
1581 READ_BOOL_DEV(DrawBoxes
)
1584 // ChaseReactionTime
1585 READ_FLOAT_DEV(ChaseReactionTime
)
1587 READ_FLOAT_DEV(RyzomTime
)
1589 READ_INT_DEV(RyzomDay
)
1590 // ManualWeatherSetup
1591 READ_BOOL_DEV(ManualWeatherSetup
)
1593 READ_BOOL_DEV(ForceLanguage
)
1594 if (!ClientCfg
.ForceLanguage
)
1596 READ_STRING_FV(LanguageCode
)
1598 // DebugStringManager
1599 READ_BOOL_DEV(DebugStringManager
)
1602 READ_STRING_FV(LastLogin
)
1606 READ_BOOL_DEV(VerboseVP
)
1607 READ_BOOL_DEV(VerboseAnimUser
)
1608 READ_BOOL_DEV(VerboseAnimSelection
)
1609 READ_BOOL_DEV(VerboseAllTraffic
)
1611 READ_STRING_DEV(LigoPrimitiveClass
);
1615 READ_INT_DEV(SimulatePacketLossRatio
)
1616 READ_BOOL_DEV(PreCacheShapes
)
1617 READ_BOOL_FV(ResetShapeBankOnRetCharSelect
)
1618 READ_BOOL_DEV(DisplayMissingAnimFile
)
1619 READ_STRING_DEV(DefaultEntity
)
1620 READ_BOOL_DEV(RestrainPI
)
1621 READ_BOOL_DEV(DumpVSIndex
)
1622 READ_INT_DEV(HelpFontSize
)
1626 CConfigFile::CVar
*cvHelpFontColor
= ClientCfg
.ConfigFile
.getVarPtr("HelpFontColor");
1627 if(cvHelpFontColor
&& cvHelpFontColor
->size() == 3)
1629 ClientCfg
.HelpFontColor
.R
= cvHelpFontColor
->asInt(0);
1630 ClientCfg
.HelpFontColor
.G
= cvHelpFontColor
->asInt(1);
1631 ClientCfg
.HelpFontColor
.B
= cvHelpFontColor
->asInt(2);
1632 ClientCfg
.HelpFontColor
.A
= 255;
1635 cfgWarning("Default value used for 'HelpFontColor' !!!");
1637 #endif // !FINAL_VERSION
1639 READ_FLOAT_DEV(HelpLineStep
)
1641 READ_INT_DEV(DebugFontSize
)
1644 CConfigFile::CVar
*pcvDebugFontColor
= ClientCfg
.ConfigFile
.getVarPtr("DebugFontColor");
1645 if( pcvDebugFontColor
&& (pcvDebugFontColor
->size() == 3) )
1647 ClientCfg
.DebugFontColor
.R
= pcvDebugFontColor
->asInt(0);
1648 ClientCfg
.DebugFontColor
.G
= pcvDebugFontColor
->asInt(1);
1649 ClientCfg
.DebugFontColor
.B
= pcvDebugFontColor
->asInt(2);
1650 ClientCfg
.DebugFontColor
.A
= 255;
1653 cfgWarning("Default value used for 'DebugFontColor'");
1654 #endif // !FINAL_VERSION
1655 READ_FLOAT_DEV(DebugLineStep
)
1658 READ_CVECTOR_DEV(HeadOffset
)
1659 READ_BOOL_DEV(FPExceptions
)
1660 READ_BOOL_DEV(NeedComputeVS
)
1661 READ_BOOL_DEV(Check
)
1662 READ_BOOL_DEV(UsePACSForAll
)
1663 READ_FLOAT_DEV(WaterEnvMapUpdateTime
)
1664 READ_BOOL_DEV(BlendForward
)
1666 ClientCfg
.ZCPacsPrim
= "gen_bt_col_ext.pacs_prim";
1667 READ_STRING_DEV(ZCPacsPrim
)
1669 READ_BOOL_FV(AutoReloadFiles
)
1670 READ_BOOL_DEV(BlendShapePatched
)
1672 READ_INT_DEV(MaxNumberOfTimedFXInstances
);
1674 READ_STRING_DEV(SelectionFX
);
1675 READ_STRING_DEV(MouseOverFX
);
1676 READ_FLOAT_DEV(SelectionFXSize
);
1678 if(ClientCfg
.ConfigFile
.exists("ExtendedCommands") && ClientCfg
.ConfigFile
.getVar("ExtendedCommands").asString() == "Enable")
1679 ClientCfg
.ExtendedCommands
= true;
1682 READ_BOOL_DEV(R2Mode
);
1683 if (ClientCfg
.Local
) // R2EDEnabled is now set by the server
1685 READ_BOOL_DEV(R2EDEnabled
)
1687 READ_INT_FV(R2EDDssNetwork
)
1690 if (ClientCfg
.Local
)
1692 ClientCfg
.R2EDDssNetwork
= 1;
1695 READ_BOOL_DEV(R2EDExtendedDebug
)
1698 CConfigFile::CVar
*var
= ClientCfg
.ConfigFile
.getVarPtr("R2EDExtendedDebug");
1703 // else no-op -> will resolve to 'nil' into lua
1708 READ_BOOL_DEV(R2EDVerboseParseTime
)
1709 READ_BOOL_DEV(R2EDDontReparseUnchangedUIFiles
)
1710 READ_BOOL_DEV(R2EDLightPalette
)
1711 READ_INT_FV(R2EDAutoSaveWait
)
1712 READ_INT_FV(R2EDAutoSaveSlot
)
1713 READ_BOOL_DEV(R2EDMustVerifyRingAccessWhileLoadingAnimation
)
1714 READ_BOOL_FV(R2EDUseVerboseRingAccess
)
1720 // Array with the name of all offensive impact FXs.
1721 READ_STRINGVECTOR_DEV(OffImpactFX
);
1723 #ifndef RZ_NO_CLIENT
1728 #ifdef NL_OS_WINDOWS
1729 if(ClientCfg
.FPExceptions
)
1730 _control87(_EM_DENORMAL
/*|_EM_INVALID|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW
|_EM_INEXACT
, _MCW_EM
);
1732 _control87(_EM_INVALID
|_EM_DENORMAL
|_EM_ZERODIVIDE
|_EM_OVERFLOW
|_EM_UNDERFLOW
|_EM_INEXACT
, _MCW_EM
);
1734 // Set the process priority
1735 static DWORD priority
[6]=
1737 0x40, // IDLE_PRIORITY_CLASS
1738 0x4000, // BELOW_NORMAL_PRIORITY_CLASS
1739 0x20, // NORMAL_PRIORITY_CLASS
1740 0x8000, // ABOVE_NORMAL_PRIORITY_CLASS
1741 0x80, // HIGH_PRIORITY_CLASS
1742 0x100, // REALTIME_PRIORITY_CLASS
1745 int index
= ClientCfg
.ProcessPriority
+2;
1747 SetPriorityClass (GetCurrentProcess(), priority
[index
]);
1748 #endif // NL_OS_WINDOWS
1750 // Init Verbose Modes (at the beginning to be able to display them as soon as possible).
1751 ::VerboseVP
= ClientCfg
.VerboseVP
;
1752 ::VerboseAnimUser
= ClientCfg
.VerboseAnimUser
;
1753 ::VerboseAnimSelection
= ClientCfg
.VerboseAnimSelection
;
1754 #ifdef LOG_ALL_TRAFFIC
1755 NLMISC::VerboseAllTraffic
= ClientCfg
.VerboseAllTraffic
;
1758 // (re-)Initialize contextual cursors.
1759 if (!ClientCfg
.R2EDEnabled
)
1761 initContextualCursor();
1765 READ_STRINGVECTOR_DEV(PrimFiles
);
1767 // Reset GlobalWind Setup
1770 Scene
->setGlobalWindPower(ClientCfg
.GlobalWindPower
);
1771 Scene
->setGlobalWindDirection(ClientCfg
.GlobalWindDirection
);
1776 // Set the monitor color properties
1777 CMonitorColorProperties monitorColor
;
1778 for(uint i
=0; i
<3; i
++)
1780 monitorColor
.Contrast
[i
] = ClientCfg
.Contrast
;
1781 monitorColor
.Luminosity
[i
] = ClientCfg
.Luminosity
;
1782 monitorColor
.Gamma
[i
] = ClientCfg
.Gamma
;
1784 if(!Driver
->setMonitorColorProperties(monitorColor
))
1785 cfgWarning("reloadCFG: setMonitorColorProperties fails");
1789 // Show/hide all or parts of the user body.
1792 UserEntity
->eyesHeight(ClientCfg
.EyesHeight
);
1793 UserEntity
->updateVisualDisplay();
1795 // Run speed and camera dist max are set according to R2 char mode
1796 UserEntity
->flushR2CharMode();
1799 // Initialize the camera distance (after camera dist max)
1800 View
.setCameraDistanceMaxForPlayer();
1802 // draw in client light?
1805 ClientCfg
.DrawBoxes
= true;
1806 ClientCfg
.Names
= true;
1810 if (ClientCfg
.Local
)
1812 uint32 tickOffset
= (uint32
)(ClientCfg
.RyzomDay
* RYZOM_HOURS_IN_TICKS
* 24 + ClientCfg
.RyzomTime
* RYZOM_HOURS_IN_TICKS
);
1813 RT
.resetTickOffset();
1814 RT
.increaseTickOffset( tickOffset
);
1818 // for reset effect of variable in mainLoop(), set true
1819 ClientCfg
.IsInvalidated
= true;
1821 // Allow warning display only first time.
1822 DisplayCFGWarning
= false;
1824 // If it is the load time, backup the ClientCfg into LastClientCfg
1825 if(firstTimeSetValues
)
1826 LastClientCfg
= ClientCfg
;
1829 firstTimeSetValues
= false;
1831 READ_INT_DEV(NumFrameForProfile
);
1832 READ_STRING_FV(KlientChatPort
);
1833 READ_BOOL_DEV(SimulateServerTick
);
1835 READ_BOOL_DEV(DamageShieldEnabled
)
1837 READ_BOOL_FV(AllowDebugLua
)
1838 READ_BOOL_FV(DisplayLuaDebugInfo
)
1840 READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled
)
1841 READ_STRING_DEV(LuaDebugInfoGotoButtonTemplate
)
1842 READ_STRING_DEV(LuaDebugInfoGotoButtonCaption
)
1843 READ_STRING_DEV(LuaDebugInfoGotoButtonFunction
)
1846 READ_BOOL_DEV(BeepWhenLaunched
)
1848 READ_STRING_DEV(R2ClientGw
)
1850 READ_FLOAT_FV(FogDistAndDepthLookupBias
)
1852 READ_INT_DEV(R2EDLoadDynamicFeatures
)
1854 READ_BOOL_DEV(CheckR2ScenarioMD5
);
1856 CConfigFile::CVar
*pcvHardwareCursors
= ClientCfg
.ConfigFile
.getVarPtr("HardwareCursors");
1857 if(pcvHardwareCursors
)
1859 ClientCfg
.HardwareCursors
.clear ();
1860 int iSz
= pcvHardwareCursors
->size();
1861 for (int i
= 0; i
< iSz
; i
++)
1862 ClientCfg
.HardwareCursors
.insert(toLowerAscii(pcvHardwareCursors
->asString(i
)));
1866 cfgWarning("Default value used for 'HardwareCursors'");
1867 // default list of harware cursors
1868 ClientCfg
.HardwareCursors
.insert("curs_can_pan.tga");
1869 ClientCfg
.HardwareCursors
.insert("curs_can_pan_dup.tga");
1870 ClientCfg
.HardwareCursors
.insert("curs_create.tga");
1871 ClientCfg
.HardwareCursors
.insert("curs_create_multi.tga");
1872 ClientCfg
.HardwareCursors
.insert("curs_create_vertex_invalid.tga");
1873 ClientCfg
.HardwareCursors
.insert("curs_default.tga");
1874 ClientCfg
.HardwareCursors
.insert("curs_dup.tga");
1875 ClientCfg
.HardwareCursors
.insert("curs_L.tga");
1876 ClientCfg
.HardwareCursors
.insert("curs_M.tga");
1877 ClientCfg
.HardwareCursors
.insert("curs_pan.tga");
1878 ClientCfg
.HardwareCursors
.insert("curs_pan_dup.tga");
1879 ClientCfg
.HardwareCursors
.insert("curs_pick.tga");
1880 ClientCfg
.HardwareCursors
.insert("curs_pick_dup.tga");
1881 ClientCfg
.HardwareCursors
.insert("curs_R.tga");
1882 ClientCfg
.HardwareCursors
.insert("curs_resize_BL_TR.tga");
1883 ClientCfg
.HardwareCursors
.insert("curs_resize_BR_TL.tga");
1884 ClientCfg
.HardwareCursors
.insert("curs_resize_LR.tga");
1885 ClientCfg
.HardwareCursors
.insert("curs_resize_TB.tga");
1886 ClientCfg
.HardwareCursors
.insert("curs_rotate.tga");
1887 ClientCfg
.HardwareCursors
.insert("curs_scale.tga");
1888 ClientCfg
.HardwareCursors
.insert("curs_stop.tga");
1889 ClientCfg
.HardwareCursors
.insert("text_cursor.tga");
1890 ClientCfg
.HardwareCursors
.insert("r2_hand_can_pan.tga");
1891 ClientCfg
.HardwareCursors
.insert("r2_hand_pan.tga");
1892 ClientCfg
.HardwareCursors
.insert("r2ed_tool_can_pick.tga");
1893 ClientCfg
.HardwareCursors
.insert("r2ed_tool_can_rotate.tga");
1894 ClientCfg
.HardwareCursors
.insert("r2ed_tool_pick.tga");
1895 ClientCfg
.HardwareCursors
.insert("r2ed_tool_rotate.tga");
1896 ClientCfg
.HardwareCursors
.insert("r2ed_tool_rotating.tga");
1899 // languages and types of Ring Scenarii
1900 READ_STRINGVECTOR_FV(ScenarioLanguages
);
1901 READ_STRINGVECTOR_FV(ScenarioTypes
);
1904 READ_STRING_FV(BuildName
)
1906 READ_BOOL_DEV(DisplayTPReason
)
1908 //READ_INT_FV(TPQuitButtonX)
1909 //READ_INT_FV(TPQuitButtonY)
1910 //READ_INT_FV(TPCancelButtonX)
1911 //READ_INT_FV(TPCancelButtonY)
1912 READ_INT_FV(TPButtonW
)
1913 READ_INT_FV(TPButtonH
)
1915 READ_STRING_FV(ScenarioSavePath
)
1918 ClientCfg
.R2EDClippedEntityBlendTime
= 0.18f
;
1919 READ_FLOAT_FV(R2EDClippedEntityBlendTime
)
1921 // vl: BackgroundDownloader is hardcoded to false and we don't want to run it, even if the cfg wants it
1922 //READ_BOOL_FV(BackgroundDownloader)
1927 //-----------------------------------------------
1930 //-----------------------------------------------
1931 void CClientConfig::serial(NLMISC::IStream
&f
)
1933 // Start the opening of a new node named ClientCFG.
1934 f
.xmlPush("ClientCFG");
1936 f
.xmlPushBegin("Light");
1941 f
.xmlPushBegin("Windowed");
1946 f
.xmlPushBegin("Width");
1951 f
.xmlPushBegin("Height");
1956 f
.xmlPushBegin("Depth");
1961 f
.xmlPushBegin("Contrast");
1966 f
.xmlPushBegin("Luminosity");
1968 f
.serial(Luminosity
);
1971 f
.xmlPushBegin("Gamma");
1977 f
.xmlPushBegin("AttackDist");
1979 f
.serial(AttackDist
);
1983 f
.xmlPushBegin("SelectWithRClick");
1985 f
.serial(SelectWithRClick
);
1988 // Close the serial for the Client CFG.
1993 //-----------------------------------------------
1995 //-----------------------------------------------
1996 void CClientConfig::init(const string
&configFileName
)
1998 // if the users client config does not exist
1999 if(!CFile::fileExists(configFileName
))
2001 // create the basic .cfg
2002 FILE *fp
= nlfopen(configFileName
, "w");
2005 nlerror("CFG::init: Can't create config file '%s'", configFileName
.c_str());
2007 nlwarning("CFG::init: creating '%s' with default values", configFileName
.c_str ());
2009 // get current locale
2010 std::string lang
= CI18N::getSystemLanguageCode();
2012 const std::vector
<std::string
> &languages
= CI18N::getLanguageCodes();
2014 // search if current locale is defined in language codes
2015 for(uint i
= 0; i
< languages
.size(); ++i
)
2017 if (lang
== languages
[i
])
2019 // store the language code in the config file
2020 fprintf(fp
, "LanguageCode = \"%s\";\n", lang
.c_str());
2028 // read the exising config file (don't parse it yet!)
2029 ucstring content
; // UTF-16 and UTF-8 textfile support
2030 NLMISC::CI18N::readTextFile(configFileName
, content
);
2031 std::string contentUtf8
= content
.toUtf8();
2033 // while there are "RootConfigFilename" values, remove them
2035 while((pos
= contentUtf8
.find("RootConfigFilename")) != configFileName
.npos
)
2037 size_t endOfLine
= contentUtf8
.find("\n", pos
);
2038 contentUtf8
.erase(pos
, (endOfLine
- pos
) + 1);
2041 // get current location of the root config file (client_default.cfg)
2042 std::string defaultConfigLocation
;
2043 if(!getDefaultConfigLocation(defaultConfigLocation
))
2044 nlerror("cannot find client_default.cfg");
2046 // and store it in the RootConfigFilename value in the very first line
2047 contentUtf8
.insert(0, std::string("RootConfigFilename = \"") +
2048 defaultConfigLocation
+ "\";\n");
2050 // save the updated config file
2051 NLMISC::COFile
configFile(configFileName
, false, true, false);
2052 configFile
.serialBuffer((uint8
*)contentUtf8
.c_str(), (uint
)contentUtf8
.size());
2055 // now we can continue loading and parsing the config file
2057 // if the config file will be modified, it calls automatically the function setValuesOnFileChange()
2058 ClientCfg
.ConfigFile
.setCallback (CClientConfig::setValuesOnFileChange
);
2060 // load the config files
2061 ClientCfg
.ConfigFile
.load (configFileName
);
2063 CConfigFile::CVar
*pCV
;
2064 // check language code is supported
2065 pCV
= ClientCfg
.ConfigFile
.getVarPtr("LanguageCode");
2068 std::string lang
= pCV
->asString();
2069 if (!CI18N::isLanguageCodeSupported(lang
))
2071 nlinfo("Unsupported language code \"%s\" fallback on default", lang
.c_str());
2072 // fallback to default language
2073 ClientCfg
.LanguageCode
= CI18N::getSystemLanguageCode();
2074 // update ConfigFile variable
2075 pCV
->setAsString(ClientCfg
.LanguageCode
);
2076 ClientCfg
.ConfigFile
.save();
2080 // update the ConfigFile variable in the config file
2081 pCV
= ClientCfg
.ConfigFile
.getVarPtr("ClientVersion");
2084 std::string str
= pCV
->asString ();
2085 if (str
!= getVersion() && ClientCfg
.SaveConfig
)
2087 nlinfo ("Update and save the ClientVersion variable in config file %s -> %s", str
.c_str(), getVersion().c_str());
2088 pCV
->setAsString(getVersion());
2089 ClientCfg
.ConfigFile
.save();
2093 nlwarning ("There's no ClientVersion variable in the config file!");
2098 //-----------------------------------------------
2100 //-----------------------------------------------
2101 void CClientConfig::release ()
2103 #ifndef RZ_NO_CLIENT
2104 // Do we have to save the cfg file ?
2105 if (ClientCfg
.SaveConfig
)
2110 CConfigFile::CVar
*varPtr
= NULL
;
2112 // Driver still alive ?
2113 if (Driver
&& Driver
->isActive ())
2116 uint32 width
, height
;
2118 Driver
->getWindowPos(x
, y
);
2119 Driver
->getWindowSize(width
, height
);
2121 // Are we in window mode ?
2122 if (ClientCfg
.Windowed
/* && !isWindowMaximized() */)
2124 // Save windows position. width/height are saved when leaving ingame.
2125 writeInt("PositionX", x
);
2126 writeInt("PositionY", y
);
2130 // Save if in FPV or TPV.
2131 writeBool("FPV", ClientCfg
.FPV
);
2133 // Save the camera distance
2134 writeDouble("CameraDistance", ClientCfg
.CameraDistance
);
2136 catch (const Exception
&e
)
2138 nlwarning ("Error while set config file variables : %s", e
.what ());
2142 ClientCfg
.ConfigFile
.save ();
2147 bool CClientConfig::readBool (const std::string
&varName
)
2150 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2152 bVal
= varPtr
->asInt() ? true : false;
2154 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2158 void CClientConfig::writeBool (const std::string
&varName
, bool bVal
, bool bForce
)
2160 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2162 varPtr
->forceAsInt(bVal
? 1:0);
2164 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2167 sint32
CClientConfig::readInt (const std::string
&varName
)
2170 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2172 bVal
= varPtr
->asInt();
2174 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2178 void CClientConfig::writeInt (const std::string
&varName
, sint32 bVal
, bool bForce
)
2180 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2182 varPtr
->forceAsInt(bVal
);
2184 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2187 double CClientConfig::readDouble (const std::string
&varName
)
2190 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2192 bVal
= varPtr
->asDouble();
2194 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2198 void CClientConfig::writeDouble (const std::string
&varName
, double dVal
, bool bForce
)
2200 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2202 varPtr
->forceAsDouble(dVal
);
2204 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2207 string
CClientConfig::readString (const std::string
&varName
)
2210 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2212 sVal
= varPtr
->asString();
2214 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2218 void CClientConfig::writeString (const std::string
&varName
, const std::string
&strVal
, bool bForce
)
2220 CConfigFile::CVar
*varPtr
= bForce
? ConfigFile
.insertVar(varName
, CConfigFile::CVar()):ConfigFile
.getVarPtr(varName
);
2222 varPtr
->forceAsString(strVal
);
2224 nlwarning("CFG: Default value used for '%s' !!!",varName
.c_str());
2227 // ***************************************************************************
2228 bool CClientConfig::readBoolNoWarning(const std::string
&varName
)
2231 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2233 bVal
= varPtr
->asInt() ? true : false;
2237 sint32
CClientConfig::readIntNoWarning(const std::string
&varName
)
2240 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2242 bVal
= varPtr
->asInt();
2246 double CClientConfig::readDoubleNoWarning(const std::string
&varName
)
2249 CConfigFile::CVar
*varPtr
= ConfigFile
.getVarPtr(varName
);
2251 bVal
= varPtr
->asDouble();
2255 // ***************************************************************************
2256 float CClientConfig::getActualLandscapeThreshold() const
2258 // The threshold to set in landscape is the inverse of the CFG one
2259 return 1.0f
/LandscapeThreshold
;
2262 // ***************************************************************************
2263 string
CClientConfig::getHtmlLanguageCode() const
2265 if(LanguageCode
=="wk")
2268 return LanguageCode
;
2271 // ***************************************************************************
2272 string
CClientConfig::buildLoadingString( const string
& ucstr
) const
2274 if( LoadingStringCount
> 0 )
2276 uint index
= rand()%LoadingStringCount
;
2277 string tipId
= "uiLoadingString" + toString(index
);
2278 return CI18N::get(tipId
);
2284 // ***************************************************************************
2285 bool CClientConfig::getDefaultConfigLocation(std::string
& p_name
) const
2287 std::string defaultConfigFileName
= "client_default.cfg";
2288 std::string defaultConfigPath
;
2293 // on mac, client_default.cfg should be searched in .app/Contents/Resources/
2294 defaultConfigPath
= getAppBundlePath() + "/Contents/Resources/";
2296 // unders Windows or Linux, search client_default.cfg is same directory as executable
2297 defaultConfigPath
= Args
.getProgramPath();
2300 std::string currentPath
= CPath::standardizePath(CPath::getCurrentPath());
2301 std::string etcPath
= CPath::standardizePath(getRyzomEtcPrefix());
2303 // look in the current working directory first
2304 if (CFile::isExists(currentPath
+ defaultConfigFileName
))
2305 p_name
= currentPath
+ defaultConfigFileName
;
2307 // look in startup directory
2308 else if (CFile::isExists(Args
.getStartupPath() + defaultConfigFileName
))
2309 p_name
= Args
.getStartupPath() + defaultConfigFileName
;
2311 // look in application directory
2312 else if (CFile::isExists(defaultConfigPath
+ defaultConfigFileName
))
2313 p_name
= defaultConfigPath
+ defaultConfigFileName
;
2315 // look in etc prefix path
2316 else if (!etcPath
.empty() && CFile::isExists(etcPath
+ defaultConfigFileName
))
2317 p_name
= etcPath
+ defaultConfigFileName
;
2319 // if some client_default.cfg was found return true
2320 return !p_name
.empty();