Changeset 185
- Timestamp:
- May 4, 2020, 11:00:56 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GameServer.pas
r169 r185 116 116 function PreviewMap(lm: integer): pointer; 117 117 118 118 119 implementation 119 120 120 121 uses 121 Directories, CityProcessing, UnitProcessing, CmdList, 122 123 LCLIntf, LCLType, LMessages, Classes, SysUtils; 122 Directories, CityProcessing, UnitProcessing, CmdList, LCLIntf, LCLType, 123 LMessages, Classes, SysUtils; 124 124 125 125 var … … 304 304 end; 305 305 CreateMap(true); 306 result := @RealMap;306 Result := @RealMap; 307 307 end; 308 308 -
trunk/Start.pas
r183 r185 98 98 AutoDiff: Integer; 99 99 MultiControl: Integer; 100 MiniWidth: Integer; 101 MiniHeight: Integer; 100 MiniSize: TPoint; 102 101 Page: TStartPage; 103 102 ShowTab: TStartTab; … … 114 113 ListIndex: array [TStartTab] of Integer; 115 114 MapFileName: string; 116 FormerGames, Maps: TStringList; 115 FormerGames: TStringList; 116 Maps: TStringList; 117 117 LogoBuffer, Mini: TBitmap; { game world sample preview } 118 118 MiniColors: array [0 .. 11, 0 .. 1] of TColor; … … 142 142 StartDlg: TStartDlg; 143 143 144 144 145 implementation 145 146 … … 154 155 // predefined world size 155 156 // attention: lx*ly+1 must be prime! 156 { nWorldSize=8;157 { MaxWorldSize=8; 157 158 lxpre: array[0..nWorldSize-1] of integer =(30,40,50,60,70,90,110,130); 158 159 lypre: array[0..nWorldSize-1] of integer =(46,52,60,70,84,94,110,130); 159 160 DefaultWorldTiles=4200; } 160 nWorldSize = 6;161 lxpre: array [0 .. nWorldSize - 1] of integer = (30, 40, 50, 60, 75, 100);162 lypre: array [0 .. nWorldSize - 1] of integer = (46, 52, 60, 70, 82, 96);161 MaxWorldSize = 6; 162 WorldSizes: array [0 .. MaxWorldSize - 1] of TPoint = ((X: 30; Y:46), 163 (X: 40; Y:52), (X: 50; Y:60), (X: 60; Y:70), (X: 75; Y:82), (X: 100; Y:96)); 163 164 DefaultWorldTiles = 4150; 164 165 DefaultWorldSize = 3; … … 775 776 MainTexture.clBevelShade); 776 777 RisedTextOut(Canvas, 344, y0Mini - 77, Phrases.Lookup('STARTCONTROLS', 5)); 777 s := IntToStr(( lxpre[WorldSize] * lypre[WorldSize]* 20 +778 s := IntToStr((WorldSizes[WorldSize].X * WorldSizes[WorldSize].Y * 20 + 778 779 DefaultWorldTiles div 2) div DefaultWorldTiles * 5) + '%'; 779 780 RisedTextOut(Canvas, 514 - BiColorTextWidth(Canvas, s), y0Mini - 77, s); … … 826 827 if not(Page in [pgMain, pgNoLoad]) then 827 828 begin 828 xMini := x0Mini - Mini Width;829 yMini := y0Mini - Mini Heightdiv 2;830 Frame(Canvas, xMini, yMini, xMini + 3 + Mini Width* 2,831 yMini + 3 + Mini Height, MainTexture.clBevelLight,829 xMini := x0Mini - MiniSize.X; 830 yMini := y0Mini - MiniSize.Y div 2; 831 Frame(Canvas, xMini, yMini, xMini + 3 + MiniSize.X * 2, 832 yMini + 3 + MiniSize.Y, MainTexture.clBevelLight, 832 833 MainTexture.clBevelShade); 833 Frame(Canvas, xMini + 1, yMini + 1, xMini + 2 + Mini Width* 2,834 yMini + 2 + Mini Height, MainTexture.clBevelShade,834 Frame(Canvas, xMini + 1, yMini + 1, xMini + 2 + MiniSize.X * 2, 835 yMini + 2 + MiniSize.Y, MainTexture.clBevelShade, 835 836 MainTexture.clBevelLight); 836 837 end; … … 838 839 if MiniMode = mmPicture then 839 840 begin 840 BitBlt(Canvas.Handle, xMini + 2, yMini + 2, Mini Width * 2, MiniHeight,841 BitBlt(Canvas.Handle, xMini + 2, yMini + 2, MiniSize.X * 2, MiniSize.Y, 841 842 Mini.Canvas.Handle, 0, 0, SRCCOPY); 842 843 if Page = pgStartRandom then … … 1001 1002 1002 1003 StartNewGame(GetSavedDir + DirectorySeparator, FileName + CevoExt, MapFileName, 1003 lxpre[WorldSize], lypre[WorldSize], StartLandMass, MaxTurn);1004 WorldSizes[WorldSize].X, WorldSizes[WorldSize].Y, StartLandMass, MaxTurn); 1004 1005 UnlistBackupFile(FileName); 1005 1006 end; … … 1020 1021 end; 1021 1022 MapFileName := Format(Phrases.Lookup('MAP'), [MapCount]) + CevoMapExt; 1022 EditMap(MapFileName, lxpre[WorldSize], lypre[WorldSize], StartLandMass);1023 EditMap(MapFileName, WorldSizes[WorldSize].X, WorldSizes[WorldSize].Y, StartLandMass); 1023 1024 end 1024 1025 end … … 1032 1033 begin 1033 1034 Map := PreviewMap(StartLandMass); 1034 MiniWidth := lxpre[WorldSize]; 1035 MiniHeight := lypre[WorldSize]; 1035 MiniSize := WorldSizes[WorldSize]; 1036 1036 1037 1037 Mini.PixelFormat := pf24bit; 1038 Mini.SetSize(Mini Width * 2, MiniHeight);1038 Mini.SetSize(MiniSize.X * 2, MiniSize.Y); 1039 1039 Mini.BeginUpdate; 1040 1040 MiniPixel.Init(Mini); 1041 for y := 0 to Mini Height- 1 do begin1042 for x := 0 to Mini Width- 1 do begin1041 for y := 0 to MiniSize.Y - 1 do begin 1042 for x := 0 to MiniSize.X - 1 do begin 1043 1043 for i := 0 to 1 do begin 1044 xm := (x * 2 + i + y and 1) mod (Mini Width* 2);1044 xm := (x * 2 + i + y and 1) mod (MiniSize.X * 2); 1045 1045 MiniPixel.SetX(xm); 1046 1046 cm := MiniColors 1047 [Map[x * lxmax div Mini Width+ lxmax *1048 ((y * (lymax - 1) + Mini Height div 2) div (MiniHeight- 1))] and1047 [Map[x * lxmax div MiniSize.X + lxmax * 1048 ((y * (lymax - 1) + MiniSize.Y div 2) div (MiniSize.Y - 1))] and 1049 1049 fTerrain, i]; 1050 1050 MiniPixel.Pixel^.B := ((cm shr 16) and $FF) * Brightness div 3; … … 1066 1066 EnemyColor := GrExt[HGrSystem].Data.Canvas.Pixels[96, 67]; 1067 1067 Mini.PixelFormat := pf24bit; 1068 Mini.SetSize(Mini Width * 2, MiniHeight);1068 Mini.SetSize(MiniSize.X * 2, MiniSize.Y); 1069 1069 if MiniMode = mmPicture then 1070 1070 begin … … 1072 1072 MiniPixel.Init(Mini); 1073 1073 PrevMiniPixel.Init(Mini, 0, -1); 1074 for y := 0 to Mini Height- 1 do begin1075 for x := 0 to Mini Width- 1 do begin1074 for y := 0 to MiniSize.Y - 1 do begin 1075 for x := 0 to MiniSize.X - 1 do begin 1076 1076 for i := 0 to 1 do begin 1077 xm := (x * 2 + i + y and 1) mod (Mini Width* 2);1077 xm := (x * 2 + i + y and 1) mod (MiniSize.X * 2); 1078 1078 MiniPixel.SetX(xm); 1079 Tile := SaveMap[x + Mini Width* y];1079 Tile := SaveMap[x + MiniSize.X * y]; 1080 1080 if Tile and fTerrain = fUNKNOWN then 1081 1081 cm := $000000 … … 1129 1129 pgNoLoad: 1130 1130 begin 1131 MiniWidth := lxpre[DefaultWorldSize]; 1132 MiniHeight := lypre[DefaultWorldSize]; 1131 MiniSize := WorldSizes[DefaultWorldSize]; 1133 1132 MiniMode := mmNone; 1134 1133 end; … … 1143 1142 if Dummy >= $000E01 then 1144 1143 BlockRead(LogFile, Dummy, 1); { item stored since 0.14.1 } 1145 BlockRead(LogFile, Mini Width, 1);1146 BlockRead(LogFile, Mini Height, 1);1144 BlockRead(LogFile, MiniSize.X, 1); 1145 BlockRead(LogFile, MiniSize.Y, 1); 1147 1146 BlockRead(LogFile, FileLandMass, 1); 1148 1147 if FileLandMass = 0 then 1149 for y := 0 to Mini Height- 1 do1150 BlockRead(LogFile, MapRow, Mini Width);1148 for y := 0 to MiniSize.Y - 1 do 1149 BlockRead(LogFile, MapRow, MiniSize.X); 1151 1150 BlockRead(LogFile, Dummy, 1); 1152 1151 BlockRead(LogFile, Dummy, 1); … … 1158 1157 MiniMode := mmPicture; 1159 1158 if MiniMode = mmPicture then 1160 BlockRead(LogFile, SaveMap[4], (Mini Width * MiniHeight- 1) div 4);1159 BlockRead(LogFile, SaveMap[4], (MiniSize.X * MiniSize.Y - 1) div 4); 1161 1160 CloseFile(LogFile); 1162 1161 except 1163 1162 CloseFile(LogFile); 1164 1163 LastTurn := 0; 1165 MiniWidth := lxpre[DefaultWorldSize]; 1166 MiniHeight := lypre[DefaultWorldSize]; 1164 MiniSize := WorldSizes[DefaultWorldSize]; 1167 1165 MiniMode := mmNone; 1168 1166 end; … … 1195 1193 if Mini.height > MaxHeightMapLogo then 1196 1194 Mini.height := MaxHeightMapLogo; 1197 Mini Width:= Mini.width div 2;1198 Mini Height:= Mini.height;1195 MiniSize.X := Mini.width div 2; 1196 MiniSize.Y := Mini.height; 1199 1197 end 1200 1198 else 1201 1199 begin 1202 1200 MiniMode := mmNone; 1203 Mini Width:= MaxWidthMapLogo;1204 Mini Height:= MaxHeightMapLogo;1201 MiniSize.X := MaxWidthMapLogo; 1202 MiniSize.Y := MaxHeightMapLogo; 1205 1203 end; 1206 1204 … … 1707 1705 procedure TStartDlg.Up1BtnClick(Sender: TObject); 1708 1706 begin 1709 if WorldSize < nWorldSize - 1 then1707 if WorldSize < MaxWorldSize - 1 then 1710 1708 begin 1711 1709 Inc(WorldSize);
Note:
See TracChangeset
for help on using the changeset viewer.