- Bring back white dot in the center of crosshair. Crosshair is blurred now!
authorunc0rr
Fri, 01 Nov 2013 23:50:13 +0400
changeset 9666 8dcb25112d96
parent 9665 bfd62e380327
child 9667 0b27737fc28f
- Bring back white dot in the center of crosshair. Crosshair is blurred now! - untint() function instead of countless repetitions of tint($ff, $ff, $ff, $ff)
hedgewars/uChat.pas
hedgewars/uGearsRender.pas
hedgewars/uRender.pas
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
share/hedgewars/Data/Graphics/Crosshair.png
--- a/hedgewars/uChat.pas	Thu Oct 31 21:13:07 2013 -0400
+++ b/hedgewars/uChat.pas	Fri Nov 01 23:50:13 2013 +0400
@@ -175,7 +175,7 @@
     DrawFillRect(r);
     Tint($00, $00, $00, $80);
     DrawTexture(9 - cScreenWidth div 2, visibleCount * 16 + 11, InputStr.Tex);
-    Tint($FF, $FF, $FF, $FF);
+    untint;
     DrawTexture(8 - cScreenWidth div 2, visibleCount * 16 + 10, InputStr.Tex);
     end;
 
@@ -188,7 +188,7 @@
     DrawFillRect(r);
     Tint($00, $00, $00, $80);
     DrawTexture(9 - cScreenWidth div 2, (visibleCount - t) * 16 - 5, Strs[i].Tex);
-    Tint($FF, $FF, $FF, $FF);
+    untint;
     DrawTexture(8 - cScreenWidth div 2, (visibleCount - t) * 16 - 6, Strs[i].Tex);
     dec(r.y, 16);
 
--- a/hedgewars/uGearsRender.pas	Thu Oct 31 21:13:07 2013 -0400
+++ b/hedgewars/uGearsRender.pas	Fri Nov 01 23:50:13 2013 +0400
@@ -65,7 +65,7 @@
 
     glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]);
     glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2);
-    Tint($FF, $FF, $FF, $FF);
+    untint;
 
     glPopMatrix;
 
@@ -222,7 +222,7 @@
         DrawSprite(sprHHDeath, ox - 16, oy - 26, Gear^.Pos);
         Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
         DrawSprite(sprHHDeath, ox - 16, oy - 26, Gear^.Pos + 8);
-        Tint($FF, $FF, $FF, $FF);
+        untint;
         exit
         end
     else if (Gear^.State and gstHHGone) <> 0 then
@@ -263,7 +263,7 @@
         begin
         Tint($00, $FF, $40, $40);
         DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360);
-        Tint($FF, $FF, $FF, $FF)
+        untint
         end;
 
 
@@ -362,12 +362,15 @@
             CrosshairX := Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle));
             CrosshairY := Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle));
 
+            setTintAdd(true);
             Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
             DrawTextureRotated(CrosshairTexture,
                     12, 12, CrosshairX + WorldDx, CrosshairY + WorldDy, 0,
                     sign * (Gear^.Angle * 180.0) / cMaxAngle);
-            Tint($FFFFFFFF);
+            untint;
+            setTintAdd(false);
             end;
+
         hx:= ox + 8 * sign;
         hy:= oy - 2;
         aangle:= Gear^.Angle * 180 / cMaxAngle - 90;
@@ -422,7 +425,7 @@
                                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
                                     DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
                                         i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
-                                    Tint($FF, $FF, $FF, $FF)
+                                    untint
                                     end
                                 end
                     end;
@@ -459,7 +462,7 @@
                                     sign,
                                     32,
                                     32);
-                                Tint($FF, $FF, $FF, $FF)
+                                untint
                                 end
                             end;
                     defaultPos:= false
@@ -663,7 +666,7 @@
                              DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA);
                              //Tint($FF, $0, $0, $AA);
                              //DrawTexture(ox - 240, oy - 240, SpritesData[sprVampiric].Texture, 10);
-                             //Tint($FF, $FF, $FF, $FF);
+                             //untint;
                              end;
                 amVampiric: DrawSpriteRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
                 amRCPlane: begin
