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;
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;
135 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
138 gFullScreen
:= True; (* rotation not allowed? *)
140 gFullScreen
:= False;
142 if SDL_GetDesktopDisplayMode(0, @display
) = 0 then
145 gScreenWidth
:= display
.w
;
146 gScreenHeight
:= display
.h
;
148 (* Window must be smaller than display *)
149 closest
.w
:= display
.w
;
150 closest
.h
:= display
.h
;
152 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
154 if percentage
< 25 then
156 closest
.w
:= display
.w
* 75 div 100;
157 closest
.h
:= display
.h
* 75 div 100;
160 target
.w
:= display
.w
* percentage
div 100;
161 target
.h
:= display
.h
* percentage
div 100;
162 target
.format
:= 0; (* didn't care *)
163 target
.refresh_rate
:= 0; (* didn't care *)
164 target
.driverdata
:= nil; (* init *)
165 SDL_GetClosestDisplayMode(0, @target
, @closest
);
168 gScreenWidth
:= closest
.w
;
169 gScreenHeight
:= closest
.h
;
170 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
175 e_LogWritefln('SDL: Failed to get desktop display mode: %s', [SDL_GetError
])
177 (* Must be positioned on primary display *)
178 gWinMaximized
:= False;
180 gTextureFilter
:= True;
181 glLegacyNPOT
:= False;
182 gRC_Width
:= gScreenWidth
;
183 gRC_Height
:= gScreenHeight
;
184 gRC_FullScreen
:= gFullScreen
;
185 gRC_Maximized
:= gWinMaximized
;
186 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
187 g_Console_ResetBinds
;
190 procedure g_Options_SetDefaultVideo
;
193 gScreenHeight
:= 480;
195 gFullScreen
:= False;
196 gWinMaximized
:= False;
198 gTextureFilter
:= True;
199 glLegacyNPOT
:= False;
200 gRC_Width
:= gScreenWidth
;
201 gRC_Height
:= gScreenHeight
;
202 gRC_FullScreen
:= gFullScreen
;
203 gRC_Maximized
:= gWinMaximized
;
204 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
205 g_Console_ResetBinds
;
209 procedure g_Options_SetDefault();
218 gMuteWhenInactive
:= False;
219 gAnnouncer
:= ANNOUNCE_MEPLUS
;
220 gSoundEffectsDF
:= True;
221 gUseChatSounds
:= True;
222 gsSDLSampleRate
:= 44100;
223 gsSDLBufferSize
:= 2048;
225 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
227 with gPlayer1Settings
do
229 Name
:= GenPlayerName(1);
230 Model
:= STD_PLAYER_MODEL
;
231 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
232 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
233 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
237 with gPlayer2Settings
do
239 Name
:= GenPlayerName(2);
240 Model
:= STD_PLAYER_MODEL
;
241 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
242 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
243 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
247 (* section Joysticks *)
248 for i
:= 0 to e_MaxJoys
- 1 do
250 e_JoystickDeadzones
[i
] := 8192
255 g_Shells_SetMax(300);
257 g_Corpses_SetMax(20);
259 ITEM_RESPAWNTIME
:= 60 * 36;
265 gDrawBackGround
:= True;
266 gShowMessages
:= True;
267 gRevertPlayers
:= False;
269 wadoptDebug
:= False;
271 e_FastScreenshots
:= True;
272 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
273 gBerserkAutoswitch
:= True;
277 gAskLanguage
:= True;
278 gLanguage
:= LANGUAGE_ENGLISH
;
280 (* section GameplayCustom *)
282 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
287 gcTeamDamage
:= False;
289 gcWeaponStay
:= False;
291 gcBotsVS
:= 'Everybody';
292 gcDeathmatchKeys
:= True;
293 gcRespawnItems
:= True;
296 (* section GameplayNetwork *)
298 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
303 gnTeamDamage
:= False;
305 gnWeaponStay
:= False;
307 gnBotsVS
:= 'Everybody';
308 gnDeathmatchKeys
:= True;
309 gnRespawnItems
:= True;
312 (* section MasterServer *)
313 NetSlistIP
:= 'mpms.doom2d.org';
314 NetSlistPort
:= 25665;
315 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
318 NetServerName
:= 'Unnamed Server';
322 NetAllowRCON
:= False;
323 NetRCONPassword
:= 'default';
324 NetUseMaster
:= True;
327 NetMasterRate
:= 60000;
328 NetForwardPorts
:= False;
332 NetForcePlayerUpdate
:= False;
333 NetPredictSelf
:= True;
334 NetClientIP
:= '127.0.0.1';
335 NetClientPort
:= NetPort
;
338 procedure g_Options_Read(FileName
: String);
343 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
345 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
348 procedure ReadInteger (VAR v
: LongWord; param
: String; minv
: LongWord = Low(LongWord); maxv
: LongWord = High(LongWord)); overload
;
350 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
353 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
355 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
358 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
360 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
363 procedure ReadBoolean (VAR v
: Boolean; param
: String);
365 v
:= config
.ReadBool(section
, param
, v
)
368 procedure ReadString (VAR v
: String; param
: String);
370 v
:= config
.ReadStr(section
, param
, v
)
374 gAskLanguage
:= True;
375 e_WriteLog('Reading config', TMsgType
.Notify
);
376 g_Options_SetDefault
;
378 if FileExists(FileName
) = False then
380 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
381 g_Options_SetDefaultVideo
;
385 config
:= TConfig
.CreateFile(FileName
);
387 section
:= 'Player1';
388 with gPlayer1Settings
do
390 ReadString(Name
, 'name');
391 ReadString(Model
, 'model');
392 ReadInteger(Color
.R
, 'red', 0, 255);
393 ReadInteger(Color
.G
, 'green', 0, 255);
394 ReadInteger(Color
.B
, 'blue', 0, 255);
395 ReadInteger(Team
, 'team');
396 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
400 section
:= 'Player2';
401 with gPlayer2Settings
do
403 ReadString(Name
, 'name');
404 ReadString(Model
, 'model');
405 ReadInteger(Color
.R
, 'red', 0, 255);
406 ReadInteger(Color
.G
, 'green', 0, 255);
407 ReadInteger(Color
.B
, 'blue', 0, 255);
408 ReadInteger(Team
, 'team');
409 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
413 section
:= 'GameplayCustom';
414 ReadString(gcMap
, 'Map');
415 ReadString(gcGameMode
, 'GameMode');
416 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
417 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
418 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
419 ReadInteger(gcPlayers
, 'Players', 0, 2);
420 ReadBoolean(gcTeamDamage
, 'TeamDamage');
421 ReadBoolean(gcAllowExit
, 'AllowExit');
422 ReadBoolean(gcWeaponStay
, 'WeaponStay');
423 ReadBoolean(gcMonsters
, 'Monsters');
424 ReadString(gcBotsVS
, 'BotsVS');
425 ReadBoolean(gcDeathmatchKeys
, 'DeathmatchKeys');
426 ReadBoolean(gcRespawnItems
, 'RespawnItems');
427 ReadInteger(gcSpawnInvul
, 'SpawnInvul');
429 with gGameSettings
do
431 GameMode
:= g_Game_TextToMode(gcGameMode
);
432 if GameMode
= GM_NONE
then
434 if GameMode
= GM_SINGLE
then
436 TimeLimit
:= gcTimeLimit
;
437 GoalLimit
:= gcGoalLimit
;
438 MaxLives
:= gcMaxLives
;
442 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
444 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
446 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
448 Options
:= Options
or GAME_OPTION_MONSTERS
;
449 if gcBotsVS
= 'Everybody' then
450 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
451 if gcBotsVS
= 'Players' then
452 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
453 if gcBotsVS
= 'Monsters' then
454 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
455 if gcDeathmatchKeys
then
456 Options
:= Options
or GAME_OPTION_DMKEYS
;
457 if gcRespawnItems
then
458 Options
:= Options
or GAME_OPTION_RESPAWNITEMS
;
461 section
:= 'GameplayNetwork';
462 ReadString(gnMap
, 'Map');
463 ReadString(gnGameMode
, 'GameMode');
464 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
465 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
466 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
467 ReadInteger(gnPlayers
, 'Players', 0, 2);
468 ReadBoolean(gnTeamDamage
, 'TeamDamage');
469 ReadBoolean(gnAllowExit
, 'AllowExit');
470 ReadBoolean(gnWeaponStay
, 'WeaponStay');
471 ReadBoolean(gnMonsters
, 'Monsters');
472 ReadString(gnBotsVS
, 'BotsVS');
473 ReadBoolean(gnDeathmatchKeys
, 'DeathmatchKeys');
474 ReadBoolean(gnRespawnItems
, 'RespawnItems');
475 ReadInteger(gnSpawnInvul
, 'SpawnInvul');
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
);
535 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
536 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
537 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
538 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
539 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
540 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
541 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
542 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
543 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
544 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
545 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
546 config
.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys
);
547 config
.WriteBool('GameplayCustom', 'RespawnItems', gcRespawnItems
);
548 config
.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul
);
550 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
551 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
552 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
553 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
554 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
555 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
556 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
557 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
558 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
559 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
560 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
561 config
.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys
);
562 config
.WriteBool('GameplayNetwork', 'RespawnItems', gnRespawnItems
);
563 config
.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul
);
565 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
566 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
567 config
.WriteStr('MasterServer', 'List', NetSlistList
);
569 config
.WriteStr ('Server', 'Name', NetServerName
);
570 config
.WriteStr ('Server', 'Password', NetPassword
);
571 config
.WriteInt ('Server', 'Port', NetPort
);
572 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
573 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
574 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
575 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
576 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
577 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
578 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
579 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
581 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
582 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
583 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
584 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
585 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
587 config
.SaveFile(FileName
);
591 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
595 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
597 config
:= TConfig
.CreateFile(FileName
);
599 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
600 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
601 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
602 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
603 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
604 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
605 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
606 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
607 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
608 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
609 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
610 config
.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys
);
611 config
.WriteBool('GameplayCustom', 'RespawnItems', gcRespawnItems
);
612 config
.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul
);
614 config
.SaveFile(FileName
);
618 procedure g_Options_Write_Gameplay_Net(FileName
: String);
622 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
624 config
:= TConfig
.CreateFile(FileName
);
626 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
627 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
628 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
629 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
630 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
631 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
632 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
633 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
634 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
635 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
636 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
637 config
.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys
);
638 config
.WriteBool('GameplayNetwork', 'RespawnItems', gnRespawnItems
);
639 config
.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul
);
641 config
.SaveFile(FileName
);
645 procedure g_Options_Write_Net_Server(FileName
: String);
649 e_WriteLog('Writing server config', TMsgType
.Notify
);
651 config
:= TConfig
.CreateFile(FileName
);
653 config
.WriteStr ('Server', 'Name', NetServerName
);
654 config
.WriteStr ('Server', 'Password', NetPassword
);
655 config
.WriteInt ('Server', 'Port', NetPort
);
656 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
657 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
658 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
660 config
.SaveFile(FileName
);
664 procedure g_Options_Write_Net_Client(FileName
: String);
668 e_WriteLog('Writing client config', TMsgType
.Notify
);
670 config
:= TConfig
.CreateFile(FileName
);
672 config
.WriteStr('Client', 'LastIP', NetClientIP
);
673 config
.WriteInt('Client', 'LastPort', NetClientPort
);
675 config
.SaveFile(FileName
);
679 procedure g_Options_Commands (p
: SSArray
);
680 var cmd
: AnsiString; i
: Integer;
682 cmd
:= LowerCase(p
[0]);
686 sys_EnableVSync(gVSync
);
687 gRC_Width
:= Max(1, gRC_Width
);
688 gRC_Height
:= Max(1, gRC_Height
);
689 gBPP
:= Max(1, gBPP
);
690 if sys_SetDisplayMode(gRC_Width
, gRC_Height
, gBPP
, gRC_FullScreen
, gRC_Maximized
) = True then
691 e_LogWriteln('resolution changed')
693 e_LogWriteln('resolution not changed')
697 if Length(p
) = 2 then
699 gAskLanguage
:= true;
700 gLanguage
:= LANGUAGE_ENGLISH
;
701 case LowerCase(p
[1]) of
704 gAskLanguage
:= false;
705 gLanguage
:= LANGUAGE_ENGLISH
;
709 gAskLanguage
:= false;
710 gLanguage
:= LANGUAGE_RUSSIAN
;
714 gAskLanguage
:= true;
715 gLanguage
:= LANGUAGE_ENGLISH
;
718 g_Language_Set(gLanguage
)
722 e_LogWritefln('usage: %s <English|Russian|Ask>', [cmd
])
727 if Length(p
) = 2 then
729 i
:= Max(0, StrToInt(p
[1]));
732 else if Length(p
) = 1 then
734 e_LogWritefln('%s', [g_GFX_GetMax()])
738 e_LogWritefln('usage: %s <n>', [cmd
])
743 if Length(p
) = 2 then
745 i
:= Max(0, StrToInt(p
[1]));
748 else if Length(p
) = 1 then
750 e_LogWritefln('%s', [g_Shells_GetMax()])
754 e_LogWritefln('usage: %s <n>', [cmd
])
759 if Length(p
) = 2 then
761 i
:= Max(0, StrToInt(p
[1]));
764 else if Length(p
) = 1 then
766 e_LogWritefln('%s', [g_Gibs_GetMax()])
770 e_LogWritefln('usage: %s <n>', [cmd
])
775 if Length(p
) = 2 then
777 i
:= Max(0, StrToInt(p
[1]));
780 else if Length(p
) = 1 then
782 e_LogWritefln('%s', [g_Corpses_GetMax()])
786 e_LogWritefln('usage: %s <n>', [cmd
])
789 'g_item_respawn_time':
791 if Length(p
) = 2 then
792 ITEM_RESPAWNTIME
:= Max(0, StrToInt(p
[1])) * 36
793 else if Length(p
) = 1 then
794 e_LogWritefln('%s', [ITEM_RESPAWNTIME
div 36])
796 e_LogWritefln('usage: %s <n>', [cmd
])
803 machine
:= Random(10000);
806 conRegVar('r_width', @gRC_Width
, '', '');
807 conRegVar('r_height', @gRC_Height
, '', '');
808 conRegVar('r_fullscreen', @gRC_FullScreen
, '', '');
809 conRegVar('r_maximized', @gRC_Maximized
, '', '');
810 conRegVar('r_bpp', @gBPP
, '', '');
811 conRegVar('r_vsync', @gVSync
, '', '');
812 conRegVar('r_texfilter', @gTextureFilter
, '', '');
813 conRegVar('r_npot', @glNPOTOverride
, '', '');
816 conRegVar('s_nosound', @gNoSound
, '', '');
817 conRegVar('s_soundvolume', @gSoundLevel
, '', '');
818 conRegVar('s_musicvolume', @gMusicLevel
, '', '');
819 conRegVar('s_maxsim', @gMaxSimSounds
, '', ''); // e_sound_fmod/sdl?
820 conRegVar('s_muteinactive', @gMuteWhenInactive
, '', '');
821 conRegVar('s_announcer', @gAnnouncer
, '', '');
822 conRegVar('s_sfx', @gSoundEffectsDF
, '', '');
823 conRegVar('s_chatsounds', @gUseChatSounds
, '', '');
824 {$IFDEF USE_SDLMIXER}
825 conRegVar('sdl_mixer_samplerate', @gsSDLSampleRate
, '', '');
826 conRegVar('sdl_mixer_buffersize', @gsSDLBufferSize
, '', '');
830 conRegVar('g_gibs_count', @gGibsCount
, '', '');
831 conRegVar('g_blood_count', @gBloodCount
, '', '');
832 conRegVar('g_adv_blood', @gAdvBlood
, '', '');
833 conRegVar('g_adv_corpses', @gAdvCorpses
, '', '');
834 conRegVar('g_adv_gibs', @gAdvGibs
, '', '');
835 conRegVar('r_flash', @gFlash
, '', '');
836 conRegVar('r_background', @gDrawBackGround
, '', '');
837 conRegVar('g_show_messages', @gShowMessages
, '', '');
838 conRegVar('r_revert_players', @gRevertPlayers
, '', '');
839 conRegVar('r_chat_bubble', @gChatBubble
, '', '');
840 conRegVar('sfs_debug', @wadoptDebug
, '', '');
841 conRegVar('sfs_fastmode', @wadoptFast
, '', '');
842 conRegVar('g_fast_screenshots', @e_FastScreenshots
, '', '');
843 conRegVar('g_default_megawad', @gDefaultMegawadStart
, '', '');
844 conRegVar('g_save_stats', @gSaveStats
, '', '');
845 conRegVar('g_screenshot_stats', @gScreenshotStats
, '', '');