234 SetLittle(Gear^.dX); |
234 SetLittle(Gear^.dX); |
235 Gear^.State:= Gear^.State or gstFalling or gstHHJumping; |
235 Gear^.State:= Gear^.State or gstFalling or gstHHJumping; |
236 end else exit(Result); |
236 end else exit(Result); |
237 jmpLJump: begin |
237 jmpLJump: begin |
238 if not TestCollisionYwithGear(Gear, -1) then |
238 if not TestCollisionYwithGear(Gear, -1) then |
239 if not TestCollisionXwithXYShift(Gear, 0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - 2 else |
239 if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - int2hwFloat(2) else |
240 if not TestCollisionXwithXYShift(Gear, 0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - 1; |
240 if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; |
241 if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
241 if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
242 or TestCollisionYwithGear(Gear, -1)) then |
242 or TestCollisionYwithGear(Gear, -1)) then |
243 begin |
243 begin |
244 Gear^.dY:= -_0_15; |
244 Gear^.dY:= -_0_15; |
245 Gear^.dX:= hwSign(Gear^.dX) * _0_15; |
245 Gear^.dX:= SignAs(_0_15, Gear^.dX); |
246 Gear^.State:= Gear^.State or gstFalling or gstHHJumping |
246 Gear^.State:= Gear^.State or gstFalling or gstHHJumping |
247 end else exit(Result) |
247 end else exit(Result) |
248 end |
248 end |
249 end; |
249 end; |
250 |
250 |
251 repeat |
251 repeat |
252 if not (Gear^.Y + cHHRadius < cWaterLine) then exit(Result); |
252 if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then exit(Result); |
253 if (Gear^.State and gstFalling) <> 0 then |
253 if (Gear^.State and gstFalling) <> 0 then |
254 begin |
254 begin |
255 if (GoInfo.Ticks = 350) then |
255 if (GoInfo.Ticks = 350) then |
256 if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then |
256 if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then |
257 begin |
257 begin |
258 Gear^.dY:= -_0_25; |
258 Gear^.dY:= -_0_25; |
259 Gear^.dX:= hwSign(Gear^.dX) * _0_02 |
259 Gear^.dX:= SignAs(_0_02, Gear^.dX) |
260 end; |
260 end; |
261 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX); |
261 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX); |
262 Gear^.X:= Gear^.X + Gear^.dX; |
262 Gear^.X:= Gear^.X + Gear^.dX; |
263 inc(GoInfo.Ticks); |
263 inc(GoInfo.Ticks); |
264 Gear^.dY:= Gear^.dY + cGravity; |
264 Gear^.dY:= Gear^.dY + cGravity; |
265 if Gear^.dY > _0_4 then exit(Result); |
265 if Gear^.dY > _0_4 then exit(Result); |
266 if (Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= 0; |
266 if (Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0; |
267 Gear^.Y:= Gear^.Y + Gear^.dY; |
267 Gear^.Y:= Gear^.Y + Gear^.dY; |
268 if (not Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, 1) then |
268 if (not Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, 1) then |
269 begin |
269 begin |
270 Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping); |
270 Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping); |
271 Gear^.dY:= 0; |
271 Gear^.dY:= _0; |
272 case JumpType of |
272 case JumpType of |
273 jmpHJump: if (bY - Gear^.Y > 5) then |
273 jmpHJump: if bY - hwRound(Gear^.Y) > 5 then |
274 begin |
274 begin |
275 Result:= true; |
275 Result:= true; |
276 GoInfo.JumpType:= jmpHJump; |
276 GoInfo.JumpType:= jmpHJump; |
277 inc(GoInfo.Ticks, 300 + 300) // 300 before jump, 300 after |
277 inc(GoInfo.Ticks, 300 + 300) // 300 before jump, 300 after |
278 end; |
278 end; |
279 jmpLJump: if hwAbs(bX - Gear^.X) > 30 then |
279 jmpLJump: if abs(bX - hwRound(Gear^.X)) > 30 then |
280 begin |
280 begin |
281 Result:= true; |
281 Result:= true; |
282 GoInfo.JumpType:= jmpLJump; |
282 GoInfo.JumpType:= jmpLJump; |
283 inc(GoInfo.Ticks, 300 + 300) // 300 before jump, 300 after |
283 inc(GoInfo.Ticks, 300 + 300) // 300 before jump, 300 after |
284 end; |
284 end; |
317 if hwRound(Gear^.Y) > pY then inc(GoInfo.FallPix); |
317 if hwRound(Gear^.Y) > pY then inc(GoInfo.FallPix); |
318 if TestCollisionYwithGear(Gear, 1) then |
318 if TestCollisionYwithGear(Gear, 1) then |
319 begin |
319 begin |
320 inc(GoInfo.Ticks, 300); |
320 inc(GoInfo.Ticks, 300); |
321 Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping); |
321 Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping); |
322 Gear^.dY:= 0; |
322 Gear^.dY:= _0; |
323 Result:= true; |
323 Result:= true; |
324 HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall |
324 HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall |
325 exit(Result) |
325 exit(Result) |
326 end; |
326 end; |
327 continue |
327 continue |
328 end; |
328 end; |
329 if (Gear^.Message and gm_Left )<>0 then Gear^.dX:= -cLittle else |
329 if (Gear^.Message and gm_Left )<>0 then Gear^.dX:= -cLittle else |
330 if (Gear^.Message and gm_Right )<>0 then Gear^.dX:= cLittle else exit(Result); |
330 if (Gear^.Message and gm_Right )<>0 then Gear^.dX:= cLittle else exit(Result); |
331 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
331 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
332 begin |
332 begin |
333 if not (TestCollisionXwithXYShift(Gear, 0, -6, hwSign(Gear^.dX)) |
333 if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) |
334 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1; |
334 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
335 if not (TestCollisionXwithXYShift(Gear, 0, -5, hwSign(Gear^.dX)) |
335 if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX)) |
336 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1; |
336 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
337 if not (TestCollisionXwithXYShift(Gear, 0, -4, hwSign(Gear^.dX)) |
337 if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX)) |
338 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1; |
338 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
339 if not (TestCollisionXwithXYShift(Gear, 0, -3, hwSign(Gear^.dX)) |
339 if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) |
340 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1; |
340 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
341 if not (TestCollisionXwithXYShift(Gear, 0, -2, hwSign(Gear^.dX)) |
341 if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) |
342 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1; |
342 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
343 if not (TestCollisionXwithXYShift(Gear, 0, -1, hwSign(Gear^.dX)) |
343 if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) |
344 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1; |
344 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
345 end; |
345 end; |
346 |
346 |
347 if not TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
347 if not TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
348 begin |
348 begin |
349 Gear^.X:= Gear^.X + hwSign(Gear^.dX); |
349 Gear^.X:= Gear^.X + int2hwFloat(hwSign(Gear^.dX)); |
350 inc(GoInfo.Ticks, cHHStepTicks) |
350 inc(GoInfo.Ticks, cHHStepTicks) |
351 end; |
351 end; |
352 if not TestCollisionYwithGear(Gear, 1) then |
352 if not TestCollisionYwithGear(Gear, 1) then |
353 begin |
353 begin |
354 Gear^.Y:= Gear^.Y + 1; |
354 Gear^.Y:= Gear^.Y + _1; |
355 if not TestCollisionYwithGear(Gear, 1) then |
355 if not TestCollisionYwithGear(Gear, 1) then |
356 begin |
356 begin |
357 Gear^.Y:= Gear^.Y + 1; |
357 Gear^.Y:= Gear^.Y + _1; |
358 if not TestCollisionYwithGear(Gear, 1) then |
358 if not TestCollisionYwithGear(Gear, 1) then |
359 begin |
359 begin |
360 Gear^.Y:= Gear^.Y + 1; |
360 Gear^.Y:= Gear^.Y + _1; |
361 if not TestCollisionYwithGear(Gear, 1) then |
361 if not TestCollisionYwithGear(Gear, 1) then |
362 begin |
362 begin |
363 Gear^.Y:= Gear^.Y + 1; |
363 Gear^.Y:= Gear^.Y + _1; |
364 if not TestCollisionYwithGear(Gear, 1) then |
364 if not TestCollisionYwithGear(Gear, 1) then |
365 begin |
365 begin |
366 Gear^.Y:= Gear^.Y + 1; |
366 Gear^.Y:= Gear^.Y + _1; |
367 if not TestCollisionYwithGear(Gear, 1) then |
367 if not TestCollisionYwithGear(Gear, 1) then |
368 begin |
368 begin |
369 Gear^.Y:= Gear^.Y + 1; |
369 Gear^.Y:= Gear^.Y + _1; |
370 if not TestCollisionYwithGear(Gear, 1) then |
370 if not TestCollisionYwithGear(Gear, 1) then |
371 begin |
371 begin |
372 Gear^.Y:= Gear^.Y - 6; |
372 Gear^.Y:= Gear^.Y - _6; |
373 Gear^.dY:= 0; |
373 Gear^.dY:= _0; |
374 Gear^.State:= Gear^.State or gstFalling |
374 Gear^.State:= Gear^.State or gstFalling |
375 end |
375 end |
376 end |
376 end |
377 end |
377 end |
378 end |
378 end |