DEADSOFTWARE

key binds and vars are stored in dfconfig.cfg
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Wed, 3 Apr 2019 14:41:03 +0000 (17:41 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Fri, 5 Apr 2019 22:19:24 +0000 (01:19 +0300)
src/engine/e_input.pas
src/game/g_console.pas
src/game/g_game.pas
src/game/g_menu.pas
src/game/g_netmsg.pas
src/game/g_options.pas

index 1c27249fc44465151cf00dc129c9bf85fa6a5f51..6c4eb45d7528aefea11e1b1569305a7bba624750 100644 (file)
@@ -61,11 +61,23 @@ const
   IK_SPACE   = SDL_SCANCODE_SPACE;
   IK_CONTROL = SDL_SCANCODE_LCTRL;
   IK_SHIFT   = SDL_SCANCODE_LSHIFT;
   IK_SPACE   = SDL_SCANCODE_SPACE;
   IK_CONTROL = SDL_SCANCODE_LCTRL;
   IK_SHIFT   = SDL_SCANCODE_LSHIFT;
+  IK_ALT     = SDL_SCANCODE_LALT;
   IK_TAB     = SDL_SCANCODE_TAB;
   IK_PAGEUP  = SDL_SCANCODE_PAGEUP;
   IK_KPPAGEUP= SDL_SCANCODE_KP_9;
   IK_PAGEDN  = SDL_SCANCODE_PAGEDOWN;
   IK_KPPAGEDN= SDL_SCANCODE_KP_3;
   IK_TAB     = SDL_SCANCODE_TAB;
   IK_PAGEUP  = SDL_SCANCODE_PAGEUP;
   IK_KPPAGEUP= SDL_SCANCODE_KP_9;
   IK_PAGEDN  = SDL_SCANCODE_PAGEDOWN;
   IK_KPPAGEDN= SDL_SCANCODE_KP_3;
+  IK_0      = SDL_SCANCODE_0;
+  IK_1      = SDL_SCANCODE_1;
+  IK_2      = SDL_SCANCODE_2;
+  IK_3      = SDL_SCANCODE_3;
+  IK_4      = SDL_SCANCODE_4;
+  IK_5      = SDL_SCANCODE_5;
+  IK_6      = SDL_SCANCODE_6;
+  IK_7      = SDL_SCANCODE_7;
+  IK_8      = SDL_SCANCODE_8;
+  IK_9      = SDL_SCANCODE_9;
+  IK_F1      = SDL_SCANCODE_F1;
   IK_F2      = SDL_SCANCODE_F2;
   IK_F3      = SDL_SCANCODE_F3;
   IK_F4      = SDL_SCANCODE_F4;
   IK_F2      = SDL_SCANCODE_F2;
   IK_F3      = SDL_SCANCODE_F3;
   IK_F4      = SDL_SCANCODE_F4;
@@ -75,6 +87,8 @@ const
   IK_F8      = SDL_SCANCODE_F8;
   IK_F9      = SDL_SCANCODE_F9;
   IK_F10     = SDL_SCANCODE_F10;
   IK_F8      = SDL_SCANCODE_F8;
   IK_F9      = SDL_SCANCODE_F9;
   IK_F10     = SDL_SCANCODE_F10;
+  IK_F11     = SDL_SCANCODE_F11;
+  IK_F12     = SDL_SCANCODE_F12;
   IK_END     = SDL_SCANCODE_END;
   IK_KPEND   = SDL_SCANCODE_KP_1;
   IK_BACKSPACE = SDL_SCANCODE_BACKSPACE;
   IK_END     = SDL_SCANCODE_END;
   IK_KPEND   = SDL_SCANCODE_KP_1;
   IK_BACKSPACE = SDL_SCANCODE_BACKSPACE;
@@ -83,6 +97,16 @@ const
   IK_PAUSE   = SDL_SCANCODE_PAUSE;
   IK_Y       = SDL_SCANCODE_Y;
   IK_N       = SDL_SCANCODE_N;
   IK_PAUSE   = SDL_SCANCODE_PAUSE;
   IK_Y       = SDL_SCANCODE_Y;
   IK_N       = SDL_SCANCODE_N;
+  IK_W       = SDL_SCANCODE_W;
+  IK_A       = SDL_SCANCODE_A;
+  IK_S       = SDL_SCANCODE_S;
+  IK_D       = SDL_SCANCODE_D;
+  IK_Q       = SDL_SCANCODE_Q;
+  IK_E       = SDL_SCANCODE_E;
+  IK_H       = SDL_SCANCODE_H;
+  IK_J       = SDL_SCANCODE_J;
+  IK_T       = SDL_SCANCODE_T;
+  IK_MINUS   = SDL_SCANCODE_MINUS;
   // TODO: think of something better than this shit
   IK_LASTKEY = SDL_NUM_SCANCODES-1;
 
   // TODO: think of something better than this shit
   IK_LASTKEY = SDL_NUM_SCANCODES-1;
 
@@ -548,21 +572,21 @@ end;
 function e_JoyButtonToKey(id: Word; btn: Byte): Word;
 begin
   Result := 0;
 function e_JoyButtonToKey(id: Word; btn: Byte): Word;
 begin
   Result := 0;
-  if id >= Length(Joysticks) then Exit;
+  if id >= e_MaxJoys then Exit;
   Result := JOYK_BEG + id*e_MaxJoyBtns + btn;
 end;
 
 function e_JoyAxisToKey(id: Word; ax: Byte; dir: Byte): Word;
 begin
   Result := 0;
   Result := JOYK_BEG + id*e_MaxJoyBtns + btn;
 end;
 
 function e_JoyAxisToKey(id: Word; ax: Byte; dir: Byte): Word;
 begin
   Result := 0;
-  if id >= Length(Joysticks) then Exit;
+  if id >= e_MaxJoys then Exit;
   Result := JOYA_BEG + id*e_MaxJoyAxes*2 + ax*2 + dir;
 end;
 
 function e_JoyHatToKey(id: Word; hat: Byte; dir: Byte): Word;
 begin
   Result := 0;
   Result := JOYA_BEG + id*e_MaxJoyAxes*2 + ax*2 + dir;
 end;
 
 function e_JoyHatToKey(id: Word; hat: Byte; dir: Byte): Word;
 begin
   Result := 0;
-  if id >= Length(Joysticks) then Exit;
+  if id >= e_MaxJoys then Exit;
   Result := JOYH_BEG + id*e_MaxJoyHats*4 + hat*4 + dir;
 end;
 
   Result := JOYH_BEG + id*e_MaxJoyHats*4 + hat*4 + dir;
 end;
 
index 69158eae2eb830bacfa8b785e2f09b35b28dde35..388b4524d97d6108a536d865614ce2e383b70614 100644 (file)
@@ -48,12 +48,14 @@ procedure g_Console_Add (L: AnsiString; show: Boolean=false);
 procedure g_Console_Clear ();
 function  g_Console_CommandBlacklisted (C: AnsiString): Boolean;
 procedure g_Console_ReadConfig (filename: String);
 procedure g_Console_Clear ();
 function  g_Console_CommandBlacklisted (C: AnsiString): Boolean;
 procedure g_Console_ReadConfig (filename: String);
+procedure g_Console_WriteConfig (filename: String);
 
 function  g_Console_Interactive: Boolean;
 function  g_Console_Action (action: Integer): Boolean;
 function  g_Console_FindBind (n: Integer; cmd: AnsiString): Integer;
 procedure g_Console_BindKey (key: Integer; cmd: AnsiString);
 procedure g_Console_ProcessBind (key: Integer; down: Boolean);
 
 function  g_Console_Interactive: Boolean;
 function  g_Console_Action (action: Integer): Boolean;
 function  g_Console_FindBind (n: Integer; cmd: AnsiString): Integer;
 procedure g_Console_BindKey (key: Integer; cmd: AnsiString);
 procedure g_Console_ProcessBind (key: Integer; down: Boolean);
+procedure g_Console_ResetBinds;
 
 procedure conwriteln (const s: AnsiString; show: Boolean=false);
 procedure conwritefln (const s: AnsiString; args: array of const; show: Boolean=false);
 
 procedure conwriteln (const s: AnsiString; show: Boolean=false);
 procedure conwritefln (const s: AnsiString; args: array of const; show: Boolean=false);
@@ -513,14 +515,20 @@ begin
   begin
     // exec <filename>
     if Length(p) = 2 then
   begin
     // exec <filename>
     if Length(p) = 2 then
-    begin
-      s := GameDir + '/' + p[1];
-      g_Console_ReadConfig(s);
-    end
+      g_Console_ReadConfig(GameDir + '/' + p[1])
     else
       g_Console_Add('exec <script file>');
   end;
 
     else
       g_Console_Add('exec <script file>');
   end;
 
+  if cmd = 'writeconfig' then
+  begin
+    // writeconfig <filename>
+    if Length(p) = 2 then
+      g_Console_WriteConfig(GameDir + '/' + p[1])
+    else
+      g_Console_Add('writeconfig <file>');
+  end;
+
   if (cmd = 'ver') or (cmd = 'version') then
   begin
     conwriteln('Doom 2D: Forever v. ' + GAME_VERSION);
   if (cmd = 'ver') or (cmd = 'version') then
   begin
     conwriteln('Doom 2D: Forever v. ' + GAME_VERSION);
@@ -592,9 +600,6 @@ begin
     else
       g_Console_Add('call <alias name>');
   end;
     else
       g_Console_Add('call <alias name>');
   end;
-
-  if cmd = '//' then
-    Exit;
 end;
 
 procedure WhitelistCommand(cmd: AnsiString);
 end;
 
 procedure WhitelistCommand(cmd: AnsiString);
@@ -626,7 +631,7 @@ begin
       i := 0;
       while (i < e_MaxInputKeys) and (key <> LowerCase(e_KeyNames[i])) do inc(i);
       if i < e_MaxInputKeys then
       i := 0;
       while (i < e_MaxInputKeys) and (key <> LowerCase(e_KeyNames[i])) do inc(i);
       if i < e_MaxInputKeys then
-        gInputBinds[i].commands := ParseAlias(p[2])
+        g_Console_BindKey(i, p[2])
     end;
   'bindlist':
     for i := 0 to e_MaxInputKeys - 1 do
     end;
   'bindlist':
     for i := 0 to e_MaxInputKeys - 1 do
@@ -636,7 +641,7 @@ begin
         act := gInputBinds[i].commands[0];
         for j := 1 to High(gInputBinds[i].commands) do
           act := act + ' ;' + gInputBinds[i].commands[j];
         act := gInputBinds[i].commands[0];
         for j := 1 to High(gInputBinds[i].commands) do
           act := act + ' ;' + gInputBinds[i].commands[j];
-        g_Console_Add(LowerCase(e_KeyNames[i]) + ' "' + act + '"')
+        g_Console_Add('"' + LowerCase(e_KeyNames[i]) + '" "' + act + '"')
       end
     end;
   'unbind':
       end
     end;
   'unbind':
@@ -647,7 +652,7 @@ begin
       i := 0;
       while (i < e_MaxInputKeys) and (key <> LowerCase(e_KeyNames[i])) do inc(i);
       if i < e_MaxInputKeys then
       i := 0;
       while (i < e_MaxInputKeys) and (key <> LowerCase(e_KeyNames[i])) do inc(i);
       if i < e_MaxInputKeys then
-        gInputBinds[i].commands := nil
+        g_Console_BindKey(i, '')
     end;
   'unbindall':
     for i := 0 to e_MaxInputKeys - 1 do
     end;
   'unbindall':
     for i := 0 to e_MaxInputKeys - 1 do
@@ -706,7 +711,7 @@ procedure AddAction (cmd: AnsiString; action: Integer; help: AnsiString = ''; hi
   end;
 
 begin
   end;
 
 begin
-  ASSERT(action >= 0);
+  ASSERT(action >= FIRST_ACTION);
   ASSERT(action <= LAST_ACTION);
   for s in PrefixList do
   begin
   ASSERT(action <= LAST_ACTION);
   for s in PrefixList do
   begin
@@ -742,18 +747,6 @@ begin
   AddCommand('unbindall', BindCommands);
   AddCommand('bindkeys', BindCommands);
 
   AddCommand('unbindall', BindCommands);
   AddCommand('bindkeys', BindCommands);
 
-  AddAction('jump', ACTION_JUMP);
-  AddAction('moveleft', ACTION_MOVELEFT);
-  AddAction('moveright', ACTION_MOVERIGHT);
-  AddAction('lookup', ACTION_LOOKUP);
-  AddAction('lookdown', ACTION_LOOKDOWN);
-  AddAction('attack', ACTION_ATTACK);
-  AddAction('scores', ACTION_SCORES);
-  AddAction('activate', ACTION_ACTIVATE);
-  AddAction('strafe', ACTION_STRAFE);
-  AddAction('weapnext', ACTION_WEAPNEXT);
-  AddAction('weapprev', ACTION_WEAPPREV);
-
   AddCommand('clear', ConsoleCommands, 'clear console');
   AddCommand('clearhistory', ConsoleCommands);
   AddCommand('showhistory', ConsoleCommands);
   AddCommand('clear', ConsoleCommands, 'clear console');
   AddCommand('clearhistory', ConsoleCommands);
   AddCommand('showhistory', ConsoleCommands);
@@ -763,6 +756,7 @@ begin
   AddCommand('echo', ConsoleCommands);
   AddCommand('dump', ConsoleCommands);
   AddCommand('exec', ConsoleCommands);
   AddCommand('echo', ConsoleCommands);
   AddCommand('dump', ConsoleCommands);
   AddCommand('exec', ConsoleCommands);
+  AddCommand('writeconfig', ConsoleCommands);
   AddCommand('alias', ConsoleCommands);
   AddCommand('call', ConsoleCommands);
   AddCommand('ver', ConsoleCommands);
   AddCommand('alias', ConsoleCommands);
   AddCommand('call', ConsoleCommands);
   AddCommand('ver', ConsoleCommands);
@@ -784,7 +778,6 @@ begin
   AddCommand('p2_name', GameCVars);
   AddCommand('p1_color', GameCVars);
   AddCommand('p2_color', GameCVars);
   AddCommand('p2_name', GameCVars);
   AddCommand('p1_color', GameCVars);
   AddCommand('p2_color', GameCVars);
-  AddCommand('r_showfps', GameCVars);
   AddCommand('r_showtime', GameCVars);
   AddCommand('r_showscore', GameCVars);
   AddCommand('r_showlives', GameCVars);
   AddCommand('r_showtime', GameCVars);
   AddCommand('r_showscore', GameCVars);
   AddCommand('r_showlives', GameCVars);
@@ -872,6 +865,18 @@ begin
   AddCommand('aimline', GameCheats);
   AddCommand('automap', GameCheats);
 
   AddCommand('aimline', GameCheats);
   AddCommand('automap', GameCheats);
 
+  AddAction('jump', ACTION_JUMP);
+  AddAction('moveleft', ACTION_MOVELEFT);
+  AddAction('moveright', ACTION_MOVERIGHT);
+  AddAction('lookup', ACTION_LOOKUP);
+  AddAction('lookdown', ACTION_LOOKDOWN);
+  AddAction('attack', ACTION_ATTACK);
+  AddAction('scores', ACTION_SCORES);
+  AddAction('activate', ACTION_ACTIVATE);
+  AddAction('strafe', ACTION_STRAFE);
+  AddAction('weapnext', ACTION_WEAPNEXT);
+  AddAction('weapprev', ACTION_WEAPPREV);
+
   WhitelistCommand('say');
   WhitelistCommand('tell');
   WhitelistCommand('overtime');
   WhitelistCommand('say');
   WhitelistCommand('tell');
   WhitelistCommand('overtime');
@@ -897,6 +902,7 @@ begin
   WhitelistCommand('g_scorelimit');
   WhitelistCommand('g_timelimit');
 
   WhitelistCommand('g_scorelimit');
   WhitelistCommand('g_timelimit');
 
+  g_Console_ResetBinds;
   g_Console_ReadConfig(GameDir + '/dfconfig.cfg');
   g_Console_ReadConfig(GameDir + '/autoexec.cfg');
 
   g_Console_ReadConfig(GameDir + '/dfconfig.cfg');
   g_Console_ReadConfig(GameDir + '/autoexec.cfg');
 
@@ -1601,9 +1607,11 @@ end;
 
 procedure g_Console_BindKey (key: Integer; cmd: AnsiString);
 begin
 
 procedure g_Console_BindKey (key: Integer; cmd: AnsiString);
 begin
+  //e_LogWritefln('bind "%s" "%s" <%s>', [LowerCase(e_KeyNames[key]), cmd, key]);
   ASSERT(key >= 0);
   ASSERT(key < e_MaxInputKeys);
   ASSERT(key >= 0);
   ASSERT(key < e_MaxInputKeys);
-  gInputBinds[key].commands := ParseAlias(cmd)
+  if key > 0 then
+    gInputBinds[key].commands := ParseAlias(cmd)
 end;
 
 function g_Console_FindBind (n: Integer; cmd: AnsiString): Integer;
 end;
 
 function g_Console_FindBind (n: Integer; cmd: AnsiString): Integer;
@@ -1651,6 +1659,84 @@ begin
   end
 end;
 
   end
 end;
 
+procedure g_Console_ResetBinds;
+  var i: Integer;
+begin
+  for i := 0 to e_MaxInputKeys - 1 do
+    g_Console_BindKey(i, '');
+
+  g_Console_BindKey(IK_A, '+p1_moveleft');
+  g_Console_BindKey(IK_D, '+p1_moveright');
+  g_Console_BindKey(IK_W, '+p1_lookup');
+  g_Console_BindKey(IK_S, '+p1_lookdown');
+  g_Console_BindKey(IK_SPACE, '+p1_jump');
+  g_Console_BindKey(IK_H, '+p1_attack');
+  g_Console_BindKey(IK_J, '+p1_activate');
+  g_Console_BindKey(IK_E, '+p1_weapnext');
+  g_Console_BindKey(IK_Q, '+p1_weapprev');
+  g_Console_BindKey(IK_ALT, '+p1_strafe');
+  g_Console_BindKey(IK_1, 'p1_weapon 1');
+  g_Console_BindKey(IK_2, 'p1_weapon 2');
+  g_Console_BindKey(IK_3, 'p1_weapon 3');
+  g_Console_BindKey(IK_4, 'p1_weapon 4');
+  g_Console_BindKey(IK_5, 'p1_weapon 5');
+  g_Console_BindKey(IK_6, 'p1_weapon 6');
+  g_Console_BindKey(IK_7, 'p1_weapon 7');
+  g_Console_BindKey(IK_8, 'p1_weapon 8');
+  g_Console_BindKey(IK_9, 'p1_weapon 9');
+  g_Console_BindKey(IK_0, 'p1_weapon 10');
+  g_Console_BindKey(IK_MINUS, 'p1_weapon 11');
+  g_Console_BindKey(IK_T, 'togglechat');
+  g_Console_BindKey(IK_Y, 'toggleteamchat');
+  g_Console_BindKey(IK_F11, 'screenshot');
+  g_Console_BindKey(IK_TAB, '+p1_scores');
+  g_Console_BindKey(IK_PAUSE, 'pause');
+  g_Console_BindKey(IK_F1, 'vote');
+
+  (* for i := 0 to e_MaxJoys - 1 do *)
+  for i := 0 to 1 do
+  begin
+    g_Console_BindKey(e_JoyAxisToKey(i, 0, 0), '+p' + IntToStr(i mod 2 + 1) + '_moveleft');
+    g_Console_BindKey(e_JoyAxisToKey(i, 0, 1), '+p' + IntToStr(i mod 2 + 1) + '_moveright');
+    g_Console_BindKey(e_JoyAxisToKey(i, 1, 0), '+p' + IntToStr(i mod 2 + 1) + '_lookup');
+    g_Console_BindKey(e_JoyAxisToKey(i, 1, 1), '+p' + IntToStr(i mod 2 + 1) + '_lookdown');
+    g_Console_BindKey(e_JoyButtonToKey(i, 2), '+p' + IntToStr(i mod 2 + 1) + '_jump');
+    g_Console_BindKey(e_JoyButtonToKey(i, 0), '+p' + IntToStr(i mod 2 + 1) + '_attack');
+    g_Console_BindKey(e_JoyButtonToKey(i, 3), '+p' + IntToStr(i mod 2 + 1) + '_activate');
+    g_Console_BindKey(e_JoyButtonToKey(i, 1), '+p' + IntToStr(i mod 2 + 1) + '_weapnext');
+    g_Console_BindKey(e_JoyButtonToKey(i, 4), '+p' + IntToStr(i mod 2 + 1) + '_weapprev');
+    g_Console_BindKey(e_JoyButtonToKey(i, 7), '+p' + IntToStr(i mod 2 + 1) + '_strafe');
+  end;
+
+  g_Console_BindKey(VK_LEFT, '+moveleft');
+  g_Console_BindKey(VK_RIGHT, '+moveright');
+  g_Console_BindKey(VK_UP, '+lookup');
+  g_Console_BindKey(VK_DOWN, '+lookdown');
+  g_Console_BindKey(VK_JUMP, '+jump');
+  g_Console_BindKey(VK_FIRE, '+attack');
+  g_Console_BindKey(VK_OPEN, '+activate');
+  g_Console_BindKey(VK_NEXT, '+weapnext');
+  g_Console_BindKey(VK_PREV, '+weapprev');
+  g_Console_BindKey(VK_STRAFE, '+strafe');
+  g_Console_BindKey(VK_0, 'weapon 1');
+  g_Console_BindKey(VK_1, 'weapon 2');
+  g_Console_BindKey(VK_2, 'weapon 3');
+  g_Console_BindKey(VK_3, 'weapon 4');
+  g_Console_BindKey(VK_4, 'weapon 5');
+  g_Console_BindKey(VK_5, 'weapon 6');
+  g_Console_BindKey(VK_6, 'weapon 7');
+  g_Console_BindKey(VK_7, 'weapon 8');
+  g_Console_BindKey(VK_8, 'weapon 9');
+  g_Console_BindKey(VK_9, 'weapon 10');
+  g_Console_BindKey(VK_A, 'weapon 11');
+  g_Console_BindKey(VK_CHAT, 'togglechat');
+  g_Console_BindKey(VK_TEAM, 'toggleteamchat');
+  g_Console_BindKey(VK_PRINTSCR, 'screenshot');
+  g_Console_BindKey(VK_STATUS, '+scores');
+
+  // VK_CONSOLE
+  // VK_ESCAPE
+end;
 
 procedure g_Console_ReadConfig (filename: String);
   var f: TextFile; s: AnsiString; i, len: Integer;
 
 procedure g_Console_ReadConfig (filename: String);
   var f: TextFile; s: AnsiString; i, len: Integer;
@@ -1677,5 +1763,44 @@ begin
   end
 end;
 
   end
 end;
 
+procedure g_Console_WriteConfig (filename: String);
+  var f: TextFile; i, j: Integer; act: AnsiString;
+begin
+  AssignFile(f, filename);
+  Rewrite(f);
+  WriteLn(f, '// generated by doom2d, do not modify');
+  WriteLn(f, 'unbindall');
+  for i := 0 to e_MaxInputKeys - 1 do
+  begin
+    if Length(gInputBinds[i].commands) > 0 then
+    begin
+      act := gInputBinds[i].commands[0];
+      for j := 1 to High(gInputBinds[i].commands) do
+        act := act + '; ' + gInputBinds[i].commands[j];
+      WriteLn(f, 'bind "', LowerCase(e_KeyNames[i]), '" "', act, '"')
+    end
+  end;
+  for i := 0 to High(commands) do
+  begin
+    if not commands[i].cheat then
+    begin
+      if @commands[i].procEx = @boolVarHandler then
+      begin
+        if PBoolean(commands[i].ptr)^ then j := 1 else j := 0;
+        WriteLn(f, commands[i].cmd, ' "', j, '"')
+      end
+      else if @commands[i].procEx = @intVarHandler then
+      begin
+        WriteLn(f, commands[i].cmd, ' "', PInteger(commands[i].ptr)^, '"')
+      end
+      else if @commands[i].procEx = @singleVarHandler then
+      begin
+        WriteLn(f, commands[i].cmd, ' "', PVarSingle(commands[i].ptr).val^:0:6, '"')
+      end
+    end
+  end;
+  CloseFile(f)
+end;
+
 
 end.
 
 end.
index 06afe8e3c5190102f67d0ee515b033f128e1dc13..ad9330d7cdd293233479985cf73ac3852f1f84b2 100644 (file)
@@ -325,6 +325,7 @@ var
   gDelayedEvents: Array of TDelayedEvent;
   gUseChatSounds: Boolean = True;
   gChatSounds: Array of TChatSound;
   gDelayedEvents: Array of TDelayedEvent;
   gUseChatSounds: Boolean = True;
   gChatSounds: Array of TChatSound;
+  gSelectWeapon: Array [0..1] of Integer = (-1, -1); // [player]
 
   g_dbg_ignore_bounds: Boolean = false;
   r_smallmap_h: Integer = 0; // 0: left; 1: center; 2: right
 
   g_dbg_ignore_bounds: Boolean = false;
   r_smallmap_h: Integer = 0; // 0: left; 1: center; 2: right
@@ -381,7 +382,6 @@ uses
 
 var
   hasPBarGfx: Boolean = false;
 
 var
   hasPBarGfx: Boolean = false;
-  nextQueueWeapon: Array [0..1] of Integer = (-1, -1); // [player]
 
 
 // ////////////////////////////////////////////////////////////////////////// //
 
 
 // ////////////////////////////////////////////////////////////////////////// //
@@ -1561,10 +1561,10 @@ begin
   if gPlayerAction[p, ACTION_WEAPPREV] then plr.PressKey(KEY_PREVWEAPON);
   if gPlayerAction[p, ACTION_ACTIVATE] then plr.PressKey(KEY_OPEN);
 
   if gPlayerAction[p, ACTION_WEAPPREV] then plr.PressKey(KEY_PREVWEAPON);
   if gPlayerAction[p, ACTION_ACTIVATE] then plr.PressKey(KEY_OPEN);
 
-  if nextQueueWeapon[p] >= 0 then
+  if gSelectWeapon[p] >= 0 then
   begin
   begin
-    plr.QueueWeaponSwitch(nextQueueWeapon[p]);
-    nextQueueWeapon[p] := -1
+    plr.QueueWeaponSwitch(gSelectWeapon[p]);
+    gSelectWeapon[p] := -1
   end;
 
   // HACK: add dynlight here
   end;
 
   // HACK: add dynlight here
@@ -5154,18 +5154,7 @@ var
 begin
   stat := nil;
   cmd := LowerCase(P[0]);
 begin
   stat := nil;
   cmd := LowerCase(P[0]);
-  if cmd = 'r_showfps' then
-  begin
-    if (Length(P) > 1) and
-       ((P[1] = '1') or (P[1] = '0')) then
-      gShowFPS := (P[1][1] = '1');
-
-    if gShowFPS then
-      g_Console_Add(_lc[I_MSG_SHOW_FPS_ON])
-    else
-      g_Console_Add(_lc[I_MSG_SHOW_FPS_OFF]);
-  end
-  else if (cmd = 'g_friendlyfire') and not g_Game_IsClient then
+  if (cmd = 'g_friendlyfire') and not g_Game_IsClient then
   begin
     with gGameSettings do
     begin
   begin
     with gGameSettings do
     begin
@@ -6834,7 +6823,7 @@ begin
     begin
       a := WP_FIRST + StrToInt(p[1]) - 1;
       if (a >= WP_FIRST) and (a <= WP_LAST) then
     begin
       a := WP_FIRST + StrToInt(p[1]) - 1;
       if (a >= WP_FIRST) and (a <= WP_LAST) then
-        nextQueueWeapon[0] := a
+        gSelectWeapon[0] := a
     end
   end
   else if (cmd = 'p1_weapon') or (cmd = 'p2_weapon') then
     end
   end
   else if (cmd = 'p1_weapon') or (cmd = 'p2_weapon') then
@@ -6844,7 +6833,7 @@ begin
       a := WP_FIRST + StrToInt(p[1]) - 1;
       b := ord(cmd[2]) - ord('1');
       if (a >= WP_FIRST) and (a <= WP_LAST) then
       a := WP_FIRST + StrToInt(p[1]) - 1;
       b := ord(cmd[2]) - ord('1');
       if (a >= WP_FIRST) and (a <= WP_LAST) then
-        nextQueueWeapon[b] := a
+        gSelectWeapon[b] := a
     end
   end
 // ÃŠÃ®Ã¬Ã Ã­Ã¤Ã» Ã‘âîåé Ã¨Ã£Ã°Ã»:
     end
   end
 // ÃŠÃ®Ã¬Ã Ã­Ã¤Ã» Ã‘âîåé Ã¨Ã£Ã°Ã»:
@@ -7863,4 +7852,6 @@ begin
 
   conRegVar('r_smallmap_align_h', @r_smallmap_h, 'halign: 0: left; 1: center; 2: right', 'horizontal aligning of small maps');
   conRegVar('r_smallmap_align_v', @r_smallmap_v, 'valign: 0: top; 1: center; 2: bottom', 'vertial aligning of small maps');
 
   conRegVar('r_smallmap_align_h', @r_smallmap_h, 'halign: 0: left; 1: center; 2: right', 'horizontal aligning of small maps');
   conRegVar('r_smallmap_align_v', @r_smallmap_v, 'valign: 0: top; 1: center; 2: bottom', 'vertial aligning of small maps');
+
+  conRegVar('r_showfps', @gShowFPS, 'draw fps counter', 'draw fps counter');
 end.
 end.
index d4fb7389faef624027406643c62c399e94b337cf..aea8b499a6a662a22692eb04d8ec350ea3ed04fc 100644 (file)
@@ -168,11 +168,11 @@ begin
   with menu do
   begin
     g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
   with menu do
   begin
     g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
-    g_Console_BindKey(g_Console_FindBind(1, '+scores'), '');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_scores'), '');
     g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
     g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
     g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_SCREENSHOT])).Key, 'screenshot');
     g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
     g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
     g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_SCREENSHOT])).Key, 'screenshot');
