Refactor ResetCap -> AnimateOnReset
parent
20dbb8320b
commit
62fdfc9f92
|
@ -9,6 +9,7 @@ CObject::CObject(int id, ObjectType type)
|
||||||
, m_position(0.0f, 0.0f, 0.0f)
|
, m_position(0.0f, 0.0f, 0.0f)
|
||||||
, m_rotation(0.0f, 0.0f, 0.0f)
|
, m_rotation(0.0f, 0.0f, 0.0f)
|
||||||
, m_scale(1.0f, 1.0f, 1.0f)
|
, m_scale(1.0f, 1.0f, 1.0f)
|
||||||
|
, m_animateOnReset(false)
|
||||||
{
|
{
|
||||||
m_implementedInterfaces.fill(false);
|
m_implementedInterfaces.fill(false);
|
||||||
}
|
}
|
||||||
|
@ -92,3 +93,14 @@ Math::Sphere CObject::GetCameraCollisionSphere()
|
||||||
return transformedSphere;
|
return transformedSphere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CObject::GetAnimateOnReset()
|
||||||
|
{
|
||||||
|
return m_animateOnReset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CObject::SetAnimateOnReset(bool animateOnReset)
|
||||||
|
{
|
||||||
|
m_animateOnReset = animateOnReset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,11 @@ public:
|
||||||
//! Sets the transparency of object
|
//! Sets the transparency of object
|
||||||
virtual void SetTransparency(float value) = 0;
|
virtual void SetTransparency(float value) = 0;
|
||||||
|
|
||||||
|
//! Sets flag controlling animation effect on level reset
|
||||||
|
void SetAnimateOnReset(bool animateOnReset);
|
||||||
|
//! Returns flag controlling animation effect on level reset
|
||||||
|
bool GetAnimateOnReset();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Transform crash sphere by object's world matrix
|
//! Transform crash sphere by object's world matrix
|
||||||
virtual void TransformCrashSphere(Math::Sphere& crashSphere) = 0;
|
virtual void TransformCrashSphere(Math::Sphere& crashSphere) = 0;
|
||||||
|
@ -133,4 +138,5 @@ protected:
|
||||||
Math::Vector m_scale;
|
Math::Vector m_scale;
|
||||||
std::vector<CrashSphere> m_crashSpheres; //!< crash spheres
|
std::vector<CrashSphere> m_crashSpheres; //!< crash spheres
|
||||||
Math::Sphere m_cameraCollisionSphere;
|
Math::Sphere m_cameraCollisionSphere;
|
||||||
|
bool m_animateOnReset;
|
||||||
};
|
};
|
||||||
|
|
|
@ -289,8 +289,6 @@ COldObject::COldObject(int id)
|
||||||
m_character.wheelLeft = 1.0f;
|
m_character.wheelLeft = 1.0f;
|
||||||
m_character.wheelRight = 1.0f;
|
m_character.wheelRight = 1.0f;
|
||||||
|
|
||||||
m_resetCap = RESET_NONE;
|
|
||||||
|
|
||||||
m_cameraType = Gfx::CAM_TYPE_BACK;
|
m_cameraType = Gfx::CAM_TYPE_BACK;
|
||||||
m_cameraDist = 50.0f;
|
m_cameraDist = 50.0f;
|
||||||
m_bCameraLock = false;
|
m_bCameraLock = false;
|
||||||
|
@ -940,9 +938,9 @@ void COldObject::Write(CLevelParserLine* line)
|
||||||
if ( GetGunGoalH() != 0.0f )
|
if ( GetGunGoalH() != 0.0f )
|
||||||
line->AddParam("aimH", CLevelParserParamUPtr{new CLevelParserParam(GetGunGoalH())});
|
line->AddParam("aimH", CLevelParserParamUPtr{new CLevelParserParam(GetGunGoalH())});
|
||||||
|
|
||||||
if ( GetResetCap() != 0 )
|
if ( GetAnimateOnReset() != 0 )
|
||||||
{
|
{
|
||||||
line->AddParam("resetCap", CLevelParserParamUPtr{new CLevelParserParam(static_cast<int>(GetResetCap()))});
|
line->AddParam("resetCap", CLevelParserParamUPtr{new CLevelParserParam(GetAnimateOnReset())});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_bVirusMode )
|
if ( m_bVirusMode )
|
||||||
|
@ -1012,7 +1010,7 @@ void COldObject::Read(CLevelParserLine* line)
|
||||||
SetGunGoalV(line->GetParam("aimV")->AsFloat(0.0f));
|
SetGunGoalV(line->GetParam("aimV")->AsFloat(0.0f));
|
||||||
SetGunGoalH(line->GetParam("aimH")->AsFloat(0.0f));
|
SetGunGoalH(line->GetParam("aimH")->AsFloat(0.0f));
|
||||||
|
|
||||||
SetResetCap(static_cast<ResetCap>(line->GetParam("resetCap")->AsInt(0)));
|
SetAnimateOnReset(line->GetParam("resetCap")->AsBool(false));
|
||||||
m_bBurn = line->GetParam("burnMode")->AsBool(false);
|
m_bBurn = line->GetParam("burnMode")->AsBool(false);
|
||||||
m_bVirusMode = line->GetParam("virusMode")->AsBool(false);
|
m_bVirusMode = line->GetParam("virusMode")->AsBool(false);
|
||||||
m_virusTime = line->GetParam("virusTime")->AsFloat(0.0f);
|
m_virusTime = line->GetParam("virusTime")->AsFloat(0.0f);
|
||||||
|
@ -1456,16 +1454,6 @@ bool COldObject::GetManual()
|
||||||
return m_bManual;
|
return m_bManual;
|
||||||
}
|
}
|
||||||
|
|
||||||
void COldObject::SetResetCap(ResetCap cap)
|
|
||||||
{
|
|
||||||
m_resetCap = cap;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResetCap COldObject::GetResetCap()
|
|
||||||
{
|
|
||||||
return m_resetCap;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Management of the particle master.
|
// Management of the particle master.
|
||||||
|
|
||||||
void COldObject::SetMasterParticle(int part, int parti)
|
void COldObject::SetMasterParticle(int part, int parti)
|
||||||
|
|
|
@ -150,9 +150,6 @@ public:
|
||||||
void SetManual(bool bManual);
|
void SetManual(bool bManual);
|
||||||
bool GetManual();
|
bool GetManual();
|
||||||
|
|
||||||
void SetResetCap(ResetCap cap) override;
|
|
||||||
ResetCap GetResetCap() override;
|
|
||||||
|
|
||||||
void SetMasterParticle(int part, int parti) override;
|
void SetMasterParticle(int part, int parti) override;
|
||||||
|
|
||||||
void SetPower(CObject* power) override;
|
void SetPower(CObject* power) override;
|
||||||
|
@ -393,12 +390,6 @@ protected:
|
||||||
|
|
||||||
int m_partiSel[4];
|
int m_partiSel[4];
|
||||||
|
|
||||||
ResetCap m_resetCap;
|
|
||||||
bool m_bResetBusy;
|
|
||||||
Math::Vector m_resetPosition;
|
|
||||||
Math::Vector m_resetAngle;
|
|
||||||
Program* m_resetRun;
|
|
||||||
|
|
||||||
float m_infoReturn;
|
float m_infoReturn;
|
||||||
|
|
||||||
std::vector<float> m_cmdLine;
|
std::vector<float> m_cmdLine;
|
||||||
|
|
|
@ -187,16 +187,6 @@ bool COldObjectInterface::GetTrainer()
|
||||||
throw std::logic_error("GetTrainer: not implemented!");
|
throw std::logic_error("GetTrainer: not implemented!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void COldObjectInterface::SetResetCap(ResetCap cap)
|
|
||||||
{
|
|
||||||
throw std::logic_error("SetResetCap: not implemented!");
|
|
||||||
}
|
|
||||||
|
|
||||||
ResetCap COldObjectInterface::GetResetCap()
|
|
||||||
{
|
|
||||||
throw std::logic_error("GetResetCap: not implemented!");
|
|
||||||
}
|
|
||||||
|
|
||||||
void COldObjectInterface::SetMasterParticle(int part, int parti)
|
void COldObjectInterface::SetMasterParticle(int part, int parti)
|
||||||
{
|
{
|
||||||
throw std::logic_error("SetMasterParticle: not implemented!");
|
throw std::logic_error("SetMasterParticle: not implemented!");
|
||||||
|
|
|
@ -64,12 +64,6 @@ enum class ExplosionType
|
||||||
Water = 3,
|
Water = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ResetCap
|
|
||||||
{
|
|
||||||
RESET_NONE = 0,
|
|
||||||
RESET_MOVE = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
class COldObjectInterface
|
class COldObjectInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -118,9 +112,6 @@ public:
|
||||||
virtual void SetTrainer(bool bEnable);
|
virtual void SetTrainer(bool bEnable);
|
||||||
virtual bool GetTrainer();
|
virtual bool GetTrainer();
|
||||||
|
|
||||||
virtual ResetCap GetResetCap();
|
|
||||||
virtual void SetResetCap(ResetCap resetCap);
|
|
||||||
|
|
||||||
virtual void SetMasterParticle(int part, int parti);
|
virtual void SetMasterParticle(int part, int parti);
|
||||||
|
|
||||||
virtual float GetCmdLine(unsigned int rank);
|
virtual float GetCmdLine(unsigned int rank);
|
||||||
|
|
|
@ -3680,7 +3680,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
||||||
->SetSoluceName(const_cast<char*>(line->GetParam("soluce")->AsPath("ai").c_str()));
|
->SetSoluceName(const_cast<char*>(line->GetParam("soluce")->AsPath("ai").c_str()));
|
||||||
|
|
||||||
if (line->GetParam("reset")->AsBool(false))
|
if (line->GetParam("reset")->AsBool(false))
|
||||||
oldObj->SetResetCap(RESET_MOVE);
|
oldObj->SetAnimateOnReset(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
rankObj ++;
|
rankObj ++;
|
||||||
|
@ -5325,10 +5325,10 @@ void CRobotMain::ResetCreate()
|
||||||
|
|
||||||
for (CObject* obj : m_objMan->GetAllObjects())
|
for (CObject* obj : m_objMan->GetAllObjects())
|
||||||
{
|
{
|
||||||
ResetCap cap = obj->GetResetCap();
|
if (obj->GetAnimateOnReset())
|
||||||
if (cap == RESET_NONE) continue;
|
{
|
||||||
|
m_engine->GetPyroManager()->Create(Gfx::PT_RESET, obj);
|
||||||
m_engine->GetPyroManager()->Create(Gfx::PT_RESET, obj);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const CLevelParserException& e)
|
catch (const CLevelParserException& e)
|
||||||
|
|
Loading…
Reference in New Issue