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);
75 gGameControls
: TControls
;
76 gScreenWidth
: Word = 800;
77 gScreenHeight
: Word = 600;
78 gWinRealPosX
: Integer = 0;
79 gWinRealPosY
: Integer = 0;
82 gFullscreen
: Boolean = False;
83 gWinMaximized
: Boolean = False;
84 gVSync
: Boolean = False;
85 glLegacyNPOT
: Boolean = False;
86 gTextureFilter
: Boolean = True;
87 gNoSound
: Boolean = False;
88 gSoundLevel
: Byte = 75;
89 gMusicLevel
: Byte = 65;
90 gMaxSimSounds
: Byte = 8;
91 gMuteWhenInactive
: Boolean = False;
92 gAdvCorpses
: Boolean = True;
93 gAdvBlood
: Boolean = True;
94 gAdvGibs
: Boolean = True;
95 gGibsCount
: Integer = 32;
96 gBloodCount
: Byte = 3;
98 gDrawBackGround
: Boolean = True;
99 gShowMessages
: Boolean = True;
100 gRevertPlayers
: Boolean = False;
101 gLanguage
: String = LANGUAGE_ENGLISH
;
102 gAskLanguage
: Boolean = True;
104 gcGameMode
: String = '';
105 gcTimeLimit
: Word = 0;
106 gcGoalLimit
: Word = 0;
107 gcMaxLives
: Byte = 0;
109 gcTeamDamage
: Boolean = False;
110 gcAllowExit
: Boolean = True;
111 gcWeaponStay
: Boolean = False;
112 gcMonsters
: Boolean = False;
113 gcBotsVS
: String = 'Everybody';
115 gnGameMode
: String = '';
116 gnTimeLimit
: Word = 0;
117 gnGoalLimit
: Word = 0;
118 gnMaxLives
: Byte = 0;
120 gnTeamDamage
: Boolean = False;
121 gnAllowExit
: Boolean = True;
122 gnWeaponStay
: Boolean = False;
123 gnMonsters
: Boolean = False;
124 gnBotsVS
: String = 'Everybody';
125 gsSDLSampleRate
: Integer = 44100;
126 gsSDLBufferSize
: Integer = 2048;
127 gSFSDebug
: Boolean = False;
128 gSFSFastMode
: Boolean = False;
133 e_log
, e_input
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
134 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_textures
,
135 g_items
, GL
, GLExt
, wadreader
, e_graphics
;
137 procedure g_Options_SetDefault();
141 g_Sound_SetupAllVolumes(75, 65);
143 gMuteWhenInactive
:= False;
144 gAnnouncer
:= ANNOUNCE_MEPLUS
;
145 gSoundEffectsDF
:= True;
148 g_Corpses_SetMax(20);
149 g_Shells_SetMax(300);
156 gDrawBackGround
:= True;
157 gShowMessages
:= True;
158 gRevertPlayers
:= False;
160 for i
:= 0 to e_MaxJoys
-1 do
161 e_JoystickDeadzones
[i
] := 8192;
163 with gGameControls
.GameControls
do
165 TakeScreenshot
:= 183;
168 TeamChat
:= 21; // [Y]
171 with gGameControls
.P1Control
do
183 for i
:= 0 to High(KeyWeapon
) do
196 for i
:= 0 to High(KeyWeapon2
) do
200 with gGameControls
.P2Control
do
212 for i
:= 0 to High(KeyWeapon
) do
225 for i
:= 0 to High(KeyWeapon2
) do
229 with gPlayer1Settings
do
232 Model
:= STD_PLAYER_MODEL
;
233 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
234 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
235 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
239 with gPlayer2Settings
do
242 Model
:= STD_PLAYER_MODEL
;
243 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
244 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
245 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
249 NetUseMaster
:= True;
250 g_Net_Slist_Set('mpms.doom2d.org', 25665);
253 procedure g_Options_Read(FileName
: String);
259 gAskLanguage
:= True;
260 e_WriteLog('Reading config', MSG_NOTIFY
);
262 if not FileExists(FileName
) then
264 e_WriteLog('Config file '+FileName
+' not found', MSG_WARNING
);
265 g_Options_SetDefault();
267 // Default video options:
269 gScreenHeight
:= 600;
272 gWinMaximized
:= False;
273 gFullScreen
:= False;
276 gTextureFilter
:= True;
277 glLegacyNPOT
:= False;
282 config
:= TConfig
.CreateFile(FileName
);
284 gScreenWidth
:= config
.ReadInt('Video', 'ScreenWidth', 800);
285 if gScreenWidth
< 640 then
287 gScreenHeight
:= config
.ReadInt('Video', 'ScreenHeight', 600);
288 if gScreenHeight
< 480 then
289 gScreenHeight
:= 480;
290 gWinRealPosX
:= config
.ReadInt('Video', 'WinPosX', 0);
291 if gWinRealPosX
< 0 then
293 gWinRealPosY
:= config
.ReadInt('Video', 'WinPosY', 0);
294 if gWinRealPosY
< 0 then
296 gFullScreen
:= config
.ReadBool('Video', 'Fullscreen', False);
297 gWinMaximized
:= config
.ReadBool('Video', 'Maximized', False);
298 gBPP
:= config
.ReadInt('Video', 'BPP', 32);
299 gFreq
:= config
.ReadInt('Video', 'Freq', 0);
300 gVSync
:= config
.ReadBool('Video', 'VSync', True);
301 gTextureFilter
:= config
.ReadBool('Video', 'TextureFilter', True);
302 glLegacyNPOT
:= config
.ReadBool('Video', 'LegacyCompatible', False);
304 gNoSound
:= config
.ReadBool('Sound', 'NoSound', False);
305 gSoundLevel
:= Min(config
.ReadInt('Sound', 'SoundLevel', 75), 255);
306 gMusicLevel
:= Min(config
.ReadInt('Sound', 'MusicLevel', 65), 255);
307 gMaxSimSounds
:= Max(Min(config
.ReadInt('Sound', 'MaxSimSounds', 8), 66), 2);
308 gMuteWhenInactive
:= config
.ReadBool('Sound', 'MuteInactive', False);
309 gAnnouncer
:= Min(Max(config
.ReadInt('Sound', 'Announcer', ANNOUNCE_MEPLUS
), ANNOUNCE_NONE
), ANNOUNCE_ALL
);
310 gSoundEffectsDF
:= config
.ReadBool('Sound', 'SoundEffectsDF', True);
311 gsSDLSampleRate
:= Min(Max(config
.ReadInt('Sound', 'SDLSampleRate', 44100), 11025), 96000);
312 gsSDLBufferSize
:= Min(Max(config
.ReadInt('Sound', 'SDLBufferSize', 2048), 64), 16384);
314 with gGameControls
.GameControls
do
316 TakeScreenshot
:= config
.ReadInt('GameControls', 'TakeScreenshot', 183);
317 Stat
:= config
.ReadInt('GameControls', 'Stat', 15);
318 Chat
:= config
.ReadInt('GameControls', 'Chat', 20);
319 TeamChat
:= config
.ReadInt('GameControls', 'TeamChat', 21);
322 with gGameControls
.P1Control
, config
do
324 KeyRight
:= ReadInt('Player1', 'KeyRight', 33);
325 KeyLeft
:= ReadInt('Player1', 'KeyLeft', 31);
326 KeyUp
:= ReadInt('Player1', 'KeyUp', 18);
327 KeyDown
:= ReadInt('Player1', 'KeyDown', 32);
328 KeyFire
:= ReadInt('Player1', 'KeyFire', 30);
329 KeyJump
:= ReadInt('Player1', 'KeyJump', 16);
330 KeyNextWeapon
:= ReadInt('Player1', 'KeyNextWeapon', 19);
331 KeyPrevWeapon
:= ReadInt('Player1', 'KeyPrevWeapon', 17);
332 KeyOpen
:= ReadInt('Player1', 'KeyOpen', 58);
333 KeyStrafe
:= ReadInt('Player1', 'KeyStrafe', 0);
334 for i
:= 0 to High(KeyWeapon
) do
335 KeyWeapon
[i
] := ReadInt('Player1', 'KeyWeapon' + IntToStr(i
), 0);
337 KeyRight2
:= ReadInt('Player1', 'KeyRight2', 0);
338 KeyLeft2
:= ReadInt('Player1', 'KeyLeft2', 0);
339 KeyUp2
:= ReadInt('Player1', 'KeyUp2', 0);
340 KeyDown2
:= ReadInt('Player1', 'KeyDown2', 0);
341 KeyFire2
:= ReadInt('Player1', 'KeyFire2', 0);
342 KeyJump2
:= ReadInt('Player1', 'KeyJump2', 0);
343 KeyNextWeapon2
:= ReadInt('Player1', 'KeyNextWeapon2', 0);
344 KeyPrevWeapon2
:= ReadInt('Player1', 'KeyPrevWeapon2', 0);
345 KeyOpen2
:= ReadInt('Player1', 'KeyOpen2', 0);
346 KeyStrafe2
:= ReadInt('Player1', 'KeyStrafe2', 0);
347 for i
:= 0 to High(KeyWeapon2
) do
348 KeyWeapon2
[i
] := ReadInt('Player1', 'KeyWeapon2' + IntToStr(i
), 0);
351 with gPlayer1Settings
, config
do
353 Name
:= ReadStr('Player1', 'name', 'Player1');
354 Model
:= ReadStr('Player1', 'model', STD_PLAYER_MODEL
);
355 Color
.R
:= Min(Abs(ReadInt('Player1', 'red', PLAYER1_DEF_COLOR
.R
)), 255);
356 Color
.G
:= Min(Abs(ReadInt('Player1', 'green', PLAYER1_DEF_COLOR
.G
)), 255);
357 Color
.B
:= Min(Abs(ReadInt('Player1', 'blue', PLAYER1_DEF_COLOR
.B
)), 255);
358 Team
:= ReadInt('Player1', 'team', TEAM_RED
);
359 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
363 with gGameControls
.P2Control
, config
do
365 KeyRight
:= ReadInt('Player2', 'KeyRight', 205);
366 KeyLeft
:= ReadInt('Player2', 'KeyLeft', 203);
367 KeyUp
:= ReadInt('Player2', 'KeyUp', 200);
368 KeyDown
:= ReadInt('Player2', 'KeyDown', 208);
369 KeyFire
:= ReadInt('Player2', 'KeyFire', 184);
370 KeyJump
:= ReadInt('Player2', 'KeyJump', 157);
371 KeyNextWeapon
:= ReadInt('Player2', 'KeyNextWeapon', 73);
372 KeyPrevWeapon
:= ReadInt('Player2', 'KeyPrevWeapon', 71);
373 KeyOpen
:= ReadInt('Player2', 'KeyOpen', 54);
374 KeyStrafe
:= ReadInt('Player2', 'KeyStrafe', 0);
375 for i
:= 0 to High(KeyWeapon
) do
376 KeyWeapon
[i
] := ReadInt('Player2', 'KeyWeapon' + IntToStr(i
), 0);
378 KeyRight2
:= ReadInt('Player2', 'KeyRight2', 0);
379 KeyLeft2
:= ReadInt('Player2', 'KeyLeft2', 0);
380 KeyUp2
:= ReadInt('Player2', 'KeyUp2', 0);
381 KeyDown2
:= ReadInt('Player2', 'KeyDown2', 0);
382 KeyFire2
:= ReadInt('Player2', 'KeyFire2', 0);
383 KeyJump2
:= ReadInt('Player2', 'KeyJump2', 0);
384 KeyNextWeapon2
:= ReadInt('Player2', 'KeyNextWeapon2', 0);
385 KeyPrevWeapon2
:= ReadInt('Player2', 'KeyPrevWeapon2', 0);
386 KeyOpen2
:= ReadInt('Player2', 'KeyOpen2', 0);
387 KeyStrafe2
:= ReadInt('Player2', 'KeyStrafe2', 0);
388 for i
:= 0 to High(KeyWeapon2
) do
389 KeyWeapon2
[i
] := ReadInt('Player2', 'KeyWeapon2' + IntToStr(i
), 0);
392 with gPlayer2Settings
, config
do
394 Name
:= ReadStr('Player2', 'name', 'Player2');
395 Model
:= ReadStr('Player2', 'model', STD_PLAYER_MODEL
);
396 Color
.R
:= Min(Abs(ReadInt('Player2', 'red', PLAYER2_DEF_COLOR
.R
)), 255);
397 Color
.G
:= Min(Abs(ReadInt('Player2', 'green', PLAYER2_DEF_COLOR
.G
)), 255);
398 Color
.B
:= Min(Abs(ReadInt('Player2', 'blue', PLAYER2_DEF_COLOR
.B
)), 255);
399 Team
:= ReadInt('Player2', 'team', TEAM_BLUE
);
400 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
404 for i
:= 0 to e_MaxJoys
-1 do
405 e_JoystickDeadzones
[i
] := config
.ReadInt('Joysticks', 'Deadzone' + IntToStr(i
), 8192);
407 g_GFX_SetMax(Min(config
.ReadInt('Game', 'MaxParticles', 1000), 50000));
408 g_Shells_SetMax(Min(config
.ReadInt('Game', 'MaxShells', 300), 600));
409 g_Gibs_SetMax(Min(config
.ReadInt('Game', 'MaxGibs', 150), 500));
410 g_Corpses_SetMax(Min(config
.ReadInt('Game', 'MaxCorpses', 20), 100));
412 case config
.ReadInt('Game', 'GibsCount', 3) of
417 else gGibsCount
:= 48;
420 ITEM_RESPAWNTIME
:= 36*Max(config
.ReadInt('Game', 'ItemRespawnTime', 60), 0);
421 gBloodCount
:= Min(config
.ReadInt('Game', 'BloodCount', 4), 4);
422 gAdvBlood
:= config
.ReadBool('Game', 'AdvancesBlood', True);
423 gAdvCorpses
:= config
.ReadBool('Game', 'AdvancesCorpses', True);
424 gAdvGibs
:= config
.ReadBool('Game', 'AdvancesGibs', True);
425 gFlash
:= Min(Max(config
.ReadInt('Game', 'Flash', 1), 0), 2);
426 gDrawBackGround
:= config
.ReadBool('Game', 'BackGround', True);
427 gShowMessages
:= config
.ReadBool('Game', 'Messages', True);
428 gRevertPlayers
:= config
.ReadBool('Game', 'RevertPlayers', False);
429 gChatBubble
:= Min(Max(config
.ReadInt('Game', 'ChatBubble', 4), 0), 4);
430 gSFSDebug
:= config
.ReadBool('Game', 'SFSDebug', False);
431 wadoptDebug
:= gSFSDebug
;
432 gSFSFastMode
:= config
.ReadBool('Game', 'SFSFastMode', False);
433 wadoptFast
:= gSFSFastMode
;
434 e_FastScreenshots
:= config
.ReadBool('Game', 'FastScreenshots', True);
436 // Ãåéìïëåé â ñâîåé èãðå
437 gcMap
:= config
.ReadStr('GameplayCustom', 'Map', '');
438 gcGameMode
:= config
.ReadStr('GameplayCustom', 'GameMode', _lc
[I_MENU_GAME_TYPE_DM
]);
439 gcTimeLimit
:= Min(Max(config
.ReadInt('GameplayCustom', 'TimeLimit', 0), 0), 65535);
440 gcGoalLimit
:= Min(Max(config
.ReadInt('GameplayCustom', 'GoalLimit', 0), 0), 65535);
441 gcMaxLives
:= Min(Max(config
.ReadInt('GameplayCustom', 'MaxLives', 0), 0), 255);
442 gcPlayers
:= Min(Max(config
.ReadInt('GameplayCustom', 'Players', 1), 0), 2);
443 gcTeamDamage
:= config
.ReadBool('GameplayCustom', 'TeamDamage', False);
444 gcAllowExit
:= config
.ReadBool('GameplayCustom', 'AllowExit', True);
445 gcWeaponStay
:= config
.ReadBool('GameplayCustom', 'WeaponStay', False);
446 gcMonsters
:= config
.ReadBool('GameplayCustom', 'Monsters', False);
447 gcBotsVS
:= config
.ReadStr('GameplayCustom', 'BotsVS', 'Everybody');
449 with gGameSettings
do
451 GameMode
:= g_Game_TextToMode(gcGameMode
);
452 if GameMode
= GM_NONE
then
454 if GameMode
= GM_SINGLE
then
456 TimeLimit
:= gcTimeLimit
;
457 GoalLimit
:= gcGoalLimit
;
458 MaxLives
:= gcMaxLives
;
462 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
464 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
466 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
468 Options
:= Options
or GAME_OPTION_MONSTERS
;
469 if gcBotsVS
= 'Everybody' then
470 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
471 if gcBotsVS
= 'Players' then
472 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
473 if gcBotsVS
= 'Monsters' then
474 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
477 // Ãåéìïëåé â ñåòåâîé èãðå
478 gnMap
:= config
.ReadStr('GameplayNetwork', 'Map', '');
479 gnGameMode
:= config
.ReadStr('GameplayNetwork', 'GameMode', _lc
[I_MENU_GAME_TYPE_DM
]);
480 gnTimeLimit
:= Min(Max(config
.ReadInt('GameplayNetwork', 'TimeLimit', 0), 0), 65535);
481 gnGoalLimit
:= Min(Max(config
.ReadInt('GameplayNetwork', 'GoalLimit', 0), 0), 65535);
482 gnMaxLives
:= Min(Max(config
.ReadInt('GameplayNetwork', 'MaxLives', 0), 0), 255);
483 gnPlayers
:= Min(Max(config
.ReadInt('GameplayNetwork', 'Players', 1), 0), 2);
484 gnTeamDamage
:= config
.ReadBool('GameplayNetwork', 'TeamDamage', False);
485 gnAllowExit
:= config
.ReadBool('GameplayNetwork', 'AllowExit', True);
486 gnWeaponStay
:= config
.ReadBool('GameplayNetwork', 'WeaponStay', False);
487 gnMonsters
:= config
.ReadBool('GameplayNetwork', 'Monsters', False);
488 gnBotsVS
:= config
.ReadStr('GameplayNetwork', 'BotsVS', 'Everybody');
490 // Îáùèå ñåòåâûå
491 NetSlistIP
:= config
.ReadStr('MasterServer', 'IP', 'mpms.doom2d.org');
492 NetSlistPort
:= config
.ReadInt('MasterServer', 'Port', 25665);
495 NetServerName
:= config
.ReadStr('Server', 'Name', 'Unnamed Server');
496 NetPassword
:= config
.ReadStr('Server', 'Password', '');
497 NetPort
:= Min(Max(0, config
.ReadInt('Server', 'Port', 25666)), 65535);
498 NetMaxClients
:= Min(Max(0, config
.ReadInt('Server', 'MaxClients', 16)), NET_MAXCLIENTS
);
499 NetAllowRCON
:= config
.ReadBool('Server', 'RCON', False);
500 NetRCONPassword
:= config
.ReadStr('Server', 'RCONPassword', 'default');
501 NetUseMaster
:= config
.ReadBool('Server', 'SyncWithMaster', True);
502 NetUpdateRate
:= Max(0, config
.ReadInt('Server', 'UpdateInterval', 0));
503 NetRelupdRate
:= Max(0, config
.ReadInt('Server', 'ReliableUpdateInterval', 18));
504 NetMasterRate
:= Max(1, config
.ReadInt('Server', 'MasterSyncInterval', 60000));
507 NetInterpLevel
:= Max(0, config
.ReadInt('Client', 'InterpolationSteps', 2));
508 NetForcePlayerUpdate
:= config
.ReadBool('Client', 'ForcePlayerUpdate', False);
509 NetPredictSelf
:= config
.ReadBool('Client', 'PredictSelf', True);
510 NetClientIP
:= config
.ReadStr('Client', 'LastIP', '127.0.0.1');
511 NetClientPort
:= Max(0, config
.ReadInt('Client', 'LastPort', 25666));
514 str
:= config
.ReadStr('Game', 'Language', '');
515 if (str
= LANGUAGE_RUSSIAN
) or
516 (str
= LANGUAGE_ENGLISH
) then
519 gAskLanguage
:= False;
522 gLanguage
:= LANGUAGE_ENGLISH
;
526 if gTextureFilter
then
527 TEXTUREFILTER
:= GL_LINEAR
529 TEXTUREFILTER
:= GL_NEAREST
;
532 procedure g_Options_Write(FileName
: String);
537 e_WriteLog('Writing config', MSG_NOTIFY
);
539 config
:= TConfig
.CreateFile(FileName
);
541 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
542 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
543 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
544 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
545 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
546 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
547 config
.WriteInt('Video', 'BPP', gBPP
);
548 config
.WriteBool('Video', 'VSync', gVSync
);
549 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
550 config
.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT
);
552 config
.WriteBool('Sound', 'NoSound', gNoSound
);
553 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
554 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
555 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
556 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
557 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
558 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
559 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
560 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
562 with config
, gGameControls
.GameControls
do
564 WriteInt('GameControls', 'TakeScreenshot', TakeScreenshot
);
565 WriteInt('GameControls', 'Stat', Stat
);
566 WriteInt('GameControls', 'Chat', Chat
);
567 WriteInt('GameControls', 'TeamChat', TeamChat
);
570 with config
, gGameControls
.P1Control
, gPlayer1Settings
do
572 WriteInt('Player1', 'KeyRight', KeyRight
);
573 WriteInt('Player1', 'KeyLeft', KeyLeft
);
574 WriteInt('Player1', 'KeyUp', KeyUp
);
575 WriteInt('Player1', 'KeyDown', KeyDown
);
576 WriteInt('Player1', 'KeyFire', KeyFire
);
577 WriteInt('Player1', 'KeyJump', KeyJump
);
578 WriteInt('Player1', 'KeyNextWeapon', KeyNextWeapon
);
579 WriteInt('Player1', 'KeyPrevWeapon', KeyPrevWeapon
);
580 WriteInt('Player1', 'KeyOpen', KeyOpen
);
581 WriteInt('Player1', 'KeyStrafe', KeyStrafe
);
582 for i
:= 0 to High(KeyWeapon
) do
583 WriteInt('Player1', 'KeyWeapon' + IntToStr(i
), KeyWeapon
[i
]);
585 WriteInt('Player1', 'KeyRight2', KeyRight2
);
586 WriteInt('Player1', 'KeyLeft2', KeyLeft2
);
587 WriteInt('Player1', 'KeyUp2', KeyUp2
);
588 WriteInt('Player1', 'KeyDown2', KeyDown2
);
589 WriteInt('Player1', 'KeyFire2', KeyFire2
);
590 WriteInt('Player1', 'KeyJump2', KeyJump2
);
591 WriteInt('Player1', 'KeyNextWeapon2', KeyNextWeapon2
);
592 WriteInt('Player1', 'KeyPrevWeapon2', KeyPrevWeapon2
);
593 WriteInt('Player1', 'KeyOpen2', KeyOpen2
);
594 WriteInt('Player1', 'KeyStrafe2', KeyStrafe2
);
595 for i
:= 0 to High(KeyWeapon2
) do
596 WriteInt('Player1', 'KeyWeapon2' + IntToStr(i
), KeyWeapon2
[i
]);
598 WriteStr('Player1', 'Name', Name
);
599 WriteStr('Player1', 'model', Model
);
600 WriteInt('Player1', 'red', Color
.R
);
601 WriteInt('Player1', 'green', Color
.G
);
602 WriteInt('Player1', 'blue', Color
.B
);
603 WriteInt('Player1', 'team', Team
);
606 with config
, gGameControls
.P2Control
, gPlayer2Settings
do
608 WriteInt('Player2', 'KeyRight', KeyRight
);
609 WriteInt('Player2', 'KeyLeft', KeyLeft
);
610 WriteInt('Player2', 'KeyUp', KeyUp
);
611 WriteInt('Player2', 'KeyDown', KeyDown
);
612 WriteInt('Player2', 'KeyFire', KeyFire
);
613 WriteInt('Player2', 'KeyJump', KeyJump
);
614 WriteInt('Player2', 'KeyNextWeapon', KeyNextWeapon
);
615 WriteInt('Player2', 'KeyPrevWeapon', KeyPrevWeapon
);
616 WriteInt('Player2', 'KeyOpen', KeyOpen
);
617 WriteInt('Player2', 'KeyStrafe', KeyStrafe
);
618 for i
:= 0 to High(KeyWeapon
) do
619 WriteInt('Player2', 'KeyWeapon' + IntToStr(i
), KeyWeapon
[i
]);
621 WriteInt('Player2', 'KeyRight2', KeyRight2
);
622 WriteInt('Player2', 'KeyLeft2', KeyLeft2
);
623 WriteInt('Player2', 'KeyUp2', KeyUp2
);
624 WriteInt('Player2', 'KeyDown2', KeyDown2
);
625 WriteInt('Player2', 'KeyFire2', KeyFire2
);
626 WriteInt('Player2', 'KeyJump2', KeyJump2
);
627 WriteInt('Player2', 'KeyNextWeapon2', KeyNextWeapon2
);
628 WriteInt('Player2', 'KeyPrevWeapon2', KeyPrevWeapon2
);
629 WriteInt('Player2', 'KeyOpen2', KeyOpen2
);
630 WriteInt('Player2', 'KeyStrafe2', KeyStrafe2
);
631 for i
:= 0 to High(KeyWeapon2
) do
632 WriteInt('Player2', 'KeyWeapon2' + IntToStr(i
), KeyWeapon2
[i
]);
634 WriteStr('Player2', 'Name', Name
);
635 WriteStr('Player2', 'model', Model
);
636 WriteInt('Player2', 'red', Color
.R
);
637 WriteInt('Player2', 'green', Color
.G
);
638 WriteInt('Player2', 'blue', Color
.B
);
639 WriteInt('Player2', 'team', Team
);
642 for i
:= 0 to e_MaxJoys
-1 do
643 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
647 0: config
.WriteInt('Game', 'GibsCount', 0);
648 8: config
.WriteInt('Game', 'GibsCount', 1);
649 16: config
.WriteInt('Game', 'GibsCount', 2);
650 32: config
.WriteInt('Game', 'GibsCount', 3);
651 else config
.WriteInt('Game', 'GibsCount', 4);
654 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
655 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
656 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
657 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
658 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
659 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
660 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
661 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
662 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
663 config
.WriteInt('Game', 'Flash', gFlash
);
664 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
665 config
.WriteBool('Game', 'Messages', gShowMessages
);
666 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
667 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
668 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
669 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
670 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
672 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
673 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
674 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
675 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
676 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
677 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
678 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
679 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
680 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
681 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
682 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
684 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
685 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
686 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
687 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
688 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
689 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
690 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
691 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
692 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
693 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
694 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
696 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
697 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
699 config
.WriteStr ('Server', 'Name', NetServerName
);
700 config
.WriteStr ('Server', 'Password', NetPassword
);
701 config
.WriteInt ('Server', 'Port', NetPort
);
702 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
703 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
704 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
705 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
706 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
707 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
708 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
710 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
711 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
712 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
713 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
714 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
716 config
.SaveFile(FileName
);
720 procedure g_Options_Write_Language(FileName
: String);
724 e_WriteLog('Writing language config', MSG_NOTIFY
);
726 config
:= TConfig
.CreateFile(FileName
);
727 config
.WriteStr('Game', 'Language', gLanguage
);
728 config
.SaveFile(FileName
);
732 procedure g_Options_Write_Video(FileName
: String);
737 e_WriteLog('Writing resolution to config', MSG_NOTIFY
);
739 config
:= TConfig
.CreateFile(FileName
);
741 if gWinMaximized
and (not gFullscreen
) then
752 config
.WriteInt('Video', 'ScreenWidth', sW
);
753 config
.WriteInt('Video', 'ScreenHeight', sH
);
754 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
755 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
756 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
757 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
759 config
.SaveFile(FileName
);
763 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
767 e_WriteLog('Writing custom gameplay config', MSG_NOTIFY
);
769 config
:= TConfig
.CreateFile(FileName
);
771 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
772 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
773 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
774 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
775 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
776 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
777 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
778 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
779 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
780 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
781 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
783 config
.SaveFile(FileName
);
787 procedure g_Options_Write_Gameplay_Net(FileName
: String);
791 e_WriteLog('Writing network gameplay config', MSG_NOTIFY
);
793 config
:= TConfig
.CreateFile(FileName
);
795 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
796 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
797 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
798 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
799 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
800 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
801 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
802 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
803 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
804 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
805 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
807 config
.SaveFile(FileName
);
811 procedure g_Options_Write_Net_Server(FileName
: String);
815 e_WriteLog('Writing server config', MSG_NOTIFY
);
817 config
:= TConfig
.CreateFile(FileName
);
819 config
.WriteStr ('Server', 'Name', NetServerName
);
820 config
.WriteStr ('Server', 'Password', NetPassword
);
821 config
.WriteInt ('Server', 'Port', NetPort
);
822 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
823 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
825 config
.SaveFile(FileName
);
829 procedure g_Options_Write_Net_Client(FileName
: String);
833 e_WriteLog('Writing client config', MSG_NOTIFY
);
835 config
:= TConfig
.CreateFile(FileName
);
837 config
.WriteStr('Client', 'LastIP', NetClientIP
);
838 config
.WriteInt('Client', 'LastPort', NetClientPort
);
840 config
.SaveFile(FileName
);