-    g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STAT])).Key, '+scores');
+    g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STAT])).Key, '+p1_scores');
     g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_CHAT])).Key, 'togglechat');
     g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_TEAMCHAT])).Key, 'toggleteamchat');
   end;
     g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_CHAT])).Key, 'togglechat');
     g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_TEAMCHAT])).Key, 'toggleteamchat');
   end;
@@ -180,47 +180,47 @@ begin
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
   with menu do
   begin
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
   with menu do
   begin
-    g_Console_BindKey(g_Console_FindBind(1, '+moveright'), '');
-    g_Console_BindKey(g_Console_FindBind(1, '+moveleft'), '');
-    g_Console_BindKey(g_Console_FindBind(1, '+lookup'), '');
-    g_Console_BindKey(g_Console_FindBind(1, '+lookdown'), '');
-    g_Console_BindKey(g_Console_FindBind(1, '+attack'), '');
-    g_Console_BindKey(g_Console_FindBind(1, '+jump'), '');
-    g_Console_BindKey(g_Console_FindBind(1, '+weapnext'), '');
-    g_Console_BindKey(g_Console_FindBind(1, '+weapprev'), '');
-    g_Console_BindKey(g_Console_FindBind(1, '+activate'), '');
-    g_Console_BindKey(g_Console_FindBind(1, '+strafe'), '');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0, '+moveright');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0, '+moveleft');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0, '+lookup');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0, '+lookdown');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0, '+attack');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0, '+jump');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0, '+weapnext');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0, '+weapprev');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0, '+activate');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0, '+strafe');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright'), '');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft'), '');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup'), '');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown'), '');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_attack'), '');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_jump'), '');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext'), '');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev'), '');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_activate'), '');
+    g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe'), '');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0, '+p1_moveright');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0, '+p1_moveleft');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0, '+p1_lookup');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0, '+p1_lookdown');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0, '+p1_attack');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0, '+p1_jump');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0, '+p1_weapnext');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0, '+p1_weapprev');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0, '+p1_activate');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0, '+p1_strafe');
     // second set
     // second set