@@ -832,9 +835,9 @@
                         sign,
                         32,
                         32);
-                    Tint($FF, $FF, $FF, $FF)
+                    untint
                     end;
-                if HH^.Team^.hasGone then Tint($FF, $FF, $FF, $FF)
+                if HH^.Team^.hasGone then untint
                 end
             else
                 begin
@@ -857,7 +860,7 @@
                         sign*m,
                         32,
                         32);
-                    Tint($FF, $FF, $FF, $FF)
+                    untint
                     end
                 end
         end;
@@ -917,7 +920,7 @@
                 DrawTextureCentered(ox, t, Team^.NameTagTex)
                 end;
             if (cTagsMask and htTransparent) <> 0 then
-                Tint($FF, $FF, $FF, $FF)
+                untint
             end;
         if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog
             begin
@@ -968,7 +971,7 @@
 
 
         if HH^.Effects[heFrozen] < 150000 then
-            Tint($FF, $FF, $FF, $FF);
+            untint;
         end;
 
 
@@ -979,7 +982,7 @@
         Tint($FF, 0, 0, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750))));
         DrawSprite(sprVampiric, sx - 24, sy - 24, 0);
         end;
-        Tint($FF, $FF, $FF, $FF)
+        untint
 end;
 
 
@@ -1017,7 +1020,7 @@
                   if Gear^.Tag < 0 then aangle:= 360-aangle;
                   Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF);
                   DrawSpriteRotatedF(sprPlane, x, y, 0, Gear^.Tag, aangle - 90);
-                  Tint($FF, $FF, $FF, $FF);
+                  untint;
                   DrawSpriteRotatedF(sprPlane, x, y, 1, Gear^.Tag, aangle - 90)
                   end;
        gtBall: DrawSpriteRotatedF(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle);
@@ -1045,7 +1048,7 @@
                         Tint($f5, $db, $35, max($40, round($FF * abs(1 - (GameTicks mod 1500) / (750 + Gear^.Health)))));
                         //Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750))));
                         DrawSprite(sprVampiric, x - 24, y - 24, 0);
-                        Tint($FF, $FF, $FF, $FF)
+                        untint
                         end
                     end;
              gtBee: DrawSpriteRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
@@ -1139,7 +1142,7 @@
        gtAirAttack: begin
                     Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF);
                     DrawSpriteRotatedF(sprAirplane, x, y, 0, Gear^.Tag, 0);
-                    Tint($FF, $FF, $FF, $FF);
+                    untint;
                     DrawSpriteRotatedF(sprAirplane, x, y, 1, Gear^.Tag, 0);
                     end;
          gtAirBomb: DrawSpriteRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
@@ -1153,7 +1156,7 @@
           gtTarget: begin
                     Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000));
                     DrawSprite(sprTarget, x - 16, y - 16, 0);
-                    Tint($FF, $FF, $FF, $FF);
+                    untint;
                     end;
           gtMortar: DrawSpriteRotated(sprMortar, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
           gtCake: if Gear^.Pos = 6 then
@@ -1207,7 +1210,7 @@
                         Tint($FF, $FF, $FF, $10);
                         for i:= 8 downto 1 do
                             DrawTextureF(SpritesData[sprPiano].Texture, 1, x, y - hwRound(Gear^.dY * 4 * i), 0, 1, 128, 128);
-                        Tint($FF, $FF, $FF, $FF)
+                        untint
                         end;
                     DrawTextureF(SpritesData[sprPiano].Texture, 1, x, y, 0, 1, 128, 128);
                     end;
@@ -1219,13 +1222,13 @@
                     else
                         Tint($C0, $C0, $00, $C0);
                     DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 36 + Gear^.UID * 100) mod 360);
-                    Tint($FF, $FF, $FF, $FF)
+                    untint
                     end;
      gtResurrector: begin
                     DrawSpriteRotated(sprCross, x, y, 0, 0);
                     Tint($f5, $db, $35, max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000))));
                     DrawTexture(x - 108, y - 108, SpritesData[sprVampiric].Texture, 4.5);
