GCI2012: Too many variables
authorkoda
Fri, 30 Nov 2012 15:26:49 +0100
changeset 8153 e97e00427204
parent 8152 5e329951afe5 (diff)
parent 8145 6408c0ba4ba1 (current diff)
child 8154 0ea76ea45e6a
GCI2012: Too many variables
--- a/CMakeLists.txt	Thu Nov 29 23:23:19 2012 -0500
+++ b/CMakeLists.txt	Fri Nov 30 15:26:49 2012 +0100
@@ -2,11 +2,11 @@
 
 #initialise cmake environment
 cmake_minimum_required(VERSION 2.6.0)
-FOREACH(hwpolicy CMP0003 CMP0012 CMP0017)
-    IF(POLICY ${hwpolicy})
-        CMAKE_POLICY(SET ${hwpolicy} NEW)
-    ENDIF()
-ENDFOREACH()
+foreach(hwpolicy CMP0003 CMP0012 CMP0017)
+    if(POLICY ${hwpolicy})
+        cmake_policy(SET ${hwpolicy} NEW)
+    endif()
+endforeach()
 #use available modules, fallback to ours if not present (CMP0017 helps)
 set(CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules" "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
 
@@ -27,34 +27,34 @@
 
 
 #detect Mercurial revision (if present)
-IF(NOT NOREVISION)
+if(NOT NOREVISION)
     set(default_build_type "DEBUG")
     set(version_suffix "-development_version")
     set(HW_DEV true)
-    FIND_PROGRAM(HGCOMMAND hg)
-    IF(HGCOMMAND AND (EXISTS ${CMAKE_SOURCE_DIR}/.hg))
+    find_program(HGCOMMAND hg)
+    if(HGCOMMAND AND (EXISTS ${CMAKE_SOURCE_DIR}/.hg))
         execute_process(COMMAND ${HGCOMMAND} identify -in
                         WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
                         OUTPUT_VARIABLE internal_version
                         ERROR_QUIET
                     )
         #check local repo status
-        STRING(REGEX REPLACE "[^+]" "" HGCHANGED ${internal_version})
+        string(REGEX REPLACE "[^+]" "" HGCHANGED ${internal_version})
 
-        STRING(REGEX REPLACE "[0-9a-zA-Z]+(.*) ([0-9]+)(.*)" "\\2" revision_number ${internal_version})
-        STRING(REGEX REPLACE "([0-9a-zA-Z]+)(.*) [0-9]+(.*)" "\\1" revision_hash ${internal_version})
+        string(REGEX REPLACE "[0-9a-zA-Z]+(.*) ([0-9]+)(.*)" "\\2" revision_number ${internal_version})
+        string(REGEX REPLACE "([0-9a-zA-Z]+)(.*) [0-9]+(.*)" "\\1" revision_hash ${internal_version})
 
-        MESSAGE(STATUS "Building revision ${revision_number} from hash ${revision_hash} ${HGCHANGED}")
-        IF(HGCHANGED)
+        message(STATUS "Building revision ${revision_number} from hash ${revision_hash} ${HGCHANGED}")
+        if(HGCHANGED)
             MESSAGE(WARNING "Notice: you have uncommitted changes in your repository")
-        ENDIF()
+        endif()
         set(version_suffix "-${revision_number}${HGCHANGED}")
-    ENDIF()
-ELSE(NOT NOREVISION)
+    endif()
+else(NOT NOREVISION)
     set(default_build_type "RELEASE")
     set(HWDEV false)
-    MESSAGE(STATUS "Building distributable version")
-ENDIF(NOT NOREVISION)
+    message(STATUS "Building distributable version")
+endif(NOT NOREVISION)
 
 
 #versioning
--- a/QTfrontend/binds.cpp	Thu Nov 29 23:23:19 2012 -0500
+++ b/QTfrontend/binds.cpp	Fri Nov 30 15:26:49 2012 +0100
@@ -66,5 +66,7 @@
     {"fullscr",   "f12",        QT_TRANSLATE_NOOP("binds", "change mode"),     NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Toggle fullscreen mode:")},
     {"capture",   "c",          QT_TRANSLATE_NOOP("binds", "capture"),         NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Take a screenshot:")},
     {"rotmask",   "delete",     QT_TRANSLATE_NOOP("binds", "hedgehogs\ninfo"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Toggle labels above hedgehogs:")},
+#ifdef VIDEOREC
     {"record",    "r",          QT_TRANSLATE_NOOP("binds", "record"),          NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Record video:")}
+#endif
 };
--- a/QTfrontend/binds.h	Thu Nov 29 23:23:19 2012 -0500
+++ b/QTfrontend/binds.h	Fri Nov 30 15:26:49 2012 +0100
@@ -21,7 +21,11 @@
 
 #include <QString>
 
+#ifdef VIDEOREC
 #define BINDS_NUMBER 46
+#else
+#define BINDS_NUMBER 45
+#endif
 
 struct BindAction
 {
--- a/hedgewars/ArgParsers.inc	Thu Nov 29 23:23:19 2012 -0500
+++ b/hedgewars/ArgParsers.inc	Fri Nov 30 15:26:49 2012 +0100
@@ -64,97 +64,139 @@
 end;
 {$ENDIF}
 
-procedure setVideo(screenWidth: LongInt; screenHeight: LongInt; bitsStr: LongInt);
+procedure DisplayUsage;
 begin
-    cScreenWidth:= screenWidth;
-    cScreenHeight:= screenHeight;
-    cBits:= bitsStr
-end;
-
-procedure setVideoWithParameters(screenWidthParam: string; screenHeightParam: string; bitsParam: string);
-var screenWidthAsInt, screenHeightAsInt, bitsStrAsInt, c: LongInt;
-begin
-    val(screenWidthParam, screenWidthAsInt, c);
-    val(screenHeightParam, screenHeightAsInt, c);
-    val(bitsParam, bitsStrAsInt, c);
-    setVideo(screenWidthAsInt,screenHeightAsInt,bitsStrAsInt)
+    WriteLn(stdout, 'Usage:');
+    WriteLn(stdout, '');
+    WriteLn(stdout, '  hwengine <path to user hedgewars folder> <path to global data folder> <path to replay file> [options]');
+    WriteLn(stdout, '');
+    WriteLn(stdout, 'where [options] are any of the following:');
+    WriteLn(stdout, ' --locale [path to language file]');
+    WriteLn(stdout, ' --width  [screen width in pixels]');
+    WriteLn(stdout, ' --height [screen height in pixels]');
+    WriteLn(stdout, ' --depth  [color depth]');
+    WriteLn(stdout, ' --volume [sound level]');
+    WriteLn(stdout, ' --time   [number of seconds]');
+    WriteLn(stdout, ' --nomusic');
+    WriteLn(stdout, ' --nosound');
+    WriteLn(stdout, ' --fullscreen');
+    WriteLn(stdout, ' --showfps');
+    WriteLn(stdout, ' --altdmg');
+    WriteLn(stdout, ' --lowquality');
+    WriteLn(stdout, ' --stats-only');
+    WriteLn(stdout, ' --help');
+    WriteLn(stdout, '');
+    WriteLn(stdout, 'Deprecated options:');
+    WriteLn(stdout, ' --set-video [screen width] [screen height] [color dept]');
+    WriteLn(stdout, ' --set-audio [volume] [enable music] [enable sounds]');
+    WriteLn(stdout, ' --set-other [language file] [full screen] [show FPS]');
+    WriteLn(stdout, ' --set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]');
+    WriteLn(stdout, ' --set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]');
+    WriteLn(stdout, '');
+    WriteLn(stdout, 'For a more detailed help and examples go to:');
+    WriteLn(stdout, 'http://code.google.com/p/hedgewars/wiki/CommandLineOptions');
 end;
 
-procedure setOtherOptions(languageFile: string; fullScreen: boolean);
+function getLongIntParameter(str:String; var paramIndex:LongInt; var wrongParameter:Boolean): LongInt;
+var tmpInt, c: LongInt;
 begin
-    cLocaleFName:= languageFile;
-    cFullScreen:= fullScreen
-end;
-
-procedure setShowFPS(showFPS: boolean);
-begin
-    cShowFPS:= showFPS
+    paramIndex:= paramIndex + 1;
+    val(str, tmpInt, c);
+    wrongParameter:= c <> 0;
+    if wrongParameter then
+        WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a number, you passed "'+str+'"');
+    getLongIntParameter:= tmpInt;
 end;
 
-procedure setOtherOptionsWithParameters(languageFileParam: string; fullScreenParam: string; showFPSParam: string);
-var fullScreen, showFPS: boolean;
+function getStringParameter(str:String; var paramIndex:LongInt): String;
 begin
-    fullScreen:= fullScreenParam = '1';
-    showFPS:= showFPSParam = '1';
-    setOtherOptions(languageFileParam,fullScreen);
-    setShowFPS(showFPS)
-end;
-
-procedure setAudio(initialVolume: LongInt; musicEnabled: boolean; soundEnabled: boolean);
-begin
-    SetVolume(initialVolume);
-    SetMusic(musicEnabled);
-    SetSound(soundEnabled);
+    paramIndex:= paramIndex + 1;
+    getStringParameter:= str;
 end;
 
-procedure setAudioWithParameters(initialVolumeParam: string; musicEnabledParam: string; soundEnabledParam: string);
-var initialVolumeAsInt, c: LongInt;
-    musicEnabled, soundEnabled: boolean;
+procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt); Forward;
+
+function parseParameter(cmd:String; arg:String; var paramIndex:LongInt): Boolean;
+const videoArray: Array [1..3] of String = ('--width','--height','--depth');
+const audioArray: Array [1..3] of String = ('--volume','--nomusic','--nosound');
+const otherArray: Array [1..3] of String = ('--locale','--fullscreen','--showfps');
+const mediaArray: Array [1..8] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen');
+const allArray: Array [1..12] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--time','--lowquality');
 begin
-    val(initialVolumeParam, initialVolumeAsInt, c);
-    musicEnabled:= musicEnabledParam = '1';
-    soundEnabled:= soundEnabledParam = '1';
-    setAudio(initialVolumeAsInt,musicEnabled, soundEnabled)
-end;
-
-procedure setMultimediaOptionsWithParameters(screenWidthParam, screenHeightParam, bitsParam: string;
-                                             initialVolumeParam, musicEnabledParam, soundEnabledParam: string;
-                                             languageFileParam, fullScreenParam: string);
-begin
-    setVideoWithParameters(screenWidthParam,screenHeightParam, bitsParam);
-    setAudioWithParameters(initialVolumeParam,musicEnabledParam,soundEnabledParam);
-    setOtherOptions(languageFileParam,fullScreenParam = '1')
+    parseParameter:= false;
+    case cmd of
+        '--locale'     : cLocaleFName   := getStringParameter (arg, paramIndex);
+        '--width'      : cScreenWidth   := getLongIntParameter(arg, paramIndex, parseParameter);
+        '--height'     : cScreenHeight  := getLongIntParameter(arg, paramIndex, parseParameter);
+        '--depth'      : cBits          := getLongIntParameter(arg, paramIndex, parseParameter);
+        '--time'       : cTimerInterval := getLongIntParameter(arg, paramIndex, parseParameter);
+        '--volume'     : SetVolume       ( getLongIntParameter(arg, paramIndex, parseParameter) );
+        '--nomusic'    : SetMusic        ( false );
+        '--nosound'    : SetSound        ( false );
+        '--fullscreen' : cFullScreen    := true;
+        '--showfps'    : cShowFPS       := true;
+        '--altdmg'     : cAltDamage     := true;
+        '--lowquality' : cReducedQuality:= ($FFFFFFFF * getLongIntParameter(arg, paramIndex, parseParameter)) xor rqLowRes; //HACK!
+        '--set-video'      : parseClassicParameter(videoArray,3,paramIndex);
+        '--set-audio'      : parseClassicParameter(audioArray,3,paramIndex);
+        '--set-other'      : parseClassicParameter(otherArray,3,paramIndex);
+        '--set-multimedia' : parseClassicParameter(mediaArray,8,paramIndex);
+        '--set-everything' : parseClassicParameter(allArray,12,paramIndex);
+        '--stats-only' : begin
+                         cOnlyStats:= true;
+                         SetSound(false);
+                         SetMusic(false);
+                         cReducedQuality:= $FFFFFFFF xor rqLowRes;
+                         end;
+        '--gci' : begin            //     We had to make up all this saved space some how...     \\
+                  WriteLn(stdout, '                                                                ');
+                  WriteLn(stdout, '      /\\\\\\\\\\\\        /\\\\\\\\\  /\\\\\\\\\\\             ');
+                  WriteLn(stdout, '     /\\\//////////      /\\\////////  \/////\\\///             ');
+                  WriteLn(stdout, '     /\\\               /\\\/               \/\\\               ');
+                  WriteLn(stdout, '     \/\\\    /\\\\\\\  /\\\                 \/\\\              ');
+                  WriteLn(stdout, '      \/\\\   \/////\\\ \/\\\                 \/\\\             ');
+                  WriteLn(stdout, '       \/\\\       \/\\\ \//\\\                \/\\\            ');
+                  WriteLn(stdout, '        \/\\\       \/\\\  \///\\\              \/\\\           ');
+                  WriteLn(stdout, '         \//\\\\\\\\\\\\/     \////\\\\\\\\\  /\\\\\\\\\\\      ');
+                  WriteLn(stdout, '          \////////////           \/////////  \///////////      ');
+                  WriteLn(stdout, '                                                                ');
+                  WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student ');
+                  WriteLn(stdout, '             ASCII Art easter egg idea by @sheepluva            ');
+                  WriteLn(stdout, '                                                                ');
+                  end;
+        '--help' : begin
+                   DisplayUsage();
+                   GameType:= gmtSyntax;
+                   end;
+    else
+        begin
+        WriteLn(stderr, 'ERROR: '+cmd+' is not a valid argument');
+        parseParameter:= true;
+        end
+    end;
 end;
 
-procedure setAltDamageTimerValueAndQuality(altDamage: boolean; timeIterval: LongInt; reducedQuality: boolean);
+procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt);
+var index, tmpInt: LongInt;
+    isBool: Boolean;
 begin
-    cAltDamage:= altDamage;
-    cTimerInterval:= timeIterval;
-    if (reducedQuality) then        //HACK
-        cReducedQuality:= $FFFFFFFF xor rqLowRes
-end;
-
-procedure setAllOptionsWithParameters(screenWidthParam:string; screenHeightParam:string; bitsParam:string;
-                                      initialVolumeParam:string; musicEnabledParam:string; soundEnabledParam:string;
-                                      languageFileParam:string; fullScreenParam:string; showFPSParam:string;
-                                      altDamageParam:string; timeItervalParam:string; reducedQualityParam: string);
-var showFPS, altDamage, reducedQuality: boolean;
-    timeIterval, c: LongInt;
-begin
-    setMultimediaOptionsWithParameters(screenWidthParam,screenHeightParam, bitsParam,
-                                       initialVolumeParam,musicEnabledParam,soundEnabledParam,
-                                       languageFileParam,fullScreenParam);
-    showFPS := showFPSParam = '1';
-    setShowFPS(showFPS);
-
-    altDamage:= altDamageParam = '1';
-    val(timeItervalParam, timeIterval, c);
-    reducedQuality:= reducedQualityParam = '1';
-    setAltDamageTimerValueAndQuality(altDamage,timeIterval,reducedQuality);
+    index:= 0;
+    tmpInt:= 1;
+    while (index < size) do
+        begin
+        paramIndex:= paramIndex+1;
+        //This next line is a really strange (but short), way to check if the parameter is a boolean one
+        isBool:= true; case cmdArray[index] of '--nomusic':;'--nosound':;'--fullscreen':;'--showfps':;'--altdmg':;'--lowquality':; else isBool:= false; end;
+        if (not isBool) or ((ParamStr(paramIndex)='1') and (cmdArray[index]<>'--nomusic') and (cmdArray[index]<>'--nosound')) then
+            parseParameter(cmdArray[index], ParamStr(paramIndex), tmpInt);
+        //if isBool then
+        //  paramIndex:= paramIndex+1;
+        index:= index+1;
+        end;
 end;
 
 procedure playReplayFileWithParameters();
-var paramIndex: LongInt;
+var paramIndex, tmpInt: LongInt;
     wrongParameter: boolean;
 begin
     UserPathPrefix:= ParamStr(1);
@@ -162,86 +204,15 @@
     recordFileName:= ParamStr(3);
     paramIndex:= 4;
     wrongParameter:= false;
-    while (paramIndex <= ParamCount) and (not wrongParameter) do
+    while (paramIndex <= ParamCount) do
         begin
-        if ParamStr(paramIndex) = '--set-video'  then
-//--set-video [screen width] [screen height] [color dept]
-            begin
-            if(ParamCount-paramIndex < 3) then
-                begin
-                wrongParameter:= true;
-                GameType:= gmtSyntax
-                end;
-            setVideoWithParameters(ParamStr(paramIndex+1), ParamStr(paramIndex+2), ParamStr(paramIndex+3));
-            paramIndex:= paramIndex + 4
-            end
-        else
-//--set-audio [volume] [enable music] [enable sounds]
-            if ParamStr(paramIndex) = '--set-audio'  then
-                begin
-                if(ParamCount-paramIndex < 3) then
-                    begin
-                    wrongParameter := true;
-                    GameType:= gmtSyntax
-                    end;
-                setAudioWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3));
-                paramIndex:= paramIndex + 4
-                end
-            else
-// --set-other [language file] [full screen] [show FPS]
-                if ParamStr(paramIndex) = '--set-other'  then
-                    begin
-                    if(ParamCount-paramIndex < 3) then
-                        begin
-                        wrongParameter:= true;
-                        GameType:= gmtSyntax
-                        end;
-                    setOtherOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3));
-                    paramIndex:= paramIndex + 4
-                    end
-                else
-//--set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]
-                    if ParamStr(paramIndex) = '--set-multimedia'  then
-                        begin
-                        if ParamCount-paramIndex < 8  then
-                            begin
-                            wrongParameter:= true;
-                            GameType:= gmtSyntax
-                            end;
-                        setMultimediaOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3),
-                                                           ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6),
-                                                           ParamStr(paramIndex+7),ParamStr(paramIndex+8));
-                        paramIndex:= paramIndex + 9
-                        end
-                    else
-//--set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]
-                        if ParamStr(paramIndex) = '--set-everything'  then
-                            begin
-                            if ParamCount-paramIndex < 12  then
-                                begin
-                                wrongParameter:= true;
-                                GameType:= gmtSyntax
-                                end;
-                            setAllOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3),
-                                                        ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6),
-                                                        ParamStr(paramIndex+7),ParamStr(paramIndex+8),ParamStr(paramIndex+9),
-                                                        ParamStr(paramIndex+10),ParamStr(paramIndex+11),ParamStr(paramIndex+12));
-                            paramIndex:= paramIndex + 13
-                            end
-                        else
-                            if ParamStr(paramIndex) = '--stats-only'  then
-                                begin
-                                cOnlyStats:= true;
-                                SetSound(false);
-                                SetMusic(false);
-                                cReducedQuality:= $FFFFFFFF xor rqLowRes; // HACK
-                                paramIndex:= paramIndex + 1
-                                end
-                            else
-                                begin
-                                wrongParameter:= true;
-                                GameType:= gmtSyntax
-                                end
-    end
+        if parseParameter( ParamStr(paramIndex), ParamStr(paramIndex+1), paramIndex) then
+            wrongParameter:= true;
+        paramIndex:= paramIndex+1;
+        end;
+    if wrongParameter = true then
+        begin
+        WriteLn(stderr, 'Please use --help to see possible arguments and their usage');
+        GameType:= gmtSyntax;
+        end
 end;
