Changeset 295


Ignore:
Timestamp:
Mar 8, 2021, 4:24:21 PM (3 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/CityScreen.pas

    r284 r295  
    216216  Template := TBitmap.Create;
    217217  Template.PixelFormat := pf24bit;
    218   LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'City.png', gfNoGamma);
     218  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'City.png',
     219    [gfNoGamma]);
    219220  CityMapTemplate := TBitmap.Create;
    220221  CityMapTemplate.PixelFormat := pf24bit;
    221   LoadGraphicFile(CityMapTemplate, GetGraphicsDir + DirectorySeparator + 'BigCityMap.png', gfNoGamma);
     222  LoadGraphicFile(CityMapTemplate, GetGraphicsDir + DirectorySeparator + 'BigCityMap.png',
     223    [gfNoGamma]);
    222224  SmallCityMapTemplate := TBitmap.Create;
    223225  SmallCityMapTemplate.PixelFormat := pf24bit;
    224226  LoadGraphicFile(SmallCityMapTemplate, GetGraphicsDir + DirectorySeparator + 'SmallCityMap.png',
    225     gfNoGamma);
     227    [gfNoGamma]);
    226228  SmallCityMap := TBitmap.Create;
    227229  SmallCityMap.PixelFormat := pf24bit;
  • trunk/LocalPlayer/Draft.pas

    r209 r295  
    9292  Template := TBitmap.Create;
    9393  Template.PixelFormat := pf24bit;
    94   LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'MiliRes.png', gfNoGamma);
     94  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'MiliRes.png',
     95    [gfNoGamma]);
    9596end;
    9697
  • trunk/LocalPlayer/NatStat.pas

    r290 r295  
    9393  Template := TBitmap.Create;
    9494  Template.PixelFormat := pf24bit;
    95   LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Nation.png', gfNoGamma);
     95  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Nation.png',
     96    [gfNoGamma]);
    9697end;
    9798
  • trunk/LocalPlayer/TechTree.pas

    r288 r295  
    137137    Image := TBitmap.Create;
    138138    Image.PixelFormat := pf24bit;
    139     LoadGraphicFile(Image, HomeDir + 'Help' + DirectorySeparator + 'AdvTree.png', gfNoGamma);
     139    LoadGraphicFile(Image, HomeDir + 'Help' + DirectorySeparator + 'AdvTree.png',
     140      [gfNoGamma]);
    140141
    141142    with Image.Canvas do begin
  • trunk/LocalPlayer/Term.pas

    r294 r295  
    11231123      if UnitStatDlg.Visible then
    11241124        UnitStatDlg.Close;
    1125     end
    1126   end
     1125    end;
     1126  end;
    11271127end;
    11281128
     
    11511151      if UnitStatDlg.Visible then
    11521152        UnitStatDlg.Close;
    1153     end
    1154   end
     1153    end;
     1154  end;
    11551155end;
    11561156
     
    11751175        UnFocus := -1;
    11761176        PaintLoc(Loc0);
    1177       end
     1177      end;
    11781178    end;
    11791179    UnFocus := uix;
     
    12201220    MovieSpeed3Btn.Visible := false;
    12211221    MovieSpeed4Btn.Visible := false;
    1222   end
     1222  end;
    12231223end;
    12241224
     
    12491249    begin
    12501250      FreeAndNil(AILogo[p]);
    1251     end
     1251    end;
    12521252  end
    12531253  else
     
    12551255    if AILogo[p] = nil then
    12561256      AILogo[p] := TBitmap.Create;
    1257     if not LoadGraphicFile(AILogo[p], HomeDir + Name + '.png', gfNoError) then
     1257    if not LoadGraphicFile(AILogo[p], HomeDir + Name + '.png', [gfNoError]) then
    12581258    begin
    12591259      FreeAndNil(AILogo[p]);
    1260     end
    1261   end
     1260    end;
     1261  end;
    12621262end;
    12631263
     
    12941294      MapValid := false;
    12951295      PaintAllMaps;
    1296     end
    1297   end
     1296    end;
     1297  end;
    12981298end;
    12991299
     
    14631463      if DelphiRandom(CountBest) = 0 then
    14641464        result := j
    1465     end
     1465    end;
    14661466  end;
    14671467end;
     
    15211521          IconKind := mikShip;
    15221522          IconIndex := Ship2Owner;
    1523         end
     1523        end;
    15241524    end;
    15251525
     
    15341534          MostCost := TestCost;
    15351535          IconIndex := imShipComp + i
    1536         end
     1536        end;
    15371537      end;
    15381538    end;
     
    16171617  sb := TPVScrollbar.Create(Self);
    16181618  sb.OnUpdate := ScrollBarUpdate;
    1619 end; { InitModule }
     1619end;
    16201620
    16211621procedure TMainScreen.InitTurn(NewPlayer: integer);
     
    22352235                    Flags and CityRepMask);
    22362236                  UpdatePanel := true;
    2237                 end
     2237                end;
    22382238              end
    22392239              else { if mRepList.Checked then }
     
    22412241                if Flags and CityRepMask <> 0 then
    22422242                  ShowCityList := true
    2243               end
    2244             end
     2243              end;
     2244            end;
    22452245          end; { city loop }
    22462246  end; // ClientMode=cTurn
     
    22612261          Play('REVOLUTION');
    22622262          Server(sRevolution, me, 0, nil^);
    2263         end
     2263        end;
    22642264      end;
    22652265  end; // ClientMode=cTurn
     
    23802380                else
    23812381                  Status := Status and not usWaiting;
    2382             end
     2382            end;
    23832383          end;
    23842384  end; // ClientMode=cTurn
     
    24782478              opAllModel:
    24792479                s := s + 'All models';
    2480             end
     2480            end;
    24812481          end;
    24822482          LogDlg.Add(NewPlayer, G.RO[0].Turn, pchar(s));
     
    24862486          s := s + '--- ACCEPTED! ---';
    24872487          LogDlg.Add(NewPlayer, G.RO[0].Turn, pchar(s));
    2488         end
     2488        end;
    24892489      end;
    24902490
     
    28422842          // this break will ensure speed of fast forward does not depend on cpu speed
    28432843          Application.ProcessMessages;
    2844         end
     2844        end;
    28452845      end;
    28462846
     
    29212921              DipCall(scReject);
    29222922              EndNego
    2923             end
    2924           end
     2923            end;
     2924          end;
    29252925        end;
    29262926      end;
     
    71707170            SetTroopLoc(Loc);
    71717171            PanelPaint
    7172           end
     7172          end;
    71737173        end
    71747174      else if Sender = mSelectTransport then
     
    71897189    begin
    71907190      HaveCities := true;
    7191       Break
     7191      Break;
    71927192    end;
    71937193  if Popup = GamePopup then
     
    72897289            m.Checked := true;
    72907290          mDebugMap.Add(m);
    7291         end
     7291        end;
    72927292    end;
    72937293    mSmallTiles.Checked := xxt = 33;
     
    74737473  begin
    74747474    SetTroopLoc(-1);
    7475     PanelPaint
     7475    PanelPaint;
    74767476  end
    74777477  else
     
    74927492      SetTroopLoc(-1);
    74937493      PanelPaint
    7494     end
    7495   end
     7494    end;
     7495  end;
    74967496end;
    74977497
     
    75417541        2 + G.ly);
    75427542      Update;
    7543     end
     7543    end;
    75447544  end
    75457545  else
     
    75577557    MiniPaint;
    75587558    PanelPaint;
    7559   end
     7559  end;
    75607560end;
    75617561
     
    76097609begin
    76107610  result := (y >= TopBarHeight + MapHeight) or (y >= ClientHeight - PanelHeight)
    7611     and ((x < xMidPanel) or (x >= xRightPanel))
     7611    and ((x < xMidPanel) or (x >= xRightPanel));
    76127612end;
    76137613
     
    76267626          GamePopup.Popup(Left + 4, Top + GetSystemMetrics(SM_CYCAPTION) + 4 +
    76277627            TopBarHeight - 1);
    7628       end
     7628      end;
    76297629    end
    76307630    else if IsPanelPixel(x, y) then
     
    77897789      CityRepMask := CityRepMask or (1 shl (Tag shr 8))
    77907790    else
    7791       CityRepMask := CityRepMask and not(1 shl (Tag shr 8))
    7792   end
     7791      CityRepMask := CityRepMask and not(1 shl (Tag shr 8));
     7792  end;
    77937793end;
    77947794
     
    78377837      else if Flag = tfAllTechs then
    78387838        TellNewModels
    7839     end
    7840   end
     7839    end;
     7840  end;
    78417841end;
    78427842
     
    79087908      GamePopup.Popup(Left + 4, Top + GetSystemMetrics(SM_CYCAPTION) + 4 +
    79097909        TopBarHeight - 1);
    7910     exit
    7911   end // windows menu button calls game menu
     7910    exit;
     7911  end; // windows menu button calls game menu
    79127912end;
    79137913
  • trunk/LocalPlayer/UnitStat.pas

    r290 r295  
    8383  Template := TBitmap.Create;
    8484  Template.PixelFormat := pf24bit;
    85   LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Unit.png', gfNoGamma);
     85  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Unit.png',
     86    [gfNoGamma]);
    8687end;
    8788
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r290 r295  
    1616    clPage, clCover: TColor;
    1717  end;
     18  TLoadGraphicFileOption = (gfNoError, gfNoGamma);
     19  TLoadGraphicFileOptions = set of TLoadGraphicFileOption;
     20
    1821
    1922{$IFDEF WINDOWS}
     
    2831procedure EditFrame(ca: TCanvas; p: TRect; const T: TTexture);
    2932function HexStringToColor(S: string): integer;
    30 function LoadGraphicFile(bmp: TBitmap; Path: string; Options: integer = 0): boolean;
     33function LoadGraphicFile(bmp: TBitmap; Path: string; Options: TLoadGraphicFileOptions = []): boolean;
    3134function LoadGraphicSet(const Name: string): integer;
    3235procedure Dump(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
     
    160163  cliWater = 4;
    161164
    162   // LoadGraphicFile options
    163   gfNoError = $01;
    164   gfNoGamma = $02;
    165 
    166165type
    167166  TGrExtDescr = record { don't use dynamic strings here! }
     
    417416end;
    418417
    419 function LoadGraphicFile(bmp: TBitmap; Path: string; Options: Integer): Boolean;
     418function LoadGraphicFile(bmp: TBitmap; Path: string; Options: TLoadGraphicFileOptions = []): Boolean;
    420419var
    421420  jtex: TJpegImage;
     
    434433    if Result then
    435434    begin
    436       if Options and gfNoGamma = 0 then
     435      if not (gfNoGamma in Options) then
    437436        bmp.PixelFormat := pf24bit;
    438437      Bmp.SetSize(jtex.Width, jtex.Height);
     
    452451    if Result then
    453452    begin
    454       if Options and gfNoGamma = 0 then
     453      if not (gfNoGamma in Options) then
    455454        bmp.PixelFormat := pf24bit;
    456455      bmp.SetSize(Png.Width, Png.Height);
     
    474473    end;
    475474    if Result then begin
    476       if Options and gfNoGamma = 0 then
     475      if not (gfNoGamma in Options) then
    477476        bmp.PixelFormat := pf24bit;
    478477    end;
     
    482481
    483482  if not Result then begin
    484     if Options and gfNoError = 0 then
     483    if not (gfNoError in Options) then
    485484      raise Exception.Create(Format(Phrases.Lookup('FILENOTFOUND'), [Path]));
    486485  end;
    487486
    488   if (Options and gfNoGamma = 0) and (Gamma <> 100) then
     487  if (not (gfNoGamma in Options)) and (Gamma <> 100) then
    489488    ApplyGammaToBitmap(Bmp);
    490489end;
     
    16751674  LoadFonts;
    16761675  LoadGraphicFile(Templates, GetGraphicsDir + DirectorySeparator +
    1677     'Templates.png', gfNoGamma);
     1676    'Templates.png', [gfNoGamma]);
    16781677  LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png');
    16791678  LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg');
  • trunk/Start.pas

    r292 r295  
    298298  ImageFileName := Copy(FileName, 1, Length(FileName) - Length(CevoMapExt)) + '.png';
    299299  Mode := mmPicture;
    300   if LoadGraphicFile(Bitmap, ImageFileName, gfNoError) then
     300  if LoadGraphicFile(Bitmap, ImageFileName, [gfNoError]) then
    301301  begin
    302302    if Bitmap.width div 2 > MaxWidthMapLogo then
     
    677677  with AIBrains[I] do begin
    678678    if not LoadGraphicFile(AIBrains[i].Picture, GetAiDir + DirectorySeparator +
    679       FileName + DirectorySeparator + FileName + '.png', gfNoError) then begin
     679      FileName + DirectorySeparator + FileName + '.png', [gfNoError]) then begin
    680680      with AIBrains[i].Picture.Canvas do begin
    681681        Brush.Color := $904830;
Note: See TracChangeset for help on using the changeset viewer.