hedgewars/GSHandlers.inc
changeset 2281 3217f0d8c420
parent 2280 786fb5d8107d
child 2282 aa186d0e4f39
equal deleted inserted replaced
2280:786fb5d8107d 2281:3217f0d8c420
   953 Gear^.Y:= Gear^.Y - Gear^.dY;
   953 Gear^.Y:= Gear^.Y - Gear^.dY;
   954 Gear^.Elasticity:= Gear^.Elasticity + _1;
   954 Gear^.Elasticity:= Gear^.Elasticity + _1;
   955 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
   955 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
   956 DeleteCI(HHGear);
   956 DeleteCI(HHGear);
   957 if (HHGear^.State and gstMoving) <> 0 then
   957 if (HHGear^.State and gstMoving) <> 0 then
   958 if TestCollisionYwithGear(HHGear, 1) then
   958 	begin
   959 	begin
       
   960 	CheckHHDamage(HHGear);
       
   961 	HHGear^.dY:= _0;
       
   962 	HHGear^.State:= HHGear^.State and not (gstMoving or gstHHJumping or gstHHHJump);
       
   963 	end else
       
   964 	begin
       
   965 	if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX);
       
   966 	HHGear^.X:= HHGear^.X + HHGear^.dX;
   959 	HHGear^.X:= HHGear^.X + HHGear^.dX;
   967 	HHGear^.Y:= HHGear^.Y + HHGear^.dY;
       
   968 	Gear^.X:= Gear^.X + HHGear^.dX;
   960 	Gear^.X:= Gear^.X + HHGear^.dX;
   969 	Gear^.Y:= Gear^.Y + HHGear^.dY;
   961 
   970 	HHGear^.dY:= HHGear^.dY + cGravity;
   962 	if TestCollisionYwithGear(HHGear, 1) then
   971 	tt:= Gear^.Elasticity;
   963 		begin
   972 	tx:= _0;
   964 		CheckHHDamage(HHGear);
   973 	ty:= _0;
   965 		HHGear^.dY:= _0;
   974 	while tt > _20 do
   966 		HHGear^.State:= HHGear^.State and not (gstMoving or gstHHJumping or gstHHHJump);
   975 		begin
   967 		end else
   976 		if  TestCollisionXwithXYShift(Gear, tx, hwRound(ty), -hwSign(Gear^.dX))
   968 		begin
   977 		or TestCollisionYwithXYShift(Gear, hwRound(tx), hwRound(ty), -hwSign(Gear^.dY)) then
   969 		if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX);
       
   970 		HHGear^.Y:= HHGear^.Y + HHGear^.dY;
       
   971 		Gear^.Y:= Gear^.Y + HHGear^.dY;
       
   972 		HHGear^.dY:= HHGear^.dY + cGravity;
       
   973 		tt:= Gear^.Elasticity;
       
   974 		tx:= _0;
       
   975 		ty:= _0;
       
   976 		while tt > _20 do
   978 			begin
   977 			begin
   979 			Gear^.X:= Gear^.X + tx;
   978 			if  TestCollisionXwithXYShift(Gear, tx, hwRound(ty), -hwSign(Gear^.dX))
   980 			Gear^.Y:= Gear^.Y + ty;
   979 			or TestCollisionYwithXYShift(Gear, hwRound(tx), hwRound(ty), -hwSign(Gear^.dY)) then
   981 			Gear^.Elasticity:= tt;
   980 				begin
   982 			Gear^.doStep:= @doStepRopeWork;
   981 				Gear^.X:= Gear^.X + tx;
   983 			with HHGear^ do State:= State and not (gstAttacking or gstMoving or gstHHHJump);
   982 				Gear^.Y:= Gear^.Y + ty;
   984 			
   983 				Gear^.Elasticity:= tt;
   985 			RemoveFromAmmo;
   984 				Gear^.doStep:= @doStepRopeWork;
   986 			
   985 				with HHGear^ do State:= State and not (gstAttacking or gstMoving or gstHHHJump);
   987 			tt:= _0;
   986 				
   988 			exit
   987 				RemoveFromAmmo;
       
   988 				
       
   989 				tt:= _0;
       
   990 				exit
       
   991 				end;
       
   992 			tx:= tx + Gear^.dX + Gear^.dX;
       
   993 			ty:= ty + Gear^.dY + Gear^.dY;
       
   994 			tt:= tt - _2;
   989 			end;
   995 			end;
   990 		tx:= tx + Gear^.dX + Gear^.dX;
       
   991 		ty:= ty + Gear^.dY + Gear^.dY;
       
   992 		tt:= tt - _2;
       
   993 		end;
   996 		end;
   994 	end;
   997 	end;
   995 
   998 
   996 CheckCollision(Gear);
   999 CheckCollision(Gear);
   997 
  1000