Changeset 479 for trunk/MiniMap.pas
- Timestamp:
- Dec 6, 2023, 5:28:20 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MiniMap.pas
r471 r479 167 167 MiniPixel: TPixelPointer; 168 168 Map: ^TTileList; 169 xx, yy: Integer; 169 170 begin 170 171 Map := PreviewMap(StartLandMass); … … 175 176 Bitmap.BeginUpdate; 176 177 MiniPixel := TPixelPointer.Create(Bitmap); 177 for y := 0 to ScaleToNative(Size.Y) - 1 do begin 178 for x := 0 to ScaleToNative(Size.X) - 1 do begin 178 xx := ScaleToNative(Size.X); 179 yy := ScaleToNative(Size.Y); 180 for y := 0 to yy - 1 do begin 181 for x := 0 to xx - 1 do begin 179 182 for i := 0 to 1 do begin 180 xm := (x * 2 + i + y and 1) mod ( ScaleToNative(Size.X)* 2);183 xm := (x * 2 + i + y and 1) mod (xx * 2); 181 184 MiniPixel.SetX(xm); 182 185 cm := Colors[Map[ScaleFromNative(x) * lxmax div Size.X + lxmax * 183 186 ((ScaleFromNative(y) * (lymax - 1) + Size.Y div 2) div (Size.Y - 1))] and 184 fTerrain, i]; 185 MiniPixel.Pixel^.B := ((cm shr 16) and $FF) * Brightness div 3; 186 MiniPixel.Pixel^.G := ((cm shr 8) and $FF) * Brightness div 3; 187 MiniPixel.Pixel^.R := ((cm shr 0) and $FF) * Brightness div 3; 187 fTerrain, I]; 188 if (PByte(MiniPixel.Pixel) >= Bitmap.RawImage.Data) and 189 (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + yy * MiniPixel.BytesPerLine)) then begin 190 MiniPixel.Pixel^.B := ((cm shr 16) and $FF) * Brightness div 3; 191 MiniPixel.Pixel^.G := ((cm shr 8) and $FF) * Brightness div 3; 192 MiniPixel.Pixel^.R := ((cm shr 0) and $FF) * Brightness div 3; 193 end; 188 194 end; 189 195 end; … … 198 204 MiniPixel: TPixelPointer; 199 205 PrevMiniPixel: TPixelPointer; 206 xx, yy: Integer; 200 207 begin 201 208 OwnColor := HGrSystem.Data.Canvas.Pixels[95, 67]; … … 207 214 MiniPixel := TPixelPointer.Create(Bitmap); 208 215 PrevMiniPixel := TPixelPointer.Create(Bitmap, 0, -1); 209 for y := 0 to ScaleToNative(Size.Y) - 1 do begin 210 for x := 0 to ScaleToNative(Size.X) - 1 do begin 216 xx := ScaleToNative(Size.X); 217 yy := ScaleToNative(Size.Y); 218 for y := 0 to yy - 1 do begin 219 for x := 0 to xx - 1 do begin 211 220 for i := 0 to 1 do begin 212 xm := (x * 2 + i + y and 1) mod ( ScaleToNative(Size.X)* 2);221 xm := (x * 2 + i + y and 1) mod (xx * 2); 213 222 MiniPixel.SetX(xm); 214 223 Tile := SaveMap[ScaleFromNative(x) + Size.X * ScaleFromNative(y)]; … … 221 230 // 2x2 city dot covers two lines 222 231 PrevMiniPixel.SetX(xm); 223 PrevMiniPixel.Pixel^.B := cm shr 16; 224 PrevMiniPixel.Pixel^.G:= cm shr 8 and $FF; 225 PrevMiniPixel.Pixel^.R := cm and $FF; 232 if (PByte(PrevMiniPixel.Pixel) >= Bitmap.RawImage.Data) and 233 (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + yy * PrevMiniPixel.BytesPerLine)) then begin 234 PrevMiniPixel.Pixel^.B := cm shr 16; 235 PrevMiniPixel.Pixel^.G:= cm shr 8 and $FF; 236 PrevMiniPixel.Pixel^.R := cm and $FF; 237 end; 226 238 end; 227 239 end … … 231 243 end else 232 244 cm := Colors[Tile and fTerrain, i]; 233 MiniPixel.Pixel^.B := (cm shr 16) and $ff; 234 MiniPixel.Pixel^.G := (cm shr 8) and $ff; 235 MiniPixel.Pixel^.R := (cm shr 0) and $ff; 245 if (PByte(MiniPixel.Pixel) >= Bitmap.RawImage.Data) and 246 (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + yy * MiniPixel.BytesPerLine)) then begin 247 MiniPixel.Pixel^.B := (cm shr 16) and $ff; 248 MiniPixel.Pixel^.G := (cm shr 8) and $ff; 249 MiniPixel.Pixel^.R := (cm shr 0) and $ff; 250 end; 236 251 end; 237 252 end; … … 254 269 MyUnit: PUn; 255 270 EnemyUnit: PUnitInfo; 271 xx, yy: Integer; 256 272 begin 257 273 if not Assigned(MyMap) then Exit; … … 268 284 MiniPixel := TPixelPointer.Create(Bitmap); 269 285 PrevMiniPixel := TPixelPointer.Create(Bitmap, 0, -1); 270 for y := 0 to ScaleToNative(Size.Y) - 1 do begin 271 for x := 0 to ScaleToNative(Size.X) - 1 do begin 286 287 xx := ScaleToNative(Size.X); 288 yy := ScaleToNative(Size.Y); 289 for y := 0 to yy - 1 do begin 290 for x := 0 to xx - 1 do begin 272 291 Loc := ScaleFromNative(x) + Size.X * ScaleFromNative(y); 273 292 if (MyMap[Loc] and fTerrain) <> fUNKNOWN then begin 274 293 for i := 0 to 1 do begin 275 294 xm := ((x - ScaleToNative(xwMini)) * 2 + i + y and 1 - ScaleToNative(hw) + 276 ScaleToNative(Size.X) * 5) mod (ScaleToNative(Size.X)* 2);295 xx * 5) mod (xx * 2); 277 296 MiniPixel.SetX(xm); 278 297 TerrainTile := MyMap[Loc] and fTerrain; … … 296 315 // 2x2 city dot covers two lines 297 316 PrevMiniPixel.SetX(xm); 298 PrevMiniPixel.Pixel^.B := (cm shr 16) and $ff; 299 PrevMiniPixel.Pixel^.G := (cm shr 8) and $ff; 300 PrevMiniPixel.Pixel^.R := (cm shr 0) and $ff; 317 if (PByte(PrevMiniPixel.Pixel) >= Bitmap.RawImage.Data) and 318 (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + yy * PrevMiniPixel.BytesPerLine)) then begin 319 PrevMiniPixel.Pixel^.B := (cm shr 16) and $ff; 320 PrevMiniPixel.Pixel^.G := (cm shr 8) and $ff; 321 PrevMiniPixel.Pixel^.R := (cm shr 0) and $ff; 322 end; 301 323 end; 302 324 end … … 318 340 else cm := Tribe[MyRO.Territory[Loc]].Color; 319 341 end; 320 MiniPixel.Pixel^.B := (cm shr 16) and $ff; 321 MiniPixel.Pixel^.G := (cm shr 8) and $ff; 322 MiniPixel.Pixel^.R := (cm shr 0) and $ff; 342 if (PByte(MiniPixel.Pixel) >= Bitmap.RawImage.Data) and 343 (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + yy * MiniPixel.BytesPerLine)) then begin 344 MiniPixel.Pixel^.B := (cm shr 16) and $ff; 345 MiniPixel.Pixel^.G := (cm shr 8) and $ff; 346 MiniPixel.Pixel^.R := (cm shr 0) and $ff; 347 end; 323 348 end; 324 349 end;
Note:
See TracChangeset
for help on using the changeset viewer.