hedgewars/CCHandlers.inc
changeset 543 465e2ec8f05f
parent 542 ec26095f1bed
child 546 0e7cc3fb05cd
equal deleted inserted replaced
542:ec26095f1bed 543:465e2ec8f05f
   327           end;
   327           end;
   328      ApplyAmmoChanges(Hedgehogs[CurrHedgehog])
   328      ApplyAmmoChanges(Hedgehogs[CurrHedgehog])
   329      end
   329      end
   330 end;
   330 end;
   331 
   331 
   332 procedure chPut(var s: shortstring);
   332 procedure doPut(putX, putY: LongInt; fromAI: boolean);
   333 begin
   333 begin
   334 if CheckNoTeamOrHH then exit;
   334 if CheckNoTeamOrHH then exit;
   335 if bShowAmmoMenu then
   335 if bShowAmmoMenu then
   336    begin
   336    begin
   337    bSelected:= true;
   337    bSelected:= true;
   338    exit
   338    exit
   339    end;
   339    end;
       
   340 
   340 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^,
   341 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^,
   341      CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do
   342      CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do
   342      if (State and gstHHChooseTarget) <> 0 then
   343      if (State and gstHHChooseTarget) <> 0 then
   343         begin
   344         begin
   344         isCursorVisible:= false;
   345         isCursorVisible:= false;
   345         if not CurrentTeam^.ExtDriven then
   346         if not CurrentTeam^.ExtDriven then
   346            begin
   347            begin
   347            SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y);
   348            if fromAI then
   348            dec(TargetPoint.X, WorldDx);
   349               begin
   349            dec(TargetPoint.Y, WorldDy);
   350               TargetPoint.X:= putX;
       
   351               TargetPoint.Y:= putY
       
   352               end else
       
   353               begin
       
   354               SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y);
       
   355               dec(TargetPoint.X, WorldDx);
       
   356               dec(TargetPoint.Y, WorldDy)
       
   357               end;
   350            SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
   358            SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
   351            end;
   359            end;
   352         State:= State and not gstHHChooseTarget;
   360         State:= State and not gstHHChooseTarget; 
   353         if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then
   361         if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then
   354            Message:= Message or gm_Attack;
   362            Message:= Message or gm_Attack;
   355         end else if CurrentTeam^.ExtDriven then OutError('got /put while not being in choose target mode', false)
   363         end else if CurrentTeam^.ExtDriven then OutError('got /put while not being in choose target mode', false)
       
   364 
       
   365 end;
       
   366 
       
   367 procedure chPut(var s: shortstring);
       
   368 begin
       
   369 doPut(0, 0, false)
   356 end;
   370 end;
   357 
   371 
   358 procedure chCapture(var s: shortstring);
   372 procedure chCapture(var s: shortstring);
   359 begin
   373 begin
   360 flagMakeCapture:= true
   374 flagMakeCapture:= true