Index: code/branches/pch/src/CMakeLists.txt
===================================================================
--- code/branches/pch/src/CMakeLists.txt	(revision 3166)
+++ code/branches/pch/src/CMakeLists.txt	(revision 3167)
@@ -29,5 +29,5 @@
 ADD_COMPILER_FLAGS("-DOIS_DYNAMIC_LIB")
 # Tolua binding speedup if required
-ADD_COMPILER_FLAGS("-DTOLUA_RELEASE" Release MinSizeRel TOLUA_PARSER_RELEASE)
+ADD_COMPILER_FLAGS("-DTOLUA_RELEASE" ORXONOX_RELEASE)
 
 # Default linking is SHARED
@@ -77,5 +77,5 @@
 
 SET(GENERATED_FILE_COMMENT
-   "DO NOT EDIT THIS FILE!
+   "DO NOT EDIT THIS FILE! <br>
     It has been automatically generated by CMake from OrxonoxConfig.h.in")
 # Copy and configure OrxonoxConfig which gets included in every file
@@ -108,4 +108,5 @@
   ${DIRECTX_INCLUDE_DIR}
   ${ZLIB_INCLUDE_DIR}
+  ${VLD_INCLUDE_DIR}
 
   # All library includes are prefixed with the path to avoid conflicts
@@ -152,6 +153,2 @@
 ADD_SUBDIRECTORY(network)
 ADD_SUBDIRECTORY(orxonox)
-
-# Apply version info
-SET_TARGET_PROPERTIES(util core network orxonox
-  PROPERTIES VERSION ${ORXONOX_VERSION})
Index: code/branches/pch/src/OrxonoxConfig.h.in
===================================================================
--- code/branches/pch/src/OrxonoxConfig.h.in	(revision 3166)
+++ code/branches/pch/src/OrxonoxConfig.h.in	(revision 3167)
@@ -34,10 +34,10 @@
 
 /**
- @file
- @brief
+@file
+@brief
     Various constants for compiler, architecture and platform.
-
+@remarks
     @GENERATED_FILE_COMMENT@
- */
+*/
 
 #ifndef _OrxonoxConfig_H__
@@ -52,5 +52,5 @@
 #cmakedefine ORXONOX_PLATFORM_UNIX /* Apple and Linux */
 
-/* Determine compiler and set ORXONOX_COMP_VER */
+// Determine compiler and set ORXONOX_COMP_VER
 #if defined( _MSC_VER )
 #  define ORXONOX_COMPILER_MSVC
@@ -75,13 +75,13 @@
 #endif
 
-/* Endianness */
+// Endianness
 #cmakedefine ORXONOX_BIG_ENDIAN
 #cmakedefine ORXONOX_LITTLE_ENDIAN
 
-/* Architecture */
+// Architecture
 #cmakedefine ORXONOX_ARCH_32
 #cmakedefine ORXONOX_ARCH_64
 
-/* See if we can use __forceinline or if we need to use __inline instead */
+// See if we can use __forceinline or if we need to use __inline instead
 #cmakedefine HAVE_FORCEINLINE
 #ifndef FORCEINLINE
@@ -93,5 +93,5 @@
 #endif
 
-/* Try to define function information */
+// Try to define function information
 #ifndef __FUNCTIONNAME__
 #  ifdef ORXONOX_COMPILER_BORLAND
@@ -115,5 +115,7 @@
 #define ORXONOX_VERSION_NAME "@ORXONOX_VERSION_NAME@"
 
-#define ORXONOX_VERSION ((ORXONOX_VERSION_MAJOR << 16) | (ORXONOX_VERSION_MINOR << 8) | ORXONOX_VERSION_PATCH)
+//! Defines version info encoded as 0xMMIIPP (M: Major version, I: Minor version, P: Patch version, all as hex)
+#define ORXONOX_VERSION \
+    ((ORXONOX_VERSION_MAJOR << 16) | (ORXONOX_VERSION_MINOR << 8) | ORXONOX_VERSION_PATCH)
 
 
@@ -123,10 +125,9 @@
 #ifdef ORXONOX_PLATFORM_UNIX
 
-/* TODO: Check what this actually is and whether we need it or not */
+// TODO: Check what this actually is and whether we need it or not
 #if 0
 #  ifdef ORXONOX_PLATFORM_APPLE
 #    define ORXONOX_PLATFORM_LIB "OrxonoxPlatform.bundle"
-#  else
-/* ORXONOX_PLATFORM_LINUX */
+#  else // ORXONOX_PLATFORM_LINUX
 #    define ORXONOX_PLATFORM_LIB "libOrxonoxPlatform.so"
 #  endif
@@ -151,8 +152,18 @@
 
 /*---------------------------------
- * Includes
- *-------------------------------*/
-/* Define the english written operators like and, or, xor
- * This is C++ standard, but the Microsoft compiler doesn't define them. */
+ * Options
+ *-------------------------------*/
+/**
+@def ORXONOX_RELEASE
+    Enables expensive (build time) optimisations and disables certain features
+*/
+#cmakedefine ORXONOX_RELEASE
+
+
+/*---------------------------------
+ * Includes and Declarations
+ *-------------------------------*/
+// Define the english written operators like and, or, xor
+// This is C++ standard, but the Microsoft compiler doesn't define them.
 #cmakedefine HAVE_ISO646_H
 #ifdef HAVE_ISO646_H
@@ -181,5 +192,11 @@
 */
 
-/* Forward declare the everywhere used std::string */
+// Always include the memory leak detector for MSVC except for actual releases
+// Note: Although officially supported, VLD does not work with MSVC 9
+#if defined(ORXONOX_COMPILER_MSVC) && _MSC_VER < 1500 && !defined(ORXONOX_RELEASE)
+#  include <vld.h>
+#endif
+
+// Forward declare the everywhere used std::string
 namespace std
 {
@@ -190,14 +207,3 @@
 }
 
-/* Just in case you don't include a standard header */
-#ifndef NULL
-  #define NULL 0
-#endif
-
-/* Visual Leak Detector looks for memory leaks */
-#cmakedefine VISUAL_LEAK_DETECTOR_ENABLE
-#ifdef VISUAL_LEAK_DETECTOR_ENABLE
-#  include <vld.h>
-#endif
-
 #endif /* _OrxonoxConfig_H__ */
Index: code/branches/pch/src/SpecialConfig.h.in
===================================================================
--- code/branches/pch/src/SpecialConfig.h.in	(revision 3166)
+++ code/branches/pch/src/SpecialConfig.h.in	(revision 3167)
@@ -28,12 +28,12 @@
 
 /**
- @file
- @brief
+@file
+@brief
     Various constants and options that only affect very little code.
- @note
+@note
     This is merely to avoid recompiling everything when only a path changes.
-
+@remarks
     @GENERATED_FILE_COMMENT@
- */
+*/
 
 #ifndef _SpecialConfig_H__
@@ -42,53 +42,73 @@
 #include "OrxonoxConfig.h"
 
-/* Set whether we must suffix "ceguilua/" for the CEGUILua.h include */
+/**
+@def CEGUILUA_USE_INTERNAL_LIBRARY
+    Set whether we must suffix "ceguilua/" for the CEGUILua.h include
+*/
 #cmakedefine CEGUILUA_USE_INTERNAL_LIBRARY
 
-/* Defined if a precompiled depdency package was used. We then copy all libraries
-   too when installing. */
+/**
+@def DEPENDENCY_PACKAGE_ENABLE
+    Defined if a precompiled depdency package was used. We then copy all libraries
+    too when installing.
+*/
 #cmakedefine DEPENDENCY_PACKAGE_ENABLE
 
-/* Orxonox either gets installed to the system or just into a folder.
-   The latter uses relative paths. */
+/**
+@def INSTALL_COPYABLE
+    Orxonox either gets installed to the system or just into a folder.
+    The latter uses relative paths.
+*/
 #cmakedefine INSTALL_COPYABLE
 
-/* Using MSVC or XCode IDE */
+/**
+@def CMAKE_CONFIGURATION_TYPES
+    Using MSVC or XCode IDE
+*/
 #cmakedefine CMAKE_CONFIGURATION_TYPES
 
-/* Handle default ConfigValues */
+// Handle default ConfigValues
 namespace orxonox
 {
-    const char* const ORXONOX_RUNTIME_INSTALL_PATH("@ORXONOX_RUNTIME_INSTALL_PATH@");
-    const char* const ORXONOX_MEDIA_INSTALL_PATH  ("@ORXONOX_MEDIA_INSTALL_PATH@");
+    // INSTALLATION PATHS
+    const char ORXONOX_RUNTIME_INSTALL_PATH[] = "@ORXONOX_RUNTIME_INSTALL_PATH@";
+    const char ORXONOX_MEDIA_INSTALL_PATH[]   = "@ORXONOX_MEDIA_INSTALL_PATH@";
     /* Config and Log path might be relative because they could be user and therefore runtime dependent */
-    const char* const ORXONOX_CONFIG_INSTALL_PATH ("@ORXONOX_CONFIG_INSTALL_PATH@");
-    const char* const ORXONOX_LOG_INSTALL_PATH    ("@ORXONOX_LOG_INSTALL_PATH@");
+    const char ORXONOX_CONFIG_INSTALL_PATH[]  = "@ORXONOX_CONFIG_INSTALL_PATH@";
+    const char ORXONOX_LOG_INSTALL_PATH[]     = "@ORXONOX_LOG_INSTALL_PATH@";
 
-    const char* const ORXONOX_MEDIA_DEV_PATH      ("@CMAKE_MEDIA_OUTPUT_DIRECTORY@");
+    // DEVELOPMENT RUN PATHS
+    const char ORXONOX_MEDIA_DEV_PATH[]       = "@CMAKE_MEDIA_OUTPUT_DIRECTORY@";
 #ifdef CMAKE_CONFIGURATION_TYPES
-    const char* const ORXONOX_CONFIG_DEV_PATH     ("@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" MACRO_QUOTEME(CMAKE_BUILD_TYPE));
-    const char* const ORXONOX_LOG_DEV_PATH        ("@CMAKE_LOG_OUTPUT_DIRECTORY@/"    MACRO_QUOTEME(CMAKE_BUILD_TYPE));
+    const char ORXONOX_CONFIG_DEV_PATH[]      = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" MACRO_QUOTEME(CMAKE_BUILD_TYPE);
+    const char ORXONOX_LOG_DEV_PATH[]         = "@CMAKE_LOG_OUTPUT_DIRECTORY@/"    MACRO_QUOTEME(CMAKE_BUILD_TYPE);
 #else
-    const char* const ORXONOX_CONFIG_DEV_PATH     ("@CMAKE_CONFIG_OUTPUT_DIRECTORY@");
-    const char* const ORXONOX_LOG_DEV_PATH        ("@CMAKE_LOG_OUTPUT_DIRECTORY@");
+    const char ORXONOX_CONFIG_DEV_PATH[]      = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@";
+    const char ORXONOX_LOG_DEV_PATH[]         = "@CMAKE_LOG_OUTPUT_DIRECTORY@";
 #endif
     
     /* OGRE Plugins */
 #ifdef NDEBUG
-    const char* const ORXONOX_OGRE_PLUGINS("@OGRE_PLUGINS_RELEASE@");
+    const char ORXONOX_OGRE_PLUGINS[] = "@OGRE_PLUGINS_RELEASE@";
 #  ifdef DEPENDENCY_PACKAGE_ENABLE
-    const char* const ORXONOX_OGRE_PLUGINS_FOLDER(".");
+    const char ORXONOX_OGRE_PLUGINS_FOLDER[] = ".";
 #  else
-    const char* const ORXONOX_OGRE_PLUGINS_FOLDER("@OGRE_PLUGINS_FOLDER_RELEASE@");
+    const char ORXONOX_OGRE_PLUGINS_FOLDER[] = "@OGRE_PLUGINS_FOLDER_RELEASE@";
 #  endif
 #else
-    const char* const ORXONOX_OGRE_PLUGINS("@OGRE_PLUGINS_DEBUG@");
+    const char ORXONOX_OGRE_PLUGINS[] = "@OGRE_PLUGINS_DEBUG@";
 #  ifdef DEPENDENCY_PACKAGE_ENABLE
-    const char* const ORXONOX_OGRE_PLUGINS_FOLDER(".");
+    const char ORXONOX_OGRE_PLUGINS_FOLDER[] = ".";
 #  else
-    const char* const ORXONOX_OGRE_PLUGINS_FOLDER("@OGRE_PLUGINS_FOLDER_DEBUG@");
+    const char ORXONOX_OGRE_PLUGINS_FOLDER[] = "@OGRE_PLUGINS_FOLDER_DEBUG@";
 #  endif
 #endif
 }
 
+/**
+@def ORXONOX_USE_WINMAIN
+    Use main() or WinMain()?
+*/
+#cmakedefine ORXONOX_USE_WINMAIN
+
 #endif /* _SpecialConfig_H__ */
Index: code/branches/pch/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/pch/src/orxonox/CMakeLists.txt	(revision 3166)
+++ code/branches/pch/src/orxonox/CMakeLists.txt	(revision 3167)
@@ -33,4 +33,9 @@
 ADD_SUBDIRECTORY(tools)
 
+# Translate argument
+IF(ORXONOX_USE_WINMAIN)
+  SET(ORXONOX_WIN32 WIN32)
+ENDIF()
+
 ORXONOX_ADD_EXECUTABLE(orxonox
   FIND_HEADER_FILES
@@ -44,4 +49,6 @@
     OrxonoxPrecompiledHeaders.h
   PCH_NO_DEFAULT
+  # When defined as WIN32 this removes the console window on Windows
+  ${ORXONOX_WIN32}
   LINK_LIBRARIES
     ${OGRE_LIBRARY}
@@ -85,4 +92,4 @@
   STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?) .*$" "\\1"
          VISUAL_STUDIO_VERSION_SIMPLE "${CMAKE_GENERATOR}")
