DEADSOFTWARE

removed trailing spaces all over the source
[d2df-sdl.git] / src / game / g_options.pas
1 unit g_options;
3 interface
5 uses
6 g_language;
8 type
9 TPlayerControl = record
10 KeyRight: Word;
11 KeyLeft: Word;
12 KeyUp: Word;
13 KeyDown: Word;
14 KeyFire: Word;
15 KeyJump: Word;
16 KeyNextWeapon: Word;
17 KeyPrevWeapon: Word;
18 KeyOpen: Word;
19 end;
21 TGameControls = record
22 TakeScreenshot: Word;
23 Stat: Word;
24 Chat: Word;
25 TeamChat: Word;
26 end;
28 TControls = record
29 GameControls: TGameControls;
30 P1Control: TPlayerControl;
31 P2Control: TPlayerControl;
32 end;
34 procedure g_Options_SetDefault();
35 procedure g_Options_Read(FileName: String);
36 procedure g_Options_Write(FileName: String);
37 procedure g_Options_Write_Language(FileName: String);
38 procedure g_Options_Write_Video(FileName: String);
39 procedure g_Options_Write_Gameplay_Custom(FileName: String);
40 procedure g_Options_Write_Gameplay_Net(FileName: String);
41 procedure g_Options_Write_Net_Server(FileName: String);
42 procedure g_Options_Write_Net_Client(FileName: String);
44 var
45 gGameControls: TControls;
46 gScreenWidth: Word = 800;
47 gScreenHeight: Word = 600;
48 gWinRealPosX: Integer = 0;
49 gWinRealPosY: Integer = 0;
50 gBPP: Byte = 32;
51 gFreq: Byte = 0;
52 gFullscreen: Boolean = False;
53 gWinMaximized: Boolean = False;
54 gVSync: Boolean = False;
55 gTextureFilter: Boolean = True;
56 gNoSound: Boolean = False;
57 gSoundLevel: Byte = 75;
58 gMusicLevel: Byte = 65;
59 gMaxSimSounds: Byte = 8;
60 gMuteWhenInactive: Boolean = False;
61 gAdvCorpses: Boolean = True;
62 gAdvBlood: Boolean = True;
63 gAdvGibs: Boolean = True;
64 gGibsCount: Integer = 32;
65 gBloodCount: Byte = 3;
66 gFlash: Byte = 1;
67 gDrawBackGround: Boolean = True;
68 gShowMessages: Boolean = True;
69 gRevertPlayers: Boolean = False;
70 gLanguage: String = LANGUAGE_ENGLISH;
71 gAskLanguage: Boolean = True;
72 gcMap: String = '';
73 gcGameMode: String = '';
74 gcTimeLimit: Word = 0;
75 gcGoalLimit: Word = 0;
76 gcMaxLives: Byte = 0;
77 gcPlayers: Byte = 1;
78 gcTeamDamage: Boolean = False;
79 gcAllowExit: Boolean = True;
80 gcWeaponStay: Boolean = False;
81 gcMonsters: Boolean = False;
82 gcBotsVS: String = 'Everybody';
83 gnMap: String = '';
84 gnGameMode: String = '';
85 gnTimeLimit: Word = 0;
86 gnGoalLimit: Word = 0;
87 gnMaxLives: Byte = 0;
88 gnPlayers: Byte = 1;
89 gnTeamDamage: Boolean = False;
90 gnAllowExit: Boolean = True;
91 gnWeaponStay: Boolean = False;
92 gnMonsters: Boolean = False;
93 gnBotsVS: String = 'Everybody';
95 implementation
97 uses
98 e_log, e_input, g_window, g_sound, g_gfx, g_player, Math,
99 g_map, g_net, g_netmaster, SysUtils, CONFIG, g_game, g_main, e_textures,
100 g_items, GL, GLExt;
102 procedure g_Options_SetDefault();
103 var
104 i: Integer;
105 begin
106 g_Sound_SetupAllVolumes(75, 65);
107 gMaxSimSounds := 8;
108 gMuteWhenInactive := False;
109 gAnnouncer := ANNOUNCE_MEPLUS;
110 gSoundEffectsDF := True;
111 g_GFX_SetMax(2000);
112 g_Gibs_SetMax(150);
113 g_Corpses_SetMax(20);
114 g_Shells_SetMax(300);
115 gGibsCount := 32;
116 gBloodCount := 3;
117 gAdvBlood := True;
118 gAdvCorpses := True;
119 gAdvGibs := True;
120 gFlash := 1;
121 gDrawBackGround := True;
122 gShowMessages := True;
123 gRevertPlayers := False;
125 for i := 0 to e_MaxJoys-1 do
126 e_JoystickDeadzones[i] := 8192;
128 with gGameControls.GameControls do
129 begin
130 TakeScreenshot := 183;
131 Stat := 15;
132 Chat := 20; // [T]
133 TeamChat := 21; // [Y]
134 end;
136 with gGameControls.P1Control do
137 begin
138 KeyRight := 77;
139 KeyLeft := 75;
140 KeyUp := 72;
141 KeyDown := 76;
142 KeyFire := 184;
143 KeyJump := 157;
144 KeyNextWeapon := 73;
145 KeyPrevWeapon := 71;
146 KeyOpen := 54;
147 end;
149 with gGameControls.P2Control do
150 begin
151 KeyRight := 33;
152 KeyLeft := 31;
153 KeyUp := 18;
154 KeyDown := 32;
155 KeyFire := 30;
156 KeyJump := 16;
157 KeyNextWeapon := 19;
158 KeyPrevWeapon := 17;
159 KeyOpen := 58;
160 end;
162 with gPlayer1Settings do
163 begin
164 Name := 'Player1';
165 Model := STD_PLAYER_MODEL;
166 Color.R := PLAYER1_DEF_COLOR.R;
167 Color.G := PLAYER1_DEF_COLOR.G;
168 Color.B := PLAYER1_DEF_COLOR.B;
169 Team := TEAM_RED;
170 end;
172 with gPlayer2Settings do
173 begin
174 Name := 'Player2';
175 Model := STD_PLAYER_MODEL;
176 Color.R := PLAYER2_DEF_COLOR.R;
177 Color.G := PLAYER2_DEF_COLOR.G;
178 Color.B := PLAYER2_DEF_COLOR.B;
179 Team := TEAM_BLUE;
180 end;
182 NetUseMaster := True;
183 g_Net_Slist_Set('mpms.doom2d.org', 25665);
184 end;
186 procedure g_Options_Read(FileName: String);
187 var
188 config: TConfig;
189 str: String;
190 i: Integer;
191 begin
192 gAskLanguage := True;
193 e_WriteLog('Reading config', MSG_NOTIFY);
195 if not FileExists(FileName) then
196 begin
197 e_WriteLog('Config file '+FileName+' not found', MSG_WARNING);
198 g_Options_SetDefault();
200 // Default video options:
201 gScreenWidth := 800;
202 gScreenHeight := 600;
203 gWinRealPosX := 0;
204 gWinRealPosY := 0;
205 gWinMaximized := False;
206 gFullScreen := False;
207 gBPP := 32;
208 gVSync := False;
209 gTextureFilter := True;
210 fUseMipmaps := False;
212 Exit;
213 end;
215 config := TConfig.CreateFile(FileName);
217 gScreenWidth := config.ReadInt('Video', 'ScreenWidth', 800);
218 if gScreenWidth < 640 then
219 gScreenWidth := 640;
220 gScreenHeight := config.ReadInt('Video', 'ScreenHeight', 600);
221 if gScreenHeight < 480 then
222 gScreenHeight := 480;
223 gWinRealPosX := config.ReadInt('Video', 'WinPosX', 0);
224 if gWinRealPosX < 0 then
225 gWinRealPosX := 0;
226 gWinRealPosY := config.ReadInt('Video', 'WinPosY', 0);
227 if gWinRealPosY < 0 then
228 gWinRealPosY := 0;
229 gFullScreen := config.ReadBool('Video', 'Fullscreen', False);
230 gWinMaximized := config.ReadBool('Video', 'Maximized', False);
231 gBPP := config.ReadInt('Video', 'BPP', 32);
232 gFreq := config.ReadInt('Video', 'Freq', 0);
233 gVSync := config.ReadBool('Video', 'VSync', True);
234 gTextureFilter := config.ReadBool('Video', 'TextureFilter', True);
235 fUseMipmaps := config.ReadBool('Video', 'LegacyCompatible', False);
237 gNoSound := config.ReadBool('Sound', 'NoSound', False);
238 gSoundLevel := Min(config.ReadInt('Sound', 'SoundLevel', 75), 255);
239 gMusicLevel := Min(config.ReadInt('Sound', 'MusicLevel', 65), 255);
240 gMaxSimSounds := Max(Min(config.ReadInt('Sound', 'MaxSimSounds', 8), 66), 2);
241 gMuteWhenInactive := config.ReadBool('Sound', 'MuteInactive', False);
242 gAnnouncer := Min(Max(config.ReadInt('Sound', 'Announcer', ANNOUNCE_MEPLUS), ANNOUNCE_NONE), ANNOUNCE_ALL);
243 gSoundEffectsDF := config.ReadBool('Sound', 'SoundEffectsDF', True);
245 with gGameControls.GameControls do
246 begin
247 TakeScreenshot := config.ReadInt('GameControls', 'TakeScreenshot', 183);
248 Stat := config.ReadInt('GameControls', 'Stat', 15);
249 Chat := config.ReadInt('GameControls', 'Chat', 20);
250 TeamChat := config.ReadInt('GameControls', 'TeamChat', 21);
251 end;
253 with gGameControls.P1Control, config do
254 begin
255 KeyRight := ReadInt('Player1', 'KeyRight', 33);
256 KeyLeft := ReadInt('Player1', 'KeyLeft', 31);
257 KeyUp := ReadInt('Player1', 'KeyUp', 18);
258 KeyDown := ReadInt('Player1', 'KeyDown', 32);
259 KeyFire := ReadInt('Player1', 'KeyFire', 30);
260 KeyJump := ReadInt('Player1', 'KeyJump', 16);
261 KeyNextWeapon := ReadInt('Player1', 'KeyNextWeapon', 19);
262 KeyPrevWeapon := ReadInt('Player1', 'KeyPrevWeapon', 17);
263 KeyOpen := ReadInt('Player1', 'KeyOpen', 58);
264 end;
266 with gPlayer1Settings, config do
267 begin
268 Name := ReadStr('Player1', 'name', 'Player1');
269 Model := ReadStr('Player1', 'model', STD_PLAYER_MODEL);
270 Color.R := Min(Abs(ReadInt('Player1', 'red', PLAYER1_DEF_COLOR.R)), 255);
271 Color.G := Min(Abs(ReadInt('Player1', 'green', PLAYER1_DEF_COLOR.G)), 255);
272 Color.B := Min(Abs(ReadInt('Player1', 'blue', PLAYER1_DEF_COLOR.B)), 255);
273 Team := ReadInt('Player1', 'team', TEAM_RED);
274 if (Team < TEAM_RED) or (Team > TEAM_BLUE) then
275 Team := TEAM_RED;
276 end;
278 with gGameControls.P2Control, config do
279 begin
280 KeyRight := ReadInt('Player2', 'KeyRight', 205);
281 KeyLeft := ReadInt('Player2', 'KeyLeft', 203);
282 KeyUp := ReadInt('Player2', 'KeyUp', 200);
283 KeyDown := ReadInt('Player2', 'KeyDown', 208);
284 KeyFire := ReadInt('Player2', 'KeyFire', 184);
285 KeyJump := ReadInt('Player2', 'KeyJump', 157);
286 KeyNextWeapon := ReadInt('Player2', 'KeyNextWeapon', 73);
287 KeyPrevWeapon := ReadInt('Player2', 'KeyPrevWeapon', 71);
288 KeyOpen := ReadInt('Player2', 'KeyOpen', 54);
289 end;
291 with gPlayer2Settings, config do
292 begin
293 Name := ReadStr('Player2', 'name', 'Player2');
294 Model := ReadStr('Player2', 'model', STD_PLAYER_MODEL);
295 Color.R := Min(Abs(ReadInt('Player2', 'red', PLAYER2_DEF_COLOR.R)), 255);
296 Color.G := Min(Abs(ReadInt('Player2', 'green', PLAYER2_DEF_COLOR.G)), 255);
297 Color.B := Min(Abs(ReadInt('Player2', 'blue', PLAYER2_DEF_COLOR.B)), 255);
298 Team := ReadInt('Player2', 'team', TEAM_BLUE);
299 if (Team < TEAM_RED) or (Team > TEAM_BLUE) then
300 Team := TEAM_RED;
301 end;
303 for i := 0 to e_MaxJoys-1 do
304 e_JoystickDeadzones[i] := config.ReadInt('Joysticks', 'Deadzone' + IntToStr(i), 8192);
306 g_GFX_SetMax(Min(config.ReadInt('Game', 'MaxParticles', 1000), 50000));
307 g_Shells_SetMax(Min(config.ReadInt('Game', 'MaxShells', 300), 600));
308 g_Gibs_SetMax(Min(config.ReadInt('Game', 'MaxGibs', 150), 500));
309 g_Corpses_SetMax(Min(config.ReadInt('Game', 'MaxCorpses', 20), 100));
311 case config.ReadInt('Game', 'GibsCount', 3) of
312 0: gGibsCount := 0;
313 1: gGibsCount := 8;
314 2: gGibsCount := 16;
315 3: gGibsCount := 32;
316 else gGibsCount := 48;
317 end;
319 ITEM_RESPAWNTIME := 36*Max(config.ReadInt('Game', 'ItemRespawnTime', 60), 0);
320 gBloodCount := Min(config.ReadInt('Game', 'BloodCount', 4), 4);
321 gAdvBlood := config.ReadBool('Game', 'AdvancesBlood', True);
322 gAdvCorpses := config.ReadBool('Game', 'AdvancesCorpses', True);
323 gAdvGibs := config.ReadBool('Game', 'AdvancesGibs', True);
324 gFlash := Min(Max(config.ReadInt('Game', 'Flash', 1), 0), 2);
325 gDrawBackGround := config.ReadBool('Game', 'BackGround', True);
326 gShowMessages := config.ReadBool('Game', 'Messages', True);
327 gRevertPlayers := config.ReadBool('Game', 'RevertPlayers', False);
328 gChatBubble := Min(Max(config.ReadInt('Game', 'ChatBubble', 4), 0), 4);
330 // Ãåéìïëåé â ñâîåé èãðå
331 gcMap := config.ReadStr('GameplayCustom', 'Map', '');
332 gcGameMode := config.ReadStr('GameplayCustom', 'GameMode', _lc[I_MENU_GAME_TYPE_DM]);
333 gcTimeLimit := Min(Max(config.ReadInt('GameplayCustom', 'TimeLimit', 0), 0), 65535);
334 gcGoalLimit := Min(Max(config.ReadInt('GameplayCustom', 'GoalLimit', 0), 0), 65535);
335 gcMaxLives := Min(Max(config.ReadInt('GameplayCustom', 'MaxLives', 0), 0), 255);
336 gcPlayers := Min(Max(config.ReadInt('GameplayCustom', 'Players', 1), 0), 2);
337 gcTeamDamage := config.ReadBool('GameplayCustom', 'TeamDamage', False);
338 gcAllowExit := config.ReadBool('GameplayCustom', 'AllowExit', True);
339 gcWeaponStay := config.ReadBool('GameplayCustom', 'WeaponStay', False);
340 gcMonsters := config.ReadBool('GameplayCustom', 'Monsters', False);
341 gcBotsVS := config.ReadStr('GameplayCustom', 'BotsVS', 'Everybody');
343 with gGameSettings do
344 begin
345 GameMode := g_Game_TextToMode(gcGameMode);
346 if GameMode = GM_NONE then
347 GameMode := GM_DM;
348 if GameMode = GM_SINGLE then
349 GameMode := GM_COOP;
350 TimeLimit := gcTimeLimit;
351 GoalLimit := gcGoalLimit;
352 MaxLives := gcMaxLives;
354 Options := 0;
355 if gcTeamDamage then
356 Options := Options or GAME_OPTION_TEAMDAMAGE;
357 if gcAllowExit then
358 Options := Options or GAME_OPTION_ALLOWEXIT;
359 if gcWeaponStay then
360 Options := Options or GAME_OPTION_WEAPONSTAY;
361 if gcMonsters then
362 Options := Options or GAME_OPTION_MONSTERS;
363 if gcBotsVS = 'Everybody' then
364 Options := Options or GAME_OPTION_BOTVSPLAYER or GAME_OPTION_BOTVSMONSTER;
365 if gcBotsVS = 'Players' then
366 Options := Options or GAME_OPTION_BOTVSPLAYER;
367 if gcBotsVS = 'Monsters' then
368 Options := Options or GAME_OPTION_BOTVSMONSTER;
369 end;
371 // Ãåéìïëåé â ñåòåâîé èãðå
372 gnMap := config.ReadStr('GameplayNetwork', 'Map', '');
373 gnGameMode := config.ReadStr('GameplayNetwork', 'GameMode', _lc[I_MENU_GAME_TYPE_DM]);
374 gnTimeLimit := Min(Max(config.ReadInt('GameplayNetwork', 'TimeLimit', 0), 0), 65535);
375 gnGoalLimit := Min(Max(config.ReadInt('GameplayNetwork', 'GoalLimit', 0), 0), 65535);
376 gnMaxLives := Min(Max(config.ReadInt('GameplayNetwork', 'MaxLives', 0), 0), 255);
377 gnPlayers := Min(Max(config.ReadInt('GameplayNetwork', 'Players', 1), 0), 2);
378 gnTeamDamage := config.ReadBool('GameplayNetwork', 'TeamDamage', False);
379 gnAllowExit := config.ReadBool('GameplayNetwork', 'AllowExit', True);
380 gnWeaponStay := config.ReadBool('GameplayNetwork', 'WeaponStay', False);
381 gnMonsters := config.ReadBool('GameplayNetwork', 'Monsters', False);
382 gnBotsVS := config.ReadStr('GameplayNetwork', 'BotsVS', 'Everybody');
384 // Îáùèå ñåòåâûå
385 NetSlistIP := config.ReadStr('MasterServer', 'IP', 'mpms.doom2d.org');
386 NetSlistPort := config.ReadInt('MasterServer', 'Port', 25665);
388 // Ñåðâåð
389 NetServerName := config.ReadStr('Server', 'Name', 'Unnamed Server');
390 NetPassword := config.ReadStr('Server', 'Password', '');
391 NetPort := Min(Max(0, config.ReadInt('Server', 'Port', 25666)), 65535);
392 NetMaxClients := Min(Max(0, config.ReadInt('Server', 'MaxClients', 16)), NET_MAXCLIENTS);
393 NetAllowRCON := config.ReadBool('Server', 'RCON', False);
394 NetRCONPassword := config.ReadStr('Server', 'RCONPassword', 'default');
395 NetUseMaster := config.ReadBool('Server', 'SyncWithMaster', True);
396 NetUpdateRate := Max(0, config.ReadInt('Server', 'UpdateInterval', 0));
397 NetRelupdRate := Max(0, config.ReadInt('Server', 'ReliableUpdateInterval', 18));
398 NetMasterRate := Max(1, config.ReadInt('Server', 'MasterSyncInterval', 60000));
400 // Êëèåíò
401 NetInterpLevel := Max(0, config.ReadInt('Client', 'InterpolationSteps', 2));
402 NetForcePlayerUpdate := config.ReadBool('Client', 'ForcePlayerUpdate', False);
403 NetPredictSelf := config.ReadBool('Client', 'PredictSelf', True);
404 NetClientIP := config.ReadStr('Client', 'LastIP', '127.0.0.1');
405 NetClientPort := Max(0, config.ReadInt('Client', 'LastPort', 25666));
407 // ßçûê:
408 str := config.ReadStr('Game', 'Language', '');
409 if (str = LANGUAGE_RUSSIAN) or
410 (str = LANGUAGE_ENGLISH) then
411 begin
412 gLanguage := str;
413 gAskLanguage := False;
414 end
415 else
416 gLanguage := LANGUAGE_ENGLISH;
418 config.Free();
420 if gTextureFilter then
421 TEXTUREFILTER := GL_LINEAR
422 else
423 TEXTUREFILTER := GL_NEAREST;
424 end;
426 procedure g_Options_Write(FileName: String);
427 var
428 config: TConfig;
429 i: Integer;
430 begin
431 e_WriteLog('Writing config', MSG_NOTIFY);
433 config := TConfig.CreateFile(FileName);
435 config.WriteInt('Video', 'ScreenWidth', gScreenWidth);
436 config.WriteInt('Video', 'ScreenHeight', gScreenHeight);
437 config.WriteInt('Video', 'WinPosX', gWinRealPosX);
438 config.WriteInt('Video', 'WinPosY', gWinRealPosY);
439 config.WriteBool('Video', 'Fullscreen', gFullScreen);
440 config.WriteBool('Video', 'Maximized', gWinMaximized);
441 config.WriteInt('Video', 'BPP', gBPP);
442 config.WriteBool('Video', 'VSync', gVSync);
443 config.WriteBool('Video', 'TextureFilter', gTextureFilter);
444 config.WriteBool('Video', 'LegacyCompatible', fUseMipmaps);
446 config.WriteBool('Sound', 'NoSound', gNoSound);
447 config.WriteInt('Sound', 'SoundLevel', gSoundLevel);
448 config.WriteInt('Sound', 'MusicLevel', gMusicLevel);
449 config.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds);
450 config.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive);
451 config.WriteInt('Sound', 'Announcer', gAnnouncer);
452 config.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF);
454 with config, gGameControls.GameControls do
455 begin
456 WriteInt('GameControls', 'TakeScreenshot', TakeScreenshot);
457 WriteInt('GameControls', 'Stat', Stat);
458 WriteInt('GameControls', 'Chat', Chat);
459 WriteInt('GameControls', 'TeamChat', TeamChat);
460 end;
462 with config, gGameControls.P1Control, gPlayer1Settings do
463 begin
464 WriteInt('Player1', 'KeyRight', KeyRight);
465 WriteInt('Player1', 'KeyLeft', KeyLeft);
466 WriteInt('Player1', 'KeyUp', KeyUp);
467 WriteInt('Player1', 'KeyDown', KeyDown);
468 WriteInt('Player1', 'KeyFire', KeyFire);
469 WriteInt('Player1', 'KeyJump', KeyJump);
470 WriteInt('Player1', 'KeyNextWeapon', KeyNextWeapon);
471 WriteInt('Player1', 'KeyPrevWeapon', KeyPrevWeapon);
472 WriteInt('Player1', 'KeyOpen', KeyOpen);
474 WriteStr('Player1', 'Name', Name);
475 WriteStr('Player1', 'model', Model);
476 WriteInt('Player1', 'red', Color.R);
477 WriteInt('Player1', 'green', Color.G);
478 WriteInt('Player1', 'blue', Color.B);
479 WriteInt('Player1', 'team', Team);
480 end;
482 with config, gGameControls.P2Control, gPlayer2Settings do
483 begin
484 WriteInt('Player2', 'KeyRight', KeyRight);
485 WriteInt('Player2', 'KeyLeft', KeyLeft);
486 WriteInt('Player2', 'KeyUp', KeyUp);
487 WriteInt('Player2', 'KeyDown', KeyDown);
488 WriteInt('Player2', 'KeyFire', KeyFire);
489 WriteInt('Player2', 'KeyJump', KeyJump);
490 WriteInt('Player2', 'KeyNextWeapon', KeyNextWeapon);
491 WriteInt('Player2', 'KeyPrevWeapon', KeyPrevWeapon);
492 WriteInt('Player2', 'KeyOpen', KeyOpen);
494 WriteStr('Player2', 'Name', Name);
495 WriteStr('Player2', 'model', Model);
496 WriteInt('Player2', 'red', Color.R);
497 WriteInt('Player2', 'green', Color.G);
498 WriteInt('Player2', 'blue', Color.B);
499 WriteInt('Player2', 'team', Team);
500 end;
502 for i := 0 to e_MaxJoys-1 do
503 config.WriteInt('Joysticks', 'Deadzone' + IntToStr(i), e_JoystickDeadzones[i]);
505 with config do
506 case gGibsCount of
507 0: config.WriteInt('Game', 'GibsCount', 0);
508 8: config.WriteInt('Game', 'GibsCount', 1);
509 16: config.WriteInt('Game', 'GibsCount', 2);
510 32: config.WriteInt('Game', 'GibsCount', 3);
511 else config.WriteInt('Game', 'GibsCount', 4);
512 end;
514 config.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME div 36);
515 config.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
516 config.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
517 config.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
518 config.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
519 config.WriteInt('Game', 'BloodCount', gBloodCount);
520 config.WriteBool('Game', 'AdvancesBlood', gAdvBlood);
521 config.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses);
522 config.WriteBool('Game', 'AdvancesGibs', gAdvGibs);
523 config.WriteInt('Game', 'Flash', gFlash);
524 config.WriteBool('Game', 'BackGround', gDrawBackGround);
525 config.WriteBool('Game', 'Messages', gShowMessages);
526 config.WriteBool('Game', 'RevertPlayers', gRevertPlayers);
527 config.WriteInt('Game', 'ChatBubble', gChatBubble);
529 config.WriteStr ('GameplayCustom', 'Map', gcMap);
530 config.WriteStr ('GameplayCustom', 'GameMode', gcGameMode);
531 config.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit);
532 config.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit);
533 config.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives);
534 config.WriteInt ('GameplayCustom', 'Players', gcPlayers);
535 config.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage);
536 config.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit);
537 config.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay);
538 config.WriteBool('GameplayCustom', 'Monsters', gcMonsters);
539 config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS);
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);
553 config.WriteStr('MasterServer', 'IP', NetSlistIP);
554 config.WriteInt('MasterServer', 'Port', NetSlistPort);
556 config.WriteStr ('Server', 'Name', NetServerName);
557 config.WriteStr ('Server', 'Password', NetPassword);
558 config.WriteInt ('Server', 'Port', NetPort);
559 config.WriteInt ('Server', 'MaxClients', NetMaxClients);
560 config.WriteBool('Server', 'RCON', NetAllowRCON);
561 config.WriteStr ('Server', 'RCONPassword', NetRCONPassword);
562 config.WriteBool('Server', 'SyncWithMaster', NetUseMaster);
563 config.WriteInt ('Server', 'UpdateInterval', NetUpdateRate);
564 config.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate);
565 config.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate);
567 config.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel);
568 config.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate);
569 config.WriteBool ('Client', 'PredictSelf', NetPredictSelf);
570 config.WriteStr ('Client', 'LastIP', NetClientIP);
571 config.WriteInt ('Client', 'LastPort', NetClientPort);
573 config.SaveFile(FileName);
574 config.Free();
575 end;
577 procedure g_Options_Write_Language(FileName: String);
578 var
579 config: TConfig;
580 begin
581 e_WriteLog('Writing language config', MSG_NOTIFY);
583 config := TConfig.CreateFile(FileName);
584 config.WriteStr('Game', 'Language', gLanguage);
585 config.SaveFile(FileName);
586 config.Free();
587 end;
589 procedure g_Options_Write_Video(FileName: String);
590 var
591 config: TConfig;
592 sW, sH: Integer;
593 begin
594 e_WriteLog('Writing resolution to config', MSG_NOTIFY);
596 config := TConfig.CreateFile(FileName);
598 if gWinMaximized and (not gFullscreen) then
599 begin
600 sW := gWinSizeX;
601 sH := gWinSizeY;
602 end
603 else
604 begin
605 sW := gScreenWidth;
606 sH := gScreenHeight;
607 end;
609 config.WriteInt('Video', 'ScreenWidth', sW);
610 config.WriteInt('Video', 'ScreenHeight', sH);
611 config.WriteInt('Video', 'WinPosX', gWinRealPosX);
612 config.WriteInt('Video', 'WinPosY', gWinRealPosY);
613 config.WriteBool('Video', 'Fullscreen', gFullscreen);
614 config.WriteBool('Video', 'Maximized', gWinMaximized);
616 config.SaveFile(FileName);
617 config.Free();
618 end;
620 procedure g_Options_Write_Gameplay_Custom(FileName: String);
621 var
622 config: TConfig;
623 begin
624 e_WriteLog('Writing custom gameplay config', MSG_NOTIFY);
626 config := TConfig.CreateFile(FileName);
628 config.WriteStr ('GameplayCustom', 'Map', gcMap);
629 config.WriteStr ('GameplayCustom', 'GameMode', gcGameMode);
630 config.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit);
631 config.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit);
632 config.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives);
633 config.WriteInt ('GameplayCustom', 'Players', gcPlayers);
634 config.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage);
635 config.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit);
636 config.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay);
637 config.WriteBool('GameplayCustom', 'Monsters', gcMonsters);
638 config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS);
640 config.SaveFile(FileName);
641 config.Free();
642 end;
644 procedure g_Options_Write_Gameplay_Net(FileName: String);
645 var
646 config: TConfig;
647 begin
648 e_WriteLog('Writing network gameplay config', MSG_NOTIFY);
650 config := TConfig.CreateFile(FileName);
652 config.WriteStr ('GameplayNetwork', 'Map', gnMap);
653 config.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode);
654 config.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit);
655 config.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit);
656 config.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives);
657 config.WriteInt ('GameplayNetwork', 'Players', gnPlayers);
658 config.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage);
659 config.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit);
660 config.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay);
661 config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters);
662 config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS);
664 config.SaveFile(FileName);
665 config.Free();
666 end;
668 procedure g_Options_Write_Net_Server(FileName: String);
669 var
670 config: TConfig;
671 begin
672 e_WriteLog('Writing server config', MSG_NOTIFY);
674 config := TConfig.CreateFile(FileName);
676 config.WriteStr ('Server', 'Name', NetServerName);
677 config.WriteStr ('Server', 'Password', NetPassword);
678 config.WriteInt ('Server', 'Port', NetPort);
679 config.WriteInt ('Server', 'MaxClients', NetMaxClients);
680 config.WriteBool('Server', 'SyncWithMaster', NetUseMaster);
682 config.SaveFile(FileName);
683 config.Free();
684 end;
686 procedure g_Options_Write_Net_Client(FileName: String);
687 var
688 config: TConfig;
689 begin
690 e_WriteLog('Writing client config', MSG_NOTIFY);
692 config := TConfig.CreateFile(FileName);
694 config.WriteStr('Client', 'LastIP', NetClientIP);
695 config.WriteInt('Client', 'LastPort', NetClientPort);
697 config.SaveFile(FileName);
698 config.Free();
699 end;
701 end.