-    g_Console_BindKey(g_Console_FindBind(2, '+moveright'), '');
-    g_Console_BindKey(g_Console_FindBind(2, '+moveleft'), '');
-    g_Console_BindKey(g_Console_FindBind(2, '+lookup'), '');
-    g_Console_BindKey(g_Console_FindBind(2, '+lookdown'), '');
-    g_Console_BindKey(g_Console_FindBind(2, '+attack'), '');
-    g_Console_BindKey(g_Console_FindBind(2, '+jump'), '');
-    g_Console_BindKey(g_Console_FindBind(2, '+weapnext'), '');
-    g_Console_BindKey(g_Console_FindBind(2, '+weapprev'), '');
-    g_Console_BindKey(g_Console_FindBind(2, '+activate'), '');
-    g_Console_BindKey(g_Console_FindBind(2, '+strafe'), '');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1, '+moveright');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1, '+moveleft');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1, '+lookup');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1, '+lookdown');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1, '+attack');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1, '+jump');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1, '+weapnext');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1, '+weapprev');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1, '+activate');
-    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1, '+strafe');
+    g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright'), '');
+    g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft'), '');
+    g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup'), '');
+    g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown'), '');
+    g_Console_BindKey(g_Console_FindBind(2, '+p1_attack'), '');
+    g_Console_BindKey(g_Console_FindBind(2, '+p1_jump'), '');
+    g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext'), '');
+    g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev'), '');
+    g_Console_BindKey(g_Console_FindBind(2, '+p1_activate'), '');
+    g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe'), '');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1, '+p1_moveright');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1, '+p1_moveleft');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1, '+p1_lookup');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1, '+p1_lookdown');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1, '+p1_attack');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1, '+p1_jump');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1, '+p1_weapnext');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1, '+p1_weapprev');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1, '+p1_activate');
+    g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1, '+p1_strafe');
   end;
 
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
   end;
 
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
@@ -228,10 +228,10 @@ begin
   begin
     for i := WP_FIRST to WP_LAST do
     begin
   begin
     for i := WP_FIRST to WP_LAST do
     begin
