Changeset 447 for trunk/LocalPlayer/IsoEngine.pas
- Timestamp:
- May 19, 2022, 10:39:34 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/IsoEngine.pas
r442 r447 13 13 14 14 type 15 TInitEnemyModelEvent = function(emix: integer): boolean;15 TInitEnemyModelEvent = function(emix: Integer): Boolean; 16 16 TTileSize = (tsSmall, tsMedium, tsBig); 17 17 … … 33 33 Dirx: array [0..7] of Integer = (1, 2, 1, 0, -1, -2, -1, 0); 34 34 Diry: array [0..7] of Integer = (-1, 0, 1, 2, 1, 0, -1, -2); 35 procedure CityGrid(xm, ym: integer; CityAllowClick: Boolean);36 function IsShoreTile(Loc: integer): boolean;35 procedure CityGrid(xm, ym: Integer; CityAllowClick: Boolean); 36 function IsShoreTile(Loc: Integer): Boolean; 37 37 procedure MakeDark(Line: PPixelPointer; Length: Integer); 38 38 procedure SetTileSize(AValue: TTileSize); 39 procedure ShadeOutside(x0, y0, Width, Height, xm, ym: integer);39 procedure ShadeOutside(x0, y0, Width, Height, xm, ym: Integer); 40 40 protected 41 41 FOutput: TBitmap; … … 65 65 ShowDebug: Boolean; 66 66 FoW: Boolean; 67 function Connection4(Loc, Mask, Value: integer): integer;68 function Connection8(Loc, Mask: integer): integer;69 function OceanConnection(Loc: integer): integer;70 procedure PaintShore( x, y, Loc: integer);71 procedure PaintTileExtraTerrain( x, y, Loc: integer);72 procedure PaintTileObjects( x, y, Loc, CityLoc, CityOwner: integer;73 UseBlink: boolean);74 procedure PaintGrid( x, y, nx, ny: integer);75 procedure FillRect( x, y, Width, Height, Color: integer);76 procedure Textout( x, y, Color: integer; const s: string);77 procedure Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);78 procedure TSprite(xDst, yDst, grix: integer; PureBlack: boolean = false);67 function Connection4(Loc, Mask, Value: Integer): Integer; 68 function Connection8(Loc, Mask: Integer): Integer; 69 function OceanConnection(Loc: Integer): Integer; 70 procedure PaintShore(X, Y, Loc: Integer); 71 procedure PaintTileExtraTerrain(X, Y, Loc: Integer); 72 procedure PaintTileObjects(X, Y, Loc, CityLoc, CityOwner: Integer; 73 UseBlink: Boolean); 74 procedure PaintGrid(X, Y, nx, ny: Integer); 75 procedure FillRect(X, Y, Width, Height, Color: Integer); 76 procedure Textout(X, Y, Color: Integer; const S: string); 77 procedure Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer); 78 procedure TSprite(xDst, yDst, grix: Integer; PureBlack: Boolean = False); 79 79 procedure ApplyTileSize(ATileSize: TTileSize); 80 80 public … … 89 89 procedure Reset; 90 90 procedure SetOutput(Output: TBitmap); 91 procedure SetPaintBounds(Left, Top, Right, Bottom: integer);92 procedure Paint( x, y, Loc, nx, ny, CityLoc, CityOwner: integer;93 UseBlink: boolean = false; CityAllowClick: boolean = false);94 procedure PaintUnit( x, y: integer; const UnitInfo: TUnitInfo;95 Status: integer);96 procedure PaintCity( x, y: integer; const CityInfo: TCityInfo;97 accessory: boolean = true);98 procedure BitBltBitmap(Src: TBitmap; x, y, Width, Height, xSrc, ySrc,99 Rop: integer);91 procedure SetPaintBounds(Left, Top, Right, Bottom: Integer); 92 procedure Paint(X, Y, Loc, nx, ny, CityLoc, CityOwner: Integer; 93 UseBlink: Boolean = False; CityAllowClick: Boolean = False); 94 procedure PaintUnit(X, Y: Integer; const UnitInfo: TUnitInfo; 95 Status: Integer); 96 procedure PaintCity(X, Y: Integer; const CityInfo: TCityInfo; 97 accessory: Boolean = True); 98 procedure BitBltBitmap(Src: TBitmap; X, Y, Width, Height, xSrc, ySrc, 99 Rop: Integer); 100 100 procedure AttackBegin(const ShowMove: TShowMove); 101 101 procedure AttackEffect(const ShowMove: TShowMove); 102 102 procedure AttackEnd; 103 103 procedure ReduceTerrainIconsSize; 104 property AdviceLoc: integer read FAdviceLoc write FAdviceLoc;104 property AdviceLoc: Integer read FAdviceLoc write FAdviceLoc; 105 105 property TileSize: TTileSize read FTileSize write SetTileSize; 106 106 end; … … 127 127 (X: 72; Y: 36)); 128 128 129 function IsJungle( y: integer): boolean;129 function IsJungle(Y: Integer): Boolean; 130 130 procedure Init(InitEnemyModelHandler: TInitEnemyModelEvent); 131 131 … … 173 173 IsoMapCache: array[TTileSize] of TIsoMapCache; 174 174 175 function IsJungle( y: integer): boolean;176 begin 177 result := (y > (G.ly - 2) div 4) and (G.ly - 1 - y> (G.ly - 2) div 4)175 function IsJungle(Y: Integer): Boolean; 176 begin 177 Result := (Y > (G.ly - 2) div 4) and (G.ly - 1 - Y > (G.ly - 2) div 4) 178 178 end; 179 179 … … 254 254 Mask24.BeginUpdate; 255 255 for ySrc := 0 to TerrainIconLines - 1 do begin 256 for i:= 0 to yyt * 3 - 1 do257 MaskLine[ i] := PixelPointer(Mask24, ScaleToNative(0),258 ScaleToNative(1 + ySrc * (yyt * 3 + 1) + i));256 for I := 0 to yyt * 3 - 1 do 257 MaskLine[I] := PixelPointer(Mask24, ScaleToNative(0), 258 ScaleToNative(1 + ySrc * (yyt * 3 + 1) + I)); 259 259 for xSrc := 0 to TerrainIconCols - 1 do begin 260 i:= ySrc * 9 + xSrc;261 TSpriteSize[ i].Left := 0;260 I := ySrc * 9 + xSrc; 261 TSpriteSize[I].Left := 0; 262 262 repeat 263 Border := true;264 for y:= 0 to yyt * 3 - 1 do begin265 MaskLine[ y].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + TSpriteSize[i].Left));266 if MaskLine[ y].Pixel^.B = 0 then Border := false;263 Border := True; 264 for Y := 0 to yyt * 3 - 1 do begin 265 MaskLine[Y].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + TSpriteSize[I].Left)); 266 if MaskLine[Y].Pixel^.B = 0 then Border := False; 267 267 end; 268 if Border then Inc(TSpriteSize[ i].Left);269 until not Border or (TSpriteSize[ i].Left = xxt * 2 - 1);270 TSpriteSize[ i].Top := 0;268 if Border then Inc(TSpriteSize[I].Left); 269 until not Border or (TSpriteSize[I].Left = xxt * 2 - 1); 270 TSpriteSize[I].Top := 0; 271 271 repeat 272 Border := true;273 for x:= 0 to xxt * 2 - 1 do begin274 MaskLine[TSpriteSize[ i].Top].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + x));275 if MaskLine[TSpriteSize[ i].Top].Pixel^.B = 0 then Border := false;272 Border := True; 273 for X := 0 to xxt * 2 - 1 do begin 274 MaskLine[TSpriteSize[I].Top].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + X)); 275 if MaskLine[TSpriteSize[I].Top].Pixel^.B = 0 then Border := False; 276 276 end; 277 if Border then inc(TSpriteSize[i].Top);278 until not Border or (TSpriteSize[ i].Top = yyt * 3 - 1);279 TSpriteSize[ i].Right := xxt * 2;277 if Border then Inc(TSpriteSize[I].Top); 278 until not Border or (TSpriteSize[I].Top = yyt * 3 - 1); 279 TSpriteSize[I].Right := xxt * 2; 280 280 repeat 281 Border := true;282 for y:= 0 to yyt * 3 - 1 do begin283 MaskLine[ y].SetX(ScaleToNative(xSrc * (xxt * 2 + 1) + TSpriteSize[i].Right));284 if MaskLine[ y].Pixel^.B = 0 then Border := false;281 Border := True; 282 for Y := 0 to yyt * 3 - 1 do begin 283 MaskLine[Y].SetX(ScaleToNative(xSrc * (xxt * 2 + 1) + TSpriteSize[I].Right)); 284 if MaskLine[Y].Pixel^.B = 0 then Border := False; 285 285 end; 286 if Border then Dec(TSpriteSize[ i].Right);287 until not Border or (TSpriteSize[ i].Right = TSpriteSize[i].Left);288 TSpriteSize[ i].Bottom := yyt * 3;286 if Border then Dec(TSpriteSize[I].Right); 287 until not Border or (TSpriteSize[I].Right = TSpriteSize[I].Left); 288 TSpriteSize[I].Bottom := yyt * 3; 289 289 repeat 290 Border := true;291 for x:= 0 to xxt * 2 - 1 do begin292 MaskLine[TSpriteSize[ i].Bottom - 1].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + x));293 if MaskLine[TSpriteSize[ i].Bottom - 1].Pixel^.B = 0 then Border := false;290 Border := True; 291 for X := 0 to xxt * 2 - 1 do begin 292 MaskLine[TSpriteSize[I].Bottom - 1].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + X)); 293 if MaskLine[TSpriteSize[I].Bottom - 1].Pixel^.B = 0 then Border := False; 294 294 end; 295 if Border then Dec(TSpriteSize[ i].Bottom);296 until not Border or (TSpriteSize[ i].Bottom = TSpriteSize[i].Top);295 if Border then Dec(TSpriteSize[I].Bottom); 296 until not Border or (TSpriteSize[I].Bottom = TSpriteSize[I].Top); 297 297 end; 298 298 end; … … 303 303 procedure TIsoMap.ApplyTileSize(ATileSize: TTileSize); 304 304 var 305 x: Integer;306 y: Integer;305 X: Integer; 306 Y: Integer; 307 307 xSrc: Integer; 308 308 ySrc: Integer; … … 361 361 1 + yyt + 15 * (yyt * 3 + 1), SRCAND); 362 362 363 for x:= -1 to 6 do begin364 if x= -1 then begin363 for X := -1 to 6 do begin 364 if X = -1 then begin 365 365 xSrc := ShoreDither * (xxt * 2 + 1) + 1; 366 366 ySrc := 1 + yyt; 367 367 end 368 else if x= 6 then begin368 else if X = 6 then begin 369 369 xSrc := 1 + (xxt * 2 + 1) * 2; 370 370 ySrc := 1 + yyt + (yyt * 3 + 1) * 2; 371 371 end else begin 372 xSrc := ( x+ 2) * (xxt * 2 + 1) + 1;372 xSrc := (X + 2) * (xxt * 2 + 1) + 1; 373 373 ySrc := 1 + yyt; 374 374 end; 375 for y:= -1 to 6 do376 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt,375 for Y := -1 to 6 do 376 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, 377 377 xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc); 378 for y:= -2 to 6 do379 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt, xxt,378 for Y := -2 to 6 do 379 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, xxt, 380 380 yyt, HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, 381 381 SRCPAINT); 382 for y:= -2 to 6 do383 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2) + xxt, (y+ 2) * yyt,382 for Y := -2 to 6 do 383 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2) + xxt, (Y + 2) * yyt, 384 384 xxt, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, 385 385 SRCPAINT); 386 for y:= -2 to 6 do387 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt, xxt,386 for Y := -2 to 6 do 387 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, xxt, 388 388 yyt, DitherMask.Canvas, xxt, yyt, SRCAND); 389 for y:= -2 to 6 do390 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2) + xxt, (y+ 2) * yyt,389 for Y := -2 to 6 do 390 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2) + xxt, (Y + 2) * yyt, 391 391 xxt, yyt, DitherMask.Canvas, 0, yyt, SRCAND); 392 392 end; 393 393 394 for y:= -1 to 6 do begin395 if y= -1 then begin394 for Y := -1 to 6 do begin 395 if Y = -1 then begin 396 396 xSrc := ShoreDither * (xxt * 2 + 1) + 1; 397 397 ySrc := 1 + yyt; 398 398 end 399 else if y= 6 then begin399 else if Y = 6 then begin 400 400 xSrc := 1 + 2 * (xxt * 2 + 1); 401 401 ySrc := 1 + yyt + 2 * (yyt * 3 + 1); 402 402 end else begin 403 xSrc := ( y+ 2) * (xxt * 2 + 1) + 1;403 xSrc := (Y + 2) * (xxt * 2 + 1) + 1; 404 404 ySrc := 1 + yyt; 405 405 end; 406 for x:= -2 to 6 do407 BitBltCanvas(LandMore.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt,406 for X := -2 to 6 do 407 BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, 408 408 xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc); 409 BitBltCanvas(LandMore.Canvas, xxt * 2, ( y+ 2) * yyt, xxt, yyt,409 BitBltCanvas(LandMore.Canvas, xxt * 2, (Y + 2) * yyt, xxt, yyt, 410 410 HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, SRCPAINT); 411 for x:= 0 to 7 do412 BitBltCanvas(LandMore.Canvas, ( x + 2) * (xxt * 2) - xxt, (y+ 2) * yyt,411 for X := 0 to 7 do 412 BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2) - xxt, (Y + 2) * yyt, 413 413 xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, 414 414 SRCPAINT); 415 for x:= -2 to 6 do416 BitBltCanvas(LandMore.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt,415 for X := -2 to 6 do 416 BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, 417 417 xxt * 2, yyt, DitherMask.Canvas, 0, 0, SRCAND); 418 418 end; 419 419 420 for x:= 0 to 3 do begin421 for y:= 0 to 3 do begin422 if ( x = 1) and (y= 1) then xSrc := 1420 for X := 0 to 3 do begin 421 for Y := 0 to 3 do begin 422 if (X = 1) and (Y = 1) then xSrc := 1 423 423 else 424 xSrc := ( xmod 2) * (xxt * 2 + 1) + 1;424 xSrc := (X mod 2) * (xxt * 2 + 1) + 1; 425 425 ySrc := 1 + yyt; 426 if ( x >= 1) = (y>= 2) then427 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y* yyt, xxt * 2, yyt,426 if (X >= 1) = (Y >= 2) then 427 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt, 428 428 HGrTerrain.Data.Canvas, xSrc, ySrc); 429 if ( x >= 1) and ((y < 2) or (x>= 2)) then429 if (X >= 1) and ((Y < 2) or (X >= 2)) then 430 430 begin 431 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y* yyt, xxt, yyt,431 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt, yyt, 432 432 HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, 433 433 SRCPAINT); 434 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2) + xxt, y* yyt, xxt, yyt,434 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2) + xxt, Y * yyt, xxt, yyt, 435 435 HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, SRCPAINT); 436 436 end; 437 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y* yyt, xxt, yyt,437 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt, yyt, 438 438 DitherMask.Canvas, xxt, yyt, SRCAND); 439 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2) + xxt, y* yyt, xxt, yyt,439 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2) + xxt, Y * yyt, xxt, yyt, 440 440 DitherMask.Canvas, 0, yyt, SRCAND); 441 441 end; 442 442 end; 443 443 444 for y:= 0 to 3 do begin445 for x:= 0 to 3 do begin446 if ( x = 1) and (y= 1) then xSrc := 1444 for Y := 0 to 3 do begin 445 for X := 0 to 3 do begin 446 if (X = 1) and (Y = 1) then xSrc := 1 447 447 else 448 xSrc := ( ymod 2) * (xxt * 2 + 1) + 1;448 xSrc := (Y mod 2) * (xxt * 2 + 1) + 1; 449 449 ySrc := 1 + yyt; 450 if ( x < 1) or (y>= 2) then451 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y* yyt, xxt * 2, yyt,450 if (X < 1) or (Y >= 2) then 451 BitBltCanvas(OceanMore.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt, 452 452 HGrTerrain.Data.Canvas, xSrc, ySrc); 453 if ( x = 1) and (y < 2) or (x >= 2) and (y>= 1) then453 if (X = 1) and (Y < 2) or (X >= 2) and (Y >= 1) then 454 454 begin 455 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y* yyt, xxt, yyt,455 BitBltCanvas(OceanMore.Canvas, X * (xxt * 2), Y * yyt, xxt, yyt, 456 456 HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, 457 457 SRCPAINT); 458 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2) + xxt, y* yyt, xxt, yyt,458 BitBltCanvas(OceanMore.Canvas, X * (xxt * 2) + xxt, Y * yyt, xxt, yyt, 459 459 HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, SRCPAINT); 460 460 end; 461 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y* yyt, xxt * 2, yyt,461 BitBltCanvas(OceanMore.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt, 462 462 DitherMask.Canvas, 0, 0, SRCAND); 463 463 end; … … 469 469 HGrTerrain.Mask.Canvas, 1, 1 + yyt, SRCPAINT); 470 470 471 for x:= -1 to 6 do472 for y:= -2 to 6 do473 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt,471 for X := -1 to 6 do 472 for Y := -2 to 6 do 473 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, 474 474 xxt * 2, yyt, DitherMask.Canvas, 0, 0, SRCAND); 475 475 476 for y:= -1 to 6 do477 for x:= -2 to 7 do478 BitBltCanvas(LandMore.Canvas, ( x + 2) * (xxt * 2) - xxt, (y+ 2) * yyt,476 for Y := -1 to 6 do 477 for X := -2 to 7 do 478 BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2) - xxt, (Y + 2) * yyt, 479 479 xxt * 2, yyt, DitherMask.Canvas, 0, yyt, SRCAND); 480 480 … … 482 482 LandMore.Canvas, 0, 0, SRCPAINT); 483 483 484 for x:= 0 to 3 do485 for y:= 0 to 3 do486 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y* yyt, xxt * 2, yyt,484 for X := 0 to 3 do 485 for Y := 0 to 3 do 486 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt, 487 487 DitherMask.Canvas, 0, 0, SRCAND); 488 488 489 for y:= 0 to 3 do490 for x:= 0 to 4 do491 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2) - xxt, y* yyt, xxt * 2,489 for Y := 0 to 3 do 490 for X := 0 to 4 do 491 BitBltCanvas(OceanMore.Canvas, X * (xxt * 2) - xxt, Y * yyt, xxt * 2, 492 492 yyt, DitherMask.Canvas, 0, yyt, SRCAND); 493 493 … … 502 502 HGrTerrain.Mask.Canvas, 1, 1 + yyt); 503 503 504 for x:= 0 to 6 do505 BitBltCanvas(LandPatch.Canvas, ( x+ 2) * (xxt * 2), yyt, xxt * 2, yyt,504 for X := 0 to 6 do 505 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), yyt, xxt * 2, yyt, 506 506 DitherMask.Canvas, 0, 0, SRCAND); 507 507 BitBltCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt, DitherMask.Canvas, 508 508 0, 0, DSTINVERT); 509 509 510 for y:= 0 to 6 do511 BitBltCanvas(LandPatch.Canvas, xxt * 2, ( y+ 2) * yyt, xxt * 2, yyt,510 for Y := 0 to 6 do 511 BitBltCanvas(LandPatch.Canvas, xxt * 2, (Y + 2) * yyt, xxt * 2, yyt, 512 512 DitherMask.Canvas, 0, 0, SRCAND); 513 513 … … 555 555 end; 556 556 557 procedure TIsoMap.SetPaintBounds(Left, Top, Right, Bottom: integer);557 procedure TIsoMap.SetPaintBounds(Left, Top, Right, Bottom: Integer); 558 558 begin 559 559 FLeft := Left; … … 563 563 end; 564 564 565 procedure TIsoMap.FillRect( x, y, Width, Height, Color: integer);566 begin 567 if x< FLeft then568 begin 569 Width := Width - (FLeft - x);570 x:= FLeft;571 end; 572 if y< FTop then573 begin 574 Height := Height - (FTop - y);575 y:= FTop;576 end; 577 if x+ Width >= FRight then578 Width := FRight - x;579 if y+ Height >= FBottom then580 Height := FBottom - y;565 procedure TIsoMap.FillRect(X, Y, Width, Height, Color: Integer); 566 begin 567 if X < FLeft then 568 begin 569 Width := Width - (FLeft - X); 570 X := FLeft; 571 end; 572 if Y < FTop then 573 begin 574 Height := Height - (FTop - Y); 575 Y := FTop; 576 end; 577 if X + Width >= FRight then 578 Width := FRight - X; 579 if Y + Height >= FBottom then 580 Height := FBottom - Y; 581 581 if (Width <= 0) or (Height <= 0) then 582 exit;582 Exit; 583 583 584 584 FOutput.Canvas.Brush.Color := Color; 585 FOutput.Canvas.FillRect(Rect( x, y, x + Width, y+ Height));585 FOutput.Canvas.FillRect(Rect(X, Y, X + Width, Y + Height)); 586 586 FOutput.Canvas.Brush.Style := bsClear; 587 587 end; 588 588 589 procedure TIsoMap.Textout( x, y, Color: integer; const s: string);589 procedure TIsoMap.Textout(X, Y, Color: Integer; const S: string); 590 590 begin 591 591 FOutput.Canvas.Font.Color := Color; 592 FOutput.Canvas.TextRect(Rect(FLeft, FTop, FRight, FBottom), x, y, s)593 end; 594 595 procedure TIsoMap.BitBltBitmap(Src: TBitmap; x, y, Width, Height, xSrc, ySrc,596 Rop: integer);597 begin 598 if x< FLeft then599 begin 600 Width := Width - (FLeft - x);601 xSrc := xSrc + (FLeft - x);602 x:= FLeft;603 end; 604 if y< FTop then605 begin 606 Height := Height - (FTop - y);607 ySrc := ySrc + (FTop - y);608 y:= FTop;609 end; 610 if x+ Width >= FRight then611 Width := FRight - x;612 if y+ Height >= FBottom then613 Height := FBottom - y;592 FOutput.Canvas.TextRect(Rect(FLeft, FTop, FRight, FBottom), X, Y, S) 593 end; 594 595 procedure TIsoMap.BitBltBitmap(Src: TBitmap; X, Y, Width, Height, xSrc, ySrc, 596 Rop: Integer); 597 begin 598 if X < FLeft then 599 begin 600 Width := Width - (FLeft - X); 601 xSrc := xSrc + (FLeft - X); 602 X := FLeft; 603 end; 604 if Y < FTop then 605 begin 606 Height := Height - (FTop - Y); 607 ySrc := ySrc + (FTop - Y); 608 Y := FTop; 609 end; 610 if X + Width >= FRight then 611 Width := FRight - X; 612 if Y + Height >= FBottom then 613 Height := FBottom - Y; 614 614 if (Width <= 0) or (Height <= 0) then 615 exit;616 617 BitBltCanvas(FOutput.Canvas, x, y, Width, Height, Src.Canvas, xSrc, ySrc, Rop);618 end; 619 620 procedure TIsoMap.Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);615 Exit; 616 617 BitBltCanvas(FOutput.Canvas, X, Y, Width, Height, Src.Canvas, xSrc, ySrc, Rop); 618 end; 619 620 procedure TIsoMap.Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer); 621 621 begin 622 622 BitBltBitmap(HGr.Mask, xDst, yDst, Width, Height, xGr, yGr, SRCAND); … … 624 624 end; 625 625 626 procedure TIsoMap.TSprite(xDst, yDst, grix: integer;627 PureBlack: boolean = false);626 procedure TIsoMap.TSprite(xDst, yDst, grix: Integer; 627 PureBlack: Boolean = False); 628 628 var 629 629 Width: Integer; 630 630 Height: Integer; 631 631 xSrc: Integer; 632 ySrc: integer;632 ySrc: Integer; 633 633 begin 634 634 Width := TSpriteSize[grix].Right - TSpriteSize[grix].Left; … … 653 653 Height := FBottom - yDst; 654 654 if (Width <= 0) or (Height <= 0) then 655 exit;655 Exit; 656 656 657 657 BitBltCanvas(FOutput.Canvas, xDst, yDst, Width, Height, MaskCanvas, xSrc, ySrc, SRCAND); … … 660 660 end; 661 661 662 procedure TIsoMap.PaintUnit( x, y: integer; const UnitInfo: TUnitInfo;663 Status: integer);664 var 665 xsh, ysh, xGr, yGr, j, mixShow: integer;662 procedure TIsoMap.PaintUnit(X, Y: Integer; const UnitInfo: TUnitInfo; 663 Status: Integer); 664 var 665 xsh, ysh, xGr, yGr, J, mixShow: Integer; 666 666 begin 667 667 with UnitInfo do 668 if (Owner = me) or (emix <> $FFFF) then668 if (Owner = Me) or (emix <> $FFFF) then 669 669 begin 670 670 if Job = jCity then … … 675 675 (@OnInitEnemyModel <> nil) then 676 676 if not OnInitEnemyModel(emix) then 677 exit;677 Exit; 678 678 xsh := Tribe[Owner].ModelPicture[mixShow].xShield; 679 679 ysh := Tribe[Owner].ModelPicture[mixShow].yShield; 680 680 {$IFNDEF SCR} if Status and usStay <> 0 then 681 j:= 19681 J := 19 682 682 else if Status and usRecover <> 0 then 683 j:= 16683 J := 16 684 684 else if Status and (usGoto or usEnhance) = usGoto or usEnhance then 685 j:= 18685 J := 18 686 686 else if Status and usEnhance <> 0 then 687 j:= 17687 J := 17 688 688 else if Status and usGoto <> 0 then 689 j:= 20689 J := 20 690 690 else {$ENDIF} if Job = jCity then 691 j:= jNone691 J := jNone 692 692 else 693 j:= Job;693 J := Job; 694 694 if Flags and unMulti <> 0 then 695 Sprite(Tribe[Owner].symHGr, x + xsh - 1 + 4, y+ ysh - 2, 14, 12,695 Sprite(Tribe[Owner].symHGr, X + xsh - 1 + 4, Y + ysh - 2, 14, 12, 696 696 33 + Tribe[Owner].sympix mod 10 * 65, 697 697 1 + Tribe[Owner].sympix div 10 * 49); 698 Sprite(Tribe[Owner].symHGr, x + xsh - 1, y+ ysh - 2, 14, 12,698 Sprite(Tribe[Owner].symHGr, X + xsh - 1, Y + ysh - 2, 14, 12, 699 699 18 + Tribe[Owner].sympix mod 10 * 65, 700 700 1 + Tribe[Owner].sympix div 10 * 49); 701 FillRect( x + xsh, y+ ysh + 5, 1 + Health * 11 div 100, 3,701 FillRect(X + xsh, Y + ysh + 5, 1 + Health * 11 div 100, 3, 702 702 ColorOfHealth(Health)); 703 if j> 0 then703 if J > 0 then 704 704 begin 705 xGr := 121 + jmod 7 * 9;706 yGr := 1 + jdiv 7 * 9;707 BitBltBitmap(HGrSystem.Mask, x + xsh + 3, y+ ysh + 9, 8, 8, xGr,705 xGr := 121 + J mod 7 * 9; 706 yGr := 1 + J div 7 * 9; 707 BitBltBitmap(HGrSystem.Mask, X + xsh + 3, Y + ysh + 9, 8, 8, xGr, 708 708 yGr, SRCAND); 709 Sprite(HGrSystem, x + xsh + 2, y+ ysh + 8, 8, 8, xGr, yGr);709 Sprite(HGrSystem, X + xsh + 2, Y + ysh + 8, 8, 8, xGr, yGr); 710 710 end; 711 711 with Tribe[Owner].ModelPicture[mixShow] do 712 Sprite(HGr, x, y, 64, 48, pix mod 10 * 65 + 1, pix div 10 * 49 + 1);712 Sprite(HGr, X, Y, 64, 48, pix mod 10 * 65 + 1, pix div 10 * 49 + 1); 713 713 if Flags and unFortified <> 0 then 714 714 begin 715 715 { DataCanvas:=HGrTerrain.Data.Canvas; 716 716 MaskCanvas:=HGrTerrain.Mask.Canvas; 717 TSprite( x,y+16,12*9+7); }718 Sprite(HGrStdUnits, x, y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1);717 TSprite(X,Y+16,12*9+7); } 718 Sprite(HGrStdUnits, X, Y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1); 719 719 end; 720 720 end; 721 721 end; 722 722 723 procedure TIsoMap.PaintCity( x, y: integer; const CityInfo: TCityInfo;724 accessory: boolean);723 procedure TIsoMap.PaintCity(X, Y: Integer; const CityInfo: TCityInfo; 724 accessory: Boolean); 725 725 var 726 726 age: Integer; … … 733 733 LabelLength: Integer; 734 734 cpic: TCityPicture; 735 s: string;735 S: string; 736 736 begin 737 737 age := GetAge(CityInfo.Owner); … … 752 752 (cHGr.Data.Canvas.Pixels[(xGr + 4) * 65, cpix * 49 + 48] = $00FFFF) 753 753 then 754 Sprite(cHGr, x - xxc, y- 2 * yyc, xxc * 2, yyc * 3,754 Sprite(cHGr, X - xxc, Y - 2 * yyc, xxc * 2, yyc * 3, 755 755 xGr * (xxc * 2 + 1) + 1, 1 + cpix * (yyc * 3 + 1)); 756 756 if ciWalled and CityInfo.Flags <> 0 then 757 Sprite(cHGr, x - xxc, y- 2 * yyc, xxc * 2, yyc * 3,757 Sprite(cHGr, X - xxc, Y - 2 * yyc, xxc * 2, yyc * 3, 758 758 (xGr + 4) * (xxc * 2 + 1) + 1, 1 + cpix * (yyc * 3 + 1)); 759 759 end … … 761 761 begin 762 762 if ciWalled and CityInfo.Flags <> 0 then 763 Sprite(HGrCities, x - xxt, y- 2 * yyt, 2 * xxt, 3 * yyt,763 Sprite(HGrCities, X - xxt, Y - 2 * yyt, 2 * xxt, 3 * yyt, 764 764 (xGr + 4) * (2 * xxt + 1) + 1, 1 + (age - 2) * (3 * yyt + 1)) 765 765 else 766 Sprite(HGrCities, x - xxt, y- 2 * yyt, 2 * xxt, 3 * yyt,766 Sprite(HGrCities, X - xxt, Y - 2 * yyt, 2 * xxt, 3 * yyt, 767 767 xGr * (2 * xxt + 1) + 1, 1 + (age - 2) * (3 * yyt + 1)); 768 768 end; 769 769 770 770 if not accessory then 771 exit;771 Exit; 772 772 773 773 { if ciCapital and CityInfo.Flags<>0 then 774 Sprite(Tribe[CityInfo.Owner].symHGr, x+cpic.xf,y-13+cpic.yf,13,14,774 Sprite(Tribe[CityInfo.Owner].symHGr,X+cpic.xf,Y-13+cpic.yf,13,14, 775 775 1+Tribe[CityInfo.Owner].sympix mod 10 *65, 776 776 1+Tribe[CityInfo.Owner].sympix div 10 *49); {capital -- paint flag } … … 781 781 begin 782 782 cpic := Tribe[CityInfo.Owner].CityPicture[xGr]; 783 xShield := x- xxc + cpic.xShield;784 yShield := y- 2 * yyc + cpic.yShield;783 xShield := X - xxc + cpic.xShield; 784 yShield := Y - 2 * yyc + cpic.yShield; 785 785 end 786 786 else 787 787 begin 788 788 cpic := CitiesPictures.Pictures[age, xGr]; 789 xShield := x- xxt + cpic.xShield;790 yShield := y- 2 * yyt + cpic.yShield;789 xShield := X - xxt + cpic.xShield; 790 yShield := Y - 2 * yyt + cpic.yShield; 791 791 end; 792 s:= IntToStr(CityInfo.size);793 LabelLength := FOutput.Canvas.TextWidth( s);792 S := IntToStr(CityInfo.size); 793 LabelLength := FOutput.Canvas.TextWidth(S); 794 794 FillRect(xShield, yShield, LabelLength + 4, 16, $000000); 795 795 if MyMap[CityInfo.Loc] and (fUnit or fObserved) = fObserved then … … 802 802 LabelTextColor := $000000; 803 803 end; 804 Textout(xShield + 2, yShield - 1, LabelTextColor, s);805 end; 806 end; 807 808 function PoleTile(Loc: integer): integer;804 Textout(xShield + 2, yShield - 1, LabelTextColor, S); 805 end; 806 end; 807 808 function PoleTile(Loc: Integer): Integer; 809 809 begin { virtual pole tile } 810 result := fUNKNOWN;810 Result := fUNKNOWN; 811 811 if Loc < -2 * G.lx then 812 812 else if Loc < -G.lx then … … 815 815 (MyMap[dLoc(Loc, -2, 2)] and fTerrain <> fUNKNOWN) and 816 816 (MyMap[dLoc(Loc, 2, 2)] and fTerrain <> fUNKNOWN) then 817 result := fArctic;817 Result := fArctic; 818 818 if (MyMap[dLoc(Loc, 0, 2)] and fObserved <> 0) and 819 819 (MyMap[dLoc(Loc, -2, 2)] and fObserved <> 0) and 820 820 (MyMap[dLoc(Loc, 2, 2)] and fObserved <> 0) then 821 result := result or fObserved;821 Result := Result or fObserved; 822 822 end 823 823 else if Loc < 0 then … … 825 825 if (MyMap[dLoc(Loc, -1, 1)] and fTerrain <> fUNKNOWN) and 826 826 (MyMap[dLoc(Loc, 1, 1)] and fTerrain <> fUNKNOWN) then 827 result := fArctic;827 Result := fArctic; 828 828 if (MyMap[dLoc(Loc, -1, 1)] and fObserved <> 0) and 829 829 (MyMap[dLoc(Loc, 1, 1)] and fObserved <> 0) then 830 result := result or fObserved;830 Result := Result or fObserved; 831 831 end 832 832 else if Loc < G.lx * (G.ly + 1) then … … 834 834 if (MyMap[dLoc(Loc, -1, -1)] and fTerrain <> fUNKNOWN) and 835 835 (MyMap[dLoc(Loc, 1, -1)] and fTerrain <> fUNKNOWN) then 836 result := fArctic;836 Result := fArctic; 837 837 if (MyMap[dLoc(Loc, -1, -1)] and fObserved <> 0) and 838 838 (MyMap[dLoc(Loc, 1, -1)] and fObserved <> 0) then 839 result := result or fObserved;839 Result := Result or fObserved; 840 840 end 841 841 else if Loc < G.lx * (G.ly + 2) then … … 844 844 (MyMap[dLoc(Loc, -2, -2)] and fTerrain <> fUNKNOWN) and 845 845 (MyMap[dLoc(Loc, 2, -2)] and fTerrain <> fUNKNOWN) then 846 result := fArctic;846 Result := fArctic; 847 847 if (MyMap[dLoc(Loc, 0, -2)] and fObserved <> 0) and 848 848 (MyMap[dLoc(Loc, -2, -2)] and fObserved <> 0) and 849 849 (MyMap[dLoc(Loc, 2, -2)] and fObserved <> 0) then 850 result := result or fObserved;851 end; 852 end; 853 854 function TIsoMap.Connection4(Loc, Mask, Value: integer): integer;855 begin 856 result := 0;850 Result := Result or fObserved; 851 end; 852 end; 853 854 function TIsoMap.Connection4(Loc, Mask, Value: Integer): Integer; 855 begin 856 Result := 0; 857 857 if dLoc(Loc, 1, -1) >= 0 then 858 858 begin 859 859 if MyMap[dLoc(Loc, 1, -1)] and Mask = Cardinal(Value) then 860 inc(result, 1);860 Inc(Result, 1); 861 861 if MyMap[dLoc(Loc, -1, -1)] and Mask = Cardinal(Value) then 862 inc(result, 8);862 Inc(Result, 8); 863 863 end; 864 864 if dLoc(Loc, 1, 1) < G.lx * G.ly then 865 865 begin 866 866 if MyMap[dLoc(Loc, 1, 1)] and Mask = Cardinal(Value) then 867 inc(result, 2);867 Inc(Result, 2); 868 868 if MyMap[dLoc(Loc, -1, 1)] and Mask = Cardinal(Value) then 869 inc(result, 4);870 end; 871 end; 872 873 function TIsoMap.Connection8(Loc, Mask: integer): integer;869 Inc(Result, 4); 870 end; 871 end; 872 873 function TIsoMap.Connection8(Loc, Mask: Integer): Integer; 874 874 var 875 875 Dir: Integer; 876 876 ConnLoc: Integer; 877 877 begin 878 result := 0;878 Result := 0; 879 879 for Dir := 0 to 7 do 880 880 begin … … 882 882 if (ConnLoc >= 0) and (ConnLoc < G.lx * G.ly) and 883 883 (MyMap[ConnLoc] and Mask <> 0) then 884 inc(result, 1 shl Dir);885 end; 886 end; 887 888 function TIsoMap.OceanConnection(Loc: integer): integer;884 Inc(Result, 1 shl Dir); 885 end; 886 end; 887 888 function TIsoMap.OceanConnection(Loc: Integer): Integer; 889 889 var 890 890 Dir: Integer; 891 891 ConnLoc: Integer; 892 892 begin 893 result := 0;893 Result := 0; 894 894 for Dir := 0 to 7 do 895 895 begin … … 897 897 if (ConnLoc < 0) or (ConnLoc >= G.lx * G.ly) or 898 898 ((MyMap[ConnLoc] - 2) and fTerrain < 13) then 899 inc(result, 1 shl Dir);900 end; 901 end; 902 903 procedure TIsoMap.PaintShore( x, y, Loc: integer);899 Inc(Result, 1 shl Dir); 900 end; 901 end; 902 903 procedure TIsoMap.PaintShore(X, Y, Loc: Integer); 904 904 var 905 905 Conn: Integer; 906 906 Tile: Integer; 907 907 begin 908 if ( y <= FTop - yyt * 2) or (y > FBottom) or (x<= FLeft - xxt * 2) or909 ( x> FRight) then910 exit;908 if (Y <= FTop - yyt * 2) or (Y > FBottom) or (X <= FLeft - xxt * 2) or 909 (X > FRight) then 910 Exit; 911 911 if (Loc < 0) or (Loc >= G.lx * G.ly) then 912 exit;912 Exit; 913 913 Tile := MyMap[Loc]; 914 914 if Tile and fTerrain >= fGrass then 915 exit;915 Exit; 916 916 Conn := OceanConnection(Loc); 917 917 if Conn = 0 then 918 exit;919 920 BitBltBitmap(HGrTerrain.Data, x + xxt div 2, y, xxt, yyt,918 Exit; 919 920 BitBltBitmap(HGrTerrain.Data, X + xxt div 2, Y, xxt, yyt, 921 921 1 + (Conn shr 6 + Conn and 1 shl 2) * (xxt * 2 + 1), 922 922 1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 923 BitBltBitmap(HGrTerrain.Data, x + xxt, y+ yyt div 2, xxt, yyt,923 BitBltBitmap(HGrTerrain.Data, X + xxt, Y + yyt div 2, xxt, yyt, 924 924 1 + (Conn and 7) * (xxt * 2 + 1) + xxt, 925 925 1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 926 BitBltBitmap(HGrTerrain.Data, x + xxt div 2, y+ yyt, xxt, yyt,926 BitBltBitmap(HGrTerrain.Data, X + xxt div 2, Y + yyt, xxt, yyt, 927 927 1 + (Conn shr 2 and 7) * (xxt * 2 + 1) + xxt, 928 928 1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 929 BitBltBitmap(HGrTerrain.Data, x, y+ yyt div 2, xxt, yyt,929 BitBltBitmap(HGrTerrain.Data, X, Y + yyt div 2, xxt, yyt, 930 930 1 + (Conn shr 4 and 7) * (xxt * 2 + 1), 931 931 1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 932 932 Conn := Connection4(Loc, fTerrain, fUNKNOWN); { dither to black } 933 933 if Conn and 1 <> 0 then 934 BitBltBitmap(HGrTerrain.Mask, x + xxt, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) +934 BitBltBitmap(HGrTerrain.Mask, X + xxt, Y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) + 935 935 xxt, 1 + yyt + 15 * (yyt * 3 + 1), SRCAND); 936 936 if Conn and 2 <> 0 then 937 BitBltBitmap(HGrTerrain.Mask, x + xxt, y+ yyt, xxt, yyt,937 BitBltBitmap(HGrTerrain.Mask, X + xxt, Y + yyt, xxt, yyt, 938 938 1 + 7 * (xxt * 2 + 1) + xxt, 1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND); 939 939 if Conn and 4 <> 0 then 940 BitBltBitmap(HGrTerrain.Mask, x, y+ yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1),940 BitBltBitmap(HGrTerrain.Mask, X, Y + yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1), 941 941 1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND); 942 942 if Conn and 8 <> 0 then 943 BitBltBitmap(HGrTerrain.Mask, x, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1),943 BitBltBitmap(HGrTerrain.Mask, X, Y, xxt, yyt, 1 + 7 * (xxt * 2 + 1), 944 944 1 + yyt + 15 * (yyt * 3 + 1), SRCAND); 945 945 end; 946 946 947 procedure TIsoMap.PaintTileExtraTerrain( x, y, Loc: integer);948 var 949 Dir, Conn, RRConn, yGr, Tile, yLoc: integer;950 begin 951 if (Loc < 0) or (Loc >= G.lx * G.ly) or ( y<= -yyt * 2) or952 ( y > FOutput.Height) or (x <= -xxt * 2) or (x> FOutput.Width) then953 exit;947 procedure TIsoMap.PaintTileExtraTerrain(X, Y, Loc: Integer); 948 var 949 Dir, Conn, RRConn, yGr, Tile, yLoc: Integer; 950 begin 951 if (Loc < 0) or (Loc >= G.lx * G.ly) or (Y <= -yyt * 2) or 952 (Y > FOutput.Height) or (X <= -xxt * 2) or (X > FOutput.Width) then 953 Exit; 954 954 Tile := MyMap[Loc]; 955 955 if Tile and fTerrain = fForest then … … 966 966 then 967 967 Conn := Conn and not 9; // no connection to north 968 TSprite( x, y, yGr + Conn mod 8 + (Conn div 8) * TerrainIconCols);968 TSprite(X, Y, yGr + Conn mod 8 + (Conn div 8) * TerrainIconCols); 969 969 end 970 970 else if Tile and fTerrain in [fHills, fMountains, fForest] then … … 972 972 yGr := 3 + 2 * (Tile and fTerrain - fForest); 973 973 Conn := Connection4(Loc, fTerrain, Tile and fTerrain); 974 TSprite( x, y, Conn mod 8 + (yGr + Conn div 8) * TerrainIconCols);974 TSprite(X, Y, Conn mod 8 + (yGr + Conn div 8) * TerrainIconCols); 975 975 end 976 976 else if Tile and fDeadLands <> 0 then 977 TSprite( x, y, spRow2);977 TSprite(X, Y, spRow2); 978 978 979 979 if ShowObjects then 980 980 begin 981 981 if Tile and fTerImp = tiFarm then 982 TSprite( x, y, spFarmLand)982 TSprite(X, Y, spFarmLand) 983 983 else if Tile and fTerImp = tiIrrigation then 984 TSprite( x, y, spIrrigation);984 TSprite(X, Y, spIrrigation); 985 985 end; 986 986 if Tile and fRiver <> 0 then … … 989 989 Connection4(Loc, fTerrain, fShore) or Connection4(Loc, fTerrain, 990 990 fUNKNOWN); 991 TSprite( x, y, spRiver + Conn mod 8 + (Conn div 8) * TerrainIconCols);991 TSprite(X, Y, spRiver + Conn mod 8 + (Conn div 8) * TerrainIconCols); 992 992 end; 993 993 … … 997 997 for Dir := 0 to 3 do 998 998 if Conn and (1 shl Dir) <> 0 then { river mouths } 999 TSprite( x, y, spRiverMouths + Dir);999 TSprite(X, Y, spRiverMouths + Dir); 1000 1000 if ShowObjects then 1001 1001 begin … … 1003 1003 for Dir := 0 to 7 do 1004 1004 if Conn and (1 shl Dir) <> 0 then { canal mouths } 1005 TSprite( x, y, spCanalMouths + 1 + Dir);1005 TSprite(X, Y, spCanalMouths + 1 + Dir); 1006 1006 end; 1007 1007 end; … … 1015 1015 if Conn = 0 then begin 1016 1016 if Tile and fCanal <> 0 then 1017 TSprite( x, y, spCanal);1017 TSprite(X, Y, spCanal); 1018 1018 end 1019 1019 else 1020 1020 for Dir := 0 to 7 do 1021 1021 if (1 shl Dir) and Conn <> 0 then 1022 TSprite( x, y, spCanal + 1 + Dir);1022 TSprite(X, Y, spCanal + 1 + Dir); 1023 1023 end; 1024 1024 … … 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 1034 TSprite( x, y, spRoad)1034 TSprite(X, Y, spRoad) 1035 1035 else if Conn > 0 then 1036 1036 for Dir := 0 to 7 do 1037 1037 if (1 shl Dir) and Conn <> 0 then 1038 TSprite( x, y, spRoad + 1 + Dir);1038 TSprite(X, Y, spRoad + 1 + Dir); 1039 1039 end; 1040 1040 1041 1041 // Paint railroad connections 1042 1042 if (Tile and fRR <> 0) and (RRConn = 0) then 1043 TSprite( x, y, spRailRoad)1043 TSprite(X, Y, spRailRoad) 1044 1044 else if RRConn > 0 then begin 1045 1045 for Dir := 0 to 7 do 1046 1046 if (1 shl Dir) and RRConn <> 0 then 1047 TSprite( x, y, spRailRoad + 1 + Dir);1047 TSprite(X, Y, spRailRoad + 1 + Dir); 1048 1048 end; 1049 1049 end; … … 1051 1051 1052 1052 // (x,y) is top left pixel of (2*xxt,3*yyt) rectangle 1053 procedure TIsoMap.PaintTileObjects( x, y, Loc, CityLoc, CityOwner: integer;1054 UseBlink: boolean);1055 var 1056 p1, p2, uix, cix, dy, Loc1, Tile, Multi, Destination: integer;1053 procedure TIsoMap.PaintTileObjects(X, Y, Loc, CityLoc, CityOwner: Integer; 1054 UseBlink: Boolean); 1055 var 1056 p1, p2, uix, cix, dy, Loc1, Tile, Multi, Destination: Integer; 1057 1057 CityInfo: TCityInfo; 1058 1058 UnitInfo: TUnitInfo; 1059 fog: boolean;1059 fog: Boolean; 1060 1060 SpecialRow: Integer; 1061 1061 SpecialCol: Integer; … … 1063 1063 procedure NameCity; 1064 1064 var 1065 cix, xs, w: integer;1065 cix, xs, W: Integer; 1066 1066 BehindCityInfo: TCityInfo; 1067 s: string;1068 IsCapital: boolean;1067 S: string; 1068 IsCapital: Boolean; 1069 1069 begin 1070 1070 BehindCityInfo.Loc := Loc - 2 * G.lx; … … 1076 1076 IsCapital := BehindCityInfo.Flags and ciCapital <> 0; 1077 1077 { if Showuix and (cix>=0) then s:=IntToStr(cix) 1078 else } s:= CityName(BehindCityInfo.ID);1079 w := FOutput.Canvas.TextWidth(s);1080 xs := x + xxt - (w+ 1) div 2;1078 else } S := CityName(BehindCityInfo.ID); 1079 W := FOutput.Canvas.TextWidth(S); 1080 xs := X + xxt - (W + 1) div 2; 1081 1081 if IsCapital then 1082 1082 FOutput.Canvas.Font.Style := FOutput.Canvas.Font.Style + [fsUnderline]; 1083 Textout(xs + 1, y - 9, $000000, s);1084 Textout(xs, y - 10, $FFFFFF, s);1083 Textout(xs + 1, Y - 9, $000000, S); 1084 Textout(xs, Y - 10, $FFFFFF, S); 1085 1085 if IsCapital then 1086 1086 FOutput.Canvas.Font.Style := FOutput.Canvas.Font.Style - [fsUnderline]; … … 1092 1092 if ShowObjects and not (moEditMode in MapOptions) and 1093 1093 (Tile and fCity <> 0) and (CityInfo.Flags and ciSpacePort <> 0) then 1094 TSprite( x + xxt, y- 6, spSpacePort);1094 TSprite(X + xxt, Y - 6, spSpacePort); 1095 1095 end; 1096 1096 1097 1097 procedure PaintBorder; 1098 1098 var 1099 dx, dy: integer;1099 dx, dy: Integer; 1100 1100 begin 1101 1101 if ShowBorder and (Loc >= 0) and (Loc < G.lx * G.ly) and 1102 1102 (Tile and fTerrain <> fUNKNOWN) then begin 1103 1103 p1 := MyRO.Territory[Loc]; 1104 if (p1 >= 0) and (ShowMyBorder or (p1 <> me)) then begin1104 if (p1 >= 0) and (ShowMyBorder or (p1 <> Me)) then begin 1105 1105 if BordersOK^ and (1 shl p1) = 0 then begin 1106 1106 UnshareBitmap(Borders); … … 1123 1123 if p2 <> p1 then 1124 1124 begin 1125 BitBltBitmap(HGrTerrain.Mask, x + dx * xxt, y+ dy * yyt, xxt,1125 BitBltBitmap(HGrTerrain.Mask, X + dx * xxt, Y + dy * yyt, xxt, 1126 1126 yyt, 1 + 8 * (xxt * 2 + 1) + dx * xxt, 1127 1127 1 + yyt + 16 * (yyt * 3 + 1) + dy * yyt, SRCAND); 1128 BitBltBitmap(Borders, x + dx * xxt, y+ dy * yyt, xxt, yyt, dx * xxt,1128 BitBltBitmap(Borders, X + dx * xxt, Y + dy * yyt, xxt, yyt, dx * xxt, 1129 1129 p1 * (yyt * 2) + dy * yyt, SRCPAINT); 1130 1130 end; … … 1143 1143 (Tile and fCity <> 0) then 1144 1144 GetCityInfo(Loc, cix, CityInfo); 1145 if ( y <= FTop - yyt * 2) or (y > FBottom) or (x<= FLeft - xxt * 2) or1146 ( x> FRight) then1145 if (Y <= FTop - yyt * 2) or (Y > FBottom) or (X <= FLeft - xxt * 2) or 1146 (X > FRight) then 1147 1147 begin 1148 1148 NameCity; 1149 1149 ShowSpacePort; 1150 exit;1150 Exit; 1151 1151 end; 1152 1152 if Tile and fTerrain = fUNKNOWN then … … 1154 1154 NameCity; 1155 1155 ShowSpacePort; 1156 exit;1156 Exit; 1157 1157 end; { square not discovered } 1158 1158 … … 1161 1161 1162 1162 if (Loc >= 0) and (Loc < G.lx * G.ly) and (Loc = FAdviceLoc) then 1163 TSprite( x, y, spPlain);1163 TSprite(X, Y, spPlain); 1164 1164 1165 1165 if (Loc >= 0) and (Loc < G.lx * G.ly) and (Tile and fSpecial <> 0) … … 1170 1170 SpecialRow := Tile and fSpecial shr 5; 1171 1171 if SpecialCol < fForest then 1172 TSprite( x, y, SpecialCol + SpecialRow * TerrainIconCols)1172 TSprite(X, Y, SpecialCol + SpecialRow * TerrainIconCols) 1173 1173 else if (SpecialCol = fForest) and IsJungle(dy) then 1174 TSprite( x, y, spJungle - 1 + SpecialRow * TerrainIconCols)1174 TSprite(X, Y, spJungle - 1 + SpecialRow * TerrainIconCols) 1175 1175 else 1176 TSprite( x, y, spForest - 1 + ((SpecialCol - fForest) * 2 + SpecialRow) * TerrainIconCols);1176 TSprite(X, Y, spForest - 1 + ((SpecialCol - fForest) * 2 + SpecialRow) * TerrainIconCols); 1177 1177 end; 1178 1178 … … 1180 1180 begin 1181 1181 if Tile and fTerImp = tiMine then 1182 TSprite( x, y, spMine);1182 TSprite(X, Y, spMine); 1183 1183 if Tile and fTerImp = tiBase then 1184 TSprite( x, y, spBase);1184 TSprite(X, Y, spBase); 1185 1185 if Tile and fPoll <> 0 then 1186 TSprite( x, y, spPollution);1186 TSprite(X, Y, spPollution); 1187 1187 if Tile and fTerImp = tiFort then 1188 1188 begin 1189 TSprite( x, y, spFortBack);1189 TSprite(X, Y, spFortBack); 1190 1190 if Tile and fObserved = 0 then 1191 TSprite( x, y, spFortFront);1191 TSprite(X, Y, spFortFront); 1192 1192 end; 1193 1193 end; 1194 1194 if (Tile and fDeadLands) <> 0 then 1195 TSprite( x, y, spMinerals + (Tile shr 25 and 3) * TerrainIconCols);1195 TSprite(X, Y, spMinerals + (Tile shr 25 and 3) * TerrainIconCols); 1196 1196 1197 1197 if moEditMode in MapOptions then … … 1205 1205 if fog and ShowObjects then 1206 1206 if Loc < -G.lx then 1207 Sprite(HGrTerrain, x, y+ yyt, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),1207 Sprite(HGrTerrain, X, Y + yyt, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1), 1208 1208 1 + yyt * 2 + 15 * (yyt * 3 + 1)) 1209 1209 else if Loc >= G.lx * (G.ly + 1) then 1210 Sprite(HGrTerrain, x, y, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),1210 Sprite(HGrTerrain, X, Y, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1), 1211 1211 1 + yyt + 15 * (yyt * 3 + 1)) 1212 1212 else 1213 TSprite( x, y, spGrid, xxt <> 33);1213 TSprite(X, Y, spGrid, xxt <> 33); 1214 1214 1215 1215 if FoW and (Tile and fObserved = 0) then … … 1224 1224 if (Destination = Loc) and (Destination <> MyUn[UnFocus].Loc) then 1225 1225 if not UseBlink or BlinkOn then 1226 TSprite( x, y, spBlink1)1226 TSprite(X, Y, spBlink1) 1227 1227 else 1228 TSprite( x, y, spBlink2)1228 TSprite(X, Y, spBlink2) 1229 1229 end; 1230 1230 {$ENDIF} … … 1232 1232 begin 1233 1233 if Tile and fPrefStartPos <> 0 then 1234 TSprite( x, y, spPrefStartPos)1234 TSprite(X, Y, spPrefStartPos) 1235 1235 else if Tile and fStartPos <> 0 then 1236 TSprite( x, y, spStartPos);1236 TSprite(X, Y, spStartPos); 1237 1237 end 1238 1238 else if ShowObjects then 1239 1239 begin 1240 1240 { if (CityLoc<0) and (UnFocus>=0) and (Loc=MyUn[UnFocus].Loc) then 1241 if BlinkOn then TSprite( x,y,8+9*0)1242 else TSprite( x,y,8+9*1); }1241 if BlinkOn then TSprite(X,Y,8+9*0) 1242 else TSprite(X,Y,8+9*1); } 1243 1243 1244 1244 NameCity; 1245 1245 ShowSpacePort; 1246 1246 if Tile and fCity <> 0 then 1247 PaintCity( x + xxt, y+ yyt, CityInfo, CityOwner < 0);1247 PaintCity(X + xxt, Y + yyt, CityInfo, CityOwner < 0); 1248 1248 1249 1249 if (Tile and fUnit <> 0) and (Loc <> AttLoc) and … … 1259 1259 UnitInfo.Health := DefHealth; 1260 1260 if (UnitInfo.Owner <> CityOwner) and 1261 not((CityOwner = me) and (MyRO.Treaty[UnitInfo.Owner] = trAlliance))1261 not((CityOwner = Me) and (MyRO.Treaty[UnitInfo.Owner] = trAlliance)) 1262 1262 then 1263 1263 {$IFNDEF SCR} if (UnFocus >= 0) and (Loc = MyUn[UnFocus].Loc) then { active unit } 1264 1264 begin 1265 1265 Multi := UnitInfo.Flags and unMulti; 1266 MakeUnitInfo( me, MyUn[UnFocus], UnitInfo);1266 MakeUnitInfo(Me, MyUn[UnFocus], UnitInfo); 1267 1267 UnitInfo.Flags := UnitInfo.Flags or Multi; 1268 PaintUnit( x + (xxt - xxu), y+ (yyt - yyu_anchor), UnitInfo,1268 PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo, 1269 1269 MyUn[UnFocus].Status); 1270 1270 end 1271 else if UnitInfo.Owner = me then1271 else if UnitInfo.Owner = Me then 1272 1272 begin 1273 1273 if ClientMode = cMovieTurn then 1274 PaintUnit( x + (xxt - xxu), y+ (yyt - yyu_anchor), UnitInfo, 0)1274 PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo, 0) 1275 1275 // status is not set with precise timing during loading 1276 1276 else 1277 PaintUnit( x + (xxt - xxu), y+ (yyt - yyu_anchor), UnitInfo,1277 PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo, 1278 1278 MyUn[uix].Status); 1279 1279 // if Showuix then Textout(x+16,y+5,$80FF00,IntToStr(uix)); 1280 1280 end 1281 else {$ENDIF} PaintUnit( x + (xxt - xxu), y+ (yyt - yyu_anchor), UnitInfo, 0);1281 else {$ENDIF} PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo, 0); 1282 1282 end 1283 1283 else if Tile and fHiddenUnit <> 0 then 1284 Sprite(HGrStdUnits, x + (xxt - xxu), y+ (yyt - yyu_anchor), xxu * 2,1284 Sprite(HGrStdUnits, X + (xxt - xxu), Y + (yyt - yyu_anchor), xxu * 2, 1285 1285 yyu * 2, 1 + 5 * (xxu * 2 + 1), 1) 1286 1286 else if Tile and fStealthUnit <> 0 then 1287 Sprite(HGrStdUnits, x + (xxt - xxu), y+ (yyt - yyu_anchor), xxu * 2,1287 Sprite(HGrStdUnits, X + (xxt - xxu), Y + (yyt - yyu_anchor), xxu * 2, 1288 1288 yyu * 2, 1 + 5 * (xxu * 2 + 1), 1 + 1 * (yyu * 2 + 1)) 1289 1289 end; … … 1291 1291 if ShowObjects and (Tile and fTerImp = tiFort) and (Tile and fObserved <> 0) 1292 1292 then 1293 TSprite( x, y, spFortFront);1293 TSprite(X, Y, spFortFront); 1294 1294 1295 1295 if (Loc >= 0) and (Loc < G.lx * G.ly) then 1296 1296 if ShowLoc then 1297 Textout( x + xxt - 16, y+ yyt - 9, $FFFF00, IntToStr(Loc))1297 Textout(X + xxt - 16, Y + yyt - 9, $FFFF00, IntToStr(Loc)) 1298 1298 else if ShowDebug and (DebugMap <> nil) and (Loc >= 0) and 1299 1299 (Loc < G.lx * G.ly) and (DebugMap[Loc] <> 0) then 1300 Textout( x + xxt - 16, y+ yyt - 9, $00E0FF,1301 IntToStr( integer(DebugMap[Loc])))1302 end; 1303 1304 procedure TIsoMap.PaintGrid( x, y, nx, ny: integer);1305 1306 procedure ClippedLine(dx0, dy0: integer; mirror: boolean);1300 Textout(X + xxt - 16, Y + yyt - 9, $00E0FF, 1301 IntToStr(Integer(DebugMap[Loc]))) 1302 end; 1303 1304 procedure TIsoMap.PaintGrid(X, Y, nx, ny: Integer); 1305 1306 procedure ClippedLine(dx0, dy0: Integer; mirror: Boolean); 1307 1307 var 1308 x0, x1, dxmin, dymin, dxmax, dymax, n: integer;1308 x0, x1, dxmin, dymin, dxmax, dymax, N: Integer; 1309 1309 begin 1310 1310 with FOutput.Canvas do 1311 1311 begin 1312 dxmin := (FLeft - x) div xxt;1313 dymin := (RealTop - y) div yyt;1314 dxmax := (FRight - x- 1) div xxt + 1;1315 dymax := (RealBottom - y- 1) div yyt + 1;1316 n:= dymax - dy0;1312 dxmin := (FLeft - X) div xxt; 1313 dymin := (RealTop - Y) div yyt; 1314 dxmax := (FRight - X - 1) div xxt + 1; 1315 dymax := (RealBottom - Y - 1) div yyt + 1; 1316 N := dymax - dy0; 1317 1317 if mirror then 1318 1318 begin 1319 if dx0 - dxmin < nthen1320 n:= dx0 - dxmin;1319 if dx0 - dxmin < N then 1320 N := dx0 - dxmin; 1321 1321 if dx0 > dxmax then 1322 1322 begin 1323 n := n- (dx0 - dxmax);1323 N := N - (dx0 - dxmax); 1324 1324 dy0 := dy0 + (dx0 - dxmax); 1325 1325 dx0 := dxmax … … 1327 1327 if dy0 < dymin then 1328 1328 begin 1329 n := n- (dymin - dy0);1329 N := N - (dymin - dy0); 1330 1330 dx0 := dx0 - (dymin - dy0); 1331 1331 dy0 := dymin … … 1334 1334 else 1335 1335 begin 1336 if dxmax - dx0 < nthen1337 n:= dxmax - dx0;1336 if dxmax - dx0 < N then 1337 N := dxmax - dx0; 1338 1338 if dx0 < dxmin then 1339 1339 begin 1340 n := n- (dxmin - dx0);1340 N := N - (dxmin - dx0); 1341 1341 dy0 := dy0 + (dxmin - dx0); 1342 1342 dx0 := dxmin … … 1344 1344 if dy0 < dymin then 1345 1345 begin 1346 n := n- (dymin - dy0);1346 N := N - (dymin - dy0); 1347 1347 dx0 := dx0 + (dymin - dy0); 1348 1348 dy0 := dymin 1349 1349 end; 1350 1350 end; 1351 if n<= 0 then1352 exit;1351 if N <= 0 then 1352 Exit; 1353 1353 if mirror then 1354 1354 begin 1355 x0 := x+ dx0 * xxt - 1;1356 x1 := x + (dx0 - n) * xxt - 1;1355 x0 := X + dx0 * xxt - 1; 1356 x1 := X + (dx0 - N) * xxt - 1; 1357 1357 end 1358 1358 else 1359 1359 begin 1360 x0 := x+ dx0 * xxt;1361 x1 := x + (dx0 + n) * xxt;1360 x0 := X + dx0 * xxt; 1361 x1 := X + (dx0 + N) * xxt; 1362 1362 end; 1363 moveto(x0, y+ dy0 * yyt);1364 lineto(x1, y + (dy0 + n) * yyt);1363 moveto(x0, Y + dy0 * yyt); 1364 lineto(x1, Y + (dy0 + N) * yyt); 1365 1365 end; 1366 1366 end; 1367 1367 1368 1368 var 1369 i: integer;1369 I: Integer; 1370 1370 begin 1371 1371 FOutput.Canvas.pen.Color := $000000; // $FF shl (8*random(3)); 1372 for i:= 0 to nx div 2 do1373 ClippedLine( i * 2, 0, false);1374 for i:= 1 to (nx + 1) div 2 do1375 ClippedLine( i * 2, 0, true);1376 for i:= 0 to ny div 2 do1377 begin 1378 ClippedLine(0, 2 * i + 2, false);1379 ClippedLine(nx + 1, 2 * i + 1 + nx and 1, true);1380 end; 1381 end; 1382 1383 function TIsoMap.IsShoreTile(Loc: integer): boolean;1372 for I := 0 to nx div 2 do 1373 ClippedLine(I * 2, 0, False); 1374 for I := 1 to (nx + 1) div 2 do 1375 ClippedLine(I * 2, 0, True); 1376 for I := 0 to ny div 2 do 1377 begin 1378 ClippedLine(0, 2 * I + 2, False); 1379 ClippedLine(nx + 1, 2 * I + 1 + nx and 1, True); 1380 end; 1381 end; 1382 1383 function TIsoMap.IsShoreTile(Loc: Integer): Boolean; 1384 1384 var 1385 1385 Dir: Integer; 1386 ConnLoc: integer;1387 begin 1388 result := false;1386 ConnLoc: Integer; 1387 begin 1388 Result := False; 1389 1389 for Dir := 0 to 7 do 1390 1390 begin … … 1392 1392 if (ConnLoc < 0) or (ConnLoc >= G.lx * G.ly) or 1393 1393 ((MyMap[ConnLoc] - 2) and fTerrain < 13) then 1394 result := true;1394 Result := True; 1395 1395 end; 1396 1396 end; … … 1401 1401 begin 1402 1402 for I := 0 to Length - 1 do begin 1403 Line^.Pixel^.B := (Line^.Pixel^.B shr 1) and $7 f;1404 Line^.Pixel^.G := (Line^.Pixel^.G shr 1) and $7 f;1405 Line^.Pixel^.R := (Line^.Pixel^.R shr 1) and $7 f;1403 Line^.Pixel^.B := (Line^.Pixel^.B shr 1) and $7F; 1404 Line^.Pixel^.G := (Line^.Pixel^.G shr 1) and $7F; 1405 Line^.Pixel^.R := (Line^.Pixel^.R shr 1) and $7F; 1406 1406 Line^.NextPixel; 1407 1407 end; … … 1415 1415 end; 1416 1416 1417 procedure TIsoMap.ShadeOutside(x0, y0, Width, Height, xm, ym: integer);1417 procedure TIsoMap.ShadeOutside(x0, y0, Width, Height, xm, ym: Integer); 1418 1418 const 1419 1419 rShade = 3.75; 1420 1420 var 1421 y, wBright: integer;1422 y_n, w_n: single;1421 Y, wBright: Integer; 1422 y_n, w_n: Single; 1423 1423 Line: TPixelPointer; 1424 1424 begin 1425 1425 FOutput.BeginUpdate; 1426 1426 Line := PixelPointer(FOutput, ScaleToNative(x0), ScaleToNative(y0)); 1427 for y:= 0 to ScaleToNative(Height) - 1 do begin1428 y_n := (ScaleFromNative( y) + y0 - ym) / yyt;1427 for Y := 0 to ScaleToNative(Height) - 1 do begin 1428 y_n := (ScaleFromNative(Y) + y0 - ym) / yyt; 1429 1429 if abs(y_n) < rShade then begin 1430 1430 // Darken left and right parts of elipsis … … 1445 1445 end; 1446 1446 1447 procedure TIsoMap.CityGrid(xm, ym: integer; CityAllowClick: Boolean);1448 var 1449 i: integer;1447 procedure TIsoMap.CityGrid(xm, ym: Integer; CityAllowClick: Boolean); 1448 var 1449 I: Integer; 1450 1450 begin 1451 1451 with FOutput.Canvas do … … 1456 1456 pen.Color := $000000; 1457 1457 pen.Width := 1; 1458 for i:= 0 to 3 do1458 for I := 0 to 3 do 1459 1459 begin 1460 moveto(xm - xxt * (4 - i), ym + yyt * (1 + i));1461 lineto(xm + xxt * (1 + i), ym - yyt * (4 - i));1462 moveto(xm - xxt * (4 - i), ym - yyt * (1 + i));1463 lineto(xm + xxt * (1 + i), ym + yyt * (4 - i));1460 moveto(xm - xxt * (4 - I), ym + yyt * (1 + I)); 1461 lineto(xm + xxt * (1 + I), ym - yyt * (4 - I)); 1462 moveto(xm - xxt * (4 - I), ym - yyt * (1 + I)); 1463 lineto(xm + xxt * (1 + I), ym + yyt * (4 - I)); 1464 1464 end; 1465 1465 moveto(xm - xxt * 4, ym + yyt * 1); … … 1475 1475 end; 1476 1476 1477 procedure TIsoMap.Paint( x, y, Loc, nx, ny, CityLoc, CityOwner: integer;1478 UseBlink: boolean; CityAllowClick: boolean);1479 var 1480 dx, dy, xm, ym, ALoc, BLoc, ATer, BTer, Aix, bix: integer;1481 begin 1482 FoW := true;1477 procedure TIsoMap.Paint(X, Y, Loc, nx, ny, CityLoc, CityOwner: Integer; 1478 UseBlink: Boolean; CityAllowClick: Boolean); 1479 var 1480 dx, dy, xm, ym, ALoc, BLoc, ATer, BTer, Aix, bix: Integer; 1481 begin 1482 FoW := True; 1483 1483 ShowLoc := moLocCodes in MapOptions; 1484 1484 ShowDebug := pDebugMap >= 0; … … 1486 1486 ShowCityNames := ShowObjects and (CityOwner < 0) and 1487 1487 (moCityNames in MapOptions); 1488 ShowBorder := true;1488 ShowBorder := True; 1489 1489 ShowMyBorder := CityOwner < 0; 1490 1490 ShowGrWall := (CityOwner < 0) and (moGreatWall in MapOptions); 1491 1491 if ShowDebug then 1492 Server(sGetDebugMap, me, pDebugMap, DebugMap)1492 Server(sGetDebugMap, Me, pDebugMap, DebugMap) 1493 1493 else 1494 1494 DebugMap := nil; 1495 1495 with FOutput.Canvas do 1496 1496 begin 1497 RealTop := y- ((Loc + 12345 * G.lx) div G.lx - 12345) * yyt;1498 RealBottom := y+ (G.ly - ((Loc + 12345 * G.lx) div G.lx - 12345) +1497 RealTop := Y - ((Loc + 12345 * G.lx) div G.lx - 12345) * yyt; 1498 RealBottom := Y + (G.ly - ((Loc + 12345 * G.lx) div G.lx - 12345) + 1499 1499 3) * yyt; 1500 1500 Brush.Color := EmptySpaceColor; … … 1573 1573 bix := 0; 1574 1574 end; 1575 BitBltBitmap(OceanPatch, x + dx * xxt, y+ dy * yyt, xxt, yyt,1575 BitBltBitmap(OceanPatch, X + dx * xxt, Y + dy * yyt, xxt, yyt, 1576 1576 Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY) 1577 1577 end … … 1621 1621 bix := Aix; 1622 1622 if Aix = -1 then 1623 BitBltBitmap(HGrTerrain.Data, x + dx * xxt, y+ dy * yyt, xxt,1623 BitBltBitmap(HGrTerrain.Data, X + dx * xxt, Y + dy * yyt, xxt, 1624 1624 yyt, 1 + 6 * (xxt * 2 + 1) + (dx + dy + 1) and 1 * xxt, 1 + yyt, 1625 1625 SRCCOPY) // arctic <-> ocean 1626 1626 else if bix = -1 then 1627 BitBltBitmap(HGrTerrain.Data, x + dx * xxt, y+ dy * yyt, xxt,1627 BitBltBitmap(HGrTerrain.Data, X + dx * xxt, Y + dy * yyt, xxt, 1628 1628 yyt, 1 + 6 * (xxt * 2 + 1) + xxt - (dx + dy + 1) and 1 * xxt, 1629 1629 1 + yyt * 2, SRCCOPY) // arctic <-> ocean 1630 1630 else 1631 BitBltBitmap(LandPatch, x + dx * xxt, y+ dy * yyt, xxt, yyt,1631 BitBltBitmap(LandPatch, X + dx * xxt, Y + dy * yyt, xxt, yyt, 1632 1632 Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY) 1633 1633 end; … … 1639 1639 for dx := -1 to nx do 1640 1640 if (dx + dy) and 1 = 0 then 1641 PaintShore( x + xxt * dx, y+ yyt + yyt * dy, dLoc(Loc, dx, dy));1641 PaintShore(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy)); 1642 1642 for dy := -2 to ny + 1 do 1643 1643 for dx := -1 to nx do 1644 1644 if (dx + dy) and 1 = 0 then 1645 PaintTileExtraTerrain( x + xxt * dx, y+ yyt + yyt * dy,1645 PaintTileExtraTerrain(X + xxt * dx, Y + yyt + yyt * dy, 1646 1646 dLoc(Loc, dx, dy)); 1647 1647 if CityOwner >= 0 then … … 1653 1653 ALoc := dLoc(Loc, dx, dy); 1654 1654 if Distance(ALoc, CityLoc) > 5 then 1655 PaintTileObjects( x + xxt * dx, y+ yyt + yyt * dy, ALoc, CityLoc,1655 PaintTileObjects(X + xxt * dx, Y + yyt + yyt * dy, ALoc, CityLoc, 1656 1656 CityOwner, UseBlink); 1657 1657 end; … … 1660 1660 * G.lx) mod (2 * G.lx) - G.lx; 1661 1661 dy := CityLoc div G.lx - (Loc + 666 * G.lx) div G.lx + 666; 1662 xm := x+ (dx + 1) * xxt;1663 ym := y+ (dy + 1) * yyt + yyt;1662 xm := X + (dx + 1) * xxt; 1663 ym := Y + (dy + 1) * yyt + yyt; 1664 1664 ShadeOutside(FLeft, FTop, FRight - FLeft, FBottom - FTop, xm, ym); 1665 1665 CityGrid(xm, ym, CityAllowClick); … … 1670 1670 ALoc := dLoc(Loc, dx, dy); 1671 1671 if Distance(ALoc, CityLoc) <= 5 then 1672 PaintTileObjects( x + xxt * dx, y+ yyt + yyt * dy, ALoc, CityLoc,1672 PaintTileObjects(X + xxt * dx, Y + yyt + yyt * dy, ALoc, CityLoc, 1673 1673 CityOwner, UseBlink); 1674 1674 end; … … 1678 1678 if ShowLoc or (moEditMode in MapOptions) or 1679 1679 (moGrid in MapOptions) then 1680 PaintGrid( x, y, nx, ny);1680 PaintGrid(X, Y, nx, ny); 1681 1681 for dy := -2 to ny + 1 do 1682 1682 for dx := -2 to nx + 1 do 1683 1683 if (dx + dy) and 1 = 0 then 1684 PaintTileObjects( x + xxt * dx, y+ yyt + yyt * dy, dLoc(Loc, dx, dy),1684 PaintTileObjects(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy), 1685 1685 CityLoc, CityOwner, UseBlink); 1686 1686 end;
Note:
See TracChangeset
for help on using the changeset viewer.