rename "frame alternate" to "wiggle" as it's more appropriate experimental3D
authorkoda
Sun, 16 Jan 2011 05:21:00 +0100 (2011-01-16)
branchexperimental3D
changeset 4818 202eef454354
parent 4816 c2575faeac3d
child 4844 20b81fafd236
rename "frame alternate" to "wiggle" as it's more appropriate move visual gears around levels to have smooth stereo effect
QTfrontend/pages.cpp
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
--- a/QTfrontend/pages.cpp	Sat Jan 15 18:35:59 2011 +0100
+++ b/QTfrontend/pages.cpp	Sun Jan 16 05:21:00 2011 +0100
@@ -733,7 +733,7 @@
             CBStereoMode->addItem(QComboBox::tr("Green/Red"));
             CBStereoMode->addItem(QComboBox::tr("Side-by-side"));
             CBStereoMode->addItem(QComboBox::tr("Top-Bottom"));
-            CBStereoMode->addItem(QComboBox::tr("Frame Alternate"));
+            CBStereoMode->addItem(QComboBox::tr("Wiggle"));
             connect(CBStereoMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceFullscreen(int)));
 
             GBAstereolayout->addWidget(CBStereoMode);
--- a/hedgewars/uVisualGears.pas	Sat Jan 15 18:35:59 2011 +0100
+++ b/hedgewars/uVisualGears.pas	Sun Jan 16 05:21:00 2011 +0100
@@ -392,6 +392,7 @@
 begin
 Gear:= VisualGearsList;
 case Layer of
+    // this level is very distant in the background when stereo
     0: while Gear <> nil do
         begin
         if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
@@ -414,6 +415,7 @@
         if Gear^.Tint <> $FFFFFFFF then Tint($FF,$FF,$FF,$FF);
         Gear:= Gear^.NextGear
         end;
+    // this level is on the land one when stereo
     1: while Gear <> nil do
         begin
         tinted:= false;
@@ -422,30 +424,60 @@
             vgtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State);
             vgtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State);
             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));
-            vgtSpeechBubble: if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team <> CurrentTeam)) or (Gear^.State = 1)) then 
-                    begin
-                    tinted:= true;
-                    Tint($FF, $FF, $FF,  $66);
-                    DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex)
-                    end
         end;
             if (cReducedQuality and rqAntiBoom) = 0 then
                 case Gear^.Kind of
                     vgtSmoke: DrawSprite(sprSmoke, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
                     vgtSmokeWhite: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
                     vgtDust: DrawSprite(sprDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
-                    vgtFeather: begin
-                            if Gear^.FrameTicks < 255 then
-                                begin
-                                Tint($FF, $FF, $FF, Gear^.FrameTicks);
-                                tinted:= true
-                                end;
-                            DrawRotatedF(sprFeather, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
-                            end;
+                    vgtFire: if (Gear^.State and gstTmpFlag) = 0 then
+                                 DrawSprite(sprFlame, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy, (RealTicks shr 6 + Gear^.Frame) mod 8)
+                             else
+                                 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);
+                    vgtSplash: if SuddenDeathDmg then
+                                   DrawSprite(sprSDSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37))
+                               else
+                                   DrawSprite(sprSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37));
+                    vgtDroplet: if SuddenDeathDmg then
+                                    DrawSprite(sprSDDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame)
+                                else
+                                    DrawSprite(sprDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);
+                    vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
                  end;
         if (Gear^.Tint <> $FFFFFFFF) or tinted then Tint($FF,$FF,$FF,$FF);
         Gear:= Gear^.NextGear
         end;
+    // this level is on the screen plane when stereo (depth = 0)
+    3: while Gear <> nil do
+        begin
+        tinted:= false;
+        if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
+        case Gear^.Kind of
+            vgtSpeechBubble: begin
+                           if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team <> CurrentTeam)) or (Gear^.State = 1)) then
+                           begin
+                               tinted:= true;
+                               Tint($FF, $FF, $FF,  $66);
+                               DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex)
+                           end
+                           else 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);
+                       end;
+            vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
+            vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
+            vgtHealth: begin
+                       tinted:= true;
+                       case Gear^.Frame div 10 of
+                           0:Tint(0, $FF, 0, round(Gear^.FrameTicks * $FF / 1000));
+                           1:Tint($FF, 0, 0, round(Gear^.FrameTicks * $FF / 1000));
+                       end;
+                       DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0);
+                       end;
+        end;
+        if (Gear^.Tint <> $FFFFFFFF) or tinted then Tint($FF,$FF,$FF,$FF);
+        Gear:= Gear^.NextGear
+       end;
+    // this level is outside the screen when stereo
     2: while Gear <> nil do
         begin
         tinted:= false;