-
--- a/hedgewars/CMakeLists.txt	Thu Nov 29 23:23:19 2012 -0500
+++ b/hedgewars/CMakeLists.txt	Fri Nov 30 15:26:49 2012 +0100
@@ -102,11 +102,11 @@
 
 
 #PASCAL DETECTION SECTION
-IF(FPC)
+if(FPC)
     set(fpc_executable ${FPC})
-ELSE()
+else()
     find_program(fpc_executable fpc)
-ENDIF()
+endif()
 
 message(STATUS "Check for working FPC compiler: ${fpc_executable}")
 execute_process(COMMAND ${fpc_executable} -iV OUTPUT_VARIABLE fpc_output ERROR_VARIABLE fpc_error)
@@ -241,7 +241,7 @@
 
 set(fpc_flags ${noexecstack_flags} ${pascal_flags} ${hwengine_project})
 
-IF(NOT APPLE)
+if(NOT APPLE)
     #here is the command for standard executables or for shared library
     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}"
         COMMAND "${fpc_executable}"
@@ -249,7 +249,7 @@
         MAIN_DEPENDENCY ${hwengine_project}
         DEPENDS ${engine_sources}
         )
-ELSE()
+else()
     #these are the dependencies for building a universal binary on Mac OS X
     foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build})
         set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list})
