hedgewars/uGears.pas
changeset 847 66970c0ed3aa
parent 845 ca72cf446ec2
child 848 b31b72756927
equal deleted inserted replaced
846:08c3f0bc766c 847:66970c0ed3aa
   475 	hx, hy: LongInt;
   475 	hx, hy: LongInt;
   476 	aangle: real;
   476 	aangle: real;
   477 	defaultPos: boolean;
   477 	defaultPos: boolean;
   478 begin
   478 begin
   479 defaultPos:= true;
   479 defaultPos:= true;
       
   480 
       
   481 hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx;
       
   482 hy:= hwRound(Gear^.Y) - 2 + WorldDy;
       
   483 aangle:= Gear^.Angle * 180 / cMaxAngle - 90;
       
   484 
   480 if (Gear^.State and gstHHDriven) <> 0 then
   485 if (Gear^.State and gstHHDriven) <> 0 then
   481 begin
   486 begin
   482 	if CurAmmoGear <> nil then
   487 	if CurAmmoGear <> nil then
   483 	begin
   488 	begin
   484 		if (CurAmmoGear^.Kind = gtRope) then
   489 		case CurAmmoGear^.Kind of
   485 			begin
   490 			 gtRope: begin
   486 			DrawHedgehog(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   491 				DrawHedgehog(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   487 					1,
   492 						1,
   488 					1,
   493 						1,
   489 					0,
   494 						0,
   490 					DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) - 110);
   495 						DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) - 110);
   491 			defaultPos:= false
   496 				defaultPos:= false
   492 			end
   497 				end;
       
   498 			gtBlowTorch: begin
       
   499 				DrawRotated(sprBlowTorch, hx, hy, hwSign(Gear^.dX), aangle);
       
   500 				DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
       
   501 						hwSign(Gear^.dX),
       
   502 						1,
       
   503 						3,
       
   504 						0);
       
   505 				end;
       
   506 
   493 		else if (CurAmmoGear^.Kind = gtPickHammer) then
   507 		else if (CurAmmoGear^.Kind = gtPickHammer) then
   494 			defaultPos:= false
   508 			defaultPos:= false
       
   509 		end
   495 	end else
   510 	end else
   496 	if ((Gear^.State and gstHHJumping) <> 0) then
   511 	if ((Gear^.State and gstHHJumping) <> 0) then
   497 		begin
   512 		begin
   498 		DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   513 		DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   499 			hwSign(Gear^.dX),
   514 			hwSign(Gear^.dX),
   513 			defaultPos:= false
   528 			defaultPos:= false
   514 		end
   529 		end
   515     else
   530     else
   516 	begin
   531 	begin
   517 		amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType;
   532 		amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType;
   518 		hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx;
       
   519 		hy:= hwRound(Gear^.Y) - 2 + WorldDy;
       
   520 		aangle:= Gear^.Angle * 180 / cMaxAngle - 90;
       
   521 
       
   522 		case amt of
   533 		case amt of
   523 			amBazooka: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle);
   534 			amBazooka: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle);
   524 			amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle);
   535 			amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle);
   525 			amShotgun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle);
   536 			amShotgun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle);
   526 			amDEagle: DrawRotated(sprHandDEagle, hx, hy, hwSign(Gear^.dX), aangle);
   537 			amDEagle: DrawRotated(sprHandDEagle, hx, hy, hwSign(Gear^.dX), aangle);
       
   538 			amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, hwSign(Gear^.dX), aangle);
   527 		end;
   539 		end;
   528 
   540 
   529 		case amt of
   541 		case amt of
   530 			amBazooka,
   542 			amBazooka,
   531 			amRope,
   543 			amRope,
   532 			amShotgun,
   544 			amShotgun,
   533 			amDEagle,
   545 			amDEagle,
   534 			amBaseballBat: begin
   546 			amBaseballBat: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   535 				DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
       
   536 						hwSign(Gear^.dX),
   547 						hwSign(Gear^.dX),
   537 						0,
   548 						0,
   538 						4,
   549 						4,
   539 						0);
   550 						0);
   540 				end;
       
   541 			amAirAttack,
   551 			amAirAttack,
   542 			amMineStrike: begin
   552 			amMineStrike: DrawRotated(sprHandAirAttack, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) + WorldDy, hwSign(Gear^.dX), 0);
   543 				DrawRotated(sprHandAirAttack, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) + WorldDy, hwSign(Gear^.dX), 0);
   553 			amPickHammer: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   544 				end;
       
   545 			amPickHammer: begin
       
   546 				DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
       
   547 						hwSign(Gear^.dX),
   554 						hwSign(Gear^.dX),
   548 						1,
   555 						1,
   549 						2,
   556 						2,
   550 						0);
   557 						0);
   551 				end;
   558 			amBlowTorch: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
       
   559 						hwSign(Gear^.dX),
       
   560 						1,
       
   561 						3,
       
   562 						0);
   552 		else
   563 		else
   553 			DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   564 			DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   554 				hwSign(Gear^.dX),
   565 				hwSign(Gear^.dX),
   555 				0,
   566 				0,
   556 				3,
   567 				4,
   557 				0);
   568 				0);
   558 		end;
   569 		end;
   559 
   570 
   560 		case amt of
   571 		case amt of
   561 			amBaseballBat: DrawRotated(sprHandBaseball,
   572 			amBaseballBat: DrawRotated(sprHandBaseball,