hedgewars/GSHandlers.inc
changeset 2828 e45410eae9ea
parent 2762 2fbc8d35eb52
child 2840 bb9117753fe4
equal deleted inserted replaced
2827:45817d8386c7 2828:e45410eae9ea
   456 	end
   456 	end
   457 end;
   457 end;
   458 
   458 
   459 procedure doStepShotgunShot(Gear: PGear);
   459 procedure doStepShotgunShot(Gear: PGear);
   460 var i: LongWord;
   460 var i: LongWord;
       
   461     shell: PVisualGear;
   461 begin
   462 begin
   462 AllInactive:= false;
   463 AllInactive:= false;
   463 
   464 
   464 if ((Gear^.State and gstAnimation) = 0) then
   465 if ((Gear^.State and gstAnimation) = 0) then
   465 	begin
   466 	begin
   466 	dec(Gear^.Timer);
   467 	dec(Gear^.Timer);
   467 	if Gear^.Timer = 0 then
   468 	if Gear^.Timer = 0 then
   468 		begin
   469 		begin
   469 		PlaySound(sndShotgunFire);
   470 		PlaySound(sndShotgunFire);
       
   471 		shell:= AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell);
       
   472 		shell^.dX:= gear^.dX / -4;
       
   473 		shell^.dY:= gear^.dY / -4;
       
   474 		shell^.Frame:= 0;
   470 		Gear^.State:= Gear^.State or gstAnimation
   475 		Gear^.State:= Gear^.State or gstAnimation
   471 		end;
   476 		end;
   472 	exit
   477 	exit
   473 	end
   478 	end
   474 	else inc(Gear^.Timer);
   479 	else inc(Gear^.Timer);
   540 Gear^.doStep:= @doStepBulletWork
   545 Gear^.doStep:= @doStepBulletWork
   541 end;
   546 end;
   542 
   547 
   543 procedure doStepSniperRifleShot(Gear: PGear);
   548 procedure doStepSniperRifleShot(Gear: PGear);
   544 var HHGear: PGear;
   549 var HHGear: PGear;
       
   550     shell: PVisualGear;
   545 begin
   551 begin
   546 cArtillery:= true;
   552 cArtillery:= true;
   547 HHGear:=PHedgehog(Gear^.Hedgehog)^.Gear;
   553 HHGear:=PHedgehog(Gear^.Hedgehog)^.Gear;
   548 HHGear^.State:= HHGear^.State or gstNotKickable;
   554 HHGear^.State:= HHGear^.State or gstNotKickable;
   549 HedgehogChAngle(HHGear);
   555 HedgehogChAngle(HHGear);
   554     if(HHGear^.Angle - 32 >= 0) then dec(HHGear^.Angle,32)
   560     if(HHGear^.Angle - 32 >= 0) then dec(HHGear^.Angle,32)
   555     end;
   561     end;
   556 
   562 
   557 if (HHGear^.Message and gm_Attack) <> 0 then
   563 if (HHGear^.Message and gm_Attack) <> 0 then
   558     begin
   564     begin
   559 	Gear^.State:= Gear^.State or gstAnimation;
   565     shell:= AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell);
       
   566     shell^.dX:= gear^.dX / -2;
       
   567     shell^.dY:= gear^.dY / -2;
       
   568     shell^.Frame:= 1;
       
   569     Gear^.State:= Gear^.State or gstAnimation;
   560     Gear^.dX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _0_5;
   570     Gear^.dX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _0_5;
   561     Gear^.dY:= -AngleCos(HHGear^.Angle) * _0_5;
   571     Gear^.dY:= -AngleCos(HHGear^.Angle) * _0_5;
   562     PlaySound(sndGun);
   572     PlaySound(sndGun);
   563     Gear^.doStep:= @doStepBulletWork;
   573     Gear^.doStep:= @doStepBulletWork;
   564     end
   574     end