2019-12-22 20:04:07 +00:00
|
|
|
#include "Runtime/World/CScriptRipple.hpp"
|
|
|
|
|
|
|
|
#include "Runtime/CStateManager.hpp"
|
|
|
|
#include "Runtime/World/CScriptWater.hpp"
|
|
|
|
|
2019-09-21 13:07:13 +00:00
|
|
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
2018-05-08 02:18:18 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2018-05-08 02:18:18 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CScriptRipple::CScriptRipple(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& vec,
|
|
|
|
bool active, float f1)
|
|
|
|
: CEntity(uid, info, active, name), x34_magnitude(f1 >= 0.f ? f1 : 0.5f), x38_center(vec) {}
|
2018-05-08 02:18:18 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CScriptRipple::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
2018-05-08 02:18:18 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CScriptRipple::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
2020-05-07 16:29:43 +00:00
|
|
|
if (msg != EScriptObjectMessage::Play) {
|
|
|
|
CEntity::AcceptScriptMsg(msg, uid, mgr);
|
|
|
|
return;
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2020-05-07 16:29:43 +00:00
|
|
|
if (!GetActive()) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-05-07 16:29:43 +00:00
|
|
|
|
|
|
|
for (const SConnection& conn : x20_conns) {
|
|
|
|
if (conn.x0_state != EScriptObjectState::Active || conn.x4_msg != EScriptObjectMessage::Next) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto search = mgr.GetIdListForScript(conn.x8_objId);
|
|
|
|
for (auto it = search.first; it != search.second; ++it) {
|
|
|
|
if (const TCastToPtr<CScriptWater> water = mgr.ObjectById(it->second)) {
|
|
|
|
water->GetFluidPlane().AddRipple(x34_magnitude, GetUniqueId(), x38_center, *water, mgr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-08 02:18:18 +00:00
|
|
|
}
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|