hedgewars/uGearsHandlersMess.pas
changeset 11550 881231c1ba46
parent 11540 1ae92bbb5a6d
child 11551 aefc770feb65
equal deleted inserted replaced
11549:893722a2a1f9 11550:881231c1ba46
  1335             end;
  1335             end;
  1336 end;
  1336 end;
  1337 
  1337 
  1338 procedure doStepDEagleShot(Gear: PGear);
  1338 procedure doStepDEagleShot(Gear: PGear);
  1339 begin
  1339 begin
       
  1340     Gear^.Data:= nil;
       
  1341     // remember who fired this
       
  1342     if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then
       
  1343         Gear^.Data:= Pointer(Gear^.Hedgehog^.Gear);
       
  1344 
  1340     PlaySound(sndGun);
  1345     PlaySound(sndGun);
  1341     // add 3 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just plain old weird angles
  1346     // add 3 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just plain old weird angles
  1342     Gear^.X := Gear^.X + Gear^.dX * 3;
  1347     Gear^.X := Gear^.X + Gear^.dX * 3;
  1343     Gear^.Y := Gear^.Y + Gear^.dY * 3;
  1348     Gear^.Y := Gear^.Y + Gear^.dY * 3;
  1344     Gear^.doStep := @doStepBulletWork
  1349     Gear^.doStep := @doStepBulletWork
  1347 procedure doStepSniperRifleShot(Gear: PGear);
  1352 procedure doStepSniperRifleShot(Gear: PGear);
  1348 var
  1353 var
  1349     HHGear: PGear;
  1354     HHGear: PGear;
  1350     shell: PVisualGear;
  1355     shell: PVisualGear;
  1351 begin
  1356 begin
       
  1357 
  1352     cArtillery := true;
  1358     cArtillery := true;
  1353     HHGear := Gear^.Hedgehog^.Gear;
  1359     HHGear := Gear^.Hedgehog^.Gear;
  1354 
  1360 
  1355     if HHGear = nil then
  1361     if HHGear = nil then
  1356         begin
  1362         begin
  1357         DeleteGear(gear);
  1363         DeleteGear(gear);
  1358         exit
  1364         exit
  1359         end;
  1365         end;
       
  1366 
       
  1367     // remember who fired this
       
  1368     Gear^.Data:= Pointer(Gear^.Hedgehog^.Gear);
  1360 
  1369 
  1361     HHGear^.State := HHGear^.State or gstNotKickable;
  1370     HHGear^.State := HHGear^.State or gstNotKickable;
  1362     HedgehogChAngle(HHGear);
  1371     HedgehogChAngle(HHGear);
  1363     if not cLaserSighting then
  1372     if not cLaserSighting then
  1364         // game does not have default laser sight. turn it on and give them a chance to aim
  1373         // game does not have default laser sight. turn it on and give them a chance to aim
  4355 
  4364 
  4356             if (hwRound(Distance(Gear^.X-ox,Gear^.Y-oy)) > Gear^.Radius + 1 ) then
  4365             if (hwRound(Distance(Gear^.X-ox,Gear^.Y-oy)) > Gear^.Radius + 1 ) then
  4357                 continue;
  4366                 continue;
  4358             end;
  4367             end;
  4359 
  4368 
  4360         // draw bullet trail
       
  4361         if isbullet then
  4369         if isbullet then
       
  4370             begin
       
  4371             // draw bullet trail
  4362             spawnBulletTrail(iterator);
  4372             spawnBulletTrail(iterator);
       
  4373             // the bullet can now hurt the hog that fired it
       
  4374             iterator^.Data:= nil;
       
  4375             end;
  4363 
  4376 
  4364         // calc gear offset in portal vector direction
  4377         // calc gear offset in portal vector direction
  4365         ox := (iterator^.X - Gear^.X);
  4378         ox := (iterator^.X - Gear^.X);
  4366         oy := (iterator^.Y - Gear^.Y);
  4379         oy := (iterator^.Y - Gear^.Y);
  4367         poffs:= (Gear^.dX * ox + Gear^.dY * oy);
  4380         poffs:= (Gear^.dX * ox + Gear^.dY * oy);