hedgewars/uGears.pas
changeset 1433 4af291d5d79c
parent 1428 0855275d443f
child 1434 75fe933483c7
equal deleted inserted replaced
1432:ab212288d34d 1433:4af291d5d79c
    86                  end;
    86                  end;
    87 
    87 
    88 procedure DeleteGear(Gear: PGear); forward;
    88 procedure DeleteGear(Gear: PGear); forward;
    89 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward;
    89 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward;
    90 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
    90 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
    91 procedure AmmoFlameWork(Ammo: PGear); forward;
    91 //procedure AmmoFlameWork(Ammo: PGear); forward;
    92 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward;
    92 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward;
    93 procedure SpawnBoxOfSmth; forward;
    93 procedure SpawnBoxOfSmth; forward;
    94 procedure AfterAttack; forward;
    94 procedure AfterAttack; forward;
    95 procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: LongInt); forward;
    95 procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: LongInt); forward;
    96 procedure HedgehogStep(Gear: PGear); forward;
    96 procedure HedgehogStep(Gear: PGear); forward;
  1127 begin
  1127 begin
  1128 TargetPoint.X:= NoPointX;
  1128 TargetPoint.X:= NoPointX;
  1129 {$IFDEF DEBUGFILE}if Radius > 3 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
  1129 {$IFDEF DEBUGFILE}if Radius > 3 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
  1130 if (Radius > 10) then AddGear(X, Y, gtExplosion, 0, _0, _0, 0);
  1130 if (Radius > 10) then AddGear(X, Y, gtExplosion, 0, _0, _0, 0);
  1131 if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion, false);
  1131 if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion, false);
  1132 if (Mask and EXPLAllDamageInRadius)=0 then dmgRadius:= Radius shl 1
  1132 
  1133                                       else dmgRadius:= Radius;
  1133 if (Mask and EXPLAllDamageInRadius) = 0 then
       
  1134 	dmgRadius:= Radius shl 1
       
  1135 else
       
  1136 	dmgRadius:= Radius;
       
  1137 
  1134 Gear:= GearsList;
  1138 Gear:= GearsList;
  1135 while Gear <> nil do
  1139 while Gear <> nil do
  1136 	begin
  1140 	begin
  1137 	dmg:= dmgRadius  + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y)));
  1141 	dmg:= dmgRadius  + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y)));
  1138 	if (dmg > 1) and
  1142 	if (dmg > 1) and
  1312 var t: PGear;
  1316 var t: PGear;
  1313 begin
  1317 begin
  1314 t:= GearsList;
  1318 t:= GearsList;
  1315 rX:= sqr(rX);
  1319 rX:= sqr(rX);
  1316 rY:= sqr(rY);
  1320 rY:= sqr(rY);
       
  1321 
  1317 while t <> nil do
  1322 while t <> nil do
  1318       begin
  1323 	begin
  1319       if (t <> Gear) and (t^.Kind = Kind) then
  1324 	if (t <> Gear) and (t^.Kind = Kind) then
  1320          if not((hwSqr(Gear^.X - t^.X) / rX + hwSqr(Gear^.Y - t^.Y) / rY) > _1) then
  1325 		if not((hwSqr(Gear^.X - t^.X) / rX + hwSqr(Gear^.Y - t^.Y) / rY) > _1) then
  1321             exit(t);
  1326 		exit(t);
  1322       t:= t^.NextGear
  1327 	t:= t^.NextGear
  1323       end;
  1328 	end;
       
  1329 
  1324 CheckGearNear:= nil
  1330 CheckGearNear:= nil
  1325 end;
  1331 end;
  1326 
  1332 
  1327 procedure AmmoFlameWork(Ammo: PGear);
  1333 {procedure AmmoFlameWork(Ammo: PGear);
  1328 var t: PGear;
  1334 var t: PGear;
  1329 begin
  1335 begin
  1330 t:= GearsList;
  1336 t:= GearsList;
  1331 while t <> nil do
  1337 while t <> nil do
  1332 	begin
  1338 	begin
  1340 			DeleteCI(t);
  1346 			DeleteCI(t);
  1341 			FollowGear:= t
  1347 			FollowGear:= t
  1342 			end;
  1348 			end;
  1343 	t:= t^.NextGear
  1349 	t:= t^.NextGear
  1344 	end;
  1350 	end;
  1345 end;
  1351 end;}
  1346 
  1352 
  1347 function CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear;
  1353 function CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear;
  1348 var t: PGear;
  1354 var t: PGear;
  1349 begin
  1355 begin
  1350 t:= GearsList;
  1356 t:= GearsList;