DEADSOFTWARE

r_sacle now saves more precisely
[d2df-sdl.git] / src / game / g_options.pas
index 18debdd9a80fc0ad0f58b628d92b5cd052dd6289..7b2a13c4050c3f25bcf271bead8596e25f62a43e 100644 (file)
@@ -134,9 +134,14 @@ var
 implementation
 
 uses
+{$IFDEF USE_NANOGL}
+  nanoGL,
+{$ELSE}
+  GL, GLExt,
+{$ENDIF}
   e_log, e_input, g_window, g_sound, g_gfx, g_player, Math,
   g_map, g_net, g_netmaster, SysUtils, CONFIG, g_game, g_main, e_texture,
-  g_items, GL, GLExt, wadreader, e_graphics;
+  g_items, wadreader, e_graphics, g_touch;
 
 procedure g_Options_SetDefault();
 var
@@ -147,6 +152,7 @@ begin
   gMuteWhenInactive := False;
   gAnnouncer := ANNOUNCE_MEPLUS;
   gSoundEffectsDF := True;
+  gUseChatSounds := True;
   g_GFX_SetMax(2000);
   g_Gibs_SetMax(150);
   g_Corpses_SetMax(20);
@@ -160,6 +166,9 @@ begin
   gDrawBackGround := True;
   gShowMessages := True;
   gRevertPlayers := False;
+  g_dbg_scale := 1.0;
+  g_touch_size := 1.0;
+  g_touch_fire := True;
 
   for i := 0 to e_MaxJoys-1 do
     e_JoystickDeadzones[i] := 8192;
@@ -184,21 +193,24 @@ begin
     KeyPrevWeapon := 71;
     KeyOpen := 54;
     KeyStrafe := 0;
-    for i := 0 to High(KeyWeapon) do
+    for i := 0 to 9 do
+      KeyWeapon[i] := 30 + i;
+    KeyWeapon[10] := 45;
+    for i := 10 to High(KeyWeapon) do
       KeyWeapon[i] := 0;
 
-    KeyRight2 := 0;
-    KeyLeft2 := 0;
-    KeyUp2 := 0;
-    KeyDown2 := 0;
-    KeyFire2 := 0;
-    KeyJump2 := 0;
-    KeyNextWeapon2 := 0;
-    KeyPrevWeapon2 := 0;
-    KeyOpen2 := 0;
-    KeyStrafe2 := 0;
+    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
-      KeyWeapon2[i] := 0;
+      KeyWeapon2[i] := VK_0 + i;
   end;
 
   with gGameControls.P2Control do
@@ -251,6 +263,7 @@ begin
   end;
 
   NetUseMaster := True;
+  NetForwardPorts := False;
   g_Net_Slist_Set('mpms.doom2d.org', 25665);
 end;
 
@@ -291,12 +304,12 @@ begin
   gScreenHeight := config.ReadInt('Video', 'ScreenHeight', 600);
   if gScreenHeight < 480 then
     gScreenHeight := 480;
-  gWinRealPosX := config.ReadInt('Video', 'WinPosX', 0);
+  gWinRealPosX := config.ReadInt('Video', 'WinPosX', 60);
   if gWinRealPosX < 0 then
-    gWinRealPosX := 0;
-  gWinRealPosY := config.ReadInt('Video', 'WinPosY', 0);
+    gWinRealPosX := 60;
+  gWinRealPosY := config.ReadInt('Video', 'WinPosY', 60);
   if gWinRealPosY < 0 then
-    gWinRealPosY := 0;
+    gWinRealPosY := 60;
   gFullScreen := config.ReadBool('Video', 'Fullscreen', False);
   gWinMaximized := config.ReadBool('Video', 'Maximized', False);
   gBPP := config.ReadInt('Video', 'BPP', 32);
@@ -312,6 +325,7 @@ begin
   gMuteWhenInactive := config.ReadBool('Sound', 'MuteInactive', False);
   gAnnouncer := Min(Max(config.ReadInt('Sound', 'Announcer', ANNOUNCE_MEPLUS), ANNOUNCE_NONE), ANNOUNCE_ALL);
   gSoundEffectsDF := config.ReadBool('Sound', 'SoundEffectsDF', True);
