260 jmpNone: exit(Result); |
260 jmpNone: exit(Result); |
261 jmpHJump: if not TestCollisionYwithGear(Gear, -1) then |
261 jmpHJump: if not TestCollisionYwithGear(Gear, -1) then |
262 begin |
262 begin |
263 Gear^.dY:= -_0_2; |
263 Gear^.dY:= -_0_2; |
264 SetLittle(Gear^.dX); |
264 SetLittle(Gear^.dX); |
265 Gear^.State:= Gear^.State or gstFalling or gstHHJumping; |
265 Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
266 end else exit(Result); |
266 end else exit(Result); |
267 jmpLJump: begin |
267 jmpLJump: begin |
268 if not TestCollisionYwithGear(Gear, -1) then |
268 if not TestCollisionYwithGear(Gear, -1) then |
269 if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - int2hwFloat(2) else |
269 if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - int2hwFloat(2) else |
270 if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; |
270 if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; |
271 if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
271 if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
272 or TestCollisionYwithGear(Gear, -1)) then |
272 or TestCollisionYwithGear(Gear, -1)) then |
273 begin |
273 begin |
274 Gear^.dY:= -_0_15; |
274 Gear^.dY:= -_0_15; |
275 Gear^.dX:= SignAs(_0_15, Gear^.dX); |
275 Gear^.dX:= SignAs(_0_15, Gear^.dX); |
276 Gear^.State:= Gear^.State or gstFalling or gstHHJumping |
276 Gear^.State:= Gear^.State or gstMoving or gstHHJumping |
277 end else exit(Result) |
277 end else exit(Result) |
278 end |
278 end |
279 end; |
279 end; |
280 |
280 |
281 repeat |
281 repeat |
282 if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then exit(Result); |
282 if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then exit(Result); |
283 if (Gear^.State and gstFalling) <> 0 then |
283 if (Gear^.State and gstMoving) <> 0 then |
284 begin |
284 begin |
285 if (GoInfo.Ticks = 350) then |
285 if (GoInfo.Ticks = 350) then |
286 if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then |
286 if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then |
287 begin |
287 begin |
288 Gear^.dY:= -_0_25; |
288 Gear^.dY:= -_0_25; |
295 if Gear^.dY > _0_4 then exit(Result); |
295 if Gear^.dY > _0_4 then exit(Result); |
296 if (Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0; |
296 if (Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0; |
297 Gear^.Y:= Gear^.Y + Gear^.dY; |
297 Gear^.Y:= Gear^.Y + Gear^.dY; |
298 if (not Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, 1) then |
298 if (not Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, 1) then |
299 begin |
299 begin |
300 Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping); |
300 Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); |
301 Gear^.dY:= _0; |
301 Gear^.dY:= _0; |
302 case JumpType of |
302 case JumpType of |
303 jmpHJump: if bY - hwRound(Gear^.Y) > 5 then |
303 jmpHJump: if bY - hwRound(Gear^.Y) > 5 then |
304 begin |
304 begin |
305 Result:= true; |
305 Result:= true; |
331 GoInfo.JumpType:= jmpNone; |
331 GoInfo.JumpType:= jmpNone; |
332 repeat |
332 repeat |
333 pX:= hwRound(Gear^.X); |
333 pX:= hwRound(Gear^.X); |
334 pY:= hwRound(Gear^.Y); |
334 pY:= hwRound(Gear^.Y); |
335 if pY + cHHRadius >= cWaterLine then exit(false); |
335 if pY + cHHRadius >= cWaterLine then exit(false); |
336 if (Gear^.State and gstFalling) <> 0 then |
336 if (Gear^.State and gstMoving) <> 0 then |
337 begin |
337 begin |
338 inc(GoInfo.Ticks); |
338 inc(GoInfo.Ticks); |
339 Gear^.dY:= Gear^.dY + cGravity; |
339 Gear^.dY:= Gear^.dY + cGravity; |
340 if Gear^.dY > _0_4 then |
340 if Gear^.dY > _0_4 then |
341 begin |
341 begin |
346 Gear^.Y:= Gear^.Y + Gear^.dY; |
346 Gear^.Y:= Gear^.Y + Gear^.dY; |
347 if hwRound(Gear^.Y) > pY then inc(GoInfo.FallPix); |
347 if hwRound(Gear^.Y) > pY then inc(GoInfo.FallPix); |
348 if TestCollisionYwithGear(Gear, 1) then |
348 if TestCollisionYwithGear(Gear, 1) then |
349 begin |
349 begin |
350 inc(GoInfo.Ticks, 300); |
350 inc(GoInfo.Ticks, 300); |
351 Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping); |
351 Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); |
352 Gear^.dY:= _0; |
352 Gear^.dY:= _0; |
353 Result:= true; |
353 Result:= true; |
354 HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall |
354 HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall |
355 exit(Result) |
355 exit(Result) |
356 end; |
356 end; |
399 Gear^.Y:= Gear^.Y + _1; |
399 Gear^.Y:= Gear^.Y + _1; |
400 if not TestCollisionYwithGear(Gear, 1) then |
400 if not TestCollisionYwithGear(Gear, 1) then |
401 begin |
401 begin |
402 Gear^.Y:= Gear^.Y - _6; |
402 Gear^.Y:= Gear^.Y - _6; |
403 Gear^.dY:= _0; |
403 Gear^.dY:= _0; |
404 Gear^.State:= Gear^.State or gstFalling |
404 Gear^.State:= Gear^.State or gstMoving |
405 end |
405 end |
406 end |
406 end |
407 end |
407 end |
408 end |
408 end |
409 end |
409 end |
410 end |
410 end |
411 end; |
411 end; |
412 if (pX <> hwRound(Gear^.X)) and ((Gear^.State and gstFalling) = 0) then |
412 if (pX <> hwRound(Gear^.X)) and ((Gear^.State and gstMoving) = 0) then |
413 exit(true); |
413 exit(true); |
414 until (pX = hwRound(Gear^.X)) and (pY = hwRound(Gear^.Y)) and ((Gear^.State and gstFalling) = 0); |
414 until (pX = hwRound(Gear^.X)) and (pY = hwRound(Gear^.Y)) and ((Gear^.State and gstMoving) = 0); |
415 HHJump(AltGear, jmpHJump, GoInfo); |
415 HHJump(AltGear, jmpHJump, GoInfo); |
416 HHGo:= Result |
416 HHGo:= Result |
417 end; |
417 end; |
418 |
418 |
419 function AIrndSign(num: LongInt): LongInt; |
419 function AIrndSign(num: LongInt): LongInt; |