mirror of https://github.com/AxioDL/metaforce.git
CDrone: Implement SetVisorFlareEnabled, UpdateVisorFlare
This commit is contained in:
parent
b3397116db
commit
edadcbef17
|
@ -12,6 +12,7 @@
|
||||||
#include "Runtime/World/CGameLight.hpp"
|
#include "Runtime/World/CGameLight.hpp"
|
||||||
#include "Runtime/World/CPatternedInfo.hpp"
|
#include "Runtime/World/CPatternedInfo.hpp"
|
||||||
#include "Runtime/World/CPlayer.hpp"
|
#include "Runtime/World/CPlayer.hpp"
|
||||||
|
#include "Runtime/World/CScriptVisorFlare.hpp"
|
||||||
#include "Runtime/World/CScriptWater.hpp"
|
#include "Runtime/World/CScriptWater.hpp"
|
||||||
#include "Runtime/World/CTeamAiMgr.hpp"
|
#include "Runtime/World/CTeamAiMgr.hpp"
|
||||||
#include "Runtime/World/CWorld.hpp"
|
#include "Runtime/World/CWorld.hpp"
|
||||||
|
@ -236,9 +237,9 @@ void CDrone::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateM
|
||||||
mgr.FreeScriptObject(x578_lightId);
|
mgr.FreeScriptObject(x578_lightId);
|
||||||
x578_lightId = kInvalidUniqueId;
|
x578_lightId = kInvalidUniqueId;
|
||||||
}
|
}
|
||||||
if (x57a_ != kInvalidUniqueId) {
|
if (x57a_visorFlareId != kInvalidUniqueId) {
|
||||||
mgr.FreeScriptObject(x57a_);
|
mgr.FreeScriptObject(x57a_visorFlareId);
|
||||||
x57a_ = kInvalidUniqueId;
|
x57a_visorFlareId = kInvalidUniqueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x7d0_) {
|
if (x7d0_) {
|
||||||
|
@ -628,11 +629,9 @@ void CDrone::Flee(CStateManager& mgr, EStateMsg msg, float dt) {
|
||||||
GetBodyController()->GetCommandMgr().DeliverCmd(
|
GetBodyController()->GetCommandMgr().DeliverCmd(
|
||||||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::BreakDodge));
|
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::BreakDodge));
|
||||||
} else if (x832_b == 1) {
|
} else if (x832_b == 1) {
|
||||||
GetBodyController()->GetCommandMgr().DeliverCmd(
|
GetBodyController()->GetCommandMgr().DeliverCmd(CBCStepCmd(pas::EStepDirection::Left, pas::EStepType::Normal));
|
||||||
CBCStepCmd(pas::EStepDirection::Left, pas::EStepType::Normal));
|
|
||||||
} else if (x832_b == 2) {
|
} else if (x832_b == 2) {
|
||||||
GetBodyController()->GetCommandMgr().DeliverCmd(
|
GetBodyController()->GetCommandMgr().DeliverCmd(CBCStepCmd(pas::EStepDirection::Right, pas::EStepType::Normal));
|
||||||
CBCStepCmd(pas::EStepDirection::Right, pas::EStepType::Normal));
|
|
||||||
}
|
}
|
||||||
} else if (x7c8_ == 1 &&
|
} else if (x7c8_ == 1 &&
|
||||||
GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Step) {
|
GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Step) {
|
||||||
|
@ -775,7 +774,8 @@ void CDrone::SpecialAttack(CStateManager& mgr, EStateMsg msg, float dt) {
|
||||||
x330_stateMachineState.SetDelay(x660_);
|
x330_stateMachineState.SetDelay(x660_);
|
||||||
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal10);
|
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal10);
|
||||||
} else if (msg == EStateMsg::Update) {
|
} else if (msg == EStateMsg::Update) {
|
||||||
GetBodyController()->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(GetTransform().frontVector(), zeus::skZero3f, 1.f));
|
GetBodyController()->GetCommandMgr().DeliverCmd(
|
||||||
|
CBCLocomotionCmd(GetTransform().frontVector(), zeus::skZero3f, 1.f));
|
||||||
zeus::CVector3f local_74 =
|
zeus::CVector3f local_74 =
|
||||||
0.5f * (mgr.GetPlayer().GetAimPosition(mgr, 0.f) + mgr.GetPlayer().GetTranslation()) - GetTranslation();
|
0.5f * (mgr.GetPlayer().GetAimPosition(mgr, 0.f) + mgr.GetPlayer().GetTranslation()) - GetTranslation();
|
||||||
if (((x668_elevation < x664_ && local_74.z() > 0.f) || (x668_elevation > x664_)) && local_74.canBeNormalized()) {
|
if (((x668_elevation < x664_ && local_74.z() > 0.f) || (x668_elevation > x664_)) && local_74.canBeNormalized()) {
|
||||||
|
@ -900,11 +900,29 @@ void CDrone::SetLightEnabled(CStateManager& mgr, bool activate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDrone::SetVisorFlareEnabled(CStateManager& mgr, bool activate) {
|
void CDrone::SetVisorFlareEnabled(CStateManager& mgr, bool activate) {
|
||||||
// TODO implement
|
if (!IsAlive()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CScriptVisorFlare* flare = TCastToPtr<CScriptVisorFlare>{mgr.ObjectById(x57a_visorFlareId)};
|
||||||
|
if (flare == nullptr && activate) {
|
||||||
|
x57a_visorFlareId = mgr.AllocateUniqueId();
|
||||||
|
flare = new CScriptVisorFlare(x57a_visorFlareId, "DroneVisorFlare"sv,
|
||||||
|
CEntityInfo{GetAreaIdAlways(), CEntity::NullConnectionList}, activate,
|
||||||
|
GetLctrTransform("Beacon_LCTR"sv).origin, CVisorFlare::EBlendMode::Zero, true, 0.1f,
|
||||||
|
1.f, 2.f, 0, 0, x57c_flares);
|
||||||
|
mgr.AddObject(flare);
|
||||||
|
}
|
||||||
|
mgr.SendScriptMsg(flare, GetUniqueId(), activate ? EScriptObjectMessage::Activate : EScriptObjectMessage::Deactivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDrone::UpdateVisorFlare(CStateManager& mgr) {
|
void CDrone::UpdateVisorFlare(CStateManager& mgr) {
|
||||||
// TODO implement
|
TCastToPtr<CScriptVisorFlare> flare = mgr.ObjectById(x57a_visorFlareId);
|
||||||
|
SetVisorFlareEnabled(
|
||||||
|
mgr, (mgr.GetPlayer().GetTranslation() - GetTranslation()).normalized().dot(GetTransform().frontVector()) > 0.f);
|
||||||
|
if (flare) {
|
||||||
|
const auto beaconXf = GetLctrTransform("Beacon_LCTR"sv);
|
||||||
|
flare->SetTranslation(beaconXf.origin + (0.1f * beaconXf.frontVector()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDrone::UpdateTouchBounds(float radius) {
|
void CDrone::UpdateTouchBounds(float radius) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ class CDrone : public CPatterned {
|
||||||
CAssetId x568_laserParticlesId;
|
CAssetId x568_laserParticlesId;
|
||||||
TLockedToken<CCollisionResponseData> x56c_;
|
TLockedToken<CCollisionResponseData> x56c_;
|
||||||
TUniqueId x578_lightId = kInvalidUniqueId;
|
TUniqueId x578_lightId = kInvalidUniqueId;
|
||||||
TUniqueId x57a_ = kInvalidUniqueId;
|
TUniqueId x57a_visorFlareId = kInvalidUniqueId;
|
||||||
std::vector<CVisorFlare::CFlareDef> x57c_flares;
|
std::vector<CVisorFlare::CFlareDef> x57c_flares;
|
||||||
pas::EStepDirection x58c_prevDodgeDir = pas::EStepDirection::Left;
|
pas::EStepDirection x58c_prevDodgeDir = pas::EStepDirection::Left;
|
||||||
CDamageInfo x590_;
|
CDamageInfo x590_;
|
||||||
|
|
|
@ -16,7 +16,7 @@ class CTexture;
|
||||||
class CVisorFlare {
|
class CVisorFlare {
|
||||||
public:
|
public:
|
||||||
enum class EBlendMode {
|
enum class EBlendMode {
|
||||||
|
Zero = 0,
|
||||||
};
|
};
|
||||||
class CFlareDef {
|
class CFlareDef {
|
||||||
TToken<CTexture> x0_tex;
|
TToken<CTexture> x0_tex;
|
||||||
|
|
Loading…
Reference in New Issue