hedgewars/GSHandlers.inc
changeset 2938 451f917ac46c
parent 2937 da06c25edf1d
child 2939 58d811e0d41c
equal deleted inserted replaced
2937:da06c25edf1d 2938:451f917ac46c
  1262 if k = gtExplosives then
  1262 if k = gtExplosives then
  1263 	begin
  1263 	begin
  1264     V:= hwSqr(Gear^.dX) + hwSqr(Gear^.dY);
  1264     V:= hwSqr(Gear^.dX) + hwSqr(Gear^.dY);
  1265     //if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation;
  1265     //if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation;
  1266     if hwAbs(Gear^.dX) > _0_15 then Gear^.State:= Gear^.State or gstAnimation;
  1266     if hwAbs(Gear^.dX) > _0_15 then Gear^.State:= Gear^.State or gstAnimation;
  1267     if ((Gear^.State and gstAnimation) = 0) or (hwAbs(Gear^.dX) < _0_001) then Gear^.dX:= _0;
  1267     if ((Gear^.State and gstAnimation) <> 0) and ((Gear^.dX.QWordValue <> 0) or (Gear^.dY.QWordValue <> 0))  then
  1268     if ((Gear^.State and gstAnimation) <> 0) and (Gear^.dX.QWordValue <> 0) and (Gear^.dY.QWordValue <> 0)  then
       
  1269         begin
  1268         begin
  1270         AllInactive:= false;
  1269         AllInactive:= false;
  1271         doStepFallingGear(Gear);
  1270         doStepFallingGear(Gear);
  1272         CalcRotationDirAngle(Gear)
  1271         CalcRotationDirAngle(Gear)
  1273         end;
  1272         end;
  1277 	dec(Gear^.Health, Gear^.Damage);
  1276 	dec(Gear^.Health, Gear^.Damage);
  1278 	Gear^.Damage:= 0;
  1277 	Gear^.Damage:= 0;
  1279 	if Gear^.Health <= 0 then
  1278 	if Gear^.Health <= 0 then
  1280 		exBoom:= true;
  1279 		exBoom:= true;
  1281 	end;
  1280 	end;
       
  1281 if ((Gear^.State and gstAnimation) = 0) or (hwAbs(Gear^.dX) < _0_001) then Gear^.dX:= _0;
  1282 
  1282 
  1283 if (Gear^.Damage > 0) or exBoom then
  1283 if (Gear^.Damage > 0) or exBoom then
  1284 	begin
  1284 	begin
  1285 	x:= hwRound(Gear^.X);
  1285 	x:= hwRound(Gear^.X);
  1286 	y:= hwRound(Gear^.Y);
  1286 	y:= hwRound(Gear^.Y);
  1313         begin
  1313         begin
  1314         Gear^.dY:= Gear^.dY + cGravity;
  1314         Gear^.dY:= Gear^.dY + cGravity;
  1315         Gear^.Y:= Gear^.Y + Gear^.dY;
  1315         Gear^.Y:= Gear^.Y + Gear^.dY;
  1316 	    if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0
  1316 	    if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0
  1317         end;
  1317         end;
  1318     if Gear^.dY < _0_001 then SetAllHHToActive;
  1318     if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then SetAllHHToActive;
  1319 	if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then
  1319 	if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then
  1320 		begin
  1320 		begin
  1321         if (V > _0_02) and (k = gtExplosives) and ((Gear^.State and gstAnimation) <> 0) then
  1321         if (V > _0_02) and (k = gtExplosives) and ((Gear^.State and gstAnimation) <> 0) then
  1322             inc(Gear^.Damage, hwRound(V * _70));
  1322             inc(Gear^.Damage, hwRound(V * _70));
  1323 
  1323 
  1330 		end;
  1330 		end;
  1331 	//if Gear^.dY > - _0_001 then Gear^.dY:= _0
  1331 	//if Gear^.dY > - _0_001 then Gear^.dY:= _0
  1332 	CheckGearDrowning(Gear);
  1332 	CheckGearDrowning(Gear);
  1333 	end;
  1333 	end;
  1334 
  1334 
  1335 if (Gear^.dY.QWordValue = 0) then AddGearCI(Gear)
  1335 if (Gear^.dX.QWordValue = 0) and (Gear^.dY.QWordValue = 0) then AddGearCI(Gear)
  1336 	else if (Gear^.dY.QWordValue <> 0) then DeleteCI(Gear)
  1336 	else DeleteCI(Gear)
  1337 end;
  1337 end;
  1338 
  1338 
  1339 ////////////////////////////////////////////////////////////////////////////////
  1339 ////////////////////////////////////////////////////////////////////////////////
  1340 
  1340 
  1341 procedure doStepTarget(Gear: PGear);
  1341 procedure doStepTarget(Gear: PGear);