- fix loading of deferred system particles
This commit is contained in:
parent
cbf9a305c5
commit
65a3ce6e86
|
@ -1 +1 @@
|
|||
Subproject commit 3de3304fd08fed556c5bfee168fcaa64bbf75612
|
||||
Subproject commit 929c6bac3c2654aa549aaecd589cdc15a0abdd61
|
|
@ -117,30 +117,30 @@ void CoreData::cleanup() {
|
|||
waterSounds.getSoundsPtr()->clear();
|
||||
}
|
||||
|
||||
Texture2D *CoreData::getTextureBySystemId(TextureSystemType type) const {
|
||||
Texture2D *CoreData::getTextureBySystemId(TextureSystemType type) {
|
||||
Texture2D *result = NULL;
|
||||
switch(type) {
|
||||
case tsyst_logoTexture:
|
||||
result = logoTexture;
|
||||
result = getLogoTexture();
|
||||
break;
|
||||
//std::vector<Texture2D *> logoTextureList;
|
||||
case tsyst_backgroundTexture:
|
||||
result = backgroundTexture;
|
||||
result = getBackgroundTexture();
|
||||
break;
|
||||
case tsyst_fireTexture:
|
||||
result = fireTexture;
|
||||
result = getFireTexture();
|
||||
break;
|
||||
case tsyst_teamColorTexture:
|
||||
result = teamColorTexture;
|
||||
result = getTeamColorTexture();
|
||||
break;
|
||||
case tsyst_snowTexture:
|
||||
result = snowTexture;
|
||||
result = getSnowTexture();
|
||||
break;
|
||||
case tsyst_waterSplashTexture:
|
||||
result = waterSplashTexture;
|
||||
result = getWaterSplashTexture();
|
||||
break;
|
||||
case tsyst_customTexture:
|
||||
result = customTexture;
|
||||
result = getCustomTexture();
|
||||
break;
|
||||
case tsyst_buttonSmallTexture:
|
||||
result = buttonSmallTexture;
|
||||
|
|
|
@ -152,7 +152,7 @@ public:
|
|||
void loadFonts();
|
||||
|
||||
// Textures
|
||||
Texture2D *getTextureBySystemId(TextureSystemType type) const;
|
||||
Texture2D *getTextureBySystemId(TextureSystemType type);
|
||||
|
||||
Texture2D *getBackgroundTexture();
|
||||
Texture2D *getFireTexture();
|
||||
|
|
|
@ -582,10 +582,15 @@ void Renderer::manageDeferredParticleSystems() {
|
|||
CoreData::TextureSystemType textureSystemId =
|
||||
static_cast<CoreData::TextureSystemType>(
|
||||
ps->getTextureFileLoadDeferredSystemId());
|
||||
|
||||
//printf("Load DEFERRED particle i = %d textureSystemId = %d\n",i,textureSystemId);
|
||||
|
||||
if(textureSystemId != CoreData::tsyst_NONE) {
|
||||
Texture2D *texture= CoreData::getInstance().getTextureBySystemId(textureSystemId);
|
||||
//printf("Loading texture from system [%d] [%p]\n",textureSystemId,texture);
|
||||
ps->setTexture(texture);
|
||||
|
||||
//printf("#2 Load DEFERRED particle i = %d textureSystemId = %d, texture = %p\n",i,textureSystemId,texture);
|
||||
}
|
||||
else {
|
||||
Texture2D *texture= newTexture2D(rs);
|
||||
|
@ -601,6 +606,7 @@ void Renderer::manageDeferredParticleSystems() {
|
|||
texture->load(textureFile);
|
||||
ps->setTexture(texture);
|
||||
}
|
||||
//printf("#3 Load DEFERRED particle i = %d textureSystemId = %d, texture = %p\n",i,textureSystemId,texture);
|
||||
}
|
||||
}
|
||||
if(dynamic_cast<GameParticleSystem *>(ps) != NULL) {
|
||||
|
|
|
@ -5263,6 +5263,8 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
|||
//result->fire->setTexture(CoreData::getInstance().getFireTexture());
|
||||
result->fireParticleSystems.push_back(result->fire);
|
||||
|
||||
//printf("Load MAIN fire particle result->fire = %p\n",result->fire);
|
||||
|
||||
Renderer::getInstance().addToDeferredParticleSystemList(make_pair(result->fire, rsGame));
|
||||
}
|
||||
|
||||
|
@ -5387,16 +5389,18 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
|||
for(int i = 0; i < (int)unitParticleSystemNodeList.size(); ++i) {
|
||||
XmlNode *node = unitParticleSystemNodeList[i];
|
||||
|
||||
if(linkFireIndex != i) {
|
||||
if(result->fire == NULL || linkFireIndex != i) {
|
||||
FireParticleSystem *ups = new FireParticleSystem();
|
||||
ups->setParticleOwner(result);
|
||||
ups->loadGame(node);
|
||||
//ups->setTexture(CoreData::getInstance().getFireTexture());
|
||||
result->fireParticleSystems.push_back(ups);
|
||||
|
||||
//if(linkFireIndex >= 0 && linkFireIndex == i) {
|
||||
// result->fire = ups;
|
||||
//}
|
||||
//printf("Load fire particle i = %d linkFireIndex = %d result->fire = %p ups = %p\n",i,linkFireIndex,result->fire,ups);
|
||||
|
||||
if(result->fire == NULL && linkFireIndex >= 0 && linkFireIndex == i) {
|
||||
result->fire = ups;
|
||||
}
|
||||
Renderer::getInstance().addToDeferredParticleSystemList(make_pair(ups, rsGame));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue