- cleanup of masterserver global flag
- attempt to cut down on resources required for masterserver mode to minimize RAM
This commit is contained in:
parent
ff14256dc5
commit
8bdf863636
|
@ -37,7 +37,7 @@ const int Logger::logLineCount= 15;
|
||||||
// ===================== PUBLIC ========================
|
// ===================== PUBLIC ========================
|
||||||
|
|
||||||
Logger::Logger() {
|
Logger::Logger() {
|
||||||
masterserverMode = false;
|
//masterserverMode = false;
|
||||||
string logs_path = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey);
|
string logs_path = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey);
|
||||||
if(logs_path != "") {
|
if(logs_path != "") {
|
||||||
fileName= logs_path + "log.txt";
|
fileName= logs_path + "log.txt";
|
||||||
|
@ -77,7 +77,7 @@ void Logger::add(const string str, bool renderScreen, const string statusText)
|
||||||
this->current= str;
|
this->current= str;
|
||||||
this->statusText = statusText;
|
this->statusText = statusText;
|
||||||
|
|
||||||
if(renderScreen == true && masterserverMode == false) {
|
if(renderScreen == true && GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
renderLoadingScreen();
|
renderLoadingScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ private:
|
||||||
bool cancelSelected;
|
bool cancelSelected;
|
||||||
GraphicButton buttonCancel;
|
GraphicButton buttonCancel;
|
||||||
|
|
||||||
bool masterserverMode;
|
//bool masterserverMode;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Logger();
|
Logger();
|
||||||
|
@ -60,7 +60,7 @@ private:
|
||||||
public:
|
public:
|
||||||
static Logger & getInstance();
|
static Logger & getInstance();
|
||||||
|
|
||||||
void setMasterserverMode(bool value) { masterserverMode = value; }
|
//void setMasterserverMode(bool value) { masterserverMode = value; }
|
||||||
|
|
||||||
void setFile(const string &fileName) {this->fileName= fileName;}
|
void setFile(const string &fileName) {this->fileName= fileName;}
|
||||||
void setState(const string &state) {this->state= state;}
|
void setState(const string &state) {this->state= state;}
|
||||||
|
|
|
@ -153,8 +153,8 @@ bool VisibleQuadContainerCache::enableFrustumCalcs = true;
|
||||||
|
|
||||||
// ==================== constructor and destructor ====================
|
// ==================== constructor and destructor ====================
|
||||||
|
|
||||||
Renderer::Renderer(bool masterserverMode) : BaseRenderer() {
|
Renderer::Renderer() : BaseRenderer() {
|
||||||
this->masterserverMode = masterserverMode;
|
//this->masterserverMode = masterserverMode;
|
||||||
//printf("this->masterserverMode = %d\n",this->masterserverMode);
|
//printf("this->masterserverMode = %d\n",this->masterserverMode);
|
||||||
//assert(0==1);
|
//assert(0==1);
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ Renderer::Renderer(bool masterserverMode) : BaseRenderer() {
|
||||||
gi.setFactory(fr.getGraphicsFactory(config.getString("FactoryGraphics")));
|
gi.setFactory(fr.getGraphicsFactory(config.getString("FactoryGraphics")));
|
||||||
GraphicsFactory *graphicsFactory= GraphicsInterface::getInstance().getFactory();
|
GraphicsFactory *graphicsFactory= GraphicsInterface::getInstance().getFactory();
|
||||||
|
|
||||||
if(this->masterserverMode == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
modelRenderer= graphicsFactory->newModelRenderer();
|
modelRenderer= graphicsFactory->newModelRenderer();
|
||||||
textRenderer= graphicsFactory->newTextRenderer2D();
|
textRenderer= graphicsFactory->newTextRenderer2D();
|
||||||
textRenderer3D = graphicsFactory->newTextRenderer3D();
|
textRenderer3D = graphicsFactory->newTextRenderer3D();
|
||||||
|
@ -220,7 +220,7 @@ Renderer::Renderer(bool masterserverMode) : BaseRenderer() {
|
||||||
|
|
||||||
//resources
|
//resources
|
||||||
for(int i=0; i< rsCount; ++i) {
|
for(int i=0; i< rsCount; ++i) {
|
||||||
if(this->masterserverMode == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
modelManager[i]= graphicsFactory->newModelManager();
|
modelManager[i]= graphicsFactory->newModelManager();
|
||||||
textureManager[i]= graphicsFactory->newTextureManager();
|
textureManager[i]= graphicsFactory->newTextureManager();
|
||||||
modelManager[i]->setTextureManager(textureManager[i]);
|
modelManager[i]->setTextureManager(textureManager[i]);
|
||||||
|
@ -322,14 +322,14 @@ bool Renderer::isEnded() {
|
||||||
return Renderer::rendererEnded;
|
return Renderer::rendererEnded;
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer &Renderer::getInstance(bool masterserverMode) {
|
Renderer &Renderer::getInstance() {
|
||||||
static Renderer renderer(masterserverMode);
|
static Renderer renderer;
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::reinitAll() {
|
void Renderer::reinitAll() {
|
||||||
//resources
|
//resources
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(int i=0; i<rsCount; ++i){
|
for(int i=0; i<rsCount; ++i){
|
||||||
|
@ -345,7 +345,7 @@ void Renderer::init() {
|
||||||
Config &config= Config::getInstance();
|
Config &config= Config::getInstance();
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ void Renderer::initGame(const Game *game, GameCamera *gameCamera) {
|
||||||
|
|
||||||
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",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ void Renderer::initMenu(const MainMenu *mm) {
|
||||||
|
|
||||||
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",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,7 +553,7 @@ void Renderer::endScenario() {
|
||||||
quadCache = VisibleQuadContainerCache();
|
quadCache = VisibleQuadContainerCache();
|
||||||
quadCache.clearFrustrumData();
|
quadCache.clearFrustrumData();
|
||||||
|
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,16 +586,24 @@ void Renderer::endGame(bool isFinalEnd) {
|
||||||
quadCache = VisibleQuadContainerCache();
|
quadCache = VisibleQuadContainerCache();
|
||||||
quadCache.clearFrustrumData();
|
quadCache.clearFrustrumData();
|
||||||
|
|
||||||
if(this->masterserverMode == true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isFinalEnd) {
|
if(isFinalEnd) {
|
||||||
//delete resources
|
//delete resources
|
||||||
modelManager[rsGame]->end();
|
if(modelManager[rsGame] != NULL) {
|
||||||
textureManager[rsGame]->end();
|
modelManager[rsGame]->end();
|
||||||
fontManager[rsGame]->end();
|
}
|
||||||
particleManager[rsGame]->end();
|
if(textureManager[rsGame] != NULL) {
|
||||||
|
textureManager[rsGame]->end();
|
||||||
|
}
|
||||||
|
if(fontManager[rsGame] != NULL) {
|
||||||
|
fontManager[rsGame]->end();
|
||||||
|
}
|
||||||
|
if(particleManager[rsGame] != NULL) {
|
||||||
|
particleManager[rsGame]->end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shadowMapHandleValid == true &&
|
if(shadowMapHandleValid == true &&
|
||||||
|
@ -617,10 +625,6 @@ void Renderer::endGame(bool isFinalEnd) {
|
||||||
void Renderer::endMenu() {
|
void Renderer::endMenu() {
|
||||||
this->menu = NULL;
|
this->menu = NULL;
|
||||||
|
|
||||||
if(this->masterserverMode == true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//delete resources
|
//delete resources
|
||||||
if(modelManager[rsMenu]) {
|
if(modelManager[rsMenu]) {
|
||||||
modelManager[rsMenu]->end();
|
modelManager[rsMenu]->end();
|
||||||
|
@ -635,6 +639,10 @@ void Renderer::endMenu() {
|
||||||
particleManager[rsMenu]->end();
|
particleManager[rsMenu]->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(this->customlist3dMenu != NULL) {
|
if(this->customlist3dMenu != NULL) {
|
||||||
glDeleteLists(*this->customlist3dMenu,1);
|
glDeleteLists(*this->customlist3dMenu,1);
|
||||||
}
|
}
|
||||||
|
@ -644,7 +652,7 @@ void Renderer::endMenu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::reloadResources() {
|
void Renderer::reloadResources() {
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,7 +672,7 @@ void Renderer::reloadResources() {
|
||||||
// ==================== engine interface ====================
|
// ==================== engine interface ====================
|
||||||
|
|
||||||
void Renderer::initTexture(ResourceScope rs, Texture *texture) {
|
void Renderer::initTexture(ResourceScope rs, Texture *texture) {
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,7 +684,7 @@ void Renderer::endTexture(ResourceScope rs, Texture *texture, bool mustExistInLi
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] free texture from manager [%s]\n",__FILE__,__FUNCTION__,__LINE__,textureFilename.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] free texture from manager [%s]\n",__FILE__,__FUNCTION__,__LINE__,textureFilename.c_str());
|
||||||
|
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,7 +701,7 @@ void Renderer::endTexture(ResourceScope rs, Texture *texture, bool mustExistInLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Renderer::endLastTexture(ResourceScope rs, bool mustExistInList) {
|
void Renderer::endLastTexture(ResourceScope rs, bool mustExistInList) {
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,7 +709,7 @@ void Renderer::endLastTexture(ResourceScope rs, bool mustExistInList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Model *Renderer::newModel(ResourceScope rs){
|
Model *Renderer::newModel(ResourceScope rs){
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,14 +717,14 @@ Model *Renderer::newModel(ResourceScope rs){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::endModel(ResourceScope rs, Model *model,bool mustExistInList) {
|
void Renderer::endModel(ResourceScope rs, Model *model,bool mustExistInList) {
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
modelManager[rs]->endModel(model,mustExistInList);
|
modelManager[rs]->endModel(model,mustExistInList);
|
||||||
}
|
}
|
||||||
void Renderer::endLastModel(ResourceScope rs, bool mustExistInList) {
|
void Renderer::endLastModel(ResourceScope rs, bool mustExistInList) {
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,7 +732,7 @@ void Renderer::endLastModel(ResourceScope rs, bool mustExistInList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture2D *Renderer::newTexture2D(ResourceScope rs){
|
Texture2D *Renderer::newTexture2D(ResourceScope rs){
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,7 +740,7 @@ Texture2D *Renderer::newTexture2D(ResourceScope rs){
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture3D *Renderer::newTexture3D(ResourceScope rs){
|
Texture3D *Renderer::newTexture3D(ResourceScope rs){
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +748,7 @@ Texture3D *Renderer::newTexture3D(ResourceScope rs){
|
||||||
}
|
}
|
||||||
|
|
||||||
Font2D *Renderer::newFont(ResourceScope rs){
|
Font2D *Renderer::newFont(ResourceScope rs){
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,7 +756,7 @@ Font2D *Renderer::newFont(ResourceScope rs){
|
||||||
}
|
}
|
||||||
|
|
||||||
Font3D *Renderer::newFont3D(ResourceScope rs){
|
Font3D *Renderer::newFont3D(ResourceScope rs){
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,7 +764,7 @@ Font3D *Renderer::newFont3D(ResourceScope rs){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::endFont(Font *font, ResourceScope rs, bool mustExistInList) {
|
void Renderer::endFont(Font *font, ResourceScope rs, bool mustExistInList) {
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,7 +814,7 @@ void Renderer::swapBuffers() {
|
||||||
|
|
||||||
//places all the opengl lights
|
//places all the opengl lights
|
||||||
void Renderer::setupLighting() {
|
void Renderer::setupLighting() {
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5785,7 +5793,7 @@ string Renderer::getGlInfo(){
|
||||||
string infoStr="";
|
string infoStr="";
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
|
|
||||||
if(this->masterserverMode == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
infoStr+= lang.get("OpenGlInfo")+":\n";
|
infoStr+= lang.get("OpenGlInfo")+":\n";
|
||||||
infoStr+= " "+lang.get("OpenGlVersion")+": ";
|
infoStr+= " "+lang.get("OpenGlVersion")+": ";
|
||||||
infoStr+= string((getGlVersion() != NULL ? getGlVersion() : "?"))+"\n";
|
infoStr+= string((getGlVersion() != NULL ? getGlVersion() : "?"))+"\n";
|
||||||
|
@ -5811,7 +5819,7 @@ string Renderer::getGlMoreInfo(){
|
||||||
string infoStr="";
|
string infoStr="";
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
|
|
||||||
if(this->masterserverMode == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
//gl extensions
|
//gl extensions
|
||||||
infoStr+= lang.get("OpenGlExtensions")+":\n ";
|
infoStr+= lang.get("OpenGlExtensions")+":\n ";
|
||||||
|
|
||||||
|
@ -5846,7 +5854,7 @@ string Renderer::getGlMoreInfo(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::autoConfig() {
|
void Renderer::autoConfig() {
|
||||||
if(this->masterserverMode == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
Config &config= Config::getInstance();
|
Config &config= Config::getInstance();
|
||||||
|
|
||||||
bool nvidiaCard= toLower(getGlVendor()).find("nvidia")!=string::npos;
|
bool nvidiaCard= toLower(getGlVendor()).find("nvidia")!=string::npos;
|
||||||
|
@ -5909,7 +5917,7 @@ void Renderer::loadConfig() {
|
||||||
Texture2D::Filter textureFilter= strToTextureFilter(config.getString("Filter"));
|
Texture2D::Filter textureFilter= strToTextureFilter(config.getString("Filter"));
|
||||||
int maxAnisotropy= config.getInt("FilterMaxAnisotropy");
|
int maxAnisotropy= config.getInt("FilterMaxAnisotropy");
|
||||||
|
|
||||||
if(this->masterserverMode == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
for(int i=0; i<rsCount; ++i){
|
for(int i=0; i<rsCount; ++i){
|
||||||
textureManager[i]->setFilter(textureFilter);
|
textureManager[i]->setFilter(textureFilter);
|
||||||
textureManager[i]->setMaxAnisotropy(maxAnisotropy);
|
textureManager[i]->setMaxAnisotropy(maxAnisotropy);
|
||||||
|
|
|
@ -300,7 +300,7 @@ private:
|
||||||
|
|
||||||
//std::map<Vec3f,Vec3f> worldToScreenPosCache;
|
//std::map<Vec3f,Vec3f> worldToScreenPosCache;
|
||||||
|
|
||||||
bool masterserverMode;
|
//bool masterserverMode;
|
||||||
|
|
||||||
std::map<uint32,VisibleQuadContainerVBOCache > mapSurfaceVBOCache;
|
std::map<uint32,VisibleQuadContainerVBOCache > mapSurfaceVBOCache;
|
||||||
|
|
||||||
|
@ -373,13 +373,13 @@ private:
|
||||||
bool CubeInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float size );
|
bool CubeInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float size );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Renderer(bool masterserverMode=false);
|
Renderer();
|
||||||
~Renderer();
|
~Renderer();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Renderer &getInstance(bool masterserverMode=false);
|
static Renderer &getInstance();
|
||||||
static bool isEnded();
|
static bool isEnded();
|
||||||
bool isMasterserverMode() const { return masterserverMode; }
|
//bool isMasterserverMode() const { return masterserverMode; }
|
||||||
|
|
||||||
void reinitAll();
|
void reinitAll();
|
||||||
|
|
||||||
|
|
|
@ -611,7 +611,7 @@ void Intro::renderModelBackground() {
|
||||||
|
|
||||||
void Intro::render() {
|
void Intro::render() {
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
if(renderer.isMasterserverMode() == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int difTime=0;
|
int difTime=0;
|
||||||
|
|
|
@ -103,7 +103,7 @@ static string application_binary="";
|
||||||
static string mg_app_name = "";
|
static string mg_app_name = "";
|
||||||
static string mailStringSupport = "";
|
static string mailStringSupport = "";
|
||||||
static bool sdl_quitCalled = false;
|
static bool sdl_quitCalled = false;
|
||||||
static bool isMasterServerModeEnabled = false;
|
//static bool isMasterServerModeEnabled = false;
|
||||||
|
|
||||||
FileCRCPreCacheThread *preCacheThread=NULL;
|
FileCRCPreCacheThread *preCacheThread=NULL;
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ void cleanupCRCThread() {
|
||||||
static void cleanupProcessObjects() {
|
static void cleanupProcessObjects() {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("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(isMasterServerModeEnabled == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
showCursor(true);
|
showCursor(true);
|
||||||
restoreVideoMode(true);
|
restoreVideoMode(true);
|
||||||
}
|
}
|
||||||
|
@ -521,7 +521,7 @@ public:
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
program->showMessage(errMsg.c_str());
|
program->showMessage(errMsg.c_str());
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
for(;isMasterServerModeEnabled == false && program->isMessageShowing();) {
|
for(;GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && program->isMessageShowing();) {
|
||||||
//program->getState()->render();
|
//program->getState()->render();
|
||||||
Window::handleEvent();
|
Window::handleEvent();
|
||||||
program->loop();
|
program->loop();
|
||||||
|
@ -533,7 +533,7 @@ public:
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
program->showMessage(errMsg.c_str());
|
program->showMessage(errMsg.c_str());
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
for(;isMasterServerModeEnabled == false && program->isMessageShowing();) {
|
for(;GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && program->isMessageShowing();) {
|
||||||
//program->renderProgramMsgBox();
|
//program->renderProgramMsgBox();
|
||||||
Window::handleEvent();
|
Window::handleEvent();
|
||||||
program->loop();
|
program->loop();
|
||||||
|
@ -573,7 +573,7 @@ public:
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
if(isMasterServerModeEnabled == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
showCursor(true);
|
showCursor(true);
|
||||||
restoreVideoMode(true);
|
restoreVideoMode(true);
|
||||||
}
|
}
|
||||||
|
@ -2454,8 +2454,9 @@ int glestMain(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if( hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
if( hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
||||||
isMasterServerModeEnabled = true;
|
//isMasterServerModeEnabled = true;
|
||||||
Window::setMasterserverMode(isMasterServerModeEnabled);
|
//Window::setMasterserverMode(isMasterServerModeEnabled);
|
||||||
|
GlobalStaticFlags::setIsNonGraphicalModeEnabled(true);
|
||||||
|
|
||||||
int foundParamIndIndex = -1;
|
int foundParamIndIndex = -1;
|
||||||
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE]) + string("="),&foundParamIndIndex);
|
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE]) + string("="),&foundParamIndIndex);
|
||||||
|
@ -2641,9 +2642,9 @@ int glestMain(int argc, char** argv) {
|
||||||
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
||||||
config.setString("FactorySound","None");
|
config.setString("FactorySound","None");
|
||||||
if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
||||||
Logger::getInstance().setMasterserverMode(true);
|
//Logger::getInstance().setMasterserverMode(true);
|
||||||
Model::setMasterserverMode(true);
|
//Model::setMasterserverMode(true);
|
||||||
Shared::Sound::Sound::setMasterserverMode(true);
|
//Shared::Sound::Sound::setMasterserverMode(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2854,10 +2855,6 @@ int glestMain(int argc, char** argv) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**ENABLED OPENGL VSYNCH**\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**ENABLED OPENGL VSYNCH**\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
|
||||||
Renderer::getInstance(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_USE_PORTS]) == true) {
|
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_USE_PORTS]) == true) {
|
||||||
int foundParamIndIndex = -1;
|
int foundParamIndIndex = -1;
|
||||||
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_USE_PORTS]) + string("="),&foundParamIndIndex);
|
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_USE_PORTS]) + string("="),&foundParamIndIndex);
|
||||||
|
@ -3523,7 +3520,7 @@ int glestMain(int argc, char** argv) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isMasterServerModeEnabled == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
printf("Headless server is now running...\n");
|
printf("Headless server is now running...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3531,7 +3528,7 @@ int glestMain(int argc, char** argv) {
|
||||||
|
|
||||||
//main loop
|
//main loop
|
||||||
while(program->isShutdownApplicationEnabled() == false && Window::handleEvent()) {
|
while(program->isShutdownApplicationEnabled() == false && Window::handleEvent()) {
|
||||||
if(isMasterServerModeEnabled == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
|
|
||||||
if(disableheadless_console == false) {
|
if(disableheadless_console == false) {
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
@ -3597,13 +3594,13 @@ int glestMain(int argc, char** argv) {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isMasterServerModeEnabled == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
printf("\nHeadless server is about to quit...\n");
|
printf("\nHeadless server is about to quit...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] starting normal application shutdown\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] starting normal application shutdown\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(isMasterServerModeEnabled == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
soundThreadManager = program->getSoundThreadManager(true);
|
soundThreadManager = program->getSoundThreadManager(true);
|
||||||
if(soundThreadManager) {
|
if(soundThreadManager) {
|
||||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
@ -3620,7 +3617,7 @@ int glestMain(int argc, char** argv) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
catch(const exception &e) {
|
catch(const exception &e) {
|
||||||
if(isMasterServerModeEnabled == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
soundThreadManager = (program != NULL ? program->getSoundThreadManager(true) : NULL);
|
soundThreadManager = (program != NULL ? program->getSoundThreadManager(true) : NULL);
|
||||||
if(soundThreadManager) {
|
if(soundThreadManager) {
|
||||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
@ -3632,7 +3629,7 @@ int glestMain(int argc, char** argv) {
|
||||||
ExceptionHandler::handleRuntimeError(e.what());
|
ExceptionHandler::handleRuntimeError(e.what());
|
||||||
}
|
}
|
||||||
catch(const char *e) {
|
catch(const char *e) {
|
||||||
if(isMasterServerModeEnabled == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
soundThreadManager = (program != NULL ? program->getSoundThreadManager(true) : NULL);
|
soundThreadManager = (program != NULL ? program->getSoundThreadManager(true) : NULL);
|
||||||
if(soundThreadManager) {
|
if(soundThreadManager) {
|
||||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
@ -3644,7 +3641,7 @@ int glestMain(int argc, char** argv) {
|
||||||
ExceptionHandler::handleRuntimeError(e);
|
ExceptionHandler::handleRuntimeError(e);
|
||||||
}
|
}
|
||||||
catch(const string &ex) {
|
catch(const string &ex) {
|
||||||
if(isMasterServerModeEnabled == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
soundThreadManager = (program != NULL ? program->getSoundThreadManager(true) : NULL);
|
soundThreadManager = (program != NULL ? program->getSoundThreadManager(true) : NULL);
|
||||||
if(soundThreadManager) {
|
if(soundThreadManager) {
|
||||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
@ -3656,7 +3653,7 @@ int glestMain(int argc, char** argv) {
|
||||||
ExceptionHandler::handleRuntimeError(ex.c_str());
|
ExceptionHandler::handleRuntimeError(ex.c_str());
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
if(isMasterServerModeEnabled == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
soundThreadManager = (program != NULL ? program->getSoundThreadManager(true) : NULL);
|
soundThreadManager = (program != NULL ? program->getSoundThreadManager(true) : NULL);
|
||||||
if(soundThreadManager) {
|
if(soundThreadManager) {
|
||||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
|
|
@ -74,7 +74,7 @@ bool ProgramState::canRender(bool sleepIfCannotRender) {
|
||||||
int maxFPSCap = Config::getInstance().getInt("RenderFPSCap","500");
|
int maxFPSCap = Config::getInstance().getInt("RenderFPSCap","500");
|
||||||
int sleepMillis = Config::getInstance().getInt("RenderFPSCapSleepMillis","1");
|
int sleepMillis = Config::getInstance().getInt("RenderFPSCapSleepMillis","1");
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
if(renderer.isMasterserverMode() == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
maxFPSCap = Config::getInstance().getInt("RenderFPSCapHeadless","250");
|
maxFPSCap = Config::getInstance().getInt("RenderFPSCapHeadless","250");
|
||||||
sleepMillis = Config::getInstance().getInt("RenderFPSCapHeadlessSleepMillis","1");
|
sleepMillis = Config::getInstance().getInt("RenderFPSCapHeadlessSleepMillis","1");
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ void ProgramState::render() {
|
||||||
canRender();
|
canRender();
|
||||||
incrementFps();
|
incrementFps();
|
||||||
|
|
||||||
if(renderer.isMasterserverMode() == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
renderer.clearBuffers();
|
renderer.clearBuffers();
|
||||||
renderer.reset2d();
|
renderer.reset2d();
|
||||||
renderer.renderMessageBox(program->getMsgBox());
|
renderer.renderMessageBox(program->getMsgBox());
|
||||||
|
@ -171,7 +171,7 @@ void Program::ShowMessageProgramState::update() {
|
||||||
// ===================== PUBLIC ========================
|
// ===================== PUBLIC ========================
|
||||||
|
|
||||||
Program::Program() {
|
Program::Program() {
|
||||||
this->masterserverMode = false;
|
//this->masterserverMode = false;
|
||||||
this->shutdownApplicationEnabled = false;
|
this->shutdownApplicationEnabled = false;
|
||||||
this->skipRenderFrameCount = 0;
|
this->skipRenderFrameCount = 0;
|
||||||
this->programState= NULL;
|
this->programState= NULL;
|
||||||
|
@ -184,9 +184,9 @@ Program::Program() {
|
||||||
msgBox.setEnabled(false);
|
msgBox.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Program::isMasterserverMode() const {
|
//bool Program::isMasterserverMode() const {
|
||||||
return this->masterserverMode;
|
// return this->masterserverMode;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void Program::initNormal(WindowGl *window){
|
void Program::initNormal(WindowGl *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",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@ -204,7 +204,7 @@ void Program::initServer(WindowGl *window, bool autostart,bool openNetworkSlots,
|
||||||
bool masterserverMode) {
|
bool masterserverMode) {
|
||||||
MainMenu* mainMenu= NULL;
|
MainMenu* mainMenu= NULL;
|
||||||
|
|
||||||
this->masterserverMode = masterserverMode;
|
//this->masterserverMode = masterserverMode;
|
||||||
init(window);
|
init(window);
|
||||||
mainMenu= new MainMenu(this);
|
mainMenu= new MainMenu(this);
|
||||||
setState(mainMenu);
|
setState(mainMenu);
|
||||||
|
@ -322,7 +322,7 @@ void Program::loopWorker() {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] ================================= MAIN LOOP START ================================= \n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] ================================= MAIN LOOP START ================================= \n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
if(renderer.isMasterserverMode() == false && window) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && window) {
|
||||||
MainWindow *mainWindow = dynamic_cast<MainWindow *>(window);
|
MainWindow *mainWindow = dynamic_cast<MainWindow *>(window);
|
||||||
if(mainWindow) {
|
if(mainWindow) {
|
||||||
//mainWindow->render();
|
//mainWindow->render();
|
||||||
|
@ -445,7 +445,7 @@ void Program::renderProgramMsgBox() {
|
||||||
renderer.renderMessageBox(&msgBox);
|
renderer.renderMessageBox(&msgBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(renderer.isMasterserverMode() == false && window) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && window) {
|
||||||
MainWindow *mainWindow = dynamic_cast<MainWindow *>(window);
|
MainWindow *mainWindow = dynamic_cast<MainWindow *>(window);
|
||||||
if(mainWindow) {
|
if(mainWindow) {
|
||||||
mainWindow->render();
|
mainWindow->render();
|
||||||
|
|
|
@ -146,7 +146,7 @@ private:
|
||||||
GraphicMessageBox msgBox;
|
GraphicMessageBox msgBox;
|
||||||
int skipRenderFrameCount;
|
int skipRenderFrameCount;
|
||||||
|
|
||||||
bool masterserverMode;
|
//bool masterserverMode;
|
||||||
bool shutdownApplicationEnabled;
|
bool shutdownApplicationEnabled;
|
||||||
static bool wantShutdownApplicationAfterGame;
|
static bool wantShutdownApplicationAfterGame;
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
static void setWantShutdownApplicationAfterGame(bool value) { wantShutdownApplicationAfterGame = value; }
|
static void setWantShutdownApplicationAfterGame(bool value) { wantShutdownApplicationAfterGame = value; }
|
||||||
static bool getWantShutdownApplicationAfterGame() { return wantShutdownApplicationAfterGame; }
|
static bool getWantShutdownApplicationAfterGame() { return wantShutdownApplicationAfterGame; }
|
||||||
|
|
||||||
bool isMasterserverMode() const;
|
//bool isMasterserverMode() const;
|
||||||
bool isShutdownApplicationEnabled() const { return shutdownApplicationEnabled; }
|
bool isShutdownApplicationEnabled() const { return shutdownApplicationEnabled; }
|
||||||
void setShutdownApplicationEnabled(bool value) { shutdownApplicationEnabled = value; }
|
void setShutdownApplicationEnabled(bool value) { shutdownApplicationEnabled = value; }
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ void MainMenu::render() {
|
||||||
incrementFps();
|
incrementFps();
|
||||||
|
|
||||||
if(state->isMasterserverMode() == false) {
|
if(state->isMasterserverMode() == false) {
|
||||||
if(renderer.isMasterserverMode() == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
renderer.clearBuffers();
|
renderer.clearBuffers();
|
||||||
|
|
||||||
//3d
|
//3d
|
||||||
|
@ -120,7 +120,7 @@ void MainMenu::render() {
|
||||||
}
|
}
|
||||||
state->render();
|
state->render();
|
||||||
|
|
||||||
if(renderer.isMasterserverMode() == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
renderer.renderMouse2d(mouseX, mouseY, mouse2dAnim);
|
renderer.renderMouse2d(mouseX, mouseY, mouse2dAnim);
|
||||||
renderer.renderFPSWhenEnabled(lastFps);
|
renderer.renderFPSWhenEnabled(lastFps);
|
||||||
renderer.swapBuffers();
|
renderer.swapBuffers();
|
||||||
|
|
|
@ -178,8 +178,7 @@ void MenuStateRoot::mouseMove(int x, int y, const MouseState *ms){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuStateRoot::isMasterserverMode() const {
|
bool MenuStateRoot::isMasterserverMode() const {
|
||||||
Renderer &renderer= Renderer::getInstance();
|
return GlobalStaticFlags::getIsNonGraphicalModeEnabled();
|
||||||
return renderer.isMasterserverMode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuStateRoot::render() {
|
void MenuStateRoot::render() {
|
||||||
|
|
|
@ -343,7 +343,7 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType
|
||||||
showUnitParticles = config.getBool("UnitParticles","true");
|
showUnitParticles = config.getBool("UnitParticles","true");
|
||||||
maxQueuedCommandDisplayCount = config.getInt("MaxQueuedCommandDisplayCount","15");
|
maxQueuedCommandDisplayCount = config.getInt("MaxQueuedCommandDisplayCount","15");
|
||||||
|
|
||||||
if(Renderer::getInstance().isMasterserverMode() == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
showUnitParticles = false;
|
showUnitParticles = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ void Minimap::init(int w, int h, const World *world, bool fogOfWar) {
|
||||||
//fow pixmaps
|
//fow pixmaps
|
||||||
float f= 0.f;
|
float f= 0.f;
|
||||||
|
|
||||||
if(Renderer::getInstance().isMasterserverMode() == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
fowPixmap0= new Pixmap2D(potW, potH, 1);
|
fowPixmap0= new Pixmap2D(potW, potH, 1);
|
||||||
fowPixmap1= new Pixmap2D(potW, potH, 1);
|
fowPixmap1= new Pixmap2D(potW, potH, 1);
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ float SurfaceAtlas::getCoordStep() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceAtlas::checkDimensions(const Pixmap2D *p) {
|
void SurfaceAtlas::checkDimensions(const Pixmap2D *p) {
|
||||||
if(Renderer::getInstance().isMasterserverMode() == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,9 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
||||||
for(int j=0; j<childCount; ++j){
|
for(int j=0; j<childCount; ++j){
|
||||||
const XmlNode *textureNode= surfaceNode->getChild("texture", j);
|
const XmlNode *textureNode= surfaceNode->getChild("texture", j);
|
||||||
surfPixmaps[i][j].init(3);
|
surfPixmaps[i][j].init(3);
|
||||||
surfPixmaps[i][j].load(textureNode->getAttribute("path")->getRestrictedValue(currentPath));
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
|
surfPixmaps[i][j].load(textureNode->getAttribute("path")->getRestrictedValue(currentPath));
|
||||||
|
}
|
||||||
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,textureNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,textureNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
surfProbs[i][j]= textureNode->getAttribute("prob")->getFloatValue();
|
surfProbs[i][j]= textureNode->getAttribute("prob")->getFloatValue();
|
||||||
|
|
|
@ -176,7 +176,7 @@ private:
|
||||||
string fileName;
|
string fileName;
|
||||||
string sourceLoader;
|
string sourceLoader;
|
||||||
|
|
||||||
static bool masterserverMode;
|
//static bool masterserverMode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//constructor & destructor
|
//constructor & destructor
|
||||||
|
@ -185,7 +185,7 @@ public:
|
||||||
virtual void init()= 0;
|
virtual void init()= 0;
|
||||||
virtual void end()= 0;
|
virtual void end()= 0;
|
||||||
|
|
||||||
static void setMasterserverMode(bool value) { masterserverMode=value; }
|
//static void setMasterserverMode(bool value) { masterserverMode=value; }
|
||||||
|
|
||||||
//data
|
//data
|
||||||
void updateInterpolationData(float t, bool cycle);
|
void updateInterpolationData(float t, bool cycle);
|
||||||
|
|
|
@ -521,6 +521,7 @@ private:
|
||||||
vector<ParticleSystem *> particleSystems;
|
vector<ParticleSystem *> particleSystems;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
ParticleManager();
|
||||||
~ParticleManager();
|
~ParticleManager();
|
||||||
void update(int renderFps=-1);
|
void update(int renderFps=-1);
|
||||||
void render(ParticleRenderer *pr, ModelRenderer *mr) const;
|
void render(ParticleRenderer *pr, ModelRenderer *mr) const;
|
||||||
|
|
|
@ -35,7 +35,7 @@ protected:
|
||||||
string logString;
|
string logString;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShaderManager(){}
|
ShaderManager();
|
||||||
virtual ~ShaderManager();
|
virtual ~ShaderManager();
|
||||||
|
|
||||||
ShaderProgram *newShaderProgram();
|
ShaderProgram *newShaderProgram();
|
||||||
|
|
|
@ -111,7 +111,7 @@ private:
|
||||||
|
|
||||||
static void setKeystate(SDL_keysym state) { keystate = state; }
|
static void setKeystate(SDL_keysym state) { keystate = state; }
|
||||||
|
|
||||||
static bool masterserverMode;
|
//static bool masterserverMode;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int w, h;
|
int w, h;
|
||||||
|
@ -132,8 +132,8 @@ public:
|
||||||
Window();
|
Window();
|
||||||
virtual ~Window();
|
virtual ~Window();
|
||||||
|
|
||||||
static void setMasterserverMode(bool value) { Window::masterserverMode = value;}
|
//static void setMasterserverMode(bool value) { Window::masterserverMode = value;}
|
||||||
static bool getMasterserverMode() { return Window::masterserverMode;}
|
//static bool getMasterserverMode() { return Window::masterserverMode;}
|
||||||
|
|
||||||
static bool getTryVSynch() { return tryVSynch; }
|
static bool getTryVSynch() { return tryVSynch; }
|
||||||
static void setTryVSynch(bool value) { tryVSynch = value; }
|
static void setTryVSynch(bool value) { tryVSynch = value; }
|
||||||
|
|
|
@ -61,13 +61,13 @@ protected:
|
||||||
float volume;
|
float volume;
|
||||||
string fileName;
|
string fileName;
|
||||||
|
|
||||||
static bool masterserverMode;
|
//static bool masterserverMode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Sound();
|
Sound();
|
||||||
virtual ~Sound(){};
|
virtual ~Sound(){};
|
||||||
|
|
||||||
static void setMasterserverMode(bool value) { masterserverMode=value; }
|
//static void setMasterserverMode(bool value) { masterserverMode=value; }
|
||||||
|
|
||||||
const SoundInfo *getInfo() const {return &info;}
|
const SoundInfo *getInfo() const {return &info;}
|
||||||
float getVolume() const {return volume;}
|
float getVolume() const {return volume;}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <assert.h>
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
@ -25,7 +26,21 @@ using namespace Shared::Platform;
|
||||||
|
|
||||||
//#define UNDEF_DEBUG
|
//#define UNDEF_DEBUG
|
||||||
|
|
||||||
namespace Shared{ namespace Util{
|
namespace Shared { namespace Util {
|
||||||
|
|
||||||
|
class GlobalStaticFlags {
|
||||||
|
public:
|
||||||
|
static bool getIsNonGraphicalModeEnabled() {
|
||||||
|
return isNonGraphicalMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setIsNonGraphicalModeEnabled(bool value) {
|
||||||
|
isNonGraphicalMode = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static bool isNonGraphicalMode;
|
||||||
|
};
|
||||||
|
|
||||||
class SystemFlags
|
class SystemFlags
|
||||||
{
|
{
|
||||||
|
@ -228,6 +243,8 @@ public:
|
||||||
return m_map;
|
return m_map;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "pixmap.h"
|
#include "pixmap.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include "util.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::runtime_error;
|
using std::runtime_error;
|
||||||
|
@ -75,6 +75,8 @@ BMPReader::BMPReader(): FileReader<Pixmap2D>(getExtensionsBmp()) {}
|
||||||
*Path is used for printing error messages
|
*Path is used for printing error messages
|
||||||
*@return <code>NULL</code> if the Pixmap2D could not be read, else the pixmap*/
|
*@return <code>NULL</code> if the Pixmap2D could not be read, else the pixmap*/
|
||||||
Pixmap2D* BMPReader::read(ifstream& in, const string& path, Pixmap2D* ret) const {
|
Pixmap2D* BMPReader::read(ifstream& in, const string& path, Pixmap2D* ret) const {
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
|
|
||||||
//read file header
|
//read file header
|
||||||
BitmapFileHeader fileHeader;
|
BitmapFileHeader fileHeader;
|
||||||
in.read((char*)&fileHeader, sizeof(BitmapFileHeader));
|
in.read((char*)&fileHeader, sizeof(BitmapFileHeader));
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <jpeglib.h>
|
#include <jpeglib.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::runtime_error;
|
using std::runtime_error;
|
||||||
|
@ -71,6 +72,7 @@ static inline std::vector<string> getExtensions() {
|
||||||
JPGReader::JPGReader(): FileReader<Pixmap2D>(getExtensions()) {}
|
JPGReader::JPGReader(): FileReader<Pixmap2D>(getExtensions()) {}
|
||||||
|
|
||||||
Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const {
|
Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const {
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
//Read file
|
//Read file
|
||||||
is.seekg(0, ios::end);
|
is.seekg(0, ios::end);
|
||||||
size_t length = is.tellg();
|
size_t length = is.tellg();
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
#include "util.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::runtime_error;
|
using std::runtime_error;
|
||||||
|
@ -61,6 +61,7 @@ static inline std::vector<string> getExtensionsPng() {
|
||||||
PNGReader::PNGReader(): FileReader<Pixmap2D>(getExtensionsPng()) {}
|
PNGReader::PNGReader(): FileReader<Pixmap2D>(getExtensionsPng()) {}
|
||||||
|
|
||||||
Pixmap2D* PNGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const {
|
Pixmap2D* PNGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const {
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
//Read file
|
//Read file
|
||||||
is.seekg(0, ios::end);
|
is.seekg(0, ios::end);
|
||||||
//size_t length = is.tellg();
|
//size_t length = is.tellg();
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "pixmap.h"
|
#include "pixmap.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "util.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::runtime_error;
|
using std::runtime_error;
|
||||||
|
@ -66,6 +66,7 @@ static inline std::vector<string> getExtensionStrings() {
|
||||||
TGAReader3D::TGAReader3D(): FileReader<Pixmap3D>(getExtensionStrings()) {}
|
TGAReader3D::TGAReader3D(): FileReader<Pixmap3D>(getExtensionStrings()) {}
|
||||||
|
|
||||||
Pixmap3D* TGAReader3D::read(ifstream& in, const string& path, Pixmap3D* ret) const {
|
Pixmap3D* TGAReader3D::read(ifstream& in, const string& path, Pixmap3D* ret) const {
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
//read header
|
//read header
|
||||||
TargaFileHeader fileHeader;
|
TargaFileHeader fileHeader;
|
||||||
in.read((char*)&fileHeader, sizeof(TargaFileHeader));
|
in.read((char*)&fileHeader, sizeof(TargaFileHeader));
|
||||||
|
|
|
@ -157,6 +157,8 @@ float FontMetrics::getHeight(const string &str) const {
|
||||||
// ===============================================
|
// ===============================================
|
||||||
|
|
||||||
Font::Font(FontTextHandlerType type) {
|
Font::Font(FontTextHandlerType type) {
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
|
|
||||||
inited = false;
|
inited = false;
|
||||||
this->type = fontTypeName;
|
this->type = fontTypeName;
|
||||||
width = 400;
|
width = 400;
|
||||||
|
|
|
@ -14,14 +14,17 @@
|
||||||
#include "graphics_interface.h"
|
#include "graphics_interface.h"
|
||||||
#include "graphics_factory.h"
|
#include "graphics_factory.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include "util.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using namespace Shared::Util;
|
||||||
namespace Shared { namespace Graphics {
|
namespace Shared { namespace Graphics {
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class FontManager
|
// class FontManager
|
||||||
// =====================================================
|
// =====================================================
|
||||||
FontManager::FontManager() {
|
FontManager::FontManager() {
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
fonts.clear();
|
fonts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,9 @@ namespace Shared{ namespace Graphics{
|
||||||
// class InterpolationData
|
// class InterpolationData
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
InterpolationData::InterpolationData(const Mesh *mesh){
|
InterpolationData::InterpolationData(const Mesh *mesh) {
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
|
|
||||||
vertices= NULL;
|
vertices= NULL;
|
||||||
normals= NULL;
|
normals= NULL;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
using namespace Util;
|
using namespace Util;
|
||||||
|
|
||||||
bool Model::masterserverMode = false;
|
//bool Model::masterserverMode = false;
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class Mesh
|
// class Mesh
|
||||||
|
@ -711,6 +711,7 @@ void Mesh::deletePixels() {
|
||||||
// ==================== constructor & destructor ====================
|
// ==================== constructor & destructor ====================
|
||||||
|
|
||||||
Model::Model() {
|
Model::Model() {
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
meshCount = 0;
|
meshCount = 0;
|
||||||
meshes = NULL;
|
meshes = NULL;
|
||||||
textureManager = NULL;
|
textureManager = NULL;
|
||||||
|
@ -779,7 +780,7 @@ void Model::load(const string &path, bool deletePixMapAfterLoad,
|
||||||
this->sourceLoader = (sourceLoader != NULL ? *sourceLoader : "");
|
this->sourceLoader = (sourceLoader != NULL ? *sourceLoader : "");
|
||||||
this->fileName = path;
|
this->fileName = path;
|
||||||
|
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string extension= path.substr(path.find_last_of('.') + 1);
|
string extension= path.substr(path.find_last_of('.') + 1);
|
||||||
|
|
|
@ -15,9 +15,12 @@
|
||||||
#include "graphics_factory.h"
|
#include "graphics_factory.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using namespace Shared::Util;
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@ -25,6 +28,7 @@ namespace Shared{ namespace Graphics{
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
ModelManager::ModelManager(){
|
ModelManager::ModelManager(){
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
textureManager= NULL;
|
textureManager= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ ParticleSystem::ParticleSystem(int particleCount) {
|
||||||
memoryObjectList[this]++;
|
memoryObjectList[this]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
|
|
||||||
//init particle vector
|
//init particle vector
|
||||||
blendMode= bmOne;
|
blendMode= bmOne;
|
||||||
//particles= new Particle[particleCount];
|
//particles= new Particle[particleCount];
|
||||||
|
@ -1160,7 +1162,11 @@ void SplashParticleSystem::updateParticle(Particle *p){
|
||||||
// ParticleManager
|
// ParticleManager
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
ParticleManager::~ParticleManager(){
|
ParticleManager::ParticleManager() {
|
||||||
|
//assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
|
}
|
||||||
|
|
||||||
|
ParticleManager::~ParticleManager() {
|
||||||
end();
|
end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest Shared Library (www.glest.org)
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -15,14 +15,21 @@
|
||||||
|
|
||||||
#include "graphics_interface.h"
|
#include "graphics_interface.h"
|
||||||
#include "graphics_factory.h"
|
#include "graphics_factory.h"
|
||||||
|
#include "util.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using namespace Shared::Util;
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class ShaderManager
|
// class ShaderManager
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
|
ShaderManager::ShaderManager() {
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
|
}
|
||||||
|
|
||||||
ShaderManager::~ShaderManager(){
|
ShaderManager::~ShaderManager(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,20 @@
|
||||||
#include "graphics_interface.h"
|
#include "graphics_interface.h"
|
||||||
#include "graphics_factory.h"
|
#include "graphics_factory.h"
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using namespace Shared::Util;
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class TextureManager
|
// class TextureManager
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
TextureManager::TextureManager(){
|
TextureManager::TextureManager() {
|
||||||
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
|
|
||||||
textureFilter= Texture::fBilinear;
|
textureFilter= Texture::fBilinear;
|
||||||
maxAnisotropy= 1;
|
maxAnisotropy= 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool
|
||||||
int resW = PlatformCommon::Private::ScreenWidth;
|
int resW = PlatformCommon::Private::ScreenWidth;
|
||||||
int resH = PlatformCommon::Private::ScreenHeight;
|
int resH = PlatformCommon::Private::ScreenHeight;
|
||||||
|
|
||||||
if(Window::getMasterserverMode() == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
string mg_icon_file = "";
|
string mg_icon_file = "";
|
||||||
|
@ -162,7 +162,7 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool
|
||||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Window::getMasterserverMode() == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
GLuint err = glewInit();
|
GLuint err = glewInit();
|
||||||
if (GLEW_OK != err) {
|
if (GLEW_OK != err) {
|
||||||
fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
|
fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
|
||||||
|
@ -198,7 +198,7 @@ void PlatformContextGl::makeCurrent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlatformContextGl::swapBuffers() {
|
void PlatformContextGl::swapBuffers() {
|
||||||
if(Window::getMasterserverMode() == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ int Window::lastShowMouseState = 0;
|
||||||
|
|
||||||
bool Window::tryVSynch = false;
|
bool Window::tryVSynch = false;
|
||||||
|
|
||||||
bool Window::masterserverMode = false;
|
//bool Window::masterserverMode = false;
|
||||||
|
|
||||||
// ========== PUBLIC ==========
|
// ========== PUBLIC ==========
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
|
||||||
if(stencilBits >= 0)
|
if(stencilBits >= 0)
|
||||||
newStencilBits = stencilBits;
|
newStencilBits = stencilBits;
|
||||||
|
|
||||||
if(Window::masterserverMode == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
if(fullscreen_anti_aliasing == true) {
|
if(fullscreen_anti_aliasing == true) {
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,1);
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2);
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2);
|
||||||
|
@ -456,7 +456,7 @@ void Window::toggleFullscreen() {
|
||||||
Use 0 for Height, Width, and Color Depth to keep the current values. */
|
Use 0 for Height, Width, and Color Depth to keep the current values. */
|
||||||
|
|
||||||
if(Window::allowAltEnterFullscreenToggle == true) {
|
if(Window::allowAltEnterFullscreenToggle == true) {
|
||||||
if(Window::masterserverMode == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
SDL_Surface *cur_surface = SDL_GetVideoSurface();
|
SDL_Surface *cur_surface = SDL_GetVideoSurface();
|
||||||
if(cur_surface != NULL) {
|
if(cur_surface != NULL) {
|
||||||
Window::isFullScreen = !((cur_surface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN);
|
Window::isFullScreen = !((cur_surface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN);
|
||||||
|
@ -532,7 +532,7 @@ void Window::toggleFullscreen() {
|
||||||
if(Window::allowAltEnterFullscreenToggle == true) {
|
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",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(Window::masterserverMode == false) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||||
SDL_Surface *cur_surface = SDL_GetVideoSurface();
|
SDL_Surface *cur_surface = SDL_GetVideoSurface();
|
||||||
if(cur_surface != NULL) {
|
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",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
|
@ -13,12 +13,13 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include "util.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using namespace Shared::Util;
|
||||||
namespace Shared { namespace Sound {
|
namespace Shared { namespace Sound {
|
||||||
|
|
||||||
bool Sound::masterserverMode = false;
|
//bool Sound::masterserverMode = false;
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class SoundInfo
|
// class SoundInfo
|
||||||
|
@ -73,7 +74,7 @@ void StaticSound::load(const string &path) {
|
||||||
|
|
||||||
fileName = path;
|
fileName = path;
|
||||||
|
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string ext= path.substr(path.find_last_of('.')+1);
|
string ext= path.substr(path.find_last_of('.')+1);
|
||||||
|
@ -110,7 +111,7 @@ void StrSound::open(const string &path) {
|
||||||
|
|
||||||
fileName = path;
|
fileName = path;
|
||||||
|
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +122,7 @@ void StrSound::open(const string &path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 StrSound::read(int8 *samples, uint32 size){
|
uint32 StrSound::read(int8 *samples, uint32 size){
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ void StrSound::close(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void StrSound::restart(){
|
void StrSound::restart(){
|
||||||
if(this->masterserverMode == true) {
|
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ using namespace Shared::Util;
|
||||||
|
|
||||||
namespace Shared{ namespace Util{
|
namespace Shared{ namespace Util{
|
||||||
|
|
||||||
|
bool GlobalStaticFlags::isNonGraphicalMode = false;
|
||||||
// Init statics
|
// Init statics
|
||||||
std::map<SystemFlags::DebugType,SystemFlags::SystemFlagsType> *SystemFlags::debugLogFileList = NULL;
|
std::map<SystemFlags::DebugType,SystemFlags::SystemFlagsType> *SystemFlags::debugLogFileList = NULL;
|
||||||
int SystemFlags::lockFile = -1;
|
int SystemFlags::lockFile = -1;
|
||||||
|
|
Loading…
Reference in New Issue