-      g_Console_BindKey(g_Console_FindBind(1, 'weapon ' + IntToStr(i + 1)), '');
-      g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0, 'weapon ' + IntToStr(i + 1));
-      g_Console_BindKey(g_Console_FindBind(2, 'weapon ' + IntToStr(i + 1)), '');
-      g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1, 'weapon ' + IntToStr(i + 1));
+      g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i + 1)), '');
+      g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0, 'p1_weapon ' + IntToStr(i + 1));
+      g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i + 1)), '');
+      g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1, 'p1_weapon ' + IntToStr(i + 1));
     end;
   end;
 
     end;
   end;
 
@@ -368,6 +368,7 @@ begin
   if g_Game_IsClient then MC_SEND_PlayerSettings;
 
   g_Options_Write(GameDir+'/'+CONFIG_FILENAME);
   if g_Game_IsClient then MC_SEND_PlayerSettings;
 
   g_Options_Write(GameDir+'/'+CONFIG_FILENAME);
+  g_Console_WriteConfig(GameDir + '/dfconfig.cfg');
 end;
 
 procedure ReadOptions();
 end;
 
 procedure ReadOptions();
@@ -421,27 +422,27 @@ begin
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
   with menu do
   begin
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
   with menu do
   begin
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0 := g_Console_FindBind(1, '+moveright');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0 := g_Console_FindBind(1, '+moveleft');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0 := g_Console_FindBind(1, '+lookup');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0 := g_Console_FindBind(1, '+lookdown');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0 := g_Console_FindBind(1, '+attack');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0 := g_Console_FindBind(1, '+jump');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0 := g_Console_FindBind(1, '+weapnext');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0 := g_Console_FindBind(1, '+weapprev');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0 := g_Console_FindBind(1, '+activate');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0 := g_Console_FindBind(1, '+strafe');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0 := g_Console_FindBind(1, '+p1_moveright');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0 := g_Console_FindBind(1, '+p1_moveleft');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0 := g_Console_FindBind(1, '+p1_lookup');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0 := g_Console_FindBind(1, '+p1_lookdown');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0 := g_Console_FindBind(1, '+p1_attack');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0 := g_Console_FindBind(1, '+p1_jump');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0 := g_Console_FindBind(1, '+p1_weapnext');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0 := g_Console_FindBind(1, '+p1_weapprev');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0 := g_Console_FindBind(1, '+p1_activate');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0 := g_Console_FindBind(1, '+p1_strafe');
     // second set
     // second set
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1 := g_Console_FindBind(2, '+moveright');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1 := g_Console_FindBind(2, '+moveleft');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1 := g_Console_FindBind(2, '+lookup');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1 := g_Console_FindBind(2, '+lookdown');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1 := g_Console_FindBind(2, '+attack');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1 := g_Console_FindBind(2, '+jump');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1 := g_Console_FindBind(2,'+weapnext');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1 := g_Console_FindBind(2, '+weapprev');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1 := g_Console_FindBind(2, '+activate');
-    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1 := g_Console_FindBind(2, '+strafe');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1 := g_Console_FindBind(2, '+p1_moveright');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1 := g_Console_FindBind(2, '+p1_moveleft');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1 := g_Console_FindBind(2, '+p1_lookup');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1 := g_Console_FindBind(2, '+p1_lookdown');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1 := g_Console_FindBind(2, '+p1_attack');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1 := g_Console_FindBind(2, '+p1_jump');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1 := g_Console_FindBind(2,'+p1_weapnext');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1 := g_Console_FindBind(2, '+p1_weapprev');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1 := g_Console_FindBind(2, '+p1_activate');
+    TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1 := g_Console_FindBind(2, '+p1_strafe');
   end;
 
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
   end;
 
   menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
