1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
21 g_language
, g_weapons
;
23 function GenPlayerName (n
: Integer): String;
25 procedure g_Options_SetDefault();
26 procedure g_Options_Read(FileName
: String);
27 procedure g_Options_Write(FileName
: String);
28 procedure g_Options_Write_Language(FileName
: String);
29 procedure g_Options_Write_Video(FileName
: String);
30 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
31 procedure g_Options_Write_Gameplay_Net(FileName
: String);
32 procedure g_Options_Write_Net_Server(FileName
: String);
33 procedure g_Options_Write_Net_Client(FileName
: String);
35 const DF_Default_Megawad_Start
= 'megawads/DOOM2D.WAD:\MAP01';
38 // gGameControls: TControls;
41 gWinRealPosX
: Integer;
42 gWinRealPosY
: Integer;
46 gWinMaximized
: Boolean;
48 glLegacyNPOT
: Boolean;
49 gTextureFilter
: Boolean;
54 gMuteWhenInactive
: Boolean;
61 gDrawBackGround
: Boolean;
62 gShowMessages
: Boolean;
63 gRevertPlayers
: Boolean;
65 gAskLanguage
: Boolean;
72 gcTeamDamage
: Boolean;
74 gcWeaponStay
: Boolean;
83 gnTeamDamage
: Boolean;
85 gnWeaponStay
: Boolean;
88 gsSDLSampleRate
: Integer;
89 gsSDLBufferSize
: Integer;
91 gSFSFastMode
: Boolean;
92 gDefaultMegawadStart
: AnsiString;
93 gBerserkAutoswitch
: Boolean;
98 {$INCLUDE ../nogl/noGLuses.inc}
102 e_log
, e_input
, g_console
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
103 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
104 g_items
, wadreader
, e_graphics
, g_touch
, envvars
;
109 function GenPlayerName (n
: Integer): String;
112 Result
:= GetUserName
;
114 Result
:= 'Player' + IntToStr(machine
MOD 10000);
116 Result
:= Copy(Result
, 1, 12) + ' '
118 Result
:= Copy(Result
, 1, 10) + ' ' + IntToStr(n
)
122 procedure g_Options_SetDefaultVideo
;
124 target
, closest
, display
: TSDL_DisplayMode
;
127 (* Display 0 = Primary display *)
128 SDL_GetDesktopDisplayMode(0, @display
);
129 {$IF DEFINED(ANDROID)}
130 gScreenWidth
:= display
.w
;
131 gScreenHeight
:= display
.h
;
132 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
134 gFullScreen
:= True; (* rotation not allowed? *)
136 (* Window must be smaller than display *)
137 closest
.w
:= display
.w
;
138 closest
.h
:= display
.h
;
140 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
142 if percentage
< 25 then
144 closest
.w
:= display
.w
* 75 div 100;
145 closest
.h
:= display
.h
* 75 div 100;
148 target
.w
:= display
.w
* percentage
div 100;
149 target
.h
:= display
.h
* percentage
div 100;
150 target
.format
:= 0; (* didn't care *)
151 target
.refresh_rate
:= 0; (* didn't care *)
152 target
.driverdata
:= nil; (* init *)
153 SDL_GetClosestDisplayMode(0, @target
, @closest
);
156 gScreenWidth
:= closest
.w
;
157 gScreenHeight
:= closest
.h
;
158 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
160 gFullScreen
:= False;
162 (* Must be positioned on primary display *)
163 gWinRealPosX
:= SDL_WINDOWPOS_CENTERED
;
164 gWinRealPosY
:= SDL_WINDOWPOS_CENTERED
;
165 gWinMaximized
:= False;
167 gTextureFilter
:= True;
168 glLegacyNPOT
:= False;
169 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
170 g_Console_ResetBinds
;
173 procedure g_Options_SetDefaultVideo
;
177 gScreenHeight
:= 480;
179 gFullScreen
:= False;
182 gWinMaximized
:= False;
184 gTextureFilter
:= True;
185 glLegacyNPOT
:= False;
186 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
187 g_Console_ResetBinds
;
191 procedure g_Options_SetDefault();
200 gMuteWhenInactive
:= False;
201 gAnnouncer
:= ANNOUNCE_MEPLUS
;
202 gSoundEffectsDF
:= True;
203 gUseChatSounds
:= True;
204 gsSDLSampleRate
:= 44100;
205 gsSDLBufferSize
:= 2048;
207 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
209 with gPlayer1Settings
do
211 Name
:= GenPlayerName(1);
212 Model
:= STD_PLAYER_MODEL
;
213 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
214 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
215 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
219 with gPlayer2Settings
do
221 Name
:= GenPlayerName(2);
222 Model
:= STD_PLAYER_MODEL
;
223 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
224 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
225 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
229 (* section Joysticks *)
230 for i
:= 0 to e_MaxJoys
- 1 do
232 e_JoystickDeadzones
[i
] := 8192
237 g_Shells_SetMax(300);
239 g_Corpses_SetMax(20);
241 ITEM_RESPAWNTIME
:= 60 * 36;
247 gDrawBackGround
:= True;
248 gShowMessages
:= True;
249 gRevertPlayers
:= False;
252 gSFSFastMode
:= False;
253 e_FastScreenshots
:= True;
254 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
255 gBerserkAutoswitch
:= True;
258 gAskLanguage
:= True;
259 gLanguage
:= LANGUAGE_ENGLISH
;
261 (* section GameplayCustom *)
263 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
268 gcTeamDamage
:= False;
270 gcWeaponStay
:= False;
272 gcBotsVS
:= 'Everybody';
274 (* section GameplayNetwork *)
276 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
281 gnTeamDamage
:= False;
283 gnWeaponStay
:= False;
285 gnBotsVS
:= 'Everybody';
287 (* section MasterServer *)
288 NetSlistIP
:= 'mpms.doom2d.org';
289 NetSlistPort
:= 25665;
290 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
293 NetServerName
:= 'Unnamed Server';
297 NetAllowRCON
:= False;
298 NetRCONPassword
:= 'default';
299 NetUseMaster
:= True;
302 NetMasterRate
:= 60000;
303 NetForwardPorts
:= False;
307 NetForcePlayerUpdate
:= False;
308 NetPredictSelf
:= True;
309 NetClientIP
:= '127.0.0.1';
310 NetClientPort
:= NetPort
;
313 procedure g_Options_Read(FileName
: String);
319 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
321 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
324 procedure ReadInteger (VAR v
: LongWord; param
: String; minv
: LongWord = Low(LongWord); maxv
: LongWord = High(LongWord)); overload
;
326 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
329 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
331 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
334 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
336 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
339 procedure ReadBoolean (VAR v
: Boolean; param
: String);
341 v
:= config
.ReadBool(section
, param
, v
)
344 procedure ReadString (VAR v
: String; param
: String);
346 v
:= config
.ReadStr(section
, param
, v
)
350 gAskLanguage
:= True;
351 e_WriteLog('Reading config', TMsgType
.Notify
);
352 g_Options_SetDefault
;
354 if FileExists(FileName
) = False then
356 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
357 g_Options_SetDefaultVideo
;
361 config
:= TConfig
.CreateFile(FileName
);
364 ReadInteger(gScreenWidth
, 'ScreenWidth', 0);
365 ReadInteger(gScreenHeight
, 'ScreenHeight', 0);
366 ReadInteger(gWinRealPosX
, 'WinPosX', 60);
367 ReadInteger(gWinRealPosY
, 'WinPosY', 60);
368 ReadBoolean(gFullScreen
, 'Fullscreen');
369 ReadBoolean(gWinMaximized
, 'Maximized');
370 ReadInteger(gBPP
, 'BPP', 0);
371 ReadInteger(gFreq
, 'Freq', 0);
372 ReadBoolean(gVSync
, 'VSync');
373 ReadBoolean(gTextureFilter
, 'TextureFilter');
374 ReadBoolean(glLegacyNPOT
, 'LegacyCompatible');
377 ReadBoolean(gNoSound
, 'NoSound');
378 ReadInteger(gSoundLevel
, 'SoundLevel', 0, 255);
379 ReadInteger(gMusicLevel
, 'MusicLevel', 0, 255);
380 ReadInteger(gMaxSimSounds
, 'MaxSimSounds', 2, 66);
381 ReadBoolean(gMuteWhenInactive
, 'MuteInactive');
382 ReadInteger(gAnnouncer
, 'Announcer', ANNOUNCE_NONE
, ANNOUNCE_ALL
);
383 ReadBoolean(gSoundEffectsDF
, 'SoundEffectsDF');
384 ReadBoolean(gUseChatSounds
, 'ChatSounds');
385 ReadInteger(gsSDLSampleRate
, 'SDLSampleRate', 11025, 96000);
386 ReadInteger(gsSDLBufferSize
, 'SDLBufferSize', 64, 16384);
388 section
:= 'Player1';
389 with gPlayer1Settings
do
391 ReadString(Name
, 'name');
392 ReadString(Model
, 'model');
393 ReadInteger(Color
.R
, 'red', 0, 255);
394 ReadInteger(Color
.G
, 'green', 0, 255);
395 ReadInteger(Color
.B
, 'blue', 0, 255);
396 ReadInteger(Team
, 'team');
397 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
401 section
:= 'Player2';
402 with gPlayer2Settings
do
404 ReadString(Name
, 'name');
405 ReadString(Model
, 'model');
406 ReadInteger(Color
.R
, 'red', 0, 255);
407 ReadInteger(Color
.G
, 'green', 0, 255);
408 ReadInteger(Color
.B
, 'blue', 0, 255);
409 ReadInteger(Team
, 'team');
410 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
414 section
:= 'Joysticks';
415 for i
:= 0 to e_MaxJoys
- 1 do
417 ReadInteger(e_JoystickDeadzones
[i
], 'Deadzone' + IntToStr(i
))
421 ReadInteger(i
, 'MaxParticles', 0, 50000); g_GFX_SetMax(i
);
422 ReadInteger(i
, 'MaxShells', 0, 600); g_Shells_SetMax(i
);
423 ReadInteger(i
, 'MaxGibs', 0, 500); g_Gibs_SetMax(i
);
424 ReadInteger(i
, 'MaxCorpses', 0, 100); g_Corpses_SetMax(i
);
425 ReadInteger(i
, 'GibsCount');
431 else gGibsCount
:= 48;
433 i
:= ITEM_RESPAWNTIME
div 36; ReadInteger(i
, 'ItemRespawnTime', 0); ITEM_RESPAWNTIME
:= i
* 36;
434 ReadInteger(gBloodCount
, 'BloodCount', 0, 4);
435 ReadBoolean(gAdvBlood
, 'AdvancesBlood');
436 ReadBoolean(gAdvCorpses
, 'AdvancesCorpses');
437 ReadBoolean(gAdvGibs
, 'AdvancesGibs');
438 ReadInteger(gFlash
, 'Flash', 0, 2);
439 ReadBoolean(gDrawBackGround
, 'BackGround');
440 ReadBoolean(gShowMessages
, 'Messages');
441 ReadBoolean(gRevertPlayers
, 'RevertPlayers');
442 ReadInteger(gChatBubble
, 'ChatBubble', 0, 4);
443 ReadBoolean(gSFSDebug
, 'SFSDebug'); wadoptDebug
:= gSFSDebug
;
444 ReadBoolean(gSFSFastMode
, 'SFSFastMode'); wadoptFast
:= gSFSFastMode
;
445 ReadBoolean(e_FastScreenshots
, 'FastScreenshots');
446 ReadString(gDefaultMegawadStart
, 'DefaultMegawadStart');
447 ReadBoolean(gBerserkAutoswitch
, 'BerserkAutoswitching');
448 i
:= Trunc(g_dbg_scale
* 100); ReadInteger(i
, 'Scale', 100); g_dbg_scale
:= i
/ 100;
449 ReadString(gLanguage
, 'Language');
450 if (gLanguage
= LANGUAGE_RUSSIAN
) or (gLanguage
= LANGUAGE_ENGLISH
) then
451 gAskLanguage
:= False
453 gLanguage
:= LANGUAGE_ENGLISH
;
455 section
:= 'GameplayCustom';
456 ReadString(gcMap
, 'Map');
457 ReadString(gcGameMode
, 'GameMode');
458 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
459 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
460 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
461 ReadInteger(gcPlayers
, 'Players', 0, 2);
462 ReadBoolean(gcTeamDamage
, 'TeamDamage');
463 ReadBoolean(gcAllowExit
, 'AllowExit');
464 ReadBoolean(gcWeaponStay
, 'WeaponStay');
465 ReadBoolean(gcMonsters
, 'Monsters');
466 ReadString(gcBotsVS
, 'BotsVS');
468 with gGameSettings
do
470 GameMode
:= g_Game_TextToMode(gcGameMode
);
471 if GameMode
= GM_NONE
then
473 if GameMode
= GM_SINGLE
then
475 TimeLimit
:= gcTimeLimit
;
476 GoalLimit
:= gcGoalLimit
;
477 MaxLives
:= gcMaxLives
;
481 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
483 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
485 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
487 Options
:= Options
or GAME_OPTION_MONSTERS
;
488 if gcBotsVS
= 'Everybody' then
489 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
490 if gcBotsVS
= 'Players' then
491 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
492 if gcBotsVS
= 'Monsters' then
493 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
496 section
:= 'GameplayNetwork';
497 ReadString(gnMap
, 'Map');
498 ReadString(gnGameMode
, 'GameMode');
499 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
500 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
501 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
502 ReadInteger(gnPlayers
, 'Players', 0, 2);
503 ReadBoolean(gnTeamDamage
, 'TeamDamage');
504 ReadBoolean(gnAllowExit
, 'AllowExit');
505 ReadBoolean(gnWeaponStay
, 'WeaponStay');
506 ReadBoolean(gnMonsters
, 'Monsters');
507 ReadString(gnBotsVS
, 'BotsVS');
509 section
:= 'MasterServer';
510 ReadString(NetSlistIP
, 'IP');
511 ReadInteger(NetSlistPort
, 'Port', 0, 65535);
512 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
515 ReadString(NetServerName
, 'Name');
516 ReadString(NetPassword
, 'Password');
517 ReadInteger(NetPort
, 'Port', 0, 65535);
518 ReadInteger(NetMaxClients
, 'MaxClients', 0, NET_MAXCLIENTS
);
519 ReadBoolean(NetAllowRCON
, 'RCON');
520 ReadString(NetRCONPassword
, 'RCONPassword');
521 ReadBoolean(NetUseMaster
, 'SyncWithMaster');
522 ReadInteger(NetUpdateRate
, 'UpdateInterval', 0);
523 ReadInteger(NetRelupdRate
, 'ReliableUpdateInterval', 0);
524 ReadInteger(NetMasterRate
, 'MasterSyncInterval', 1);
525 ReadBoolean(NetForwardPorts
, 'ForwardPorts');
528 ReadInteger(NetInterpLevel
, 'InterpolationSteps', 0);
529 ReadBoolean(NetForcePlayerUpdate
, 'ForcePlayerUpdate');
530 ReadBoolean(NetPredictSelf
, 'PredictSelf');
531 ReadString(NetClientIP
, 'LastIP');
532 ReadInteger(NetClientPort
, 'LastPort', 0, 65535);
536 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
539 procedure g_Options_Write(FileName
: String);
544 e_WriteLog('Writing config', TMsgType
.Notify
);
546 config
:= TConfig
.CreateFile(FileName
);
548 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
549 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
550 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
551 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
552 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
553 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
554 config
.WriteInt('Video', 'BPP', gBPP
);
555 config
.WriteBool('Video', 'VSync', gVSync
);
556 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
557 config
.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT
);
559 config
.WriteBool('Sound', 'NoSound', gNoSound
);
560 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
561 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
562 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
563 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
564 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
565 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
566 config
.WriteBool('Sound', 'ChatSounds', gUseChatSounds
);
567 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
568 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
570 with config
, gPlayer1Settings
do
572 WriteStr('Player1', 'Name', Name
);
573 WriteStr('Player1', 'model', Model
);
574 WriteInt('Player1', 'red', Color
.R
);
575 WriteInt('Player1', 'green', Color
.G
);
576 WriteInt('Player1', 'blue', Color
.B
);
577 WriteInt('Player1', 'team', Team
);
580 with config
, gPlayer2Settings
do
582 WriteStr('Player2', 'Name', Name
);
583 WriteStr('Player2', 'model', Model
);
584 WriteInt('Player2', 'red', Color
.R
);
585 WriteInt('Player2', 'green', Color
.G
);
586 WriteInt('Player2', 'blue', Color
.B
);
587 WriteInt('Player2', 'team', Team
);
590 for i
:= 0 to e_MaxJoys
-1 do
591 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
595 0: config
.WriteInt('Game', 'GibsCount', 0);
596 8: config
.WriteInt('Game', 'GibsCount', 1);
597 16: config
.WriteInt('Game', 'GibsCount', 2);
598 32: config
.WriteInt('Game', 'GibsCount', 3);
599 else config
.WriteInt('Game', 'GibsCount', 4);
602 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
603 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
604 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
605 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
606 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
607 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
608 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
609 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
610 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
611 config
.WriteInt('Game', 'Flash', gFlash
);
612 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
613 config
.WriteBool('Game', 'Messages', gShowMessages
);
614 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
615 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
616 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
617 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
618 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
619 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
620 config
.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch
);
621 config
.WriteInt('Game', 'Scale', Round(g_dbg_scale
* 100));
623 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
624 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
625 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
626 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
627 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
628 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
629 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
630 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
631 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
632 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
633 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
635 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
636 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
637 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
638 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
639 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
640 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
641 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
642 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
643 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
644 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
645 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
647 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
648 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
650 config
.WriteStr ('Server', 'Name', NetServerName
);
651 config
.WriteStr ('Server', 'Password', NetPassword
);
652 config
.WriteInt ('Server', 'Port', NetPort
);
653 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
654 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
655 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
656 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
657 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
658 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
659 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
660 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
662 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
663 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
664 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
665 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
666 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
668 config
.SaveFile(FileName
);
672 procedure g_Options_Write_Language(FileName
: String);
676 e_WriteLog('Writing language config', TMsgType
.Notify
);
678 config
:= TConfig
.CreateFile(FileName
);
679 config
.WriteStr('Game', 'Language', gLanguage
);
680 config
.SaveFile(FileName
);
684 procedure g_Options_Write_Video(FileName
: String);
689 e_WriteLog('Writing resolution to config', TMsgType
.Notify
);
691 config
:= TConfig
.CreateFile(FileName
);
693 if gWinMaximized
and (not gFullscreen
) then
703 e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX
, gWinSizeY
, gScreenWidth
, gScreenHeight
]);
705 config
.WriteInt('Video', 'ScreenWidth', sW
);
706 config
.WriteInt('Video', 'ScreenHeight', sH
);
707 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
708 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
709 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
710 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
712 config
.WriteStr('Player1', 'Name', gPlayer1Settings
.Name
);
713 config
.WriteStr('Player2', 'Name', gPlayer2Settings
.Name
);
715 config
.SaveFile(FileName
);
719 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
723 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
725 config
:= TConfig
.CreateFile(FileName
);
727 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
728 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
729 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
730 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
731 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
732 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
733 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
734 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
735 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
736 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
737 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
739 config
.SaveFile(FileName
);
743 procedure g_Options_Write_Gameplay_Net(FileName
: String);
747 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
749 config
:= TConfig
.CreateFile(FileName
);
751 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
752 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
753 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
754 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
755 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
756 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
757 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
758 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
759 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
760 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
761 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
763 config
.SaveFile(FileName
);
767 procedure g_Options_Write_Net_Server(FileName
: String);
771 e_WriteLog('Writing server config', TMsgType
.Notify
);
773 config
:= TConfig
.CreateFile(FileName
);
775 config
.WriteStr ('Server', 'Name', NetServerName
);
776 config
.WriteStr ('Server', 'Password', NetPassword
);
777 config
.WriteInt ('Server', 'Port', NetPort
);
778 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
779 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
780 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
782 config
.SaveFile(FileName
);
786 procedure g_Options_Write_Net_Client(FileName
: String);
790 e_WriteLog('Writing client config', TMsgType
.Notify
);
792 config
:= TConfig
.CreateFile(FileName
);
794 config
.WriteStr('Client', 'LastIP', NetClientIP
);
795 config
.WriteInt('Client', 'LastPort', NetClientPort
);
797 config
.SaveFile(FileName
);
803 machine
:= Random(10000)