Remove some GLunit dependencies noticed on graph. uUtils was using it for GLfloat - but, the stuff it was returning to was usually converting to "real" anyway. uLand was including it unnecessarily. Minor refactor
authornemo
Fri, 28 Jun 2013 12:47:54 -0400
changeset 9295 f8819c3dde54
parent 9293 873022596d15
child 9297 3f16f5e43814
Remove some GLunit dependencies noticed on graph. uUtils was using it for GLfloat - but, the stuff it was returning to was usually converting to "real" anyway. uLand was including it unnecessarily. Minor refactor
hedgewars/uGears.pas
hedgewars/uLand.pas
hedgewars/uLandObjects.pas
hedgewars/uStore.pas
hedgewars/uTeams.pas
hedgewars/uUtils.pas
--- a/hedgewars/uGears.pas	Fri Jun 28 10:25:42 2013 +0400
+++ b/hedgewars/uGears.pas	Fri Jun 28 12:47:54 2013 -0400
@@ -49,7 +49,7 @@
 
 implementation
 uses uStore, uSound, uTeams, uRandom, uIO, uLandGraphics, {$IFDEF SDL13}uTouch,{$ENDIF}
-    uLocale, uAmmos, uStats, uVisualGears, uScript, GLunit, uVariables,
+    uLocale, uAmmos, uStats, uVisualGears, uScript, uVariables,
     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture,
     uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlersRope
     , uVisualGearsList, uGearsHandlersMess, uAI;
@@ -312,7 +312,7 @@
                     
                     ChangeToSDClouds;
                     ChangeToSDFlakes;
-                    glClearColor(SDSkyColor.r * (SDTint/255) / 255, SDSkyColor.g * (SDTint/255) / 255, SDSkyColor.b * (SDTint/255) / 255, 0.99);
+                    SetSkyColor(SDSkyColor.r * (SDTint/255) / 255, SDSkyColor.g * (SDTint/255) / 255, SDSkyColor.b * (SDTint/255) / 255);
                     Ammoz[amTardis].SkipTurns:= 9999;
                     Ammoz[amTardis].Probability:= 0;
                     end;
--- a/hedgewars/uLand.pas	Fri Jun 28 10:25:42 2013 +0400
+++ b/hedgewars/uLand.pas	Fri Jun 28 12:47:54 2013 -0400
@@ -20,7 +20,7 @@
 
 unit uLand;
 interface
-uses SDLh, uLandTemplates, uFloat, uConsts, GLunit, uTypes, uAILandMarks;
+uses SDLh, uLandTemplates, uFloat, uConsts, uTypes, uAILandMarks;
 
 procedure initModule;
 procedure freeModule;
--- a/hedgewars/uLandObjects.pas	Fri Jun 28 10:25:42 2013 +0400
+++ b/hedgewars/uLandObjects.pas	Fri Jun 28 12:47:54 2013 -0400
@@ -32,7 +32,7 @@
 procedure SetLand(var LandWord: Word; Pixel: LongWord); inline;
 
 implementation
-uses uStore, uConsts, uConsole, uRandom, uSound, GLunit
+uses uStore, uConsts, uConsole, uRandom, uSound
      , uTypes, uVariables, uUtils, uDebug, SysUtils
      , uPhysFSLayer;
 
@@ -535,7 +535,7 @@
             SkyColor.g:= t;
             SkyColor.b:= t
             end;
-        glClearColor(SkyColor.r / 255, SkyColor.g / 255, SkyColor.b / 255, 0.99);
+        SetSkyColor(SkyColor.r / 255, SkyColor.g / 255, SkyColor.b / 255);
         SDSkyColor.r:= SkyColor.r;
         SDSkyColor.g:= SkyColor.g;
         SDSkyColor.b:= SkyColor.b;
@@ -794,7 +794,7 @@
                 RQSkyColor.g:= t;
                 RQSkyColor.b:= t
                 end;
-            glClearColor(RQSkyColor.r / 255, RQSkyColor.g / 255, RQSkyColor.b / 255, 0.99);
+            SetSkyColor(RQSkyColor.r / 255, RQSkyColor.g / 255, RQSkyColor.b / 255);
             SDSkyColor.r:= RQSkyColor.r;
             SDSkyColor.g:= RQSkyColor.g;
             SDSkyColor.b:= RQSkyColor.b;
--- a/hedgewars/uStore.pas	Fri Jun 28 10:25:42 2013 +0400
+++ b/hedgewars/uStore.pas	Fri Jun 28 12:47:54 2013 -0400
@@ -54,6 +54,7 @@
 
 procedure WarpMouse(x, y: Word); inline;
 procedure SwapBuffers; {$IFDEF USE_VIDEO_RECORDING}cdecl{$ELSE}inline{$ENDIF};
