Changeset 329 for trunk


Ignore:
Timestamp:
Mar 25, 2021, 3:30:05 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Use enumeration type for sound blocks for preload.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r328 r329  
    2222  TPaintLocTempStyle = (pltsNormal, pltsBlink);
    2323  TTileSize = (tsSmall, tsMedium, tsBig);
     24
     25  TSoundBlock = (sbStart, sbWonder, sbScience, sbContact, sbTurn);
     26  TSoundBlocks = set of TSoundBlock;
    2427
    2528  { TMainScreen }
     
    315318    procedure OnScroll(var m: TMessage); message WM_VSCROLL;
    316319    procedure OnEOT(var Msg: TMessage); message WM_EOT;
    317     procedure SoundPreload(Check: integer);
     320    procedure SoundPreload(Check: TSoundBlocks);
    318321    procedure UpdateKeyShortcuts;
    319322    procedure SetFullScreen(Active: Boolean);
     
    435438    'CITY_INVALIDTYPE');
    436439
    437   // sound blocks for preload
    438   sbStart = $01;
    439   sbWonder = $02;
    440   sbScience = $04;
    441   sbContact = $08;
    442   sbTurn = $10;
    443   sbAll = $FF;
    444 
    445440  TileSizes: array [TTileSize] of TPoint = ((X: 33; Y: 16), (X: 48; Y: 24),
    446441    (X: 72; Y: 36));
     
    494489  ScienceSum: Integer;
    495490  TaxSum: Integer;
    496   SoundPreloadDone: Integer;
     491  SoundPreloadDone: TSoundBlocks;
    497492  MarkCityLoc: Integer;
    498493  HGrTerrain: TGraphicSet;
     
    13621357end;
    13631358
    1364 procedure TMainScreen.SoundPreload(Check: integer);
     1359procedure TMainScreen.SoundPreload(Check: TSoundBlocks);
    13651360const
    13661361  nStartBlock = 27;
     
    13981393  mi: TModelInfo;
    13991394begin
    1400   if Check and sbStart and not SoundPreloadDone <> 0 then
    1401   begin
     1395  if (sbStart in Check) and not (sbStart in SoundPreloadDone) then begin
    14021396    for i := 0 to nStartBlock - 1 do
    14031397      PreparePlay(StartBlock[i]);
    1404     SoundPreloadDone := SoundPreloadDone or sbStart;
    1405   end;
    1406   if Check and sbWonder and not SoundPreloadDone <> 0 then
    1407   begin
     1398    SoundPreloadDone := SoundPreloadDone + [sbStart];
     1399  end;
     1400  if (sbWonder in Check) and not (sbWonder in SoundPreloadDone) then begin
    14081401    need := false;
    14091402    for i := 0 to nWonder - 1 do
    14101403      if MyRO.Wonder[i].CityID <> WonderNotBuiltYet then
    14111404        need := true;
    1412     if need then
    1413     begin
     1405    if need then begin
    14141406      for i := 0 to nWonderBlock - 1 do
    14151407        PreparePlay(WonderBlock[i]);
    1416       SoundPreloadDone := SoundPreloadDone or sbWonder;
     1408      SoundPreloadDone := SoundPreloadDone + [sbWonder];
    14171409    end;
    14181410  end;
    1419   if (Check and sbScience and not SoundPreloadDone <> 0) and
    1420     (MyRO.Tech[adScience] >= tsApplicable) then
    1421   begin
     1411  if ((sbScience in Check) and not (sbScience in SoundPreloadDone)) and
     1412    (MyRO.Tech[adScience] >= tsApplicable) then begin
    14221413    for i := 0 to nScienceBlock - 1 do
    14231414      PreparePlay(ScienceBlock[i]);
    1424     SoundPreloadDone := SoundPreloadDone or sbScience;
    1425   end;
    1426   if (Check and sbContact and not SoundPreloadDone <> 0) and
    1427     (MyRO.nEnemyModel + MyRO.nEnemyCity > 0) then
    1428   begin
     1415    SoundPreloadDone := SoundPreloadDone + [sbScience];
     1416  end;
     1417  if ((sbContact in Check) and not (sbContact in SoundPreloadDone)) and
     1418    (MyRO.nEnemyModel + MyRO.nEnemyCity > 0) then begin
    14291419    for i := 0 to nContactBlock - 1 do
    14301420      PreparePlay(ContactBlock[i]);
    1431     SoundPreloadDone := SoundPreloadDone or sbContact;
    1432   end;
    1433   if Check and sbTurn <> 0 then
    1434   begin
     1421    SoundPreloadDone := SoundPreloadDone + [sbContact];
     1422  end;
     1423  if sbTurn in Check then begin
    14351424    if MyRO.Happened and phShipComplete <> 0 then
    14361425      PreparePlay('MSG_YOUWIN');
     
    16591648  SmallImp.PixelFormat := pf24bit;
    16601649  InitSmallImp;
    1661   SoundPreloadDone := 0;
     1650  SoundPreloadDone := [];
    16621651  StartRunning := false;
    16631652  StayOnTop_Ensured := false;
     
    16811670    Icon: imRecycling), (Adv: adComputers; Icon: imResLab),
    16821671    (Adv: adSpaceFlight; Icon: woMIR));
     1672  sbAll = [sbStart, sbWonder, sbScience, sbContact, sbTurn];
    16831673var
    16841674  p1, i, ad, uix, cix, MoveOptions, MoveResult, Loc1,
     
    26182608              FillChar(ToldTech, SizeOf(ToldTech), Byte(tsNA));
    26192609              if G.Difficulty[p1] > 0 then
    2620                 SoundPreload(sbStart);
     2610                SoundPreload([sbStart]);
    26212611            end;
    26222612
Note: See TracChangeset for help on using the changeset viewer.