hedgewars/GSHandlers.inc
changeset 4372 3836973380b9
parent 4365 4f2b1a152979
child 4387 3698361802ed
equal deleted inserted replaced
4371:ae172b2b03ed 4372:3836973380b9
    76         begin
    76         begin
    77             d := r - hwRound(Distance(gi^.X - x, gi^.Y - y));
    77             d := r - hwRound(Distance(gi^.X - x, gi^.Y - y));
    78             if (d > 1) and not gi^.Invulnerable and (GetRandom(2) = 0) then
    78             if (d > 1) and not gi^.Invulnerable and (GetRandom(2) = 0) then
    79             begin
    79             begin
    80                 if (CurrentHedgehog^.Gear = gi) then
    80                 if (CurrentHedgehog^.Gear = gi) then
    81                     PlaySound(sndOops, PHedgehog(gi^.Hedgehog)^.Team^.voicepack)
    81                     PlaySound(sndOops, gi^.Hedgehog^.Team^.voicepack)
    82                 else
    82                 else
    83                 begin
    83                 begin
    84                     if (gi^.State and gstMoving) = 0 then
    84                     if (gi^.State and gstMoving) = 0 then
    85                         gi^.State := gi^.State or gstLoser;
    85                         gi^.State := gi^.State or gstLoser;
    86                     if d > r div 2 then
    86                     if d > r div 2 then
    87                         PlaySound(sndNooo, PHedgehog(gi^.Hedgehog)^.Team^.voicepack)
    87                         PlaySound(sndNooo, gi^.Hedgehog^.Team^.voicepack)
    88                     else
    88                     else
    89                         PlaySound(sndUhOh, PHedgehog(gi^.Hedgehog)^.Team^.voicepack);
    89                         PlaySound(sndUhOh, gi^.Hedgehog^.Team^.voicepack);
    90                 end;
    90                 end;
    91             end;
    91             end;
    92         end;
    92         end;
    93         gi := gi^.NextGear
    93         gi := gi^.NextGear
    94     end;
    94     end;
  1107        or (CheckGearDrowning(HHGear))
  1107        or (CheckGearDrowning(HHGear))
  1108        or TestCollisionYwithGear(HHGear, 1) then
  1108        or TestCollisionYwithGear(HHGear, 1) then
  1109     begin
  1109     begin
  1110         DeleteGear(Gear);
  1110         DeleteGear(Gear);
  1111         isCursorVisible := false;
  1111         isCursorVisible := false;
  1112         ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
  1112         ApplyAmmoChanges(HHGear^.Hedgehog^);
  1113         exit
  1113         exit
  1114     end;
  1114     end;
  1115 
  1115 
  1116     HedgehogChAngle(HHGear);
  1116     HedgehogChAngle(HHGear);
  1117 
  1117 
  1354 
  1354 
  1355 procedure RemoveFromAmmo;
  1355 procedure RemoveFromAmmo;
  1356 begin
  1356 begin
  1357     if (Gear^.State and gstAttacked) = 0 then
  1357     if (Gear^.State and gstAttacked) = 0 then
  1358     begin
  1358     begin
  1359         OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
  1359         OnUsedAmmo(HHGear^.Hedgehog^);
  1360         Gear^.State := Gear^.State or gstAttacked
  1360         Gear^.State := Gear^.State or gstAttacked
  1361     end;
  1361     end;
  1362     ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^)
  1362     ApplyAmmoChanges(HHGear^.Hedgehog^)
  1363 end;
  1363 end;
  1364 
  1364 
  1365 begin
  1365 begin
  1366     Gear^.X := Gear^.X - Gear^.dX;
  1366     Gear^.X := Gear^.X - Gear^.dX;
  1367     Gear^.Y := Gear^.Y - Gear^.dY;
  1367     Gear^.Y := Gear^.Y - Gear^.dY;
  2019     Gear^.dX := SignAs(_0_45, Gear^.dX);
  2019     Gear^.dX := SignAs(_0_45, Gear^.dX);
  2020     Gear^.dY := - _0_9;
  2020     Gear^.dY := - _0_9;
  2021     Gear^.doStep := @doStepFirePunchWork;
  2021     Gear^.doStep := @doStepFirePunchWork;
  2022     DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5);
  2022     DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5);
  2023 
  2023 
  2024     PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), PHedgehog(HHGear^.Hedgehog)^.Team^.
  2024     PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), HHGear^.Hedgehog^.Team^.
  2025     voicepack)
  2025     voicepack)
  2026 end;
  2026 end;
  2027 
  2027 
  2028 ////////////////////////////////////////////////////////////////////////////////
  2028 ////////////////////////////////////////////////////////////////////////////////
  2029 
  2029 
  2047             dY := _0;
  2047             dY := _0;
  2048             State := State or gstMoving;
  2048             State := State or gstMoving;
  2049         end;
  2049         end;
  2050         DeleteGear(Gear);
  2050         DeleteGear(Gear);
  2051         isCursorVisible := false;
  2051         isCursorVisible := false;
  2052         ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
  2052         ApplyAmmoChanges(HHGear^.Hedgehog^);
  2053         exit
  2053         exit
  2054     end;
  2054     end;
  2055 
  2055 
  2056     if not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
  2056     if not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
  2057         HHGear^.X := HHGear^.X + cWindSpeed * 200;
  2057         HHGear^.X := HHGear^.X + cWindSpeed * 200;
  2276     if ((Gear^.Message and not gmSwitch) <> 0) or (TurnTimeLeft = 0) then
  2276     if ((Gear^.Message and not gmSwitch) <> 0) or (TurnTimeLeft = 0) then
  2277     begin
  2277     begin
  2278         HHGear := Gear^.Hedgehog^.Gear;
  2278         HHGear := Gear^.Hedgehog^.Gear;
  2279         Msg := Gear^.Message and not gmSwitch;
  2279         Msg := Gear^.Message and not gmSwitch;
  2280         DeleteGear(Gear);
  2280         DeleteGear(Gear);
  2281         OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
  2281         OnUsedAmmo(HHGear^.Hedgehog^);
  2282         ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
  2282         ApplyAmmoChanges(HHGear^.Hedgehog^);
  2283 
  2283 
  2284         HHGear := CurrentHedgehog^.Gear;
  2284         HHGear := CurrentHedgehog^.Gear;
  2285         ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
  2285         ApplyAmmoChanges(HHGear^.Hedgehog^);
  2286         HHGear^.Message := Msg;
  2286         HHGear^.Message := Msg;
  2287         exit
  2287         exit
  2288     end;
  2288     end;
  2289 
  2289 
  2290     if (Gear^.Message and gmSwitch) <> 0 then
  2290     if (Gear^.Message and gmSwitch) <> 0 then
  3150             Active := true;
  3150             Active := true;
  3151             State := State or gstMoving
  3151             State := State or gstMoving
  3152             end;
  3152             end;
  3153         DeleteGear(Gear);
  3153         DeleteGear(Gear);
  3154         isCursorVisible := false;
  3154         isCursorVisible := false;
  3155         ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
  3155         ApplyAmmoChanges(HHGear^.Hedgehog^);
  3156         //    if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
  3156         //    if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
  3157 
  3157 
  3158 //    Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall)
  3158 //    Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall)
  3159 
  3159 
  3160 //AddCaption(trmsg[sidFuel]+': '+inttostr(round(Gear^.Health/20))+'%', cWhiteColor, capgrpAmmostate);
  3160 //AddCaption(trmsg[sidFuel]+': '+inttostr(round(Gear^.Health/20))+'%', cWhiteColor, capgrpAmmostate);
  4319                         gtHedgehog, gstWait, _0, _0, 0);
  4319                         gtHedgehog, gstWait, _0, _0, 0);
  4320                 resgear^.Hedgehog := graves[i]^.Hedgehog;
  4320                 resgear^.Hedgehog := graves[i]^.Hedgehog;
  4321                 resgear^.Health := graves[i]^.Health;
  4321                 resgear^.Health := graves[i]^.Health;
  4322                 PHedgehog(graves[i]^.Hedgehog)^.Gear := resgear;
  4322                 PHedgehog(graves[i]^.Hedgehog)^.Gear := resgear;
  4323                 DeleteGear(graves[i]);
  4323                 DeleteGear(graves[i]);
  4324                 RenderHealth(PHedgehog(resgear^.Hedgehog)^);
  4324                 RenderHealth(resgear^.Hedgehog^);
  4325                 RecountTeamHealth(Phedgehog(resgear^.Hedgehog)^.Team);
  4325                 RecountTeamHealth(resgear^.Hedgehog^.Team);
  4326                 PHedgehog(resgear^.Hedgehog)^.Effects[heResurrected]:= true;
  4326                 resgear^.Hedgehog^.Effects[heResurrected]:= true;
  4327                 if PHedgehog(resgear^.Hedgehog)^.Hat = 'NoHat' then
  4327                 if resgear^.Hedgehog^.Hat = 'NoHat' then
  4328                     begin
  4328                     begin
  4329                     FreeTexture(PHedgehog(resgear^.Hedgehog)^.HatTex);
  4329                     FreeTexture(resgear^.Hedgehog^.HatTex);
  4330                     PHedgehog(resgear^.Hedgehog)^.HatTex := Surface2Tex(
  4330                     resgear^.Hedgehog^.HatTex := Surface2Tex(
  4331                         LoadImage(Pathz[ptHats] + '/Reserved/Zombie', ifNone),
  4331                         LoadImage(Pathz[ptHats] + '/Reserved/Zombie', ifNone),
  4332                         True)
  4332                         True)
  4333                     end
  4333                     end
  4334                 end;
  4334                 end;
  4335 
  4335