1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
21 g_language
, g_weapons
;
23 function GenPlayerName (n
: Integer): String;
25 procedure g_Options_SetDefault();
26 procedure g_Options_Read(FileName
: String);
27 procedure g_Options_Write(FileName
: String);
28 procedure g_Options_Write_Language(FileName
: String);
29 procedure g_Options_Write_Video(FileName
: String);
30 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
31 procedure g_Options_Write_Gameplay_Net(FileName
: String);
32 procedure g_Options_Write_Net_Server(FileName
: String);
33 procedure g_Options_Write_Net_Client(FileName
: String);
35 const DF_Default_Megawad_Start
= 'megawads/DOOM2D.WAD:\MAP01';
38 // gGameControls: TControls;
41 gWinRealPosX
: Integer;
42 gWinRealPosY
: Integer;
46 gWinMaximized
: Boolean;
48 glLegacyNPOT
: Boolean;
49 gTextureFilter
: Boolean;
54 gMuteWhenInactive
: Boolean;
61 gDrawBackGround
: Boolean;
62 gShowMessages
: Boolean;
63 gRevertPlayers
: Boolean;
65 gAskLanguage
: Boolean;
72 gcTeamDamage
: Boolean;
74 gcWeaponStay
: Boolean;
83 gnTeamDamage
: Boolean;
85 gnWeaponStay
: Boolean;
88 gsSDLSampleRate
: Integer;
89 gsSDLBufferSize
: Integer;
91 gSFSFastMode
: Boolean;
92 gDefaultMegawadStart
: AnsiString
;
93 gBerserkAutoswitch
: Boolean;
98 {$INCLUDE ../nogl/noGLuses.inc}
99 e_log
, e_input
, g_console
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
100 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
101 g_items
, wadreader
, e_graphics
, g_touch
, SDL2
, envvars
;
106 function GenPlayerName (n
: Integer): String;
109 Result
:= GetUserName
;
111 Result
:= 'Player' + IntToStr(machine
MOD 10000);
113 Result
:= Copy(Result
, 1, 12) + ' '
115 Result
:= Copy(Result
, 1, 10) + ' ' + IntToStr(n
)
118 procedure g_Options_SetDefaultVideo
;
120 target
, closest
, display
: TSDL_DisplayMode
;
123 (* Display 0 = Primary display *)
124 SDL_GetDesktopDisplayMode(0, @display
);
125 {$IF DEFINED(ANDROID)}
126 gScreenWidth
:= display
.w
;
127 gScreenHeight
:= display
.h
;
128 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
130 gFullScreen
:= True; (* rotation not allowed? *)
132 (* Window must be smaller than display *)
133 closest
.w
:= display
.w
;
134 closest
.h
:= display
.h
;
136 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
138 if percentage
< 25 then
140 closest
.w
:= display
.w
* 75 div 100;
141 closest
.h
:= display
.h
* 75 div 100;
144 target
.w
:= display
.w
* percentage
div 100;
145 target
.h
:= display
.h
* percentage
div 100;
146 target
.format
:= 0; (* didn't care *)
147 target
.refresh_rate
:= 0; (* didn't care *)
148 target
.driverdata
:= nil; (* init *)
149 SDL_GetClosestDisplayMode(0, @target
, @closest
);
152 gScreenWidth
:= closest
.w
;
153 gScreenHeight
:= closest
.h
;
154 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
156 gFullScreen
:= False;
158 (* Must be positioned on primary display *)
159 gWinRealPosX
:= SDL_WINDOWPOS_CENTERED
;
160 gWinRealPosY
:= SDL_WINDOWPOS_CENTERED
;
161 gWinMaximized
:= False;
163 gTextureFilter
:= True;
164 glLegacyNPOT
:= False;
165 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
166 g_Console_ResetBinds
;
169 procedure g_Options_SetDefault();
178 gMuteWhenInactive
:= False;
179 gAnnouncer
:= ANNOUNCE_MEPLUS
;
180 gSoundEffectsDF
:= True;
181 gUseChatSounds
:= True;
182 gsSDLSampleRate
:= 44100;
183 gsSDLBufferSize
:= 2048;
185 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
187 with gPlayer1Settings
do
189 Name
:= GenPlayerName(1);
190 Model
:= STD_PLAYER_MODEL
;
191 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
192 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
193 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
197 with gPlayer2Settings
do
199 Name
:= GenPlayerName(2);
200 Model
:= STD_PLAYER_MODEL
;
201 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
202 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
203 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
207 (* section Joysticks *)
208 for i
:= 0 to e_MaxJoys
- 1 do
210 e_JoystickDeadzones
[i
] := 8192
215 g_Shells_SetMax(300);
217 g_Corpses_SetMax(20);
219 ITEM_RESPAWNTIME
:= 60 * 36;
225 gDrawBackGround
:= True;
226 gShowMessages
:= True;
227 gRevertPlayers
:= False;
229 gPlayerIndicator
:= 1;
231 gSFSFastMode
:= False;
232 e_FastScreenshots
:= True;
233 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
234 gBerserkAutoswitch
:= True;
237 gAskLanguage
:= True;
238 gLanguage
:= LANGUAGE_ENGLISH
;
240 (* section GameplayCustom *)
242 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
247 gcTeamDamage
:= False;
249 gcWeaponStay
:= False;
251 gcBotsVS
:= 'Everybody';
253 (* section GameplayNetwork *)
255 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
260 gnTeamDamage
:= False;
262 gnWeaponStay
:= False;
264 gnBotsVS
:= 'Everybody';
266 (* section MasterServer *)
267 NetSlistIP
:= 'mpms.doom2d.org';
268 NetSlistPort
:= 25665;
269 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
272 NetServerName
:= 'Unnamed Server';
276 NetAllowRCON
:= False;
277 NetRCONPassword
:= 'default';
278 NetUseMaster
:= True;
281 NetMasterRate
:= 60000;
282 NetForwardPorts
:= False;
286 NetForcePlayerUpdate
:= False;
287 NetPredictSelf
:= True;
288 NetClientIP
:= '127.0.0.1';
289 NetClientPort
:= NetPort
;
292 procedure g_Options_Read(FileName
: String);
298 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
300 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
303 procedure ReadInteger (VAR v
: LongWord
; param
: String; minv
: LongWord
= Low(LongWord
); maxv
: LongWord
= High(LongWord
)); overload
;
305 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
308 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
310 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
313 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
315 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
318 procedure ReadBoolean (VAR v
: Boolean; param
: String);
320 v
:= config
.ReadBool(section
, param
, v
)
323 procedure ReadString (VAR v
: String; param
: String);
325 v
:= config
.ReadStr(section
, param
, v
)
329 gAskLanguage
:= True;
330 e_WriteLog('Reading config', TMsgType
.Notify
);
331 g_Options_SetDefault
;
333 if FileExists(FileName
) = False then
335 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
336 g_Options_SetDefaultVideo
;
340 config
:= TConfig
.CreateFile(FileName
);
343 ReadInteger(gScreenWidth
, 'ScreenWidth', 0);
344 ReadInteger(gScreenHeight
, 'ScreenHeight', 0);
345 ReadInteger(gWinRealPosX
, 'WinPosX', 60);
346 ReadInteger(gWinRealPosY
, 'WinPosY', 60);
347 ReadBoolean(gFullScreen
, 'Fullscreen');
348 ReadBoolean(gWinMaximized
, 'Maximized');
349 ReadInteger(gBPP
, 'BPP', 0);
350 ReadInteger(gFreq
, 'Freq', 0);
351 ReadBoolean(gVSync
, 'VSync');
352 ReadBoolean(gTextureFilter
, 'TextureFilter');
353 ReadBoolean(glLegacyNPOT
, 'LegacyCompatible');
356 ReadBoolean(gNoSound
, 'NoSound');
357 ReadInteger(gSoundLevel
, 'SoundLevel', 0, 255);
358 ReadInteger(gMusicLevel
, 'MusicLevel', 0, 255);
359 ReadInteger(gMaxSimSounds
, 'MaxSimSounds', 2, 66);
360 ReadBoolean(gMuteWhenInactive
, 'MuteInactive');
361 ReadInteger(gAnnouncer
, 'Announcer', ANNOUNCE_NONE
, ANNOUNCE_ALL
);
362 ReadBoolean(gSoundEffectsDF
, 'SoundEffectsDF');
363 ReadBoolean(gUseChatSounds
, 'ChatSounds');
364 ReadInteger(gsSDLSampleRate
, 'SDLSampleRate', 11025, 96000);
365 ReadInteger(gsSDLBufferSize
, 'SDLBufferSize', 64, 16384);
367 section
:= 'Player1';
368 with gPlayer1Settings
do
370 ReadString(Name
, 'name');
371 ReadString(Model
, 'model');
372 ReadInteger(Color
.R
, 'red', 0, 255);
373 ReadInteger(Color
.G
, 'green', 0, 255);
374 ReadInteger(Color
.B
, 'blue', 0, 255);
375 ReadInteger(Team
, 'team');
376 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
380 section
:= 'Player2';
381 with gPlayer2Settings
do
383 ReadString(Name
, 'name');
384 ReadString(Model
, 'model');
385 ReadInteger(Color
.R
, 'red', 0, 255);
386 ReadInteger(Color
.G
, 'green', 0, 255);
387 ReadInteger(Color
.B
, 'blue', 0, 255);
388 ReadInteger(Team
, 'team');
389 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
393 section
:= 'Joysticks';
394 for i
:= 0 to e_MaxJoys
- 1 do
396 ReadInteger(e_JoystickDeadzones
[i
], 'Deadzone' + IntToStr(i
))
400 ReadInteger(i
, 'MaxParticles', 0, 50000); g_GFX_SetMax(i
);
401 ReadInteger(i
, 'MaxShells', 0, 600); g_Shells_SetMax(i
);
402 ReadInteger(i
, 'MaxGibs', 0, 500); g_Gibs_SetMax(i
);
403 ReadInteger(i
, 'MaxCorpses', 0, 100); g_Corpses_SetMax(i
);
404 ReadInteger(i
, 'GibsCount');
410 else gGibsCount
:= 48;
412 i
:= ITEM_RESPAWNTIME
div 36; ReadInteger(i
, 'ItemRespawnTime', 0); ITEM_RESPAWNTIME
:= i
* 36;
413 ReadInteger(gBloodCount
, 'BloodCount', 0, 4);
414 ReadBoolean(gAdvBlood
, 'AdvancesBlood');
415 ReadBoolean(gAdvCorpses
, 'AdvancesCorpses');
416 ReadBoolean(gAdvGibs
, 'AdvancesGibs');
417 ReadInteger(gFlash
, 'Flash', 0, 2);
418 ReadBoolean(gDrawBackGround
, 'BackGround');
419 ReadBoolean(gShowMessages
, 'Messages');
420 ReadBoolean(gRevertPlayers
, 'RevertPlayers');
421 ReadInteger(gChatBubble
, 'ChatBubble', 0, 4);
422 ReadInteger(gPlayerIndicator
, 'PlayerIndicator', 0, 2);
423 ReadBoolean(gSFSDebug
, 'SFSDebug'); wadoptDebug
:= gSFSDebug
;
424 ReadBoolean(gSFSFastMode
, 'SFSFastMode'); wadoptFast
:= gSFSFastMode
;
425 ReadBoolean(e_FastScreenshots
, 'FastScreenshots');
426 ReadString(gDefaultMegawadStart
, 'DefaultMegawadStart');
427 ReadBoolean(gBerserkAutoswitch
, 'BerserkAutoswitching');
428 i
:= Trunc(g_dbg_scale
* 100); ReadInteger(i
, 'Scale', 100); g_dbg_scale
:= i
/ 100;
429 ReadString(gLanguage
, 'Language');
430 if (gLanguage
= LANGUAGE_RUSSIAN
) or (gLanguage
= LANGUAGE_ENGLISH
) then
431 gAskLanguage
:= False
433 gLanguage
:= LANGUAGE_ENGLISH
;
435 section
:= 'GameplayCustom';
436 ReadString(gcMap
, 'Map');
437 ReadString(gcGameMode
, 'GameMode');
438 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
439 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
440 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
441 ReadInteger(gcPlayers
, 'Players', 0, 2);
442 ReadBoolean(gcTeamDamage
, 'TeamDamage');
443 ReadBoolean(gcAllowExit
, 'AllowExit');
444 ReadBoolean(gcWeaponStay
, 'WeaponStay');
445 ReadBoolean(gcMonsters
, 'Monsters');
446 ReadString(gcBotsVS
, 'BotsVS');
448 with gGameSettings
do
450 GameMode
:= g_Game_TextToMode(gcGameMode
);
451 if GameMode
= GM_NONE
then
453 if GameMode
= GM_SINGLE
then
455 TimeLimit
:= gcTimeLimit
;
456 GoalLimit
:= gcGoalLimit
;
457 MaxLives
:= gcMaxLives
;
461 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
463 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
465 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
467 Options
:= Options
or GAME_OPTION_MONSTERS
;
468 if gcBotsVS
= 'Everybody' then
469 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
470 if gcBotsVS
= 'Players' then
471 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
472 if gcBotsVS
= 'Monsters' then
473 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
476 section
:= 'GameplayNetwork';
477 ReadString(gnMap
, 'Map');
478 ReadString(gnGameMode
, 'GameMode');
479 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
480 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
481 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
482 ReadInteger(gnPlayers
, 'Players', 0, 2);
483 ReadBoolean(gnTeamDamage
, 'TeamDamage');
484 ReadBoolean(gnAllowExit
, 'AllowExit');
485 ReadBoolean(gnWeaponStay
, 'WeaponStay');
486 ReadBoolean(gnMonsters
, 'Monsters');
487 ReadString(gnBotsVS
, 'BotsVS');
489 section
:= 'MasterServer';
490 ReadString(NetSlistIP
, 'IP');
491 ReadInteger(NetSlistPort
, 'Port', 0, 65535);
492 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
495 ReadString(NetServerName
, 'Name');
496 ReadString(NetPassword
, 'Password');
497 ReadInteger(NetPort
, 'Port', 0, 65535);
498 ReadInteger(NetMaxClients
, 'MaxClients', 0, NET_MAXCLIENTS
);
499 ReadBoolean(NetAllowRCON
, 'RCON');
500 ReadString(NetRCONPassword
, 'RCONPassword');
501 ReadBoolean(NetUseMaster
, 'SyncWithMaster');
502 ReadInteger(NetUpdateRate
, 'UpdateInterval', 0);
503 ReadInteger(NetRelupdRate
, 'ReliableUpdateInterval', 0);
504 ReadInteger(NetMasterRate
, 'MasterSyncInterval', 1);
505 ReadBoolean(NetForwardPorts
, 'ForwardPorts');
508 ReadInteger(NetInterpLevel
, 'InterpolationSteps', 0);
509 ReadBoolean(NetForcePlayerUpdate
, 'ForcePlayerUpdate');
510 ReadBoolean(NetPredictSelf
, 'PredictSelf');
511 ReadString(NetClientIP
, 'LastIP');
512 ReadInteger(NetClientPort
, 'LastPort', 0, 65535);
516 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
519 procedure g_Options_Write(FileName
: String);
524 e_WriteLog('Writing config', TMsgType
.Notify
);
526 config
:= TConfig
.CreateFile(FileName
);
528 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
529 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
530 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
531 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
532 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
533 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
534 config
.WriteInt('Video', 'BPP', gBPP
);
535 config
.WriteBool('Video', 'VSync', gVSync
);
536 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
537 config
.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT
);
539 config
.WriteBool('Sound', 'NoSound', gNoSound
);
540 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
541 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
542 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
543 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
544 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
545 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
546 config
.WriteBool('Sound', 'ChatSounds', gUseChatSounds
);
547 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
548 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
550 with config
, gPlayer1Settings
do
552 WriteStr('Player1', 'Name', Name
);
553 WriteStr('Player1', 'model', Model
);
554 WriteInt('Player1', 'red', Color
.R
);
555 WriteInt('Player1', 'green', Color
.G
);
556 WriteInt('Player1', 'blue', Color
.B
);
557 WriteInt('Player1', 'team', Team
);
560 with config
, gPlayer2Settings
do
562 WriteStr('Player2', 'Name', Name
);
563 WriteStr('Player2', 'model', Model
);
564 WriteInt('Player2', 'red', Color
.R
);
565 WriteInt('Player2', 'green', Color
.G
);
566 WriteInt('Player2', 'blue', Color
.B
);
567 WriteInt('Player2', 'team', Team
);
570 for i
:= 0 to e_MaxJoys
-1 do
571 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
575 0: config
.WriteInt('Game', 'GibsCount', 0);
576 8: config
.WriteInt('Game', 'GibsCount', 1);
577 16: config
.WriteInt('Game', 'GibsCount', 2);
578 32: config
.WriteInt('Game', 'GibsCount', 3);
579 else config
.WriteInt('Game', 'GibsCount', 4);
582 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
583 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
584 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
585 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
586 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
587 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
588 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
589 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
590 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
591 config
.WriteInt('Game', 'Flash', gFlash
);
592 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
593 config
.WriteBool('Game', 'Messages', gShowMessages
);
594 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
595 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
596 config
.WriteInt('Game', 'PlayerIndicator', gPlayerIndicator
);
597 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
598 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
599 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
600 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
601 config
.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch
);
602 config
.WriteInt('Game', 'Scale', Round(g_dbg_scale
* 100));
604 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
605 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
606 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
607 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
608 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
609 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
610 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
611 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
612 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
613 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
614 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
616 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
617 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
618 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
619 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
620 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
621 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
622 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
623 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
624 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
625 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
626 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
628 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
629 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
631 config
.WriteStr ('Server', 'Name', NetServerName
);
632 config
.WriteStr ('Server', 'Password', NetPassword
);
633 config
.WriteInt ('Server', 'Port', NetPort
);
634 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
635 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
636 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
637 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
638 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
639 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
640 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
641 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
643 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
644 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
645 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
646 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
647 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
649 config
.SaveFile(FileName
);
653 procedure g_Options_Write_Language(FileName
: String);
657 e_WriteLog('Writing language config', TMsgType
.Notify
);
659 config
:= TConfig
.CreateFile(FileName
);
660 config
.WriteStr('Game', 'Language', gLanguage
);
661 config
.SaveFile(FileName
);
665 procedure g_Options_Write_Video(FileName
: String);
670 e_WriteLog('Writing resolution to config', TMsgType
.Notify
);
672 config
:= TConfig
.CreateFile(FileName
);
674 if gWinMaximized
and (not gFullscreen
) then
684 e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX
, gWinSizeY
, gScreenWidth
, gScreenHeight
]);
686 config
.WriteInt('Video', 'ScreenWidth', sW
);
687 config
.WriteInt('Video', 'ScreenHeight', sH
);
688 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
689 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
690 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
691 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
693 config
.WriteStr('Player1', 'Name', gPlayer1Settings
.Name
);
694 config
.WriteStr('Player2', 'Name', gPlayer2Settings
.Name
);
696 config
.SaveFile(FileName
);
700 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
704 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
706 config
:= TConfig
.CreateFile(FileName
);
708 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
709 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
710 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
711 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
712 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
713 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
714 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
715 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
716 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
717 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
718 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
720 config
.SaveFile(FileName
);
724 procedure g_Options_Write_Gameplay_Net(FileName
: String);
728 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
730 config
:= TConfig
.CreateFile(FileName
);
732 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
733 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
734 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
735 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
736 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
737 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
738 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
739 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
740 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
741 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
742 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
744 config
.SaveFile(FileName
);
748 procedure g_Options_Write_Net_Server(FileName
: String);
752 e_WriteLog('Writing server config', TMsgType
.Notify
);
754 config
:= TConfig
.CreateFile(FileName
);
756 config
.WriteStr ('Server', 'Name', NetServerName
);
757 config
.WriteStr ('Server', 'Password', NetPassword
);
758 config
.WriteInt ('Server', 'Port', NetPort
);
759 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
760 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
761 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
763 config
.SaveFile(FileName
);
767 procedure g_Options_Write_Net_Client(FileName
: String);
771 e_WriteLog('Writing client config', TMsgType
.Notify
);
773 config
:= TConfig
.CreateFile(FileName
);
775 config
.WriteStr('Client', 'LastIP', NetClientIP
);
776 config
.WriteInt('Client', 'LastPort', NetClientPort
);
778 config
.SaveFile(FileName
);
784 machine
:= Random(10000)