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, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 {$INCLUDE ../shared/a_modes.inc}
22 g_language
, g_weapons
;
24 function GenPlayerName (n
: Integer): String;
26 procedure g_Options_SetDefault();
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;
99 {$INCLUDE ../nogl/noGLuses.inc}
100 e_log
, e_input
, g_console
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
101 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
102 g_items
, wadreader
, e_graphics
, g_touch
, SDL2
, envvars
;
107 function GenPlayerName (n
: Integer): String;
110 Result
:= GetUserName
;
112 Result
:= 'Player' + IntToStr(machine
MOD 10000);
114 Result
:= Copy(Result
, 1, 12) + ' '
116 Result
:= Copy(Result
, 1, 10) + ' ' + IntToStr(n
)
119 procedure g_Options_SetDefaultVideo
;
121 target
, closest
, display
: TSDL_DisplayMode
;
124 (* Display 0 = Primary display *)
125 SDL_GetDesktopDisplayMode(0, @display
);
126 {$IF DEFINED(ANDROID)}
127 gScreenWidth
:= display
.w
;
128 gScreenHeight
:= display
.h
;
129 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
131 gFullScreen
:= True; (* rotation not allowed? *)
133 (* Window must be smaller than display *)
134 closest
.w
:= display
.w
;
135 closest
.h
:= display
.h
;
137 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
139 if percentage
< 25 then
141 closest
.w
:= display
.w
* 75 div 100;
142 closest
.h
:= display
.h
* 75 div 100;
145 target
.w
:= display
.w
* percentage
div 100;
146 target
.h
:= display
.h
* percentage
div 100;
147 target
.format
:= 0; (* didn't care *)
148 target
.refresh_rate
:= 0; (* didn't care *)
149 target
.driverdata
:= nil; (* init *)
150 SDL_GetClosestDisplayMode(0, @target
, @closest
);
153 gScreenWidth
:= closest
.w
;
154 gScreenHeight
:= closest
.h
;
155 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
157 gFullScreen
:= False;
159 (* Must be positioned on primary display *)
160 gWinRealPosX
:= SDL_WINDOWPOS_CENTERED
;
161 gWinRealPosY
:= SDL_WINDOWPOS_CENTERED
;
162 gWinMaximized
:= False;
164 gTextureFilter
:= True;
165 glLegacyNPOT
:= False;
166 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
167 g_Console_ResetBinds
;
170 procedure g_Options_SetDefault();
179 gMuteWhenInactive
:= False;
180 gAnnouncer
:= ANNOUNCE_MEPLUS
;
181 gSoundEffectsDF
:= True;
182 gUseChatSounds
:= True;
183 gsSDLSampleRate
:= 44100;
184 gsSDLBufferSize
:= 2048;
186 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
188 with gPlayer1Settings
do
190 Name
:= GenPlayerName(1);
191 Model
:= STD_PLAYER_MODEL
;
192 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
193 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
194 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
198 with gPlayer2Settings
do
200 Name
:= GenPlayerName(2);
201 Model
:= STD_PLAYER_MODEL
;
202 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
203 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
204 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
208 (* section Joysticks *)
209 for i
:= 0 to e_MaxJoys
- 1 do
211 e_JoystickDeadzones
[i
] := 8192
216 g_Shells_SetMax(300);
218 g_Corpses_SetMax(20);
220 ITEM_RESPAWNTIME
:= 60 * 36;
226 gDrawBackGround
:= True;
227 gShowMessages
:= True;
228 gRevertPlayers
:= False;
230 gPlayerIndicator
:= True;
232 gSFSFastMode
:= False;
233 e_FastScreenshots
:= True;
234 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
235 gBerserkAutoswitch
:= True;
238 gAskLanguage
:= True;
239 gLanguage
:= LANGUAGE_ENGLISH
;
241 (* section GameplayCustom *)
243 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
248 gcTeamDamage
:= False;
250 gcWeaponStay
:= False;
252 gcBotsVS
:= 'Everybody';
254 (* section GameplayNetwork *)
256 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
261 gnTeamDamage
:= False;
263 gnWeaponStay
:= False;
265 gnBotsVS
:= 'Everybody';
267 (* section MasterServer *)
268 NetSlistIP
:= 'mpms.doom2d.org';
269 NetSlistPort
:= 25665;
270 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
273 NetServerName
:= 'Unnamed Server';
277 NetAllowRCON
:= False;
278 NetRCONPassword
:= 'default';
279 NetUseMaster
:= True;
282 NetMasterRate
:= 60000;
283 NetForwardPorts
:= False;
287 NetForcePlayerUpdate
:= False;
288 NetPredictSelf
:= True;
289 NetClientIP
:= '127.0.0.1';
290 NetClientPort
:= NetPort
;
293 procedure g_Options_Read(FileName
: String);
299 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
301 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
304 procedure ReadInteger (VAR v
: LongWord; param
: String; minv
: LongWord = Low(LongWord); maxv
: LongWord = High(LongWord)); overload
;
306 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
309 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
311 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
314 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
316 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
319 procedure ReadBoolean (VAR v
: Boolean; param
: String);
321 v
:= config
.ReadBool(section
, param
, v
)
324 procedure ReadString (VAR v
: String; param
: String);
326 v
:= config
.ReadStr(section
, param
, v
)
330 gAskLanguage
:= True;
331 e_WriteLog('Reading config', TMsgType
.Notify
);
332 g_Options_SetDefault
;
334 if FileExists(FileName
) = False then
336 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
337 g_Options_SetDefaultVideo
;
341 config
:= TConfig
.CreateFile(FileName
);
344 ReadInteger(gScreenWidth
, 'ScreenWidth', 0);
345 ReadInteger(gScreenHeight
, 'ScreenHeight', 0);
346 ReadInteger(gWinRealPosX
, 'WinPosX', 60);
347 ReadInteger(gWinRealPosY
, 'WinPosY', 60);
348 ReadBoolean(gFullScreen
, 'Fullscreen');
349 ReadBoolean(gWinMaximized
, 'Maximized');
350 ReadInteger(gBPP
, 'BPP', 0);
351 ReadInteger(gFreq
, 'Freq', 0);
352 ReadBoolean(gVSync
, 'VSync');
353 ReadBoolean(gTextureFilter
, 'TextureFilter');
354 ReadBoolean(glLegacyNPOT
, 'LegacyCompatible');
357 ReadBoolean(gNoSound
, 'NoSound');
358 ReadInteger(gSoundLevel
, 'SoundLevel', 0, 255);
359 ReadInteger(gMusicLevel
, 'MusicLevel', 0, 255);
360 ReadInteger(gMaxSimSounds
, 'MaxSimSounds', 2, 66);
361 ReadBoolean(gMuteWhenInactive
, 'MuteInactive');
362 ReadInteger(gAnnouncer
, 'Announcer', ANNOUNCE_NONE
, ANNOUNCE_ALL
);
363 ReadBoolean(gSoundEffectsDF
, 'SoundEffectsDF');
364 ReadBoolean(gUseChatSounds
, 'ChatSounds');
365 ReadInteger(gsSDLSampleRate
, 'SDLSampleRate', 11025, 96000);
366 ReadInteger(gsSDLBufferSize
, 'SDLBufferSize', 64, 16384);
368 section
:= 'Player1';
369 with gPlayer1Settings
do
371 ReadString(Name
, 'name');
372 ReadString(Model
, 'model');
373 ReadInteger(Color
.R
, 'red', 0, 255);
374 ReadInteger(Color
.G
, 'green', 0, 255);
375 ReadInteger(Color
.B
, 'blue', 0, 255);
376 ReadInteger(Team
, 'team');
377 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
381 section
:= 'Player2';
382 with gPlayer2Settings
do
384 ReadString(Name
, 'name');
385 ReadString(Model
, 'model');
386 ReadInteger(Color
.R
, 'red', 0, 255);
387 ReadInteger(Color
.G
, 'green', 0, 255);
388 ReadInteger(Color
.B
, 'blue', 0, 255);
389 ReadInteger(Team
, 'team');
390 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
394 section
:= 'Joysticks';
395 for i
:= 0 to e_MaxJoys
- 1 do
397 ReadInteger(e_JoystickDeadzones
[i
], 'Deadzone' + IntToStr(i
))
401 ReadInteger(i
, 'MaxParticles', 0, 50000); g_GFX_SetMax(i
);
402 ReadInteger(i
, 'MaxShells', 0, 600); g_Shells_SetMax(i
);
403 ReadInteger(i
, 'MaxGibs', 0, 500); g_Gibs_SetMax(i
);
404 ReadInteger(i
, 'MaxCorpses', 0, 100); g_Corpses_SetMax(i
);
405 ReadInteger(i
, 'GibsCount');
411 else gGibsCount
:= 48;
413 i
:= ITEM_RESPAWNTIME
div 36; ReadInteger(i
, 'ItemRespawnTime', 0); ITEM_RESPAWNTIME
:= i
* 36;
414 ReadInteger(gBloodCount
, 'BloodCount', 0, 4);
415 ReadBoolean(gAdvBlood
, 'AdvancesBlood');
416 ReadBoolean(gAdvCorpses
, 'AdvancesCorpses');
417 ReadBoolean(gAdvGibs
, 'AdvancesGibs');
418 ReadInteger(gFlash
, 'Flash', 0, 2);
419 ReadBoolean(gDrawBackGround
, 'BackGround');
420 ReadBoolean(gShowMessages
, 'Messages');
421 ReadBoolean(gRevertPlayers
, 'RevertPlayers');
422 ReadInteger(gChatBubble
, 'ChatBubble', 0, 4);
423 ReadBoolean(gPlayerIndicator
, 'PlayerIndicator');
424 ReadBoolean(gSFSDebug
, 'SFSDebug'); wadoptDebug
:= gSFSDebug
;
425 ReadBoolean(gSFSFastMode
, 'SFSFastMode'); wadoptFast
:= gSFSFastMode
;
426 ReadBoolean(e_FastScreenshots
, 'FastScreenshots');
427 ReadString(gDefaultMegawadStart
, 'DefaultMegawadStart');
428 ReadBoolean(gBerserkAutoswitch
, 'BerserkAutoswitching');
429 i
:= Trunc(g_dbg_scale
* 100); ReadInteger(i
, 'Scale', 100); g_dbg_scale
:= i
/ 100;
430 ReadString(gLanguage
, 'Language');
431 if (gLanguage
= LANGUAGE_RUSSIAN
) or (gLanguage
= LANGUAGE_ENGLISH
) then
432 gAskLanguage
:= False
434 gLanguage
:= LANGUAGE_ENGLISH
;
436 section
:= 'GameplayCustom';
437 ReadString(gcMap
, 'Map');
438 ReadString(gcGameMode
, 'GameMode');
439 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
440 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
441 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
442 ReadInteger(gcPlayers
, 'Players', 0, 2);
443 ReadBoolean(gcTeamDamage
, 'TeamDamage');
444 ReadBoolean(gcAllowExit
, 'AllowExit');
445 ReadBoolean(gcWeaponStay
, 'WeaponStay');
446 ReadBoolean(gcMonsters
, 'Monsters');
447 ReadString(gcBotsVS
, 'BotsVS');
449 with gGameSettings
do
451 GameMode
:= g_Game_TextToMode(gcGameMode
);
452 if GameMode
= GM_NONE
then
454 if GameMode
= GM_SINGLE
then
456 TimeLimit
:= gcTimeLimit
;
457 GoalLimit
:= gcGoalLimit
;
458 MaxLives
:= gcMaxLives
;
462 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
464 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
466 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
468 Options
:= Options
or GAME_OPTION_MONSTERS
;
469 if gcBotsVS
= 'Everybody' then
470 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
471 if gcBotsVS
= 'Players' then
472 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
473 if gcBotsVS
= 'Monsters' then
474 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
477 section
:= 'GameplayNetwork';
478 ReadString(gnMap
, 'Map');
479 ReadString(gnGameMode
, 'GameMode');
480 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
481 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
482 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
483 ReadInteger(gnPlayers
, 'Players', 0, 2);
484 ReadBoolean(gnTeamDamage
, 'TeamDamage');
485 ReadBoolean(gnAllowExit
, 'AllowExit');
486 ReadBoolean(gnWeaponStay
, 'WeaponStay');
487 ReadBoolean(gnMonsters
, 'Monsters');
488 ReadString(gnBotsVS
, 'BotsVS');
490 section
:= 'MasterServer';
491 ReadString(NetSlistIP
, 'IP');
492 ReadInteger(NetSlistPort
, 'Port', 0, 65535);
493 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
496 ReadString(NetServerName
, 'Name');
497 ReadString(NetPassword
, 'Password');
498 ReadInteger(NetPort
, 'Port', 0, 65535);
499 ReadInteger(NetMaxClients
, 'MaxClients', 0, NET_MAXCLIENTS
);
500 ReadBoolean(NetAllowRCON
, 'RCON');
501 ReadString(NetRCONPassword
, 'RCONPassword');
502 ReadBoolean(NetUseMaster
, 'SyncWithMaster');
503 ReadInteger(NetUpdateRate
, 'UpdateInterval', 0);
504 ReadInteger(NetRelupdRate
, 'ReliableUpdateInterval', 0);
505 ReadInteger(NetMasterRate
, 'MasterSyncInterval', 1);
506 ReadBoolean(NetForwardPorts
, 'ForwardPorts');
509 ReadInteger(NetInterpLevel
, 'InterpolationSteps', 0);
510 ReadBoolean(NetForcePlayerUpdate
, 'ForcePlayerUpdate');
511 ReadBoolean(NetPredictSelf
, 'PredictSelf');
512 ReadString(NetClientIP
, 'LastIP');
513 ReadInteger(NetClientPort
, 'LastPort', 0, 65535);
517 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
520 procedure g_Options_Write(FileName
: String);
525 e_WriteLog('Writing config', TMsgType
.Notify
);
527 config
:= TConfig
.CreateFile(FileName
);
529 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
530 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
531 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
532 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
533 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
534 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
535 config
.WriteInt('Video', 'BPP', gBPP
);
536 config
.WriteBool('Video', 'VSync', gVSync
);
537 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
538 config
.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT
);
540 config
.WriteBool('Sound', 'NoSound', gNoSound
);
541 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
542 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
543 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
544 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
545 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
546 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
547 config
.WriteBool('Sound', 'ChatSounds', gUseChatSounds
);
548 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
549 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
551 with config
, gPlayer1Settings
do
553 WriteStr('Player1', 'Name', Name
);
554 WriteStr('Player1', 'model', Model
);
555 WriteInt('Player1', 'red', Color
.R
);
556 WriteInt('Player1', 'green', Color
.G
);
557 WriteInt('Player1', 'blue', Color
.B
);
558 WriteInt('Player1', 'team', Team
);
561 with config
, gPlayer2Settings
do
563 WriteStr('Player2', 'Name', Name
);
564 WriteStr('Player2', 'model', Model
);
565 WriteInt('Player2', 'red', Color
.R
);
566 WriteInt('Player2', 'green', Color
.G
);
567 WriteInt('Player2', 'blue', Color
.B
);
568 WriteInt('Player2', 'team', Team
);
571 for i
:= 0 to e_MaxJoys
-1 do
572 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
576 0: config
.WriteInt('Game', 'GibsCount', 0);
577 8: config
.WriteInt('Game', 'GibsCount', 1);
578 16: config
.WriteInt('Game', 'GibsCount', 2);
579 32: config
.WriteInt('Game', 'GibsCount', 3);
580 else config
.WriteInt('Game', 'GibsCount', 4);
583 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
584 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
585 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
586 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
587 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
588 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
589 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
590 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
591 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
592 config
.WriteInt('Game', 'Flash', gFlash
);
593 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
594 config
.WriteBool('Game', 'Messages', gShowMessages
);
595 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
596 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
597 config
.WriteBool('Game', 'PlayerIndicator', gPlayerIndicator
);
598 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
599 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
600 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
601 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
602 config
.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch
);
603 config
.WriteInt('Game', 'Scale', Round(g_dbg_scale
* 100));
605 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
606 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
607 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
608 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
609 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
610 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
611 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
612 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
613 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
614 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
615 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
617 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
618 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
619 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
620 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
621 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
622 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
623 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
624 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
625 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
626 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
627 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
629 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
630 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
632 config
.WriteStr ('Server', 'Name', NetServerName
);
633 config
.WriteStr ('Server', 'Password', NetPassword
);
634 config
.WriteInt ('Server', 'Port', NetPort
);
635 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
636 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
637 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
638 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
639 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
640 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
641 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
642 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
644 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
645 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
646 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
647 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
648 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
650 config
.SaveFile(FileName
);
654 procedure g_Options_Write_Language(FileName
: String);
658 e_WriteLog('Writing language config', TMsgType
.Notify
);
660 config
:= TConfig
.CreateFile(FileName
);
661 config
.WriteStr('Game', 'Language', gLanguage
);
662 config
.SaveFile(FileName
);
666 procedure g_Options_Write_Video(FileName
: String);
671 e_WriteLog('Writing resolution to config', TMsgType
.Notify
);
673 config
:= TConfig
.CreateFile(FileName
);
675 if gWinMaximized
and (not gFullscreen
) then
685 e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX
, gWinSizeY
, gScreenWidth
, gScreenHeight
]);
687 config
.WriteInt('Video', 'ScreenWidth', sW
);
688 config
.WriteInt('Video', 'ScreenHeight', sH
);
689 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
690 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
691 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
692 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
694 config
.WriteStr('Player1', 'Name', gPlayer1Settings
.Name
);
695 config
.WriteStr('Player2', 'Name', gPlayer2Settings
.Name
);
697 config
.SaveFile(FileName
);
701 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
705 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
707 config
:= TConfig
.CreateFile(FileName
);
709 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
710 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
711 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
712 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
713 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
714 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
715 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
716 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
717 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
718 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
719 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
721 config
.SaveFile(FileName
);
725 procedure g_Options_Write_Gameplay_Net(FileName
: String);
729 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
731 config
:= TConfig
.CreateFile(FileName
);
733 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
734 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
735 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
736 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
737 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
738 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
739 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
740 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
741 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
742 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
743 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
745 config
.SaveFile(FileName
);
749 procedure g_Options_Write_Net_Server(FileName
: String);
753 e_WriteLog('Writing server config', TMsgType
.Notify
);
755 config
:= TConfig
.CreateFile(FileName
);
757 config
.WriteStr ('Server', 'Name', NetServerName
);
758 config
.WriteStr ('Server', 'Password', NetPassword
);
759 config
.WriteInt ('Server', 'Port', NetPort
);
760 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
761 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
762 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
764 config
.SaveFile(FileName
);
768 procedure g_Options_Write_Net_Client(FileName
: String);
772 e_WriteLog('Writing client config', TMsgType
.Notify
);
774 config
:= TConfig
.CreateFile(FileName
);
776 config
.WriteStr('Client', 'LastIP', NetClientIP
);
777 config
.WriteInt('Client', 'LastPort', NetClientPort
);
779 config
.SaveFile(FileName
);
785 machine
:= Random(10000)