hedgewars/uVisualGears.pas
branchexperimental3D
changeset 4818 202eef454354
parent 4809 9c7d5f802618
child 4976 088d40d8aba2
equal deleted inserted replaced
4816:c2575faeac3d 4818:202eef454354
   390     tinted: boolean;
   390     tinted: boolean;
   391     tmp: real;
   391     tmp: real;
   392 begin
   392 begin
   393 Gear:= VisualGearsList;
   393 Gear:= VisualGearsList;
   394 case Layer of
   394 case Layer of
       
   395     // this level is very distant in the background when stereo
   395     0: while Gear <> nil do
   396     0: while Gear <> nil do
   396         begin
   397         begin
   397         if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   398         if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   398         case Gear^.Kind of
   399         case Gear^.Kind of
   399             vgtFlake: if SuddenDeathDmg then
   400             vgtFlake: if SuddenDeathDmg then
   412                           DrawSprite(sprCloud, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame);
   413                           DrawSprite(sprCloud, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame);
   413             end;
   414             end;
   414         if Gear^.Tint <> $FFFFFFFF then Tint($FF,$FF,$FF,$FF);
   415         if Gear^.Tint <> $FFFFFFFF then Tint($FF,$FF,$FF,$FF);
   415         Gear:= Gear^.NextGear
   416         Gear:= Gear^.NextGear
   416         end;
   417         end;
       
   418     // this level is on the land one when stereo
   417     1: while Gear <> nil do
   419     1: while Gear <> nil do
   418         begin
   420         begin
   419         tinted:= false;
   421         tinted:= false;
   420         if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   422         if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   421         case Gear^.Kind of
   423         case Gear^.Kind of
   422             vgtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State);
   424             vgtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State);
   423             vgtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State);
   425             vgtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State);
   424             vgtLineTrail: DrawLine(Gear^.X, Gear^.Y, Gear^.dX, Gear^.dY, 1.0, $FF, min(Gear^.Timer, $C0), min(Gear^.Timer, $80), min(Gear^.Timer, $FF));
   426             vgtLineTrail: DrawLine(Gear^.X, Gear^.Y, Gear^.dX, Gear^.dY, 1.0, $FF, min(Gear^.Timer, $C0), min(Gear^.Timer, $80), min(Gear^.Timer, $FF));
   425             vgtSpeechBubble: if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team <> CurrentTeam)) or (Gear^.State = 1)) then 
       
   426                     begin
       
   427                     tinted:= true;
       
   428                     Tint($FF, $FF, $FF,  $66);
       
   429                     DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex)
       
   430                     end
       
   431         end;
   427         end;
   432             if (cReducedQuality and rqAntiBoom) = 0 then
   428             if (cReducedQuality and rqAntiBoom) = 0 then
   433                 case Gear^.Kind of
   429                 case Gear^.Kind of
   434                     vgtSmoke: DrawSprite(sprSmoke, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
   430                     vgtSmoke: DrawSprite(sprSmoke, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
   435                     vgtSmokeWhite: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
   431                     vgtSmokeWhite: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
   436                     vgtDust: DrawSprite(sprDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
   432                     vgtDust: DrawSprite(sprDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
   437                     vgtFeather: begin
   433                     vgtFire: if (Gear^.State and gstTmpFlag) = 0 then
   438                             if Gear^.FrameTicks < 255 then
   434                                  DrawSprite(sprFlame, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy, (RealTicks shr 6 + Gear^.Frame) mod 8)
   439                                 begin
   435                              else
   440                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
   436                                  DrawTextureF(SpritesData[sprFlame].Texture, Gear^.FrameTicks / 900, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, (RealTicks shr 7 + Gear^.Frame) mod 8, 1, 16, 16);
   441                                 tinted:= true
   437                     vgtSplash: if SuddenDeathDmg then
   442                                 end;
   438                                    DrawSprite(sprSDSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37))
   443                             DrawRotatedF(sprFeather, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   439                                else
   444                             end;
   440                                    DrawSprite(sprSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37));
       
   441                     vgtDroplet: if SuddenDeathDmg then
       
   442                                     DrawSprite(sprSDDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame)
       
   443                                 else
       
   444                                     DrawSprite(sprDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);
       
   445                     vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   445                  end;
   446                  end;
   446         if (Gear^.Tint <> $FFFFFFFF) or tinted then Tint($FF,$FF,$FF,$FF);
   447         if (Gear^.Tint <> $FFFFFFFF) or tinted then Tint($FF,$FF,$FF,$FF);
   447         Gear:= Gear^.NextGear
   448         Gear:= Gear^.NextGear
   448         end;
   449         end;
       
   450     // this level is on the screen plane when stereo (depth = 0)
       
   451     3: while Gear <> nil do
       
   452         begin
       
   453         tinted:= false;
       
   454         if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
       
   455         case Gear^.Kind of
       
   456             vgtSpeechBubble: begin
       
   457                            if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team <> CurrentTeam)) or (Gear^.State = 1)) then
       
   458                            begin
       
   459                                tinted:= true;
       
   460                                Tint($FF, $FF, $FF,  $66);
       
   461                                DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex)
       
   462                            end
       
   463                            else if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team = CurrentTeam)) or (Gear^.State = 2)) then
       
   464                                DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
       
   465                        end;
       
   466             vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
       
   467             vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
       
   468             vgtHealth: begin
       
   469                        tinted:= true;
       
   470                        case Gear^.Frame div 10 of
       
   471                            0:Tint(0, $FF, 0, round(Gear^.FrameTicks * $FF / 1000));
       
   472                            1:Tint($FF, 0, 0, round(Gear^.FrameTicks * $FF / 1000));
       
   473                        end;
       
   474                        DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0);
       
   475                        end;
       
   476         end;
       
   477         if (Gear^.Tint <> $FFFFFFFF) or tinted then Tint($FF,$FF,$FF,$FF);
       
   478         Gear:= Gear^.NextGear
       
   479        end;
       
   480     // this level is outside the screen when stereo
   449     2: while Gear <> nil do
   481     2: while Gear <> nil do
   450         begin
   482         begin
   451         tinted:= false;
   483         tinted:= false;
   452         if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   484         if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   453         case Gear^.Kind of
   485         case Gear^.Kind of
   460             end;
   492             end;
   461         if (cReducedQuality and rqAntiBoom) = 0 then
   493         if (cReducedQuality and rqAntiBoom) = 0 then
   462             case Gear^.Kind of
   494             case Gear^.Kind of
   463                 vgtExplPart: DrawSprite(sprExplPart, round(Gear^.X) + WorldDx - 16, round(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
   495                 vgtExplPart: DrawSprite(sprExplPart, round(Gear^.X) + WorldDx - 16, round(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
   464                 vgtExplPart2: DrawSprite(sprExplPart2, round(Gear^.X) + WorldDx - 16, round(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
   496                 vgtExplPart2: DrawSprite(sprExplPart2, round(Gear^.X) + WorldDx - 16, round(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
   465                 vgtFire: if (Gear^.State and gstTmpFlag) = 0 then
       
   466                              DrawSprite(sprFlame, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy, (RealTicks shr 6 + Gear^.Frame) mod 8)
       
   467                          else
       
   468                              DrawTextureF(SpritesData[sprFlame].Texture, Gear^.FrameTicks / 900, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, (RealTicks shr 7 + Gear^.Frame) mod 8, 1, 16, 16);
       
   469                 vgtBubble: DrawSprite(sprBubbles, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
   497                 vgtBubble: DrawSprite(sprBubbles, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
   470                 vgtSteam: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
   498                 vgtSteam: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
   471                 vgtAmmo: begin
   499                 vgtAmmo: begin
   472                         tinted:= true;
   500                         tinted:= true;
   473                         Tint($FF, $FF, $FF, round(Gear^.alpha * $FF));
   501                         Tint($FF, $FF, $FF, round(Gear^.alpha * $FF));
   474                         DrawTextureF(ropeIconTex, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 32, 32);
   502                         DrawTextureF(ropeIconTex, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 32, 32);
   475                         DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32);
   503                         DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32);
   476                         end;
   504                         end;
   477                 vgtHealth:  begin
       
   478                             tinted:= true;
       
   479                             case Gear^.Frame div 10 of
       
   480                                 0:Tint(0, $FF, 0, round(Gear^.FrameTicks * $FF / 1000));
       
   481                                 1:Tint($FF, 0, 0, round(Gear^.FrameTicks * $FF / 1000));
       
   482                             end;
       
   483                             DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0);
       
   484                             end;
       
   485                 vgtShell: begin
   505                 vgtShell: begin
   486                             if Gear^.FrameTicks < $FF then
   506                             if Gear^.FrameTicks < $FF then
   487                                 begin
   507                                 begin
   488                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
   508                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
   489                                 tinted:= true
   509                                 tinted:= true
   490                                 end;
   510                                 end;
   491                             DrawRotatedF(sprShell, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   511                             DrawRotatedF(sprShell, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   492                             end;
   512                             end;
   493                   vgtEgg: begin
   513                 vgtFeather: begin
       
   514                             if Gear^.FrameTicks < 255 then
       
   515                                 begin
       
   516                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
       
   517                                 tinted:= true
       
   518                                 end;
       
   519                             DrawRotatedF(sprFeather, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
       
   520                           end;
       
   521                 vgtEgg: begin
   494                             if Gear^.FrameTicks < $FF then
   522                             if Gear^.FrameTicks < $FF then
   495                                 begin
   523                                 begin
   496                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
   524                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
   497                                 tinted:= true
   525                                 tinted:= true
   498                                 end;
   526                                 end;
   499                             DrawRotatedF(sprEgg, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   527                             DrawRotatedF(sprEgg, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   500                             end;
   528                             end;
   501                  vgtSplash: if SuddenDeathDmg then
       
   502                                 DrawSprite(sprSDSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37))
       
   503                             else
       
   504                                 DrawSprite(sprSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37));
       
   505                 vgtDroplet: if SuddenDeathDmg then
       
   506                                 DrawSprite(sprSDDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame)
       
   507                             else
       
   508                                 DrawSprite(sprDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);
       
   509                vgtBeeTrace: begin
   529                vgtBeeTrace: begin
   510                             if Gear^.FrameTicks < $FF then
   530                             if Gear^.FrameTicks < $FF then
   511                                 Tint($FF, $FF, $FF, Gear^.FrameTicks div 2)
   531                                 Tint($FF, $FF, $FF, Gear^.FrameTicks div 2)
   512                             else
   532                             else
   513                                 Tint($FF, $FF, $FF, $80);
   533                                 Tint($FF, $FF, $FF, $80);
   517                 vgtSmokeRing: begin
   537                 vgtSmokeRing: begin
   518                             tinted:= true;
   538                             tinted:= true;
   519                             Tint($FF, $FF, $FF, round(Gear^.alpha * $FF));
   539                             Tint($FF, $FF, $FF, round(Gear^.alpha * $FF));
   520                             DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle);
   540                             DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle);
   521                             end;
   541                             end;
   522                 vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
       
   523                  vgtNote: DrawRotatedF(sprNote, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   542                  vgtNote: DrawRotatedF(sprNote, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   524                 vgtBulletHit: DrawRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle);
   543                 vgtBulletHit: DrawRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle);
   525             end;
   544             end;
   526         case Gear^.Kind of
   545         case Gear^.Kind of
   527             vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
       
   528             vgtSpeechBubble: if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team = CurrentTeam)) or (Gear^.State = 2)) then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
       
   529             vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
       
   530             vgtCircle:  if gear^.Angle = 1 then 
   546             vgtCircle:  if gear^.Angle = 1 then 
   531                             begin
   547                             begin
   532                             tmp:= Gear^.State / 100;
   548                             tmp:= Gear^.State / 100;
   533                             DrawTexture(round(Gear^.X-24*tmp) + WorldDx, round(Gear^.Y-24*tmp) + WorldDy, SpritesData[sprVampiric].Texture, tmp)
   549                             DrawTexture(round(Gear^.X-24*tmp) + WorldDx, round(Gear^.Y-24*tmp) + WorldDy, SpritesData[sprVampiric].Texture, tmp)
   534                             end
   550                             end