hedgewars/uGears.pas
changeset 5316 191cd6c06203
parent 5313 5e18eaef65d0
child 5319 51d8e4747876
equal deleted inserted replaced
5313:5e18eaef65d0 5316:191cd6c06203
   220 gear^.FlightTime:= 0;
   220 gear^.FlightTime:= 0;
   221 gear^.uid:= Counter;
   221 gear^.uid:= Counter;
   222 gear^.SoundChannel:= -1;
   222 gear^.SoundChannel:= -1;
   223 gear^.ImpactSound:= sndNone;
   223 gear^.ImpactSound:= sndNone;
   224 gear^.nImpactSounds:= 0;
   224 gear^.nImpactSounds:= 0;
       
   225 gear^.AmmoType:= amNothing;
   225 
   226 
   226 if CurrentHedgehog <> nil then
   227 if CurrentHedgehog <> nil then
   227     begin
   228     begin
   228     gear^.Hedgehog:= CurrentHedgehog;
   229     gear^.Hedgehog:= CurrentHedgehog;
   229     gear^.IntersectGear:= CurrentHedgehog^.Gear
   230     gear^.IntersectGear:= CurrentHedgehog^.Gear
   230     end;
   231     end;
       
   232 // Define ammo association, if any.
       
   233 case Kind of
       
   234         gtGrenade: gear^.AmmoType:= amGrenade;
       
   235           gtShell: gear^.AmmoType:= amBazooka;
       
   236             gtBee: gear^.AmmoType:= amBee;
       
   237     gtShotgunShot: gear^.AmmoType:= amShotgun;
       
   238      gtPickHammer: gear^.AmmoType:= amPickHammer;
       
   239            gtRope: gear^.AmmoType:= amRope;
       
   240      gtDEagleShot: gear^.AmmoType:= amDEagle;
       
   241        gtDynamite: gear^.AmmoType:= amDynamite;
       
   242     gtClusterBomb, 
       
   243         gtCluster: gear^.AmmoType:= amClusterBomb;
       
   244          gtShover: gear^.AmmoType:= amBaseballBat;  // Shover is only used for baseball bat right now
       
   245       gtFirePunch: gear^.AmmoType:= amFirePunch;
       
   246       gtParachute: gear^.AmmoType:= amParachute;
       
   247         gtAirBomb: gear^.AmmoType:= amAirAttack;
       
   248       gtBlowTorch: gear^.AmmoType:= amBlowTorch;
       
   249          gtGirder: gear^.AmmoType:= amGirder;
       
   250        gtTeleport: gear^.AmmoType:= amTeleport;
       
   251        gtSwitcher: gear^.AmmoType:= amSwitch;
       
   252          gtMortar: gear^.AmmoType:= amMortar;
       
   253            gtWhip: gear^.AmmoType:= amWhip;
       
   254        gtKamikaze: gear^.AmmoType:= amKamikaze;
       
   255            gtCake: gear^.AmmoType:= amCake;
       
   256       gtSeduction: gear^.AmmoType:= amSeduction;
       
   257      gtWatermelon,
       
   258      gtMelonPiece: gear^.AmmoType:= amWatermelon;
       
   259     gtHellishBomb: gear^.AmmoType:= amHellishBomb;
       
   260           gtDrill: gear^.AmmoType:= amDrill;
       
   261         gtBallGun,
       
   262            gtBall: gear^.AmmoType:= amBallgun;
       
   263         gtRCPlane: gear^.AmmoType:= amRCPlane;
       
   264 gtSniperRifleShot: gear^.AmmoType:= amSniperRifle;
       
   265         gtJetpack: gear^.AmmoType:= amJetpack;
       
   266         gtMolotov: gear^.AmmoType:= amMolotov;
       
   267           gtBirdy, 
       
   268             gtEgg: gear^.AmmoType:= amBirdy;
       
   269          gtPortal: gear^.AmmoType:= amPortalGun;
       
   270           gtPiano: gear^.AmmoType:= amPiano;
       
   271         gtGasBomb: gear^.AmmoType:= amGasBomb;
       
   272     gtSineGunShot: gear^.AmmoType:= amSineGun;
       
   273    gtFlamethrower: gear^.AmmoType:= amFlamethrower;
       
   274           gtSMine: gear^.AmmoType:= amSMine;
       
   275          gtHammer, 
       
   276       gtHammerHit: gear^.AmmoType:= amHammer;
       
   277     gtResurrector: gear^.AmmoType:= amResurrector;
       
   278        gtSnowball: gear^.AmmoType:= amSnowball;
       
   279       gtStructure: gear^.AmmoType:= amStructure;  // TODO - This will undoubtedly change once there is more than one structure
       
   280         gtLandGun: gear^.AmmoType:= amLandGun;
       
   281          gtTardis: gear^.AmmoType:= amTardis;
       
   282 end;
   231 
   283 
   232 case Kind of
   284 case Kind of
   233      gtGrenade,
   285      gtGrenade,
   234      gtClusterBomb,
   286      gtClusterBomb,
   235      gtGasBomb: begin
   287      gtGasBomb: begin
   547                 gear^.Radius:= 13;
   599                 gear^.Radius:= 13;
   548                 gear^.Health:= 200;
   600                 gear^.Health:= 200;
   549                 gear^.Tag:= 3;
   601                 gear^.Tag:= 3;
   550                 end;
   602                 end;
   551     end;
   603     end;
       
   604 
       
   605 if ((Ammoz[gear^.AmmoType].Ammo.Propz and ammoprop_SetBounce) <> 0) and (CurrentHedgehog <> nil) then 
       
   606     if CurrentHedgehog^.Bounce < _1 then 
       
   607         begin
       
   608         gear^.Elasticity:= gear^.Elasticity * CurrentHedgehog^.Bounce;
       
   609         gear^.Friction:= gear^.Friction * CurrentHedgehog^.Bounce
       
   610         end
       
   611     else 
       
   612         begin
       
   613         gear^.Elasticity:= _1 - ((_1-gear^.Elasticity) / CurrentHedgehog^.Bounce);
       
   614         gear^.Friction:= _1 - ((_1-gear^.Friction) / CurrentHedgehog^.Bounce);
       
   615         end;
   552 
   616 
   553 InsertGearToList(gear);
   617 InsertGearToList(gear);
   554 AddGear:= gear;
   618 AddGear:= gear;
   555 
   619 
   556 ScriptCall('onGearAdd', gear^.uid);
   620 ScriptCall('onGearAdd', gear^.uid);