hedgewars/uGears.pas
changeset 824 e632cc7caf3a
parent 823 90d651e75547
child 825 4b32f282f9d7
equal deleted inserted replaced
823:90d651e75547 824:e632cc7caf3a
   472 procedure DrawHH(Gear: PGear; Surface: PSDL_Surface);
   472 procedure DrawHH(Gear: PGear; Surface: PSDL_Surface);
   473 var t: LongInt;
   473 var t: LongInt;
   474 	amt: TAmmoType;
   474 	amt: TAmmoType;
   475 	hx, hy: LongInt;
   475 	hx, hy: LongInt;
   476 	aangle: real;
   476 	aangle: real;
   477 begin
   477 	defaultPos: boolean;
       
   478 begin
       
   479 defaultPos:= true;
   478 if (Gear^.State and gstHHDriven) <> 0 then
   480 if (Gear^.State and gstHHDriven) <> 0 then
   479 begin
   481 begin
   480 	if CurAmmoGear <> nil then
   482 	if CurAmmoGear <> nil then
   481 	begin
   483 	begin
   482 		if (CurAmmoGear^.Kind = gtRope) then
   484 		if (CurAmmoGear^.Kind = gtRope) then
   483 		DrawHedgehog(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   485 			begin
   484 				1,
   486 			DrawHedgehog(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   485 				1,
   487 					1,
   486 				0,
   488 					1,
   487 				DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) - 110);
   489 					0,
       
   490 					DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) - 110);
       
   491 			defaultPos:= false
       
   492 			end
   488 	end else
   493 	end else
   489 	if (Gear^.Message and (gm_Left or gm_Right) <> 0) then
   494 	if ((Gear^.State and gstHHJumping) <> 0) then
       
   495 		begin
       
   496 		DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
       
   497 			hwSign(Gear^.dX),
       
   498 			1,
       
   499 			1,
       
   500 			0);
       
   501 			defaultPos:= false
       
   502 		end else
       
   503 	if (Gear^.Message and (gm_Left or gm_Right) <> 0)
       
   504        or ((Gear^.State and gstAttacked) <> 0) then
       
   505 		begin
   490 		DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   506 		DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   491 			hwSign(Gear^.dX),
   507 			hwSign(Gear^.dX),
   492 			0,
   508 			0,
   493 			PHedgehog(Gear^.Hedgehog)^.visStepPos div 2,
   509 			PHedgehog(Gear^.Hedgehog)^.visStepPos div 2,
   494 			0)
   510 			0);
       
   511 			defaultPos:= false
       
   512 		end
   495     else
   513     else
   496 	begin
   514 	begin
   497 		amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType;
   515 		amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType;
   498 		hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx;
   516 		hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx;
   499 		hy:= hwRound(Gear^.Y) - 2 + WorldDy;
   517 		hy:= hwRound(Gear^.Y) - 2 + WorldDy;
   507 		end;
   525 		end;
   508 		case amt of
   526 		case amt of
   509 			amBazooka,
   527 			amBazooka,
   510 			amRope,
   528 			amRope,
   511 			amShotgun,
   529 			amShotgun,
   512 			amDEagle: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   530 			amDEagle: begin
   513 						hwSign(Gear^.dX),
   531 					DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   514 						0,
   532 							hwSign(Gear^.dX),
   515 						4,
   533 							0,
   516 						0);
   534 							4,
       
   535 							0);
       
   536 					defaultPos:= false
       
   537 				end
   517 		else
   538 		else
   518 			DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   539 			DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   519 				hwSign(Gear^.dX),
   540 				hwSign(Gear^.dX),
   520 				0,
   541 				0,
   521 				3,
   542 				3,
   522 				0);
   543 				0);
       
   544 			defaultPos:= false
   523 		end
   545 		end
   524 	end
   546 	end
   525 end else
   547 end;
       
   548 
       
   549 if defaultPos then 
   526 	DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   550 	DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   527 		hwSign(Gear^.dX),
   551 		hwSign(Gear^.dX),
   528 		0,
   552 		0,
   529 		3,
   553 		3,
   530 		0);
   554 		0);