hedgewars/CCHandlers.inc
changeset 2407 9f413bd5150e
parent 2406 2e757b32991e
child 2428 6800f8aa0184
--- a/hedgewars/CCHandlers.inc	Tue Oct 06 16:30:08 2009 +0000
+++ b/hedgewars/CCHandlers.inc	Wed Oct 07 14:37:42 2009 +0000
@@ -455,39 +455,36 @@
 begin
 if CheckNoTeamOrHH then exit;
 if bShowAmmoMenu then
-   begin
-   bSelected:= true;
-   exit
-   end;
+	begin
+	bSelected:= true;
+	exit
+	end;
 
 with CurrentHedgehog^.Gear^,
-     CurrentHedgehog^ do
-     if (State and gstHHChooseTarget) <> 0 then
-        begin
-        isCursorVisible:= false;
-        if not CurrentTeam^.ExtDriven then
-           begin
-           if fromAI then
-              begin
-              TargetPoint.X:= putX;
-              TargetPoint.Y:= putY
-              end else
-              begin
-{$IFDEF SDL13}
-              SDL_GetMouseState(0, @TargetPoint.X, @TargetPoint.Y);
-{$ELSE}
-			  SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y);
-{$ENDIF}
-			  dec(TargetPoint.X, cScreenWidth div 2);
-              dec(TargetPoint.X, WorldDx);
-              dec(TargetPoint.Y, WorldDy)
-              end;
-           SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
-           end;
-        State:= State and not gstHHChooseTarget;
-        if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then
-           Message:= Message or gm_Attack;
-        end else if CurrentTeam^.ExtDriven then OutError('got /put while not being in choose target mode', false)
+	CurrentHedgehog^ do
+	if (State and gstHHChooseTarget) <> 0 then
+		begin
+		isCursorVisible:= false;
+		if not CurrentTeam^.ExtDriven then
+			begin
+			if fromAI then
+				begin
+				TargetPoint.X:= putX;
+				TargetPoint.Y:= putY
+				end else
+				begin
+				TargetPoint.X:= CursorPoint.X - WorldDx;
+				TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy;
+				end;
+			SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
+			end;
+		State:= State and not gstHHChooseTarget;
+		if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then
+			Message:= Message or gm_Attack;
+		end
+	else
+		if CurrentTeam^.ExtDriven then
+			OutError('got /put while not being in choose target mode', false)
 end;
 
 procedure chPut(var s: shortstring);