hedgewars/uVisualGearsList.pas
changeset 10015 4feced261c68
parent 9998 736015b847e3
parent 9960 fac73b8a52d3
child 10108 c68cf030eded
equal deleted inserted replaced
10014:56d2f2d5aad8 10015:4feced261c68
    27 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; inline;
    27 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; inline;
    28 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear;
    28 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear;
    29 procedure DeleteVisualGear(Gear: PVisualGear);
    29 procedure DeleteVisualGear(Gear: PVisualGear);
    30 function  VisualGearByUID(uid : Longword) : PVisualGear;
    30 function  VisualGearByUID(uid : Longword) : PVisualGear;
    31 
    31 
    32 const 
    32 const
    33     cExplFrameTicks = 110;
    33     cExplFrameTicks = 110;
    34 
    34 
    35 var VGCounter: LongWord;
    35 var VGCounter: LongWord;
    36     VisualGearLayers: array[0..6] of PVisualGear;
    36     VisualGearLayers: array[0..6] of PVisualGear;
    37 
    37 
    73     vgtExplosion,
    73     vgtExplosion,
    74     vgtSmokeTrace,
    74     vgtSmokeTrace,
    75     vgtEvilTrace,
    75     vgtEvilTrace,
    76     vgtNote,
    76     vgtNote,
    77     vgtSmoothWindBar])) then
    77     vgtSmoothWindBar])) then
    78     
    78 
    79         exit;
    79         exit;
    80 
    80 
    81 inc(VGCounter);
    81 inc(VGCounter);
    82 New(gear);
    82 New(gear);
    83 FillChar(gear^, sizeof(TVisualGear), 0);
    83 FillChar(gear^, sizeof(TVisualGear), 0);
    84 gear^.X:= real(X);
    84 gear^.X:= real(X);
    85 gear^.Y:= real(Y);
    85 gear^.Y:= real(Y);
    86 gear^.Kind := Kind;
    86 gear^.Kind := Kind;
    87 gear^.doStep:= doStepHandlers[Kind];
    87 gear^.doStep:= doStepVGHandlers[Kind];
    88 gear^.State:= 0;
    88 gear^.State:= 0;
    89 gear^.Tint:= $FFFFFFFF;
    89 gear^.Tint:= $FFFFFFFF;
    90 gear^.uid:= VGCounter;
    90 gear^.uid:= VGCounter;
    91 gear^.Layer:= 0;
    91 gear^.Layer:= 0;
    92 
    92 
   287                 dx:= hwFloat2Float(AngleSin(t)) * sp;
   287                 dx:= hwFloat2Float(AngleSin(t)) * sp;
   288                 dy:= hwFloat2Float(AngleCos(t)) * sp * -2;
   288                 dy:= hwFloat2Float(AngleCos(t)) * sp * -2;
   289                 if random(2) = 0 then
   289                 if random(2) = 0 then
   290                     dx := -dx;
   290                     dx := -dx;
   291                 end;
   291                 end;
   292       vgtNote: 
   292       vgtNote:
   293                 begin
   293                 begin
   294                 dx:= 0.005 * (random(15) + 10);
   294                 dx:= 0.005 * (random(15) + 10);
   295                 dy:= -0.001 * (random(40) + 20);
   295                 dy:= -0.001 * (random(40) + 20);
   296                 if random(2) = 0 then
   296                 if random(2) = 0 then
   297                     dx := -dx;
   297                     dx := -dx;
   304                 dy:= 0;
   304                 dy:= 0;
   305                 FrameTicks:= 350;
   305                 FrameTicks:= 350;
   306                 Frame:= 7;
   306                 Frame:= 7;
   307                 Angle:= 0;
   307                 Angle:= 0;
   308                 end;
   308                 end;
   309 vgtSmoothWindBar: 
   309 vgtSmoothWindBar:
   310                 begin
   310                 begin
   311                 Angle:= hwFloat2Float(cMaxWindSpeed)*2 / 1440; // seems rate below is supposed to change wind bar at 1px per 10ms. Max time, 1440ms. This tries to match the rate of change
   311                 Angle:= hwFloat2Float(cMaxWindSpeed)*2 / 1440; // seems rate below is supposed to change wind bar at 1px per 10ms. Max time, 1440ms. This tries to match the rate of change
   312                 Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
   312                 Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
   313                 end;
   313                 end;
   314  vgtStraightShot:
   314  vgtStraightShot:
   330     gear^.State:= State;
   330     gear^.State:= State;
   331 
   331 
   332 case Gear^.Kind of
   332 case Gear^.Kind of
   333     vgtFlake: if cFlattenFlakes then
   333     vgtFlake: if cFlattenFlakes then
   334         gear^.Layer:= 0
   334         gear^.Layer:= 0
   335               else if random(3) = 0 then 
   335               else if random(3) = 0 then
   336                   begin
   336                   begin
   337                   gear^.Scale:= 0.5;
   337                   gear^.Scale:= 0.5;
   338                   gear^.Layer:= 0   // 33% - far back
   338                   gear^.Layer:= 0   // 33% - far back
   339                   end
   339                   end
   340               else if random(3) = 0 then
   340               else if random(3) = 0 then