hedgewars/uGears.pas
branchhedgeroid
changeset 6224 42b256eca362
parent 6192 7c34bf4fbb54
child 6252 8d598aa498b0
equal deleted inserted replaced
6055:88cfcd9161d3 6224:42b256eca362
   293                 with Gear^ do
   293                 with Gear^ do
   294                     begin
   294                     begin
   295                     Pos:= 0;
   295                     Pos:= 0;
   296                     Radius:= 1;
   296                     Radius:= 1;
   297                     DirAngle:= random * 360;
   297                     DirAngle:= random * 360;
   298                     dx.isNegative:= GetRandom(2) = 0;
   298                     if State and gstTmpFlag = 0 then
   299                     dx.QWordValue:= GetRandom(100000000);
   299                         begin
   300                     dy.isNegative:= false;
   300                         dx.isNegative:= GetRandom(2) = 0;
   301                     dy.QWordValue:= GetRandom(70000000);
   301                         dx.QWordValue:= GetRandom(100000000);
       
   302                         dy.isNegative:= false;
       
   303                         dy.QWordValue:= GetRandom(70000000);
       
   304                         if GetRandom(2) = 0 then dx := -dx
       
   305                         end;
   302                     State:= State or gstInvisible;
   306                     State:= State or gstInvisible;
   303                     if GetRandom(2) = 0 then dx := -dx;
       
   304                     Health:= random(vobFrameTicks);
   307                     Health:= random(vobFrameTicks);
   305                     Timer:= random(vobFramesCount);
   308                     Timer:= random(vobFramesCount);
   306                     Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity
   309                     Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity
   307                     end
   310                     end
   308                 end;
   311                 end;
  1239 
  1242 
  1240 if (GameFlags and gfArtillery) <> 0 then
  1243 if (GameFlags and gfArtillery) <> 0 then
  1241     cArtillery:= true;
  1244     cArtillery:= true;
  1242 
  1245 
  1243 if not hasBorder and ((Theme = 'Snow') or (Theme = 'Christmas')) then
  1246 if not hasBorder and ((Theme = 'Snow') or (Theme = 'Christmas')) then
  1244     begin
       
  1245     for i:= 0 to Pred(vobCount*2) do
  1247     for i:= 0 to Pred(vobCount*2) do
  1246         AddGear(GetRandom(LAND_WIDTH+1024)-512, LAND_HEIGHT - GetRandom(LAND_HEIGHT div 2), gtFlake, 0, _0, _0, 0);
  1248         AddGear(GetRandom(LAND_WIDTH+1024)-512, LAND_HEIGHT - GetRandom(LAND_HEIGHT div 2), gtFlake, 0, _0, _0, 0);
  1247     //disableLandBack:= true
       
  1248     end
       
  1249 end;
  1249 end;
  1250 
  1250 
  1251 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord);
  1251 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord);
  1252 var Gear: PGear;
  1252 var Gear: PGear;
  1253     dmg, dmgRadius, dmgBase: LongInt;
  1253     dmg, dmgRadius, dmgBase: LongInt;
  1284     if (Gear^.State and gstNoDamage) = 0 then
  1284     if (Gear^.State and gstNoDamage) = 0 then
  1285         begin
  1285         begin
  1286         case Gear^.Kind of
  1286         case Gear^.Kind of
  1287             gtHedgehog,
  1287             gtHedgehog,
  1288                 gtMine,
  1288                 gtMine,
       
  1289                 gtBall,
       
  1290                 gtMelonPiece,
       
  1291                 gtGrenade,
       
  1292                 gtClusterBomb,
       
  1293                 gtCluster,
  1289                 gtSMine,
  1294                 gtSMine,
  1290                 gtCase,
  1295                 gtCase,
  1291                 gtTarget,
  1296                 gtTarget,
  1292                 gtFlame,
  1297                 gtFlame,
  1293                 gtExplosives,
  1298                 gtExplosives,
  1488                     Gear^.State:= Gear^.State or gstMoving;
  1493                     Gear^.State:= Gear^.State or gstMoving;
  1489 
  1494 
  1490                     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
  1495                     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
  1491                         begin
  1496                         begin
  1492                         if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX))
  1497                         if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX))
  1493                             or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
  1498                             or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
  1494                         if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX))
  1499                         if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX))
  1495                             or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
  1500                             or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
  1496                         if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX))
  1501                         if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX))
  1497                             or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
  1502                             or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
  1498                         end;
  1503                         end;
  1499 
  1504 
  1500                     if (Ammo^.Kind <> gtFlame) or ((Ammo^.State and gsttmpFlag) = 0) then FollowGear:= Gear
  1505                     if (Ammo^.Kind <> gtFlame) or ((Ammo^.State and gsttmpFlag) = 0) then FollowGear:= Gear
  1501                     end;
  1506                     end;
  1502         end
  1507         end