@@ -449,8 +450,8 @@ begin
   begin
     for i := WP_FIRST to WP_LAST do
     begin
   begin
     for i := WP_FIRST to WP_LAST do
     begin
-      TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0 := g_Console_FindBind(1, 'weapon ' + IntToStr(i + 1));
-      TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1 := g_Console_FindBind(2, 'weapon ' + IntToStr(i + 1));
+      TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0 := g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i + 1));
+      TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1 := g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i + 1));
     end;
   end;
 
     end;
   end;
 
@@ -515,7 +516,7 @@ begin
   with menu do
   begin
     TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_SCREENSHOT])).Key := g_Console_FindBind(1, 'screenshot');
   with menu do
   begin
     TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_SCREENSHOT])).Key := g_Console_FindBind(1, 'screenshot');
-    TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STAT])).Key := g_Console_FindBind(1, '+scores');
+    TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STAT])).Key := g_Console_FindBind(1, '+p1_scores');
     TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_CHAT])).Key := g_Console_FindBind(1, 'togglechat');
     TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_TEAMCHAT])).Key := g_Console_FindBind(1, 'toggleteamchat');
   end;
     TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_CHAT])).Key := g_Console_FindBind(1, 'togglechat');
     TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_TEAMCHAT])).Key := g_Console_FindBind(1, 'toggleteamchat');
   end;
