255 procedure doStepDrowningGear(Gear: PGear); |
255 procedure doStepDrowningGear(Gear: PGear); |
256 begin |
256 begin |
257 AllInactive := false; |
257 AllInactive := false; |
258 Gear^.Y := Gear^.Y + cDrownSpeed; |
258 Gear^.Y := Gear^.Y + cDrownSpeed; |
259 Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed; |
259 Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed; |
260 if (not SuddenDeathDmg and (cWaterOpacity > $FE)) or (SuddenDeathDmg and (cSDWaterOpacity > $FE)) or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then |
|
261 DeleteGear(Gear); |
|
262 // Create some bubbles (0.5% might be better but causes too few bubbles sometimes) |
260 // Create some bubbles (0.5% might be better but causes too few bubbles sometimes) |
263 if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cSDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then |
261 if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cSDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then |
264 if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then |
262 if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then |
265 AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, |
263 AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble) |
266 vgtBubble) |
|
267 else if Random(12) = 0 then |
264 else if Random(12) = 0 then |
268 AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, |
265 AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble); |
269 vgtBubble) |
266 if (not SuddenDeathDmg and (cWaterOpacity > $FE)) or (SuddenDeathDmg and (cSDWaterOpacity > $FE)) or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then |
|
267 DeleteGear(Gear); |
270 end; |
268 end; |
271 |
269 |
272 //////////////////////////////////////////////////////////////////////////////// |
270 //////////////////////////////////////////////////////////////////////////////// |
273 procedure doStepFallingGear(Gear: PGear); |
271 procedure doStepFallingGear(Gear: PGear); |
274 var |
272 var |
794 |
792 |
795 if (GameTicks and $F) = 0 then |
793 if (GameTicks and $F) = 0 then |
796 begin |
794 begin |
797 if (GameTicks and $30) = 0 then |
795 if (GameTicks and $30) = 0 then |
798 AddVisualGear(gX, gY, vgtBeeTrace); |
796 AddVisualGear(gX, gY, vgtBeeTrace); |
799 Gear^.dX := Gear^.Elasticity * (Gear^.dX + _0_000064 * (TargetPoint.X - gX)); |
797 Gear^.dX := Gear^.Elasticity * (Gear^.dX + _0_000064 * (Gear^.TargetX - gX)); |
800 Gear^.dY := Gear^.Elasticity * (Gear^.dY + _0_000064 * (TargetPoint.Y - gY)); |
798 Gear^.dY := Gear^.Elasticity * (Gear^.dY + _0_000064 * (Gear^.TargetY - gY)); |
801 // 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) |
802 t := Gear^.Friction / Distance(Gear^.dX, Gear^.dY); |
800 t := Gear^.Friction / Distance(Gear^.dX, Gear^.dY); |
803 Gear^.dX := Gear^.dX * t; |
801 Gear^.dX := Gear^.dX * t; |
804 Gear^.dY := Gear^.dY * t; |
802 Gear^.dY := Gear^.dY * t; |
805 end; |
803 end; |
1366 State := (State or gstMoving) and not gstWinner; |
1364 State := (State or gstMoving) and not gstWinner; |
1367 end; |
1365 end; |
1368 DeleteGear(Gear) |
1366 DeleteGear(Gear) |
1369 end; |
1367 end; |
1370 |
1368 |
1371 procedure WaitCollision; |
1369 (*procedure WaitCollision; |
1372 begin |
1370 begin |
1373 with HHGear^ do |
1371 with HHGear^ do |
1374 begin |
1372 begin |
1375 Message := Message and not gmAttack; |
1373 Message := Message and not gmAttack; |
1376 State := State or gstMoving; |
1374 State := State or gstMoving; |
1377 end; |
1375 end; |
1378 RopePoints.Count := 0; |
1376 RopePoints.Count := 0; |
1379 Gear^.Elasticity := _0; |
1377 Gear^.Elasticity := _0; |
1380 Gear^.doStep := @doStepRopeAfterAttack |
1378 Gear^.doStep := @doStepRopeAfterAttack |
1381 end; |
1379 end;*) |
1382 |
1380 |
1383 begin |
1381 begin |
1384 HHGear := Gear^.Hedgehog^.Gear; |
1382 HHGear := Gear^.Hedgehog^.Gear; |
1385 |
1383 |
1386 if ((HHGear^.State and gstHHDriven) = 0) |
1384 if ((HHGear^.State and gstHHDriven) = 0) |
2417 Gear^.Tag := -1; |
2415 Gear^.Tag := -1; |
2418 Gear^.X := int2hwFloat(LAND_WIDTH + 2048); |
2416 Gear^.X := int2hwFloat(LAND_WIDTH + 2048); |
2419 end; |
2417 end; |
2420 |
2418 |
2421 Gear^.Y := int2hwFloat(topY-300); |
2419 Gear^.Y := int2hwFloat(topY-300); |
2422 Gear^.dX := int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15); |
2420 Gear^.dX := int2hwFloat(Gear^.TargetX - 5 * Gear^.Tag * 15); |
2423 |
2421 |
2424 // 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) |
2425 if (Gear^.State = 2) then |
2423 if (Gear^.State = 2) then |
2426 Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 900 |
2424 Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 900 |
2427 // calcs for regular falling gears |
2425 // calcs for regular falling gears |
2428 else if (int2hwFloat(TargetPoint.Y) - Gear^.Y > _0) then |
2426 else if (int2hwFloat(Gear^.TargetY) - Gear^.Y > _0) then |
2429 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 / |
2430 cGravity) * Gear^.Tag; |
2428 cGravity) * Gear^.Tag; |
2431 |
2429 |
2432 Gear^.Health := 6; |
2430 Gear^.Health := 6; |
2433 Gear^.doStep := @doStepAirAttackWork; |
2431 Gear^.doStep := @doStepAirAttackWork; |
2434 Gear^.SoundChannel := LoopSound(sndPlane, 4000); |
2432 Gear^.SoundChannel := LoopSound(sndPlane, 4000); |
2460 x, y, tx, ty: hwFloat; |
2458 x, y, tx, ty: hwFloat; |
2461 begin |
2459 begin |
2462 AllInactive := false; |
2460 AllInactive := false; |
2463 |
2461 |
2464 HHGear := Gear^.Hedgehog^.Gear; |
2462 HHGear := Gear^.Hedgehog^.Gear; |
2465 tx := int2hwFloat(TargetPoint.X); |
2463 tx := int2hwFloat(Gear^.TargetX); |
2466 ty := int2hwFloat(TargetPoint.Y); |
2464 ty := int2hwFloat(Gear^.TargetY); |
2467 x := HHGear^.X; |
2465 x := HHGear^.X; |
2468 y := HHGear^.Y; |
2466 y := HHGear^.Y; |
2469 |
2467 |
2470 if (Distance(tx - x, ty - y) > _256) or |
2468 if (Distance(tx - x, ty - y) > _256) or |
2471 not TryPlaceOnLand(TargetPoint.X - SpritesData[sprAmGirder].Width div 2, |
2469 not TryPlaceOnLand(Gear^.TargetX - SpritesData[sprAmGirder].Width div 2, |
2472 TargetPoint.Y - SpritesData[sprAmGirder].Height div 2, |
2470 Gear^.TargetY - SpritesData[sprAmGirder].Height div 2, |
2473 sprAmGirder, Gear^.State, true, false) then |
2471 sprAmGirder, Gear^.State, true, false) then |
2474 begin |
2472 begin |
2475 PlaySound(sndDenied); |
2473 PlaySound(sndDenied); |
2476 HHGear^.Message := HHGear^.Message and not gmAttack; |
2474 HHGear^.Message := HHGear^.Message and not gmAttack; |
2477 HHGear^.State := HHGear^.State and not gstAttacking; |
2475 HHGear^.State := HHGear^.State and not gstAttacking; |
2486 AfterAttack; |
2484 AfterAttack; |
2487 end; |
2485 end; |
2488 |
2486 |
2489 HHGear^.State := HHGear^.State and not (gstAttacking or gstAttacked); |
2487 HHGear^.State := HHGear^.State and not (gstAttacking or gstAttacked); |
2490 HHGear^.Message := HHGear^.Message and not gmAttack; |
2488 HHGear^.Message := HHGear^.Message and not gmAttack; |
2491 TargetPoint.X := NoPointX |
|
2492 end; |
2489 end; |
2493 |
2490 |
2494 //////////////////////////////////////////////////////////////////////////////// |
2491 //////////////////////////////////////////////////////////////////////////////// |
2495 procedure doStepTeleportAfter(Gear: PGear); |
2492 procedure doStepTeleportAfter(Gear: PGear); |
2496 var |
2493 var |
2527 HHGear: PGear; |
2524 HHGear: PGear; |
2528 begin |
2525 begin |
2529 AllInactive := false; |
2526 AllInactive := false; |
2530 |
2527 |
2531 HHGear := Gear^.Hedgehog^.Gear; |
2528 HHGear := Gear^.Hedgehog^.Gear; |
2532 if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2, |
2529 if not TryPlaceOnLand(Gear^.TargetX - SpritesData[sprHHTelepMask].Width div 2, |
2533 TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2, |
2530 Gear^.TargetY - SpritesData[sprHHTelepMask].Height div 2, |
2534 sprHHTelepMask, 0, false, false) then |
2531 sprHHTelepMask, 0, false, false) then |
2535 begin |
2532 begin |
2536 HHGear^.Message := HHGear^.Message and not gmAttack; |
2533 HHGear^.Message := HHGear^.Message and not gmAttack; |
2537 HHGear^.State := HHGear^.State and not gstAttacking; |
2534 HHGear^.State := HHGear^.State and not gstAttacking; |
2538 HHGear^.State := HHGear^.State or gstHHChooseTarget; |
2535 HHGear^.State := HHGear^.State or gstHHChooseTarget; |
2550 Gear^.dX := HHGear^.dX; |
2547 Gear^.dX := HHGear^.dX; |
2551 // 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) |
2552 HHGear^.dX.isNegative := (Gear^.X.QWordValue <> 0); |
2549 HHGear^.dX.isNegative := (Gear^.X.QWordValue <> 0); |
2553 Gear^.X := HHGear^.X; |
2550 Gear^.X := HHGear^.X; |
2554 Gear^.Y := HHGear^.Y; |
2551 Gear^.Y := HHGear^.Y; |
2555 HHGear^.X := int2hwFloat(TargetPoint.X); |
2552 HHGear^.X := int2hwFloat(Gear^.TargetX); |
2556 HHGear^.Y := int2hwFloat(TargetPoint.Y); |
2553 HHGear^.Y := int2hwFloat(Gear^.TargetY); |
2557 HHGear^.State := HHGear^.State or gstMoving; |
2554 HHGear^.State := HHGear^.State or gstMoving; |
2558 playSound(sndWarp) |
2555 playSound(sndWarp) |
2559 end; |
2556 end; |
2560 TargetPoint.X := NoPointX; |
2557 Gear^.TargetX:= NoPointX |
2561 end; |
2558 end; |
2562 |
2559 |
2563 //////////////////////////////////////////////////////////////////////////////// |
2560 //////////////////////////////////////////////////////////////////////////////// |
2564 procedure doStepSwitcherWork(Gear: PGear); |
2561 procedure doStepSwitcherWork(Gear: PGear); |
2565 var |
2562 var |
2943 end; |
2940 end; |
2944 |
2941 |
2945 //////////////////////////////////////////////////////////////////////////////// |
2942 //////////////////////////////////////////////////////////////////////////////// |
2946 procedure doStepSeductionWork(Gear: PGear); |
2943 procedure doStepSeductionWork(Gear: PGear); |
2947 var |
2944 var |
2948 x, y: LongInt; |
2945 x, y, i: LongInt; |
2949 begin |
2946 hogs: TPGearArray; |
2950 AllInactive := false; |
2947 d: hwFloat; |
2951 |
2948 begin |
|
2949 AllInactive := false; |
|
2950 hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Radius); |
|
2951 if Length(hogs) > 0 then |
|
2952 begin |
|
2953 for i:= 0 to High(hogs) do |
|
2954 begin |
|
2955 //d:= Distance(Gear^.X - hogs[i]^.X, Gear^.Y - hogs[i]^.Y); |
|
2956 hogs[i]^.dX:= _0_25 * (Gear^.X - hogs[i]^.X) / _250; |
|
2957 //if Gear^.X < hogs[i]^.X then hogs[i]^.dX.isNegative:= true; |
|
2958 hogs[i]^.dY:= -_0_25; |
|
2959 hogs[i]^.Active:= true; |
|
2960 end; |
|
2961 end ; |
|
2962 AfterAttack; |
|
2963 DeleteGear(Gear); |
|
2964 (* |
2952 Gear^.X := Gear^.X + Gear^.dX; |
2965 Gear^.X := Gear^.X + Gear^.dX; |
2953 Gear^.Y := Gear^.Y + Gear^.dY; |
2966 Gear^.Y := Gear^.Y + Gear^.dY; |
2954 x := hwRound(Gear^.X); |
2967 x := hwRound(Gear^.X); |
2955 y := hwRound(Gear^.Y); |
2968 y := hwRound(Gear^.Y); |
2956 |
2969 |
2990 end; |
3003 end; |
2991 |
3004 |
2992 procedure doStepSeduction(Gear: PGear); |
3005 procedure doStepSeduction(Gear: PGear); |
2993 begin |
3006 begin |
2994 AllInactive := false; |
3007 AllInactive := false; |
2995 DeleteCI(Gear^.Hedgehog^.Gear); |
3008 //DeleteCI(Gear^.Hedgehog^.Gear); |
2996 Gear^.doStep := @doStepSeductionWear |
3009 Gear^.doStep := @doStepSeductionWear |
2997 end; |
3010 end; |
2998 |
3011 |
2999 //////////////////////////////////////////////////////////////////////////////// |
3012 //////////////////////////////////////////////////////////////////////////////// |
3000 procedure doStepWaterUp(Gear: PGear); |
3013 procedure doStepWaterUp(Gear: PGear); |