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/>.
25 TPlayerControl
= record
49 TGameControls
= record
57 GameControls
: TGameControls
;
58 P1Control
: TPlayerControl
;
59 P2Control
: TPlayerControl
;
62 procedure g_Options_SetDefault();
63 procedure g_Options_Read(FileName
: String);
64 procedure g_Options_Write(FileName
: String);
65 procedure g_Options_Write_Language(FileName
: String);
66 procedure g_Options_Write_Video(FileName
: String);
67 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
68 procedure g_Options_Write_Gameplay_Net(FileName
: String);
69 procedure g_Options_Write_Net_Server(FileName
: String);
70 procedure g_Options_Write_Net_Client(FileName
: String);
73 gGameControls
: TControls
;
74 gScreenWidth
: Word = 800;
75 gScreenHeight
: Word = 600;
76 gWinRealPosX
: Integer = 0;
77 gWinRealPosY
: Integer = 0;
80 gFullscreen
: Boolean = False;
81 gWinMaximized
: Boolean = False;
82 gVSync
: Boolean = False;
83 glLegacyNPOT
: Boolean = False;
84 gTextureFilter
: Boolean = True;
85 gNoSound
: Boolean = False;
86 gSoundLevel
: Byte = 75;
87 gMusicLevel
: Byte = 65;
88 gMaxSimSounds
: Byte = 8;
89 gMuteWhenInactive
: Boolean = False;
90 gAdvCorpses
: Boolean = True;
91 gAdvBlood
: Boolean = True;
92 gAdvGibs
: Boolean = True;
93 gGibsCount
: Integer = 32;
94 gBloodCount
: Byte = 3;
96 gDrawBackGround
: Boolean = True;
97 gShowMessages
: Boolean = True;
98 gRevertPlayers
: Boolean = False;
99 gLanguage
: String = LANGUAGE_ENGLISH
;
100 gAskLanguage
: Boolean = True;
102 gcGameMode
: String = '';
103 gcTimeLimit
: Word = 0;
104 gcGoalLimit
: Word = 0;
105 gcMaxLives
: Byte = 0;
107 gcTeamDamage
: Boolean = False;
108 gcAllowExit
: Boolean = True;
109 gcWeaponStay
: Boolean = False;
110 gcMonsters
: Boolean = False;
111 gcBotsVS
: String = 'Everybody';
113 gnGameMode
: String = '';
114 gnTimeLimit
: Word = 0;
115 gnGoalLimit
: Word = 0;
116 gnMaxLives
: Byte = 0;
118 gnTeamDamage
: Boolean = False;
119 gnAllowExit
: Boolean = True;
120 gnWeaponStay
: Boolean = False;
121 gnMonsters
: Boolean = False;
122 gnBotsVS
: String = 'Everybody';
123 gsSDLSampleRate
: Integer = 44100;
124 gsSDLBufferSize
: Integer = 2048;
125 gSFSDebug
: Boolean = False;
126 gSFSFastMode
: Boolean = False;
131 e_log
, e_input
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
132 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_textures
,
133 g_items
, GL
, GLExt
, wadreader
, e_graphics
;
135 procedure g_Options_SetDefault();
139 g_Sound_SetupAllVolumes(75, 65);
141 gMuteWhenInactive
:= False;
142 gAnnouncer
:= ANNOUNCE_MEPLUS
;
143 gSoundEffectsDF
:= True;
146 g_Corpses_SetMax(20);
147 g_Shells_SetMax(300);
154 gDrawBackGround
:= True;
155 gShowMessages
:= True;
156 gRevertPlayers
:= False;
158 for i
:= 0 to e_MaxJoys
-1 do
159 e_JoystickDeadzones
[i
] := 8192;
161 with gGameControls
.GameControls
do
163 TakeScreenshot
:= 183;
166 TeamChat
:= 21; // [Y]
169 with gGameControls
.P1Control
do
194 with gGameControls
.P2Control
do
219 with gPlayer1Settings
do
222 Model
:= STD_PLAYER_MODEL
;
223 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
224 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
225 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
229 with gPlayer2Settings
do
232 Model
:= STD_PLAYER_MODEL
;
233 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
234 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
235 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
239 NetUseMaster
:= True;
240 g_Net_Slist_Set('mpms.doom2d.org', 25665);
243 procedure g_Options_Read(FileName
: String);
249 gAskLanguage
:= True;
250 e_WriteLog('Reading config', MSG_NOTIFY
);
252 if not FileExists(FileName
) then
254 e_WriteLog('Config file '+FileName
+' not found', MSG_WARNING
);
255 g_Options_SetDefault();
257 // Default video options:
259 gScreenHeight
:= 600;
262 gWinMaximized
:= False;
263 gFullScreen
:= False;
266 gTextureFilter
:= True;
267 glLegacyNPOT
:= False;
272 config
:= TConfig
.CreateFile(FileName
);
274 gScreenWidth
:= config
.ReadInt('Video', 'ScreenWidth', 800);
275 if gScreenWidth
< 640 then
277 gScreenHeight
:= config
.ReadInt('Video', 'ScreenHeight', 600);
278 if gScreenHeight
< 480 then
279 gScreenHeight
:= 480;
280 gWinRealPosX
:= config
.ReadInt('Video', 'WinPosX', 0);
281 if gWinRealPosX
< 0 then
283 gWinRealPosY
:= config
.ReadInt('Video', 'WinPosY', 0);
284 if gWinRealPosY
< 0 then
286 gFullScreen
:= config
.ReadBool('Video', 'Fullscreen', False);
287 gWinMaximized
:= config
.ReadBool('Video', 'Maximized', False);
288 gBPP
:= config
.ReadInt('Video', 'BPP', 32);
289 gFreq
:= config
.ReadInt('Video', 'Freq', 0);
290 gVSync
:= config
.ReadBool('Video', 'VSync', True);
291 gTextureFilter
:= config
.ReadBool('Video', 'TextureFilter', True);
292 glLegacyNPOT
:= config
.ReadBool('Video', 'LegacyCompatible', False);
294 gNoSound
:= config
.ReadBool('Sound', 'NoSound', False);
295 gSoundLevel
:= Min(config
.ReadInt('Sound', 'SoundLevel', 75), 255);
296 gMusicLevel
:= Min(config
.ReadInt('Sound', 'MusicLevel', 65), 255);
297 gMaxSimSounds
:= Max(Min(config
.ReadInt('Sound', 'MaxSimSounds', 8), 66), 2);
298 gMuteWhenInactive
:= config
.ReadBool('Sound', 'MuteInactive', False);
299 gAnnouncer
:= Min(Max(config
.ReadInt('Sound', 'Announcer', ANNOUNCE_MEPLUS
), ANNOUNCE_NONE
), ANNOUNCE_ALL
);
300 gSoundEffectsDF
:= config
.ReadBool('Sound', 'SoundEffectsDF', True);
301 gsSDLSampleRate
:= Min(Max(config
.ReadInt('Sound', 'SDLSampleRate', 44100), 11025), 96000);
302 gsSDLBufferSize
:= Min(Max(config
.ReadInt('Sound', 'SDLBufferSize', 2048), 64), 16384);
304 with gGameControls
.GameControls
do
306 TakeScreenshot
:= config
.ReadInt('GameControls', 'TakeScreenshot', 183);
307 Stat
:= config
.ReadInt('GameControls', 'Stat', 15);
308 Chat
:= config
.ReadInt('GameControls', 'Chat', 20);
309 TeamChat
:= config
.ReadInt('GameControls', 'TeamChat', 21);
312 with gGameControls
.P1Control
, config
do
314 KeyRight
:= ReadInt('Player1', 'KeyRight', 33);
315 KeyLeft
:= ReadInt('Player1', 'KeyLeft', 31);
316 KeyUp
:= ReadInt('Player1', 'KeyUp', 18);
317 KeyDown
:= ReadInt('Player1', 'KeyDown', 32);
318 KeyFire
:= ReadInt('Player1', 'KeyFire', 30);
319 KeyJump
:= ReadInt('Player1', 'KeyJump', 16);
320 KeyNextWeapon
:= ReadInt('Player1', 'KeyNextWeapon', 19);
321 KeyPrevWeapon
:= ReadInt('Player1', 'KeyPrevWeapon', 17);
322 KeyOpen
:= ReadInt('Player1', 'KeyOpen', 58);
323 KeyStrafe
:= ReadInt('Player1', 'KeyStrafe', 0);
325 KeyRight2
:= ReadInt('Player1', 'KeyRight2', 0);
326 KeyLeft2
:= ReadInt('Player1', 'KeyLeft2', 0);
327 KeyUp2
:= ReadInt('Player1', 'KeyUp2', 0);
328 KeyDown2
:= ReadInt('Player1', 'KeyDown2', 0);
329 KeyFire2
:= ReadInt('Player1', 'KeyFire2', 0);
330 KeyJump2
:= ReadInt('Player1', 'KeyJump2', 0);
331 KeyNextWeapon2
:= ReadInt('Player1', 'KeyNextWeapon2', 0);
332 KeyPrevWeapon2
:= ReadInt('Player1', 'KeyPrevWeapon2', 0);
333 KeyOpen2
:= ReadInt('Player1', 'KeyOpen2', 0);
334 KeyStrafe2
:= ReadInt('Player1', 'KeyStrafe2', 0);
337 with gPlayer1Settings
, config
do
339 Name
:= ReadStr('Player1', 'name', 'Player1');
340 Model
:= ReadStr('Player1', 'model', STD_PLAYER_MODEL
);
341 Color
.R
:= Min(Abs(ReadInt('Player1', 'red', PLAYER1_DEF_COLOR
.R
)), 255);
342 Color
.G
:= Min(Abs(ReadInt('Player1', 'green', PLAYER1_DEF_COLOR
.G
)), 255);
343 Color
.B
:= Min(Abs(ReadInt('Player1', 'blue', PLAYER1_DEF_COLOR
.B
)), 255);
344 Team
:= ReadInt('Player1', 'team', TEAM_RED
);
345 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
349 with gGameControls
.P2Control
, config
do
351 KeyRight
:= ReadInt('Player2', 'KeyRight', 205);
352 KeyLeft
:= ReadInt('Player2', 'KeyLeft', 203);
353 KeyUp
:= ReadInt('Player2', 'KeyUp', 200);
354 KeyDown
:= ReadInt('Player2', 'KeyDown', 208);
355 KeyFire
:= ReadInt('Player2', 'KeyFire', 184);
356 KeyJump
:= ReadInt('Player2', 'KeyJump', 157);
357 KeyNextWeapon
:= ReadInt('Player2', 'KeyNextWeapon', 73);
358 KeyPrevWeapon
:= ReadInt('Player2', 'KeyPrevWeapon', 71);
359 KeyOpen
:= ReadInt('Player2', 'KeyOpen', 54);
360 KeyStrafe
:= ReadInt('Player2', 'KeyStrafe', 0);
362 KeyRight2
:= ReadInt('Player2', 'KeyRight2', 0);
363 KeyLeft2
:= ReadInt('Player2', 'KeyLeft2', 0);
364 KeyUp2
:= ReadInt('Player2', 'KeyUp2', 0);
365 KeyDown2
:= ReadInt('Player2', 'KeyDown2', 0);
366 KeyFire2
:= ReadInt('Player2', 'KeyFire2', 0);
367 KeyJump2
:= ReadInt('Player2', 'KeyJump2', 0);
368 KeyNextWeapon2
:= ReadInt('Player2', 'KeyNextWeapon2', 0);
369 KeyPrevWeapon2
:= ReadInt('Player2', 'KeyPrevWeapon2', 0);
370 KeyOpen2
:= ReadInt('Player2', 'KeyOpen2', 0);
371 KeyStrafe2
:= ReadInt('Player2', 'KeyStrafe2', 0);
374 with gPlayer2Settings
, config
do
376 Name
:= ReadStr('Player2', 'name', 'Player2');
377 Model
:= ReadStr('Player2', 'model', STD_PLAYER_MODEL
);
378 Color
.R
:= Min(Abs(ReadInt('Player2', 'red', PLAYER2_DEF_COLOR
.R
)), 255);
379 Color
.G
:= Min(Abs(ReadInt('Player2', 'green', PLAYER2_DEF_COLOR
.G
)), 255);
380 Color
.B
:= Min(Abs(ReadInt('Player2', 'blue', PLAYER2_DEF_COLOR
.B
)), 255);
381 Team
:= ReadInt('Player2', 'team', TEAM_BLUE
);
382 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
386 for i
:= 0 to e_MaxJoys
-1 do
387 e_JoystickDeadzones
[i
] := config
.ReadInt('Joysticks', 'Deadzone' + IntToStr(i
), 8192);
389 g_GFX_SetMax(Min(config
.ReadInt('Game', 'MaxParticles', 1000), 50000));
390 g_Shells_SetMax(Min(config
.ReadInt('Game', 'MaxShells', 300), 600));
391 g_Gibs_SetMax(Min(config
.ReadInt('Game', 'MaxGibs', 150), 500));
392 g_Corpses_SetMax(Min(config
.ReadInt('Game', 'MaxCorpses', 20), 100));
394 case config
.ReadInt('Game', 'GibsCount', 3) of
399 else gGibsCount
:= 48;
402 ITEM_RESPAWNTIME
:= 36*Max(config
.ReadInt('Game', 'ItemRespawnTime', 60), 0);
403 gBloodCount
:= Min(config
.ReadInt('Game', 'BloodCount', 4), 4);
404 gAdvBlood
:= config
.ReadBool('Game', 'AdvancesBlood', True);
405 gAdvCorpses
:= config
.ReadBool('Game', 'AdvancesCorpses', True);
406 gAdvGibs
:= config
.ReadBool('Game', 'AdvancesGibs', True);
407 gFlash
:= Min(Max(config
.ReadInt('Game', 'Flash', 1), 0), 2);
408 gDrawBackGround
:= config
.ReadBool('Game', 'BackGround', True);
409 gShowMessages
:= config
.ReadBool('Game', 'Messages', True);
410 gRevertPlayers
:= config
.ReadBool('Game', 'RevertPlayers', False);
411 gChatBubble
:= Min(Max(config
.ReadInt('Game', 'ChatBubble', 4), 0), 4);
412 gSFSDebug
:= config
.ReadBool('Game', 'SFSDebug', False);
413 wadoptDebug
:= gSFSDebug
;
414 gSFSFastMode
:= config
.ReadBool('Game', 'SFSFastMode', False);
415 wadoptFast
:= gSFSFastMode
;
416 e_FastScreenshots
:= config
.ReadBool('Game', 'FastScreenshots', True);
418 // Ãåéìïëåé â ñâîåé èãðå
419 gcMap
:= config
.ReadStr('GameplayCustom', 'Map', '');
420 gcGameMode
:= config
.ReadStr('GameplayCustom', 'GameMode', _lc
[I_MENU_GAME_TYPE_DM
]);
421 gcTimeLimit
:= Min(Max(config
.ReadInt('GameplayCustom', 'TimeLimit', 0), 0), 65535);
422 gcGoalLimit
:= Min(Max(config
.ReadInt('GameplayCustom', 'GoalLimit', 0), 0), 65535);
423 gcMaxLives
:= Min(Max(config
.ReadInt('GameplayCustom', 'MaxLives', 0), 0), 255);
424 gcPlayers
:= Min(Max(config
.ReadInt('GameplayCustom', 'Players', 1), 0), 2);
425 gcTeamDamage
:= config
.ReadBool('GameplayCustom', 'TeamDamage', False);
426 gcAllowExit
:= config
.ReadBool('GameplayCustom', 'AllowExit', True);
427 gcWeaponStay
:= config
.ReadBool('GameplayCustom', 'WeaponStay', False);
428 gcMonsters
:= config
.ReadBool('GameplayCustom', 'Monsters', False);
429 gcBotsVS
:= config
.ReadStr('GameplayCustom', 'BotsVS', 'Everybody');
431 with gGameSettings
do
433 GameMode
:= g_Game_TextToMode(gcGameMode
);
434 if GameMode
= GM_NONE
then
436 if GameMode
= GM_SINGLE
then
438 TimeLimit
:= gcTimeLimit
;
439 GoalLimit
:= gcGoalLimit
;
440 MaxLives
:= gcMaxLives
;
444 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
446 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
448 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
450 Options
:= Options
or GAME_OPTION_MONSTERS
;
451 if gcBotsVS
= 'Everybody' then
452 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
453 if gcBotsVS
= 'Players' then
454 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
455 if gcBotsVS
= 'Monsters' then
456 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
459 // Ãåéìïëåé â ñåòåâîé èãðå
460 gnMap
:= config
.ReadStr('GameplayNetwork', 'Map', '');
461 gnGameMode
:= config
.ReadStr('GameplayNetwork', 'GameMode', _lc
[I_MENU_GAME_TYPE_DM
]);
462 gnTimeLimit
:= Min(Max(config
.ReadInt('GameplayNetwork', 'TimeLimit', 0), 0), 65535);
463 gnGoalLimit
:= Min(Max(config
.ReadInt('GameplayNetwork', 'GoalLimit', 0), 0), 65535);
464 gnMaxLives
:= Min(Max(config
.ReadInt('GameplayNetwork', 'MaxLives', 0), 0), 255);
465 gnPlayers
:= Min(Max(config
.ReadInt('GameplayNetwork', 'Players', 1), 0), 2);
466 gnTeamDamage
:= config
.ReadBool('GameplayNetwork', 'TeamDamage', False);
467 gnAllowExit
:= config
.ReadBool('GameplayNetwork', 'AllowExit', True);
468 gnWeaponStay
:= config
.ReadBool('GameplayNetwork', 'WeaponStay', False);
469 gnMonsters
:= config
.ReadBool('GameplayNetwork', 'Monsters', False);
470 gnBotsVS
:= config
.ReadStr('GameplayNetwork', 'BotsVS', 'Everybody');
472 // Îáùèå ñåòåâûå
473 NetSlistIP
:= config
.ReadStr('MasterServer', 'IP', 'mpms.doom2d.org');
474 NetSlistPort
:= config
.ReadInt('MasterServer', 'Port', 25665);
477 NetServerName
:= config
.ReadStr('Server', 'Name', 'Unnamed Server');
478 NetPassword
:= config
.ReadStr('Server', 'Password', '');
479 NetPort
:= Min(Max(0, config
.ReadInt('Server', 'Port', 25666)), 65535);
480 NetMaxClients
:= Min(Max(0, config
.ReadInt('Server', 'MaxClients', 16)), NET_MAXCLIENTS
);
481 NetAllowRCON
:= config
.ReadBool('Server', 'RCON', False);
482 NetRCONPassword
:= config
.ReadStr('Server', 'RCONPassword', 'default');
483 NetUseMaster
:= config
.ReadBool('Server', 'SyncWithMaster', True);
484 NetUpdateRate
:= Max(0, config
.ReadInt('Server', 'UpdateInterval', 0));
485 NetRelupdRate
:= Max(0, config
.ReadInt('Server', 'ReliableUpdateInterval', 18));
486 NetMasterRate
:= Max(1, config
.ReadInt('Server', 'MasterSyncInterval', 60000));
489 NetInterpLevel
:= Max(0, config
.ReadInt('Client', 'InterpolationSteps', 2));
490 NetForcePlayerUpdate
:= config
.ReadBool('Client', 'ForcePlayerUpdate', False);
491 NetPredictSelf
:= config
.ReadBool('Client', 'PredictSelf', True);
492 NetClientIP
:= config
.ReadStr('Client', 'LastIP', '127.0.0.1');
493 NetClientPort
:= Max(0, config
.ReadInt('Client', 'LastPort', 25666));
496 str
:= config
.ReadStr('Game', 'Language', '');
497 if (str
= LANGUAGE_RUSSIAN
) or
498 (str
= LANGUAGE_ENGLISH
) then
501 gAskLanguage
:= False;
504 gLanguage
:= LANGUAGE_ENGLISH
;
508 if gTextureFilter
then
509 TEXTUREFILTER
:= GL_LINEAR
511 TEXTUREFILTER
:= GL_NEAREST
;
514 procedure g_Options_Write(FileName
: String);
519 e_WriteLog('Writing config', MSG_NOTIFY
);
521 config
:= TConfig
.CreateFile(FileName
);
523 config
.WriteInt('Video', 'ScreenWidth', gScreenWidth
);
524 config
.WriteInt('Video', 'ScreenHeight', gScreenHeight
);
525 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
526 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
527 config
.WriteBool('Video', 'Fullscreen', gFullScreen
);
528 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
529 config
.WriteInt('Video', 'BPP', gBPP
);
530 config
.WriteBool('Video', 'VSync', gVSync
);
531 config
.WriteBool('Video', 'TextureFilter', gTextureFilter
);
532 config
.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT
);
534 config
.WriteBool('Sound', 'NoSound', gNoSound
);
535 config
.WriteInt('Sound', 'SoundLevel', gSoundLevel
);
536 config
.WriteInt('Sound', 'MusicLevel', gMusicLevel
);
537 config
.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds
);
538 config
.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive
);
539 config
.WriteInt('Sound', 'Announcer', gAnnouncer
);
540 config
.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF
);
541 config
.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate
);
542 config
.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize
);
544 with config
, gGameControls
.GameControls
do
546 WriteInt('GameControls', 'TakeScreenshot', TakeScreenshot
);
547 WriteInt('GameControls', 'Stat', Stat
);
548 WriteInt('GameControls', 'Chat', Chat
);
549 WriteInt('GameControls', 'TeamChat', TeamChat
);
552 with config
, gGameControls
.P1Control
, gPlayer1Settings
do
554 WriteInt('Player1', 'KeyRight', KeyRight
);
555 WriteInt('Player1', 'KeyLeft', KeyLeft
);
556 WriteInt('Player1', 'KeyUp', KeyUp
);
557 WriteInt('Player1', 'KeyDown', KeyDown
);
558 WriteInt('Player1', 'KeyFire', KeyFire
);
559 WriteInt('Player1', 'KeyJump', KeyJump
);
560 WriteInt('Player1', 'KeyNextWeapon', KeyNextWeapon
);
561 WriteInt('Player1', 'KeyPrevWeapon', KeyPrevWeapon
);
562 WriteInt('Player1', 'KeyOpen', KeyOpen
);
563 WriteInt('Player1', 'KeyStrafe', KeyStrafe
);
565 WriteInt('Player1', 'KeyRight2', KeyRight2
);
566 WriteInt('Player1', 'KeyLeft2', KeyLeft2
);
567 WriteInt('Player1', 'KeyUp2', KeyUp2
);
568 WriteInt('Player1', 'KeyDown2', KeyDown2
);
569 WriteInt('Player1', 'KeyFire2', KeyFire2
);
570 WriteInt('Player1', 'KeyJump2', KeyJump2
);
571 WriteInt('Player1', 'KeyNextWeapon2', KeyNextWeapon2
);
572 WriteInt('Player1', 'KeyPrevWeapon2', KeyPrevWeapon2
);
573 WriteInt('Player1', 'KeyOpen2', KeyOpen2
);
574 WriteInt('Player1', 'KeyStrafe2', KeyStrafe2
);
576 WriteStr('Player1', 'Name', Name
);
577 WriteStr('Player1', 'model', Model
);
578 WriteInt('Player1', 'red', Color
.R
);
579 WriteInt('Player1', 'green', Color
.G
);
580 WriteInt('Player1', 'blue', Color
.B
);
581 WriteInt('Player1', 'team', Team
);
584 with config
, gGameControls
.P2Control
, gPlayer2Settings
do
586 WriteInt('Player2', 'KeyRight', KeyRight
);
587 WriteInt('Player2', 'KeyLeft', KeyLeft
);
588 WriteInt('Player2', 'KeyUp', KeyUp
);
589 WriteInt('Player2', 'KeyDown', KeyDown
);
590 WriteInt('Player2', 'KeyFire', KeyFire
);
591 WriteInt('Player2', 'KeyJump', KeyJump
);
592 WriteInt('Player2', 'KeyNextWeapon', KeyNextWeapon
);
593 WriteInt('Player2', 'KeyPrevWeapon', KeyPrevWeapon
);
594 WriteInt('Player2', 'KeyOpen', KeyOpen
);
595 WriteInt('Player2', 'KeyStrafe', KeyStrafe
);
597 WriteInt('Player2', 'KeyRight2', KeyRight2
);
598 WriteInt('Player2', 'KeyLeft2', KeyLeft2
);
599 WriteInt('Player2', 'KeyUp2', KeyUp2
);
600 WriteInt('Player2', 'KeyDown2', KeyDown2
);
601 WriteInt('Player2', 'KeyFire2', KeyFire2
);
602 WriteInt('Player2', 'KeyJump2', KeyJump2
);
603 WriteInt('Player2', 'KeyNextWeapon2', KeyNextWeapon2
);
604 WriteInt('Player2', 'KeyPrevWeapon2', KeyPrevWeapon2
);
605 WriteInt('Player2', 'KeyOpen2', KeyOpen2
);
606 WriteInt('Player2', 'KeyStrafe2', KeyStrafe2
);
608 WriteStr('Player2', 'Name', Name
);
609 WriteStr('Player2', 'model', Model
);
610 WriteInt('Player2', 'red', Color
.R
);
611 WriteInt('Player2', 'green', Color
.G
);
612 WriteInt('Player2', 'blue', Color
.B
);
613 WriteInt('Player2', 'team', Team
);
616 for i
:= 0 to e_MaxJoys
-1 do
617 config
.WriteInt('Joysticks', 'Deadzone' + IntToStr(i
), e_JoystickDeadzones
[i
]);
621 0: config
.WriteInt('Game', 'GibsCount', 0);
622 8: config
.WriteInt('Game', 'GibsCount', 1);
623 16: config
.WriteInt('Game', 'GibsCount', 2);
624 32: config
.WriteInt('Game', 'GibsCount', 3);
625 else config
.WriteInt('Game', 'GibsCount', 4);
628 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
629 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
630 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
631 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
632 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
633 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
634 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
635 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
636 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
637 config
.WriteInt('Game', 'Flash', gFlash
);
638 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
639 config
.WriteBool('Game', 'Messages', gShowMessages
);
640 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
641 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
642 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
643 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
644 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
646 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
647 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
648 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
649 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
650 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
651 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
652 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
653 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
654 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
655 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
656 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
658 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
659 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
660 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
661 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
662 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
663 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
664 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
665 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
666 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
667 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
668 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
670 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
671 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
673 config
.WriteStr ('Server', 'Name', NetServerName
);
674 config
.WriteStr ('Server', 'Password', NetPassword
);
675 config
.WriteInt ('Server', 'Port', NetPort
);
676 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
677 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
678 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
679 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
680 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
681 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
682 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
684 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
685 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
686 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
687 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
688 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
690 config
.SaveFile(FileName
);
694 procedure g_Options_Write_Language(FileName
: String);
698 e_WriteLog('Writing language config', MSG_NOTIFY
);
700 config
:= TConfig
.CreateFile(FileName
);
701 config
.WriteStr('Game', 'Language', gLanguage
);
702 config
.SaveFile(FileName
);
706 procedure g_Options_Write_Video(FileName
: String);
711 e_WriteLog('Writing resolution to config', MSG_NOTIFY
);
713 config
:= TConfig
.CreateFile(FileName
);
715 if gWinMaximized
and (not gFullscreen
) then
726 config
.WriteInt('Video', 'ScreenWidth', sW
);
727 config
.WriteInt('Video', 'ScreenHeight', sH
);
728 config
.WriteInt('Video', 'WinPosX', gWinRealPosX
);
729 config
.WriteInt('Video', 'WinPosY', gWinRealPosY
);
730 config
.WriteBool('Video', 'Fullscreen', gFullscreen
);
731 config
.WriteBool('Video', 'Maximized', gWinMaximized
);
733 config
.SaveFile(FileName
);
737 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
741 e_WriteLog('Writing custom gameplay config', MSG_NOTIFY
);
743 config
:= TConfig
.CreateFile(FileName
);
745 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
746 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
747 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
748 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
749 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
750 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
751 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
752 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
753 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
754 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
755 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
757 config
.SaveFile(FileName
);
761 procedure g_Options_Write_Gameplay_Net(FileName
: String);
765 e_WriteLog('Writing network gameplay config', MSG_NOTIFY
);
767 config
:= TConfig
.CreateFile(FileName
);
769 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
770 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
771 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
772 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
773 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
774 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
775 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
776 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
777 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
778 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
779 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
781 config
.SaveFile(FileName
);
785 procedure g_Options_Write_Net_Server(FileName
: String);
789 e_WriteLog('Writing server config', MSG_NOTIFY
);
791 config
:= TConfig
.CreateFile(FileName
);
793 config
.WriteStr ('Server', 'Name', NetServerName
);
794 config
.WriteStr ('Server', 'Password', NetPassword
);
795 config
.WriteInt ('Server', 'Port', NetPort
);
796 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
797 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
799 config
.SaveFile(FileName
);
803 procedure g_Options_Write_Net_Client(FileName
: String);
807 e_WriteLog('Writing client config', MSG_NOTIFY
);
809 config
:= TConfig
.CreateFile(FileName
);
811 config
.WriteStr('Client', 'LastIP', NetClientIP
);
812 config
.WriteInt('Client', 'LastPort', NetClientPort
);
814 config
.SaveFile(FileName
);