2036 if ((Gear^.State and gstWait) <> 0) |
2034 if ((Gear^.State and gstWait) <> 0) |
2037 or (cMineDudPercent = 0) |
2035 or (cMineDudPercent = 0) |
2038 or (getRandom(100) > cMineDudPercent) then |
2036 or (getRandom(100) > cMineDudPercent) then |
2039 begin |
2037 begin |
2040 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
2038 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
2041 DeleteGear(Gear) |
2039 DeleteGear(Gear); |
|
2040 exit // redundant but we've had too many delete gear bugs |
2042 end |
2041 end |
2043 else |
2042 else |
2044 begin |
2043 begin |
2045 vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
2044 vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
2046 if vg <> nil then |
2045 if vg <> nil then |
2079 // Remove land created by frozen air mine sprite pixel-perfectly |
2078 // Remove land created by frozen air mine sprite pixel-perfectly |
2080 EraseLand( |
2079 EraseLand( |
2081 hwRound(Gear^.X) - SpritesData[sprFrozenAirMine].Width div 2, |
2080 hwRound(Gear^.X) - SpritesData[sprFrozenAirMine].Width div 2, |
2082 hwRound(Gear^.Y) - SpritesData[sprFrozenAirMine].Height div 2, |
2081 hwRound(Gear^.Y) - SpritesData[sprFrozenAirMine].Height div 2, |
2083 sprFrozenAirMine, 0, 0, false, false, false, false); |
2082 sprFrozenAirMine, 0, 0, false, false, false, false); |
2084 DeleteGear(Gear) |
2083 DeleteGear(Gear); |
|
2084 exit |
2085 end; |
2085 end; |
2086 doStepFallingGear(Gear); |
2086 doStepFallingGear(Gear); |
2087 exit |
2087 exit |
2088 end; |
2088 end; |
2089 isUnderwater:= CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y) + Gear^.Radius); |
2089 isUnderwater:= CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y) + Gear^.Radius); |
2459 begin |
2459 begin |
2460 x := hwRound(Gear^.X); |
2460 x := hwRound(Gear^.X); |
2461 y := hwRound(Gear^.Y); |
2461 y := hwRound(Gear^.Y); |
2462 hog:= Gear^.Hedgehog; |
2462 hog:= Gear^.Hedgehog; |
2463 |
2463 |
2464 DeleteGear(Gear); |
|
2465 // <-- delete gear! |
|
2466 |
|
2467 if k = gtCase then |
2464 if k = gtCase then |
2468 begin |
2465 begin |
2469 doMakeExplosion(x, y, Gear^.Boom, hog, EXPLAutoSound); |
2466 doMakeExplosion(x, y, Gear^.Boom, hog, EXPLAutoSound); |
2470 for i:= 0 to 63 do |
2467 for i:= 0 to 63 do |
2471 AddGear(x, y, gtFlame, 0, _0, _0, 0); |
2468 AddGear(x, y, gtFlame, 0, _0, _0, 0); |
2472 end |
2469 end |
2473 else if k = gtTarget then |
2470 else if k = gtTarget then |
2474 uStats.TargetHit() |
2471 uStats.TargetHit() |
2475 else if k = gtExplosives then |
2472 else if k = gtExplosives then |
2476 begin |
2473 begin |
2477 doMakeExplosion(x, y, Gear^.Boom, hog, EXPLAutoSound); |
2474 doMakeExplosion(x, y, Gear^.Boom, hog, EXPLAutoSound); |
2478 for i:= 0 to 31 do |
2475 for i:= 0 to 31 do |
2479 begin |
2476 begin |
2480 dX := AngleCos(i * 64) * _0_5 * (getrandomf + _1); |
2477 dX := AngleCos(i * 64) * _0_5 * (getrandomf + _1); |
2481 dY := AngleSin(i * 64) * _0_5 * (getrandomf + _1); |
2478 dY := AngleSin(i * 64) * _0_5 * (getrandomf + _1); |
2482 AddGear(x, y, gtFlame, 0, dX, dY, 0); |
2479 AddGear(x, y, gtFlame, 0, dX, dY, 0); |
2483 AddGear(x, y, gtFlame, gstTmpFlag, -dX, -dY, 0); |
2480 AddGear(x, y, gtFlame, gstTmpFlag, -dX, -dY, 0); |
2484 end |
2481 end |
2485 end; |
2482 end; |
2486 exit |
2483 DeleteGear(Gear); |
|
2484 exit |
2487 end; |
2485 end; |
2488 |
2486 |
2489 if k = gtExplosives then |
2487 if k = gtExplosives then |
2490 begin |
2488 begin |
2491 //if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation; |
2489 //if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation; |
2860 else |
2858 else |
2861 for i:= Random(3) downto 0 do |
2859 for i:= Random(3) downto 0 do |
2862 AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
2860 AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
2863 |
2861 |
2864 DeleteGear(Gear) |
2862 DeleteGear(Gear) |
2865 end; |
2863 end |
2866 end; |
2864 end; |
2867 |
2865 |
2868 //////////////////////////////////////////////////////////////////////////////// |
2866 //////////////////////////////////////////////////////////////////////////////// |
2869 procedure doStepFirePunchWork(Gear: PGear); |
2867 procedure doStepFirePunchWork(Gear: PGear); |
2870 var |
2868 var |
2953 Message := 0; |
2951 Message := 0; |
2954 SetLittle(dX); |
2952 SetLittle(dX); |
2955 dY := _0; |
2953 dY := _0; |
2956 State := State or gstMoving; |
2954 State := State or gstMoving; |
2957 end; |
2955 end; |
2958 DeleteGear(Gear); |
|
2959 if (GetAmmoEntry(HHGear^.Hedgehog^, amParachute)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and (HHGear^.Hedgehog^.MultiShootAttacks = 0) then |
2956 if (GetAmmoEntry(HHGear^.Hedgehog^, amParachute)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and (HHGear^.Hedgehog^.MultiShootAttacks = 0) then |
2960 HHGear^.Hedgehog^.CurAmmoType:= amParachute; |
2957 HHGear^.Hedgehog^.CurAmmoType:= amParachute; |
2961 isCursorVisible := false; |
2958 isCursorVisible := false; |
2962 ApplyAmmoChanges(HHGear^.Hedgehog^); |
2959 ApplyAmmoChanges(HHGear^.Hedgehog^); |
|
2960 DeleteGear(Gear); |
2963 exit |
2961 exit |
2964 end; |
2962 end; |
2965 |
2963 |
2966 HHGear^.X := HHGear^.X + cWindSpeed * 200; |
2964 HHGear^.X := HHGear^.X + cWindSpeed * 200; |
2967 |
2965 |
3037 if (hwRound(Gear^.X) > (max(LAND_WIDTH,4096)+2048)) or (hwRound(Gear^.X) < -2048) then |
3035 if (hwRound(Gear^.X) > (max(LAND_WIDTH,4096)+2048)) or (hwRound(Gear^.X) < -2048) then |
3038 begin |
3036 begin |
3039 // avoid to play forever (is this necessary?) |
3037 // avoid to play forever (is this necessary?) |
3040 StopSoundChan(Gear^.SoundChannel); |
3038 StopSoundChan(Gear^.SoundChannel); |
3041 DeleteGear(Gear) |
3039 DeleteGear(Gear) |
3042 end; |
3040 end |
3043 end; |
3041 end; |
3044 |
3042 |
3045 procedure doStepAirAttack(Gear: PGear); |
3043 procedure doStepAirAttack(Gear: PGear); |
3046 begin |
3044 begin |
3047 AllInactive := false; |
3045 AllInactive := false; |
3080 AllInactive := false; |
3078 AllInactive := false; |
3081 doStepFallingGear(Gear); |
3079 doStepFallingGear(Gear); |
3082 if (Gear^.State and gstCollision) <> 0 then |
3080 if (Gear^.State and gstCollision) <> 0 then |
3083 begin |
3081 begin |
3084 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3082 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3085 DeleteGear(Gear); |
|
3086 {$IFNDEF PAS2C} |
3083 {$IFNDEF PAS2C} |
3087 with mobileRecord do |
3084 with mobileRecord do |
3088 if (performRumble <> nil) and (not fastUntilLag) then |
3085 if (performRumble <> nil) and (not fastUntilLag) then |
3089 performRumble(kSystemSoundID_Vibrate); |
3086 performRumble(kSystemSoundID_Vibrate); |
3090 {$ENDIF} |
3087 {$ENDIF} |
|
3088 DeleteGear(Gear); |
3091 exit |
3089 exit |
3092 end; |
3090 end; |
3093 if (GameTicks and $3F) = 0 then |
3091 if (GameTicks and $3F) = 0 then |
3094 AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace) |
3092 AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace) |
3095 end; |
3093 end; |
3276 |
3275 |
3277 if ((Gear^.Message and (not (gmSwitch or gmPrecise))) <> 0) or (TurnTimeLeft = 0) then |
3276 if ((Gear^.Message and (not (gmSwitch or gmPrecise))) <> 0) or (TurnTimeLeft = 0) then |
3278 begin |
3277 begin |
3279 hedgehog := Gear^.Hedgehog; |
3278 hedgehog := Gear^.Hedgehog; |
3280 //Msg := Gear^.Message and (not gmSwitch); |
3279 //Msg := Gear^.Message and (not gmSwitch); |
3281 DeleteGear(Gear); |
|
3282 ApplyAmmoChanges(hedgehog^); |
3280 ApplyAmmoChanges(hedgehog^); |
3283 |
3281 |
3284 HHGear := CurrentHedgehog^.Gear; |
3282 HHGear := CurrentHedgehog^.Gear; |
3285 ApplyAmmoChanges(HHGear^.Hedgehog^); |
3283 ApplyAmmoChanges(HHGear^.Hedgehog^); |
3286 //HHGear^.Message := Msg; |
3284 //HHGear^.Message := Msg; |
|
3285 DeleteGear(Gear); |
3287 exit |
3286 exit |
3288 end; |
3287 end; |
3289 |
3288 |
3290 if (Gear^.Message and gmSwitch) <> 0 then |
3289 if (Gear^.Message and gmSwitch) <> 0 then |
3291 begin |
3290 begin |
4485 begin |
4484 begin |
4486 Message := 0; |
4485 Message := 0; |
4487 Active := true; |
4486 Active := true; |
4488 State := State or gstMoving |
4487 State := State or gstMoving |
4489 end; |
4488 end; |
4490 DeleteGear(Gear); |
|
4491 if (GetAmmoEntry(HHGear^.Hedgehog^, amJetpack)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and (HHGear^.Hedgehog^.MultiShootAttacks = 0) then |
4489 if (GetAmmoEntry(HHGear^.Hedgehog^, amJetpack)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and (HHGear^.Hedgehog^.MultiShootAttacks = 0) then |
4492 HHGear^.Hedgehog^.CurAmmoType:= amJetpack; |
4490 HHGear^.Hedgehog^.CurAmmoType:= amJetpack; |
4493 isCursorVisible := false; |
4491 isCursorVisible := false; |
4494 ApplyAmmoChanges(HHGear^.Hedgehog^); |
4492 ApplyAmmoChanges(HHGear^.Hedgehog^); |
4495 // if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); |
4493 // if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); |
4496 |
4494 |
4497 // Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall) |
4495 // Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall) |
4498 |
4496 |
4499 //AddCaption(trmsg[sidFuel]+': '+inttostr(round(Gear^.Health/20))+'%', cWhiteColor, capgrpAmmostate); |
4497 //AddCaption(trmsg[sidFuel]+': '+inttostr(round(Gear^.Health/20))+'%', cWhiteColor, capgrpAmmostate); |
|
4498 DeleteGear(Gear); |
4500 end |
4499 end |
4501 end; |
4500 end; |
4502 |
4501 |
4503 procedure doStepJetpack(Gear: PGear); |
4502 procedure doStepJetpack(Gear: PGear); |
4504 var |
4503 var |