hedgewars/uVisualGears.pas
branchwebgl
changeset 9950 2759212a27de
parent 9521 8054d9d775fd
parent 9769 5814e0c47c99
child 10015 4feced261c68
equal deleted inserted replaced
9521:8054d9d775fd 9950:2759212a27de
   165                                  else
   165                                  else
   166                                      DrawTextureRotatedF(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)
   166                                      DrawTextureRotatedF(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)
   167                              end;
   167                              end;
   168                end;
   168                end;
   169            if Gear^.Tint <> $FFFFFFFF then
   169            if Gear^.Tint <> $FFFFFFFF then
   170                Tint($FF,$FF,$FF,$FF);
   170                untint;
   171            Gear:= Gear^.NextGear
   171            Gear:= Gear^.NextGear
   172            end
   172            end
   173        end;
   173        end;
   174     // this layer is on the land level (which is close but behind the screen plane) when stereo
   174     // this layer is on the land level (which is close but behind the screen plane) when stereo
   175     1: begin
   175     1: begin
   217                   vgtDroplet: if SuddenDeathDmg then
   217                   vgtDroplet: if SuddenDeathDmg then
   218                                   DrawSprite(sprSDDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame)
   218                                   DrawSprite(sprSDDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame)
   219                               else
   219                               else
   220                                   DrawSprite(sprDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);
   220                                   DrawSprite(sprDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);
   221                   vgtBubble: DrawSprite(sprBubbles, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
   221                   vgtBubble: DrawSprite(sprBubbles, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
       
   222                vgtStraightShot: begin 
       
   223                                 if Gear^.dX < 0 then
       
   224                                     i:= -1
       
   225                                 else
       
   226                                     i:= 1;
       
   227                                 DrawTextureRotatedF(SpritesData[TSprite(Gear^.State)].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, i, SpritesData[TSprite(Gear^.State)].Width, SpritesData[TSprite(Gear^.State)].Height, Gear^.Angle);
       
   228                                 end;
   222               end;
   229               end;
   223           //if (Gear^.Tint <> $FFFFFFFF) or tinted then Tint($FF,$FF,$FF,$FF);
   230           //if (Gear^.Tint <> $FFFFFFFF) or tinted then untint;
   224           if (Gear^.Tint <> $FFFFFFFF) then
   231           if (Gear^.Tint <> $FFFFFFFF) then
   225               Tint($FF,$FF,$FF,$FF);
   232               untint;
   226           Gear:= Gear^.NextGear
   233           Gear:= Gear^.NextGear
   227           end
   234           end
   228        end;
   235        end;
   229     // this layer is on the screen plane (depth = 0) when stereo
   236     // this layer is on the screen plane (depth = 0) when stereo
   230     3: begin
   237     3: begin
   282            if (cReducedQuality and rqAntiBoom) = 0 then
   289            if (cReducedQuality and rqAntiBoom) = 0 then
   283                case Gear^.Kind of
   290                case Gear^.Kind of
   284                    vgtChunk: DrawSpriteRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   291                    vgtChunk: DrawSpriteRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   285                end;
   292                end;
   286            if (Gear^.Tint <> $FFFFFFFF) or tinted then
   293            if (Gear^.Tint <> $FFFFFFFF) or tinted then
   287                Tint($FF,$FF,$FF,$FF);
   294                untint;
   288            Gear:= Gear^.NextGear
   295            Gear:= Gear^.NextGear
   289            end
   296            end
   290        end;
   297        end;
   291     // this layer is outside the screen when stereo
   298     // this layer is outside the screen when stereo
   292     2: begin
   299     2: begin
   366                               end
   373                               end
   367                           else
   374                           else
   368                               DrawCircle(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State, Gear^.Timer);
   375                               DrawCircle(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State, Gear^.Timer);
   369            end;
   376            end;
   370            if (Gear^.Tint <> $FFFFFFFF) or tinted then
   377            if (Gear^.Tint <> $FFFFFFFF) or tinted then
   371                Tint($FF,$FF,$FF,$FF);
   378                untint;
   372            Gear:= Gear^.NextGear
   379            Gear:= Gear^.NextGear
   373            end
   380            end
   374        end;
   381        end;
   375      // this layer is half-way between the screen plane (depth = 0) when in stereo, and the land
   382      // this layer is half-way between the screen plane (depth = 0) when in stereo, and the land
   376      4: begin
   383      4: begin
   394                                 DrawTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   401                                 DrawTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
   395                             else
   402                             else
   396                                 DrawTextureRotatedF(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);
   403                                 DrawTextureRotatedF(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);
   397             end;
   404             end;
   398             if (Gear^.Tint <> $FFFFFFFF) then
   405             if (Gear^.Tint <> $FFFFFFFF) then
   399                 Tint($FF,$FF,$FF,$FF);
   406                 untint;
   400             Gear:= Gear^.NextGear
   407             Gear:= Gear^.NextGear
   401             end
   408             end
   402         end;
   409         end;
   403      // this layer is on the screen plane (depth = 0) when stereo, but just behind the land
   410      // this layer is on the screen plane (depth = 0) when stereo, but just behind the land
   404      5: begin
   411      5: begin
   422                                 DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   429                                 DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   423                             else
   430                             else
   424                                 DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
   431                                 DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
   425                 end;
   432                 end;
   426             if (Gear^.Tint <> $FFFFFFFF) then
   433             if (Gear^.Tint <> $FFFFFFFF) then
   427                 Tint($FF,$FF,$FF,$FF);
   434                 untint;
   428             Gear:= Gear^.NextGear
   435             Gear:= Gear^.NextGear
   429             end
   436             end
   430         end;
   437         end;
   431      // this layer is on the screen plane (depth = 0) when stereo, but just in front of the land
   438      // this layer is on the screen plane (depth = 0) when stereo, but just in front of the land
   432     6: begin
   439     6: begin
   446                                 DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   453                                 DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
   447                             else
   454                             else
   448                                 DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
   455                                 DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
   449                 end;
   456                 end;
   450             if (Gear^.Tint <> $FFFFFFFF) then
   457             if (Gear^.Tint <> $FFFFFFFF) then
   451                 Tint($FF,$FF,$FF,$FF);
   458                 untint;
   452             Gear:= Gear^.NextGear
   459             Gear:= Gear^.NextGear
   453             end
   460             end
   454         end;
   461         end;
   455     end;
   462     end;
   456 end;
   463 end;
   485 var i: LongInt;
   492 var i: LongInt;
   486 begin
   493 begin
   487 if (cReducedQuality and rqKillFlakes) <> 0 then
   494 if (cReducedQuality and rqKillFlakes) <> 0 then
   488     exit;
   495     exit;
   489 
   496 
   490 if hasBorder or ((Theme <> 'Snow') and (Theme <> 'Christmas')) then
   497 if hasBorder or (not cSnow) then
   491     for i:= 0 to Pred(vobCount * cScreenSpace div 4096) do
   498     for i:= 0 to Pred(vobCount * cScreenSpace div 4096) do
   492         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake)
   499         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake)
   493 else
   500 else
   494     for i:= 0 to Pred((vobCount * cScreenSpace div 4096) div 3) do
   501     for i:= 0 to Pred((vobCount * cScreenSpace div 4096) div 3) do
   495         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake);
   502         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake);
   513         DeleteVisualGear(vg);
   520         DeleteVisualGear(vg);
   514         vg:= tmp
   521         vg:= tmp
   515         end
   522         end
   516         else vg:= vg^.NextGear;
   523         else vg:= vg^.NextGear;
   517     end;
   524     end;
   518 if ((GameFlags and gfBorder) <> 0) or ((Theme <> 'Snow') and (Theme <> 'Christmas')) then
   525 if hasBorder or (not cSnow) then
   519     for i:= 0 to Pred(vobSDCount * cScreenSpace div 4096) do
   526     for i:= 0 to Pred(vobSDCount * cScreenSpace div 4096) do
   520         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake)
   527         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake)
   521 else
   528 else
   522     for i:= 0 to Pred((vobSDCount * cScreenSpace div 4096) div 3) do
   529     for i:= 0 to Pred((vobSDCount * cScreenSpace div 4096) div 3) do
   523         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake);
   530         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake);