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, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
21 g_language
, g_weapons
, utils
;
23 function GenPlayerName (n
: Integer): String;
25 procedure g_Options_SetDefault
;
26 procedure g_Options_SetDefaultVideo
;
27 procedure g_Options_Read(FileName
: String);
28 procedure g_Options_Write(FileName
: String);
29 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
30 procedure g_Options_Write_Gameplay_Net(FileName
: String);
31 procedure g_Options_Write_Net_Server(FileName
: String);
32 procedure g_Options_Write_Net_Client(FileName
: String);
33 procedure g_Options_Commands (p
: SSArray
);
35 const DF_Default_Megawad_Start
= 'megawads/DOOM2D.WAD:\MAP01';
43 gWinMaximized
: Boolean;
45 glLegacyNPOT
: Boolean;
46 gTextureFilter
: Boolean;
50 gMaxSimSounds
: Integer;
51 gMuteWhenInactive
: Boolean;
58 gDrawBackGround
: Boolean;
59 gShowMessages
: Boolean;
60 gRevertPlayers
: Boolean;
62 gAskLanguage
: Boolean;
69 gcTeamDamage
: Boolean;
71 gcWeaponStay
: Boolean;
80 gnTeamDamage
: Boolean;
82 gnWeaponStay
: Boolean;
85 gsSDLSampleRate
: Integer;
86 gsSDLBufferSize
: Integer;
88 gSFSFastMode
: Boolean;
89 gDefaultMegawadStart
: AnsiString
;
90 gBerserkAutoswitch
: Boolean;
91 glNPOTOverride
: Boolean = false;
96 {$INCLUDE ../nogl/noGLuses.inc}
100 e_log
, e_input
, g_console
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
101 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
102 g_items
, wadreader
, e_graphics
, g_touch
, envvars
, g_system
;
107 function GenPlayerName (n
: Integer): String;
110 Result
:= GetUserName
;
112 Result
:= 'Player' + IntToStr(machine
MOD 10000);
114 Result
:= Copy(Result
, 1, 12) + ' '
116 Result
:= Copy(Result
, 1, 10) + ' ' + IntToStr(n
)
120 procedure g_Options_SetDefaultVideo
;
121 var display
: TSDL_DisplayMode
;
123 var target
, closest
: TSDL_DisplayMode
; percentage
: Integer;
126 (* Display 0 = Primary display *)
128 gScreenHeight
:= 480;
129 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
132 gFullScreen
:= True; (* rotation not allowed? *)
134 gFullScreen
:= False;
136 if SDL_GetDesktopDisplayMode(0, @display
) = 0 then
139 gScreenWidth
:= display
.w
;
140 gScreenHeight
:= display
.h
;
142 (* Window must be smaller than display *)
143 closest
.w
:= display
.w
;
144 closest
.h
:= display
.h
;
146 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
148 if percentage
< 25 then
150 closest
.w
:= display
.w
* 75 div 100;
151 closest
.h
:= display
.h
* 75 div 100;
154 target
.w
:= display
.w
* percentage
div 100;
155 target
.h
:= display
.h
* percentage
div 100;
156 target
.format
:= 0; (* didn't care *)
157 target
.refresh_rate
:= 0; (* didn't care *)
158 target
.driverdata
:= nil; (* init *)
159 SDL_GetClosestDisplayMode(0, @target
, @closest
);
162 gScreenWidth
:= closest
.w
;
163 gScreenHeight
:= closest
.h
;
164 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
169 e_LogWritefln('SDL: Failed to get desktop display mode: %s', [SDL_GetError
])
171 (* Must be positioned on primary display *)
172 gWinMaximized
:= False;
174 gTextureFilter
:= True;
175 glLegacyNPOT
:= False;
176 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
177 g_Console_ResetBinds
;
180 procedure g_Options_SetDefaultVideo
;
183 gScreenHeight
:= 480;
185 gFullScreen
:= False;
186 gWinMaximized
:= False;
188 gTextureFilter
:= True;
189 glLegacyNPOT
:= False;
190 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
191 g_Console_ResetBinds
;
195 procedure g_Options_SetDefault();
204 gMuteWhenInactive
:= False;
205 gAnnouncer
:= ANNOUNCE_MEPLUS
;
206 gSoundEffectsDF
:= True;
207 gUseChatSounds
:= True;
208 gsSDLSampleRate
:= 44100;
209 gsSDLBufferSize
:= 2048;
211 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
213 with gPlayer1Settings
do
215 Name
:= GenPlayerName(1);
216 Model
:= STD_PLAYER_MODEL
;
217 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
218 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
219 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
223 with gPlayer2Settings
do
225 Name
:= GenPlayerName(2);
226 Model
:= STD_PLAYER_MODEL
;
227 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
228 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
229 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
233 (* section Joysticks *)
234 for i
:= 0 to e_MaxJoys
- 1 do
236 e_JoystickDeadzones
[i
] := 8192
241 g_Shells_SetMax(300);
243 g_Corpses_SetMax(20);
245 ITEM_RESPAWNTIME
:= 60 * 36;
251 gDrawBackGround
:= True;
252 gShowMessages
:= True;
253 gRevertPlayers
:= False;
256 gSFSFastMode
:= False;
257 e_FastScreenshots
:= True;
258 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
259 gBerserkAutoswitch
:= True;
262 gAskLanguage
:= True;
263 gLanguage
:= LANGUAGE_ENGLISH
;
265 (* section GameplayCustom *)
267 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
272 gcTeamDamage
:= False;
274 gcWeaponStay
:= False;
276 gcBotsVS
:= 'Everybody';
278 (* section GameplayNetwork *)
280 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
285 gnTeamDamage
:= False;
287 gnWeaponStay
:= False;
289 gnBotsVS
:= 'Everybody';
291 (* section MasterServer *)
292 NetSlistIP
:= 'mpms.doom2d.org';
293 NetSlistPort
:= 25665;
294 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
297 NetServerName
:= 'Unnamed Server';
301 NetAllowRCON
:= False;
302 NetRCONPassword
:= 'default';
303 NetUseMaster
:= True;
306 NetMasterRate
:= 60000;
307 NetForwardPorts
:= False;
311 NetForcePlayerUpdate
:= False;
312 NetPredictSelf
:= True;
313 NetClientIP
:= '127.0.0.1';
314 NetClientPort
:= NetPort
;
317 procedure g_Options_Read(FileName
: String);
323 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
325 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
328 procedure ReadInteger (VAR v
: LongWord
; param
: String; minv
: LongWord
= Low(LongWord
); maxv
: LongWord
= High(LongWord
)); overload
;
330 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
333 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
335 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
338 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
340 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
343 procedure ReadBoolean (VAR v
: Boolean; param
: String);
345 v
:= config
.ReadBool(section
, param
, v
)
348 procedure ReadString (VAR v
: String; param
: String);
350 v
:= config
.ReadStr(section
, param
, v
)
354 gAskLanguage
:= True;
355 e_WriteLog('Reading config', TMsgType
.Notify
);
356 g_Options_SetDefault
;
358 if FileExists(FileName
) = False then
360 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
361 g_Options_SetDefaultVideo
;
365 config
:= TConfig
.CreateFile(FileName
);
367 section
:= 'Player1';
368 with gPlayer1Settings
do
370 ReadString(Name
, 'name');
371 ReadString(Model
, 'model');
372 ReadInteger(Color
.R
, 'red', 0, 255);
373 ReadInteger(Color
.G
, 'green', 0, 255);
374 ReadInteger(Color
.B
, 'blue', 0, 255);
375 ReadInteger(Team
, 'team');
376 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
380 section
:= 'Player2';
381 with gPlayer2Settings
do
383 ReadString(Name
, 'name');
384 ReadString(Model
, 'model');
385 ReadInteger(Color
.R
, 'red', 0, 255);
386 ReadInteger(Color
.G
, 'green', 0, 255);
387 ReadInteger(Color
.B
, 'blue', 0, 255);
388 ReadInteger(Team
, 'team');
389 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
394 ReadInteger(i
, 'MaxParticles', 0, 50000); g_GFX_SetMax(i
);
395 ReadInteger(i
, 'MaxShells', 0, 600); g_Shells_SetMax(i
);
396 ReadInteger(i
, 'MaxGibs', 0, 500); g_Gibs_SetMax(i
);
397 ReadInteger(i
, 'MaxCorpses', 0, 100); g_Corpses_SetMax(i
);
398 ReadInteger(i
, 'GibsCount');
404 else gGibsCount
:= 48;
406 i
:= ITEM_RESPAWNTIME
div 36; ReadInteger(i
, 'ItemRespawnTime', 0); ITEM_RESPAWNTIME
:= i
* 36;
407 ReadInteger(gBloodCount
, 'BloodCount', 0, 4);
408 ReadBoolean(gAdvBlood
, 'AdvancesBlood');
409 ReadBoolean(gAdvCorpses
, 'AdvancesCorpses');
410 ReadBoolean(gAdvGibs
, 'AdvancesGibs');
411 ReadInteger(gFlash
, 'Flash', 0, 2);
412 ReadBoolean(gDrawBackGround
, 'BackGround');
413 ReadBoolean(gShowMessages
, 'Messages');
414 ReadBoolean(gRevertPlayers
, 'RevertPlayers');
415 ReadInteger(gChatBubble
, 'ChatBubble', 0, 4);
416 ReadBoolean(gSFSDebug
, 'SFSDebug'); wadoptDebug
:= gSFSDebug
;
417 ReadBoolean(gSFSFastMode
, 'SFSFastMode'); wadoptFast
:= gSFSFastMode
;
418 ReadBoolean(e_FastScreenshots
, 'FastScreenshots');
419 ReadString(gDefaultMegawadStart
, 'DefaultMegawadStart');
420 ReadBoolean(gBerserkAutoswitch
, 'BerserkAutoswitching');
421 i
:= Trunc(g_dbg_scale
* 100); ReadInteger(i
, 'Scale', 100); g_dbg_scale
:= i
/ 100;
423 section
:= 'GameplayCustom';
424 ReadString(gcMap
, 'Map');
425 ReadString(gcGameMode
, 'GameMode');
426 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
427 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
428 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
429 ReadInteger(gcPlayers
, 'Players', 0, 2);
430 ReadBoolean(gcTeamDamage
, 'TeamDamage');
431 ReadBoolean(gcAllowExit
, 'AllowExit');
432 ReadBoolean(gcWeaponStay
, 'WeaponStay');
433 ReadBoolean(gcMonsters
, 'Monsters');
434 ReadString(gcBotsVS
, 'BotsVS');
436 with gGameSettings
do
438 GameMode
:= g_Game_TextToMode(gcGameMode
);
439 if GameMode
= GM_NONE
then
441 if GameMode
= GM_SINGLE
then
443 TimeLimit
:= gcTimeLimit
;
444 GoalLimit
:= gcGoalLimit
;
445 MaxLives
:= gcMaxLives
;
449 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
451 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
453 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
455 Options
:= Options
or GAME_OPTION_MONSTERS
;
456 if gcBotsVS
= 'Everybody' then
457 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
458 if gcBotsVS
= 'Players' then
459 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
460 if gcBotsVS
= 'Monsters' then
461 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
464 section
:= 'GameplayNetwork';
465 ReadString(gnMap
, 'Map');
466 ReadString(gnGameMode
, 'GameMode');
467 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
468 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
469 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
470 ReadInteger(gnPlayers
, 'Players', 0, 2);
471 ReadBoolean(gnTeamDamage
, 'TeamDamage');
472 ReadBoolean(gnAllowExit
, 'AllowExit');
473 ReadBoolean(gnWeaponStay
, 'WeaponStay');
474 ReadBoolean(gnMonsters
, 'Monsters');
475 ReadString(gnBotsVS
, 'BotsVS');
477 section
:= 'MasterServer';
478 ReadString(NetSlistIP
, 'IP');
479 ReadInteger(NetSlistPort
, 'Port', 0, 65535);
480 ReadString(NetSlistList
, 'List');
481 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
484 ReadString(NetServerName
, 'Name');
485 ReadString(NetPassword
, 'Password');
486 ReadInteger(NetPort
, 'Port', 0, 65535);
487 ReadInteger(NetMaxClients
, 'MaxClients', 0, NET_MAXCLIENTS
);
488 ReadBoolean(NetAllowRCON
, 'RCON');
489 ReadString(NetRCONPassword
, 'RCONPassword');
490 ReadBoolean(NetUseMaster
, 'SyncWithMaster');
491 ReadInteger(NetUpdateRate
, 'UpdateInterval', 0);
492 ReadInteger(NetRelupdRate
, 'ReliableUpdateInterval', 0);
493 ReadInteger(NetMasterRate
, 'MasterSyncInterval', 1);
494 ReadBoolean(NetForwardPorts
, 'ForwardPorts');
497 ReadInteger(NetInterpLevel
, 'InterpolationSteps', 0);
498 ReadBoolean(NetForcePlayerUpdate
, 'ForcePlayerUpdate');
499 ReadBoolean(NetPredictSelf
, 'PredictSelf');
500 ReadString(NetClientIP
, 'LastIP');
501 ReadInteger(NetClientPort
, 'LastPort', 0, 65535);
505 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
508 procedure g_Options_Write(FileName
: String);
511 e_WriteLog('Writing config', TMsgType
.Notify
);
513 config
:= TConfig
.CreateFile(FileName
);
515 with config
, gPlayer1Settings
do
517 WriteStr('Player1', 'Name', Name
);
518 WriteStr('Player1', 'model', Model
);
519 WriteInt('Player1', 'red', Color
.R
);
520 WriteInt('Player1', 'green', Color
.G
);
521 WriteInt('Player1', 'blue', Color
.B
);
522 WriteInt('Player1', 'team', Team
);
525 with config
, gPlayer2Settings
do
527 WriteStr('Player2', 'Name', Name
);
528 WriteStr('Player2', 'model', Model
);
529 WriteInt('Player2', 'red', Color
.R
);
530 WriteInt('Player2', 'green', Color
.G
);
531 WriteInt('Player2', 'blue', Color
.B
);
532 WriteInt('Player2', 'team', Team
);
537 0: config
.WriteInt('Game', 'GibsCount', 0);
538 8: config
.WriteInt('Game', 'GibsCount', 1);
539 16: config
.WriteInt('Game', 'GibsCount', 2);
540 32: config
.WriteInt('Game', 'GibsCount', 3);
541 else config
.WriteInt('Game', 'GibsCount', 4);
544 config
.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME
div 36);
545 config
.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
546 config
.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
547 config
.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
548 config
.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
549 config
.WriteInt('Game', 'BloodCount', gBloodCount
);
550 config
.WriteBool('Game', 'AdvancesBlood', gAdvBlood
);
551 config
.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses
);
552 config
.WriteBool('Game', 'AdvancesGibs', gAdvGibs
);
553 config
.WriteInt('Game', 'Flash', gFlash
);
554 config
.WriteBool('Game', 'BackGround', gDrawBackGround
);
555 config
.WriteBool('Game', 'Messages', gShowMessages
);
556 config
.WriteBool('Game', 'RevertPlayers', gRevertPlayers
);
557 config
.WriteInt('Game', 'ChatBubble', gChatBubble
);
558 config
.WriteBool('Game', 'SFSDebug', gSFSDebug
);
559 config
.WriteBool('Game', 'SFSFastMode', gSFSFastMode
);
560 config
.WriteBool('Game', 'FastScreenshots', e_FastScreenshots
);
561 config
.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart
);
562 config
.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch
);
563 config
.WriteInt('Game', 'Scale', Round(g_dbg_scale
* 100));
565 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
566 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
567 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
568 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
569 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
570 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
571 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
572 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
573 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
574 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
575 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
577 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
578 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
579 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
580 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
581 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
582 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
583 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
584 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
585 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
586 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
587 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
589 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
590 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
591 config
.WriteStr('MasterServer', 'List', NetSlistList
);
593 config
.WriteStr ('Server', 'Name', NetServerName
);
594 config
.WriteStr ('Server', 'Password', NetPassword
);
595 config
.WriteInt ('Server', 'Port', NetPort
);
596 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
597 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
598 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
599 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
600 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
601 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
602 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
603 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
605 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
606 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
607 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
608 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
609 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
611 config
.SaveFile(FileName
);
615 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
619 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
621 config
:= TConfig
.CreateFile(FileName
);
623 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
624 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
625 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
626 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
627 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
628 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
629 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
630 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
631 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
632 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
633 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
635 config
.SaveFile(FileName
);
639 procedure g_Options_Write_Gameplay_Net(FileName
: String);
643 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
645 config
:= TConfig
.CreateFile(FileName
);
647 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
648 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
649 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
650 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
651 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
652 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
653 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
654 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
655 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
656 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
657 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
659 config
.SaveFile(FileName
);
663 procedure g_Options_Write_Net_Server(FileName
: String);
667 e_WriteLog('Writing server config', TMsgType
.Notify
);
669 config
:= TConfig
.CreateFile(FileName
);
671 config
.WriteStr ('Server', 'Name', NetServerName
);
672 config
.WriteStr ('Server', 'Password', NetPassword
);
673 config
.WriteInt ('Server', 'Port', NetPort
);
674 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
675 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
676 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
678 config
.SaveFile(FileName
);
682 procedure g_Options_Write_Net_Client(FileName
: String);
686 e_WriteLog('Writing client config', TMsgType
.Notify
);
688 config
:= TConfig
.CreateFile(FileName
);
690 config
.WriteStr('Client', 'LastIP', NetClientIP
);
691 config
.WriteInt('Client', 'LastPort', NetClientPort
);
693 config
.SaveFile(FileName
);
697 procedure g_Options_Commands (p
: SSArray
);
700 cmd
:= LowerCase(p
[0]);
704 sys_EnableVSync(gVSync
);
705 gRC_Width
:= Max(1, gRC_Width
);
706 gRC_Height
:= Max(1, gRC_Height
);
707 gBPP
:= Max(1, gBPP
);
708 if sys_SetDisplayMode(gRC_Width
, gRC_Height
, gBPP
, gRC_FullScreen
) = True then
709 e_LogWriteln('resolution changed')
711 e_LogWriteln('resolution not changed')
715 if Length(p
) = 2 then
717 gAskLanguage
:= true;
718 gLanguage
:= LANGUAGE_ENGLISH
;
719 case LowerCase(p
[1]) of
722 gAskLanguage
:= false;
723 gLanguage
:= LANGUAGE_ENGLISH
;
727 gAskLanguage
:= false;
728 gLanguage
:= LANGUAGE_RUSSIAN
;
732 gAskLanguage
:= true;
733 gLanguage
:= LANGUAGE_ENGLISH
;
736 g_Language_Set(gLanguage
)
744 machine
:= Random(10000);
747 conRegVar('r_width', @gRC_Width
, '', '');
748 conRegVar('r_height', @gRC_Height
, '', '');
749 conRegVar('r_fullscreen', @gRC_FullScreen
, '', '');
750 conRegVar('r_maximized', @gRC_Maximized
, '', '');
751 conRegVar('r_bpp', @gBPP
, '', '');
752 conRegVar('r_vsync', @gVSync
, '', '');
753 conRegVar('r_texfilter', @gTextureFilter
, '', '');
754 conRegVar('r_npot', @glNPOTOverride
, '', '');
757 conRegVar('s_nosound', @gNoSound
, '', '');
758 conRegVar('s_soundvolume', @gSoundLevel
, '', '');
759 conRegVar('s_musicvolume', @gMusicLevel
, '', '');
760 conRegVar('s_maxsim', @gMaxSimSounds
, '', ''); // e_sound_fmod/sdl?
761 conRegVar('s_muteinactive', @gMuteWhenInactive
, '', '');
762 conRegVar('s_announcer', @gAnnouncer
, '', '');
763 conRegVar('s_sfx', @gSoundEffectsDF
, '', '');
764 conRegVar('s_chatsounds', @gUseChatSounds
, '', '');
765 {$IFDEF USE_SDLMIXER}
766 conRegVar('sdl_mixer_samplerate', @gsSDLSampleRate
, '', '');
767 conRegVar('sdl_mixer_buffersize', @gsSDLBufferSize
, '', '');