- more updates for headless mode (try to avoid using opengl completely), server now runs at around 20 MB RAM at game start.
This commit is contained in:
parent
fdd04d10c1
commit
c68aa74fcf
|
@ -680,12 +680,16 @@ void PopupMenu::init(string menuHeader,std::vector<string> menuItems) {
|
||||||
int currentButtonWidth = -1;
|
int currentButtonWidth = -1;
|
||||||
if(font3D != NULL) {
|
if(font3D != NULL) {
|
||||||
FontMetrics *fontMetrics= font3D->getMetrics();
|
FontMetrics *fontMetrics= font3D->getMetrics();
|
||||||
|
if(fontMetrics) {
|
||||||
currentButtonWidth = fontMetrics->getTextWidth(menuItems[i]);
|
currentButtonWidth = fontMetrics->getTextWidth(menuItems[i]);
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
|
else if(font) {
|
||||||
FontMetrics *fontMetrics= font->getMetrics();
|
FontMetrics *fontMetrics= font->getMetrics();
|
||||||
|
if(fontMetrics) {
|
||||||
currentButtonWidth = fontMetrics->getTextWidth(menuItems[i]);
|
currentButtonWidth = fontMetrics->getTextWidth(menuItems[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(maxButtonWidth < 0 || currentButtonWidth > maxButtonWidth) {
|
if(maxButtonWidth < 0 || currentButtonWidth > maxButtonWidth) {
|
||||||
maxButtonWidth = currentButtonWidth + 5;
|
maxButtonWidth = currentButtonWidth + 5;
|
||||||
|
|
|
@ -56,40 +56,57 @@ void CoreData::load() {
|
||||||
|
|
||||||
//textures
|
//textures
|
||||||
backgroundTexture= renderer.newTexture2D(rsGlobal);
|
backgroundTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(backgroundTexture) {
|
||||||
backgroundTexture->setMipmap(false);
|
backgroundTexture->setMipmap(false);
|
||||||
backgroundTexture->getPixmap()->load(dir+"/menu/textures/back.tga");
|
backgroundTexture->getPixmap()->load(dir+"/menu/textures/back.tga");
|
||||||
|
}
|
||||||
|
|
||||||
fireTexture= renderer.newTexture2D(rsGlobal);
|
fireTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(fireTexture) {
|
||||||
fireTexture->setFormat(Texture::fAlpha);
|
fireTexture->setFormat(Texture::fAlpha);
|
||||||
fireTexture->getPixmap()->init(1);
|
fireTexture->getPixmap()->init(1);
|
||||||
fireTexture->getPixmap()->load(dir+"/misc_textures/fire_particle.tga");
|
fireTexture->getPixmap()->load(dir+"/misc_textures/fire_particle.tga");
|
||||||
|
}
|
||||||
|
|
||||||
teamColorTexture= renderer.newTexture2D(rsGlobal);
|
teamColorTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(teamColorTexture) {
|
||||||
teamColorTexture->setFormat(Texture::fAlpha);
|
teamColorTexture->setFormat(Texture::fAlpha);
|
||||||
teamColorTexture->getPixmap()->init(1);
|
teamColorTexture->getPixmap()->init(1);
|
||||||
teamColorTexture->getPixmap()->load(dir+"/misc_textures/team_color_texture.tga");
|
teamColorTexture->getPixmap()->load(dir+"/misc_textures/team_color_texture.tga");
|
||||||
|
}
|
||||||
|
|
||||||
snowTexture= renderer.newTexture2D(rsGlobal);
|
snowTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(snowTexture) {
|
||||||
snowTexture->setMipmap(false);
|
snowTexture->setMipmap(false);
|
||||||
snowTexture->setFormat(Texture::fAlpha);
|
snowTexture->setFormat(Texture::fAlpha);
|
||||||
snowTexture->getPixmap()->init(1);
|
snowTexture->getPixmap()->init(1);
|
||||||
snowTexture->getPixmap()->load(dir+"/misc_textures/snow_particle.tga");
|
snowTexture->getPixmap()->load(dir+"/misc_textures/snow_particle.tga");
|
||||||
|
}
|
||||||
|
|
||||||
customTexture= renderer.newTexture2D(rsGlobal);
|
customTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(customTexture) {
|
||||||
customTexture->getPixmap()->load(dir+"/menu/textures/custom_texture.tga");
|
customTexture->getPixmap()->load(dir+"/menu/textures/custom_texture.tga");
|
||||||
|
}
|
||||||
|
|
||||||
notOnServerTexture= renderer.newTexture2D(rsGlobal);
|
notOnServerTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(notOnServerTexture) {
|
||||||
notOnServerTexture->getPixmap()->load(dir+"/menu/textures/not_on_server.tga");
|
notOnServerTexture->getPixmap()->load(dir+"/menu/textures/not_on_server.tga");
|
||||||
|
}
|
||||||
|
|
||||||
onServerDifferentTexture= renderer.newTexture2D(rsGlobal);
|
onServerDifferentTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(onServerDifferentTexture) {
|
||||||
onServerDifferentTexture->getPixmap()->load(dir+"/menu/textures/on_server_different.tga");
|
onServerDifferentTexture->getPixmap()->load(dir+"/menu/textures/on_server_different.tga");
|
||||||
onServerTexture= renderer.newTexture2D(rsGlobal);
|
onServerTexture= renderer.newTexture2D(rsGlobal);
|
||||||
onServerTexture->getPixmap()->load(dir+"/menu/textures/on_server.tga");
|
onServerTexture->getPixmap()->load(dir+"/menu/textures/on_server.tga");
|
||||||
onServerInstalledTexture= renderer.newTexture2D(rsGlobal);
|
onServerInstalledTexture= renderer.newTexture2D(rsGlobal);
|
||||||
onServerInstalledTexture->getPixmap()->load(dir+"/menu/textures/on_server_installed.tga");
|
onServerInstalledTexture->getPixmap()->load(dir+"/menu/textures/on_server_installed.tga");
|
||||||
|
}
|
||||||
|
|
||||||
logoTexture= renderer.newTexture2D(rsGlobal);
|
logoTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(logoTexture) {
|
||||||
logoTexture->setMipmap(false);
|
logoTexture->setMipmap(false);
|
||||||
logoTexture->getPixmap()->load(dir+"/menu/textures/logo.tga");
|
logoTexture->getPixmap()->load(dir+"/menu/textures/logo.tga");
|
||||||
|
}
|
||||||
|
|
||||||
logoTextureList.clear();
|
logoTextureList.clear();
|
||||||
string logosPath= dir+"/menu/textures/logo*.*";
|
string logosPath= dir+"/menu/textures/logo*.*";
|
||||||
|
@ -99,44 +116,62 @@ void CoreData::load() {
|
||||||
string logo = logoFilenames[i];
|
string logo = logoFilenames[i];
|
||||||
if(strcmp("logo.tga",logo.c_str()) != 0) {
|
if(strcmp("logo.tga",logo.c_str()) != 0) {
|
||||||
Texture2D *logoTextureExtra= renderer.newTexture2D(rsGlobal);
|
Texture2D *logoTextureExtra= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(logoTextureExtra) {
|
||||||
logoTextureExtra->setMipmap(true);
|
logoTextureExtra->setMipmap(true);
|
||||||
logoTextureExtra->getPixmap()->load(dir+"/menu/textures/" + logo);
|
logoTextureExtra->getPixmap()->load(dir+"/menu/textures/" + logo);
|
||||||
logoTextureList.push_back(logoTextureExtra);
|
logoTextureList.push_back(logoTextureExtra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
waterSplashTexture= renderer.newTexture2D(rsGlobal);
|
waterSplashTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(waterSplashTexture) {
|
||||||
waterSplashTexture->setFormat(Texture::fAlpha);
|
waterSplashTexture->setFormat(Texture::fAlpha);
|
||||||
waterSplashTexture->getPixmap()->init(1);
|
waterSplashTexture->getPixmap()->init(1);
|
||||||
waterSplashTexture->getPixmap()->load(dir+"/misc_textures/water_splash.tga");
|
waterSplashTexture->getPixmap()->load(dir+"/misc_textures/water_splash.tga");
|
||||||
|
}
|
||||||
|
|
||||||
buttonSmallTexture= renderer.newTexture2D(rsGlobal);
|
buttonSmallTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(buttonSmallTexture) {
|
||||||
buttonSmallTexture->setForceCompressionDisabled(true);
|
buttonSmallTexture->setForceCompressionDisabled(true);
|
||||||
buttonSmallTexture->getPixmap()->load(dir+"/menu/textures/button_small.tga");
|
buttonSmallTexture->getPixmap()->load(dir+"/menu/textures/button_small.tga");
|
||||||
|
}
|
||||||
|
|
||||||
buttonBigTexture= renderer.newTexture2D(rsGlobal);
|
buttonBigTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(buttonBigTexture) {
|
||||||
buttonBigTexture->setForceCompressionDisabled(true);
|
buttonBigTexture->setForceCompressionDisabled(true);
|
||||||
buttonBigTexture->getPixmap()->load(dir+"/menu/textures/button_big.tga");
|
buttonBigTexture->getPixmap()->load(dir+"/menu/textures/button_big.tga");
|
||||||
|
}
|
||||||
|
|
||||||
horizontalLineTexture= renderer.newTexture2D(rsGlobal);
|
horizontalLineTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(horizontalLineTexture) {
|
||||||
horizontalLineTexture->setForceCompressionDisabled(true);
|
horizontalLineTexture->setForceCompressionDisabled(true);
|
||||||
horizontalLineTexture->getPixmap()->load(dir+"/menu/textures/line_horizontal.tga");
|
horizontalLineTexture->getPixmap()->load(dir+"/menu/textures/line_horizontal.tga");
|
||||||
|
}
|
||||||
|
|
||||||
verticalLineTexture= renderer.newTexture2D(rsGlobal);
|
verticalLineTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(verticalLineTexture) {
|
||||||
verticalLineTexture->setForceCompressionDisabled(true);
|
verticalLineTexture->setForceCompressionDisabled(true);
|
||||||
verticalLineTexture->getPixmap()->load(dir+"/menu/textures/line_vertical.tga");
|
verticalLineTexture->getPixmap()->load(dir+"/menu/textures/line_vertical.tga");
|
||||||
|
}
|
||||||
|
|
||||||
checkBoxTexture= renderer.newTexture2D(rsGlobal);
|
checkBoxTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(checkBoxTexture) {
|
||||||
checkBoxTexture->setForceCompressionDisabled(true);
|
checkBoxTexture->setForceCompressionDisabled(true);
|
||||||
checkBoxTexture->getPixmap()->load(dir+"/menu/textures/checkbox.tga");
|
checkBoxTexture->getPixmap()->load(dir+"/menu/textures/checkbox.tga");
|
||||||
|
}
|
||||||
|
|
||||||
checkedCheckBoxTexture= renderer.newTexture2D(rsGlobal);
|
checkedCheckBoxTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(checkedCheckBoxTexture) {
|
||||||
checkedCheckBoxTexture->setForceCompressionDisabled(true);
|
checkedCheckBoxTexture->setForceCompressionDisabled(true);
|
||||||
checkedCheckBoxTexture->getPixmap()->load(dir+"/menu/textures/checkbox_checked.tga");
|
checkedCheckBoxTexture->getPixmap()->load(dir+"/menu/textures/checkbox_checked.tga");
|
||||||
|
}
|
||||||
|
|
||||||
gameWinnerTexture= renderer.newTexture2D(rsGlobal);
|
gameWinnerTexture= renderer.newTexture2D(rsGlobal);
|
||||||
|
if(gameWinnerTexture) {
|
||||||
gameWinnerTexture->setForceCompressionDisabled(true);
|
gameWinnerTexture->setForceCompressionDisabled(true);
|
||||||
gameWinnerTexture->getPixmap()->load(dir+"/misc_textures/game_winner.png");
|
gameWinnerTexture->getPixmap()->load(dir+"/misc_textures/game_winner.png");
|
||||||
|
}
|
||||||
|
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
|
|
||||||
|
@ -164,14 +199,18 @@ void CoreData::load() {
|
||||||
string displayFontName = displayFontNamePrefix + intToStr(displayFontSize) + displayFontNamePostfix;
|
string displayFontName = displayFontNamePrefix + intToStr(displayFontSize) + displayFontNamePostfix;
|
||||||
|
|
||||||
displayFont= renderer.newFont(rsGlobal);
|
displayFont= renderer.newFont(rsGlobal);
|
||||||
|
if(displayFont) {
|
||||||
displayFont->setType(displayFontName,config.getString("FontDisplay",""));
|
displayFont->setType(displayFontName,config.getString("FontDisplay",""));
|
||||||
displayFont->setSize(displayFontSize);
|
displayFont->setSize(displayFontSize);
|
||||||
//displayFont->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//displayFont->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
displayFont3D= renderer.newFont3D(rsGlobal);
|
displayFont3D= renderer.newFont3D(rsGlobal);
|
||||||
|
if(displayFont3D) {
|
||||||
displayFont3D->setType(displayFontName,config.getString("FontDisplay",""));
|
displayFont3D->setType(displayFontName,config.getString("FontDisplay",""));
|
||||||
displayFont3D->setSize(displayFontSize);
|
displayFont3D->setSize(displayFontSize);
|
||||||
//displayFont3D->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//displayFont3D->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontName = [%s] displayFontSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontName.c_str(),displayFontSize);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontName = [%s] displayFontSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontName.c_str(),displayFontSize);
|
||||||
|
|
||||||
|
@ -193,14 +232,18 @@ void CoreData::load() {
|
||||||
string displayFontNameSmall = displayFontNameSmallPrefix + intToStr(displayFontNameSmallSize) + displayFontNameSmallPostfix;
|
string displayFontNameSmall = displayFontNameSmallPrefix + intToStr(displayFontNameSmallSize) + displayFontNameSmallPostfix;
|
||||||
|
|
||||||
displayFontSmall= renderer.newFont(rsGlobal);
|
displayFontSmall= renderer.newFont(rsGlobal);
|
||||||
|
if(displayFontSmall) {
|
||||||
displayFontSmall->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""));
|
displayFontSmall->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""));
|
||||||
displayFontSmall->setSize(displayFontNameSmallSize);
|
displayFontSmall->setSize(displayFontNameSmallSize);
|
||||||
//displayFontSmall->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//displayFontSmall->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
displayFontSmall3D= renderer.newFont3D(rsGlobal);
|
displayFontSmall3D= renderer.newFont3D(rsGlobal);
|
||||||
|
if(displayFontSmall3D) {
|
||||||
displayFontSmall3D->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""));
|
displayFontSmall3D->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""));
|
||||||
displayFontSmall3D->setSize(displayFontNameSmallSize);
|
displayFontSmall3D->setSize(displayFontNameSmallSize);
|
||||||
//displayFontSmall3D->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//displayFontSmall3D->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontSmallName = [%s] displayFontSmallNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontNameSmall.c_str(),displayFontNameSmallSize);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontSmallName = [%s] displayFontSmallNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontNameSmall.c_str(),displayFontNameSmallSize);
|
||||||
|
|
||||||
|
@ -221,16 +264,20 @@ void CoreData::load() {
|
||||||
string menuFontNameNormal= menuFontNameNormalPrefix + intToStr(menuFontNameNormalSize) + menuFontNameNormalPostfix;
|
string menuFontNameNormal= menuFontNameNormalPrefix + intToStr(menuFontNameNormalSize) + menuFontNameNormalPostfix;
|
||||||
|
|
||||||
menuFontNormal= renderer.newFont(rsGlobal);
|
menuFontNormal= renderer.newFont(rsGlobal);
|
||||||
|
if(menuFontNormal) {
|
||||||
menuFontNormal->setType(menuFontNameNormal,config.getString("FontMenuNormal",""));
|
menuFontNormal->setType(menuFontNameNormal,config.getString("FontMenuNormal",""));
|
||||||
menuFontNormal->setSize(menuFontNameNormalSize);
|
menuFontNormal->setSize(menuFontNameNormalSize);
|
||||||
menuFontNormal->setWidth(Font::wBold);
|
menuFontNormal->setWidth(Font::wBold);
|
||||||
//menuFontNormal->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//menuFontNormal->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
menuFontNormal3D= renderer.newFont3D(rsGlobal);
|
menuFontNormal3D= renderer.newFont3D(rsGlobal);
|
||||||
|
if(menuFontNormal3D) {
|
||||||
menuFontNormal3D->setType(menuFontNameNormal,config.getString("FontMenuNormal",""));
|
menuFontNormal3D->setType(menuFontNameNormal,config.getString("FontMenuNormal",""));
|
||||||
menuFontNormal3D->setSize(menuFontNameNormalSize);
|
menuFontNormal3D->setSize(menuFontNameNormalSize);
|
||||||
menuFontNormal3D->setWidth(Font::wBold);
|
menuFontNormal3D->setWidth(Font::wBold);
|
||||||
//menuFontNormal3D->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//menuFontNormal3D->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNormalName = [%s] menuFontNormalNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameNormal.c_str(),menuFontNameNormalSize);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNormalName = [%s] menuFontNormalNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameNormal.c_str(),menuFontNameNormalSize);
|
||||||
|
|
||||||
|
@ -251,14 +298,18 @@ void CoreData::load() {
|
||||||
string menuFontNameBig= menuFontNameBigPrefix+intToStr(menuFontNameBigSize)+menuFontNameBigPostfix;
|
string menuFontNameBig= menuFontNameBigPrefix+intToStr(menuFontNameBigSize)+menuFontNameBigPostfix;
|
||||||
|
|
||||||
menuFontBig= renderer.newFont(rsGlobal);
|
menuFontBig= renderer.newFont(rsGlobal);
|
||||||
|
if(menuFontBig) {
|
||||||
menuFontBig->setType(menuFontNameBig,config.getString("FontMenuBig",""));
|
menuFontBig->setType(menuFontNameBig,config.getString("FontMenuBig",""));
|
||||||
menuFontBig->setSize(menuFontNameBigSize);
|
menuFontBig->setSize(menuFontNameBigSize);
|
||||||
//menuFontBig->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//menuFontBig->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
menuFontBig3D= renderer.newFont3D(rsGlobal);
|
menuFontBig3D= renderer.newFont3D(rsGlobal);
|
||||||
|
if(menuFontBig3D) {
|
||||||
menuFontBig3D->setType(menuFontNameBig,config.getString("FontMenuBig",""));
|
menuFontBig3D->setType(menuFontNameBig,config.getString("FontMenuBig",""));
|
||||||
menuFontBig3D->setSize(menuFontNameBigSize);
|
menuFontBig3D->setSize(menuFontNameBigSize);
|
||||||
//menuFontBig3D->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//menuFontBig3D->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNameBig = [%s] menuFontNameBigSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameBig.c_str(),menuFontNameBigSize);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNameBig = [%s] menuFontNameBigSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameBig.c_str(),menuFontNameBigSize);
|
||||||
|
|
||||||
|
@ -279,14 +330,18 @@ void CoreData::load() {
|
||||||
string menuFontNameVeryBig= menuFontNameVeryBigPrefix + intToStr(menuFontNameVeryBigSize) + menuFontNameVeryBigPostfix;
|
string menuFontNameVeryBig= menuFontNameVeryBigPrefix + intToStr(menuFontNameVeryBigSize) + menuFontNameVeryBigPostfix;
|
||||||
|
|
||||||
menuFontVeryBig= renderer.newFont(rsGlobal);
|
menuFontVeryBig= renderer.newFont(rsGlobal);
|
||||||
|
if(menuFontVeryBig) {
|
||||||
menuFontVeryBig->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""));
|
menuFontVeryBig->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""));
|
||||||
menuFontVeryBig->setSize(menuFontNameVeryBigSize);
|
menuFontVeryBig->setSize(menuFontNameVeryBigSize);
|
||||||
//menuFontVeryBig->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//menuFontVeryBig->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
menuFontVeryBig3D= renderer.newFont3D(rsGlobal);
|
menuFontVeryBig3D= renderer.newFont3D(rsGlobal);
|
||||||
|
if(menuFontVeryBig3D) {
|
||||||
menuFontVeryBig3D->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""));
|
menuFontVeryBig3D->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""));
|
||||||
menuFontVeryBig3D->setSize(menuFontNameVeryBigSize);
|
menuFontVeryBig3D->setSize(menuFontNameVeryBigSize);
|
||||||
//menuFontVeryBig3D->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//menuFontVeryBig3D->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
//printf("CoreData menuFontVeryBig3D [%d] menuFontVeryBig3D [%p]\n",menuFontVeryBig3D->getSize(),menuFontVeryBig3D);
|
//printf("CoreData menuFontVeryBig3D [%d] menuFontVeryBig3D [%p]\n",menuFontVeryBig3D->getSize(),menuFontVeryBig3D);
|
||||||
|
|
||||||
|
@ -310,14 +365,18 @@ void CoreData::load() {
|
||||||
string consoleFontName= consoleFontNamePrefix + intToStr(consoleFontNameSize) + consoleFontNamePostfix;
|
string consoleFontName= consoleFontNamePrefix + intToStr(consoleFontNameSize) + consoleFontNamePostfix;
|
||||||
|
|
||||||
consoleFont= renderer.newFont(rsGlobal);
|
consoleFont= renderer.newFont(rsGlobal);
|
||||||
|
if(consoleFont) {
|
||||||
consoleFont->setType(consoleFontName,config.getString("FontConsole",""));
|
consoleFont->setType(consoleFontName,config.getString("FontConsole",""));
|
||||||
consoleFont->setSize(consoleFontNameSize);
|
consoleFont->setSize(consoleFontNameSize);
|
||||||
//consoleFont->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//consoleFont->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
consoleFont3D= renderer.newFont3D(rsGlobal);
|
consoleFont3D= renderer.newFont3D(rsGlobal);
|
||||||
|
if(consoleFont3D) {
|
||||||
consoleFont3D->setType(consoleFontName,config.getString("FontConsole",""));
|
consoleFont3D->setType(consoleFontName,config.getString("FontConsole",""));
|
||||||
consoleFont3D->setSize(consoleFontNameSize);
|
consoleFont3D->setSize(consoleFontNameSize);
|
||||||
//consoleFont3D->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
//consoleFont3D->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] consoleFontName = [%s] consoleFontNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,consoleFontName.c_str(),consoleFontNameSize);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] consoleFontName = [%s] consoleFontNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,consoleFontName.c_str(),consoleFontNameSize);
|
||||||
|
|
||||||
|
@ -335,8 +394,10 @@ void CoreData::load() {
|
||||||
|
|
||||||
for(int i=0; i<6; ++i){
|
for(int i=0; i<6; ++i){
|
||||||
waterSounds[i]= new StaticSound();
|
waterSounds[i]= new StaticSound();
|
||||||
|
if(waterSounds[i]) {
|
||||||
waterSounds[i]->load(dir+"/water_sounds/water"+intToStr(i)+".wav");
|
waterSounds[i]->load(dir+"/water_sounds/water"+intToStr(i)+".wav");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
|
||||||
|
|
||||||
if(textureEnabled){
|
if(textureEnabled){
|
||||||
texture= renderer->newTexture2D(rsGame);
|
texture= renderer->newTexture2D(rsGame);
|
||||||
|
if(texture) {
|
||||||
if(textureNode->getAttribute("luminance")->getBoolValue()){
|
if(textureNode->getAttribute("luminance")->getBoolValue()){
|
||||||
texture->setFormat(Texture::fAlpha);
|
texture->setFormat(Texture::fAlpha);
|
||||||
texture->getPixmap()->init(1);
|
texture->getPixmap()->init(1);
|
||||||
|
@ -133,9 +134,12 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
|
||||||
else{
|
else{
|
||||||
texture->getPixmap()->init(4);
|
texture->getPixmap()->init(4);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
string currentPath = dir;
|
string currentPath = dir;
|
||||||
endPathWithSlash(currentPath);
|
endPathWithSlash(currentPath);
|
||||||
|
if(texture) {
|
||||||
texture->load(textureNode->getAttribute("path")->getRestrictedValue(currentPath));
|
texture->load(textureNode->getAttribute("path")->getRestrictedValue(currentPath));
|
||||||
|
}
|
||||||
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(parentLoader,textureNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(parentLoader,textureNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -152,8 +156,9 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
|
||||||
|
|
||||||
string path= modelNode->getAttribute("path")->getRestrictedValue(currentPath);
|
string path= modelNode->getAttribute("path")->getRestrictedValue(currentPath);
|
||||||
model= renderer->newModel(rsGame);
|
model= renderer->newModel(rsGame);
|
||||||
|
if(model) {
|
||||||
model->load(path, false, &loadedFileList, &parentLoader);
|
model->load(path, false, &loadedFileList, &parentLoader);
|
||||||
|
}
|
||||||
loadedFileList[path].push_back(make_pair(parentLoader,modelNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[path].push_back(make_pair(parentLoader,modelNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
if(modelNode->hasChild("cycles")) {
|
if(modelNode->hasChild("cycles")) {
|
||||||
|
|
|
@ -151,7 +151,10 @@ const int OBJECT_SELECT_OFFSET=100000000;
|
||||||
|
|
||||||
// ==================== constructor and destructor ====================
|
// ==================== constructor and destructor ====================
|
||||||
|
|
||||||
Renderer::Renderer() {
|
Renderer::Renderer(bool masterserverMode) : BaseRenderer() {
|
||||||
|
this->masterserverMode = masterserverMode;
|
||||||
|
//printf("this->masterserverMode = %d\n",this->masterserverMode);
|
||||||
|
|
||||||
Renderer::rendererEnded = false;
|
Renderer::rendererEnded = false;
|
||||||
this->allowRenderUnitTitles = false;
|
this->allowRenderUnitTitles = false;
|
||||||
this->menu = NULL;
|
this->menu = NULL;
|
||||||
|
@ -179,8 +182,6 @@ Renderer::Renderer() {
|
||||||
fontManager[i] = NULL;
|
fontManager[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsInterface &gi= GraphicsInterface::getInstance();
|
|
||||||
FactoryRepository &fr= FactoryRepository::getInstance();
|
|
||||||
Config &config= Config::getInstance();
|
Config &config= Config::getInstance();
|
||||||
|
|
||||||
Renderer::perspFarPlane = config.getFloat("PerspectiveFarPlane",floatToStr(Renderer::perspFarPlane).c_str());
|
Renderer::perspFarPlane = config.getFloat("PerspectiveFarPlane",floatToStr(Renderer::perspFarPlane).c_str());
|
||||||
|
@ -189,22 +190,28 @@ Renderer::Renderer() {
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Renderer::perspFarPlane [%f] this->no2DMouseRendering [%d] this->maxConsoleLines [%d]\n",__FILE__,__FUNCTION__,__LINE__,Renderer::perspFarPlane,this->no2DMouseRendering,this->maxConsoleLines);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Renderer::perspFarPlane [%f] this->no2DMouseRendering [%d] this->maxConsoleLines [%d]\n",__FILE__,__FUNCTION__,__LINE__,Renderer::perspFarPlane,this->no2DMouseRendering,this->maxConsoleLines);
|
||||||
|
|
||||||
|
GraphicsInterface &gi= GraphicsInterface::getInstance();
|
||||||
|
FactoryRepository &fr= FactoryRepository::getInstance();
|
||||||
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) {
|
||||||
modelRenderer= graphicsFactory->newModelRenderer();
|
modelRenderer= graphicsFactory->newModelRenderer();
|
||||||
textRenderer= graphicsFactory->newTextRenderer2D();
|
textRenderer= graphicsFactory->newTextRenderer2D();
|
||||||
textRenderer3D = graphicsFactory->newTextRenderer3D();
|
textRenderer3D = graphicsFactory->newTextRenderer3D();
|
||||||
particleRenderer= graphicsFactory->newParticleRenderer();
|
particleRenderer= graphicsFactory->newParticleRenderer();
|
||||||
|
}
|
||||||
|
|
||||||
//resources
|
//resources
|
||||||
for(int i=0; i< rsCount; ++i) {
|
for(int i=0; i< rsCount; ++i) {
|
||||||
|
if(this->masterserverMode == 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]);
|
||||||
particleManager[i]= graphicsFactory->newParticleManager();
|
|
||||||
fontManager[i]= graphicsFactory->newFontManager();
|
fontManager[i]= graphicsFactory->newFontManager();
|
||||||
}
|
}
|
||||||
|
particleManager[i]= graphicsFactory->newParticleManager();
|
||||||
|
}
|
||||||
|
|
||||||
saveScreenShotThread = new SimpleTaskThread(this,0,25);
|
saveScreenShotThread = new SimpleTaskThread(this,0,25);
|
||||||
saveScreenShotThread->setUniqueID(__FILE__);
|
saveScreenShotThread->setUniqueID(__FILE__);
|
||||||
|
@ -295,13 +302,16 @@ bool Renderer::isEnded() {
|
||||||
return Renderer::rendererEnded;
|
return Renderer::rendererEnded;
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer &Renderer::getInstance() {
|
Renderer &Renderer::getInstance(bool masterserverMode) {
|
||||||
static Renderer renderer;
|
static Renderer renderer(masterserverMode);
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::reinitAll() {
|
void Renderer::reinitAll() {
|
||||||
//resources
|
//resources
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for(int i=0; i<rsCount; ++i){
|
for(int i=0; i<rsCount; ++i){
|
||||||
//modelManager[i]->init();
|
//modelManager[i]->init();
|
||||||
textureManager[i]->init(true);
|
textureManager[i]->init(true);
|
||||||
|
@ -325,6 +335,10 @@ void Renderer::init() {
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
modelManager[rsGlobal]->init();
|
modelManager[rsGlobal]->init();
|
||||||
textureManager[rsGlobal]->init();
|
textureManager[rsGlobal]->init();
|
||||||
fontManager[rsGlobal]->init();
|
fontManager[rsGlobal]->init();
|
||||||
|
@ -359,6 +373,10 @@ void Renderer::initGame(const Game *game){
|
||||||
|
|
||||||
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) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//shadows
|
//shadows
|
||||||
if(shadows == sProjected || shadows == sShadowMapping) {
|
if(shadows == sProjected || shadows == sShadowMapping) {
|
||||||
static_cast<ModelRendererGl*>(modelRenderer)->setSecondaryTexCoordUnit(2);
|
static_cast<ModelRendererGl*>(modelRenderer)->setSecondaryTexCoordUnit(2);
|
||||||
|
@ -418,6 +436,10 @@ 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) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
modelManager[rsMenu]->init();
|
modelManager[rsMenu]->init();
|
||||||
textureManager[rsMenu]->init();
|
textureManager[rsMenu]->init();
|
||||||
fontManager[rsMenu]->init();
|
fontManager[rsMenu]->init();
|
||||||
|
@ -493,6 +515,10 @@ void Renderer::end() {
|
||||||
void Renderer::endGame() {
|
void Renderer::endGame() {
|
||||||
game= NULL;
|
game= NULL;
|
||||||
|
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//delete resources
|
//delete resources
|
||||||
modelManager[rsGame]->end();
|
modelManager[rsGame]->end();
|
||||||
textureManager[rsGame]->end();
|
textureManager[rsGame]->end();
|
||||||
|
@ -512,6 +538,11 @@ void Renderer::endGame() {
|
||||||
|
|
||||||
void Renderer::endMenu() {
|
void Renderer::endMenu() {
|
||||||
this->menu = NULL;
|
this->menu = NULL;
|
||||||
|
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//delete resources
|
//delete resources
|
||||||
modelManager[rsMenu]->end();
|
modelManager[rsMenu]->end();
|
||||||
textureManager[rsMenu]->end();
|
textureManager[rsMenu]->end();
|
||||||
|
@ -522,6 +553,10 @@ void Renderer::endMenu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::reloadResources() {
|
void Renderer::reloadResources() {
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(int i=0; i<rsCount; ++i) {
|
for(int i=0; i<rsCount; ++i) {
|
||||||
modelManager[i]->end();
|
modelManager[i]->end();
|
||||||
textureManager[i]->end();
|
textureManager[i]->end();
|
||||||
|
@ -538,6 +573,10 @@ 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) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
textureManager[rs]->initTexture(texture);
|
textureManager[rs]->initTexture(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,6 +585,10 @@ 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) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
textureManager[rs]->endTexture(texture,mustExistInList);
|
textureManager[rs]->endTexture(texture,mustExistInList);
|
||||||
|
|
||||||
if(rs == rsGlobal) {
|
if(rs == rsGlobal) {
|
||||||
|
@ -559,33 +602,65 @@ 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) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
textureManager[rs]->endLastTexture(mustExistInList);
|
textureManager[rs]->endLastTexture(mustExistInList);
|
||||||
}
|
}
|
||||||
|
|
||||||
Model *Renderer::newModel(ResourceScope rs){
|
Model *Renderer::newModel(ResourceScope rs){
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return modelManager[rs]->newModel();
|
return modelManager[rs]->newModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::endModel(ResourceScope rs, Model *model,bool mustExistInList) {
|
void Renderer::endModel(ResourceScope rs, Model *model,bool mustExistInList) {
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
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) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
modelManager[rs]->endLastModel(mustExistInList);
|
modelManager[rs]->endLastModel(mustExistInList);
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture2D *Renderer::newTexture2D(ResourceScope rs){
|
Texture2D *Renderer::newTexture2D(ResourceScope rs){
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return textureManager[rs]->newTexture2D();
|
return textureManager[rs]->newTexture2D();
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture3D *Renderer::newTexture3D(ResourceScope rs){
|
Texture3D *Renderer::newTexture3D(ResourceScope rs){
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return textureManager[rs]->newTexture3D();
|
return textureManager[rs]->newTexture3D();
|
||||||
}
|
}
|
||||||
|
|
||||||
Font2D *Renderer::newFont(ResourceScope rs){
|
Font2D *Renderer::newFont(ResourceScope rs){
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return fontManager[rs]->newFont2D();
|
return fontManager[rs]->newFont2D();
|
||||||
}
|
}
|
||||||
|
|
||||||
Font3D *Renderer::newFont3D(ResourceScope rs){
|
Font3D *Renderer::newFont3D(ResourceScope rs){
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return fontManager[rs]->newFont3D();
|
return fontManager[rs]->newFont3D();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,6 +702,10 @@ void Renderer::swapBuffers() {
|
||||||
|
|
||||||
//places all the opengl lights
|
//places all the opengl lights
|
||||||
void Renderer::setupLighting() {
|
void Renderer::setupLighting() {
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int lightCount= 0;
|
int lightCount= 0;
|
||||||
const World *world= game->getWorld();
|
const World *world= game->getWorld();
|
||||||
const GameCamera *gameCamera= game->getGameCamera();
|
const GameCamera *gameCamera= game->getGameCamera();
|
||||||
|
@ -5150,11 +5229,14 @@ void Renderer::loadConfig() {
|
||||||
//load filter settings
|
//load filter settings
|
||||||
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) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Texture2D *Renderer::saveScreenToTexture(int x, int y, int width, int height) {
|
Texture2D *Renderer::saveScreenToTexture(int x, int y, int width, int height) {
|
||||||
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__);
|
||||||
|
@ -6741,9 +6823,11 @@ Texture2D * Renderer::preloadTexture(string logoFilename) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] logoFilename [%s]\n",__FILE__,__FUNCTION__,__LINE__,logoFilename.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] logoFilename [%s]\n",__FILE__,__FUNCTION__,__LINE__,logoFilename.c_str());
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
result = renderer.newTexture2D(rsGlobal);
|
result = renderer.newTexture2D(rsGlobal);
|
||||||
|
if(result) {
|
||||||
result->setMipmap(true);
|
result->setMipmap(true);
|
||||||
result->load(logoFilename);
|
result->load(logoFilename);
|
||||||
//renderer.initTexture(rsGlobal,result);
|
//renderer.initTexture(rsGlobal,result);
|
||||||
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] add texture to manager and cache [%s]\n",__FILE__,__FUNCTION__,__LINE__,logoFilename.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] add texture to manager and cache [%s]\n",__FILE__,__FUNCTION__,__LINE__,logoFilename.c_str());
|
||||||
|
|
||||||
|
|
|
@ -266,6 +266,8 @@ private:
|
||||||
|
|
||||||
//std::map<Vec3f,Vec3f> worldToScreenPosCache;
|
//std::map<Vec3f,Vec3f> worldToScreenPosCache;
|
||||||
|
|
||||||
|
bool masterserverMode;
|
||||||
|
|
||||||
std::map<uint32,VisibleQuadContainerVBOCache > mapSurfaceVBOCache;
|
std::map<uint32,VisibleQuadContainerVBOCache > mapSurfaceVBOCache;
|
||||||
|
|
||||||
class SurfaceData {
|
class SurfaceData {
|
||||||
|
@ -332,12 +334,13 @@ private:
|
||||||
Quad2i lastVisibleQuad;
|
Quad2i lastVisibleQuad;
|
||||||
} mapRenderer;
|
} mapRenderer;
|
||||||
private:
|
private:
|
||||||
Renderer();
|
Renderer(bool masterserverMode=false);
|
||||||
~Renderer();
|
~Renderer();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Renderer &getInstance();
|
static Renderer &getInstance(bool masterserverMode=false);
|
||||||
static bool isEnded();
|
static bool isEnded();
|
||||||
|
bool isMasterserverMode() const { return masterserverMode; }
|
||||||
|
|
||||||
void reinitAll();
|
void reinitAll();
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,9 @@ void Intro::update(){
|
||||||
|
|
||||||
void Intro::render() {
|
void Intro::render() {
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
|
if(renderer.isMasterserverMode() == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int difTime=0;
|
int difTime=0;
|
||||||
|
|
||||||
canRender();
|
canRender();
|
||||||
|
|
|
@ -95,6 +95,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;
|
||||||
|
|
||||||
FileCRCPreCacheThread *preCacheThread=NULL;
|
FileCRCPreCacheThread *preCacheThread=NULL;
|
||||||
|
|
||||||
|
@ -209,8 +210,11 @@ 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) {
|
||||||
showCursor(true);
|
showCursor(true);
|
||||||
restoreVideoMode(true);
|
restoreVideoMode(true);
|
||||||
|
}
|
||||||
|
|
||||||
cleanupCRCThread();
|
cleanupCRCThread();
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@ -487,7 +491,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(;program->isMessageShowing();) {
|
for(;isMasterServerModeEnabled == false && program->isMessageShowing();) {
|
||||||
//program->getState()->render();
|
//program->getState()->render();
|
||||||
Window::handleEvent();
|
Window::handleEvent();
|
||||||
program->loop();
|
program->loop();
|
||||||
|
@ -497,7 +501,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(;program->isMessageShowing();) {
|
for(;isMasterServerModeEnabled == false && program->isMessageShowing();) {
|
||||||
//program->renderProgramMsgBox();
|
//program->renderProgramMsgBox();
|
||||||
Window::handleEvent();
|
Window::handleEvent();
|
||||||
program->loop();
|
program->loop();
|
||||||
|
@ -535,8 +539,10 @@ public:
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
|
if(isMasterServerModeEnabled == false) {
|
||||||
showCursor(true);
|
showCursor(true);
|
||||||
restoreVideoMode(true);
|
restoreVideoMode(true);
|
||||||
|
}
|
||||||
|
|
||||||
runtimeErrorMsg = errMsg;
|
runtimeErrorMsg = errMsg;
|
||||||
throw runtimeErrorMsg;
|
throw runtimeErrorMsg;
|
||||||
|
@ -2423,6 +2429,9 @@ int glestMain(int argc, char** argv) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
||||||
|
isMasterServerModeEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
//off_t fileSize = getFileSize(argv[0]);
|
//off_t fileSize = getFileSize(argv[0]);
|
||||||
//double fSize = ((double)fileSize / 1048576.0);
|
//double fSize = ((double)fileSize / 1048576.0);
|
||||||
|
@ -3136,6 +3145,7 @@ int glestMain(int argc, char** argv) {
|
||||||
program->initServer(mainWindow,false,true);
|
program->initServer(mainWindow,false,true);
|
||||||
}
|
}
|
||||||
else if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
else if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
||||||
|
Renderer &renderer= Renderer::getInstance(true);
|
||||||
program->initServer(mainWindow,false,true,true);
|
program->initServer(mainWindow,false,true,true);
|
||||||
}
|
}
|
||||||
else if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_AUTOSTART_LASTGAME])) == true) {
|
else if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_AUTOSTART_LASTGAME])) == true) {
|
||||||
|
@ -3394,7 +3404,9 @@ int glestMain(int argc, char** argv) {
|
||||||
string playerTexture = data_path + "data/core/faction_textures/faction" + intToStr(index) + ".tga";
|
string playerTexture = data_path + "data/core/faction_textures/faction" + intToStr(index) + ".tga";
|
||||||
if(fileExists(playerTexture) == true) {
|
if(fileExists(playerTexture) == true) {
|
||||||
Texture2D *texture = Renderer::getInstance().newTexture2D(rsGlobal);
|
Texture2D *texture = Renderer::getInstance().newTexture2D(rsGlobal);
|
||||||
|
if(texture) {
|
||||||
texture->load(playerTexture);
|
texture->load(playerTexture);
|
||||||
|
}
|
||||||
crcPlayerTextureCache[index] = texture;
|
crcPlayerTextureCache[index] = texture;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -158,6 +158,7 @@ void Program::ShowMessageProgramState::update() {
|
||||||
// ===================== PUBLIC ========================
|
// ===================== PUBLIC ========================
|
||||||
|
|
||||||
Program::Program() {
|
Program::Program() {
|
||||||
|
this->masterserverMode = false;
|
||||||
skipRenderFrameCount = 0;
|
skipRenderFrameCount = 0;
|
||||||
programState= NULL;
|
programState= NULL;
|
||||||
singleton = this;
|
singleton = this;
|
||||||
|
@ -169,6 +170,10 @@ Program::Program() {
|
||||||
msgBox.setEnabled(false);
|
msgBox.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Program::isMasterserverMode() const {
|
||||||
|
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__);
|
||||||
|
|
||||||
|
@ -185,6 +190,7 @@ void Program::initServer(WindowGl *window, bool autostart,bool openNetworkSlots,
|
||||||
bool masterserverMode) {
|
bool masterserverMode) {
|
||||||
MainMenu* mainMenu= NULL;
|
MainMenu* mainMenu= NULL;
|
||||||
|
|
||||||
|
this->masterserverMode = masterserverMode;
|
||||||
init(window);
|
init(window);
|
||||||
mainMenu= new MainMenu(this);
|
mainMenu= new MainMenu(this);
|
||||||
setState(mainMenu);
|
setState(mainMenu);
|
||||||
|
|
|
@ -144,12 +144,16 @@ private:
|
||||||
GraphicMessageBox msgBox;
|
GraphicMessageBox msgBox;
|
||||||
int skipRenderFrameCount;
|
int skipRenderFrameCount;
|
||||||
|
|
||||||
|
bool masterserverMode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Program();
|
Program();
|
||||||
~Program();
|
~Program();
|
||||||
|
|
||||||
static Program *getInstance() {return singleton;}
|
static Program *getInstance() {return singleton;}
|
||||||
|
|
||||||
|
bool isMasterserverMode() const;
|
||||||
|
|
||||||
GraphicMessageBox * getMsgBox() { return &msgBox; }
|
GraphicMessageBox * getMsgBox() { return &msgBox; }
|
||||||
void initNormal(WindowGl *window);
|
void initNormal(WindowGl *window);
|
||||||
void initServer(WindowGl *window,bool autostart=false,bool openNetworkSlots=false,bool masterserverMode=false);
|
void initServer(WindowGl *window,bool autostart=false,bool openNetworkSlots=false,bool masterserverMode=false);
|
||||||
|
|
|
@ -95,6 +95,7 @@ void MainMenu::render() {
|
||||||
incrementFps();
|
incrementFps();
|
||||||
|
|
||||||
if(state->isMasterserverMode() == false) {
|
if(state->isMasterserverMode() == false) {
|
||||||
|
if(renderer.isMasterserverMode() == false) {
|
||||||
renderer.clearBuffers();
|
renderer.clearBuffers();
|
||||||
|
|
||||||
//3d
|
//3d
|
||||||
|
@ -107,14 +108,16 @@ void MainMenu::render() {
|
||||||
|
|
||||||
//2d
|
//2d
|
||||||
renderer.reset2d();
|
renderer.reset2d();
|
||||||
|
}
|
||||||
state->render();
|
state->render();
|
||||||
|
|
||||||
|
if(renderer.isMasterserverMode() == false) {
|
||||||
renderer.renderMouse2d(mouseX, mouseY, mouse2dAnim);
|
renderer.renderMouse2d(mouseX, mouseY, mouse2dAnim);
|
||||||
|
|
||||||
renderer.renderFPSWhenEnabled(lastFps);
|
renderer.renderFPSWhenEnabled(lastFps);
|
||||||
|
|
||||||
renderer.swapBuffers();
|
renderer.swapBuffers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//syncronus update
|
//syncronus update
|
||||||
void MainMenu::update(){
|
void MainMenu::update(){
|
||||||
|
|
|
@ -51,9 +51,11 @@ MenuBackground::MenuBackground(){
|
||||||
|
|
||||||
//water texture
|
//water texture
|
||||||
waterTexture= renderer.newTexture2D(rsMenu);
|
waterTexture= renderer.newTexture2D(rsMenu);
|
||||||
|
if(waterTexture) {
|
||||||
waterTexture->getPixmap()->init(4);
|
waterTexture->getPixmap()->init(4);
|
||||||
waterTexture->getPixmap()->load(data_path + "data/core/menu/textures/water.tga");
|
waterTexture->getPixmap()->load(data_path + "data/core/menu/textures/water.tga");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//fog
|
//fog
|
||||||
const XmlNode *fogNode= menuNode->getChild("fog");
|
const XmlNode *fogNode= menuNode->getChild("fog");
|
||||||
|
@ -104,13 +106,17 @@ MenuBackground::MenuBackground(){
|
||||||
|
|
||||||
//load main model
|
//load main model
|
||||||
mainModel= renderer.newModel(rsMenu);
|
mainModel= renderer.newModel(rsMenu);
|
||||||
|
if(mainModel) {
|
||||||
mainModel->load(data_path + "data/core/menu/main_model/menu_main.g3d");
|
mainModel->load(data_path + "data/core/menu/main_model/menu_main.g3d");
|
||||||
|
}
|
||||||
|
|
||||||
//models
|
//models
|
||||||
for(int i=0; i<5; ++i){
|
for(int i=0; i<5; ++i){
|
||||||
characterModels[i]= renderer.newModel(rsMenu);
|
characterModels[i]= renderer.newModel(rsMenu);
|
||||||
|
if(characterModels[i]) {
|
||||||
characterModels[i]->load(data_path + "data/core/menu/about_models/character"+intToStr(i)+".g3d");
|
characterModels[i]->load(data_path + "data/core/menu/about_models/character"+intToStr(i)+".g3d");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//about position
|
//about position
|
||||||
positionNode= cameraNode->getChild("about-position");
|
positionNode= cameraNode->getChild("about-position");
|
||||||
|
|
|
@ -153,7 +153,15 @@ void MenuStateRoot::mouseMove(int x, int y, const MouseState *ms){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MenuStateRoot::isMasterserverMode() const {
|
||||||
|
Renderer &renderer= Renderer::getInstance();
|
||||||
|
return renderer.isMasterserverMode();
|
||||||
|
}
|
||||||
|
|
||||||
void MenuStateRoot::render() {
|
void MenuStateRoot::render() {
|
||||||
|
if(isMasterserverMode() == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
CoreData &coreData= CoreData::getInstance();
|
CoreData &coreData= CoreData::getInstance();
|
||||||
const Metrics &metrics= Metrics::getInstance();
|
const Metrics &metrics= Metrics::getInstance();
|
||||||
|
|
|
@ -46,6 +46,8 @@ public:
|
||||||
void update();
|
void update();
|
||||||
virtual void keyDown(SDL_KeyboardEvent key);
|
virtual void keyDown(SDL_KeyboardEvent key);
|
||||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||||
|
|
||||||
|
virtual bool isMasterserverMode() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -453,7 +453,9 @@ void Faction::init(
|
||||||
|
|
||||||
texture= Renderer::getInstance().newTexture2D(rsGame);
|
texture= Renderer::getInstance().newTexture2D(rsGame);
|
||||||
string data_path = getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
|
string data_path = getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
|
||||||
|
if(texture) {
|
||||||
texture->load(data_path + "data/core/faction_textures/faction"+intToStr(startLocationIndex)+".tga");
|
texture->load(data_path + "data/core/faction_textures/faction"+intToStr(startLocationIndex)+".tga");
|
||||||
|
}
|
||||||
|
|
||||||
if( game->getGameSettings()->getPathFinderType() == pfBasic &&
|
if( game->getGameSettings()->getPathFinderType() == pfBasic &&
|
||||||
Config::getInstance().getBool("EnableFactionWorkerThreads","true") == true) {
|
Config::getInstance().getBool("EnableFactionWorkerThreads","true") == true) {
|
||||||
|
|
|
@ -57,7 +57,9 @@ void CommandType::load(int id, const XmlNode *n, const string &dir,
|
||||||
|
|
||||||
string currentPath = dir;
|
string currentPath = dir;
|
||||||
endPathWithSlash(currentPath);
|
endPathWithSlash(currentPath);
|
||||||
|
if(image) {
|
||||||
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath));
|
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath));
|
||||||
|
}
|
||||||
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(parentLoader,imageNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(parentLoader,imageNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//unit requirements
|
//unit requirements
|
||||||
|
|
|
@ -38,9 +38,11 @@ ObjectType::~ObjectType(){
|
||||||
TilesetModelType* ObjectType::loadModel(const string &path, std::map<string,vector<pair<string, string> > > *loadedFileList,
|
TilesetModelType* ObjectType::loadModel(const string &path, std::map<string,vector<pair<string, string> > > *loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
Model *model= Renderer::getInstance().newModel(rsGame);
|
Model *model= Renderer::getInstance().newModel(rsGame);
|
||||||
|
if(model) {
|
||||||
model->load(path, false, loadedFileList, &parentLoader);
|
model->load(path, false, loadedFileList, &parentLoader);
|
||||||
|
}
|
||||||
color= Vec3f(0.f);
|
color= Vec3f(0.f);
|
||||||
if(model->getMeshCount()>0 && model->getMesh(0)->getTexture(0) != NULL) {
|
if(model && model->getMeshCount()>0 && model->getMesh(0)->getTexture(0) != NULL) {
|
||||||
const Pixmap2D *p= model->getMesh(0)->getTexture(0)->getPixmapConst();
|
const Pixmap2D *p= model->getMesh(0)->getTexture(0)->getPixmapConst();
|
||||||
color= p->getPixel3f(p->getW()/2, p->getH()/2);
|
color= p->getPixel3f(p->getW()/2, p->getH()/2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,9 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
|
||||||
//image
|
//image
|
||||||
const XmlNode *imageNode= resourceNode->getChild("image");
|
const XmlNode *imageNode= resourceNode->getChild("image");
|
||||||
image= renderer.newTexture2D(rsGame);
|
image= renderer.newTexture2D(rsGame);
|
||||||
|
if(image) {
|
||||||
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath));
|
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath));
|
||||||
|
}
|
||||||
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,imageNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,imageNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//type
|
//type
|
||||||
|
@ -94,7 +96,9 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
|
||||||
string modelPath= modelNode->getAttribute("path")->getRestrictedValue(currentPath);
|
string modelPath= modelNode->getAttribute("path")->getRestrictedValue(currentPath);
|
||||||
|
|
||||||
model= renderer.newModel(rsGame);
|
model= renderer.newModel(rsGame);
|
||||||
|
if(model) {
|
||||||
model->load(modelPath, false, &loadedFileList, &sourceXMLFile);
|
model->load(modelPath, false, &loadedFileList, &sourceXMLFile);
|
||||||
|
}
|
||||||
loadedFileList[modelPath].push_back(make_pair(sourceXMLFile,modelNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[modelPath].push_back(make_pair(sourceXMLFile,modelNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
if(modelNode->hasChild("particles")){
|
if(modelNode->hasChild("particles")){
|
||||||
|
|
|
@ -192,7 +192,9 @@ void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
||||||
string path= animationList[i]->getAttribute("path")->getRestrictedValue(currentPath);
|
string path= animationList[i]->getAttribute("path")->getRestrictedValue(currentPath);
|
||||||
if(fileExists(path) == true) {
|
if(fileExists(path) == true) {
|
||||||
Model *animation= Renderer::getInstance().newModel(rsGame);
|
Model *animation= Renderer::getInstance().newModel(rsGame);
|
||||||
|
if(animation) {
|
||||||
animation->load(path, false, &loadedFileList, &parentLoader);
|
animation->load(path, false, &loadedFileList, &parentLoader);
|
||||||
|
}
|
||||||
loadedFileList[path].push_back(make_pair(parentLoader,animationList[i]->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[path].push_back(make_pair(parentLoader,animationList[i]->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
animations.push_back(animation);
|
animations.push_back(animation);
|
||||||
|
|
|
@ -418,13 +418,17 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
|
||||||
//image
|
//image
|
||||||
const XmlNode *imageNode= parametersNode->getChild("image");
|
const XmlNode *imageNode= parametersNode->getChild("image");
|
||||||
image= Renderer::getInstance().newTexture2D(rsGame);
|
image= Renderer::getInstance().newTexture2D(rsGame);
|
||||||
|
if(image) {
|
||||||
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath));
|
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath));
|
||||||
|
}
|
||||||
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,imageNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,imageNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//image cancel
|
//image cancel
|
||||||
const XmlNode *imageCancelNode= parametersNode->getChild("image-cancel");
|
const XmlNode *imageCancelNode= parametersNode->getChild("image-cancel");
|
||||||
cancelImage= Renderer::getInstance().newTexture2D(rsGame);
|
cancelImage= Renderer::getInstance().newTexture2D(rsGame);
|
||||||
|
if(cancelImage) {
|
||||||
cancelImage->load(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath));
|
cancelImage->load(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath));
|
||||||
|
}
|
||||||
loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,imageCancelNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,imageCancelNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//meeting point
|
//meeting point
|
||||||
|
@ -432,7 +436,9 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
|
||||||
meetingPoint= meetingPointNode->getAttribute("value")->getBoolValue();
|
meetingPoint= meetingPointNode->getAttribute("value")->getBoolValue();
|
||||||
if(meetingPoint) {
|
if(meetingPoint) {
|
||||||
meetingPointImage= Renderer::getInstance().newTexture2D(rsGame);
|
meetingPointImage= Renderer::getInstance().newTexture2D(rsGame);
|
||||||
|
if(meetingPointImage) {
|
||||||
meetingPointImage->load(meetingPointNode->getAttribute("image-path")->getRestrictedValue(currentPath));
|
meetingPointImage->load(meetingPointNode->getAttribute("image-path")->getRestrictedValue(currentPath));
|
||||||
|
}
|
||||||
loadedFileList[meetingPointNode->getAttribute("image-path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,meetingPointNode->getAttribute("image-path")->getRestrictedValue()));
|
loadedFileList[meetingPointNode->getAttribute("image-path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,meetingPointNode->getAttribute("image-path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,9 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
||||||
//image
|
//image
|
||||||
const XmlNode *imageNode= upgradeNode->getChild("image");
|
const XmlNode *imageNode= upgradeNode->getChild("image");
|
||||||
image= Renderer::getInstance().newTexture2D(rsGame);
|
image= Renderer::getInstance().newTexture2D(rsGame);
|
||||||
|
if(image) {
|
||||||
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath,true));
|
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath,true));
|
||||||
|
}
|
||||||
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(make_pair(sourceXMLFile,imageNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(make_pair(sourceXMLFile,imageNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//if(fileExists(imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)) == false) {
|
//if(fileExists(imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)) == false) {
|
||||||
|
@ -238,7 +240,9 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
||||||
//image cancel
|
//image cancel
|
||||||
const XmlNode *imageCancelNode= upgradeNode->getChild("image-cancel");
|
const XmlNode *imageCancelNode= upgradeNode->getChild("image-cancel");
|
||||||
cancelImage= Renderer::getInstance().newTexture2D(rsGame);
|
cancelImage= Renderer::getInstance().newTexture2D(rsGame);
|
||||||
|
if(cancelImage) {
|
||||||
cancelImage->load(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true));
|
cancelImage->load(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true));
|
||||||
|
}
|
||||||
loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(make_pair(sourceXMLFile,imageCancelNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(make_pair(sourceXMLFile,imageCancelNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//if(fileExists(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)) == false) {
|
//if(fileExists(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)) == false) {
|
||||||
|
|
|
@ -56,6 +56,8 @@ void Minimap::init(int w, int h, const World *world, bool fogOfWar) {
|
||||||
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__);
|
||||||
//fow pixmaps
|
//fow pixmaps
|
||||||
float f= 0.f;
|
float f= 0.f;
|
||||||
|
|
||||||
|
if(Renderer::getInstance().isMasterserverMode() == 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);
|
||||||
|
|
||||||
|
@ -75,11 +77,13 @@ void Minimap::init(int w, int h, const World *world, bool fogOfWar) {
|
||||||
else {
|
else {
|
||||||
fowPixmap1->setPixels(&f);
|
fowPixmap1->setPixels(&f);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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__);
|
||||||
|
|
||||||
//fow tex
|
//fow tex
|
||||||
fowTex= renderer.newTexture2D(rsGame);
|
fowTex= renderer.newTexture2D(rsGame);
|
||||||
|
if(fowTex) {
|
||||||
fowTex->setMipmap(false);
|
fowTex->setMipmap(false);
|
||||||
fowTex->setPixmapInit(false);
|
fowTex->setPixmapInit(false);
|
||||||
fowTex->setFormat(Texture::fAlpha);
|
fowTex->setFormat(Texture::fAlpha);
|
||||||
|
@ -88,13 +92,16 @@ void Minimap::init(int w, int h, const World *world, bool fogOfWar) {
|
||||||
|
|
||||||
fowTex->getPixmap()->init(potW, potH, 1);
|
fowTex->getPixmap()->init(potW, potH, 1);
|
||||||
fowTex->getPixmap()->setPixels(&f);
|
fowTex->getPixmap()->setPixels(&f);
|
||||||
|
}
|
||||||
|
|
||||||
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__);
|
||||||
|
|
||||||
//tex
|
//tex
|
||||||
tex= renderer.newTexture2D(rsGame);
|
tex= renderer.newTexture2D(rsGame);
|
||||||
|
if(tex) {
|
||||||
tex->getPixmap()->init(scaledW, scaledH, 3);
|
tex->getPixmap()->init(scaledW, scaledH, 3);
|
||||||
tex->setMipmap(false);
|
tex->setMipmap(false);
|
||||||
|
}
|
||||||
|
|
||||||
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__);
|
||||||
|
|
||||||
|
@ -112,15 +119,17 @@ Minimap::~Minimap() {
|
||||||
// ==================== set ====================
|
// ==================== set ====================
|
||||||
|
|
||||||
void Minimap::incFowTextureAlphaSurface(const Vec2i &sPos, float alpha) {
|
void Minimap::incFowTextureAlphaSurface(const Vec2i &sPos, float alpha) {
|
||||||
|
if(fowPixmap1) {
|
||||||
assert(sPos.x<fowPixmap1->getW() && sPos.y<fowPixmap1->getH());
|
assert(sPos.x<fowPixmap1->getW() && sPos.y<fowPixmap1->getH());
|
||||||
|
|
||||||
if(fowPixmap1->getPixelf(sPos.x, sPos.y)<alpha){
|
if(fowPixmap1->getPixelf(sPos.x, sPos.y)<alpha){
|
||||||
fowPixmap1->setPixel(sPos.x, sPos.y, alpha);
|
fowPixmap1->setPixel(sPos.x, sPos.y, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Minimap::resetFowTex() {
|
void Minimap::resetFowTex() {
|
||||||
|
if(fowTex) {
|
||||||
Pixmap2D *tmpPixmap= fowPixmap0;
|
Pixmap2D *tmpPixmap= fowPixmap0;
|
||||||
fowPixmap0= fowPixmap1;
|
fowPixmap0= fowPixmap1;
|
||||||
fowPixmap1= tmpPixmap;
|
fowPixmap1= tmpPixmap;
|
||||||
|
@ -159,8 +168,10 @@ void Minimap::resetFowTex() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Minimap::updateFowTex(float t) {
|
void Minimap::updateFowTex(float t) {
|
||||||
|
if(fowPixmap0 && fowTex) {
|
||||||
for(int i=0; i<fowPixmap0->getW(); ++i){
|
for(int i=0; i<fowPixmap0->getW(); ++i){
|
||||||
for(int j=0; j<fowPixmap0->getH(); ++j){
|
for(int j=0; j<fowPixmap0->getH(); ++j){
|
||||||
float p1= fowPixmap1->getPixelf(i, j);
|
float p1= fowPixmap1->getPixelf(i, j);
|
||||||
|
@ -171,6 +182,7 @@ void Minimap::updateFowTex(float t) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== PRIVATE ====================
|
// ==================== PRIVATE ====================
|
||||||
|
|
||||||
|
@ -179,6 +191,7 @@ void Minimap::computeTexture(const World *world) {
|
||||||
Vec3f color;
|
Vec3f color;
|
||||||
const Map *map= world->getMap();
|
const Map *map= world->getMap();
|
||||||
|
|
||||||
|
if(tex) {
|
||||||
tex->getPixmap()->setPixels(Vec4f(1.f, 1.f, 1.f, 0.1f).ptr());
|
tex->getPixmap()->setPixels(Vec4f(1.f, 1.f, 1.f, 0.1f).ptr());
|
||||||
|
|
||||||
for(int j=0; j<tex->getPixmap()->getH(); ++j){
|
for(int j=0; j<tex->getPixmap()->getH(); ++j){
|
||||||
|
@ -205,5 +218,6 @@ void Minimap::computeTexture(const World *world) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
|
@ -87,11 +87,13 @@ void SurfaceAtlas::addSurface(SurfaceInfo *si) {
|
||||||
if(it == surfaceInfos.end()) {
|
if(it == surfaceInfos.end()) {
|
||||||
//add new texture
|
//add new texture
|
||||||
Texture2D *t= Renderer::getInstance().newTexture2D(rsGame);
|
Texture2D *t= Renderer::getInstance().newTexture2D(rsGame);
|
||||||
if(t == NULL) {
|
if(t) {
|
||||||
throw runtime_error("Could not create new texture (NULL)");
|
//if(t == NULL) {
|
||||||
}
|
// throw runtime_error("Could not create new texture (NULL)");
|
||||||
|
//}
|
||||||
t->setWrapMode(Texture::wmClampToEdge);
|
t->setWrapMode(Texture::wmClampToEdge);
|
||||||
t->getPixmap()->init(surfaceSize, surfaceSize, 3);
|
t->getPixmap()->init(surfaceSize, surfaceSize, 3);
|
||||||
|
}
|
||||||
|
|
||||||
si->setCoord(Vec2f(0.f, 0.f));
|
si->setCoord(Vec2f(0.f, 0.f));
|
||||||
si->setTexture(t);
|
si->setTexture(t);
|
||||||
|
@ -99,12 +101,16 @@ void SurfaceAtlas::addSurface(SurfaceInfo *si) {
|
||||||
|
|
||||||
//copy texture to pixmap
|
//copy texture to pixmap
|
||||||
if(si->getCenter() != NULL) {
|
if(si->getCenter() != NULL) {
|
||||||
|
if(t) {
|
||||||
t->getPixmap()->copy(si->getCenter());
|
t->getPixmap()->copy(si->getCenter());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
|
if(t) {
|
||||||
t->getPixmap()->splat(si->getLeftUp(), si->getRightUp(), si->getLeftDown(), si->getRightDown());
|
t->getPixmap()->splat(si->getLeftUp(), si->getRightUp(), si->getLeftDown(), si->getRightDown());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
si->setCoord(it->getCoord());
|
si->setCoord(it->getCoord());
|
||||||
si->setTexture(it->getTexture());
|
si->setTexture(it->getTexture());
|
||||||
|
@ -116,6 +122,10 @@ float SurfaceAtlas::getCoordStep() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceAtlas::checkDimensions(const Pixmap2D *p) {
|
void SurfaceAtlas::checkDimensions(const Pixmap2D *p) {
|
||||||
|
if(Renderer::getInstance().isMasterserverMode() == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(p == NULL) {
|
if(p == NULL) {
|
||||||
throw runtime_error("Bad surface texture pixmap (NULL)");
|
throw runtime_error("Bad surface texture pixmap (NULL)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,17 +262,23 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
||||||
//water
|
//water
|
||||||
const XmlNode *waterNode= parametersNode->getChild("water");
|
const XmlNode *waterNode= parametersNode->getChild("water");
|
||||||
waterTex= renderer.newTexture3D(rsGame);
|
waterTex= renderer.newTexture3D(rsGame);
|
||||||
|
if(waterTex) {
|
||||||
waterTex->setMipmap(false);
|
waterTex->setMipmap(false);
|
||||||
waterTex->setWrapMode(Texture::wmRepeat);
|
waterTex->setWrapMode(Texture::wmRepeat);
|
||||||
|
}
|
||||||
waterEffects= waterNode->getAttribute("effects")->getBoolValue();
|
waterEffects= waterNode->getAttribute("effects")->getBoolValue();
|
||||||
|
|
||||||
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__);
|
||||||
|
|
||||||
int waterFrameCount= waterNode->getChildCount();
|
int waterFrameCount= waterNode->getChildCount();
|
||||||
|
if(waterTex) {
|
||||||
waterTex->getPixmap()->init(waterFrameCount, 4);
|
waterTex->getPixmap()->init(waterFrameCount, 4);
|
||||||
|
}
|
||||||
for(int i=0; i<waterFrameCount; ++i){
|
for(int i=0; i<waterFrameCount; ++i){
|
||||||
const XmlNode *waterFrameNode= waterNode->getChild("texture", i);
|
const XmlNode *waterFrameNode= waterNode->getChild("texture", i);
|
||||||
|
if(waterTex) {
|
||||||
waterTex->getPixmap()->loadSlice(waterFrameNode->getAttribute("path")->getRestrictedValue(currentPath), i);
|
waterTex->getPixmap()->loadSlice(waterFrameNode->getAttribute("path")->getRestrictedValue(currentPath), i);
|
||||||
|
}
|
||||||
loadedFileList[waterFrameNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,waterFrameNode->getAttribute("path")->getRestrictedValue()));
|
loadedFileList[waterFrameNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,waterFrameNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1236,8 +1236,10 @@ void World::initFactionTypes(GameSettings *gs) {
|
||||||
stats.setControl(i, gs->getFactionControl(i));
|
stats.setControl(i, gs->getFactionControl(i));
|
||||||
stats.setResourceMultiplier(i,(gs->getResourceMultiplierIndex(i)+5)*0.1f);
|
stats.setResourceMultiplier(i,(gs->getResourceMultiplierIndex(i)+5)*0.1f);
|
||||||
stats.setPlayerName(i,gs->getNetworkPlayerName(i));
|
stats.setPlayerName(i,gs->getNetworkPlayerName(i));
|
||||||
|
if(getFaction(i)->getTexture()) {
|
||||||
stats.setPlayerColor(i,getFaction(i)->getTexture()->getPixmapConst()->getPixel3f(0, 0));
|
stats.setPlayerColor(i,getFaction(i)->getTexture()->getPixmapConst()->getPixel3f(0, 0));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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__);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user