diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2013-06-24 21:37:15 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2013-06-24 21:37:15 +0200 |
commit | 7c2e955e1552a9c4e412ea2c936be61fc78ba010 (patch) | |
tree | ee506dfbec54f998d10c385bde3a1c3fa04e66b2 /src/graphics/engine/pyro.cpp | |
parent | e218dcfdf2c58f8841e7ebd220527d08e870a6d5 (diff) | |
parent | b376486fd74fa02b0297ceef6d0f977b32358e5e (diff) | |
download | colobot-7c2e955e1552a9c4e412ea2c936be61fc78ba010.tar.gz colobot-7c2e955e1552a9c4e412ea2c936be61fc78ba010.tar.bz2 colobot-7c2e955e1552a9c4e412ea2c936be61fc78ba010.zip |
Colobot Gold 0.1.0-alpha
Diffstat (limited to 'src/graphics/engine/pyro.cpp')
-rw-r--r-- | src/graphics/engine/pyro.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/graphics/engine/pyro.cpp b/src/graphics/engine/pyro.cpp index cab28b6..7c51829 100644 --- a/src/graphics/engine/pyro.cpp +++ b/src/graphics/engine/pyro.cpp @@ -89,13 +89,15 @@ bool CPyro::Create(PyroType type, CObject* obj, float force) DisplayError(type, obj); // displays eventual messages - int i = 0; - // Copies all spheres of the object. - for (; i < 50; i++) { - if ( !obj->GetCrashSphere(i, m_crashSpherePos[i], m_crashSphereRadius[i]) ) break; + int i = 0; + // Copies all spheres of the object. + for (; i < 50; i++) + { + if ( !obj->GetCrashSphere(i, m_crashSpherePos[i], m_crashSphereRadius[i]) ) break; + } + m_crashSphereUsed = i; } - m_crashSphereUsed = i; // Calculates the size of the effect. if ( oType == OBJECT_ANT || @@ -1554,8 +1556,15 @@ void CPyro::ExploStart() for (int i = 0; i < OBJECTMAXPART; i++) { int objRank = m_object->GetObjectRank(i); - if ( objRank == -1 ) continue; - m_engine->ChangeSecondTexture(objRank, "dirty04.tga"); + if (objRank == -1) continue; + + // TODO: refactor later to material change + int oldBaseObjRank = m_engine->GetObjectBaseRank(objRank); + int newBaseObjRank = m_engine->CreateBaseObject(); + m_engine->CopyBaseObject(oldBaseObjRank, newBaseObjRank); + m_engine->SetObjectBaseRank(objRank, newBaseObjRank); + + m_engine->ChangeSecondTexture(objRank, "dirty04.png"); Math::Vector pos = m_object->GetPosition(i); @@ -1616,6 +1625,13 @@ void CPyro::BurnStart() { int objRank = m_object->GetObjectRank(i); if (objRank == -1) continue; + + // TODO: refactor later to material change + int oldBaseObjRank = m_engine->GetObjectBaseRank(objRank); + int newBaseObjRank = m_engine->CreateBaseObject(); + m_engine->CopyBaseObject(oldBaseObjRank, newBaseObjRank); + m_engine->SetObjectBaseRank(objRank, newBaseObjRank); + m_engine->ChangeSecondTexture(objRank, "dirty04.png"); } m_engine->LoadTexture("dirty04.png"); @@ -2382,6 +2398,7 @@ void CPyro::LightOperFrame(float rTime) { if ( m_progress < m_lightOper[i].progress ) { + assert(i > 0); // TODO: if assert fails, fix the code float progress = (m_progress-m_lightOper[i-1].progress) / (m_lightOper[i].progress-m_lightOper[i-1].progress); float intensity = m_lightOper[i-1].intensity + (m_lightOper[i].intensity-m_lightOper[i-1].intensity)*progress; @@ -2399,3 +2416,4 @@ void CPyro::LightOperFrame(float rTime) } // namespace Gfx + |