code cleanup
authorkoda
Tue, 18 Jan 2011 00:12:39 +0100
changeset 4850 434cd1284204
parent 4849 e7b1f0aaf36f
child 4851 3ba1ecc06dc6
code cleanup
hedgewars/hwLibrary.pas
hedgewars/options.inc
hedgewars/uCaptions.pas
hedgewars/uKeys.pas
hedgewars/uLandObjects.pas
hedgewars/uScript.pas
hedgewars/uStore.pas
hedgewars/uWorld.pas
--- a/hedgewars/hwLibrary.pas	Mon Jan 17 23:24:55 2011 +0100
+++ b/hedgewars/hwLibrary.pas	Tue Jan 18 00:12:39 2011 +0100
@@ -12,9 +12,8 @@
 // these procedures/functions to the PascalImports.h file (also in the "Pascal Sources" group)
 // to make these functions available in the C/C++/Objective-C source files
 // (add "#include PascalImports.h" near the top of these files if it's not there yet)
-uses cmem, uVariables, PascalExports, hwengine;
+uses cmem, PascalExports, hwengine;
 begin
-    // avoid compiler warnings about units not being used
-    isTerminated:= isTerminated;
+
 end.
 
--- a/hedgewars/options.inc	Mon Jan 17 23:24:55 2011 +0100
+++ b/hedgewars/options.inc	Tue Jan 18 00:12:39 2011 +0100
@@ -25,12 +25,10 @@
 {$MODE OBJFPC}
 {$MACRO ON}
 
-{$DEFINE GLunit:=GL,GLext}
+{$DEFINE GLunit:=GL}
 
 {$IFDEF IPHONEOS}
   {$DEFINE SDL13}
-  {$DEFINE SDL_MIXER_NEWER}
-  {$DEFINE SDL_IMAGE_NEWER}
   {$DEFINE HWLIBRARY}
   {$DEFINE S3D_DISABLED}
   {$DEFINE GLunit:=gles11}
--- a/hedgewars/uCaptions.pas	Mon Jan 17 23:24:55 2011 +0100
+++ b/hedgewars/uCaptions.pas	Tue Jan 18 00:12:39 2011 +0100
@@ -10,7 +10,7 @@
 procedure freeModule;
 
 implementation
-uses uTextures, uRenderUtils, uVariables, uRender, uConsts;
+uses uTextures, uRenderUtils, uVariables, uRender;
 
 type TCaptionStr = record
                    Tex: PTexture;
--- a/hedgewars/uKeys.pas	Mon Jan 17 23:24:55 2011 +0100
+++ b/hedgewars/uKeys.pas	Tue Jan 18 00:12:39 2011 +0100
@@ -164,8 +164,11 @@
 end;
 
 procedure ResetKbd;
-var i, j, k, t: LongInt;
-{$IFNDEF IPHONEOS}pkbd: PByteArray;{$ENDIF}
+var j, k, t: LongInt;
+{$IFNDEF IPHONEOS}
+    i: LongInt;
+    pkbd: PByteArray;
+{$ENDIF}
 begin
 
 k:= SDL_GetMouseState(nil, nil);
@@ -223,8 +226,9 @@
     end;
 {$ENDIF}
 
+// what is this final loop for?
 for t:= 0 to cKeyMaxIndex do
-    tkbd[i]:= tkbdn[i]
+    tkbd[t]:= tkbdn[t]
 end;
 
 procedure InitKbdKeyTable;
--- a/hedgewars/uLandObjects.pas	Mon Jan 17 23:24:55 2011 +0100
+++ b/hedgewars/uLandObjects.pas	Tue Jan 18 00:12:39 2011 +0100
@@ -29,7 +29,7 @@
 procedure AddOnLandObjects(Surface: PSDL_Surface);
 
 implementation
-uses uStore, uConsts, uConsole, uRandom, uVisualGears, uSound, GLunit,
+uses uStore, uConsts, uConsole, uRandom, uSound, GLunit,
      uTypes, uVariables, uUtils, uDebug, sysutils;
 
 const MaxRects = 512;
--- a/hedgewars/uScript.pas	Mon Jan 17 23:24:55 2011 +0100
+++ b/hedgewars/uScript.pas	Tue Jan 18 00:12:39 2011 +0100
@@ -55,7 +55,6 @@
     uVariables,
     uCommands,
     uUtils,
-    uKeys,
     uCaptions,
     uDebug,
     uCollisions;
--- a/hedgewars/uStore.pas	Mon Jan 17 23:24:55 2011 +0100
+++ b/hedgewars/uStore.pas	Tue Jan 18 00:12:39 2011 +0100
@@ -17,6 +17,7 @@
  *)
 
 {$INCLUDE "options.inc"}
+{$IF GLunit = GL}{$DEFINE GLunit:=GL,GLext}{$ENDIF}
 
 unit uStore;
 interface
@@ -436,7 +437,8 @@
 
 function glLoadExtension(extension : shortstring) : boolean;
 begin
-{$IFDEF IPHONEOS}
+{$IF GLunit = gles11}
+    // FreePascal doesn't come with OpenGL ES 1.1 Extension headers
     extension:= extension; // avoid hint
     glLoadExtension:= false;
 {$IFDEF DEBUGFILE}
--- a/hedgewars/uWorld.pas	Mon Jan 17 23:24:55 2011 +0100
+++ b/hedgewars/uWorld.pas	Tue Jan 18 00:12:39 2011 +0100
@@ -17,6 +17,7 @@
  *)
 
 {$INCLUDE "options.inc"}
+{$IF GLunit = GL}{$DEFINE GLunit:=GL,GLext}{$ENDIF}
 
 unit uWorld;
 interface
@@ -64,7 +65,7 @@
     amSel: TAmmoType = amNothing;
     missionTex: PTexture;
     missionTimer: LongInt;
-    stereoDepth: GLfloat = 0;
+    stereoDepth: GLfloat;
 
 const cStereo_Sky           = 0.0500;
       cStereo_Horizon       = 0.0250;
@@ -711,6 +712,7 @@
 procedure ChangeDepth(rm: TRenderMode; d: GLfloat);
 begin
 {$IFDEF S3D_DISABLED}
+    rm:= rm; d:= d; // avoid hint
     exit;
 {$ELSE}
     d:= d / 5;
@@ -726,6 +728,7 @@
 procedure ResetDepth(rm: TRenderMode);
 begin
 {$IFDEF S3D_DISABLED}
+    rm:= rm; // avoid hint
     exit;
 {$ELSE}
     if rm = rmDefault then exit;
@@ -740,10 +743,9 @@
 var i, t: LongInt;
     r: TSDL_Rect;
     tdx, tdy: Double;
-    grp: TCapGroup;
     s: string[15];
     highlight: Boolean;
-    offset, offsetX, offsetY, screenBottom: LongInt;
+    offsetX, offsetY, screenBottom: LongInt;
     VertexBuffer: array [0..3] of TVertex2f;
 begin
     if (cReducedQuality and rqNoBackground) = 0 then
@@ -1313,10 +1315,12 @@
     missionTimer:= 0;
     missionTex:= nil;
     cOffsetY:= 0;
+    stereoDepth:= 0;
 end;
 
 procedure freeModule;
 begin
+    stereoDepth:= stereoDepth; // avoid hint
 end;
 
 end.