Changeset 313 for trunk/LocalPlayer


Ignore:
Timestamp:
Mar 17, 2021, 11:11:55 AM (4 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/LocalPlayer
Files:
14 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
Note: See TracChangeset for help on using the changeset viewer.