diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index 506fc186424753429b21151925830bb1a0b6376d..41f0e69ffa8633d35f53b3540e61bce94b167838 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, version 3 of the License ONLY.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
interface
uses
interface
uses
- g_language, g_weapons;
-
-type
- TPlayerControl = record
- KeyRight: Word;
- KeyLeft: Word;
- KeyUp: Word;
- KeyDown: Word;
- KeyFire: Word;
- KeyJump: Word;
- KeyNextWeapon: Word;
- KeyPrevWeapon: Word;
- KeyOpen: Word;
- KeyStrafe: Word;
- KeyWeapon: array [WP_FIRST..WP_LAST] of Word;
-
- KeyRight2: Word;
- KeyLeft2: Word;
- KeyUp2: Word;
- KeyDown2: Word;
- KeyFire2: Word;
- KeyJump2: Word;
- KeyNextWeapon2: Word;
- KeyPrevWeapon2: Word;
- KeyOpen2: Word;
- KeyStrafe2: Word;
- KeyWeapon2: array [WP_FIRST..WP_LAST] of Word;
- end;
-
- TGameControls = record
- TakeScreenshot: Word;
- Stat: Word;
- Chat: Word;
- TeamChat: Word;
- end;
-
- TControls = record
- GameControls: TGameControls;
- P1Control: TPlayerControl;
- P2Control: TPlayerControl;
- end;
+ g_language, g_weapons, utils;
function GenPlayerName (n: Integer): String;
function GenPlayerName (n: Integer): String;
-procedure g_Options_SetDefault();
+procedure g_Options_SetDefault;
+procedure g_Options_SetDefaultVideo;
procedure g_Options_Read(FileName: String);
procedure g_Options_Write(FileName: String);
procedure g_Options_Read(FileName: String);
procedure g_Options_Write(FileName: String);
-procedure g_Options_Write_Language(FileName: String);
-procedure g_Options_Write_Video(FileName: String);
procedure g_Options_Write_Gameplay_Custom(FileName: String);
procedure g_Options_Write_Gameplay_Net(FileName: String);
procedure g_Options_Write_Net_Server(FileName: String);
procedure g_Options_Write_Net_Client(FileName: String);
procedure g_Options_Write_Gameplay_Custom(FileName: String);
procedure g_Options_Write_Gameplay_Net(FileName: String);
procedure g_Options_Write_Net_Server(FileName: String);
procedure g_Options_Write_Net_Client(FileName: String);
+procedure g_Options_Commands (p: SSArray);
const DF_Default_Megawad_Start = 'megawads/DOOM2D.WAD:\MAP01';
var
const DF_Default_Megawad_Start = 'megawads/DOOM2D.WAD:\MAP01';
var
- gGameControls: TControls;
gScreenWidth: Word;
gScreenHeight: Word;
gScreenWidth: Word;
gScreenHeight: Word;
- gWinRealPosX: Integer;
- gWinRealPosY: Integer;
- gBPP: Byte;
+ gBPP: Integer;
gFreq: Byte;
gFullscreen: Boolean;
gWinMaximized: Boolean;
gFreq: Byte;
gFullscreen: Boolean;
gWinMaximized: Boolean;
glLegacyNPOT: Boolean;
gTextureFilter: Boolean;
gNoSound: Boolean;
glLegacyNPOT: Boolean;
gTextureFilter: Boolean;
gNoSound: Boolean;
- gSoundLevel: Byte;
- gMusicLevel: Byte;
- gMaxSimSounds: Byte;
+ gSoundLevel: Integer;
+ gMusicLevel: Integer;
+ gMaxSimSounds: Integer;
gMuteWhenInactive: Boolean;
gAdvCorpses: Boolean;
gAdvBlood: Boolean;
gMuteWhenInactive: Boolean;
gAdvCorpses: Boolean;
gAdvBlood: Boolean;
gSFSFastMode: Boolean;
gDefaultMegawadStart: AnsiString;
gBerserkAutoswitch: Boolean;
gSFSFastMode: Boolean;
gDefaultMegawadStart: AnsiString;
gBerserkAutoswitch: Boolean;
+ glNPOTOverride: Boolean = false;
implementation
uses
{$INCLUDE ../nogl/noGLuses.inc}
implementation
uses
{$INCLUDE ../nogl/noGLuses.inc}
- e_log, e_input, g_window, g_sound, g_gfx, g_player, Math,
+ {$IFDEF USE_SDL2}
+ SDL2,
+ {$ENDIF}
+ e_log, e_input, g_console, g_window, g_sound, g_gfx, g_player, Math,
g_map, g_net, g_netmaster, SysUtils, CONFIG, g_game, g_main, e_texture,
g_map, g_net, g_netmaster, SysUtils, CONFIG, g_game, g_main, e_texture,
- g_items, wadreader, e_graphics, g_touch, SDL2, envvars;
+ g_items, wadreader, e_graphics, g_touch, envvars, g_system;
var
machine: Integer;
var
machine: Integer;
begin
ASSERT(n >= 1);
Result := GetUserName;
begin
ASSERT(n >= 1);
Result := GetUserName;
- if Result = '' then Result := 'Player' + IntToStr(machine MOD 10000);
- if n > 1 then Result := Copy(Result, 1, 10) + (' ' + IntToStr(n))
+ if Result = '' then
+ Result := 'Player' + IntToStr(machine MOD 10000);
+ if n = 1 then
+ Result := Copy(Result, 1, 12) + ' '
+ else
+ Result := Copy(Result, 1, 10) + ' ' + IntToStr(n)
end;
end;
+{$IFDEF USE_SDL2}
procedure g_Options_SetDefaultVideo;
procedure g_Options_SetDefaultVideo;
-var
- target, closest, display: TSDL_DisplayMode;
- percentage: Integer;
+ var display: TSDL_DisplayMode;
+ {$IFNDEF ANDROID}
+ var target, closest: TSDL_DisplayMode; percentage: Integer;
+ {$ENDIF}
begin
(* Display 0 = Primary display *)
begin
(* Display 0 = Primary display *)
- SDL_GetDesktopDisplayMode(0, @display);
- {$IF DEFINED(ANDROID)}
+ gScreenWidth := 640;
+ gScreenHeight := 480;
+ //gBPP := SDL_BITSPERPIXEL(dispaly.format);
+ gBPP := 32;
+ {$IFDEF ANDROID}
+ gFullScreen := True; (* rotation not allowed? *)
+ {$ELSE}
+ gFullScreen := False;
+ {$ENDIF}
+ if SDL_GetDesktopDisplayMode(0, @display) = 0 then
+ begin
+ {$IFDEF ANDROID}
gScreenWidth := display.w;
gScreenHeight := display.h;
gScreenWidth := display.w;
gScreenHeight := display.h;
- //gBPP := SDL_BITSPERPIXEL(dispaly.format);
- gBPP := 32;
- gFullScreen := True; (* rotation not allowed? *)
{$ELSE}
(* Window must be smaller than display *)
closest.w := display.w;
{$ELSE}
(* Window must be smaller than display *)
closest.w := display.w;
gScreenWidth := closest.w;
gScreenHeight := closest.h;
//gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
gScreenWidth := closest.w;
gScreenHeight := closest.h;
//gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
- gBPP := 32;
- gFullScreen := False;
{$ENDIF}
{$ENDIF}
+ end
+ else
+ begin
+ e_LogWritefln('SDL: Failed to get desktop display mode: %s', [SDL_GetError])
+ end;
(* Must be positioned on primary display *)
(* Must be positioned on primary display *)
- gWinRealPosX := SDL_WINDOWPOS_CENTERED;
- gWinRealPosY := SDL_WINDOWPOS_CENTERED;
gWinMaximized := False;
gVSync := True;
gTextureFilter := True;
glLegacyNPOT := False;
e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth) + ' h = ' + IntToStr(gScreenHeight));
gWinMaximized := False;
gVSync := True;
gTextureFilter := True;
glLegacyNPOT := False;
e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth) + ' h = ' + IntToStr(gScreenHeight));
+ g_Console_ResetBinds;
end;
end;
+{$ELSE}
+procedure g_Options_SetDefaultVideo;
+begin
+ gScreenWidth := 640;
+ gScreenHeight := 480;
+ gBPP := 32;
+ gFullScreen := False;
+ gWinMaximized := False;
+ gVSync := True;
+ gTextureFilter := True;
+ glLegacyNPOT := False;
+ e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth) + ' h = ' + IntToStr(gScreenHeight));
+ g_Console_ResetBinds;
+end;
+{$ENDIF}
procedure g_Options_SetDefault();
var
procedure g_Options_SetDefault();
var
g_Sound_SetupAllVolumes(gSoundLevel, gMusicLevel);
g_Sound_SetupAllVolumes(gSoundLevel, gMusicLevel);
- (* section GameControls *)
- with gGameControls.GameControls do
- begin
- TakeScreenshot := SDL_SCANCODE_F12;
- Stat := SDL_SCANCODE_TAB;
- Chat := SDL_SCANCODE_T;
- TeamChat := SDL_SCANCODE_Y;
- end;
-
- (* section Player1 *)
- with gGameControls.P1Control do
- begin
- KeyRight := SDL_SCANCODE_KP_6;
- KeyLeft := SDL_SCANCODE_KP_4;
- KeyUp := SDL_SCANCODE_KP_8;
- KeyDown := SDL_SCANCODE_KP_5;
- KeyFire := SDL_SCANCODE_SLASH;
- KeyJump := SDL_SCANCODE_RCTRL;
- KeyNextWeapon := SDL_SCANCODE_KP_9;
- KeyPrevWeapon := SDL_SCANCODE_KP_7;
- KeyOpen := SDL_SCANCODE_RSHIFT;
- KeyStrafe := SDL_SCANCODE_PERIOD;
-
- for i := 0 to 9 do
- begin
- KeyWeapon[i] := SDL_SCANCODE_1 + i (* 1, ..., 9, 0 *)
- end;
- KeyWeapon[10] := SDL_SCANCODE_MINUS;
- for i := 11 to High(KeyWeapon) do
- begin
- KeyWeapon[i] := 0
- end;
-
- KeyRight2 := VK_RIGHT;
- KeyLeft2 := VK_LEFT;
- KeyUp2 := VK_UP;
- KeyDown2 := VK_DOWN;
- KeyFire2 := VK_FIRE;
- KeyJump2 := VK_JUMP;
- KeyNextWeapon2 := VK_NEXT;
- KeyPrevWeapon2 := VK_PREV;
- KeyOpen2 := VK_OPEN;
- KeyStrafe2 := VK_STRAFE;
-
- for i := 0 to High(KeyWeapon2) do
- begin
- KeyWeapon2[i] := VK_0 + i
- end;
- end;
-
with gPlayer1Settings do
begin
Name := GenPlayerName(1);
with gPlayer1Settings do
begin
Name := GenPlayerName(1);
Team := TEAM_RED;
end;
Team := TEAM_RED;
end;
- (* section Player2 *)
- with gGameControls.P2Control do
- begin
- KeyRight := SDL_SCANCODE_D;
- KeyLeft := SDL_SCANCODE_A;
- KeyUp := SDL_SCANCODE_W;
- KeyDown := SDL_SCANCODE_S;
- KeyFire := SDL_SCANCODE_G;
- KeyJump := SDL_SCANCODE_SPACE;
- KeyNextWeapon := SDL_SCANCODE_E;
- KeyPrevWeapon := SDL_SCANCODE_Q;
- KeyOpen := SDL_SCANCODE_F;
- KeyStrafe := SDL_SCANCODE_LSHIFT;
- for i := 0 to High(KeyWeapon) do
- begin
- KeyWeapon[i] := 0
- end;
-
- KeyRight2 := 0;
- KeyLeft2 := 0;
- KeyUp2 := 0;
- KeyDown2 := 0;
- KeyFire2 := 0;
- KeyJump2 := 0;
- KeyNextWeapon2 := 0;
- KeyPrevWeapon2 := 0;
- KeyOpen2 := 0;
- KeyStrafe2 := 0;
-
- for i := 0 to High(KeyWeapon2) do
- begin
- KeyWeapon2[i] := 0;
- end
- end;
-
with gPlayer2Settings do
begin
Name := GenPlayerName(2);
with gPlayer2Settings do
begin
Name := GenPlayerName(2);
e_JoystickDeadzones[i] := 8192
end;
e_JoystickDeadzones[i] := 8192
end;
- (* section Touch *)
- g_touch_size := 1.0;
- g_touch_fire := True;
- g_touch_offset := 50;
- g_touch_alt := False;
-
(* section Game *)
g_GFX_SetMax(2000);
g_Shells_SetMax(300);
(* section Game *)
g_GFX_SetMax(2000);
g_Shells_SetMax(300);
(* section MasterServer *)
NetSlistIP := 'mpms.doom2d.org';
NetSlistPort := 25665;
(* section MasterServer *)
NetSlistIP := 'mpms.doom2d.org';
NetSlistPort := 25665;
- g_Net_Slist_Set(NetSlistIP, NetSlistPort);
+ g_Net_Slist_Set(NetSlistIP, NetSlistPort, NetSlistList);
(* section Server *)
NetServerName := 'Unnamed Server';
(* section Server *)
NetServerName := 'Unnamed Server';
config := TConfig.CreateFile(FileName);
config := TConfig.CreateFile(FileName);
- section := 'Video';
- ReadInteger(gScreenWidth, 'ScreenWidth', 0);
- ReadInteger(gScreenHeight, 'ScreenHeight', 0);
- ReadInteger(gWinRealPosX, 'WinPosX', 60);
- ReadInteger(gWinRealPosY, 'WinPosY', 60);
- ReadBoolean(gFullScreen, 'Fullscreen');
- ReadBoolean(gWinMaximized, 'Maximized');
- ReadInteger(gBPP, 'BPP', 0);
- ReadInteger(gFreq, 'Freq', 0);
- ReadBoolean(gVSync, 'VSync');
- ReadBoolean(gTextureFilter, 'TextureFilter');
- ReadBoolean(glLegacyNPOT, 'LegacyCompatible');
-
- section := 'Sound';
- ReadBoolean(gNoSound, 'NoSound');
- ReadInteger(gSoundLevel, 'SoundLevel', 0, 255);
- ReadInteger(gMusicLevel, 'MusicLevel', 0, 255);
- ReadInteger(gMaxSimSounds, 'MaxSimSounds', 2, 66);
- ReadBoolean(gMuteWhenInactive, 'MuteInactive');
- ReadInteger(gAnnouncer, 'Announcer', ANNOUNCE_NONE, ANNOUNCE_ALL);
- ReadBoolean(gSoundEffectsDF, 'SoundEffectsDF');
- ReadBoolean(gUseChatSounds, 'ChatSounds');
- ReadInteger(gsSDLSampleRate, 'SDLSampleRate', 11025, 96000);
- ReadInteger(gsSDLBufferSize, 'SDLBufferSize', 64, 16384);
-
- section := 'GameControls';
- with gGameControls.GameControls do
- begin
- ReadInteger(TakeScreenshot, 'TakeScreenshot');
- ReadInteger(Stat, 'Stat');
- ReadInteger(Chat, 'Chat');
- ReadInteger(TeamChat, 'TeamChat');
- end;
-
- section := 'Player1';
- with gGameControls.P1Control do
- begin
- ReadInteger(KeyRight, 'KeyRight');
- ReadInteger(KeyLeft, 'KeyLeft');
- ReadInteger(KeyUp, 'KeyUp');
- ReadInteger(KeyDown, 'KeyDown');
- ReadInteger(KeyFire, 'KeyFire');
- ReadInteger(KeyJump, 'KeyJump');
- ReadInteger(KeyNextWeapon, 'KeyNextWeapon');
- ReadInteger(KeyPrevWeapon, 'KeyPrevWeapon');
- ReadInteger(KeyOpen, 'KeyOpen');
- ReadInteger(KeyStrafe, 'KeyStrafe');
-
- for i := 0 to High(KeyWeapon) do
- begin
- ReadInteger(KeyWeapon[i], 'KeyWeapon' + IntToStr(i))
- end;
-
- ReadInteger(KeyRight2, 'KeyRight2');
- ReadInteger(KeyLeft2, 'KeyLeft2');
- ReadInteger(KeyUp2, 'KeyUp2');
- ReadInteger(KeyDown2, 'KeyDown2');
- ReadInteger(KeyFire2, 'KeyFire2');
- ReadInteger(KeyJump2, 'KeyJump2');
- ReadInteger(KeyNextWeapon2, 'KeyNextWeapon2');
- ReadInteger(KeyPrevWeapon2, 'KeyPrevWeapon2');
- ReadInteger(KeyOpen2, 'KeyOpen2');
- ReadInteger(KeyStrafe2, 'KeyStrafe2');
-
- for i := 0 to High(KeyWeapon2) do
- begin
- ReadInteger(KeyWeapon2[i], 'KeyWeapon2' + IntToStr(i))
- end;
- end;
-
section := 'Player1';
with gPlayer1Settings do
begin
section := 'Player1';
with gPlayer1Settings do
begin
Team := TEAM_RED;
end;
Team := TEAM_RED;
end;
- section := 'Player2';
- with gGameControls.P2Control do
- begin
- ReadInteger(KeyRight, 'KeyRight');
- ReadInteger(KeyLeft, 'KeyLeft');
- ReadInteger(KeyUp, 'KeyUp');
- ReadInteger(KeyDown, 'KeyDown');
- ReadInteger(KeyFire, 'KeyFire');
- ReadInteger(KeyJump, 'KeyJump');
- ReadInteger(KeyNextWeapon, 'KeyNextWeapon');
- ReadInteger(KeyPrevWeapon, 'KeyPrevWeapon');
- ReadInteger(KeyOpen, 'KeyOpen');
- ReadInteger(KeyStrafe, 'KeyStrafe');
-
- for i := 0 to High(KeyWeapon) do
- begin
- ReadInteger(KeyWeapon[i], 'KeyWeapon' + IntToStr(i))
- end;
-
- ReadInteger(KeyRight2, 'KeyRight2');
- ReadInteger(KeyLeft2, 'KeyLeft2');
- ReadInteger(KeyUp2, 'KeyUp2');
- ReadInteger(KeyDown2, 'KeyDown2');
- ReadInteger(KeyFire2, 'KeyFire2');
- ReadInteger(KeyJump2, 'KeyJump2');
- ReadInteger(KeyNextWeapon2, 'KeyNextWeapon2');
- ReadInteger(KeyPrevWeapon2, 'KeyPrevWeapon2');
- ReadInteger(KeyOpen2, 'KeyOpen2');
- ReadInteger(KeyStrafe2, 'KeyStrafe2');
-
- for i := 0 to High(KeyWeapon2) do
- begin
- ReadInteger(KeyWeapon2[i], 'KeyWeapon2' + IntToStr(i))
- end;
- end;
-
section := 'Player2';
with gPlayer2Settings do
begin
section := 'Player2';
with gPlayer2Settings do
begin
Team := TEAM_RED;
end;
Team := TEAM_RED;
end;
- section := 'Joysticks';
- for i := 0 to e_MaxJoys - 1 do
- begin
- ReadInteger(e_JoystickDeadzones[i], 'Deadzone' + IntToStr(i))
- end;
-
- section := 'Touch';
- i := Trunc(g_touch_size * 10); ReadInteger(i, 'Size', 0); g_touch_size := i / 10;
- ReadBoolean(g_touch_fire, 'Fire');
- i := Round(g_touch_offset); ReadInteger(i, 'Offset', 0, 100); g_touch_offset := i;
- ReadBoolean(g_touch_alt, 'Alt');
-
section := 'Game';
section := 'Game';
- ReadInteger(i, 'MaxParticles', 1000, 50000); g_GFX_SetMax(i);
- ReadInteger(i, 'MaxShells', 300, 600); g_Shells_SetMax(i);
- ReadInteger(i, 'MaxGibs', 150, 500); g_Gibs_SetMax(i);
- ReadInteger(i, 'MaxCorpses', 20, 100); g_Corpses_SetMax(i);
+ ReadInteger(i, 'MaxParticles', 0, 50000); g_GFX_SetMax(i);
+ ReadInteger(i, 'MaxShells', 0, 600); g_Shells_SetMax(i);
+ ReadInteger(i, 'MaxGibs', 0, 500); g_Gibs_SetMax(i);
+ ReadInteger(i, 'MaxCorpses', 0, 100); g_Corpses_SetMax(i);
ReadInteger(i, 'GibsCount');
case i of
0: gGibsCount := 0;
ReadInteger(i, 'GibsCount');
case i of
0: gGibsCount := 0;
ReadString(gDefaultMegawadStart, 'DefaultMegawadStart');
ReadBoolean(gBerserkAutoswitch, 'BerserkAutoswitching');
i := Trunc(g_dbg_scale * 100); ReadInteger(i, 'Scale', 100); g_dbg_scale := i / 100;
ReadString(gDefaultMegawadStart, 'DefaultMegawadStart');
ReadBoolean(gBerserkAutoswitch, 'BerserkAutoswitching');
i := Trunc(g_dbg_scale * 100); ReadInteger(i, 'Scale', 100); g_dbg_scale := i / 100;
- ReadString(gLanguage, 'Language');
- if (gLanguage = LANGUAGE_RUSSIAN) or (gLanguage = LANGUAGE_ENGLISH) then
- gAskLanguage := False
- else
- gLanguage := LANGUAGE_ENGLISH;
section := 'GameplayCustom';
ReadString(gcMap, 'Map');
section := 'GameplayCustom';
ReadString(gcMap, 'Map');
section := 'MasterServer';
ReadString(NetSlistIP, 'IP');
ReadInteger(NetSlistPort, 'Port', 0, 65535);
section := 'MasterServer';
ReadString(NetSlistIP, 'IP');
ReadInteger(NetSlistPort, 'Port', 0, 65535);
- g_Net_Slist_Set(NetSlistIP, NetSlistPort);
+ ReadString(NetSlistList, 'List');
+ g_Net_Slist_Set(NetSlistIP, NetSlistPort, NetSlistList);
section := 'Server';
ReadString(NetServerName, 'Name');
section := 'Server';
ReadString(NetServerName, 'Name');
end;
procedure g_Options_Write(FileName: String);
end;
procedure g_Options_Write(FileName: String);
-var
- config: TConfig;
- i: Integer;
+ var config: TConfig;
begin
e_WriteLog('Writing config', TMsgType.Notify);
config := TConfig.CreateFile(FileName);
begin
e_WriteLog('Writing config', TMsgType.Notify);
config := TConfig.CreateFile(FileName);
- config.WriteInt('Video', 'ScreenWidth', gScreenWidth);
- config.WriteInt('Video', 'ScreenHeight', gScreenHeight);
- config.WriteInt('Video', 'WinPosX', gWinRealPosX);
- config.WriteInt('Video', 'WinPosY', gWinRealPosY);
- config.WriteBool('Video', 'Fullscreen', gFullScreen);
- config.WriteBool('Video', 'Maximized', gWinMaximized);
- config.WriteInt('Video', 'BPP', gBPP);
- config.WriteBool('Video', 'VSync', gVSync);
- config.WriteBool('Video', 'TextureFilter', gTextureFilter);
- config.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT);
-
- config.WriteBool('Sound', 'NoSound', gNoSound);
- config.WriteInt('Sound', 'SoundLevel', gSoundLevel);
- config.WriteInt('Sound', 'MusicLevel', gMusicLevel);
- config.WriteInt('Sound', 'MaxSimSounds', gMaxSimSounds);
- config.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive);
- config.WriteInt('Sound', 'Announcer', gAnnouncer);
- config.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF);
- config.WriteBool('Sound', 'ChatSounds', gUseChatSounds);
- config.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate);
- config.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize);
-
- with config, gGameControls.GameControls do
+ with config, gPlayer1Settings do
begin
begin
- WriteInt('GameControls', 'TakeScreenshot', TakeScreenshot);
- WriteInt('GameControls', 'Stat', Stat);
- WriteInt('GameControls', 'Chat', Chat);
- WriteInt('GameControls', 'TeamChat', TeamChat);
- end;
-
- with config, gGameControls.P1Control, gPlayer1Settings do
- begin
- WriteInt('Player1', 'KeyRight', KeyRight);
- WriteInt('Player1', 'KeyLeft', KeyLeft);
- WriteInt('Player1', 'KeyUp', KeyUp);
- WriteInt('Player1', 'KeyDown', KeyDown);
- WriteInt('Player1', 'KeyFire', KeyFire);
- WriteInt('Player1', 'KeyJump', KeyJump);
- WriteInt('Player1', 'KeyNextWeapon', KeyNextWeapon);
- WriteInt('Player1', 'KeyPrevWeapon', KeyPrevWeapon);
- WriteInt('Player1', 'KeyOpen', KeyOpen);
- WriteInt('Player1', 'KeyStrafe', KeyStrafe);
- for i := 0 to High(KeyWeapon) do
- WriteInt('Player1', 'KeyWeapon' + IntToStr(i), KeyWeapon[i]);
-
- WriteInt('Player1', 'KeyRight2', KeyRight2);
- WriteInt('Player1', 'KeyLeft2', KeyLeft2);
- WriteInt('Player1', 'KeyUp2', KeyUp2);
- WriteInt('Player1', 'KeyDown2', KeyDown2);
- WriteInt('Player1', 'KeyFire2', KeyFire2);
- WriteInt('Player1', 'KeyJump2', KeyJump2);
- WriteInt('Player1', 'KeyNextWeapon2', KeyNextWeapon2);
- WriteInt('Player1', 'KeyPrevWeapon2', KeyPrevWeapon2);
- WriteInt('Player1', 'KeyOpen2', KeyOpen2);
- WriteInt('Player1', 'KeyStrafe2', KeyStrafe2);
- for i := 0 to High(KeyWeapon2) do
- WriteInt('Player1', 'KeyWeapon2' + IntToStr(i), KeyWeapon2[i]);
-
WriteStr('Player1', 'Name', Name);
WriteStr('Player1', 'model', Model);
WriteInt('Player1', 'red', Color.R);
WriteStr('Player1', 'Name', Name);
WriteStr('Player1', 'model', Model);
WriteInt('Player1', 'red', Color.R);
WriteInt('Player1', 'team', Team);
end;
WriteInt('Player1', 'team', Team);
end;
- with config, gGameControls.P2Control, gPlayer2Settings do
+ with config, gPlayer2Settings do
begin
begin
- WriteInt('Player2', 'KeyRight', KeyRight);
- WriteInt('Player2', 'KeyLeft', KeyLeft);
- WriteInt('Player2', 'KeyUp', KeyUp);
- WriteInt('Player2', 'KeyDown', KeyDown);
- WriteInt('Player2', 'KeyFire', KeyFire);
- WriteInt('Player2', 'KeyJump', KeyJump);
- WriteInt('Player2', 'KeyNextWeapon', KeyNextWeapon);
- WriteInt('Player2', 'KeyPrevWeapon', KeyPrevWeapon);
- WriteInt('Player2', 'KeyOpen', KeyOpen);
- WriteInt('Player2', 'KeyStrafe', KeyStrafe);
- for i := 0 to High(KeyWeapon) do
- WriteInt('Player2', 'KeyWeapon' + IntToStr(i), KeyWeapon[i]);
-
- WriteInt('Player2', 'KeyRight2', KeyRight2);
- WriteInt('Player2', 'KeyLeft2', KeyLeft2);
- WriteInt('Player2', 'KeyUp2', KeyUp2);
- WriteInt('Player2', 'KeyDown2', KeyDown2);
- WriteInt('Player2', 'KeyFire2', KeyFire2);
- WriteInt('Player2', 'KeyJump2', KeyJump2);
- WriteInt('Player2', 'KeyNextWeapon2', KeyNextWeapon2);
- WriteInt('Player2', 'KeyPrevWeapon2', KeyPrevWeapon2);
- WriteInt('Player2', 'KeyOpen2', KeyOpen2);
- WriteInt('Player2', 'KeyStrafe2', KeyStrafe2);
- for i := 0 to High(KeyWeapon2) do
- WriteInt('Player2', 'KeyWeapon2' + IntToStr(i), KeyWeapon2[i]);
-
WriteStr('Player2', 'Name', Name);
WriteStr('Player2', 'model', Model);
WriteInt('Player2', 'red', Color.R);
WriteStr('Player2', 'Name', Name);
WriteStr('Player2', 'model', Model);
WriteInt('Player2', 'red', Color.R);
WriteInt('Player2', 'team', Team);
end;
WriteInt('Player2', 'team', Team);
end;
- for i := 0 to e_MaxJoys-1 do
- config.WriteInt('Joysticks', 'Deadzone' + IntToStr(i), e_JoystickDeadzones[i]);
-
- config.WriteInt('Touch', 'Size', Round(g_touch_size * 10));
- config.WriteBool('Touch', 'Fire', g_touch_fire);
- config.WriteInt('Touch', 'Offset', Round(g_touch_offset));
- config.WriteBool('Touch', 'Alt', g_touch_alt);
-
with config do
case gGibsCount of
0: config.WriteInt('Game', 'GibsCount', 0);
with config do
case gGibsCount of
0: config.WriteInt('Game', 'GibsCount', 0);
config.WriteStr('MasterServer', 'IP', NetSlistIP);
config.WriteInt('MasterServer', 'Port', NetSlistPort);
config.WriteStr('MasterServer', 'IP', NetSlistIP);
config.WriteInt('MasterServer', 'Port', NetSlistPort);
+ config.WriteStr('MasterServer', 'List', NetSlistList);
config.WriteStr ('Server', 'Name', NetServerName);
config.WriteStr ('Server', 'Password', NetPassword);
config.WriteStr ('Server', 'Name', NetServerName);
config.WriteStr ('Server', 'Password', NetPassword);
config.Free();
end;
config.Free();
end;
-procedure g_Options_Write_Language(FileName: String);
-var
- config: TConfig;
-begin
- e_WriteLog('Writing language config', TMsgType.Notify);
-
- config := TConfig.CreateFile(FileName);
- config.WriteStr('Game', 'Language', gLanguage);
- config.SaveFile(FileName);
- config.Free();
-end;
-
-procedure g_Options_Write_Video(FileName: String);
-var
- config: TConfig;
- sW, sH: Integer;
-begin
- e_WriteLog('Writing resolution to config', TMsgType.Notify);
-
- config := TConfig.CreateFile(FileName);
-
- if gWinMaximized and (not gFullscreen) then
- begin
- sW := gWinSizeX;
- sH := gWinSizeY;
- end
- else
- begin
- sW := gScreenWidth;
- sH := gScreenHeight;
- end;
- e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX, gWinSizeY, gScreenWidth, gScreenHeight]);
-
- config.WriteInt('Video', 'ScreenWidth', sW);
- config.WriteInt('Video', 'ScreenHeight', sH);
- config.WriteInt('Video', 'WinPosX', gWinRealPosX);
- config.WriteInt('Video', 'WinPosY', gWinRealPosY);
- config.WriteBool('Video', 'Fullscreen', gFullscreen);
- config.WriteBool('Video', 'Maximized', gWinMaximized);
-
- config.SaveFile(FileName);
- config.Free();
-end;
-
procedure g_Options_Write_Gameplay_Custom(FileName: String);
var
config: TConfig;
procedure g_Options_Write_Gameplay_Custom(FileName: String);
var
config: TConfig;
config.Free();
end;
config.Free();
end;
+procedure g_Options_Commands (p: SSArray);
+ var cmd: AnsiString;
+begin
+ cmd := LowerCase(p[0]);
+ case cmd of
+ 'r_reset':
+ begin
+ sys_EnableVSync(gVSync);
+ gRC_Width := Max(1, gRC_Width);
+ gRC_Height := Max(1, gRC_Height);
+ gBPP := Max(1, gBPP);
+ if sys_SetDisplayMode(gRC_Width, gRC_Height, gBPP, gRC_FullScreen) = True then
+ e_LogWriteln('resolution changed')
+ else
+ e_LogWriteln('resolution not changed')
+ end;
+ 'g_language':
+ begin
+ if Length(p) = 2 then
+ begin
+ gAskLanguage := true;
+ gLanguage := LANGUAGE_ENGLISH;
+ case LowerCase(p[1]) of
+ 'english':
+ begin
+ gAskLanguage := false;
+ gLanguage := LANGUAGE_ENGLISH;
+ end;
+ 'russian':
+ begin
+ gAskLanguage := false;
+ gLanguage := LANGUAGE_RUSSIAN;
+ end;
+ 'ask':
+ begin
+ gAskLanguage := true;
+ gLanguage := LANGUAGE_ENGLISH;
+ end;
+ end;
+ g_Language_Set(gLanguage)
+ end
+ end
+ end;
+end;
+
initialization
initialization
- machine := Random(10000)
+ Randomize;
+ machine := Random(10000);
+
+ (* Video *)
+ conRegVar('r_width', @gRC_Width, '', '');
+ conRegVar('r_height', @gRC_Height, '', '');
+ conRegVar('r_fullscreen', @gRC_FullScreen, '', '');
+ conRegVar('r_maximized', @gRC_Maximized, '', '');
+ conRegVar('r_bpp', @gBPP, '', '');
+ conRegVar('r_vsync', @gVSync, '', '');
+ conRegVar('r_texfilter', @gTextureFilter, '', '');
+ conRegVar('r_npot', @glNPOTOverride, '', '');
+
+ (* Sound *)
+ conRegVar('s_nosound', @gNoSound, '', '');
+ conRegVar('s_soundvolume', @gSoundLevel, '', '');
+ conRegVar('s_musicvolume', @gMusicLevel, '', '');
+ conRegVar('s_maxsim', @gMaxSimSounds, '', ''); // e_sound_fmod/sdl?
+ conRegVar('s_muteinactive', @gMuteWhenInactive, '', '');
+ conRegVar('s_announcer', @gAnnouncer, '', '');
+ conRegVar('s_sfx', @gSoundEffectsDF, '', '');
+ conRegVar('s_chatsounds', @gUseChatSounds, '', '');
+ {$IFDEF USE_SDLMIXER}
+ conRegVar('sdl_mixer_samplerate', @gsSDLSampleRate, '', '');
+ conRegVar('sdl_mixer_buffersize', @gsSDLBufferSize, '', '');
+ {$ENDIF}
end.
end.