hedgewars/uVisualGears.pas
changeset 6553 91365db8b82c
parent 6453 11c578d30bd3
child 6580 6155187bf599
equal deleted inserted replaced
6552:91adc9ee7b8c 6553:91365db8b82c
   151     case Kind of
   151     case Kind of
   152     vgtFlake: begin
   152     vgtFlake: begin
   153                 Timer:= 0;
   153                 Timer:= 0;
   154                 tdX:= 0;
   154                 tdX:= 0;
   155                 tdY:= 0;
   155                 tdY:= 0;
       
   156                 Scale:= 1.0;
   156                 if SuddenDeathDmg then
   157                 if SuddenDeathDmg then
   157                     begin
   158                     begin
   158                     FrameTicks:= random(vobSDFrameTicks);
   159                     FrameTicks:= random(vobSDFrameTicks);
   159                     Frame:= random(vobSDFramesCount);
   160                     Frame:= random(vobSDFramesCount);
   160                     end
   161                     end
   172                 end;
   173                 end;
   173     vgtCloud: begin
   174     vgtCloud: begin
   174                 Frame:= random(4);
   175                 Frame:= random(4);
   175                 dx:= 0.5 + 0.1 * random(5); // how much the cloud will be affected by wind
   176                 dx:= 0.5 + 0.1 * random(5); // how much the cloud will be affected by wind
   176                 timer:= random(4096);
   177                 timer:= random(4096);
       
   178                 Scale:= 1.0
   177                 end;
   179                 end;
   178     vgtExplPart,
   180     vgtExplPart,
   179     vgtExplPart2: begin
   181     vgtExplPart2: begin
   180                 t:= random(1024);
   182                 t:= random(1024);
   181                 sp:= 0.001 * (random(95) + 70);
   183                 sp:= 0.001 * (random(95) + 70);
   336 
   338 
   337 if State <> 0 then gear^.State:= State;
   339 if State <> 0 then gear^.State:= State;
   338 
   340 
   339 case Gear^.Kind of
   341 case Gear^.Kind of
   340     vgtFlake: if cFlattenFlakes then gear^.Layer:= 0
   342     vgtFlake: if cFlattenFlakes then gear^.Layer:= 0
   341               else if random(3) = 0 then gear^.Layer:= 0   // 33% - far back
   343               else if random(3) = 0 then 
   342               else if random(3) = 0 then gear^.Layer:= 4   // 22% - mid-distance
   344                   begin
       
   345                   gear^.Scale:= 0.5;
       
   346                   gear^.Layer:= 0   // 33% - far back
       
   347                   end
       
   348               else if random(3) = 0 then
       
   349                   begin
       
   350                   gear^.Scale:= 0.8;
       
   351                   gear^.Layer:= 4   // 22% - mid-distance
       
   352                   end
   343               else if random(3) <> 0 then gear^.Layer:= 5  // 30% - just behind land
   353               else if random(3) <> 0 then gear^.Layer:= 5  // 30% - just behind land
   344               else if random(2) = 0 then gear^.Layer:= 6   // 7% - just in front of land
   354               else if random(2) = 0 then gear^.Layer:= 6   // 7% - just in front of land
   345               else gear^.Layer:= 2;  // 7% - close up
   355               else begin
       
   356                    gear^.Scale:= 1.5;
       
   357                    gear^.Layer:= 2;  // 7% - close up
       
   358                    end;
   346 
   359 
   347     vgtCloud: if cFlattenClouds then gear^.Layer:= 5
   360     vgtCloud: if cFlattenClouds then gear^.Layer:= 5
   348               else if random(3) = 0 then gear^.Layer:= 0
   361               else if random(3) = 0 then
   349               else gear^.Layer:= random(2) + 4;
   362                   begin
       
   363                   gear^.Scale:= 0.25;
       
   364                   gear^.Layer:= 0
       
   365                   end
       
   366               else if random(2) = 0 then gear^.Layer:= 5
       
   367               else begin
       
   368                    gear^.Scale:= 0.4;
       
   369                    gear^.Layer:= 4
       
   370                    end;
   350 
   371 
   351     // 0: this layer is very distant in the background when in stereo
   372     // 0: this layer is very distant in the background when in stereo
   352     vgtTeamHealthSorter,
   373     vgtTeamHealthSorter,
   353     vgtSmoothWindBar: gear^.Layer:= 0;
   374     vgtSmoothWindBar: gear^.Layer:= 0;
   354 
   375 
   474        while Gear <> nil do
   495        while Gear <> nil do
   475            begin
   496            begin
   476            if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   497            if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   477            case Gear^.Kind of
   498            case Gear^.Kind of
   478               vgtCloud: if SuddenDeathDmg then
   499               vgtCloud: if SuddenDeathDmg then
   479                              DrawTextureF(SpritesData[sprSDCloud].Texture, 0.25, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height)
   500                              DrawTextureF(SpritesData[sprSDCloud].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height)
   480                          else
   501                          else
   481                             DrawTextureF(SpritesData[sprCloud].Texture, 0.25, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height);
   502                             DrawTextureF(SpritesData[sprCloud].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height);
   482                vgtFlake: if cFlattenFlakes then
   503                vgtFlake: if cFlattenFlakes then
   483                              begin
   504                              begin
   484                              if SuddenDeathDmg then
   505                              if SuddenDeathDmg then
   485                                  if vobSDVelocity = 0 then
   506                                  if vobSDVelocity = 0 then
   486                                      DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   507                                      DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   494                              end
   515                              end
   495                          else
   516                          else
   496                              begin
   517                              begin
   497                              if SuddenDeathDmg then
   518                              if SuddenDeathDmg then
   498                                  if vobSDVelocity = 0 then
   519                                  if vobSDVelocity = 0 then
   499                                      DrawTextureF(SpritesData[sprSDFlake].Texture, 0.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   520                                      DrawTextureF(SpritesData[sprSDFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   500                                  else
   521                                  else
   501                                      DrawRotatedTextureF(SpritesData[sprSDFlake].Texture, 0.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
   522                                      DrawRotatedTextureF(SpritesData[sprSDFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
   502                              else
   523                              else
   503                                  if vobVelocity = 0 then
   524                                  if vobVelocity = 0 then
   504                                      DrawTextureF(SpritesData[sprFlake].Texture, 0.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   525                                      DrawTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   505                                  else
   526                                  else
   506                                      DrawRotatedTextureF(SpritesData[sprFlake].Texture, 0.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
   527                                      DrawRotatedTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
   507                              end;
   528                              end;
   508                end;
   529                end;
   509            if Gear^.Tint <> $FFFFFFFF then Tint($FF,$FF,$FF,$FF);
   530            if Gear^.Tint <> $FFFFFFFF then Tint($FF,$FF,$FF,$FF);
   510            Gear:= Gear^.NextGear
   531            Gear:= Gear^.NextGear
   511            end
   532            end
   674                    vgtBulletHit: DrawRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle);
   695                    vgtBulletHit: DrawRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle);
   675                end;
   696                end;
   676            case Gear^.Kind of
   697            case Gear^.Kind of
   677                vgtFlake: if SuddenDeathDmg then
   698                vgtFlake: if SuddenDeathDmg then
   678                              if vobSDVelocity = 0 then
   699                              if vobSDVelocity = 0 then
   679                                  DrawTextureF(SpritesData[sprSDFlake].Texture, 1.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   700                                  DrawTextureF(SpritesData[sprSDFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   680                              else
   701                              else
   681                                  DrawRotatedTextureF(SpritesData[sprSDFlake].Texture, 1.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
   702                                  DrawRotatedTextureF(SpritesData[sprSDFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
   682                          else
   703                          else
   683                              if vobVelocity = 0 then
   704                              if vobVelocity = 0 then
   684                                  DrawTextureF(SpritesData[sprFlake].Texture, 1.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   705                                  DrawTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   685                              else
   706                              else
   686                                  DrawRotatedTextureF(SpritesData[sprFlake].Texture, 1.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle);
   707                                  DrawRotatedTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle);
   687                vgtCircle: if gear^.Angle = 1 then
   708                vgtCircle: if gear^.Angle = 1 then
   688                               begin
   709                               begin
   689                               tmp:= Gear^.State / 100;
   710                               tmp:= Gear^.State / 100;
   690                               DrawTexture(round(Gear^.X-24*tmp) + WorldDx, round(Gear^.Y-24*tmp) + WorldDy, SpritesData[sprVampiric].Texture, tmp)
   711                               DrawTexture(round(Gear^.X-24*tmp) + WorldDx, round(Gear^.Y-24*tmp) + WorldDy, SpritesData[sprVampiric].Texture, tmp)
   691                               end
   712                               end
   701        while Gear <> nil do
   722        while Gear <> nil do
   702            begin
   723            begin
   703            if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   724            if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   704            case Gear^.Kind of
   725            case Gear^.Kind of
   705               vgtCloud: if SuddenDeathDmg then
   726               vgtCloud: if SuddenDeathDmg then
   706                              DrawTextureF(SpritesData[sprSDCloud].Texture, 0.4, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height)
   727                              DrawTextureF(SpritesData[sprSDCloud].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height)
   707                          else
   728                          else
   708                             DrawTextureF(SpritesData[sprCloud].Texture, 0.4, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height);
   729                             DrawTextureF(SpritesData[sprCloud].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height);
   709               vgtFlake: if SuddenDeathDmg then
   730               vgtFlake: if SuddenDeathDmg then
   710                              if vobSDVelocity = 0 then
   731                              if vobSDVelocity = 0 then
   711                                  DrawTextureF(SpritesData[sprSDFlake].Texture, 0.8, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   732                                  DrawTextureF(SpritesData[sprSDFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   712                              else
   733                              else
   713                                  DrawRotatedTextureF(SpritesData[sprSDFlake].Texture, 0.8, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
   734                                  DrawRotatedTextureF(SpritesData[sprSDFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
   714                          else
   735                          else
   715                              if vobVelocity = 0 then
   736                              if vobVelocity = 0 then
   716                                  DrawTextureF(SpritesData[sprFlake].Texture, 0.8, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   737                                  DrawTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   717                              else
   738                              else
   718                                  DrawRotatedTextureF(SpritesData[sprFlake].Texture, 0.8, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle);
   739                                  DrawRotatedTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle);
   719                end;
   740                end;
   720            if (Gear^.Tint <> $FFFFFFFF) then Tint($FF,$FF,$FF,$FF);
   741            if (Gear^.Tint <> $FFFFFFFF) then Tint($FF,$FF,$FF,$FF);
   721            Gear:= Gear^.NextGear
   742            Gear:= Gear^.NextGear
   722            end
   743            end
   723        end;
   744        end;