Ignore:
Timestamp:
Apr 9, 2021, 5:56:50 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Merged changes from trunk r360 into highdpi branch.
File:
1 edited

Legend:

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

    r349 r361  
    7777  AgePrepared := -2;
    7878  TitleHeight := DpiScreen.Height;
    79   InitButtons();
     79  InitButtons;
    8080
    8181  Back := TDpiBitmap.Create;
     
    9898procedure TUnitStatDlg.CheckAge;
    9999begin
    100   if MainTextureAge <> AgePrepared then
    101   begin
    102     AgePrepared := MainTextureAge;
     100  if MainTexture.Age <> AgePrepared then begin
     101    AgePrepared := MainTexture.Age;
    103102    DpiBitCanvas(Back.Canvas, 0, 0, wCommon, hOwnModel,
    104       MainTexture.Image.Canvas, (wMainTexture - wCommon) div 2,
    105       (hMainTexture - hOwnModel) div 2);
     103      MainTexture.Image.Canvas, (MainTexture.Width - wCommon) div 2,
     104      (MainTexture.Height - hOwnModel) div 2);
    106105    DpiBitCanvas(Back.Canvas, wCommon, 0, wCommon, hEnemyModel,
    107       MainTexture.Image.Canvas, (wMainTexture - wCommon) div 2,
    108       (hMainTexture - hEnemyModel) div 2);
     106      MainTexture.Image.Canvas, (MainTexture.Width - wCommon) div 2,
     107      (MainTexture.Height - hEnemyModel) div 2);
    109108    DpiBitCanvas(Back.Canvas, 2 * wCommon, 0, wCommon, hEnemyUnit,
    110       MainTexture.Image.Canvas, (wMainTexture - wCommon) div 2,
    111       (hMainTexture - hEnemyUnit) div 2);
     109      MainTexture.Image.Canvas, (MainTexture.Width - wCommon) div 2,
     110      (MainTexture.Height - hEnemyUnit) div 2);
    112111    DpiBitCanvas(Back.Canvas, 3 * wCommon, 0, wCommon, hEnemyCityDefense,
    113       MainTexture.Image.Canvas, (wMainTexture - wCommon) div 2,
    114       (hMainTexture - hEnemyCityDefense) div 2);
     112      MainTexture.Image.Canvas, (MainTexture.Width - wCommon) div 2,
     113      (MainTexture.Height - hEnemyCityDefense) div 2);
    115114    DpiBitCanvas(Back.Canvas, 4 * wCommon, 0, wCommon, hEnemyCity,
    116       MainTexture.Image.Canvas, (wMainTexture - wCommon) div 2,
    117       (hMainTexture - hEnemyCity) div 2);
     115      MainTexture.Image.Canvas, (MainTexture.Width - wCommon) div 2,
     116      (MainTexture.Height - hEnemyCity) div 2);
    118117    ImageOp_B(Back, Template, 0, 0, 0, 0, 5 * wCommon, hMax);
    119   end
     118  end;
    120119end;
    121120
     
    151150        dec(ecixShow);
    152151      assert(ecixShow >= 0);
    153     end
     152    end;
    154153  end;
    155154  case Kind of
     
    297296      result := (PPicture.HGr = PTestPicture.HGr) and
    298297        (PPicture.pix = PTestPicture.pix) and
    299         (ModelHash(mox^) = ModelHash(MyRO.EnemyModel[emix]))
     298        (ModelHash(mox^) = ModelHash(MyRO.EnemyModel[emix]));
    300299    end
    301300    else
    302301      result := (MyRO.EnemyModel[emix].owner = mox.owner) and
    303         (MyRO.EnemyModel[emix].mix = mox.mix)
     302        (MyRO.EnemyModel[emix].mix = mox.mix);
    304303  end;
    305304
    306305  procedure FeatureBar(dst: TDpiBitmap; x, y: integer; const mi: TModelInfo;
    307     const T: TTexture);
     306    T: TTexture);
    308307  var
    309308    i, w, dx, num: integer;
     
    371370  end; { featurebar }
    372371
    373   procedure NumberBarS(dst: TDpiBitmap; x, y: integer; Cap, s: string;
    374     const T: TTexture);
    375   begin
    376     DLine(dst.Canvas, x - 2, x + 170, y + 16, T.clBevelShade, T.clBevelLight);
     372  procedure NumberBarS(dst: TDpiBitmap; x, y: integer; Cap, s: string; T: TTexture);
     373  begin
     374    DLine(dst.Canvas, x - 2, x + 170, y + 16, T.ColorBevelShade, T.ColorBevelLight);
    377375    LoweredTextOut(dst.Canvas, -1, T, x - 2, y, Cap);
    378376    RisedTextout(dst.Canvas, x + 170 - BiColorTextWidth(dst.Canvas, s), y, s);
     
    437435      begin
    438436        case i of
    439           0:
    440             j := imWalls;
    441           1:
    442             j := imCoastalFort;
    443           2:
    444             j := imMissileBat;
    445           3:
    446             j := imBunker
     437          0: j := imWalls;
     438          1: j := imCoastalFort;
     439          2: j := imMissileBat;
     440          3: j := imBunker
    447441        end;
    448442        Frame(offscreen.Canvas, x - 1, yImp - 1, x + xSizeSmall,
    449           yImp + ySizeSmall, MainTexture.clBevelLight,
    450           MainTexture.clBevelShade);
     443          yImp + ySizeSmall, MainTexture.ColorBevelLight,
     444          MainTexture.ColorBevelShade);
    451445        DpiBitCanvas(offscreen.Canvas, x, yImp, xSizeSmall, ySizeSmall,
    452446          SmallImp.Canvas, j mod 7 * xSizeSmall,
    453447          (j + SystemIconLines * 7) div 7 * ySizeSmall);
    454         inc(x, xSizeSmall + 4)
     448        inc(x, xSizeSmall + 4);
    455449      end;
    456450  end;
     
    469463            if IsToCount(MyRO.EnemyUn[MyRO.nEnemyUn + uix].emix) then
    470464              inc(Available);
    471         end
     465        end;
    472466      end
    473467    else // no supervisor -- can only count stack top units
     
    512506    begin
    513507      MakeUnitInfo(me, MyUn[uixShow], ui);
    514       MakeModelInfo(me, MyUn[uixShow].mix, MyModel[MyUn[uixShow].mix], mi)
     508      MakeModelInfo(me, MyUn[uixShow].mix, MyModel[MyUn[uixShow].mix], mi);
    515509    end
    516510    else
     
    518512      mi := mox^;
    519513      if Kind in [dkEnemyUnit, dkEnemyCityDefense] then
    520         ui := MyRO.EnemyUn[euixShow]
     514        ui := MyRO.EnemyUn[euixShow];
    521515    end;
    522516
     
    527521        begin
    528522          { Frame(offscreen.canvas,xView-1,yView-1,xView+64,yView+48,
    529             MainTexture.clBevelShade,MainTexture.clBevelLight);
     523            MainTexture.ColorBevelShade,MainTexture.ColorBevelLight);
    530524            RFrame(offscreen.canvas,xView-2,yView-2,xView+65,yView+49,
    531             MainTexture.clBevelShade,MainTexture.clBevelLight); }
     525            MainTexture.ColorBevelShade,MainTexture.ColorBevelLight); }
    532526          with offscreen.Canvas do
    533527          begin
     
    541535          begin
    542536            x := 1 + 2 * (xxt * 2 + 1);
    543             y := 1 + yyt + 2 * (yyt * 3 + 1)
     537            y := 1 + yyt + 2 * (yyt * 3 + 1);
    544538          end
    545539          else
    546540          begin
    547541            x := integer(MyMap[Loc] and fTerrain) * (xxt * 2 + 1) + 1;
    548             y := 1 + yyt
     542            y := 1 + yyt;
    549543          end;
    550544          for j := -1 to 1 do
     
    594588              (ClientWidth - BiColorTextWidth(offscreen.Canvas, s)) div 2,
    595589              yView + 80, s);
    596           end
     590          end;
    597591        end
    598592      else
     
    615609        Phrases.Lookup('UNITCOST'));
    616610      DLine(offscreen.Canvas, xTotal - 2, xTotal + 170, yTotal + 57 + 16,
    617         MainTexture.clBevelShade, MainTexture.clBevelLight);
     611        MainTexture.ColorBevelShade, MainTexture.ColorBevelLight);
    618612      if G.Difficulty[me] = 0 then
    619613        s := IntToStr(mi.cost)
     
    636630              (yTotal + StatDown - 19), Phrases.Lookup('UNITINTRO'));
    637631          DLine(offscreen.Canvas, xTotal - 2, xTotal + 170,
    638             (yTotal + StatDown - 19) + 16, MainTexture.clTextShade,
    639             MainTexture.clTextLight);
     632            (yTotal + StatDown - 19) + 16, MainTexture.ColorTextShade,
     633            MainTexture.ColorTextLight);
    640634          s := TurnToString(MyModel[mixShow].IntroTurn);
    641635          RisedTextout(offscreen.Canvas,
     
    675669          ConscriptsBtn.ButtonIndex := 29;
    676670          ConscriptsBtn.Hint := Phrases.Lookup('BTN_ALLOWCONSCRIPTS');
    677         end
     671        end;
    678672      end
    679673      else if Kind = dkEnemyModel then
     
    685679          NumberBar(offscreen, xTotal, yTotal + StatDown,
    686680            Phrases.Lookup('UNITKNOWN'), Available, MainTexture);
    687       end
     681      end;
    688682    end;
    689683  end;
     
    705699procedure TUnitStatDlg.ModelBoxChange(Sender: TObject);
    706700begin
    707   SmartUpdateContent
     701  SmartUpdateContent;
    708702end;
    709703
     
    720714    SwitchBtn.ButtonIndex := 11;
    721715    SwitchBtn.Hint := Phrases.Lookup('BTN_NONOBSOLETE');
    722   end
     716  end;
    723717end;
    724718
     
    735729    ConscriptsBtn.ButtonIndex := 29;
    736730    ConscriptsBtn.Hint := Phrases.Lookup('BTN_ALLOWCONSCRIPTS');
    737   end
     731  end;
    738732end;
    739733
    740734procedure TUnitStatDlg.HelpBtnClick(Sender: TObject);
    741735begin
    742   HelpDlg.ShowNewContent(wmPersistent, hkModel, 0)
     736  HelpDlg.ShowNewContent(wmPersistent, hkModel, 0);
    743737end;
    744738
Note: See TracChangeset for help on using the changeset viewer.