-                    Tint($FF, $FF, $FF, $FF);
+                    untint;
                     end;
       gtNapalmBomb: DrawSpriteRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
            gtFlake: if Gear^.State and (gstDrowning or gstTmpFlag) <> 0  then
@@ -1238,7 +1241,7 @@
                         DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle);
                         //DrawSpriteRotated(sprSnowDust, x, y, 0, Gear^.DirAngle);
                         //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1);
-                        Tint($FF, $FF, $FF, $FF);
+                        untint;
                         end
                     else //if not isInLag then
                         begin
@@ -1255,7 +1258,7 @@
 //DrawSprite(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer)
 //DrawSpriteRotatedF(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer, 1, Gear^.DirAngle);
                         if Gear^.FlightTime > 0 then
-                            Tint($FF, $FF, $FF, $FF);
+                            untint;
                         end;
        //gtStructure: DrawSprite(sprTarget, x - 16, y - 16, 0);
           gtTardis: if Gear^.Pos <> 4 then
@@ -1266,16 +1269,16 @@
                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
                         DrawSprite(sprTardis, x-24, y-63,0);
                         if Gear^.Pos = 2 then
-                            Tint($FF, $FF, $FF, $FF)
+                            untint
                         else
                             Tint($FF,$FF,$FF,max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
                         DrawSprite(sprTardis, x-24, y-63,1);
                         if Gear^.Pos <> 2 then
-                            Tint($FF, $FF, $FF, $FF)
+                            untint
 (*
                         Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250))));
                         DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25);
-                        Tint($FF, $FF, $FF, $FF)
+                        untint
 *)
                         end;
             gtIceGun: begin
@@ -1313,7 +1316,7 @@
          end;
       if Gear^.RenderTimer and (Gear^.Tex <> nil) then
           DrawTextureCentered(x + 8, y + 8, Gear^.Tex);
-    if Gear^.State and gstFrozen <> 0 then Tint($FF, $FF, $FF, $FF)
+    if Gear^.State and gstFrozen <> 0 then untint
 end;
 
 end.
--- a/hedgewars/uRender.pas	Thu Oct 31 21:13:07 2013 -0400
+++ b/hedgewars/uRender.pas	Fri Nov 01 23:50:13 2013 +0400
@@ -52,6 +52,8 @@
 
 procedure Tint                  (r, g, b, a: Byte); inline;
 procedure Tint                  (c: Longword); inline;
+procedure untint(); inline;
+procedure setTintAdd            (f: boolean); inline;
 
 
 implementation
@@ -372,7 +374,7 @@
 
     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
     glDrawArrays(GL_LINES, 0, Length(VertexBuffer));
-    Tint($FF, $FF, $FF, $FF);
+    untint;
     
     glPopMatrix;
     
@@ -405,7 +407,7 @@
 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
 
-Tint($FF, $FF, $FF, $FF);
+untint;
 glEnable(GL_TEXTURE_2D)
 end;
 
@@ -413,7 +415,7 @@
 begin
     Tint(r, g, b, a);
     DrawCircle(X, Y, Radius, Width); 
-    Tint($FF, $FF, $FF, $FF);
+    untint;
 end;
 
 procedure DrawCircle(X, Y, Radius, Width: LongInt); 
@@ -527,7 +529,7 @@
         begin
         Tint($FF, $FF, $FF, alpha);
         DrawTexture(frame.x, frame.y, spritesData[sprite].Texture, buttonScale);
-        Tint($FF, $FF, $FF, $FF);
+        untint;
         end;
     end;
 {$ELSE}
@@ -564,4 +566,17 @@
     Tint(((c shr 24) and $FF), ((c shr 16) and $FF), (c shr 8) and $FF, (c and $FF))
 end;
 
+procedure untint(); inline;
+begin
+    Tint($FF, $FF, $FF, $FF)
+end;
+
+procedure setTintAdd(f: boolean); inline;
+begin
+    if f then
+        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD)
+    else
+        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+end;
+
 end.
