equal
deleted
inserted
replaced
323 begin |
323 begin |
324 collV := -1; |
324 collV := -1; |
325 if land and lfIce <> 0 then |
325 if land and lfIce <> 0 then |
326 Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1) |
326 Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1) |
327 else Gear^.dX := Gear^.dX * Gear^.Friction; |
327 else Gear^.dX := Gear^.dX * Gear^.Friction; |
328 if land and lfBouncy = 0 then |
328 if (Gear^.AdvBounce = 0) or (land and lfBouncy = 0) then |
329 begin |
329 begin |
330 Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
330 Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
331 Gear^.State := Gear^.State or gstCollision |
331 Gear^.State := Gear^.State or gstCollision |
332 end |
332 end |
333 else Gear^.dY := - Gear^.dY * cElastic |
333 else Gear^.dY := - Gear^.dY * cElastic |
348 if land and lfIce <> 0 then |
348 if land and lfIce <> 0 then |
349 Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1) |
349 Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1) |
350 else |
350 else |
351 Gear^.dX := Gear^.dX * Gear^.Friction; |
351 Gear^.dX := Gear^.dX * Gear^.Friction; |
352 |
352 |
353 if land and lfBouncy = 0 then |
353 if (Gear^.AdvBounce = 0) or (land and lfBouncy = 0) then |
354 begin |
354 begin |
355 Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
355 Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
356 Gear^.State := Gear^.State or gstCollision |
356 Gear^.State := Gear^.State or gstCollision |
357 end |
357 end |
358 else Gear^.dY := - Gear^.dY * cElastic |
358 else Gear^.dY := - Gear^.dY * cElastic |
371 |
371 |
372 xland:= TestCollisionXwithGear(Gear, hwSign(Gear^.dX)); |
372 xland:= TestCollisionXwithGear(Gear, hwSign(Gear^.dX)); |
373 if xland <> 0 then |
373 if xland <> 0 then |
374 begin |
374 begin |
375 collH := hwSign(Gear^.dX); |
375 collH := hwSign(Gear^.dX); |
376 if xland and lfBouncy = 0 then |
376 if (Gear^.AdvBounce = 0) or (xland and lfBouncy = 0) then |
377 begin |
377 begin |
378 Gear^.dX := - Gear^.dX * Gear^.Elasticity; |
378 Gear^.dX := - Gear^.dX * Gear^.Elasticity; |
379 Gear^.dY := Gear^.dY * Gear^.Elasticity; |
379 Gear^.dY := Gear^.dY * Gear^.Elasticity; |
380 Gear^.State := Gear^.State or gstCollision |
380 Gear^.State := Gear^.State or gstCollision |
381 end |
381 end |
390 xland:= TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)); |
390 xland:= TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)); |
391 if xland <> 0 then collH := -hwSign(Gear^.dX) |
391 if xland <> 0 then collH := -hwSign(Gear^.dX) |
392 end; |
392 end; |
393 //if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then |
393 //if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then |
394 if (collV <> 0) and (collH <> 0) and |
394 if (collV <> 0) and (collH <> 0) and |
395 (((Gear^.AdvBounce=1) and ((collV=-1) or ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue))) or |
395 (((Gear^.AdvBounce=1) and ((collV=-1) or ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue)))) then |
396 ((xland or land) and lfBouncy <> 0)) then |
396 //or ((xland or land) and lfBouncy <> 0)) then |
397 begin |
397 begin |
398 if (xland or land) and lfBouncy = 0 then |
398 if (xland or land) and lfBouncy = 0 then |
399 begin |
399 begin |
400 Gear^.dX := tdY*Gear^.Elasticity*Gear^.Friction; |
400 Gear^.dX := tdY*Gear^.Elasticity*Gear^.Friction; |
401 Gear^.dY := tdX*Gear^.Elasticity |
401 Gear^.dY := tdX*Gear^.Elasticity |
428 if (not isFalling) and ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_02.QWordValue) then |
428 if (not isFalling) and ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_02.QWordValue) then |
429 Gear^.State := Gear^.State and (not gstMoving) |
429 Gear^.State := Gear^.State and (not gstMoving) |
430 else |
430 else |
431 Gear^.State := Gear^.State or gstMoving; |
431 Gear^.State := Gear^.State or gstMoving; |
432 |
432 |
433 if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_1.QWordValue) and (Gear^.dY.QWordValue < _0_1.QWordValue) then |
433 if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_15.QWordValue) and (Gear^.dY.QWordValue < _0_15.QWordValue) then |
434 Gear^.State := Gear^.State or gstCollision; |
434 Gear^.State := Gear^.State or gstCollision; |
435 |
435 |
436 if ((xland or land) and lfBouncy <> 0) and |
436 if ((xland or land) and lfBouncy <> 0) and |
437 (((Gear^.Radius < 3) and (Gear^.dY < -_0_1)) or |
437 (((Gear^.Radius < 3) and (Gear^.dY < -_0_1)) or |
438 ((Gear^.Radius >= 3) and |
438 ((Gear^.Radius >= 3) and |
1695 Gear^.State := Gear^.State or gsttmpFlag; |
1695 Gear^.State := Gear^.State or gsttmpFlag; |
1696 end; |
1696 end; |
1697 |
1697 |
1698 //////////////////////////////////////////////////////////////////////////////// |
1698 //////////////////////////////////////////////////////////////////////////////// |
1699 procedure doStepSMine(Gear: PGear); |
1699 procedure doStepSMine(Gear: PGear); |
|
1700 var land: Word; |
1700 begin |
1701 begin |
1701 // TODO: do real calculation? |
1702 // TODO: do real calculation? |
1702 if (TestCollisionXwithGear(Gear, 2) <> 0) |
1703 land:= TestCollisionXwithGear(Gear, 2); |
1703 or (TestCollisionYwithGear(Gear,-2) <> 0) |
1704 if land = 0 then land:= TestCollisionYwithGear(Gear,-2); |
1704 or (TestCollisionXwithGear(Gear,-2) <> 0) |
1705 if land = 0 then land:= TestCollisionXwithGear(Gear,-2); |
1705 or (TestCollisionYwithGear(Gear, 2) <> 0) then |
1706 if land = 0 then land:= TestCollisionYwithGear(Gear, 2); |
|
1707 if (land <> 0) and (land and lfBouncy = 0) then |
1706 begin |
1708 begin |
1707 if (not isZero(Gear^.dX)) or (not isZero(Gear^.dY)) then |
1709 if (not isZero(Gear^.dX)) or (not isZero(Gear^.dY)) then |
1708 begin |
1710 begin |
1709 PlaySound(sndRopeAttach); |
1711 PlaySound(sndRopeAttach); |
1710 Gear^.dX:= _0; |
1712 Gear^.dX:= _0; |