diff -Nru megaglest-3.6.0.2/CMakeLists.txt megaglest-3.6.0.3/CMakeLists.txt --- megaglest-3.6.0.2/CMakeLists.txt 2011-12-15 18:01:07.000000000 +0000 +++ megaglest-3.6.0.3/CMakeLists.txt 2012-01-23 07:22:43.000000000 +0000 @@ -1,7 +1,7 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.6.2 ) PROJECT( MegaGlest ) -#SET(CMAKE_VERBOSE_MAKEFILE ON) +# SET(CMAKE_VERBOSE_MAKEFILE ON) # # *NOTE: For now we assume some variation of GCC Compiler (or MingW for Windows binaries) @@ -55,6 +55,7 @@ message(STATUS "Using xvfb-run to run man2help.") endif() +include(${CMAKE_SOURCE_DIR}/mk/cmake/Modules/SpecialMacros.cmake) ## Compiler flags IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW) @@ -74,11 +75,42 @@ # For gcc warning options see: http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html IF(NOT MINGW) # For tons of verbose warnings add: -Wall - ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -rdynamic") +# ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -rdynamic") + ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -rdynamic") ELSE() - ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -DUNICODE") +# ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -DUNICODE") + ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -DUNICODE") ENDIF() #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + + IF(NOT MAX_SSE_LEVEL_DESIRED) + SET(MAX_SSE_LEVEL_DESIRED "1" CACHE STRING "Set the max SSE level to use if supported (0-3)" FORCE) + ENDIF() + + MESSAGE(STATUS "*NOTE: Checking for max SSE LEVEL [${MAX_SSE_LEVEL_DESIRED}]") + special_check_for_sse( ${MAX_SSE_LEVEL_DESIRED} ) + + OPTION(WANT_STREFLOP "use the library streflop" ON) + IF(WANT_STREFLOP) + ADD_DEFINITIONS("-DUSE_STREFLOP -DSTREFLOP_RANDOM_GEN_SIZE=32 -DLIBM_COMPILING_FLT32") + + IF(HAS_SSE_EXTENSIONS) + ADD_DEFINITIONS("-DSTREFLOP_SSE") + MESSAGE(STATUS "*NOTE: using SSE for STREFLOP.") + ELSE() + special_check_for_x87() + + IF(HAS_X87_SUPPORT) + ADD_DEFINITIONS("-DSTREFLOP_X87") + MESSAGE(STATUS "*NOTE: using X87 for STREFLOP.") + ELSE() + ADD_DEFINITIONS("-DSTREFLOP_SOFT") + MESSAGE(STATUS "*NOTE: using SOFT emulation for STREFLOP.") + ENDIF() + ENDIF() + ELSE() + MESSAGE(STATUS "*WARNING: Disabled use of STREFLOP! Out of synchs may occur") + ENDIF() # Debug compiler flags SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3") @@ -169,21 +201,12 @@ ENDIF() - OPTION(WANT_STREFLOP "use the library streflop" ON) - # Win32 specific Compiler Flags IF(WIN32) ADD_DEFINITIONS("-D_WINDOWS -D_WIN32 -D_STDCALL_SUPPORTED -D_M_IX86 -DXML_LIBRARY -D_LIB -DCURL_STATICLIB") ELSE() ADD_DEFINITIONS("-DCURL_STATICLIB") ENDIF() - - IF(WANT_STREFLOP) - ADD_DEFINITIONS("-DUSE_STREFLOP -DSTREFLOP_SSE -DSTREFLOP_RANDOM_GEN_SIZE=32 -DLIBM_COMPILING_FLT32") - ELSE() - MESSAGE(STATUS "*WARNING: Disabled use of STREFLOP! Out of synchs may occur") - ENDIF() - ENDIF() IF(WIN32) @@ -240,6 +263,13 @@ ADD_SUBDIRECTORY( ${PROJECT_SOURCE_DIR}/data/glest_game ) ENDIF() +get_directory_property( DirDefs DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) +foreach( d ${DirDefs} ) + message( STATUS "=====> Found Define: " ${d} ) +endforeach() +message( STATUS "=====> DirDefs: " ${DirDefs} ) +#MESSAGE(STATUS "*** Compiler definitions are [${COMPILE_DEFINITIONS}]") + MARK_AS_ADVANCED(SDLMAIN_LIBRARY) MARK_AS_ADVANCED(SDL_INCLUDE_DIR) MARK_AS_ADVANCED(SDL_LIBRARY) diff -Nru megaglest-3.6.0.2/debian/changelog megaglest-3.6.0.3/debian/changelog --- megaglest-3.6.0.2/debian/changelog 2012-01-19 18:28:51.000000000 +0000 +++ megaglest-3.6.0.3/debian/changelog 2012-02-28 23:34:46.000000000 +0000 @@ -1,3 +1,25 @@ +megaglest (3.6.0.3-1ubuntu1) precise; urgency=low + + * Merge from Debian testing. Remaining changes (LP:#932450): + - debian/rules: Don't build with -DMINIUPNPC_VERSION_PRE1_6=true + as we have 1.6 in the archive. + - debian/control: Only build on x86 architectures. + + -- Mark Vejvoda Tue, 14 Feb 2012 16:26:28 +0000 + +megaglest (3.6.0.3-1) unstable; urgency=low + + [ Mark Vejvoda ] + * New upstream release + - Fixes FTBFS on non-x86 architectures (Closes: #654283) + - Fixes crash with some GPU/driver combinations (Closes: #653547) + + [ Paul Wise ] + * megaglest should be priority extra since famfam is extra + * Drop patches, they were applied upstream + + -- Mark Vejvoda Wed, 25 Jan 2012 08:45:18 +0800 + megaglest (3.6.0.2-2ubuntu2) precise; urgency=low * README.txt confirms that this is for x86 architectures only (as forced @@ -239,3 +261,4 @@ * Initial release -- Giuseppe Borzi Mon, 7 Aug 2006 20:02:47 +0200 + diff -Nru megaglest-3.6.0.2/debian/control megaglest-3.6.0.3/debian/control --- megaglest-3.6.0.2/debian/control 2012-01-19 18:27:14.000000000 +0000 +++ megaglest-3.6.0.3/debian/control 2012-02-28 23:32:10.000000000 +0000 @@ -1,6 +1,6 @@ Source: megaglest Section: games -Priority: optional +Priority: extra Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian Games Team Uploaders: @@ -70,7 +70,6 @@ Internet or a LAN. Package: megaglest-dbg -Priority: extra Section: debug Architecture: any-amd64 any-i386 Depends: megaglest (= ${binary:Version}), ${misc:Depends} diff -Nru megaglest-3.6.0.2/debian/patches/drop-sse.patch megaglest-3.6.0.3/debian/patches/drop-sse.patch --- megaglest-3.6.0.2/debian/patches/drop-sse.patch 2011-12-23 06:47:32.000000000 +0000 +++ megaglest-3.6.0.3/debian/patches/drop-sse.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -Description: drop SSE related flags since they prevent building on non-x86 -Origin: http://megaglest.svn.sourceforge.net/viewvc/megaglest?view=revision&revision=3023 -Forwarded: not-needed ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -74,7 +74,7 @@ - # For gcc warning options see: http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html - IF(NOT MINGW) - # For tons of verbose warnings add: -Wall -- ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -rdynamic") -+ ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -rdynamic") - ELSE() - ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -DUNICODE") - ENDIF() diff -Nru megaglest-3.6.0.2/debian/patches/fix-kFreeBSD-FTBFS.patch megaglest-3.6.0.3/debian/patches/fix-kFreeBSD-FTBFS.patch --- megaglest-3.6.0.2/debian/patches/fix-kFreeBSD-FTBFS.patch 2011-12-23 05:09:04.000000000 +0000 +++ megaglest-3.6.0.3/debian/patches/fix-kFreeBSD-FTBFS.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -Description: fix FTBFS on Debian GNU/kFreeBSD architectures -Author: Paul Wise -Forwarded: yes, will apply to svn shortly -Applied-Upstream: http://megaglest.svn.sourceforge.net/viewvc/megaglest?view=revision&revision=3022 ---- a/source/shared_lib/sources/platform/posix/socket.cpp -+++ b/source/shared_lib/sources/platform/posix/socket.cpp -@@ -313,7 +313,7 @@ - // class Socket - // =============================================== - --#if defined(__FreeBSD__) || defined(BSD) || defined(__APPLE__) || defined(__linux__) -+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(BSD) || defined(__APPLE__) || defined(__linux__) - # define USE_GETIFADDRS 1 - # include - #endif ---- a/source/glest_map_editor/CMakeLists.txt -+++ b/source/glest_map_editor/CMakeLists.txt -@@ -19,7 +19,7 @@ - # It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'. - - IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") -- SET(wxWidgets_CONFIG_OPTIONS --prefix=/usr/local) -+ SET(wxWidgets_CONFIG_OPTIONS) - MESSAGE(STATUS "Detected FreeBSD.....") - ENDIF() - diff -Nru megaglest-3.6.0.2/debian/patches/series megaglest-3.6.0.3/debian/patches/series --- megaglest-3.6.0.2/debian/patches/series 2011-12-23 06:43:23.000000000 +0000 +++ megaglest-3.6.0.3/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -fix-kFreeBSD-FTBFS.patch -drop-sse.patch diff -Nru megaglest-3.6.0.2/mk/cmake/Modules/FindFTGL.cmake megaglest-3.6.0.3/mk/cmake/Modules/FindFTGL.cmake --- megaglest-3.6.0.2/mk/cmake/Modules/FindFTGL.cmake 2011-11-30 05:10:04.000000000 +0000 +++ megaglest-3.6.0.3/mk/cmake/Modules/FindFTGL.cmake 2012-01-23 07:22:43.000000000 +0000 @@ -5,7 +5,8 @@ # # FTGL_FOUND - system has ftgl # FTGL_INCLUDE_DIR - path to FTGL/FTGL.h -# FTGL_LIBRARY - the library that must be included +# FTGL_LIBRARY - the library that must be included +# FTGL_LIBRARY_PATH - the library path # # @@ -14,17 +15,34 @@ OPTION(FTGL_STATIC "Set to ON to link your project with static library (instead of DLL)." ON) ENDIF() +#message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #1 Searching for FTGL lib in custom path: [${FTGL_LIBRARY_PATH}]") + IF (FTGL_LIBRARY AND FTGL_INCLUDE_DIR) SET(FTGL_FOUND "YES") + message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! FTGL lib ALREADY FOUND in: [${FTGL_LIBRARY}]") ELSE (FTGL_LIBRARY AND FTGL_INCLUDE_DIR) - FIND_PATH(FTGL_INCLUDE_DIR FTGL/ftgl.h PATHS /usr/local/include /usr/include) - -IF (FTGL_STATIC AND NOT FTGL_LIBRARY) - FIND_LIBRARY(FTGL_LIBRARY NAMES libftgl.a ftgl PATHS /usr/local/lib /usr/lib) -ELSE() - FIND_LIBRARY(FTGL_LIBRARY NAMES ftgl PATHS /usr/local/lib /usr/lib) -ENDIF() + IF(FTGL_LIBRARY_PATH) + message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Searching for FTGL lib in custom path: [${FTGL_LIBRARY_PATH}]") + ENDIF() + + FIND_PATH(FTGL_INCLUDE_DIR FTGL/ftgl.h + PATHS /usr/local/include + /usr/include) + + IF (FTGL_STATIC AND NOT FTGL_LIBRARY) + FIND_LIBRARY(FTGL_LIBRARY + NAMES libftgl.a ftgl libftgl libftgl.dll + PATHS /usr/local/lib + /usr/lib + ${FTGL_LIBRARY_PATH}) + ELSE() + FIND_LIBRARY(FTGL_LIBRARY + NAMES ftgl libftgl libftgl.dll libftgl.a + PATHS /usr/local/lib + /usr/lib + ${FTGL_LIBRARY_PATH}) + ENDIF() IF (FTGL_INCLUDE_DIR AND FTGL_LIBRARY) SET(FTGL_FOUND "YES") diff -Nru megaglest-3.6.0.2/mk/cmake/Modules/SpecialMacros.cmake megaglest-3.6.0.3/mk/cmake/Modules/SpecialMacros.cmake --- megaglest-3.6.0.2/mk/cmake/Modules/SpecialMacros.cmake 1970-01-01 00:00:00.000000000 +0000 +++ megaglest-3.6.0.3/mk/cmake/Modules/SpecialMacros.cmake 2012-01-23 07:26:31.000000000 +0000 @@ -0,0 +1,182 @@ +# special macros SpecialMacros.cmake + +include(CheckFunctionExists) +include(AddFileDependencies) + +#macro(special_add_library lib) +# if (WIN32) +# add_library(${lib} STATIC ${ARGN}) +# else (WIN32) +# add_library(${lib} SHARED ${ARGN}) +# endif (WIN32) +#endmacro(special_add_library) + +macro(special_check_for_sse _max_sse_level_desired) + set(${_max_sse_level_desired}) + + message(STATUS "Max SSE desired: [${_max_sse_level_desired}]") + + # check for SSE extensions + include(CheckCXXSourceRuns) + include(CheckCSourceRuns) + + if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX ) + set(SSE_FLAGS) + + set(CMAKE_REQUIRED_FLAGS "-msse3") + check_cxx_source_runs(" + #include + + int main() + { + __m128d a, b; + double vals[2] = {0}; + a = _mm_loadu_pd(vals); + b = _mm_hadd_pd(a,a); + _mm_storeu_pd(vals, b); + return 0; + }" + HAS_SSE3_EXTENSIONS) + + set(CMAKE_REQUIRED_FLAGS "-msse2") + check_cxx_source_runs(" + #include + + int main() + { + __m128d a, b; + double vals[2] = {0}; + a = _mm_loadu_pd(vals); + b = _mm_add_pd(a,a); + _mm_storeu_pd(vals,b); + return 0; + }" + HAS_SSE2_EXTENSIONS) + + set(CMAKE_REQUIRED_FLAGS "-msse") + check_cxx_source_runs(" + #include + int main() + { + __m128 a, b; + float vals[4] = {0}; + a = _mm_loadu_ps(vals); + b = a; + b = _mm_add_ps(a,b); + _mm_storeu_ps(vals,b); + return 0; + }" + HAS_SSE_EXTENSIONS) + + set(CMAKE_REQUIRED_FLAGS) + + if(HAS_SSE3_EXTENSIONS AND (NOT ${_max_sse_level_desired} OR ${_max_sse_level_desired} MATCHES "3")) + set(SSE_FLAGS "-msse3 -mfpmath=sse") + message(STATUS "Found SSE3 extensions, using flags: ${SSE_FLAGS}") + elseif(HAS_SSE2_EXTENSIONS AND (NOT ${_max_sse_level_desired} OR ${_max_sse_level_desired} MATCHES "2" OR ${_max_sse_level_desired} MATCHES "3")) + set(SSE_FLAGS "-msse2 -mfpmath=sse") + message(STATUS "Found SSE2 extensions, using flags: ${SSE_FLAGS}") + elseif(HAS_SSE_EXTENSIONS AND (NOT ${_max_sse_level_desired} OR ${_max_sse_level_desired} MATCHES "1" OR ${_max_sse_level_desired} MATCHES "2" OR ${_max_sse_level_desired} MATCHES "3")) + set(SSE_FLAGS "-msse -mfpmath=sse") + message(STATUS "Found SSE extensions, using flags: ${SSE_FLAGS}") + endif() + + add_definitions(${SSE_FLAGS}) + + elseif(MSVC) + check_cxx_source_runs(" + #include + + int main() + { + __m128d a, b; + double vals[2] = {0}; + a = _mm_loadu_pd(vals); + b = _mm_add_pd(a,a); + _mm_storeu_pd(vals,b); + return 0; + }" + HAS_SSE2_EXTENSIONS) + if( HAS_SSE2_EXTENSIONS AND (NOT ${_max_sse_level_desired} OR ${_max_sse_level_desired} MATCHES "2")) + message(STATUS "Found SSE2 extensions") + set(SSE_FLAGS "/arch:SSE2 /fp:fast -D__SSE__ -D__SSE2__" ) + endif() + + add_definitions(${SSE_FLAGS}) + endif() +endmacro(special_check_for_sse) + +macro(special_check_for_x87) + # check for X87 support + include(CheckCXXSourceRuns) + include(CheckCSourceRuns) + + if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX ) + + check_cxx_source_runs(" + int main() + { + unsigned short fpu_mode; + do { asm volatile (\"fstcw %0\" : \"=m\" (fpu_mode) : ); } while (0); + fpu_mode &= 0xFCFF; + do { asm volatile (\"fclex \\\\n fldcw %0\" : : \"m\" (fpu_mode)); } while (0); + + return 0; + }" + HAS_X87_SUPPORT) + + if(HAS_X87_SUPPORT) + message(STATUS "Found X87 support.") + endif() + + elseif(MSVC) + + set(HAS_X87_SUPPORT On) + + endif() +endmacro(special_check_for_x87) + +macro(special_add_compile_flags target) + set(args ${ARGN}) + separate_arguments(args) + get_target_property(_flags ${target} COMPILE_FLAGS) + if(NOT _flags) + set(_flags ${ARGN}) + else(NOT _flags) + separate_arguments(_flags) + list(APPEND _flags "${args}") + endif(NOT _flags) + + _special_list_to_string(_flags_str "${_flags}") + set_target_properties(${target} PROPERTIES + COMPILE_FLAGS "${_flags_str}") +endmacro(special_add_compile_flags) + +macro(special_add_link_flags target) + set(args ${ARGN}) + separate_arguments(args) + get_target_property(_flags ${target} LINK_FLAGS) + if(NOT _flags) + set(_flags ${ARGN}) + else(NOT _flags) + separate_arguments(_flags) + list(APPEND _flags "${args}") + endif(NOT _flags) + + _special_list_to_string(_flags_str "${_flags}") + set_target_properties(${target} PROPERTIES + LINK_FLAGS "${_flags_str}") +endmacro(special_add_link_flags) + +macro(_special_list_to_string _string _list) + set(${_string}) + foreach(_item ${_list}) + string(LENGTH "${${_string}}" _len) + if(${_len} GREATER 0) + set(${_string} "${${_string}} ${_item}") + else(${_len} GREATER 0) + set(${_string} "${_item}") + endif(${_len} GREATER 0) + endforeach(_item) +endmacro(_special_list_to_string) + diff -Nru megaglest-3.6.0.2/mk/cmake/Modules/Toolchain-mingw32.cmake megaglest-3.6.0.3/mk/cmake/Modules/Toolchain-mingw32.cmake --- megaglest-3.6.0.2/mk/cmake/Modules/Toolchain-mingw32.cmake 2011-12-15 21:10:40.000000000 +0000 +++ megaglest-3.6.0.3/mk/cmake/Modules/Toolchain-mingw32.cmake 2012-01-23 07:22:43.000000000 +0000 @@ -2,12 +2,23 @@ SET(CMAKE_SYSTEM_NAME Windows) # which compilers to use for C and C++ -SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc) -SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++) -SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres) +#SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc) +#SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++) +#SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres) +SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) +SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) # here is the target environment located -SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc ${PROJECT_SOURCE_DIR}/source/win32_deps/lib) +#SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc ${PROJECT_SOURCE_DIR}/source/win32_deps/lib) +SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 ${PROJECT_SOURCE_DIR}/source/win32_deps/lib) +include_directories(${PROJECT_SOURCE_DIR}/source/win32_deps/freetype-2.4.8/include) +include_directories(${PROJECT_SOURCE_DIR}/source/win32_deps/glew-1.7.0/include) +include_directories(${PROJECT_SOURCE_DIR}/source/win32_deps/ftgl-2.1.3~rc5/src) +#add_definitions(-std=c++0x) +add_definitions( -std=gnu++0x ) +add_definitions( -DTA3D_PLATFORM_MSVC=1 ) +add_definitions( -DTA3D_PLATFORM_WINDOWS=1 ) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search diff -Nru megaglest-3.6.0.2/mk/windoze/CopyWindowsRuntimeDlls.bat megaglest-3.6.0.3/mk/windoze/CopyWindowsRuntimeDlls.bat --- megaglest-3.6.0.2/mk/windoze/CopyWindowsRuntimeDlls.bat 2011-05-03 10:20:50.000000000 +0000 +++ megaglest-3.6.0.3/mk/windoze/CopyWindowsRuntimeDlls.bat 2012-01-23 07:59:57.000000000 +0000 @@ -2,5 +2,6 @@ rem if not exist ..\..\data\glest_game\dsound.dll copy dsound.dll ..\..\data\glest_game\ if not exist ..\..\data\glest_game\xerces-c_3_0.dll copy ..\..\source\win32_deps\bin\xerces-c_3_0.dll ..\..\data\glest_game\ +if not exist ..\..\data\glest_game\openal32.dll copy ..\..\source\win32_deps\bin\openal32.dll ..\..\data\glest_game\ if not "%1" == "nopause" pause Binary files /tmp/AH09gY5DVs/megaglest-3.6.0.2/mk/windoze/Glest.suo and /tmp/QC74pprGn7/megaglest-3.6.0.3/mk/windoze/Glest.suo differ diff -Nru megaglest-3.6.0.2/mk/windoze/Installer/MegaGlestInstaller.nsi megaglest-3.6.0.3/mk/windoze/Installer/MegaGlestInstaller.nsi --- megaglest-3.6.0.2/mk/windoze/Installer/MegaGlestInstaller.nsi 2011-12-16 09:04:26.000000000 +0000 +++ megaglest-3.6.0.3/mk/windoze/Installer/MegaGlestInstaller.nsi 2012-01-23 07:53:27.000000000 +0000 @@ -3,8 +3,8 @@ !define APNAME MegaGlest !define APNAME_OLD Mega-Glest -!define APVER_OLD 3.6.0 -!define APVER 3.6.0.2 +!define APVER_OLD 3.6.0.2 +!define APVER 3.6.0.3 Name "${APNAME} ${APVER}" SetCompressor /FINAL /SOLID lzma diff -Nru megaglest-3.6.0.2/mk/windoze/Installer/MegaGlestUpdater.nsi megaglest-3.6.0.3/mk/windoze/Installer/MegaGlestUpdater.nsi --- megaglest-3.6.0.2/mk/windoze/Installer/MegaGlestUpdater.nsi 2011-12-16 09:04:26.000000000 +0000 +++ megaglest-3.6.0.3/mk/windoze/Installer/MegaGlestUpdater.nsi 2012-01-23 07:53:27.000000000 +0000 @@ -2,10 +2,10 @@ ; General Attributes !define APNAME MegaGlest -!define APVER 3.6.0.2 +!define APVER 3.6.0.3 !define APNAME_OLD Mega-Glest -!define APVER_OLD 3.6.0 -!define APVER_UPDATE 3.6.0.2 +!define APVER_OLD 3.6.0.2 +!define APVER_UPDATE 3.6.0.3 Name "${APNAME} ${APVER_UPDATE}" SetCompressor /FINAL /SOLID lzma diff -Nru megaglest-3.6.0.2/source/configurator/configuration.cpp megaglest-3.6.0.3/source/configurator/configuration.cpp --- megaglest-3.6.0.2/source/configurator/configuration.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/configurator/configuration.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -16,6 +16,7 @@ #include "xml_parser.h" #include "util.h" #include "conversion.h" +#include #include"platform_util.h" using namespace std; diff -Nru megaglest-3.6.0.2/source/configurator/main.cpp megaglest-3.6.0.3/source/configurator/main.cpp --- megaglest-3.6.0.2/source/configurator/main.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/configurator/main.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -24,6 +24,7 @@ #include "util.h" #include #include +#include using namespace std; using namespace Shared::PlatformCommon; diff -Nru megaglest-3.6.0.2/source/g3d_viewer/main.cpp megaglest-3.6.0.3/source/g3d_viewer/main.cpp --- megaglest-3.6.0.2/source/g3d_viewer/main.cpp 2011-12-20 06:31:38.000000000 +0000 +++ megaglest-3.6.0.3/source/g3d_viewer/main.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -105,6 +105,7 @@ wxT("--rotate-x-value"), wxT("--rotate-y-value"), wxT("--screenshot-format"), + wxT("--verbose"), }; enum GAME_ARG_TYPE { @@ -121,6 +122,7 @@ GAME_ARG_ROTATE_X_VALUE, GAME_ARG_ROTATE_Y_VALUE, GAME_ARG_SCREENSHOT_FORMAT, + GAME_ARG_VERBOSE, }; bool hasCommandArgument(int argc, wxChar** argv,const string argName, @@ -197,9 +199,9 @@ printf("\n \t\t of the optional settings:"); printf("\n \t\ttransparent, enable_grid, enable_wireframe,"); printf("\n \t\tenable_normals, disable_grid, disable_wireframe,"); - printf("\n \t\tdisable_normals, saveas-"); + printf("\n \t\tdisable_normals, saveas-, resize-wxh"); printf("\n \t\texample:"); - printf("\n %s %s=transparent,disable_grid,saveas-test.png %s=techs/megapack/factions/tech/units/battle_machine/models/battle_machine_dying.g3d",extractFileFromDirectoryPath(argv0).c_str(),(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_AUTO_SCREENSHOT]),(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL])); + printf("\n %s %s=transparent,disable_grid,saveas-test.png,resize-800x600 %s=techs/megapack/factions/tech/units/battle_machine/models/battle_machine_dying.g3d",extractFileFromDirectoryPath(argv0).c_str(),(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_AUTO_SCREENSHOT]),(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL])); // "================================================================================" printf("\n%s=x",(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_PARTICLE])); @@ -258,6 +260,7 @@ bool autoScreenShotAndExit = false; vector autoScreenShotParams; +std::pair overrideSize(0,0); // =============================================== // class MainWindow @@ -291,6 +294,7 @@ //getGlPlatformExtensions(); int args[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_MIN_ALPHA, 8 }; // to prevent flicker + //int args[] = { WX_GL_RGBA, WX_GL_MIN_ALPHA, 0 }; // to prevent flicker glCanvas = new GlCanvas(this, args); #if wxCHECK_VERSION(2, 9, 1) @@ -567,31 +571,25 @@ setupStartupSettings(); } + //wxClientDC &dc = event.GetDC(); +// wxPaintDC dc(this); +// if(overrideSize.first > 0 && overrideSize.second > 0) { +// wxRect r(0,0,100,100); +// dc.SetDeviceClippingRegion(r); +// // Then I destroy the clipping region +// dc.DestroyClippingRegion(); +// } + // notice that we use GetSize() here and not GetClientSize() because // the latter doesn't return correct results for the minimized windows // (at least not under Windows) -#if defined(WIN32) -/* - //Seems like windows cannot handle this consistently + int viewportW = GetClientSize().x; + int viewportH = GetClientSize().y; - if(autoScreenShotAndExit == true) { - printf("\n\n$$$ GetSize() x = %d y = %d, Renderer::windowW = %d H = %d\n",GetSize().x,GetSize().y,Renderer::windowW,Renderer::windowH); - //renderer->reset(GetSize().x, GetSize().y-10, playerColor); - //renderer->reset(Renderer::windowW, Renderer::windowH-20, playerColor); - //this->Iconize(false); - - //this->Refresh(); - //renderer->reset(GetClientSize().x, GetClientSize().y, playerColor); - renderer->reset(Renderer::windowW, Renderer::windowH-20, playerColor); - } - else { - printf("\n\n### GetClientSize() x = %d y = %d\n",GetClientSize().x,GetClientSize().y); - renderer->reset(GetClientSize().x, GetClientSize().y, playerColor); - } -*/ - renderer->reset(GetClientSize().x, GetClientSize().y, playerColor); +#if defined(WIN32) + renderer->reset(viewportW, viewportH, playerColor); #else - renderer->reset(GetClientSize().x, GetClientSize().y, playerColor); + renderer->reset(viewportW, viewportH, playerColor); #endif renderer->transform(rotX, rotY, zoom); @@ -616,8 +614,7 @@ } renderer->renderParticleManager(); - glCanvas->SwapBuffers(); - + bool haveLoadedParticles = (particleProjectilePathList.empty() == false || particleSplashPathList.empty() == false); if(autoScreenShotAndExit == true) { @@ -629,7 +626,10 @@ Close(); return; } - else if((modelPathList.empty() == false) && resetAnimation && haveLoadedParticles) { + + glCanvas->SwapBuffers(); + + if((modelPathList.empty() == false) && resetAnimation && haveLoadedParticles) { if(anim >= resetAnim && resetAnim > 0) { printf("RESETTING EVERYTHING [%f][%f]...\n",anim,resetAnim); fflush(stdout); @@ -963,7 +963,7 @@ FILE *f= fopen(saveAsFilename.c_str(), "rb"); #endif if(f == NULL) { - renderer->saveScreen(saveAsFilename.c_str()); + renderer->saveScreen(saveAsFilename.c_str(),&overrideSize); } else { if(f) { @@ -998,7 +998,7 @@ FILE *f= fopen(path.c_str(), "rb"); #endif if(f == NULL) { - renderer->saveScreen(path); + renderer->saveScreen(path,&overrideSize); break; } else { @@ -1095,10 +1095,11 @@ string skillParticleFile = ""; string skillParticleProjectileFile = ""; string skillParticleSplashFile = ""; + bool fileFound = fileExists(unitXML); - printf("Loading unit from file [%s]\n",unitXML.c_str()); + printf("Loading unit from file [%s] fileFound = %d\n",unitXML.c_str(),fileFound); - if(fileExists(unitXML) == true) { + if(fileFound == true) { XmlTree xmlTree; xmlTree.load(unitXML,Properties::getTagReplacementValues()); const XmlNode *unitNode= xmlTree.getRootNode(); @@ -1270,15 +1271,19 @@ //int height = -1; if(fileExists(unitXML) == true) { + + int size = 0; + int height= 0; + { XmlTree xmlTree; xmlTree.load(unitXML,Properties::getTagReplacementValues()); const XmlNode *unitNode= xmlTree.getRootNode(); const XmlNode *parametersNode= unitNode->getChild("parameters"); //size - int size= parametersNode->getChild("size")->getAttribute("value")->getIntValue(); + size= parametersNode->getChild("size")->getAttribute("value")->getIntValue(); //height - int height= parametersNode->getChild("height")->getAttribute("value")->getIntValue(); - + height= parametersNode->getChild("height")->getAttribute("value")->getIntValue(); + } // std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl; @@ -1323,6 +1328,8 @@ } void MainWindow::loadProjectileParticle(string path) { + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s] particleProjectilePathList.size() = %lu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleProjectilePathList.size()); + if(timer) timer->Stop(); if(path != "" && fileExists(path) == true) { renderer->end(); @@ -1342,7 +1349,7 @@ try { if(this->particleProjectilePathList.empty() == false) { - printf("this->particleProjectilePathList.size() = %lu\n",this->particleProjectilePathList.size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("this->particleProjectilePathList.size() = %lu\n",this->particleProjectilePathList.size()); string titlestring=winHeader; for(unsigned int idx = 0; idx < this->particleProjectilePathList.size(); idx++) { @@ -1363,6 +1370,8 @@ int height = -1; if(fileExists(unitXML) == true) { + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,unitXML.c_str(),idx); + XmlTree xmlTree; xmlTree.load(unitXML,Properties::getTagReplacementValues()); const XmlNode *unitNode= xmlTree.getRootNode(); @@ -1375,18 +1384,21 @@ // std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl; + string particleFile = dir + folderDelimiter + particlePath; { - XmlTree xmlTree; - xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues()); - //const XmlNode *particleSystemNode= xmlTree.getRootNode(); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx); + XmlTree xmlTree; + xmlTree.load(particleFile,Properties::getTagReplacementValues()); + //const XmlNode *particleSystemNode= xmlTree.getRootNode(); - // std::cout << "Loaded successfully, loading values..." << std::endl; + // std::cout << "Loaded successfully, loading values..." << std::endl; } + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx); std::map > > loadedFileList; ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile(); projectileParticleSystemType->load(NULL, dir, //### we don't know if there are overrides in the unit XML - dir + folderDelimiter + particlePath,renderer, loadedFileList, + particleFile,renderer, loadedFileList, "g3dviewer",""); // std::cout << "Values loaded, about to read..." << std::endl; @@ -1412,6 +1424,8 @@ ps->setVisible(true); renderer->manageParticleSystem(ps); } + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loaded [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx); } SetTitle(ToUnicode(titlestring)); @@ -1428,9 +1442,12 @@ wxMessageDialog(NULL, ToUnicode(e.what()), ToUnicode("Not a Mega-Glest projectile particle XML file, or broken"), wxOK | wxICON_ERROR).ShowModal(); } if(timer) timer->Start(100); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] after load [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str()); } void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSplash::load (and own list...) + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s] particleSplashPathList.size() = %lu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleSplashPathList.size()); + if(timer) timer->Stop(); if(path != "" && fileExists(path) == true) { renderer->end(); @@ -1481,11 +1498,12 @@ // std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl; - XmlTree xmlTree; - xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues()); - //const XmlNode *particleSystemNode= xmlTree.getRootNode(); - - // std::cout << "Loaded successfully, loading values..." << std::endl; + { + XmlTree xmlTree; + xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues()); + //const XmlNode *particleSystemNode= xmlTree.getRootNode(); + // std::cout << "Loaded successfully, loading values..." << std::endl; + } std::map > > loadedFileList; ParticleSystemTypeSplash *splashParticleSystemType= new ParticleSystemTypeSplash(); @@ -1531,6 +1549,7 @@ wxMessageDialog(NULL, ToUnicode(e.what()), ToUnicode("Not a Mega-Glest projectile particle XML file, or broken"), wxOK | wxICON_ERROR).ShowModal(); } if(timer) timer->Start(100); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] after load [%s] particleSplashPathList.size() = %lu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleSplashPathList.size()); } void MainWindow::onMenuModeNormals(wxCommandEvent &event){ @@ -1980,6 +1999,10 @@ bool App::OnInit() { SystemFlags::VERBOSE_MODE_ENABLED = false; + //Renderer::windowW = 1920; + //Renderer::windowH = 1440; + //Renderer::windowX= 0; + //Renderer::windowY= 0; string modelPath=""; string particlePath=""; @@ -2005,6 +2028,10 @@ return false; } + if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_VERBOSE])) == true) { + SystemFlags::VERBOSE_MODE_ENABLED = true; + } + if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_AUTO_SCREENSHOT])) == true) { autoScreenShotAndExit = true; @@ -2026,13 +2053,29 @@ autoScreenShotParams.clear(); Tokenize(optionsValue,autoScreenShotParams,","); - #ifdef WIN32 for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) { + +#ifdef WIN32 std::auto_ptr wstr(Ansi2WideString(autoScreenShotParams[i].c_str())); autoScreenShotParams[i] = utf8_encode(wstr.get()); - } - #endif +#endif + + if(_strnicmp(autoScreenShotParams[i].c_str(),"resize-",7) == 0) { + printf("Screenshot option [%s]\n",autoScreenShotParams[i].c_str()); + string resize = autoScreenShotParams[i]; + resize = resize.erase(0,7); + vector values; + Tokenize(resize,values,"x"); + overrideSize.first = strToInt(values[0]); + overrideSize.second = strToInt(values[1]); + + Renderer::windowX= 0; + Renderer::windowY= 0; + Renderer::windowW = overrideSize.first; + Renderer::windowH = overrideSize.second + 25; + } + } } } diff -Nru megaglest-3.6.0.2/source/g3d_viewer/renderer.cpp megaglest-3.6.0.3/source/g3d_viewer/renderer.cpp --- megaglest-3.6.0.2/source/g3d_viewer/renderer.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/g3d_viewer/renderer.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -21,6 +21,11 @@ namespace Shared{ namespace G3dViewer{ +int Renderer::windowX= 100; +int Renderer::windowY= 100; +int Renderer::windowW= 640; +int Renderer::windowH= 480; + // =============================================== // class MeshCallbackTeamColor // =============================================== @@ -483,16 +488,21 @@ //printf("#3.1 The framebuffer uses %d bit(s) per the alpha component\n", alpha_bits); } -void Renderer::saveScreen(const string &path) { +void Renderer::saveScreen(const string &path,std::pair *overrideSize) { Pixmap2D *pixmapScreenShot = new Pixmap2D(width, height, 4); - glFinish(); + //glFinish(); glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadPixels(0, 0, pixmapScreenShot->getW(), pixmapScreenShot->getH(),GL_RGBA, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels()); + glReadPixels(0, 0, pixmapScreenShot->getW(), pixmapScreenShot->getH(), + GL_RGBA, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels()); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + //if(overrideSize != NULL && overrideSize->first > 0 && overrideSize->second > 0) { + // pixmapScreenShot->Scale(GL_RGBA,overrideSize->first,overrideSize->second); + //} + pixmapScreenShot->save(path); delete pixmapScreenShot; } diff -Nru megaglest-3.6.0.2/source/g3d_viewer/renderer.h megaglest-3.6.0.3/source/g3d_viewer/renderer.h --- megaglest-3.6.0.2/source/g3d_viewer/renderer.h 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/g3d_viewer/renderer.h 2012-01-23 07:22:43.000000000 +0000 @@ -68,10 +68,10 @@ class Renderer : public RendererInterface { public: - static const int windowX= 100; - static const int windowY= 100; - static const int windowW= 640; - static const int windowH= 480; + static int windowX; + static int windowY; + static int windowW; + static int windowH; public: enum PlayerColor{ @@ -157,7 +157,7 @@ void setBackgroundColor(float red, float green, float blue); void setAlphaColor(float alpha); - void saveScreen(const string &path); + void saveScreen(const string &path,std::pair *overrideSize); bool hasActiveParticleSystem(ParticleSystem::ParticleSystemType typeName) const; }; diff -Nru megaglest-3.6.0.2/source/glest_game/facilities/game_util.cpp megaglest-3.6.0.3/source/glest_game/facilities/game_util.cpp --- megaglest-3.6.0.2/source/glest_game/facilities/game_util.cpp 2011-12-16 09:04:26.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/facilities/game_util.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -27,14 +27,14 @@ namespace Glest { namespace Game { const char *mailString = " http://bugs.megaglest.org"; -const string glestVersionString = "v3.6.0.2"; +const string glestVersionString = "v3.6.0.3"; #if defined(SVNVERSION) const string SVN_Rev = string("Rev: ") + string(SVNVERSION); #elif defined(SVNVERSIONHEADER) #include "svnversion.h" const string SVN_Rev = string("Rev: ") + string(SVNVERSION); #else -const string SVN_Rev = "$Rev: 3002 $"; +const string SVN_Rev = "$Rev: 3070 $"; #endif string getCrashDumpFileName(){ diff -Nru megaglest-3.6.0.2/source/glest_game/global/config.cpp megaglest-3.6.0.3/source/glest_game/global/config.cpp --- megaglest-3.6.0.2/source/glest_game/global/config.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/global/config.cpp 2012-01-24 07:39:16.000000000 +0000 @@ -147,7 +147,7 @@ #if defined(CUSTOM_DATA_INSTALL_PATH) if(foundPath == false) { - foundPath = tryCustomPath(cfgType, fileName, CUSTOM_DATA_INSTALL_PATH); + foundPath = tryCustomPath(cfgType, fileName, formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH))); } #endif diff -Nru megaglest-3.6.0.2/source/glest_game/global/core_data.cpp megaglest-3.6.0.3/source/glest_game/global/core_data.cpp --- megaglest-3.6.0.2/source/glest_game/global/core_data.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/global/core_data.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -350,7 +350,7 @@ if(Renderer::renderText3DEnabled == false) { displayFont= renderer.newFont(rsGlobal); if(displayFont) { - displayFont->setType(displayFontName,config.getString("FontDisplay","")); + displayFont->setType(displayFontName,config.getString("FontDisplay",""),config.getString("FontDisplayFamily","")); displayFont->setSize(displayFontSize); //displayFont->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } @@ -363,7 +363,7 @@ if(Renderer::renderText3DEnabled == true) { displayFont3D= renderer.newFont3D(rsGlobal); if(displayFont3D) { - displayFont3D->setType(displayFontName,config.getString("FontDisplay","")); + displayFont3D->setType(displayFontName,config.getString("FontDisplay",""),config.getString("FontDisplayFamily","")); displayFont3D->setSize(displayFontSize); //displayFont3D->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } @@ -395,7 +395,7 @@ if(Renderer::renderText3DEnabled == false) { displayFontSmall= renderer.newFont(rsGlobal); if(displayFontSmall) { - displayFontSmall->setType(displayFontNameSmall,config.getString("FontSmallDisplay","")); + displayFontSmall->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""),config.getString("FontSmallDisplayFamily","")); displayFontSmall->setSize(displayFontNameSmallSize); //displayFontSmall->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } @@ -408,7 +408,7 @@ if(Renderer::renderText3DEnabled == true) { displayFontSmall3D= renderer.newFont3D(rsGlobal); if(displayFontSmall3D) { - displayFontSmall3D->setType(displayFontNameSmall,config.getString("FontSmallDisplay","")); + displayFontSmall3D->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""),config.getString("FontSmallDisplayFamily","")); displayFontSmall3D->setSize(displayFontNameSmallSize); //displayFontSmall3D->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } @@ -439,7 +439,7 @@ if(Renderer::renderText3DEnabled == false) { menuFontNormal= renderer.newFont(rsGlobal); if(menuFontNormal) { - menuFontNormal->setType(menuFontNameNormal,config.getString("FontMenuNormal","")); + menuFontNormal->setType(menuFontNameNormal,config.getString("FontMenuNormal",""),config.getString("FontMenuNormalFamily","")); menuFontNormal->setSize(menuFontNameNormalSize); menuFontNormal->setWidth(Font::wBold); //menuFontNormal->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); @@ -453,7 +453,7 @@ if(Renderer::renderText3DEnabled == true) { menuFontNormal3D= renderer.newFont3D(rsGlobal); if(menuFontNormal3D) { - menuFontNormal3D->setType(menuFontNameNormal,config.getString("FontMenuNormal","")); + menuFontNormal3D->setType(menuFontNameNormal,config.getString("FontMenuNormal",""),config.getString("FontMenuNormalFamily","")); menuFontNormal3D->setSize(menuFontNameNormalSize); menuFontNormal3D->setWidth(Font::wBold); //menuFontNormal3D->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); @@ -485,7 +485,7 @@ if(Renderer::renderText3DEnabled == false) { menuFontBig= renderer.newFont(rsGlobal); if(menuFontBig) { - menuFontBig->setType(menuFontNameBig,config.getString("FontMenuBig","")); + menuFontBig->setType(menuFontNameBig,config.getString("FontMenuBig",""),config.getString("FontMenuBigFamily","")); menuFontBig->setSize(menuFontNameBigSize); //menuFontBig->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } @@ -498,7 +498,7 @@ if(Renderer::renderText3DEnabled == true) { menuFontBig3D= renderer.newFont3D(rsGlobal); if(menuFontBig3D) { - menuFontBig3D->setType(menuFontNameBig,config.getString("FontMenuBig","")); + menuFontBig3D->setType(menuFontNameBig,config.getString("FontMenuBig",""),config.getString("FontMenuBigFamily","")); menuFontBig3D->setSize(menuFontNameBigSize); //menuFontBig3D->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } @@ -529,7 +529,7 @@ if(Renderer::renderText3DEnabled == false) { menuFontVeryBig= renderer.newFont(rsGlobal); if(menuFontVeryBig) { - menuFontVeryBig->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig","")); + menuFontVeryBig->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""),config.getString("FontMenuVeryBigFamily","")); menuFontVeryBig->setSize(menuFontNameVeryBigSize); //menuFontVeryBig->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } @@ -542,7 +542,7 @@ if(Renderer::renderText3DEnabled == true) { menuFontVeryBig3D= renderer.newFont3D(rsGlobal); if(menuFontVeryBig3D) { - menuFontVeryBig3D->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig","")); + menuFontVeryBig3D->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""),config.getString("FontMenuVeryBigFamily","")); menuFontVeryBig3D->setSize(menuFontNameVeryBigSize); //menuFontVeryBig3D->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } @@ -576,7 +576,7 @@ if(Renderer::renderText3DEnabled == false) { consoleFont= renderer.newFont(rsGlobal); if(consoleFont) { - consoleFont->setType(consoleFontName,config.getString("FontConsole","")); + consoleFont->setType(consoleFontName,config.getString("FontConsole",""),config.getString("FontConsoleFamily","")); consoleFont->setSize(consoleFontNameSize); //consoleFont->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } @@ -589,7 +589,7 @@ if(Renderer::renderText3DEnabled == true) { consoleFont3D= renderer.newFont3D(rsGlobal); if(consoleFont3D) { - consoleFont3D->setType(consoleFontName,config.getString("FontConsole","")); + consoleFont3D->setType(consoleFontName,config.getString("FontConsole",""),config.getString("FontConsoleFamily","")); consoleFont3D->setSize(consoleFontNameSize); //consoleFont3D->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } diff -Nru megaglest-3.6.0.2/source/glest_game/global/lang.cpp megaglest-3.6.0.3/source/glest_game/global/lang.cpp --- megaglest-3.6.0.2/source/glest_game/global/lang.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/global/lang.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -107,6 +107,15 @@ #endif } + if( lang.hasString("MEGAGLEST_FONT_FAMILY")) { + #if defined(WIN32) + string newEnvValue = "MEGAGLEST_FONT_FAMILY=" + lang.get("MEGAGLEST_FONT_FAMILY"); + _putenv(newEnvValue.c_str()); + #else + setenv("MEGAGLEST_FONT_FAMILY",lang.get("MEGAGLEST_FONT_FAMILY").c_str(),0); + #endif + } + // if( lang.hasString("FONT_YOFFSET_FACTOR")) { // FontMetrics::DEFAULT_Y_OFFSET_FACTOR = strToFloat(lang.get("FONT_YOFFSET_FACTOR")); // } diff -Nru megaglest-3.6.0.2/source/glest_game/graphics/particle_type.cpp megaglest-3.6.0.3/source/glest_game/graphics/particle_type.cpp --- megaglest-3.6.0.2/source/glest_game/graphics/particle_type.cpp 2011-12-02 16:07:59.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/graphics/particle_type.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -43,7 +43,8 @@ teamcolorNoEnergy=false; teamcolorEnergy=false; - alternations=false; + alternations=0; + particleSystemStartDelay=0; texture=NULL; model=NULL; minmaxEnabled=false; @@ -101,6 +102,7 @@ this->teamcolorNoEnergy = src.teamcolorNoEnergy; this->teamcolorEnergy = src.teamcolorEnergy; this->alternations = src.alternations; + this->particleSystemStartDelay= src.particleSystemStartDelay; for(Children::iterator it = children.begin(); it != children.end(); ++it) { UnitParticleSystemType *child = *it; @@ -239,6 +241,11 @@ const XmlNode *alternatingNode= particleSystemNode->getChild("alternations"); alternations= alternatingNode->getAttribute("value")->getIntValue(); } + //particleSystemStartDelay + if(particleSystemNode->hasChild("particleSystemStartDelay")){ + const XmlNode *node= particleSystemNode->getChild("particleSystemStartDelay"); + particleSystemStartDelay= node->getAttribute("value")->getIntValue(); + } //mode if(particleSystemNode->hasChild("mode")) { const XmlNode *modeNode= particleSystemNode->getChild("mode"); @@ -293,6 +300,7 @@ ats->setTeamcolorNoEnergy(teamcolorNoEnergy); ats->setTeamcolorEnergy(teamcolorEnergy); ats->setAlternations(alternations); + ats->setParticleSystemStartDelay(particleSystemStartDelay); ats->setBlendMode(ParticleSystem::strToBlendMode(mode)); } diff -Nru megaglest-3.6.0.2/source/glest_game/graphics/particle_type.h megaglest-3.6.0.3/source/glest_game/graphics/particle_type.h --- megaglest-3.6.0.2/source/glest_game/graphics/particle_type.h 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/graphics/particle_type.h 2012-01-23 07:22:43.000000000 +0000 @@ -69,6 +69,7 @@ bool teamcolorNoEnergy; bool teamcolorEnergy; int alternations; + int particleSystemStartDelay; typedef std::list Children; Children children; diff -Nru megaglest-3.6.0.2/source/glest_game/graphics/renderer.cpp megaglest-3.6.0.3/source/glest_game/graphics/renderer.cpp --- megaglest-3.6.0.2/source/glest_game/graphics/renderer.cpp 2011-12-14 22:38:02.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/graphics/renderer.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -839,7 +839,7 @@ assertGl(); //sun/moon light - Vec3f lightColor= computeLightColor(time); + Vec3f lightColor= timeFlow->computeLightColor(); Vec3f fogColor= world->getTileset()->getFogColor(); Vec4f lightPos= timeFlow->isDay()? computeSunPos(time): computeMoonPos(time); nearestLightPos= lightPos; @@ -3260,7 +3260,7 @@ glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOVertices ); // Bind The Buffer // Load The Data glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, vertices, GL_STATIC_DRAW_ARB ); - glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); assertGl(); // Generate And Bind The Texture Coordinate Buffer @@ -3268,7 +3268,7 @@ glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOFowTexCoords ); // Bind The Buffer // Load The Data glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoords, GL_STATIC_DRAW_ARB ); - glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); assertGl(); // Generate And Bind The Texture Coordinate Buffer @@ -3276,7 +3276,7 @@ glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOSurfaceTexCoords ); // Bind The Buffer // Load The Data glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoordsSurface, GL_STATIC_DRAW_ARB ); - glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); assertGl(); // Generate And Bind The Normal Buffer @@ -3284,7 +3284,7 @@ glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBONormals ); // Bind The Buffer // Load The Data glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, normals, GL_STATIC_DRAW_ARB ); - glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); vboCache.hasBuiltVBOs = true; @@ -3333,7 +3333,7 @@ assert(vbo); glBindBufferARB(target,vbo); glBufferDataARB(target,sizeof(T)*buf.size(),&buf[0],GL_STATIC_DRAW_ARB); - glBindBuffer(target,0); + glBindBufferARB(target,0); assertGl(); buf.clear(); } @@ -4183,7 +4183,7 @@ const Texture2D *fowTex = world->getMinimap()->getFowTexture(); const Pixmap2D *fowTexPixmap = fowTex->getPixmapConst(); - Vec3f baseFogColor = world->getTileset()->getFogColor() * computeLightColor(world->getTimeFlow()->getTime()); + Vec3f baseFogColor = world->getTileset()->getFogColor() * world->getTimeFlow()->computeLightColor(); bool modelRenderStarted = false; @@ -6395,7 +6395,7 @@ Pixmap2D *pixmapScreenShot = new Pixmap2D(sm.getScreenW(), sm.getScreenH(), 3); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - glFinish(); + //glFinish(); glPixelStorei(GL_PACK_ALIGNMENT, 1); @@ -6461,35 +6461,6 @@ #endif } -Vec3f Renderer::computeLightColor(float time) { - const Tileset *tileset= game->getWorld()->getTileset(); - Vec3f color; - - const float transition= 2; - const float dayStart= TimeFlow::dawn; - const float dayEnd= TimeFlow::dusk-transition; - const float nightStart= TimeFlow::dusk; - const float nightEnd= TimeFlow::dawn-transition; - - if(time>dayStart && timegetSunLightColor(); - } - else if(time>nightStart || timegetMoonLightColor(); - } - else if(time>=dayEnd && time<=nightStart) { - color= tileset->getSunLightColor().lerp((time-dayEnd)/transition, tileset->getMoonLightColor()); - } - else if(time>=nightEnd && time<=dayStart) { - color= tileset->getMoonLightColor().lerp((time-nightEnd)/transition, tileset->getSunLightColor()); - } - else { - assert(false); - color= tileset->getSunLightColor(); - } - return color; -} - Vec4f Renderer::computeWaterColor(float waterLevel, float cellHeight) { const float waterFactor= 1.5f; return Vec4f(1.f, 1.f, 1.f, clamp((waterLevel-cellHeight)*waterFactor, 0.f, 1.f)); diff -Nru megaglest-3.6.0.2/source/glest_game/graphics/renderer.h megaglest-3.6.0.3/source/glest_game/graphics/renderer.h --- megaglest-3.6.0.2/source/glest_game/graphics/renderer.h 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/graphics/renderer.h 2012-01-23 07:22:43.000000000 +0000 @@ -581,7 +581,6 @@ float computeMoonAngle(float time); Vec4f computeSunPos(float time); Vec4f computeMoonPos(float time); - Vec3f computeLightColor(float time); Vec4f computeWaterColor(float waterLevel, float cellHeight); void checkExtension(const string &extension, const string &msg); diff -Nru megaglest-3.6.0.2/source/glest_game/graphics/unit_particle_type.cpp megaglest-3.6.0.3/source/glest_game/graphics/unit_particle_type.cpp --- megaglest-3.6.0.2/source/glest_game/graphics/unit_particle_type.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/graphics/unit_particle_type.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -40,8 +40,9 @@ relativeDirection = false; fixed = false; staticParticleCount = 0; - isVisibleAtNight = false; - isVisibleAtDay = false; + isVisibleAtNight = true; + isVisibleAtDay = true; + isDaylightAffected = false; radiusBasedStartenergy = false; delay = 0; lifetime = 0; @@ -146,6 +147,15 @@ isVisibleAtDay=true; } + //isDaylightAffected + if(particleSystemNode->hasChild("isDaylightAffected")){ + const XmlNode *node= particleSystemNode->getChild("isDaylightAffected"); + isDaylightAffected= node->getAttribute("value")->getBoolValue(); + } + else { + isDaylightAffected=false; + } + //radiusBasedStartenergy if(particleSystemNode->hasChild("radiusBasedStartenergy")){ const XmlNode *isVisibleAtDayNode= particleSystemNode->getChild("radiusBasedStartenergy"); @@ -217,9 +227,11 @@ ups->setTeamcolorNoEnergy(teamcolorNoEnergy); ups->setTeamcolorEnergy(teamcolorEnergy); ups->setAlternations(alternations); + ups->setParticleSystemStartDelay(particleSystemStartDelay); ups->setIsVisibleAtNight(isVisibleAtNight); ups->setIsVisibleAtDay(isVisibleAtDay); + ups->setIsDaylightAffected(isDaylightAffected); ups->setStaticParticleCount(staticParticleCount); ups->setRadius(radius); ups->setMinRadius(minRadius); diff -Nru megaglest-3.6.0.2/source/glest_game/graphics/unit_particle_type.h megaglest-3.6.0.3/source/glest_game/graphics/unit_particle_type.h --- megaglest-3.6.0.2/source/glest_game/graphics/unit_particle_type.h 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/graphics/unit_particle_type.h 2012-01-23 07:22:43.000000000 +0000 @@ -58,6 +58,7 @@ int staticParticleCount; bool isVisibleAtNight; bool isVisibleAtDay; + bool isDaylightAffected; bool radiusBasedStartenergy; int delay; int lifetime; diff -Nru megaglest-3.6.0.2/source/glest_game/main/battle_end.cpp megaglest-3.6.0.3/source/glest_game/main/battle_end.cpp --- megaglest-3.6.0.2/source/glest_game/main/battle_end.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/main/battle_end.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -237,7 +237,7 @@ } realPlayerCount++; - int textX= lm + 60 + (realPlayerCount*110); + int textX= lm + 60 + (realPlayerCount*100); int team= stats.getTeam(i) + 1; int kills= stats.getKills(i); int enemykills= stats.getEnemyKills(i); @@ -292,7 +292,7 @@ } if(stats.getControl(i) != ctHuman && stats.getControl(i) != ctNetwork ) { - controlString += " x " + floatToStr(stats.getResourceMultiplier(i),1); + controlString += "\nx " + floatToStr(stats.getResourceMultiplier(i),1); } if(score == bestScore && stats.getVictory(i)) { @@ -408,7 +408,7 @@ //GameConstants::updateFps //string header2 = lang.get("GameDuration") + " " + floatToStr(stats.getWorldTimeElapsed() / 24.0,2); - string header2 = lang.get("GameDuration") + ": " + intToStr(stats.getFramesToCalculatePlaytime()/GameConstants::updateFps/60); + string header2 = lang.get("GameDuration") + ": " + floatToStr((float)stats.getFramesToCalculatePlaytime() / (float)GameConstants::updateFps / 60.0,2); textRenderer->render(header2, lm+250, bm+530); header2 = lang.get("GameMaxConcurrentUnitCount") + ": " + intToStr(stats.getMaxConcurrentUnitCount()); diff -Nru megaglest-3.6.0.2/source/glest_game/main/main.cpp megaglest-3.6.0.3/source/glest_game/main/main.cpp --- megaglest-3.6.0.2/source/glest_game/main/main.cpp 2011-12-20 07:00:23.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/main/main.cpp 2012-01-24 07:39:16.000000000 +0000 @@ -2181,26 +2181,8 @@ string duplicateWarnings=""; { -// vector maps; vector results; -/* - vector mapPaths = config.getPathListForType(ptMaps); - - findAll(mapPaths, "*.gbm", results, false, false, true); - copy(results.begin(), results.end(), std::back_inserter(maps)); - - results.clear(); - findAll(mapPaths, "*.mgm", results, false, false, true); - copy(results.begin(), results.end(), std::back_inserter(maps)); - - results.clear(); - std::sort(maps.begin(),maps.end()); - - if(maps.empty()) { - throw runtime_error("No maps were found!"); - } -*/ string scenarioDir = ""; vector pathList = config.getPathListForType(ptMaps,scenarioDir); vector invalidMapList; @@ -2459,7 +2441,7 @@ #if defined(CUSTOM_DATA_INSTALL_PATH) - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n\nCUSTOM_DATA_INSTALL_PATH = [%s]\n\n",CUSTOM_DATA_INSTALL_PATH); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n\nCUSTOM_DATA_INSTALL_PATH = [%s]\n\n",formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)).c_str()); #endif const int knownArgCount = sizeof(GAME_ARGS) / sizeof(GAME_ARGS[0]); @@ -2945,13 +2927,13 @@ else { #ifdef _WIN32 - int localeBufferSize = GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SISO639LANGNAME, NULL, 0); - wchar_t *sysLocale = new wchar_t[localeBufferSize]; + int localeBufferSize = GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SISO639LANGNAME, NULL, 0); + wchar_t *sysLocale = new wchar_t[localeBufferSize]; GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SISO639LANGNAME, sysLocale,localeBufferSize); //String langValue(sysLocale); //const char *lang_locale = langValue.c_str(); - char langValue[1024]=""; + char langValue[1024]=""; wcstombs(langValue,sysLocale, 1023); const char *lang_locale = &langValue[0]; #else @@ -3543,6 +3525,10 @@ cinfd[0].events = POLLIN; #else h = GetStdHandle(STD_INPUT_HANDLE); + //DWORD dwMode; + //GetConsoleMode(h, &dwMode); + //SetConsoleMode(h, dwMode & ~ENABLE_MOUSE_INPUT); + FlushConsoleInputBuffer(h); #endif } @@ -3568,36 +3554,72 @@ // line buffer input. This does work okay as long as the user doesn't enter characters // without pressing enter, and then try to end the server another way (say a remote // console command), in which case we'll still be waiting for the stdin EOL and hang. - if (WaitForSingleObject(h, 0) == WAIT_OBJECT_0) + + DWORD saveMode; + GetConsoleMode(h, &saveMode); + DWORD dwMode = saveMode; + dwMode &= ~ENABLE_MOUSE_INPUT; + dwMode &= ~ENABLE_WINDOW_INPUT; + SetConsoleMode(h, dwMode); + + bool gotData = (WaitForSingleObject(h, 0) == WAIT_OBJECT_0); + SetConsoleMode(h, saveMode); + if(gotData == true) #endif { - getline(cin, command); - cin.clear(); - - printf("server command [%s]\n",command.c_str()); - if(command == "quit") { - break; + bool skip = true; +#ifdef WIN32 + DWORD nNumberOfCharsToRead = 1024; + DWORD nRead = 0; + INPUT_RECORD irInRec[1025]; + + PeekConsoleInput(h,&irInRec[0],nNumberOfCharsToRead,&nRead); + for(int i = 0; i < nRead; ++i) { + INPUT_RECORD &inr = irInRec[i]; + + //printf("inr.EventType = %d\n",inr.EventType); + if(inr.EventType == KEY_EVENT) { + if(inr.Event.KeyEvent.bKeyDown) { + char cHoldKey = inr.Event.KeyEvent.uChar.AsciiChar; + if(cHoldKey == '\r') { + skip = false; + break; + } + } + } } +#else + skip = false; +#endif + if(skip == false) { + getline(cin, command); + cin.clear(); + + printf("server command [%s]\n",command.c_str()); + if(command == "quit") { + break; + } #ifndef WIN32 - if (cinfd[0].revents & POLLNVAL) { - printf("invalid file descriptor\n"); - } - if (cinfd[0].revents & POLLERR) { - printf("error in file descriptor\n"); - } - if (cinfd[0].revents & POLLHUP) { - printf("hang up in file descriptor\n"); - } - - if(pollresult < 0) { - printf("pollresult = %d errno = %d [%s]\n",pollresult,pollerror,strerror(pollerror)); - - cinfd[0].fd = fileno(stdin); - cinfd[0].events = POLLIN; - } + if (cinfd[0].revents & POLLNVAL) { + printf("invalid file descriptor\n"); + } + if (cinfd[0].revents & POLLERR) { + printf("error in file descriptor\n"); + } + if (cinfd[0].revents & POLLHUP) { + printf("hang up in file descriptor\n"); + } + + if(pollresult < 0) { + printf("pollresult = %d errno = %d [%s]\n",pollresult,pollerror,strerror(pollerror)); + + cinfd[0].fd = fileno(stdin); + cinfd[0].events = POLLIN; + } #endif + } } } //printf("looping\n"); diff -Nru megaglest-3.6.0.2/source/glest_game/network/connection_slot.cpp megaglest-3.6.0.3/source/glest_game/network/connection_slot.cpp --- megaglest-3.6.0.2/source/glest_game/network/connection_slot.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/network/connection_slot.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -385,9 +385,9 @@ if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] about to accept new client connection playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex); - Socket *newSocket = serverInterface->getServerSocket()->accept(); + Socket *newSocket = serverInterface->getServerSocket()->accept(false); - if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] called accept new client connection playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex); + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] called accept new client connection playerIndex = %d newSocket = %p\n",__FILE__,__FUNCTION__,__LINE__,playerIndex,newSocket); if(newSocket != NULL) { // Set Socket as non-blocking newSocket->setBlock(false); @@ -436,14 +436,19 @@ //if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis()); } + else { + close(); + return; + } //if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis()); - } + //} //if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis()); //send intro message when connected - if(hasData == true && this->isConnected() == true) { + //if(hasData == true && this->isConnected() == true) { + if(this->isConnected() == true) { //RandomGen random; //sessionKey = random.randRange(-100000, 100000); srand(time(NULL) / (this->playerIndex + 1)); @@ -473,6 +478,7 @@ //if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis()); //} } + } } } //if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis()); @@ -707,14 +713,14 @@ throw runtime_error(szBuf); } - GameSettings gameSettings; - networkMessageLaunch.buildGameSettings(&gameSettings); + GameSettings gameSettingsBuffer; + networkMessageLaunch.buildGameSettings(&gameSettingsBuffer); //printf("Connection slot got networkMessageLaunch.getMessageType() = %d, got map [%s]\n",networkMessageLaunch.getMessageType(),gameSettings.getMap().c_str()); //printf("\n\n\n\n=====Connection slot got settings:\n%s\n",gameSettings.toString().c_str()); - this->serverInterface->setGameSettings(&gameSettings,false); - this->serverInterface->broadcastGameSetup(&gameSettings); + //this->serverInterface->setGameSettings(&gameSettingsBuffer,false); + this->serverInterface->broadcastGameSetup(&gameSettingsBuffer, true); if(networkMessageLaunch.getMessageType() == nmtLaunch) { this->serverInterface->setMasterserverAdminRequestLaunch(true); @@ -1031,7 +1037,8 @@ } void ConnectionSlot::validateConnection() { - if(gotIntro == false && connectedTime > 0 && + if(this->isConnected() == true && + gotIntro == false && connectedTime > 0 && difftime(time(NULL),connectedTime) > GameConstants::maxClientConnectHandshakeSecs) { close(); } @@ -1063,6 +1070,7 @@ ready = false; gotIntro = false; + connectedTime = 0; if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__); } diff -Nru megaglest-3.6.0.2/source/glest_game/network/server_interface.cpp megaglest-3.6.0.3/source/glest_game/network/server_interface.cpp --- megaglest-3.6.0.2/source/glest_game/network/server_interface.cpp 2011-12-20 02:36:04.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/network/server_interface.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -1708,10 +1708,17 @@ return bOkToStart; } -void ServerInterface::broadcastGameSetup(const GameSettings *gameSettings) { +void ServerInterface::broadcastGameSetup(GameSettings *gameSettingsBuffer, bool setGameSettingsBuffer) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__); + if(setGameSettingsBuffer == true) { + validateGameSettings(gameSettingsBuffer); + //setGameSettings(gameSettingsBuffer,false); + MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE); + gameSettings = *gameSettingsBuffer; + gameSettingsUpdateCount++; + } MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE); - NetworkMessageLaunch networkMessageLaunch(gameSettings, nmtBroadCastSetup); + NetworkMessageLaunch networkMessageLaunch(gameSettingsBuffer, nmtBroadCastSetup); broadcastMessage(&networkMessageLaunch); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__); } @@ -1833,17 +1840,47 @@ } int ServerInterface::getGameSettingsUpdateCount() { - if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START gameSettingsUpdateCount = %d\n",__FILE__,__FUNCTION__,gameSettingsUpdateCount); MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE); + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START gameSettingsUpdateCount = %d\n",__FILE__,__FUNCTION__,gameSettingsUpdateCount); int result = gameSettingsUpdateCount; safeMutex.ReleaseLock(); return result; } +void ServerInterface::validateGameSettings(GameSettings *serverGameSettings) { + MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE); + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s]\n",__FILE__,__FUNCTION__); + + string mapFile = serverGameSettings->getMap(); + if(find(mapFiles.begin(),mapFiles.end(),mapFile) == mapFiles.end()) { + printf("Reverting map from [%s] to [%s]\n",serverGameSettings->getMap().c_str(),gameSettings.getMap().c_str()); + + serverGameSettings->setMapFilterIndex(gameSettings.getMapFilterIndex()); + serverGameSettings->setMap(gameSettings.getMap()); + serverGameSettings->setMapCRC(gameSettings.getMapCRC()); + } + + string tilesetFile = serverGameSettings->getTileset(); + if(find(tilesetFiles.begin(),tilesetFiles.end(),tilesetFile) == tilesetFiles.end()) { + printf("Reverting tileset from [%s] to [%s]\n",serverGameSettings->getTileset().c_str(),gameSettings.getTileset().c_str()); + + serverGameSettings->setTileset(gameSettings.getTileset()); + serverGameSettings->setTilesetCRC(gameSettings.getTilesetCRC()); + } + + string techtreeFile = serverGameSettings->getTech(); + if(find(techTreeFiles.begin(),techTreeFiles.end(),techtreeFile) == techTreeFiles.end()) { + printf("Reverting tech from [%s] to [%s]\n",serverGameSettings->getTech().c_str(),gameSettings.getTech().c_str()); + + serverGameSettings->setTech(gameSettings.getTech()); + serverGameSettings->setTechCRC(gameSettings.getTechCRC()); + } +} + void ServerInterface::setGameSettings(GameSettings *serverGameSettings, bool waitForClientAck) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START gameSettingsUpdateCount = %d, waitForClientAck = %d\n",__FILE__,__FUNCTION__,gameSettingsUpdateCount,waitForClientAck); MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE); + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START gameSettingsUpdateCount = %d, waitForClientAck = %d\n",__FILE__,__FUNCTION__,gameSettingsUpdateCount,waitForClientAck); string mapFile = serverGameSettings->getMap(); if(find(mapFiles.begin(),mapFiles.end(),mapFile) == mapFiles.end()) { diff -Nru megaglest-3.6.0.2/source/glest_game/network/server_interface.h megaglest-3.6.0.3/source/glest_game/network/server_interface.h --- megaglest-3.6.0.2/source/glest_game/network/server_interface.h 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/network/server_interface.h 2012-01-23 07:22:43.000000000 +0000 @@ -124,8 +124,9 @@ int getConnectedSlotCount(); int getOpenSlotCount(); bool launchGame(const GameSettings *gameSettings); + void validateGameSettings(GameSettings *serverGameSettings); void setGameSettings(GameSettings *serverGameSettings, bool waitForClientAck); - void broadcastGameSetup(const GameSettings *gameSettings); + void broadcastGameSetup(GameSettings *gameSettingsBuffer, bool setGameSettingsBuffer=false); int getGameSettingsUpdateCount(); diff -Nru megaglest-3.6.0.2/source/glest_game/world/time_flow.cpp megaglest-3.6.0.3/source/glest_game/world/time_flow.cpp --- megaglest-3.6.0.2/source/glest_game/world/time_flow.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/world/time_flow.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -55,6 +55,7 @@ soundRenderer.stopAmbient(ambientSounds->getNight()); UnitParticleSystem::isNight=false; } + UnitParticleSystem::lightColor=computeLightColor(); if((lastTime=dawn) || firstTime){ @@ -94,4 +95,35 @@ // return (this->time>=time) && (this->timedayStart && timegetSunLightColor(); + } + else if(time>nightStart || timegetMoonLightColor(); + } + else if(time>=dayEnd && time<=nightStart) { + color= tileset->getSunLightColor().lerp((time-dayEnd)/transition, tileset->getMoonLightColor()); + } + else if(time>=nightEnd && time<=dayStart) { + color= tileset->getMoonLightColor().lerp((time-nightEnd)/transition, tileset->getSunLightColor()); + } + else { + assert(false); + color= tileset->getSunLightColor(); + } + return color; +} + + }}//end namespace diff -Nru megaglest-3.6.0.2/source/glest_game/world/time_flow.h megaglest-3.6.0.3/source/glest_game/world/time_flow.h --- megaglest-3.6.0.2/source/glest_game/world/time_flow.h 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_game/world/time_flow.h 2012-01-23 07:22:43.000000000 +0000 @@ -57,6 +57,7 @@ bool isTotalNight() const {return timedusk-1.f;} float getTimeInc() const {return timeInc;} + Vec3f computeLightColor() const; void update(); private: //bool isAproxTime(float time) const; diff -Nru megaglest-3.6.0.2/source/glest_map_editor/CMakeLists.txt megaglest-3.6.0.3/source/glest_map_editor/CMakeLists.txt --- megaglest-3.6.0.2/source/glest_map_editor/CMakeLists.txt 2011-12-20 07:00:23.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_map_editor/CMakeLists.txt 2012-01-23 07:22:43.000000000 +0000 @@ -17,12 +17,6 @@ IF(NOT WIN32) # It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'. - - IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - SET(wxWidgets_CONFIG_OPTIONS --prefix=/usr/local) - MESSAGE(STATUS "Detected FreeBSD.....") - ENDIF() - FIND_PACKAGE(wxWidgets COMPONENTS core base gl REQUIRED) # wxWidgets include (this will do all the magic to configure everything) diff -Nru megaglest-3.6.0.2/source/glest_map_editor/main.cpp megaglest-3.6.0.3/source/glest_map_editor/main.cpp --- megaglest-3.6.0.2/source/glest_map_editor/main.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/glest_map_editor/main.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -21,6 +21,7 @@ #ifndef WIN32 #include #endif +#include using namespace Shared::Util; using namespace Shared::PlatformCommon; diff -Nru megaglest-3.6.0.2/source/shared_lib/CMakeLists.txt megaglest-3.6.0.3/source/shared_lib/CMakeLists.txt --- megaglest-3.6.0.2/source/shared_lib/CMakeLists.txt 2011-12-16 06:24:21.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/CMakeLists.txt 2012-01-23 20:36:15.000000000 +0000 @@ -138,7 +138,10 @@ FIND_PACKAGE(FontConfig) IF(FONTCONFIG_FOUND) + MESSAGE(STATUS "**NOTE: FontConfig support was detected and enabled.") SET(HAVE_FONTCONFIG 1) + ADD_DEFINITIONS(-DHAVE_FONTCONFIG) + INCLUDE_DIRECTORIES( ${FONTCONFIG_INCLUDE_DIR} ) SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${FONTCONFIG_LIBRARIES} ) ENDIF(FONTCONFIG_FOUND) @@ -290,6 +293,30 @@ SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${IRCCLIENT_LIBRARY}) endif() + set(CMAKE_REQUIRED_INCLUDES "${IRCCLIENT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_LIBRARIES "${IRCCLIENT_LIBRARY}") + check_cxx_source_runs(" + #include + #include + #include + int main() + { + unsigned int high = 0; + unsigned int low = 0; + irc_get_version(&high,&low); + if( (high == 1 && low >= 6) || (high > 1)) { + return 0; + } + throw 1; + }" + HAS_LIBIRCCLIENT_1_6) + + IF(HAS_LIBIRCCLIENT_1_6) + message(STATUS "Found HAS_LIBIRCCLIENT_1_6: ${HAS_LIBIRCCLIENT_1_6}") + ELSE() + ADD_DEFINITIONS(-DLIBIRCCLIENT_PRE1_6) + ENDIF() + IF(WIN32) SET(MG_SOURCE_FILES ${MG_SOURCE_FILES} ${PROJECT_SOURCE_DIR}/source/shared_lib/sources/platform/posix/socket.cpp) SET(MG_SOURCE_FILES ${MG_SOURCE_FILES} ${PROJECT_SOURCE_DIR}/source/shared_lib/sources/platform/posix/ircclient.cpp) @@ -348,9 +375,9 @@ ENDIF() # FIXME: hackish... - IF(WANT_STREFLOP) - SET(STREFLOP_PROPERTIES "-DSTREFLOP_SSE -DLIBM_COMPILING_FLT32") - ENDIF() +# IF(WANT_STREFLOP) +# SET(STREFLOP_PROPERTIES "-DSTREFLOP_SSE -DLIBM_COMPILING_FLT32") +# ENDIF() SET_SOURCE_FILES_PROPERTIES(${MG_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PLATFORM_SPECIFIC_DEFINES} ${STREFLOP_PROPERTIES} ${CXXFLAGS}") diff -Nru megaglest-3.6.0.2/source/shared_lib/include/graphics/font.h megaglest-3.6.0.3/source/shared_lib/include/graphics/font.h --- megaglest-3.6.0.2/source/shared_lib/include/graphics/font.h 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/graphics/font.h 2012-01-23 07:22:43.000000000 +0000 @@ -101,7 +101,7 @@ string getType() const; //set - void setType(string typeX11, string typeGeneric); + void setType(string typeX11, string typeGeneric, string typeGenericFamily); void setWidth(int width); int getSize() const; @@ -139,7 +139,7 @@ Font3D *ConvertFont2DTo3D(Font2D *font); -const char* findFont(const char *firstFontToTry=NULL); +const char* findFont(const char *firstFontToTry=NULL,const char *firstFontFamilyToTry=NULL); }}//end namespace diff -Nru megaglest-3.6.0.2/source/shared_lib/include/graphics/font_text.h megaglest-3.6.0.3/source/shared_lib/include/graphics/font_text.h --- megaglest-3.6.0.2/source/shared_lib/include/graphics/font_text.h 2011-12-20 07:39:07.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/graphics/font_text.h 2012-01-23 07:22:43.000000000 +0000 @@ -36,7 +36,7 @@ Text(FontTextHandlerType type); virtual ~Text(); - virtual void init(string fontName, int fontSize); + virtual void init(string fontName, string fontFamilyName, int fontSize); virtual void SetFaceSize(int); virtual int GetFaceSize(); diff -Nru megaglest-3.6.0.2/source/shared_lib/include/graphics/gl/font_text_freetypegl.h megaglest-3.6.0.3/source/shared_lib/include/graphics/gl/font_text_freetypegl.h --- megaglest-3.6.0.2/source/shared_lib/include/graphics/gl/font_text_freetypegl.h 2011-12-20 07:39:07.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/graphics/gl/font_text_freetypegl.h 2012-01-23 07:22:43.000000000 +0000 @@ -41,7 +41,7 @@ TextFreetypeGL(FontTextHandlerType type); virtual ~TextFreetypeGL(); - virtual void init(string fontName, int fontSize); + virtual void init(string fontName, string fontFamilyName, int fontSize); virtual void SetFaceSize(int); virtual int GetFaceSize(); @@ -66,6 +66,7 @@ int fontFaceSize; string fontName; + string fontFamilyName; const char* fontFile; void cleanupFont(); diff -Nru megaglest-3.6.0.2/source/shared_lib/include/graphics/gl/font_textFTGL.h megaglest-3.6.0.3/source/shared_lib/include/graphics/gl/font_textFTGL.h --- megaglest-3.6.0.2/source/shared_lib/include/graphics/gl/font_textFTGL.h 2011-12-20 07:39:07.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/graphics/gl/font_textFTGL.h 2012-01-23 07:22:43.000000000 +0000 @@ -33,7 +33,7 @@ TextFTGL(FontTextHandlerType type); virtual ~TextFTGL(); - virtual void init(string fontName, int fontSize); + virtual void init(string fontName, string fontFamilyName, int fontSize); virtual void SetFaceSize(int); virtual int GetFaceSize(); diff -Nru megaglest-3.6.0.2/source/shared_lib/include/graphics/md5/Image.h megaglest-3.6.0.3/source/shared_lib/include/graphics/md5/Image.h --- megaglest-3.6.0.2/source/shared_lib/include/graphics/md5/Image.h 2011-12-18 15:18:46.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/graphics/md5/Image.h 2012-01-23 07:22:43.000000000 +0000 @@ -43,10 +43,11 @@ #endif // _WIN32 #include -#ifndef _WIN32 -//#include + +#if !defined(_WIN32) || defined(__MINGW32__) #include #endif + #include #include #include @@ -61,7 +62,7 @@ using std::endl; using std::string; -#ifdef _WIN32 +#if defined(_WIN32) using std::tr1::shared_ptr; #endif diff -Nru megaglest-3.6.0.2/source/shared_lib/include/graphics/md5/Md5Model.h megaglest-3.6.0.3/source/shared_lib/include/graphics/md5/Md5Model.h --- megaglest-3.6.0.2/source/shared_lib/include/graphics/md5/Md5Model.h 2011-12-18 15:18:46.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/graphics/md5/Md5Model.h 2012-01-23 07:22:43.000000000 +0000 @@ -48,7 +48,11 @@ #include #include #include -//#include + +#if !defined(_WIN32) || defined(__MINGW32__) +#include +#endif + #include #include "Mathlib.h" @@ -60,7 +64,7 @@ using std::vector; using std::map; -#ifdef _WIN32 +#if defined(_WIN32) using std::tr1::shared_ptr; #endif diff -Nru megaglest-3.6.0.2/source/shared_lib/include/graphics/particle.h megaglest-3.6.0.3/source/shared_lib/include/graphics/particle.h --- megaglest-3.6.0.2/source/shared_lib/include/graphics/particle.h 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/graphics/particle.h 2012-01-23 07:22:43.000000000 +0000 @@ -132,6 +132,7 @@ bool teamcolorNoEnergy; bool teamcolorEnergy; int alternations; + int particleSystemStartDelay; ParticleObserver *particleObserver; public: @@ -173,6 +174,7 @@ void setTeamcolorNoEnergy(bool teamcolorNoEnergy) {this->teamcolorNoEnergy= teamcolorNoEnergy;} void setTeamcolorEnergy(bool teamcolorEnergy) {this->teamcolorEnergy= teamcolorEnergy;} void setAlternations(int alternations) {this->alternations= alternations;} + void setParticleSystemStartDelay(int delay) {this->particleSystemStartDelay= delay;} virtual void setFactionColor(Vec3f factionColor); static BlendMode strToBlendMode(const string &str); @@ -269,6 +271,7 @@ class UnitParticleSystem: public GameParticleSystem{ public: static bool isNight; + static Vec3f lightColor; private: float radius; float minRadius; @@ -296,6 +299,7 @@ float rotation; bool isVisibleAtNight; bool isVisibleAtDay; + bool isDaylightAffected; bool radiusBasedStartenergy; int staticParticleCount; int delay; @@ -339,6 +343,7 @@ void setPrimitive(Primitive primitive) {this->primitive= primitive;} void setStaticParticleCount(int staticParticleCount){this->staticParticleCount= staticParticleCount;} void setIsVisibleAtNight(bool value) {this->isVisibleAtNight= value;} + void setIsDaylightAffected(bool value) {this->isDaylightAffected= value;} void setIsVisibleAtDay(bool value) {this->isVisibleAtDay= value;} void setRadiusBasedStartenergy(bool value) {this->radiusBasedStartenergy= value;} void setShape(Shape shape) {this->shape= shape;} diff -Nru megaglest-3.6.0.2/source/shared_lib/include/platform/common/platform_common.h megaglest-3.6.0.3/source/shared_lib/include/platform/common/platform_common.h --- megaglest-3.6.0.2/source/shared_lib/include/platform/common/platform_common.h 2011-12-13 01:30:52.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/platform/common/platform_common.h 2012-01-24 16:14:49.000000000 +0000 @@ -211,6 +211,7 @@ void endPathWithSlash(string &path, bool requireOSSlash=false); void trimPathWithStartingSlash(string &path); void updatePathClimbingParts(string &path); +string formatPath(string path); string replaceAll(string& context, const string& from, const string& to); bool removeFile(string file); diff -Nru megaglest-3.6.0.2/source/shared_lib/include/platform/posix/socket.h megaglest-3.6.0.3/source/shared_lib/include/platform/posix/socket.h --- megaglest-3.6.0.2/source/shared_lib/include/platform/posix/socket.h 2011-12-02 16:07:59.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/platform/posix/socket.h 2012-01-23 07:22:43.000000000 +0000 @@ -253,7 +253,7 @@ virtual ~ServerSocket(); void bind(int port); void listen(int connectionQueueSize= SOMAXCONN); - Socket *accept(); + Socket *accept(bool errorOnFail=true); void stopBroadCastThread(); void pauseBroadcast(); diff -Nru megaglest-3.6.0.2/source/shared_lib/include/platform/sdl/platform_main.h megaglest-3.6.0.3/source/shared_lib/include/platform/sdl/platform_main.h --- megaglest-3.6.0.2/source/shared_lib/include/platform/sdl/platform_main.h 2011-12-20 06:31:38.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/platform/sdl/platform_main.h 2012-01-23 07:22:43.000000000 +0000 @@ -388,7 +388,8 @@ hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_VERSION])) == true || hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_SHOW_INI_SETTINGS])) == true || hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) { - if(SDL_Init(SDL_INIT_TIMER | SDL_INIT_JOYSTICK) < 0) { + // Use this for masterserver mode for timers like Chrono + if(SDL_Init(SDL_INIT_TIMER) < 0) { std::cerr << "Couldn't initialize SDL: " << SDL_GetError() << "\n"; return 1; } @@ -398,9 +399,9 @@ std::cerr << "Couldn't initialize SDL: " << SDL_GetError() << "\n"; return 1; } + SDL_EnableUNICODE(1); + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); } - SDL_EnableUNICODE(1); - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); return 0; } diff -Nru megaglest-3.6.0.2/source/shared_lib/include/platform/win32/types.h megaglest-3.6.0.3/source/shared_lib/include/platform/win32/types.h --- megaglest-3.6.0.2/source/shared_lib/include/platform/win32/types.h 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/platform/win32/types.h 2012-01-23 07:22:43.000000000 +0000 @@ -33,10 +33,9 @@ typedef long long int64; typedef unsigned long long uint64; -//typedef uint8 byte; - }}//end namespace +#ifndef __MINGW32__ // ISO C9x compliant stdint.h for Microsoft Visual Studio // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 @@ -287,3 +286,5 @@ #endif // _MSC_STDINT_H_ ] #endif + +#endif diff -Nru megaglest-3.6.0.2/source/shared_lib/include/util/string_utils.h megaglest-3.6.0.3/source/shared_lib/include/util/string_utils.h --- megaglest-3.6.0.2/source/shared_lib/include/util/string_utils.h 2011-10-17 20:56:11.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/include/util/string_utils.h 2012-01-23 07:22:43.000000000 +0000 @@ -25,6 +25,10 @@ # include #include "types.h" +#ifdef __MINGW32__ +typedef unsigned char byte; +#endif + //! \name Macros for Shared::Util::String //@{ diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/graphics/font.cpp megaglest-3.6.0.3/source/shared_lib/sources/graphics/font.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/graphics/font.cpp 2011-12-02 22:04:02.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/graphics/font.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -84,8 +84,11 @@ #if defined(WIN32) string newEnvValue = "MEGAGLEST_FONT="; _putenv(newEnvValue.c_str()); + newEnvValue = "MEGAGLEST_FONT_FAMILY="; + _putenv(newEnvValue.c_str()); #else unsetenv("MEGAGLEST_FONT"); + unsetenv("MEGAGLEST_FONT_FAMILY"); #endif } @@ -212,11 +215,11 @@ return this->type; } -void Font::setType(string typeX11, string typeGeneric) { +void Font::setType(string typeX11, string typeGeneric, string typeGenericFamily) { if(textHandler) { try { this->type= typeGeneric; - textHandler->init(typeGeneric,textHandler->GetFaceSize()); + textHandler->init(typeGeneric,typeGenericFamily,textHandler->GetFaceSize()); metrics.setTextHandler(this->textHandler); } catch(exception &ex) { @@ -269,54 +272,11 @@ depth= 10.f; } -const char* findFont(const char *firstFontToTry) { - const char* font = NULL; - const char* path = NULL; - - #define CHECK_FONT_PATH(filename) \ - { \ - path = filename; \ - if( !font && path && fileExists(path) == true ) \ - font = strdup(path); \ - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Found font file [%s]\n",font); \ - } - - string tryFont = ""; - if(firstFontToTry) { - tryFont = firstFontToTry; - #ifdef WIN32 - replaceAll(tryFont, "/", "\\"); - #endif - - CHECK_FONT_PATH(tryFont.c_str()) - } - - // Get user-specified font path - if(getenv("MEGAGLEST_FONT") != NULL) { - tryFont = getenv("MEGAGLEST_FONT"); - #ifdef WIN32 - replaceAll(tryFont, "/", "\\"); - #endif - - CHECK_FONT_PATH(tryFont.c_str()) - } - - string data_path = Text::DEFAULT_FONT_PATH; - string defaultFont = data_path + "data/core/fonts/LinBiolinum_RB.ttf";//LinBiolinum_Re-0.6.4.ttf - tryFont = defaultFont; - #ifdef WIN32 - replaceAll(tryFont, "/", "\\"); - #endif - CHECK_FONT_PATH(tryFont.c_str()) - -#ifdef FONT_PATH - // Get distro-specified font path - CHECK_FONT_PATH(FONT_PATH) -#endif - +string findFontFamily(const char* font, const char *fontFamily) { + string resultFile = ""; #ifdef HAVE_FONTCONFIG // Get default font via fontconfig - if( !font && FcInit() ) { + if( !font && FcInit() && fontFamily) { FcResult result; FcFontSet *fs; FcPattern* pat; @@ -327,30 +287,107 @@ name of a font that contains all the Unicode characters in use in your translation. */ - pat = FcNameParse((FcChar8 *)"Gothic Uralic"); + //pat = FcNameParse((FcChar8 *)"Gothic Uralic"); + pat = FcNameParse((FcChar8 *)fontFamily); FcConfigSubstitute(0, pat, FcMatchPattern); - FcPatternDel(pat, FC_WEIGHT); - FcPatternAddInteger(pat, FC_WEIGHT, FC_WEIGHT_BOLD); + //FcPatternDel(pat, FC_WEIGHT); + //FcPatternAddInteger(pat, FC_WEIGHT, FC_WEIGHT_BOLD); FcDefaultSubstitute(pat); fs = FcFontSetCreate(); match = FcFontMatch(0, pat, &result); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Trying fontconfig for fontfamily [%s]\n",fontFamily); + if (match) FcFontSetAdd(fs, match); if (pat) FcPatternDestroy(pat); if(fs) { FcChar8* file; if( FcPatternGetString (fs->fonts[0], FC_FILE, 0, &file) == FcResultMatch ) { - CHECK_FONT_PATH((const char*)file) + //CHECK_FONT_PATH((const char*)file,NULL) + resultFile = (const char*)file; } FcFontSetDestroy(fs); } FcFini(); } +#else + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("******************* NO FONT CONFIG ENABLED!\n"); +#endif + + return resultFile; +} + +const char* findFont(const char *firstFontToTry,const char *firstFontFamilyToTry) { + const char* font = NULL; + const char* path = NULL; + + #define CHECK_FONT_PATH(filename,fontFamily) \ + { \ + path = filename; \ + if( !font && path && strlen(path) > 0 && fileExists(path) == true ) { \ + font = strdup(path); \ + } \ + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#1 Searching for font file [%s] result [%s]\n",path,font); \ + if( !font && fontFamily && strlen(fontFamily) > 0) { \ + string fileFound = findFontFamily(font, fontFamily); \ + if(fileFound != "") { \ + path = fileFound.c_str(); \ + if( !font && path && strlen(path) > 0 && fileExists(path) == true ) { \ + font = strdup(path); \ + } \ + } \ + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#2 Searching for font family [%s] result [%s]\n",fontFamily,font); \ + } \ + } + + string tryFont = ""; + if(firstFontToTry || firstFontFamilyToTry) { + if(firstFontToTry && strlen(firstFontToTry) > 0) { + tryFont = firstFontToTry; + #ifdef WIN32 + replaceAll(tryFont, "/", "\\"); + #endif + + + CHECK_FONT_PATH(tryFont.c_str(),firstFontFamilyToTry) + } + else { + CHECK_FONT_PATH(NULL,firstFontFamilyToTry) + } + } + + // Get user-specified font path + if(getenv("MEGAGLEST_FONT") != NULL || getenv("MEGAGLEST_FONT_FAMILY") != NULL) { + + if(getenv("MEGAGLEST_FONT") != NULL) { + tryFont = getenv("MEGAGLEST_FONT"); + #ifdef WIN32 + replaceAll(tryFont, "/", "\\"); + #endif + + CHECK_FONT_PATH(tryFont.c_str(),getenv("MEGAGLEST_FONT_FAMILY")) + } + else { + CHECK_FONT_PATH(NULL,getenv("MEGAGLEST_FONT_FAMILY")) + } + } + + string data_path = Text::DEFAULT_FONT_PATH; + string defaultFont = data_path + "data/core/fonts/LinBiolinum_RB.ttf";//LinBiolinum_Re-0.6.4.ttf + tryFont = defaultFont; + #ifdef WIN32 + replaceAll(tryFont, "/", "\\"); + #endif + CHECK_FONT_PATH(tryFont.c_str(),"Linux Biolinum O:style=Bold") + +#ifdef FONT_PATH + // Get distro-specified font path + CHECK_FONT_PATH(FONT_PATH) #endif - CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf") + CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf","Gothic Uralic:style=Regular") // Check a couple of common paths for Gothic Uralic/bold as a last resort // Debian @@ -359,44 +396,44 @@ font that contains all the Unicode characters in use in your translation. If the font is available in Debian it should be the Debian path. */ - CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf") + CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf","Gothic Uralic:style=Regular") /* TRANSLATORS: If using the FTGL backend, this should be the path of a font that contains all the Unicode characters in use in your translation. If the font is available in Debian it should be the Debian path. */ - CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothu___.ttf") + CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothu___.ttf","Gothic Uralic:style=Regular") // Mandrake /* TRANSLATORS: If using the FTGL backend, this should be the path of a bold font that contains all the Unicode characters in use in your translation. If the font is available in Mandrake it should be the Mandrake path. */ - CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHUB__.TTF") + CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHUB__.TTF","Gothic Uralic:style=Bold") /* TRANSLATORS: If using the FTGL backend, this should be the path of a font that contains all the Unicode characters in use in your translation. If the font is available in Mandrake it should be the Mandrake path. */ - CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHU___.TTF") + CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHU___.TTF","Gothic Uralic:style=Regular") // Check the non-translated versions of the above - CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf") - CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothu___.ttf") - CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHUB__.TTF") - CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHU___.TTF") - - CHECK_FONT_PATH("/usr/share/fonts/truetype/linux-libertine/LinLibertine_Re.ttf") - - CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeSerif.ttf") - CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeSans.ttf") - CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeMono.ttf") + CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf","Gothic Uralic:style=Regular") + CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothu___.ttf","Gothic Uralic:style=Regular") + CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHUB__.TTF","Gothic Uralic:style=Regular") + CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHU___.TTF","Gothic Uralic:style=Regular") + + CHECK_FONT_PATH("/usr/share/fonts/truetype/linux-libertine/LinLibertine_Re.ttf","Linux Libertine O:style=Regular") + + CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeSerif.ttf","FreeSerif") + CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeSans.ttf","FreeSans") + CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeMono.ttf","FreeMono") #ifdef _WIN32 - CHECK_FONT_PATH("c:\\windows\\fonts\\verdana.ttf") - CHECK_FONT_PATH("c:\\windows\\fonts\\tahoma.ttf") - CHECK_FONT_PATH("c:\\windows\\fonts\\arial.ttf") - CHECK_FONT_PATH("\\windows\\fonts\\arial.ttf") + CHECK_FONT_PATH("c:\\windows\\fonts\\verdana.ttf",NULL) + CHECK_FONT_PATH("c:\\windows\\fonts\\tahoma.ttf",NULL) + CHECK_FONT_PATH("c:\\windows\\fonts\\arial.ttf",NULL) + CHECK_FONT_PATH("\\windows\\fonts\\arial.ttf",NULL) #endif return font; diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/graphics/font_text.cpp megaglest-3.6.0.3/source/shared_lib/sources/graphics/font_text.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/graphics/font_text.cpp 2011-12-20 07:39:07.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/graphics/font_text.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -19,7 +19,7 @@ this->type = type; } Text::~Text() {} -void Text::init(string fontName, int fontSize) {} +void Text::init(string fontName, string fontFamilyName, int fontSize) {} void Text::Render(const char*, const int) {} float Text::Advance(const char*, const int) {return 0;} float Text::LineHeight(const char*, const int) {return 0;} diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/graphics/gl/font_gl.cpp megaglest-3.6.0.3/source/shared_lib/sources/graphics/gl/font_gl.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/graphics/gl/font_gl.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/graphics/gl/font_gl.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -84,17 +84,16 @@ }}}//end namespace -namespace Shared { namespace Graphics { - - using namespace Gl; -Font3D * ConvertFont2DTo3D(Font2D *font) { - - Font3D *result = new Font3DGl(); - result->setSize(font->getSize()); - result->setType("",font->getType()); - result->setWidth(font->getWidth()); - result->init(); - return result; -} - -}} +//namespace Shared { namespace Graphics { +// +// using namespace Gl; +//Font3D * ConvertFont2DTo3D(Font2D *font) { +// +// Font3D *result = new Font3DGl(); +// result->setSize(font->getSize()); +// result->setType("",font->getType()); +// result->setWidth(font->getWidth()); +// result->init(); +// return result; +//} +//}} diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/graphics/gl/font_text_freetypegl.cpp megaglest-3.6.0.3/source/shared_lib/sources/graphics/gl/font_text_freetypegl.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/graphics/gl/font_text_freetypegl.cpp 2011-12-20 07:39:07.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/graphics/gl/font_text_freetypegl.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -38,7 +38,7 @@ font=NULL; manager=NULL; - init("", 24); + init("", "", 24); } TextFreetypeGL::~TextFreetypeGL() { @@ -52,10 +52,11 @@ } } -void TextFreetypeGL::init(string fontName, int fontSize) { +void TextFreetypeGL::init(string fontName, string fontFamilyName, int fontSize) { cleanupFont(); this->fontName = fontName; - this->fontFile = findFont(this->fontName.c_str()); + this->fontFamilyName = fontFamilyName; + this->fontFile = findFont(this->fontName.c_str(),this->fontFamilyName.c_str()); this->fontFaceSize = fontSize; const wchar_t *cache = L" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; @@ -77,7 +78,7 @@ void TextFreetypeGL::SetFaceSize(int value) { this->fontFaceSize = value; - init(this->fontName,this->fontFaceSize); + init(this->fontName,this->fontFamilyName,this->fontFaceSize); } int TextFreetypeGL::GetFaceSize() { diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp megaglest-3.6.0.3/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp 2011-12-20 07:39:07.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -78,7 +78,7 @@ delete ftFont; ftFont = NULL; free((void*)fontFile); fontFile = NULL; - throw runtime_error("FTGL: error loading font"); + throw runtime_error(string("FTGL: error loading font: ") + string(fontFile)); } free((void*)fontFile); fontFile = NULL; @@ -123,9 +123,9 @@ fontFile = NULL; } -void TextFTGL::init(string fontName, int fontSize) { +void TextFTGL::init(string fontName, string fontFamilyName, int fontSize) { cleanupFont(); - fontFile = findFont(fontName.c_str()); + fontFile = findFont(fontName.c_str(),fontFamilyName.c_str()); //ftFont = new FTBufferFont(fontFile); //ftFont = new FTGLPixmapFont(fontFile); diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/graphics/model.cpp megaglest-3.6.0.3/source/shared_lib/sources/graphics/model.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/graphics/model.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/graphics/model.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -141,28 +141,28 @@ glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOVertices ); // Bind The Buffer // Load The Data glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getVertices(), GL_STATIC_DRAW_ARB ); - glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); // Generate And Bind The Texture Coordinate Buffer glGenBuffersARB( 1, (GLuint*)&m_nVBOTexCoords ); // Get A Valid Name glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOTexCoords ); // Bind The Buffer // Load The Data glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f)*vertexCount, texCoords, GL_STATIC_DRAW_ARB ); - glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); // Generate And Bind The Normal Buffer glGenBuffersARB( 1, (GLuint*)&m_nVBONormals ); // Get A Valid Name glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBONormals ); // Bind The Buffer // Load The Data glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getNormals(), GL_STATIC_DRAW_ARB ); - glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); // Generate And Bind The Index Buffer glGenBuffersARB( 1, (GLuint*)&m_nVBOIndexes ); // Get A Valid Name glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, m_nVBOIndexes ); // Bind The Buffer // Load The Data glBufferDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(uint32)*indexCount, indices, GL_STATIC_DRAW_ARB ); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); // Our Copy Of The Data Is No Longer Necessary, It Is Safe In The Graphics Card delete [] vertices; vertices = NULL; diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/graphics/particle.cpp megaglest-3.6.0.3/source/shared_lib/sources/graphics/particle.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/graphics/particle.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/graphics/particle.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -74,6 +74,7 @@ teamcolorNoEnergy= false; teamcolorEnergy= false; alternations= 0; + particleSystemStartDelay= 0; } ParticleSystem::~ParticleSystem(){ @@ -97,8 +98,10 @@ if(aliveParticleCount > (int) particles.size()){ throw runtime_error("aliveParticleCount >= particles.size()"); } - - if(state != sPause){ + if(particleSystemStartDelay>0){ + particleSystemStartDelay--; + } + else if(state != sPause){ for(int i= 0; i < aliveParticleCount; ++i){ updateParticle(&particles[i]); @@ -527,6 +530,7 @@ // UnitParticleSystem // =========================================================================== bool UnitParticleSystem::isNight= false; +Vec3f UnitParticleSystem::lightColor=Vec3f(1.0f,1.0f,1.0f); UnitParticleSystem::UnitParticleSystem(int particleCount): GameParticleSystem(particleCount), @@ -537,11 +541,14 @@ setParticleSize(0.6f); setColorNoEnergy(Vec4f(1.0f, 0.5f, 0.0f, 1.0f)); + sizeNoEnergy=1.0f; primitive= pQuad; gravity= 0.0f; fixed= false; + shape = UnitParticleSystem::sLinear; + angle= 0.0f; rotation= 0.0f; relativeDirection= true; relative= false; @@ -549,6 +556,7 @@ isVisibleAtNight= true; isVisibleAtDay= true; + isDaylightAffected= false; cRotation= Vec3f(1.0f, 1.0f, 1.0f); fixedAddition= Vec3f(0.0f, 0.0f, 0.0f); @@ -560,6 +568,7 @@ delay = 0; // none lifetime = -1; // forever + emissionRateFade=0.0f; startTime = 0; endTime = 1; @@ -736,6 +745,12 @@ } p->speed+= p->accel; p->color= color * energyRatio + colorNoEnergy * (1.0f - energyRatio); + if(isDaylightAffected==true) + { + p->color.x=p->color.x*lightColor.x; + p->color.y=p->color.y*lightColor.y; + p->color.z=p->color.z*lightColor.z; + } p->size= particleSize * energyRatio + sizeNoEnergy * (1.0f - energyRatio); if(state == ParticleSystem::sFade || staticParticleCount < 1){ p->energy--; diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/graphics/pixmap.cpp megaglest-3.6.0.3/source/shared_lib/sources/graphics/pixmap.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/graphics/pixmap.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/graphics/pixmap.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -916,20 +916,30 @@ void Pixmap2D::Scale(int format, int newW, int newH) { int useComponents = this->getComponents(); + int originalW = w; + int originalH = h; uint8 *newpixels= new uint8[newW * newH * useComponents]; glPixelStorei(GL_PACK_ALIGNMENT, 1); int error = gluScaleImage( format, w, h, GL_UNSIGNED_BYTE, pixels, newW, newH, GL_UNSIGNED_BYTE, newpixels); - if(error != GL_NO_ERROR) { + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + if(error == GL_NO_ERROR) { init(newW,newH,this->components); pixels = newpixels; + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Scaled image from [%d x %d] to [%d x %d]\n",originalW,originalH,w,h); } else { - assertGl(); + const char *errorString= reinterpret_cast(gluErrorString(error)); + printf("ERROR Scaling image from [%d x %d] to [%d x %d] error: %d [%s]\n",originalW,originalH,w,h,error,errorString); + + GLenum glErr = error; + assertGlWithErrorNumber(glErr); } - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + CalculatePixelsCRC(pixels,getPixelByteCount(), crc); } diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/graphics/texture.cpp megaglest-3.6.0.3/source/shared_lib/sources/graphics/texture.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/graphics/texture.cpp 2011-12-15 11:16:14.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/graphics/texture.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -26,6 +26,16 @@ const int Texture::defaultComponents = 4; bool Texture::useTextureCompression = false; +/* Quick utility function for texture creation */ +static int powerOfTwo(int input) { + int value = 1; + + while (value < input) { + value <<= 1; + } + return value; +} + Texture::Texture() { assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false); @@ -86,6 +96,102 @@ delete[] surfData; } +// SDL_Surface *prepGLTexture(SDL_Surface *surface, GLfloat *texCoords = NULL, const bool +// freeSource = false) { + /* Use the surface width and height expanded to powers of 2 */ + //int w = powerOfTwo(surface->w); + //int h = powerOfTwo(surface->h); + int w = surface->w; + int h = surface->h; + +// if (texCoords != 0) { +// texCoords[0] = 0.0f; /* Min +// X */ +// texCoords[1] = 0.0f; /* Min +// Y */ +// texCoords[2] = (GLfloat)surface->w / w; /* Max X */ +// texCoords[3] = (GLfloat)surface->h / h; /* Max Y */ +// } + + SDL_Surface *image = SDL_CreateRGBSurface( + SDL_SWSURFACE, + w, h, + 32, + #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ + 0x000000FF, + 0x0000FF00, + 0x00FF0000, + 0xFF000000 + #else + 0xFF000000, + 0x00FF0000, + 0x0000FF00, + 0x000000FF + #endif + ); + if ( image == NULL ) { + return 0; + } + + /* Save the alpha blending attributes */ + Uint32 savedFlags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK); + Uint8 savedAlpha = surface->format->alpha; + if ( (savedFlags & SDL_SRCALPHA) == SDL_SRCALPHA ) { + SDL_SetAlpha(surface, 0, 0); + } + + SDL_Rect srcArea, destArea; + /* Copy the surface into the GL texture image */ + srcArea.x = 0; destArea.x = 0; + /* Copy it in at the bottom, because we're going to flip + this image upside-down in a moment + */ + srcArea.y = 0; destArea.y = h - surface->h; + srcArea.w = surface->w; + srcArea.h = surface->h; + SDL_BlitSurface(surface, &srcArea, image, &destArea); + + /* Restore the alpha blending attributes */ + if ((savedFlags & SDL_SRCALPHA) == SDL_SRCALPHA) { + SDL_SetAlpha(surface, savedFlags, savedAlpha); + } + + /* Turn the image upside-down, because OpenGL textures + start at the bottom-left, instead of the top-left + */ + #ifdef _MSC_VER + Uint8 *line = new Uint8[image->pitch]; + #else + Uint8 line[image->pitch]; + #endif + /* These two make the following more readable */ + Uint8 *pixels = static_cast(image->pixels); + Uint16 pitch = image->pitch; + int ybegin = 0; + int yend = image->h - 1; + + // TODO: consider if this lock is legal/appropriate + if (SDL_MUSTLOCK(image)) { SDL_LockSurface(image); } + while (ybegin < yend) { + memcpy(line, pixels + pitch*ybegin, pitch); + memcpy(pixels + pitch*ybegin, pixels + pitch*yend, pitch); + memcpy(pixels + pitch*yend, line, pitch); + ybegin++; + yend--; + } + if (SDL_MUSTLOCK(image)) { SDL_UnlockSurface(image); } + +// if (freeSource) { +// SDL_FreeSurface(surface); +// } + + #ifdef _MSC_VER + delete[] line; + #endif + + return image; +// } + return surface; } diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/lua/lua_script.cpp megaglest-3.6.0.3/source/shared_lib/sources/lua/lua_script.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/lua/lua_script.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/lua/lua_script.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -192,7 +192,7 @@ if(lua_isstring(luaState, argumentIndex)) { const char *result = luaL_checkstring(luaState, argumentIndex); - printf("\nGENERIC param %d is a string, %s!\n",argumentIndex,result); + //printf("\nGENERIC param %d is a string, %s!\n",argumentIndex,result); return (void *)result; } //else if(lua_isnumber(luaState, argumentIndex)) { @@ -202,11 +202,11 @@ //} else if(lua_isnumber(luaState, argumentIndex)) { lua_Integer result = luaL_checkinteger(luaState, argumentIndex); - printf("\nGENERIC param %d is an int, %d!\n",argumentIndex,(int)result); + //printf("\nGENERIC param %d is an int, %d!\n",argumentIndex,(int)result); return (void *)result; } else { - printf("\nGENERIC param %d is a NULL!\n",argumentIndex); + //printf("\nGENERIC param %d is a NULL!\n",argumentIndex); return NULL; } } diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/platform/common/platform_common.cpp megaglest-3.6.0.3/source/shared_lib/sources/platform/common/platform_common.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/platform/common/platform_common.cpp 2011-12-13 01:30:52.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/platform/common/platform_common.cpp 2012-01-24 16:14:49.000000000 +0000 @@ -500,6 +500,13 @@ } } +string formatPath(string path) { + replaceAll(path, "\"", ""); + replaceAll(path, "//", "/"); + + return path; +} + void trimPathWithStartingSlash(string &path) { if(StartsWith(path, "/") == true || StartsWith(path, "\\") == true) { path.erase(path.begin(),path.begin()+1); @@ -1587,6 +1594,11 @@ void restoreVideoMode(bool exitingApp) { //SDL_Quit(); + if(exitingApp == true && SDL_WasInit(SDL_INIT_VIDEO)) { + SDL_ShowCursor(1); + SDL_WM_GrabInput(SDL_GRAB_OFF); + SDL_SetGamma(1, 1, 1); + } } int getScreenW() { diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/platform/posix/ircclient.cpp megaglest-3.6.0.3/source/shared_lib/sources/platform/posix/ircclient.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/platform/posix/ircclient.cpp 2011-12-03 01:19:54.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/platform/posix/ircclient.cpp 2012-01-23 20:36:15.000000000 +0000 @@ -15,6 +15,11 @@ #include "platform_common.h" #include "libircclient.h" +// upstream moved some defines into new headers as of 1.6 +#ifndef LIBIRCCLIENT_PRE1_6 +#include "libirc_rfcnumeric.h" +#endif + #include #include #include diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/platform/posix/socket.cpp megaglest-3.6.0.3/source/shared_lib/sources/platform/posix/socket.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/platform/posix/socket.cpp 2011-12-02 17:46:02.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/platform/posix/socket.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -313,7 +313,7 @@ // class Socket // =============================================== -#if defined(__FreeBSD__) || defined(BSD) || defined(__APPLE__) || defined(__linux__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(BSD) || defined(__APPLE__) || defined(__linux__) # define USE_GETIFADDRS 1 # include #endif @@ -768,7 +768,7 @@ bool Socket::isSocketValid(const PLATFORM_SOCKET *validateSocket) { #ifdef WIN32 - if(validateSocket == NULL) { + if(validateSocket == NULL || (*validateSocket) == 0) { return false; } else { @@ -959,6 +959,8 @@ MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE); MutexSafeWrapper safeMutex1(dataSynchAccessorWrite,CODE_AT_LINE); + + if(isSocketValid() == true) { ::shutdown(sock,2); #ifndef WIN32 ::close(sock); @@ -967,6 +969,7 @@ ::closesocket(sock); sock = -1; #endif + } safeMutex.ReleaseLock(); safeMutex1.ReleaseLock(); } @@ -985,6 +988,7 @@ fd_set rfds; FD_ZERO(&rfds); + string socketDebugList = ""; PLATFORM_SOCKET imaxsocket = 0; for(std::map::iterator itermap = socketTriggeredList.begin(); itermap != socketTriggeredList.end(); ++itermap) @@ -994,6 +998,11 @@ { FD_SET(socket, &rfds); imaxsocket = max(socket,imaxsocket); + + if(socketDebugList != "") { + socketDebugList += ","; + } + socketDebugList += intToStr(socket); } } @@ -1012,7 +1021,7 @@ } if(retval < 0) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] ERROR SELECTING SOCKET DATA retval = %d error = %s\n",__FILE__,__FUNCTION__,retval,getLastSocketErrorFormattedText().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d, ERROR SELECTING SOCKET DATA retval = %d error = %s, socketDebugList [%s]\n",__FILE__,__FUNCTION__,__LINE__,retval,getLastSocketErrorFormattedText().c_str(),socketDebugList.c_str()); } else if(retval) { @@ -1147,7 +1156,8 @@ #else int err= ioctlsocket(sock, FIONREAD, &size); #endif - if(err < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) + int lastSocketError = getLastSocketError(); + if(err < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR PEEKING SOCKET DATA, err = %d %s\n",__FILE__,__FUNCTION__,__LINE__,err,getLastSocketErrorFormattedText().c_str()); break; @@ -1201,11 +1211,13 @@ MutexSafeWrapper safeMutex(dataSynchAccessorWrite,CODE_AT_LINE); + if(isSocketValid() == true) { #ifdef __APPLE__ bytesSent = ::send(sock, (const char *)data, dataSize, SO_NOSIGPIPE); #else bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL | MSG_DONTWAIT); #endif + } safeMutex.ReleaseLock(); } @@ -1213,15 +1225,16 @@ //bytesSent = -1; // END TEST - if(bytesSent < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR WRITING SOCKET DATA, err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesSent,getLastSocketErrorFormattedText().c_str()); + int lastSocketError = getLastSocketError(); + if(bytesSent < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) { + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR WRITING SOCKET DATA, err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesSent,getLastSocketErrorFormattedText(&lastSocketError).c_str()); } - else if(bytesSent < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN && isConnected() == true) { + else if(bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN && isConnected() == true) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during send, trying again...\n",__FILE__,__FUNCTION__,__LINE__); int attemptCount = 0; time_t tStartTimer = time(NULL); - while((bytesSent < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) && + while((bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) && (difftime(time(NULL),tStartTimer) <= MAX_SEND_WAIT_SECONDS)) { attemptCount++; if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount); @@ -1243,7 +1256,8 @@ #else bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL | MSG_DONTWAIT); #endif - if(bytesSent < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) { + lastSocketError = getLastSocketError(); + if(bytesSent < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) { break; } @@ -1264,13 +1278,16 @@ } if(isConnected() == true && bytesSent > 0 && bytesSent < dataSize) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] need to send more data, trying again getLastSocketError() = %d, bytesSent = %d, dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,getLastSocketError(),bytesSent,dataSize); + lastSocketError = getLastSocketError(); + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] need to send more data, trying again getLastSocketError() = %d, bytesSent = %d, dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,lastSocketError,bytesSent,dataSize); int totalBytesSent = bytesSent; int attemptCount = 0; + + time_t tStartTimer = time(NULL); while(((bytesSent > 0 && totalBytesSent < dataSize) || - (bytesSent < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN)) && + (bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN)) && (difftime(time(NULL),tStartTimer) <= MAX_SEND_WAIT_SECONDS)) { attemptCount++; if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, totalBytesSent = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,totalBytesSent); @@ -1293,11 +1310,12 @@ #else bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, MSG_NOSIGNAL | MSG_DONTWAIT); #endif + lastSocketError = getLastSocketError(); if(bytesSent > 0) { totalBytesSent += bytesSent; } - if(bytesSent < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) { + if(bytesSent < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) { break; } @@ -1352,17 +1370,20 @@ // safeMutexSocketDestructorFlag.ReleaseLock(); MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE); - bytesReceived = recv(sock, reinterpret_cast(data), dataSize, 0); + if(isSocketValid() == true) { + bytesReceived = recv(sock, reinterpret_cast(data), dataSize, 0); + } safeMutex.ReleaseLock(); } - if(bytesReceived < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] ERROR READING SOCKET DATA error while sending socket data, bytesSent = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesReceived,getLastSocketErrorFormattedText().c_str()); + int lastSocketError = getLastSocketError(); + if(bytesReceived < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) { + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] ERROR READING SOCKET DATA error while sending socket data, bytesSent = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesReceived,getLastSocketErrorFormattedText(&lastSocketError).c_str()); } - else if(bytesReceived < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) { + else if(bytesReceived < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during receive, trying again...\n",__FILE__,__FUNCTION__,__LINE__); time_t tStartTimer = time(NULL); - while((bytesReceived < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) && + while((bytesReceived < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) && (difftime(time(NULL),tStartTimer) <= MAX_RECV_WAIT_SECONDS)) { if(isConnected() == false) { int iErr = getLastSocketError(); @@ -1382,6 +1403,7 @@ MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE); bytesReceived = recv(sock, reinterpret_cast(data), dataSize, 0); + lastSocketError = getLastSocketError(); safeMutex.ReleaseLock(); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #2 EAGAIN during receive, trying again returned: %d\n",__FILE__,__FUNCTION__,__LINE__,bytesReceived); @@ -1442,8 +1464,9 @@ MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE); //if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis()); - - err = recv(sock, reinterpret_cast(data), dataSize, MSG_PEEK); + if(isSocketValid() == true) { + err = recv(sock, reinterpret_cast(data), dataSize, MSG_PEEK); + } safeMutex.ReleaseLock(); //printf("Peek #1 err = %d\n",err); @@ -1452,17 +1475,18 @@ } //if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis()); - if(err < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) { + int lastSocketError = getLastSocketError(); + if(err < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] ERROR PEEKING SOCKET DATA error while sending socket data, err = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,err,getLastSocketErrorFormattedText().c_str()); disconnectSocket(); } - else if(err < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN && mustGetData == true) { + else if(err < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN && mustGetData == true) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 ERROR EAGAIN during peek, trying again...\n",__FILE__,__FUNCTION__,__LINE__); //printf("Peek #2 err = %d\n",err); time_t tStartTimer = time(NULL); - while((err < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) && + while((err < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) && (difftime(time(NULL),tStartTimer) <= MAX_PEEK_WAIT_SECONDS)) { /* if(isConnected() == false) { @@ -1484,6 +1508,7 @@ //MutexSafeWrapper safeMutex(&dataSynchAccessor,CODE_AT_LINE + "_" + intToStr(sock) + "_" + intToStr(dataSize)); MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE); err = recv(sock, reinterpret_cast(data), dataSize, MSG_PEEK); + lastSocketError = getLastSocketError(); safeMutex.ReleaseLock(); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) if(chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis()); @@ -1498,8 +1523,9 @@ if(err <= 0) { //printf("Peek #3 err = %d\n",err); - if(mustGetData == true || getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) { - int iErr = getLastSocketError(); + lastSocketError = getLastSocketError(); + if(mustGetData == true || lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) { + int iErr = lastSocketError; disconnectSocket(); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] DISCONNECTED SOCKET error while peeking socket data, err = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,err,getLastSocketErrorFormattedText(&iErr).c_str()); @@ -1761,8 +1787,9 @@ if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #2 Error connecting socket for IP: %s for Port: %d err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,ip.getString().c_str(),port,err,getLastSocketErrorFormattedText().c_str()); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] #2 Error connecting socket for IP: %s for Port: %d err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,ip.getString().c_str(),port,err,getLastSocketErrorFormattedText().c_str()); - if (getLastSocketError() == PLATFORM_SOCKET_INPROGRESS || - getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) { + int lastSocketError = getLastSocketError(); + if (lastSocketError == PLATFORM_SOCKET_INPROGRESS || + lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) { fd_set myset; struct timeval tv; int valopt=0; @@ -1781,10 +1808,11 @@ { MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE); err = select((int)sock + 1, NULL, &myset, NULL, &tv); + lastSocketError = getLastSocketError(); //safeMutex.ReleaseLock(); } - if (err < 0 && getLastSocketError() != PLATFORM_SOCKET_INTERRUPTED) { + if (err < 0 && lastSocketError != PLATFORM_SOCKET_INTERRUPTED) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] Error connecting %s\n",__FILE__,__FUNCTION__,__LINE__,getLastSocketErrorFormattedText().c_str()); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Error connecting %s\n",__FILE__,__FUNCTION__,__LINE__,getLastSocketErrorFormattedText().c_str()); @@ -1900,7 +1928,7 @@ #else setsockopt(bcfd, SOL_SOCKET, SO_REUSEADDR, (char *)&val, sizeof(val)); #endif - if(bind( bcfd, (struct sockaddr *)&bcaddr, sizeof(bcaddr) ) < 0 ) { + if(::bind( bcfd, (struct sockaddr *)&bcaddr, sizeof(bcaddr) ) < 0 ) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"bind failed: %s\n", getLastSocketErrorFormattedText().c_str()); } else { @@ -2189,9 +2217,14 @@ } } -Socket *ServerSocket::accept() { +Socket *ServerSocket::accept(bool errorOnFail) { if(isSocketValid() == false) { - throwException("socket is invalid!"); + if(errorOnFail == true) { + throwException("socket is invalid!"); + } + else { + return NULL; + } } struct sockaddr_in cli_addr; @@ -2206,11 +2239,16 @@ sprintf(szBuf, "In [%s::%s Line: %d] Error accepting socket connection sock = %d, err = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,sock,newSock,getLastSocketErrorFormattedText().c_str()); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf); - if(getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) - { + int lastSocketError = getLastSocketError(); + if(lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) { + return NULL; + } + if(errorOnFail == true) { + throwException(szBuf); + } + else { return NULL; } - throwException(szBuf); } else { diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/platform/sdl/gl_wrap.cpp megaglest-3.6.0.3/source/shared_lib/sources/platform/sdl/gl_wrap.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/platform/sdl/gl_wrap.cpp 2011-12-15 11:16:14.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/platform/sdl/gl_wrap.cpp 2012-01-24 07:39:16.000000000 +0000 @@ -77,11 +77,11 @@ #ifndef WIN32 string mg_icon_file = ""; #if defined(CUSTOM_DATA_INSTALL_PATH_VALUE) - if(fileExists(CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.png")) { - mg_icon_file = CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.png"; + if(fileExists(formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.png")) { + mg_icon_file = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.png"; } - else if(fileExists(CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.bmp")) { - mg_icon_file = CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.bmp"; + else if(fileExists(formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.bmp")) { + mg_icon_file = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.bmp"; } #endif @@ -137,13 +137,14 @@ //uint32 colorkey = SDL_MapRGB(icon->format, 255, 0, 255); //SDL_SetColorKey(icon, SDL_SRCCOLORKEY, colorkey); + SDL_SetColorKey(icon, SDL_SRCCOLORKEY, SDL_MapRGB(icon->format, 255, 0, 255)); SDL_WM_SetIcon(icon, NULL); } } #endif - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to set resolution: %d x %d, colorBits = %d.\n",__FILE__,__FUNCTION__,__LINE__,resW,resH,colorBits); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to set resolution: %d x %d, colorBits = %d.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,resW,resH,colorBits); if(screen != NULL) { SDL_FreeSurface(screen); @@ -159,8 +160,8 @@ << "bpp " << stencilBits << " stencil " << depthBits << " depth-buffer). SDL Error is: " << SDL_GetError(); - if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,msg.str().c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,msg.str().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,msg.str().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,msg.str().c_str()); for(int i = 32; i >= 8; i-=8) { // try different color bits @@ -201,15 +202,15 @@ SDL_WM_GrabInput(SDL_GRAB_OFF); GLuint err = glewInit(); - if (GLEW_OK != err) { - fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err)); - //return 1; - throw std::runtime_error((char *)glewGetErrorString(err)); + if (GLEW_OK != err) { + fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err)); + //return 1; + throw std::runtime_error((char *)glewGetErrorString(err)); } //fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION)); int bufferSize = (resW * resH * BaseColorPickEntity::COLOR_COMPONENTS); - BaseColorPickEntity::init(bufferSize); + BaseColorPickEntity::init(bufferSize); } } diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/platform/sdl/window.cpp megaglest-3.6.0.3/source/shared_lib/sources/platform/sdl/window.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/platform/sdl/window.cpp 2011-12-03 08:17:49.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/platform/sdl/window.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -128,7 +128,7 @@ case SDL_MOUSEBUTTONUP: case SDL_MOUSEMOTION: - //printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__); + //printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); codeLocation = "d"; setLastMouseEvent(Chrono::getCurMillis()); @@ -140,21 +140,21 @@ switch(event.type) { case SDL_QUIT: - //printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__); + //printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); codeLocation = "e"; return false; case SDL_MOUSEBUTTONDOWN: - //printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__); + //printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); codeLocation = "f"; if(global_window) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); global_window->handleMouseDown(event); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); } break; case SDL_MOUSEBUTTONUP: { - //printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__); + //printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); codeLocation = "g"; if(global_window) { MouseButton b = getMouseButton(event.button.button); @@ -166,7 +166,7 @@ break; } case SDL_MOUSEMOTION: { - //printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__); + //printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); //MouseState ms; //ms.leftMouse = (event.motion.state & SDL_BUTTON_LMASK) != 0; //ms.rightMouse = (event.motion.state & SDL_BUTTON_RMASK) != 0; @@ -183,11 +183,11 @@ break; } case SDL_KEYDOWN: - //printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__); + //printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); { - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== START OF SDL SDL_KEYDOWN ================================\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== START OF SDL SDL_KEYDOWN ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); codeLocation = "i"; Window::isKeyPressedDown = true; @@ -198,20 +198,20 @@ keystate = event.key.keysym; string keyName = SDL_GetKeyName(event.key.keysym.sym); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Raw SDL key [%d - %c] mod [%d] unicode [%d - %c] scancode [%d] keyName [%s]\n",__FILE__,__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.unicode,event.key.keysym.scancode,keyName.c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Raw SDL key [%d] mod [%d] unicode [%d] scancode [%d] keyName [%s]\n",__FILE__,__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.scancode,keyName.c_str()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Raw SDL key [%d - %c] mod [%d] unicode [%d - %c] scancode [%d] keyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.unicode,event.key.keysym.scancode,keyName.c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Raw SDL key [%d] mod [%d] unicode [%d] scancode [%d] keyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.scancode,keyName.c_str()); /* handle ALT+Return */ if((keyName == "return" || keyName == "enter") && (event.key.keysym.mod & (KMOD_LALT | KMOD_RALT))) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] SDLK_RETURN pressed.\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] SDLK_RETURN pressed.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); toggleFullscreen(); } #ifdef WIN32 /* handle ALT+f4 */ if((keyName == "f4" || keyName == "F4") && (event.key.keysym.mod & (KMOD_LALT | KMOD_RALT))) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] ALT-F4 pressed.\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] ALT-F4 pressed.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); return false; } #endif @@ -224,17 +224,17 @@ global_window->eventKeyDown(event.key); global_window->eventKeyPress(event.key); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); } - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== END OF SDL SDL_KEYDOWN ================================\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== END OF SDL SDL_KEYDOWN ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); } break; case SDL_KEYUP: - //printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__); + //printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== START OF SDL SDL_KEYUP ================================\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== START OF SDL SDL_KEYUP ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); codeLocation = "j"; @@ -246,7 +246,7 @@ keystate = event.key.keysym; - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] KEY_UP, Raw SDL key [%d] mod [%d] unicode [%d] scancode [%d]\n",__FILE__,__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.scancode); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] KEY_UP, Raw SDL key [%d] mod [%d] unicode [%d] scancode [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.scancode); if(global_window) { //char key = getKey(event.key.keysym,true); @@ -254,15 +254,15 @@ global_window->eventKeyUp(event.key); } - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== END OF SDL SDL_KEYUP ================================\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== END OF SDL SDL_KEYUP ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); break; case SDL_ACTIVEEVENT: { // codeLocation = "k"; -// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",__FILE__,__FUNCTION__,__LINE__,event.active.state,event.active.gain); +// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.active.state,event.active.gain); // -// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state); +// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive,event.active.state); // // // Check if the program has lost window focus // if ((event.active.state & SDL_APPACTIVE) == SDL_APPACTIVE) { @@ -273,9 +273,9 @@ // Window::isActive = true; // } // -// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",__FILE__,__FUNCTION__,__LINE__,Window::isActive); +// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive); // -// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive); +// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive); // // bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly()); // showCursor(willShowCursor); @@ -292,18 +292,18 @@ // Window::isActive = true; // } // -// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",__FILE__,__FUNCTION__,__LINE__,Window::isActive); +// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive); // -// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state); +// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive,event.active.state); // bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly()); // showCursor(willShowCursor); // } // } codeLocation = "k"; - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",__FILE__,__FUNCTION__,__LINE__,event.active.state,event.active.gain); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.active.state,event.active.gain); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive,event.active.state); // Check if the program has lost window focus if ((event.active.state & (SDL_APPACTIVE | SDL_APPINPUTFOCUS))) { @@ -314,9 +314,9 @@ Window::isActive = true; } - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",__FILE__,__FUNCTION__,__LINE__,Window::isActive); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive); bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly()); showCursor(willShowCursor); @@ -326,22 +326,22 @@ } } catch(const char *e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e,codeLocation.c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e,codeLocation.c_str()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e,codeLocation.c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e,codeLocation.c_str()); throw runtime_error(e); } catch(const std::runtime_error& e) { - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),codeLocation.c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),codeLocation.c_str()); throw runtime_error(e.what()); } catch(const std::exception& e) { - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),codeLocation.c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),codeLocation.c_str()); } catch(...) { - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,codeLocation.c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,codeLocation.c_str()); } } @@ -443,7 +443,7 @@ // setup LOD bias factor //const float lodBias = std::max(std::min( configHandler->Get("TextureLODBias", 0.0f) , 4.0f), -4.0f); const float lodBias = max(min(0.0f,4.0f),-4.0f); - //if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("\n\n\n\n\n$$$$ In [%s::%s Line: %d] lodBias = %f\n\n",__FILE__,__FUNCTION__,__LINE__,lodBias); + //if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("\n\n\n\n\n$$$$ In [%s::%s Line: %d] lodBias = %f\n\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,lodBias); #ifdef USE_STREFLOP if (streflop::fabs(lodBias) > 0.01f) { #else @@ -455,7 +455,7 @@ } void Window::toggleFullscreen() { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); Window::isFullScreen = !Window::isFullScreen; #ifdef WIN32 @@ -486,14 +486,14 @@ if ( (!surface) || (!(*surface)) ) // don't bother if there's no surface. return; - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); tmpflags = (*surface)->flags; w = (*surface)->w; h = (*surface)->h; bpp = (*surface)->format->BitsPerPixel; - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n w = %d, h = %d, bpp = %d",__FILE__,__FUNCTION__,__LINE__,w,h,bpp); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n w = %d, h = %d, bpp = %d",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,w,h,bpp); if (flags == NULL) // use the surface's flags. flags = &tmpflags; @@ -507,16 +507,16 @@ SDL_GetClipRect(*surface, &clip); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); *surface = SDL_SetVideoMode(w, h, bpp, (*flags)); if (*surface == NULL) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); *surface = SDL_SetVideoMode(w, h, bpp, tmpflags); } // if - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); SDL_SetClipRect(*surface, &clip); } @@ -524,14 +524,14 @@ else { HWND handle = GetSDLWindow(); if(Window::isFullScreen == true) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == true [%d]\n",__FILE__,__FUNCTION__,__LINE__,handle); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == true [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,handle); ShowWindow(handle, SW_MAXIMIZE); //if(Window::getUseDefaultCursorOnly() == false) { // showCursor(false); //} } else { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == false [%d]\n",__FILE__,__FUNCTION__,__LINE__,handle); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == false [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,handle); ShowWindow(handle, SW_RESTORE); //showCursor(true); } @@ -539,31 +539,31 @@ #else if(Window::allowAltEnterFullscreenToggle == true) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) { SDL_Surface *cur_surface = SDL_GetVideoSurface(); if(cur_surface != NULL) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); SDL_WM_ToggleFullScreen(cur_surface); } } - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); } #endif - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); } void Window::handleMouseDown(SDL_Event event) { static const Uint32 DOUBLECLICKTIME = 500; static const int DOUBLECLICKDELTA = 5; - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); MouseButton button = getMouseButton(event.button.button); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // windows implementation uses 120 for the resolution of a standard mouse // wheel notch. However, newer mice have finer resolutions. I dunno if SDL @@ -579,35 +579,35 @@ return; } - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); Uint32 ticks = SDL_GetTicks(); int n = (int) button; assert(n >= 0 && n < mbCount); if(n >= 0 && n < mbCount) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); if(ticks - lastMouseDown[n] < DOUBLECLICKTIME && abs(lastMouseX[n] - event.button.x) < DOUBLECLICKDELTA && abs(lastMouseY[n] - event.button.y) < DOUBLECLICKDELTA) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); eventMouseDown(event.button.x, event.button.y, button); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); eventMouseDoubleClick(event.button.x, event.button.y, button); } else { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); eventMouseDown(event.button.x, event.button.y, button); } - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); lastMouseDown[n] = ticks; lastMouseX[n] = event.button.x; lastMouseY[n] = event.button.y; - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); } } @@ -625,7 +625,7 @@ return mbWheelDown; default: //throw std::runtime_error("Mouse Button > 3 not handled."); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Mouse Button [%d] not handled.\n",__FILE__,__FUNCTION__,__LINE__,sdlButton); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Mouse Button [%d] not handled.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,sdlButton); return mbUnknown; } @@ -637,16 +637,16 @@ if(input.keysym.unicode > 0) { string unicodeKeyName = SDL_GetKeyName((SDLKey)input.keysym.unicode); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",__FILE__,__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",__FILE__,__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str()); // When modifiers are pressed the unicode result is wrong // example CTRL-3 will give the ESCAPE vslue 27 in unicode if( !(input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) && !(input.keysym.mod & (KMOD_LALT | KMOD_RALT)) && !(input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) ) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); c = input.keysym.unicode; //c = toupper(c); @@ -674,38 +674,40 @@ input.keysym.unicode == SDLK_COMMA || input.keysym.unicode == SDLK_MINUS || input.keysym.unicode == SDLK_PERIOD || - input.keysym.unicode == SDLK_SLASH)) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + input.keysym.unicode == SDLK_SLASH || + // Need to allow Shift + # key for AZERTY style keyboards + (input.keysym.unicode >= SDLK_0 && input.keysym.unicode <= SDLK_9))) { + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); c = input.keysym.unicode; } else if(input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); if( (input.keysym.unicode >= SDLK_0 && input.keysym.unicode <= SDLK_9) || (input.keysym.unicode >= SDLK_KP0 && input.keysym.unicode <= SDLK_KP9)) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); c = input.keysym.unicode; } } - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF)); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF)); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF)); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF)); } //if(c == 0) { if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) { c = input.keysym.sym; } - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d]\n",__FILE__,__FUNCTION__,__LINE__,c); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); //c = (c & 0xFF); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); // SDL does NOT handle lowercase if(c >= 'A' && c <= 'Z') { @@ -806,20 +808,20 @@ if( input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL) || input.keysym.mod & (KMOD_LALT | KMOD_RALT)) { //input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) { - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] result *WOULD HAVE BEEN TRUE* but is false due to: modifiersAllowed = %d input.keysym.mod = %d\n",__FILE__,__FUNCTION__,__LINE__,modifiersAllowed,input.keysym.mod); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] result *WOULD HAVE BEEN TRUE* but is false due to: modifiersAllowed = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,modifiersAllowed,input.keysym.mod); result = false; } } string compareKeyName = SDL_GetKeyName(compareKey); string pressKeyName = SDL_GetKeyName((SDLKey)c); - //printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result); + //printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result); //printf ("ISPRESS compareKey [%d - %s] pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d result = %d\n", // compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod,result); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result); return result; } @@ -828,7 +830,7 @@ wchar_t c = SDLK_UNKNOWN; //if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) { if(input.keysym.unicode > 0) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",__FILE__,__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod); c = input.keysym.unicode; // if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) { @@ -837,18 +839,18 @@ //c = toupper(c); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF),c); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF),c); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF),c); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF),c); } if(c == SDLK_UNKNOWN) { c = input.keysym.sym; } - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d][%lc]\n",__FILE__,__FUNCTION__,__LINE__,c); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d][%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); //c = (SDLKey)(c & 0xFF); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); string pressKeyName = SDL_GetKeyName((SDLKey)c); string inputKeyName = SDL_GetKeyName(input.keysym.sym); @@ -856,8 +858,8 @@ //printf ("PRESS pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d\n", // c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",__FILE__,__FUNCTION__,__LINE__,c,pressKeyName.c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",__FILE__,__FUNCTION__,__LINE__,c,pressKeyName.c_str()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str()); return c; } @@ -866,7 +868,7 @@ SDLKey c = SDLK_UNKNOWN; //if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) { if(input.keysym.unicode > 0) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",__FILE__,__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod); c = (SDLKey)input.keysym.unicode; // if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) { @@ -875,18 +877,18 @@ //c = toupper(c); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF)); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF)); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF)); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF)); } if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) { c = input.keysym.sym; } - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d]\n",__FILE__,__FUNCTION__,__LINE__,c); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); //c = (SDLKey)(c & 0xFF); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); string pressKeyName = SDL_GetKeyName((SDLKey)c); string inputKeyName = SDL_GetKeyName(input.keysym.sym); @@ -894,8 +896,8 @@ //printf ("PRESS pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d\n", // c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",__FILE__,__FUNCTION__,__LINE__,c,pressKeyName.c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",__FILE__,__FUNCTION__,__LINE__,c,pressKeyName.c_str()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str()); return c; } @@ -954,8 +956,8 @@ key != SDLK_POWER); string inputKeyName = SDL_GetKeyName((SDLKey)key); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); return result; } @@ -1014,8 +1016,8 @@ key != SDLK_POWER); string inputKeyName = SDL_GetKeyName(key); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); return result; } diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/platform/win32/platform_util.cpp megaglest-3.6.0.3/source/shared_lib/sources/platform/win32/platform_util.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/platform/win32/platform_util.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/platform/win32/platform_util.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -257,7 +257,15 @@ HWND hwnd = wminfo.window; - ::SetClassLong(hwnd, GCL_HICON, (LONG) icon); +#ifdef __MINGW32__ + #define GCL_HICON -14 +#endif + +#ifndef __MINGW32__ + LONG iconPtr = (LONG)icon; + + ::SetClassLong(hwnd, GCL_HICON, iconPtr); +#endif } void done_win32() { ::DestroyIcon(icon); diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/streflop/CMakeLists.txt megaglest-3.6.0.3/source/shared_lib/sources/streflop/CMakeLists.txt --- megaglest-3.6.0.2/source/shared_lib/sources/streflop/CMakeLists.txt 2010-06-05 17:34:55.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/streflop/CMakeLists.txt 2012-01-23 07:22:43.000000000 +0000 @@ -13,7 +13,7 @@ SET(STREFLOP_SRC ${STREFLOP_GLOBBED_CPP}) # use SSE unconditionally (FIXME?) -SET_SOURCE_FILES_PROPERTIES(${STREFLOP_SRC} PROPERTIES COMPILE_FLAGS "-DSTREFLOP_SSE -DLIBM_COMPILING_FLT32 -O3 ${CXXFLAGS}") +#SET_SOURCE_FILES_PROPERTIES(${STREFLOP_SRC} PROPERTIES COMPILE_FLAGS "-DSTREFLOP_SSE -DLIBM_COMPILING_FLT32 -O3 ${CXXFLAGS}") ADD_LIBRARY(streflop STATIC EXCLUDE_FROM_ALL ${STREFLOP_SRC} diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/util/conversion.cpp megaglest-3.6.0.3/source/shared_lib/sources/util/conversion.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/util/conversion.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/util/conversion.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -136,16 +136,19 @@ } bool IsNumeric(const char *p, bool allowNegative) { - int index = 0; - for ( ; *p; p++) { - if (*p < '0' || *p > '9') { - if(allowNegative == false || (*p != '-' && index == 0)) { - return false; - } + if(p != NULL && strcmp(p,"-") == 0) { + return false; + } + int index = 0; + for ( ; *p; p++) { + if (*p < '0' || *p > '9') { + if(allowNegative == false || (*p != '-' && index == 0)) { + return false; + } + } + index++; } - index++; - } - return true; + return true; } class Comma: public numpunct// own facet class diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/util/properties.cpp megaglest-3.6.0.3/source/shared_lib/sources/util/properties.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/util/properties.cpp 2011-11-23 18:02:00.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/util/properties.cpp 2012-01-24 07:39:16.000000000 +0000 @@ -67,7 +67,7 @@ #endif if(fileStream.is_open() == false){ - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str()); throw runtime_error("File NOT FOUND, can't open file: [" + path + "]"); } @@ -190,11 +190,11 @@ //const wchar_t *wBuf = &szPath[0]; //size_t size = MAX_PATH + 1; - //char pMBBuffer[MAX_PATH + 1]=""; - //wcstombs_s(&size, &pMBBuffer[0], (size_t)size, wBuf, (size_t)size);// Convert to char* from TCHAR[] - //string appPath=""; - //appPath.assign(&pMBBuffer[0]); // Now assign the char* to the string, and there you have it!!! :) - std::string appPath = utf8_encode(szPath); + //char pMBBuffer[MAX_PATH + 1]=""; + //wcstombs_s(&size, &pMBBuffer[0], (size_t)size, wBuf, (size_t)size);// Convert to char* from TCHAR[] + //string appPath=""; + //appPath.assign(&pMBBuffer[0]); // Now assign the char* to the string, and there you have it!!! :) + std::string appPath = utf8_encode(szPath); //string appPath = szPath; mapTagReplacementValues["$APPDATA"] = appPath; @@ -215,20 +215,15 @@ mapTagReplacementValues["{APPLICATIONPATH}"] = Properties::applicationPath; #if defined(CUSTOM_DATA_INSTALL_PATH) - mapTagReplacementValues["$APPLICATIONDATAPATH"] = CUSTOM_DATA_INSTALL_PATH; - mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = CUSTOM_DATA_INSTALL_PATH; - mapTagReplacementValues["{APPLICATIONDATAPATH}"] = CUSTOM_DATA_INSTALL_PATH; - - //mapTagReplacementValues["$COMMONDATAPATH", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/"); - //mapTagReplacementValues["%%COMMONDATAPATH%%", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/"); + mapTagReplacementValues["$APPLICATIONDATAPATH"] = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)); + mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)); + mapTagReplacementValues["{APPLICATIONDATAPATH}"] = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)); #else mapTagReplacementValues["$APPLICATIONDATAPATH"] = Properties::applicationPath; mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = Properties::applicationPath; mapTagReplacementValues["{APPLICATIONDATAPATH}"] = Properties::applicationPath; - //mapTagReplacementValues["$COMMONDATAPATH", Properties::applicationPath + "/commondata/"); - //mapTagReplacementValues["%%COMMONDATAPATH%%", Properties::applicationPath + "/commondata/"); #endif mapTagReplacementValues["$GAMEVERSION"] = Properties::gameVersion; @@ -278,17 +273,17 @@ // For win32 we allow use of the appdata variable since that is the recommended // place for application data in windows platform #ifdef WIN32 - TCHAR szPath[MAX_PATH]; - // Get path for each computer, non-user specific and non-roaming data. - if ( SUCCEEDED( SHGetFolderPath( NULL, CSIDL_APPDATA, + TCHAR szPath[MAX_PATH]; + // Get path for each computer, non-user specific and non-roaming data. + if ( SUCCEEDED( SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, szPath))) { //const wchar_t *wBuf = &szPath[0]; //size_t size = MAX_PATH + 1; - //char pMBBuffer[MAX_PATH + 1]=""; - //wcstombs_s(&size, &pMBBuffer[0], (size_t)size, wBuf, (size_t)size);// Convert to char* from TCHAR[] - //string appPath=""; - //appPath.assign(&pMBBuffer[0]); // Now assign the char* to the string, and there you have it!!! :) - std::string appPath = utf8_encode(szPath); + //char pMBBuffer[MAX_PATH + 1]=""; + //wcstombs_s(&size, &pMBBuffer[0], (size_t)size, wBuf, (size_t)size);// Convert to char* from TCHAR[] + //string appPath=""; + //appPath.assign(&pMBBuffer[0]); // Now assign the char* to the string, and there you have it!!! :) + std::string appPath = utf8_encode(szPath); //string appPath = szPath; replaceAll(value, "$APPDATA", appPath); @@ -308,20 +303,15 @@ replaceAll(value, "{APPLICATIONPATH}", Properties::applicationPath); #if defined(CUSTOM_DATA_INSTALL_PATH) - replaceAll(value, "$APPLICATIONDATAPATH", CUSTOM_DATA_INSTALL_PATH); - replaceAll(value, "%%APPLICATIONDATAPATH%%", CUSTOM_DATA_INSTALL_PATH); - replaceAll(value, "{APPLICATIONDATAPATH}", CUSTOM_DATA_INSTALL_PATH); - - //replaceAll(value, "$COMMONDATAPATH", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/"); - //replaceAll(value, "%%COMMONDATAPATH%%", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/"); + replaceAll(value, "$APPLICATIONDATAPATH", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH))); + replaceAll(value, "%%APPLICATIONDATAPATH%%", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH))); + replaceAll(value, "{APPLICATIONDATAPATH}", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH))); #else replaceAll(value, "$APPLICATIONDATAPATH", Properties::applicationPath); replaceAll(value, "%%APPLICATIONDATAPATH%%", Properties::applicationPath); replaceAll(value, "{APPLICATIONDATAPATH}", Properties::applicationPath); - //replaceAll(value, "$COMMONDATAPATH", Properties::applicationPath + "/commondata/"); - //replaceAll(value, "%%COMMONDATAPATH%%", Properties::applicationPath + "/commondata/"); #endif replaceAll(value, "$GAMEVERSION", Properties::gameVersion); @@ -364,7 +354,7 @@ return strToBool(getString(key,defaultValueIfNotFound)); } catch(exception &e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); throw runtime_error("Error accessing value: " + key + " in: " + path+"\n[" + e.what() + "]"); } } @@ -374,7 +364,7 @@ return strToInt(getString(key,defaultValueIfNotFound)); } catch(exception &e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); } } @@ -392,7 +382,7 @@ return strToFloat(getString(key,defaultValueIfNotFound)); } catch(exception &e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); } } @@ -410,7 +400,7 @@ it= propertyMap.find(key); if(it==propertyMap.end()){ if(defaultValueIfNotFound != NULL) { - //printf("In [%s::%s - %d]defaultValueIfNotFound = [%s]\n",__FILE__,__FUNCTION__,__LINE__,defaultValueIfNotFound); + //printf("In [%s::%s - %d]defaultValueIfNotFound = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,defaultValueIfNotFound); return string(defaultValueIfNotFound); } else { @@ -456,7 +446,7 @@ return strToBool(getString(key,defaultValueIfNotFound)); } catch(exception &e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); throw runtime_error("Error accessing value: " + string(key) + " in: " + path+"\n[" + e.what() + "]"); } } @@ -466,7 +456,7 @@ return strToInt(getString(key,defaultValueIfNotFound)); } catch(exception &e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); } } @@ -476,7 +466,7 @@ return strToFloat(getString(key,defaultValueIfNotFound)); } catch(exception &e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what()); throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); } } @@ -486,7 +476,7 @@ it= propertyMap.find(key); if(it==propertyMap.end()){ if(defaultValueIfNotFound != NULL) { - //printf("In [%s::%s - %d]defaultValueIfNotFound = [%s]\n",__FILE__,__FUNCTION__,__LINE__,defaultValueIfNotFound); + //printf("In [%s::%s - %d]defaultValueIfNotFound = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,defaultValueIfNotFound); return string(defaultValueIfNotFound); } else { diff -Nru megaglest-3.6.0.2/source/shared_lib/sources/xml/xml_parser.cpp megaglest-3.6.0.3/source/shared_lib/sources/xml/xml_parser.cpp --- megaglest-3.6.0.2/source/shared_lib/sources/xml/xml_parser.cpp 2011-12-14 07:40:48.000000000 +0000 +++ megaglest-3.6.0.3/source/shared_lib/sources/xml/xml_parser.cpp 2012-01-23 07:22:43.000000000 +0000 @@ -70,7 +70,7 @@ XmlIo::initialized= true; } catch(const XMLException &e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error initializing XML system, msg %s\n",__FILE__,__FUNCTION__,__LINE__,e.getMessage()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error initializing XML system, msg %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.getMessage()); throw runtime_error("Error initializing XML system"); } @@ -81,7 +81,7 @@ implementation = DOMImplementationRegistry::getDOMImplementation(str); } catch(const DOMException &ex) { - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while creating XML parser, msg: %s\n",__FILE__,__FUNCTION__,__LINE__,ex.getMessage()); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while creating XML parser, msg: %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.getMessage()); throw runtime_error("Exception while creating XML parser"); } } @@ -135,7 +135,7 @@ return rootNode; } catch(const DOMException &ex) { - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while loading: [%s], %s\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(ex.msg)); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while loading: [%s], %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(ex.msg)); throw runtime_error("Exception while loading: " + path + ": " + XMLString::transcode(ex.msg)); } } @@ -170,7 +170,7 @@ document->release(); } catch(const DOMException &e){ - SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while saving: [%s], %s\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(e.msg)); + SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while saving: [%s], %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(e.msg)); throw runtime_error("Exception while saving: " + path + ": " + XMLString::transcode(e.msg)); } } @@ -191,6 +191,8 @@ static string loadStackCacheName = string(__FILE__) + string("_loadStackCacheName"); void XmlTree::load(const string &path, std::map mapTagReplacementValues) { + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str()); + //printf("XmlTree::load p [%p]\n",this); assert(!loadPath.size()); @@ -208,6 +210,8 @@ loadPath = path; this->rootNode= XmlIo::getInstance().load(path, mapTagReplacementValues); + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str()); } void XmlTree::save(const string &path){ diff -Nru megaglest-3.6.0.2/start_megaglest_configurator megaglest-3.6.0.3/start_megaglest_configurator --- megaglest-3.6.0.2/start_megaglest_configurator 2011-05-14 17:31:40.000000000 +0000 +++ megaglest-3.6.0.3/start_megaglest_configurator 2012-01-23 07:22:43.000000000 +0000 @@ -19,4 +19,4 @@ # export game library directory test -n "${LIBDIR}" && export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GAMEDIR}/${LIBDIR}" -./megaglest_configurator +./megaglest_configurator $@ diff -Nru megaglest-3.6.0.2/start_megaglest_g3dviewer megaglest-3.6.0.3/start_megaglest_g3dviewer --- megaglest-3.6.0.2/start_megaglest_g3dviewer 2011-12-20 01:51:38.000000000 +0000 +++ megaglest-3.6.0.3/start_megaglest_g3dviewer 2012-01-23 07:22:43.000000000 +0000 @@ -120,4 +120,4 @@ findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FUSION_LINKEDLIBNAME}" "$FUSION_LIBLOOKUP1" "$FUSION_LIBLOOKUP2" findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECT_LINKEDLIBNAME}" "$DIRECT_LIBLOOKUP1" "$DIRECT_LIBLOOKUP2" -"$GAMEDIR/megaglest_g3dviewer" "$1" +"$GAMEDIR/megaglest_g3dviewer" $@ diff -Nru megaglest-3.6.0.2/start_megaglest_mapeditor megaglest-3.6.0.3/start_megaglest_mapeditor --- megaglest-3.6.0.2/start_megaglest_mapeditor 2011-12-20 01:51:38.000000000 +0000 +++ megaglest-3.6.0.3/start_megaglest_mapeditor 2012-01-23 07:22:43.000000000 +0000 @@ -120,4 +120,4 @@ findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FUSION_LINKEDLIBNAME}" "$FUSION_LIBLOOKUP1" "$FUSION_LIBLOOKUP2" findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECT_LINKEDLIBNAME}" "$DIRECT_LIBLOOKUP1" "$DIRECT_LIBLOOKUP2" -"$GAMEDIR/megaglest_editor" "$1" +"$GAMEDIR/megaglest_editor" $@