hedgewars/uVisualGears.pas
changeset 5562 8056d82b4d23
parent 5491 3a82724de759
child 5563 fc73b6e941f7
equal deleted inserted replaced
5561:dfbe55237c64 5562:8056d82b4d23
   107             @doStepChunk,
   107             @doStepChunk,
   108             @doStepNote,
   108             @doStepNote,
   109             @doStepLineTrail,
   109             @doStepLineTrail,
   110             @doStepBulletHit,
   110             @doStepBulletHit,
   111             @doStepCircle,
   111             @doStepCircle,
   112             @doStepSmoothWindBar
   112             @doStepSmoothWindBar,
       
   113             @doStepStraightShot
   113         );
   114         );
   114 
   115 
   115 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0; Critical: Boolean = false): PVisualGear;
   116 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0; Critical: Boolean = false): PVisualGear;
   116 const VGCounter: Longword = 0;
   117 const VGCounter: Longword = 0;
   117 var gear: PVisualGear;
   118 var gear: PVisualGear;
   118     t: Longword;
   119     t: Longword;
   119     sp: real;
   120     sp: real;
   120 begin
   121 begin
   121 if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then // we are scrolling now
   122 AddVisualGear:= nil;
   122     if (Kind <> vgtCloud) and not Critical then
   123 if ((GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet))) and // we are scrolling now
   123         begin
   124    ((Kind <> vgtCloud) and not Critical) then exit;
   124         AddVisualGear:= nil;
       
   125         exit
       
   126         end;
       
   127 
   125 
   128 if ((cReducedQuality and rqAntiBoom) <> 0) and
   126 if ((cReducedQuality and rqAntiBoom) <> 0) and
   129    not Critical and
   127    not Critical and
   130    not (Kind in
   128    not (Kind in
   131    [vgtTeamHealthSorter,
   129    [vgtTeamHealthSorter,
   134     vgtHealthTag,
   132     vgtHealthTag,
   135     vgtExplosion,
   133     vgtExplosion,
   136     vgtSmokeTrace,
   134     vgtSmokeTrace,
   137     vgtEvilTrace,
   135     vgtEvilTrace,
   138     vgtNote,
   136     vgtNote,
   139     vgtSmoothWindBar]) then
   137     vgtSmoothWindBar]) then exit;
   140     begin
       
   141       AddVisualGear:= nil;
       
   142       exit
       
   143     end;
       
   144 
   138 
   145 inc(VGCounter);
   139 inc(VGCounter);
   146 New(gear);
   140 New(gear);
   147 FillChar(gear^, sizeof(TVisualGear), 0);
   141 FillChar(gear^, sizeof(TVisualGear), 0);
   148 gear^.X:= real(X);
   142 gear^.X:= real(X);
   329                 FrameTicks:= 350;
   323                 FrameTicks:= 350;
   330                 Frame:= 7;
   324                 Frame:= 7;
   331                 Angle := 0;
   325                 Angle := 0;
   332                 end;
   326                 end;
   333 vgtSmoothWindBar: Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
   327 vgtSmoothWindBar: Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
       
   328  vgtStraightShot: begin
       
   329                 dx:= 0.001 * (random(200));
       
   330                 dy:= 0.001 * (random(200));
       
   331                 if random(2) = 0 then dx := -dx;
       
   332                 if random(2) = 0 then dy := -dy;
       
   333                 Frame:= 0;
       
   334                 FrameTicks:= random(750) + 1000;
       
   335                 Sprite:= sprSnowDust;
       
   336                 end;
   334         end;
   337         end;
   335 
   338 
   336 if State <> 0 then gear^.State:= State;
   339 if State <> 0 then gear^.State:= State;
   337 
   340 
   338 if VisualGearsList <> nil then
   341 if VisualGearsList <> nil then
   483                                  DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
   486                                  DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
   484                              end;
   487                              end;
   485             vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
   488             vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
   486             vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
   489             vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
   487             vgtHealth: DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0);
   490             vgtHealth: DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0);
       
   491             vgtStraightShot: DrawRotatedF(Gear^.Sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   488         end;
   492         end;
   489         if (cReducedQuality and rqAntiBoom) = 0 then
   493         if (cReducedQuality and rqAntiBoom) = 0 then
   490             case Gear^.Kind of
   494             case Gear^.Kind of
   491                 vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   495                 vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   492             end;
   496             end;