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;
94 glNPOTOverride
: Boolean = false;
99 {$INCLUDE ../nogl/noGLuses.inc}
103 e_log
, e_input
, g_console
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
104 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
105 g_items
, wadreader
, e_graphics
, g_touch
, envvars
;
110 function GenPlayerName (n
: Integer): String;
113 Result
:= GetUserName
;
115 Result
:= 'Player' + IntToStr(machine
MOD 10000);
117 Result
:= Copy(Result
, 1, 12) + ' '
119 Result
:= Copy(Result
, 1, 10) + ' ' + IntToStr(n
)
123 procedure g_Options_SetDefaultVideo
;
125 target
, closest
, display
: TSDL_DisplayMode
;
128 (* Display 0 = Primary display *)
130 gScreenHeight
:= 480;
131 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
134 gFullScreen
:= True; (* rotation not allowed? *)
136 gFullScreen
:= False;
138 if SDL_GetDesktopDisplayMode(0, @display
) = 0 then
141 gScreenWidth
:= display
.w
;
142 gScreenHeight
:= display
.h
;
144 (* Window must be smaller than display *)
145 closest
.w
:= display
.w
;
146 closest
.h
:= display
.h
;
148 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
150 if percentage
< 25 then
152 closest
.w
:= display
.w
* 75 div 100;
153 closest
.h
:= display
.h
* 75 div 100;
156 target
.w
:= display
.w
* percentage
div 100;
157 target
.h
:= display
.h
* percentage
div 100;
158 target
.format
:= 0; (* didn't care *)
159 target
.refresh_rate
:= 0; (* didn't care *)
160 target
.driverdata
:= nil; (* init *)
161 SDL_GetClosestDisplayMode(0, @target
, @closest
);
164 gScreenWidth
:= closest
.w
;
165 gScreenHeight
:= closest
.h
;
166 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
171 e_LogWritefln('SDL: Failed to get desktop display mode: %s', [SDL_GetError
])
173 (* Must be positioned on primary display *)
174 gWinRealPosX
:= SDL_WINDOWPOS_CENTERED
;
175 gWinRealPosY
:= SDL_WINDOWPOS_CENTERED
;
176 gWinMaximized
:= False;
178 gTextureFilter
:= True;
179 glLegacyNPOT
:= False;
180 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
181 g_Console_ResetBinds
;
184 procedure g_Options_SetDefaultVideo
;
187 gScreenHeight
:= 480;
189 gFullScreen
:= False;
192 gWinMaximized
:= False;
194 gTextureFilter
:= True;
195 glLegacyNPOT
:= False;
196 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
197 g_Console_ResetBinds
;
201 procedure g_Options_SetDefault();
210 gMuteWhenInactive
:= False;
211 gAnnouncer
:= ANNOUNCE_MEPLUS
;
212 gSoundEffectsDF
:= True;
213 gUseChatSounds
:= True;
214 gsSDLSampleRate
:= 44100;
215 gsSDLBufferSize
:= 2048;
217 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
219 with gPlayer1Settings
do
221 Name
:= GenPlayerName(1);
222 Model
:= STD_PLAYER_MODEL
;
223 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
224 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
225 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
229 with gPlayer2Settings
do
231 Name
:= GenPlayerName(2);
232 Model
:= STD_PLAYER_MODEL
;
233 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
234 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
235 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
239 (* section Joysticks *)
240 for i
:= 0 to e_MaxJoys
- 1 do
242 e_JoystickDeadzones
[i
] := 8192
247 g_Shells_SetMax(300);
249 g_Corpses_SetMax(20);
251 ITEM_RESPAWNTIME
:= 60 * 36;
257 gDrawBackGround
:= True;
258 gShowMessages
:= True;
259 gRevertPlayers
:= False;
262 gSFSFastMode
:= False;
263 e_FastScreenshots
:= True;
264 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
265 gBerserkAutoswitch
:= True;
268 gAskLanguage
:= True;
269 gLanguage
:= LANGUAGE_ENGLISH
;
271 (* section GameplayCustom *)
273 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
278 gcTeamDamage
:= False;
280 gcWeaponStay
:= False;
282 gcBotsVS
:= 'Everybody';
284 (* section GameplayNetwork *)
286 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
291 gnTeamDamage
:= False;
293 gnWeaponStay
:= False;
295 gnBotsVS
:= 'Everybody';
297 (* section MasterServer *)
298 NetSlistIP
:= 'mpms.doom2d.org';
299 NetSlistPort
:= 25665;
300 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
303 NetServerName
:= 'Unnamed Server';
307 NetAllowRCON
:= False;
308 NetRCONPassword
:= 'default';
309 NetUseMaster
:= True;
312 NetMasterRate
:= 60000;
313 NetForwardPorts
:= False;
317 NetForcePlayerUpdate
:= False;
318 NetPredictSelf
:= True;
319 NetClientIP
:= '127.0.0.1';
320 NetClientPort
:= NetPort
;
323 procedure g_Options_Read(FileName
: String);
329 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
331 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
334 procedure ReadInteger (VAR v
: LongWord; param
: String; minv
: LongWord = Low(LongWord); maxv
: LongWord = High(LongWord)); overload
;
336 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
339 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
341 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
344 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
346 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
349 procedure ReadBoolean (VAR v
: Boolean; param
: String);
351 v
:= config
.ReadBool(section
, param
, v
)
354 procedure ReadString (VAR v
: String; param
: String);
356 v
:= config
.ReadStr(section
, param
, v
)
360 gAskLanguage
:= True;
361 e_WriteLog('Reading config', TMsgType
.Notify
);
362 g_Options_SetDefault
;
364 if FileExists(FileName
) = False then
366 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
367 g_Options_SetDefaultVideo
;
371 config
:= TConfig
.CreateFile(FileName
);
374 ReadInteger(gScreenWidth
, 'ScreenWidth', 0);
375 ReadInteger(gScreenHeight
, 'ScreenHeight', 0);
376 ReadInteger(gWinRealPosX
, 'WinPosX', 60);
377 ReadInteger(gWinRealPosY
, 'WinPosY', 60);
378 ReadBoolean(gFullScreen
, 'Fullscreen');
379 ReadBoolean(gWinMaximized
, 'Maximized');
380 ReadInteger(gBPP
, 'BPP', 0);
381 ReadInteger(gFreq
, 'Freq', 0);
382 ReadBoolean(gVSync
, 'VSync');
383 ReadBoolean(gTextureFilter
, 'TextureFilter');
384 ReadBoolean(glNPOTOverride
, 'LegacyCompatibleForce');
387 ReadBoolean(gNoSound
, 'NoSound');
388 ReadInteger(gSoundLevel
, 'SoundLevel', 0, 255);
389 ReadInteger(gMusicLevel
, 'MusicLevel', 0, 255);
390 ReadInteger(gMaxSimSounds
, 'MaxSimSounds', 2, 66);
391 ReadBoolean(gMuteWhenInactive
, 'MuteInactive');
392 ReadInteger(gAnnouncer
, 'Announcer', ANNOUNCE_NONE
, ANNOUNCE_ALL
);
393 ReadBoolean(gSoundEffectsDF
, 'SoundEffectsDF');
394 ReadBoolean(gUseChatSounds
, 'ChatSounds');
395 ReadInteger(gsSDLSampleRate
, 'SDLSampleRate', 11025, 96000);
396 ReadInteger(gsSDLBufferSize
, 'SDLBufferSize', 64, 16384);
398 section
:= 'Player1';
399 with gPlayer1Settings
do
401 ReadString(Name
, 'name');
402 ReadString(Model
, 'model');
403 ReadInteger(Color
.R
, 'red', 0, 255);
404 ReadInteger(Color
.G
, 'green', 0, 255);
405 ReadInteger(Color
.B
, 'blue', 0, 255);
406 ReadInteger(Team
, 'team');
407 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
411 section
:= 'Player2';
412 with gPlayer2Settings
do
414 ReadString(Name
, 'name');
415 ReadString(Model
, 'model');
416 ReadInteger(Color
.R
, 'red', 0, 255);
417 ReadInteger(Color
.G
, 'green', 0, 255);
418 ReadInteger(Color
.B
, 'blue', 0, 255);
419 ReadInteger(Team
, 'team');
420 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
424 section
:= 'Joysticks';
425 for i
:= 0 to e_MaxJoys
- 1 do
427 ReadInteger(e_JoystickDeadzones
[i
], 'Deadzone' + IntToStr(i
))
431 ReadInteger(i
, 'MaxParticles', 0, 50000); g_GFX_SetMax(i
);
432 ReadInteger(i
, 'MaxShells', 0, 600); g_Shells_SetMax(i
);
433 ReadInteger(i
, 'MaxGibs', 0, 500); g_Gibs_SetMax(i
);
434 ReadInteger(i
, 'MaxCorpses', 0, 100); g_Corpses_SetMax(i
);
435 ReadInteger(i
, 'GibsCount');
441 else gGibsCount
:= 48;
443 i
:= ITEM_RESPAWNTIME
div 36; ReadInteger(i
, 'ItemRespawnTime', 0); ITEM_RESPAWNTIME
:= i
* 36;
444 ReadInteger(gBloodCount
, 'BloodCount', 0, 4);
445 ReadBoolean(gAdvBlood
, 'AdvancesBlood');
446 ReadBoolean(gAdvCorpses
, 'AdvancesCorpses');
447 ReadBoolean(gAdvGibs
, 'AdvancesGibs');
448 ReadInteger(gFlash
, 'Flash', 0, 2);
449 ReadBoolean(gDrawBackGround
, 'BackGround');
450 ReadBoolean(gShowMessages
, 'Messages');
451 ReadBoolean(gRevertPlayers
, 'RevertPlayers');
452 ReadInteger(gChatBubble
, 'ChatBubble', 0, 4);
453 ReadBoolean(gSFSDebug
, 'SFSDebug'); wadoptDebug
:= gSFSDebug
;
454 ReadBoolean(gSFSFastMode
, 'SFSFastMode'); wadoptFast
:= gSFSFastMode
;
455 ReadBoolean(e_FastScreenshots
, 'FastScreenshots');
456 ReadString(gDefaultMegawadStart
, 'DefaultMegawadStart');
457 ReadBoolean(gBerserkAutoswitch
, 'BerserkAutoswitching');
458 i
:= Trunc(g_dbg_scale
* 100); ReadInteger(i
, 'Scale', 100); g_dbg_scale
:= i
/ 100;
459 ReadString(gLanguage
, 'Language');
460 if (gLanguage
= LANGUAGE_RUSSIAN
) or (gLanguage
= LANGUAGE_ENGLISH
) then
461 gAskLanguage
:= False
463 gLanguage
:= LANGUAGE_ENGLISH
;
465 section
:= 'GameplayCustom';
466 ReadString(gcMap
, 'Map');
467 ReadString(gcGameMode
, 'GameMode');
468 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
469 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
470 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
471 ReadInteger(gcPlayers
, 'Players', 0, 2);
472 ReadBoolean(gcTeamDamage
, 'TeamDamage');
473 ReadBoolean(gcAllowExit
, 'AllowExit');
474 ReadBoolean(gcWeaponStay
, 'WeaponStay');
475 ReadBoolean(gcMonsters
, 'Monsters');
476 ReadString(gcBotsVS
, 'BotsVS');
478 with gGameSettings
do
480 GameMode
:= g_Game_TextToMode(gcGameMode
);
481 if GameMode
= GM_NONE
then
483 if GameMode
= GM_SINGLE
then
485 TimeLimit
:= gcTimeLimit
;
486 GoalLimit
:= gcGoalLimit
;
487 MaxLives
:= gcMaxLives
;
491 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
493 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
495 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
497 Options
:= Options
or GAME_OPTION_MONSTERS
;
498 if gcBotsVS
= 'Everybody' then
499 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
500 if gcBotsVS
= 'Players' then
501 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
502 if gcBotsVS
= 'Monsters' then
503 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
506 section
:= 'GameplayNetwork';
507 ReadString(gnMap
, 'Map');
508 ReadString(gnGameMode
, 'GameMode');
509 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
510 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
511 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
512 ReadInteger(gnPlayers
, 'Players', 0, 2);
513 ReadBoolean(gnTeamDamage
, 'TeamDamage');
514 ReadBoolean(gnAllowExit
, 'AllowExit');
515 ReadBoolean(gnWeaponStay
, 'WeaponStay');
516 ReadBoolean(gnMonsters
, 'Monsters');
517 ReadString(gnBotsVS
, 'BotsVS');
519 section
:= 'MasterServer';
520 ReadString(NetSlistIP
, 'IP');
521 ReadInteger(NetSlistPort
, 'Port', 0, 65535);
522 ReadString(NetSlistList
, 'List');
523 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
526 ReadString(NetServerName
, 'Name');
527 ReadString(NetPassword
, 'Password');
528 ReadInteger(NetPort
, 'Port', 0, 65535);
529 ReadInteger(NetMaxClients
, 'MaxClients', 0, NET_MAXCLIENTS
);
530 ReadBoolean(NetAllowRCON
, 'RCON');
531 ReadString(NetRCONPassword
, 'RCONPassword');
532 ReadBoolean(NetUseMaster
, 'SyncWithMaster');
533 ReadInteger(NetUpdateRate
, 'UpdateInterval', 0);
534 ReadInteger(NetRelupdRate
, 'ReliableUpdateInterval', 0);
535 ReadInteger(NetMasterRate
, 'MasterSyncInterval', 1);
536 ReadBoolean(NetForwardPorts
, 'ForwardPorts');
539 ReadInteger(NetInterpLevel
, 'InterpolationSteps', 0);
540 ReadBoolean(NetForcePlayerUpdate
, 'ForcePlayerUpdate');
541 ReadBoolean(NetPredictSelf
, 'PredictSelf');
542 ReadString(NetClientIP
, 'LastIP');
543 ReadInteger(NetClientPort
, 'LastPort', 0, 65535);
547 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
550 procedure g_Options_Write(FileName
: String);
555 e_WriteLog('Writing config', TMsgType
.Notify
);
557 config
:= TConfig
.CreateFile(FileName
);
559 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
560 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
561 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
562 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
563 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
564 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
565 config
.WriteInt('Video', 'BPP', gBPP
);
566 config
.WriteBool('Video', 'VSync', gVSync
);
567 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
568 config
.WriteBool('Video', 'LegacyCompatibleForce', glNPOTOverride
);
570 config
.WriteBool('Sound', 'NoSound', gNoSound
);
571 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
572 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
573 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
574 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
575 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
576 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
577 config
.WriteBool('Sound', 'ChatSounds', gUseChatSounds
);
578 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
579 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
581 with config
, gPlayer1Settings
do
583 WriteStr('Player1', 'Name', Name
);
584 WriteStr('Player1', 'model', Model
);
585 WriteInt('Player1', 'red', Color
.R
);
586 WriteInt('Player1', 'green', Color
.G
);
587 WriteInt('Player1', 'blue', Color
.B
);
588 WriteInt('Player1', 'team', Team
);
591 with config
, gPlayer2Settings
do
593 WriteStr('Player2', 'Name', Name
);
594 WriteStr('Player2', 'model', Model
);
595 WriteInt('Player2', 'red', Color
.R
);
596 WriteInt('Player2', 'green', Color
.G
);
597 WriteInt('Player2', 'blue', Color
.B
);
598 WriteInt('Player2', 'team', Team
);
601 for i
:= 0 to e_MaxJoys
-1 do
602 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
606 0: config
.WriteInt('Game', 'GibsCount', 0);
607 8: config
.WriteInt('Game', 'GibsCount', 1);
608 16: config
.WriteInt('Game', 'GibsCount', 2);
609 32: config
.WriteInt('Game', 'GibsCount', 3);
610 else config
.WriteInt('Game', 'GibsCount', 4);
613 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
614 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
615 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
616 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
617 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
618 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
619 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
620 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
621 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
622 config
.WriteInt('Game', 'Flash', gFlash
);
623 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
624 config
.WriteBool('Game', 'Messages', gShowMessages
);
625 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
626 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
627 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
628 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
629 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
630 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
631 config
.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch
);
632 config
.WriteInt('Game', 'Scale', Round(g_dbg_scale
* 100));
634 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
635 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
636 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
637 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
638 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
639 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
640 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
641 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
642 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
643 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
644 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
646 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
647 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
648 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
649 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
650 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
651 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
652 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
653 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
654 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
655 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
656 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
658 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
659 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
660 config
.WriteStr('MasterServer', 'List', NetSlistList
);
662 config
.WriteStr ('Server', 'Name', NetServerName
);
663 config
.WriteStr ('Server', 'Password', NetPassword
);
664 config
.WriteInt ('Server', 'Port', NetPort
);
665 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
666 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
667 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
668 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
669 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
670 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
671 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
672 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
674 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
675 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
676 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
677 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
678 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
680 config
.SaveFile(FileName
);
684 procedure g_Options_Write_Language(FileName
: String);
688 e_WriteLog('Writing language config', TMsgType
.Notify
);
690 config
:= TConfig
.CreateFile(FileName
);
691 config
.WriteStr('Game', 'Language', gLanguage
);
692 config
.SaveFile(FileName
);
696 procedure g_Options_Write_Video(FileName
: String);
701 e_WriteLog('Writing resolution to config', TMsgType
.Notify
);
703 config
:= TConfig
.CreateFile(FileName
);
705 if gWinMaximized
and (not gFullscreen
) then
715 e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX
, gWinSizeY
, gScreenWidth
, gScreenHeight
]);
717 config
.WriteInt('Video', 'ScreenWidth', sW
);
718 config
.WriteInt('Video', 'ScreenHeight', sH
);
719 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
720 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
721 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
722 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
724 config
.WriteStr('Player1', 'Name', gPlayer1Settings
.Name
);
725 config
.WriteStr('Player2', 'Name', gPlayer2Settings
.Name
);
727 config
.SaveFile(FileName
);
731 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
735 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
737 config
:= TConfig
.CreateFile(FileName
);
739 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
740 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
741 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
742 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
743 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
744 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
745 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
746 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
747 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
748 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
749 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
751 config
.SaveFile(FileName
);
755 procedure g_Options_Write_Gameplay_Net(FileName
: String);
759 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
761 config
:= TConfig
.CreateFile(FileName
);
763 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
764 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
765 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
766 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
767 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
768 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
769 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
770 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
771 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
772 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
773 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
775 config
.SaveFile(FileName
);
779 procedure g_Options_Write_Net_Server(FileName
: String);
783 e_WriteLog('Writing server config', TMsgType
.Notify
);
785 config
:= TConfig
.CreateFile(FileName
);
787 config
.WriteStr ('Server', 'Name', NetServerName
);
788 config
.WriteStr ('Server', 'Password', NetPassword
);
789 config
.WriteInt ('Server', 'Port', NetPort
);
790 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
791 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
792 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
794 config
.SaveFile(FileName
);
798 procedure g_Options_Write_Net_Client(FileName
: String);
802 e_WriteLog('Writing client config', TMsgType
.Notify
);
804 config
:= TConfig
.CreateFile(FileName
);
806 config
.WriteStr('Client', 'LastIP', NetClientIP
);
807 config
.WriteInt('Client', 'LastPort', NetClientPort
);
809 config
.SaveFile(FileName
);
815 machine
:= Random(10000)