154 Gear^.doStep := @doStepDrowningGear; |
154 Gear^.doStep := @doStepDrowningGear; |
155 Gear^.State := Gear^.State and (not gstHHDriven); |
155 Gear^.State := Gear^.State and (not gstHHDriven); |
156 AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); |
156 AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); |
157 end |
157 end |
158 end |
158 end |
159 else if Gear^.Kind = gtFlake then |
159 else Gear^.doStep := @doStepDrowningGear; |
160 begin |
160 if Gear^.Kind = gtFlake then exit // skip splashes |
161 DeleteGear(Gear); |
|
162 exit |
|
163 end |
|
164 else Gear^.doStep := @doStepDrowningGear |
|
165 end; |
161 end; |
166 if ((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius)) or |
162 if ((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius)) or |
167 (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01))) then |
163 (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01))) then |
168 // don't play splash if they are already way past the surface |
164 // don't play splash if they are already way past the surface |
169 PlaySound(sndSplash) |
165 PlaySound(sndSplash) |
359 (not isFalling) then |
355 (not isFalling) then |
360 Gear^.State := Gear^.State and not gstMoving |
356 Gear^.State := Gear^.State and not gstMoving |
361 else |
357 else |
362 Gear^.State := Gear^.State or gstMoving; |
358 Gear^.State := Gear^.State or gstMoving; |
363 |
359 |
364 if (Gear^.nImpactSounds > 0) then |
360 if (Gear^.nImpactSounds > 0) and |
365 if ((Gear^.Damage <> 0) or ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or |
361 ((Gear^.Damage <> 0) or |
366 gstMoving))) and |
362 ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving))) and |
367 ((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)) then |
363 ((Gear^.dX.QWordValue > _0_1.QWordValue) or |
368 PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true |
364 (Gear^.dY.QWordValue > _0_1.QWordValue)) then |
369 ); |
365 PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true); |
370 end; |
366 end; |
371 |
367 |
372 //////////////////////////////////////////////////////////////////////////////// |
368 //////////////////////////////////////////////////////////////////////////////// |
373 procedure doStepBomb(Gear: PGear); |
369 procedure doStepBomb(Gear: PGear); |
374 var |
370 var |
498 begin |
494 begin |
499 PlaySound(sndMolotov); |
495 PlaySound(sndMolotov); |
500 gX := hwRound(Gear^.X); |
496 gX := hwRound(Gear^.X); |
501 gY := hwRound(Gear^.Y); |
497 gY := hwRound(Gear^.Y); |
502 //doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 5, EXPLAutoSound); |
498 //doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 5, EXPLAutoSound); |
503 for i:= 0 to 20 do |
499 for i:= 0 to 24 do |
504 begin |
500 begin |
505 dX := AngleCos(i * 2) * ((_0_1*(i div 5))) * (GetRandom + _1); |
501 dX := AngleCos(i * 2) * ((_0_15*(i div 5))) * (GetRandom + _1); |
506 dY := AngleSin(i * 8) * _0_5 * (GetRandom + _1); |
502 dY := AngleSin(i * 8) * _0_5 * (GetRandom + _1); |
507 Fire := AddGear(gX, gY, gtFlame, 0, dX, dY, 0); |
503 Fire := AddGear(gX, gY, gtFlame, 0, dX, dY, 0); |
508 Fire^.State := Fire^.State or gsttmpFlag; |
504 Fire^.State := Fire^.State or gsttmpFlag; |
509 Fire := AddGear(gX, gY, gtFlame, 0, dX, -dY, 0); |
505 Fire := AddGear(gX, gY, gtFlame, 0, dX, -dY, 0); |
510 Fire^.State := Fire^.State or gsttmpFlag; |
506 Fire^.State := Fire^.State or gsttmpFlag; |
593 gun:= (Gear^.State and gstTmpFlag) <> 0; |
589 gun:= (Gear^.State and gstTmpFlag) <> 0; |
594 move:= false; |
590 move:= false; |
595 draw:= false; |
591 draw:= false; |
596 if gun then |
592 if gun then |
597 begin |
593 begin |
|
594 Gear^.State:= Gear^.State and not gstInvisible; |
598 doStepFallingGear(Gear); |
595 doStepFallingGear(Gear); |
599 CheckCollision(Gear); |
596 CheckCollision(Gear); |
600 if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then draw:= true; |
597 if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then draw:= true; |
601 xx:= hwRound(Gear^.X); |
598 xx:= hwRound(Gear^.X); |
602 yy:= hwRound(Gear^.Y); |
599 yy:= hwRound(Gear^.Y); |
731 begin |
728 begin |
732 DeleteGear(Gear); |
729 DeleteGear(Gear); |
733 exit |
730 exit |
734 end; |
731 end; |
735 Gear^.X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)-512); |
732 Gear^.X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)-512); |
736 Gear^.Y:= int2hwFloat(750+(GetRandom(50)-25)) |
733 Gear^.Y:= int2hwFloat(750+(GetRandom(50)-25)); |
|
734 Gear^.State:= Gear^.State or gstInvisible; |
737 end |
735 end |
738 end; |
736 end; |
739 |
737 |
740 //////////////////////////////////////////////////////////////////////////////// |
738 //////////////////////////////////////////////////////////////////////////////// |
741 procedure doStepGrave(Gear: PGear); |
739 procedure doStepGrave(Gear: PGear); |
2174 if not sticky then |
2181 if not sticky then |
2175 begin |
2182 begin |
2176 if ((GameTicks and $1) = 0) then |
2183 if ((GameTicks and $1) = 0) then |
2177 begin |
2184 begin |
2178 Gear^.Radius := 7; |
2185 Gear^.Radius := 7; |
2179 AmmoShove(Gear, 4, 150); |
2186 tdX:= Gear^.dX; |
|
2187 tdY:= Gear^.dY; |
|
2188 Gear^.dX.QWordValue:= 214748365; |
|
2189 Gear^.dY.QWordValue:= 429496730; |
|
2190 Gear^.dX.isNegative:= getrandom(2)<>1; |
|
2191 Gear^.dY.isNegative:= true; |
|
2192 AmmoShove(Gear, 6, 100); |
|
2193 Gear^.dX:= tdX; |
|
2194 Gear^.dY:= tdY; |
2180 Gear^.Radius := 1; |
2195 Gear^.Radius := 1; |
2181 end |
2196 end |
2182 else if ((GameTicks and $3) = 3) then doMakeExplosion(gX, gY, 6, Gear^.Hedgehog, 0);//, EXPLNoDamage); |
2197 else if ((GameTicks and $3) = 3) then doMakeExplosion(gX, gY, 8, Gear^.Hedgehog, 0);//, EXPLNoDamage); |
2183 //DrawExplosion(gX, gY, 4); |
2198 //DrawExplosion(gX, gY, 4); |
2184 if ((GameTicks and $7) = 0) and (Random(2) = 0) then |
2199 if ((GameTicks and $7) = 0) and (Random(2) = 0) then |
2185 for i:= 1 to Random(2)+1 do |
2200 for i:= 1 to Random(2)+1 do |
2186 AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
2201 AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
2187 if Gear^.Health > 0 then dec(Gear^.Health); |
2202 if Gear^.Health > 0 then dec(Gear^.Health); |
3754 if (iterator^.X < Gear^.X - r) |
3769 if (iterator^.X < Gear^.X - r) |
3755 or (iterator^.X > Gear^.X + r) |
3770 or (iterator^.X > Gear^.X + r) |
3756 or (iterator^.Y < Gear^.Y - r) |
3771 or (iterator^.Y < Gear^.Y - r) |
3757 or (iterator^.Y > Gear^.Y + r) then |
3772 or (iterator^.Y > Gear^.Y + r) then |
3758 continue; |
3773 continue; |
3759 |
3774 (* |
|
3775 Square check causes fail on many innocent cases. the 3/4s and 1.5 fudge factors... help. |
|
3776 Might still need to remove this section |
|
3777 *) |
3760 //Will if fit through? |
3778 //Will if fit through? |
3761 //set r to be portal distance |
3779 //set r to be portal distance |
3762 r := Int2hwFloat(Gear^.Radius +1); |
3780 r := Int2hwFloat(Gear^.Radius * 3 div 4); |
3763 |
3781 o_x := hwRound(conPortal^.X + (conPortal^.dX*_1_5)); |
3764 o_x := hwRound(conPortal^.X + conPortal^.dX); |
3782 o_y := hwRound(conPortal^.Y + (conPortal^.dY*_1_5)); |
3765 o_y := hwRound(conPortal^.Y + conPortal^.dY); |
3783 //r := Int2hwFloat(Gear^.Radius +1); |
|
3784 |
|
3785 //o_x := hwRound(conPortal^.X + conPortal^.dX); |
|
3786 //o_y := hwRound(conPortal^.Y + conPortal^.dY); |
3766 r_x := hwRound(conPortal^.X+r*conPortal^.dX); |
3787 r_x := hwRound(conPortal^.X+r*conPortal^.dX); |
3767 r_y := hwRound(conPortal^.Y+r*conPortal^.dY); |
3788 r_y := hwRound(conPortal^.Y+r*conPortal^.dY); |
3768 rr_x := hwRound(conPortal^.X+r*conPortal^.dX*2); |
3789 rr_x := hwRound(conPortal^.X+r*conPortal^.dX*2); |
3769 rr_y := hwRound(conPortal^.Y+r*conPortal^.dY*2); |
3790 rr_y := hwRound(conPortal^.Y+r*conPortal^.dY*2); |
3770 |
3791 |
4389 |
4410 |
4390 dec(Gear^.Timer); |
4411 dec(Gear^.Timer); |
4391 if Gear^.Timer = 0 then |
4412 if Gear^.Timer = 0 then |
4392 begin |
4413 begin |
4393 dec(Gear^.Health); |
4414 dec(Gear^.Health); |
4394 if (Gear^.Health mod 10) = 0 then |
4415 if (Gear^.Health mod 5) = 0 then |
4395 begin |
4416 begin |
4396 rx := rndSign(getRandom * _0_1); |
4417 rx := rndSign(getRandom * _0_1); |
4397 ry := rndSign(getRandom * _0_1); |
4418 ry := rndSign(getRandom * _0_1); |
4398 speed := _0_8 * (_10 / Gear^.Tag); |
4419 speed := _0_5 * (_10 / Gear^.Tag); |
4399 |
4420 |
4400 Fire := AddGear(gx, gy, gtFlame, 0, |
4421 Fire := AddGear(gx, gy, gtFlame, 0, |
4401 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4422 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4402 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4423 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4403 Fire^.State := Fire^.State or gsttmpFlag; |
4424 Fire^.State := Fire^.State or gsttmpFlag; |
4404 |
4425 |
4405 if (Gear^.Health mod 20) = 0 then |
4426 if (Gear^.Health mod 30) = 0 then |
4406 Fire := AddGear(gx, gy, gtFlame, 0, |
4427 Fire := AddGear(gx, gy, gtFlame, 0, |
4407 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4428 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4408 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4429 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4409 end; |
4430 end; |
4410 Gear^.Timer:= Gear^.Tag |
4431 Gear^.Timer:= Gear^.Tag |
4468 |
4489 |
4469 dec(Gear^.Timer); |
4490 dec(Gear^.Timer); |
4470 if Gear^.Timer = 0 then |
4491 if Gear^.Timer = 0 then |
4471 begin |
4492 begin |
4472 dec(Gear^.Health); |
4493 dec(Gear^.Health); |
4473 if (Gear^.Health mod 5) = 0 then |
4494 |
4474 begin |
4495 rx := rndSign(getRandom * _0_1); |
4475 rx := rndSign(getRandom * _0_1); |
4496 ry := rndSign(getRandom * _0_1); |
4476 ry := rndSign(getRandom * _0_1); |
4497 speed := (_3 / Gear^.Tag); |
4477 speed := (_3 / Gear^.Tag); |
4498 |
4478 |
4499 Flake := AddGear(gx, gy, gtFlake, 0, _0, _0, 0); |
4479 Flake := AddGear(gx, gy, gtFlake, 0, _0, _0, 0); |
4500 Flake^.dX:= SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx; |
4480 Flake^.dX:= SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx; |
4501 Flake^.dY:= AngleCos(HHGear^.Angle) * ( - speed) + ry; |
4481 Flake^.dY:= AngleCos(HHGear^.Angle) * ( - speed) + ry; |
4502 Flake^.State := Flake^.State or gsttmpFlag; |
4482 Flake^.State := Flake^.State or gsttmpFlag; |
|
4483 |
4503 |
4484 end; |
|
4485 Gear^.Timer:= Gear^.Tag |
4504 Gear^.Timer:= Gear^.Tag |
4486 end; |
4505 end; |
4487 |
4506 |
4488 if (Gear^.Health = 0) or (HHGear^.Damage <> 0) or ((HHGear^.Message and gmAttack) <> 0) then |
4507 if (Gear^.Health = 0) or (HHGear^.Damage <> 0) or ((HHGear^.Message and gmAttack) <> 0) then |
4489 begin |
4508 begin |