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
;
125 var display
: TSDL_DisplayMode
;
127 var target
, closest
: TSDL_DisplayMode
; percentage
: Integer;
130 (* Display 0 = Primary display *)
132 gScreenHeight
:= 480;
133 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
136 gFullScreen
:= True; (* rotation not allowed? *)
138 gFullScreen
:= False;
140 if SDL_GetDesktopDisplayMode(0, @display
) = 0 then
143 gScreenWidth
:= display
.w
;
144 gScreenHeight
:= display
.h
;
146 (* Window must be smaller than display *)
147 closest
.w
:= display
.w
;
148 closest
.h
:= display
.h
;
150 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
152 if percentage
< 25 then
154 closest
.w
:= display
.w
* 75 div 100;
155 closest
.h
:= display
.h
* 75 div 100;
158 target
.w
:= display
.w
* percentage
div 100;
159 target
.h
:= display
.h
* percentage
div 100;
160 target
.format
:= 0; (* didn't care *)
161 target
.refresh_rate
:= 0; (* didn't care *)
162 target
.driverdata
:= nil; (* init *)
163 SDL_GetClosestDisplayMode(0, @target
, @closest
);
166 gScreenWidth
:= closest
.w
;
167 gScreenHeight
:= closest
.h
;
168 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
173 e_LogWritefln('SDL: Failed to get desktop display mode: %s', [SDL_GetError
])
175 (* Must be positioned on primary display *)
176 gWinRealPosX
:= SDL_WINDOWPOS_CENTERED
;
177 gWinRealPosY
:= SDL_WINDOWPOS_CENTERED
;
178 gWinMaximized
:= False;
180 gTextureFilter
:= True;
181 glLegacyNPOT
:= False;
182 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
183 g_Console_ResetBinds
;
186 procedure g_Options_SetDefaultVideo
;
189 gScreenHeight
:= 480;
191 gFullScreen
:= False;
194 gWinMaximized
:= False;
196 gTextureFilter
:= True;
197 glLegacyNPOT
:= False;
198 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
199 g_Console_ResetBinds
;
203 procedure g_Options_SetDefault();
212 gMuteWhenInactive
:= False;
213 gAnnouncer
:= ANNOUNCE_MEPLUS
;
214 gSoundEffectsDF
:= True;
215 gUseChatSounds
:= True;
216 gsSDLSampleRate
:= 44100;
217 gsSDLBufferSize
:= 2048;
219 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
221 with gPlayer1Settings
do
223 Name
:= GenPlayerName(1);
224 Model
:= STD_PLAYER_MODEL
;
225 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
226 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
227 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
231 with gPlayer2Settings
do
233 Name
:= GenPlayerName(2);
234 Model
:= STD_PLAYER_MODEL
;
235 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
236 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
237 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
241 (* section Joysticks *)
242 for i
:= 0 to e_MaxJoys
- 1 do
244 e_JoystickDeadzones
[i
] := 8192
249 g_Shells_SetMax(300);
251 g_Corpses_SetMax(20);
253 ITEM_RESPAWNTIME
:= 60 * 36;
259 gDrawBackGround
:= True;
260 gShowMessages
:= True;
261 gRevertPlayers
:= False;
264 gSFSFastMode
:= False;
265 e_FastScreenshots
:= True;
266 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
267 gBerserkAutoswitch
:= True;
270 gAskLanguage
:= True;
271 gLanguage
:= LANGUAGE_ENGLISH
;
273 (* section GameplayCustom *)
275 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
280 gcTeamDamage
:= False;
282 gcWeaponStay
:= False;
284 gcBotsVS
:= 'Everybody';
286 (* section GameplayNetwork *)
288 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
293 gnTeamDamage
:= False;
295 gnWeaponStay
:= False;
297 gnBotsVS
:= 'Everybody';
299 (* section MasterServer *)
300 NetSlistIP
:= 'mpms.doom2d.org';
301 NetSlistPort
:= 25665;
302 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
305 NetServerName
:= 'Unnamed Server';
309 NetAllowRCON
:= False;
310 NetRCONPassword
:= 'default';
311 NetUseMaster
:= True;
314 NetMasterRate
:= 60000;
315 NetForwardPorts
:= False;
319 NetForcePlayerUpdate
:= False;
320 NetPredictSelf
:= True;
321 NetClientIP
:= '127.0.0.1';
322 NetClientPort
:= NetPort
;
325 procedure g_Options_Read(FileName
: String);
331 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
333 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
336 procedure ReadInteger (VAR v
: LongWord; param
: String; minv
: LongWord = Low(LongWord); maxv
: LongWord = High(LongWord)); overload
;
338 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
341 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
343 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
346 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
348 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
351 procedure ReadBoolean (VAR v
: Boolean; param
: String);
353 v
:= config
.ReadBool(section
, param
, v
)
356 procedure ReadString (VAR v
: String; param
: String);
358 v
:= config
.ReadStr(section
, param
, v
)
362 gAskLanguage
:= True;
363 e_WriteLog('Reading config', TMsgType
.Notify
);
364 g_Options_SetDefault
;
366 if FileExists(FileName
) = False then
368 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
369 g_Options_SetDefaultVideo
;
373 config
:= TConfig
.CreateFile(FileName
);
376 ReadInteger(gScreenWidth
, 'ScreenWidth', 0);
377 ReadInteger(gScreenHeight
, 'ScreenHeight', 0);
378 ReadInteger(gWinRealPosX
, 'WinPosX', 60);
379 ReadInteger(gWinRealPosY
, 'WinPosY', 60);
380 ReadBoolean(gFullScreen
, 'Fullscreen');
381 ReadBoolean(gWinMaximized
, 'Maximized');
382 ReadInteger(gBPP
, 'BPP', 0);
383 ReadInteger(gFreq
, 'Freq', 0);
384 ReadBoolean(gVSync
, 'VSync');
385 ReadBoolean(gTextureFilter
, 'TextureFilter');
386 ReadBoolean(glNPOTOverride
, 'LegacyCompatibleForce');
389 ReadBoolean(gNoSound
, 'NoSound');
390 ReadInteger(gSoundLevel
, 'SoundLevel', 0, 255);
391 ReadInteger(gMusicLevel
, 'MusicLevel', 0, 255);
392 ReadInteger(gMaxSimSounds
, 'MaxSimSounds', 2, 66);
393 ReadBoolean(gMuteWhenInactive
, 'MuteInactive');
394 ReadInteger(gAnnouncer
, 'Announcer', ANNOUNCE_NONE
, ANNOUNCE_ALL
);
395 ReadBoolean(gSoundEffectsDF
, 'SoundEffectsDF');
396 ReadBoolean(gUseChatSounds
, 'ChatSounds');
397 ReadInteger(gsSDLSampleRate
, 'SDLSampleRate', 11025, 96000);
398 ReadInteger(gsSDLBufferSize
, 'SDLBufferSize', 64, 16384);
400 section
:= 'Player1';
401 with gPlayer1Settings
do
403 ReadString(Name
, 'name');
404 ReadString(Model
, 'model');
405 ReadInteger(Color
.R
, 'red', 0, 255);
406 ReadInteger(Color
.G
, 'green', 0, 255);
407 ReadInteger(Color
.B
, 'blue', 0, 255);
408 ReadInteger(Team
, 'team');
409 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
413 section
:= 'Player2';
414 with gPlayer2Settings
do
416 ReadString(Name
, 'name');
417 ReadString(Model
, 'model');
418 ReadInteger(Color
.R
, 'red', 0, 255);
419 ReadInteger(Color
.G
, 'green', 0, 255);
420 ReadInteger(Color
.B
, 'blue', 0, 255);
421 ReadInteger(Team
, 'team');
422 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
426 section
:= 'Joysticks';
427 for i
:= 0 to e_MaxJoys
- 1 do
429 ReadInteger(e_JoystickDeadzones
[i
], 'Deadzone' + IntToStr(i
))
433 ReadInteger(i
, 'MaxParticles', 0, 50000); g_GFX_SetMax(i
);
434 ReadInteger(i
, 'MaxShells', 0, 600); g_Shells_SetMax(i
);
435 ReadInteger(i
, 'MaxGibs', 0, 500); g_Gibs_SetMax(i
);
436 ReadInteger(i
, 'MaxCorpses', 0, 100); g_Corpses_SetMax(i
);
437 ReadInteger(i
, 'GibsCount');
443 else gGibsCount
:= 48;
445 i
:= ITEM_RESPAWNTIME
div 36; ReadInteger(i
, 'ItemRespawnTime', 0); ITEM_RESPAWNTIME
:= i
* 36;
446 ReadInteger(gBloodCount
, 'BloodCount', 0, 4);
447 ReadBoolean(gAdvBlood
, 'AdvancesBlood');
448 ReadBoolean(gAdvCorpses
, 'AdvancesCorpses');
449 ReadBoolean(gAdvGibs
, 'AdvancesGibs');
450 ReadInteger(gFlash
, 'Flash', 0, 2);
451 ReadBoolean(gDrawBackGround
, 'BackGround');
452 ReadBoolean(gShowMessages
, 'Messages');
453 ReadBoolean(gRevertPlayers
, 'RevertPlayers');
454 ReadInteger(gChatBubble
, 'ChatBubble', 0, 4);
455 ReadBoolean(gSFSDebug
, 'SFSDebug'); wadoptDebug
:= gSFSDebug
;
456 ReadBoolean(gSFSFastMode
, 'SFSFastMode'); wadoptFast
:= gSFSFastMode
;
457 ReadBoolean(e_FastScreenshots
, 'FastScreenshots');
458 ReadString(gDefaultMegawadStart
, 'DefaultMegawadStart');
459 ReadBoolean(gBerserkAutoswitch
, 'BerserkAutoswitching');
460 i
:= Trunc(g_dbg_scale
* 100); ReadInteger(i
, 'Scale', 100); g_dbg_scale
:= i
/ 100;
461 ReadString(gLanguage
, 'Language');
462 if (gLanguage
= LANGUAGE_RUSSIAN
) or (gLanguage
= LANGUAGE_ENGLISH
) then
463 gAskLanguage
:= False
465 gLanguage
:= LANGUAGE_ENGLISH
;
467 section
:= 'GameplayCustom';
468 ReadString(gcMap
, 'Map');
469 ReadString(gcGameMode
, 'GameMode');
470 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
471 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
472 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
473 ReadInteger(gcPlayers
, 'Players', 0, 2);
474 ReadBoolean(gcTeamDamage
, 'TeamDamage');
475 ReadBoolean(gcAllowExit
, 'AllowExit');
476 ReadBoolean(gcWeaponStay
, 'WeaponStay');
477 ReadBoolean(gcMonsters
, 'Monsters');
478 ReadString(gcBotsVS
, 'BotsVS');
480 with gGameSettings
do
482 GameMode
:= g_Game_TextToMode(gcGameMode
);
483 if GameMode
= GM_NONE
then
485 if GameMode
= GM_SINGLE
then
487 TimeLimit
:= gcTimeLimit
;
488 GoalLimit
:= gcGoalLimit
;
489 MaxLives
:= gcMaxLives
;
493 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
495 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
497 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
499 Options
:= Options
or GAME_OPTION_MONSTERS
;
500 if gcBotsVS
= 'Everybody' then
501 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
502 if gcBotsVS
= 'Players' then
503 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
504 if gcBotsVS
= 'Monsters' then
505 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
508 section
:= 'GameplayNetwork';
509 ReadString(gnMap
, 'Map');
510 ReadString(gnGameMode
, 'GameMode');
511 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
512 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
513 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
514 ReadInteger(gnPlayers
, 'Players', 0, 2);
515 ReadBoolean(gnTeamDamage
, 'TeamDamage');
516 ReadBoolean(gnAllowExit
, 'AllowExit');
517 ReadBoolean(gnWeaponStay
, 'WeaponStay');
518 ReadBoolean(gnMonsters
, 'Monsters');
519 ReadString(gnBotsVS
, 'BotsVS');
521 section
:= 'MasterServer';
522 ReadString(NetSlistIP
, 'IP');
523 ReadInteger(NetSlistPort
, 'Port', 0, 65535);
524 ReadString(NetSlistList
, 'List');
525 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
528 ReadString(NetServerName
, 'Name');
529 ReadString(NetPassword
, 'Password');
530 ReadInteger(NetPort
, 'Port', 0, 65535);
531 ReadInteger(NetMaxClients
, 'MaxClients', 0, NET_MAXCLIENTS
);
532 ReadBoolean(NetAllowRCON
, 'RCON');
533 ReadString(NetRCONPassword
, 'RCONPassword');
534 ReadBoolean(NetUseMaster
, 'SyncWithMaster');
535 ReadInteger(NetUpdateRate
, 'UpdateInterval', 0);
536 ReadInteger(NetRelupdRate
, 'ReliableUpdateInterval', 0);
537 ReadInteger(NetMasterRate
, 'MasterSyncInterval', 1);
538 ReadBoolean(NetForwardPorts
, 'ForwardPorts');
541 ReadInteger(NetInterpLevel
, 'InterpolationSteps', 0);
542 ReadBoolean(NetForcePlayerUpdate
, 'ForcePlayerUpdate');
543 ReadBoolean(NetPredictSelf
, 'PredictSelf');
544 ReadString(NetClientIP
, 'LastIP');
545 ReadInteger(NetClientPort
, 'LastPort', 0, 65535);
549 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
552 procedure g_Options_Write(FileName
: String);
557 e_WriteLog('Writing config', TMsgType
.Notify
);
559 config
:= TConfig
.CreateFile(FileName
);
561 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
562 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
563 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
564 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
565 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
566 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
567 config
.WriteInt('Video', 'BPP', gBPP
);
568 config
.WriteBool('Video', 'VSync', gVSync
);
569 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
570 config
.WriteBool('Video', 'LegacyCompatibleForce', glNPOTOverride
);
572 config
.WriteBool('Sound', 'NoSound', gNoSound
);
573 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
574 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
575 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
576 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
577 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
578 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
579 config
.WriteBool('Sound', 'ChatSounds', gUseChatSounds
);
580 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
581 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
583 with config
, gPlayer1Settings
do
585 WriteStr('Player1', 'Name', Name
);
586 WriteStr('Player1', 'model', Model
);
587 WriteInt('Player1', 'red', Color
.R
);
588 WriteInt('Player1', 'green', Color
.G
);
589 WriteInt('Player1', 'blue', Color
.B
);
590 WriteInt('Player1', 'team', Team
);
593 with config
, gPlayer2Settings
do
595 WriteStr('Player2', 'Name', Name
);
596 WriteStr('Player2', 'model', Model
);
597 WriteInt('Player2', 'red', Color
.R
);
598 WriteInt('Player2', 'green', Color
.G
);
599 WriteInt('Player2', 'blue', Color
.B
);
600 WriteInt('Player2', 'team', Team
);
603 for i
:= 0 to e_MaxJoys
-1 do
604 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
608 0: config
.WriteInt('Game', 'GibsCount', 0);
609 8: config
.WriteInt('Game', 'GibsCount', 1);
610 16: config
.WriteInt('Game', 'GibsCount', 2);
611 32: config
.WriteInt('Game', 'GibsCount', 3);
612 else config
.WriteInt('Game', 'GibsCount', 4);
615 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
616 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
617 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
618 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
619 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
620 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
621 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
622 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
623 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
624 config
.WriteInt('Game', 'Flash', gFlash
);
625 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
626 config
.WriteBool('Game', 'Messages', gShowMessages
);
627 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
628 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
629 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
630 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
631 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
632 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
633 config
.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch
);
634 config
.WriteInt('Game', 'Scale', Round(g_dbg_scale
* 100));
636 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
637 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
638 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
639 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
640 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
641 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
642 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
643 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
644 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
645 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
646 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
648 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
649 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
650 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
651 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
652 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
653 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
654 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
655 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
656 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
657 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
658 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
660 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
661 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
662 config
.WriteStr('MasterServer', 'List', NetSlistList
);
664 config
.WriteStr ('Server', 'Name', NetServerName
);
665 config
.WriteStr ('Server', 'Password', NetPassword
);
666 config
.WriteInt ('Server', 'Port', NetPort
);
667 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
668 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
669 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
670 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
671 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
672 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
673 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
674 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
676 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
677 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
678 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
679 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
680 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
682 config
.SaveFile(FileName
);
686 procedure g_Options_Write_Language(FileName
: String);
690 e_WriteLog('Writing language config', TMsgType
.Notify
);
692 config
:= TConfig
.CreateFile(FileName
);
693 config
.WriteStr('Game', 'Language', gLanguage
);
694 config
.SaveFile(FileName
);
698 procedure g_Options_Write_Video(FileName
: String);
703 e_WriteLog('Writing resolution to config', TMsgType
.Notify
);
705 config
:= TConfig
.CreateFile(FileName
);
707 if gWinMaximized
and (not gFullscreen
) then
717 e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX
, gWinSizeY
, gScreenWidth
, gScreenHeight
]);
719 config
.WriteInt('Video', 'ScreenWidth', sW
);
720 config
.WriteInt('Video', 'ScreenHeight', sH
);
721 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
722 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
723 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
724 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
726 config
.WriteStr('Player1', 'Name', gPlayer1Settings
.Name
);
727 config
.WriteStr('Player2', 'Name', gPlayer2Settings
.Name
);
729 config
.SaveFile(FileName
);
733 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
737 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
739 config
:= TConfig
.CreateFile(FileName
);
741 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
742 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
743 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
744 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
745 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
746 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
747 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
748 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
749 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
750 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
751 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
753 config
.SaveFile(FileName
);
757 procedure g_Options_Write_Gameplay_Net(FileName
: String);
761 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
763 config
:= TConfig
.CreateFile(FileName
);
765 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
766 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
767 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
768 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
769 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
770 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
771 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
772 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
773 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
774 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
775 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
777 config
.SaveFile(FileName
);
781 procedure g_Options_Write_Net_Server(FileName
: String);
785 e_WriteLog('Writing server config', TMsgType
.Notify
);
787 config
:= TConfig
.CreateFile(FileName
);
789 config
.WriteStr ('Server', 'Name', NetServerName
);
790 config
.WriteStr ('Server', 'Password', NetPassword
);
791 config
.WriteInt ('Server', 'Port', NetPort
);
792 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
793 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
794 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
796 config
.SaveFile(FileName
);
800 procedure g_Options_Write_Net_Client(FileName
: String);
804 e_WriteLog('Writing client config', TMsgType
.Notify
);
806 config
:= TConfig
.CreateFile(FileName
);
808 config
.WriteStr('Client', 'LastIP', NetClientIP
);
809 config
.WriteInt('Client', 'LastPort', NetClientPort
);
811 config
.SaveFile(FileName
);
817 machine
:= Random(10000)