equal
deleted
inserted
replaced
98 |
98 |
99 function CheckGearsCollision(Gear: PGear; Dir: integer; forX: boolean): boolean; |
99 function CheckGearsCollision(Gear: PGear; Dir: integer; forX: boolean): boolean; |
100 var x1, x2, y1, y2: integer; |
100 var x1, x2, y1, y2: integer; |
101 i: Longword; |
101 i: Longword; |
102 begin |
102 begin |
|
103 Result:= false; |
|
104 if Count = 0 then exit; |
103 x1:= round(Gear.X); |
105 x1:= round(Gear.X); |
104 y1:= round(Gear.Y); |
106 y1:= round(Gear.Y); |
105 {if (Gear.State and gstOutOfHH) = 0 then |
107 {if (Gear.State and gstOutOfHH) = 0 then |
106 begin |
108 begin |
107 p:= PHedgehog(Gear.Hedgehog)^.Gear; |
109 p:= PHedgehog(Gear.Hedgehog)^.Gear; |
109 ((x1 + Gear.HalfWidth < round(p.X) - p.HalfWidth) |
111 ((x1 + Gear.HalfWidth < round(p.X) - p.HalfWidth) |
110 or (x1 - Gear.HalfWidth > round(p.X) + p.HalfWidth) |
112 or (x1 - Gear.HalfWidth > round(p.X) + p.HalfWidth) |
111 or (y1 - Gear.HalfHeight > round(p.Y) + p.HalfHeight) |
113 or (y1 - Gear.HalfHeight > round(p.Y) + p.HalfHeight) |
112 or (y1 + Gear.HalfHeight < round(p.Y) - p.HalfHeight)) then Gear.State:= Gear.State or gstOutOfHH; |
114 or (y1 + Gear.HalfHeight < round(p.Y) - p.HalfHeight)) then Gear.State:= Gear.State or gstOutOfHH; |
113 end; } |
115 end; } |
114 Result:= false; |
|
115 if forX then |
116 if forX then |
116 begin |
117 begin |
117 x1:= x1 + Dir*Gear.HalfWidth; |
118 x1:= x1 + Dir*Gear.HalfWidth; |
118 x2:= x1; |
119 x2:= x1; |
119 y2:= y1 + Gear.HalfHeight - 1; |
120 y2:= y1 + Gear.HalfHeight - 1; |