Changeset 405 for branches/highdpi/LocalPlayer
- Timestamp:
- Nov 3, 2021, 11:22:02 AM (4 years ago)
- Location:
- branches/highdpi/LocalPlayer
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/CityScreen.pas
r378 r405 8 8 Protocol, ClientTools, Term, ScreenTools, IsoEngine, BaseWin, 9 9 LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls, 10 ButtonA, ButtonC, Area, GraphType ;10 ButtonA, ButtonC, Area, GraphType, UTexture; 11 11 12 12 const -
branches/highdpi/LocalPlayer/ClientTools.pas
r361 r405 636 636 procedure CityOptimizer_CityChange(cix: integer); 637 637 begin 638 if (MyRO.Government <> gAnarchy) and ( MyCity[cix].Flags and638 if (MyRO.Government <> gAnarchy) and (cix <> -1) and (MyCity[cix].Flags and 639 639 chCaptured = 0) then 640 640 begin … … 756 756 initialization 757 757 758 759 758 Assert(nImp < 128); 759 CalculateAdvValues; 760 760 761 761 end. -
branches/highdpi/LocalPlayer/IsoEngine.pas
r349 r405 1007 1007 end; 1008 1008 1009 if ShowObjects then 1010 begin 1011 if (Tile and fCanal <> 0) or (Tile and fCity <> 0) then 1012 begin // paint canal connections 1009 if ShowObjects then begin 1010 // Paint canal connections 1011 if (Tile and fCanal <> 0) or (Tile and fCity <> 0) then begin 1013 1012 Conn := Connection8(Loc, fCanal or fCity); 1014 1013 if Tile and fCanal <> 0 then 1015 1014 Conn := Conn or ($FF - OceanConnection(Loc)); 1016 if Conn = 0 then 1017 begin 1015 if Conn = 0 then begin 1018 1016 if Tile and fCanal <> 0 then 1019 TSprite(x, y, spCanal) 1017 TSprite(x, y, spCanal); 1020 1018 end 1021 1019 else … … 1024 1022 TSprite(x, y, spCanal + 1 + Dir); 1025 1023 end; 1024 1026 1025 if Tile and (fRR or fCity) <> 0 then 1027 1026 RRConn := Connection8(Loc, fRR or fCity) 1028 1027 else 1029 1028 RRConn := 0; 1030 if Tile and (fRoad or fRR or fCity) <> 0 then 1031 begin // paint road connections 1029 1030 // Paint road connections 1031 if Tile and (fRoad or fRR or fCity) <> 0 then begin 1032 1032 Conn := Connection8(Loc, fRoad or fRR or fCity) and not RRConn; 1033 1033 if (Conn = 0) and (Tile and (fRR or fCity) = 0) then … … 1038 1038 TSprite(x, y, spRoad + 1 + Dir); 1039 1039 end; 1040 // paint railroad connections 1040 1041 // Paint railroad connections 1041 1042 if (Tile and fRR <> 0) and (RRConn = 0) then 1042 1043 TSprite(x, y, spRailRoad) 1043 else if RRConn > 0 then 1044 else if RRConn > 0 then begin 1044 1045 for Dir := 0 to 7 do 1045 1046 if (1 shl Dir) and RRConn <> 0 then 1046 1047 TSprite(x, y, spRailRoad + 1 + Dir); 1048 end; 1047 1049 end; 1048 1050 end; -
branches/highdpi/LocalPlayer/MessgEx.pas
r361 r405 543 543 end; 544 544 545 546 initialization547 548 545 end. -
branches/highdpi/LocalPlayer/Term.lfm
r349 r405 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: TDpiMenuItem 670 Caption = '-' 671 end 672 object mPrevUnit: TDpiMenuItem 673 Tag = 100 674 ShortCut = 46 675 OnClick = MenuClick 676 end 677 object mNextUnit: TDpiMenuItem 678 Tag = 101 679 ShortCut = 45 680 OnClick = MenuClick 681 end 669 682 end 670 683 object StatPopup: TDpiPopupMenu -
branches/highdpi/LocalPlayer/Term.pas
r378 r405 29 29 TMainScreen = class(TDrawDlg) 30 30 mBigTiles: TDpiMenuItem; 31 mNextUnit: TDpiMenuItem; 32 N13: TDpiMenuItem; 33 mPrevUnit: TDpiMenuItem; 31 34 Timer1: TTimer; 32 35 GamePopup: TDpiPopupMenu; … … 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); … … 2433 2437 begin 2434 2438 SetTroopLoc(-1); 2435 PaintAll 2439 PaintAll; 2436 2440 end { supervisor } 2437 2441 { else if (ClientMode=cTurn) and (MyRO.Turn=0) then … … 2455 2459 FocusOnLoc(G.lx * G.ly div 2); 2456 2460 SetTroopLoc(-1); 2457 PanelPaint 2461 PanelPaint; 2458 2462 end; 2459 2463 if ShowCityList then … … 3446 3450 NoMapPanel := TIsoMap.Create; 3447 3451 3448 KeyBindings.LoadFromRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');3449 3452 UpdateKeyShortcuts; 3450 3453 … … 3545 3548 I: Integer; 3546 3549 begin 3547 KeyBindings.SaveToRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');3548 3550 MainFormKeyDown := nil; 3549 3551 FreeAndNil(sb); … … 4904 4906 end; 4905 4907 4908 procedure TMainScreen.FocusNextUnit(Dir: Integer); 4909 var 4910 i, uix, NewFocus: Integer; 4911 begin 4912 if ClientMode >= scContact then 4913 Exit; 4914 DestinationMarkON := False; 4915 PaintDestination; 4916 NewFocus := -1; 4917 for i := 1 to MyRO.nUn do begin 4918 uix := (UnFocus + i * Dir + MyRO.nUn) mod MyRO.nUn; 4919 if (MyUn[uix].Loc >= 0) and (MyUn[uix].Status and usStay = 0) then begin 4920 NewFocus := uix; 4921 Break; 4922 end; 4923 end; 4924 if NewFocus >= 0 then begin 4925 SetUnFocus(NewFocus); 4926 SetTroopLoc(MyUn[NewFocus].Loc); 4927 FocusOnLoc(TroopLoc, flRepaintPanel); 4928 end; 4929 end; 4930 4906 4931 procedure TMainScreen.FocusOnLoc(Loc: integer; Options: integer = 0); 4907 4932 var … … 4930 4955 end; 4931 4956 4932 procedure TMainScreen.NextUnit(NearLoc: integer; AutoTurn: boolean);4957 procedure TMainScreen.NextUnit(NearLoc: Integer; AutoTurn: Boolean); 4933 4958 var 4934 Dist, TestDist: single;4935 i, uix, NewFocus: integer;4936 GotoOnly: boolean;4959 Dist, TestDist: Single; 4960 i, uix, NewFocus: Integer; 4961 GotoOnly: Boolean; 4937 4962 begin 4938 4963 Dist := 0; 4939 4964 if ClientMode >= scContact then 4940 exit;4941 DestinationMarkON := false;4965 Exit; 4966 DestinationMarkON := False; 4942 4967 PaintDestination; 4943 for GotoOnly := GoOnPhase downto false do 4944 begin 4968 for GotoOnly := GoOnPhase downto False do begin 4945 4969 NewFocus := -1; 4946 for i := 1 to MyRO.nUn do 4947 begin 4970 for i := 1 to MyRO.nUn do begin 4948 4971 uix := (UnFocus + i) mod MyRO.nUn; 4949 4972 if (MyUn[uix].Loc >= 0) and (MyUn[uix].Job = jNone) and 4950 4973 (MyUn[uix].Status and (usStay or usRecover or usWaiting) = usWaiting) 4951 4974 and (not GotoOnly or (MyUn[uix].Status and usGoto <> 0)) then 4952 if NearLoc < 0 then 4953 begin 4975 if NearLoc < 0 then begin 4954 4976 NewFocus := uix; 4955 4977 Break; 4956 end 4957 else 4958 begin 4978 end else begin 4959 4979 TestDist := Distance(NearLoc, MyUn[uix].Loc); 4960 if (NewFocus < 0) or (TestDist < Dist) then 4961 begin 4980 if (NewFocus < 0) or (TestDist < Dist) then begin 4962 4981 NewFocus := uix; 4963 4982 Dist := TestDist; … … 4966 4985 end; 4967 4986 if GotoOnly then 4968 if NewFocus < 0 then 4969 GoOnPhase := false 4970 else 4971 Break; 4972 end; 4973 if NewFocus >= 0 then 4974 begin 4987 if NewFocus < 0 then GoOnPhase := False 4988 else Break; 4989 end; 4990 if NewFocus >= 0 then begin 4975 4991 SetUnFocus(NewFocus); 4976 4992 SetTroopLoc(MyUn[NewFocus].Loc); 4977 FocusOnLoc(TroopLoc, flRepaintPanel) 4978 end 4979 else if AutoTurn and not mWaitTurn.Checked then 4980 begin 4981 TurnComplete := true; 4993 FocusOnLoc(TroopLoc, flRepaintPanel); 4994 end else 4995 if AutoTurn and not mWaitTurn.Checked then begin 4996 TurnComplete := True; 4982 4997 SetUnFocus(-1); 4983 4998 SetTroopLoc(-1); 4984 PostMessage(Handle, WM_EOT, 0, 0) 4985 end 4986 else 4987 begin 4999 PostMessage(Handle, WM_EOT, 0, 0); 5000 end else begin 4988 5001 if { (UnFocus>=0) and } not TurnComplete and EOT.Visible then 4989 5002 Play('TURNEND'); 4990 TurnComplete := true;5003 TurnComplete := True; 4991 5004 SetUnFocus(-1); 4992 5005 SetTroopLoc(-1); … … 5962 5975 end 5963 5976 else 5964 NextUnit(UnStartLoc, true) 5977 NextUnit(UnStartLoc, true); 5965 5978 end 5966 5979 else if (UnFocus < 0) and (Options and muAutoNext <> 0) then … … 6167 6180 begin 6168 6181 MyUn[uix].Status := MyUn[uix].Status and not usWaiting; 6169 NextUnit(UnStartLoc, true) 6182 NextUnit(UnStartLoc, true); 6170 6183 end; 6171 6184 end; … … 6328 6341 trixFocus := TrCnt; 6329 6342 inc(TrCnt); 6330 end 6343 end; 6331 6344 end 6332 6345 else // count enemy units here … … 6443 6456 mStay.ShortCut := BStay.ShortCut; 6444 6457 mNoOrders.ShortCut := BNoOrders.ShortCut; 6458 mPrevUnit.ShortCut := BPrevUnit.ShortCut; 6459 mNextUnit.ShortCut := BNextUnit.ShortCut; 6445 6460 mCancel.ShortCut := BCancel.ShortCut; 6446 6461 mPillage.ShortCut := BPillage.ShortCut; … … 6636 6651 else if BStay.Test(ShortCut) then MenuClick(mStay) 6637 6652 else if BNoOrders.Test(ShortCut) then MenuClick(mNoOrders) 6653 else if BPrevUnit.Test(ShortCut) then MenuClick(mPrevUnit) 6654 else if BNextUnit.Test(ShortCut) then MenuClick(mNextUnit) 6638 6655 else if BCancel.Test(ShortCut) then MenuClick_Check(UnitPopup, mCancel) 6639 6656 else if BPillage.Test(ShortCut) then MenuClick_Check(UnitPopup, mPillage) … … 6718 6735 end 6719 6736 else 6720 PanelPaint 6737 PanelPaint; 6721 6738 end 6722 6739 else 6723 6740 NextUnit(UnStartLoc, true); 6724 end 6741 end; 6725 6742 end; 6726 6743 case result of … … 6735 6752 if result < rExecuted then 6736 6753 Play('INVALID') 6737 end 6754 end; 6738 6755 end; 6739 6756 … … 6914 6931 end 6915 6932 else if UnFocus >= 0 then 6916 with MyUn[UnFocus]do6933 with TUn(MyUn[UnFocus]) do 6917 6934 if Sender = mGoOn then 6918 6935 begin … … 6945 6962 begin 6946 6963 Centre(Loc); 6947 PaintAllMaps 6964 PaintAllMaps; 6948 6965 end 6949 6966 else if Sender = mCity then … … 6957 6974 PaintAll; 6958 6975 ZoomToCity(Loc0, true, chFounded); 6959 end 6976 end; 6960 6977 end 6961 6978 else … … 7018 7035 if Job > jNone then 7019 7036 Server(sStartJob + jNone shl 4, me, UnFocus, nil^); 7020 NextUnit(UnStartLoc, true) 7037 NextUnit(UnStartLoc, true); 7021 7038 end 7022 7039 else if Sender = mRecover then … … 7027 7044 if Job > jNone then 7028 7045 Server(sStartJob + jNone shl 4, me, UnFocus, nil^); 7029 NextUnit(UnStartLoc, true) 7046 NextUnit(UnStartLoc, true); 7030 7047 end 7031 7048 else if Sender = mNoOrders then 7032 7049 begin 7033 7050 Status := Status and not usWaiting; 7034 NextUnit(UnStartLoc, true) 7051 NextUnit(UnStartLoc, true); 7052 end 7053 else if Sender = mPrevUnit then 7054 begin 7055 Status := Status and not usWaiting; 7056 FocusNextUnit(-1); 7057 end 7058 else if Sender = mNextUnit then 7059 begin 7060 Status := Status and not usWaiting; 7061 FocusNextUnit(1); 7035 7062 end 7036 7063 else if Sender = mCancel then … … 7113 7140 NextUnit(Loc, true) 7114 7141 else 7115 PanelPaint 7142 PanelPaint; 7116 7143 end 7117 7144 else if i = eNoTime_Load then … … 8035 8062 end; 8036 8063 8037 initialization8038 8039 8064 end. 8040 8065 -
branches/highdpi/LocalPlayer/UKeyBindings.pas
r303 r405 17 17 ShortCut: TShortCut; 18 18 ShortCut2: TShortCut; 19 DefaultShortCut: TShortCut; 20 DefaultShortCut2: TShortCut; 19 21 function Test(AShortCut: TShortCut): Boolean; 22 procedure Assign(Source: TKeyBinding); 23 procedure SetDefault; 20 24 end; 21 25 … … 23 27 24 28 TKeyBindings = class(TFPGObjectList<TKeyBinding>) 29 private 25 30 public 26 31 function AddItem(const ShortName, FullName: string; ShortCut: TShortCut; ShortCut2: TShortCut = 0): TKeyBinding; overload; … … 29 34 procedure LoadFromRegistry(RootKey: HKEY; Key: string); 30 35 procedure SaveToRegistry(RootKey: HKEY; Key: string); 36 procedure LoadToStrings(Strings: TStrings); 37 procedure Assign(Source: TKeyBindings); 38 procedure ResetToDefault; 39 procedure RemoveShortCut(ShortCut: TShortCut); 31 40 end; 32 41 … … 52 61 BStay: TKeyBinding; 53 62 BNoOrders: TKeyBinding; 63 BPrevUnit: TKeyBinding; 64 BNextUnit: TKeyBinding; 54 65 BCancel: TKeyBinding; 55 66 BPillage: TKeyBinding; … … 123 134 end; 124 135 136 procedure TKeyBinding.Assign(Source: TKeyBinding); 137 begin 138 ShortName := Source.ShortName; 139 FullName := Source.FullName; 140 ShortCut := Source.ShortCut; 141 ShortCut2 := Source.ShortCut2; 142 DefaultShortCut := Source.DefaultShortCut; 143 DefaultShortCut2 := Source.DefaultShortCut2; 144 end; 145 146 procedure TKeyBinding.SetDefault; 147 begin 148 ShortCut := DefaultShortCut; 149 ShortCut2 := DefaultShortCut2; 150 end; 151 125 152 { TKeyBindings } 126 153 … … 133 160 Result.ShortCut := ShortCut; 134 161 Result.ShortCut2 := ShortCut2; 162 Result.DefaultShortCut := ShortCut; 163 Result.DefaultShortCut2 := ShortCut2; 135 164 Add(Result); 136 165 end; … … 207 236 end; 208 237 238 procedure TKeyBindings.LoadToStrings(Strings: TStrings); 239 var 240 I: Integer; 241 Text: string; 242 begin 243 Strings.Clear; 244 for I := 0 to Count - 1 do begin 245 Text:= ''; 246 if Items[I].ShortCut <> 0 then 247 Text:= Text + ShortCutToText(Items[I].ShortCut); 248 if Items[I].ShortCut2 <> 0 then begin 249 if Text <> '' then Text := Text + ', '; 250 Text:= Text + ShortCutToText(Items[I].ShortCut2); 251 end; 252 if Text <> '' then Text := Items[I].FullName + ' (' + Text + ')' 253 else Text := Items[I].FullName; 254 Strings.Add(Text); 255 end; 256 end; 257 258 procedure TKeyBindings.Assign(Source: TKeyBindings); 259 var 260 I: Integer; 261 begin 262 while Count < Source.Count do 263 Add(TKeyBinding.Create); 264 while Count > Source.Count do 265 Delete(Count - 1); 266 for I := 0 to Count - 1 do 267 Items[I].Assign(Source.Items[I]); 268 end; 269 270 procedure TKeyBindings.ResetToDefault; 271 var 272 I: Integer; 273 begin 274 for I := 0 to Count - 1 do 275 Items[I].SetDefault; 276 end; 277 278 procedure TKeyBindings.RemoveShortCut(ShortCut: TShortCut); 279 var 280 I: Integer; 281 begin 282 for I := 0 to Count - 1 do begin 283 if Items[I].ShortCut = ShortCut then Items[I].ShortCut := 0; 284 if Items[I].ShortCut2 = ShortCut then Items[I].ShortCut2 := 0; 285 end; 286 end; 287 209 288 210 289 initialization … … 231 310 BStay := AddItem('Stay', 'Stay', 'S'); 232 311 BNoOrders := AddItem('NoOrders', 'No orders', 'Space'); 312 BPrevUnit := AddItem('PrevUnit', 'Previous unit', 'Del'); 313 BNextUnit := AddItem('NextUnit', 'Next unit', 'Ins'); 233 314 BCancel := AddItem('Cancel', 'Cancel', 'Ctrl+C'); 234 315 BPillage := AddItem('Pillage', 'Pillage', 'Ctrl+P'); -
branches/highdpi/LocalPlayer/UnitStat.pas
r361 r405 52 52 53 53 uses 54 Tribes, Help, Directories ;54 Tribes, Help, Directories, UTexture; 55 55 56 56 {$R *.lfm}
Note:
See TracChangeset
for help on using the changeset viewer.