hedgewars/GSHandlers.inc
changeset 3115 831bd0f7050d
parent 3107 1fa539758c10
child 3118 1320933fd651
equal deleted inserted replaced
3114:3a3d1ee2ebd0 3115:831bd0f7050d
  1357         inc(Gear^.Damage, hwRound(Gear^.dX * _50))
  1357         inc(Gear^.Damage, hwRound(Gear^.dX * _50))
  1358     else if Gear^.dY.isNegative and (Gear^.dY < -_0_03) and TestCollisionYwithGear(Gear, -1) then
  1358     else if Gear^.dY.isNegative and (Gear^.dY < -_0_03) and TestCollisionYwithGear(Gear, -1) then
  1359         inc(Gear^.Damage, hwRound(Gear^.dY * -_50))
  1359         inc(Gear^.Damage, hwRound(Gear^.dY * -_50))
  1360     else if Gear^.dX.isNegative and (Gear^.dX < -_0_03) and TestCollisionXwithGear(Gear, -1) then
  1360     else if Gear^.dX.isNegative and (Gear^.dX < -_0_03) and TestCollisionXwithGear(Gear, -1) then
  1361         inc(Gear^.Damage, hwRound(Gear^.dX * -_50));
  1361         inc(Gear^.Damage, hwRound(Gear^.dX * -_50));
  1362 	
  1362     
  1363     doStepFallingGear(Gear);
  1363     doStepFallingGear(Gear);
  1364     CalcRotationDirAngle(Gear);
  1364     CalcRotationDirAngle(Gear);
  1365     CheckGearDrowning(Gear)
  1365     CheckGearDrowning(Gear)
  1366     end
  1366     end
  1367 else 
  1367 else 
  2792        Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall)
  2792        Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall)
  2793        end;
  2793        end;
  2794 
  2794 
  2795 if (HHGear^.Message and gm_Attack <> 0) then begin
  2795 if (HHGear^.Message and gm_Attack <> 0) then begin
  2796         HHGear^.Message := HHGear^.Message and not gm_Attack;
  2796         HHGear^.Message := HHGear^.Message and not gm_Attack;
  2797 		if Gear^.FlightTime > 0 then begin
  2797         if Gear^.FlightTime > 0 then begin
  2798 			AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtEgg, 0, Gear^.dX * _0_5, Gear^.dY, 0);
  2798             AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + 32, gtEgg, 0, Gear^.dX * _0_5, Gear^.dY, 0);
  2799 			dec(Gear^.FlightTime)
  2799             dec(Gear^.FlightTime)
  2800 		end;
  2800         end;
  2801 end;
  2801 end;
  2802 
  2802 
  2803 if HHGear^.Message and (gm_Up or gm_Precise or gm_Left or gm_Right) <> 0 then Gear^.State:= Gear^.State and not gsttmpFlag;
  2803 if HHGear^.Message and (gm_Up or gm_Precise or gm_Left or gm_Right) <> 0 then Gear^.State:= Gear^.State and not gsttmpFlag;
  2804 HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right);
  2804 HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right);
  2805 HHGear^.State:= HHGear^.State or gstMoving;
  2805 HHGear^.State:= HHGear^.State or gstMoving;
  2908 Gear^.doStep:= @doStepBigExplosionWork
  2908 Gear^.doStep:= @doStepBigExplosionWork
  2909 end;
  2909 end;
  2910 
  2910 
  2911 ////////////////////////////////////////////////////////////////////////////////
  2911 ////////////////////////////////////////////////////////////////////////////////
  2912 procedure doStepEggWork(Gear: PGear);
  2912 procedure doStepEggWork(Gear: PGear);
  2913 begin
  2913 var vg: PVisualGear;
  2914 	AllInactive:= false;
  2914      i: LongInt;
  2915 	Gear^.dX:= Gear^.dX;
  2915 begin
  2916 	doStepFallingGear(Gear);
  2916     AllInactive:= false;
  2917 	if (Gear^.State and gstCollision) <> 0 then
  2917     Gear^.dX:= Gear^.dX;
  2918 	begin
  2918     doStepFallingGear(Gear);
  2919 		doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, EXPLAutoSound + EXPLPoisoned);
  2919     CheckGearDrowning(Gear);
  2920 		DeleteGear(Gear);
  2920     CalcRotationDirAngle(Gear);
  2921 		exit
  2921 
  2922 	end;
  2922     if (Gear^.State and gstCollision) <> 0 then
  2923 	if (GameTicks and $3F) = 0 then
  2923     begin
  2924 		AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0)
  2924         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLPoisoned or EXPLNoGfx);
  2925 end;
  2925         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLPoisoned or EXPLNoGfx);
       
  2926         PlaySound(sndEggBreak);
       
  2927         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
       
  2928         vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
       
  2929         if vg <> nil then vg^.Frame:= 2;
       
  2930 
       
  2931     for i:= 10 downto 0 do begin
       
  2932         vg := AddVisualGear(hwRound(Gear^.X) - 3 + Random(6), hwRound(Gear^.Y) - 3 + Random(6), vgtDust);
       
  2933         if vg <> nil then vg^.dX := vg^.dX + (Gear^.dX / 5);
       
  2934         end;
       
  2935 
       
  2936         DeleteGear(Gear);
       
  2937         exit
       
  2938     end;
       
  2939 end;