index a7219124df1b26292b2d87aafaa4130125879e4e..e84d82965bcc48850e4d971a28234fb4adbf7a18 100644 (file)
@@ -2781,20 +2781,12 @@ begin
   g_Net_Client_Send(True, NET_CHAN_CHAT);
 end;
 
   g_Net_Client_Send(True, NET_CHAN_CHAT);
 end;
 
-function isKeyPressed (key1: Word; key2: Word): Boolean;
-begin
-  if (key1 <> 0) and e_KeyPressed(key1) then begin result := true; exit; end;
-  if (key2 <> 0) and e_KeyPressed(key2) then begin result := true; exit; end;
-  result := false;
-end;
-
 procedure MC_SEND_PlayerPos();
 var
   kByte: Word;
   Predict: Boolean;
   strafeDir: Byte;
   WeaponSelect: Word = 0;
 procedure MC_SEND_PlayerPos();
 var
   kByte: Word;
   Predict: Boolean;
   strafeDir: Byte;
   WeaponSelect: Word = 0;
-  I: Integer;
 begin
   if not gGameOn then Exit;
   if gPlayers = nil then Exit;
 begin
   if not gGameOn then Exit;
   if gPlayers = nil then Exit;
@@ -2807,62 +2799,70 @@ begin
   begin
     strafeDir := P1MoveButton shr 4;
     P1MoveButton := P1MoveButton and $0F;
   begin
     strafeDir := P1MoveButton shr 4;
     P1MoveButton := P1MoveButton and $0F;
