hedgewars/uGearsHedgehog.pas
changeset 7406 1fe2c821f9bf
parent 7391 588eabb4b384
child 7409 fd91aa100ce0
equal deleted inserted replaced
7405:63f56edae4c6 7406:1fe2c821f9bf
   594 
   594 
   595 ////////////////////////////////////////////////////////////////////////////////
   595 ////////////////////////////////////////////////////////////////////////////////
   596 procedure PickUp(HH, Gear: PGear);
   596 procedure PickUp(HH, Gear: PGear);
   597 var s: shortstring;
   597 var s: shortstring;
   598     a: TAmmoType;
   598     a: TAmmoType;
   599     i, rx, ry: LongInt;
   599     i: LongInt;
   600     rdx, rdy: hwFloat;
       
   601     vga: PVisualGear;
   600     vga: PVisualGear;
   602     ag: PGear;
   601     ag, gi: PGear;
   603 begin
   602 begin
   604 Gear^.Message:= gmDestroy;
   603 Gear^.Message:= gmDestroy;
   605 if (Gear^.Pos and posCaseExplode) <> 0 then
   604 if (Gear^.Pos and posCaseExplode) <> 0 then
   606     if (Gear^.Pos and posCasePoison) <> 0 then
   605     if (Gear^.Pos and posCasePoison) <> 0 then
   607         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned)
   606         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned)
   619                         end
   618                         end
   620                     else
   619                     else
   621                         begin
   620                         begin
   622 // Add spawning here...
   621 // Add spawning here...
   623                         AddRandomness(CheckSum xor GameTicks);
   622                         AddRandomness(CheckSum xor GameTicks);
   624 
   623                         
   625                         for i:= 0 to GetRandom(50)+50 do
   624                         gi := GearsList;
       
   625                         while gi <> nil do
   626                             begin
   626                             begin
   627                             rx:= GetRandom(rightX-leftX)+leftX;
   627                             if gi^.Kind = gtGenericFaller then
   628                             ry:= GetRandom(LAND_HEIGHT-topY)+topY;
   628                                 begin
   629                             rdx:= _90-(GetRandomf*_360);
   629                                 gi^.Active:= true;
   630                             rdy:= _90-(GetRandomf*_360);
   630                                 gi^.X:= int2hwFloat(GetRandom(rightX-leftX)+leftX);
   631                             AddGear(rx, ry, gtGenericFaller, gstInvisible, rdx, rdy, GetRandom(500));
   631                                 gi^.Y:= int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
       
   632                                 gi^.dX:= _90-(GetRandomf*_360);
       
   633                                 gi^.dY:= _90-(GetRandomf*_360)
       
   634                                 end;
       
   635                             gi := gi^.NextGear
   632                             end;
   636                             end;
   633                         ag:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAddAmmo, gstInvisible, _0, _0, GetRandom(200)+100);
   637                         ag:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAddAmmo, gstInvisible, _0, _0, GetRandom(200)+100);
   634                         ag^.Pos:= Gear^.Pos;
   638                         ag^.Pos:= Gear^.Pos;
   635                         ag^.Power:= Gear^.Power
   639                         ag^.Power:= Gear^.Power
   636                         end;
   640                         end;