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 gcSpawnInvul
: Integer = 0;
84 gnTeamDamage
: Boolean;
86 gnWeaponStay
: Boolean;
89 gnDeathmatchKeys
: Boolean = True;
90 gnSpawnInvul
: Integer = 0;
91 gsSDLSampleRate
: Integer;
92 gsSDLBufferSize
: Integer;
93 gDefaultMegawadStart
: AnsiString;
94 gBerserkAutoswitch
: Boolean;
95 glNPOTOverride
: Boolean = false;
100 {$INCLUDE ../nogl/noGLuses.inc}
104 e_log
, e_input
, g_console
, g_window
, g_sound
, g_gfx
, g_player
, Math
,
105 g_map
, g_net
, g_netmaster
, SysUtils
, CONFIG
, g_game
, g_main
, e_texture
,
106 g_items
, wadreader
, e_graphics
, g_touch
, envvars
, g_system
;
111 function GenPlayerName (n
: Integer): String;
114 Result
:= GetUserName
;
116 Result
:= 'Player' + IntToStr(machine
MOD 10000);
118 Result
:= Copy(Result
, 1, 12) + ' '
120 Result
:= Copy(Result
, 1, 10) + ' ' + IntToStr(n
)
124 procedure g_Options_SetDefaultVideo
;
125 var display
: TSDL_DisplayMode
;
127 var target
, closest
: TSDL_DisplayMode
; percentage
: Integer;
130 (* Display 0 = Primary display *)
132 gScreenHeight
:= 480;
133 //gBPP := SDL_BITSPERPIXEL(dispaly.format);
136 gFullScreen
:= True; (* rotation not allowed? *)
138 gFullScreen
:= False;
140 if SDL_GetDesktopDisplayMode(0, @display
) = 0 then
143 gScreenWidth
:= display
.w
;
144 gScreenHeight
:= display
.h
;
146 (* Window must be smaller than display *)
147 closest
.w
:= display
.w
;
148 closest
.h
:= display
.h
;
150 while (display
.w
- closest
.w
< 48) or (display
.h
- closest
.h
< 48) do
152 if percentage
< 25 then
154 closest
.w
:= display
.w
* 75 div 100;
155 closest
.h
:= display
.h
* 75 div 100;
158 target
.w
:= display
.w
* percentage
div 100;
159 target
.h
:= display
.h
* percentage
div 100;
160 target
.format
:= 0; (* didn't care *)
161 target
.refresh_rate
:= 0; (* didn't care *)
162 target
.driverdata
:= nil; (* init *)
163 SDL_GetClosestDisplayMode(0, @target
, @closest
);
166 gScreenWidth
:= closest
.w
;
167 gScreenHeight
:= closest
.h
;
168 //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
173 e_LogWritefln('SDL: Failed to get desktop display mode: %s', [SDL_GetError
])
175 (* Must be positioned on primary display *)
176 gWinMaximized
:= False;
178 gTextureFilter
:= True;
179 glLegacyNPOT
:= False;
180 gRC_Width
:= gScreenWidth
;
181 gRC_Height
:= gScreenHeight
;
182 gRC_FullScreen
:= gFullScreen
;
183 gRC_Maximized
:= gWinMaximized
;
184 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
185 g_Console_ResetBinds
;
188 procedure g_Options_SetDefaultVideo
;
191 gScreenHeight
:= 480;
193 gFullScreen
:= False;
194 gWinMaximized
:= False;
196 gTextureFilter
:= True;
197 glLegacyNPOT
:= False;
198 gRC_Width
:= gScreenWidth
;
199 gRC_Height
:= gScreenHeight
;
200 gRC_FullScreen
:= gFullScreen
;
201 gRC_Maximized
:= gWinMaximized
;
202 e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth
) + ' h = ' + IntToStr(gScreenHeight
));
203 g_Console_ResetBinds
;
207 procedure g_Options_SetDefault();
216 gMuteWhenInactive
:= False;
217 gAnnouncer
:= ANNOUNCE_MEPLUS
;
218 gSoundEffectsDF
:= True;
219 gUseChatSounds
:= True;
220 gsSDLSampleRate
:= 44100;
221 gsSDLBufferSize
:= 2048;
223 g_Sound_SetupAllVolumes(gSoundLevel
, gMusicLevel
);
225 with gPlayer1Settings
do
227 Name
:= GenPlayerName(1);
228 Model
:= STD_PLAYER_MODEL
;
229 Color
.R
:= PLAYER1_DEF_COLOR
.R
;
230 Color
.G
:= PLAYER1_DEF_COLOR
.G
;
231 Color
.B
:= PLAYER1_DEF_COLOR
.B
;
235 with gPlayer2Settings
do
237 Name
:= GenPlayerName(2);
238 Model
:= STD_PLAYER_MODEL
;
239 Color
.R
:= PLAYER2_DEF_COLOR
.R
;
240 Color
.G
:= PLAYER2_DEF_COLOR
.G
;
241 Color
.B
:= PLAYER2_DEF_COLOR
.B
;
245 (* section Joysticks *)
246 for i
:= 0 to e_MaxJoys
- 1 do
248 e_JoystickDeadzones
[i
] := 8192
253 g_Shells_SetMax(300);
255 g_Corpses_SetMax(20);
257 ITEM_RESPAWNTIME
:= 60 * 36;
263 gDrawBackGround
:= True;
264 gShowMessages
:= True;
265 gRevertPlayers
:= False;
267 wadoptDebug
:= False;
269 e_FastScreenshots
:= True;
270 gDefaultMegawadStart
:= DF_Default_Megawad_Start
;
271 gBerserkAutoswitch
:= True;
275 gAskLanguage
:= True;
276 gLanguage
:= LANGUAGE_ENGLISH
;
278 (* section GameplayCustom *)
280 gcGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
285 gcTeamDamage
:= False;
287 gcWeaponStay
:= False;
289 gcBotsVS
:= 'Everybody';
290 gcDeathmatchKeys
:= True;
293 (* section GameplayNetwork *)
295 gnGameMode
:= _lc
[I_MENU_GAME_TYPE_DM
];
300 gnTeamDamage
:= False;
302 gnWeaponStay
:= False;
304 gnBotsVS
:= 'Everybody';
305 gnDeathmatchKeys
:= True;
308 (* section MasterServer *)
309 NetSlistIP
:= 'mpms.doom2d.org';
310 NetSlistPort
:= 25665;
311 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
314 NetServerName
:= 'Unnamed Server';
318 NetAllowRCON
:= False;
319 NetRCONPassword
:= 'default';
320 NetUseMaster
:= True;
323 NetMasterRate
:= 60000;
324 NetForwardPorts
:= False;
328 NetForcePlayerUpdate
:= False;
329 NetPredictSelf
:= True;
330 NetClientIP
:= '127.0.0.1';
331 NetClientPort
:= NetPort
;
334 procedure g_Options_Read(FileName
: String);
339 procedure ReadInteger (VAR v
: Integer; param
: String; minv
: Integer = Low(Integer); maxv
: Integer = High(Integer));
341 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
344 procedure ReadInteger (VAR v
: LongWord; param
: String; minv
: LongWord = Low(LongWord); maxv
: LongWord = High(LongWord)); overload
;
346 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
349 procedure ReadInteger (VAR v
: Word; param
: String; minv
: Word = Low(Word); maxv
: Word = High(Word)); overload
;
351 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
354 procedure ReadInteger (VAR v
: Byte; param
: String; minv
: Byte = Low(Byte); maxv
: Byte = High(Byte)); overload
;
356 v
:= Max(Min(config
.ReadInt(section
, param
, v
), maxv
), minv
)
359 procedure ReadBoolean (VAR v
: Boolean; param
: String);
361 v
:= config
.ReadBool(section
, param
, v
)
364 procedure ReadString (VAR v
: String; param
: String);
366 v
:= config
.ReadStr(section
, param
, v
)
370 gAskLanguage
:= True;
371 e_WriteLog('Reading config', TMsgType
.Notify
);
372 g_Options_SetDefault
;
374 if FileExists(FileName
) = False then
376 e_WriteLog('Config file '+FileName
+' not found', TMsgType
.Warning
);
377 g_Options_SetDefaultVideo
;
381 config
:= TConfig
.CreateFile(FileName
);
383 section
:= 'Player1';
384 with gPlayer1Settings
do
386 ReadString(Name
, 'name');
387 ReadString(Model
, 'model');
388 ReadInteger(Color
.R
, 'red', 0, 255);
389 ReadInteger(Color
.G
, 'green', 0, 255);
390 ReadInteger(Color
.B
, 'blue', 0, 255);
391 ReadInteger(Team
, 'team');
392 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
396 section
:= 'Player2';
397 with gPlayer2Settings
do
399 ReadString(Name
, 'name');
400 ReadString(Model
, 'model');
401 ReadInteger(Color
.R
, 'red', 0, 255);
402 ReadInteger(Color
.G
, 'green', 0, 255);
403 ReadInteger(Color
.B
, 'blue', 0, 255);
404 ReadInteger(Team
, 'team');
405 if (Team
< TEAM_RED
) or (Team
> TEAM_BLUE
) then
409 section
:= 'GameplayCustom';
410 ReadString(gcMap
, 'Map');
411 ReadString(gcGameMode
, 'GameMode');
412 ReadInteger(gcTimeLimit
, 'TimeLimit', 0, 65535);
413 ReadInteger(gcGoalLimit
, 'GoalLimit', 0, 65535);
414 ReadInteger(gcMaxLives
, 'MaxLives', 0, 255);
415 ReadInteger(gcPlayers
, 'Players', 0, 2);
416 ReadBoolean(gcTeamDamage
, 'TeamDamage');
417 ReadBoolean(gcAllowExit
, 'AllowExit');
418 ReadBoolean(gcWeaponStay
, 'WeaponStay');
419 ReadBoolean(gcMonsters
, 'Monsters');
420 ReadString(gcBotsVS
, 'BotsVS');
421 ReadBoolean(gcDeathmatchKeys
, 'DeathmatchKeys');
422 ReadInteger(gcSpawnInvul
, 'SpawnInvul');
424 with gGameSettings
do
426 GameMode
:= g_Game_TextToMode(gcGameMode
);
427 if GameMode
= GM_NONE
then
429 if GameMode
= GM_SINGLE
then
431 TimeLimit
:= gcTimeLimit
;
432 GoalLimit
:= gcGoalLimit
;
433 MaxLives
:= gcMaxLives
;
437 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
439 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
441 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
443 Options
:= Options
or GAME_OPTION_MONSTERS
;
444 if gcBotsVS
= 'Everybody' then
445 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
446 if gcBotsVS
= 'Players' then
447 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
448 if gcBotsVS
= 'Monsters' then
449 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
450 if gcDeathmatchKeys
then
451 Options
:= Options
or GAME_OPTION_DMKEYS
;
454 section
:= 'GameplayNetwork';
455 ReadString(gnMap
, 'Map');
456 ReadString(gnGameMode
, 'GameMode');
457 ReadInteger(gnTimeLimit
, 'TimeLimit', 0, 65535);
458 ReadInteger(gnGoalLimit
, 'GoalLimit', 0, 65535);
459 ReadInteger(gnMaxLives
, 'MaxLives', 0, 255);
460 ReadInteger(gnPlayers
, 'Players', 0, 2);
461 ReadBoolean(gnTeamDamage
, 'TeamDamage');
462 ReadBoolean(gnAllowExit
, 'AllowExit');
463 ReadBoolean(gnWeaponStay
, 'WeaponStay');
464 ReadBoolean(gnMonsters
, 'Monsters');
465 ReadString(gnBotsVS
, 'BotsVS');
466 ReadBoolean(gnDeathmatchKeys
, 'DeathmatchKeys');
467 ReadInteger(gnSpawnInvul
, 'SpawnInvul');
469 section
:= 'MasterServer';
470 ReadString(NetSlistIP
, 'IP');
471 ReadInteger(NetSlistPort
, 'Port', 0, 65535);
472 ReadString(NetSlistList
, 'List');
473 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
476 ReadString(NetServerName
, 'Name');
477 ReadString(NetPassword
, 'Password');
478 ReadInteger(NetPort
, 'Port', 0, 65535);
479 ReadInteger(NetMaxClients
, 'MaxClients', 0, NET_MAXCLIENTS
);
480 ReadBoolean(NetAllowRCON
, 'RCON');
481 ReadString(NetRCONPassword
, 'RCONPassword');
482 ReadBoolean(NetUseMaster
, 'SyncWithMaster');
483 ReadInteger(NetUpdateRate
, 'UpdateInterval', 0);
484 ReadInteger(NetRelupdRate
, 'ReliableUpdateInterval', 0);
485 ReadInteger(NetMasterRate
, 'MasterSyncInterval', 1);
486 ReadBoolean(NetForwardPorts
, 'ForwardPorts');
489 ReadInteger(NetInterpLevel
, 'InterpolationSteps', 0);
490 ReadBoolean(NetForcePlayerUpdate
, 'ForcePlayerUpdate');
491 ReadBoolean(NetPredictSelf
, 'PredictSelf');
492 ReadString(NetClientIP
, 'LastIP');
493 ReadInteger(NetClientPort
, 'LastPort', 0, 65535);
497 //if gTextureFilter then TEXTUREFILTER := GL_LINEAR else TEXTUREFILTER := GL_NEAREST;
500 procedure g_Options_Write(FileName
: String);
503 e_WriteLog('Writing config', TMsgType
.Notify
);
505 config
:= TConfig
.CreateFile(FileName
);
507 with config
, gPlayer1Settings
do
509 WriteStr('Player1', 'Name', Name
);
510 WriteStr('Player1', 'model', Model
);
511 WriteInt('Player1', 'red', Color
.R
);
512 WriteInt('Player1', 'green', Color
.G
);
513 WriteInt('Player1', 'blue', Color
.B
);
514 WriteInt('Player1', 'team', Team
);
517 with config
, gPlayer2Settings
do
519 WriteStr('Player2', 'Name', Name
);
520 WriteStr('Player2', 'model', Model
);
521 WriteInt('Player2', 'red', Color
.R
);
522 WriteInt('Player2', 'green', Color
.G
);
523 WriteInt('Player2', 'blue', Color
.B
);
524 WriteInt('Player2', 'team', Team
);
527 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
528 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
529 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
530 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
531 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
532 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
533 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
534 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
535 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
536 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
537 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
538 config
.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys
);
539 config
.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul
);
541 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
542 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
543 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
544 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
545 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
546 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
547 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
548 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
549 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
550 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
551 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
552 config
.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys
);
553 config
.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul
);
555 config
.WriteStr('MasterServer', 'IP', NetSlistIP
);
556 config
.WriteInt('MasterServer', 'Port', NetSlistPort
);
557 config
.WriteStr('MasterServer', 'List', NetSlistList
);
559 config
.WriteStr ('Server', 'Name', NetServerName
);
560 config
.WriteStr ('Server', 'Password', NetPassword
);
561 config
.WriteInt ('Server', 'Port', NetPort
);
562 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
563 config
.WriteBool('Server', 'RCON', NetAllowRCON
);
564 config
.WriteStr ('Server', 'RCONPassword', NetRCONPassword
);
565 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
566 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
567 config
.WriteInt ('Server', 'UpdateInterval', NetUpdateRate
);
568 config
.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate
);
569 config
.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate
);
571 config
.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel
);
572 config
.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate
);
573 config
.WriteBool ('Client', 'PredictSelf', NetPredictSelf
);
574 config
.WriteStr ('Client', 'LastIP', NetClientIP
);
575 config
.WriteInt ('Client', 'LastPort', NetClientPort
);
577 config
.SaveFile(FileName
);
581 procedure g_Options_Write_Gameplay_Custom(FileName
: String);
585 e_WriteLog('Writing custom gameplay config', TMsgType
.Notify
);
587 config
:= TConfig
.CreateFile(FileName
);
589 config
.WriteStr ('GameplayCustom', 'Map', gcMap
);
590 config
.WriteStr ('GameplayCustom', 'GameMode', gcGameMode
);
591 config
.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit
);
592 config
.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit
);
593 config
.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives
);
594 config
.WriteInt ('GameplayCustom', 'Players', gcPlayers
);
595 config
.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage
);
596 config
.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit
);
597 config
.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay
);
598 config
.WriteBool('GameplayCustom', 'Monsters', gcMonsters
);
599 config
.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS
);
600 config
.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys
);
601 config
.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul
);
603 config
.SaveFile(FileName
);
607 procedure g_Options_Write_Gameplay_Net(FileName
: String);
611 e_WriteLog('Writing network gameplay config', TMsgType
.Notify
);
613 config
:= TConfig
.CreateFile(FileName
);
615 config
.WriteStr ('GameplayNetwork', 'Map', gnMap
);
616 config
.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode
);
617 config
.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit
);
618 config
.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit
);
619 config
.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives
);
620 config
.WriteInt ('GameplayNetwork', 'Players', gnPlayers
);
621 config
.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage
);
622 config
.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit
);
623 config
.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay
);
624 config
.WriteBool('GameplayNetwork', 'Monsters', gnMonsters
);
625 config
.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS
);
626 config
.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys
);
627 config
.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul
);
629 config
.SaveFile(FileName
);
633 procedure g_Options_Write_Net_Server(FileName
: String);
637 e_WriteLog('Writing server config', TMsgType
.Notify
);
639 config
:= TConfig
.CreateFile(FileName
);
641 config
.WriteStr ('Server', 'Name', NetServerName
);
642 config
.WriteStr ('Server', 'Password', NetPassword
);
643 config
.WriteInt ('Server', 'Port', NetPort
);
644 config
.WriteInt ('Server', 'MaxClients', NetMaxClients
);
645 config
.WriteBool('Server', 'SyncWithMaster', NetUseMaster
);
646 config
.WriteBool('Server', 'ForwardPorts', NetForwardPorts
);
648 config
.SaveFile(FileName
);
652 procedure g_Options_Write_Net_Client(FileName
: String);
656 e_WriteLog('Writing client config', TMsgType
.Notify
);
658 config
:= TConfig
.CreateFile(FileName
);
660 config
.WriteStr('Client', 'LastIP', NetClientIP
);
661 config
.WriteInt('Client', 'LastPort', NetClientPort
);
663 config
.SaveFile(FileName
);
667 procedure g_Options_Commands (p
: SSArray
);
668 var cmd
: AnsiString; i
: Integer;
670 cmd
:= LowerCase(p
[0]);
674 sys_EnableVSync(gVSync
);
675 gRC_Width
:= Max(1, gRC_Width
);
676 gRC_Height
:= Max(1, gRC_Height
);
677 gBPP
:= Max(1, gBPP
);
678 if sys_SetDisplayMode(gRC_Width
, gRC_Height
, gBPP
, gRC_FullScreen
, gRC_Maximized
) = True then
679 e_LogWriteln('resolution changed')
681 e_LogWriteln('resolution not changed')
685 if Length(p
) = 2 then
687 gAskLanguage
:= true;
688 gLanguage
:= LANGUAGE_ENGLISH
;
689 case LowerCase(p
[1]) of
692 gAskLanguage
:= false;
693 gLanguage
:= LANGUAGE_ENGLISH
;
697 gAskLanguage
:= false;
698 gLanguage
:= LANGUAGE_RUSSIAN
;
702 gAskLanguage
:= true;
703 gLanguage
:= LANGUAGE_ENGLISH
;
706 g_Language_Set(gLanguage
)
710 e_LogWritefln('usage: %s <English|Russian|Ask>', [cmd
])
715 if Length(p
) = 2 then
717 i
:= Max(0, StrToInt(p
[1]));
720 else if Length(p
) = 1 then
722 e_LogWritefln('%s', [g_GFX_GetMax()])
726 e_LogWritefln('usage: %s <n>', [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_Shells_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_Gibs_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_Corpses_GetMax()])
774 e_LogWritefln('usage: %s <n>', [cmd
])
777 'g_item_respawn_time':
779 if Length(p
) = 2 then
780 ITEM_RESPAWNTIME
:= Max(0, StrToInt(p
[1])) * 36
781 else if Length(p
) = 1 then
782 e_LogWritefln('%s', [ITEM_RESPAWNTIME
div 36])
784 e_LogWritefln('usage: %s <n>', [cmd
])
791 machine
:= Random(10000);
794 conRegVar('r_width', @gRC_Width
, '', '');
795 conRegVar('r_height', @gRC_Height
, '', '');
796 conRegVar('r_fullscreen', @gRC_FullScreen
, '', '');
797 conRegVar('r_maximized', @gRC_Maximized
, '', '');
798 conRegVar('r_bpp', @gBPP
, '', '');
799 conRegVar('r_vsync', @gVSync
, '', '');
800 conRegVar('r_texfilter', @gTextureFilter
, '', '');
801 conRegVar('r_npot', @glNPOTOverride
, '', '');
804 conRegVar('s_nosound', @gNoSound
, '', '');
805 conRegVar('s_soundvolume', @gSoundLevel
, '', '');
806 conRegVar('s_musicvolume', @gMusicLevel
, '', '');
807 conRegVar('s_maxsim', @gMaxSimSounds
, '', ''); // e_sound_fmod/sdl?
808 conRegVar('s_muteinactive', @gMuteWhenInactive
, '', '');
809 conRegVar('s_announcer', @gAnnouncer
, '', '');
810 conRegVar('s_sfx', @gSoundEffectsDF
, '', '');
811 conRegVar('s_chatsounds', @gUseChatSounds
, '', '');
812 {$IFDEF USE_SDLMIXER}
813 conRegVar('sdl_mixer_samplerate', @gsSDLSampleRate
, '', '');
814 conRegVar('sdl_mixer_buffersize', @gsSDLBufferSize
, '', '');
818 conRegVar('g_gibs_count', @gGibsCount
, '', '');
819 conRegVar('g_blood_count', @gBloodCount
, '', '');
820 conRegVar('g_adv_blood', @gAdvBlood
, '', '');
821 conRegVar('g_adv_corpses', @gAdvCorpses
, '', '');
822 conRegVar('g_adv_gibs', @gAdvGibs
, '', '');
823 conRegVar('r_flash', @gFlash
, '', '');
824 conRegVar('r_background', @gDrawBackGround
, '', '');
825 conRegVar('g_show_messages', @gShowMessages
, '', '');
826 conRegVar('r_revert_players', @gRevertPlayers
, '', '');
827 conRegVar('r_chat_bubble', @gChatBubble
, '', '');
828 conRegVar('sfs_debug', @wadoptDebug
, '', '');
829 conRegVar('sfs_fastmode', @wadoptFast
, '', '');
830 conRegVar('g_fast_screenshots', @e_FastScreenshots
, '', '');
831 conRegVar('g_default_megawad', @gDefaultMegawadStart
, '', '');
832 conRegVar('g_save_stats', @gSaveStats
, '', '');
833 conRegVar('g_screenshot_stats', @gScreenshotStats
, '', '');