2016-12-10 02:35:20 +00:00
|
|
|
#include "CScriptPickupGenerator.hpp"
|
2017-01-15 03:07:01 +00:00
|
|
|
#include "TCastTo.hpp"
|
2016-12-10 02:35:20 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
CScriptPickupGenerator::CScriptPickupGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
|
|
|
const zeus::CVector3f& pos, float frequency, bool active)
|
|
|
|
: CEntity(uid, info, active, name), x34_position(pos), x40_frequency(frequency)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:07:01 +00:00
|
|
|
void CScriptPickupGenerator::Accept(IVisitor& visitor)
|
|
|
|
{
|
|
|
|
visitor.Visit(this);
|
|
|
|
}
|
|
|
|
|
2016-12-10 02:35:20 +00:00
|
|
|
void CScriptPickupGenerator::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
|
|
|
|
{
|
|
|
|
if (msg == EScriptObjectMessage::SetToZero && x30_24_active && x44_ != 100.f)
|
|
|
|
{
|
|
|
|
x44_ -= 1.f;
|
|
|
|
if (x44_ < 0.000009f)
|
|
|
|
sub8015E220();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CScriptPickupGenerator::sub8015E220()
|
|
|
|
{
|
|
|
|
if (x40_frequency > 0.f)
|
|
|
|
x44_ = (100.f / x40_frequency) + 100.f;
|
|
|
|
else
|
|
|
|
x44_ = std::numeric_limits<float>::max();
|
|
|
|
}
|
|
|
|
}
|