Changeset 615 for trunk/LocalPlayer


Ignore:
Timestamp:
Sep 14, 2024, 6:20:50 PM (3 months ago)
Author:
chronos
Message:
  • Added: Allow to scroll map with Ctrl+arrows/num keys.
Location:
trunk/LocalPlayer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/KeyBindings.pas

    r614 r615  
    117117  BRecover: TKeyBinding;
    118118  BUtilize: TKeyBinding;
    119   BMoveLeftDown: TKeyBinding;
    120   BMoveDown: TKeyBinding;
    121   BMoveRightDown: TKeyBinding;
    122   BMoveRight: TKeyBinding;
    123   BMoveRightUp: TKeyBinding;
    124   BMoveUp: TKeyBinding;
    125   BMoveLeftUp: TKeyBinding;
    126   BMoveLeft: TKeyBinding;
     119  BUnitMoveLeftDown: TKeyBinding;
     120  BUnitMoveDown: TKeyBinding;
     121  BUnitMoveRightDown: TKeyBinding;
     122  BUnitMoveRight: TKeyBinding;
     123  BUnitMoveRightUp: TKeyBinding;
     124  BUnitMoveUp: TKeyBinding;
     125  BUnitMoveLeftUp: TKeyBinding;
     126  BUnitMoveLeft: TKeyBinding;
     127  BMapMoveLeftDown: TKeyBinding;
     128  BMapMoveDown: TKeyBinding;
     129  BMapMoveRightDown: TKeyBinding;
     130  BMapMoveRight: TKeyBinding;
     131  BMapMoveRightUp: TKeyBinding;
     132  BMapMoveUp: TKeyBinding;
     133  BMapMoveLeftUp: TKeyBinding;
     134  BMapMoveLeft: TKeyBinding;
    127135
    128136
     
    382390  BRecover := AddItem('Recover', 'Recover', 'V');
    383391  BUtilize := AddItem('Utilize', 'Utilize', 'Z');
    384   BMoveLeftDown := AddItem('MoveLeftDown', 'Move unit left-down', 'Num1', 'End');
    385   BMoveDown := AddItem('MoveDown', 'Move unit down', 'Num2', 'Down');
    386   BMoveRightDown := AddItem('MoveRightDown', 'Move unit right-down', 'Num3', 'PgDn');
    387   BMoveRight := AddItem('MoveRight', 'Move unit right', 'Num6', 'Right');
    388   BMoveRightUp := AddItem('MoveRightUp', 'Move unit right-up', 'Num9', 'PgUp');
    389   BMoveUp := AddItem('MoveUp', 'Move unit up', 'Num8', 'Up');
    390   BMoveLeftUp := AddItem('MoveLeftUp', 'Move unit left-up', 'Num7', 'Home');
    391   BMoveLeft := AddItem('MoveLeft', 'Move unit left', 'Num4', 'Left');
     392  // Unit moves
     393  BUnitMoveLeftDown := AddItem('MoveLeftDown', 'Move unit left-down', 'Num1', 'End');
     394  BUnitMoveDown := AddItem('MoveDown', 'Move unit down', 'Num2', 'Down');
     395  BUnitMoveRightDown := AddItem('MoveRightDown', 'Move unit right-down', 'Num3', 'PgDn');
     396  BUnitMoveRight := AddItem('MoveRight', 'Move unit right', 'Num6', 'Right');
     397  BUnitMoveRightUp := AddItem('MoveRightUp', 'Move unit right-up', 'Num9', 'PgUp');
     398  BUnitMoveUp := AddItem('MoveUp', 'Move unit up', 'Num8', 'Up');
     399  BUnitMoveLeftUp := AddItem('MoveLeftUp', 'Move unit left-up', 'Num7', 'Home');
     400  BUnitMoveLeft := AddItem('MoveLeft', 'Move unit left', 'Num4', 'Left');
     401  // Map moves
     402  BMapMoveLeftDown := AddItem('MapMoveLeftDown', 'Move map left-down', 'Ctrl+Num1', 'Ctrl+End');
     403  BMapMoveDown := AddItem('MapMoveDown', 'Move map down', 'Ctrl+Num2', 'Ctrl+Down');
     404  BMapMoveRightDown := AddItem('MapMoveRightDown', 'Move map right-down', 'Ctrl+Num3', 'Ctrl+PgDn');
     405  BMapMoveRight := AddItem('MapMoveRight', 'Move map right', 'Ctrl+Num6', 'Ctrl+Right');
     406  BMapMoveRightUp := AddItem('MapMoveRightUp', 'Move map right-up', 'Ctrl+Num9', 'Ctrl+PgUp');
     407  BMapMoveUp := AddItem('MapMoveUp', 'Move map up', 'Ctrl+Num8', 'Ctrl+Up');
     408  BMapMoveLeftUp := AddItem('MapMoveLeftUp', 'Move map left-up', 'Ctrl+Num7', 'Ctrl+Home');
     409  BMapMoveLeft := AddItem('MapMoveLeft', 'Move map left', 'Ctrl+Num4', 'Ctrl+Left');
     410
    392411  SortAlpha;
    393412end;
     
    400419end.
    401420
    402 
  • trunk/LocalPlayer/Term.pas

    r614 r615  
    1313  Protocol, Tribes, PVSB, ClientTools, ScreenTools, BaseWin, Messg, ButtonBase,
    1414  LCLIntf, LCLType, Menus, SysUtils, Classes, DrawDlg, Types, Math,
    15   DateUtils, Platform, ButtonB, ButtonC, EOTButton, Area,
     15  DateUtils, Platform, ButtonB, ButtonC, EOTButton, Area, Help,
    1616  GraphicSet, MiniMap, IsoEngine, Wonders, TechTree, Enhance, Nego, CityType,
    1717  Diagram, CityScreen, Rates, Battle, NatStat, UnitStat, Draft, Select, MessgEx,
    18   Help,
    1918  {$IFDEF DPI}Dpi.Graphics, Dpi.Controls, Dpi.Forms, Dpi.Menus, Dpi.ExtCtrls,
    2019  Dpi.PixelPointer, Dpi.Common, System.UITypes{$ELSE}
     
    244243      Shift: TShiftState; X, Y: Integer);
    245244    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
     245    procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    246246    procedure mDisbandOrUtilizeClick(Sender: TObject);
    247247    procedure FormResize(Sender: TObject);
     
    270270    procedure mNamesClick(Sender: TObject);
    271271    procedure MapBtnClick(Sender: TObject);
    272     procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    273272    procedure CreateUnitClick(Sender: TObject);
    274273    procedure mSoundOffClick(Sender: TObject);
     
    71207119  end;
    71217120
     7121  procedure DoMoveMap(X, Y: Integer);
     7122  var
     7123    ScrollSpeed: Integer;
     7124  begin
     7125    if mScrollFast.Checked then ScrollSpeed := 2
     7126      else ScrollSpeed := 1;
     7127    if (X <> 0) or (Y <> 0) then begin
     7128      Scroll(X * ScrollSpeed, Y * ScrollSpeed);
     7129    end;
     7130  end;
     7131
    71227132var
    71237133  Time0, Time1: TDateTime;
     
    72417251      InitPopup(TerrainPopup);
    72427252      if mEnhance.Visible and mEnhance.Enabled then mEnhance.Click
    7243         else mEnhanceDef.Click
     7253        else mEnhanceDef.Click;
    72447254    end
    72457255    else if BGoOn.Test(ShortCut) then MenuClick_Check(UnitPopup, mGoOn)
     
    72677277    else if BRecover.Test(ShortCut) then MenuClick_Check(UnitPopup, mRecover)
    72687278    else if BUtilize.Test(ShortCut) then MenuClick_Check(UnitPopup, mUtilize)
    7269     else if BMoveLeftDown.Test(ShortCut) then DoMoveUnit(-1, 1)
    7270     else if BMoveDown.Test(ShortCut) then DoMoveUnit(0, 2)
    7271     else if BMoveRightDown.Test(ShortCut) then DoMoveUnit(1, 1)
    7272     else if BMoveLeft.Test(ShortCut) then DoMoveUnit(-2, 0)
    7273     else if BMoveRight.Test(ShortCut) then DoMoveUnit(2, 0)
    7274     else if BMoveLeftUp.Test(ShortCut) then DoMoveUnit(-1, -1)
    7275     else if BMoveUp.Test(ShortCut) then  DoMoveUnit(0, -2)
    7276     else if BMoveRightUp.Test(ShortCut) then DoMoveUnit(1, -1);
     7279    // Unit move
     7280    else if BUnitMoveLeftDown.Test(ShortCut) then DoMoveUnit(-1, 1)
     7281    else if BUnitMoveDown.Test(ShortCut) then DoMoveUnit(0, 2)
     7282    else if BUnitMoveRightDown.Test(ShortCut) then DoMoveUnit(1, 1)
     7283    else if BUnitMoveLeft.Test(ShortCut) then DoMoveUnit(-2, 0)
     7284    else if BUnitMoveRight.Test(ShortCut) then DoMoveUnit(2, 0)
     7285    else if BUnitMoveLeftUp.Test(ShortCut) then DoMoveUnit(-1, -1)
     7286    else if BUnitMoveUp.Test(ShortCut) then  DoMoveUnit(0, -2)
     7287    else if BUnitMoveRightUp.Test(ShortCut) then DoMoveUnit(1, -1)
     7288    // Map move
     7289    else if BMapMoveLeftDown.Test(ShortCut) then DoMoveMap(-1, 1)
     7290    else if BMapMoveDown.Test(ShortCut) then DoMoveMap(0, 2)
     7291    else if BMapMoveRightDown.Test(ShortCut) then DoMoveMap(1, 1)
     7292    else if BMapMoveLeft.Test(ShortCut) then DoMoveMap(-2, 0)
     7293    else if BMapMoveRight.Test(ShortCut) then DoMoveMap(2, 0)
     7294    else if BMapMoveLeftUp.Test(ShortCut) then DoMoveMap(-1, -1)
     7295    else if BMapMoveUp.Test(ShortCut) then DoMoveMap(0, -2)
     7296    else if BMapMoveRightUp.Test(ShortCut) then DoMoveMap(1, -1);
    72777297  end;
    72787298end;
Note: See TracChangeset for help on using the changeset viewer.