IsEnded is only a getter
parent
02c5cb7aa7
commit
ed9701545d
|
@ -219,14 +219,6 @@ Error CPyro::IsEnded()
|
||||||
// End of the pyrotechnic effect?
|
// End of the pyrotechnic effect?
|
||||||
if ( m_progress < 1.0f ) return ERR_CONTINUE;
|
if ( m_progress < 1.0f ) return ERR_CONTINUE;
|
||||||
|
|
||||||
AfterEnd();
|
|
||||||
|
|
||||||
if ( m_lightRank != -1 )
|
|
||||||
{
|
|
||||||
m_lightMan->DeleteLight(m_lightRank);
|
|
||||||
m_lightRank = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ERR_STOP;
|
return ERR_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,8 @@ public:
|
||||||
void FallProgress(float rTime);
|
void FallProgress(float rTime);
|
||||||
//! Indicates whether the fall is over
|
//! Indicates whether the fall is over
|
||||||
Error IsEnded() override;
|
Error IsEnded() override;
|
||||||
|
//! Makes a sound and unlocks the object after fall is done
|
||||||
|
void AfterEnd() override;
|
||||||
|
|
||||||
bool EventProcess(const Event&) override;
|
bool EventProcess(const Event&) override;
|
||||||
};
|
};
|
||||||
|
@ -237,7 +239,7 @@ class CSpiderPyro : public CPyro
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSpiderPyro(CObject *obj);
|
CSpiderPyro(CObject *obj);
|
||||||
Error IsEnded() override;
|
bool EventProcess(const Event& event) override;
|
||||||
void AfterCreate() override;
|
void AfterCreate() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -245,7 +247,7 @@ class CEggPyro : public CPyro
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CEggPyro(CObject *obj);
|
CEggPyro(CObject *obj);
|
||||||
Error IsEnded() override;
|
bool EventProcess(const Event& event) override;
|
||||||
void AfterCreate() override;
|
void AfterCreate() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -284,7 +286,7 @@ class CFragVPyro : public CPyro
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CFragVPyro(CObject *obj);
|
CFragVPyro(CObject *obj);
|
||||||
Error IsEnded() override;
|
bool EventProcess(const Event& event) override;
|
||||||
void AfterCreate() override;
|
void AfterCreate() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -313,7 +315,7 @@ class CFragExploOrShotPyro : public CPyro
|
||||||
public:
|
public:
|
||||||
CFragExploOrShotPyro(PyroType type, CObject *obj, float force = 1.0f);
|
CFragExploOrShotPyro(PyroType type, CObject *obj, float force = 1.0f);
|
||||||
void AfterCreate() override;
|
void AfterCreate() override;
|
||||||
Error IsEnded() override;
|
bool EventProcess(const Event& event) override;
|
||||||
void UpdateEffect() override;
|
void UpdateEffect() override;
|
||||||
|
|
||||||
//! Starts the explosion of a vehicle
|
//! Starts the explosion of a vehicle
|
||||||
|
|
|
@ -71,6 +71,7 @@ void Gfx::CPyroManager::EventProcess(const Event& event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
(*it)->AfterEnd();
|
||||||
(*it)->DeleteObject();
|
(*it)->DeleteObject();
|
||||||
it = m_pyros.erase(it);
|
it = m_pyros.erase(it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,15 @@ CEggPyro::CEggPyro(CObject *obj)
|
||||||
: CPyro(PT_OTHER, obj)
|
: CPyro(PT_OTHER, obj)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Error CEggPyro::IsEnded() {
|
bool CEggPyro::EventProcess(const Event& event)
|
||||||
|
{
|
||||||
// Destroys the object that exploded.
|
// Destroys the object that exploded.
|
||||||
//It should not be destroyed at the end of the Create,
|
//It should not be destroyed at the end of the Create,
|
||||||
//because it is sometimes the object itself that makes the Create:
|
//because it is sometimes the object itself that makes the Create:
|
||||||
// pyro->Create(PT_FRAGT, this);
|
// pyro->Create(PT_FRAGT, this);
|
||||||
DeleteObject(true, true);
|
DeleteObject(true, true);
|
||||||
|
|
||||||
return CPyro::IsEnded();
|
return CPyro::EventProcess(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEggPyro::AfterCreate()
|
void CEggPyro::AfterCreate()
|
||||||
|
|
|
@ -176,12 +176,18 @@ Error CFallPyro::IsEnded()
|
||||||
Math::Vector pos = m_object->GetPosition();
|
Math::Vector pos = m_object->GetPosition();
|
||||||
if (pos.y > m_fallFloor) return ERR_CONTINUE;
|
if (pos.y > m_fallFloor) return ERR_CONTINUE;
|
||||||
|
|
||||||
m_sound->Play(SOUND_BOUM, pos);
|
|
||||||
m_object->SetLock(false); // usable again
|
|
||||||
|
|
||||||
return ERR_STOP;
|
return ERR_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFallPyro::AfterEnd()
|
||||||
|
{
|
||||||
|
if (m_object != nullptr)
|
||||||
|
{
|
||||||
|
m_sound->Play(SOUND_BOUM, m_object->GetPosition());
|
||||||
|
m_object->SetLock(false); // usable again
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CFallPyro::EventProcess(const Event& event)
|
bool CFallPyro::EventProcess(const Event& event)
|
||||||
{
|
{
|
||||||
CPyro::EventProcess(event);
|
CPyro::EventProcess(event);
|
||||||
|
|
|
@ -297,7 +297,8 @@ void CFragExploOrShotPyro::AfterCreate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Error CFragExploOrShotPyro::IsEnded() {
|
bool CFragExploOrShotPyro::EventProcess(const Event& event)
|
||||||
|
{
|
||||||
// Destroys the object that exploded.
|
// Destroys the object that exploded.
|
||||||
//It should not be destroyed at the end of the Create,
|
//It should not be destroyed at the end of the Create,
|
||||||
//because it is sometimes the object itself that makes the Create:
|
//because it is sometimes the object itself that makes the Create:
|
||||||
|
@ -309,7 +310,7 @@ Error CFragExploOrShotPyro::IsEnded() {
|
||||||
DeleteObject(true, true);
|
DeleteObject(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CPyro::IsEnded();
|
return CPyro::EventProcess(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFragExploOrShotPyro::ExploStart()
|
void CFragExploOrShotPyro::ExploStart()
|
||||||
|
|
|
@ -32,14 +32,15 @@ CFragVPyro::CFragVPyro(CObject *obj)
|
||||||
: CPyro(PT_OTHER, obj)
|
: CPyro(PT_OTHER, obj)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Error CFragVPyro::IsEnded() {
|
bool CFragVPyro::EventProcess(const Event& event)
|
||||||
|
{
|
||||||
// Destroys the object that exploded.
|
// Destroys the object that exploded.
|
||||||
//It should not be destroyed at the end of the Create,
|
//It should not be destroyed at the end of the Create,
|
||||||
//because it is sometimes the object itself that makes the Create:
|
//because it is sometimes the object itself that makes the Create:
|
||||||
// pyro->Create(PT_FRAGT, this);
|
// pyro->Create(PT_FRAGT, this);
|
||||||
DeleteObject(true, true);
|
DeleteObject(true, true);
|
||||||
|
|
||||||
return CPyro::IsEnded();
|
return CPyro::EventProcess(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFragVPyro::AfterCreate()
|
void CFragVPyro::AfterCreate()
|
||||||
|
|
|
@ -37,14 +37,15 @@ CSpiderPyro::CSpiderPyro(CObject *obj)
|
||||||
: CPyro(PT_OTHER, obj)
|
: CPyro(PT_OTHER, obj)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Error CSpiderPyro::IsEnded() {
|
bool CSpiderPyro::EventProcess(const Event& event)
|
||||||
|
{
|
||||||
// Destroys the object that exploded.
|
// Destroys the object that exploded.
|
||||||
//It should not be destroyed at the end of the Create,
|
//It should not be destroyed at the end of the Create,
|
||||||
//because it is sometimes the object itself that makes the Create:
|
//because it is sometimes the object itself that makes the Create:
|
||||||
// pyro->Create(PT_FRAGT, this);
|
// pyro->Create(PT_FRAGT, this);
|
||||||
DeleteObject(true, true);
|
DeleteObject(true, true);
|
||||||
|
|
||||||
return CPyro::IsEnded();
|
return CPyro::EventProcess(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpiderPyro::AfterCreate()
|
void CSpiderPyro::AfterCreate()
|
||||||
|
|
Loading…
Reference in New Issue