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
;
25 TPlayerControl
= record
36 KeyWeapon
: array [WP_FIRST
..WP_LAST
] of Word;
48 KeyWeapon2
: array [WP_FIRST
..WP_LAST
] of Word;
51 TGameControls
= record
59 GameControls
: TGameControls
;
60 P1Control
: TPlayerControl
;
61 P2Control
: TPlayerControl
;
64 procedure g_Options_SetDefault();
65 procedure g_Options_Read(FileName
: String);
66 procedure g_Options_Write(FileName
: String);
67 procedure g_Options_Write_Language(FileName
: String);
68 procedure g_Options_Write_Video(FileName
: String);
69 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
70 procedure g_Options_Write_Gameplay_Net(FileName
: String);
71 procedure g_Options_Write_Net_Server(FileName
: String);
72 procedure g_Options_Write_Net_Client(FileName
: String);
74 const DF_Default_Megawad_Start
= 'megawads/DOOM2D.WAD:\MAP01';
77 gGameControls
: TControls
;
78 gScreenWidth
: Word = 800;
79 gScreenHeight
: Word = 600;
80 gWinRealPosX
: Integer = 0;
81 gWinRealPosY
: Integer = 0;
84 gFullscreen
: Boolean = False;
85 gWinMaximized
: Boolean = False;
86 gVSync
: Boolean = False;
87 glLegacyNPOT
: Boolean = False;
88 gTextureFilter
: Boolean = True;
89 gNoSound
: Boolean = False;
90 gSoundLevel
: Byte = 75;
91 gMusicLevel
: Byte = 65;
92 gMaxSimSounds
: Byte = 8;
93 gMuteWhenInactive
: Boolean = False;
94 gAdvCorpses
: Boolean = True;
95 gAdvBlood
: Boolean = True;
96 gAdvGibs
: Boolean = True;
97 gGibsCount
: Integer = 32;
98 gBloodCount
: Byte = 3;
100 gDrawBackGround
: Boolean = True;
101 gShowMessages
: Boolean = True;
102 gRevertPlayers
: Boolean = False;
103 gLanguage
: String = LANGUAGE_ENGLISH
;
104 gAskLanguage
: Boolean = True;
106 gcGameMode
: String = '';
107 gcTimeLimit
: Word = 0;
108 gcGoalLimit
: Word = 0;
109 gcMaxLives
: Byte = 0;
111 gcTeamDamage
: Boolean = False;
112 gcAllowExit
: Boolean = True;
113 gcWeaponStay
: Boolean = False;
114 gcMonsters
: Boolean = False;
115 gcBotsVS
: String = 'Everybody';
117 gnGameMode
: String = '';
118 gnTimeLimit
: Word = 0;
119 gnGoalLimit
: Word = 0;
120 gnMaxLives
: Byte = 0;
122 gnTeamDamage
: Boolean = False;
123 gnAllowExit
: Boolean = True;
124 gnWeaponStay
: Boolean = False;
125 gnMonsters
: Boolean = False;
126 gnBotsVS
: String = 'Everybody';
127 gsSDLSampleRate
: Integer = 44100;
128 gsSDLBufferSize
: Integer = 2048;
129 gSFSDebug
: Boolean = False;
130 gSFSFastMode
: Boolean = False;
131 gDefaultMegawadStart
: AnsiString = DF_Default_Megawad_Start
;
132 gBerserkAutoswitch
: Boolean = True;
142 e_log
, e_input
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
143 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
144 g_items
, wadreader
, e_graphics
, g_touch
;
146 procedure g_Options_SetDefault();
150 g_Sound_SetupAllVolumes(75, 65);
152 gMuteWhenInactive
:= False;
153 gAnnouncer
:= ANNOUNCE_MEPLUS
;
154 gSoundEffectsDF
:= True;
155 gUseChatSounds
:= True;
158 g_Corpses_SetMax(20);
159 g_Shells_SetMax(300);
166 gDrawBackGround
:= True;
167 gShowMessages
:= True;
168 gRevertPlayers
:= False;
171 g_touch_fire
:= True;
172 g_touch_offset
:= 50;
173 g_touch_alt
:= False;
175 for i
:= 0 to e_MaxJoys
-1 do
176 e_JoystickDeadzones
[i
] := 8192;
178 with gGameControls
.GameControls
do
180 TakeScreenshot
:= 183;
183 TeamChat
:= 21; // [Y]
186 with gGameControls
.P1Control
do
199 KeyWeapon
[i
] := 30 + i
;
201 for i
:= 10 to High(KeyWeapon
) do
204 KeyRight2
:= VK_RIGHT
;
210 KeyNextWeapon2
:= VK_NEXT
;
211 KeyPrevWeapon2
:= VK_PREV
;
213 KeyStrafe2
:= VK_STRAFE
;
214 for i
:= 0 to High(KeyWeapon2
) do
215 KeyWeapon2
[i
] := VK_0
+ i
;
218 with gGameControls
.P2Control
do
230 for i
:= 0 to High(KeyWeapon
) do
243 for i
:= 0 to High(KeyWeapon2
) do
247 with gPlayer1Settings
do
250 Model
:= STD_PLAYER_MODEL
;
251 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
252 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
253 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
257 with gPlayer2Settings
do
260 Model
:= STD_PLAYER_MODEL
;
261 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
262 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
263 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
267 NetUseMaster
:= True;
268 NetForwardPorts
:= False;
269 g_Net_Slist_Set('mpms.doom2d.org', 25665);
272 procedure g_Options_Read(FileName
: String);
278 gAskLanguage
:= True;
279 e_WriteLog('Reading config', TMsgType
.Notify
);
281 if not FileExists(FileName
) then
283 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
284 g_Options_SetDefault();
286 // Default video options:
288 gScreenHeight
:= 600;
291 gWinMaximized
:= False;
292 gFullScreen
:= False;
295 gTextureFilter
:= True;
296 glLegacyNPOT
:= False;
301 config
:= TConfig
.CreateFile(FileName
);
303 gScreenWidth
:= config
.ReadInt('Video', 'ScreenWidth', 800);
304 if gScreenWidth
< 640 then
306 gScreenHeight
:= config
.ReadInt('Video', 'ScreenHeight', 600);
307 if gScreenHeight
< 480 then
308 gScreenHeight
:= 480;
309 gWinRealPosX
:= config
.ReadInt('Video', 'WinPosX', 60);
310 if gWinRealPosX
< 0 then
312 gWinRealPosY
:= config
.ReadInt('Video', 'WinPosY', 60);
313 if gWinRealPosY
< 0 then
315 gFullScreen
:= config
.ReadBool('Video', 'Fullscreen', False);
316 gWinMaximized
:= config
.ReadBool('Video', 'Maximized', False);
317 gBPP
:= config
.ReadInt('Video', 'BPP', 32);
318 gFreq
:= config
.ReadInt('Video', 'Freq', 0);
319 gVSync
:= config
.ReadBool('Video', 'VSync', True);
320 gTextureFilter
:= config
.ReadBool('Video', 'TextureFilter', True);
321 glLegacyNPOT
:= config
.ReadBool('Video', 'LegacyCompatible', False);
323 gNoSound
:= config
.ReadBool('Sound', 'NoSound', False);
324 gSoundLevel
:= Min(config
.ReadInt('Sound', 'SoundLevel', 75), 255);
325 gMusicLevel
:= Min(config
.ReadInt('Sound', 'MusicLevel', 65), 255);
326 gMaxSimSounds
:= Max(Min(config
.ReadInt('Sound', 'MaxSimSounds', 8), 66), 2);
327 gMuteWhenInactive
:= config
.ReadBool('Sound', 'MuteInactive', False);
328 gAnnouncer
:= Min(Max(config
.ReadInt('Sound', 'Announcer', ANNOUNCE_MEPLUS
), ANNOUNCE_NONE
), ANNOUNCE_ALL
);
329 gSoundEffectsDF
:= config
.ReadBool('Sound', 'SoundEffectsDF', True);
330 gUseChatSounds
:= config
.ReadBool('Sound', 'ChatSounds', True);
331 gsSDLSampleRate
:= Min(Max(config
.ReadInt('Sound', 'SDLSampleRate', 44100), 11025), 96000);
332 gsSDLBufferSize
:= Min(Max(config
.ReadInt('Sound', 'SDLBufferSize', 2048), 64), 16384);
334 with gGameControls
.GameControls
do
336 TakeScreenshot
:= config
.ReadInt('GameControls', 'TakeScreenshot', 183);
337 Stat
:= config
.ReadInt('GameControls', 'Stat', 15);
338 Chat
:= config
.ReadInt('GameControls', 'Chat', 20);
339 TeamChat
:= config
.ReadInt('GameControls', 'TeamChat', 21);
342 with gGameControls
.P1Control
, config
do
344 KeyRight
:= ReadInt('Player1', 'KeyRight', 33);
345 KeyLeft
:= ReadInt('Player1', 'KeyLeft', 31);
346 KeyUp
:= ReadInt('Player1', 'KeyUp', 18);
347 KeyDown
:= ReadInt('Player1', 'KeyDown', 32);
348 KeyFire
:= ReadInt('Player1', 'KeyFire', 30);
349 KeyJump
:= ReadInt('Player1', 'KeyJump', 16);
350 KeyNextWeapon
:= ReadInt('Player1', 'KeyNextWeapon', 19);
351 KeyPrevWeapon
:= ReadInt('Player1', 'KeyPrevWeapon', 17);
352 KeyOpen
:= ReadInt('Player1', 'KeyOpen', 58);
353 KeyStrafe
:= ReadInt('Player1', 'KeyStrafe', 0);
354 for i
:= 0 to High(KeyWeapon
) do
355 KeyWeapon
[i
] := ReadInt('Player1', 'KeyWeapon' + IntToStr(i
), 0);
357 KeyRight2
:= ReadInt('Player1', 'KeyRight2', 0);
358 KeyLeft2
:= ReadInt('Player1', 'KeyLeft2', 0);
359 KeyUp2
:= ReadInt('Player1', 'KeyUp2', 0);
360 KeyDown2
:= ReadInt('Player1', 'KeyDown2', 0);
361 KeyFire2
:= ReadInt('Player1', 'KeyFire2', 0);
362 KeyJump2
:= ReadInt('Player1', 'KeyJump2', 0);
363 KeyNextWeapon2
:= ReadInt('Player1', 'KeyNextWeapon2', 0);
364 KeyPrevWeapon2
:= ReadInt('Player1', 'KeyPrevWeapon2', 0);
365 KeyOpen2
:= ReadInt('Player1', 'KeyOpen2', 0);
366 KeyStrafe2
:= ReadInt('Player1', 'KeyStrafe2', 0);
367 for i
:= 0 to High(KeyWeapon2
) do
368 KeyWeapon2
[i
] := ReadInt('Player1', 'KeyWeapon2' + IntToStr(i
), 0);
371 with gPlayer1Settings
, config
do
373 Name
:= ReadStr('Player1', 'name', 'Player1');
374 Model
:= ReadStr('Player1', 'model', STD_PLAYER_MODEL
);
375 Color
.R
:= Min(Abs(ReadInt('Player1', 'red', PLAYER1_DEF_COLOR
.R
)), 255);
376 Color
.G
:= Min(Abs(ReadInt('Player1', 'green', PLAYER1_DEF_COLOR
.G
)), 255);
377 Color
.B
:= Min(Abs(ReadInt('Player1', 'blue', PLAYER1_DEF_COLOR
.B
)), 255);
378 Team
:= ReadInt('Player1', 'team', TEAM_RED
);
379 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
383 with gGameControls
.P2Control
, config
do
385 KeyRight
:= ReadInt('Player2', 'KeyRight', 205);
386 KeyLeft
:= ReadInt('Player2', 'KeyLeft', 203);
387 KeyUp
:= ReadInt('Player2', 'KeyUp', 200);
388 KeyDown
:= ReadInt('Player2', 'KeyDown', 208);
389 KeyFire
:= ReadInt('Player2', 'KeyFire', 184);
390 KeyJump
:= ReadInt('Player2', 'KeyJump', 157);
391 KeyNextWeapon
:= ReadInt('Player2', 'KeyNextWeapon', 73);
392 KeyPrevWeapon
:= ReadInt('Player2', 'KeyPrevWeapon', 71);
393 KeyOpen
:= ReadInt('Player2', 'KeyOpen', 54);
394 KeyStrafe
:= ReadInt('Player2', 'KeyStrafe', 0);
395 for i
:= 0 to High(KeyWeapon
) do
396 KeyWeapon
[i
] := ReadInt('Player2', 'KeyWeapon' + IntToStr(i
), 0);
398 KeyRight2
:= ReadInt('Player2', 'KeyRight2', 0);
399 KeyLeft2
:= ReadInt('Player2', 'KeyLeft2', 0);
400 KeyUp2
:= ReadInt('Player2', 'KeyUp2', 0);
401 KeyDown2
:= ReadInt('Player2', 'KeyDown2', 0);
402 KeyFire2
:= ReadInt('Player2', 'KeyFire2', 0);
403 KeyJump2
:= ReadInt('Player2', 'KeyJump2', 0);
404 KeyNextWeapon2
:= ReadInt('Player2', 'KeyNextWeapon2', 0);
405 KeyPrevWeapon2
:= ReadInt('Player2', 'KeyPrevWeapon2', 0);
406 KeyOpen2
:= ReadInt('Player2', 'KeyOpen2', 0);
407 KeyStrafe2
:= ReadInt('Player2', 'KeyStrafe2', 0);
408 for i
:= 0 to High(KeyWeapon2
) do
409 KeyWeapon2
[i
] := ReadInt('Player2', 'KeyWeapon2' + IntToStr(i
), 0);
412 with gPlayer2Settings
, config
do
414 Name
:= ReadStr('Player2', 'name', 'Player2');
415 Model
:= ReadStr('Player2', 'model', STD_PLAYER_MODEL
);
416 Color
.R
:= Min(Abs(ReadInt('Player2', 'red', PLAYER2_DEF_COLOR
.R
)), 255);
417 Color
.G
:= Min(Abs(ReadInt('Player2', 'green', PLAYER2_DEF_COLOR
.G
)), 255);
418 Color
.B
:= Min(Abs(ReadInt('Player2', 'blue', PLAYER2_DEF_COLOR
.B
)), 255);
419 Team
:= ReadInt('Player2', 'team', TEAM_BLUE
);
420 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
424 for i
:= 0 to e_MaxJoys
-1 do
425 e_JoystickDeadzones
[i
] := config
.ReadInt('Joysticks', 'Deadzone' + IntToStr(i
), 8192);
427 g_touch_size
:= Max(config
.ReadInt('Touch', 'Size', 10) / 10, 0.1);
428 g_touch_fire
:= config
.ReadBool('Touch', 'Fire', True);
429 g_touch_offset
:= Max(Min(config
.ReadInt('Touch', 'Offset', 50), 100), 0);
430 g_touch_alt
:= config
.ReadBool('Touch', 'Alt', False);
432 g_GFX_SetMax(Min(config
.ReadInt('Game', 'MaxParticles', 1000), 50000));
433 g_Shells_SetMax(Min(config
.ReadInt('Game', 'MaxShells', 300), 600));
434 g_Gibs_SetMax(Min(config
.ReadInt('Game', 'MaxGibs', 150), 500));
435 g_Corpses_SetMax(Min(config
.ReadInt('Game', 'MaxCorpses', 20), 100));
437 case config
.ReadInt('Game', 'GibsCount', 3) of
442 else gGibsCount
:= 48;
445 ITEM_RESPAWNTIME
:= 36*Max(config
.ReadInt('Game', 'ItemRespawnTime', 60), 0);
446 gBloodCount
:= Min(config
.ReadInt('Game', 'BloodCount', 4), 4);
447 gAdvBlood
:= config
.ReadBool('Game', 'AdvancesBlood', True);
448 gAdvCorpses
:= config
.ReadBool('Game', 'AdvancesCorpses', True);
449 gAdvGibs
:= config
.ReadBool('Game', 'AdvancesGibs', True);
450 gFlash
:= Min(Max(config
.ReadInt('Game', 'Flash', 1), 0), 2);
451 gDrawBackGround
:= config
.ReadBool('Game', 'BackGround', True);
452 gShowMessages
:= config
.ReadBool('Game', 'Messages', True);
453 gRevertPlayers
:= config
.ReadBool('Game', 'RevertPlayers', False);
454 gChatBubble
:= Min(Max(config
.ReadInt('Game', 'ChatBubble', 4), 0), 4);
455 gSFSDebug
:= config
.ReadBool('Game', 'SFSDebug', False);
456 wadoptDebug
:= gSFSDebug
;
457 gSFSFastMode
:= config
.ReadBool('Game', 'SFSFastMode', False);
458 wadoptFast
:= gSFSFastMode
;
459 e_FastScreenshots
:= config
.ReadBool('Game', 'FastScreenshots', True);
460 gDefaultMegawadStart
:= config
.ReadStr('Game', 'DefaultMegawadStart', DF_Default_Megawad_Start
);
461 gBerserkAutoswitch
:= config
.ReadBool('Game', 'BerserkAutoswitching', True);
462 g_dbg_scale
:= Max(config
.ReadInt('Game', 'Scale', 100) / 100, 1.0);
464 // Ãåéìïëåé â ñâîåé èãðå
465 gcMap
:= config
.ReadStr('GameplayCustom', 'Map', '');
466 gcGameMode
:= config
.ReadStr('GameplayCustom', 'GameMode', _lc
[I_MENU_GAME_TYPE_DM
]);
467 gcTimeLimit
:= Min(Max(config
.ReadInt('GameplayCustom', 'TimeLimit', 0), 0), 65535);
468 gcGoalLimit
:= Min(Max(config
.ReadInt('GameplayCustom', 'GoalLimit', 0), 0), 65535);
469 gcMaxLives
:= Min(Max(config
.ReadInt('GameplayCustom', 'MaxLives', 0), 0), 255);
470 gcPlayers
:= Min(Max(config
.ReadInt('GameplayCustom', 'Players', 1), 0), 2);
471 gcTeamDamage
:= config
.ReadBool('GameplayCustom', 'TeamDamage', False);
472 gcAllowExit
:= config
.ReadBool('GameplayCustom', 'AllowExit', True);
473 gcWeaponStay
:= config
.ReadBool('GameplayCustom', 'WeaponStay', False);
474 gcMonsters
:= config
.ReadBool('GameplayCustom', 'Monsters', False);
475 gcBotsVS
:= config
.ReadStr('GameplayCustom', 'BotsVS', 'Everybody');
477 with gGameSettings
do
479 GameMode
:= g_Game_TextToMode(gcGameMode
);
480 if GameMode
= GM_NONE
then
482 if GameMode
= GM_SINGLE
then
484 TimeLimit
:= gcTimeLimit
;
485 GoalLimit
:= gcGoalLimit
;
486 MaxLives
:= gcMaxLives
;
490 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
492 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
494 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
496 Options
:= Options
or GAME_OPTION_MONSTERS
;
497 if gcBotsVS
= 'Everybody' then
498 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
499 if gcBotsVS
= 'Players' then
500 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
501 if gcBotsVS
= 'Monsters' then
502 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
505 // Ãåéìïëåé â ñåòåâîé èãðå
506 gnMap
:= config
.ReadStr('GameplayNetwork', 'Map', '');
507 gnGameMode
:= config
.ReadStr('GameplayNetwork', 'GameMode', _lc
[I_MENU_GAME_TYPE_DM
]);
508 gnTimeLimit
:= Min(Max(config
.ReadInt('GameplayNetwork', 'TimeLimit', 0), 0), 65535);
509 gnGoalLimit
:= Min(Max(config
.ReadInt('GameplayNetwork', 'GoalLimit', 0), 0), 65535);
510 gnMaxLives
:= Min(Max(config
.ReadInt('GameplayNetwork', 'MaxLives', 0), 0), 255);
511 gnPlayers
:= Min(Max(config
.ReadInt('GameplayNetwork', 'Players', 1), 0), 2);
512 gnTeamDamage
:= config
.ReadBool('GameplayNetwork', 'TeamDamage', False);
513 gnAllowExit
:= config
.ReadBool('GameplayNetwork', 'AllowExit', True);
514 gnWeaponStay
:= config
.ReadBool('GameplayNetwork', 'WeaponStay', False);
515 gnMonsters
:= config
.ReadBool('GameplayNetwork', 'Monsters', False);
516 gnBotsVS
:= config
.ReadStr('GameplayNetwork', 'BotsVS', 'Everybody');
518 // Îáùèå ñåòåâûå
519 NetSlistIP
:= config
.ReadStr('MasterServer', 'IP', 'mpms.doom2d.org');
520 NetSlistPort
:= config
.ReadInt('MasterServer', 'Port', 25665);
523 NetServerName
:= config
.ReadStr('Server', 'Name', 'Unnamed Server');
524 NetPassword
:= config
.ReadStr('Server', 'Password', '');
525 NetPort
:= Min(Max(0, config
.ReadInt('Server', 'Port', 25666)), 65535);
526 NetMaxClients
:= Min(Max(0, config
.ReadInt('Server', 'MaxClients', 16)), NET_MAXCLIENTS
);
527 NetAllowRCON
:= config
.ReadBool('Server', 'RCON', False);
528 NetRCONPassword
:= config
.ReadStr('Server', 'RCONPassword', 'default');
529 NetUseMaster
:= config
.ReadBool('Server', 'SyncWithMaster', True);
530 NetUpdateRate
:= Max(0, config
.ReadInt('Server', 'UpdateInterval', 0));
531 NetRelupdRate
:= Max(0, config
.ReadInt('Server', 'ReliableUpdateInterval', 18));
532 NetMasterRate
:= Max(1, config
.ReadInt('Server', 'MasterSyncInterval', 60000));
533 NetForwardPorts
:= config
.ReadBool('Server', 'ForwardPorts', False);
536 NetInterpLevel
:= Max(0, config
.ReadInt('Client', 'InterpolationSteps', 2));
537 NetForcePlayerUpdate
:= config
.ReadBool('Client', 'ForcePlayerUpdate', False);
538 NetPredictSelf
:= config
.ReadBool('Client', 'PredictSelf', True);
539 NetClientIP
:= config
.ReadStr('Client', 'LastIP', '127.0.0.1');
540 NetClientPort
:= Max(0, config
.ReadInt('Client', 'LastPort', 25666));
543 str
:= config
.ReadStr('Game', 'Language', '');
544 if (str
= LANGUAGE_RUSSIAN
) or
545 (str
= LANGUAGE_ENGLISH
) then
548 gAskLanguage
:= False;
551 gLanguage
:= LANGUAGE_ENGLISH
;
555 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
558 procedure g_Options_Write(FileName
: String);
563 e_WriteLog('Writing config', TMsgType
.Notify
);
565 config
:= TConfig
.CreateFile(FileName
);
567 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
568 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
569 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
570 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
571 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
572 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
573 config
.WriteInt('Video', 'BPP', gBPP
);
574 config
.WriteBool('Video', 'VSync', gVSync
);
575 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
576 config
.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT
);
578 config
.WriteBool('Sound', 'NoSound', gNoSound
);
579 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
580 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
581 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
582 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
583 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
584 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
585 config
.WriteBool('Sound', 'ChatSounds', gUseChatSounds
);
586 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
587 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
589 with config
, gGameControls
.GameControls
do
591 WriteInt('GameControls', 'TakeScreenshot', TakeScreenshot
);
592 WriteInt('GameControls', 'Stat', Stat
);
593 WriteInt('GameControls', 'Chat', Chat
);
594 WriteInt('GameControls', 'TeamChat', TeamChat
);
597 with config
, gGameControls
.P1Control
, gPlayer1Settings
do
599 WriteInt('Player1', 'KeyRight', KeyRight
);
600 WriteInt('Player1', 'KeyLeft', KeyLeft
);
601 WriteInt('Player1', 'KeyUp', KeyUp
);
602 WriteInt('Player1', 'KeyDown', KeyDown
);
603 WriteInt('Player1', 'KeyFire', KeyFire
);
604 WriteInt('Player1', 'KeyJump', KeyJump
);
605 WriteInt('Player1', 'KeyNextWeapon', KeyNextWeapon
);
606 WriteInt('Player1', 'KeyPrevWeapon', KeyPrevWeapon
);
607 WriteInt('Player1', 'KeyOpen', KeyOpen
);
608 WriteInt('Player1', 'KeyStrafe', KeyStrafe
);
609 for i
:= 0 to High(KeyWeapon
) do
610 WriteInt('Player1', 'KeyWeapon' + IntToStr(i
), KeyWeapon
[i
]);
612 WriteInt('Player1', 'KeyRight2', KeyRight2
);
613 WriteInt('Player1', 'KeyLeft2', KeyLeft2
);
614 WriteInt('Player1', 'KeyUp2', KeyUp2
);
615 WriteInt('Player1', 'KeyDown2', KeyDown2
);
616 WriteInt('Player1', 'KeyFire2', KeyFire2
);
617 WriteInt('Player1', 'KeyJump2', KeyJump2
);
618 WriteInt('Player1', 'KeyNextWeapon2', KeyNextWeapon2
);
619 WriteInt('Player1', 'KeyPrevWeapon2', KeyPrevWeapon2
);
620 WriteInt('Player1', 'KeyOpen2', KeyOpen2
);
621 WriteInt('Player1', 'KeyStrafe2', KeyStrafe2
);
622 for i
:= 0 to High(KeyWeapon2
) do
623 WriteInt('Player1', 'KeyWeapon2' + IntToStr(i
), KeyWeapon2
[i
]);
625 WriteStr('Player1', 'Name', Name
);
626 WriteStr('Player1', 'model', Model
);
627 WriteInt('Player1', 'red', Color
.R
);
628 WriteInt('Player1', 'green', Color
.G
);
629 WriteInt('Player1', 'blue', Color
.B
);
630 WriteInt('Player1', 'team', Team
);
633 with config
, gGameControls
.P2Control
, gPlayer2Settings
do
635 WriteInt('Player2', 'KeyRight', KeyRight
);
636 WriteInt('Player2', 'KeyLeft', KeyLeft
);
637 WriteInt('Player2', 'KeyUp', KeyUp
);
638 WriteInt('Player2', 'KeyDown', KeyDown
);
639 WriteInt('Player2', 'KeyFire', KeyFire
);
640 WriteInt('Player2', 'KeyJump', KeyJump
);
641 WriteInt('Player2', 'KeyNextWeapon', KeyNextWeapon
);
642 WriteInt('Player2', 'KeyPrevWeapon', KeyPrevWeapon
);
643 WriteInt('Player2', 'KeyOpen', KeyOpen
);
644 WriteInt('Player2', 'KeyStrafe', KeyStrafe
);
645 for i
:= 0 to High(KeyWeapon
) do
646 WriteInt('Player2', 'KeyWeapon' + IntToStr(i
), KeyWeapon
[i
]);
648 WriteInt('Player2', 'KeyRight2', KeyRight2
);
649 WriteInt('Player2', 'KeyLeft2', KeyLeft2
);
650 WriteInt('Player2', 'KeyUp2', KeyUp2
);
651 WriteInt('Player2', 'KeyDown2', KeyDown2
);
652 WriteInt('Player2', 'KeyFire2', KeyFire2
);
653 WriteInt('Player2', 'KeyJump2', KeyJump2
);
654 WriteInt('Player2', 'KeyNextWeapon2', KeyNextWeapon2
);
655 WriteInt('Player2', 'KeyPrevWeapon2', KeyPrevWeapon2
);
656 WriteInt('Player2', 'KeyOpen2', KeyOpen2
);
657 WriteInt('Player2', 'KeyStrafe2', KeyStrafe2
);
658 for i
:= 0 to High(KeyWeapon2
) do
659 WriteInt('Player2', 'KeyWeapon2' + IntToStr(i
), KeyWeapon2
[i
]);
661 WriteStr('Player2', 'Name', Name
);
662 WriteStr('Player2', 'model', Model
);
663 WriteInt('Player2', 'red', Color
.R
);
664 WriteInt('Player2', 'green', Color
.G
);
665 WriteInt('Player2', 'blue', Color
.B
);
666 WriteInt('Player2', 'team', Team
);
669 for i
:= 0 to e_MaxJoys
-1 do
670 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
672 config
.WriteInt('Touch', 'Size', Round(g_touch_size
* 10));
673 config
.WriteBool('Touch', 'Fire', g_touch_fire
);
674 config
.WriteInt('Touch', 'Offset', Round(g_touch_offset
));
675 config
.WriteBool('Touch', 'Alt', g_touch_alt
);
679 0: config
.WriteInt('Game', 'GibsCount', 0);
680 8: config
.WriteInt('Game', 'GibsCount', 1);
681 16: config
.WriteInt('Game', 'GibsCount', 2);
682 32: config
.WriteInt('Game', 'GibsCount', 3);
683 else config
.WriteInt('Game', 'GibsCount', 4);
686 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
687 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
688 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
689 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
690 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
691 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
692 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
693 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
694 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
695 config
.WriteInt('Game', 'Flash', gFlash
);
696 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
697 config
.WriteBool('Game', 'Messages', gShowMessages
);
698 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
699 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
700 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
701 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
702 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
703 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
704 config
.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch
);
705 config
.WriteInt('Game', 'Scale', Round(g_dbg_scale
* 100));
707 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
708 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
709 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
710 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
711 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
712 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
713 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
714 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
715 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
716 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
717 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
719 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
720 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
721 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
722 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
723 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
724 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
725 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
726 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
727 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
728 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
729 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
731 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
732 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
734 config
.WriteStr ('Server', 'Name', NetServerName
);
735 config
.WriteStr ('Server', 'Password', NetPassword
);
736 config
.WriteInt ('Server', 'Port', NetPort
);
737 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
738 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
739 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
740 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
741 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
742 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
743 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
744 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
746 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
747 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
748 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
749 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
750 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
752 config
.SaveFile(FileName
);
756 procedure g_Options_Write_Language(FileName
: String);
760 e_WriteLog('Writing language config', TMsgType
.Notify
);
762 config
:= TConfig
.CreateFile(FileName
);
763 config
.WriteStr('Game', 'Language', gLanguage
);
764 config
.SaveFile(FileName
);
768 procedure g_Options_Write_Video(FileName
: String);
773 e_WriteLog('Writing resolution to config', TMsgType
.Notify
);
775 config
:= TConfig
.CreateFile(FileName
);
777 if gWinMaximized
and (not gFullscreen
) then
787 e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX
, gWinSizeY
, gScreenWidth
, gScreenHeight
]);
789 config
.WriteInt('Video', 'ScreenWidth', sW
);
790 config
.WriteInt('Video', 'ScreenHeight', sH
);
791 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
792 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
793 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
794 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
796 config
.SaveFile(FileName
);
800 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
804 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
806 config
:= TConfig
.CreateFile(FileName
);
808 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
809 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
810 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
811 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
812 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
813 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
814 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
815 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
816 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
817 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
818 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
820 config
.SaveFile(FileName
);
824 procedure g_Options_Write_Gameplay_Net(FileName
: String);
828 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
830 config
:= TConfig
.CreateFile(FileName
);
832 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
833 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
834 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
835 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
836 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
837 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
838 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
839 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
840 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
841 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
842 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
844 config
.SaveFile(FileName
);
848 procedure g_Options_Write_Net_Server(FileName
: String);
852 e_WriteLog('Writing server config', TMsgType
.Notify
);
854 config
:= TConfig
.CreateFile(FileName
);
856 config
.WriteStr ('Server', 'Name', NetServerName
);
857 config
.WriteStr ('Server', 'Password', NetPassword
);
858 config
.WriteInt ('Server', 'Port', NetPort
);
859 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
860 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
861 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
863 config
.SaveFile(FileName
);
867 procedure g_Options_Write_Net_Client(FileName
: String);
871 e_WriteLog('Writing client config', TMsgType
.Notify
);
873 config
:= TConfig
.CreateFile(FileName
);
875 config
.WriteStr('Client', 'LastIP', NetClientIP
);
876 config
.WriteInt('Client', 'LastPort', NetClientPort
);
878 config
.SaveFile(FileName
);