hedgewars/uGearsHedgehog.pas
changeset 13096 d78e65c66573
parent 12996 2bafaeed5e2e
child 13156 26f0c3669b4e
equal deleted inserted replaced
13095:4118006fab95 13096:d78e65c66573
    75     while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do
    75     while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do
    76         inc(ammoidx);
    76         inc(ammoidx);
    77 
    77 
    78     if (MultiShootAttacks > 0) then
    78     if (MultiShootAttacks > 0) then
    79         begin
    79         begin
    80         if (CurAmmoType = amSniperRifle) and ((GameFlags and gfArtillery) = 0) then
    80         if (Effects[heArtillery] = 2) then
    81             cArtillery := false;
    81             Effects[heArtillery]:= 0;
    82         if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0 then
    82         if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0 then
    83             begin
    83             begin
    84             MultiShootAttacks:= Ammoz[CurAmmoType].Ammo.NumPerTurn;
    84             MultiShootAttacks:= Ammoz[CurAmmoType].Ammo.NumPerTurn;
    85             AfterAttack
    85             AfterAttack
    86             end
    86             end
   268             yy:= -AngleCos(Angle);
   268             yy:= -AngleCos(Angle);
   269 
   269 
   270             lx:= X + int2hwfloat(round(GetLaunchX(CurAmmoType, hwSign(dX), Angle)));
   270             lx:= X + int2hwfloat(round(GetLaunchX(CurAmmoType, hwSign(dX), Angle)));
   271             ly:= Y + int2hwfloat(round(GetLaunchY(CurAmmoType, Angle)));
   271             ly:= Y + int2hwfloat(round(GetLaunchY(CurAmmoType, Angle)));
   272 
   272 
   273             if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then
   273             if ((Gear^.State and gstHHHJump) <> 0) and (Effects[heArtillery] = 0) then
   274                 xx:= - xx;
   274                 xx:= - xx;
   275             if Ammoz[CurAmmoType].Ammo.AttackVoice <> sndNone then
   275             if Ammoz[CurAmmoType].Ammo.AttackVoice <> sndNone then
   276                 AddVoice(Ammoz[CurAmmoType].Ammo.AttackVoice, CurrentTeam^.voicepack);
   276                 AddVoice(Ammoz[CurAmmoType].Ammo.AttackVoice, CurrentTeam^.voicepack);
   277 
   277 
   278 // Initiating alt attack
   278 // Initiating alt attack
   827                     Gear^.Y:= Gear^.Y - _1;
   827                     Gear^.Y:= Gear^.Y - _1;
   828             if (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) = 0) and
   828             if (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) = 0) and
   829                (TestCollisionYwithGear(Gear, -1) = 0) then
   829                (TestCollisionYwithGear(Gear, -1) = 0) then
   830                 begin
   830                 begin
   831                 Gear^.dY:= -_0_15;
   831                 Gear^.dY:= -_0_15;
   832                 if not cArtillery then
   832                 if Gear^.Hedgehog^.Effects[heArtillery] = 0 then
   833                     Gear^.dX:= SignAs(_0_15, Gear^.dX);
   833                     Gear^.dX:= SignAs(_0_15, Gear^.dX);
   834                 Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
   834                 Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
   835                 PlaySoundV(sndJump1, Gear^.Hedgehog^.Team^.voicepack);
   835                 PlaySoundV(sndJump1, Gear^.Hedgehog^.Team^.voicepack);
   836         exit
   836         exit
   837         end;
   837         end;
   872         end;
   872         end;
   873     DeleteCI(Gear); // must be after exit!! (see previous line)
   873     DeleteCI(Gear); // must be after exit!! (see previous line)
   874 
   874 
   875     Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7;
   875     Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7;
   876 
   876 
   877     if (not cArtillery or
   877     if ((Gear^.Hedgehog^.Effects[heArtillery] = 0) or
   878            ((CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtBlowTorch))) and
   878            ((CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtBlowTorch))) and
   879        ((Gear^.Message and gmPrecise) = 0) then
   879        ((Gear^.Message and gmPrecise) = 0) then
   880         MakeHedgehogsStep(Gear);
   880         MakeHedgehogsStep(Gear);
   881 
   881 
   882     SetAllHHToActive(false);
   882     SetAllHHToActive(false);
  1041 
  1041 
  1042         CheckHHDamage(Gear);
  1042         CheckHHDamage(Gear);
  1043 
  1043 
  1044         if (land and lfBouncy = 0) or (Gear^.State and gstCollision <> 0) then
  1044         if (land and lfBouncy = 0) or (Gear^.State and gstCollision <> 0) then
  1045             begin
  1045             begin
  1046             if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery)
  1046             if ((Gear^.State and gstHHHJump) <> 0) and (Gear^.Hedgehog^.Effects[heArtillery] = 0)
  1047             and (Gear^.dX.QWordValue < _0_02.QWordValue) then
  1047             and (Gear^.dX.QWordValue < _0_02.QWordValue) then
  1048                 begin
  1048                 begin
  1049                 if land and lfBouncy <> 0 then
  1049                 if land and lfBouncy <> 0 then
  1050                     Gear^.dY:= _0;
  1050                     Gear^.dY:= _0;
  1051                 Gear^.dX.isNegative:= not Gear^.dX.isNegative // landing after high jump
  1051                 Gear^.dX.isNegative:= not Gear^.dX.isNegative // landing after high jump
  1346     if ((HHGear^.Message and gmHJump) <> 0) and wasJumping and ((HHGear^.State and gstHHHJump) = 0) then
  1346     if ((HHGear^.Message and gmHJump) <> 0) and wasJumping and ((HHGear^.State and gstHHHJump) = 0) then
  1347         if (not (hwAbs(HHGear^.dX) > cLittle)) and (HHGear^.dY < -_0_02) then
  1347         if (not (hwAbs(HHGear^.dX) > cLittle)) and (HHGear^.dY < -_0_02) then
  1348             begin
  1348             begin
  1349             HHGear^.State:= HHGear^.State or gstHHHJump;
  1349             HHGear^.State:= HHGear^.State or gstHHHJump;
  1350             HHGear^.dY:= -_0_25;
  1350             HHGear^.dY:= -_0_25;
  1351             if not cArtillery then
  1351             if (Hedgehog^.Effects[heArtillery] = 0) then
  1352                 HHGear^.dX:= -SignAs(_0_02, HHGear^.dX);
  1352                 HHGear^.dX:= -SignAs(_0_02, HHGear^.dX);
  1353             PlaySoundV(sndJump2, Hedgehog^.Team^.voicepack)
  1353             PlaySoundV(sndJump2, Hedgehog^.Team^.voicepack)
  1354             end;
  1354             end;
  1355 
  1355 
  1356     HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump));
  1356     HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump));
  1357 
  1357 
  1358     if (not cArtillery) and wasJumping and (TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) <> 0) then
  1358     if (Hedgehog^.Effects[heArtillery] = 0) and wasJumping and (TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) <> 0) then
  1359         SetLittle(HHGear^.dX);
  1359         SetLittle(HHGear^.dX);
  1360 
  1360 
  1361     if Hedgehog^.Gear <> nil then
  1361     if Hedgehog^.Gear <> nil then
  1362         doStepHedgehogMoving(HHGear);
  1362         doStepHedgehogMoving(HHGear);
  1363 
  1363