792 |
792 |
793 if (GameTicks and $F) = 0 then |
793 if (GameTicks and $F) = 0 then |
794 begin |
794 begin |
795 if (GameTicks and $30) = 0 then |
795 if (GameTicks and $30) = 0 then |
796 AddVisualGear(gX, gY, vgtBeeTrace); |
796 AddVisualGear(gX, gY, vgtBeeTrace); |
797 Gear^.dX := Gear^.Elasticity * (Gear^.dX + _0_000064 * (TargetPoint.X - gX)); |
797 Gear^.dX := Gear^.Elasticity * (Gear^.dX + _0_000064 * (Gear^.TargetX - gX)); |
798 Gear^.dY := Gear^.Elasticity * (Gear^.dY + _0_000064 * (TargetPoint.Y - gY)); |
798 Gear^.dY := Gear^.Elasticity * (Gear^.dY + _0_000064 * (Gear^.TargetY - gY)); |
799 // make sure new speed isn't higher than original one (which we stored in Friction variable) |
799 // make sure new speed isn't higher than original one (which we stored in Friction variable) |
800 t := Gear^.Friction / Distance(Gear^.dX, Gear^.dY); |
800 t := Gear^.Friction / Distance(Gear^.dX, Gear^.dY); |
801 Gear^.dX := Gear^.dX * t; |
801 Gear^.dX := Gear^.dX * t; |
802 Gear^.dY := Gear^.dY * t; |
802 Gear^.dY := Gear^.dY * t; |
803 end; |
803 end; |
2415 Gear^.Tag := -1; |
2415 Gear^.Tag := -1; |
2416 Gear^.X := int2hwFloat(LAND_WIDTH + 2048); |
2416 Gear^.X := int2hwFloat(LAND_WIDTH + 2048); |
2417 end; |
2417 end; |
2418 |
2418 |
2419 Gear^.Y := int2hwFloat(topY-300); |
2419 Gear^.Y := int2hwFloat(topY-300); |
2420 Gear^.dX := int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15); |
2420 Gear^.dX := int2hwFloat(Gear^.TargetX - 5 * Gear^.Tag * 15); |
2421 |
2421 |
2422 // calcs for Napalm Strike, so that it will hit the target (without wind at least :P) |
2422 // calcs for Napalm Strike, so that it will hit the target (without wind at least :P) |
2423 if (Gear^.State = 2) then |
2423 if (Gear^.State = 2) then |
2424 Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 900 |
2424 Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 900 |
2425 // calcs for regular falling gears |
2425 // calcs for regular falling gears |
2426 else if (int2hwFloat(TargetPoint.Y) - Gear^.Y > _0) then |
2426 else if (int2hwFloat(Gear^.TargetY) - Gear^.Y > _0) then |
2427 Gear^.dX := Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(TargetPoint.Y) - Gear^.Y) * 2 / |
2427 Gear^.dX := Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(Gear^.TargetY) - Gear^.Y) * 2 / |
2428 cGravity) * Gear^.Tag; |
2428 cGravity) * Gear^.Tag; |
2429 |
2429 |
2430 Gear^.Health := 6; |
2430 Gear^.Health := 6; |
2431 Gear^.doStep := @doStepAirAttackWork; |
2431 Gear^.doStep := @doStepAirAttackWork; |
2432 Gear^.SoundChannel := LoopSound(sndPlane, 4000); |
2432 Gear^.SoundChannel := LoopSound(sndPlane, 4000); |
2458 x, y, tx, ty: hwFloat; |
2458 x, y, tx, ty: hwFloat; |
2459 begin |
2459 begin |
2460 AllInactive := false; |
2460 AllInactive := false; |
2461 |
2461 |
2462 HHGear := Gear^.Hedgehog^.Gear; |
2462 HHGear := Gear^.Hedgehog^.Gear; |
2463 tx := int2hwFloat(TargetPoint.X); |
2463 tx := int2hwFloat(Gear^.TargetX); |
2464 ty := int2hwFloat(TargetPoint.Y); |
2464 ty := int2hwFloat(Gear^.TargetY); |
2465 x := HHGear^.X; |
2465 x := HHGear^.X; |
2466 y := HHGear^.Y; |
2466 y := HHGear^.Y; |
2467 |
2467 |
2468 if (Distance(tx - x, ty - y) > _256) or |
2468 if (Distance(tx - x, ty - y) > _256) or |
2469 not TryPlaceOnLand(TargetPoint.X - SpritesData[sprAmGirder].Width div 2, |
2469 not TryPlaceOnLand(Gear^.TargetX - SpritesData[sprAmGirder].Width div 2, |
2470 TargetPoint.Y - SpritesData[sprAmGirder].Height div 2, |
2470 Gear^.TargetY - SpritesData[sprAmGirder].Height div 2, |
2471 sprAmGirder, Gear^.State, true, false) then |
2471 sprAmGirder, Gear^.State, true, false) then |
2472 begin |
2472 begin |
2473 PlaySound(sndDenied); |
2473 PlaySound(sndDenied); |
2474 HHGear^.Message := HHGear^.Message and not gmAttack; |
2474 HHGear^.Message := HHGear^.Message and not gmAttack; |
2475 HHGear^.State := HHGear^.State and not gstAttacking; |
2475 HHGear^.State := HHGear^.State and not gstAttacking; |
2484 AfterAttack; |
2484 AfterAttack; |
2485 end; |
2485 end; |
2486 |
2486 |
2487 HHGear^.State := HHGear^.State and not (gstAttacking or gstAttacked); |
2487 HHGear^.State := HHGear^.State and not (gstAttacking or gstAttacked); |
2488 HHGear^.Message := HHGear^.Message and not gmAttack; |
2488 HHGear^.Message := HHGear^.Message and not gmAttack; |
2489 TargetPoint.X := NoPointX |
|
2490 end; |
2489 end; |
2491 |
2490 |
2492 //////////////////////////////////////////////////////////////////////////////// |
2491 //////////////////////////////////////////////////////////////////////////////// |
2493 procedure doStepTeleportAfter(Gear: PGear); |
2492 procedure doStepTeleportAfter(Gear: PGear); |
2494 var |
2493 var |
2525 HHGear: PGear; |
2524 HHGear: PGear; |
2526 begin |
2525 begin |
2527 AllInactive := false; |
2526 AllInactive := false; |
2528 |
2527 |
2529 HHGear := Gear^.Hedgehog^.Gear; |
2528 HHGear := Gear^.Hedgehog^.Gear; |
2530 if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2, |
2529 if not TryPlaceOnLand(Gear^.TargetX - SpritesData[sprHHTelepMask].Width div 2, |
2531 TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2, |
2530 Gear^.TargetY - SpritesData[sprHHTelepMask].Height div 2, |
2532 sprHHTelepMask, 0, false, false) then |
2531 sprHHTelepMask, 0, false, false) then |
2533 begin |
2532 begin |
2534 HHGear^.Message := HHGear^.Message and not gmAttack; |
2533 HHGear^.Message := HHGear^.Message and not gmAttack; |
2535 HHGear^.State := HHGear^.State and not gstAttacking; |
2534 HHGear^.State := HHGear^.State and not gstAttacking; |
2536 HHGear^.State := HHGear^.State or gstHHChooseTarget; |
2535 HHGear^.State := HHGear^.State or gstHHChooseTarget; |
2548 Gear^.dX := HHGear^.dX; |
2547 Gear^.dX := HHGear^.dX; |
2549 // retrieve the cursor direction (it was previously copied to X so it doesn't get lost) |
2548 // retrieve the cursor direction (it was previously copied to X so it doesn't get lost) |
2550 HHGear^.dX.isNegative := (Gear^.X.QWordValue <> 0); |
2549 HHGear^.dX.isNegative := (Gear^.X.QWordValue <> 0); |
2551 Gear^.X := HHGear^.X; |
2550 Gear^.X := HHGear^.X; |
2552 Gear^.Y := HHGear^.Y; |
2551 Gear^.Y := HHGear^.Y; |
2553 HHGear^.X := int2hwFloat(TargetPoint.X); |
2552 HHGear^.X := int2hwFloat(Gear^.TargetX); |
2554 HHGear^.Y := int2hwFloat(TargetPoint.Y); |
2553 HHGear^.Y := int2hwFloat(Gear^.TargetY); |
2555 HHGear^.State := HHGear^.State or gstMoving; |
2554 HHGear^.State := HHGear^.State or gstMoving; |
2556 playSound(sndWarp) |
2555 playSound(sndWarp) |
2557 end; |
2556 end; |
2558 TargetPoint.X := NoPointX; |
2557 Gear^.TargetX:= NoPointX |
2559 end; |
2558 end; |
2560 |
2559 |
2561 //////////////////////////////////////////////////////////////////////////////// |
2560 //////////////////////////////////////////////////////////////////////////////// |
2562 procedure doStepSwitcherWork(Gear: PGear); |
2561 procedure doStepSwitcherWork(Gear: PGear); |
2563 var |
2562 var |