Ignore:
Timestamp:
Mar 26, 2021, 2:16:04 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Reworker IsoEngine unit to support multiple iso maps with different tile sizes.
  • Modified: Changing tile size in main windows map doesn't affect other tile drawing on panel and in other windows like help window.
  • Modified: Optimized tile size switching. Graphic assets needed for given tile size is prepared only once. Then switching between them is just about changing references to objects and redrawing.
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Help.pas

    r328 r330  
    77  Protocol, ScreenTools, BaseWin, StringTables, Math, LCLIntf, LCLType,
    88  Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls,
    9   ButtonB, PVSB, Types, fgl;
     9  ButtonB, PVSB, Types, fgl, IsoEngine;
    1010
    1111const
     
    102102    ExtPic, TerrIcon: TBitmap;
    103103    ScrollBar: TPVScrollbar;
     104    NoMap: TIsoMap;
    104105    x0: array [-2..180] of Integer;
    105106    procedure PaintTerrIcon(x, y, xSrc, ySrc: Integer);
     
    273274begin
    274275  inherited;
     276  NoMap := TIsoMap.Create;
     277
    275278  HistItems := THistItems.Create;
    276279
     
    331334  // FreeAndNil(CaptionFont);
    332335  FreeAndNil(HistItems);
     336  FreeAndNil(NoMap);
    333337end;
    334338
     
    502506procedure THelpDlg.PaintTerrIcon(x, y, xSrc, ySrc: integer);
    503507begin
    504   Frame(OffScreen.Canvas, x - 1, y - 1, x + xSizeBig, y + ySizeBig,
    505     $000000, $000000);
    506   if 2 * yyt < 40 then begin
    507     Sprite(OffScreen, HGrTerrain, x, y, 56, 2 * yyt, xSrc, ySrc);
    508     Sprite(OffScreen, HGrTerrain, x, y + 2 * yyt, 56, 40 - 2 * yyt,
     508  with NoMap do begin
     509    Frame(OffScreen.Canvas, x - 1, y - 1, x + xSizeBig, y + ySizeBig,
     510      $000000, $000000);
     511    if 2 * yyt < 40 then begin
     512      Sprite(OffScreen, HGrTerrain, x, y, 56, 2 * yyt, xSrc, ySrc);
     513      Sprite(OffScreen, HGrTerrain, x, y + 2 * yyt, 56, 40 - 2 * yyt,
     514        xSrc, ySrc);
     515    end else
     516      Sprite(OffScreen, HGrTerrain, x, y, 56, 40, xSrc, ySrc);
     517    Sprite(OffScreen, HGrTerrain, x, y, xxt, yyt, xSrc + xxt, ySrc + yyt);
     518    Sprite(OffScreen, HGrTerrain, x, y + yyt, xxt, 40 - yyt, xSrc + xxt, ySrc);
     519    Sprite(OffScreen, HGrTerrain, x + xxt, y, 56 - xxt, yyt, xSrc, ySrc + yyt);
     520    Sprite(OffScreen, HGrTerrain, x + xxt, y + yyt, 56 - xxt, 40 - yyt,
    509521      xSrc, ySrc);
    510   end else
    511     Sprite(OffScreen, HGrTerrain, x, y, 56, 40, xSrc, ySrc);
    512   Sprite(OffScreen, HGrTerrain, x, y, xxt, yyt, xSrc + xxt, ySrc + yyt);
    513   Sprite(OffScreen, HGrTerrain, x, y + yyt, xxt, 40 - yyt, xSrc + xxt, ySrc);
    514   Sprite(OffScreen, HGrTerrain, x + xxt, y, 56 - xxt, yyt, xSrc, ySrc + yyt);
    515   Sprite(OffScreen, HGrTerrain, x + xxt, y + yyt, 56 - xxt, 40 - yyt,
    516     xSrc, ySrc);
     522  end;
    517523end;
    518524
     
    605611                    12 + x0[i], -7 + i * 24, 56, 40, 137, 127);
    606612                1:
    607                   begin
     613                  with NoMap do begin
    608614                    PaintTerrIcon(12 + x0[i], -7 + i * 24,
    609615                      1 + 3 * (xxt * 2 + 1), 1 + yyt);
     
    618624                  end;
    619625                2:
    620                   begin
     626                  with NoMap do begin
    621627                    PaintTerrIcon(12 + x0[i], -7 + i * 24,
    622628                      1 + 7 * (xxt * 2 + 1), 1 + yyt + 4 * (yyt * 3 + 1));
     
    703709            end;
    704710          pkTer, pkBigTer:
    705             begin
     711            with NoMap do begin
    706712              if HelpLineInfo.Format = pkBigTer then
    707713                y := i * 24 - 3 + yyt
     
    758764            end;
    759765          pkTerImp:
    760             begin
     766            with NoMap do begin
    761767              ofs := 8;
    762768              if HelpLineInfo.Picpix = 5 then
Note: See TracChangeset for help on using the changeset viewer.