330 GoInfo.JumpType:= jmpNone; |
330 GoInfo.JumpType:= jmpNone; |
331 bX:= hwRound(Gear^.X); |
331 bX:= hwRound(Gear^.X); |
332 bY:= hwRound(Gear^.Y); |
332 bY:= hwRound(Gear^.Y); |
333 case JumpType of |
333 case JumpType of |
334 jmpNone: exit(bRes); |
334 jmpNone: exit(bRes); |
335 jmpHJump: if not TestCollisionYwithGear(Gear, -1) then |
335 jmpHJump: if TestCollisionYwithGear(Gear, -1) = 0 then |
336 begin |
336 begin |
337 Gear^.dY:= -_0_2; |
337 Gear^.dY:= -_0_2; |
338 SetLittle(Gear^.dX); |
338 SetLittle(Gear^.dX); |
339 Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
339 Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
340 end else exit(bRes); |
340 end else exit(bRes); |
341 jmpLJump: begin |
341 jmpLJump: begin |
342 if not TestCollisionYwithGear(Gear, -1) then |
342 if TestCollisionYwithGear(Gear, -1) <> 0 then |
343 if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - int2hwFloat(2) else |
343 if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - int2hwFloat(2) else |
344 if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; |
344 if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; |
345 if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
345 if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
346 or TestCollisionYwithGear(Gear, -1)) then |
346 or (TestCollisionYwithGear(Gear, -1) <> 0)) then |
347 begin |
347 begin |
348 Gear^.dY:= -_0_15; |
348 Gear^.dY:= -_0_15; |
349 Gear^.dX:= SignAs(_0_15, Gear^.dX); |
349 Gear^.dX:= SignAs(_0_15, Gear^.dX); |
350 Gear^.State:= Gear^.State or gstMoving or gstHHJumping |
350 Gear^.State:= Gear^.State or gstMoving or gstHHJumping |
351 end else exit(bRes) |
351 end else exit(bRes) |
365 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX); |
365 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX); |
366 Gear^.X:= Gear^.X + Gear^.dX; |
366 Gear^.X:= Gear^.X + Gear^.dX; |
367 inc(GoInfo.Ticks); |
367 inc(GoInfo.Ticks); |
368 Gear^.dY:= Gear^.dY + cGravity; |
368 Gear^.dY:= Gear^.dY + cGravity; |
369 if Gear^.dY > _0_4 then exit(bRes); |
369 if Gear^.dY > _0_4 then exit(bRes); |
370 if (Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0; |
370 if (Gear^.dY.isNegative)and (TestCollisionYwithGear(Gear, -1) <> 0) then Gear^.dY:= _0; |
371 Gear^.Y:= Gear^.Y + Gear^.dY; |
371 Gear^.Y:= Gear^.Y + Gear^.dY; |
372 if (not Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, 1) then |
372 if (not Gear^.dY.isNegative)and (TestCollisionYwithGear(Gear, 1) <> 0) then |
373 begin |
373 begin |
374 Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); |
374 Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); |
375 Gear^.dY:= _0; |
375 Gear^.dY:= _0; |
376 case JumpType of |
376 case JumpType of |
377 jmpHJump: if bY - hwRound(Gear^.Y) > 5 then |
377 jmpHJump: if bY - hwRound(Gear^.Y) > 5 then |
415 HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall with damage |
415 HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall with damage |
416 exit(false) |
416 exit(false) |
417 end; |
417 end; |
418 Gear^.Y:= Gear^.Y + Gear^.dY; |
418 Gear^.Y:= Gear^.Y + Gear^.dY; |
419 if hwRound(Gear^.Y) > pY then inc(GoInfo.FallPix); |
419 if hwRound(Gear^.Y) > pY then inc(GoInfo.FallPix); |
420 if TestCollisionYwithGear(Gear, 1) then |
420 if TestCollisionYwithGear(Gear, 1) <> 0 then |
421 begin |
421 begin |
422 inc(GoInfo.Ticks, 410); |
422 inc(GoInfo.Ticks, 410); |
423 Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); |
423 Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); |
424 Gear^.dY:= _0; |
424 Gear^.dY:= _0; |
425 HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall |
425 HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall |
430 if (Gear^.Message and gmLeft )<>0 then Gear^.dX:= -cLittle else |
430 if (Gear^.Message and gmLeft )<>0 then Gear^.dX:= -cLittle else |
431 if (Gear^.Message and gmRight )<>0 then Gear^.dX:= cLittle else exit(false); |
431 if (Gear^.Message and gmRight )<>0 then Gear^.dX:= cLittle else exit(false); |
432 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
432 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
433 begin |
433 begin |
434 if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) |
434 if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) |
435 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
435 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
436 if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX)) |
436 if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX)) |
437 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
437 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
438 if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX)) |
438 if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX)) |
439 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
439 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
440 if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) |
440 if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) |
441 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
441 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
442 if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) |
442 if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) |
443 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
443 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
444 if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) |
444 if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) |
445 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
445 or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; |
446 end; |
446 end; |
447 |
447 |
448 if not TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
448 if not TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
449 begin |
449 begin |
450 Gear^.X:= Gear^.X + int2hwFloat(hwSign(Gear^.dX)); |
450 Gear^.X:= Gear^.X + int2hwFloat(hwSign(Gear^.dX)); |
451 inc(GoInfo.Ticks, cHHStepTicks) |
451 inc(GoInfo.Ticks, cHHStepTicks) |
452 end; |
452 end; |
453 if not TestCollisionYwithGear(Gear, 1) then |
453 if TestCollisionYwithGear(Gear, 1) = 0 then |
454 begin |
454 begin |
455 Gear^.Y:= Gear^.Y + _1; |
455 Gear^.Y:= Gear^.Y + _1; |
456 if not TestCollisionYwithGear(Gear, 1) then |
456 if TestCollisionYwithGear(Gear, 1) = 0 then |
457 begin |
457 begin |
458 Gear^.Y:= Gear^.Y + _1; |
458 Gear^.Y:= Gear^.Y + _1; |
459 if not TestCollisionYwithGear(Gear, 1) then |
459 if TestCollisionYwithGear(Gear, 1) = 0 then |
460 begin |
460 begin |
461 Gear^.Y:= Gear^.Y + _1; |
461 Gear^.Y:= Gear^.Y + _1; |
462 if not TestCollisionYwithGear(Gear, 1) then |
462 if TestCollisionYwithGear(Gear, 1) = 0 then |
463 begin |
463 begin |
464 Gear^.Y:= Gear^.Y + _1; |
464 Gear^.Y:= Gear^.Y + _1; |
465 if not TestCollisionYwithGear(Gear, 1) then |
465 if TestCollisionYwithGear(Gear, 1) = 0 then |
466 begin |
466 begin |
467 Gear^.Y:= Gear^.Y + _1; |
467 Gear^.Y:= Gear^.Y + _1; |
468 if not TestCollisionYwithGear(Gear, 1) then |
468 if TestCollisionYwithGear(Gear, 1) = 0 then |
469 begin |
469 begin |
470 Gear^.Y:= Gear^.Y + _1; |
470 Gear^.Y:= Gear^.Y + _1; |
471 if not TestCollisionYwithGear(Gear, 1) then |
471 if TestCollisionYwithGear(Gear, 1) = 0 then |
472 begin |
472 begin |
473 Gear^.Y:= Gear^.Y - _6; |
473 Gear^.Y:= Gear^.Y - _6; |
474 Gear^.dY:= _0; |
474 Gear^.dY:= _0; |
475 Gear^.State:= Gear^.State or gstMoving |
475 Gear^.State:= Gear^.State or gstMoving |
476 end |
476 end |