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
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2017-11-13 06:19:18 +00:00
|
|
|
CScriptPickupGenerator::CScriptPickupGenerator(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
2016-12-10 02:35:20 +00:00
|
|
|
const zeus::CVector3f& pos, float frequency, bool active)
|
2018-12-08 05:30:43 +00:00
|
|
|
: CEntity(uid, info, active, name), x34_position(pos), x40_frequency(frequency) {}
|
2016-12-10 02:35:20 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CScriptPickupGenerator::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
2017-01-15 03:07:01 +00:00
|
|
|
|
2018-12-08 05:30:43 +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 {
|
2016-12-10 02:35:20 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2016-12-10 02:35:20 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
2016-12-10 02:35:20 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CScriptPickupGenerator::sub8015E220() {
|
|
|
|
if (x40_frequency > 0.f)
|
|
|
|
x44_ = (100.f / x40_frequency) + 100.f;
|
|
|
|
else
|
|
|
|
x44_ = std::numeric_limits<float>::max();
|
2016-12-10 02:35:20 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|