equal
deleted
inserted
replaced
323 if (StepTicks = 0) then HedgehogStep(Gear) |
323 if (StepTicks = 0) then HedgehogStep(Gear) |
324 end; |
324 end; |
325 |
325 |
326 //////////////////////////////////////////////////////////////////////////////// |
326 //////////////////////////////////////////////////////////////////////////////// |
327 procedure doStepHedgehogFree(Gear: PGear); |
327 procedure doStepHedgehogFree(Gear: PGear); |
328 begin |
328 var prevState: Longword; |
329 //DeleteCI(Gear); |
329 begin |
|
330 prevState:= Gear^.State; |
330 if not TestCollisionYwithGear(Gear, 1) then |
331 if not TestCollisionYwithGear(Gear, 1) then |
331 begin |
332 begin |
332 if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0; |
333 if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0; |
333 Gear^.State:= Gear^.State or gstFalling or gstMoving; |
334 Gear^.State:= Gear^.State or gstFalling or gstMoving; |
334 Gear^.dY:= Gear^.dY + cGravity |
335 Gear^.dY:= Gear^.dY + cGravity |
371 Gear^.dY:= _0 |
372 Gear^.dY:= _0 |
372 end else Gear^.State:= Gear^.State or gstMoving; |
373 end else Gear^.State:= Gear^.State or gstMoving; |
373 |
374 |
374 if (Gear^.State and gstMoving) <> 0 then |
375 if (Gear^.State and gstMoving) <> 0 then |
375 begin |
376 begin |
|
377 Gear^.State:= Gear^.State and not gstAnimation; |
376 Gear^.X:= Gear^.X + Gear^.dX; |
378 Gear^.X:= Gear^.X + Gear^.dX; |
377 Gear^.Y:= Gear^.Y + Gear^.dY; |
379 Gear^.Y:= Gear^.Y + Gear^.dY; |
378 if (Gear^.dY > _0) and not TestCollisionYwithGear(Gear, 1) and TestCollisionYwithXYShift(Gear, 0, 1, 1) then |
380 if (Gear^.dY > _0) and not TestCollisionYwithGear(Gear, 1) and TestCollisionYwithXYShift(Gear, 0, 1, 1) then |
379 begin |
381 begin |
380 CheckHHDamage(Gear); |
382 CheckHHDamage(Gear); |
397 |
399 |
398 AllInactive:= false; |
400 AllInactive:= false; |
399 |
401 |
400 if (not CheckGearDrowning(Gear)) and |
402 if (not CheckGearDrowning(Gear)) and |
401 ((Gear^.State and gstMoving) = 0) then |
403 ((Gear^.State and gstMoving) = 0) then |
402 begin |
404 if ((Gear^.State and gstAnimation) = 0) and |
403 Gear^.State:= 0; |
405 (prevState <> Gear^.State) then |
404 Gear^.Active:= false; |
406 begin |
405 AddGearCI(Gear); |
407 Gear^.State:= gstAnimation; |
406 exit |
408 Gear^.Timer:= 150 |
|
409 end else |
|
410 begin |
|
411 if Gear^.Timer = 0 then |
|
412 begin |
|
413 Gear^.State:= 0; |
|
414 Gear^.Active:= false; |
|
415 AddGearCI(Gear); |
|
416 exit |
|
417 end else dec(Gear^.Timer) |
407 end |
418 end |
408 end; |
419 end; |
409 |
420 |
410 //////////////////////////////////////////////////////////////////////////////// |
421 //////////////////////////////////////////////////////////////////////////////// |
411 procedure doStepHedgehog(Gear: PGear); |
422 procedure doStepHedgehog(Gear: PGear); |
414 begin |
425 begin |
415 DeleteGear(Gear); |
426 DeleteGear(Gear); |
416 exit |
427 exit |
417 end; |
428 end; |
418 if (Gear^.State and gstHHDriven) = 0 then doStepHedgehogFree(Gear) |
429 if (Gear^.State and gstHHDriven) = 0 then doStepHedgehogFree(Gear) |
419 else doStepHedgehogDriven(Gear) |
430 else doStepHedgehogDriven(Gear) |
420 end; |
431 end; |