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_rotation(0.0f, 0.0f, 0.0f)
|
||||
, m_scale(1.0f, 1.0f, 1.0f)
|
||||
, m_animateOnReset(false)
|
||||
{
|
||||
m_implementedInterfaces.fill(false);
|
||||
}
|
||||
|
@ -92,3 +93,14 @@ Math::Sphere CObject::GetCameraCollisionSphere()
|
|||
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
|
||||
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:
|
||||
//! Transform crash sphere by object's world matrix
|
||||
virtual void TransformCrashSphere(Math::Sphere& crashSphere) = 0;
|
||||
|
@ -133,4 +138,5 @@ protected:
|
|||
Math::Vector m_scale;
|
||||
std::vector<CrashSphere> m_crashSpheres; //!< crash spheres
|
||||
Math::Sphere m_cameraCollisionSphere;
|
||||
bool m_animateOnReset;
|
||||
};
|
||||
|
|
|
@ -289,8 +289,6 @@ COldObject::COldObject(int id)
|
|||
m_character.wheelLeft = 1.0f;
|
||||
m_character.wheelRight = 1.0f;
|
||||
|
||||
m_resetCap = RESET_NONE;
|
||||
|
||||
m_cameraType = Gfx::CAM_TYPE_BACK;
|
||||
m_cameraDist = 50.0f;
|
||||
m_bCameraLock = false;
|
||||
|
@ -940,9 +938,9 @@ void COldObject::Write(CLevelParserLine* line)
|
|||
if ( GetGunGoalH() != 0.0f )
|
||||
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 )
|
||||
|
@ -1012,7 +1010,7 @@ void COldObject::Read(CLevelParserLine* line)
|
|||
SetGunGoalV(line->GetParam("aimV")->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_bVirusMode = line->GetParam("virusMode")->AsBool(false);
|
||||
m_virusTime = line->GetParam("virusTime")->AsFloat(0.0f);
|
||||
|
@ -1456,16 +1454,6 @@ bool COldObject::GetManual()
|
|||
return m_bManual;
|
||||
}
|
||||
|
||||
void COldObject::SetResetCap(ResetCap cap)
|
||||
{
|
||||
m_resetCap = cap;
|
||||
}
|
||||
|
||||
ResetCap COldObject::GetResetCap()
|
||||
{
|
||||
return m_resetCap;
|
||||
}
|
||||
|
||||
// Management of the particle master.
|
||||
|
||||
void COldObject::SetMasterParticle(int part, int parti)
|
||||
|
|
|
@ -150,9 +150,6 @@ public:
|
|||
void SetManual(bool bManual);
|
||||
bool GetManual();
|
||||
|
||||
void SetResetCap(ResetCap cap) override;
|
||||
ResetCap GetResetCap() override;
|
||||
|
||||
void SetMasterParticle(int part, int parti) override;
|
||||
|
||||
void SetPower(CObject* power) override;
|
||||
|
@ -393,12 +390,6 @@ protected:
|
|||
|
||||
int m_partiSel[4];
|
||||
|
||||
ResetCap m_resetCap;
|
||||
bool m_bResetBusy;
|
||||
Math::Vector m_resetPosition;
|
||||
Math::Vector m_resetAngle;
|
||||
Program* m_resetRun;
|
||||
|
||||
float m_infoReturn;
|
||||
|
||||
std::vector<float> m_cmdLine;
|
||||
|
|
|
@ -187,16 +187,6 @@ bool COldObjectInterface::GetTrainer()
|
|||
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)
|
||||
{
|
||||
throw std::logic_error("SetMasterParticle: not implemented!");
|
||||
|
|
|
@ -64,12 +64,6 @@ enum class ExplosionType
|
|||
Water = 3,
|
||||
};
|
||||
|
||||
enum ResetCap
|
||||
{
|
||||
RESET_NONE = 0,
|
||||
RESET_MOVE = 1
|
||||
};
|
||||
|
||||
class COldObjectInterface
|
||||
{
|
||||
public:
|
||||
|
@ -118,9 +112,6 @@ public:
|
|||
virtual void SetTrainer(bool bEnable);
|
||||
virtual bool GetTrainer();
|
||||
|
||||
virtual ResetCap GetResetCap();
|
||||
virtual void SetResetCap(ResetCap resetCap);
|
||||
|
||||
virtual void SetMasterParticle(int part, int parti);
|
||||
|
||||
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()));
|
||||
|
||||
if (line->GetParam("reset")->AsBool(false))
|
||||
oldObj->SetResetCap(RESET_MOVE);
|
||||
oldObj->SetAnimateOnReset(true);
|
||||
}
|
||||
|
||||
rankObj ++;
|
||||
|
@ -5325,10 +5325,10 @@ void CRobotMain::ResetCreate()
|
|||
|
||||
for (CObject* obj : m_objMan->GetAllObjects())
|
||||
{
|
||||
ResetCap cap = obj->GetResetCap();
|
||||
if (cap == RESET_NONE) continue;
|
||||
|
||||
m_engine->GetPyroManager()->Create(Gfx::PT_RESET, obj);
|
||||
if (obj->GetAnimateOnReset())
|
||||
{
|
||||
m_engine->GetPyroManager()->Create(Gfx::PT_RESET, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const CLevelParserException& e)
|
||||
|
|
Loading…
Reference in New Issue