hedgewars/uGears.pas
changeset 2020 f8cd566204ef
parent 2017 7845c77c8d31
child 2023 41d3afaa20c7
equal deleted inserted replaced
2019:b3f1eda8865f 2020:f8cd566204ef
   716 end;
   716 end;
   717 
   717 
   718 procedure DrawHH(Gear: PGear);
   718 procedure DrawHH(Gear: PGear);
   719 var t: LongInt;
   719 var t: LongInt;
   720 	amt: TAmmoType;
   720 	amt: TAmmoType;
   721 	hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite
   721 	hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
   722 	lx, ly, dx, dy, ax, ay, aAngle, dAngle: real;  // laser, change
   722 	lx, ly, dx, dy, ax, ay, aAngle, dAngle: real;  // laser, change
   723 	defaultPos, HatVisible: boolean;
   723 	defaultPos, HatVisible: boolean;
   724     VertexBuffer: array [0..1] of TVertex2f;
   724     VertexBuffer: array [0..1] of TVertex2f;
   725 begin
   725 begin
       
   726 m:= 1;
       
   727 if (Gear^.State and gstHHHJump) <> 0 then m:= -1;
   726 if (Gear^.State and gstHHDeath) <> 0 then
   728 if (Gear^.State and gstHHDeath) <> 0 then
   727 	begin
   729 	begin
   728 	DrawSprite(sprHHDeath, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 26 + WorldDy, Gear^.Pos);
   730 	DrawSprite(sprHHDeath, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 26 + WorldDy, Gear^.Pos);
   729 	exit
   731 	exit
   730 	end;
   732 	end;
   888 		end
   890 		end
   889 	end else
   891 	end else
   890 
   892 
   891 	if ((Gear^.State and gstHHJumping) <> 0) then
   893 	if ((Gear^.State and gstHHJumping) <> 0) then
   892 	begin
   894 	begin
   893 	if ((Gear^.State and gstHHHJump) <> 0) then
   895     DrawHedgehog(sx, sy,
   894 		DrawHedgehog(sx, sy,
   896         hwSign(Gear^.dX)*m,
   895 			- hwSign(Gear^.dX),
   897         1,
   896 			1,
   898         1,
   897 			1,
   899         0);
   898 			0)
   900 	HatVisible:= true;
   899 		else
       
   900 		DrawHedgehog(sx, sy,
       
   901 			hwSign(Gear^.dX),
       
   902 			1,
       
   903 			1,
       
   904 			0);
       
   905 	HatVisible:= true;
   901 	HatVisible:= true;
   906 	defaultPos:= false
   902 	defaultPos:= false
   907 	end else
   903 	end else
   908 
   904 
   909 	if (Gear^.Message and (gm_Left or gm_Right) <> 0) and (not isCursorVisible) then
   905 	if (Gear^.Message and (gm_Left or gm_Right) <> 0) and (not isCursorVisible) then
  1025 		defaultPos:= false
  1021 		defaultPos:= false
  1026 		end else
  1022 		end else
  1027 
  1023 
  1028 	if ((Gear^.State and gstHHJumping) <> 0) then
  1024 	if ((Gear^.State and gstHHJumping) <> 0) then
  1029 		begin
  1025 		begin
  1030 		if ((Gear^.State and gstHHHJump) <> 0) then
  1026 		DrawHedgehog(sx, sy,
  1031 			DrawHedgehog(sx, sy,
  1027 			hwSign(Gear^.dX)*m,
  1032 				- hwSign(Gear^.dX),
  1028 			1,
  1033 				1,
  1029 			1,
  1034 				1,
  1030 			0);
  1035 				0)
  1031 		defaultPos:= false
  1036 			else
       
  1037 			DrawHedgehog(sx, sy,
       
  1038 				hwSign(Gear^.dX),
       
  1039 				1,
       
  1040 				1,
       
  1041 				0);
       
  1042 			defaultPos:= false
       
  1043 		end;
  1032 		end;
  1044 	end;
  1033 	end;
  1045 
  1034 
  1046 with PHedgehog(Gear^.Hedgehog)^ do
  1035 with PHedgehog(Gear^.Hedgehog)^ do
  1047 	begin
  1036 	begin
  1078 			DrawTextureF(HatTex,
  1067 			DrawTextureF(HatTex,
  1079 				HatVisibility,
  1068 				HatVisibility,
  1080 				sx,
  1069 				sx,
  1081 				hwRound(Gear^.Y) - 8 + WorldDy,
  1070 				hwRound(Gear^.Y) - 8 + WorldDy,
  1082 				0,
  1071 				0,
  1083 				hwSign(Gear^.dX),
  1072 				hwSign(Gear^.dX)*m,
  1084 				32);
  1073 				32);
  1085 	end;
  1074 	end;
  1086 
  1075 
  1087 
  1076 
  1088 with PHedgehog(Gear^.Hedgehog)^ do
  1077 with PHedgehog(Gear^.Hedgehog)^ do
  1123    1: I need to draw the laser from weapon origin to nearest land
  1112    1: I need to draw the laser from weapon origin to nearest land
  1124    2: I need to start the beam outside the hedgie for attractiveness. 
  1113    2: I need to start the beam outside the hedgie for attractiveness. 
  1125    3: I need to extend the beam beyond land. 
  1114    3: I need to extend the beam beyond land. 
  1126    This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function.
  1115    This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function.
  1127 *)
  1116 *)
  1128 					if ((Gear^.State and gstHHHJump) <> 0) then m:= -1 else m:= 1;
       
  1129 					dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle);
  1117 					dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle);
  1130 					dy:= - Cos(Gear^.Angle * pi / cMaxAngle);
  1118 					dy:= - Cos(Gear^.Angle * pi / cMaxAngle);
  1131 					if cLaserSighting then
  1119 					if cLaserSighting then
  1132 						begin
  1120 						begin
  1133 						lx:= hwRound(Gear^.X);
  1121 						lx:= hwRound(Gear^.X);