--- a/hedgewars/uVisualGears.pas	Thu Oct 31 21:13:07 2013 -0400
+++ b/hedgewars/uVisualGears.pas	Fri Nov 01 23:50:13 2013 +0400
@@ -167,7 +167,7 @@
                              end;
                end;
            if Gear^.Tint <> $FFFFFFFF then
-               Tint($FF,$FF,$FF,$FF);
+               untint;
            Gear:= Gear^.NextGear
            end
        end;
@@ -220,9 +220,9 @@
                                   DrawSprite(sprDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);
                   vgtBubble: DrawSprite(sprBubbles, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
               end;
-          //if (Gear^.Tint <> $FFFFFFFF) or tinted then Tint($FF,$FF,$FF,$FF);
+          //if (Gear^.Tint <> $FFFFFFFF) or tinted then untint;
           if (Gear^.Tint <> $FFFFFFFF) then
-              Tint($FF,$FF,$FF,$FF);
+              untint;
           Gear:= Gear^.NextGear
           end
        end;
@@ -284,7 +284,7 @@
                    vgtChunk: DrawSpriteRotatedF(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);
+               untint;
            Gear:= Gear^.NextGear
            end
        end;
@@ -368,7 +368,7 @@
                               DrawCircle(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State, Gear^.Timer);
            end;
            if (Gear^.Tint <> $FFFFFFFF) or tinted then
-               Tint($FF,$FF,$FF,$FF);
+               untint;
            Gear:= Gear^.NextGear
            end
        end;
@@ -396,7 +396,7 @@
                                 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);
             end;
             if (Gear^.Tint <> $FFFFFFFF) then
-                Tint($FF,$FF,$FF,$FF);
+                untint;
             Gear:= Gear^.NextGear
             end
         end;
@@ -424,7 +424,7 @@
                                 DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
                 end;
             if (Gear^.Tint <> $FFFFFFFF) then
-                Tint($FF,$FF,$FF,$FF);
+                untint;
             Gear:= Gear^.NextGear
             end
         end;
@@ -448,7 +448,7 @@
                                 DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
                 end;
             if (Gear^.Tint <> $FFFFFFFF) then
-                Tint($FF,$FF,$FF,$FF);
+                untint;
             Gear:= Gear^.NextGear
             end
         end;
--- a/hedgewars/uWorld.pas	Thu Oct 31 21:13:07 2013 -0400
+++ b/hedgewars/uWorld.pas	Fri Nov 01 23:50:13 2013 +0400
@@ -892,7 +892,7 @@
 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]);
 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
 
-Tint($FF, $FF, $FF, $FF);
+untint;
 
 {for i:= -1 to cWaterSprCount do
     DrawSprite(sprWater,
@@ -1297,7 +1297,7 @@
             begin
             if TeamsCount * 100 > Longword(cScreenHeight) then
                 Tint($FF,$FF,$FF,$80)
-            else Tint($FF, $FF, $FF, $FF);
+            else untint;
 
             // draw name
             r.x:= 2;
@@ -1346,7 +1346,7 @@
         ChangeDepth(RM, -cStereo_Horizon);
         DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset);
         if SuddenDeathDmg then
-            Tint($FF, $FF, $FF, $FF);
+            untint;
     end;
 
 DrawVisualGears(0);
@@ -1661,7 +1661,7 @@
         glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
 
         glEnable(GL_TEXTURE_2D);
-        Tint($FF, $FF, $FF, $FF);
+        untint;
         if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then
             ScreenFade:= sfNone
         end
@@ -1689,7 +1689,7 @@
     for i:= 0 to 20 do
         glVertex2f(-(cScreenWidth shr 1) + 30 + sin(i*2*Pi/20)*10, 35 + cos(i*2*Pi/20)*10);
     glEnd();
-    Tint($FF, $FF, $FF, $FF);
+    untint;
     glEnable(GL_TEXTURE_2D);
     end;
 {$ENDIF}
Binary file share/hedgewars/Data/Graphics/Crosshair.png has changed