diff --git a/source/g3d_viewer/renderer.cpp b/source/g3d_viewer/renderer.cpp index 0263dfbc9..53e6177e6 100644 --- a/source/g3d_viewer/renderer.cpp +++ b/source/g3d_viewer/renderer.cpp @@ -35,7 +35,6 @@ namespace Shared { // =============================================== void MeshCallbackTeamColor::execute(const Mesh *mesh) { - //team color if (mesh->getCustomTexture() && teamTexture != NULL) { //texture 0 @@ -43,18 +42,14 @@ namespace Shared { //set color to interpolation glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE1); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); - //set alpha to 1 - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, hasAlpha ? GL_COMBINE : GL_REPLACE); + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); @@ -74,10 +69,14 @@ namespace Shared { glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); - //set alpha to 1 - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, hasAlpha ? GL_COMBINE : GL_REPLACE); - glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PRIMARY_COLOR); + //Interpolate alpha with alpha of previous texture + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_INTERPOLATE); + glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE); + glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PREVIOUS); + glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_SRC_ALPHA); glActiveTexture(GL_TEXTURE0); } else { @@ -338,7 +337,6 @@ namespace Shared { glTranslatef(0, -1.5, -5); Texture2D *customTexture = NULL; - bool hasAlpha = false; switch (playerColor) { case pcRed: customTexture = customTextureRed; @@ -366,13 +364,12 @@ namespace Shared { break; case pcTransparent: customTexture = customTextureTransparent; - hasAlpha = true; break; default: assert(false); break; } - meshCallbackTeamColor.setTeamTexture(customTexture, hasAlpha); + meshCallbackTeamColor.setTeamTexture(customTexture); if (wireframe) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); diff --git a/source/g3d_viewer/renderer.h b/source/g3d_viewer/renderer.h index 9d7f2bc3b..0811b7443 100644 --- a/source/g3d_viewer/renderer.h +++ b/source/g3d_viewer/renderer.h @@ -60,14 +60,9 @@ namespace Shared { public: MeshCallbackTeamColor() : MeshCallback() { teamTexture = NULL; - hasAlpha = false; } - void setTeamTexture(const Texture *teamTexture, bool hasAlpha) { + void setTeamTexture(const Texture *teamTexture) { this->teamTexture = teamTexture; - this->hasAlpha = hasAlpha; - } - bool getHasAlpha() { - return hasAlpha; } virtual void execute(const Mesh *mesh); }; diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index c553c09e4..231590a9f 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -7222,7 +7222,7 @@ namespace crcPlayerTextureCache = CacheManager::getCachedItem < std::map < int, Texture2D * > >(GameConstants::playerTextureCacheLookupKey); - for (int index = 0; index < GameConstants::maxPlayers; ++index) { + for (int index = 0; index <= GameConstants::maxPlayers; ++index) { string playerTexture = getGameCustomCoreDataPath(data_path, diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 2ebfa6d38..346860f33 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -3744,7 +3744,7 @@ namespace Glest { int teamnumber = listBoxTeams[i].getSelectedItemIndex(); Vec4f teamcolor = Vec4f(1.0f, 1.0f, 1.0f, 1.0f); - if (teamnumber >= 0 && teamnumber < 8) { + if (teamnumber >= 0 && teamnumber <= GameConstants::maxPlayers) { teamcolor = crcPlayerTextureCache[teamnumber]-> getPixmap()->getPixel4f(0, 0); diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index f52c7fa1c..c38958c82 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -2990,7 +2990,7 @@ namespace Glest { int teamnumber = listBoxTeams[i].getSelectedItemIndex(); Vec4f teamcolor = Vec4f(1.0f, 1.0f, 1.0f, 1.0f); - if (teamnumber >= 0 && teamnumber < 8) { + if (teamnumber >= 0 && teamnumber <= GameConstants::maxPlayers) { teamcolor = crcPlayerTextureCache[teamnumber]-> getPixmap()->getPixel4f(0, 0); diff --git a/source/shared_lib/include/map/map_preview.h b/source/shared_lib/include/map/map_preview.h index 6aa128580..d055da6bd 100644 --- a/source/shared_lib/include/map/map_preview.h +++ b/source/shared_lib/include/map/map_preview.h @@ -50,7 +50,7 @@ namespace Shared { static const int DEFAULT_MAP_CELL_HEIGHT = 10; static const int MIN_MAP_FACTIONCOUNT = 1; - static const int MAX_MAP_FACTIONCOUNT = 8; + static const int MAX_MAP_FACTIONCOUNT = 10; static const int DEFAULT_MAP_FACTIONCOUNT = 8; static const int DEFAULT_MAP_CELL_WIDTH = 128;