Ignore:
Timestamp:
Apr 6, 2021, 8:11:02 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Merged trunk branch version r348 into highdpi branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/Help.pas

    r303 r349  
    77  UDpiControls, 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: TDpiBitmap;
    103103    ScrollBar: TPVScrollbar;
     104    NoMap: TIsoMap;
    104105    x0: array [-2..180] of Integer;
    105106    procedure PaintTerrIcon(x, y, xSrc, ySrc: Integer);
     
    241242
    242243  nSeeAlso = 14;
    243   SeeAlso: array [0 .. nSeeAlso - 1] of record Kind, no, SeeKind,
    244     SeeNo: integer end = ((Kind: hkImp; no: imWalls; SeeKind: hkFeature;
     244  SeeAlso: array [0 .. nSeeAlso - 1] of record
     245    Kind: Integer;
     246    no: Integer;
     247    SeeKind: Integer;
     248    SeeNo: Integer;
     249  end = ((Kind: hkImp; no: imWalls; SeeKind: hkFeature;
    245250    SeeNo: mcArtillery), (Kind: hkImp; no: imHydro; SeeKind: hkImp;
    246251    SeeNo: woHoover), (Kind: hkImp; no: imWalls; SeeKind: hkImp;
     
    269274begin
    270275  inherited;
     276  NoMap := TIsoMap.Create;
     277
    271278  HistItems := THistItems.Create;
    272279
     
    327334  // FreeAndNil(CaptionFont);
    328335  FreeAndNil(HistItems);
     336  FreeAndNil(NoMap);
    329337end;
    330338
     
    397405      ca.FrameRect(rect(x+1,i*24+1,x+24-1,i*24+24-1));
    398406      ca.Brush.Style:=bsClear; }
    399     DpiBitCanvas(ca, x, y - 4, 24, 24, GrExt[HGrSystem].Data.Canvas, 1,
     407    DpiBitCanvas(ca, x, y - 4, 24, 24, HGrSystem.Data.Canvas, 1,
    400408      146);
    401409    BiColorTextOut(ca, $FFFFFF, $7F007F, x + 10 - ca.Textwidth(s[1]) div 2,
     
    436444    if (Kind = hkMisc) and (no = miscMain) then
    437445      ca.Font.Assign(UniFont[ftNormal]);
    438   end
     446  end;
    439447end;
    440448
     
    460468  ySrc := (iix div 7 + 1) * ySizeBig;
    461469  PaintPtr := PixelPointer(OffScreen, ScaleToNative(x0), ScaleToNative(y0));
    462   CoalPtr := PixelPointer(Templates, ScaleToNative(xCoal), ScaleToNative(yCoal));
     470  CoalPtr := PixelPointer(Templates.Data, ScaleToNative(xCoal), ScaleToNative(yCoal));
    463471  for dy := -1 to 1 do
    464472    ImpPtr[dy] := PixelPointer(BigImp, ScaleToNative(xSrc), ScaleToNative(ySrc));
     
    504512procedure THelpDlg.PaintTerrIcon(x, y, xSrc, ySrc: integer);
    505513begin
    506   Frame(OffScreen.Canvas, x - 1, y - 1, x + xSizeBig, y + ySizeBig,
    507     $000000, $000000);
    508   if 2 * yyt < 40 then begin
    509     Sprite(OffScreen, HGrTerrain, x, y, 56, 2 * yyt, xSrc, ySrc);
    510     Sprite(OffScreen, HGrTerrain, x, y + 2 * yyt, 56, 40 - 2 * yyt,
     514  with NoMap do begin
     515    Frame(OffScreen.Canvas, x - 1, y - 1, x + xSizeBig, y + ySizeBig,
     516      $000000, $000000);
     517    if 2 * yyt < 40 then begin
     518      Sprite(OffScreen, HGrTerrain, x, y, 56, 2 * yyt, xSrc, ySrc);
     519      Sprite(OffScreen, HGrTerrain, x, y + 2 * yyt, 56, 40 - 2 * yyt,
     520        xSrc, ySrc);
     521    end else
     522      Sprite(OffScreen, HGrTerrain, x, y, 56, 40, xSrc, ySrc);
     523    Sprite(OffScreen, HGrTerrain, x, y, xxt, yyt, xSrc + xxt, ySrc + yyt);
     524    Sprite(OffScreen, HGrTerrain, x, y + yyt, xxt, 40 - yyt, xSrc + xxt, ySrc);
     525    Sprite(OffScreen, HGrTerrain, x + xxt, y, 56 - xxt, yyt, xSrc, ySrc + yyt);
     526    Sprite(OffScreen, HGrTerrain, x + xxt, y + yyt, 56 - xxt, 40 - yyt,
    511527      xSrc, ySrc);
    512   end else
    513     Sprite(OffScreen, HGrTerrain, x, y, 56, 40, xSrc, ySrc);
    514   Sprite(OffScreen, HGrTerrain, x, y, xxt, yyt, xSrc + xxt, ySrc + yyt);
    515   Sprite(OffScreen, HGrTerrain, x, y + yyt, xxt, 40 - yyt, xSrc + xxt, ySrc);
    516   Sprite(OffScreen, HGrTerrain, x + xxt, y, 56 - xxt, yyt, xSrc, ySrc + yyt);
    517   Sprite(OffScreen, HGrTerrain, x + xxt, y + yyt, 56 - xxt, 40 - yyt,
    518     xSrc, ySrc);
     528  end;
    519529end;
    520530
     
    571581                j and $FF]);
    572582              PaintLogo(OffScreen.Canvas, (InnerWidth - 122) div 2, i * 24 + 1,
    573                 GrExt[HGrSystem].Data.Canvas.Pixels[95, 1], $000000);
     583                HGrSystem.Data.Canvas.Pixels[95, 1], $000000);
    574584              Font.Assign(UniFont[ftSmall]);
    575585              BiColorTextOut(OffScreen.Canvas, $000000, $7F007F,
     
    604614              case HelpLineInfo.Picpix of
    605615                0:
    606                   FrameImage(OffScreen.Canvas, GrExt[HGrSystem2].Data,
     616                  FrameImage(OffScreen.Canvas, HGrSystem2.Data,
    607617                    12 + x0[i], -7 + i * 24, 56, 40, 137, 127);
    608618                1:
    609                   begin
     619                  with NoMap do begin
    610620                    PaintTerrIcon(12 + x0[i], -7 + i * 24,
    611621                      1 + 3 * (xxt * 2 + 1), 1 + yyt);
     
    620630                  end;
    621631                2:
    622                   begin
     632                  with NoMap do begin
    623633                    PaintTerrIcon(12 + x0[i], -7 + i * 24,
    624634                      1 + 7 * (xxt * 2 + 1), 1 + yyt + 4 * (yyt * 3 + 1));
     
    660670              j := AdvValue[HelpLineInfo.Picpix] div 1000;
    661671              DpiBitCanvas(OffScreen.Canvas, x0[i] + 4, 4 + i * 24, 14, 14,
    662                 GrExt[HGrSystem].Mask.Canvas, 127 + j * 15, 85, SRCAND);
     672                HGrSystem.Mask.Canvas, 127 + j * 15, 85, SRCAND);
    663673              Sprite(OffScreen, HGrSystem, x0[i] + 3, 3 + i * 24, 14, 14,
    664674                127 + j * 15, 85);
     
    705715            end;
    706716          pkTer, pkBigTer:
    707             begin
     717            with NoMap do begin
    708718              if HelpLineInfo.Format = pkBigTer then
    709719                y := i * 24 - 3 + yyt
     
    760770            end;
    761771          pkTerImp:
    762             begin
     772            with NoMap do begin
    763773              ofs := 8;
    764774              if HelpLineInfo.Picpix = 5 then
     
    767777                  xxt * 2 - 8, yyt * 2 - 4, 5 + 2 * (xxt * 2 + 1),
    768778                  3 + yyt + 2 * (yyt * 3 + 1));
    769                 srcno := 45
     779                srcno := 45;
    770780              end
    771781              else
     
    9901000  procedure AddTextual(s: string);
    9911001  var
    992     i, p, l, ofs, CurrentFormat, FollowFormat, Picpix, LinkCategory, LinkIndex,
    993       RightMargin: integer;
     1002    i: Integer;
     1003    p: Integer;
     1004    l: Integer;
     1005    ofs: Integer;
     1006    CurrentFormat: Integer;
     1007    FollowFormat: Integer;
     1008    Picpix: Integer;
     1009    LinkCategory: Integer;
     1010    LinkIndex: Integer;
     1011    RightMargin: Integer;
    9941012    Name: string;
     1013    Text: string;
    9951014  begin
    9961015    RightMargin := InnerWidth - 16 - DpiGetSystemMetrics(SM_CXVSCROLL);
     
    11391158            Break;
    11401159        until (p >= Length(s)) or (s[l + 1] = '\');
    1141         MainText.AddLine(Copy(s, 1, l), CurrentFormat, Picpix, LinkCategory,
     1160        Text := Copy(s, 1, l);
     1161        if LinkCategory and $3f = hkInternet then begin
     1162          if LinkIndex = 1 then Text := AITemplateManual
     1163          else if LinkIndex = 2 then Text := CevoHomepageShort
     1164          else if LinkIndex = 3 then Text := CevoContactShort;
     1165        end;
     1166        MainText.AddLine(Text, CurrentFormat, Picpix, LinkCategory,
    11421167          LinkIndex);
    11431168        if (l < Length(s)) and (s[l + 1] = '\') then
     
    14711496                hkMisc + hkCrossLink, miscGovList);
    14721497          NextSection('BUILDALLOW');
    1473           for i := 0 to 27 do
     1498          for i := 0 to nWonder - 1 do
    14741499            if Imp[i].Preq = no then
    14751500              AddImprovement(i);
    1476           for i := 28 to nImp - 1 do
     1501          for i := nWonder to nImp - 1 do
    14771502            if (Imp[i].Preq = no) and (Imp[i].Kind <> ikCommon) then
    14781503              AddImprovement(i);
    1479           for i := 28 to nImp - 1 do
     1504          for i := nWonder to nImp - 1 do
    14801505            if (Imp[i].Preq = no) and (Imp[i].Kind = ikCommon) then
    14811506              AddImprovement(i);
     
    15141539              end;
    15151540          NextSection('EXPIRATION');
    1516           for i := 0 to 27 do
     1541          for i := 0 to nWonder - 1 do
    15171542            if (Imp[i].Preq <> preNA) and (Imp[i].Expiration = no) then
    15181543              AddImprovement(i);
     
    15321557          List := THyperText.Create;
    15331558          List.OwnsObjects := True;
    1534           for i := 28 to nImp - 1 do
     1559          for i := nWonder to nImp - 1 do
    15351560            if (i <> imTrGoods) and (Imp[i].Preq <> preNA) and
    15361561              (Imp[i].Kind = ikCommon) then
     
    15451570          Caption := HelpText.Lookup('HELPTITLE_UNIQUELIST');
    15461571          // AddLine(HelpText.Lookup('HELPTITLE_UNIQUELIST'),pkSection);
    1547           for i := 28 to nImp - 1 do
     1572          for i := nWonder to nImp - 1 do
    15481573            if (Imp[i].Preq <> preNA) and
    15491574              ((Imp[i].Kind = ikNatLocal) or (Imp[i].Kind = ikNatGlobal)) then
     
    15531578            LineFeed;
    15541579            AddLine(HelpText.Lookup('HELPTITLE_SHIPPARTLIST'),pkSection);
    1555             for i:=28 to nImp-1 do
     1580            for i:= nWonder to nImp-1 do
    15561581            if (Imp[i].Preq<>preNA) and (Imp[i].Kind=ikShipPart) then
    15571582            AddLine(Phrases.Lookup('IMPROVEMENTS',i),pkSmallIcon,i,hkImp,i); }
     
    15611586          Caption := HelpText.Lookup('HELPTITLE_WONDERLIST');
    15621587          // AddLine(HelpText.Lookup('HELPTITLE_WONDERLIST'),pkSection);
    1563           for i := 0 to 27 do
     1588          for i := 0 to nWonder - 1 do
    15641589            if Imp[i].Preq <> preNA then
    15651590              AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon, i,
     
    15871612            AddFeature(mcAcademy);
    15881613          end;
    1589           if (no < 28) and not Phrases2FallenBackToEnglish then
     1614          if (no < nWonder) and not Phrases2FallenBackToEnglish then
    15901615          begin
    15911616            LineFeed;
     
    16331658              [Phrases.Lookup('TERRAIN', 3 * 12 + i)]), pkTer, 3 * 12 + i);
    16341659          end;
    1635           if (no < 28) and (Imp[no].Expiration >= 0) then
     1660          if (no < nWonder) and (Imp[no].Expiration >= 0) then
    16361661          begin
    16371662            NextSection('EXPIRATION');
     
    16431668          end;
    16441669          NextSection('SEEALSO');
    1645           if (no < 28) and (Imp[no].Expiration >= 0) then
     1670          if (no < nWonder) and (Imp[no].Expiration >= 0) then
    16461671            AddImprovement(woEiffel);
    16471672          for i := 0 to nImpReplacement - 1 do
Note: See TracChangeset for help on using the changeset viewer.