diff --git a/CMakeLists.txt b/CMakeLists.txt
index 64584d3e7..1339fbcf6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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 @@ if (NOT ${XVFB_RUN} MATCHES "XVFB_RUN-NOTFOUND")
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 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
# 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 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
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 @@ IF(EXISTS "${PROJECT_SOURCE_DIR}/data/glest_game/")
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 --git a/mk/cmake/Modules/FindFTGL.cmake b/mk/cmake/Modules/FindFTGL.cmake
index eaa85f0e9..393111683 100644
--- a/mk/cmake/Modules/FindFTGL.cmake
+++ b/mk/cmake/Modules/FindFTGL.cmake
@@ -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 @@ IF(WANT_STATIC_LIBS)
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_LIBRARY_PATH)
+ message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Searching for FTGL lib in custom path: [${FTGL_LIBRARY_PATH}]")
+ ENDIF()
-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()
+ 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 --git a/mk/cmake/Modules/Toolchain-mingw32.cmake b/mk/cmake/Modules/Toolchain-mingw32.cmake
index 707cb00a5..9080a2603 100644
--- a/mk/cmake/Modules/Toolchain-mingw32.cmake
+++ b/mk/cmake/Modules/Toolchain-mingw32.cmake
@@ -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 --git a/mk/linux/mojosetup/megaglest-installer/makedeps_folder.sh b/mk/linux/mojosetup/megaglest-installer/makedeps_folder.sh
index 2eac1b51a..56df741ca 100755
--- a/mk/linux/mojosetup/megaglest-installer/makedeps_folder.sh
+++ b/mk/linux/mojosetup/megaglest-installer/makedeps_folder.sh
@@ -3,7 +3,7 @@ set -e
# Use this script to copy shared (libs) files to specified location
# ----------------------------------------------------------------------------
# Written by Vivek Gite
-# (c) 2006 nixCraft under GNU GPL v2.0+
+# Copyright (c) 2006 nixCraft under GNU GPL v2.0+
# Last updated on: Apr/06/2010 by Vivek Gite
# ----------------------------------------------------------------------------
# + Modified for megaglest deployment - Softcoder
diff --git a/mk/linux/start_megaglest_configurator b/mk/linux/start_megaglest_configurator
index 3d5370541..fe92e213b 100755
--- a/mk/linux/start_megaglest_configurator
+++ b/mk/linux/start_megaglest_configurator
@@ -19,4 +19,4 @@ cd $GAMEDIR
# export game library directory
test -n "${LIBDIR}" && export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GAMEDIR}/${LIBDIR}"
-./megaglest_configurator
+./megaglest_configurator $@
diff --git a/mk/linux/start_megaglest_g3dviewer b/mk/linux/start_megaglest_g3dviewer
index 7e50f1e91..ad58add73 100755
--- a/mk/linux/start_megaglest_g3dviewer
+++ b/mk/linux/start_megaglest_g3dviewer
@@ -120,4 +120,4 @@ findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECTFB_LINKEDLIBNAME}" "$DIRECTF
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 --git a/mk/linux/start_megaglest_mapeditor b/mk/linux/start_megaglest_mapeditor
index d70aa013d..d358424bc 100755
--- a/mk/linux/start_megaglest_mapeditor
+++ b/mk/linux/start_megaglest_mapeditor
@@ -120,4 +120,4 @@ findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECTFB_LINKEDLIBNAME}" "$DIRECTF
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" $@
diff --git a/mk/windoze/Glest.suo b/mk/windoze/Glest.suo
index 0a3a31606..3e63ed8b0 100644
Binary files a/mk/windoze/Glest.suo and b/mk/windoze/Glest.suo differ
diff --git a/source/configurator/configuration.cpp b/source/configurator/configuration.cpp
index 7c11e7fd8..63846dfee 100644
--- a/source/configurator/configuration.cpp
+++ b/source/configurator/configuration.cpp
@@ -16,6 +16,7 @@
#include "xml_parser.h"
#include "util.h"
#include "conversion.h"
+#include
#include"platform_util.h"
using namespace std;
diff --git a/source/configurator/main.cpp b/source/configurator/main.cpp
index dfa746ffe..63b186536 100644
--- a/source/configurator/main.cpp
+++ b/source/configurator/main.cpp
@@ -24,6 +24,7 @@
#include "util.h"
#include
#include
+#include
using namespace std;
using namespace Shared::PlatformCommon;
diff --git a/source/g3d_viewer/main.cpp b/source/g3d_viewer/main.cpp
index 887ce0ceb..356d88688 100644
--- a/source/g3d_viewer/main.cpp
+++ b/source/g3d_viewer/main.cpp
@@ -105,6 +105,7 @@ const wxChar *GAME_ARGS[] = {
wxT("--rotate-x-value"),
wxT("--rotate-y-value"),
wxT("--screenshot-format"),
+ wxT("--verbose"),
};
enum GAME_ARG_TYPE {
@@ -121,6 +122,7 @@ enum GAME_ARG_TYPE {
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 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
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 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
bool autoScreenShotAndExit = false;
vector autoScreenShotParams;
+std::pair overrideSize(0,0);
// ===============================================
// class MainWindow
@@ -291,6 +294,7 @@ MainWindow::MainWindow( std::pair > unitToLoad,
//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 @@ void MainWindow::onPaint(wxPaintEvent &event) {
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 @@ void MainWindow::onPaint(wxPaintEvent &event) {
}
renderer->renderParticleManager();
- glCanvas->SwapBuffers();
-
+
bool haveLoadedParticles = (particleProjectilePathList.empty() == false || particleSplashPathList.empty() == false);
if(autoScreenShotAndExit == true) {
@@ -629,7 +626,10 @@ void MainWindow::onPaint(wxPaintEvent &event) {
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 @@ void MainWindow::saveScreenshot() {
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 @@ void MainWindow::saveScreenshot() {
FILE *f= fopen(path.c_str(), "rb");
#endif
if(f == NULL) {
- renderer->saveScreen(path);
+ renderer->saveScreen(path,&overrideSize);
break;
}
else {
@@ -1095,10 +1095,11 @@ void MainWindow::loadUnit(string path, string skillName) {
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 @@ void MainWindow::loadParticle(string path) {
//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::loadParticle(string path) {
}
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 @@ void MainWindow::loadProjectileParticle(string path) {
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 @@ void MainWindow::loadProjectileParticle(string path) {
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 @@ void MainWindow::loadProjectileParticle(string path) {
// 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 @@ void MainWindow::loadProjectileParticle(string path) {
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 @@ void MainWindow::loadProjectileParticle(string path) {
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 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
// 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 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
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 @@ END_EVENT_TABLE()
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 @@ bool App::OnInit() {
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 @@ bool App::OnInit() {
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 --git a/source/g3d_viewer/renderer.cpp b/source/g3d_viewer/renderer.cpp
index 87b363053..efc9e66d5 100644
--- a/source/g3d_viewer/renderer.cpp
+++ b/source/g3d_viewer/renderer.cpp
@@ -21,6 +21,11 @@ using namespace Shared::Graphics::Gl;
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 @@ void Renderer::setAlphaColor(float alpha) {
//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 --git a/source/g3d_viewer/renderer.h b/source/g3d_viewer/renderer.h
index 48b533e77..ed58caff1 100644
--- a/source/g3d_viewer/renderer.h
+++ b/source/g3d_viewer/renderer.h
@@ -68,10 +68,10 @@ public:
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 @@ public:
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 --git a/source/glest_game/facilities/game_util.cpp b/source/glest_game/facilities/game_util.cpp
index 3119793ec..695c3b3db 100644
--- a/source/glest_game/facilities/game_util.cpp
+++ b/source/glest_game/facilities/game_util.cpp
@@ -27,7 +27,7 @@ using namespace Shared::Platform;
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)
diff --git a/source/glest_game/global/config.cpp b/source/glest_game/global/config.cpp
index cc9214f66..9f436b112 100644
--- a/source/glest_game/global/config.cpp
+++ b/source/glest_game/global/config.cpp
@@ -147,7 +147,7 @@ Config::Config(std::pair type, std::pair f
#if defined(CUSTOM_DATA_INSTALL_PATH)
if(foundPath == false) {
- foundPath = tryCustomPath(cfgType, fileName, CUSTOM_DATA_INSTALL_PATH);
+ foundPath = tryCustomPath(cfgType, fileName, TOSTRING(CUSTOM_DATA_INSTALL_PATH));
}
#endif
diff --git a/source/glest_game/global/core_data.cpp b/source/glest_game/global/core_data.cpp
index a24cc64ed..089efb11d 100644
--- a/source/glest_game/global/core_data.cpp
+++ b/source/glest_game/global/core_data.cpp
@@ -350,7 +350,7 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 @@ void CoreData::loadFonts() {
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 --git a/source/glest_game/global/lang.cpp b/source/glest_game/global/lang.cpp
index 5ba1793c7..5091f3e07 100644
--- a/source/glest_game/global/lang.cpp
+++ b/source/glest_game/global/lang.cpp
@@ -107,6 +107,15 @@ void Lang::loadStrings(string uselanguage, bool loadFonts,
#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 --git a/source/glest_game/graphics/particle_type.cpp b/source/glest_game/graphics/particle_type.cpp
index 109da64ba..c1aebdd3a 100644
--- a/source/glest_game/graphics/particle_type.cpp
+++ b/source/glest_game/graphics/particle_type.cpp
@@ -43,7 +43,8 @@ ParticleSystemType::ParticleSystemType() {
teamcolorNoEnergy=false;
teamcolorEnergy=false;
- alternations=false;
+ alternations=0;
+ particleSystemStartDelay=0;
texture=NULL;
model=NULL;
minmaxEnabled=false;
@@ -101,6 +102,7 @@ void ParticleSystemType::copyAll(const ParticleSystemType &src) {
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 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
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 @@ void ParticleSystemType::setValues(AttackParticleSystem *ats){
ats->setTeamcolorNoEnergy(teamcolorNoEnergy);
ats->setTeamcolorEnergy(teamcolorEnergy);
ats->setAlternations(alternations);
+ ats->setParticleSystemStartDelay(particleSystemStartDelay);
ats->setBlendMode(ParticleSystem::strToBlendMode(mode));
}
diff --git a/source/glest_game/graphics/particle_type.h b/source/glest_game/graphics/particle_type.h
index 62b37fc0f..6d3ecc7e6 100644
--- a/source/glest_game/graphics/particle_type.h
+++ b/source/glest_game/graphics/particle_type.h
@@ -69,6 +69,7 @@ protected:
bool teamcolorNoEnergy;
bool teamcolorEnergy;
int alternations;
+ int particleSystemStartDelay;
typedef std::list Children;
Children children;
diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp
index 140436435..f39167ed0 100644
--- a/source/glest_game/graphics/renderer.cpp
+++ b/source/glest_game/graphics/renderer.cpp
@@ -839,7 +839,7 @@ void Renderer::setupLighting() {
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 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
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 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
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 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
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 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
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 @@ template void _loadVBO(GLuint &vbo,std::vector buf,int target=GL_
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 @@ void Renderer::renderObjects(const int renderFps) {
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 @@ void Renderer::saveScreen(const string &path) {
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 @@ Vec4f Renderer::computeMoonPos(float time) {
#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 --git a/source/glest_game/graphics/renderer.h b/source/glest_game/graphics/renderer.h
index 849329988..b0603a30d 100644
--- a/source/glest_game/graphics/renderer.h
+++ b/source/glest_game/graphics/renderer.h
@@ -581,7 +581,6 @@ private:
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 --git a/source/glest_game/graphics/unit_particle_type.cpp b/source/glest_game/graphics/unit_particle_type.cpp
index cecbc1c05..d42fe8d83 100644
--- a/source/glest_game/graphics/unit_particle_type.cpp
+++ b/source/glest_game/graphics/unit_particle_type.cpp
@@ -40,8 +40,9 @@ UnitParticleSystemType::UnitParticleSystemType() : ParticleSystemType() {
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 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
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 @@ const void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
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 --git a/source/glest_game/graphics/unit_particle_type.h b/source/glest_game/graphics/unit_particle_type.h
index 00c4ef794..a3e500161 100644
--- a/source/glest_game/graphics/unit_particle_type.h
+++ b/source/glest_game/graphics/unit_particle_type.h
@@ -58,6 +58,7 @@ protected:
int staticParticleCount;
bool isVisibleAtNight;
bool isVisibleAtDay;
+ bool isDaylightAffected;
bool radiusBasedStartenergy;
int delay;
int lifetime;
diff --git a/source/glest_game/main/battle_end.cpp b/source/glest_game/main/battle_end.cpp
index 780843f82..7e6b88bb6 100644
--- a/source/glest_game/main/battle_end.cpp
+++ b/source/glest_game/main/battle_end.cpp
@@ -237,7 +237,7 @@ void BattleEnd::render() {
}
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 @@ void BattleEnd::render() {
}
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 @@ void BattleEnd::render() {
//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 --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp
index 346b5b5f5..a22265ed3 100644
--- a/source/glest_game/main/main.cpp
+++ b/source/glest_game/main/main.cpp
@@ -2459,7 +2459,7 @@ int glestMain(int argc, char** argv) {
#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",TOSTRING(CUSTOM_DATA_INSTALL_PATH));
#endif
const int knownArgCount = sizeof(GAME_ARGS) / sizeof(GAME_ARGS[0]);
@@ -3543,6 +3543,10 @@ int glestMain(int argc, char** argv) {
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 +3572,72 @@ int glestMain(int argc, char** argv) {
// 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 (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));
+ if(pollresult < 0) {
+ printf("pollresult = %d errno = %d [%s]\n",pollresult,pollerror,strerror(pollerror));
- cinfd[0].fd = fileno(stdin);
- cinfd[0].events = POLLIN;
- }
+ cinfd[0].fd = fileno(stdin);
+ cinfd[0].events = POLLIN;
+ }
#endif
+ }
}
}
//printf("looping\n");
diff --git a/source/glest_game/network/connection_slot.cpp b/source/glest_game/network/connection_slot.cpp
index 9f4e8afad..b464de8f8 100644
--- a/source/glest_game/network/connection_slot.cpp
+++ b/source/glest_game/network/connection_slot.cpp
@@ -385,9 +385,9 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
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 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
//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 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
//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 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
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::update(bool checkForNewClients,int lockedSlotIndex) {
}
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 @@ void ConnectionSlot::close() {
ready = false;
gotIntro = false;
+ connectedTime = 0;
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
}
diff --git a/source/glest_game/network/server_interface.cpp b/source/glest_game/network/server_interface.cpp
index 9a79d954c..c6ed6bc3c 100644
--- a/source/glest_game/network/server_interface.cpp
+++ b/source/glest_game/network/server_interface.cpp
@@ -1708,10 +1708,17 @@ bool ServerInterface::launchGame(const GameSettings *gameSettings) {
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::getOpenSlotCount() {
}
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::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);
+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) {
+ 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 --git a/source/glest_game/network/server_interface.h b/source/glest_game/network/server_interface.h
index fe28280ed..ec48d5a98 100644
--- a/source/glest_game/network/server_interface.h
+++ b/source/glest_game/network/server_interface.h
@@ -124,8 +124,9 @@ public:
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 --git a/source/glest_game/world/time_flow.cpp b/source/glest_game/world/time_flow.cpp
index d060dcf9c..8287f92e9 100644
--- a/source/glest_game/world/time_flow.cpp
+++ b/source/glest_game/world/time_flow.cpp
@@ -55,6 +55,7 @@ void TimeFlow::update() {
soundRenderer.stopAmbient(ambientSounds->getNight());
UnitParticleSystem::isNight=false;
}
+ UnitParticleSystem::lightColor=computeLightColor();
if((lastTime=dawn) || firstTime){
@@ -94,4 +95,35 @@ void TimeFlow::update() {
// return (this->time>=time) && (this->time