Changeset 704 for trunk/MiniMap.pas
- Timestamp:
- Aug 12, 2025, 3:14:50 PM (6 months ago)
- File:
-
- 1 edited
-
trunk/MiniMap.pas (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/MiniMap.pas
r703 r704 313 313 xxt, xwMini: Integer); 314 314 var 315 x, y, Loc, i, hw, xm, cm, cmPolOcean, cmPolNone: integer;315 X, Y, Loc, I, HW, XM, CM, cmPolOcean, cmPolNone: integer; 316 316 PrevMiniPixel: TPixelPointer; 317 317 MiniPixel: TPixelPointer; … … 321 321 MyUnit: PUn; 322 322 EnemyUnit: PUnitInfo; 323 xx, yy: Integer;323 XX, YY: Integer; 324 324 begin 325 325 if not Assigned(MyMap) then Exit; 326 326 cmPolOcean := HGrSystem.Data.Canvas.Pixels[101, 67]; 327 327 cmPolNone := HGrSystem.Data.Canvas.Pixels[102, 67]; 328 hw:= MapWidth div (xxt * 2);328 HW := MapWidth div (xxt * 2); 329 329 with Bitmap.Canvas do begin 330 330 Brush.Color := $000000; … … 337 337 PrevMiniPixel := TPixelPointer.Create(Bitmap); 338 338 339 xx:= ScaleToNative(Size.X);340 yy:= ScaleToNative(Size.Y);341 for y := 0 to yy- 1 do begin342 for x := 0 to xx- 1 do begin343 Loc := ScaleFromNative( x) + Size.X * ScaleFromNative(y);339 XX := ScaleToNative(Size.X); 340 YY := ScaleToNative(Size.Y); 341 for Y := 0 to YY - 1 do begin 342 for X := 0 to XX - 1 do begin 343 Loc := ScaleFromNative(X) + Size.X * ScaleFromNative(Y); 344 344 if (MyMap[Loc] and fTerrain) <> fUNKNOWN then begin 345 for i:= 0 to 1 do begin346 xm := ((x - ScaleToNative(xwMini)) * 2 + i + y and 1 - ScaleToNative(hw) +347 xx * 5) mod (xx* 2);348 MiniPixel.SetX( xm);345 for I := 0 to 1 do begin 346 XM := ((X - ScaleToNative(xwMini)) * 2 + I + Y and 1 - ScaleToNative(HW) + 347 XX * 5) mod (XX * 2); 348 MiniPixel.SetX(XM); 349 349 TerrainTile := MyMap[Loc] and fTerrain; 350 350 if TerrainTile > 11 then TerrainTile := 0; 351 cm := Colors[TerrainTile, i];351 CM := Colors[TerrainTile, I]; 352 352 if ClientMode = cEditMap then begin 353 353 if MyMap[Loc] and (fPrefStartPos or fStartPos) <> 0 then 354 cm:= $FFFFFF;354 CM := $FFFFFF; 355 355 end 356 356 else if MyMap[Loc] and fCity <> 0 then begin 357 357 // City 358 358 MyCity := GetMyCityByLoc(Loc); 359 if Assigned(MyCity) then cm:= Tribe[me].Color359 if Assigned(MyCity) then CM := Tribe[me].Color 360 360 else begin 361 361 EnemyCity := GetEnemyCityByLoc(Loc); 362 362 if Assigned(EnemyCity) then 363 cm:= Tribe[EnemyCity^.Owner].Color;363 CM := Tribe[EnemyCity^.Owner].Color; 364 364 end; 365 cm := $808080 or cmshr 1; { increase brightness }366 if y> 0 then begin365 CM := $808080 or CM shr 1; { increase brightness } 366 if Y > 0 then begin 367 367 // 2x2 city dot covers two lines 368 PrevMiniPixel.SetX( xm);368 PrevMiniPixel.SetX(XM); 369 369 if (PByte(PrevMiniPixel.Pixel) >= Bitmap.RawImage.Data) and 370 (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + yy* PrevMiniPixel.BytesPerLine)) then begin371 PrevMiniPixel.PixelB := ( cmshr 16) and $ff;372 PrevMiniPixel.PixelG := ( cmshr 8) and $ff;373 PrevMiniPixel.PixelR := ( cmshr 0) and $ff;370 (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * PrevMiniPixel.BytesPerLine)) then begin 371 PrevMiniPixel.PixelB := (CM shr 16) and $ff; 372 PrevMiniPixel.PixelG := (CM shr 8) and $ff; 373 PrevMiniPixel.PixelR := (CM shr 0) and $ff; 374 374 end; 375 375 end; 376 376 end 377 else if ( i= 0) and (MyMap[Loc] and fUnit <> 0) then begin377 else if (I = 0) and (MyMap[Loc] and fUnit <> 0) then begin 378 378 // Unit 379 379 MyUnit := GetMyUnitByLoc(Loc); 380 if Assigned(MyUnit) then cm:= Tribe[me].Color380 if Assigned(MyUnit) then CM := Tribe[me].Color 381 381 else begin 382 382 EnemyUnit := GetEnemyUnitByLoc(Loc); 383 383 if Assigned(EnemyUnit) then 384 cm:= Tribe[EnemyUnit.Owner].Color;384 CM := Tribe[EnemyUnit.Owner].Color; 385 385 end; 386 cm := $808080 or cmshr 1; { increase brightness }386 CM := $808080 or CM shr 1; { increase brightness } 387 387 end 388 388 else if moPolitical in MapOptions then begin 389 389 // Political 390 if MyMap[Loc] and fTerrain < fGrass then cm:= cmPolOcean391 else if MyRO.Territory[Loc] < 0 then cm:= cmPolNone392 else cm:= Tribe[MyRO.Territory[Loc]].Color;390 if MyMap[Loc] and fTerrain < fGrass then CM := cmPolOcean 391 else if MyRO.Territory[Loc] < 0 then CM := cmPolNone 392 else CM := Tribe[MyRO.Territory[Loc]].Color; 393 393 end; 394 394 if (PByte(MiniPixel.Pixel) >= Bitmap.RawImage.Data) and 395 (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + yy* MiniPixel.BytesPerLine)) then begin396 MiniPixel.PixelB := ( cmshr 16) and $ff;397 MiniPixel.PixelG := ( cmshr 8) and $ff;398 MiniPixel.PixelR := ( cmshr 0) and $ff;395 (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * MiniPixel.BytesPerLine)) then begin 396 MiniPixel.PixelB := (CM shr 16) and $ff; 397 MiniPixel.PixelG := (CM shr 8) and $ff; 398 MiniPixel.PixelR := (CM shr 0) and $ff; 399 399 end; 400 400 end; … … 402 402 end; 403 403 MiniPixel.NextLine; 404 if y> 0 then PrevMiniPixel.NextLine;404 if Y > 0 then PrevMiniPixel.NextLine; 405 405 end; 406 406 Bitmap.EndUpdate;
Note:
See TracChangeset
for help on using the changeset viewer.
