hedgewars/uVisualGears.pas
changeset 12163 4d1250ca68ac
parent 11046 47a8c19ecb60
child 12164 cb3e785534da
equal deleted inserted replaced
12162:e837912ba85d 12163:4d1250ca68ac
   123         exit(SDsprite)
   123         exit(SDsprite)
   124     else
   124     else
   125         exit(sprite);
   125         exit(sprite);
   126 end;
   126 end;
   127 
   127 
       
   128 function GetSpriteByWind(sprite, Lsprite: TSprite): TSprite; inline;
       
   129 begin
       
   130     if (SpritesData[Lsprite].Texture <> nil) and (cWindSpeedf<0) then
       
   131         exit(Lsprite)
       
   132     else
       
   133         exit(sprite);
       
   134 end;
       
   135 
   128 function GetSpriteData(sprite, SDsprite: TSprite): PSpriteData; inline;
   136 function GetSpriteData(sprite, SDsprite: TSprite): PSpriteData; inline;
   129 begin
   137 begin
   130     exit(@SpritesData[GetSprite(sprite, SDsprite)]);
   138     exit(@SpritesData[GetSprite(sprite, SDsprite)]);
   131 end;
   139 end;
   132 
   140 
   150         while Gear <> nil do
   158         while Gear <> nil do
   151             begin
   159             begin
   152             if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   160             if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   153             case Gear^.Kind of
   161             case Gear^.Kind of
   154               vgtCloud: begin
   162               vgtCloud: begin
   155                         spriteData:= GetSpriteData(sprCloud, sprSDCloud);
   163 			spriteData:= GetSpriteData(GetSpriteByWind(sprCloud, sprCloudL), GetSpriteByWind(sprSDCloud, sprSDCloudL));
   156                         DrawTextureF(spriteData^.Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height)
   164                         DrawTextureF(spriteData^.Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height)
   157                         end;
   165                         end;
   158                vgtFlake: begin
   166                vgtFlake: begin
   159                          sprite:= GetSprite(sprFlake, sprSDFlake);
   167                          sprite:= GetSpriteByWind(GetSprite(sprFlake, sprSDFlake), GetSprite(sprFlakeL, sprSDFlakeL));
   160                          if cFlattenFlakes then
   168                          if cFlattenFlakes then
   161                              begin
   169                              begin
   162                              if speedlessFlakes then
   170                              if speedlessFlakes then
   163                                  DrawSprite(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   171                                  DrawSprite(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   164                              else
   172                              else
   186           //tinted:= false;
   194           //tinted:= false;
   187           if Gear^.Tint <> $FFFFFFFF then
   195           if Gear^.Tint <> $FFFFFFFF then
   188               Tint(Gear^.Tint);
   196               Tint(Gear^.Tint);
   189           case Gear^.Kind of
   197           case Gear^.Kind of
   190               vgtFlake: begin
   198               vgtFlake: begin
   191                          sprite:= GetSprite(sprFlake, sprSDFlake);
   199                          sprite:= GetSpriteByWind(GetSprite(sprFlake, sprSDFlake), GetSprite(sprFlakeL, sprSDFlakeL));
   192                          if speedlessFlakes then
   200                          if speedlessFlakes then
   193                              DrawSprite(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   201                              DrawSprite(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   194                          else
   202                          else
   195                              DrawSpriteRotatedF(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
   203                              DrawSpriteRotatedF(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
   196                         end;
   204                         end;
   358                    vgtNote: DrawSpriteRotatedF(sprNote, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   366                    vgtNote: DrawSpriteRotatedF(sprNote, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   359                    vgtBulletHit: DrawSpriteRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle);
   367                    vgtBulletHit: DrawSpriteRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle);
   360                end;
   368                end;
   361            case Gear^.Kind of
   369            case Gear^.Kind of
   362                vgtFlake: begin
   370                vgtFlake: begin
   363                          spriteData:= GetSpriteData(sprFlake, sprSDFlake);
   371                          spriteData:= GetSpriteData(GetSpriteByWind(sprFlake, sprFlakeL), GetSpriteByWind(sprSDFlake, sprSDFlakeL));
   364                          if speedlessFlakes then
   372                          if speedlessFlakes then
   365                              DrawTextureF(spriteData^.Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height)
   373                              DrawTextureF(spriteData^.Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height)
   366                          else
   374                          else
   367                              DrawTextureRotatedF(spriteData^.Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height, Gear^.Angle);
   375                              DrawTextureRotatedF(spriteData^.Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height, Gear^.Angle);
   368                          end;
   376                          end;
   386             begin
   394             begin
   387             if Gear^.Tint <> $FFFFFFFF then
   395             if Gear^.Tint <> $FFFFFFFF then
   388                 Tint(Gear^.Tint);
   396                 Tint(Gear^.Tint);
   389             case Gear^.Kind of
   397             case Gear^.Kind of
   390                vgtCloud: begin
   398                vgtCloud: begin
   391                          spriteData:= GetSpriteData(sprCloud, sprSDCloud);
   399                          spriteData:= GetSpriteData(GetSpriteByWind(sprCloud, sprCloudL), GetSpriteByWind(sprSDCloud, sprSDCloudL));
   392                          DrawTextureF(spriteData^.Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height);
   400                          DrawTextureF(spriteData^.Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height);
   393                          end;
   401                          end;
   394               vgtFlake: begin
   402               vgtFlake: begin
   395                         spriteData:= GetSpriteData(sprFlake, sprSDFlake);
   403                         spriteData:= GetSpriteData(GetSpriteByWind(sprFlake, sprFlakeL), GetSpriteByWind(sprSDFlake, sprSDFlakeL));
   396                         if speedlessFlakes then
   404                         if speedlessFlakes then
   397                             DrawTextureF(spriteData^.Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height)
   405                             DrawTextureF(spriteData^.Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height)
   398                         else
   406                         else
   399                             DrawTextureRotatedF(spriteData^.Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height, Gear^.Angle);
   407                             DrawTextureRotatedF(spriteData^.Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, spriteData^.Width, spriteData^.Height, Gear^.Angle);
   400                         end;
   408                         end;
   411             begin
   419             begin
   412             if Gear^.Tint <> $FFFFFFFF then
   420             if Gear^.Tint <> $FFFFFFFF then
   413                 Tint(Gear^.Tint);
   421                 Tint(Gear^.Tint);
   414             case Gear^.Kind of
   422             case Gear^.Kind of
   415                 vgtCloud: begin
   423                 vgtCloud: begin
   416                           sprite:= GetSprite(sprCloud, sprSDCloud);
   424 			sprite:= GetSpriteByWind(GetSprite(sprCloud, sprSDCloud), GetSprite(sprCloudL, sprSDCloudL));
   417                           DrawSprite(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame);
   425                           DrawSprite(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame);
   418                           end;
   426                           end;
   419               vgtFlake: begin
   427               vgtFlake: begin
   420                         sprite:= GetSprite(sprFlake, sprSDFlake);
   428 			sprite:= GetSpriteByWind(GetSprite(sprFlake, sprSDFlake), GetSprite(sprFlakeL, sprSDFlakeL));
   421                         if speedlessFlakes then
   429                         if speedlessFlakes then
   422                             DrawSprite(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   430                             DrawSprite(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   423                         else
   431                         else
   424                             DrawSpriteRotatedF(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
   432                             DrawSpriteRotatedF(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
   425                         end;
   433                         end;
   436             begin
   444             begin
   437             if Gear^.Tint <> $FFFFFFFF then
   445             if Gear^.Tint <> $FFFFFFFF then
   438                 Tint(Gear^.Tint);
   446                 Tint(Gear^.Tint);
   439             case Gear^.Kind of
   447             case Gear^.Kind of
   440                 vgtFlake: begin
   448                 vgtFlake: begin
   441                           sprite:= GetSprite(sprFlake, sprSDFlake);
   449                          sprite:= GetSpriteByWind(GetSprite(sprFlake, sprSDFlake), GetSprite(sprFlakeL, sprSDFlakeL));
   442                           if speedlessFlakes then
   450                           if speedlessFlakes then
   443                               DrawSprite(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   451                               DrawSprite(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   444                           else
   452                           else
   445                               DrawSpriteRotatedF(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
   453                               DrawSpriteRotatedF(sprite, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
   446                           end;
   454                           end;