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}
102 e_log
, e_input
, g_console
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
103 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
104 g_items
, wadreader
, e_graphics
, g_touch
, envvars
;
109 function GenPlayerName (n
: Integer): String;
112 Result
:= GetUserName
;
114 Result
:= 'Player' + IntToStr(machine
MOD 10000);
116 Result
:= Copy(Result
, 1, 12) + ' '
118 Result
:= Copy(Result
, 1, 10) + ' ' + IntToStr(n
)
122 procedure g_Options_SetDefaultVideo
;
124 target
, closest
, display
: TSDL_DisplayMode
;
127 (* Display 0 = Primary display *)
129 gScreenHeight
:= 480;
130 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
133 gFullScreen
:= True; (* rotation not allowed? *)
135 gFullScreen
:= False;
137 if SDL_GetDesktopDisplayMode(0, @display
) = 0 then
140 gScreenWidth
:= display
.w
;
141 gScreenHeight
:= display
.h
;
143 (* Window must be smaller than display *)
144 closest
.w
:= display
.w
;
145 closest
.h
:= display
.h
;
147 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
149 if percentage
< 25 then
151 closest
.w
:= display
.w
* 75 div 100;
152 closest
.h
:= display
.h
* 75 div 100;
155 target
.w
:= display
.w
* percentage
div 100;
156 target
.h
:= display
.h
* percentage
div 100;
157 target
.format
:= 0; (* didn't care *)
158 target
.refresh_rate
:= 0; (* didn't care *)
159 target
.driverdata
:= nil; (* init *)
160 SDL_GetClosestDisplayMode(0, @target
, @closest
);
163 gScreenWidth
:= closest
.w
;
164 gScreenHeight
:= closest
.h
;
165 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
170 e_LogWritefln('SDL: Failed to get desktop display mode: %s', [SDL_GetError
])
172 (* Must be positioned on primary display *)
173 gWinRealPosX
:= SDL_WINDOWPOS_CENTERED
;
174 gWinRealPosY
:= SDL_WINDOWPOS_CENTERED
;
175 gWinMaximized
:= False;
177 gTextureFilter
:= True;
178 glLegacyNPOT
:= False;
179 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
180 g_Console_ResetBinds
;
183 procedure g_Options_SetDefaultVideo
;
186 gScreenHeight
:= 480;
188 gFullScreen
:= False;
191 gWinMaximized
:= False;
193 gTextureFilter
:= True;
194 glLegacyNPOT
:= False;
195 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
196 g_Console_ResetBinds
;
200 procedure g_Options_SetDefault();
209 gMuteWhenInactive
:= False;
210 gAnnouncer
:= ANNOUNCE_MEPLUS
;
211 gSoundEffectsDF
:= True;
212 gUseChatSounds
:= True;
213 gsSDLSampleRate
:= 44100;
214 gsSDLBufferSize
:= 2048;
216 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
218 with gPlayer1Settings
do
220 Name
:= GenPlayerName(1);
221 Model
:= STD_PLAYER_MODEL
;
222 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
223 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
224 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
228 with gPlayer2Settings
do
230 Name
:= GenPlayerName(2);
231 Model
:= STD_PLAYER_MODEL
;
232 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
233 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
234 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
238 (* section Joysticks *)
239 for i
:= 0 to e_MaxJoys
- 1 do
241 e_JoystickDeadzones
[i
] := 8192
246 g_Shells_SetMax(300);
248 g_Corpses_SetMax(20);
250 ITEM_RESPAWNTIME
:= 60 * 36;
256 gDrawBackGround
:= True;
257 gShowMessages
:= True;
258 gRevertPlayers
:= False;
261 gSFSFastMode
:= False;
262 e_FastScreenshots
:= True;
263 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
264 gBerserkAutoswitch
:= True;
267 gAskLanguage
:= True;
268 gLanguage
:= LANGUAGE_ENGLISH
;
270 (* section GameplayCustom *)
272 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
277 gcTeamDamage
:= False;
279 gcWeaponStay
:= False;
281 gcBotsVS
:= 'Everybody';
283 (* section GameplayNetwork *)
285 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
290 gnTeamDamage
:= False;
292 gnWeaponStay
:= False;
294 gnBotsVS
:= 'Everybody';
296 (* section MasterServer *)
297 NetSlistIP
:= 'mpms.doom2d.org';
298 NetSlistPort
:= 25665;
299 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
302 NetServerName
:= 'Unnamed Server';
306 NetAllowRCON
:= False;
307 NetRCONPassword
:= 'default';
308 NetUseMaster
:= True;
311 NetMasterRate
:= 60000;
312 NetForwardPorts
:= False;
316 NetForcePlayerUpdate
:= False;
317 NetPredictSelf
:= True;
318 NetClientIP
:= '127.0.0.1';
319 NetClientPort
:= NetPort
;
322 procedure g_Options_Read(FileName
: String);
328 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
330 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
333 procedure ReadInteger (VAR v
: LongWord; param
: String; minv
: LongWord = Low(LongWord); maxv
: LongWord = High(LongWord)); overload
;
335 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
338 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
340 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
343 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
345 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
348 procedure ReadBoolean (VAR v
: Boolean; param
: String);
350 v
:= config
.ReadBool(section
, param
, v
)
353 procedure ReadString (VAR v
: String; param
: String);
355 v
:= config
.ReadStr(section
, param
, v
)
359 gAskLanguage
:= True;
360 e_WriteLog('Reading config', TMsgType
.Notify
);
361 g_Options_SetDefault
;
363 if FileExists(FileName
) = False then
365 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
366 g_Options_SetDefaultVideo
;
370 config
:= TConfig
.CreateFile(FileName
);
373 ReadInteger(gScreenWidth
, 'ScreenWidth', 0);
374 ReadInteger(gScreenHeight
, 'ScreenHeight', 0);
375 ReadInteger(gWinRealPosX
, 'WinPosX', 60);
376 ReadInteger(gWinRealPosY
, 'WinPosY', 60);
377 ReadBoolean(gFullScreen
, 'Fullscreen');
378 ReadBoolean(gWinMaximized
, 'Maximized');
379 ReadInteger(gBPP
, 'BPP', 0);
380 ReadInteger(gFreq
, 'Freq', 0);
381 ReadBoolean(gVSync
, 'VSync');
382 ReadBoolean(gTextureFilter
, 'TextureFilter');
383 ReadBoolean(glLegacyNPOT
, 'LegacyCompatible');
386 ReadBoolean(gNoSound
, 'NoSound');
387 ReadInteger(gSoundLevel
, 'SoundLevel', 0, 255);
388 ReadInteger(gMusicLevel
, 'MusicLevel', 0, 255);
389 ReadInteger(gMaxSimSounds
, 'MaxSimSounds', 2, 66);
390 ReadBoolean(gMuteWhenInactive
, 'MuteInactive');
391 ReadInteger(gAnnouncer
, 'Announcer', ANNOUNCE_NONE
, ANNOUNCE_ALL
);
392 ReadBoolean(gSoundEffectsDF
, 'SoundEffectsDF');
393 ReadBoolean(gUseChatSounds
, 'ChatSounds');
394 ReadInteger(gsSDLSampleRate
, 'SDLSampleRate', 11025, 96000);
395 ReadInteger(gsSDLBufferSize
, 'SDLBufferSize', 64, 16384);
397 section
:= 'Player1';
398 with gPlayer1Settings
do
400 ReadString(Name
, 'name');
401 ReadString(Model
, 'model');
402 ReadInteger(Color
.R
, 'red', 0, 255);
403 ReadInteger(Color
.G
, 'green', 0, 255);
404 ReadInteger(Color
.B
, 'blue', 0, 255);
405 ReadInteger(Team
, 'team');
406 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
410 section
:= 'Player2';
411 with gPlayer2Settings
do
413 ReadString(Name
, 'name');
414 ReadString(Model
, 'model');
415 ReadInteger(Color
.R
, 'red', 0, 255);
416 ReadInteger(Color
.G
, 'green', 0, 255);
417 ReadInteger(Color
.B
, 'blue', 0, 255);
418 ReadInteger(Team
, 'team');
419 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
423 section
:= 'Joysticks';
424 for i
:= 0 to e_MaxJoys
- 1 do
426 ReadInteger(e_JoystickDeadzones
[i
], 'Deadzone' + IntToStr(i
))
430 ReadInteger(i
, 'MaxParticles', 0, 50000); g_GFX_SetMax(i
);
431 ReadInteger(i
, 'MaxShells', 0, 600); g_Shells_SetMax(i
);
432 ReadInteger(i
, 'MaxGibs', 0, 500); g_Gibs_SetMax(i
);
433 ReadInteger(i
, 'MaxCorpses', 0, 100); g_Corpses_SetMax(i
);
434 ReadInteger(i
, 'GibsCount');
440 else gGibsCount
:= 48;
442 i
:= ITEM_RESPAWNTIME
div 36; ReadInteger(i
, 'ItemRespawnTime', 0); ITEM_RESPAWNTIME
:= i
* 36;
443 ReadInteger(gBloodCount
, 'BloodCount', 0, 4);
444 ReadBoolean(gAdvBlood
, 'AdvancesBlood');
445 ReadBoolean(gAdvCorpses
, 'AdvancesCorpses');
446 ReadBoolean(gAdvGibs
, 'AdvancesGibs');
447 ReadInteger(gFlash
, 'Flash', 0, 2);
448 ReadBoolean(gDrawBackGround
, 'BackGround');
449 ReadBoolean(gShowMessages
, 'Messages');
450 ReadBoolean(gRevertPlayers
, 'RevertPlayers');
451 ReadInteger(gChatBubble
, 'ChatBubble', 0, 4);
452 ReadBoolean(gSFSDebug
, 'SFSDebug'); wadoptDebug
:= gSFSDebug
;
453 ReadBoolean(gSFSFastMode
, 'SFSFastMode'); wadoptFast
:= gSFSFastMode
;
454 ReadBoolean(e_FastScreenshots
, 'FastScreenshots');
455 ReadString(gDefaultMegawadStart
, 'DefaultMegawadStart');
456 ReadBoolean(gBerserkAutoswitch
, 'BerserkAutoswitching');
457 i
:= Trunc(g_dbg_scale
* 100); ReadInteger(i
, 'Scale', 100); g_dbg_scale
:= i
/ 100;
458 ReadString(gLanguage
, 'Language');
459 if (gLanguage
= LANGUAGE_RUSSIAN
) or (gLanguage
= LANGUAGE_ENGLISH
) then
460 gAskLanguage
:= False
462 gLanguage
:= LANGUAGE_ENGLISH
;
464 section
:= 'GameplayCustom';
465 ReadString(gcMap
, 'Map');
466 ReadString(gcGameMode
, 'GameMode');
467 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
468 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
469 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
470 ReadInteger(gcPlayers
, 'Players', 0, 2);
471 ReadBoolean(gcTeamDamage
, 'TeamDamage');
472 ReadBoolean(gcAllowExit
, 'AllowExit');
473 ReadBoolean(gcWeaponStay
, 'WeaponStay');
474 ReadBoolean(gcMonsters
, 'Monsters');
475 ReadString(gcBotsVS
, 'BotsVS');
477 with gGameSettings
do
479 GameMode
:= g_Game_TextToMode(gcGameMode
);
480 if GameMode
= GM_NONE
then
482 if GameMode
= GM_SINGLE
then
484 TimeLimit
:= gcTimeLimit
;
485 GoalLimit
:= gcGoalLimit
;
486 MaxLives
:= gcMaxLives
;
490 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
492 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
494 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
496 Options
:= Options
or GAME_OPTION_MONSTERS
;
497 if gcBotsVS
= 'Everybody' then
498 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
499 if gcBotsVS
= 'Players' then
500 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
501 if gcBotsVS
= 'Monsters' then
502 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
505 section
:= 'GameplayNetwork';
506 ReadString(gnMap
, 'Map');
507 ReadString(gnGameMode
, 'GameMode');
508 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
509 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
510 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
511 ReadInteger(gnPlayers
, 'Players', 0, 2);
512 ReadBoolean(gnTeamDamage
, 'TeamDamage');
513 ReadBoolean(gnAllowExit
, 'AllowExit');
514 ReadBoolean(gnWeaponStay
, 'WeaponStay');
515 ReadBoolean(gnMonsters
, 'Monsters');
516 ReadString(gnBotsVS
, 'BotsVS');
518 section
:= 'MasterServer';
519 ReadString(NetSlistIP
, 'IP');
520 ReadInteger(NetSlistPort
, 'Port', 0, 65535);
521 ReadString(NetSlistList
, 'List');
522 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
525 ReadString(NetServerName
, 'Name');
526 ReadString(NetPassword
, 'Password');
527 ReadInteger(NetPort
, 'Port', 0, 65535);
528 ReadInteger(NetMaxClients
, 'MaxClients', 0, NET_MAXCLIENTS
);
529 ReadBoolean(NetAllowRCON
, 'RCON');
530 ReadString(NetRCONPassword
, 'RCONPassword');
531 ReadBoolean(NetUseMaster
, 'SyncWithMaster');
532 ReadInteger(NetUpdateRate
, 'UpdateInterval', 0);
533 ReadInteger(NetRelupdRate
, 'ReliableUpdateInterval', 0);
534 ReadInteger(NetMasterRate
, 'MasterSyncInterval', 1);
535 ReadBoolean(NetForwardPorts
, 'ForwardPorts');
538 ReadInteger(NetInterpLevel
, 'InterpolationSteps', 0);
539 ReadBoolean(NetForcePlayerUpdate
, 'ForcePlayerUpdate');
540 ReadBoolean(NetPredictSelf
, 'PredictSelf');
541 ReadString(NetClientIP
, 'LastIP');
542 ReadInteger(NetClientPort
, 'LastPort', 0, 65535);
546 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
549 procedure g_Options_Write(FileName
: String);
554 e_WriteLog('Writing config', TMsgType
.Notify
);
556 config
:= TConfig
.CreateFile(FileName
);
558 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
559 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
560 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
561 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
562 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
563 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
564 config
.WriteInt('Video', 'BPP', gBPP
);
565 config
.WriteBool('Video', 'VSync', gVSync
);
566 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
567 config
.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT
);
569 config
.WriteBool('Sound', 'NoSound', gNoSound
);
570 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
571 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
572 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
573 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
574 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
575 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
576 config
.WriteBool('Sound', 'ChatSounds', gUseChatSounds
);
577 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
578 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
580 with config
, gPlayer1Settings
do
582 WriteStr('Player1', 'Name', Name
);
583 WriteStr('Player1', 'model', Model
);
584 WriteInt('Player1', 'red', Color
.R
);
585 WriteInt('Player1', 'green', Color
.G
);
586 WriteInt('Player1', 'blue', Color
.B
);
587 WriteInt('Player1', 'team', Team
);
590 with config
, gPlayer2Settings
do
592 WriteStr('Player2', 'Name', Name
);
593 WriteStr('Player2', 'model', Model
);
594 WriteInt('Player2', 'red', Color
.R
);
595 WriteInt('Player2', 'green', Color
.G
);
596 WriteInt('Player2', 'blue', Color
.B
);
597 WriteInt('Player2', 'team', Team
);
600 for i
:= 0 to e_MaxJoys
-1 do
601 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
605 0: config
.WriteInt('Game', 'GibsCount', 0);
606 8: config
.WriteInt('Game', 'GibsCount', 1);
607 16: config
.WriteInt('Game', 'GibsCount', 2);
608 32: config
.WriteInt('Game', 'GibsCount', 3);
609 else config
.WriteInt('Game', 'GibsCount', 4);
612 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
613 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
614 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
615 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
616 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
617 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
618 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
619 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
620 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
621 config
.WriteInt('Game', 'Flash', gFlash
);
622 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
623 config
.WriteBool('Game', 'Messages', gShowMessages
);
624 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
625 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
626 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
627 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
628 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
629 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
630 config
.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch
);
631 config
.WriteInt('Game', 'Scale', Round(g_dbg_scale
* 100));
633 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
634 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
635 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
636 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
637 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
638 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
639 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
640 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
641 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
642 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
643 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
645 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
646 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
647 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
648 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
649 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
650 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
651 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
652 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
653 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
654 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
655 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
657 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
658 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
659 config
.WriteStr('MasterServer', 'List', NetSlistList
);
661 config
.WriteStr ('Server', 'Name', NetServerName
);
662 config
.WriteStr ('Server', 'Password', NetPassword
);
663 config
.WriteInt ('Server', 'Port', NetPort
);
664 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
665 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
666 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
667 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
668 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
669 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
670 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
671 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
673 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
674 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
675 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
676 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
677 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
679 config
.SaveFile(FileName
);
683 procedure g_Options_Write_Language(FileName
: String);
687 e_WriteLog('Writing language config', TMsgType
.Notify
);
689 config
:= TConfig
.CreateFile(FileName
);
690 config
.WriteStr('Game', 'Language', gLanguage
);
691 config
.SaveFile(FileName
);
695 procedure g_Options_Write_Video(FileName
: String);
700 e_WriteLog('Writing resolution to config', TMsgType
.Notify
);
702 config
:= TConfig
.CreateFile(FileName
);
704 if gWinMaximized
and (not gFullscreen
) then
714 e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX
, gWinSizeY
, gScreenWidth
, gScreenHeight
]);
716 config
.WriteInt('Video', 'ScreenWidth', sW
);
717 config
.WriteInt('Video', 'ScreenHeight', sH
);
718 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
719 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
720 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
721 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
723 config
.WriteStr('Player1', 'Name', gPlayer1Settings
.Name
);
724 config
.WriteStr('Player2', 'Name', gPlayer2Settings
.Name
);
726 config
.SaveFile(FileName
);
730 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
734 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
736 config
:= TConfig
.CreateFile(FileName
);
738 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
739 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
740 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
741 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
742 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
743 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
744 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
745 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
746 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
747 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
748 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
750 config
.SaveFile(FileName
);
754 procedure g_Options_Write_Gameplay_Net(FileName
: String);
758 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
760 config
:= TConfig
.CreateFile(FileName
);
762 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
763 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
764 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
765 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
766 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
767 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
768 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
769 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
770 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
771 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
772 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
774 config
.SaveFile(FileName
);
778 procedure g_Options_Write_Net_Server(FileName
: String);
782 e_WriteLog('Writing server config', TMsgType
.Notify
);
784 config
:= TConfig
.CreateFile(FileName
);
786 config
.WriteStr ('Server', 'Name', NetServerName
);
787 config
.WriteStr ('Server', 'Password', NetPassword
);
788 config
.WriteInt ('Server', 'Port', NetPort
);
789 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
790 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
791 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
793 config
.SaveFile(FileName
);
797 procedure g_Options_Write_Net_Client(FileName
: String);
801 e_WriteLog('Writing client config', TMsgType
.Notify
);
803 config
:= TConfig
.CreateFile(FileName
);
805 config
.WriteStr('Client', 'LastIP', NetClientIP
);
806 config
.WriteInt('Client', 'LastPort', NetClientPort
);
808 config
.SaveFile(FileName
);
814 machine
:= Random(10000)