mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of ssh://git.axiodl.com:6431/AxioDL/urde
This commit is contained in:
commit
9512f6c98d
|
@ -3,10 +3,7 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
static CRandom16 DefaultRandom(0);
|
||||
static CGlobalRandom DefaultGlobalRandom(DefaultRandom);
|
||||
|
||||
CRandom16* CRandom16::g_randomNumber = &DefaultRandom;
|
||||
CGlobalRandom* CGlobalRandom::g_currentGlobalRandom = &DefaultGlobalRandom;
|
||||
CRandom16* CRandom16::g_randomNumber = nullptr;// &DefaultRandom;
|
||||
CGlobalRandom* CGlobalRandom::g_currentGlobalRandom = nullptr;//&DefaultGlobalRandom;
|
||||
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ class CRandom16
|
|||
u32 m_seed;
|
||||
static CRandom16* g_randomNumber;
|
||||
public:
|
||||
CRandom16() = default;
|
||||
CRandom16(u32 p) : m_seed(p) {}
|
||||
CRandom16(u32 p = 99) : m_seed(p) {}
|
||||
|
||||
inline u32 Next()
|
||||
{
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
CCollisionActorManager::CCollisionActorManager(CStateManager&, TUniqueId, TAreaId,
|
||||
const std::vector<CJointCollisionDescription>& descs, bool)
|
||||
CCollisionActorManager::CCollisionActorManager(CStateManager& mgr, TUniqueId owner, TAreaId area,
|
||||
const std::vector<CJointCollisionDescription>& descs, bool b1)
|
||||
: x0_jointDescriptions(descs)
|
||||
, x10_ownerId(owner)
|
||||
, x12_(b1)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -21,9 +23,22 @@ void CCollisionActorManager::Destroy(CStateManager& mgr) const
|
|||
const_cast<CCollisionActorManager&>(*this).x13_ = true;
|
||||
}
|
||||
|
||||
void CCollisionActorManager::SetActive(CStateManager&, bool)
|
||||
void CCollisionActorManager::SetActive(CStateManager& mgr, bool active)
|
||||
{
|
||||
for (const CJointCollisionDescription& jDesc : x0_jointDescriptions)
|
||||
{
|
||||
TCastToPtr<CActor> act(mgr.ObjectById(jDesc.GetCollisionActorId()));
|
||||
|
||||
if (act)
|
||||
{
|
||||
bool curActive = act->GetActive();
|
||||
if (curActive != active)
|
||||
act->SetActive(active);
|
||||
|
||||
if (!curActive)
|
||||
Update(0.f, mgr, EUpdateOptions::One);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCollisionActorManager::AddMaterial(CStateManager& mgr, const CMaterialList& list)
|
||||
|
@ -49,7 +64,6 @@ CJointCollisionDescription CCollisionActorManager::GetCollisionDescFromIndex(u32
|
|||
|
||||
void CCollisionActorManager::Update(float, CStateManager&, CCollisionActorManager::EUpdateOptions) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,13 +15,16 @@ class CCollisionActorManager
|
|||
public:
|
||||
enum class EUpdateOptions
|
||||
{
|
||||
Zero
|
||||
Zero,
|
||||
One
|
||||
};
|
||||
|
||||
private:
|
||||
std::vector<CJointCollisionDescription> x0_jointDescriptions;
|
||||
TUniqueId x10_;
|
||||
TUniqueId x10_ownerId;
|
||||
bool x12_;
|
||||
bool x13_ = false;
|
||||
bool x14_ = true;
|
||||
public:
|
||||
CCollisionActorManager(CStateManager&, TUniqueId, TAreaId, const std::vector<CJointCollisionDescription>&, bool);
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ CCollisionResponseData::CCollisionResponseData(CInputStream& in, CSimplePool* re
|
|||
FourCC clsId = CPF::GetClassID(in);
|
||||
if (clsId == UncookedResType())
|
||||
{
|
||||
CRandom16 rand{99};
|
||||
CRandom16 rand;
|
||||
CGlobalRandom gr(rand);
|
||||
|
||||
while (clsId != SBIG('_END'))
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
enum class EOrientationType
|
||||
{
|
||||
Zero,
|
||||
One
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -117,8 +117,8 @@ void CSamusHud::InitializeFrameGluePermanent(const CStateManager& mgr)
|
|||
{
|
||||
SVideoBand& band = x5a4_videoBands[i];
|
||||
band.x0_videoband = static_cast<CGuiModel*>(x274_loadedFrmeBaseHud->FindWidget(hecl::Format("model_videoband%d", i)));
|
||||
band.x4_randA = CRandom16::GetRandomNumber()->Range(6.f, 66.f);
|
||||
band.x8_randB = CRandom16::GetRandomNumber()->Range(16.f, 256.f);
|
||||
band.x4_randA = 6 + (std::rand() % ((66 - 6) + 1));
|
||||
band.x8_randB = 16 + (std::rand() % ((256 - 16) + 1));
|
||||
}
|
||||
x59c_base_textpane_message->SetDepthTest(false);
|
||||
x598_base_basewidget_message->SetVisibility(false, ETraversalMode::Children);
|
||||
|
|
|
@ -83,7 +83,6 @@ CGameArchitectureSupport::CGameArchitectureSupport(CMain& parent,
|
|||
{
|
||||
CMain* m = static_cast<CMain*>(g_Main);
|
||||
|
||||
g_GuiSys = &x44_guiSys;
|
||||
x30_inputGenerator.startScanning();
|
||||
g_InputGenerator = &x30_inputGenerator;
|
||||
|
||||
|
@ -94,8 +93,11 @@ CGameArchitectureSupport::CGameArchitectureSupport(CMain& parent,
|
|||
CStreamAudioManager::SetMusicVolume(0x7f);
|
||||
m->ResetGameState();
|
||||
|
||||
//std::shared_ptr<CIOWin> splash = std::make_shared<CSplashScreen>(CSplashScreen::ESplashScreen::Nintendo);
|
||||
//x58_ioWinManager.AddIOWin(splash, 1000, 10000);
|
||||
if (!g_tweakGame->GetSplashScreensDisabled())
|
||||
{
|
||||
std::shared_ptr<CIOWin> splash = std::make_shared<CSplashScreen>(CSplashScreen::ESplashScreen::Nintendo);
|
||||
x58_ioWinManager.AddIOWin(splash, 1000, 10000);
|
||||
}
|
||||
|
||||
std::shared_ptr<CIOWin> mf = std::make_shared<CMainFlow>();
|
||||
x58_ioWinManager.AddIOWin(mf, 0, 0);
|
||||
|
@ -108,6 +110,9 @@ CGameArchitectureSupport::CGameArchitectureSupport(CMain& parent,
|
|||
|
||||
std::shared_ptr<CIOWin> errWin = std::make_shared<CErrorOutputWindow>(false);
|
||||
x58_ioWinManager.AddIOWin(errWin, 10000, 100000);
|
||||
|
||||
g_GuiSys = &x44_guiSys;
|
||||
g_GameState->GameOptions().EnsureSettings();
|
||||
}
|
||||
|
||||
void CGameArchitectureSupport::UpdateTicks()
|
||||
|
@ -794,6 +799,7 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr,
|
|||
x164_archSupport.reset(new CGameArchitectureSupport(*this, voiceEngine, backend));
|
||||
g_archSupport = x164_archSupport.get();
|
||||
x164_archSupport->PreloadAudio();
|
||||
std::srand(std::time(nullptr));
|
||||
//g_TweakManager->ReadFromMemoryCard("AudioTweaks");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,68 @@
|
|||
#include "CFireFlea.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "CPlayerState.hpp"
|
||||
#include "TCastTo.hpp"
|
||||
|
||||
namespace urde::MP1
|
||||
{
|
||||
|
||||
//region Fire Flea Death Camera
|
||||
|
||||
const zeus::CColor CFireFlea::CDeathCameraEffect::skEndFadeColor{1.f, 1.f, 0.5f, 1.f};
|
||||
const zeus::CColor CFireFlea::CDeathCameraEffect::skStartFadeColor{1.f, 0.f, 0.f, 0.f};
|
||||
zeus::CColor CFireFlea::CDeathCameraEffect::sCurrentFadeColor = zeus::CColor::skClear;
|
||||
|
||||
CFireFlea::CDeathCameraEffect::CDeathCameraEffect(TUniqueId uid, TAreaId areaId, std::string_view name)
|
||||
: CEntity(uid, CEntityInfo(areaId, CEntity::NullConnectionList), true, name)
|
||||
{
|
||||
}
|
||||
|
||||
void CFireFlea::CDeathCameraEffect::Accept(IVisitor& visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
|
||||
void CFireFlea::CDeathCameraEffect::PreThink(float dt, CStateManager& mgr)
|
||||
{
|
||||
CCameraFilterPassPoly& filterPass = mgr.GetCameraFilterPass(5);
|
||||
u32 r5 = x34_ + x38_;
|
||||
u32 r8 = r5 + x3c_;
|
||||
u32 r31 = r8 + x40_;
|
||||
if (x44_ >= x34_ && x44_ <= r5)
|
||||
{
|
||||
sCurrentFadeColor += zeus::CColor::lerp(skStartFadeColor, skEndFadeColor, x34_- x44_);
|
||||
filterPass.SetFilter(EFilterType::Blend, EFilterShape::Fullscreen, 0.f, sCurrentFadeColor, CAssetId());
|
||||
}
|
||||
else if (x44_ >= r8 && x44_ <= r31)
|
||||
{
|
||||
sCurrentFadeColor += zeus::CColor::lerp(skEndFadeColor, skStartFadeColor, r8 - x44_);
|
||||
filterPass.SetFilter(EFilterType::Blend, EFilterShape::Fullscreen, 0.f, sCurrentFadeColor, CAssetId());
|
||||
}
|
||||
else if (x44_ > r5)
|
||||
{
|
||||
sCurrentFadeColor = skEndFadeColor;
|
||||
filterPass.SetFilter(EFilterType::Blend, EFilterShape::Fullscreen, 0.f, sCurrentFadeColor, CAssetId());
|
||||
}
|
||||
|
||||
if (r31 == x44_)
|
||||
{
|
||||
filterPass.DisableFilter(0.f);
|
||||
mgr.FreeScriptObject(GetUniqueId());
|
||||
x44_ = 0;
|
||||
} else
|
||||
x44_++;
|
||||
|
||||
if (mgr.GetPlayerState()->GetActiveVisor(mgr) != CPlayerState::EPlayerVisor::Thermal)
|
||||
filterPass.DisableFilter(0.f);
|
||||
}
|
||||
|
||||
void CFireFlea::CDeathCameraEffect::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
sCurrentFadeColor = zeus::CColor::skClear;
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
CFireFlea::CFireFlea(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo, float)
|
||||
: CPatterned(ECharacter::FireFlea, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
||||
|
|
|
@ -6,6 +6,24 @@ namespace urde::MP1
|
|||
{
|
||||
class CFireFlea : public CPatterned
|
||||
{
|
||||
class CDeathCameraEffect : CEntity
|
||||
{
|
||||
u32 x34_ = 13;
|
||||
u32 x38_ = 5;
|
||||
u32 x3c_ = 60;
|
||||
u32 x40_ = 190;
|
||||
u32 x44_ = 0;
|
||||
public:
|
||||
static const zeus::CColor skStartFadeColor;
|
||||
static const zeus::CColor skEndFadeColor;
|
||||
static zeus::CColor sCurrentFadeColor;
|
||||
CDeathCameraEffect(TUniqueId, TAreaId, std::string_view);
|
||||
|
||||
void Accept(IVisitor&);
|
||||
void PreThink(float, CStateManager&);
|
||||
void Think(float, CStateManager&);
|
||||
};
|
||||
|
||||
public:
|
||||
DEFINE_PATTERNED(FireFlea)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
namespace urde
|
||||
{
|
||||
CRandom16 CDecal::sDecalRandom(99);
|
||||
CRandom16 CDecal::sDecalRandom;
|
||||
bool CDecal::sMoveRedToAlphaBuffer = false;
|
||||
|
||||
CDecal::CDecal(const TToken<CDecalDescription>& desc, const zeus::CTransform& xf)
|
||||
|
|
|
@ -33,7 +33,7 @@ CDecalDescription* CDecalDataFactory::CreateGeneratorDescription(CInputStream& i
|
|||
|
||||
bool CDecalDataFactory::CreateDPSM(CDecalDescription* desc, CInputStream& in, CSimplePool* resPool)
|
||||
{
|
||||
CRandom16 rand{99};
|
||||
CRandom16 rand;
|
||||
CGlobalRandom gr{rand};
|
||||
FourCC clsId = CPF::GetClassID(in);
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ CElementGen::CElementGen(const TToken<CGenDescription>& gen,
|
|||
if (desc->x58_x44_TIND)
|
||||
desc->x58_x44_TIND->GetValueTexture(0).GetObj();
|
||||
|
||||
CGlobalRandom globRnd(x27c_randState);
|
||||
if (CIntElement* seedElem = desc->x1c_x10_SEED.get())
|
||||
{
|
||||
int seedVal;
|
||||
|
|
|
@ -858,7 +858,7 @@ CGenDescription* CParticleDataFactory::CreateGeneratorDescription(CInputStream&
|
|||
bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& in,
|
||||
std::vector<CAssetId>& tracker, CSimplePool* resPool)
|
||||
{
|
||||
CRandom16 rand{99};
|
||||
CRandom16 rand;
|
||||
CGlobalRandom gr(rand);
|
||||
FourCC clsId = GetClassID(in);
|
||||
while (clsId != SBIG('_END'))
|
||||
|
|
|
@ -34,7 +34,7 @@ CElectricDescription* CParticleElectricDataFactory::CreateElectricDescription(CI
|
|||
|
||||
bool CParticleElectricDataFactory::CreateELSM(CElectricDescription* desc, CInputStream& in, CSimplePool* resPool)
|
||||
{
|
||||
CRandom16 rand{99};
|
||||
CRandom16 rand;
|
||||
CGlobalRandom gr{rand};
|
||||
|
||||
FourCC clsId = CPF::GetClassID(in);
|
||||
|
|
|
@ -33,7 +33,7 @@ CSwooshDescription* CParticleSwooshDataFactory::CreateGeneratorDescription(CInpu
|
|||
|
||||
bool CParticleSwooshDataFactory::CreateWPSM(CSwooshDescription* desc, CInputStream& in, CSimplePool* resPool)
|
||||
{
|
||||
CRandom16 rand{99};
|
||||
CRandom16 rand;
|
||||
FourCC clsId = CPF::GetClassID(in);
|
||||
while (clsId != SBIG('_END'))
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ CWeaponDescription* CProjectileWeaponDataFactory::CreateGeneratorDescription(CIn
|
|||
|
||||
bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputStream& in, CSimplePool* resPool)
|
||||
{
|
||||
CRandom16 rand{99};
|
||||
CRandom16 rand;
|
||||
CGlobalRandom gr{rand};
|
||||
FourCC clsId = CPF::GetClassID(in);
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ void CAmbientAI::Accept(IVisitor& visitor)
|
|||
|
||||
void CAmbientAI::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
return;
|
||||
if (!GetActive())
|
||||
return;
|
||||
|
||||
|
@ -115,7 +114,6 @@ void CAmbientAI::Think(float dt, CStateManager& mgr)
|
|||
|
||||
void CAmbientAI::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
{
|
||||
return;
|
||||
switch(msg)
|
||||
{
|
||||
case EScriptObjectMessage::Reset:
|
||||
|
|
|
@ -1962,7 +1962,7 @@ void CMorphBall::RenderIceBreakEffect(const CStateManager& mgr) const
|
|||
|
||||
void CMorphBall::RenderDamageEffects(const CStateManager& mgr, const zeus::CTransform& xf) const
|
||||
{
|
||||
CRandom16 rand(99);
|
||||
CRandom16 rand;
|
||||
CModelFlags flags(7, 0, 1, zeus::CColor(0.25f * x1e44_damageEffect, 0.1f * x1e44_damageEffect,
|
||||
0.1f * x1e44_damageEffect, 1.f)); // No Z update
|
||||
flags.m_extendedShader = EExtendedShader::SolidColorAdditive;
|
||||
|
|
|
@ -268,7 +268,7 @@ void CScriptGunTurret::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid,
|
|||
|
||||
if (TCastToConstPtr<CScriptGunTurret> gun = mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)))
|
||||
{
|
||||
x25c_ = mgr.GetIdForScript(conn.x8_objId);
|
||||
x25c_gunId = mgr.GetIdForScript(conn.x8_objId);
|
||||
x260_ = gun->GetHealthInfo(mgr)->GetHP();
|
||||
return;
|
||||
}
|
||||
|
@ -374,9 +374,19 @@ zeus::CVector3f CScriptGunTurret::GetAimPosition(const CStateManager &, float) c
|
|||
return GetTranslation();
|
||||
}
|
||||
|
||||
void CScriptGunTurret::SetupCollisionManager(CStateManager&)
|
||||
void CScriptGunTurret::SetupCollisionManager(CStateManager& mgr)
|
||||
{
|
||||
std::vector<CJointCollisionDescription> jointDescs;
|
||||
jointDescs.reserve(2);
|
||||
const CAnimData* animData = GetModelData()->GetAnimationData();
|
||||
x508_gunSDKSeg = animData->GetLocatorSegId("Gun_SDK"sv);
|
||||
CSegId blastLCTR = animData->GetLocatorSegId("Blast_LCTR"sv);
|
||||
jointDescs.push_back(CJointCollisionDescription::SphereSubdivideCollision(x508_gunSDKSeg, blastLCTR, 0.6f, 1.f,
|
||||
CJointCollisionDescription::EOrientationType::One,
|
||||
"Gun_SDK"sv, 1000.f));
|
||||
jointDescs.push_back(CJointCollisionDescription::SphereCollision(blastLCTR, 0.3f, "Blast_LCTR"sv, 1000.f));
|
||||
|
||||
x49c_collisionManager.reset(new CCollisionActorManager(mgr, GetUniqueId(), GetAreaIdAlways(), jointDescs, true));
|
||||
}
|
||||
|
||||
void CScriptGunTurret::sub80219b18(s32 w1, CStateManager& mgr)
|
||||
|
@ -606,9 +616,9 @@ void CScriptGunTurret::sub80219a00(float dt, CStateManager& mgr)
|
|||
sub80219b18(1, mgr);
|
||||
x524_ += dt;
|
||||
sub80217124(mgr);
|
||||
if (x25c_ != kInvalidUniqueId)
|
||||
if (x25c_gunId != kInvalidUniqueId)
|
||||
{
|
||||
if (TCastToPtr<CScriptGunTurret> gunTurret = mgr.ObjectById(x25c_))
|
||||
if (TCastToPtr<CScriptGunTurret> gunTurret = mgr.ObjectById(x25c_gunId))
|
||||
{
|
||||
if (gunTurret->x520_ != 12)
|
||||
gunTurret->x520_ = x520_;
|
||||
|
@ -667,7 +677,7 @@ void CScriptGunTurret::sub8021998c(s32 w1, CStateManager& mgr, float dt)
|
|||
sub80218f50(w1, mgr, dt);
|
||||
break;
|
||||
case 11:
|
||||
sub80218e34(w1, mgr, dt);
|
||||
sub80218e34(w1, mgr);
|
||||
break;
|
||||
case 12:
|
||||
sub80218bb4(w1, mgr, dt);
|
||||
|
@ -696,7 +706,7 @@ void CScriptGunTurret::sub802196c4(s32 w1, CStateManager& mgr, float dt)
|
|||
{
|
||||
x528_ = 0.f;
|
||||
x560_27_ = false;
|
||||
if (TCastToPtr<CScriptGunTurret> gunTurret = mgr.ObjectById(x25c_))
|
||||
if (TCastToPtr<CScriptGunTurret> gunTurret = mgr.ObjectById(x25c_gunId))
|
||||
x260_ = gunTurret->HealthInfo(mgr)->GetHP();
|
||||
}
|
||||
else if (w1 == 1)
|
||||
|
@ -707,7 +717,7 @@ void CScriptGunTurret::sub802196c4(s32 w1, CStateManager& mgr, float dt)
|
|||
x560_28_ = true;
|
||||
x468_->SetParticleEmission(false);
|
||||
|
||||
if (TCastToPtr<CScriptGunTurret> gunTurret = mgr.ObjectById(x25c_))
|
||||
if (TCastToPtr<CScriptGunTurret> gunTurret = mgr.ObjectById(x25c_gunId))
|
||||
x260_ = gunTurret->GetHealthInfo(mgr)->GetHP();
|
||||
}
|
||||
}
|
||||
|
@ -777,9 +787,9 @@ void CScriptGunTurret::sub80218f50(s32 state, CStateManager& mgr, float dt)
|
|||
if (sub802179a4(mgr))
|
||||
{
|
||||
sub80218830(dt, mgr);
|
||||
if (x25c_ != kInvalidUniqueId)
|
||||
if (x25c_gunId != kInvalidUniqueId)
|
||||
{
|
||||
if (TCastToPtr<CScriptGunTurret> gun = mgr.ObjectById(x25c_))
|
||||
if (TCastToPtr<CScriptGunTurret> gun = mgr.ObjectById(x25c_gunId))
|
||||
{
|
||||
zeus::CVector3f vec = x404_;
|
||||
if (sub80217ad8(mgr))
|
||||
|
@ -835,19 +845,75 @@ void CScriptGunTurret::sub80218f50(s32 state, CStateManager& mgr, float dt)
|
|||
}
|
||||
}
|
||||
|
||||
void CScriptGunTurret::sub80218e34(s32, CStateManager&, float)
|
||||
void CScriptGunTurret::sub80218e34(s32 state, CStateManager& mgr)
|
||||
{
|
||||
if (state != 1 || x25c_gunId == kInvalidUniqueId)
|
||||
return;
|
||||
|
||||
if (TCastToPtr<CScriptGunTurret> gun = mgr.ObjectById(x25c_gunId))
|
||||
{
|
||||
zeus::CTransform gunXf = GetTransform() * GetLocatorTransform("Gun_SDK"sv);
|
||||
|
||||
if (zeus::CVector3f::getAngleDiff(gun->GetTransform().frontVector(), x544_) < zeus::degToRad(0.9f))
|
||||
sub80219b18(6, mgr);
|
||||
}
|
||||
}
|
||||
|
||||
void CScriptGunTurret::sub80218bb4(s32, CStateManager&, float)
|
||||
void CScriptGunTurret::sub80218bb4(s32 state, CStateManager& mgr, float dt)
|
||||
{
|
||||
|
||||
if (state == 0)
|
||||
{
|
||||
x560_31_ = mgr.GetActiveRandom()->Float() < 0.f;
|
||||
x534_ = 0.15f;
|
||||
RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
||||
mgr.GetPlayer().SetOrbitRequestForTarget(GetUniqueId(), CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr);
|
||||
} else if (state == 1)
|
||||
{
|
||||
if (x524_ >= x2d4_data.x9c_)
|
||||
{
|
||||
sub80219b18(0, mgr);
|
||||
if (TCastToPtr<CScriptGunTurret> gun = mgr.ObjectById(x25c_gunId))
|
||||
gun->x520_ = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
bool CScriptGunTurret::sub80217ad8(CStateManager&)
|
||||
zeus::CVector3f frontVec = GetTransform().frontVector();
|
||||
if (x560_31_ && x550_.magSquared() < 0.f &&
|
||||
zeus::CVector3f::getAngleDiff(x544_, frontVec) >= zeus::degToRad(45.f))
|
||||
{
|
||||
return false;
|
||||
x560_31_ = false;
|
||||
} else if (!x560_31_ && x550_.magSquared() < 0.f &&
|
||||
zeus::CVector3f::getAngleDiff(x544_, frontVec) >= zeus::degToRad(45.f))
|
||||
{
|
||||
x560_31_ = true;
|
||||
}
|
||||
|
||||
if (TCastToPtr<CScriptGunTurret> gun = mgr.ObjectById(x25c_gunId))
|
||||
{
|
||||
x534_ -= dt;
|
||||
if (x534_ >= 0.f)
|
||||
return;
|
||||
|
||||
x404_ = gun->GetTranslation() + (100.f * gun->GetTransform().frontVector());
|
||||
SendScriptMsgs(EScriptObjectState::Attack, mgr, EScriptObjectMessage::None);
|
||||
x534_ = 0.15f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CScriptGunTurret::sub80217ad8(CStateManager& mgr)
|
||||
{
|
||||
zeus::CVector3f posDif = mgr.GetPlayer().GetTranslation() - GetTranslation();
|
||||
zeus::CVector3f someVec(posDif.x, posDif.y, 0.f);
|
||||
if (x550_.dot(posDif) >= 0.f)
|
||||
return zeus::CVector3f::getAngleDiff(x544_, someVec) <= x2d4_data.x20_;
|
||||
|
||||
if (zeus::CVector3f::getAngleDiff(x544_, someVec) <= x2d4_data.x20_)
|
||||
return true;
|
||||
|
||||
float biasedAngle = zeus::CVector3f::getAngleDiff(posDif, zeus::CVector3f::skUp) - zeus::degToRad(90.f);
|
||||
|
||||
return (biasedAngle >= zeus::degToRad(-20.f) && biasedAngle <= x2d4_data.x24_);
|
||||
}
|
||||
|
||||
bool CScriptGunTurret::sub802179a4(CStateManager&)
|
||||
|
@ -871,10 +937,10 @@ zeus::CVector3f CScriptGunTurret::sub80217e34(float dt)
|
|||
void CScriptGunTurret::sub80217f5c(float dt, CStateManager& mgr)
|
||||
{
|
||||
/* TODO: Finish */
|
||||
if (x25c_ == kInvalidUniqueId)
|
||||
if (x25c_gunId == kInvalidUniqueId)
|
||||
return;
|
||||
|
||||
if (TCastToPtr<CScriptGunTurret> gun = mgr.ObjectById(x25c_))
|
||||
if (TCastToPtr<CScriptGunTurret> gun = mgr.ObjectById(x25c_gunId))
|
||||
{
|
||||
zeus::CTransform xf = GetLocatorTransform("Gun_SDK"sv);
|
||||
xf = GetTransform() * xf;
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
private:
|
||||
|
||||
ETurretComponent x258_type;
|
||||
TUniqueId x25c_ = kInvalidUniqueId;
|
||||
TUniqueId x25c_gunId = kInvalidUniqueId;
|
||||
float x260_ = 0.f;
|
||||
CHealthInfo x264_healthInfo;
|
||||
CDamageVulnerability x26c_damageVuln;
|
||||
|
@ -117,7 +117,7 @@ private:
|
|||
float x4f4_ = 0.f;
|
||||
float x4f8_ = 0.f;
|
||||
zeus::CVector3f x4fc_;
|
||||
u8 x508_ = 0xFF;
|
||||
u8 x508_gunSDKSeg = 0xFF;
|
||||
CSfxHandle x50c_ = 0;
|
||||
float x510_ = 0.f;
|
||||
zeus::CVector3f x514_;
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
void sub802195bc(s32, CStateManager&, float);
|
||||
void sub8021942c(s32, CStateManager&, float);
|
||||
void sub80218f50(s32, CStateManager&, float);
|
||||
void sub80218e34(s32, CStateManager&, float);
|
||||
void sub80218e34(s32, CStateManager&);
|
||||
void sub80218bb4(s32, CStateManager&, float);
|
||||
bool sub80217ad8(CStateManager&);
|
||||
bool sub802179a4(CStateManager&);
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit 91a0755d30574217539042b7a6a3c6db08653bcc
|
||||
Subproject commit 5fece8ddb1a58e23e0957232964bc91a007cf123
|
Loading…
Reference in New Issue