-  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/orxonox.vcproj.user" "${CMAKE_CURRENT_BINARY_DIR}/orxonox.vcproj.user")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/orxonox.vcproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/orxonox.vcproj.user")
 ENDIF(MSVC)
Index: code/branches/pch/src/orxonox/Main.cc
===================================================================
--- code/branches/pch/src/orxonox/Main.cc	(revision 3166)
+++ code/branches/pch/src/orxonox/Main.cc	(revision 3167)
@@ -28,12 +28,9 @@
  */
  
- /**
- @mainpage Orxonox Documentation
- */
-
- /**
- @file
- @brief Entry point of the program.
-  */
+/**
+@file
+@brief
+    Entry point of the program.
+*/
 
 #include "OrxonoxConfig.h"
@@ -47,5 +44,9 @@
     Main method. Game starts here (except for static initialisations).
 */
+#ifdef ORXONOX_USE_WINMAIN
+INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
+#else
 int main(int argc, char** argv)
+#endif
 {
     {
Index: code/branches/pch/src/orxonox/orxonox.vcproj.user
===================================================================
--- code/branches/pch/src/orxonox/orxonox.vcproj.user	(revision 3166)
+++ 	(revision )
@@ -1,45 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioUserFile
-	ProjectType="Visual C++"
-	Version="${VISUAL_STUDIO_VERSION_SIMPLE}.00"
-	ShowAllFiles="false"
-	>
-	<Configurations>
-		<Configuration
-			Name="Debug|${MSVC_PLATFORM}"
-			>
-			<DebugSettings
-				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
-				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
-				EnvironmentMerge="true"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|${MSVC_PLATFORM}"
-			>
-			<DebugSettings
-				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
-				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
-				EnvironmentMerge="true"
-			/>
-		</Configuration>
-		<Configuration
-			Name="MinSizeRel|${MSVC_PLATFORM}"
-			>
-			<DebugSettings
-				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
-				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
-				EnvironmentMerge="true"
-			/>
-		</Configuration>
-		<Configuration
-			Name="RelWithDebInfo|${MSVC_PLATFORM}"
-			>
-			<DebugSettings
-				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
-				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
-				EnvironmentMerge="true"
-			/>
-		</Configuration>
-	</Configurations>
-</VisualStudioUserFile>
Index: code/branches/pch/src/orxonox/orxonox.vcproj.user.in
===================================================================
--- code/branches/pch/src/orxonox/orxonox.vcproj.user.in	(revision 3167)
+++ code/branches/pch/src/orxonox/orxonox.vcproj.user.in	(revision 3167)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+	ProjectType="Visual C++"
+	Version="${VISUAL_STUDIO_VERSION_SIMPLE}.00"
+	ShowAllFiles="false"
+	>
+	<Configurations>
+		<Configuration
+			Name="Debug|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+		<Configuration
+			Name="MinSizeRel|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+		<Configuration
+			Name="RelWithDebInfo|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+	</Configurations>
+</VisualStudioUserFile>
Index: code/branches/pch/src/orxonox/sound/SoundBase.h
===================================================================
--- code/branches/pch/src/orxonox/sound/SoundBase.h	(revision 3166)
+++ code/branches/pch/src/orxonox/sound/SoundBase.h	(revision 3167)
@@ -30,4 +30,5 @@
 
 #include "OrxonoxPrereqs.h"
+#include <cstring> // define NULL
 
 namespace orxonox
Index: code/branches/pch/src/tolua/CMakeLists.txt
===================================================================
--- code/branches/pch/src/tolua/CMakeLists.txt	(revision 3166)
+++ code/branches/pch/src/tolua/CMakeLists.txt	(revision 3167)
@@ -61,6 +61,4 @@
 )
 
-OPTION(TOLUA_PARSER_RELEASE "Disable all debug messages from tolua bind files for Release and MinSizeRel build types." FALSE)
-
 # Set some variables to the cache in order to use them in the TOLUA macro
 SET(TOLUA_PARSER_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/all-${LUA_VERSION}.lua" CACHE INTERNAL "")