@@ -462,10 +494,6 @@
             case Gear^.Kind of
                 vgtExplPart: DrawSprite(sprExplPart, round(Gear^.X) + WorldDx - 16, round(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
                 vgtExplPart2: DrawSprite(sprExplPart2, round(Gear^.X) + WorldDx - 16, round(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
-                vgtFire: if (Gear^.State and gstTmpFlag) = 0 then
-                             DrawSprite(sprFlame, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy, (RealTicks shr 6 + Gear^.Frame) mod 8)
-                         else
-                             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);
                 vgtBubble: DrawSprite(sprBubbles, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
                 vgtSteam: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
                 vgtAmmo: begin
@@ -474,14 +502,6 @@
                         DrawTextureF(ropeIconTex, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 32, 32);
                         DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32);
                         end;
-                vgtHealth:  begin
-                            tinted:= true;
-                            case Gear^.Frame div 10 of
-                                0:Tint(0, $FF, 0, round(Gear^.FrameTicks * $FF / 1000));
-                                1:Tint($FF, 0, 0, round(Gear^.FrameTicks * $FF / 1000));
-                            end;
-                            DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0);
-                            end;
                 vgtShell: begin
                             if Gear^.FrameTicks < $FF then
                                 begin
@@ -490,7 +510,15 @@
                                 end;
                             DrawRotatedF(sprShell, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
                             end;
-                  vgtEgg: begin
+                vgtFeather: begin
+                            if Gear^.FrameTicks < 255 then
+                                begin
+                                Tint($FF, $FF, $FF, Gear^.FrameTicks);
+                                tinted:= true
+                                end;
+                            DrawRotatedF(sprFeather, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
+                          end;
+                vgtEgg: begin
                             if Gear^.FrameTicks < $FF then
                                 begin
                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
@@ -498,14 +526,6 @@
                                 end;
                             DrawRotatedF(sprEgg, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
                             end;
-                 vgtSplash: if SuddenDeathDmg then
-                                DrawSprite(sprSDSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37))
-                            else
-                                DrawSprite(sprSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37));
-                vgtDroplet: if SuddenDeathDmg then
-                                DrawSprite(sprSDDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame)
-                            else
-                                DrawSprite(sprDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);
                vgtBeeTrace: begin
                             if Gear^.FrameTicks < $FF then
                                 Tint($FF, $FF, $FF, Gear^.FrameTicks div 2)
@@ -519,14 +539,10 @@
                             Tint($FF, $FF, $FF, round(Gear^.alpha * $FF));
                             DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle);
                             end;
-                vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
                  vgtNote: DrawRotatedF(sprNote, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
                 vgtBulletHit: DrawRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle);
             end;
         case Gear^.Kind of
-            vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
-            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);
-            vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
             vgtCircle:  if gear^.Angle = 1 then 
                             begin
                             tmp:= Gear^.State / 100;
--- a/hedgewars/uWorld.pas	Sat Jan 15 18:35:59 2011 +0100
+++ b/hedgewars/uWorld.pas	Sun Jan 16 05:21:00 2011 +0100
@@ -71,6 +71,7 @@
       cStereo_Water_distant = 0.0125;
       cStereo_Land          = 0.0075;
       cStereo_Water_near    = 0.0025;
+      cStereo_Outside       = 0.0400;
 
 procedure InitWorld;
 var i, t: LongInt;
@@ -808,7 +809,6 @@
         end;
 
     DrawVisualGears(1);
-
     DrawGears;
 
     if SuddenDeathDmg then
@@ -842,11 +842,14 @@
         DrawWaves(-1, 50, - (cWaveHeight shr 1), 0);
 
 // everything after this ChangeDepth will be drawn outside the screen
-    ChangeDepth(RM, 0.045);
+// note: negative parallax gears should last very little for a smooth stereo effect
+    ChangeDepth(RM, cStereo_Outside);
     DrawVisualGears(2);
 
 // everything after this ResetDepth will be drawn at screen level (depth = 0)
+// note: everything that needs to be readable should be on this level
     ResetDepth(RM);
+    DrawVisualGears(3);
 
 {$WARNINGS OFF}
 // Target