+procedure SetSkyColor(r, g, b: real);
 
 implementation
 uses uMisc, uConsole, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands
@@ -1258,11 +1259,11 @@
         // clean the window from any previous content
         glClear(GL_COLOR_BUFFER_BIT);
         if SuddenDeathDmg then
-            glClearColor(SDSkyColor.r * (SDTint/255) / 255, SDSkyColor.g * (SDTint/255) / 255, SDSkyColor.b * (SDTint/255) / 255, 0.99)
+            SetSkyColor(SDSkyColor.r * (SDTint/255) / 255, SDSkyColor.g * (SDTint/255) / 255, SDSkyColor.b * (SDTint/255) / 255)
         else if ((cReducedQuality and rqNoBackground) = 0) then 
-            glClearColor(SkyColor.r / 255, SkyColor.g / 255, SkyColor.b / 255, 0.99)
+            SetSkyColor(SkyColor.r / 255, SkyColor.g / 255, SkyColor.b / 255)
         else
-            glClearColor(RQSkyColor.r / 255, RQSkyColor.g / 255, RQSkyColor.b / 255, 0.99);
+            SetSkyColor(RQSkyColor.r / 255, RQSkyColor.g / 255, RQSkyColor.b / 255);
 
         // reload everything we had before
         ReloadCaptions(false);
@@ -1273,6 +1274,31 @@
         end;
 end;
 
+procedure WarpMouse(x, y: Word); inline;
+begin
+{$IFDEF SDL13}
+    SDL_WarpMouseInWindow(SDLwindow, x, y);
+{$ELSE}
+    x:= x; y:= y; // avoid hints
+{$ENDIF}
+end;
+
+procedure SwapBuffers; {$IFDEF USE_VIDEO_RECORDING}cdecl{$ELSE}inline{$ENDIF};
+begin
+    if GameType = gmtRecord then
+        exit;
+{$IFDEF SDL13}
+    SDL_GL_SwapWindow(SDLwindow);
+{$ELSE}
+    SDL_GL_SwapBuffers();
+{$ENDIF}
+end;
+
+procedure SetSkyColor(r, g, b: real);
+begin
+    glClearColor(r, g, b, 0.99)
+end;
+
 procedure initModule;
 var ai: TAmmoType;
     i: LongInt;
@@ -1310,25 +1336,4 @@
 {$ENDIF}
     SDL_Quit();
 end;
-
-procedure WarpMouse(x, y: Word); inline;
-begin
-{$IFDEF SDL13}
-    SDL_WarpMouseInWindow(SDLwindow, x, y);
-{$ELSE}
-    x:= x; y:= y; // avoid hints
-{$ENDIF}
-end;
-
-procedure SwapBuffers; {$IFDEF USE_VIDEO_RECORDING}cdecl{$ELSE}inline{$ENDIF};
-begin
-    if GameType = gmtRecord then
-        exit;
-{$IFDEF SDL13}
-    SDL_GL_SwapWindow(SDLwindow);
-{$ELSE}
-    SDL_GL_SwapBuffers();
-{$ENDIF}
-end;
-
 end.
--- a/hedgewars/uTeams.pas	Fri Jun 28 10:25:42 2013 +0400
+++ b/hedgewars/uTeams.pas	Fri Jun 28 12:47:54 2013 -0400
@@ -21,7 +21,7 @@
 unit uTeams;
 interface
 uses uConsts, uInputHandler, uRandom, uFloat, uStats, 
-     uCollisions, GLunit, uSound, uStore, uTypes, uScript
+     uCollisions, uSound, uStore, uTypes, uScript
      {$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF};
 
 
--- a/hedgewars/uUtils.pas	Fri Jun 28 10:25:42 2013 +0400
+++ b/hedgewars/uUtils.pas	Fri Jun 28 12:47:54 2013 -0400
@@ -21,7 +21,7 @@
 unit uUtils;
 
 interface
-uses uTypes, uFloat, GLunit;
+uses uTypes, uFloat;
 
 procedure SplitBySpace(var a, b: shortstring);
 procedure SplitByChar(var a, b: shortstring; c: char);
@@ -41,7 +41,7 @@
 function  StrToInt(s: shortstring): LongInt;
 function  FloatToStr(n: hwFloat): shortstring;
 
-function  DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; inline;
+function  DxDy2Angle(const _dY, _dX: hwFloat): real; inline;
 function  DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
 function  DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
 function  DxDy2AttackAnglef(const _dY, _dX: extended): LongInt;
@@ -200,7 +200,7 @@
 end;
 
 
-function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; inline;
+function DxDy2Angle(const _dY, _dX: hwFloat): real; inline;
 var dY, dX: Extended;
 begin
 dY:= hwFloat2Float(_dY);