+  gUseChatSounds := config.ReadBool('Sound', 'ChatSounds', True);
   gsSDLSampleRate := Min(Max(config.ReadInt('Sound', 'SDLSampleRate', 44100), 11025), 96000);
   gsSDLBufferSize := Min(Max(config.ReadInt('Sound', 'SDLBufferSize', 2048), 64), 16384);
 
@@ -408,6 +422,9 @@ begin
   for i := 0 to e_MaxJoys-1 do
     e_JoystickDeadzones[i] := config.ReadInt('Joysticks', 'Deadzone' + IntToStr(i), 8192);
 
+  g_touch_size := Max(config.ReadInt('Touch', 'Size', 10) / 10, 0.1);
+  g_touch_fire := config.ReadBool('Touch', 'Fire', True);
+
   g_GFX_SetMax(Min(config.ReadInt('Game', 'MaxParticles', 1000), 50000));
   g_Shells_SetMax(Min(config.ReadInt('Game', 'MaxShells', 300), 600));
   g_Gibs_SetMax(Min(config.ReadInt('Game', 'MaxGibs', 150), 500));
@@ -436,8 +453,9 @@ begin
   gSFSFastMode := config.ReadBool('Game', 'SFSFastMode', False);
   wadoptFast := gSFSFastMode;
   e_FastScreenshots := config.ReadBool('Game', 'FastScreenshots', True);
-  gDefaultMegawadStart := config.ReadStr('Game', 'DefaultMegawadStart', 'megawads/DOOM2D.WAD:\MAP01');
+  gDefaultMegawadStart := config.ReadStr('Game', 'DefaultMegawadStart', DF_Default_Megawad_Start);
   gBerserkAutoswitch := config.ReadBool('Game', 'BerserkAutoswitching', True);
+  g_dbg_scale := Max(config.ReadInt('Game', 'Scale', 100) / 100, 1.0);
 
 // Ãåéìïëåé â ñâîåé èãðå
   gcMap := config.ReadStr('GameplayCustom', 'Map', '');
@@ -508,6 +526,7 @@ begin
   NetUpdateRate := Max(0, config.ReadInt('Server', 'UpdateInterval', 0));
   NetRelupdRate := Max(0, config.ReadInt('Server', 'ReliableUpdateInterval', 18));
   NetMasterRate := Max(1, config.ReadInt('Server', 'MasterSyncInterval', 60000));
+  NetForwardPorts := config.ReadBool('Server', 'ForwardPorts', False);
 
 // Êëèåíò
   NetInterpLevel := Max(0, config.ReadInt('Client', 'InterpolationSteps', 2));
@@ -559,6 +578,7 @@ begin
   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);
 
@@ -645,6 +665,9 @@ begin
   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);
+
   with config do
     case gGibsCount of
       0: config.WriteInt('Game', 'GibsCount', 0);
@@ -673,6 +696,7 @@ begin
   config.WriteBool('Game', 'FastScreenshots', e_FastScreenshots);
   config.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart);
   config.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch);
+  config.WriteInt('Game', 'Scale', Round(g_dbg_scale * 100));
 
   config.WriteStr ('GameplayCustom', 'Map', gcMap);
   config.WriteStr ('GameplayCustom', 'GameMode', gcGameMode);
@@ -708,6 +732,7 @@ begin
   config.WriteBool('Server', 'RCON', NetAllowRCON);
   config.WriteStr ('Server', 'RCONPassword', NetRCONPassword);
   config.WriteBool('Server', 'SyncWithMaster', NetUseMaster);
+  config.WriteBool('Server', 'ForwardPorts', NetForwardPorts);
   config.WriteInt ('Server', 'UpdateInterval', NetUpdateRate);
   config.WriteInt ('Server', 'ReliableUpdateInterval', NetRelupdRate);
   config.WriteInt ('Server', 'MasterSyncInterval', NetMasterRate);
@@ -753,6 +778,7 @@ 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);
@@ -826,6 +852,7 @@ begin
   config.WriteInt ('Server', 'Port', NetPort);
   config.WriteInt ('Server', 'MaxClients', NetMaxClients);
   config.WriteBool('Server', 'SyncWithMaster', NetUseMaster);
+  config.WriteBool('Server', 'ForwardPorts', NetForwardPorts);
 
   config.SaveFile(FileName);
   config.Free();