2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 09:47:43 +00:00

Initial CActorContraption and weapon imps

This commit is contained in:
2017-05-18 03:58:15 -07:00
parent 1f25becf8e
commit 40a0d8395a
16 changed files with 241 additions and 53 deletions

View File

@@ -1,4 +1,7 @@
#include "Weapon/CGameProjectile.hpp"
#include "Graphics/CLight.hpp"
#include "World/CGameLight.hpp"
#include "CStateManager.hpp"
#include "TCastTo.hpp"
namespace urde
@@ -16,6 +19,35 @@ CGameProjectile::CGameProjectile(bool active, const TToken<CWeaponDescription>&,
{
}
void CGameProjectile::Accept(urde::IVisitor& visitor) { visitor.Visit(this); }
void CGameProjectile::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId /*uid*/, CStateManager& mgr)
{
if (msg == EScriptObjectMessage::InternalMessage15)
{
if (!x2e4_27_)
{
x2e4_27_ = true;
x2e4_26_ = true;
}
}
else if (msg == EScriptObjectMessage::InternalMessage16)
{
if (!x2e4_26_)
x2e4_26_ = true;
}
else if (msg == EScriptObjectMessage::InternalMessage17)
{
if (x2e4_26_)
{
x2e4_26_ = false;
x2e4_27_ = false;
}
}
else if (msg == EScriptObjectMessage::Deleted)
DeleteProjectileLight(mgr);
}
CWeapon::EProjectileAttrib CGameProjectile::GetBeamAttribType(EWeaponType wType)
{
if (wType == EWeaponType::Ice)
@@ -30,9 +62,25 @@ CWeapon::EProjectileAttrib CGameProjectile::GetBeamAttribType(EWeaponType wType)
return EProjectileAttrib::None;
}
void CGameProjectile::Accept(urde::IVisitor& visitor)
void CGameProjectile::DeleteProjectileLight(CStateManager& mgr)
{
if (x2c8_projectileLight != kInvalidUniqueId)
{
mgr.FreeScriptObject(x2c8_projectileLight);
x2c8_projectileLight = kInvalidUniqueId;
}
}
void CGameProjectile::CreateProjectileLight(const std::string& name, const CLight& light, CStateManager& mgr)
{
DeleteProjectileLight(mgr);
x2c8_projectileLight = mgr.AllocateUniqueId();
mgr.AddObject(new CGameLight(x2c8_projectileLight, GetAreaId(), GetActive(), name, GetTransform(), GetUniqueId(),
light, x2cc_, 0, 0.f));
}
void CGameProjectile::Chase(float dt, CStateManager& mgr)
{
visitor.Visit(this);
}
}