Changeset 616 for trunk/LocalPlayer/Term.pas
- Timestamp:
- Sep 15, 2024, 12:50:58 PM (8 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Term.pas
r615 r616 428 428 procedure SetFullScreen(Active: Boolean); 429 429 procedure PaintZoomedTile(Dst: TBitmap; X, Y, Loc: Integer); 430 procedure UpdateInterface; 430 431 public 431 432 UsedOffscreenWidth: Integer; … … 672 673 FastScrolling = False; // causes problems with overlapping windows 673 674 674 nBrushTypes = 26; 675 BrushTypes: array [0 .. nBrushTypes - 1] of Cardinal = (fPrefStartPos, 675 BrushTypes: array[0..25] of Cardinal = (fPrefStartPos, 676 676 fStartPos, fShore, fGrass, fTundra, fPrairie, fDesert, fSwamp, fForest, 677 677 fHills, fMountains, fArctic, fDeadLands, fDeadLands or fCobalt, … … 1124 1124 end; 1125 1125 end; 1126 end; 1127 1128 procedure TMainScreen.UpdateInterface; 1129 begin 1130 mFillMap.Enabled := BrushType in [fShore, fGrass, fTundra, fPrairie, fDesert, fSwamp, fForest, 1131 fHills, fMountains, fArctic]; 1126 1132 end; 1127 1133 … … 2959 2965 HelpDlg.Difficulty := 0; 2960 2966 BrushType := fGrass; 2967 UpdateInterface; 2961 2968 BrushLoc := -1; 2962 2969 Edited := False; … … 4860 4867 4861 4868 var 4862 I, uix, uixDefender, X, xSrc, ySrc, xSrcBase, ySrcBase,CostFactor, Count,4869 I, uix, uixDefender, X, CostFactor, Count, 4863 4870 mixShow, xTreasurySection, xResearchSection, JobFocus, TrueMoney, 4864 4871 TrueResearch: Integer; 4872 Src, SrcBase: TPoint; 4865 4873 Tile: Cardinal; 4866 4874 S: string; … … 4950 4958 8, 8, 121 + I * 9, 61); 4951 4959 4952 if ClientMode = cEditMap then 4953 begin 4960 if ClientMode = cEditMap then begin 4954 4961 for I := 0 to TrRow - 1 do 4955 4962 trix[I] := -1; 4956 4963 Count := 0; 4957 for I := 0 to nBrushTypes- 1 do4964 for I := 0 to Length(BrushTypes) - 1 do 4958 4965 begin // display terrain types 4959 4966 if (Count >= TrRow * VerticalScrollBar.Position) and (Count < TrRow * (VerticalScrollBar.Position + 1)) 4960 then 4961 begin 4967 then begin 4962 4968 trix[Count - TrRow * VerticalScrollBar.Position] := BrushTypes[I]; 4963 4969 X := (Count - TrRow * VerticalScrollBar.Position) * TrPitch; 4964 xSrcBase:= -1;4970 SrcBase.X := -1; 4965 4971 case BrushTypes[I] of 4966 0..8: 4967 begin 4968 xSrc := BrushTypes[I]; 4969 ySrc := 0; 4970 end; 4971 9..30: 4972 begin 4973 xSrcBase := 2; 4974 ySrcBase := 2; 4975 xSrc := 0; 4976 ySrc := 2 * Integer(BrushTypes[I]) - 15 4977 end; 4978 fRiver: 4979 begin 4980 xSrc := 7; 4981 ySrc := 14; 4982 end; 4983 fRoad: 4984 begin 4985 xSrc := 0; 4986 ySrc := 9; 4987 end; 4988 fRR: 4989 begin 4990 xSrc := 0; 4991 ySrc := 10; 4992 end; 4993 fCanal: 4994 begin 4995 xSrc := 0; 4996 ySrc := 11; 4997 end; 4998 fPoll: 4999 begin 5000 xSrc := 6; 5001 ySrc := 12; 5002 end; 4972 0..8: Src := Point(BrushTypes[I], 0); 4973 9..30: begin 4974 SrcBase := Point(2, 2); 4975 Src := Point(0, 2 * Integer(BrushTypes[I]) - 15); 4976 end; 4977 fRiver: Src := Point(7, 14); 4978 fRoad: Src := Point(0, 9); 4979 fRR: Src := Point(0, 10); 4980 fCanal: Src := Point(0, 11); 4981 fPoll: Src := Point(6, 12); 5003 4982 fDeadLands, fDeadLands or fCobalt, fDeadLands or fUranium, 5004 4983 fDeadLands or fMercury: 5005 4984 begin 5006 xSrcBase := 6; 5007 ySrcBase := 2; 5008 xSrc := 8; 5009 ySrc := 12 + BrushTypes[I] shr 25; 4985 SrcBase := Point(6, 2); 4986 Src := Point(8, 12 + BrushTypes[I] shr 25); 5010 4987 end; 5011 4988 tiIrrigation, tiFarm, tiMine, tiBase: 5012 begin 5013 xSrc := BrushTypes[I] shr 12 - 1; 5014 ySrc := 12; 5015 end; 5016 tiFort: 5017 begin 5018 xSrc := 3; 5019 ySrc := 12; 5020 xSrcBase := 7; 5021 ySrcBase := 12; 5022 end; 5023 fPrefStartPos: 5024 begin 5025 xSrc := 0; 5026 ySrc := 1; 5027 end; 5028 fStartPos: 5029 begin 5030 xSrc := 0; 5031 ySrc := 2; 5032 end; 4989 Src := Point(BrushTypes[I] shr 12 - 1, 12); 4990 tiFort: begin 4991 Src := Point(3, 12); 4992 SrcBase := Point(7, 12); 4993 end; 4994 fPrefStartPos: Src := Point(0, 1); 4995 fStartPos: Src := Point(0, 2); 5033 4996 end; 5034 4997 with MainMap do begin 5035 if xSrcBase>= 0 then4998 if SrcBase.X >= 0 then 5036 4999 Sprite(Panel, HGrTerrain, xTroop + 2 + X, yTroop + 9 - yyt, xxt * 2, 5037 yyt * 3, 1 + xSrcBase* (xxt * 2 + 1),5038 1 + ySrcBase* (yyt * 3 + 1));5000 yyt * 3, 1 + SrcBase.X * (xxt * 2 + 1), 5001 1 + SrcBase.Y * (yyt * 3 + 1)); 5039 5002 Sprite(Panel, HGrTerrain, xTroop + 2 + X, yTroop + 9 - yyt, xxt * 2, 5040 yyt * 3, 1 + xSrc * (xxt * 2 + 1), 1 + ySrc* (yyt * 3 + 1));5003 yyt * 3, 1 + Src.X * (xxt * 2 + 1), 1 + Src.Y * (yyt * 3 + 1)); 5041 5004 if BrushTypes[I] = BrushType then begin 5042 5005 ScreenTools.Frame(Panel.Canvas, xTroop + 2 + X, … … 5049 5012 end; 5050 5013 end; 5051 Inc(Count) 5014 Inc(Count); 5052 5015 end; 5053 5016 case BrushType of … … 5080 5043 begin 5081 5044 case BrushType of 5082 fRoad: 5083 I := 1; 5084 fRR: 5085 I := 2; 5086 tiIrrigation: 5087 I := 4; 5088 tiFarm: 5089 I := 5; 5090 tiMine: 5091 I := 7; 5092 fCanal: 5093 I := 8; 5094 tiFort: 5095 I := 10; 5096 tiBase: 5097 I := 12; 5045 fRoad: I := 1; 5046 fRR: I := 2; 5047 tiIrrigation: I := 4; 5048 tiFarm: I := 5; 5049 tiMine: I := 7; 5050 fCanal: I := 8; 5051 tiFort: I := 10; 5052 tiBase: I := 12; 5098 5053 end; 5099 5054 S := Phrases.Lookup('JOBRESULT', I); 5100 end 5055 end; 5101 5056 end; 5102 5057 LoweredTextOut(Panel.Canvas, -1, MainTexture, xTroop + 1, … … 6795 6750 StatPopup.Popup(Left + ClientWidth - xPalace + 6, 6796 6751 Top + ClientHeight - PanelHeight + yPalace + ySizeBig + 6797 GetSystemMetrics(SM_CYCAPTION) + 3) 6752 GetSystemMetrics(SM_CYCAPTION) + 3); 6798 6753 end 6799 (* else if (X >=xAdvisor-3) and (Y>=yAdvisor-3)6800 and (X <xAdvisor+16+3) and (Y<yAdvisor+16+3) and HaveStrategyAdvice then6754 (* else if (X >= xAdvisor - 3) and (Y >= yAdvisor - 3) 6755 and (X < xAdvisor + 16 + 3) and (Y < yAdvisor + 16 + 3) and HaveStrategyAdvice then 6801 6756 AdviceBtnClick *) 6802 6757 else if (X >= xTroop + 1) and (Y >= yTroop + 1) and … … 6808 6763 begin 6809 6764 BrushType := trix[I]; 6765 UpdateInterface; 6810 6766 PanelPaint; 6811 6767 end … … 6829 6785 SetUnFocus(trix[I]); 6830 6786 SetTroopLoc(MyUn[trix[I]].Loc); 6831 FocusOnLoc(TroopLoc, flRepaintPanel) 6787 FocusOnLoc(TroopLoc, flRepaintPanel); 6832 6788 end 6833 6789 else … … 6836 6792 CityDlg.RestoreUnFocus := trix[I]; 6837 6793 PanelPaint; 6838 end 6794 end; 6839 6795 end 6840 6796 else if (ClientMode < scContact) then … … 6893 6849 trixFocus := -1; 6894 6850 if ClientMode = cEditMap then 6895 TrCnt := nBrushTypes6851 TrCnt := Length(BrushTypes) 6896 6852 else if (Loc >= 0) and (MyMap[Loc] and fUnit <> 0) then 6897 6853 if MyMap[Loc] and fOwned <> 0 then … … 7893 7849 MapBoxMouseDown(nil, TMouseButton.mbLeft, Shift, X, Y); 7894 7850 end 7895 (* else if Idle and (UnFocus >=0) then7851 (* else if Idle and (UnFocus >= 0) then 7896 7852 begin 7897 qx :=(xMouse*32+yMouse*66+16*66) div(32*66)-1;7898 qy :=(yMouse*66-xMouse*32-16*66+2000*33*32) div(32*66)-999;7899 MouseLoc :=(xw+(qx-qy+2048) div 2-1024+G.lx) mod G.lx+G.lx*(yw+qx+qy);7853 qx := (xMouse * 32 + yMouse * 66 + 16 * 66) div(32 * 66) - 1; 7854 qy := (yMouse * 66 - xMouse * 32 - 16 * 66 + 2000 * 33 * 32) div(32 * 66) - 999; 7855 MouseLoc := (xw + (qx - qy + 2048) div 2 - 1024 + G.lx) mod G.lx + G.lx * (yw + qx + qy); 7900 7856 ShowMoveHint(MouseLoc); 7901 7857 end *) … … 7953 7909 else if (Y >= TopBarHeight) and (X >= MapOffset) and 7954 7910 (X < MapOffset + MapWidth) then 7955 MapBoxMouseDown(Sender, Button, Shift, X - MapOffset, Y - TopBarHeight) 7911 MapBoxMouseDown(Sender, Button, Shift, X - MapOffset, Y - TopBarHeight); 7956 7912 end; 7957 7913
Note:
See TracChangeset
for help on using the changeset viewer.