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';
41 gWinSizeX
, gWinSizeY
: Integer;
42 gWinMaximized
: Boolean;
44 glLegacyNPOT
: Boolean;
45 glRenderToFBO
: Boolean = True;
46 gTextureFilter
: Boolean;
50 gMaxSimSounds
: Integer;
51 gMuteWhenInactive
: Boolean;
58 gDrawBackGround
: Boolean;
59 gShowMessages
: Boolean;
60 gRevertPlayers
: Boolean;
62 gAskLanguage
: Boolean;
63 gSaveStats
: Boolean = False;
64 gScreenshotStats
: Boolean = False;
71 gcTeamDamage
: Boolean;
73 gcWeaponStay
: Boolean;
76 gcDeathmatchKeys
: Boolean = True;
77 gcRespawnItems
: Boolean = True;
78 gcSpawnInvul
: Integer = 0;
85 gnTeamDamage
: Boolean;
87 gnWeaponStay
: Boolean;
90 gnDeathmatchKeys
: Boolean = True;
91 gnRespawnItems
: Boolean = True;
92 gnSpawnInvul
: Integer = 0;
93 gsSDLSampleRate
: Integer;
94 gsSDLBufferSize
: Integer;
95 gDefaultMegawadStart
: AnsiString;
96 gBerserkAutoswitch
: Boolean;
97 glNPOTOverride
: Boolean = false;
102 {$INCLUDE ../nogl/noGLuses.inc}
106 e_log
, e_input
, g_console
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
107 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
108 g_items
, wadreader
, e_graphics
, g_touch
, envvars
, g_system
;
113 function GenPlayerName (n
: Integer): String;
116 Result
:= GetUserName
;
118 Result
:= 'Player' + IntToStr(machine
MOD 10000);
120 Result
:= Copy(Result
, 1, 12) + ' '
122 Result
:= Copy(Result
, 1, 10) + ' ' + IntToStr(n
)
126 procedure g_Options_SetDefaultVideo
;
127 var display
: TSDL_DisplayMode
;
129 var target
, closest
: TSDL_DisplayMode
; percentage
: Integer;
132 (* Display 0 = Primary display *)
134 gScreenHeight
:= 480;
137 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
140 gFullScreen
:= True; (* rotation not allowed? *)
142 gFullScreen
:= False;
144 if SDL_GetDesktopDisplayMode(0, @display
) = 0 then
147 gWinSizeX
:= display
.w
;
148 gWinSizeY
:= display
.h
;
150 (* Window must be smaller than display *)
151 closest
.w
:= display
.w
;
152 closest
.h
:= display
.h
;
154 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
156 if percentage
< 25 then
158 closest
.w
:= display
.w
* 75 div 100;
159 closest
.h
:= display
.h
* 75 div 100;
162 target
.w
:= display
.w
* percentage
div 100;
163 target
.h
:= display
.h
* percentage
div 100;
164 target
.format
:= 0; (* didn't care *)
165 target
.refresh_rate
:= 0; (* didn't care *)
166 target
.driverdata
:= nil; (* init *)
167 SDL_GetClosestDisplayMode(0, @target
, @closest
);
170 gWinSizeX
:= closest
.w
;
171 gWinSizeY
:= closest
.h
;
172 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
177 e_LogWritefln('SDL: Failed to get desktop display mode: %s', [SDL_GetError
])
179 (* Must be positioned on primary display *)
180 gWinMaximized
:= False;
182 gTextureFilter
:= True;
183 glLegacyNPOT
:= False;
184 gRC_Width
:= gWinSizeX
;
185 gRC_Height
:= gWinSizeY
;
186 gRC_FullScreen
:= gFullScreen
;
187 gRC_Maximized
:= gWinMaximized
;
188 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gWinSizeX
) + ' h = ' + IntToStr(gWinSizeY
));
189 g_Console_ResetBinds
;
192 procedure g_Options_SetDefaultVideo
;
197 gFullScreen
:= False;
198 gWinMaximized
:= False;
200 gTextureFilter
:= True;
201 glLegacyNPOT
:= False;
202 gScreenWidth
:= gWinSizeX
;
203 gScreenHeight
:= gWinSizeY
;
204 gRC_Width
:= gWinSizeX
;
205 gRC_Height
:= gWinSizeY
;
206 gRC_FullScreen
:= gFullScreen
;
207 gRC_Maximized
:= gWinMaximized
;
208 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gWinSizeX
) + ' h = ' + IntToStr(gWinSizeY
));
209 g_Console_ResetBinds
;
213 procedure g_Options_SetDefault();
222 gMuteWhenInactive
:= False;
223 gAnnouncer
:= ANNOUNCE_MEPLUS
;
224 gSoundEffectsDF
:= True;
225 gUseChatSounds
:= True;
226 gsSDLSampleRate
:= 44100;
227 gsSDLBufferSize
:= 2048;
229 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
231 with gPlayer1Settings
do
233 Name
:= GenPlayerName(1);
234 Model
:= STD_PLAYER_MODEL
;
235 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
236 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
237 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
241 with gPlayer2Settings
do
243 Name
:= GenPlayerName(2);
244 Model
:= STD_PLAYER_MODEL
;
245 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
246 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
247 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
251 (* section Joysticks *)
252 for i
:= 0 to e_MaxJoys
- 1 do
254 e_JoystickDeadzones
[i
] := 8192
259 g_Shells_SetMax(300);
261 g_Corpses_SetMax(20);
263 ITEM_RESPAWNTIME
:= 60 * 36;
269 gDrawBackGround
:= True;
270 gShowMessages
:= True;
271 gRevertPlayers
:= False;
273 wadoptDebug
:= False;
275 e_FastScreenshots
:= True;
276 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
277 gBerserkAutoswitch
:= True;
281 gAskLanguage
:= True;
282 gLanguage
:= LANGUAGE_ENGLISH
;
284 (* section GameplayCustom *)
286 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
291 gcTeamDamage
:= False;
293 gcWeaponStay
:= False;
295 gcBotsVS
:= 'Everybody';
296 gcDeathmatchKeys
:= True;
297 gcRespawnItems
:= True;
300 (* section GameplayNetwork *)
302 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
307 gnTeamDamage
:= False;
309 gnWeaponStay
:= False;
311 gnBotsVS
:= 'Everybody';
312 gnDeathmatchKeys
:= True;
313 gnRespawnItems
:= True;
316 (* section MasterServer *)
317 NetSlistIP
:= 'mpms.doom2d.org';
318 NetSlistPort
:= 25665;
319 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
322 NetServerName
:= 'Unnamed Server';
326 NetAllowRCON
:= False;
327 NetRCONPassword
:= 'default';
328 NetUseMaster
:= True;
331 NetMasterRate
:= 60000;
332 NetForwardPorts
:= False;
336 NetForcePlayerUpdate
:= False;
337 NetPredictSelf
:= True;
338 NetClientIP
:= '127.0.0.1';
339 NetClientPort
:= NetPort
;
342 procedure g_Options_Read(FileName
: String);
347 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
349 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
352 procedure ReadInteger (VAR v
: LongWord; param
: String; minv
: LongWord = Low(LongWord); maxv
: LongWord = High(LongWord)); overload
;
354 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
357 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
359 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
362 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
364 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
367 procedure ReadBoolean (VAR v
: Boolean; param
: String);
369 v
:= config
.ReadBool(section
, param
, v
)
372 procedure ReadString (VAR v
: String; param
: String);
374 v
:= config
.ReadStr(section
, param
, v
)
378 gAskLanguage
:= True;
379 e_WriteLog('Reading config', TMsgType
.Notify
);
380 g_Options_SetDefault
;
382 if FileExists(FileName
) = False then
384 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
385 g_Options_SetDefaultVideo
;
389 config
:= TConfig
.CreateFile(FileName
);
391 section
:= 'Player1';
392 with gPlayer1Settings
do
394 ReadString(Name
, 'name');
395 ReadString(Model
, 'model');
396 ReadInteger(Color
.R
, 'red', 0, 255);
397 ReadInteger(Color
.G
, 'green', 0, 255);
398 ReadInteger(Color
.B
, 'blue', 0, 255);
399 ReadInteger(Team
, 'team');
400 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
404 section
:= 'Player2';
405 with gPlayer2Settings
do
407 ReadString(Name
, 'name');
408 ReadString(Model
, 'model');
409 ReadInteger(Color
.R
, 'red', 0, 255);
410 ReadInteger(Color
.G
, 'green', 0, 255);
411 ReadInteger(Color
.B
, 'blue', 0, 255);
412 ReadInteger(Team
, 'team');
413 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
417 section
:= 'GameplayCustom';
418 ReadString(gcMap
, 'Map');
419 ReadString(gcGameMode
, 'GameMode');
420 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
421 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
422 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
423 ReadInteger(gcPlayers
, 'Players', 0, 2);
424 ReadBoolean(gcTeamDamage
, 'TeamDamage');
425 ReadBoolean(gcAllowExit
, 'AllowExit');
426 ReadBoolean(gcWeaponStay
, 'WeaponStay');
427 ReadBoolean(gcMonsters
, 'Monsters');
428 ReadString(gcBotsVS
, 'BotsVS');
429 ReadBoolean(gcDeathmatchKeys
, 'DeathmatchKeys');
430 ReadBoolean(gcRespawnItems
, 'RespawnItems');
431 ReadInteger(gcSpawnInvul
, 'SpawnInvul');
433 with gGameSettings
do
435 GameMode
:= g_Game_TextToMode(gcGameMode
);
436 if GameMode
= GM_NONE
then
438 if GameMode
= GM_SINGLE
then
440 TimeLimit
:= gcTimeLimit
;
441 GoalLimit
:= gcGoalLimit
;
442 MaxLives
:= gcMaxLives
;
446 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
448 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
450 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
452 Options
:= Options
or GAME_OPTION_MONSTERS
;
453 if gcBotsVS
= 'Everybody' then
454 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
455 if gcBotsVS
= 'Players' then
456 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
457 if gcBotsVS
= 'Monsters' then
458 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
459 if gcDeathmatchKeys
then
460 Options
:= Options
or GAME_OPTION_DMKEYS
;
461 if gcRespawnItems
then
462 Options
:= Options
or GAME_OPTION_RESPAWNITEMS
;
465 section
:= 'GameplayNetwork';
466 ReadString(gnMap
, 'Map');
467 ReadString(gnGameMode
, 'GameMode');
468 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
469 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
470 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
471 ReadInteger(gnPlayers
, 'Players', 0, 2);
472 ReadBoolean(gnTeamDamage
, 'TeamDamage');
473 ReadBoolean(gnAllowExit
, 'AllowExit');
474 ReadBoolean(gnWeaponStay
, 'WeaponStay');
475 ReadBoolean(gnMonsters
, 'Monsters');
476 ReadString(gnBotsVS
, 'BotsVS');
477 ReadBoolean(gnDeathmatchKeys
, 'DeathmatchKeys');
478 ReadBoolean(gnRespawnItems
, 'RespawnItems');
479 ReadInteger(gnSpawnInvul
, 'SpawnInvul');
481 section
:= 'MasterServer';
482 ReadString(NetSlistIP
, 'IP');
483 ReadInteger(NetSlistPort
, 'Port', 0, 65535);
484 ReadString(NetSlistList
, 'List');
485 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
488 ReadString(NetServerName
, 'Name');
489 ReadString(NetPassword
, 'Password');
490 ReadInteger(NetPort
, 'Port', 0, 65535);
491 ReadInteger(NetMaxClients
, 'MaxClients', 0, NET_MAXCLIENTS
);
492 ReadBoolean(NetAllowRCON
, 'RCON');
493 ReadString(NetRCONPassword
, 'RCONPassword');
494 ReadBoolean(NetUseMaster
, 'SyncWithMaster');
495 ReadInteger(NetUpdateRate
, 'UpdateInterval', 0);
496 ReadInteger(NetRelupdRate
, 'ReliableUpdateInterval', 0);
497 ReadInteger(NetMasterRate
, 'MasterSyncInterval', 1);
498 ReadBoolean(NetForwardPorts
, 'ForwardPorts');
501 ReadInteger(NetInterpLevel
, 'InterpolationSteps', 0);
502 ReadBoolean(NetForcePlayerUpdate
, 'ForcePlayerUpdate');
503 ReadBoolean(NetPredictSelf
, 'PredictSelf');
504 ReadString(NetClientIP
, 'LastIP');
505 ReadInteger(NetClientPort
, 'LastPort', 0, 65535);
509 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
512 procedure g_Options_Write(FileName
: String);
515 e_WriteLog('Writing config', TMsgType
.Notify
);
517 config
:= TConfig
.CreateFile(FileName
);
519 with config
, gPlayer1Settings
do
521 WriteStr('Player1', 'Name', Name
);
522 WriteStr('Player1', 'model', Model
);
523 WriteInt('Player1', 'red', Color
.R
);
524 WriteInt('Player1', 'green', Color
.G
);
525 WriteInt('Player1', 'blue', Color
.B
);
526 WriteInt('Player1', 'team', Team
);
529 with config
, gPlayer2Settings
do
531 WriteStr('Player2', 'Name', Name
);
532 WriteStr('Player2', 'model', Model
);
533 WriteInt('Player2', 'red', Color
.R
);
534 WriteInt('Player2', 'green', Color
.G
);
535 WriteInt('Player2', 'blue', Color
.B
);
536 WriteInt('Player2', 'team', Team
);
539 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
540 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
541 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
542 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
543 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
544 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
545 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
546 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
547 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
548 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
549 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
550 config
.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys
);
551 config
.WriteBool('GameplayCustom', 'RespawnItems', gcRespawnItems
);
552 config
.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul
);
554 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
555 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
556 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
557 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
558 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
559 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
560 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
561 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
562 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
563 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
564 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
565 config
.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys
);
566 config
.WriteBool('GameplayNetwork', 'RespawnItems', gnRespawnItems
);
567 config
.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul
);
569 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
570 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
571 config
.WriteStr('MasterServer', 'List', NetSlistList
);
573 config
.WriteStr ('Server', 'Name', NetServerName
);
574 config
.WriteStr ('Server', 'Password', NetPassword
);
575 config
.WriteInt ('Server', 'Port', NetPort
);
576 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
577 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
578 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
579 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
580 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
581 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
582 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
583 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
585 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
586 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
587 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
588 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
589 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
591 config
.SaveFile(FileName
);
595 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
599 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
601 config
:= TConfig
.CreateFile(FileName
);
603 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
604 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
605 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
606 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
607 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
608 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
609 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
610 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
611 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
612 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
613 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
614 config
.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys
);
615 config
.WriteBool('GameplayCustom', 'RespawnItems', gcRespawnItems
);
616 config
.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul
);
618 config
.SaveFile(FileName
);
622 procedure g_Options_Write_Gameplay_Net(FileName
: String);
626 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
628 config
:= TConfig
.CreateFile(FileName
);
630 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
631 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
632 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
633 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
634 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
635 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
636 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
637 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
638 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
639 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
640 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
641 config
.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys
);
642 config
.WriteBool('GameplayNetwork', 'RespawnItems', gnRespawnItems
);
643 config
.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul
);
645 config
.SaveFile(FileName
);
649 procedure g_Options_Write_Net_Server(FileName
: String);
653 e_WriteLog('Writing server config', TMsgType
.Notify
);
655 config
:= TConfig
.CreateFile(FileName
);
657 config
.WriteStr ('Server', 'Name', NetServerName
);
658 config
.WriteStr ('Server', 'Password', NetPassword
);
659 config
.WriteInt ('Server', 'Port', NetPort
);
660 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
661 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
662 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
664 config
.SaveFile(FileName
);
668 procedure g_Options_Write_Net_Client(FileName
: String);
672 e_WriteLog('Writing client config', TMsgType
.Notify
);
674 config
:= TConfig
.CreateFile(FileName
);
676 config
.WriteStr('Client', 'LastIP', NetClientIP
);
677 config
.WriteInt('Client', 'LastPort', NetClientPort
);
679 config
.SaveFile(FileName
);
683 procedure g_Options_Commands (p
: SSArray
);
684 var cmd
: AnsiString; i
: Integer;
686 cmd
:= LowerCase(p
[0]);
690 sys_EnableVSync(gVSync
);
691 gRC_Width
:= Max(1, gRC_Width
);
692 gRC_Height
:= Max(1, gRC_Height
);
693 gBPP
:= Max(1, gBPP
);
694 if sys_SetDisplayMode(gRC_Width
, gRC_Height
, gBPP
, gRC_FullScreen
, gRC_Maximized
) = True then
695 e_LogWriteln('resolution changed')
697 e_LogWriteln('resolution not changed')
701 if Length(p
) = 2 then
703 gAskLanguage
:= true;
704 gLanguage
:= LANGUAGE_ENGLISH
;
705 case LowerCase(p
[1]) of
708 gAskLanguage
:= false;
709 gLanguage
:= LANGUAGE_ENGLISH
;
713 gAskLanguage
:= false;
714 gLanguage
:= LANGUAGE_RUSSIAN
;
718 gAskLanguage
:= true;
719 gLanguage
:= LANGUAGE_ENGLISH
;
722 g_Language_Set(gLanguage
)
726 e_LogWritefln('usage: %s <English|Russian|Ask>', [cmd
])
731 if Length(p
) = 2 then
733 i
:= Max(0, StrToInt(p
[1]));
736 else if Length(p
) = 1 then
738 e_LogWritefln('%s', [g_GFX_GetMax()])
742 e_LogWritefln('usage: %s <n>', [cmd
])
747 if Length(p
) = 2 then
749 i
:= Max(0, StrToInt(p
[1]));
752 else if Length(p
) = 1 then
754 e_LogWritefln('%s', [g_Shells_GetMax()])
758 e_LogWritefln('usage: %s <n>', [cmd
])
763 if Length(p
) = 2 then
765 i
:= Max(0, StrToInt(p
[1]));
768 else if Length(p
) = 1 then
770 e_LogWritefln('%s', [g_Gibs_GetMax()])
774 e_LogWritefln('usage: %s <n>', [cmd
])
779 if Length(p
) = 2 then
781 i
:= Max(0, StrToInt(p
[1]));
784 else if Length(p
) = 1 then
786 e_LogWritefln('%s', [g_Corpses_GetMax()])
790 e_LogWritefln('usage: %s <n>', [cmd
])
793 'g_item_respawn_time':
795 if Length(p
) = 2 then
796 ITEM_RESPAWNTIME
:= Max(0, StrToInt(p
[1])) * 36
797 else if Length(p
) = 1 then
798 e_LogWritefln('%s', [ITEM_RESPAWNTIME
div 36])
800 e_LogWritefln('usage: %s <n>', [cmd
])
807 machine
:= Random(10000);
810 conRegVar('r_width', @gRC_Width
, '', '');
811 conRegVar('r_height', @gRC_Height
, '', '');
812 conRegVar('r_fullscreen', @gRC_FullScreen
, '', '');
813 conRegVar('r_maximized', @gRC_Maximized
, '', '');
814 conRegVar('r_bpp', @gBPP
, '', '');
815 conRegVar('r_vsync', @gVSync
, '', '');
816 conRegVar('r_texfilter', @gTextureFilter
, '', '');
817 conRegVar('r_npot', @glNPOTOverride
, '', '');
820 conRegVar('s_nosound', @gNoSound
, '', '');
821 conRegVar('s_soundvolume', @gSoundLevel
, '', '');
822 conRegVar('s_musicvolume', @gMusicLevel
, '', '');
823 conRegVar('s_maxsim', @gMaxSimSounds
, '', ''); // e_sound_fmod/sdl?
824 conRegVar('s_muteinactive', @gMuteWhenInactive
, '', '');
825 conRegVar('s_announcer', @gAnnouncer
, '', '');
826 conRegVar('s_sfx', @gSoundEffectsDF
, '', '');
827 conRegVar('s_chatsounds', @gUseChatSounds
, '', '');
828 {$IFDEF USE_SDLMIXER}
829 conRegVar('sdl_mixer_samplerate', @gsSDLSampleRate
, '', '');
830 conRegVar('sdl_mixer_buffersize', @gsSDLBufferSize
, '', '');
834 conRegVar('g_gibs_count', @gGibsCount
, '', '');
835 conRegVar('g_blood_count', @gBloodCount
, '', '');
836 conRegVar('g_adv_blood', @gAdvBlood
, '', '');
837 conRegVar('g_adv_corpses', @gAdvCorpses
, '', '');
838 conRegVar('g_adv_gibs', @gAdvGibs
, '', '');
839 conRegVar('r_flash', @gFlash
, '', '');
840 conRegVar('r_background', @gDrawBackGround
, '', '');
841 conRegVar('g_show_messages', @gShowMessages
, '', '');
842 conRegVar('r_revert_players', @gRevertPlayers
, '', '');
843 conRegVar('r_chat_bubble', @gChatBubble
, '', '');
844 conRegVar('sfs_debug', @wadoptDebug
, '', '');
845 conRegVar('sfs_fastmode', @wadoptFast
, '', '');
846 conRegVar('g_fast_screenshots', @e_FastScreenshots
, '', '');
847 conRegVar('g_default_megawad', @gDefaultMegawadStart
, '', '');
848 conRegVar('g_save_stats', @gSaveStats
, '', '');
849 conRegVar('g_screenshot_stats', @gScreenshotStats
, '', '');