@@ -267,7 +267,7 @@
         ARGS ${lipo_args_list} -create -output ${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}
         DEPENDS ${lipo_args_list}
         )
-ENDIF()
+endif()
 
 
 add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}")
--- a/hedgewars/hwengine.pas	Thu Nov 29 23:23:19 2012 -0500
+++ b/hedgewars/hwengine.pas	Fri Nov 30 15:26:49 2012 +0100
@@ -536,39 +536,18 @@
 end;
 
 {$IFNDEF HWLIBRARY}
-///////////////////////////////////////////////////////////////////////////////
-procedure DisplayUsage;
-var i: LongInt;
-begin
-    WriteLn(stdout, 'Wrong argument format: correct configurations is');
-    WriteLn(stdout, '');
-    WriteLn(stdout, '  hwengine <path to user hedgewars folder> <path to global data folder> <path to replay file> [options]');
-    WriteLn(stdout, '');
-    WriteLn(stdout, 'where [options] must be specified either as:');
-    WriteLn(stdout, ' --set-video [screen width] [screen height] [color dept]');
-    WriteLn(stdout, ' --set-audio [volume] [enable music] [enable sounds]');
-    WriteLn(stdout, ' --set-other [language file] [full screen] [show FPS]');
-    WriteLn(stdout, ' --set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]');
-    WriteLn(stdout, ' --set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]');
-    WriteLn(stdout, ' --stats-only');
-    WriteLn(stdout, '');
-    WriteLn(stdout, 'Read documentation online at http://code.google.com/p/hedgewars/wiki/CommandLineOptions for more information');
-    WriteLn(stdout, '');
-    Write(stdout, 'PARSED COMMAND: ');
-    
-    for i:=0 to ParamCount do
-        Write(stdout, ParamStr(i) + ' ');
-        
-    WriteLn(stdout, '');
-end;
 
 ///////////////////////////////////////////////////////////////////////////////
 {$INCLUDE "ArgParsers.inc"}
 
 procedure GetParams;
+var tmpInt: LongInt;
 begin
     if (ParamCount < 3) then
-        GameType:= gmtSyntax
+        begin
+        DisplayUsage();
+        GameType:= gmtSyntax;
+        end
     else
         if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then
             begin
@@ -601,7 +580,7 @@
     if GameType = gmtLandPreview then
         GenLandPreview()
     else if GameType = gmtSyntax then
-        DisplayUsage()
+        //Exit cleanly
     else Game();
 
     // return 1 when engine is not called correctly
--- a/hedgewars/uChat.pas	Thu Nov 29 23:23:19 2012 -0500
+++ b/hedgewars/uChat.pas	Fri Nov 30 15:26:49 2012 +0100
@@ -41,6 +41,7 @@
     Width: LongInt;
     s: shortstring;
     end;
+    TChatCmd = (quit, pause, finish, fullscreen);
 
 var Strs: array[0 .. MaxStrIndex] of TChatLine;
     MStrs: array[0 .. MaxStrIndex] of shortstring;
@@ -52,15 +53,25 @@
     ChatReady: boolean;
     showAll: boolean;
 
-const colors: array[#0..#6] of TSDL_Color = (
-    (r:$FF; g:$FF; b:$FF; unused:$FF), // unused, feel free to take it for anything
-    (r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White]
-    (r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple]
-    (r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime]
-    (r:$FF; g:$FF; b:$A0; unused:$FF), // team message [Light Yellow]
-    (r:$FF; g:$00; b:$00; unused:$FF), // error messages [Red]
-    (r:$00; g:$FF; b:$FF; unused:$FF)  // input line [Light Blue]
-    );
+const
+    colors: array[#0..#6] of TSDL_Color = (
+            (r:$FF; g:$FF; b:$FF; unused:$FF), // unused, feel free to take it for anything
+            (r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White]
+            (r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple]
+            (r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime]
+            (r:$FF; g:$FF; b:$A0; unused:$FF), // team message [Light Yellow]
+            (r:$FF; g:$00; b:$00; unused:$FF), // error messages [Red]
+            (r:$00; g:$FF; b:$FF; unused:$FF)  // input line [Light Blue]
+            );
+    ChatCommandz: array [TChatCmd] of record
+            ChatCmd: string[31];
+            ProcedureCallChatCmd: string[31];
+            end = (
+            (ChatCmd: '/quit'; ProcedureCallChatCmd: 'halt'),
+            (ChatCmd: '/pause'; ProcedureCallChatCmd: 'pause'),
+            (ChatCmd: '/finish'; ProcedureCallChatCmd: 'finish'),
+            (ChatCmd: '/fullscreen'; ProcedureCallChatCmd: 'fullscr')
+            );
 
 procedure SetLine(var cl: TChatLine; str: shortstring; isInput: boolean);
 var strSurface, resSurface: PSDL_Surface;
@@ -197,6 +208,7 @@
 
 procedure AcceptChatString(s: shortstring);
 var i: TWave;
+    j: TChatCmd;
     c, t: LongInt;
     x: byte;
 begin
@@ -267,6 +279,13 @@
             ParseCommand('/taunt ' + char(i), true);
             exit
             end;
+
+	for j:= Low(TChatCmd) to High(TChatCmd) do
+        if (s = ChatCommandz[j].ChatCmd) then
+            begin
+            ParseCommand(ChatCommandz[j].ProcedureCallChatCmd, true);
+            exit
+            end;
     end
     else
         ParseCommand('/say ' + s, true);
--- a/misc/libopenalbridge/CMakeLists.txt	Thu Nov 29 23:23:19 2012 -0500
+++ b/misc/libopenalbridge/CMakeLists.txt	Fri Nov 30 15:26:49 2012 +0100
@@ -30,7 +30,7 @@
 
 if(WIN32)
 if(MSVC)
-	SET_TARGET_PROPERTIES(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def)
+	set_target_properties(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def)
 endif(MSVC)
 #install it in the executable directory
 	install(TARGETS openalbridge DESTINATION bin)
--- a/misc/physfs/CMakeLists.txt	Thu Nov 29 23:23:19 2012 -0500
+++ b/misc/physfs/CMakeLists.txt	Fri Nov 30 15:26:49 2012 +0100
@@ -6,59 +6,59 @@
 #lines overridden by Hedgewars configuration
 #CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
 #PROJECT(PhysicsFS)
-SET(PHYSFS_VERSION 2.1.0)
+set(PHYSFS_VERSION 2.1.0)
 
 # Increment this if/when we break backwards compatibility.