-    with gGameControls.P1Control do
+
+    if gPlayerAction[0, ACTION_MOVELEFT] and (not gPlayerAction[0, ACTION_MOVERIGHT]) then
+      P1MoveButton := 1
+    else if (not gPlayerAction[0, ACTION_MOVELEFT]) and gPlayerAction[0, ACTION_MOVERIGHT] then
+      P1MoveButton := 2
+    else if (not gPlayerAction[0, ACTION_MOVELEFT]) and (not gPlayerAction[0, ACTION_MOVERIGHT]) then
+      P1MoveButton := 0;
+
+    // strafing
+    if gPlayerAction[0, ACTION_STRAFE] then
+    begin
+      // new strafe mechanics
+      if (strafeDir = 0) then strafeDir := P1MoveButton; // start strafing
+      // now set direction according to strafe (reversed)
+           if (strafeDir = 2) then gPlayer1.SetDirection(TDirection.D_LEFT)
+      else if (strafeDir = 1) then gPlayer1.SetDirection(TDirection.D_RIGHT);
+    end
+    else
     begin
     begin
-           if isKeyPressed(KeyLeft, KeyLeft2) and (not isKeyPressed(KeyRight, KeyRight2)) then P1MoveButton := 1
-      else if (not isKeyPressed(KeyLeft, KeyLeft2)) and isKeyPressed(KeyRight, KeyRight2) then P1MoveButton := 2
-      else if (not isKeyPressed(KeyLeft, KeyLeft2)) and (not isKeyPressed(KeyRight, KeyRight2)) then P1MoveButton := 0;
+      if (P1MoveButton = 2) and gPlayerAction[0, ACTION_MOVELEFT] then
+        gPlayer1.SetDirection(TDirection.D_LEFT)
+      else if (P1MoveButton = 1) and gPlayerAction[0, ACTION_MOVERIGHT] then
+        gPlayer1.SetDirection(TDirection.D_RIGHT)
+      else if P1MoveButton <> 0 then
+        gPlayer1.SetDirection(TDirection(P1MoveButton-1));
+    end;
 
 
-      // strafing
-      if isKeyPressed(KeyStrafe, KeyStrafe2) then
-      begin
-        // new strafe mechanics
-        if (strafeDir = 0) then strafeDir := P1MoveButton; // start strafing
-        // now set direction according to strafe (reversed)
-             if (strafeDir = 2) then gPlayer1.SetDirection(TDirection.D_LEFT)
-        else if (strafeDir = 1) then gPlayer1.SetDirection(TDirection.D_RIGHT);
-      end
-      else
-      begin
-             if (P1MoveButton = 2) and isKeyPressed(KeyLeft, KeyLeft2) then gPlayer1.SetDirection(TDirection.D_LEFT)
-        else if (P1MoveButton = 1) and isKeyPressed(KeyRight, KeyRight2) then gPlayer1.SetDirection(TDirection.D_RIGHT)
-        else if P1MoveButton <> 0 then gPlayer1.SetDirection(TDirection(P1MoveButton-1));
-      end;
+    gPlayer1.ReleaseKeys;
+    if P1MoveButton = 1 then
+    begin
+      kByte := kByte or NET_KEY_LEFT;
+      if Predict then gPlayer1.PressKey(KEY_LEFT, 10000);
+    end;
+    if P1MoveButton = 2 then
+    begin
+      kByte := kByte or NET_KEY_RIGHT;
+      if Predict then gPlayer1.PressKey(KEY_RIGHT, 10000);
+    end;
+    if gPlayerAction[0, ACTION_LOOKUP] then
+    begin
+      kByte := kByte or NET_KEY_UP;
+      gPlayer1.PressKey(KEY_UP, 10000);
+    end;
+    if gPlayerAction[0, ACTION_LOOKDOWN] then
+    begin
+      kByte := kByte or NET_KEY_DOWN;
+      gPlayer1.PressKey(KEY_DOWN, 10000);
+    end;
+    if gPlayerAction[0, ACTION_JUMP] then
+    begin
+      kByte := kByte or NET_KEY_JUMP;
+      // gPlayer1.PressKey(KEY_JUMP, 10000); // TODO: Make a prediction option
+    end;
+    if gPlayerAction[0, ACTION_ATTACK] then kByte := kByte or NET_KEY_FIRE;
+    if gPlayerAction[0, ACTION_ACTIVATE] then kByte := kByte or NET_KEY_OPEN;
+    if gPlayerAction[0, ACTION_WEAPNEXT] then kByte := kByte or NET_KEY_NW;
+    if gPlayerAction[0, ACTION_WEAPPREV] then kByte := kByte or NET_KEY_PW;
 
 
-      gPlayer1.ReleaseKeys;
-      if P1MoveButton = 1 then
-      begin
-        kByte := kByte or NET_KEY_LEFT;
-        if Predict then gPlayer1.PressKey(KEY_LEFT, 10000);
-      end;
-      if P1MoveButton = 2 then
-      begin
-        kByte := kByte or NET_KEY_RIGHT;
-        if Predict then gPlayer1.PressKey(KEY_RIGHT, 10000);
-      end;
-      if isKeyPressed(KeyUp, KeyUp2) then
-      begin
-        kByte := kByte or NET_KEY_UP;
-        gPlayer1.PressKey(KEY_UP, 10000);
-      end;
-      if isKeyPressed(KeyDown, KeyDown2) then
-      begin
-        kByte := kByte or NET_KEY_DOWN;
-        gPlayer1.PressKey(KEY_DOWN, 10000);
-      end;
-      if isKeyPressed(KeyJump, KeyJump2) then
-      begin
-        kByte := kByte or NET_KEY_JUMP;
-        // gPlayer1.PressKey(KEY_JUMP, 10000); // TODO: Make a prediction option
-      end;
-      if isKeyPressed(KeyFire, KeyFire2) then kByte := kByte or NET_KEY_FIRE;
-      if isKeyPressed(KeyOpen, KeyOpen2) then kByte := kByte or NET_KEY_OPEN;
-      if isKeyPressed(KeyNextWeapon, KeyNextWeapon2) then kByte := kByte or NET_KEY_NW;
-      if isKeyPressed(KeyPrevWeapon, KeyPrevWeapon2) then kByte := kByte or NET_KEY_PW;
-      for I := 0 to High(KeyWeapon) do
-        if isKeyPressed(KeyWeapon[I], KeyWeapon2[I]) then
-          WeaponSelect := WeaponSelect or Word(1 shl I);
+    if gSelectWeapon[0] >= 0 then
+    begin
+      WeaponSelect := gSelectWeapon[0];
+      //gSelectWeapon[0] := -1
     end;
     end;
