hedgewars/CCHandlers.inc
changeset 2407 9f413bd5150e
parent 2406 2e757b32991e
child 2428 6800f8aa0184
equal deleted inserted replaced
2406:2e757b32991e 2407:9f413bd5150e
   453 
   453 
   454 procedure doPut(putX, putY: LongInt; fromAI: boolean);
   454 procedure doPut(putX, putY: LongInt; fromAI: boolean);
   455 begin
   455 begin
   456 if CheckNoTeamOrHH then exit;
   456 if CheckNoTeamOrHH then exit;
   457 if bShowAmmoMenu then
   457 if bShowAmmoMenu then
   458    begin
   458 	begin
   459    bSelected:= true;
   459 	bSelected:= true;
   460    exit
   460 	exit
   461    end;
   461 	end;
   462 
   462 
   463 with CurrentHedgehog^.Gear^,
   463 with CurrentHedgehog^.Gear^,
   464      CurrentHedgehog^ do
   464 	CurrentHedgehog^ do
   465      if (State and gstHHChooseTarget) <> 0 then
   465 	if (State and gstHHChooseTarget) <> 0 then
   466         begin
   466 		begin
   467         isCursorVisible:= false;
   467 		isCursorVisible:= false;
   468         if not CurrentTeam^.ExtDriven then
   468 		if not CurrentTeam^.ExtDriven then
   469            begin
   469 			begin
   470            if fromAI then
   470 			if fromAI then
   471               begin
   471 				begin
   472               TargetPoint.X:= putX;
   472 				TargetPoint.X:= putX;
   473               TargetPoint.Y:= putY
   473 				TargetPoint.Y:= putY
   474               end else
   474 				end else
   475               begin
   475 				begin
   476 {$IFDEF SDL13}
   476 				TargetPoint.X:= CursorPoint.X - WorldDx;
   477               SDL_GetMouseState(0, @TargetPoint.X, @TargetPoint.Y);
   477 				TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy;
   478 {$ELSE}
   478 				end;
   479 			  SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y);
   479 			SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
   480 {$ENDIF}
   480 			end;
   481 			  dec(TargetPoint.X, cScreenWidth div 2);
   481 		State:= State and not gstHHChooseTarget;
   482               dec(TargetPoint.X, WorldDx);
   482 		if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then
   483               dec(TargetPoint.Y, WorldDy)
   483 			Message:= Message or gm_Attack;
   484               end;
   484 		end
   485            SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
   485 	else
   486            end;
   486 		if CurrentTeam^.ExtDriven then
   487         State:= State and not gstHHChooseTarget;
   487 			OutError('got /put while not being in choose target mode', false)
   488         if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then
       
   489            Message:= Message or gm_Attack;
       
   490         end else if CurrentTeam^.ExtDriven then OutError('got /put while not being in choose target mode', false)
       
   491 end;
   488 end;
   492 
   489 
   493 procedure chPut(var s: shortstring);
   490 procedure chPut(var s: shortstring);
   494 begin
   491 begin
   495 doPut(0, 0, false)
   492 doPut(0, 0, false)