13de0c499d13e7a82df4b8c30e6404e1c271f286
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;
137 e_log
, e_input
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
138 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
139 g_items
, GL
, GLExt
, wadreader
, e_graphics
;
141 procedure g_Options_SetDefault();
145 g_Sound_SetupAllVolumes(75, 65);
147 gMuteWhenInactive
:= False;
148 gAnnouncer
:= ANNOUNCE_MEPLUS
;
149 gSoundEffectsDF
:= True;
152 g_Corpses_SetMax(20);
153 g_Shells_SetMax(300);
160 gDrawBackGround
:= True;
161 gShowMessages
:= True;
162 gRevertPlayers
:= False;
164 for i
:= 0 to e_MaxJoys
-1 do
165 e_JoystickDeadzones
[i
] := 8192;
167 with gGameControls
.GameControls
do
169 TakeScreenshot
:= 183;
172 TeamChat
:= 21; // [Y]
175 with gGameControls
.P1Control
do
187 for i
:= 0 to High(KeyWeapon
) do
200 for i
:= 0 to High(KeyWeapon2
) do
204 with gGameControls
.P2Control
do
216 for i
:= 0 to High(KeyWeapon
) do
229 for i
:= 0 to High(KeyWeapon2
) do
233 with gPlayer1Settings
do
236 Model
:= STD_PLAYER_MODEL
;
237 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
238 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
239 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
243 with gPlayer2Settings
do
246 Model
:= STD_PLAYER_MODEL
;
247 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
248 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
249 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
253 NetUseMaster
:= True;
254 g_Net_Slist_Set('mpms.doom2d.org', 25665);
257 procedure g_Options_Read(FileName
: String);
263 gAskLanguage
:= True;
264 e_WriteLog('Reading config', MSG_NOTIFY
);
266 if not FileExists(FileName
) then
268 e_WriteLog('Config file '+FileName
+' not found', MSG_WARNING
);
269 g_Options_SetDefault();
271 // Default video options:
273 gScreenHeight
:= 600;
276 gWinMaximized
:= False;
277 gFullScreen
:= False;
280 gTextureFilter
:= True;
281 glLegacyNPOT
:= False;
286 config
:= TConfig
.CreateFile(FileName
);
288 gScreenWidth
:= config
.ReadInt('Video', 'ScreenWidth', 800);
289 if gScreenWidth
< 640 then
291 gScreenHeight
:= config
.ReadInt('Video', 'ScreenHeight', 600);
292 if gScreenHeight
< 480 then
293 gScreenHeight
:= 480;
294 gWinRealPosX
:= config
.ReadInt('Video', 'WinPosX', 0);
295 if gWinRealPosX
< 0 then
297 gWinRealPosY
:= config
.ReadInt('Video', 'WinPosY', 0);
298 if gWinRealPosY
< 0 then
300 gFullScreen
:= config
.ReadBool('Video', 'Fullscreen', False);
301 gWinMaximized
:= config
.ReadBool('Video', 'Maximized', False);
302 gBPP
:= config
.ReadInt('Video', 'BPP', 32);
303 gFreq
:= config
.ReadInt('Video', 'Freq', 0);
304 gVSync
:= config
.ReadBool('Video', 'VSync', True);
305 gTextureFilter
:= config
.ReadBool('Video', 'TextureFilter', True);
306 glLegacyNPOT
:= config
.ReadBool('Video', 'LegacyCompatible', False);
308 gNoSound
:= config
.ReadBool('Sound', 'NoSound', False);
309 gSoundLevel
:= Min(config
.ReadInt('Sound', 'SoundLevel', 75), 255);
310 gMusicLevel
:= Min(config
.ReadInt('Sound', 'MusicLevel', 65), 255);
311 gMaxSimSounds
:= Max(Min(config
.ReadInt('Sound', 'MaxSimSounds', 8), 66), 2);
312 gMuteWhenInactive
:= config
.ReadBool('Sound', 'MuteInactive', False);
313 gAnnouncer
:= Min(Max(config
.ReadInt('Sound', 'Announcer', ANNOUNCE_MEPLUS
), ANNOUNCE_NONE
), ANNOUNCE_ALL
);
314 gSoundEffectsDF
:= config
.ReadBool('Sound', 'SoundEffectsDF', True);
315 gsSDLSampleRate
:= Min(Max(config
.ReadInt('Sound', 'SDLSampleRate', 44100), 11025), 96000);
316 gsSDLBufferSize
:= Min(Max(config
.ReadInt('Sound', 'SDLBufferSize', 2048), 64), 16384);
318 with gGameControls
.GameControls
do
320 TakeScreenshot
:= config
.ReadInt('GameControls', 'TakeScreenshot', 183);
321 Stat
:= config
.ReadInt('GameControls', 'Stat', 15);
322 Chat
:= config
.ReadInt('GameControls', 'Chat', 20);
323 TeamChat
:= config
.ReadInt('GameControls', 'TeamChat', 21);
326 with gGameControls
.P1Control
, config
do
328 KeyRight
:= ReadInt('Player1', 'KeyRight', 33);
329 KeyLeft
:= ReadInt('Player1', 'KeyLeft', 31);
330 KeyUp
:= ReadInt('Player1', 'KeyUp', 18);
331 KeyDown
:= ReadInt('Player1', 'KeyDown', 32);
332 KeyFire
:= ReadInt('Player1', 'KeyFire', 30);
333 KeyJump
:= ReadInt('Player1', 'KeyJump', 16);
334 KeyNextWeapon
:= ReadInt('Player1', 'KeyNextWeapon', 19);
335 KeyPrevWeapon
:= ReadInt('Player1', 'KeyPrevWeapon', 17);
336 KeyOpen
:= ReadInt('Player1', 'KeyOpen', 58);
337 KeyStrafe
:= ReadInt('Player1', 'KeyStrafe', 0);
338 for i
:= 0 to High(KeyWeapon
) do
339 KeyWeapon
[i
] := ReadInt('Player1', 'KeyWeapon' + IntToStr(i
), 0);
341 KeyRight2
:= ReadInt('Player1', 'KeyRight2', 0);
342 KeyLeft2
:= ReadInt('Player1', 'KeyLeft2', 0);
343 KeyUp2
:= ReadInt('Player1', 'KeyUp2', 0);
344 KeyDown2
:= ReadInt('Player1', 'KeyDown2', 0);
345 KeyFire2
:= ReadInt('Player1', 'KeyFire2', 0);
346 KeyJump2
:= ReadInt('Player1', 'KeyJump2', 0);
347 KeyNextWeapon2
:= ReadInt('Player1', 'KeyNextWeapon2', 0);
348 KeyPrevWeapon2
:= ReadInt('Player1', 'KeyPrevWeapon2', 0);
349 KeyOpen2
:= ReadInt('Player1', 'KeyOpen2', 0);
350 KeyStrafe2
:= ReadInt('Player1', 'KeyStrafe2', 0);
351 for i
:= 0 to High(KeyWeapon2
) do
352 KeyWeapon2
[i
] := ReadInt('Player1', 'KeyWeapon2' + IntToStr(i
), 0);
355 with gPlayer1Settings
, config
do
357 Name
:= ReadStr('Player1', 'name', 'Player1');
358 Model
:= ReadStr('Player1', 'model', STD_PLAYER_MODEL
);
359 Color
.R
:= Min(Abs(ReadInt('Player1', 'red', PLAYER1_DEF_COLOR
.R
)), 255);
360 Color
.G
:= Min(Abs(ReadInt('Player1', 'green', PLAYER1_DEF_COLOR
.G
)), 255);
361 Color
.B
:= Min(Abs(ReadInt('Player1', 'blue', PLAYER1_DEF_COLOR
.B
)), 255);
362 Team
:= ReadInt('Player1', 'team', TEAM_RED
);
363 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
367 with gGameControls
.P2Control
, config
do
369 KeyRight
:= ReadInt('Player2', 'KeyRight', 205);
370 KeyLeft
:= ReadInt('Player2', 'KeyLeft', 203);
371 KeyUp
:= ReadInt('Player2', 'KeyUp', 200);
372 KeyDown
:= ReadInt('Player2', 'KeyDown', 208);
373 KeyFire
:= ReadInt('Player2', 'KeyFire', 184);
374 KeyJump
:= ReadInt('Player2', 'KeyJump', 157);
375 KeyNextWeapon
:= ReadInt('Player2', 'KeyNextWeapon', 73);
376 KeyPrevWeapon
:= ReadInt('Player2', 'KeyPrevWeapon', 71);
377 KeyOpen
:= ReadInt('Player2', 'KeyOpen', 54);
378 KeyStrafe
:= ReadInt('Player2', 'KeyStrafe', 0);
379 for i
:= 0 to High(KeyWeapon
) do
380 KeyWeapon
[i
] := ReadInt('Player2', 'KeyWeapon' + IntToStr(i
), 0);
382 KeyRight2
:= ReadInt('Player2', 'KeyRight2', 0);
383 KeyLeft2
:= ReadInt('Player2', 'KeyLeft2', 0);
384 KeyUp2
:= ReadInt('Player2', 'KeyUp2', 0);
385 KeyDown2
:= ReadInt('Player2', 'KeyDown2', 0);
386 KeyFire2
:= ReadInt('Player2', 'KeyFire2', 0);
387 KeyJump2
:= ReadInt('Player2', 'KeyJump2', 0);
388 KeyNextWeapon2
:= ReadInt('Player2', 'KeyNextWeapon2', 0);
389 KeyPrevWeapon2
:= ReadInt('Player2', 'KeyPrevWeapon2', 0);
390 KeyOpen2
:= ReadInt('Player2', 'KeyOpen2', 0);
391 KeyStrafe2
:= ReadInt('Player2', 'KeyStrafe2', 0);
392 for i
:= 0 to High(KeyWeapon2
) do
393 KeyWeapon2
[i
] := ReadInt('Player2', 'KeyWeapon2' + IntToStr(i
), 0);
396 with gPlayer2Settings
, config
do
398 Name
:= ReadStr('Player2', 'name', 'Player2');
399 Model
:= ReadStr('Player2', 'model', STD_PLAYER_MODEL
);
400 Color
.R
:= Min(Abs(ReadInt('Player2', 'red', PLAYER2_DEF_COLOR
.R
)), 255);
401 Color
.G
:= Min(Abs(ReadInt('Player2', 'green', PLAYER2_DEF_COLOR
.G
)), 255);
402 Color
.B
:= Min(Abs(ReadInt('Player2', 'blue', PLAYER2_DEF_COLOR
.B
)), 255);
403 Team
:= ReadInt('Player2', 'team', TEAM_BLUE
);
404 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
408 for i
:= 0 to e_MaxJoys
-1 do
409 e_JoystickDeadzones
[i
] := config
.ReadInt('Joysticks', 'Deadzone' + IntToStr(i
), 8192);
411 g_GFX_SetMax(Min(config
.ReadInt('Game', 'MaxParticles', 1000), 50000));
412 g_Shells_SetMax(Min(config
.ReadInt('Game', 'MaxShells', 300), 600));
413 g_Gibs_SetMax(Min(config
.ReadInt('Game', 'MaxGibs', 150), 500));
414 g_Corpses_SetMax(Min(config
.ReadInt('Game', 'MaxCorpses', 20), 100));
416 case config
.ReadInt('Game', 'GibsCount', 3) of
421 else gGibsCount
:= 48;
424 ITEM_RESPAWNTIME
:= 36*Max(config
.ReadInt('Game', 'ItemRespawnTime', 60), 0);
425 gBloodCount
:= Min(config
.ReadInt('Game', 'BloodCount', 4), 4);
426 gAdvBlood
:= config
.ReadBool('Game', 'AdvancesBlood', True);
427 gAdvCorpses
:= config
.ReadBool('Game', 'AdvancesCorpses', True);
428 gAdvGibs
:= config
.ReadBool('Game', 'AdvancesGibs', True);
429 gFlash
:= Min(Max(config
.ReadInt('Game', 'Flash', 1), 0), 2);
430 gDrawBackGround
:= config
.ReadBool('Game', 'BackGround', True);
431 gShowMessages
:= config
.ReadBool('Game', 'Messages', True);
432 gRevertPlayers
:= config
.ReadBool('Game', 'RevertPlayers', False);
433 gChatBubble
:= Min(Max(config
.ReadInt('Game', 'ChatBubble', 4), 0), 4);
434 gSFSDebug
:= config
.ReadBool('Game', 'SFSDebug', False);
435 wadoptDebug
:= gSFSDebug
;
436 gSFSFastMode
:= config
.ReadBool('Game', 'SFSFastMode', False);
437 wadoptFast
:= gSFSFastMode
;
438 e_FastScreenshots
:= config
.ReadBool('Game', 'FastScreenshots', True);
439 gDefaultMegawadStart
:= config
.ReadStr('Game', 'DefaultMegawadStart', 'megawads/DOOM2D.WAD:\MAP01');
440 gBerserkAutoswitch
:= config
.ReadBool('Game', 'BerserkAutoswitch', False);
442 // Ãåéìïëåé â ñâîåé èãðå
443 gcMap
:= config
.ReadStr('GameplayCustom', 'Map', '');
444 gcGameMode
:= config
.ReadStr('GameplayCustom', 'GameMode', _lc
[I_MENU_GAME_TYPE_DM
]);
445 gcTimeLimit
:= Min(Max(config
.ReadInt('GameplayCustom', 'TimeLimit', 0), 0), 65535);
446 gcGoalLimit
:= Min(Max(config
.ReadInt('GameplayCustom', 'GoalLimit', 0), 0), 65535);
447 gcMaxLives
:= Min(Max(config
.ReadInt('GameplayCustom', 'MaxLives', 0), 0), 255);
448 gcPlayers
:= Min(Max(config
.ReadInt('GameplayCustom', 'Players', 1), 0), 2);
449 gcTeamDamage
:= config
.ReadBool('GameplayCustom', 'TeamDamage', False);
450 gcAllowExit
:= config
.ReadBool('GameplayCustom', 'AllowExit', True);
451 gcWeaponStay
:= config
.ReadBool('GameplayCustom', 'WeaponStay', False);
452 gcMonsters
:= config
.ReadBool('GameplayCustom', 'Monsters', False);
453 gcBotsVS
:= config
.ReadStr('GameplayCustom', 'BotsVS', 'Everybody');
455 with gGameSettings
do
457 GameMode
:= g_Game_TextToMode(gcGameMode
);
458 if GameMode
= GM_NONE
then
460 if GameMode
= GM_SINGLE
then
462 TimeLimit
:= gcTimeLimit
;
463 GoalLimit
:= gcGoalLimit
;
464 MaxLives
:= gcMaxLives
;
468 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
470 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
472 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
474 Options
:= Options
or GAME_OPTION_MONSTERS
;
475 if gcBotsVS
= 'Everybody' then
476 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
477 if gcBotsVS
= 'Players' then
478 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
479 if gcBotsVS
= 'Monsters' then
480 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
483 // Ãåéìïëåé â ñåòåâîé èãðå
484 gnMap
:= config
.ReadStr('GameplayNetwork', 'Map', '');
485 gnGameMode
:= config
.ReadStr('GameplayNetwork', 'GameMode', _lc
[I_MENU_GAME_TYPE_DM
]);
486 gnTimeLimit
:= Min(Max(config
.ReadInt('GameplayNetwork', 'TimeLimit', 0), 0), 65535);
487 gnGoalLimit
:= Min(Max(config
.ReadInt('GameplayNetwork', 'GoalLimit', 0), 0), 65535);
488 gnMaxLives
:= Min(Max(config
.ReadInt('GameplayNetwork', 'MaxLives', 0), 0), 255);
489 gnPlayers
:= Min(Max(config
.ReadInt('GameplayNetwork', 'Players', 1), 0), 2);
490 gnTeamDamage
:= config
.ReadBool('GameplayNetwork', 'TeamDamage', False);
491 gnAllowExit
:= config
.ReadBool('GameplayNetwork', 'AllowExit', True);
492 gnWeaponStay
:= config
.ReadBool('GameplayNetwork', 'WeaponStay', False);
493 gnMonsters
:= config
.ReadBool('GameplayNetwork', 'Monsters', False);
494 gnBotsVS
:= config
.ReadStr('GameplayNetwork', 'BotsVS', 'Everybody');
496 // Îáùèå ñåòåâûå
497 NetSlistIP
:= config
.ReadStr('MasterServer', 'IP', 'mpms.doom2d.org');
498 NetSlistPort
:= config
.ReadInt('MasterServer', 'Port', 25665);
501 NetServerName
:= config
.ReadStr('Server', 'Name', 'Unnamed Server');
502 NetPassword
:= config
.ReadStr('Server', 'Password', '');
503 NetPort
:= Min(Max(0, config
.ReadInt('Server', 'Port', 25666)), 65535);
504 NetMaxClients
:= Min(Max(0, config
.ReadInt('Server', 'MaxClients', 16)), NET_MAXCLIENTS
);
505 NetAllowRCON
:= config
.ReadBool('Server', 'RCON', False);
506 NetRCONPassword
:= config
.ReadStr('Server', 'RCONPassword', 'default');
507 NetUseMaster
:= config
.ReadBool('Server', 'SyncWithMaster', True);
508 NetUpdateRate
:= Max(0, config
.ReadInt('Server', 'UpdateInterval', 0));
509 NetRelupdRate
:= Max(0, config
.ReadInt('Server', 'ReliableUpdateInterval', 18));
510 NetMasterRate
:= Max(1, config
.ReadInt('Server', 'MasterSyncInterval', 60000));
513 NetInterpLevel
:= Max(0, config
.ReadInt('Client', 'InterpolationSteps', 2));
514 NetForcePlayerUpdate
:= config
.ReadBool('Client', 'ForcePlayerUpdate', False);
515 NetPredictSelf
:= config
.ReadBool('Client', 'PredictSelf', True);
516 NetClientIP
:= config
.ReadStr('Client', 'LastIP', '127.0.0.1');
517 NetClientPort
:= Max(0, config
.ReadInt('Client', 'LastPort', 25666));
520 str
:= config
.ReadStr('Game', 'Language', '');
521 if (str
= LANGUAGE_RUSSIAN
) or
522 (str
= LANGUAGE_ENGLISH
) then
525 gAskLanguage
:= False;
528 gLanguage
:= LANGUAGE_ENGLISH
;
532 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
535 procedure g_Options_Write(FileName
: String);
540 e_WriteLog('Writing config', MSG_NOTIFY
);
542 config
:= TConfig
.CreateFile(FileName
);
544 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
545 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
546 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
547 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
548 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
549 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
550 config
.WriteInt('Video', 'BPP', gBPP
);
551 config
.WriteBool('Video', 'VSync', gVSync
);
552 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
553 config
.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT
);
555 config
.WriteBool('Sound', 'NoSound', gNoSound
);
556 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
557 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
558 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
559 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
560 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
561 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
562 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
563 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
565 with config
, gGameControls
.GameControls
do
567 WriteInt('GameControls', 'TakeScreenshot', TakeScreenshot
);
568 WriteInt('GameControls', 'Stat', Stat
);
569 WriteInt('GameControls', 'Chat', Chat
);
570 WriteInt('GameControls', 'TeamChat', TeamChat
);
573 with config
, gGameControls
.P1Control
, gPlayer1Settings
do
575 WriteInt('Player1', 'KeyRight', KeyRight
);
576 WriteInt('Player1', 'KeyLeft', KeyLeft
);
577 WriteInt('Player1', 'KeyUp', KeyUp
);
578 WriteInt('Player1', 'KeyDown', KeyDown
);
579 WriteInt('Player1', 'KeyFire', KeyFire
);
580 WriteInt('Player1', 'KeyJump', KeyJump
);
581 WriteInt('Player1', 'KeyNextWeapon', KeyNextWeapon
);
582 WriteInt('Player1', 'KeyPrevWeapon', KeyPrevWeapon
);
583 WriteInt('Player1', 'KeyOpen', KeyOpen
);
584 WriteInt('Player1', 'KeyStrafe', KeyStrafe
);
585 for i
:= 0 to High(KeyWeapon
) do
586 WriteInt('Player1', 'KeyWeapon' + IntToStr(i
), KeyWeapon
[i
]);
588 WriteInt('Player1', 'KeyRight2', KeyRight2
);
589 WriteInt('Player1', 'KeyLeft2', KeyLeft2
);
590 WriteInt('Player1', 'KeyUp2', KeyUp2
);
591 WriteInt('Player1', 'KeyDown2', KeyDown2
);
592 WriteInt('Player1', 'KeyFire2', KeyFire2
);
593 WriteInt('Player1', 'KeyJump2', KeyJump2
);
594 WriteInt('Player1', 'KeyNextWeapon2', KeyNextWeapon2
);
595 WriteInt('Player1', 'KeyPrevWeapon2', KeyPrevWeapon2
);
596 WriteInt('Player1', 'KeyOpen2', KeyOpen2
);
597 WriteInt('Player1', 'KeyStrafe2', KeyStrafe2
);
598 for i
:= 0 to High(KeyWeapon2
) do
599 WriteInt('Player1', 'KeyWeapon2' + IntToStr(i
), KeyWeapon2
[i
]);
601 WriteStr('Player1', 'Name', Name
);
602 WriteStr('Player1', 'model', Model
);
603 WriteInt('Player1', 'red', Color
.R
);
604 WriteInt('Player1', 'green', Color
.G
);
605 WriteInt('Player1', 'blue', Color
.B
);
606 WriteInt('Player1', 'team', Team
);
609 with config
, gGameControls
.P2Control
, gPlayer2Settings
do
611 WriteInt('Player2', 'KeyRight', KeyRight
);
612 WriteInt('Player2', 'KeyLeft', KeyLeft
);
613 WriteInt('Player2', 'KeyUp', KeyUp
);
614 WriteInt('Player2', 'KeyDown', KeyDown
);
615 WriteInt('Player2', 'KeyFire', KeyFire
);
616 WriteInt('Player2', 'KeyJump', KeyJump
);
617 WriteInt('Player2', 'KeyNextWeapon', KeyNextWeapon
);
618 WriteInt('Player2', 'KeyPrevWeapon', KeyPrevWeapon
);
619 WriteInt('Player2', 'KeyOpen', KeyOpen
);
620 WriteInt('Player2', 'KeyStrafe', KeyStrafe
);
621 for i
:= 0 to High(KeyWeapon
) do
622 WriteInt('Player2', 'KeyWeapon' + IntToStr(i
), KeyWeapon
[i
]);
624 WriteInt('Player2', 'KeyRight2', KeyRight2
);
625 WriteInt('Player2', 'KeyLeft2', KeyLeft2
);
626 WriteInt('Player2', 'KeyUp2', KeyUp2
);
627 WriteInt('Player2', 'KeyDown2', KeyDown2
);
628 WriteInt('Player2', 'KeyFire2', KeyFire2
);
629 WriteInt('Player2', 'KeyJump2', KeyJump2
);
630 WriteInt('Player2', 'KeyNextWeapon2', KeyNextWeapon2
);
631 WriteInt('Player2', 'KeyPrevWeapon2', KeyPrevWeapon2
);
632 WriteInt('Player2', 'KeyOpen2', KeyOpen2
);
633 WriteInt('Player2', 'KeyStrafe2', KeyStrafe2
);
634 for i
:= 0 to High(KeyWeapon2
) do
635 WriteInt('Player2', 'KeyWeapon2' + IntToStr(i
), KeyWeapon2
[i
]);
637 WriteStr('Player2', 'Name', Name
);
638 WriteStr('Player2', 'model', Model
);
639 WriteInt('Player2', 'red', Color
.R
);
640 WriteInt('Player2', 'green', Color
.G
);
641 WriteInt('Player2', 'blue', Color
.B
);
642 WriteInt('Player2', 'team', Team
);
645 for i
:= 0 to e_MaxJoys
-1 do
646 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
650 0: config
.WriteInt('Game', 'GibsCount', 0);
651 8: config
.WriteInt('Game', 'GibsCount', 1);
652 16: config
.WriteInt('Game', 'GibsCount', 2);
653 32: config
.WriteInt('Game', 'GibsCount', 3);
654 else config
.WriteInt('Game', 'GibsCount', 4);
657 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
658 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
659 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
660 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
661 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
662 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
663 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
664 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
665 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
666 config
.WriteInt('Game', 'Flash', gFlash
);
667 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
668 config
.WriteBool('Game', 'Messages', gShowMessages
);
669 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
670 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
671 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
672 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
673 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
674 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
675 config
.WriteBool('Game', 'BerserkAutoswitch', gBerserkAutoswitch
);
677 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
678 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
679 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
680 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
681 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
682 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
683 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
684 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
685 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
686 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
687 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
689 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
690 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
691 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
692 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
693 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
694 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
695 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
696 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
697 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
698 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
699 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
701 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
702 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
704 config
.WriteStr ('Server', 'Name', NetServerName
);
705 config
.WriteStr ('Server', 'Password', NetPassword
);
706 config
.WriteInt ('Server', 'Port', NetPort
);
707 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
708 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
709 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
710 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
711 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
712 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
713 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
715 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
716 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
717 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
718 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
719 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
721 config
.SaveFile(FileName
);
725 procedure g_Options_Write_Language(FileName
: String);
729 e_WriteLog('Writing language config', MSG_NOTIFY
);
731 config
:= TConfig
.CreateFile(FileName
);
732 config
.WriteStr('Game', 'Language', gLanguage
);
733 config
.SaveFile(FileName
);
737 procedure g_Options_Write_Video(FileName
: String);
742 e_WriteLog('Writing resolution to config', MSG_NOTIFY
);
744 config
:= TConfig
.CreateFile(FileName
);
746 if gWinMaximized
and (not gFullscreen
) then
757 config
.WriteInt('Video', 'ScreenWidth', sW
);
758 config
.WriteInt('Video', 'ScreenHeight', sH
);
759 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
760 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
761 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
762 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
764 config
.SaveFile(FileName
);
768 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
772 e_WriteLog('Writing custom gameplay config', MSG_NOTIFY
);
774 config
:= TConfig
.CreateFile(FileName
);
776 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
777 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
778 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
779 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
780 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
781 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
782 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
783 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
784 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
785 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
786 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
788 config
.SaveFile(FileName
);
792 procedure g_Options_Write_Gameplay_Net(FileName
: String);
796 e_WriteLog('Writing network gameplay config', MSG_NOTIFY
);
798 config
:= TConfig
.CreateFile(FileName
);
800 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
801 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
802 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
803 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
804 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
805 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
806 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
807 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
808 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
809 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
810 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
812 config
.SaveFile(FileName
);
816 procedure g_Options_Write_Net_Server(FileName
: String);
820 e_WriteLog('Writing server config', MSG_NOTIFY
);
822 config
:= TConfig
.CreateFile(FileName
);
824 config
.WriteStr ('Server', 'Name', NetServerName
);
825 config
.WriteStr ('Server', 'Password', NetPassword
);
826 config
.WriteInt ('Server', 'Port', NetPort
);
827 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
828 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
830 config
.SaveFile(FileName
);
834 procedure g_Options_Write_Net_Client(FileName
: String);
838 e_WriteLog('Writing client config', MSG_NOTIFY
);
840 config
:= TConfig
.CreateFile(FileName
);
842 config
.WriteStr('Client', 'LastIP', NetClientIP
);
843 config
.WriteInt('Client', 'LastPort', NetClientPort
);
845 config
.SaveFile(FileName
);