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_SetDefaultVideo
;
27 procedure g_Options_Read(FileName
: String);
28 procedure g_Options_Write(FileName
: String);
29 procedure g_Options_Write_Language(FileName
: String);
30 procedure g_Options_Write_Video(FileName
: String);
31 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
32 procedure g_Options_Write_Gameplay_Net(FileName
: String);
33 procedure g_Options_Write_Net_Server(FileName
: String);
34 procedure g_Options_Write_Net_Client(FileName
: String);
36 const DF_Default_Megawad_Start
= 'megawads/DOOM2D.WAD:\MAP01';
39 // gGameControls: TControls;
42 gWinRealPosX
: Integer;
43 gWinRealPosY
: Integer;
47 gWinMaximized
: Boolean;
49 glLegacyNPOT
: Boolean;
50 gTextureFilter
: Boolean;
55 gMuteWhenInactive
: Boolean;
62 gDrawBackGround
: Boolean;
63 gShowMessages
: Boolean;
64 gRevertPlayers
: Boolean;
66 gAskLanguage
: Boolean;
73 gcTeamDamage
: Boolean;
75 gcWeaponStay
: Boolean;
84 gnTeamDamage
: Boolean;
86 gnWeaponStay
: Boolean;
89 gsSDLSampleRate
: Integer;
90 gsSDLBufferSize
: Integer;
92 gSFSFastMode
: Boolean;
93 gDefaultMegawadStart
: AnsiString;
94 gBerserkAutoswitch
: Boolean;
95 glNPOTOverride
: Boolean = false;
100 {$INCLUDE ../nogl/noGLuses.inc}
104 e_log
, e_input
, g_console
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
105 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
106 g_items
, wadreader
, e_graphics
, g_touch
, envvars
;
111 function GenPlayerName (n
: Integer): String;
114 Result
:= GetUserName
;
116 Result
:= 'Player' + IntToStr(machine
MOD 10000);
118 Result
:= Copy(Result
, 1, 12) + ' '
120 Result
:= Copy(Result
, 1, 10) + ' ' + IntToStr(n
)
124 procedure g_Options_SetDefaultVideo
;
126 target
, closest
, display
: TSDL_DisplayMode
;
129 (* Display 0 = Primary display *)
131 gScreenHeight
:= 480;
132 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
135 gFullScreen
:= True; (* rotation not allowed? *)
137 gFullScreen
:= False;
139 if SDL_GetDesktopDisplayMode(0, @display
) = 0 then
142 gScreenWidth
:= display
.w
;
143 gScreenHeight
:= display
.h
;
145 (* Window must be smaller than display *)
146 closest
.w
:= display
.w
;
147 closest
.h
:= display
.h
;
149 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
151 if percentage
< 25 then
153 closest
.w
:= display
.w
* 75 div 100;
154 closest
.h
:= display
.h
* 75 div 100;
157 target
.w
:= display
.w
* percentage
div 100;
158 target
.h
:= display
.h
* percentage
div 100;
159 target
.format
:= 0; (* didn't care *)
160 target
.refresh_rate
:= 0; (* didn't care *)
161 target
.driverdata
:= nil; (* init *)
162 SDL_GetClosestDisplayMode(0, @target
, @closest
);
165 gScreenWidth
:= closest
.w
;
166 gScreenHeight
:= closest
.h
;
167 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
172 e_LogWritefln('SDL: Failed to get desktop display mode: %s', [SDL_GetError
])
174 (* Must be positioned on primary display *)
175 gWinRealPosX
:= SDL_WINDOWPOS_CENTERED
;
176 gWinRealPosY
:= SDL_WINDOWPOS_CENTERED
;
177 gWinMaximized
:= False;
179 gTextureFilter
:= True;
180 glLegacyNPOT
:= False;
181 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
182 g_Console_ResetBinds
;
185 procedure g_Options_SetDefaultVideo
;
188 gScreenHeight
:= 480;
190 gFullScreen
:= False;
193 gWinMaximized
:= False;
195 gTextureFilter
:= True;
196 glLegacyNPOT
:= False;
197 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
198 g_Console_ResetBinds
;
202 procedure g_Options_SetDefault();
211 gMuteWhenInactive
:= False;
212 gAnnouncer
:= ANNOUNCE_MEPLUS
;
213 gSoundEffectsDF
:= True;
214 gUseChatSounds
:= True;
215 gsSDLSampleRate
:= 44100;
216 gsSDLBufferSize
:= 2048;
218 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
220 with gPlayer1Settings
do
222 Name
:= GenPlayerName(1);
223 Model
:= STD_PLAYER_MODEL
;
224 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
225 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
226 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
230 with gPlayer2Settings
do
232 Name
:= GenPlayerName(2);
233 Model
:= STD_PLAYER_MODEL
;
234 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
235 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
236 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
240 (* section Joysticks *)
241 for i
:= 0 to e_MaxJoys
- 1 do
243 e_JoystickDeadzones
[i
] := 8192
248 g_Shells_SetMax(300);
250 g_Corpses_SetMax(20);
252 ITEM_RESPAWNTIME
:= 60 * 36;
258 gDrawBackGround
:= True;
259 gShowMessages
:= True;
260 gRevertPlayers
:= False;
263 gSFSFastMode
:= False;
264 e_FastScreenshots
:= True;
265 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
266 gBerserkAutoswitch
:= True;
269 gAskLanguage
:= True;
270 gLanguage
:= LANGUAGE_ENGLISH
;
272 (* section GameplayCustom *)
274 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
279 gcTeamDamage
:= False;
281 gcWeaponStay
:= False;
283 gcBotsVS
:= 'Everybody';
285 (* section GameplayNetwork *)
287 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
292 gnTeamDamage
:= False;
294 gnWeaponStay
:= False;
296 gnBotsVS
:= 'Everybody';
298 (* section MasterServer *)
299 NetSlistIP
:= 'mpms.doom2d.org';
300 NetSlistPort
:= 25665;
301 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
304 NetServerName
:= 'Unnamed Server';
308 NetAllowRCON
:= False;
309 NetRCONPassword
:= 'default';
310 NetUseMaster
:= True;
313 NetMasterRate
:= 60000;
314 NetForwardPorts
:= False;
318 NetForcePlayerUpdate
:= False;
319 NetPredictSelf
:= True;
320 NetClientIP
:= '127.0.0.1';
321 NetClientPort
:= NetPort
;
324 procedure g_Options_Read(FileName
: String);
330 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
332 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
335 procedure ReadInteger (VAR v
: LongWord; param
: String; minv
: LongWord = Low(LongWord); maxv
: LongWord = High(LongWord)); overload
;
337 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
340 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
342 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
345 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
347 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
350 procedure ReadBoolean (VAR v
: Boolean; param
: String);
352 v
:= config
.ReadBool(section
, param
, v
)
355 procedure ReadString (VAR v
: String; param
: String);
357 v
:= config
.ReadStr(section
, param
, v
)
361 gAskLanguage
:= True;
362 e_WriteLog('Reading config', TMsgType
.Notify
);
363 g_Options_SetDefault
;
365 if FileExists(FileName
) = False then
367 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
368 g_Options_SetDefaultVideo
;
372 config
:= TConfig
.CreateFile(FileName
);
375 ReadInteger(gScreenWidth
, 'ScreenWidth', 0);
376 ReadInteger(gScreenHeight
, 'ScreenHeight', 0);
377 ReadInteger(gWinRealPosX
, 'WinPosX', 60);
378 ReadInteger(gWinRealPosY
, 'WinPosY', 60);
379 ReadBoolean(gFullScreen
, 'Fullscreen');
380 ReadBoolean(gWinMaximized
, 'Maximized');
381 ReadInteger(gBPP
, 'BPP', 0);
382 ReadInteger(gFreq
, 'Freq', 0);
383 ReadBoolean(gVSync
, 'VSync');
384 ReadBoolean(gTextureFilter
, 'TextureFilter');
385 ReadBoolean(glNPOTOverride
, 'LegacyCompatibleForce');
388 ReadBoolean(gNoSound
, 'NoSound');
389 ReadInteger(gSoundLevel
, 'SoundLevel', 0, 255);
390 ReadInteger(gMusicLevel
, 'MusicLevel', 0, 255);
391 ReadInteger(gMaxSimSounds
, 'MaxSimSounds', 2, 66);
392 ReadBoolean(gMuteWhenInactive
, 'MuteInactive');
393 ReadInteger(gAnnouncer
, 'Announcer', ANNOUNCE_NONE
, ANNOUNCE_ALL
);
394 ReadBoolean(gSoundEffectsDF
, 'SoundEffectsDF');
395 ReadBoolean(gUseChatSounds
, 'ChatSounds');
396 ReadInteger(gsSDLSampleRate
, 'SDLSampleRate', 11025, 96000);
397 ReadInteger(gsSDLBufferSize
, 'SDLBufferSize', 64, 16384);
399 section
:= 'Player1';
400 with gPlayer1Settings
do
402 ReadString(Name
, 'name');
403 ReadString(Model
, 'model');
404 ReadInteger(Color
.R
, 'red', 0, 255);
405 ReadInteger(Color
.G
, 'green', 0, 255);
406 ReadInteger(Color
.B
, 'blue', 0, 255);
407 ReadInteger(Team
, 'team');
408 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
412 section
:= 'Player2';
413 with gPlayer2Settings
do
415 ReadString(Name
, 'name');
416 ReadString(Model
, 'model');
417 ReadInteger(Color
.R
, 'red', 0, 255);
418 ReadInteger(Color
.G
, 'green', 0, 255);
419 ReadInteger(Color
.B
, 'blue', 0, 255);
420 ReadInteger(Team
, 'team');
421 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
425 section
:= 'Joysticks';
426 for i
:= 0 to e_MaxJoys
- 1 do
428 ReadInteger(e_JoystickDeadzones
[i
], 'Deadzone' + IntToStr(i
))
432 ReadInteger(i
, 'MaxParticles', 0, 50000); g_GFX_SetMax(i
);
433 ReadInteger(i
, 'MaxShells', 0, 600); g_Shells_SetMax(i
);
434 ReadInteger(i
, 'MaxGibs', 0, 500); g_Gibs_SetMax(i
);
435 ReadInteger(i
, 'MaxCorpses', 0, 100); g_Corpses_SetMax(i
);
436 ReadInteger(i
, 'GibsCount');
442 else gGibsCount
:= 48;
444 i
:= ITEM_RESPAWNTIME
div 36; ReadInteger(i
, 'ItemRespawnTime', 0); ITEM_RESPAWNTIME
:= i
* 36;
445 ReadInteger(gBloodCount
, 'BloodCount', 0, 4);
446 ReadBoolean(gAdvBlood
, 'AdvancesBlood');
447 ReadBoolean(gAdvCorpses
, 'AdvancesCorpses');
448 ReadBoolean(gAdvGibs
, 'AdvancesGibs');
449 ReadInteger(gFlash
, 'Flash', 0, 2);
450 ReadBoolean(gDrawBackGround
, 'BackGround');
451 ReadBoolean(gShowMessages
, 'Messages');
452 ReadBoolean(gRevertPlayers
, 'RevertPlayers');
453 ReadInteger(gChatBubble
, 'ChatBubble', 0, 4);
454 ReadBoolean(gSFSDebug
, 'SFSDebug'); wadoptDebug
:= gSFSDebug
;
455 ReadBoolean(gSFSFastMode
, 'SFSFastMode'); wadoptFast
:= gSFSFastMode
;
456 ReadBoolean(e_FastScreenshots
, 'FastScreenshots');
457 ReadString(gDefaultMegawadStart
, 'DefaultMegawadStart');
458 ReadBoolean(gBerserkAutoswitch
, 'BerserkAutoswitching');
459 i
:= Trunc(g_dbg_scale
* 100); ReadInteger(i
, 'Scale', 100); g_dbg_scale
:= i
/ 100;
460 ReadString(gLanguage
, 'Language');
461 if (gLanguage
= LANGUAGE_RUSSIAN
) or (gLanguage
= LANGUAGE_ENGLISH
) then
462 gAskLanguage
:= False
464 gLanguage
:= LANGUAGE_ENGLISH
;
466 section
:= 'GameplayCustom';
467 ReadString(gcMap
, 'Map');
468 ReadString(gcGameMode
, 'GameMode');
469 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
470 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
471 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
472 ReadInteger(gcPlayers
, 'Players', 0, 2);
473 ReadBoolean(gcTeamDamage
, 'TeamDamage');
474 ReadBoolean(gcAllowExit
, 'AllowExit');
475 ReadBoolean(gcWeaponStay
, 'WeaponStay');
476 ReadBoolean(gcMonsters
, 'Monsters');
477 ReadString(gcBotsVS
, 'BotsVS');
479 with gGameSettings
do
481 GameMode
:= g_Game_TextToMode(gcGameMode
);
482 if GameMode
= GM_NONE
then
484 if GameMode
= GM_SINGLE
then
486 TimeLimit
:= gcTimeLimit
;
487 GoalLimit
:= gcGoalLimit
;
488 MaxLives
:= gcMaxLives
;
492 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
494 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
496 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
498 Options
:= Options
or GAME_OPTION_MONSTERS
;
499 if gcBotsVS
= 'Everybody' then
500 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
501 if gcBotsVS
= 'Players' then
502 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
503 if gcBotsVS
= 'Monsters' then
504 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
507 section
:= 'GameplayNetwork';
508 ReadString(gnMap
, 'Map');
509 ReadString(gnGameMode
, 'GameMode');
510 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
511 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
512 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
513 ReadInteger(gnPlayers
, 'Players', 0, 2);
514 ReadBoolean(gnTeamDamage
, 'TeamDamage');
515 ReadBoolean(gnAllowExit
, 'AllowExit');
516 ReadBoolean(gnWeaponStay
, 'WeaponStay');
517 ReadBoolean(gnMonsters
, 'Monsters');
518 ReadString(gnBotsVS
, 'BotsVS');
520 section
:= 'MasterServer';
521 ReadString(NetSlistIP
, 'IP');
522 ReadInteger(NetSlistPort
, 'Port', 0, 65535);
523 ReadString(NetSlistList
, 'List');
524 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
527 ReadString(NetServerName
, 'Name');
528 ReadString(NetPassword
, 'Password');
529 ReadInteger(NetPort
, 'Port', 0, 65535);
530 ReadInteger(NetMaxClients
, 'MaxClients', 0, NET_MAXCLIENTS
);
531 ReadBoolean(NetAllowRCON
, 'RCON');
532 ReadString(NetRCONPassword
, 'RCONPassword');
533 ReadBoolean(NetUseMaster
, 'SyncWithMaster');
534 ReadInteger(NetUpdateRate
, 'UpdateInterval', 0);
535 ReadInteger(NetRelupdRate
, 'ReliableUpdateInterval', 0);
536 ReadInteger(NetMasterRate
, 'MasterSyncInterval', 1);
537 ReadBoolean(NetForwardPorts
, 'ForwardPorts');
540 ReadInteger(NetInterpLevel
, 'InterpolationSteps', 0);
541 ReadBoolean(NetForcePlayerUpdate
, 'ForcePlayerUpdate');
542 ReadBoolean(NetPredictSelf
, 'PredictSelf');
543 ReadString(NetClientIP
, 'LastIP');
544 ReadInteger(NetClientPort
, 'LastPort', 0, 65535);
548 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
551 procedure g_Options_Write(FileName
: String);
556 e_WriteLog('Writing config', TMsgType
.Notify
);
558 config
:= TConfig
.CreateFile(FileName
);
560 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
561 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
562 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
563 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
564 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
565 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
566 config
.WriteInt('Video', 'BPP', gBPP
);
567 config
.WriteBool('Video', 'VSync', gVSync
);
568 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
569 config
.WriteBool('Video', 'LegacyCompatibleForce', glNPOTOverride
);
571 config
.WriteBool('Sound', 'NoSound', gNoSound
);
572 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
573 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
574 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
575 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
576 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
577 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
578 config
.WriteBool('Sound', 'ChatSounds', gUseChatSounds
);
579 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
580 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
582 with config
, gPlayer1Settings
do
584 WriteStr('Player1', 'Name', Name
);
585 WriteStr('Player1', 'model', Model
);
586 WriteInt('Player1', 'red', Color
.R
);
587 WriteInt('Player1', 'green', Color
.G
);
588 WriteInt('Player1', 'blue', Color
.B
);
589 WriteInt('Player1', 'team', Team
);
592 with config
, gPlayer2Settings
do
594 WriteStr('Player2', 'Name', Name
);
595 WriteStr('Player2', 'model', Model
);
596 WriteInt('Player2', 'red', Color
.R
);
597 WriteInt('Player2', 'green', Color
.G
);
598 WriteInt('Player2', 'blue', Color
.B
);
599 WriteInt('Player2', 'team', Team
);
602 for i
:= 0 to e_MaxJoys
-1 do
603 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
607 0: config
.WriteInt('Game', 'GibsCount', 0);
608 8: config
.WriteInt('Game', 'GibsCount', 1);
609 16: config
.WriteInt('Game', 'GibsCount', 2);
610 32: config
.WriteInt('Game', 'GibsCount', 3);
611 else config
.WriteInt('Game', 'GibsCount', 4);
614 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
615 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
616 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
617 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
618 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
619 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
620 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
621 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
622 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
623 config
.WriteInt('Game', 'Flash', gFlash
);
624 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
625 config
.WriteBool('Game', 'Messages', gShowMessages
);
626 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
627 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
628 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
629 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
630 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
631 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
632 config
.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch
);
633 config
.WriteInt('Game', 'Scale', Round(g_dbg_scale
* 100));
635 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
636 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
637 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
638 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
639 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
640 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
641 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
642 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
643 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
644 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
645 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
647 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
648 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
649 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
650 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
651 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
652 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
653 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
654 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
655 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
656 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
657 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
659 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
660 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
661 config
.WriteStr('MasterServer', 'List', NetSlistList
);
663 config
.WriteStr ('Server', 'Name', NetServerName
);
664 config
.WriteStr ('Server', 'Password', NetPassword
);
665 config
.WriteInt ('Server', 'Port', NetPort
);
666 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
667 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
668 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
669 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
670 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
671 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
672 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
673 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
675 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
676 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
677 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
678 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
679 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
681 config
.SaveFile(FileName
);
685 procedure g_Options_Write_Language(FileName
: String);
689 e_WriteLog('Writing language config', TMsgType
.Notify
);
691 config
:= TConfig
.CreateFile(FileName
);
692 config
.WriteStr('Game', 'Language', gLanguage
);
693 config
.SaveFile(FileName
);
697 procedure g_Options_Write_Video(FileName
: String);
702 e_WriteLog('Writing resolution to config', TMsgType
.Notify
);
704 config
:= TConfig
.CreateFile(FileName
);
706 if gWinMaximized
and (not gFullscreen
) then
716 e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX
, gWinSizeY
, gScreenWidth
, gScreenHeight
]);
718 config
.WriteInt('Video', 'ScreenWidth', sW
);
719 config
.WriteInt('Video', 'ScreenHeight', sH
);
720 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
721 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
722 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
723 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
725 config
.WriteStr('Player1', 'Name', gPlayer1Settings
.Name
);
726 config
.WriteStr('Player2', 'Name', gPlayer2Settings
.Name
);
728 config
.SaveFile(FileName
);
732 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
736 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
738 config
:= TConfig
.CreateFile(FileName
);
740 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
741 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
742 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
743 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
744 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
745 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
746 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
747 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
748 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
749 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
750 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
752 config
.SaveFile(FileName
);
756 procedure g_Options_Write_Gameplay_Net(FileName
: String);
760 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
762 config
:= TConfig
.CreateFile(FileName
);
764 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
765 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
766 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
767 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
768 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
769 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
770 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
771 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
772 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
773 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
774 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
776 config
.SaveFile(FileName
);
780 procedure g_Options_Write_Net_Server(FileName
: String);
784 e_WriteLog('Writing server config', TMsgType
.Notify
);
786 config
:= TConfig
.CreateFile(FileName
);
788 config
.WriteStr ('Server', 'Name', NetServerName
);
789 config
.WriteStr ('Server', 'Password', NetPassword
);
790 config
.WriteInt ('Server', 'Port', NetPort
);
791 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
792 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
793 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
795 config
.SaveFile(FileName
);
799 procedure g_Options_Write_Net_Client(FileName
: String);
803 e_WriteLog('Writing client config', TMsgType
.Notify
);
805 config
:= TConfig
.CreateFile(FileName
);
807 config
.WriteStr('Client', 'LastIP', NetClientIP
);
808 config
.WriteInt('Client', 'LastPort', NetClientPort
);
810 config
.SaveFile(FileName
);
816 machine
:= Random(10000)