hedgewars/GSHandlers.inc
changeset 522 ca089787f59d
parent 521 bc8fd78d7598
child 525 ae21b8e86dd9
equal deleted inserted replaced
521:bc8fd78d7598 522:ca089787f59d
    36    then Gear^.State:= Gear^.State or      gstCollision
    36    then Gear^.State:= Gear^.State or      gstCollision
    37    else Gear^.State:= Gear^.State and not gstCollision
    37    else Gear^.State:= Gear^.State and not gstCollision
    38 end;
    38 end;
    39 
    39 
    40 procedure CheckHHDamage(Gear: PGear);
    40 procedure CheckHHDamage(Gear: PGear);
    41 begin
    41 var dmg: Longword;
    42 if _0_4 < Gear^.dY then Gear^.Damage:= Gear^.Damage + 1 + hwRound((hwAbs(Gear^.dY) - _0_4) * 70);
    42 begin
       
    43 if _0_4 < Gear^.dY then
       
    44    begin
       
    45    dmg:= 1 + hwRound((hwAbs(Gear^.dY) - _0_4) * 70);
       
    46    inc(Gear^.Damage, dmg);
       
    47    AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, dmg, Gear);
       
    48    end
    43 end;
    49 end;
    44 
    50 
    45 ////////////////////////////////////////////////////////////////////////////////
    51 ////////////////////////////////////////////////////////////////////////////////
    46 ////////////////////////////////////////////////////////////////////////////////
    52 ////////////////////////////////////////////////////////////////////////////////
    47 procedure CalcRotationDirAngle(Gear: PGear);
    53 procedure CalcRotationDirAngle(Gear: PGear);
   167 end;
   173 end;
   168 
   174 
   169 ////////////////////////////////////////////////////////////////////////////////
   175 ////////////////////////////////////////////////////////////////////////////////
   170 procedure doStepHealthTagWork(Gear: PGear);
   176 procedure doStepHealthTagWork(Gear: PGear);
   171 begin
   177 begin
   172 AllInactive:= false;
   178 if Gear^.Kind = gtHealthTag then
       
   179    AllInactive:= false;
   173 dec(Gear^.Timer);
   180 dec(Gear^.Timer);
   174 Gear^.Y:= Gear^.Y - _0_08;
   181 Gear^.Y:= Gear^.Y + Gear^.dY;
   175 if Gear^.Timer = 0 then
   182 if Gear^.Timer = 0 then
   176    begin
   183    begin
   177    PHedgehog(Gear^.Hedgehog)^.Gear^.Active:= true; // to let current hh die
   184    if Gear^.Kind = gtHealthTag then
       
   185       PHedgehog(Gear^.Hedgehog)^.Gear^.Active:= true; // to let current hh die
   178    DeleteGear(Gear)
   186    DeleteGear(Gear)
   179    end
   187    end
   180 end;
   188 end;
   181 
   189 
   182 procedure doStepHealthTagWorkUnderWater(Gear: PGear);
   190 procedure doStepHealthTagWorkUnderWater(Gear: PGear);
   187    DeleteGear(Gear)
   195    DeleteGear(Gear)
   188 end;
   196 end;
   189 
   197 
   190 procedure doStepHealthTag(Gear: PGear);
   198 procedure doStepHealthTag(Gear: PGear);
   191 var s: shortstring;
   199 var s: shortstring;
   192 begin
   200     font: THWFont;
   193 AllInactive:= false;
   201 begin
       
   202 AllInactive:= false;
       
   203 if Gear^.Kind = gtHealthTag then
       
   204    begin
       
   205    font:= fnt16;
       
   206    Gear^.dY:= -_0_08
       
   207    end else
       
   208    begin
       
   209    font:= fntSmall;
       
   210    Gear^.dY:= -_0_02
       
   211    end;
       
   212 
   194 str(Gear^.State, s);
   213 str(Gear^.State, s);
   195 Gear^.Surf:= RenderString(s, PHedgehog(Gear^.Hedgehog)^.Team^.Color, fnt16);
   214 Gear^.Surf:= RenderString(s, PHedgehog(Gear^.Hedgehog)^.Team^.Color, font);
   196 if hwRound(Gear^.Y) < cWaterLine then Gear^.doStep:= @doStepHealthTagWork
   215 if hwRound(Gear^.Y) < cWaterLine then Gear^.doStep:= @doStepHealthTagWork
   197                                  else Gear^.doStep:= @doStepHealthTagWorkUnderWater
   216                                  else Gear^.doStep:= @doStepHealthTagWorkUnderWater;
       
   217 Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Surf^.h)
   198 end;
   218 end;
   199 
   219 
   200 ////////////////////////////////////////////////////////////////////////////////
   220 ////////////////////////////////////////////////////////////////////////////////
   201 procedure doStepGrave(Gear: PGear);
   221 procedure doStepGrave(Gear: PGear);
   202 begin
   222 begin