Changeset 313


Ignore:
Timestamp:
Mar 17, 2021, 11:11:55 AM (3 years ago)
Author:
chronos
Message:
  • Modified: LoadGraphicSet now returns TGrExtDescr reference. Replaced integer index references to GrExt with with direct class reference to TGrExtDescr.
Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Battle.pas

    r205 r313  
    108108      FanaticColor);
    109109  BitBltCanvas(ca, xm - 12, ym - 12, 24, 24,
    110     GrExt[HGrSystem].Mask.Canvas, 26, 146, SRCAND);
     110    HGrSystem.Mask.Canvas, 26, 146, SRCAND);
    111111  BitBltCanvas(ca, xm - 12, ym - 12, 24, 24,
    112     GrExt[HGrSystem].Data.Canvas, 26, 146, SRCPAINT);
     112    HGrSystem.Data.Canvas, 26, 146, SRCPAINT);
    113113
    114114  LabelText := Format('%d', [Forecast.AStr]);
     
    133133  begin
    134134    BitBltCanvas(ca, xm + 9 + LDDamage - 7, ym - 6, 14, 17,
    135       GrExt[HGrSystem].Mask.Canvas, 51, 153, SRCAND);
     135      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    136136    BitBltCanvas(ca, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
    137       GrExt[HGrSystem].Mask.Canvas, 51, 153, SRCAND);
     137      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    138138    BitBltCanvas(ca, xm + 8 + LDDamage - 7, ym - 7, 14, 17,
    139       GrExt[HGrSystem].Data.Canvas, 51, 153, SRCPAINT);
     139      HGrSystem.Data.Canvas, 51, 153, SRCPAINT);
    140140  end;
    141141  LabelText := Format('%d', [DDamage]);
     
    153153  begin
    154154    BitBltCanvas(ca, xm - 6, ym + 9 + LADamage - 7, 14, 17,
    155       GrExt[HGrSystem].Mask.Canvas, 51, 153, SRCAND);
     155      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    156156    BitBltCanvas(ca, xm - 7, ym + 8 + LADamage - 7, 14, 17,
    157       GrExt[HGrSystem].Mask.Canvas, 51, 153, SRCAND);
     157      HGrSystem.Mask.Canvas, 51, 153, SRCAND);
    158158    BitBltCanvas(ca, xm - 7, ym + 8 + LADamage - 7, 14, 17,
    159       GrExt[HGrSystem].Data.Canvas, 51, 153, SRCPAINT);
     159      HGrSystem.Data.Canvas, 51, 153, SRCPAINT);
    160160  end;
    161161  LabelText := Format('%d', [MyUn[uix].Health - Forecast.EndHealthAtt]);
  • trunk/LocalPlayer/CityScreen.pas

    r295 r313  
    387387    if Kind = 3 then
    388388    begin
    389       Tex.clBevelLight := GrExt[HGrSystem].Data.Canvas.Pixels[104, 36];
     389      Tex.clBevelLight := HGrSystem.Data.Canvas.Pixels[104, 36];
    390390      Tex.clBevelShade := Tex.clBevelLight;
    391391    end;
     
    624624      xGr := 141;
    625625    BitBltCanvas(offscreen.Canvas, xmArea - 192 + 5 + i * d, ymArea - 96 - 29,
    626       27, 30, GrExt[HGrSystem].Mask.Canvas, xGr, 171, SRCAND); { shadow }
     626      27, 30, HGrSystem.Mask.Canvas, xGr, 171, SRCAND); { shadow }
    627627    Sprite(offscreen, HGrSystem, xmArea - 192 + 4 + i * d, ymArea - 96 - 30, 27,
    628628      30, xGr, 171);
     
    636636    xGr := 1 + 112;
    637637    BitBltCanvas(offscreen.Canvas, xmArea + 192 - 27 + 1 - i * d, 29 + 1, 27,
    638       30, GrExt[HGrSystem].Mask.Canvas, xGr, 171, SRCAND); { shadow }
     638      30, HGrSystem.Mask.Canvas, xGr, 171, SRCAND); { shadow }
    639639    Sprite(offscreen, HGrSystem, xmArea + 192 - 27 - i * d, 29, 27, 30,
    640640      xGr, 171);
     
    10521052        (integer(MyRO.EnemyModel[emix].mix) <> c.Project and cpIndex)) do
    10531053        dec(emix);
    1054       if Tribe[cOwner].ModelPicture[c.Project and cpIndex].HGr = 0 then
     1054      if Tribe[cOwner].ModelPicture[c.Project and cpIndex].HGr = HGrSystem then
    10551055        InitEnemyModel(emix);
    10561056    end;
  • trunk/LocalPlayer/Draft.pas

    r295 r313  
    336336          // paint cost
    337337          LightGradient(offscreen.Canvas, xFeature + 34,
    338             yFeature + LinePitch * i, 50, GrExt[HGrSystem].Data.Canvas.Pixels
     338            yFeature + LinePitch * i, 50, HGrSystem.Data.Canvas.Pixels
    339339            [187, 137]);
    340340          if (Domain = dGround) and (code[i] = mcDefense) then
  • trunk/LocalPlayer/Enhance.pas

    r257 r313  
    9797    if Controls[i] is TButtonC then
    9898      BitBltCanvas(Canvas, Controls[i].Left + 2, Controls[i].Top - 11, 8, 8,
    99         GrExt[HGrSystem].Data.Canvas, 121 + Controls[i].Tag mod 7 * 9,
     99        HGrSystem.Data.Canvas, 121 + Controls[i].Tag mod 7 * 9,
    100100        1 + Controls[i].Tag div 7 * 9);
    101101end;
  • trunk/LocalPlayer/Help.pas

    r304 r313  
    401401      ca.FrameRect(rect(x+1,i*24+1,x+24-1,i*24+24-1));
    402402      ca.Brush.Style:=bsClear; }
    403     BitBltCanvas(ca, x, y - 4, 24, 24, GrExt[HGrSystem].Data.Canvas, 1,
     403    BitBltCanvas(ca, x, y - 4, 24, 24, HGrSystem.Data.Canvas, 1,
    404404      146);
    405405    BiColorTextOut(ca, $FFFFFF, $7F007F, x + 10 - ca.Textwidth(s[1]) div 2,
     
    569569                j and $FF]);
    570570              PaintLogo(OffScreen.Canvas, (InnerWidth - 122) div 2, i * 24 + 1,
    571                 GrExt[HGrSystem].Data.Canvas.Pixels[95, 1], $000000);
     571                HGrSystem.Data.Canvas.Pixels[95, 1], $000000);
    572572              Font.Assign(UniFont[ftSmall]);
    573573              BiColorTextOut(OffScreen.Canvas, $000000, $7F007F,
     
    602602              case HelpLineInfo.Picpix of
    603603                0:
    604                   FrameImage(OffScreen.Canvas, GrExt[HGrSystem2].Data,
     604                  FrameImage(OffScreen.Canvas, HGrSystem2.Data,
    605605                    12 + x0[i], -7 + i * 24, 56, 40, 137, 127);
    606606                1:
     
    637637              ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[i], 2 - 1 + i * 24,
    638638                8 + 36 + x0[i], 2 + 20 + i * 24, $000000, $000000);
    639               Dump(OffScreen, HGrSystem, 8 + x0[i], 2 + i * 24, 36, 20,
     639              Dump(OffScreen, HGrSystem,  8 + x0[i], 2 + i * 24, 36, 20,
    640640                75 + HelpLineInfo.Picpix * 37, 295);
    641641              x0[i] := x0[i] + (8 + 8 + 36);
     
    658658              j := AdvValue[HelpLineInfo.Picpix] div 1000;
    659659              BitBltCanvas(OffScreen.Canvas, x0[i] + 4, 4 + i * 24, 14, 14,
    660                 GrExt[HGrSystem].Mask.Canvas, 127 + j * 15, 85, SRCAND);
     660                HGrSystem.Mask.Canvas, 127 + j * 15, 85, SRCAND);
    661661              Sprite(OffScreen, HGrSystem, x0[i] + 3, 3 + i * 24, 14, 14,
    662662                127 + j * 15, 85);
  • trunk/LocalPlayer/IsoEngine.pas

    r301 r313  
    5151    procedure FillRect(x, y, Width, Height, Color: integer);
    5252    procedure Textout(x, y, Color: integer; const s: string);
    53     procedure Sprite(HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
     53    procedure Sprite(HGr: TGrExtDescr; xDst, yDst, Width, Height, xGr, yGr: integer);
    5454    procedure TSprite(xDst, yDst, grix: integer; PureBlack: boolean = false);
    5555
     
    139139function ApplyTileSize(xxtNew, yytNew: integer): boolean;
    140140var
    141   i, x, y, xSrc, ySrc, HGrTerrainNew, HGrCitiesNew, age, size: integer;
     141  i: Integer;
     142  x: Integer;
     143  y: Integer;
     144  xSrc: Integer;
     145  ySrc: Integer;
     146  HGrTerrainNew: TGrExtDescr;
     147  HGrCitiesNew: TGrExtDescr;
     148  Age: Integer;
     149  Size: Integer;
    142150  LandMore, OceanMore, DitherMask, Mask24: TBitmap;
    143151  MaskLine: array [0 .. 50 * 3 - 1] of TPixelPointer; // 32 = assumed maximum for yyt
     
    147155  HGrTerrainNew := LoadGraphicSet(Format('Terrain%dx%d.png',
    148156    [xxtNew * 2, yytNew * 2]));
    149   if HGrTerrainNew < 0 then
     157  if not Assigned(HGrTerrainNew) then
    150158    exit;
    151159  HGrCitiesNew := LoadGraphicSet(Format('Cities%dx%d.png',
    152160    [xxtNew * 2, yytNew * 2]));
    153   if HGrCitiesNew < 0 then
     161  if not Assigned(HGrCitiesNew) then
    154162    exit;
    155163  xxt := xxtNew;
     
    196204  DitherMask.Canvas.FillRect(0, 0, DitherMask.Width, DitherMask.Height);
    197205  BitBltCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt * 2,
    198     GrExt[HGrTerrain].Mask.Canvas, 1 + 7 * (xxt * 2 + 1),
     206    HGrTerrain.Mask.Canvas, 1 + 7 * (xxt * 2 + 1),
    199207    1 + yyt + 15 * (yyt * 3 + 1), SRCAND);
    200208
     
    218226    for y := -1 to 6 do
    219227      BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt,
    220         xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);
     228        xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc);
    221229    for y := -2 to 6 do
    222230      BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt, xxt,
    223         yyt, GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt,
     231        yyt, HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt,
    224232        SRCPAINT);
    225233    for y := -2 to 6 do
    226234      BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2) + xxt, (y + 2) * yyt,
    227         xxt, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt,
     235        xxt, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc + yyt,
    228236        SRCPAINT);
    229237    for y := -2 to 6 do
     
    254262    for x := -2 to 6 do
    255263      BitBltCanvas(LandMore.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt,
    256         xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);
     264        xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc);
    257265    BitBltCanvas(LandMore.Canvas, xxt * 2, (y + 2) * yyt, xxt, yyt,
    258       GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt, SRCPAINT);
     266      HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, SRCPAINT);
    259267    for x := 0 to 7 do
    260268      BitBltCanvas(LandMore.Canvas, (x + 2) * (xxt * 2) - xxt, (y + 2) * yyt,
    261         xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt,
     269        xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc + yyt,
    262270        SRCPAINT);
    263271    for x := -2 to 6 do
     
    276284      if (x >= 1) = (y >= 2) then
    277285        BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
    278           GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);
     286          HGrTerrain.Data.Canvas, xSrc, ySrc);
    279287      if (x >= 1) and ((y < 2) or (x >= 2)) then
    280288      begin
    281289        BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt, yyt,
    282           GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt,
     290          HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt,
    283291          SRCPAINT);
    284292        BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
    285           GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt, SRCPAINT);
     293          HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, SRCPAINT);
    286294      end;
    287295      BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt, yyt,
     
    301309      if (x < 1) or (y >= 2) then
    302310        BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
    303           GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);
     311          HGrTerrain.Data.Canvas, xSrc, ySrc);
    304312      if (x = 1) and (y < 2) or (x >= 2) and (y >= 1) then
    305313      begin
    306314        BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt, yyt,
    307           GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt,
     315          HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt,
    308316          SRCPAINT);
    309317        BitBltCanvas(OceanMore.Canvas, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
    310           GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt, SRCPAINT);
     318          HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, SRCPAINT);
    311319      end;
    312320      BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
     
    317325    DitherMask.Canvas, 0, 0, DSTINVERT); { invert dither mask }
    318326  BitBltCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt * 2,
    319     GrExt[HGrTerrain].Mask.Canvas, 1, 1 + yyt, SRCPAINT);
     327    HGrTerrain.Mask.Canvas, 1, 1 + yyt, SRCPAINT);
    320328
    321329  for x := -1 to 6 do
     
    351359  end;
    352360  BitBltCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt,
    353     GrExt[HGrTerrain].Mask.Canvas, 1, 1 + yyt);
     361    HGrTerrain.Mask.Canvas, 1, 1 + yyt);
    354362
    355363  for x := 0 to 6 do
     
    369377  // reduce size of terrain icons
    370378  Mask24 := TBitmap.Create;
    371   Mask24.Assign(GrExt[HGrTerrain].Mask);
     379  Mask24.Assign(HGrTerrain.Mask);
    372380  Mask24.PixelFormat := pf24bit;
    373381  Mask24.BeginUpdate;
     
    526534end;
    527535
    528 procedure TIsoMap.Sprite(HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
    529 begin
    530   BitBltBitmap(GrExt[HGr].Mask, xDst, yDst, Width, Height, xGr, yGr, SRCAND);
    531   BitBltBitmap(GrExt[HGr].Data, xDst, yDst, Width, Height, xGr, yGr, SRCPAINT);
     536procedure TIsoMap.Sprite(HGr: TGrExtDescr; xDst, yDst, Width, Height, xGr, yGr: integer);
     537begin
     538  BitBltBitmap(HGr.Mask, xDst, yDst, Width, Height, xGr, yGr, SRCAND);
     539  BitBltBitmap(HGr.Data, xDst, yDst, Width, Height, xGr, yGr, SRCPAINT);
    532540end;
    533541
     
    579587      else
    580588        mixShow := mix;
    581       if (Tribe[Owner].ModelPicture[mixShow].HGr = 0) and
     589      if (Tribe[Owner].ModelPicture[mixShow].HGr = HGrSystem) and
    582590        (@OnInitEnemyModel <> nil) then
    583591        if not OnInitEnemyModel(emix) then
     
    612620        xGr := 121 + j mod 7 * 9;
    613621        yGr := 1 + j div 7 * 9;
    614         BitBltBitmap(GrExt[HGrSystem].Mask, x + xsh + 3, y + ysh + 9, 8, 8, xGr,
     622        BitBltBitmap(HGrSystem.Mask, x + xsh + 3, y + ysh + 9, 8, 8, xGr,
    615623          yGr, SRCAND);
    616624        Sprite(HGrSystem, x + xsh + 2, y + ysh + 8, 8, 8, xGr, yGr);
     
    631639  accessory: boolean);
    632640var
    633   age, cHGr, cpix, xGr, xShield, yShield, LabelTextColor, LabelLength: integer;
     641  age: Integer;
     642  cHGr: TGrExtDescr;
     643  cpix: Integer;
     644  xGr: Integer;
     645  xShield: Integer;
     646  yShield: Integer;
     647  LabelTextColor: Integer;
     648  LabelLength: Integer;
    634649  cpic: TCityPicture;
    635650  s: string;
     
    650665    cpix := Tribe[CityInfo.Owner].cpix;
    651666    if (ciWalled and CityInfo.Flags = 0) or
    652       (GrExt[cHGr].Data.Canvas.Pixels[(xGr + 4) * 65, cpix * 49 + 48] = $00FFFF)
     667      (cHGr.Data.Canvas.Pixels[(xGr + 4) * 65, cpix * 49 + 48] = $00FFFF)
    653668    then
    654669      Sprite(cHGr, x - xxc, y - 2 * yyc, xxc * 2, yyc * 3,
     
    819834    exit;
    820835
    821   BitBltBitmap(GrExt[HGrTerrain].Data, x + xxt div 2, y, xxt, yyt,
     836  BitBltBitmap(HGrTerrain.Data, x + xxt div 2, y, xxt, yyt,
    822837    1 + (Conn shr 6 + Conn and 1 shl 2) * (xxt * 2 + 1),
    823838    1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    824   BitBltBitmap(GrExt[HGrTerrain].Data, x + xxt, y + yyt div 2, xxt, yyt,
     839  BitBltBitmap(HGrTerrain.Data, x + xxt, y + yyt div 2, xxt, yyt,
    825840    1 + (Conn and 7) * (xxt * 2 + 1) + xxt,
    826841    1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    827   BitBltBitmap(GrExt[HGrTerrain].Data, x + xxt div 2, y + yyt, xxt, yyt,
     842  BitBltBitmap(HGrTerrain.Data, x + xxt div 2, y + yyt, xxt, yyt,
    828843    1 + (Conn shr 2 and 7) * (xxt * 2 + 1) + xxt,
    829844    1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    830   BitBltBitmap(GrExt[HGrTerrain].Data, x, y + yyt div 2, xxt, yyt,
     845  BitBltBitmap(HGrTerrain.Data, x, y + yyt div 2, xxt, yyt,
    831846    1 + (Conn shr 4 and 7) * (xxt * 2 + 1),
    832847    1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    833848  Conn := Connection4(Loc, fTerrain, fUNKNOWN); { dither to black }
    834849  if Conn and 1 <> 0 then
    835     BitBltBitmap(GrExt[HGrTerrain].Mask, x + xxt, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) +
     850    BitBltBitmap(HGrTerrain.Mask, x + xxt, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) +
    836851      xxt, 1 + yyt + 15 * (yyt * 3 + 1), SRCAND);
    837852  if Conn and 2 <> 0 then
    838     BitBltBitmap(GrExt[HGrTerrain].Mask, x + xxt, y + yyt, xxt, yyt,
     853    BitBltBitmap(HGrTerrain.Mask, x + xxt, y + yyt, xxt, yyt,
    839854      1 + 7 * (xxt * 2 + 1) + xxt, 1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND);
    840855  if Conn and 4 <> 0 then
    841     BitBltBitmap(GrExt[HGrTerrain].Mask, x, y + yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
     856    BitBltBitmap(HGrTerrain.Mask, x, y + yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
    842857      1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND);
    843858  if Conn and 8 <> 0 then
    844     BitBltBitmap(GrExt[HGrTerrain].Mask, x, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
     859    BitBltBitmap(HGrTerrain.Mask, x, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
    845860      1 + yyt + 15 * (yyt * 3 + 1), SRCAND);
    846861end;
     
    10121027
    10131028          BitBltCanvas(Borders.Canvas, 0, p1 * (yyt * 2), xxt * 2,
    1014             yyt * 2, GrExt[HGrTerrain].Data.Canvas,
     1029            yyt * 2, HGrTerrain.Data.Canvas,
    10151030            1 + 8 * (xxt * 2 + 1), 1 + yyt + 16 * (yyt * 3 + 1));
    10161031          Borders.BeginUpdate;
     
    10431058              if p2 <> p1 then
    10441059              begin
    1045                 BitBltBitmap(GrExt[HGrTerrain].Mask, x + dx * xxt, y + dy * yyt, xxt,
     1060                BitBltBitmap(HGrTerrain.Mask, x + dx * xxt, y + dy * yyt, xxt,
    10461061                  yyt, 1 + 8 * (xxt * 2 + 1) + dx * xxt,
    10471062                  1 + yyt + 16 * (yyt * 3 + 1) + dy * yyt, SRCAND);
     
    15361551                bix := Aix;
    15371552            if Aix = -1 then
    1538               BitBltBitmap(GrExt[HGrTerrain].Data, x + dx * xxt, y + dy * yyt, xxt,
     1553              BitBltBitmap(HGrTerrain.Data, x + dx * xxt, y + dy * yyt, xxt,
    15391554                yyt, 1 + 6 * (xxt * 2 + 1) + (dx + dy + 1) and 1 * xxt, 1 + yyt,
    15401555                SRCCOPY) // arctic <-> ocean
    15411556            else if bix = -1 then
    1542               BitBltBitmap(GrExt[HGrTerrain].Data, x + dx * xxt, y + dy * yyt, xxt,
     1557              BitBltBitmap(HGrTerrain.Data, x + dx * xxt, y + dy * yyt, xxt,
    15431558                yyt, 1 + 6 * (xxt * 2 + 1) + xxt - (dx + dy + 1) and 1 * xxt,
    15441559                1 + yyt * 2, SRCCOPY) // arctic <-> ocean
     
    15491564      end;
    15501565
    1551   DataCanvas := GrExt[HGrTerrain].Data.Canvas;
    1552   MaskCanvas := GrExt[HGrTerrain].Mask.Canvas;
     1566  DataCanvas := HGrTerrain.Data.Canvas;
     1567  MaskCanvas := HGrTerrain.Mask.Canvas;
    15531568  for dy := -2 to ny + 1 do
    15541569    for dx := -1 to nx do
  • trunk/LocalPlayer/MessgEx.pas

    r290 r313  
    149149      begin
    150150        Tribe[IconIndex].InitAge(GetAge(IconIndex));
    151         if Tribe[IconIndex].faceHGr >= 0 then
    152           TopSpace := 64
     151        if Assigned(Tribe[IconIndex].faceHGr) then
     152          TopSpace := 64;
    153153      end;
    154154    mikFullControl:
     
    336336      with MyRO.EnemyModel[emix], Tribe[Owner].ModelPicture[mix] do
    337337      begin
    338         BitBltCanvas(Canvas, x, y, 64, 48, GrExt[HGr].Mask.Canvas,
     338        BitBltCanvas(Canvas, x, y, 64, 48, HGr.Mask.Canvas,
    339339          pix mod 10 * 65 + 1, pix div 10 * 49 + 1, SRCAND);
    340         BitBltCanvas(Canvas, x, y, 64, 48, GrExt[HGr].Data.Canvas,
     340        BitBltCanvas(Canvas, x, y, 64, 48, HGr.Data.Canvas,
    341341          pix mod 10 * 65 + 1, pix div 10 * 49 + 1, SRCPAINT);
    342342      end;
     
    411411          ySizeBig, 0, 0);
    412412        BitBltCanvas(Canvas, ClientWidth div 2 - 32, 20, 64, 44,
    413           GrExt[HGr].Mask.Canvas, pix mod 10 * 65 + 1,
     413          HGr.Mask.Canvas, pix mod 10 * 65 + 1,
    414414          pix div 10 * 49 + 1, SRCAND);
    415415        BitBltCanvas(Canvas, ClientWidth div 2 - 32, 20, 64, 44,
    416           GrExt[HGr].Data.Canvas, pix mod 10 * 65 + 1,
     416          HGr.Data.Canvas, pix mod 10 * 65 + 1,
    417417          pix div 10 * 49 + 1, SRCPAINT);
    418418      end;
     
    421421        MainTexture.clCover);
    422422    mikTribe:
    423       if Tribe[IconIndex].faceHGr >= 0 then
     423      if Assigned(Tribe[IconIndex].faceHGr) then
    424424      begin
    425425        Frame(Canvas, ClientWidth div 2 - 32 - 1, 24 - 1,
    426426          ClientWidth div 2 + 32, 24 + 48, $000000, $000000);
    427427        BitBltCanvas(Canvas, ClientWidth div 2 - 32, 24, 64, 48,
    428           GrExt[Tribe[IconIndex].faceHGr].Data.Canvas,
     428          Tribe[IconIndex].faceHGr.Data.Canvas,
    429429          1 + Tribe[IconIndex].facepix mod 10 * 65,
    430430          1 + Tribe[IconIndex].facepix div 10 * 49)
  • trunk/LocalPlayer/NatStat.pas

    r295 r313  
    279279    // show leader picture
    280280    Tribe[pView].InitAge(GetAge(pView));
    281     if Tribe[pView].faceHGr >= 0 then
     281    if Assigned(Tribe[pView].faceHGr) then
    282282    begin
    283283      Dump(offscreen, Tribe[pView].faceHGr, 18, yIcon - 4, 64, 48,
  • trunk/LocalPlayer/Nego.pas

    r174 r313  
    149149      with TButtonN(Components[cix]) do
    150150      begin
    151         Graphic := GrExt[HGrSystem].Data;
    152         Mask := GrExt[HGrSystem].Mask;
    153         BackGraphic := GrExt[HGrSystem2].Data;
     151        Graphic := HGrSystem.Data;
     152        Mask := HGrSystem.Mask;
     153        BackGraphic := HGrSystem2.Data;
    154154        case Tag shr 8 of
    155155          1:
     
    432432    Brush.Color := $000000;
    433433    Tribe[p].InitAge(GetAge(p));
    434     if Tribe[p].faceHGr >= 0 then
     434    if Assigned(Tribe[p].faceHGr) then
    435435      Dump(Offscreen, Tribe[p].faceHGr, X, Y, 64, 48,
    436436        1 + Tribe[p].facepix mod 10 * 65, 1 + Tribe[p].facepix div 10 * 49)
  • trunk/LocalPlayer/Rates.pas

    r188 r313  
    123123      for i := 0 to current div 8 - 1 do
    124124        BitBltCanvas(Offscreen.Canvas, x + max - 8 - i * 8, y, 8, 7,
    125           GrExt[HGrSystem].Data.Canvas, 104, 9 + 8 * 2);
     125          HGrSystem.Data.Canvas, 104, 9 + 8 * 2);
    126126      BitBltCanvas(Offscreen.Canvas, x + max - current, y, current - 8 * (current div 8), 7,
    127         GrExt[HGrSystem].Data.Canvas, 104, 9 + 8 * 2);
     127        HGrSystem.Data.Canvas, 104, 9 + 8 * 2);
    128128      Brush.Color := $000000;
    129129      FillRect(Rect(x, y, x + max - current, y + 7));
  • trunk/LocalPlayer/Select.pas

    r226 r313  
    579579                j := AdvValue[lix] div 1000;
    580580                BitBltCanvas(offscreen.Canvas, (8 + 16 - 4), y0 + 2, 14, 14,
    581                   GrExt[HGrSystem].Mask.Canvas, 127 + j * 15,
     581                  HGrSystem.Mask.Canvas, 127 + j * 15,
    582582                  85, SRCAND);
    583583                Sprite(offscreen, HGrSystem, (8 + 16 - 5), y0 + 1, 14, 14,
     
    13501350          begin
    13511351            if Tribe[DipMem[me].pContact].ModelPicture
    1352               [MyRO.EnemyModel[emix].mix].HGr = 0 then
     1352              [MyRO.EnemyModel[emix].mix].HGr = HGrSystem then
    13531353              InitEnemyModel(emix);
    13541354            code[0, Lines[0]] := emix;
     
    13731373            (MyRO.EnemyModel[code[1, Lines[0]]].mix = i)) do
    13741374            dec(code[1, Lines[0]]);
    1375           if Tribe[pView].ModelPicture[i].HGr = 0 then
     1375          if Tribe[pView].ModelPicture[i].HGr = HGrSystem then
    13761376            InitEnemyModel(code[1, Lines[0]]);
    13771377          code[0, Lines[0]] := i;
     
    13941394            PPicture := @Tribe[MyRO.EnemyModel[emix].Owner].ModelPicture
    13951395              [MyRO.EnemyModel[emix].mix];
    1396             if PPicture.HGr = 0 then
     1396            if PPicture.HGr = HGrSystem then
    13971397              InitEnemyModel(emix);
    13981398            ok := true;
  • trunk/LocalPlayer/Term.pas

    r312 r313  
    445445  SoundPreloadDone: Integer;
    446446  MarkCityLoc: Integer;
    447   HGrTerrain: Integer;
    448   HGrCities: Integer;
     447  HGrTerrain: TGrExtDescr;
     448  HGrCities: TGrExtDescr;
    449449  MovieSpeed: Integer;
    450450  CityRepMask: Cardinal;
     
    751751  for emix := 0 to MyRO.nEnemyModel - 1 do
    752752    with MyRO.EnemyModel[emix] do
    753       if Tribe[Owner].ModelPicture[mix].HGr = 0 then
     753      if Tribe[Owner].ModelPicture[mix].HGr = HGrSystem then
    754754        InitEnemyModel(emix);
    755755end;
     
    834834    while MyData.ToldModels < MyRO.nModel do
    835835    begin { new Unit class available }
    836       if (ModelPicture[MyData.ToldModels].HGr > 0) and
     836      if (ModelPicture[MyData.ToldModels].HGr <> HGrSystem) and
    837837        (MyModel[MyData.ToldModels].Kind <> mkSelfDeveloped) then
    838838      begin // save picture of DevModel
    839839        ModelPicture[MyData.ToldModels + 1] := ModelPicture[MyData.ToldModels];
    840840        ModelName[MyData.ToldModels + 1] := ModelName[MyData.ToldModels];
    841         ModelPicture[MyData.ToldModels].HGr := 0
     841        ModelPicture[MyData.ToldModels].HGr := HGrSystem
    842842      end;
    843       if ModelPicture[MyData.ToldModels].HGr = 0 then
     843      if ModelPicture[MyData.ToldModels].HGr = HGrSystem then
    844844        InitMyModel(MyData.ToldModels, true);
    845845      { only run if no researched model }
     
    10421042        DraftDlg.ShowNewContent(wmModal);
    10431043        if DraftDlg.ModalResult <> mrOK then
    1044           Tribe[me].ModelPicture[MyRO.nModel].HGr := 0
     1044          Tribe[me].ModelPicture[MyRO.nModel].HGr := HGrSystem
    10451045      end;
    10461046    until (ChosenResearch <> adMilitary) or (DraftDlg.ModalResult = mrOK);
     
    16031603  for x := 0 to 11 do
    16041604    for y := 0 to 1 do
    1605       MiniColors[x, y] := GrExt[HGrSystem].Data.Canvas.Pixels[66 + x, 67 + y];
     1605      MiniColors[x, y] := HGrSystem.Data.Canvas.Pixels[66 + x, 67 + y];
    16061606  IsoEngine.Init(InitEnemyModel);
    16071607  if not IsoEngine.ApplyTileSize(xxt, yyt) and ((xxt <> 48) or (yyt <> 24) or (xxt <> 72))
     
    27852785              ItsMeAgain(p1);
    27862786              for mix := 0 to MyRO.nModel - 1 do
    2787                 if Tribe[me].ModelPicture[mix].HGr = 0 then
     2787                if Tribe[me].ModelPicture[mix].HGr = HGrSystem then
    27882788                  InitMyModel(mix, true);
    27892789            end;
     
    30753075        begin
    30763076          CurrentMoveInfo.DoShow := false;
    3077           if not idle and (Tribe[Owner].ModelPicture[mix].HGr = 0) then
     3077          if not idle and (Tribe[Owner].ModelPicture[mix].HGr = HGrSystem) then
    30783078            InitEnemyModel(emix);
    30793079
     
    32703270          begin
    32713271            ToLoc := dLoc(FromLoc, dx, dy);
    3272             if Tribe[Owner].ModelPicture[mix].HGr = 0 then
     3272            if Tribe[Owner].ModelPicture[mix].HGr = HGrSystem then
    32733273              InitEnemyModel(emix);
    32743274
     
    40734073begin
    40744074  if not Assigned(MyMap) then Exit;
    4075   cmPolOcean := GrExt[HGrSystem].Data.Canvas.Pixels[101, 67];
    4076   cmPolNone := GrExt[HGrSystem].Data.Canvas.Pixels[102, 67];
     4075  cmPolOcean := HGrSystem.Data.Canvas.Pixels[101, 67];
     4076  cmPolNone := HGrSystem.Data.Canvas.Pixels[102, 67];
    40774077  hw := MapWidth div (xxt * 2);
    40784078  with Mini.Canvas do begin
     
    44004400          $FFFFFF, $B0B0B0);
    44014401        BitBltCanvas(Panel.Canvas, ClientWidth - xPalace, yPalace, xSizeBig,
    4402           ySizeBig, GrExt[HGrSystem2].Data.Canvas, 70, 123);
     4402          ySizeBig, HGrSystem2.Data.Canvas, 70, 123);
    44034403      end
    44044404      else if MyRO.NatBuilt[imPalace] > 0 then
     
    46154615            BiColorTextWidth(Panel.Canvas, s) div 2, PanelHeight - 23, s);
    46164616
    4617           FrameImage(Panel.Canvas, GrExt[HGrSystem].Data,
     4617          FrameImage(Panel.Canvas, HGrSystem.Data,
    46184618            xMidPanel + 7 + xUnitText, yTroop + 15, 12, 14,
    46194619            121 + Exp div ExpCost * 13, 28);
     
    53535353              MyRO.EnemyModel[emix].mix, MouseLoc) >= rExecuted) then
    53545354            begin
    5355               if Tribe[p1].ModelPicture[MyRO.EnemyModel[emix].mix].HGr = 0 then
     5355              if Tribe[p1].ModelPicture[MyRO.EnemyModel[emix].mix].HGr = HGrSystem then
    53565356                InitEnemyModel(emix);
    53575357              m2 := TMenuItem.Create(m);
     
    64366436procedure TMainScreen.SetViewpoint(p: integer);
    64376437var
    6438   i: integer;
     6438  i: Integer;
    64396439begin
    64406440  if supervising and (G.RO[0].Turn > 0) and
     
    64476447    SumCities(TaxSum, ScienceSum);
    64486448    for i := 0 to MyRO.nModel - 1 do
    6449       if Tribe[me].ModelPicture[i].HGr = 0 then
    6450         InitMyModel(i, true);
     6449      if Tribe[me].ModelPicture[i].HGr = HGrSystem then
     6450        InitMyModel(i, True);
    64516451
    64526452    SetTroopLoc(-1);
    64536453    PanelPaint;
    6454     MapValid := false;
     6454    MapValid := False;
    64556455    PaintAllMaps;
    64566456  end;
  • trunk/LocalPlayer/Tribes.pas

    r312 r313  
    1414
    1515  TModelPicture = record
    16     HGr: Integer;
     16    HGr: TGrExtDescr;
    1717    pix: Integer;
    1818    xShield: Integer;
     
    2929
    3030  TTribe = class
    31     symHGr: Integer;
     31    symHGr: TGrExtDescr;
    3232    sympix: Integer;
    33     faceHGr: Integer;
     33    faceHGr: TGrExtDescr;
    3434    facepix: Integer;
    35     cHGr: Integer;
     35    cHGr: TGrExtDescr;
    3636    cpix: Integer;
    3737    // symbol and city graphics
     
    6262var
    6363  Tribe: array [0 .. nPl - 1] of TTribe;
    64   HGrStdUnits: Integer;
     64  HGrStdUnits: TGrExtDescr;
    6565
    6666procedure Init;
     
    7070procedure FindStdModelPicture(Code: Integer; var pix: Integer; var Name: string);
    7171function GetTribeInfo(FileName: string; var Name: string; var Color: TColor): Boolean;
    72 procedure FindPosition(HGr, x, y, xmax, ymax: Integer; Mark: TColor;
     72procedure FindPosition(HGr: TGrExtDescr; x, y, xmax, ymax: Integer; Mark: TColor;
    7373  var xp, yp: Integer);
    7474
     
    8282  TChosenModelPictureInfo = record
    8383    Hash: Integer;
    84     HGr: Integer;
     84    HGr: TGrExtDescr;
    8585    pix: Integer;
    8686    ModelName: ShortString;
     
    328328end;
    329329
    330 procedure FindPosition(HGr, x, y, xmax, ymax: Integer; Mark: TColor;
     330procedure FindPosition(HGr: TGrExtDescr; x, y, xmax, ymax: Integer; Mark: TColor;
    331331  var xp, yp: Integer);
    332332begin
    333333  xp := 0;
    334   while (xp < xmax) and (GrExt[HGr].Data.Canvas.Pixels[x + 1 + xp, y] <> Mark) do
     334  while (xp < xmax) and (HGr.Data.Canvas.Pixels[x + 1 + xp, y] <> Mark) do
    335335    Inc(xp);
    336336  yp := 0;
    337   while (yp < ymax) and (GrExt[HGr].Data.Canvas.Pixels[x, y + 1 + yp] <> Mark) do
     337  while (yp < ymax) and (HGr.Data.Canvas.Pixels[x, y + 1 + yp] <> Mark) do
    338338    Inc(yp);
    339339end;
     
    447447      end
    448448      else
    449         cHGr := -1;
     449        cHGr := nil;
    450450
    451451{$IFNDEF SCR}
     
    454454      Item := Get;
    455455      if Item = '' then
    456         faceHGr := -1
     456        faceHGr := nil
    457457      else
    458458      begin
    459459        faceHGr := LoadGraphicSet(Item + '.png');
    460460        facepix := GetNum;
    461         if GrExt[faceHGr].Data.Canvas.Pixels[facepix mod 10 * 65,
     461        if faceHGr.Data.Canvas.Pixels[facepix mod 10 * 65,
    462462          facepix div 10 * 49 + 48] = $00FFFF then
    463463        begin // generate shield picture
    464           GrExt[faceHGr].Data.Canvas.Pixels[facepix mod 10 * 65,
     464          faceHGr.Data.Canvas.Pixels[facepix mod 10 * 65,
    465465            facepix div 10 * 49 + 48] := $000000;
    466466          Gray := $B8B8B8;
    467           ImageOp_BCC(GrExt[faceHGr].Data, Templates,
     467          ImageOp_BCC(faceHGr.Data, Templates,
    468468            facepix mod 10 * 65 + 1, facepix div 10 * 49 + 1, 1, 25, 64, 48,
    469469            Gray, Color);
     
    500500        HGr := LoadGraphicSet(GrName);
    501501        pix := Info.pix;
    502         Inc(GrExt[HGr].pixUsed[pix]);
     502        Inc(HGr.pixUsed[pix]);
    503503      end;
    504504      ModelName[mix] := '';
     
    558558  Code, Turn: Integer; ForceNew: Boolean): Boolean;
    559559var
    560   i, Cnt, HGr, Used, LeastUsed: Integer;
     560  i: Integer;
     561  Cnt: Integer;
     562  HGr: TGrExtDescr;
     563  Used: Integer;
     564  LeastUsed: Integer;
    561565  TestPic: TModelPictureInfo;
    562566  ok: Boolean;
     
    567571    if Code = GetNum then
    568572    begin
    569       if ForceNew or (HGr < 0) then
     573      if ForceNew or (not Assigned(HGr)) then
    570574        Used := 0
    571575      else
    572576      begin
    573         Used := 4 * GrExt[HGr].pixUsed[TestPic.pix];
     577        Used := 4 * HGr.pixUsed[TestPic.pix];
    574578        if HGr = HGrStdUnits then
    575579          Inc(Used, 2); // prefer units not from StdUnits
     
    596600      if PictureList[i].Hash = Picture.Hash then
    597601      begin
    598         Picture.GrName := GrExt[PictureList[i].HGr].Name;
     602        Picture.GrName := PictureList[i].HGr.Name;
    599603        Picture.pix := PictureList[i].pix;
    600604        Result := False;
     
    623627      ok := True;
    624628      TestPic.GrName := Copy(Input, 8, 255) + '.png';
    625       HGr := GrExt.Count - 1;
    626       while (HGr >= 0) and (GrExt[HGr].Name <> TestPic.GrName) do
    627         Dec(HGr);
     629      HGr := GrExt.SearchByName(TestPic.GrName);
    628630    end
    629631    else if (Input <> '') and (Input[1] = '#') then
  • trunk/LocalPlayer/UnitStat.pas

    r300 r313  
    136136      begin
    137137        mox := @MyRO.EnemyModel[emix];
    138         if Tribe[owner].ModelPicture[mix].HGr = 0 then
     138        if Tribe[owner].ModelPicture[mix].HGr = HGrSystem then
    139139          InitEnemyModel(emix);
    140140      end
     
    529529          with offscreen.Canvas do
    530530          begin
    531             Brush.Color := GrExt[HGrSystem].Data.Canvas.Pixels[98, 67];
     531            Brush.Color := HGrSystem.Data.Canvas.Pixels[98, 67];
    532532            offscreen.Canvas.FillRect(Rect(xView, yView, xView + 64,
    533533              yView + 16));
     
    574574            Sprite(offscreen, HGrStdUnits, xView, yView, xxu * 2, yyu * 2,
    575575              1 + 6 * (xxu * 2 + 1), 1);
    576           FrameImage(offscreen.Canvas, GrExt[HGrSystem].Data, xView - 20,
     576          FrameImage(offscreen.Canvas, HGrSystem.Data, xView - 20,
    577577            yView + 5, 12, 14, 121 + Exp div ExpCost * 13, 28);
    578578          if Health < 100 then
  • trunk/Packages/CevoComponents/DrawDlg.pas

    r297 r313  
    202202    if Components[cix] is TButtonBase then
    203203    begin
    204       TButtonBase(Components[cix]).Graphic := GrExt[HGrSystem].Data;
     204      TButtonBase(Components[cix]).Graphic := HGrSystem.Data;
    205205      // if ButtonDownSound <> '*' then
    206206      // DownSound := GetSoundsDir + DirectorySeparator + ButtonDownSound + '.wav';
     
    210210        TButtonA(Components[cix]).Font := UniFont[ftButton];
    211211      if Components[cix] is TButtonB then
    212         TButtonB(Components[cix]).Mask := GrExt[HGrSystem].Mask;
     212        TButtonB(Components[cix]).Mask := HGrSystem.Mask;
    213213    end;
    214214end;
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r312 r313  
    2525  TLoadGraphicFileOptions = set of TLoadGraphicFileOption;
    2626
     27  { TGrExtDescr }
     28
     29  TGrExtDescr = class
     30    Name: string;
     31    Data: TBitmap;
     32    Mask: TBitmap;
     33    pixUsed: array of Byte;
     34    procedure ResetPixUsed;
     35    constructor Create;
     36    destructor Destroy; override;
     37  end;
     38
     39  { TGrExtDescrs }
     40
     41  TGrExtDescrs = class(TFPGObjectList<TGrExtDescr>)
     42    function SearchByName(Name: string): TGrExtDescr;
     43    function AddNew(Name: string): TGrExtDescr;
     44  end;
     45
     46  TFontType = (ftNormal, ftSmall, ftTiny, ftCaption, ftButton);
    2747
    2848{$IFDEF WINDOWS}
     
    3858function HexStringToColor(S: string): integer;
    3959function LoadGraphicFile(Bmp: TBitmap; FileName: string; Options: TLoadGraphicFileOptions = []): boolean;
    40 function LoadGraphicSet(const Name: string): integer;
    41 procedure Dump(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
    42 procedure Sprite(Canvas: TCanvas; HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
     60function LoadGraphicSet(const Name: string): TGrExtDescr;
     61procedure Dump(dst: TBitmap; HGr: TGrExtDescr; xDst, yDst, Width, Height, xGr, yGr: integer);
     62procedure Sprite(Canvas: TCanvas; HGr: TGrExtDescr; xDst, yDst, Width, Height, xGr, yGr: integer);
    4363  overload;
    44 procedure Sprite(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
     64procedure Sprite(dst: TBitmap; HGr: TGrExtDescr; xDst, yDst, Width, Height, xGr, yGr: integer);
    4565  overload;
    4666procedure MakeBlue(Dst: TBitmap; X, Y, Width, Height: Integer);
     
    168188  cliWater = 4;
    169189
    170 type
    171 
    172   { TGrExtDescr }
    173 
    174   TGrExtDescr = class
    175     Name: string;
    176     Data: TBitmap;
    177     Mask: TBitmap;
    178     pixUsed: array of Byte;
    179     procedure ResetPixUsed;
    180     constructor Create;
    181     destructor Destroy; override;
    182   end;
    183 
    184   { TGrExtDescrs }
    185 
    186   TGrExtDescrs = class(TFPGObjectList<TGrExtDescr>)
    187     function SearchByName(Name: string): TGrExtDescr;
    188     function AddNew(Name: string): TGrExtDescr;
    189   end;
    190 
    191   TFontType = (ftNormal, ftSmall, ftTiny, ftCaption, ftButton);
    192 
    193190var
    194191  Phrases: TStringTable;
    195192  Phrases2: TStringTable;
    196193  GrExt: TGrExtDescrs;
    197   HGrSystem: Integer;
    198   HGrSystem2: Integer;
     194  HGrSystem: TGrExtDescr;
     195  HGrSystem2: TGrExtDescr;
    199196  ClickFrameColor: Integer;
    200197  MainTextureAge: Integer;
     
    495492end;
    496493
    497 function LoadGraphicSet(const Name: string): Integer;
    498 var
    499   I: Integer;
     494function LoadGraphicSet(const Name: string): TGrExtDescr;
     495var
    500496  x: Integer;
    501497  y: Integer;
     
    505501  DataPixel: TPixelPointer;
    506502  MaskPixel: TPixelPointer;
    507   NewGrExt: TGrExtDescr;
    508 begin
    509   NewGrExt := GrExt.SearchByName(Name);
    510   if not Assigned(NewGrExt) then begin
    511     NewGrExt := GrExt.AddNew(Name);
     503begin
     504  Result := GrExt.SearchByName(Name);
     505  if not Assigned(Result) then begin
     506    Result := GrExt.AddNew(Name);
    512507    FileName := GetGraphicsDir + DirectorySeparator + Name;
    513     if not LoadGraphicFile(NewGrExt.Data, FileName) then begin
    514       Result := -1;
     508    if not LoadGraphicFile(Result.Data, FileName) then begin
     509      Result := nil;
    515510      Exit;
    516511    end;
    517512
    518     NewGrExt.ResetPixUsed;
    519 
    520     xmax := NewGrExt.Data.Width - 1; // allows 4-byte access even for last pixel
     513    Result.ResetPixUsed;
     514
     515    xmax := Result.Data.Width - 1; // allows 4-byte access even for last pixel
    521516    // Why there was that limit?
    522517    //if xmax > 970 then
    523518    //  xmax := 970;
    524519
    525     NewGrExt.Mask.SetSize(NewGrExt.Data.Width, NewGrExt.Data.Height);
    526 
    527     NewGrExt.Data.BeginUpdate;
    528     NewGrExt.Mask.BeginUpdate;
    529     DataPixel := PixelPointer(NewGrExt.Data);
    530     MaskPixel := PixelPointer(NewGrExt.Mask);
    531     for y := 0 to ScaleToNative(NewGrExt.Data.Height) - 1 do begin
     520    Result.Mask.SetSize(Result.Data.Width, Result.Data.Height);
     521
     522    Result.Data.BeginUpdate;
     523    Result.Mask.BeginUpdate;
     524    DataPixel := PixelPointer(Result.Data);
     525    MaskPixel := PixelPointer(Result.Mask);
     526    for y := 0 to ScaleToNative(Result.Data.Height) - 1 do begin
    532527      for x := 0 to ScaleToNative(xmax) - 1 do begin
    533528        OriginalColor := DataPixel.Pixel^.ARGB and $FFFFFF;
     
    548543      MaskPixel.NextLine;
    549544    end;
    550     NewGrExt.Data.EndUpdate;
    551     NewGrExt.Mask.EndUpdate;
    552   end;
    553   Result := GrExt.IndexOf(NewGrExt);
    554 end;
    555 
    556 procedure Dump(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
     545    Result.Data.EndUpdate;
     546    Result.Mask.EndUpdate;
     547  end;
     548end;
     549
     550procedure Dump(dst: TBitmap; HGr: TGrExtDescr; xDst, yDst, Width, Height, xGr, yGr: integer);
    557551begin
    558552  BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height,
    559     GrExt[HGr].Data.Canvas, xGr, yGr);
     553    HGr.Data.Canvas, xGr, yGr);
    560554end;
    561555
     
    820814end;
    821815
    822 procedure Sprite(Canvas: TCanvas; HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
     816procedure Sprite(Canvas: TCanvas; HGr: TGrExtDescr; xDst, yDst, Width, Height, xGr, yGr: integer);
    823817begin
    824818  BitBltCanvas(Canvas, xDst, yDst, Width, Height,
    825     GrExt[HGr].Mask.Canvas, xGr, yGr, SRCAND);
     819    HGr.Mask.Canvas, xGr, yGr, SRCAND);
    826820  BitBltCanvas(Canvas, xDst, yDst, Width, Height,
    827     GrExt[HGr].Data.Canvas, xGr, yGr, SRCPAINT);
    828 end;
    829 
    830 procedure Sprite(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
     821    HGr.Data.Canvas, xGr, yGr, SRCPAINT);
     822end;
     823
     824procedure Sprite(dst: TBitmap; HGr: TGrExtDescr; xDst, yDst, Width, Height, xGr, yGr: integer);
    831825begin
    832826  BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height,
    833     GrExt[HGr].Mask.Canvas, xGr, yGr, SRCAND);
     827    HGr.Mask.Canvas, xGr, yGr, SRCAND);
    834828  BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height,
    835     GrExt[HGr].Data.Canvas, xGr, yGr, SRCPAINT);
     829    HGr.Data.Canvas, xGr, yGr, SRCPAINT);
    836830end;
    837831
     
    10101004  for x := 0 to wOrna - 1 do
    10111005    for y := 0 to hOrna - 1 do begin
    1012       p := GrExt[HGrSystem2].Data.Canvas.Pixels[xOrna + x, yOrna + y];
     1006      p := HGrSystem2.Data.Canvas.Pixels[xOrna + x, yOrna + y];
    10131007      if p = $0000FF then
    1014         GrExt[HGrSystem2].Data.Canvas.Pixels[xOrna + x, yOrna + y] := Light
     1008        HGrSystem2.Data.Canvas.Pixels[xOrna + x, yOrna + y] := Light
    10151009      else if p = $FF0000 then
    1016         GrExt[HGrSystem2].Data.Canvas.Pixels[xOrna + x, yOrna + y] := Shade;
     1010        HGrSystem2.Data.Canvas.Pixels[xOrna + x, yOrna + y] := Shade;
    10171011    end;
    10181012  InitOrnamentDone := True;
     
    10251019  for x := 0 to 9 do
    10261020    for y := 0 to 9 do
    1027       if GrExt[HGrSystem].Mask.Canvas.Pixels[66 + x, 47 + y] = 0 then
     1021      if HGrSystem.Mask.Canvas.Pixels[66 + x, 47 + y] = 0 then
    10281022      begin
    1029         intensity := GrExt[HGrSystem].Data.Canvas.Pixels[66 +
     1023        intensity := HGrSystem.Data.Canvas.Pixels[66 +
    10301024          x, 47 + y] and $FF;
    1031         GrExt[HGrSystem].Data.Canvas.Pixels[77 + x, 47 + y] :=
     1025        HGrSystem.Data.Canvas.Pixels[77 + x, 47 + y] :=
    10321026          T.clMark and $FF * intensity div $FF + T.clMark shr 8 and
    10331027          $FF * intensity div $FF shl 8 + T.clMark shr 16 and
    10341028          $FF * intensity div $FF shl 16;
    10351029      end;
    1036   BitBltCanvas(GrExt[HGrSystem].Mask.Canvas, 77, 47, 10, 10,
    1037     GrExt[HGrSystem].Mask.Canvas, 66, 47);
     1030  BitBltCanvas(HGrSystem.Mask.Canvas, 77, 47, 10, 10,
     1031    HGrSystem.Mask.Canvas, 66, 47);
    10381032end;
    10391033
     
    11441138  procedure PaintIcon(x, y, Kind: Integer);
    11451139  begin
    1146     BitBltCanvas(ca, x, y + 6, 10, 10, GrExt[HGrSystem].Mask.Canvas,
     1140    BitBltCanvas(ca, x, y + 6, 10, 10, HGrSystem.Mask.Canvas,
    11471141      66 + Kind mod 11 * 11, 115 + Kind div 11 * 11, SRCAND);
    1148     BitBltCanvas(ca, x, y + 6, 10, 10, GrExt[HGrSystem].Data.Canvas,
     1142    BitBltCanvas(ca, x, y + 6, 10, 10, HGrSystem.Data.Canvas,
    11491143      66 + Kind mod 11 * 11, 115 + Kind div 11 * 11, SRCPAINT);
    11501144  end;
     
    12861280    (16, 12, 8, 4, 0, -4, -8, -12 - 24, -16 + 16, -20, -24, -28, -32, -36, -40, -44);
    12871281begin
    1288   Gradient(ca, x, y, 0, 1, Width, 0, GrExt[HGrSystem].Data.Canvas.Pixels
     1282  Gradient(ca, x, y, 0, 1, Width, 0, HGrSystem.Data.Canvas.Pixels
    12891283    [187, 137 + Kind], Brightness);
    12901284end;
     
    13041298begin
    13051299  Gradient(ca, x, y, 1, 0, 0, Height,
    1306     GrExt[HGrSystem].Data.Canvas.Pixels[187, 137 + Kind], Brightness);
     1300    HGrSystem.Data.Canvas.Pixels[187, 137 + Kind], Brightness);
    13071301end;
    13081302
     
    13661360      begin
    13671361        BitBltCanvas(dst.Canvas, xIcon + 4 + i * (14 * ld div sd), yIcon + 2 + 1, 14,
    1368           14, GrExt[HGrSystem].Mask.Canvas, 67 + Kind mod 8 * 15,
     1362          14, HGrSystem.Mask.Canvas, 67 + Kind mod 8 * 15,
    13691363          70 + Kind div 8 * 15, SRCAND);
    13701364        Sprite(dst, HGrSystem, xIcon + 3 + i * (14 * ld div sd), yIcon + 2,
     
    13751369        BitBltCanvas(dst.Canvas, xIcon + 4 + (val mod 10) *
    13761370          (14 * ld div sd) + i * (14 * ld div sd), yIcon + 3, 14, 14,
    1377           GrExt[HGrSystem].Mask.Canvas, 67 + 7 mod 8 * 15,
     1371          HGrSystem.Mask.Canvas, 67 + 7 mod 8 * 15,
    13781372          70 + 7 div 8 * 15, SRCAND);
    13791373        Sprite(dst, HGrSystem, xIcon + 3 + (val mod 10) *
     
    13991393      begin
    14001394        BitBltCanvas(dst.Canvas, xIcon + 4 + i * (14 * ld div sd), yIcon + 3, 14, 14,
    1401           GrExt[HGrSystem].Mask.Canvas, 67 + Kind mod 8 * 15,
     1395          HGrSystem.Mask.Canvas, 67 + Kind mod 8 * 15,
    14021396          70 + Kind div 8 * 15, SRCAND);
    14031397        Sprite(dst, HGrSystem, xIcon + 3 + i * (14 * ld div sd), yIcon + 2,
     
    14081402        BitBltCanvas(dst.Canvas, xIcon + 4 + (val div 10) *
    14091403          (14 * ld div sd) + i * (10 * ld div sd), yIcon + 7, 10, 10,
    1410           GrExt[HGrSystem].Mask.Canvas, 66 + Kind mod 11 * 11,
     1404          HGrSystem.Mask.Canvas, 66 + Kind mod 11 * 11,
    14111405          115 + Kind div 11 * 11, SRCAND);
    14121406        Sprite(dst, HGrSystem, xIcon + 3 + (val div 10) *
     
    14441438    for i := 0 to pos div 8 - 1 do
    14451439      BitBltCanvas(ca, x + i * 8, y, 8, 7,
    1446         GrExt[HGrSystem].Data.Canvas, 104, 9 + 8 * Kind);
     1440        HGrSystem.Data.Canvas, 104, 9 + 8 * Kind);
    14471441    BitBltCanvas(ca, x + 8 * (pos div 8), y, pos - 8 * (pos div 8), 7,
    1448       GrExt[HGrSystem].Data.Canvas, 104, 9 + 8 * Kind);
     1442      HGrSystem.Data.Canvas, 104, 9 + 8 * Kind);
    14491443    if Growth > 0 then
    14501444    begin
    14511445      for i := 0 to Growth div 8 - 1 do
    14521446        BitBltCanvas(ca, x + pos + i * 8, y, 8, 7,
    1453           GrExt[HGrSystem].Data.Canvas, 112, 9 + 8 * Kind);
     1447          HGrSystem.Data.Canvas, 112, 9 + 8 * Kind);
    14541448      BitBltCanvas(ca, x + pos + 8 * (Growth div 8), y,
    1455         Growth - 8 * (Growth div 8), 7, GrExt[HGrSystem].Data.Canvas,
     1449        Growth - 8 * (Growth div 8), 7, HGrSystem.Data.Canvas,
    14561450        112, 9 + 8 * Kind);
    14571451    end
     
    14601454      for i := 0 to -Growth div 8 - 1 do
    14611455        BitBltCanvas(ca, x + pos + i * 8, y, 8, 7,
    1462           GrExt[HGrSystem].Data.Canvas, 104, 1);
     1456          HGrSystem.Data.Canvas, 104, 1);
    14631457      BitBltCanvas(ca, x + pos + 8 * (-Growth div 8), y, -Growth -
    14641458        8 * (-Growth div 8), 7,
    1465         GrExt[HGrSystem].Data.Canvas, 104, 1);
     1459        HGrSystem.Data.Canvas, 104, 1);
    14661460    end;
    14671461    Brush.Color := $000000;
     
    17121706  MainTexture.Image := TBitmap.Create;
    17131707  MainTextureAge := -2;
    1714   ClickFrameColor := GrExt[HGrSystem].Data.Canvas.Pixels[187, 175];
     1708  ClickFrameColor := HGrSystem.Data.Canvas.Pixels[187, 175];
    17151709  InitOrnamentDone := False;
    17161710  GenerateNames := True;
  • trunk/Start.pas

    r304 r313  
    236236  for X := 0 to 11 do
    237237    for Y := 0 to 1 do
    238       Colors[x, y] := GrExt[HGrSystem].Data.Canvas.Pixels[66 + x, 67 + y];
     238      Colors[x, y] := HGrSystem.Data.Canvas.Pixels[66 + x, 67 + y];
    239239end;
    240240
     
    381381  PrevMiniPixel: TPixelPointer;
    382382begin
    383   OwnColor := GrExt[HGrSystem].Data.Canvas.Pixels[95, 67];
    384   EnemyColor := GrExt[HGrSystem].Data.Canvas.Pixels[96, 67];
     383  OwnColor := HGrSystem.Data.Canvas.Pixels[95, 67];
     384  EnemyColor := HGrSystem.Data.Canvas.Pixels[96, 67];
    385385  Bitmap.PixelFormat := pf24bit;
    386386  Bitmap.SetSize(Size.X * 2, Size.Y);
     
    479479  with PlayerSlots[i] do begin
    480480    DiffUpBtn := TButtonC.Create(self);
    481     DiffUpBtn.Graphic := GrExt[HGrSystem].Data;
     481    DiffUpBtn.Graphic := HGrSystem.Data;
    482482    DiffUpBtn.left := xBrain[i] - 18;
    483483    DiffUpBtn.top := yBrain[i] + 39;
     
    486486    DiffUpBtn.OnClick := DiffBtnClick;
    487487    DiffDownBtn := TButtonC.Create(self);
    488     DiffDownBtn.Graphic := GrExt[HGrSystem].Data;
     488    DiffDownBtn.Graphic := HGrSystem.Data;
    489489    DiffDownBtn.left := xBrain[i] - 18;
    490490    DiffDownBtn.top := yBrain[i] + 51;
     
    496496  with PlayerSlots[i] do begin
    497497    MultiBtn := TButtonC.Create(self);
    498     MultiBtn.Graphic := GrExt[HGrSystem].Data;
     498    MultiBtn.Graphic := HGrSystem.Data;
    499499    MultiBtn.left := xBrain[i] - 18;
    500500    MultiBtn.top := yBrain[i];
     
    511511    CustomizeBtn.ButtonIndex := 2;
    512512
    513   BitBltBitmap(BrainNoTerm.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 1, 111);
    514   BitBltBitmap(BrainSuperVirtual.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 66, 111);
    515   BitBltBitmap(BrainTerm.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 131, 111);
    516   BitBltBitmap(BrainRandom.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 131, 46);
     513  BitBltBitmap(BrainNoTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, 1, 111);
     514  BitBltBitmap(BrainSuperVirtual.Picture, 0, 0, 64, 64, HGrSystem2.Data, 66, 111);
     515  BitBltBitmap(BrainTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, 131, 111);
     516  BitBltBitmap(BrainRandom.Picture, 0, 0, 64, 64, HGrSystem2.Data, 131, 46);
    517517  LoadAiBrainsPictures;
    518518
     
    907907        begin
    908908          BitBltCanvas(Canvas, 9 + i * 27, yLogo - 2, wOrna, hOrna,
    909             GrExt[HGrSystem2].Mask.Canvas, xOrna, yOrna, SRCAND);
     909            HGrSystem2.Mask.Canvas, xOrna, yOrna, SRCAND);
    910910          BitBltCanvas(Canvas, 9 + i * 27, yLogo - 2, wOrna, hOrna,
    911             GrExt[HGrSystem2].Data.Canvas, xOrna, yOrna, SRCPAINT);
     911            HGrSystem2.Data.Canvas, xOrna, yOrna, SRCPAINT);
    912912        end;
    913913      PaintLogo(Canvas, 69 + 11 * 27, yLogo, MainTexture.clBevelLight,
     
    926926          begin
    927927            BitBltCanvas(Canvas, xBrain[i] - 18, yBrain[i] + 19, 12, 14,
    928               GrExt[HGrSystem].Data.Canvas, 134 + (Difficulty[i] - 1) *
     928              HGrSystem.Data.Canvas, 134 + (Difficulty[i] - 1) *
    929929              13, 28);
    930930            Frame(Canvas, xBrain[i] - 19, yBrain[i] + 18, xBrain[i] - 18 + 12,
     
    946946                MainTexture.clBevelShade, MainTexture.clBevelLight);
    947947              BitBltCanvas(Canvas, xBrain[i] - 31, yBrain[i], 13, 12,
    948                 GrExt[HGrSystem].Data.Canvas, 88, 47);
     948                HGrSystem.Data.Canvas, 88, 47);
    949949            end;
    950950          end;
     
    991991        begin
    992992          BitBltCanvas(Canvas, 9 + i * 27, yLogo - 2, wOrna, hOrna,
    993             GrExt[HGrSystem2].Mask.Canvas, xOrna, yOrna, SRCAND);
     993            HGrSystem2.Mask.Canvas, xOrna, yOrna, SRCAND);
    994994          BitBltCanvas(Canvas, 9 + i * 27, yLogo - 2, wOrna, hOrna,
    995             GrExt[HGrSystem2].Data.Canvas, xOrna, yOrna, SRCPAINT);
     995            HGrSystem2.Data.Canvas, xOrna, yOrna, SRCPAINT);
    996996        end;
    997997      PaintLogo(Canvas, 69, yLogo, MainTexture.clBevelLight,
Note: See TracChangeset for help on using the changeset viewer.