hedgewars/uAmmos.pas
changeset 3697 d5b30d6373fc
parent 3407 dcc129c4352e
child 3836 833c0f32e326
equal deleted inserted replaced
3695:c11abf387a7d 3697:d5b30d6373fc
    69        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
    69        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
    70 
    70 
    71        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= cnts[a];
    71        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= cnts[a];
    72        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= cnts[a];
    72        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= cnts[a];
    73 
    73 
    74        if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
    74        if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then
    75            Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
    75            Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
    76        inc(mi[Ammoz[a].Slot])
    76        inc(mi[Ammoz[a].Slot])
    77        end
    77        end
    78     else if (TotalRounds < 0) and ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then 
    78     else if (TotalRounds < 0) and ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then
    79        begin
    79        begin
    80        TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
    80        TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
    81        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
    81        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
    82 
    82 
    83        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
    83        Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
    97 begin
    97 begin
    98 TryDo((byte(ammoLoadout[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoProbability[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoDelay[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoReinforcement[0]) = byte(ord(High(TAmmoType)))), 'Incomplete or missing ammo scheme set (incompatible frontend or demo/save?)', true);
    98 TryDo((byte(ammoLoadout[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoProbability[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoDelay[0]) = byte(ord(High(TAmmoType)))) and (byte(ammoReinforcement[0]) = byte(ord(High(TAmmoType)))), 'Incomplete or missing ammo scheme set (incompatible frontend or demo/save?)', true);
    99 
    99 
   100 // FIXME - TEMPORARY hardcoded check on shoppa pending creation of crate *type* probability editor
   100 // FIXME - TEMPORARY hardcoded check on shoppa pending creation of crate *type* probability editor
   101 substr:= Copy(ammoLoadout,1,15);
   101 substr:= Copy(ammoLoadout,1,15);
   102 if (substr = '000000990000009') or 
   102 if (substr = '000000990000009') or
   103    (substr = '000000990000000') then
   103    (substr = '000000990000000') then
   104     shoppa:= true;
   104     shoppa:= true;
   105 
   105 
   106 inc(StoreCnt);
   106 inc(StoreCnt);
   107 TryDo(StoreCnt <= cMaxHHs, 'Ammo stores overflow', true);
   107 TryDo(StoreCnt <= cMaxHHs, 'Ammo stores overflow', true);
   135             cnt:= 0;
   135             cnt:= 0;
   136             Ammoz[a].Probability:= 0
   136             Ammoz[a].Probability:= 0
   137             end;
   137             end;
   138         ammos[a]:= cnt;
   138         ammos[a]:= cnt;
   139 
   139 
   140         if ((GameFlags and gfKing) <> 0) and ((GameFlags and gfPlaceHog) = 0) and (Ammoz[a].SkipTurns = 0) and (a <> amTeleport) and (a <> amSkip) then 
   140         if ((GameFlags and gfKing) <> 0) and ((GameFlags and gfPlaceHog) = 0) and (Ammoz[a].SkipTurns = 0) and (a <> amTeleport) and (a <> amSkip) then
   141             Ammoz[a].SkipTurns:= 1;
   141             Ammoz[a].SkipTurns:= 1;
   142 
   142 
   143         if ((GameFlags and gfPlaceHog) <> 0) and
   143         if ((GameFlags and gfPlaceHog) <> 0) and
   144             (a <> amTeleport) and (a <> amSkip) and 
   144             (a <> amTeleport) and (a <> amSkip) and
   145             (Ammoz[a].SkipTurns < 10000) then inc(Ammoz[a].SkipTurns,10000)
   145             (Ammoz[a].SkipTurns < 10000) then inc(Ammoz[a].SkipTurns,10000)
   146         end else
   146         end else
   147         ammos[a]:= AMMO_INFINITE
   147         ammos[a]:= AMMO_INFINITE
   148     end;
   148     end;
   149 
   149 
   351 for i:= 0 to Pred(StoreCnt) do
   351 for i:= 0 to Pred(StoreCnt) do
   352     for slot:= 0 to cMaxSlotIndex do
   352     for slot:= 0 to cMaxSlotIndex do
   353         begin
   353         begin
   354         for a:= 0 to cMaxSlotAmmoIndex do
   354         for a:= 0 to cMaxSlotAmmoIndex do
   355             with StoresList[i]^[slot, a] do
   355             with StoresList[i]^[slot, a] do
   356                 if (Propz and ammoprop_NotBorder) <> 0 then 
   356                 if (Propz and ammoprop_NotBorder) <> 0 then
   357                     begin
   357                     begin
   358                     Count:= 0;
   358                     Count:= 0;
   359                     InitialCount:= 0
   359                     InitialCount:= 0
   360                     end;
   360                     end;
   361 
   361