hedgewars/uGearsHedgehog.pas
changeset 10124 aabd1b75d5a3
parent 10123 64e72781d344
child 10146 1fb6d8cc4626
equal deleted inserted replaced
10123:64e72781d344 10124:aabd1b75d5a3
   515     TargetPoint.X := NoPointX;
   515     TargetPoint.X := NoPointX;
   516     ScriptCall('onHogAttack');
   516     ScriptCall('onHogAttack');
   517 end;
   517 end;
   518 
   518 
   519 procedure AfterAttack;
   519 procedure AfterAttack;
   520 var s: shortstring;
   520 var s: ansistring;
   521     a: TAmmoType;
   521     a: TAmmoType;
   522     HHGear: PGear;
   522     HHGear: PGear;
   523 begin
   523 begin
   524 with CurrentHedgehog^ do
   524 with CurrentHedgehog^ do
   525     begin
   525     begin
   530         begin
   530         begin
   531         Inc(MultiShootAttacks);
   531         Inc(MultiShootAttacks);
   532 
   532 
   533         if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then
   533         if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then
   534             begin
   534             begin
   535             s:= inttostr(Ammoz[a].Ammo.NumPerTurn - MultiShootAttacks + 1);
   535             s:= ansistring(inttostr(Ammoz[a].Ammo.NumPerTurn - MultiShootAttacks + 1));
   536             AddCaption(format(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate);
   536             AddCaption(formatA(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate);
   537             end;
   537             end;
   538 
   538 
   539         if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks)
   539         if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks)
   540         or ((GameFlags and gfMultiWeapon) <> 0) then
   540         or ((GameFlags and gfMultiWeapon) <> 0) then
   541             begin
   541             begin
   634     Gear^.Timer:= timertime
   634     Gear^.Timer:= timertime
   635     end
   635     end
   636 end;
   636 end;
   637 
   637 
   638 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord);
   638 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord);
   639 var s: shortstring;
   639 var s: ansistring;
   640     vga: PVisualGear;
   640     vga: PVisualGear;
   641 begin
   641 begin
   642     if cnt <> 0 then AddAmmo(HH, ammo, cnt)
   642     if cnt <> 0 then AddAmmo(HH, ammo, cnt)
   643     else AddAmmo(HH, ammo);
   643     else AddAmmo(HH, ammo);
   644 
   644 
   712                     PlaySound(sndShotgunReload);
   712                     PlaySound(sndShotgunReload);
   713                     inc(HH^.Health, Gear^.Health);
   713                     inc(HH^.Health, Gear^.Health);
   714                     HH^.Hedgehog^.Effects[hePoisoned] := 0;
   714                     HH^.Hedgehog^.Effects[hePoisoned] := 0;
   715                     str(Gear^.Health, s);
   715                     str(Gear^.Health, s);
   716                     s:= '+' + s;
   716                     s:= '+' + s;
   717                     AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
   717                     AddCaption(ansistring(s), HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
   718                     RenderHealth(HH^.Hedgehog^);
   718                     RenderHealth(HH^.Hedgehog^);
   719                     RecountTeamHealth(HH^.Hedgehog^.Team);
   719                     RecountTeamHealth(HH^.Hedgehog^.Team);
   720 
   720 
   721                     i:= 0;
   721                     i:= 0;
   722                     while i < Gear^.Health do
   722                     while i < Gear^.Health do
  1232 end;
  1232 end;
  1233 
  1233 
  1234 ////////////////////////////////////////////////////////////////////////////////
  1234 ////////////////////////////////////////////////////////////////////////////////
  1235 procedure doStepHedgehogFree(Gear: PGear);
  1235 procedure doStepHedgehogFree(Gear: PGear);
  1236 var prevState: Longword;
  1236 var prevState: Longword;
       
  1237     s: ansistring;
  1237 begin
  1238 begin
  1238 prevState:= Gear^.State;
  1239 prevState:= Gear^.State;
  1239 
  1240 
  1240 doStepHedgehogMoving(Gear);
  1241 doStepHedgehogMoving(Gear);
  1241 
  1242 
  1266             else
  1267             else
  1267                 begin
  1268                 begin
  1268                 Gear^.State:= (Gear^.State or gstHHDeath) and (not gstAnimation);
  1269                 Gear^.State:= (Gear^.State or gstHHDeath) and (not gstAnimation);
  1269                 Gear^.doStep:= @doStepHedgehogDead;
  1270                 Gear^.doStep:= @doStepHedgehogDead;
  1270                 // Death message
  1271                 // Death message
  1271                 AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
  1272                 s:= ansistring(Gear^.Hedgehog^.Name);
       
  1273                 AddCaption(FormatA(GetEventString(eidDied), s), cWhiteColor, capgrpMessage);
  1272                 end;
  1274                 end;
  1273             end
  1275             end
  1274         else
  1276         else
  1275             begin
  1277             begin
  1276             Gear^.State:= Gear^.State and (not gstAnimation);
  1278             Gear^.State:= Gear^.State and (not gstAnimation);
  1277             Gear^.doStep:= @doStepHedgehogGone;
  1279             Gear^.doStep:= @doStepHedgehogGone;
  1278 
  1280 
  1279             // Gone message
  1281             // Gone message
  1280             AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
  1282             s:= ansistring(Gear^.Hedgehog^.Name);
       
  1283             AddCaption(FormatA(GetEventString(eidGone), s), cWhiteColor, capgrpMessage);
  1281             end
  1284             end
  1282         end;
  1285         end;
  1283     exit
  1286     exit
  1284     end;
  1287     end;
  1285 
  1288