hedgewars/HHHandlers.inc
changeset 5319 51d8e4747876
parent 5316 191cd6c06203
child 5322 1bcc12a30d5d
equal deleted inserted replaced
5316:191cd6c06203 5319:51d8e4747876
   134         begin
   134         begin
   135         color:= Gear^.Hedgehog^.Team^.Clan^.Color;
   135         color:= Gear^.Hedgehog^.Team^.Clan^.Color;
   136         case Gear^.MsgParam of
   136         case Gear^.MsgParam of
   137             1: begin
   137             1: begin
   138                AddCaption(format(trmsg[sidBounce], trmsg[sidBounce1]), color, capgrpAmmostate);
   138                AddCaption(format(trmsg[sidBounce], trmsg[sidBounce1]), color, capgrpAmmostate);
   139                Gear^.Hedgehog^.Bounce:= _0_3
   139                CurWeapon^.Bounciness:= 350;
   140                end;
   140                end;
   141             2: begin
   141             2: begin
   142                AddCaption(format(trmsg[sidBounce], trmsg[sidBounce2]), color, capgrpAmmostate);
   142                AddCaption(format(trmsg[sidBounce], trmsg[sidBounce2]), color, capgrpAmmostate);
   143                Gear^.Hedgehog^.Bounce:= _0_7
   143                CurWeapon^.Bounciness:= 700;
   144                end;
   144                end;
   145             3: begin
   145             3: begin
   146                AddCaption(format(trmsg[sidBounce], trmsg[sidBounce3]), color, capgrpAmmostate);
   146                AddCaption(format(trmsg[sidBounce], trmsg[sidBounce3]), color, capgrpAmmostate);
   147                Gear^.Hedgehog^.Bounce:= _1
   147                CurWeapon^.Bounciness:= 1000;
   148                end;
   148                end;
   149             4: begin
   149             4: begin
   150                AddCaption(format(trmsg[sidBounce], trmsg[sidBounce4]), color, capgrpAmmostate);
   150                AddCaption(format(trmsg[sidBounce], trmsg[sidBounce4]), color, capgrpAmmostate);
   151                Gear^.Hedgehog^.Bounce:= _2
   151                CurWeapon^.Bounciness:= 2000;
   152                end;
   152                end;
   153             5: begin
   153             5: begin
   154                AddCaption(format(trmsg[sidBounce], trmsg[sidBounce5]), color, capgrpAmmostate);
   154                AddCaption(format(trmsg[sidBounce], trmsg[sidBounce5]), color, capgrpAmmostate);
   155                Gear^.Hedgehog^.Bounce:= _4
   155                CurWeapon^.Bounciness:= 4000;
   156                end
   156                end
   157             end
   157             end
   158         end
   158         end
   159     else if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then
   159     else if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then
   160         begin
   160         begin
   169 var xx, yy, newDx, newDy, lx, ly: hwFloat;
   169 var xx, yy, newDx, newDy, lx, ly: hwFloat;
   170     speech: PVisualGear;
   170     speech: PVisualGear;
   171     newGear:  PGear;
   171     newGear:  PGear;
   172     CurWeapon: PAmmo;
   172     CurWeapon: PAmmo;
   173     altUse: boolean;
   173     altUse: boolean;
       
   174     elastic: hwFloat;
   174 begin
   175 begin
   175 bShowFinger:= false;
   176 bShowFinger:= false;
   176 CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
   177 CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
   177 with Gear^,
   178 with Gear^,
   178      Gear^.Hedgehog^ do
   179      Gear^.Hedgehog^ do
   373                   end;
   374                   end;
   374 
   375 
   375         // Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
   376         // Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
   376         if altUse then FollowGear:= nil;
   377         if altUse then FollowGear:= nil;
   377 
   378 
       
   379         if ((Ammoz[newGear^.AmmoType].Ammo.Propz and ammoprop_SetBounce) <> 0) and (newGear <> nil) then
       
   380             begin
       
   381             elastic:=  int2hwfloat(CurWeapon^.Bounciness) / _1000;
       
   382 
       
   383             if elastic < _1 then newGear^.Elasticity:= newGear^.Elasticity * elastic
       
   384             else if elastic > _1 then newGear^.Elasticity:= _1 - ((_1-newGear^.Elasticity) / elastic);
       
   385 (* Experimented with friction modifier. Didn't seem helpful 
       
   386             fric:= int2hwfloat(CurWeapon^.Bounciness) / _250;
       
   387             if fric < _1 then newGear^.Friction:= newGear^.Friction * fric
       
   388             else if fric > _1 then newGear^.Friction:= _1 - ((_1-newGear^.Friction) / fric)*)
       
   389             end;
       
   390 
       
   391 
   378         uStats.AmmoUsed(CurAmmoType);
   392         uStats.AmmoUsed(CurAmmoType);
   379 
   393 
   380         if not (SpeechText = '') then
   394         if not (SpeechText = '') then
   381             begin
   395             begin
   382             speech:= AddVisualGear(0, 0, vgtSpeechBubble);
   396             speech:= AddVisualGear(0, 0, vgtSpeechBubble);