hedgewars/HHHandlers.inc
changeset 1669 b709e061577e
parent 1658 208a3258afdf
child 1682 f8c4af3a2b54
equal deleted inserted replaced
1668:ceee3f20c784 1669:b709e061577e
   112         else if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) = 0 then Message:= Message and not gm_Attack
   112         else if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) = 0 then Message:= Message and not gm_Attack
   113         else begin
   113         else begin
   114              if Power = 0 then
   114              if Power = 0 then
   115                 begin
   115                 begin
   116                 AttackBar:= CurrentTeam^.AttackBar;
   116                 AttackBar:= CurrentTeam^.AttackBar;
   117                 PlaySound(sndThrowPowerUp, false)
   117                 PlaySound(sndThrowPowerUp, false, nil)
   118                 end;
   118                 end;
   119              inc(Power)
   119              inc(Power)
   120              end;
   120              end;
   121         if ((Message and gm_Attack) <> 0) then exit;
   121         if ((Message and gm_Attack) <> 0) then exit;
   122 
   122 
   123         if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then
   123         if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then
   124            begin
   124            begin
   125            StopSound(sndThrowPowerUp);
   125            StopSound(sndThrowPowerUp);
   126            PlaySound(sndThrowRelease, false);
   126            PlaySound(sndThrowRelease, false, nil);
   127            end;
   127            end;
   128         xx:= SignAs(AngleSin(Angle), dX);
   128         xx:= SignAs(AngleSin(Angle), dX);
   129         yy:= -AngleCos(Angle);
   129         yy:= -AngleCos(Angle);
   130 
   130 
   131         if ((Gear^.State and gstHHHJump) <> 0) then xx:= - xx;
   131         if ((Gear^.State and gstHHHJump) <> 0) then xx:= - xx;
   133                       amGrenade: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtAmmo_Bomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
   133                       amGrenade: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtAmmo_Bomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
   134                   amClusterBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtClusterBomb,  0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
   134                   amClusterBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtClusterBomb,  0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
   135                       amBazooka: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtAmmo_Grenade, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
   135                       amBazooka: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtAmmo_Grenade, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
   136                           amUFO: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtUFO,          0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
   136                           amUFO: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtUFO,          0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
   137                       amShotgun: begin
   137                       amShotgun: begin
   138                                  PlaySound(sndShotgunReload, false);
   138                                  PlaySound(sndShotgunReload, false, nil);
   139                                  CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtShotgunShot,  0, xx * _0_5, yy * _0_5, 0);
   139                                  CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtShotgunShot,  0, xx * _0_5, yy * _0_5, 0);
   140                                  end;
   140                                  end;
   141                    amPickHammer: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
   141                    amPickHammer: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
   142                          amSkip: ParseCommand('/skip', true);
   142                          amSkip: ParseCommand('/skip', true);
   143                          amRope: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtRope, 0, xx, yy, 0);
   143                          amRope: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtRope, 0, xx, yy, 0);
   144                          amMine: begin
   144                          amMine: begin
   145                                  AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtMine, 0, SignAs(_0_02, dX), _0, 3000);
   145                                  AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtMine, 0, SignAs(_0_02, dX), _0, 3000);
   146                                  PlaySound(sndLaugh, false)
   146                                  PlaySound(sndLaugh, false, nil)
   147                                  end;
   147                                  end;
   148                        amDEagle: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
   148                        amDEagle: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
   149                      amDynamite: begin
   149                      amDynamite: begin
   150                                  AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
   150                                  AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
   151                                  PlaySound(sndLaugh, false)
   151                                  PlaySound(sndLaugh, false, nil)
   152                                  end;
   152                                  end;
   153                     amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, xx, _0, 0);
   153                     amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, xx, _0, 0);
   154                          amWhip: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
   154                          amWhip: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
   155                   amBaseballBat: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0);
   155                   amBaseballBat: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0);
   156                     amParachute: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtParachute, 0, _0, _0, 0);
   156                     amParachute: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtParachute, 0, _0, _0, 0);
   162                        amSwitch: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtSwitcher, 0, _0, _0, 0);
   162                        amSwitch: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtSwitcher, 0, _0, _0, 0);
   163                        amMortar: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtMortar,  0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0);
   163                        amMortar: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtMortar,  0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0);
   164                        amKamikaze: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
   164                        amKamikaze: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
   165                          amCake: begin
   165                          amCake: begin
   166                                  CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 3, hwRound(Y), gtCake, 0, xx, _0, 0);
   166                                  CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 3, hwRound(Y), gtCake, 0, xx, _0, 0);
   167                                  PlaySound(sndLaugh, false)
   167                                  PlaySound(sndLaugh, false, nil)
   168                                  end;
   168                                  end;
   169                     amSeduction: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius * 2), hwRound(Y + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
   169                     amSeduction: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius * 2), hwRound(Y + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
   170                    amWatermelon: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtWatermelon,  0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
   170                    amWatermelon: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtWatermelon,  0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
   171                   amHellishBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtHellishBomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 5000);
   171                   amHellishBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtHellishBomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 5000);
   172                        amNapalm: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 2, _0, _0, 0);
   172                        amNapalm: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 2, _0, _0, 0);
   232 	begin
   232 	begin
   233 	AllInactive:= false;
   233 	AllInactive:= false;
   234 	Gear^.Z:= cCurrHHZ;
   234 	Gear^.Z:= cCurrHHZ;
   235 	RemoveGearFromList(Gear);
   235 	RemoveGearFromList(Gear);
   236 	InsertGearToList(Gear);
   236 	InsertGearToList(Gear);
   237 	PlaySound(sndByeBye, false);
   237 	PlaySound(sndByeBye, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
   238 	Gear^.Pos:= 0;
   238 	Gear^.Pos:= 0;
   239 	Gear^.Timer:= timertime
   239 	Gear^.Timer:= timertime
   240 	end
   240 	end
   241 end;
   241 end;
   242 
   242 
   310          or   TestCollisionYwithGear(Gear, -1)) then
   310          or   TestCollisionYwithGear(Gear, -1)) then
   311          begin
   311          begin
   312          Gear^.dY:= -_0_15;
   312          Gear^.dY:= -_0_15;
   313          Gear^.dX:= SignAs(_0_15, Gear^.dX);
   313          Gear^.dX:= SignAs(_0_15, Gear^.dX);
   314          Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
   314          Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
   315          PlaySound(sndJump1, false);
   315          PlaySound(sndJump1, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
   316          exit
   316          exit
   317          end;
   317          end;
   318       end;
   318       end;
   319 
   319 
   320    if ((Gear^.Message and gm_HJump ) <> 0) then
   320    if ((Gear^.Message and gm_HJump ) <> 0) then
   323       Gear^.Message:= Gear^.Message and not gm_HJump;
   323       Gear^.Message:= Gear^.Message and not gm_HJump;
   324 
   324 
   325       Gear^.dY:= -_0_2;
   325       Gear^.dY:= -_0_2;
   326       SetLittle(Gear^.dX);
   326       SetLittle(Gear^.dX);
   327       Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
   327       Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
   328       PlaySound(sndJump3, false);
   328       PlaySound(sndJump3, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
   329       exit
   329       exit
   330       end;
   330       end;
   331 
   331 
   332    PrevdX:= hwSign(Gear^.dX);
   332    PrevdX:= hwSign(Gear^.dX);
   333    if (Gear^.Message and gm_Left  )<>0 then Gear^.dX:= -cLittle else
   333    if (Gear^.Message and gm_Left  )<>0 then Gear^.dX:= -cLittle else
   580 		if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
   580 		if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
   581 			begin
   581 			begin
   582 			Gear^.State:= Gear^.State or gstHHHJump or gstMoving;
   582 			Gear^.State:= Gear^.State or gstHHHJump or gstMoving;
   583 			Gear^.dY:= -_0_25;
   583 			Gear^.dY:= -_0_25;
   584 			Gear^.dX:= -SignAs(_0_02, Gear^.dX);
   584 			Gear^.dX:= -SignAs(_0_02, Gear^.dX);
   585 			PlaySound(sndJump2, false)
   585 			PlaySound(sndJump2, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
   586 			end;
   586 			end;
   587 	
   587 	
   588 	Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
   588 	Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
   589 
   589 
   590 	if wasJumping and
   590 	if wasJumping and