hedgewars/uGears.pas
changeset 981 e883baf3a458
parent 976 368a8926632b
child 982 bbf382a5fe73
equal deleted inserted replaced
980:20128e98988b 981:e883baf3a458
   971     i: LongInt;
   971     i: LongInt;
   972 begin
   972 begin
   973 t:= CheckGearsCollision(Ammo);
   973 t:= CheckGearsCollision(Ammo);
   974 i:= t^.Count;
   974 i:= t^.Count;
   975 while i > 0 do
   975 while i > 0 do
   976     begin
   976 	begin
   977     dec(i);
   977 	dec(i);
   978     if (t^.ar[i]^.State and gstNoDamage) = 0 then
   978 	if (t^.ar[i]^.State and gstNoDamage) = 0 then
   979        case t^.ar[i]^.Kind of
   979 		case t^.ar[i]^.Kind of
   980            gtHedgehog,
   980 			gtHedgehog,
   981                gtMine,
   981 			gtMine,
   982              gtTarget,
   982 			gtTarget,
   983                gtCase: begin
   983 			gtCase: begin
   984                        inc(t^.ar[i]^.Damage, Damage);
   984 					inc(t^.ar[i]^.Damage, Damage);
   985 
   985 
   986                        if t^.ar[i]^.Kind = gtHedgehog then
   986 					if t^.ar[i]^.Kind = gtHedgehog then
   987                           AddDamageTag(hwRound(t^.ar[i]^.X), hwRound(t^.ar[i]^.Y), Damage, t^.ar[i]);
   987 						AddDamageTag(hwRound(t^.ar[i]^.X), hwRound(t^.ar[i]^.Y), Damage, t^.ar[i]);
   988 
   988 
   989                        DeleteCI(t^.ar[i]);
   989 					DeleteCI(t^.ar[i]);
   990                        t^.ar[i]^.dX:= Ammo^.dX * Power * _0_01;
   990 					t^.ar[i]^.dX:= Ammo^.dX * Power * _0_01;
   991                        t^.ar[i]^.dY:= Ammo^.dY * Power * _0_01;
   991 					t^.ar[i]^.dY:= Ammo^.dY * Power * _0_01;
   992                        t^.ar[i]^.Active:= true;
   992 					t^.ar[i]^.Active:= true;
   993                        t^.ar[i]^.State:= t^.ar[i]^.State or gstMoving;
   993 					t^.ar[i]^.State:= t^.ar[i]^.State or gstMoving;
   994                        FollowGear:= t^.ar[i]
   994 
   995                        end;
   995 (*					if TestCollisionXwithGear(t^.ar[i], hwSign(t^.ar[i]^.dX)) then
   996            end
   996 						begin
   997     end;
   997 						if not (TestCollisionXwithXYShift(t^.ar[i], _0, -3, hwSign(t^.ar[i]^.dX))
       
   998 							or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1;
       
   999 						if not (TestCollisionXwithXYShift(t^.ar[i], _0, -2, hwSign(t^.ar[i]^.dX))
       
  1000 							or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1;
       
  1001 						if not (TestCollisionXwithXYShift(t^.ar[i], _0, -1, hwSign(t^.ar[i]^.dX))
       
  1002 							or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1;
       
  1003 						end;
       
  1004 *)					
       
  1005 					FollowGear:= t^.ar[i]
       
  1006 					end;
       
  1007 		end
       
  1008 	end;
   998 SetAllToActive
  1009 SetAllToActive
   999 end;
  1010 end;
  1000 
  1011 
  1001 procedure AssignHHCoords;
  1012 procedure AssignHHCoords;
  1002 var i, t, p, j: LongInt;
  1013 var i, t, p, j: LongInt;