189 inc(y) |
189 inc(y) |
190 until (y > i); |
190 until (y > i); |
191 end; |
191 end; |
192 TestCollisionXKick:= false; |
192 TestCollisionXKick:= false; |
193 |
193 |
194 if flag and (Gear^.dX > cHHKick) then |
194 if flag and (hwAbs(Gear^.dX) > cHHKick) then |
195 begin |
195 begin |
196 if Count = 0 then exit; |
196 if Count = 0 then exit; |
197 mx:= hwRound(Gear^.X); |
197 mx:= hwRound(Gear^.X); |
198 my:= hwRound(Gear^.Y); |
198 my:= hwRound(Gear^.Y); |
199 |
199 |
200 for i:= 0 to Pred(Count) do |
200 for i:= 0 to Pred(Count) do |
201 with cinfos[i] do |
201 with cinfos[i] do |
202 if (Gear <> cGear) and |
202 if (Gear <> cGear) and |
203 (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius)) and |
203 (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius)) and |
204 ((mx > x) xor (Dir > 0)) then |
204 ((mx > x) xor (Dir > 0)) then |
205 if (cinfos[i].cGear^.Kind in [gtHedgehog, gtMine]) then |
205 if (cGear^.Kind in [gtHedgehog, gtMine]) then |
206 begin |
206 begin |
207 Gear^.dX:= Gear^.dX {* _0_6}; |
207 Gear^.dX:= Gear^.dX {* _0_6}; |
208 Gear^.dY:= Gear^.dY {* _0_6}; |
208 Gear^.dY:= Gear^.dY {* _0_6}; |
209 with cinfos[i].cGear^ do |
209 with cGear^ do |
210 begin |
210 begin |
211 dX:= Gear^.dX {* _1_5}; |
211 dX:= Gear^.dX {* _1_5}; |
212 dY:= Gear^.dY {* _1_5}; |
212 dY:= Gear^.dY {* _1_5}; |
213 State:= State and gstMoving; |
213 State:= State or gstMoving; |
214 Active:= true |
214 Active:= true |
215 end; |
215 end; |
216 DeleteCI(cinfos[i].cGear); |
216 DeleteCI(cGear); |
217 exit |
217 exit |
218 end else exit(true) |
218 end else exit(true) |
219 end |
219 end |
220 end; |
220 end; |
221 |
221 |
239 inc(x) |
239 inc(x) |
240 until (x > i); |
240 until (x > i); |
241 end; |
241 end; |
242 TestCollisionYKick:= false; |
242 TestCollisionYKick:= false; |
243 |
243 |
244 if flag and (Gear^.dX > cHHKick) then |
244 if flag and (hwAbs(Gear^.dX) > cHHKick) then |
245 begin |
245 begin |
246 if Count = 0 then exit; |
246 if Count = 0 then exit; |
247 mx:= hwRound(Gear^.X); |
247 mx:= hwRound(Gear^.X); |
248 my:= hwRound(Gear^.Y); |
248 my:= hwRound(Gear^.Y); |
249 |
249 |
250 for i:= 0 to Pred(Count) do |
250 for i:= 0 to Pred(Count) do |
251 with cinfos[i] do |
251 with cinfos[i] do |
252 if (Gear <> cGear) and |
252 if (Gear <> cGear) and |
253 (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius)) and |
253 (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius)) and |
254 ((my > y) xor (Dir > 0)) then |
254 ((my > y) xor (Dir > 0)) then |
255 if (cinfos[i].cGear^.Kind in [gtHedgehog, gtMine]) then |
255 if (cGear^.Kind in [gtHedgehog, gtMine]) then |
256 begin |
256 begin |
257 Gear^.dX:= Gear^.dX {* _0_6}; |
257 Gear^.dX:= Gear^.dX {* _0_6}; |
258 Gear^.dY:= Gear^.dY {* _0_6}; |
258 Gear^.dY:= Gear^.dY {* _0_6}; |
259 with cinfos[i].cGear^ do |
259 with cGear^ do |
260 begin |
260 begin |
261 dX:= Gear^.dX {* _1_5}; |
261 dX:= Gear^.dX {* _1_5}; |
262 dY:= Gear^.dY {* _1_5}; |
262 dY:= Gear^.dY {* _1_5}; |
263 State:= State and gstMoving; |
263 State:= State or gstMoving; |
264 Active:= true |
264 Active:= true |
265 end; |
265 end; |
266 DeleteCI(cinfos[i].cGear); |
266 DeleteCI(cGear); |
267 exit |
267 exit |
268 end else exit(true) |
268 end else exit(true) |
269 end |
269 end |
270 end; |
270 end; |
271 |
271 |