From 256994c199a22ca9fb8e276bc3fa27afe6b26217 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 31 Aug 2019 02:02:21 -0700 Subject: [PATCH] Initial CEnergyBall, update submodules, various fixes --- DataSpec/DNACommon/CMakeLists.txt | 1 + DataSpec/DNACommon/MayaSpline.hpp | 24 ++++++++ DataSpec/DNAMP3/CAUD.cpp | 21 ------- DataSpec/DNAMP3/CAUD.hpp | 84 ++++++++-------------------- DataSpec/DNAMP3/CMakeLists.txt | 1 - DataSpec/DNAMP3/DNAMP3.cpp | 24 ++++---- DataSpec/SpecBase.cpp | 1 + Editor/badging/Badging.cpp | 2 + Runtime/MP1/World/CEnergyBall.cpp | 92 ++++++++++++++++++++++++++++++- Runtime/MP1/World/CEnergyBall.hpp | 28 ++++++++++ Runtime/World/CPatterned.cpp | 4 ++ Runtime/World/CPatterned.hpp | 1 + Runtime/World/CPatternedInfo.hpp | 1 + amuse | 2 +- hecl | 2 +- hecl-gui | 2 +- kabufuda | 2 +- nod | 2 +- specter | 2 +- 19 files changed, 195 insertions(+), 101 deletions(-) create mode 100644 DataSpec/DNACommon/MayaSpline.hpp delete mode 100644 DataSpec/DNAMP3/CAUD.cpp diff --git a/DataSpec/DNACommon/CMakeLists.txt b/DataSpec/DNACommon/CMakeLists.txt index 19fcd9ac4..39a616532 100644 --- a/DataSpec/DNACommon/CMakeLists.txt +++ b/DataSpec/DNACommon/CMakeLists.txt @@ -4,6 +4,7 @@ make_dnalist(CMDL FSM2 MAPA MAPU + MayaSpline EGMC SAVWCommon ParticleCommon diff --git a/DataSpec/DNACommon/MayaSpline.hpp b/DataSpec/DNACommon/MayaSpline.hpp new file mode 100644 index 000000000..00b48fae3 --- /dev/null +++ b/DataSpec/DNACommon/MayaSpline.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include "DataSpec/DNACommon/DNACommon.hpp" + +namespace DataSpec { +struct MayaSpline : public BigDNA { + AT_DECL_DNA_YAML + Value preInf; + Value postInf; + Value knotCount; + struct Knot : BigDNA { + AT_DECL_DNA_YAML + Value time; + Value amplitude; + Value unk1; + Value unk2; + }; + + Vector knots; + Value clampMode; + Value minAmp; + Value maxAmp; +}; +} \ No newline at end of file diff --git a/DataSpec/DNAMP3/CAUD.cpp b/DataSpec/DNAMP3/CAUD.cpp deleted file mode 100644 index 162c8086e..000000000 --- a/DataSpec/DNAMP3/CAUD.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "CAUD.hpp" - -namespace DataSpec::DNAMP3 { - -template -void CAUD::CSMPInfo::UnknownStruct2::UnknownQuad::Enumerate(typename Op::StreamT& s) { - Do(athena::io::PropId{"unknown1"}, unknown1, s); - Do(athena::io::PropId{"unknown2"}, unknown2, s); - Do(athena::io::PropId{"unknown3"}, unknown3, s); - Do(athena::io::PropId{"unknown4"}, unknown4, s); - if (unknown4 == 5) - Do(athena::io::PropId{"unknown5"}, unknown5, s); -} - -AT_SPECIALIZE_DNA_YAML(CAUD::CSMPInfo::UnknownStruct2::UnknownQuad) - -const char* CAUD::CSMPInfo::UnknownStruct2::UnknownQuad::DNAType() { - return "DataSpec::DNAMP3::CAUD::CSMPInfo::UnknownStruct2::UnknownQuad"; -} - -} // namespace DataSpec::DNAMP3 diff --git a/DataSpec/DNAMP3/CAUD.hpp b/DataSpec/DNAMP3/CAUD.hpp index 6edb47108..6b9964849 100644 --- a/DataSpec/DNAMP3/CAUD.hpp +++ b/DataSpec/DNAMP3/CAUD.hpp @@ -1,8 +1,8 @@ #pragma once #include "DataSpec/DNACommon/DNACommon.hpp" +#include "DataSpec/DNACommon/MayaSpline.hpp" #include "DataSpec/DNACommon/PAK.hpp" - namespace DataSpec::DNAMP3 { struct CAUD : BigDNA { @@ -10,8 +10,8 @@ struct CAUD : BigDNA { DNAFourCC magic; Value version; String<-1> name; - Value nameCount; - Vector, AT_DNA_COUNT(nameCount)> names; + Value volumeGroupCount; + Vector, AT_DNA_COUNT(volumeGroupCount)> volumeGroups; Value unknown1; Value unknown2; Value unknown3; @@ -24,75 +24,39 @@ struct CAUD : BigDNA { UniqueID64 csmpId; Value unknown1; Value unknown2; - Value unknown3; + Value unknown3; Value unknown4; Value unknown5; Value unknown6; Value unknown7; - Value unknown8; - Value unknown9; + Value unknown8; + Value unknown9; Value unknown10; Value unknown11; Value unknown12; Value unknown13; - Value unknown14[8]; - struct UnknownStruct1 : BigDNA { + Value unknown14; + Value unknown15; + Value unknown16; + Value unknown17; + Value unknown18; + Value unknown19; + MayaSpline spline1; + MayaSpline spline2; + MayaSpline spline3; + MayaSpline spline4; + Value unkStructCount; + struct UnknownStruct : BigDNA { AT_DECL_DNA_YAML Value unknown1; Value unknown2; - Value unknown3; - Value unknown4; }; - Value unknown15; - Vector unknown16; - struct UnknownStruct2 : BigDNA { - AT_DECL_DNA_YAML - Value unknown1; - Vector unknown2; - Value unknown3; - Value unknown4; - Value unknown5; - struct UnknownPair : BigDNA { - AT_DECL_DNA_YAML - Value unknown1; - Value unknown2; - }; - Value unknown6; - Vector unknown7; - struct UnknownQuad : BigDNA { - AT_DECL_EXPLICIT_DNA_YAML - Value unknown1; - Value unknown2; - Value unknown3; - Value unknown4; - Value unknown5[5]; - }; - - Value unknown8; - Vector unknown9; - }; - UnknownStruct2 unknown17[4]; - Value unknown18; - Value unknown19; - Value unknown20; - Value unknown21; - Value unknown22; - Value unknown23; - Value unknown24; - Value unknown25; - Value unknown26; - Value unknown27; - Value unknown28; - struct UnknownStruct3 : BigDNA { - AT_DECL_DNA_YAML - Value unknown1; - Value unknown2; - Value unknown3; - Value unknown4; - }; - Vector unknown29; - Value unknown30; - Value unknown31; + Vector unkStructs; + Value unknown20; + Value unknown21; + Value unknown22; + Value unknown23; + MayaSpline spline5; }; Value infoCount; diff --git a/DataSpec/DNAMP3/CMakeLists.txt b/DataSpec/DNAMP3/CMakeLists.txt index a937e6d87..0c0ea91a6 100644 --- a/DataSpec/DNAMP3/CMakeLists.txt +++ b/DataSpec/DNAMP3/CMakeLists.txt @@ -19,7 +19,6 @@ set(DNAMP3_SOURCES CMDL.hpp CMDL.cpp CMDLMaterials.cpp CSKR.cpp - CAUD.cpp STRG.hpp STRG.cpp MAPA.hpp MREA.cpp) diff --git a/DataSpec/DNAMP3/DNAMP3.cpp b/DataSpec/DNAMP3/DNAMP3.cpp index a43abae56..45acd0d9f 100644 --- a/DataSpec/DNAMP3/DNAMP3.cpp +++ b/DataSpec/DNAMP3/DNAMP3.cpp @@ -226,8 +226,8 @@ void PAKBridge::addMAPATransforms(PAKRouter& pakRouter, ResExtractor PAKBridge::LookupExtractor(const nod::Node& pakNode, const PAK& pak, const PAK::Entry& entry) { switch (entry.type.toUint32()) { - // case SBIG('CAUD'): - // return {CAUD::Extract, {_SYS_STR(".yaml")}}; + case SBIG('CAUD'): + return {CAUD::Extract, {_SYS_STR(".yaml")}}; case SBIG('STRG'): return {STRG::Extract, {_SYS_STR(".yaml")}}; case SBIG('TXTR'): @@ -236,16 +236,16 @@ ResExtractor PAKBridge::LookupExtractor(const nod::Node& pakNode, con return {SAVWCommon::ExtractSAVW, {_SYS_STR(".yaml")}}; case SBIG('HINT'): return {HINT::Extract, {_SYS_STR(".yaml")}}; - case SBIG('CMDL'): - return {CMDL::Extract, {_SYS_STR(".blend")}, 1}; - case SBIG('CHAR'): - return {CHAR::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 2}; - case SBIG('MLVL'): - return {MLVL::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 3}; - case SBIG('MREA'): - return {MREA::Extract, {_SYS_STR(".blend")}, 4}; - case SBIG('MAPA'): - return {MAPA::Extract, {_SYS_STR(".blend")}, 4}; +// case SBIG('CMDL'): +// return {CMDL::Extract, {_SYS_STR(".blend")}, 1}; +// case SBIG('CHAR'): +// return {CHAR::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 2}; +// case SBIG('MLVL'): +// return {MLVL::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 3}; +// case SBIG('MREA'): +// return {MREA::Extract, {_SYS_STR(".blend")}, 4}; +// case SBIG('MAPA'): +// return {MAPA::Extract, {_SYS_STR(".blend")}, 4}; case SBIG('FSM2'): return {DNAFSM2::ExtractFSM2, {_SYS_STR(".yaml")}}; case SBIG('FONT'): diff --git a/DataSpec/SpecBase.cpp b/DataSpec/SpecBase.cpp index 84d89dd2c..07e813a64 100644 --- a/DataSpec/SpecBase.cpp +++ b/DataSpec/SpecBase.cpp @@ -9,6 +9,7 @@ #include "DNACommon/TXTR.hpp" #include "AssetNameMap.hpp" #include "hecl/ClientProcess.hpp" +#include "nod/DiscBase.hpp" #include "nod/nod.hpp" #include "hecl/Blender/Connection.hpp" #include "hecl/Blender/SDNARead.hpp" diff --git a/Editor/badging/Badging.cpp b/Editor/badging/Badging.cpp index f54576f56..43b9b9ee6 100644 --- a/Editor/badging/Badging.cpp +++ b/Editor/badging/Badging.cpp @@ -1,5 +1,7 @@ #include "Badging.hpp" #include "athena/MemoryReader.hpp" + +#include #include extern "C" uint8_t URDE_BADGE[]; diff --git a/Runtime/MP1/World/CEnergyBall.cpp b/Runtime/MP1/World/CEnergyBall.cpp index 894cfb1bd..2aeafedfb 100644 --- a/Runtime/MP1/World/CEnergyBall.cpp +++ b/Runtime/MP1/World/CEnergyBall.cpp @@ -1,4 +1,9 @@ +#include "CSimplePool.hpp" +#include "CStateManager.hpp" +#include "GameGlobalObjects.hpp" #include "MP1/World/CEnergyBall.hpp" +#include "World/CPatternedInfo.hpp" +#include "World/CPlayer.hpp" namespace urde::MP1 { CEnergyBall::CEnergyBall(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, @@ -7,5 +12,90 @@ CEnergyBall::CEnergyBall(TUniqueId uid, std::string_view name, const CEntityInfo const CAssetId& a2, const CAssetId& a3, s16 sfxId2, float f3, float f4, const CAssetId& a4, const CDamageInfo& dInfo2, float f5) : CPatterned(ECharacter::EnergyBall, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo, - EMovementType::Flyer, EColliderType::One, EBodyType::NewFlyer, actParms, EKnockBackVariant::Medium) {} + EMovementType::Flyer, EColliderType::One, EBodyType::NewFlyer, actParms, EKnockBackVariant::Medium) +, x570_(w1) +, x574_(f1) +, x578_(dInfo1) +, x594_initialTurnSpeed(pInfo.GetTurnSpeed()) +, x598_(f2) +, x59c_(a1) +, x5a0_(sfxId1) +, x5a4_(a2) +, x5a8_(g_SimplePool->GetObj({FOURCC('ELSC'), a3})) +, x5b4_(sfxId2) +, x5b8_(f3) +, x5bc_(f4) +, x5c0_(g_SimplePool->GetObj({FOURCC('PART'), a4})) +, x5cc_(dInfo2) +, x5e8_(f5) { + x460_knockBackController.SetEnableExplodeDeath(false); + x460_knockBackController.SetAutoResetImpulse(false); + x460_knockBackController.SetEnableBurnDeath(false); + x460_knockBackController.SetX82_24(false); + x460_knockBackController.SetEnableBurn(false); + x460_knockBackController.SetEnableLaggedBurnDeath(false); + x460_knockBackController.SetEnableShock(false); + x460_knockBackController.SetEnableFreeze(false); + x460_knockBackController.SetX81_31(false); +} + +void CEnergyBall::Think(float dt, CStateManager& mgr) { + float newTurnSpeed = x594_initialTurnSpeed * zeus::clamp(0.f, (x56c_ - 2.5f) * 0.125f, 1.f); + x3b8_turnSpeed = newTurnSpeed; + x450_bodyController->SetTurnSpeed(newTurnSpeed); + CPatterned::Think(dt, mgr); + GetModelData()->GetAnimationData()->GetParticleDB().SetModulationColorAllActiveEffects( + zeus::CColor::lerp(zeus::skWhite, zeus::skRed, zeus::clamp(0.f, x428_damageCooldownTimer / 0.33f, 1.f))); + + bool r27 = false; + if (GetActive() && IsAlive()) { + x56c_ -= dt; + if (x56c_ > x574_) + r27 = true; + if (!InMaxRange(mgr, dt)) + r27 = true; + } + + if (!r27) + sub8029f4a8(mgr); +} + +void CEnergyBall::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) { + if (msg == EScriptObjectMessage::Registered) { + SetMaterialFilter(CMaterialFilter::MakeInclude({EMaterialTypes::Player})); + RemoveMaterial(EMaterialTypes::Solid, mgr); + } + CPatterned::AcceptScriptMsg(msg, uid, mgr); +} + +void CEnergyBall::Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState /* state */) { + CHealthInfo* hInfo = HealthInfo(mgr); + if (hInfo && hInfo->GetHP() > 0.f) { + CPatterned::Death(mgr, direction, EScriptObjectState::Any); + } else { + CPatterned::Death(mgr, direction, EScriptObjectState::DeathRattle); + } +} + +void CEnergyBall::Generate(CStateManager& mgr, EStateMsg msg, float /*arg*/) { + if (msg == EStateMsg::Activate || msg == EStateMsg::Update) { + if (msg == EStateMsg::Activate) + x32c_animState = EAnimState::Ready; + + TryGenerateDeactivate(mgr, 0); + + if (!x450_bodyController->GetActive()) + x450_bodyController->Activate(mgr); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + } +} + +void CEnergyBall::Attack(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Update) { + zeus::CVector3f seekPos = x568_steeringBehaviors.Seek(*this, mgr.GetPlayer().GetEyePosition()); + x450_bodyController->FaceDirection3D(seekPos, GetTransform().basis[1], arg); + } +} +void CEnergyBall::sub8029f4a8(CStateManager& mgr) {} } \ No newline at end of file diff --git a/Runtime/MP1/World/CEnergyBall.hpp b/Runtime/MP1/World/CEnergyBall.hpp index 7ac0bbdc1..11e3cd343 100644 --- a/Runtime/MP1/World/CEnergyBall.hpp +++ b/Runtime/MP1/World/CEnergyBall.hpp @@ -1,9 +1,30 @@ #pragma once +#include "Character/CSteeringBehaviors.hpp" +#include "World/CDamageInfo.hpp" #include "World/CPatterned.hpp" namespace urde::MP1 { class CEnergyBall : public CPatterned { + CSteeringBehaviors x568_steeringBehaviors; + float x56c_ = 0.f; + s32 x570_; + float x574_; + CDamageInfo x578_; + float x594_initialTurnSpeed; + float x598_; + CAssetId x59c_; + s16 x5a0_; + CAssetId x5a4_; + TToken x5a8_; // originally an rstl::optional_object + s16 x5b4_; + float x5b8_; + float x5bc_; + TToken x5c0_; + CDamageInfo x5cc_; + float x5e8_; + + void sub8029f4a8(CStateManager& mgr); public: DEFINE_PATTERNED(EnergyBall) CEnergyBall(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, @@ -11,5 +32,12 @@ public: const CDamageInfo& dInfo1, float f2, const CAssetId& a1, s16 sfxId1, const CAssetId& a2, const CAssetId& a3, s16 sfxId2, float f3, float f4, const CAssetId& a4, const CDamageInfo& dInfo2, float f5); + + + void Think(float dt, CStateManager& mgr) override; + void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override; + void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) override; + void Generate(CStateManager& mgr, EStateMsg msg, float arg) override; + void Attack(CStateManager& mgr, EStateMsg msg, float arg) override; }; } diff --git a/Runtime/World/CPatterned.cpp b/Runtime/World/CPatterned.cpp index 4d25a2adb..7f2d3a127 100644 --- a/Runtime/World/CPatterned.cpp +++ b/Runtime/World/CPatterned.cpp @@ -936,6 +936,10 @@ void CPatterned::TryKnockBack(CStateManager& mgr, int arg) { x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTranslation(), pas::ESeverity(arg))); } +void CPatterned::TryGenerateDeactivate(urde::CStateManager& mgr, int arg) { + x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType(arg), zeus::skZero3f)); +} + void CPatterned::BuildBodyController(EBodyType bodyType) { if (x450_bodyController) return; diff --git a/Runtime/World/CPatterned.hpp b/Runtime/World/CPatterned.hpp index 5e01c1944..7c1516493 100644 --- a/Runtime/World/CPatterned.hpp +++ b/Runtime/World/CPatterned.hpp @@ -337,6 +337,7 @@ public: void TryCover(CStateManager& mgr, int arg); void TryWallHang(CStateManager& mgr, int arg); void TryKnockBack(CStateManager& mgr, int arg); + void TryGenerateDeactivate(CStateManager& mgr, int arg); virtual bool KnockbackWhenFrozen() const { return true; } virtual void MassiveDeath(CStateManager& mgr); diff --git a/Runtime/World/CPatternedInfo.hpp b/Runtime/World/CPatternedInfo.hpp index f0bbbf8f7..e82f27c0a 100644 --- a/Runtime/World/CPatternedInfo.hpp +++ b/Runtime/World/CPatternedInfo.hpp @@ -57,6 +57,7 @@ public: CPatternedInfo(CInputStream& in, u32 pcount); static std::pair HasCorrectParameterCount(CInputStream& in); + float GetTurnSpeed() const { return x8_turnSpeed; } float GetDetectionHeightRange() const { return x10_detectionHeightRange; } const CHealthInfo& GetHealthInfo() const { return x54_healthInfo; } const CDamageVulnerability& GetDamageVulnerability() const { return x5c_damageVulnerability; } diff --git a/amuse b/amuse index 107ddeb5a..5da58eb1d 160000 --- a/amuse +++ b/amuse @@ -1 +1 @@ -Subproject commit 107ddeb5a9dfe3e336c26c285ce0be0b8f0ebd2c +Subproject commit 5da58eb1da26c83307b324be3fc9c3d496b46d86 diff --git a/hecl b/hecl index af5d10cfe..0eb776c54 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit af5d10cfe91655d2dc48c53df52e564e2b0d6be7 +Subproject commit 0eb776c5406b0c203e81d45edf611da76c6ed7fd diff --git a/hecl-gui b/hecl-gui index 1ebf7ec12..c2101317a 160000 --- a/hecl-gui +++ b/hecl-gui @@ -1 +1 @@ -Subproject commit 1ebf7ec1261d13e7921a3f3bafa30688d2d0f5f3 +Subproject commit c2101317ad3f727f6f284e3285ce425431763203 diff --git a/kabufuda b/kabufuda index f57d8cf76..222fb5c17 160000 --- a/kabufuda +++ b/kabufuda @@ -1 +1 @@ -Subproject commit f57d8cf76187e0444e232b557e709fca161c64a9 +Subproject commit 222fb5c179b2ab1aa302053825321762451e2be5 diff --git a/nod b/nod index df1e45072..55301dd50 160000 --- a/nod +++ b/nod @@ -1 +1 @@ -Subproject commit df1e450728c725ab66508caca64b76cff13c354c +Subproject commit 55301dd505ae38a7ad5ba0dc145eb6a826887fb5 diff --git a/specter b/specter index ba31ba180..73ace3136 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit ba31ba180f3cbc1ba9513befa95a4dbbdbaf38a4 +Subproject commit 73ace31365553b7264bf1de9968b74aec5636d6e