hedgewars/uGears.pas
changeset 958 92bb9fa046f9
parent 957 ba340a727909
child 959 18b05fc2d0a6
equal deleted inserted replaced
957:ba340a727909 958:92bb9fa046f9
   207     gtHedgehog: begin
   207     gtHedgehog: begin
   208                 Result^.Radius:= cHHRadius;
   208                 Result^.Radius:= cHHRadius;
   209                 Result^.Elasticity:= _0_35;
   209                 Result^.Elasticity:= _0_35;
   210                 Result^.Friction:= _0_999;
   210                 Result^.Friction:= _0_999;
   211                 Result^.Angle:= cMaxAngle div 2;
   211                 Result^.Angle:= cMaxAngle div 2;
   212                 Result^.Pos:= GetRandom(19);
       
   213                 Result^.Z:= cHHZ;
   212                 Result^.Z:= cHHZ;
   214                 end;
   213                 end;
   215 gtAmmo_Grenade: begin
   214 gtAmmo_Grenade: begin
   216                 Result^.Radius:= 4;
   215                 Result^.Radius:= 4;
   217                 end;
   216                 end;
   652 		(RealTicks div 128 + Gear^.Pos) mod 19,
   651 		(RealTicks div 128 + Gear^.Pos) mod 19,
   653 		hwSign(Gear^.dX),
   652 		hwSign(Gear^.dX),
   654 		0);
   653 		0);
   655 
   654 
   656 with PHedgehog(Gear^.Hedgehog)^ do
   655 with PHedgehog(Gear^.Hedgehog)^ do
   657      if (Gear^.State{ and not gstAnimation}) = 0 then
   656 	if (Gear^.State{ and not gstAnimation}) = 0 then
   658         begin
   657 	begin
   659         t:= hwRound(Gear^.Y) - cHHRadius - 10 + WorldDy;
   658 	t:= hwRound(Gear^.Y) - cHHRadius - 10 + WorldDy;
   660         if (cTagsMask and 1) <> 0 then
   659 	if (cTagsMask and 1) <> 0 then
   661            begin
   660 		begin
   662            dec(t, HealthTagTex^.h + 2);
   661 		dec(t, HealthTagTex^.h + 2);
   663            DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTagTex)
   662 		DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTagTex)
   664            end;
   663 		end;
   665         if (cTagsMask and 2) <> 0 then
   664 	if (cTagsMask and 2) <> 0 then
   666            begin
   665 		begin
   667            dec(t, NameTagTex^.h + 2);
   666 		dec(t, NameTagTex^.h + 2);
   668            DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTagTex)
   667 		DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTagTex)
   669            end;
   668 		end;
   670         if (cTagsMask and 4) <> 0 then
   669 	if (cTagsMask and 4) <> 0 then
   671            begin
   670 		begin
   672            dec(t, Team^.NameTagTex^.h + 2);
   671 		dec(t, Team^.NameTagTex^.h + 2);
   673            DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex)
   672 		DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex)
   674            end
   673 		end
   675         end else // Current hedgehog
   674 	end else // Current hedgehog
   676       if (Gear^.State and gstHHDriven) <> 0 then
   675 	if (Gear^.State and gstHHDriven) <> 0 then
   677         begin
   676 		begin
   678         if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then
   677 		if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then
   679            DrawSprite(sprFinger, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 64 + WorldDy,
   678 			DrawSprite(sprFinger, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 64 + WorldDy,
   680                       GameTicks div 32 mod 16);
   679 						GameTicks div 32 mod 16);
   681 
   680 
   682         if (Gear^.State and (gstHHJumping or gstDrowning)) = 0 then
   681 		if (Gear^.State and gstDrowning) = 0 then
   683            if (Gear^.State and gstHHThinking) <> 0 then
   682 			if (Gear^.State and gstHHThinking) <> 0 then
   684               DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, 0)
   683 				DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, 0)
   685               else
   684 				else
   686               if ShowCrosshair and ((Gear^.State and gstAttacked) = 0) then
   685 				if ShowCrosshair and ((Gear^.State and gstAttacked) = 0) then
   687                  DrawRotatedTex(Team^.CrosshairTex,
   686 					begin
   688                                 12, 12,
   687 					if ((Gear^.State and gstHHHJump) <> 0) then m:= -1 else m:= 1;
   689                                 Round(hwRound(Gear^.X) +
   688 					DrawRotatedTex(Team^.CrosshairTex,
   690                                 hwSign(Gear^.dX) * Sin(Gear^.Angle*pi/cMaxAngle)*60) + WorldDx,
   689 							12, 12,
   691                                 Round(hwRound(Gear^.Y) -
   690 							Round(hwRound(Gear^.X) + hwSign(Gear^.dX) * m * Sin(Gear^.Angle*pi/cMaxAngle) * 60) + WorldDx,
   692                                 Cos(Gear^.Angle*pi/cMaxAngle)*60) + WorldDy, 0,
   691 							Round(hwRound(Gear^.Y) - Cos(Gear^.Angle*pi/cMaxAngle) * 60) + WorldDy, 0,
   693                                 hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle)
   692 							hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle)
   694         end;
   693 					end
       
   694 			end;
   695 end;
   695 end;
   696 
   696 
   697 procedure DrawGears;
   697 procedure DrawGears;
   698 var Gear, HHGear: PGear;
   698 var Gear, HHGear: PGear;
   699     i: Longword;
   699     i: Longword;
   984 		with ClansArray[p]^ do
   984 		with ClansArray[p]^ do
   985 			for j:= 0 to Pred(TeamsNumber) do
   985 			for j:= 0 to Pred(TeamsNumber) do
   986 				with Teams[j]^ do
   986 				with Teams[j]^ do
   987 					for i:= 0 to cMaxHHIndex do
   987 					for i:= 0 to cMaxHHIndex do
   988 						with Hedgehogs[i] do
   988 						with Hedgehogs[i] do
   989 							if (Gear <> nil) and (Gear^.X.QWordValue = 0) then FindPlace(Gear, false, t, t + 1024);
   989 							if (Gear <> nil) and (Gear^.X.QWordValue = 0) then
       
   990 								begin
       
   991 								FindPlace(Gear, false, t, t + 1024);
       
   992 								Gear^.Pos:= GetRandom(19);
       
   993 								end;
   990 		inc(t, 1024)
   994 		inc(t, 1024)
   991 		end
   995 		end
   992 	end else // mix hedgehogs
   996 	end else // mix hedgehogs
   993 	begin
   997 	begin
   994 	Count:= 0;
   998 	Count:= 0;