+
     // fix movebutton state
     P1MoveButton := P1MoveButton or (strafeDir shl 4);
   end
     // fix movebutton state
     P1MoveButton := P1MoveButton or (strafeDir shl 4);
   end
index 2e268a0c3e69317b51a1a76bf05b607082479889..fa88259bb75bd1c6a763e5afd59686293ca16368 100644 (file)
@@ -21,46 +21,6 @@ interface
 uses
   g_language, g_weapons;
 
 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;
-
 function GenPlayerName (n: Integer): String;
 
 procedure g_Options_SetDefault();
 function GenPlayerName (n: Integer): String;
 
 procedure g_Options_SetDefault();
@@ -76,7 +36,7 @@ procedure g_Options_Write_Net_Client(FileName: String);
 const DF_Default_Megawad_Start = 'megawads/DOOM2D.WAD:\MAP01';
 
 var
 const DF_Default_Megawad_Start = 'megawads/DOOM2D.WAD:\MAP01';
 
 var
-  gGameControls: TControls;
+//  gGameControls: TControls;
   gScreenWidth: Word;
   gScreenHeight: Word;
   gWinRealPosX: Integer;
   gScreenWidth: Word;
   gScreenHeight: Word;
   gWinRealPosX: Integer;
@@ -137,7 +97,7 @@ implementation
 
 uses
   {$INCLUDE ../nogl/noGLuses.inc}
 
 uses
   {$INCLUDE ../nogl/noGLuses.inc}
-  e_log, e_input, g_window, g_sound, g_gfx, g_player, Math,
+  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_items, wadreader, e_graphics, g_touch, SDL2, envvars;
 
   g_map, g_net, g_netmaster, SysUtils, CONFIG, g_game, g_main, e_texture,
   g_items, wadreader, e_graphics, g_touch, SDL2, envvars;
 
@@ -204,6 +164,7 @@ begin
   gTextureFilter := True;
   glLegacyNPOT := False;
   e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth) + ' h = ' + IntToStr(gScreenHeight));
   gTextureFilter := True;
   glLegacyNPOT := False;
   e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth) + ' h = ' + IntToStr(gScreenHeight));
+  g_Console_ResetBinds
 end;
 
 procedure g_Options_SetDefault();
 end;
 
 procedure g_Options_SetDefault();
@@ -224,56 +185,6 @@ begin
 
   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);
@@ -284,41 +195,6 @@ begin
     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);
@@ -335,12 +211,6 @@ begin
     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);
@@ -495,51 +365,6 @@ begin
   ReadInteger(gsSDLSampleRate, 'SDLSampleRate', 11025, 96000);
   ReadInteger(gsSDLBufferSize, 'SDLBufferSize', 64, 16384);
 
   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
@@ -553,42 +378,6 @@ 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
@@ -608,12 +397,6 @@ begin
     ReadInteger(e_JoystickDeadzones[i], 'Deadzone' + IntToStr(i))
   end;
 
     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';
   ReadInteger(i, 'MaxParticles', 0, 50000); g_GFX_SetMax(i);
   ReadInteger(i, 'MaxShells', 0, 600); g_Shells_SetMax(i);
   section := 'Game';
   ReadInteger(i, 'MaxParticles', 0, 50000); g_GFX_SetMax(i);
   ReadInteger(i, 'MaxShells', 0, 600); g_Shells_SetMax(i);
@@ -765,42 +548,8 @@ begin
   config.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate);
   config.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize);
 
   config.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate);
   config.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize);
 
-  with config, gGameControls.GameControls do
-  begin
-    WriteInt('GameControls', 'TakeScreenshot', TakeScreenshot);
-    WriteInt('GameControls', 'Stat', Stat);
-    WriteInt('GameControls', 'Chat', Chat);
-    WriteInt('GameControls', 'TeamChat', TeamChat);
-  end;
-
-  with config, gGameControls.P1Control, gPlayer1Settings do
+  with config, gPlayer1Settings do
   begin
   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);
@@ -809,34 +558,8 @@ begin
     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);
@@ -848,11 +571,6 @@ begin
   for i := 0 to e_MaxJoys-1 do
     config.WriteInt('Joysticks', 'Deadzone' + IntToStr(i), e_JoystickDeadzones[i]);
 
   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);