hedgewars/uVisualGears.pas
changeset 3083 8da8f2515221
parent 3080 b7fa8ad60e3b
child 3096 9330eead14fa
equal deleted inserted replaced
3082:36586b751d64 3083:8da8f2515221
    53 procedure initModule;
    53 procedure initModule;
    54 procedure freeModule;
    54 procedure freeModule;
    55 
    55 
    56 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
    56 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
    57 procedure ProcessVisualGears(Steps: Longword);
    57 procedure ProcessVisualGears(Steps: Longword);
    58 procedure KickFlakes(dmgRadius, X, Y: LongInt);
    58 procedure KickFlakes(Radius, X, Y: LongInt);
    59 procedure DrawVisualGears(Layer: LongWord);
    59 procedure DrawVisualGears(Layer: LongWord);
    60 procedure DeleteVisualGear(Gear: PVisualGear);
    60 procedure DeleteVisualGear(Gear: PVisualGear);
    61 procedure AddClouds;
    61 procedure AddClouds;
    62 procedure AddDamageTag(X, Y, Damage, Color: LongWord);
    62 procedure AddDamageTag(X, Y, Damage, Color: LongWord);
    63 procedure FreeVisualGears;
    63 procedure FreeVisualGears;
    64 
    64 
    65 var VisualGearsList: PVisualGear;
    65 var VisualGearsList: PVisualGear;
    66     vobFrameTicks, vobFramesCount: Longword;
    66     vobFrameTicks, vobFramesCount, vobCount: Longword;
    67     vobVelocity, vobFallSpeed: LongInt;
    67     vobVelocity, vobFallSpeed: LongInt;
    68 
    68 
    69 implementation
    69 implementation
    70 uses uWorld, uMisc, uStore, uTeams, uSound;
    70 uses uWorld, uMisc, uStore, uTeams, uSound;
    71 const cExplFrameTicks = 110;
    71 const cExplFrameTicks = 110;
   655       t:= Gear^.NextGear;
   655       t:= Gear^.NextGear;
   656       Gear^.doStep(Gear, Steps)
   656       Gear^.doStep(Gear, Steps)
   657       end
   657       end
   658 end;
   658 end;
   659 
   659 
   660 procedure KickFlakes(dmgRadius, X, Y: LongInt);
   660 procedure KickFlakes(Radius, X, Y: LongInt);
   661 var Gear, t: PVisualGear;
   661 var Gear, t: PVisualGear;
   662     dmg: LongInt;
   662     dmg: LongInt;
   663 begin
   663 begin
   664 if dmgRadius = 0 then exit;
   664 if (vobCount = 0) or (vobCount > 200) then exit;
   665 
       
   666 t:= VisualGearsList;
   665 t:= VisualGearsList;
   667 while t <> nil do
   666 while t <> nil do
   668       begin
   667       begin
   669       Gear:= t;
   668       Gear:= t;
   670       if Gear^.Kind = vgtFlake then
   669       if Gear^.Kind = vgtFlake then
   671           begin
   670           begin
   672           // Damage calc from doMakeExplosion
   671           // Damage calc from doMakeExplosion
   673           dmg:= min(100,dmgRadius*2  + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))));
   672           dmg:= min(100,Radius*2  + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))));
   674           if dmg > 1 then
   673           if dmg > 1 then
   675               begin
   674               begin
   676               Gear^.tdX:= Gear^.dX + SignAs(_0_01 * dmg + cHHKick, Gear^.X - int2hwFloat(X));
   675               Gear^.tdX:= Gear^.dX + SignAs(_0_01 * dmg + cHHKick, Gear^.X - int2hwFloat(X));
   677               Gear^.tdY:= Gear^.dY + SignAs(_0_01 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y));
   676               Gear^.tdY:= Gear^.dY + SignAs(_0_01 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y));
   678               Gear^.Timer:= 200
   677               Gear^.Timer:= 200