DEADSOFTWARE

NPOT *REALLY* fixed this time; also, added menu option
[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 glLegacyNPOT: Boolean = False;
56 gTextureFilter: Boolean = True;
57 gNoSound: Boolean = False;
58 gSoundLevel: Byte = 75;
59 gMusicLevel: Byte = 65;
60 gMaxSimSounds: Byte = 8;
61 gMuteWhenInactive: Boolean = False;
62 gAdvCorpses: Boolean = True;
63 gAdvBlood: Boolean = True;
64 gAdvGibs: Boolean = True;
65 gGibsCount: Integer = 32;
66 gBloodCount: Byte = 3;
67 gFlash: Byte = 1;
68 gDrawBackGround: Boolean = True;
69 gShowMessages: Boolean = True;
70 gRevertPlayers: Boolean = False;
71 gLanguage: String = LANGUAGE_ENGLISH;
72 gAskLanguage: Boolean = True;
73 gcMap: String = '';
74 gcGameMode: String = '';
75 gcTimeLimit: Word = 0;
76 gcGoalLimit: Word = 0;
77 gcMaxLives: Byte = 0;
78 gcPlayers: Byte = 1;
79 gcTeamDamage: Boolean = False;
80 gcAllowExit: Boolean = True;
81 gcWeaponStay: Boolean = False;
82 gcMonsters: Boolean = False;
83 gcBotsVS: String = 'Everybody';
84 gnMap: String = '';
85 gnGameMode: String = '';
86 gnTimeLimit: Word = 0;
87 gnGoalLimit: Word = 0;
88 gnMaxLives: Byte = 0;
89 gnPlayers: Byte = 1;
90 gnTeamDamage: Boolean = False;
91 gnAllowExit: Boolean = True;
92 gnWeaponStay: Boolean = False;
93 gnMonsters: Boolean = False;
94 gnBotsVS: String = 'Everybody';
96 implementation
98 uses
99 e_log, e_input, g_window, g_sound, g_gfx, g_player, Math,
100 g_map, g_net, g_netmaster, SysUtils, CONFIG, g_game, g_main, e_textures,
101 g_items, GL, GLExt;
103 procedure g_Options_SetDefault();
104 var
105 i: Integer;
106 begin
107 g_Sound_SetupAllVolumes(75, 65);
108 gMaxSimSounds := 8;
109 gMuteWhenInactive := False;
110 gAnnouncer := ANNOUNCE_MEPLUS;
111 gSoundEffectsDF := True;
112 g_GFX_SetMax(2000);
113 g_Gibs_SetMax(150);
114 g_Corpses_SetMax(20);
115 g_Shells_SetMax(300);
116 gGibsCount := 32;
117 gBloodCount := 3;
118 gAdvBlood := True;
119 gAdvCorpses := True;
120 gAdvGibs := True;
121 gFlash := 1;
122 gDrawBackGround := True;
123 gShowMessages := True;
124 gRevertPlayers := False;
126 for i := 0 to e_MaxJoys-1 do
127 e_JoystickDeadzones[i] := 8192;
129 with gGameControls.GameControls do
130 begin
131 TakeScreenshot := 183;
132 Stat := 15;
133 Chat := 20; // [T]
134 TeamChat := 21; // [Y]
135 end;
137 with gGameControls.P1Control do
138 begin
139 KeyRight := 77;
140 KeyLeft := 75;
141 KeyUp := 72;
142 KeyDown := 76;
143 KeyFire := 184;
144 KeyJump := 157;
145 KeyNextWeapon := 73;
146 KeyPrevWeapon := 71;
147 KeyOpen := 54;
148 end;
150 with gGameControls.P2Control do
151 begin
152 KeyRight := 33;
153 KeyLeft := 31;
154 KeyUp := 18;
155 KeyDown := 32;
156 KeyFire := 30;
157 KeyJump := 16;
158 KeyNextWeapon := 19;
159 KeyPrevWeapon := 17;
160 KeyOpen := 58;
161 end;
163 with gPlayer1Settings do
164 begin
165 Name := 'Player1';
166 Model := STD_PLAYER_MODEL;
167 Color.R := PLAYER1_DEF_COLOR.R;
168 Color.G := PLAYER1_DEF_COLOR.G;
169 Color.B := PLAYER1_DEF_COLOR.B;
170 Team := TEAM_RED;
171 end;
173 with gPlayer2Settings do
174 begin
175 Name := 'Player2';
176 Model := STD_PLAYER_MODEL;
177 Color.R := PLAYER2_DEF_COLOR.R;
178 Color.G := PLAYER2_DEF_COLOR.G;
179 Color.B := PLAYER2_DEF_COLOR.B;
180 Team := TEAM_BLUE;
181 end;
183 NetUseMaster := True;
184 g_Net_Slist_Set('mpms.doom2d.org', 25665);
185 end;
187 procedure g_Options_Read(FileName: String);
188 var
189 config: TConfig;
190 str: String;
191 i: Integer;
192 begin
193 gAskLanguage := True;
194 e_WriteLog('Reading config', MSG_NOTIFY);
196 if not FileExists(FileName) then
197 begin
198 e_WriteLog('Config file '+FileName+' not found', MSG_WARNING);
199 g_Options_SetDefault();
201 // Default video options:
202 gScreenWidth := 800;
203 gScreenHeight := 600;
204 gWinRealPosX := 0;
205 gWinRealPosY := 0;
206 gWinMaximized := False;
207 gFullScreen := False;
208 gBPP := 32;
209 gVSync := False;
210 gTextureFilter := True;
211 glLegacyNPOT := False;
213 Exit;
214 end;
216 config := TConfig.CreateFile(FileName);
218 gScreenWidth := config.ReadInt('Video', 'ScreenWidth', 800);
219 if gScreenWidth < 640 then
220 gScreenWidth := 640;
221 gScreenHeight := config.ReadInt('Video', 'ScreenHeight', 600);
222 if gScreenHeight < 480 then
223 gScreenHeight := 480;
224 gWinRealPosX := config.ReadInt('Video', 'WinPosX', 0);
225 if gWinRealPosX < 0 then
226 gWinRealPosX := 0;
227 gWinRealPosY := config.ReadInt('Video', 'WinPosY', 0);
228 if gWinRealPosY < 0 then
229 gWinRealPosY := 0;
230 gFullScreen := config.ReadBool('Video', 'Fullscreen', False);
231 gWinMaximized := config.ReadBool('Video', 'Maximized', False);
232 gBPP := config.ReadInt('Video', 'BPP', 32);
233 gFreq := config.ReadInt('Video', 'Freq', 0);
234 gVSync := config.ReadBool('Video', 'VSync', True);
235 gTextureFilter := config.ReadBool('Video', 'TextureFilter', True);
236 glLegacyNPOT := config.ReadBool('Video', 'LegacyCompatible', False);
238 gNoSound := config.ReadBool('Sound', 'NoSound', False);
239 gSoundLevel := Min(config.ReadInt('Sound', 'SoundLevel', 75), 255);
240 gMusicLevel := Min(config.ReadInt('Sound', 'MusicLevel', 65), 255);
241 gMaxSimSounds := Max(Min(config.ReadInt('Sound', 'MaxSimSounds', 8), 66), 2);
242 gMuteWhenInactive := config.ReadBool('Sound', 'MuteInactive', False);
243 gAnnouncer := Min(Max(config.ReadInt('Sound', 'Announcer', ANNOUNCE_MEPLUS), ANNOUNCE_NONE), ANNOUNCE_ALL);
244 gSoundEffectsDF := config.ReadBool('Sound', 'SoundEffectsDF', True);
246 with gGameControls.GameControls do
247 begin
248 TakeScreenshot := config.ReadInt('GameControls', 'TakeScreenshot', 183);
249 Stat := config.ReadInt('GameControls', 'Stat', 15);
250 Chat := config.ReadInt('GameControls', 'Chat', 20);
251 TeamChat := config.ReadInt('GameControls', 'TeamChat', 21);
252 end;
254 with gGameControls.P1Control, config do
255 begin
256 KeyRight := ReadInt('Player1', 'KeyRight', 33);
257 KeyLeft := ReadInt('Player1', 'KeyLeft', 31);
258 KeyUp := ReadInt('Player1', 'KeyUp', 18);
259 KeyDown := ReadInt('Player1', 'KeyDown', 32);
260 KeyFire := ReadInt('Player1', 'KeyFire', 30);
261 KeyJump := ReadInt('Player1', 'KeyJump', 16);
262 KeyNextWeapon := ReadInt('Player1', 'KeyNextWeapon', 19);
263 KeyPrevWeapon := ReadInt('Player1', 'KeyPrevWeapon', 17);
264 KeyOpen := ReadInt('Player1', 'KeyOpen', 58);
265 end;
267 with gPlayer1Settings, config do
268 begin
269 Name := ReadStr('Player1', 'name', 'Player1');
270 Model := ReadStr('Player1', 'model', STD_PLAYER_MODEL);
271 Color.R := Min(Abs(ReadInt('Player1', 'red', PLAYER1_DEF_COLOR.R)), 255);
272 Color.G := Min(Abs(ReadInt('Player1', 'green', PLAYER1_DEF_COLOR.G)), 255);
273 Color.B := Min(Abs(ReadInt('Player1', 'blue', PLAYER1_DEF_COLOR.B)), 255);
274 Team := ReadInt('Player1', 'team', TEAM_RED);
275 if (Team < TEAM_RED) or (Team > TEAM_BLUE) then
276 Team := TEAM_RED;
277 end;
279 with gGameControls.P2Control, config do
280 begin
281 KeyRight := ReadInt('Player2', 'KeyRight', 205);
282 KeyLeft := ReadInt('Player2', 'KeyLeft', 203);
283 KeyUp := ReadInt('Player2', 'KeyUp', 200);
284 KeyDown := ReadInt('Player2', 'KeyDown', 208);
285 KeyFire := ReadInt('Player2', 'KeyFire', 184);
286 KeyJump := ReadInt('Player2', 'KeyJump', 157);
287 KeyNextWeapon := ReadInt('Player2', 'KeyNextWeapon', 73);
288 KeyPrevWeapon := ReadInt('Player2', 'KeyPrevWeapon', 71);
289 KeyOpen := ReadInt('Player2', 'KeyOpen', 54);
290 end;
292 with gPlayer2Settings, config do
293 begin
294 Name := ReadStr('Player2', 'name', 'Player2');
295 Model := ReadStr('Player2', 'model', STD_PLAYER_MODEL);
296 Color.R := Min(Abs(ReadInt('Player2', 'red', PLAYER2_DEF_COLOR.R)), 255);
297 Color.G := Min(Abs(ReadInt('Player2', 'green', PLAYER2_DEF_COLOR.G)), 255);
298 Color.B := Min(Abs(ReadInt('Player2', 'blue', PLAYER2_DEF_COLOR.B)), 255);
299 Team := ReadInt('Player2', 'team', TEAM_BLUE);
300 if (Team < TEAM_RED) or (Team > TEAM_BLUE) then
301 Team := TEAM_RED;
302 end;
304 for i := 0 to e_MaxJoys-1 do
305 e_JoystickDeadzones[i] := config.ReadInt('Joysticks', 'Deadzone' + IntToStr(i), 8192);
307 g_GFX_SetMax(Min(config.ReadInt('Game', 'MaxParticles', 1000), 50000));
308 g_Shells_SetMax(Min(config.ReadInt('Game', 'MaxShells', 300), 600));
309 g_Gibs_SetMax(Min(config.ReadInt('Game', 'MaxGibs', 150), 500));
310 g_Corpses_SetMax(Min(config.ReadInt('Game', 'MaxCorpses', 20), 100));
312 case config.ReadInt('Game', 'GibsCount', 3) of
313 0: gGibsCount := 0;
314 1: gGibsCount := 8;
315 2: gGibsCount := 16;
316 3: gGibsCount := 32;
317 else gGibsCount := 48;
318 end;
320 ITEM_RESPAWNTIME := 36*Max(config.ReadInt('Game', 'ItemRespawnTime', 60), 0);
321 gBloodCount := Min(config.ReadInt('Game', 'BloodCount', 4), 4);
322 gAdvBlood := config.ReadBool('Game', 'AdvancesBlood', True);
323 gAdvCorpses := config.ReadBool('Game', 'AdvancesCorpses', True);
324 gAdvGibs := config.ReadBool('Game', 'AdvancesGibs', True);
325 gFlash := Min(Max(config.ReadInt('Game', 'Flash', 1), 0), 2);
326 gDrawBackGround := config.ReadBool('Game', 'BackGround', True);
327 gShowMessages := config.ReadBool('Game', 'Messages', True);
328 gRevertPlayers := config.ReadBool('Game', 'RevertPlayers', False);
329 gChatBubble := Min(Max(config.ReadInt('Game', 'ChatBubble', 4), 0), 4);
331 // Ãåéìïëåé â ñâîåé èãðå
332 gcMap := config.ReadStr('GameplayCustom', 'Map', '');
333 gcGameMode := config.ReadStr('GameplayCustom', 'GameMode', _lc[I_MENU_GAME_TYPE_DM]);
334 gcTimeLimit := Min(Max(config.ReadInt('GameplayCustom', 'TimeLimit', 0), 0), 65535);
335 gcGoalLimit := Min(Max(config.ReadInt('GameplayCustom', 'GoalLimit', 0), 0), 65535);
336 gcMaxLives := Min(Max(config.ReadInt('GameplayCustom', 'MaxLives', 0), 0), 255);
337 gcPlayers := Min(Max(config.ReadInt('GameplayCustom', 'Players', 1), 0), 2);
338 gcTeamDamage := config.ReadBool('GameplayCustom', 'TeamDamage', False);
339 gcAllowExit := config.ReadBool('GameplayCustom', 'AllowExit', True);
340 gcWeaponStay := config.ReadBool('GameplayCustom', 'WeaponStay', False);
341 gcMonsters := config.ReadBool('GameplayCustom', 'Monsters', False);
342 gcBotsVS := config.ReadStr('GameplayCustom', 'BotsVS', 'Everybody');
344 with gGameSettings do
345 begin
346 GameMode := g_Game_TextToMode(gcGameMode);
347 if GameMode = GM_NONE then
348 GameMode := GM_DM;
349 if GameMode = GM_SINGLE then
350 GameMode := GM_COOP;
351 TimeLimit := gcTimeLimit;
352 GoalLimit := gcGoalLimit;
353 MaxLives := gcMaxLives;
355 Options := 0;
356 if gcTeamDamage then
357 Options := Options or GAME_OPTION_TEAMDAMAGE;
358 if gcAllowExit then
359 Options := Options or GAME_OPTION_ALLOWEXIT;
360 if gcWeaponStay then
361 Options := Options or GAME_OPTION_WEAPONSTAY;
362 if gcMonsters then
363 Options := Options or GAME_OPTION_MONSTERS;
364 if gcBotsVS = 'Everybody' then
365 Options := Options or GAME_OPTION_BOTVSPLAYER or GAME_OPTION_BOTVSMONSTER;
366 if gcBotsVS = 'Players' then
367 Options := Options or GAME_OPTION_BOTVSPLAYER;
368 if gcBotsVS = 'Monsters' then
369 Options := Options or GAME_OPTION_BOTVSMONSTER;
370 end;
372 // Ãåéìïëåé â ñåòåâîé èãðå
373 gnMap := config.ReadStr('GameplayNetwork', 'Map', '');
374 gnGameMode := config.ReadStr('GameplayNetwork', 'GameMode', _lc[I_MENU_GAME_TYPE_DM]);
375 gnTimeLimit := Min(Max(config.ReadInt('GameplayNetwork', 'TimeLimit', 0), 0), 65535);
376 gnGoalLimit := Min(Max(config.ReadInt('GameplayNetwork', 'GoalLimit', 0), 0), 65535);
377 gnMaxLives := Min(Max(config.ReadInt('GameplayNetwork', 'MaxLives', 0), 0), 255);
378 gnPlayers := Min(Max(config.ReadInt('GameplayNetwork', 'Players', 1), 0), 2);
379 gnTeamDamage := config.ReadBool('GameplayNetwork', 'TeamDamage', False);
380 gnAllowExit := config.ReadBool('GameplayNetwork', 'AllowExit', True);
381 gnWeaponStay := config.ReadBool('GameplayNetwork', 'WeaponStay', False);
382 gnMonsters := config.ReadBool('GameplayNetwork', 'Monsters', False);
383 gnBotsVS := config.ReadStr('GameplayNetwork', 'BotsVS', 'Everybody');
385 // Îáùèå ñåòåâûå
386 NetSlistIP := config.ReadStr('MasterServer', 'IP', 'mpms.doom2d.org');
387 NetSlistPort := config.ReadInt('MasterServer', 'Port', 25665);
389 // Ñåðâåð
390 NetServerName := config.ReadStr('Server', 'Name', 'Unnamed Server');
391 NetPassword := config.ReadStr('Server', 'Password', '');
392 NetPort := Min(Max(0, config.ReadInt('Server', 'Port', 25666)), 65535);
393 NetMaxClients := Min(Max(0, config.ReadInt('Server', 'MaxClients', 16)), NET_MAXCLIENTS);
394 NetAllowRCON := config.ReadBool('Server', 'RCON', False);
395 NetRCONPassword := config.ReadStr('Server', 'RCONPassword', 'default');
396 NetUseMaster := config.ReadBool('Server', 'SyncWithMaster', True);
397 NetUpdateRate := Max(0, config.ReadInt('Server', 'UpdateInterval', 0));
398 NetRelupdRate := Max(0, config.ReadInt('Server', 'ReliableUpdateInterval', 18));
399 NetMasterRate := Max(1, config.ReadInt('Server', 'MasterSyncInterval', 60000));
401 // Êëèåíò
402 NetInterpLevel := Max(0, config.ReadInt('Client', 'InterpolationSteps', 2));
403 NetForcePlayerUpdate := config.ReadBool('Client', 'ForcePlayerUpdate', False);
404 NetPredictSelf := config.ReadBool('Client', 'PredictSelf', True);
405 NetClientIP := config.ReadStr('Client', 'LastIP', '127.0.0.1');
406 NetClientPort := Max(0, config.ReadInt('Client', 'LastPort', 25666));
408 // ßçûê:
409 str := config.ReadStr('Game', 'Language', '');
410 if (str = LANGUAGE_RUSSIAN) or
411 (str = LANGUAGE_ENGLISH) then
412 begin
413 gLanguage := str;
414 gAskLanguage := False;
415 end
416 else
417 gLanguage := LANGUAGE_ENGLISH;
419 config.Free();
421 if gTextureFilter then
422 TEXTUREFILTER := GL_LINEAR
423 else
424 TEXTUREFILTER := GL_NEAREST;
425 end;
427 procedure g_Options_Write(FileName: String);
428 var
429 config: TConfig;
430 i: Integer;
431 begin
432 e_WriteLog('Writing config', MSG_NOTIFY);
434 config := TConfig.CreateFile(FileName);
436 config.WriteInt('Video', 'ScreenWidth', gScreenWidth);
437 config.WriteInt('Video', 'ScreenHeight', gScreenHeight);
438 config.WriteInt('Video', 'WinPosX', gWinRealPosX);
439 config.WriteInt('Video', 'WinPosY', gWinRealPosY);
440 config.WriteBool('Video', 'Fullscreen', gFullScreen);
441 config.WriteBool('Video', 'Maximized', gWinMaximized);
442 config.WriteInt('Video', 'BPP', gBPP);
443 config.WriteBool('Video', 'VSync', gVSync);
444 config.WriteBool('Video', 'TextureFilter', gTextureFilter);
445 config.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT);
447 config.WriteBool('Sound', 'NoSound', gNoSound);
448 config.WriteInt('Sound', 'SoundLevel', gSoundLevel);
449 config.WriteInt('Sound', 'MusicLevel', gMusicLevel);
450 config.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds);
451 config.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive);
452 config.WriteInt('Sound', 'Announcer', gAnnouncer);
453 config.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF);
455 with config, gGameControls.GameControls do
456 begin
457 WriteInt('GameControls', 'TakeScreenshot', TakeScreenshot);
458 WriteInt('GameControls', 'Stat', Stat);
459 WriteInt('GameControls', 'Chat', Chat);
460 WriteInt('GameControls', 'TeamChat', TeamChat);
461 end;
463 with config, gGameControls.P1Control, gPlayer1Settings do
464 begin
465 WriteInt('Player1', 'KeyRight', KeyRight);
466 WriteInt('Player1', 'KeyLeft', KeyLeft);
467 WriteInt('Player1', 'KeyUp', KeyUp);
468 WriteInt('Player1', 'KeyDown', KeyDown);
469 WriteInt('Player1', 'KeyFire', KeyFire);
470 WriteInt('Player1', 'KeyJump', KeyJump);
471 WriteInt('Player1', 'KeyNextWeapon', KeyNextWeapon);
472 WriteInt('Player1', 'KeyPrevWeapon', KeyPrevWeapon);
473 WriteInt('Player1', 'KeyOpen', KeyOpen);
475 WriteStr('Player1', 'Name', Name);
476 WriteStr('Player1', 'model', Model);
477 WriteInt('Player1', 'red', Color.R);
478 WriteInt('Player1', 'green', Color.G);
479 WriteInt('Player1', 'blue', Color.B);
480 WriteInt('Player1', 'team', Team);
481 end;
483 with config, gGameControls.P2Control, gPlayer2Settings do
484 begin
485 WriteInt('Player2', 'KeyRight', KeyRight);
486 WriteInt('Player2', 'KeyLeft', KeyLeft);
487 WriteInt('Player2', 'KeyUp', KeyUp);
488 WriteInt('Player2', 'KeyDown', KeyDown);
489 WriteInt('Player2', 'KeyFire', KeyFire);
490 WriteInt('Player2', 'KeyJump', KeyJump);
491 WriteInt('Player2', 'KeyNextWeapon', KeyNextWeapon);
492 WriteInt('Player2', 'KeyPrevWeapon', KeyPrevWeapon);
493 WriteInt('Player2', 'KeyOpen', KeyOpen);
495 WriteStr('Player2', 'Name', Name);
496 WriteStr('Player2', 'model', Model);
497 WriteInt('Player2', 'red', Color.R);
498 WriteInt('Player2', 'green', Color.G);
499 WriteInt('Player2', 'blue', Color.B);
500 WriteInt('Player2', 'team', Team);
501 end;
503 for i := 0 to e_MaxJoys-1 do
504 config.WriteInt('Joysticks', 'Deadzone' + IntToStr(i), e_JoystickDeadzones[i]);
506 with config do
507 case gGibsCount of
508 0: config.WriteInt('Game', 'GibsCount', 0);
509 8: config.WriteInt('Game', 'GibsCount', 1);
510 16: config.WriteInt('Game', 'GibsCount', 2);
511 32: config.WriteInt('Game', 'GibsCount', 3);
512 else config.WriteInt('Game', 'GibsCount', 4);
513 end;
515 config.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME div 36);
516 config.WriteInt('Game', 'MaxParticles', g_GFX_GetMax());
517 config.WriteInt('Game', 'MaxShells', g_Shells_GetMax());
518 config.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax());
519 config.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax());
520 config.WriteInt('Game', 'BloodCount', gBloodCount);
521 config.WriteBool('Game', 'AdvancesBlood', gAdvBlood);
522 config.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses);
523 config.WriteBool('Game', 'AdvancesGibs', gAdvGibs);
524 config.WriteInt('Game', 'Flash', gFlash);
525 config.WriteBool('Game', 'BackGround', gDrawBackGround);
526 config.WriteBool('Game', 'Messages', gShowMessages);
527 config.WriteBool('Game', 'RevertPlayers', gRevertPlayers);
528 config.WriteInt('Game', 'ChatBubble', gChatBubble);
530 config.WriteStr ('GameplayCustom', 'Map', gcMap);
531 config.WriteStr ('GameplayCustom', 'GameMode', gcGameMode);
532 config.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit);
533 config.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit);
534 config.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives);
535 config.WriteInt ('GameplayCustom', 'Players', gcPlayers);
536 config.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage);
537 config.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit);
538 config.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay);
539 config.WriteBool('GameplayCustom', 'Monsters', gcMonsters);
540 config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS);
542 config.WriteStr ('GameplayNetwork', 'Map', gnMap);
543 config.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode);
544 config.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit);
545 config.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit);
546 config.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives);
547 config.WriteInt ('GameplayNetwork', 'Players', gnPlayers);
548 config.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage);
549 config.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit);
550 config.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay);
551 config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters);
552 config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS);
554 config.WriteStr('MasterServer', 'IP', NetSlistIP);
555 config.WriteInt('MasterServer', 'Port', NetSlistPort);
557 config.WriteStr ('Server', 'Name', NetServerName);
558 config.WriteStr ('Server', 'Password', NetPassword);
559 config.WriteInt ('Server', 'Port', NetPort);
560 config.WriteInt ('Server', 'MaxClients', NetMaxClients);
561 config.WriteBool('Server', 'RCON', NetAllowRCON);
562 config.WriteStr ('Server', 'RCONPassword', NetRCONPassword);
563 config.WriteBool('Server', 'SyncWithMaster', NetUseMaster);
564 config.WriteInt ('Server', 'UpdateInterval', NetUpdateRate);
565 config.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate);
566 config.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate);
568 config.WriteInt ('Client', 'InterpolationSteps', NetInterpLevel);
569 config.WriteBool ('Client', 'ForcePlayerUpdate', NetForcePlayerUpdate);
570 config.WriteBool ('Client', 'PredictSelf', NetPredictSelf);
571 config.WriteStr ('Client', 'LastIP', NetClientIP);
572 config.WriteInt ('Client', 'LastPort', NetClientPort);
574 config.SaveFile(FileName);
575 config.Free();
576 end;
578 procedure g_Options_Write_Language(FileName: String);
579 var
580 config: TConfig;
581 begin
582 e_WriteLog('Writing language config', MSG_NOTIFY);
584 config := TConfig.CreateFile(FileName);
585 config.WriteStr('Game', 'Language', gLanguage);
586 config.SaveFile(FileName);
587 config.Free();
588 end;
590 procedure g_Options_Write_Video(FileName: String);
591 var
592 config: TConfig;
593 sW, sH: Integer;
594 begin
595 e_WriteLog('Writing resolution to config', MSG_NOTIFY);
597 config := TConfig.CreateFile(FileName);
599 if gWinMaximized and (not gFullscreen) then
600 begin
601 sW := gWinSizeX;
602 sH := gWinSizeY;
603 end
604 else
605 begin
606 sW := gScreenWidth;
607 sH := gScreenHeight;
608 end;
610 config.WriteInt('Video', 'ScreenWidth', sW);
611 config.WriteInt('Video', 'ScreenHeight', sH);
612 config.WriteInt('Video', 'WinPosX', gWinRealPosX);
613 config.WriteInt('Video', 'WinPosY', gWinRealPosY);
614 config.WriteBool('Video', 'Fullscreen', gFullscreen);
615 config.WriteBool('Video', 'Maximized', gWinMaximized);
617 config.SaveFile(FileName);
618 config.Free();
619 end;
621 procedure g_Options_Write_Gameplay_Custom(FileName: String);
622 var
623 config: TConfig;
624 begin
625 e_WriteLog('Writing custom gameplay config', MSG_NOTIFY);
627 config := TConfig.CreateFile(FileName);
629 config.WriteStr ('GameplayCustom', 'Map', gcMap);
630 config.WriteStr ('GameplayCustom', 'GameMode', gcGameMode);
631 config.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit);
632 config.WriteInt ('GameplayCustom', 'GoalLimit', gcGoalLimit);
633 config.WriteInt ('GameplayCustom', 'MaxLives', gcMaxLives);
634 config.WriteInt ('GameplayCustom', 'Players', gcPlayers);
635 config.WriteBool('GameplayCustom', 'TeamDamage', gcTeamDamage);
636 config.WriteBool('GameplayCustom', 'AllowExit', gcAllowExit);
637 config.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay);
638 config.WriteBool('GameplayCustom', 'Monsters', gcMonsters);
639 config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS);
641 config.SaveFile(FileName);
642 config.Free();
643 end;
645 procedure g_Options_Write_Gameplay_Net(FileName: String);
646 var
647 config: TConfig;
648 begin
649 e_WriteLog('Writing network gameplay config', MSG_NOTIFY);
651 config := TConfig.CreateFile(FileName);
653 config.WriteStr ('GameplayNetwork', 'Map', gnMap);
654 config.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode);
655 config.WriteInt ('GameplayNetwork', 'TimeLimit', gnTimeLimit);
656 config.WriteInt ('GameplayNetwork', 'GoalLimit', gnGoalLimit);
657 config.WriteInt ('GameplayNetwork', 'MaxLives', gnMaxLives);
658 config.WriteInt ('GameplayNetwork', 'Players', gnPlayers);
659 config.WriteBool('GameplayNetwork', 'TeamDamage', gnTeamDamage);
660 config.WriteBool('GameplayNetwork', 'AllowExit', gnAllowExit);
661 config.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay);
662 config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters);
663 config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS);
665 config.SaveFile(FileName);
666 config.Free();
667 end;
669 procedure g_Options_Write_Net_Server(FileName: String);
670 var
671 config: TConfig;
672 begin
673 e_WriteLog('Writing server config', MSG_NOTIFY);
675 config := TConfig.CreateFile(FileName);
677 config.WriteStr ('Server', 'Name', NetServerName);
678 config.WriteStr ('Server', 'Password', NetPassword);
679 config.WriteInt ('Server', 'Port', NetPort);
680 config.WriteInt ('Server', 'MaxClients', NetMaxClients);
681 config.WriteBool('Server', 'SyncWithMaster', NetUseMaster);
683 config.SaveFile(FileName);
684 config.Free();
685 end;
687 procedure g_Options_Write_Net_Client(FileName: String);
688 var
689 config: TConfig;
690 begin
691 e_WriteLog('Writing client config', MSG_NOTIFY);
693 config := TConfig.CreateFile(FileName);
695 config.WriteStr('Client', 'LastIP', NetClientIP);
696 config.WriteInt('Client', 'LastPort', NetClientPort);
698 config.SaveFile(FileName);
699 config.Free();
700 end;
702 end.