hedgewars/uVisualGears.pas
changeset 14605 ab79cd4a7382
parent 14593 34e810295d08
child 15607 f8c1492601fe
equal deleted inserted replaced
14604:914f04315f21 14605:ab79cd4a7382
    72 if Steps = 0 then
    72 if Steps = 0 then
    73     exit;
    73     exit;
    74 
    74 
    75 for i:= 0 to 6 do
    75 for i:= 0 to 6 do
    76     begin
    76     begin
    77     t:= VisualGearLayers[i];
    77     t:= VisualGearLayersStart[i];
    78     while t <> nil do
    78     while t <> nil do
    79         begin
    79         begin
    80         Gear:= t;
    80         Gear:= t;
    81         t:= Gear^.NextGear;
    81         t:= Gear^.NextGear;
    82         Gear^.doStep(Gear, Steps)
    82         Gear^.doStep(Gear, Steps)
    91 if (vobCount = 0) or (vobCount > 200) then
    91 if (vobCount = 0) or (vobCount > 200) then
    92     exit;
    92     exit;
    93 for i:= 2 to 6 do
    93 for i:= 2 to 6 do
    94     if i <> 3 then
    94     if i <> 3 then
    95         begin
    95         begin
    96         t:= VisualGearLayers[i];
    96         t:= VisualGearLayersStart[i];
    97         while t <> nil do
    97         while t <> nil do
    98             begin
    98             begin
    99             Gear:= t;
    99             Gear:= t;
   100             if Gear^.Kind = vgtFlake then
   100             if Gear^.Kind = vgtFlake then
   101                 begin
   101                 begin
   152     speedlessFlakes:= (vobVelocity = 0);
   152     speedlessFlakes:= (vobVelocity = 0);
   153 
   153 
   154 case Layer of
   154 case Layer of
   155     // this layer is very distant in the background when stereo
   155     // this layer is very distant in the background when stereo
   156     0: begin
   156     0: begin
   157         Gear:= VisualGearLayers[0];
   157         Gear:= VisualGearLayersStart[0];
   158         while Gear <> nil do
   158         while Gear <> nil do
   159             begin
   159             begin
   160             if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   160             if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
   161             case Gear^.Kind of
   161             case Gear^.Kind of
   162               vgtCloud: begin
   162               vgtCloud: begin
   187            Gear:= Gear^.NextGear
   187            Gear:= Gear^.NextGear
   188            end
   188            end
   189        end;
   189        end;
   190     // this layer is on the land level (which is close but behind the screen plane) when stereo
   190     // this layer is on the land level (which is close but behind the screen plane) when stereo
   191     1: begin
   191     1: begin
   192        Gear:= VisualGearLayers[1];
   192        Gear:= VisualGearLayersStart[1];
   193        while Gear <> nil do
   193        while Gear <> nil do
   194           begin
   194           begin
   195           if Gear^.Tint <> $FFFFFFFF then
   195           if Gear^.Tint <> $FFFFFFFF then
   196               Tint(Gear^.Tint);
   196               Tint(Gear^.Tint);
   197           case Gear^.Kind of
   197           case Gear^.Kind of
   246           Gear:= Gear^.NextGear
   246           Gear:= Gear^.NextGear
   247           end
   247           end
   248        end;
   248        end;
   249     // this layer is on the screen plane (depth = 0) when stereo
   249     // this layer is on the screen plane (depth = 0) when stereo
   250     3: begin
   250     3: begin
   251        Gear:= VisualGearLayers[3];
   251        Gear:= VisualGearLayersStart[3];
   252        while Gear <> nil do
   252        while Gear <> nil do
   253            begin
   253            begin
   254            tinted:= false;
   254            tinted:= false;
   255            if Gear^.Tint <> $FFFFFFFF then
   255            if Gear^.Tint <> $FFFFFFFF then
   256                Tint(Gear^.Tint);
   256                Tint(Gear^.Tint);
   305            Gear:= Gear^.NextGear
   305            Gear:= Gear^.NextGear
   306            end
   306            end
   307        end;
   307        end;
   308     // this layer is outside the screen when stereo
   308     // this layer is outside the screen when stereo
   309     2: begin
   309     2: begin
   310        Gear:= VisualGearLayers[2];
   310        Gear:= VisualGearLayersStart[2];
   311        while Gear <> nil do
   311        while Gear <> nil do
   312            begin
   312            begin
   313            tinted:= false;
   313            tinted:= false;
   314            if Gear^.Tint <> $FFFFFFFF then
   314            if Gear^.Tint <> $FFFFFFFF then
   315                Tint(Gear^.Tint);
   315                Tint(Gear^.Tint);
   380            Gear:= Gear^.NextGear
   380            Gear:= Gear^.NextGear
   381            end
   381            end
   382        end;
   382        end;
   383      // this layer is half-way between the screen plane (depth = 0) when in stereo, and the land
   383      // this layer is half-way between the screen plane (depth = 0) when in stereo, and the land
   384      4: begin
   384      4: begin
   385         Gear:= VisualGearLayers[4];
   385         Gear:= VisualGearLayersStart[4];
   386         while Gear <> nil do
   386         while Gear <> nil do
   387             begin
   387             begin
   388             if Gear^.Tint <> $FFFFFFFF then
   388             if Gear^.Tint <> $FFFFFFFF then
   389                 Tint(Gear^.Tint);
   389                 Tint(Gear^.Tint);
   390             case Gear^.Kind of
   390             case Gear^.Kind of
   406             Gear:= Gear^.NextGear
   406             Gear:= Gear^.NextGear
   407             end
   407             end
   408         end;
   408         end;
   409      // this layer is on the screen plane (depth = 0) when stereo, but just behind the land
   409      // this layer is on the screen plane (depth = 0) when stereo, but just behind the land
   410      5: begin
   410      5: begin
   411         Gear:= VisualGearLayers[5];
   411         Gear:= VisualGearLayersStart[5];
   412         while Gear <> nil do
   412         while Gear <> nil do
   413             begin
   413             begin
   414             if Gear^.Tint <> $FFFFFFFF then
   414             if Gear^.Tint <> $FFFFFFFF then
   415                 Tint(Gear^.Tint);
   415                 Tint(Gear^.Tint);
   416             case Gear^.Kind of
   416             case Gear^.Kind of
   432             Gear:= Gear^.NextGear
   432             Gear:= Gear^.NextGear
   433             end
   433             end
   434         end;
   434         end;
   435      // this layer is on the screen plane (depth = 0) when stereo, but just in front of the land
   435      // this layer is on the screen plane (depth = 0) when stereo, but just in front of the land
   436     6: begin
   436     6: begin
   437         Gear:= VisualGearLayers[6];
   437         Gear:= VisualGearLayersStart[6];
   438         while Gear <> nil do
   438         while Gear <> nil do
   439             begin
   439             begin
   440             if Gear^.Tint <> $FFFFFFFF then
   440             if Gear^.Tint <> $FFFFFFFF then
   441                 Tint(Gear^.Tint);
   441                 Tint(Gear^.Tint);
   442             case Gear^.Kind of
   442             case Gear^.Kind of
   472 begin
   472 begin
   473 if cCloudsNumber = cSDCloudsNumber then
   473 if cCloudsNumber = cSDCloudsNumber then
   474     exit;
   474     exit;
   475 for i:= 0 to 6 do
   475 for i:= 0 to 6 do
   476     begin
   476     begin
   477     vg:= VisualGearLayers[i];
   477     vg:= VisualGearLayersStart[i];
   478     while vg <> nil do
   478     while vg <> nil do
   479         if vg^.Kind = vgtCloud then
   479         if vg^.Kind = vgtCloud then
   480             begin
   480             begin
   481             tmp:= vg^.NextGear;
   481             tmp:= vg^.NextGear;
   482             DeleteVisualGear(vg);
   482             DeleteVisualGear(vg);
   512         (vobFramesCount = vobSDFramesCount) and (vobVelocity = vobSDVelocity) and
   512         (vobFramesCount = vobSDFramesCount) and (vobVelocity = vobSDVelocity) and
   513         (vobFallSpeed = vobSDFallSpeed) then
   513         (vobFallSpeed = vobSDFallSpeed) then
   514     exit;
   514     exit;
   515 for i:= 0 to 6 do
   515 for i:= 0 to 6 do
   516     begin
   516     begin
   517     vg:= VisualGearLayers[i];
   517     vg:= VisualGearLayersStart[i];
   518     while vg <> nil do
   518     while vg <> nil do
   519         if vg^.Kind = vgtFlake then
   519         if vg^.Kind = vgtFlake then
   520             begin
   520             begin
   521             tmp:= vg^.NextGear;
   521             tmp:= vg^.NextGear;
   522             DeleteVisualGear(vg);
   522             DeleteVisualGear(vg);
   535 procedure initModule;
   535 procedure initModule;
   536 var i: LongWord;
   536 var i: LongWord;
   537 begin
   537 begin
   538 VGCounter:= 0;
   538 VGCounter:= 0;
   539 for i:= 0 to 6 do
   539 for i:= 0 to 6 do
   540     VisualGearLayers[i]:= nil;
   540     begin
       
   541     VisualGearLayersStart[i]:= nil;
       
   542     VisualGearLayersEnd[i]:= nil;
       
   543     end;
   541 end;
   544 end;
   542 
   545 
   543 procedure freeModule;
   546 procedure freeModule;
   544 var i: LongWord;
   547 var i: LongWord;
   545 begin
   548 begin
   546 VGCounter:= 0;
   549 VGCounter:= 0;
   547 for i:= 0 to 6 do
   550 for i:= 0 to 6 do
   548     while VisualGearLayers[i] <> nil do DeleteVisualGear(VisualGearLayers[i]);
   551     while VisualGearLayersStart[i] <> nil do DeleteVisualGear(VisualGearLayersStart[i]);
   549 end;
   552 end;
   550 
   553 
   551 end.
   554 end.