Changeset 349 for branches/highdpi/LocalPlayer/Help.pas
- Timestamp:
- Apr 6, 2021, 8:11:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Help.pas
r303 r349 7 7 UDpiControls, Protocol, ScreenTools, BaseWin, StringTables, Math, LCLIntf, LCLType, 8 8 Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls, 9 ButtonB, PVSB, Types, fgl ;9 ButtonB, PVSB, Types, fgl, IsoEngine; 10 10 11 11 const … … 102 102 ExtPic, TerrIcon: TDpiBitmap; 103 103 ScrollBar: TPVScrollbar; 104 NoMap: TIsoMap; 104 105 x0: array [-2..180] of Integer; 105 106 procedure PaintTerrIcon(x, y, xSrc, ySrc: Integer); … … 241 242 242 243 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; 245 250 SeeNo: mcArtillery), (Kind: hkImp; no: imHydro; SeeKind: hkImp; 246 251 SeeNo: woHoover), (Kind: hkImp; no: imWalls; SeeKind: hkImp; … … 269 274 begin 270 275 inherited; 276 NoMap := TIsoMap.Create; 277 271 278 HistItems := THistItems.Create; 272 279 … … 327 334 // FreeAndNil(CaptionFont); 328 335 FreeAndNil(HistItems); 336 FreeAndNil(NoMap); 329 337 end; 330 338 … … 397 405 ca.FrameRect(rect(x+1,i*24+1,x+24-1,i*24+24-1)); 398 406 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, 400 408 146); 401 409 BiColorTextOut(ca, $FFFFFF, $7F007F, x + 10 - ca.Textwidth(s[1]) div 2, … … 436 444 if (Kind = hkMisc) and (no = miscMain) then 437 445 ca.Font.Assign(UniFont[ftNormal]); 438 end 446 end; 439 447 end; 440 448 … … 460 468 ySrc := (iix div 7 + 1) * ySizeBig; 461 469 PaintPtr := PixelPointer(OffScreen, ScaleToNative(x0), ScaleToNative(y0)); 462 CoalPtr := PixelPointer(Templates , ScaleToNative(xCoal), ScaleToNative(yCoal));470 CoalPtr := PixelPointer(Templates.Data, ScaleToNative(xCoal), ScaleToNative(yCoal)); 463 471 for dy := -1 to 1 do 464 472 ImpPtr[dy] := PixelPointer(BigImp, ScaleToNative(xSrc), ScaleToNative(ySrc)); … … 504 512 procedure THelpDlg.PaintTerrIcon(x, y, xSrc, ySrc: integer); 505 513 begin 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, 511 527 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; 519 529 end; 520 530 … … 571 581 j and $FF]); 572 582 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); 574 584 Font.Assign(UniFont[ftSmall]); 575 585 BiColorTextOut(OffScreen.Canvas, $000000, $7F007F, … … 604 614 case HelpLineInfo.Picpix of 605 615 0: 606 FrameImage(OffScreen.Canvas, GrExt[HGrSystem2].Data,616 FrameImage(OffScreen.Canvas, HGrSystem2.Data, 607 617 12 + x0[i], -7 + i * 24, 56, 40, 137, 127); 608 618 1: 609 begin619 with NoMap do begin 610 620 PaintTerrIcon(12 + x0[i], -7 + i * 24, 611 621 1 + 3 * (xxt * 2 + 1), 1 + yyt); … … 620 630 end; 621 631 2: 622 begin632 with NoMap do begin 623 633 PaintTerrIcon(12 + x0[i], -7 + i * 24, 624 634 1 + 7 * (xxt * 2 + 1), 1 + yyt + 4 * (yyt * 3 + 1)); … … 660 670 j := AdvValue[HelpLineInfo.Picpix] div 1000; 661 671 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); 663 673 Sprite(OffScreen, HGrSystem, x0[i] + 3, 3 + i * 24, 14, 14, 664 674 127 + j * 15, 85); … … 705 715 end; 706 716 pkTer, pkBigTer: 707 begin717 with NoMap do begin 708 718 if HelpLineInfo.Format = pkBigTer then 709 719 y := i * 24 - 3 + yyt … … 760 770 end; 761 771 pkTerImp: 762 begin772 with NoMap do begin 763 773 ofs := 8; 764 774 if HelpLineInfo.Picpix = 5 then … … 767 777 xxt * 2 - 8, yyt * 2 - 4, 5 + 2 * (xxt * 2 + 1), 768 778 3 + yyt + 2 * (yyt * 3 + 1)); 769 srcno := 45 779 srcno := 45; 770 780 end 771 781 else … … 990 1000 procedure AddTextual(s: string); 991 1001 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; 994 1012 Name: string; 1013 Text: string; 995 1014 begin 996 1015 RightMargin := InnerWidth - 16 - DpiGetSystemMetrics(SM_CXVSCROLL); … … 1139 1158 Break; 1140 1159 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, 1142 1167 LinkIndex); 1143 1168 if (l < Length(s)) and (s[l + 1] = '\') then … … 1471 1496 hkMisc + hkCrossLink, miscGovList); 1472 1497 NextSection('BUILDALLOW'); 1473 for i := 0 to 27do1498 for i := 0 to nWonder - 1 do 1474 1499 if Imp[i].Preq = no then 1475 1500 AddImprovement(i); 1476 for i := 28to nImp - 1 do1501 for i := nWonder to nImp - 1 do 1477 1502 if (Imp[i].Preq = no) and (Imp[i].Kind <> ikCommon) then 1478 1503 AddImprovement(i); 1479 for i := 28to nImp - 1 do1504 for i := nWonder to nImp - 1 do 1480 1505 if (Imp[i].Preq = no) and (Imp[i].Kind = ikCommon) then 1481 1506 AddImprovement(i); … … 1514 1539 end; 1515 1540 NextSection('EXPIRATION'); 1516 for i := 0 to 27do1541 for i := 0 to nWonder - 1 do 1517 1542 if (Imp[i].Preq <> preNA) and (Imp[i].Expiration = no) then 1518 1543 AddImprovement(i); … … 1532 1557 List := THyperText.Create; 1533 1558 List.OwnsObjects := True; 1534 for i := 28to nImp - 1 do1559 for i := nWonder to nImp - 1 do 1535 1560 if (i <> imTrGoods) and (Imp[i].Preq <> preNA) and 1536 1561 (Imp[i].Kind = ikCommon) then … … 1545 1570 Caption := HelpText.Lookup('HELPTITLE_UNIQUELIST'); 1546 1571 // AddLine(HelpText.Lookup('HELPTITLE_UNIQUELIST'),pkSection); 1547 for i := 28to nImp - 1 do1572 for i := nWonder to nImp - 1 do 1548 1573 if (Imp[i].Preq <> preNA) and 1549 1574 ((Imp[i].Kind = ikNatLocal) or (Imp[i].Kind = ikNatGlobal)) then … … 1553 1578 LineFeed; 1554 1579 AddLine(HelpText.Lookup('HELPTITLE_SHIPPARTLIST'),pkSection); 1555 for i:= 28to nImp-1 do1580 for i:= nWonder to nImp-1 do 1556 1581 if (Imp[i].Preq<>preNA) and (Imp[i].Kind=ikShipPart) then 1557 1582 AddLine(Phrases.Lookup('IMPROVEMENTS',i),pkSmallIcon,i,hkImp,i); } … … 1561 1586 Caption := HelpText.Lookup('HELPTITLE_WONDERLIST'); 1562 1587 // AddLine(HelpText.Lookup('HELPTITLE_WONDERLIST'),pkSection); 1563 for i := 0 to 27do1588 for i := 0 to nWonder - 1 do 1564 1589 if Imp[i].Preq <> preNA then 1565 1590 AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon, i, … … 1587 1612 AddFeature(mcAcademy); 1588 1613 end; 1589 if (no < 28) and not Phrases2FallenBackToEnglish then1614 if (no < nWonder) and not Phrases2FallenBackToEnglish then 1590 1615 begin 1591 1616 LineFeed; … … 1633 1658 [Phrases.Lookup('TERRAIN', 3 * 12 + i)]), pkTer, 3 * 12 + i); 1634 1659 end; 1635 if (no < 28) and (Imp[no].Expiration >= 0) then1660 if (no < nWonder) and (Imp[no].Expiration >= 0) then 1636 1661 begin 1637 1662 NextSection('EXPIRATION'); … … 1643 1668 end; 1644 1669 NextSection('SEEALSO'); 1645 if (no < 28) and (Imp[no].Expiration >= 0) then1670 if (no < nWonder) and (Imp[no].Expiration >= 0) then 1646 1671 AddImprovement(woEiffel); 1647 1672 for i := 0 to nImpReplacement - 1 do
Note:
See TracChangeset
for help on using the changeset viewer.