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
;
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;
170 for i
:= 0 to e_MaxJoys
-1 do
171 e_JoystickDeadzones
[i
] := 8192;
173 with gGameControls
.GameControls
do
175 TakeScreenshot
:= 183;
178 TeamChat
:= 21; // [Y]
181 with gGameControls
.P1Control
do
194 KeyWeapon
[i
] := 30 + i
;
196 for i
:= 10 to High(KeyWeapon
) do
199 KeyRight2
:= VK_RIGHT
;
205 KeyNextWeapon2
:= VK_NEXT
;
206 KeyPrevWeapon2
:= VK_PREV
;
208 KeyStrafe2
:= VK_STRAFE
;
209 for i
:= 0 to High(KeyWeapon2
) do
210 KeyWeapon2
[i
] := VK_0
+ i
;
213 with gGameControls
.P2Control
do
225 for i
:= 0 to High(KeyWeapon
) do
238 for i
:= 0 to High(KeyWeapon2
) do
242 with gPlayer1Settings
do
245 Model
:= STD_PLAYER_MODEL
;
246 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
247 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
248 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
252 with gPlayer2Settings
do
255 Model
:= STD_PLAYER_MODEL
;
256 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
257 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
258 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
262 NetUseMaster
:= True;
263 NetForwardPorts
:= False;
264 g_Net_Slist_Set('mpms.doom2d.org', 25665);
267 procedure g_Options_Read(FileName
: String);
273 gAskLanguage
:= True;
274 e_WriteLog('Reading config', TMsgType
.Notify
);
276 if not FileExists(FileName
) then
278 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
279 g_Options_SetDefault();
281 // Default video options:
283 gScreenHeight
:= 600;
286 gWinMaximized
:= False;
287 gFullScreen
:= False;
290 gTextureFilter
:= True;
291 glLegacyNPOT
:= False;
296 config
:= TConfig
.CreateFile(FileName
);
298 gScreenWidth
:= config
.ReadInt('Video', 'ScreenWidth', 800);
299 if gScreenWidth
< 640 then
301 gScreenHeight
:= config
.ReadInt('Video', 'ScreenHeight', 600);
302 if gScreenHeight
< 480 then
303 gScreenHeight
:= 480;
304 gWinRealPosX
:= config
.ReadInt('Video', 'WinPosX', 60);
305 if gWinRealPosX
< 0 then
307 gWinRealPosY
:= config
.ReadInt('Video', 'WinPosY', 60);
308 if gWinRealPosY
< 0 then
310 gFullScreen
:= config
.ReadBool('Video', 'Fullscreen', False);
311 gWinMaximized
:= config
.ReadBool('Video', 'Maximized', False);
312 gBPP
:= config
.ReadInt('Video', 'BPP', 32);
313 gFreq
:= config
.ReadInt('Video', 'Freq', 0);
314 gVSync
:= config
.ReadBool('Video', 'VSync', True);
315 gTextureFilter
:= config
.ReadBool('Video', 'TextureFilter', True);
316 glLegacyNPOT
:= config
.ReadBool('Video', 'LegacyCompatible', False);
318 gNoSound
:= config
.ReadBool('Sound', 'NoSound', False);
319 gSoundLevel
:= Min(config
.ReadInt('Sound', 'SoundLevel', 75), 255);
320 gMusicLevel
:= Min(config
.ReadInt('Sound', 'MusicLevel', 65), 255);
321 gMaxSimSounds
:= Max(Min(config
.ReadInt('Sound', 'MaxSimSounds', 8), 66), 2);
322 gMuteWhenInactive
:= config
.ReadBool('Sound', 'MuteInactive', False);
323 gAnnouncer
:= Min(Max(config
.ReadInt('Sound', 'Announcer', ANNOUNCE_MEPLUS
), ANNOUNCE_NONE
), ANNOUNCE_ALL
);
324 gSoundEffectsDF
:= config
.ReadBool('Sound', 'SoundEffectsDF', True);
325 gUseChatSounds
:= config
.ReadBool('Sound', 'ChatSounds', True);
326 gsSDLSampleRate
:= Min(Max(config
.ReadInt('Sound', 'SDLSampleRate', 44100), 11025), 96000);
327 gsSDLBufferSize
:= Min(Max(config
.ReadInt('Sound', 'SDLBufferSize', 2048), 64), 16384);
329 with gGameControls
.GameControls
do
331 TakeScreenshot
:= config
.ReadInt('GameControls', 'TakeScreenshot', 183);
332 Stat
:= config
.ReadInt('GameControls', 'Stat', 15);
333 Chat
:= config
.ReadInt('GameControls', 'Chat', 20);
334 TeamChat
:= config
.ReadInt('GameControls', 'TeamChat', 21);
337 with gGameControls
.P1Control
, config
do
339 KeyRight
:= ReadInt('Player1', 'KeyRight', 33);
340 KeyLeft
:= ReadInt('Player1', 'KeyLeft', 31);
341 KeyUp
:= ReadInt('Player1', 'KeyUp', 18);
342 KeyDown
:= ReadInt('Player1', 'KeyDown', 32);
343 KeyFire
:= ReadInt('Player1', 'KeyFire', 30);
344 KeyJump
:= ReadInt('Player1', 'KeyJump', 16);
345 KeyNextWeapon
:= ReadInt('Player1', 'KeyNextWeapon', 19);
346 KeyPrevWeapon
:= ReadInt('Player1', 'KeyPrevWeapon', 17);
347 KeyOpen
:= ReadInt('Player1', 'KeyOpen', 58);
348 KeyStrafe
:= ReadInt('Player1', 'KeyStrafe', 0);
349 for i
:= 0 to High(KeyWeapon
) do
350 KeyWeapon
[i
] := ReadInt('Player1', 'KeyWeapon' + IntToStr(i
), 0);
352 KeyRight2
:= ReadInt('Player1', 'KeyRight2', 0);
353 KeyLeft2
:= ReadInt('Player1', 'KeyLeft2', 0);
354 KeyUp2
:= ReadInt('Player1', 'KeyUp2', 0);
355 KeyDown2
:= ReadInt('Player1', 'KeyDown2', 0);
356 KeyFire2
:= ReadInt('Player1', 'KeyFire2', 0);
357 KeyJump2
:= ReadInt('Player1', 'KeyJump2', 0);
358 KeyNextWeapon2
:= ReadInt('Player1', 'KeyNextWeapon2', 0);
359 KeyPrevWeapon2
:= ReadInt('Player1', 'KeyPrevWeapon2', 0);
360 KeyOpen2
:= ReadInt('Player1', 'KeyOpen2', 0);
361 KeyStrafe2
:= ReadInt('Player1', 'KeyStrafe2', 0);
362 for i
:= 0 to High(KeyWeapon2
) do
363 KeyWeapon2
[i
] := ReadInt('Player1', 'KeyWeapon2' + IntToStr(i
), 0);
366 with gPlayer1Settings
, config
do
368 Name
:= ReadStr('Player1', 'name', 'Player1');
369 Model
:= ReadStr('Player1', 'model', STD_PLAYER_MODEL
);
370 Color
.R
:= Min(Abs(ReadInt('Player1', 'red', PLAYER1_DEF_COLOR
.R
)), 255);
371 Color
.G
:= Min(Abs(ReadInt('Player1', 'green', PLAYER1_DEF_COLOR
.G
)), 255);
372 Color
.B
:= Min(Abs(ReadInt('Player1', 'blue', PLAYER1_DEF_COLOR
.B
)), 255);
373 Team
:= ReadInt('Player1', 'team', TEAM_RED
);
374 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
378 with gGameControls
.P2Control
, config
do
380 KeyRight
:= ReadInt('Player2', 'KeyRight', 205);
381 KeyLeft
:= ReadInt('Player2', 'KeyLeft', 203);
382 KeyUp
:= ReadInt('Player2', 'KeyUp', 200);
383 KeyDown
:= ReadInt('Player2', 'KeyDown', 208);
384 KeyFire
:= ReadInt('Player2', 'KeyFire', 184);
385 KeyJump
:= ReadInt('Player2', 'KeyJump', 157);
386 KeyNextWeapon
:= ReadInt('Player2', 'KeyNextWeapon', 73);
387 KeyPrevWeapon
:= ReadInt('Player2', 'KeyPrevWeapon', 71);
388 KeyOpen
:= ReadInt('Player2', 'KeyOpen', 54);
389 KeyStrafe
:= ReadInt('Player2', 'KeyStrafe', 0);
390 for i
:= 0 to High(KeyWeapon
) do
391 KeyWeapon
[i
] := ReadInt('Player2', 'KeyWeapon' + IntToStr(i
), 0);
393 KeyRight2
:= ReadInt('Player2', 'KeyRight2', 0);
394 KeyLeft2
:= ReadInt('Player2', 'KeyLeft2', 0);
395 KeyUp2
:= ReadInt('Player2', 'KeyUp2', 0);
396 KeyDown2
:= ReadInt('Player2', 'KeyDown2', 0);
397 KeyFire2
:= ReadInt('Player2', 'KeyFire2', 0);
398 KeyJump2
:= ReadInt('Player2', 'KeyJump2', 0);
399 KeyNextWeapon2
:= ReadInt('Player2', 'KeyNextWeapon2', 0);
400 KeyPrevWeapon2
:= ReadInt('Player2', 'KeyPrevWeapon2', 0);
401 KeyOpen2
:= ReadInt('Player2', 'KeyOpen2', 0);
402 KeyStrafe2
:= ReadInt('Player2', 'KeyStrafe2', 0);
403 for i
:= 0 to High(KeyWeapon2
) do
404 KeyWeapon2
[i
] := ReadInt('Player2', 'KeyWeapon2' + IntToStr(i
), 0);
407 with gPlayer2Settings
, config
do
409 Name
:= ReadStr('Player2', 'name', 'Player2');
410 Model
:= ReadStr('Player2', 'model', STD_PLAYER_MODEL
);
411 Color
.R
:= Min(Abs(ReadInt('Player2', 'red', PLAYER2_DEF_COLOR
.R
)), 255);
412 Color
.G
:= Min(Abs(ReadInt('Player2', 'green', PLAYER2_DEF_COLOR
.G
)), 255);
413 Color
.B
:= Min(Abs(ReadInt('Player2', 'blue', PLAYER2_DEF_COLOR
.B
)), 255);
414 Team
:= ReadInt('Player2', 'team', TEAM_BLUE
);
415 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
419 for i
:= 0 to e_MaxJoys
-1 do
420 e_JoystickDeadzones
[i
] := config
.ReadInt('Joysticks', 'Deadzone' + IntToStr(i
), 8192);
422 g_GFX_SetMax(Min(config
.ReadInt('Game', 'MaxParticles', 1000), 50000));
423 g_Shells_SetMax(Min(config
.ReadInt('Game', 'MaxShells', 300), 600));
424 g_Gibs_SetMax(Min(config
.ReadInt('Game', 'MaxGibs', 150), 500));
425 g_Corpses_SetMax(Min(config
.ReadInt('Game', 'MaxCorpses', 20), 100));
427 case config
.ReadInt('Game', 'GibsCount', 3) of
432 else gGibsCount
:= 48;
435 ITEM_RESPAWNTIME
:= 36*Max(config
.ReadInt('Game', 'ItemRespawnTime', 60), 0);
436 gBloodCount
:= Min(config
.ReadInt('Game', 'BloodCount', 4), 4);
437 gAdvBlood
:= config
.ReadBool('Game', 'AdvancesBlood', True);
438 gAdvCorpses
:= config
.ReadBool('Game', 'AdvancesCorpses', True);
439 gAdvGibs
:= config
.ReadBool('Game', 'AdvancesGibs', True);
440 gFlash
:= Min(Max(config
.ReadInt('Game', 'Flash', 1), 0), 2);
441 gDrawBackGround
:= config
.ReadBool('Game', 'BackGround', True);
442 gShowMessages
:= config
.ReadBool('Game', 'Messages', True);
443 gRevertPlayers
:= config
.ReadBool('Game', 'RevertPlayers', False);
444 gChatBubble
:= Min(Max(config
.ReadInt('Game', 'ChatBubble', 4), 0), 4);
445 gSFSDebug
:= config
.ReadBool('Game', 'SFSDebug', False);
446 wadoptDebug
:= gSFSDebug
;
447 gSFSFastMode
:= config
.ReadBool('Game', 'SFSFastMode', False);
448 wadoptFast
:= gSFSFastMode
;
449 e_FastScreenshots
:= config
.ReadBool('Game', 'FastScreenshots', True);
450 gDefaultMegawadStart
:= config
.ReadStr('Game', 'DefaultMegawadStart', DF_Default_Megawad_Start
);
451 gBerserkAutoswitch
:= config
.ReadBool('Game', 'BerserkAutoswitching', True);
453 // Ãåéìïëåé â ñâîåé èãðå
454 gcMap
:= config
.ReadStr('GameplayCustom', 'Map', '');
455 gcGameMode
:= config
.ReadStr('GameplayCustom', 'GameMode', _lc
[I_MENU_GAME_TYPE_DM
]);
456 gcTimeLimit
:= Min(Max(config
.ReadInt('GameplayCustom', 'TimeLimit', 0), 0), 65535);
457 gcGoalLimit
:= Min(Max(config
.ReadInt('GameplayCustom', 'GoalLimit', 0), 0), 65535);
458 gcMaxLives
:= Min(Max(config
.ReadInt('GameplayCustom', 'MaxLives', 0), 0), 255);
459 gcPlayers
:= Min(Max(config
.ReadInt('GameplayCustom', 'Players', 1), 0), 2);
460 gcTeamDamage
:= config
.ReadBool('GameplayCustom', 'TeamDamage', False);
461 gcAllowExit
:= config
.ReadBool('GameplayCustom', 'AllowExit', True);
462 gcWeaponStay
:= config
.ReadBool('GameplayCustom', 'WeaponStay', False);
463 gcMonsters
:= config
.ReadBool('GameplayCustom', 'Monsters', False);
464 gcBotsVS
:= config
.ReadStr('GameplayCustom', 'BotsVS', 'Everybody');
466 with gGameSettings
do
468 GameMode
:= g_Game_TextToMode(gcGameMode
);
469 if GameMode
= GM_NONE
then
471 if GameMode
= GM_SINGLE
then
473 TimeLimit
:= gcTimeLimit
;
474 GoalLimit
:= gcGoalLimit
;
475 MaxLives
:= gcMaxLives
;
479 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
481 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
483 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
485 Options
:= Options
or GAME_OPTION_MONSTERS
;
486 if gcBotsVS
= 'Everybody' then
487 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
488 if gcBotsVS
= 'Players' then
489 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
490 if gcBotsVS
= 'Monsters' then
491 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
494 // Ãåéìïëåé â ñåòåâîé èãðå
495 gnMap
:= config
.ReadStr('GameplayNetwork', 'Map', '');
496 gnGameMode
:= config
.ReadStr('GameplayNetwork', 'GameMode', _lc
[I_MENU_GAME_TYPE_DM
]);
497 gnTimeLimit
:= Min(Max(config
.ReadInt('GameplayNetwork', 'TimeLimit', 0), 0), 65535);
498 gnGoalLimit
:= Min(Max(config
.ReadInt('GameplayNetwork', 'GoalLimit', 0), 0), 65535);
499 gnMaxLives
:= Min(Max(config
.ReadInt('GameplayNetwork', 'MaxLives', 0), 0), 255);
500 gnPlayers
:= Min(Max(config
.ReadInt('GameplayNetwork', 'Players', 1), 0), 2);
501 gnTeamDamage
:= config
.ReadBool('GameplayNetwork', 'TeamDamage', False);
502 gnAllowExit
:= config
.ReadBool('GameplayNetwork', 'AllowExit', True);
503 gnWeaponStay
:= config
.ReadBool('GameplayNetwork', 'WeaponStay', False);
504 gnMonsters
:= config
.ReadBool('GameplayNetwork', 'Monsters', False);
505 gnBotsVS
:= config
.ReadStr('GameplayNetwork', 'BotsVS', 'Everybody');
507 // Îáùèå ñåòåâûå
508 NetSlistIP
:= config
.ReadStr('MasterServer', 'IP', 'mpms.doom2d.org');
509 NetSlistPort
:= config
.ReadInt('MasterServer', 'Port', 25665);
512 NetServerName
:= config
.ReadStr('Server', 'Name', 'Unnamed Server');
513 NetPassword
:= config
.ReadStr('Server', 'Password', '');
514 NetPort
:= Min(Max(0, config
.ReadInt('Server', 'Port', 25666)), 65535);
515 NetMaxClients
:= Min(Max(0, config
.ReadInt('Server', 'MaxClients', 16)), NET_MAXCLIENTS
);
516 NetAllowRCON
:= config
.ReadBool('Server', 'RCON', False);
517 NetRCONPassword
:= config
.ReadStr('Server', 'RCONPassword', 'default');
518 NetUseMaster
:= config
.ReadBool('Server', 'SyncWithMaster', True);
519 NetUpdateRate
:= Max(0, config
.ReadInt('Server', 'UpdateInterval', 0));
520 NetRelupdRate
:= Max(0, config
.ReadInt('Server', 'ReliableUpdateInterval', 18));
521 NetMasterRate
:= Max(1, config
.ReadInt('Server', 'MasterSyncInterval', 60000));
522 NetForwardPorts
:= config
.ReadBool('Server', 'ForwardPorts', False);
525 NetInterpLevel
:= Max(0, config
.ReadInt('Client', 'InterpolationSteps', 2));
526 NetForcePlayerUpdate
:= config
.ReadBool('Client', 'ForcePlayerUpdate', False);
527 NetPredictSelf
:= config
.ReadBool('Client', 'PredictSelf', True);
528 NetClientIP
:= config
.ReadStr('Client', 'LastIP', '127.0.0.1');
529 NetClientPort
:= Max(0, config
.ReadInt('Client', 'LastPort', 25666));
532 str
:= config
.ReadStr('Game', 'Language', '');
533 if (str
= LANGUAGE_RUSSIAN
) or
534 (str
= LANGUAGE_ENGLISH
) then
537 gAskLanguage
:= False;
540 gLanguage
:= LANGUAGE_ENGLISH
;
544 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
547 procedure g_Options_Write(FileName
: String);
552 e_WriteLog('Writing config', TMsgType
.Notify
);
554 config
:= TConfig
.CreateFile(FileName
);
556 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
557 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
558 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
559 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
560 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
561 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
562 config
.WriteInt('Video', 'BPP', gBPP
);
563 config
.WriteBool('Video', 'VSync', gVSync
);
564 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
565 config
.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT
);
567 config
.WriteBool('Sound', 'NoSound', gNoSound
);
568 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
569 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
570 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
571 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
572 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
573 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
574 config
.WriteBool('Sound', 'ChatSounds', gUseChatSounds
);
575 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
576 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
578 with config
, gGameControls
.GameControls
do
580 WriteInt('GameControls', 'TakeScreenshot', TakeScreenshot
);
581 WriteInt('GameControls', 'Stat', Stat
);
582 WriteInt('GameControls', 'Chat', Chat
);
583 WriteInt('GameControls', 'TeamChat', TeamChat
);
586 with config
, gGameControls
.P1Control
, gPlayer1Settings
do
588 WriteInt('Player1', 'KeyRight', KeyRight
);
589 WriteInt('Player1', 'KeyLeft', KeyLeft
);
590 WriteInt('Player1', 'KeyUp', KeyUp
);
591 WriteInt('Player1', 'KeyDown', KeyDown
);
592 WriteInt('Player1', 'KeyFire', KeyFire
);
593 WriteInt('Player1', 'KeyJump', KeyJump
);
594 WriteInt('Player1', 'KeyNextWeapon', KeyNextWeapon
);
595 WriteInt('Player1', 'KeyPrevWeapon', KeyPrevWeapon
);
596 WriteInt('Player1', 'KeyOpen', KeyOpen
);
597 WriteInt('Player1', 'KeyStrafe', KeyStrafe
);
598 for i
:= 0 to High(KeyWeapon
) do
599 WriteInt('Player1', 'KeyWeapon' + IntToStr(i
), KeyWeapon
[i
]);
601 WriteInt('Player1', 'KeyRight2', KeyRight2
);
602 WriteInt('Player1', 'KeyLeft2', KeyLeft2
);
603 WriteInt('Player1', 'KeyUp2', KeyUp2
);
604 WriteInt('Player1', 'KeyDown2', KeyDown2
);
605 WriteInt('Player1', 'KeyFire2', KeyFire2
);
606 WriteInt('Player1', 'KeyJump2', KeyJump2
);
607 WriteInt('Player1', 'KeyNextWeapon2', KeyNextWeapon2
);
608 WriteInt('Player1', 'KeyPrevWeapon2', KeyPrevWeapon2
);
609 WriteInt('Player1', 'KeyOpen2', KeyOpen2
);
610 WriteInt('Player1', 'KeyStrafe2', KeyStrafe2
);
611 for i
:= 0 to High(KeyWeapon2
) do
612 WriteInt('Player1', 'KeyWeapon2' + IntToStr(i
), KeyWeapon2
[i
]);
614 WriteStr('Player1', 'Name', Name
);
615 WriteStr('Player1', 'model', Model
);
616 WriteInt('Player1', 'red', Color
.R
);
617 WriteInt('Player1', 'green', Color
.G
);
618 WriteInt('Player1', 'blue', Color
.B
);
619 WriteInt('Player1', 'team', Team
);
622 with config
, gGameControls
.P2Control
, gPlayer2Settings
do
624 WriteInt('Player2', 'KeyRight', KeyRight
);
625 WriteInt('Player2', 'KeyLeft', KeyLeft
);
626 WriteInt('Player2', 'KeyUp', KeyUp
);
627 WriteInt('Player2', 'KeyDown', KeyDown
);
628 WriteInt('Player2', 'KeyFire', KeyFire
);
629 WriteInt('Player2', 'KeyJump', KeyJump
);
630 WriteInt('Player2', 'KeyNextWeapon', KeyNextWeapon
);
631 WriteInt('Player2', 'KeyPrevWeapon', KeyPrevWeapon
);
632 WriteInt('Player2', 'KeyOpen', KeyOpen
);
633 WriteInt('Player2', 'KeyStrafe', KeyStrafe
);
634 for i
:= 0 to High(KeyWeapon
) do
635 WriteInt('Player2', 'KeyWeapon' + IntToStr(i
), KeyWeapon
[i
]);
637 WriteInt('Player2', 'KeyRight2', KeyRight2
);
638 WriteInt('Player2', 'KeyLeft2', KeyLeft2
);
639 WriteInt('Player2', 'KeyUp2', KeyUp2
);
640 WriteInt('Player2', 'KeyDown2', KeyDown2
);
641 WriteInt('Player2', 'KeyFire2', KeyFire2
);
642 WriteInt('Player2', 'KeyJump2', KeyJump2
);
643 WriteInt('Player2', 'KeyNextWeapon2', KeyNextWeapon2
);
644 WriteInt('Player2', 'KeyPrevWeapon2', KeyPrevWeapon2
);
645 WriteInt('Player2', 'KeyOpen2', KeyOpen2
);
646 WriteInt('Player2', 'KeyStrafe2', KeyStrafe2
);
647 for i
:= 0 to High(KeyWeapon2
) do
648 WriteInt('Player2', 'KeyWeapon2' + IntToStr(i
), KeyWeapon2
[i
]);
650 WriteStr('Player2', 'Name', Name
);
651 WriteStr('Player2', 'model', Model
);
652 WriteInt('Player2', 'red', Color
.R
);
653 WriteInt('Player2', 'green', Color
.G
);
654 WriteInt('Player2', 'blue', Color
.B
);
655 WriteInt('Player2', 'team', Team
);
658 for i
:= 0 to e_MaxJoys
-1 do
659 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
663 0: config
.WriteInt('Game', 'GibsCount', 0);
664 8: config
.WriteInt('Game', 'GibsCount', 1);
665 16: config
.WriteInt('Game', 'GibsCount', 2);
666 32: config
.WriteInt('Game', 'GibsCount', 3);
667 else config
.WriteInt('Game', 'GibsCount', 4);
670 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
671 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
672 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
673 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
674 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
675 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
676 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
677 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
678 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
679 config
.WriteInt('Game', 'Flash', gFlash
);
680 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
681 config
.WriteBool('Game', 'Messages', gShowMessages
);
682 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
683 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
684 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
685 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
686 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
687 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
688 config
.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch
);
690 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
691 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
692 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
693 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
694 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
695 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
696 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
697 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
698 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
699 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
700 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
702 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
703 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
704 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
705 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
706 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
707 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
708 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
709 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
710 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
711 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
712 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
714 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
715 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
717 config
.WriteStr ('Server', 'Name', NetServerName
);
718 config
.WriteStr ('Server', 'Password', NetPassword
);
719 config
.WriteInt ('Server', 'Port', NetPort
);
720 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
721 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
722 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
723 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
724 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
725 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
726 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
727 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
729 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
730 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
731 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
732 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
733 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
735 config
.SaveFile(FileName
);
739 procedure g_Options_Write_Language(FileName
: String);
743 e_WriteLog('Writing language config', TMsgType
.Notify
);
745 config
:= TConfig
.CreateFile(FileName
);
746 config
.WriteStr('Game', 'Language', gLanguage
);
747 config
.SaveFile(FileName
);
751 procedure g_Options_Write_Video(FileName
: String);
756 e_WriteLog('Writing resolution to config', TMsgType
.Notify
);
758 config
:= TConfig
.CreateFile(FileName
);
760 if gWinMaximized
and (not gFullscreen
) then
770 e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX
, gWinSizeY
, gScreenWidth
, gScreenHeight
]);
772 config
.WriteInt('Video', 'ScreenWidth', sW
);
773 config
.WriteInt('Video', 'ScreenHeight', sH
);
774 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
775 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
776 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
777 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
779 config
.SaveFile(FileName
);
783 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
787 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
789 config
:= TConfig
.CreateFile(FileName
);
791 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
792 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
793 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
794 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
795 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
796 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
797 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
798 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
799 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
800 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
801 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
803 config
.SaveFile(FileName
);
807 procedure g_Options_Write_Gameplay_Net(FileName
: String);
811 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
813 config
:= TConfig
.CreateFile(FileName
);
815 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
816 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
817 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
818 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
819 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
820 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
821 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
822 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
823 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
824 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
825 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
827 config
.SaveFile(FileName
);
831 procedure g_Options_Write_Net_Server(FileName
: String);
835 e_WriteLog('Writing server config', TMsgType
.Notify
);
837 config
:= TConfig
.CreateFile(FileName
);
839 config
.WriteStr ('Server', 'Name', NetServerName
);
840 config
.WriteStr ('Server', 'Password', NetPassword
);
841 config
.WriteInt ('Server', 'Port', NetPort
);
842 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
843 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
844 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
846 config
.SaveFile(FileName
);
850 procedure g_Options_Write_Net_Client(FileName
: String);
854 e_WriteLog('Writing client config', TMsgType
.Notify
);
856 config
:= TConfig
.CreateFile(FileName
);
858 config
.WriteStr('Client', 'LastIP', NetClientIP
);
859 config
.WriteInt('Client', 'LastPort', NetClientPort
);
861 config
.SaveFile(FileName
);