-SET(PHYSFS_SOVERSION 1)
+set(PHYSFS_SOVERSION 1)
 
 # I hate that they define "WIN32" ... we're about to move to Win64...I hope!
-IF(WIN32 AND NOT WINDOWS)
-    SET(WINDOWS TRUE)
-ENDIF(WIN32 AND NOT WINDOWS)
+if(WIN32 AND NOT WINDOWS)
+    set(WINDOWS true)
+endif(WIN32 AND NOT WINDOWS)
 
 # Bleh, let's do it for "APPLE" too.
-IF(APPLE AND NOT MACOSX)
-    SET(MACOSX TRUE)
-ENDIF(APPLE AND NOT MACOSX)
+if(APPLE AND NOT MACOSX)
+    set(MACOSX true)
+endif(APPLE AND NOT MACOSX)
 
 # For now, Haiku and BeOS are the same, as far as the build system cares.
-IF(HAIKU AND NOT BEOS)
-    SET(BEOS TRUE)
-ENDIF(HAIKU AND NOT BEOS)
+if(HAIKU AND NOT BEOS)
+    set(BEOS true)
+endif(HAIKU AND NOT BEOS)
 
-IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
-    SET(SOLARIS TRUE)
-ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+    set(SOLARIS true)
+endif(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
 
-INCLUDE(CheckIncludeFile)
-INCLUDE(CheckLibraryExists)
-INCLUDE(CheckCSourceCompiles)
+include(CheckIncludeFile)
+include(CheckLibraryExists)
+include(CheckCSourceCompiles)
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
 include_directories(${SDL_INCLUDE_DIR}) #hw
 include_directories(${LUA_INCLUDE_DIR}) #hw
 
-IF(MACOSX)
+if(MACOSX)
     # Fallback to older OS X on PowerPC to support wider range of systems...
-    IF(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
-        ADD_DEFINITIONS(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020)
-        SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2")
-    ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
+    if(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
+        add_definitions(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020)
+        set(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2")
+    endif(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
 
     # Need these everywhere...
-    ADD_DEFINITIONS(-fno-common)
-    SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework IOKit")
-ENDIF(MACOSX)
+    add_definitions(-fno-common)
+    set(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework IOKit")
+endif(MACOSX)
 
 # Add some gcc-specific command lines.
-IF(CMAKE_COMPILER_IS_GNUCC)
+if(CMAKE_COMPILER_IS_GNUCC)
     # Always build with debug symbols...you can strip it later.
-    ADD_DEFINITIONS(-g -pipe -Werror -fsigned-char)
+    add_definitions(-g -pipe -Werror -fsigned-char)
 
     # Stupid BeOS generates warnings in the system headers.
-    IF(NOT BEOS)
-        ADD_DEFINITIONS(-Wall)
-    ENDIF(NOT BEOS)
+    if(NOT BEOS)
+        add_definitions(-Wall)
+    endif(NOT BEOS)
 
     CHECK_C_SOURCE_COMPILES("
         #if ((defined(__GNUC__)) && (__GNUC__ >= 4))
@@ -68,31 +68,31 @@
         #endif
     " PHYSFS_IS_GCC4)
 
-    IF(PHYSFS_IS_GCC4)
+    if(PHYSFS_IS_GCC4)
         # Not supported on several operating systems at this time.
-        IF(NOT SOLARIS AND NOT WINDOWS)
-            ADD_DEFINITIONS(-fvisibility=hidden)
-        ENDIF(NOT SOLARIS AND NOT WINDOWS)
-    ENDIF(PHYSFS_IS_GCC4)
+        if(NOT SOLARIS AND NOT WINDOWS)
+            add_definitions(-fvisibility=hidden)
+        endif(NOT SOLARIS AND NOT WINDOWS)
+    endif(PHYSFS_IS_GCC4)
 
     # Don't use -rpath.
-    SET(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
+    set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
+endif(CMAKE_COMPILER_IS_GNUCC)
 
-IF(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
-    ADD_DEFINITIONS(-erroff=E_EMPTY_TRANSLATION_UNIT)
-    ADD_DEFINITIONS(-xldscope=hidden)
-ENDIF(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
+if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
+    add_definitions(-erroff=E_EMPTY_TRANSLATION_UNIT)
+    add_definitions(-xldscope=hidden)
+endif(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
 
-IF(MSVC)
+if(MSVC)
     # VS.NET 8.0 got really really anal about strcpy, etc, which even if we
     #  cleaned up our code, zlib, etc still use...so disable the warning.
-    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1)
-ENDIF(MSVC)
+    add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
+endif(MSVC)
 
 # Basic chunks of source code ...
 
-SET(LZMA_SRCS
+set(LZMA_SRCS
     src/lzma/C/7zCrc.c
     src/lzma/C/Archive/7z/7zBuffer.c
     src/lzma/C/Archive/7z/7zDecode.c
@@ -106,20 +106,20 @@
     src/lzma/C/Compress/Lzma/LzmaDecode.c
 )
 
-IF(BEOS)
+if(BEOS)
     # We add this explicitly, since we don't want CMake to think this
     #  is a C++ project unless we're on BeOS.
-    SET(PHYSFS_BEOS_SRCS src/platform_beos.cpp)
-    FIND_LIBRARY(BE_LIBRARY be)
-    FIND_LIBRARY(ROOT_LIBRARY root)
-    SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY})
-ENDIF(BEOS)
+    set(PHYSFS_BEOS_SRCS src/platform_beos.cpp)
+    find_library(BE_LIBRARY be)
+    find_library(ROOT_LIBRARY root)
+    set(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY})
+endif(BEOS)
 
 # Almost everything is "compiled" here, but things that don't apply to the
 #  build are #ifdef'd out. This is to make it easy to embed PhysicsFS into
 #  another project or bring up a new build system: just compile all the source
 #  code and #define the things you want.
-SET(PHYSFS_SRCS
+set(PHYSFS_SRCS
     src/physfs.c
     src/physfs_byteorder.c
     src/physfs_unicode.c
@@ -147,23 +147,23 @@
 
 # platform layers ...
 
-IF(UNIX)
-    IF(BEOS)
-        SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
-        SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
-        SET(HAVE_PTHREAD_H TRUE)
-    ELSE(BEOS)
+if(UNIX)
+    if(BEOS)
+        set(PHYSFS_HAVE_CDROM_SUPPORT true)
+        set(PHYSFS_HAVE_THREAD_SUPPORT true)
+        set(HAVE_PTHREAD_H true)
+    else(BEOS)
         CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H)
-        IF(HAVE_UCRED_H)
-            ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_UCRED_H=1)
-            SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
-        ENDIF(HAVE_UCRED_H)
+        if(HAVE_UCRED_H)
+            add_definitions(-DPHYSFS_HAVE_SYS_UCRED_H=1)
+            set(PHYSFS_HAVE_CDROM_SUPPORT false)
+        endif(HAVE_UCRED_H)
 
         CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H)
-        IF(HAVE_MNTENT_H)
-            ADD_DEFINITIONS(-DPHYSFS_HAVE_MNTENT_H=1)
-            SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
-        ENDIF(HAVE_MNTENT_H)
+        if(HAVE_MNTENT_H)
+            add_definitions(-DPHYSFS_HAVE_MNTENT_H=1)
+            set(PHYSFS_HAVE_CDROM_SUPPORT false)
+        endif(HAVE_MNTENT_H)
 
         # !!! FIXME: Solaris fails this, because mnttab.h implicitly
         # !!! FIXME:  depends on other system headers.  :(
@@ -174,150 +174,150 @@
             int main(int argc, char **argv) { return 0; }
         " HAVE_SYS_MNTTAB_H)
 
-        IF(HAVE_SYS_MNTTAB_H)
-            ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_MNTTAB_H=1)
-            SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
-        ENDIF(HAVE_SYS_MNTTAB_H)
+        if(HAVE_SYS_MNTTAB_H)
+            add_definitions(-DPHYSFS_HAVE_SYS_MNTTAB_H=1)
+            set(PHYSFS_HAVE_CDROM_SUPPORT false)
+        endif(HAVE_SYS_MNTTAB_H)
 
         CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
-        IF(HAVE_PTHREAD_H)
-            SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
-        ENDIF(HAVE_PTHREAD_H)
-    ENDIF(BEOS)
-ENDIF(UNIX)
+        if(HAVE_PTHREAD_H)
+            set(PHYSFS_HAVE_THREAD_SUPPORT false)
+        endif(HAVE_PTHREAD_H)
+    endif(BEOS)
+endif(UNIX)
 
-IF(WINDOWS)
-    SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
-    SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
-ENDIF(WINDOWS)
+if(WINDOWS)
+    set(PHYSFS_HAVE_CDROM_SUPPORT true)
+    set(PHYSFS_HAVE_THREAD_SUPPORT true)
+endif(WINDOWS)
 
-IF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
-    ADD_DEFINITIONS(-DPHYSFS_NO_CDROM_SUPPORT=1)
-    MESSAGE(WARNING " ***")
-    MESSAGE(WARNING " *** There is no CD-ROM support in this build!")
-    MESSAGE(WARNING " *** PhysicsFS will just pretend there are no discs.")
-    MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
-    MESSAGE(WARNING " ***   but is this what you REALLY wanted?")
-    MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
-    MESSAGE(WARNING " ***")
-ENDIF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
+if(NOT PHYSFS_HAVE_CDROM_SUPPORT)
+    add_definitions(-DPHYSFS_NO_CDROM_SUPPORT=1)
+    message(WARNING " ***")
+    message(WARNING " *** There is no CD-ROM support in this build!")
+    message(WARNING " *** PhysicsFS will just pretend there are no discs.")
+    message(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
+    message(WARNING " ***   but is this what you REALLY wanted?")
+    message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
+    message(WARNING " ***")
+endif(NOT PHYSFS_HAVE_CDROM_SUPPORT)
 
-IF(PHYSFS_HAVE_THREAD_SUPPORT)
-    ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE)
-ELSE(PHYSFS_HAVE_THREAD_SUPPORT)
-    ADD_DEFINITIONS(-DPHYSFS_NO_THREAD_SUPPORT=1)
-    MESSAGE(WARNING " ***")
-    MESSAGE(WARNING " *** There is no thread support in this build!")
-    MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!")
-    MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
-    MESSAGE(WARNING " ***   but is this what you REALLY wanted?")
-    MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
-    MESSAGE(WARNING " ***")
-ENDIF(PHYSFS_HAVE_THREAD_SUPPORT)
+if(PHYSFS_HAVE_THREAD_SUPPORT)
+    add_definitions(-D_REENTRANT -D_THREAD_SAFE)
+else(PHYSFS_HAVE_THREAD_SUPPORT)
+    add_definitions(-DPHYSFS_NO_THREAD_SUPPORT=1)
+    message(WARNING " ***")
+    message(WARNING " *** There is no thread support in this build!")
+    message(WARNING " *** PhysicsFS will NOT be reentrant!")
+    message(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
+    message(WARNING " ***   but is this what you REALLY wanted?")
+    message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
+    message(WARNING " ***")
+endif(PHYSFS_HAVE_THREAD_SUPPORT)
 
 
 # Archivers ...
 
-OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
-IF(PHYSFS_ARCHIVE_ZIP)
-    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1)
-ENDIF(PHYSFS_ARCHIVE_ZIP)
+option(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" true)
+if(PHYSFS_ARCHIVE_ZIP)
+    add_definitions(-DPHYSFS_SUPPORTS_ZIP=1)
+endif(PHYSFS_ARCHIVE_ZIP)
 
-OPTION(PHYSFS_ARCHIVE_7Z "Enable 7zip support" FALSE)
-IF(PHYSFS_ARCHIVE_7Z)
-    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_7Z=1)
+option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" false)
+if(PHYSFS_ARCHIVE_7Z)
+    add_definitions(-DPHYSFS_SUPPORTS_7Z=1)
     # !!! FIXME: rename to 7z.c?
-    SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS})
-ENDIF(PHYSFS_ARCHIVE_7Z)
+    set(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS})
+endif(PHYSFS_ARCHIVE_7Z)
 
-OPTION(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
-IF(PHYSFS_ARCHIVE_GRP)
-    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_GRP=1)
-ENDIF(PHYSFS_ARCHIVE_GRP)
+option(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" true)
+if(PHYSFS_ARCHIVE_GRP)
+    add_definitions(-DPHYSFS_SUPPORTS_GRP=1)
+endif(PHYSFS_ARCHIVE_GRP)
 
-OPTION(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
-IF(PHYSFS_ARCHIVE_WAD)
-    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_WAD=1)
-ENDIF(PHYSFS_ARCHIVE_WAD)
+option(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" true)
+if(PHYSFS_ARCHIVE_WAD)
+    add_definitions(-DPHYSFS_SUPPORTS_WAD=1)
+endif(PHYSFS_ARCHIVE_WAD)
 
-OPTION(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
-IF(PHYSFS_ARCHIVE_HOG)
-    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_HOG=1)
-ENDIF(PHYSFS_ARCHIVE_HOG)
+option(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" true)
+if(PHYSFS_ARCHIVE_HOG)
+    add_definitions(-DPHYSFS_SUPPORTS_HOG=1)
+endif(PHYSFS_ARCHIVE_HOG)
 
-OPTION(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
-IF(PHYSFS_ARCHIVE_MVL)
-    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MVL=1)
-ENDIF(PHYSFS_ARCHIVE_MVL)
+option(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" true)
+if(PHYSFS_ARCHIVE_MVL)
+    add_definitions(-DPHYSFS_SUPPORTS_MVL=1)
+endif(PHYSFS_ARCHIVE_MVL)
 
-OPTION(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
-IF(PHYSFS_ARCHIVE_QPAK)
-    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_QPAK=1)
-ENDIF(PHYSFS_ARCHIVE_QPAK)
+option(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" true)
+if(PHYSFS_ARCHIVE_QPAK)
+    add_definitions(-DPHYSFS_SUPPORTS_QPAK=1)
+endif(PHYSFS_ARCHIVE_QPAK)
 
-OPTION(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE)
-IF(PHYSFS_ARCHIVE_ISO9660)
-    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ISO9660=1)
-ENDIF(PHYSFS_ARCHIVE_ISO9660)
+option(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" true)
+if(PHYSFS_ARCHIVE_ISO9660)
+    add_definitions(-DPHYSFS_SUPPORTS_ISO9660=1)
+endif(PHYSFS_ARCHIVE_ISO9660)
 
 #as needed by Hedgewars configuration
-IF(WINDOWS)
-    OPTION(PHYSFS_BUILD_STATIC "Build static library" FALSE)
-    OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
-    SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} ${SDL_LIBRARY})
-ELSE(WINDOWS)
-    OPTION(PHYSFS_BUILD_STATIC "Build static library" TRUE)
-    OPTION(PHYSFS_BUILD_SHARED "Build shared library" FALSE)
-ENDIF(WINDOWS)
+if(WINDOWS)
+    option(PHYSFS_BUILD_STATIC "Build static library" false)
+    option(PHYSFS_BUILD_SHARED "Build shared library" true)
+    set(OTHER_LDFLAGS ${OTHER_LDFLAGS} ${SDL_LIBRARY})
+else(WINDOWS)
+    option(PHYSFS_BUILD_STATIC "Build static library" true)
+    option(PHYSFS_BUILD_SHARED "Build shared library" false)
+endif(WINDOWS)
 
-IF(PHYSFS_BUILD_STATIC)
-    ADD_LIBRARY(physfs STATIC ${PHYSFS_SRCS})
-    SET_TARGET_PROPERTIES(physfs PROPERTIES OUTPUT_NAME "physfs")
-    SET(PHYSFS_LIB_TARGET physfs)
-    SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
-ENDIF(PHYSFS_BUILD_STATIC)
+if(PHYSFS_BUILD_STATIC)
+    add_library(physfs STATIC ${PHYSFS_SRCS})
+    set_target_properties(physfs PROPERTIES OUTPUT_NAME "physfs")
+    set(PHYSFS_LIB_TARGET physfs)
+    set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
+endif(PHYSFS_BUILD_STATIC)
 
-IF(PHYSFS_BUILD_SHARED)
+if(PHYSFS_BUILD_SHARED)
     find_package(SDL REQUIRED)
-    ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS})
-    SET_TARGET_PROPERTIES(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
-    SET_TARGET_PROPERTIES(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
-    TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
-    SET(PHYSFS_LIB_TARGET physfs)
-    SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
-    INSTALL(TARGETS ${PHYSFS_INSTALL_TARGETS}
+    add_library(physfs SHARED ${PHYSFS_SRCS})
+    set_target_properties(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
+    set_target_properties(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
+    target_link_libraries(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
+    set(PHYSFS_LIB_TARGET physfs)
+    set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
+    install(TARGETS ${PHYSFS_INSTALL_TARGETS}
             RUNTIME DESTINATION bin)
-ENDIF(PHYSFS_BUILD_SHARED)
+endif(PHYSFS_BUILD_SHARED)
 
-IF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
-    MESSAGE(FATAL "Both shared and static libraries are disabled!")
-ENDIF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
+if(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
+    message(FATAL "Both shared and static libraries are disabled!")
+endif(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
 
 # CMake FAQ says I need this...
-IF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
-    SET_TARGET_PROPERTIES(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
-ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
+if(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
+    set_target_properties(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
+endif(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
 
-OPTION(PHYSFS_BUILD_TEST "Build stdio test program." FALSE)
-MARK_AS_ADVANCED(PHYSFS_BUILD_TEST)
-IF(PHYSFS_BUILD_TEST)
-    FIND_PATH(READLINE_H readline/readline.h)
-    FIND_PATH(HISTORY_H readline/history.h)
-    IF(READLINE_H AND HISTORY_H)
-        FIND_LIBRARY(CURSES_LIBRARY NAMES curses ncurses)
-        SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
-        FIND_LIBRARY(READLINE_LIBRARY readline)
-        IF(READLINE_LIBRARY)
-            SET(HAVE_SYSTEM_READLINE TRUE)
-            SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
-            INCLUDE_DIRECTORIES(${READLINE_H} ${HISTORY_H})
-            ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1)
-        ENDIF(READLINE_LIBRARY)
-    ENDIF(READLINE_H AND HISTORY_H)
-    ADD_EXECUTABLE(test_physfs test/test_physfs.c)
-    TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
-    SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
-ENDIF(PHYSFS_BUILD_TEST)
+option(PHYSFS_BUILD_TEST "Build stdio test program." false)
+mark_as_advanced(PHYSFS_BUILD_TEST)
+if(PHYSFS_BUILD_TEST)
+    find_path(READLINE_H readline/readline.h)
+    find_path(HISTORY_H readline/history.h)
+    if(READLINE_H AND HISTORY_H)
+        find_library(CURSES_LIBRARY NAMES curses ncurses)
+        set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
+        find_library(READLINE_LIBRARY readline)
+        if(READLINE_LIBRARY)
+            set(HAVE_SYSTEM_READLINE true)
+            set(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
+            include_directories(${READLINE_H} ${HISTORY_H})
+            add_definitions(-DPHYSFS_HAVE_READLINE=1)
+        endif(READLINE_LIBRARY)
+    endif(READLINE_H AND HISTORY_H)
+    add_executable(test_physfs test/test_physfs.c)
+    target_link_libraries(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
+    set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
+endif(PHYSFS_BUILD_TEST)
 
 
 # Scripting language bindings...
@@ -325,38 +325,38 @@
 #CMake's SWIG support is basically useless.
 #FIND_PACKAGE(SWIG)
 
-OPTION(PHYSFS_BUILD_SWIG "Build ${_LANG} bindings." FALSE)
-MARK_AS_ADVANCED(PHYSFS_BUILD_SWIG)
+option(PHYSFS_BUILD_SWIG "Build ${_LANG} bindings." false)
+mark_as_advanced(PHYSFS_BUILD_SWIG)
 
-FIND_PROGRAM(SWIG swig DOC "Path to swig command line app: http://swig.org/")
-IF(NOT SWIG)
-    MESSAGE(STATUS "SWIG not found. You won't be able to build scripting language bindings.")
-ELSE(NOT SWIG)
-    MARK_AS_ADVANCED(SWIG)
-    IF(DEFINED CMAKE_BUILD_TYPE)
-        IF((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
-            IF(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
-                SET(SWIG_OPT_CFLAGS "-small")
-            ELSE(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
-                SET(SWIG_OPT_CFLAGS "-O")
-            ENDIF(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
-        ENDIF((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
-    ENDIF(DEFINED CMAKE_BUILD_TYPE)
+find_program(SWIG swig DOC "Path to swig command line app: http://swig.org/")
+if(NOT SWIG)
+    message(STATUS "SWIG not found. You won't be able to build scripting language bindings.")
+else(NOT SWIG)
+    mark_as_advanced(SWIG)
+    if(DEFINED CMAKE_BUILD_TYPE)
+        if((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
+            if(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
+                set(SWIG_OPT_CFLAGS "-small")
+            else(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
+                set(SWIG_OPT_CFLAGS "-O")
+            endif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
+        endif((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
+    endif(DEFINED CMAKE_BUILD_TYPE)
 
-    SET(SWIG_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/physfs-swig-bindings")
+    set(SWIG_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/physfs-swig-bindings")
 
-    MACRO(CONFIGURE_SWIG_BINDING _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS _EXTRALDFLAGS)
-        STRING(TOUPPER "${_LANG}" _UPPERLANG)
-        STRING(TOLOWER "${_LANG}" _LOWERLANG)
-        SET(_TARGET "physfs-${_LOWERLANG}")
-        SET(_TARGETDIR "${SWIG_OUTPUT_DIR}/${_LOWERLANG}")
+    macro(CONFIGURE_SWIG_BINDING _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS _EXTRALDFLAGS)
+        string(TOUPPER "${_LANG}" _UPPERLANG)
+        string(TOLOWER "${_LANG}" _LOWERLANG)
+        set(_TARGET "physfs-${_LOWERLANG}")
+        set(_TARGETDIR "${SWIG_OUTPUT_DIR}/${_LOWERLANG}")
 
-        IF(NOT EXISTS "${_TARGETDIR}")
-            FILE(MAKE_DIRECTORY "${_TARGETDIR}")
-        ENDIF(NOT EXISTS "${_TARGETDIR}")
+        if(NOT EXISTS "${_TARGETDIR}")
+            file(MAKE_DIRECTORY "${_TARGETDIR}")
+        endif(NOT EXISTS "${_TARGETDIR}")
 
-        IF(PHYSFS_BUILD_${_UPPERLANG})
-            ADD_CUSTOM_COMMAND(
+        if(PHYSFS_BUILD_${_UPPERLANG})
+            add_custom_command(
                 OUTPUT "${_TARGETDIR}/${_TARGET}.c" ${_EXTRAOUTPUTS}
                 MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i"
                 COMMAND "${SWIG}"
@@ -364,66 +364,66 @@
                 COMMENT "Generating ${_LANG} bindings..."
             )
 
-            ADD_LIBRARY(${_TARGET} SHARED "${_TARGETDIR}/${_TARGET}.c")
-            TARGET_LINK_LIBRARIES(${_TARGET} ${PHYSFS_LIB_TARGET})
-            SET_TARGET_PROPERTIES(${_TARGET} PROPERTIES
+            add_library(${_TARGET} SHARED "${_TARGETDIR}/${_TARGET}.c")
+            target_link_libraries(${_TARGET} ${PHYSFS_LIB_TARGET})
+            set_target_properties(${_TARGET} PROPERTIES
                 COMPILE_FLAGS "${_EXTRACFLAGS}"
                 LINK_FLAGS "${_EXTRALDFLAGS}"
                 LIBRARY_OUTPUT_NAME "physfs"
                 LIBRARY_OUTPUT_DIRECTORY "${_TARGETDIR}"
                 CLEAN_DIRECT_OUTPUT 1
             )
-            INSTALL(TARGETS ${_TARGET} LIBRARY DESTINATION "${_INSTALLPATH}")
-            MESSAGE(STATUS "${_LANG} bindings configured!")
-        ELSE(PHYSFS_BUILD_${_UPPERLANG})
-            MESSAGE(STATUS "Couldn't figure out ${_LANG} configuration. Skipping ${_LANG} bindings.")
-        ENDIF(PHYSFS_BUILD_${_UPPERLANG})
-    ENDMACRO(CONFIGURE_SWIG_BINDING)
+            install(TARGETS ${_TARGET} LIBRARY DESTINATION "${_INSTALLPATH}")
+            message(STATUS "${_LANG} bindings configured!")
+        else(PHYSFS_BUILD_${_UPPERLANG})
+            message(STATUS "Couldn't figure out ${_LANG} configuration. Skipping ${_LANG} bindings.")
+        endif(PHYSFS_BUILD_${_UPPERLANG})
+    endmacro(CONFIGURE_SWIG_BINDING)
 
-    MACRO(ADD_SCRIPT_BINDING_OPTION _VAR _LANG _DEFVAL)
-        SET(BUILDSWIGVAL ${_DEFVAL})
-        IF(NOT PHYSFS_BUILD_SWIG)
-            SET(BUILDSWIGVAL FALSE)
-        ENDIF(NOT PHYSFS_BUILD_SWIG)
-        OPTION(${_VAR} "Build ${_LANG} bindings." ${BUILDSWIGVAL})
-        MARK_AS_ADVANCED(${_VAR})
-    ENDMACRO(ADD_SCRIPT_BINDING_OPTION)
+    macro(ADD_SCRIPT_BINDING_OPTION _VAR _LANG _DEFVAL)
+        set(BUILDSWIGVAL ${_DEFVAL})
+        if(NOT PHYSFS_BUILD_SWIG)
+            set(BUILDSWIGVAL false)
+        endif(NOT PHYSFS_BUILD_SWIG)
+        option(${_VAR} "Build ${_LANG} bindings." ${BUILDSWIGVAL})
+        mark_as_advanced(${_VAR})
+    endmacro(ADD_SCRIPT_BINDING_OPTION)
 
-    ADD_SCRIPT_BINDING_OPTION(PHYSFS_BUILD_PERL "Perl" TRUE)
-    ADD_SCRIPT_BINDING_OPTION(PHYSFS_BUILD_RUBY "Ruby" TRUE)
-ENDIF(NOT SWIG)
+    ADD_SCRIPT_BINDING_OPTION(PHYSFS_BUILD_PERL "Perl" true)
+    ADD_SCRIPT_BINDING_OPTION(PHYSFS_BUILD_RUBY "Ruby" true)
+endif(NOT SWIG)
 
-IF(PHYSFS_BUILD_PERL)
-    MESSAGE(STATUS "Configuring Perl bindings...")
-    FIND_PROGRAM(PERL perl DOC "Path to perl command line app: http://perl.org/")
-    IF(NOT PERL)
-        MESSAGE(STATUS "Perl not found. You won't be able to build perl bindings.")
-        SET(PHYSFS_BUILD_PERL FALSE)
-    ENDIF(NOT PERL)
-    MARK_AS_ADVANCED(PERL)
+if(PHYSFS_BUILD_PERL)
+    message(STATUS "Configuring Perl bindings...")
+    find_program(PERL perl DOC "Path to perl command line app: http://perl.org/")
+    if(NOT PERL)
+        message(STATUS "Perl not found. You won't be able to build perl bindings.")
+        set(PHYSFS_BUILD_PERL false)
+    endif(NOT PERL)
+    mark_as_advanced(PERL)
 
-    MACRO(GET_PERL_CONFIG _KEY _VALUE)
-        IF(PHYSFS_BUILD_PERL)
-            MESSAGE(STATUS "Figuring out perl config value '${_KEY}' ...")
-            EXECUTE_PROCESS(
+    macro(GET_PERL_CONFIG _KEY _VALUE)
+        if(PHYSFS_BUILD_PERL)
+            message(STATUS "Figuring out perl config value '${_KEY}' ...")
+            execute_process(
                 COMMAND ${PERL} -w -e "use Config; print \$Config{${_KEY}};"
                 RESULT_VARIABLE GET_PERL_CONFIG_RC
                 OUTPUT_VARIABLE ${_VALUE}
             )
-            IF(NOT GET_PERL_CONFIG_RC EQUAL 0)
-                MESSAGE(STATUS "Perl executable ('${PERL}') reported failure: ${GET_PERL_CONFIG_RC}")
-                SET(PHYSFS_BUILD_PERL FALSE)
-            ENDIF(NOT GET_PERL_CONFIG_RC EQUAL 0)
-            IF(NOT ${_VALUE})
-                MESSAGE(STATUS "Perl executable ('${PERL}') didn't have a value for '${_KEY}'")
-                SET(PHYSFS_BUILD_PERL FALSE)
-            ENDIF(NOT ${_VALUE})
+            if(NOT GET_PERL_CONFIG_RC EQUAL 0)
+                message(STATUS "Perl executable ('${PERL}') reported failure: ${GET_PERL_CONFIG_RC}")
+                set(PHYSFS_BUILD_PERL false)
+            endif(NOT GET_PERL_CONFIG_RC EQUAL 0)
+            if(NOT ${_VALUE})
+                message(STATUS "Perl executable ('${PERL}') didn't have a value for '${_KEY}'")
+                set(PHYSFS_BUILD_PERL false)
+            endif(NOT ${_VALUE})
 
-            IF(PHYSFS_BUILD_PERL)
-                MESSAGE(STATUS "Perl says: '${${_VALUE}}'.")
-            ENDIF(PHYSFS_BUILD_PERL)
-        ENDIF(PHYSFS_BUILD_PERL)
-    ENDMACRO(GET_PERL_CONFIG)
+            if(PHYSFS_BUILD_PERL)
+                message(STATUS "Perl says: '${${_VALUE}}'.")
+            endif(PHYSFS_BUILD_PERL)
+        endif(PHYSFS_BUILD_PERL)
+    endmacro(GET_PERL_CONFIG)
 
     # !!! FIXME: installsitearch might be the wrong location.
     GET_PERL_CONFIG("archlibexp" PERL_INCLUDE_PATH)
@@ -432,63 +432,63 @@
     GET_PERL_CONFIG("installsitearch" PERL_INSTALL_PATH)
 
     # !!! FIXME: this test for Mac OS X is wrong.
-    IF(MACOSX)
+    if(MACOSX)
         GET_PERL_CONFIG("libperl" PERL_LIBPERL)
-        SET(TMPLIBPERL "${PERL_LIBPERL}")
-        STRING(REGEX REPLACE "^lib" "" TMPLIBPERL "${TMPLIBPERL}")
-        STRING(REGEX REPLACE "\\.so$" "" TMPLIBPERL "${TMPLIBPERL}")
-        STRING(REGEX REPLACE "\\.dylib$" "" TMPLIBPERL "${TMPLIBPERL}")
-        STRING(REGEX REPLACE "\\.dll$" "" TMPLIBPERL "${TMPLIBPERL}")
-        IF(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
-            MESSAGE(STATUS "Stripped '${PERL_LIBPERL}' down to '${TMPLIBPERL}'.")
-            SET(PERL_LIBPERL "${TMPLIBPERL}")
-        ENDIF(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
-        SET(PERL_LIBPERL "-l${PERL_LIBPERL}")
-    ENDIF(MACOSX)
+        set(TMPLIBPERL "${PERL_LIBPERL}")
+        string(REGEX REPLACE "^lib" "" TMPLIBPERL "${TMPLIBPERL}")
+        string(REGEX REPLACE "\\.so$" "" TMPLIBPERL "${TMPLIBPERL}")
+        string(REGEX REPLACE "\\.dylib$" "" TMPLIBPERL "${TMPLIBPERL}")
+        string(REGEX REPLACE "\\.dll$" "" TMPLIBPERL "${TMPLIBPERL}")
+        if(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
+            message(STATUS "Stripped '${PERL_LIBPERL}' down to '${TMPLIBPERL}'.")
+            set(PERL_LIBPERL "${TMPLIBPERL}")
+        endif(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
+        set(PERL_LIBPERL "-l${PERL_LIBPERL}")
+    endif(MACOSX)
 
     CONFIGURE_SWIG_BINDING(Perl "${PERL_INSTALL_PATH}" "${SWIG_OUTPUT_DIR}/perl/physfs.pm" "\"-I${PERL_INCLUDE_PATH}/CORE\" ${PERL_CCFLAGS} -w" "\"-L${PERL_INCLUDE_PATH}/CORE\" ${PERL_LIBPERL} ${PERL_LDFLAGS}")
-    INSTALL(FILES "${SWIG_OUTPUT_DIR}/perl/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}")
-    INSTALL(
+    install(FILES "${SWIG_OUTPUT_DIR}/perl/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}")
+    install(
         FILES test/test_physfs.pl
         DESTINATION bin
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
                     GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
     )
-ENDIF(PHYSFS_BUILD_PERL)
+endif(PHYSFS_BUILD_PERL)
 
 # !!! FIXME: lots of cut-and-paste from perl bindings.
-IF(PHYSFS_BUILD_RUBY)
-    MESSAGE(STATUS "Configuring Ruby bindings...")
-    FIND_PROGRAM(RUBY ruby DOC "Path to ruby command line app: http://ruby-lang.org/")
-    IF(NOT RUBY)
-        MESSAGE(STATUS "Ruby not found. You won't be able to build ruby bindings.")
-        SET(PHYSFS_BUILD_RUBY FALSE)
-    ENDIF(NOT RUBY)
-    MARK_AS_ADVANCED(RUBY)
+if(PHYSFS_BUILD_RUBY)
+    message(STATUS "Configuring Ruby bindings...")
+    find_program(RUBY ruby DOC "Path to ruby command line app: http://ruby-lang.org/")
+    if(NOT RUBY)
+        message(STATUS "Ruby not found. You won't be able to build ruby bindings.")
+        set(PHYSFS_BUILD_RUBY FALSE)
+    endif(NOT RUBY)
+    mark_as_advanced(RUBY)
 
-    MACRO(GET_RUBY_CONFIG _KEY _VALUE)
-        IF(PHYSFS_BUILD_RUBY)
-            MESSAGE(STATUS "Figuring out ruby config value '${_KEY}' ...")
-            EXECUTE_PROCESS(
+    macro(GET_RUBY_CONFIG _KEY _VALUE)
+        if(PHYSFS_BUILD_RUBY)
+            message(STATUS "Figuring out ruby config value '${_KEY}' ...")
+            execute_process(
                 COMMAND ${RUBY} -e "require 'rbconfig'; puts RbConfig::CONFIG['${_KEY}'];"
                 RESULT_VARIABLE GET_RUBY_CONFIG_RC
                 OUTPUT_VARIABLE ${_VALUE}
                 OUTPUT_STRIP_TRAILING_WHITESPACE
             )
-            IF(NOT GET_RUBY_CONFIG_RC EQUAL 0)
-                MESSAGE(STATUS "Ruby executable ('${RUBY}') reported failure: ${GET_RUBY_CONFIG_RC}")
-                SET(PHYSFS_BUILD_RUBY FALSE)
-            ENDIF(NOT GET_RUBY_CONFIG_RC EQUAL 0)
-            IF(NOT ${_VALUE})
-                MESSAGE(STATUS "Ruby executable ('${RUBY}') didn't have a value for '${_KEY}'")
-                SET(PHYSFS_BUILD_RUBY FALSE)
-            ENDIF(NOT ${_VALUE})
+            if(NOT GET_RUBY_CONFIG_RC EQUAL 0)
+                message(STATUS "Ruby executable ('${RUBY}') reported failure: ${GET_RUBY_CONFIG_RC}")
+                set(PHYSFS_BUILD_RUBY FALSE)
+            endif(NOT GET_RUBY_CONFIG_RC EQUAL 0)
+            if(NOT ${_VALUE})
+                message(STATUS "Ruby executable ('${RUBY}') didn't have a value for '${_KEY}'")
+                set(PHYSFS_BUILD_RUBY FALSE)
+            endif(NOT ${_VALUE})
 
-            IF(PHYSFS_BUILD_RUBY)
-                MESSAGE(STATUS "Ruby says: '${${_VALUE}}'.")
-            ENDIF(PHYSFS_BUILD_RUBY)
-        ENDIF(PHYSFS_BUILD_RUBY)
-    ENDMACRO(GET_RUBY_CONFIG)
+            if(PHYSFS_BUILD_RUBY)
+                message(STATUS "Ruby says: '${${_VALUE}}'.")
+            endif(PHYSFS_BUILD_RUBY)
+        endif(PHYSFS_BUILD_RUBY)
+    endmacro(GET_RUBY_CONFIG)
 
     GET_RUBY_CONFIG("archdir" RUBY_INCLUDE_PATH)
     GET_RUBY_CONFIG("CFLAGS" RUBY_CCFLAGS)
@@ -498,14 +498,14 @@
     GET_RUBY_CONFIG("libdir" RUBY_LIBDIR)
 
     CONFIGURE_SWIG_BINDING(Ruby "${RUBY_INSTALL_PATH}" "" "\"-I${RUBY_INCLUDE_PATH}\" ${RUBY_CCFLAGS} -w" "\"-L${RUBY_LIBDIR}\" ${RUBY_LIBRUBY} ${RUBY_LDFLAGS}")
-    SET_TARGET_PROPERTIES(physfs-ruby PROPERTIES PREFIX "")
-    INSTALL(
+    set_target_properties(physfs-ruby PROPERTIES PREFIX "")
+    install(
         FILES test/test_physfs.rb
         DESTINATION bin
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
                     GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
     )
-ENDIF(PHYSFS_BUILD_RUBY)
+endif(PHYSFS_BUILD_RUBY)
 
 
 #INSTALL(TARGETS ${PHYSFS_INSTALL_TARGETS}
@@ -514,9 +514,9 @@
 #        ARCHIVE DESTINATION lib${LIB_SUFFIX})
 #INSTALL(FILES src/physfs.h DESTINATION include)
 
-IF(UNIX)
-    SET(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.gz")
-    ADD_CUSTOM_TARGET(
+if(UNIX)
+    set(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.gz")
+    add_custom_target(
         dist
         hg archive -t tgz "${PHYSFS_TARBALL}"
         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
@@ -528,17 +528,17 @@
 #        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
 #        COMMENT "Uninstall the project..."
 #    )
-ENDIF(UNIX)
+endif(UNIX)
 
-MACRO(MESSAGE_BOOL_OPTION _NAME _VALUE)
-    IF(${_VALUE})
-        MESSAGE(STATUS "  ${_NAME}: enabled")
-    ELSE(${_VALUE})
-        MESSAGE(STATUS "  ${_NAME}: disabled")
-    ENDIF(${_VALUE})
-ENDMACRO(MESSAGE_BOOL_OPTION)
+macro(MESSAGE_BOOL_OPTION _NAME _VALUE)
+    if(${_VALUE})
+        message(STATUS "  ${_NAME}: enabled")
+    else(${_VALUE})
+        message(STATUS "  ${_NAME}: disabled")
+    endif(${_VALUE})
+endmacro(MESSAGE_BOOL_OPTION)
 
-MESSAGE(STATUS "PhysicsFS will build with the following options:")
+message(STATUS "PhysicsFS will build with the following options:")
 MESSAGE_BOOL_OPTION("ZIP support" PHYSFS_ARCHIVE_ZIP)
 MESSAGE_BOOL_OPTION("7zip support" PHYSFS_ARCHIVE_7Z)
 MESSAGE_BOOL_OPTION("GRP support" PHYSFS_ARCHIVE_GRP)
@@ -553,9 +553,9 @@
 MESSAGE_BOOL_OPTION("Build Perl bindings" PHYSFS_BUILD_PERL)
 MESSAGE_BOOL_OPTION("Build Ruby bindings" PHYSFS_BUILD_RUBY)
 MESSAGE_BOOL_OPTION("Build stdio test program" PHYSFS_BUILD_TEST)
-IF(PHYSFS_BUILD_TEST)
+if(PHYSFS_BUILD_TEST)
     MESSAGE_BOOL_OPTION("  Use readline in test program" HAVE_SYSTEM_READLINE)
-ENDIF(PHYSFS_BUILD_TEST)
+endif(PHYSFS_BUILD_TEST)
 
 # end of CMakeLists.txt ...
 
--- a/project_files/Android-build/CMakeLists.txt	Thu Nov 29 23:23:19 2012 -0500
+++ b/project_files/Android-build/CMakeLists.txt	Fri Nov 30 15:26:49 2012 +0100
@@ -18,7 +18,7 @@
 
 find_program(ANT ant DOC "Path to the java package creator: ant")
 if(NOT EXISTS ${ANT})
-    MESSAGE(FATAL_ERROR "Couldn't detect the Ant build tool")
+    message(FATAL_ERROR "Couldn't detect the Ant build tool")
 endif()
 
 if(NOT ANDROID_NDK)
@@ -26,9 +26,9 @@
 endif()
 
 if(IS_DIRECTORY "${ANDROID_NDK}")
-    MESSAGE(STATUS "Detected the android NDK directory at: " ${ANDROID_NDK}) 
+    message(STATUS "Detected the android NDK directory at: " ${ANDROID_NDK}) 
 else ()
-    MESSAGE(FATAL_ERROR "Couldn't detect the Android NDK directory")
+    message(FATAL_ERROR "Couldn't detect the Android NDK directory")
 endif()
 
 if(NOT ANDROID_NDK_TOOLCHAINDIR)
@@ -39,9 +39,9 @@
 endif()
 
 if(IS_DIRECTORY "${ANDROID_NDK_TOOLCHAINDIR}")
-    MESSAGE(STATUS "Detected the Android NDK toolchain at: ${ANDROID_NDK_TOOLCHAINDIR}") 
+    message(STATUS "Detected the Android NDK toolchain at: ${ANDROID_NDK_TOOLCHAINDIR}") 
 else ()
-    MESSAGE(FATAL_ERROR "Couldn't detect the Android NDK toolchain directory: ${ANDROID_NDK_TOOLCHAINDIR}")
+    message(FATAL_ERROR "Couldn't detect the Android NDK toolchain directory: ${ANDROID_NDK_TOOLCHAINDIR}")
 endif()
 
 if(NOT ANDROID_SDK)#Check if its defined at the cmdline
@@ -52,9 +52,9 @@
 endif()
 
 if( IS_DIRECTORY "${ANDROID_SDK}")
-    MESSAGE(STATUS "Detected the android SDK directory at: " ${ANDROID_SDK}) 
+    message(STATUS "Detected the android SDK directory at: " ${ANDROID_SDK}) 
 else ()
-    MESSAGE(FATAL_ERROR "Couldn't detect the Android SDK directory")
+    message(FATAL_ERROR "Couldn't detect the Android SDK directory")
 endif()
 
 if( NOT FPC_DIR)
@@ -66,9 +66,9 @@
 endif()
 
 if( IS_DIRECTORY "${FPC_DIR}")
-    MESSAGE(STATUS "Detected the FreePascal directory at: " "${FPC_DIR}") 
+    message(STATUS "Detected the FreePascal directory at: " "${FPC_DIR}") 
 else ()
-    MESSAGE(FATAL_ERROR "Couldn't detect the FreePascal directory")
+    message(FATAL_ERROR "Couldn't detect the FreePascal directory")
 endif()
 
 set(SDL_DIR /home/richard/Downloads/android-project)
@@ -77,7 +77,7 @@
 set(ANDROID_SDK_API_LVL 16)
 set(ANDROID_NDK_API_LVL 5)
 
-MESSAGE(STATUS "Creating Makefile.android...")
+message(STATUS "Creating Makefile.android...")
 
 configure_file(Templates/Makefile.android .)
 
@@ -89,9 +89,9 @@
                  "--target android-${ANDROID_SDK_API_LVL}"
                  OUTPUT_VARIABLE androidoutput
                 )
-    MESSAGE(STATUS "Updating android project config...\n" ${androidoutput})
+    message(STATUS "Updating android project config...\n" ${androidoutput})
 else()
-    MESSAGE(FATAL_ERROR "Couldn't find the android executable in ${ANDROID_SDK}/platform-tools or ${ANDROID_SDK}/tools.")
+    message(FATAL_ERROR "Couldn't find the android executable in ${ANDROID_SDK}/platform-tools or ${ANDROID_SDK}/tools.")
 endif()
 
 exec_program(${HGCOMMAND}
--- a/share/CMakeLists.txt	Thu Nov 29 23:23:19 2012 -0500
+++ b/share/CMakeLists.txt	Fri Nov 30 15:26:49 2012 +0100
@@ -1,13 +1,13 @@
 add_subdirectory(hedgewars)
 
-IF(APPLE OR CROSSAPPLE)
+if(APPLE OR CROSSAPPLE)
     #needed for CFBundleVersion and CFBundleShortVersionString
         #should reuse the variables set in main CMakeLists.txt
-    IF(HGCOMMAND AND (EXISTS ${CMAKE_SOURCE_DIR}/.hg))
+    if(HGCOMMAND AND (EXISTS ${CMAKE_SOURCE_DIR}/.hg))
         set(HEDGEWARS_REVISION ${revision_number})
-    ELSE()
+    else()
         set(HEDGEWARS_REVISION ${HEDGEWARS_VERSION})
-    ENDIF()
+    endif()
 
     configure_file(${hedgewars_SOURCE_DIR}/share/Info.plist.in
                    ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
@@ -20,4 +20,4 @@
             DESTINATION ../Resources/)
     install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/dsa_pub.pem"
             DESTINATION ../Resources/)
-ENDIF(APPLE OR CROSSAPPLE)
+endif(APPLE OR CROSSAPPLE)