Changeset 387 for trunk/LocalPlayer
- Timestamp:
- Apr 27, 2021, 9:37:48 PM (4 years ago)
- Location:
- trunk/LocalPlayer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Term.lfm
r321 r387 1 1 object MainScreen: TMainScreen 2 Left = 1692 Left = 516 3 3 Height = 480 4 Top = 5964 Top = 834 5 5 Width = 800 6 6 HorzScrollBar.Visible = False … … 667 667 OnClick = MenuClick 668 668 end 669 object N13: TMenuItem 670 Caption = '-' 671 end 672 object mPrevUnit: TMenuItem 673 Tag = 100 674 ShortCut = 46 675 OnClick = MenuClick 676 end 677 object mNextUnit: TMenuItem 678 Tag = 101 679 ShortCut = 45 680 OnClick = MenuClick 681 end 669 682 end 670 683 object StatPopup: TPopupMenu -
trunk/LocalPlayer/Term.pas
r385 r387 29 29 TMainScreen = class(TDrawDlg) 30 30 mBigTiles: TMenuItem; 31 mNextUnit: TMenuItem; 32 N13: TMenuItem; 33 mPrevUnit: TMenuItem; 31 34 Timer1: TTimer; 32 35 GamePopup: TPopupMenu; … … 286 289 procedure CopyMiniToPanel; 287 290 procedure PanelPaint; 288 procedure NextUnit(NearLoc: integer; AutoTurn: boolean); 291 procedure FocusNextUnit(Dir: Integer = 1); 292 procedure NextUnit(NearLoc: Integer; AutoTurn: Boolean); 289 293 procedure Scroll(dx, dy: integer); 290 294 procedure SetMapPos(Loc: integer; MapPos: TPoint); … … 2427 2431 begin 2428 2432 SetTroopLoc(-1); 2429 PaintAll 2433 PaintAll; 2430 2434 end { supervisor } 2431 2435 { else if (ClientMode=cTurn) and (MyRO.Turn=0) then … … 2449 2453 FocusOnLoc(G.lx * G.ly div 2); 2450 2454 SetTroopLoc(-1); 2451 PanelPaint 2455 PanelPaint; 2452 2456 end; 2453 2457 if ShowCityList then … … 4896 4900 end; 4897 4901 4902 procedure TMainScreen.FocusNextUnit(Dir: Integer); 4903 var 4904 i, uix, NewFocus: Integer; 4905 begin 4906 if ClientMode >= scContact then 4907 Exit; 4908 DestinationMarkON := False; 4909 PaintDestination; 4910 NewFocus := -1; 4911 for i := 1 to MyRO.nUn do begin 4912 uix := (UnFocus + i * Dir + MyRO.nUn) mod MyRO.nUn; 4913 if (MyUn[uix].Loc >= 0) and (MyUn[uix].Status and usStay = 0) then begin 4914 NewFocus := uix; 4915 Break; 4916 end; 4917 end; 4918 if NewFocus >= 0 then begin 4919 SetUnFocus(NewFocus); 4920 SetTroopLoc(MyUn[NewFocus].Loc); 4921 FocusOnLoc(TroopLoc, flRepaintPanel); 4922 end; 4923 end; 4924 4898 4925 procedure TMainScreen.FocusOnLoc(Loc: integer; Options: integer = 0); 4899 4926 var … … 4922 4949 end; 4923 4950 4924 procedure TMainScreen.NextUnit(NearLoc: integer; AutoTurn: boolean);4951 procedure TMainScreen.NextUnit(NearLoc: Integer; AutoTurn: Boolean); 4925 4952 var 4926 Dist, TestDist: single;4927 i, uix, NewFocus: integer;4928 GotoOnly: boolean;4953 Dist, TestDist: Single; 4954 i, uix, NewFocus: Integer; 4955 GotoOnly: Boolean; 4929 4956 begin 4930 4957 Dist := 0; 4931 4958 if ClientMode >= scContact then 4932 exit;4933 DestinationMarkON := false;4959 Exit; 4960 DestinationMarkON := False; 4934 4961 PaintDestination; 4935 for GotoOnly := GoOnPhase downto false do 4936 begin 4962 for GotoOnly := GoOnPhase downto False do begin 4937 4963 NewFocus := -1; 4938 for i := 1 to MyRO.nUn do 4939 begin 4964 for i := 1 to MyRO.nUn do begin 4940 4965 uix := (UnFocus + i) mod MyRO.nUn; 4941 4966 if (MyUn[uix].Loc >= 0) and (MyUn[uix].Job = jNone) and 4942 4967 (MyUn[uix].Status and (usStay or usRecover or usWaiting) = usWaiting) 4943 4968 and (not GotoOnly or (MyUn[uix].Status and usGoto <> 0)) then 4944 if NearLoc < 0 then 4945 begin 4969 if NearLoc < 0 then begin 4946 4970 NewFocus := uix; 4947 4971 Break; 4948 end 4949 else 4950 begin 4972 end else begin 4951 4973 TestDist := Distance(NearLoc, MyUn[uix].Loc); 4952 if (NewFocus < 0) or (TestDist < Dist) then 4953 begin 4974 if (NewFocus < 0) or (TestDist < Dist) then begin 4954 4975 NewFocus := uix; 4955 4976 Dist := TestDist; … … 4958 4979 end; 4959 4980 if GotoOnly then 4960 if NewFocus < 0 then 4961 GoOnPhase := false 4962 else 4963 Break; 4964 end; 4965 if NewFocus >= 0 then 4966 begin 4981 if NewFocus < 0 then GoOnPhase := False 4982 else Break; 4983 end; 4984 if NewFocus >= 0 then begin 4967 4985 SetUnFocus(NewFocus); 4968 4986 SetTroopLoc(MyUn[NewFocus].Loc); 4969 FocusOnLoc(TroopLoc, flRepaintPanel) 4970 end 4971 else if AutoTurn and not mWaitTurn.Checked then 4972 begin 4973 TurnComplete := true; 4987 FocusOnLoc(TroopLoc, flRepaintPanel); 4988 end else 4989 if AutoTurn and not mWaitTurn.Checked then begin 4990 TurnComplete := True; 4974 4991 SetUnFocus(-1); 4975 4992 SetTroopLoc(-1); 4976 PostMessage(Handle, WM_EOT, 0, 0) 4977 end 4978 else 4979 begin 4993 PostMessage(Handle, WM_EOT, 0, 0); 4994 end else begin 4980 4995 if { (UnFocus>=0) and } not TurnComplete and EOT.Visible then 4981 4996 Play('TURNEND'); 4982 TurnComplete := true;4997 TurnComplete := True; 4983 4998 SetUnFocus(-1); 4984 4999 SetTroopLoc(-1); … … 5954 5969 end 5955 5970 else 5956 NextUnit(UnStartLoc, true) 5971 NextUnit(UnStartLoc, true); 5957 5972 end 5958 5973 else if (UnFocus < 0) and (Options and muAutoNext <> 0) then … … 6159 6174 begin 6160 6175 MyUn[uix].Status := MyUn[uix].Status and not usWaiting; 6161 NextUnit(UnStartLoc, true) 6176 NextUnit(UnStartLoc, true); 6162 6177 end; 6163 6178 end; … … 6320 6335 trixFocus := TrCnt; 6321 6336 inc(TrCnt); 6322 end 6337 end; 6323 6338 end 6324 6339 else // count enemy units here … … 6435 6450 mStay.ShortCut := BStay.ShortCut; 6436 6451 mNoOrders.ShortCut := BNoOrders.ShortCut; 6452 mPrevUnit.ShortCut := BPrevUnit.ShortCut; 6453 mNextUnit.ShortCut := BNextUnit.ShortCut; 6437 6454 mCancel.ShortCut := BCancel.ShortCut; 6438 6455 mPillage.ShortCut := BPillage.ShortCut; … … 6628 6645 else if BStay.Test(ShortCut) then MenuClick(mStay) 6629 6646 else if BNoOrders.Test(ShortCut) then MenuClick(mNoOrders) 6647 else if BPrevUnit.Test(ShortCut) then MenuClick(mPrevUnit) 6648 else if BNextUnit.Test(ShortCut) then MenuClick(mNextUnit) 6630 6649 else if BCancel.Test(ShortCut) then MenuClick_Check(UnitPopup, mCancel) 6631 6650 else if BPillage.Test(ShortCut) then MenuClick_Check(UnitPopup, mPillage) … … 6710 6729 end 6711 6730 else 6712 PanelPaint 6731 PanelPaint; 6713 6732 end 6714 6733 else 6715 6734 NextUnit(UnStartLoc, true); 6716 end 6735 end; 6717 6736 end; 6718 6737 case result of … … 6727 6746 if result < rExecuted then 6728 6747 Play('INVALID') 6729 end 6748 end; 6730 6749 end; 6731 6750 … … 6906 6925 end 6907 6926 else if UnFocus >= 0 then 6908 with MyUn[UnFocus]do6927 with TUn(MyUn[UnFocus]) do 6909 6928 if Sender = mGoOn then 6910 6929 begin … … 6937 6956 begin 6938 6957 Centre(Loc); 6939 PaintAllMaps 6958 PaintAllMaps; 6940 6959 end 6941 6960 else if Sender = mCity then … … 6949 6968 PaintAll; 6950 6969 ZoomToCity(Loc0, true, chFounded); 6951 end 6970 end; 6952 6971 end 6953 6972 else … … 7010 7029 if Job > jNone then 7011 7030 Server(sStartJob + jNone shl 4, me, UnFocus, nil^); 7012 NextUnit(UnStartLoc, true) 7031 NextUnit(UnStartLoc, true); 7013 7032 end 7014 7033 else if Sender = mRecover then … … 7019 7038 if Job > jNone then 7020 7039 Server(sStartJob + jNone shl 4, me, UnFocus, nil^); 7021 NextUnit(UnStartLoc, true) 7040 NextUnit(UnStartLoc, true); 7022 7041 end 7023 7042 else if Sender = mNoOrders then 7024 7043 begin 7025 7044 Status := Status and not usWaiting; 7026 NextUnit(UnStartLoc, true) 7045 NextUnit(UnStartLoc, true); 7046 end 7047 else if Sender = mPrevUnit then 7048 begin 7049 Status := Status and not usWaiting; 7050 FocusNextUnit(-1); 7051 end 7052 else if Sender = mNextUnit then 7053 begin 7054 Status := Status and not usWaiting; 7055 FocusNextUnit(1); 7027 7056 end 7028 7057 else if Sender = mCancel then … … 7105 7134 NextUnit(Loc, true) 7106 7135 else 7107 PanelPaint 7136 PanelPaint; 7108 7137 end 7109 7138 else if i = eNoTime_Load then -
trunk/LocalPlayer/UKeyBindings.pas
r386 r387 61 61 BStay: TKeyBinding; 62 62 BNoOrders: TKeyBinding; 63 BPrevUnit: TKeyBinding; 64 BNextUnit: TKeyBinding; 63 65 BCancel: TKeyBinding; 64 66 BPillage: TKeyBinding; … … 308 310 BStay := AddItem('Stay', 'Stay', 'S'); 309 311 BNoOrders := AddItem('NoOrders', 'No orders', 'Space'); 312 BPrevUnit := AddItem('PrevUnit', 'Previous unit', 'Del'); 313 BNextUnit := AddItem('NextUnit', 'Next unit', 'Ins'); 310 314 BCancel := AddItem('Cancel', 'Cancel', 'Ctrl+C'); 311 315 BPillage := AddItem('Pillage', 'Pillage', 'Ctrl+P');
Note:
See TracChangeset
for help on using the changeset viewer.