Various loader implementations

This commit is contained in:
Phillip Stephens 2018-10-11 15:57:05 -07:00
parent 8b25548482
commit bbfe61efbf
59 changed files with 1136 additions and 133 deletions

View File

@ -28,7 +28,7 @@ struct BloodFlower : IScriptObject
UniqueID32 particle4;
Value<float> unknown1;
UniqueID32 particle5;
Value<float> unknown2;
Value<atUint32> unknown2;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const

View File

@ -44,7 +44,7 @@ struct ElitePirate : IScriptObject
Value<float> unknown13;
Value<float> unknown14;
Value<float> unknown15;
Value<float> unknown16;
Value<atUint32> unknown16;
Value<atUint32> soundID3;
Value<atUint32> soundID4;
UniqueID32 particle7;

View File

@ -291,7 +291,7 @@ void CMapArea::CMapAreaSurface::Draw(const zeus::CVector3f* verts, const zeus::C
{
if (instIdx >= m_instances.size())
return;
Instance& instance = const_cast<Instance&>(m_instances[instIdx]);
if (surfColor.a)

View File

@ -130,7 +130,7 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
x90c_loaderFuncs[int(EScriptObjectType::PuddleToadGamma)] = ScriptLoader::LoadPuddleToadGamma;
x90c_loaderFuncs[int(EScriptObjectType::DistanceFog)] = ScriptLoader::LoadDistanceFog;
x90c_loaderFuncs[int(EScriptObjectType::FireFlea)] = ScriptLoader::LoadFireFlea;
x90c_loaderFuncs[int(EScriptObjectType::MetareeAlpha)] = ScriptLoader::LoadMetareeAlpha;
x90c_loaderFuncs[int(EScriptObjectType::Metaree)] = ScriptLoader::LoadMetaree;
x90c_loaderFuncs[int(EScriptObjectType::DockAreaChange)] = ScriptLoader::LoadDockAreaChange;
x90c_loaderFuncs[int(EScriptObjectType::ActorRotate)] = ScriptLoader::LoadActorRotate;
x90c_loaderFuncs[int(EScriptObjectType::SpecialFunction)] = ScriptLoader::LoadSpecialFunction;
@ -1123,7 +1123,7 @@ void CStateManager::SendScriptMsg(TUniqueId src, TEditorId dest, EScriptObjectMe
{
CEntity* ent = ObjectById(src);
auto search = GetIdListForScript(dest);
if (ent && search.first != x890_scriptIdMap.cend())
if (search.first != x890_scriptIdMap.cend())
{
for (auto it = search.first; it != search.second; ++it)
{
@ -1278,14 +1278,14 @@ std::pair<TEditorId, TUniqueId> CStateManager::LoadScriptObject(TAreaId aid, ESc
u32 readAmt = in.position() - startPos;
if (readAmt > length)
LogModule.report(logvisor::Fatal, "Script object overread");
LogModule.report(logvisor::Fatal, "Script object overread while reading %s", ScriptObjectTypeToStr(type).data());
u32 leftover = length - readAmt;
for (u32 i=0 ; i<leftover ; ++i)
in.readByte();
if (error || ent == nullptr)
{
LogModule.report(logvisor::Fatal, "Script load error");
LogModule.report(logvisor::Error, "Script load error while loading %s", ScriptObjectTypeToStr(type).data());
return {kInvalidEditorId, kInvalidUniqueId};
}
else

View File

@ -10,9 +10,11 @@
#include "zeus/CColor.hpp"
#include "hecl/Runtime.hpp"
#include "hecl/CVar.hpp"
namespace urde
{
extern hecl::CVar* g_disableLighting;
class CLight;
class CTimeProvider;

View File

@ -108,7 +108,11 @@ struct SShader
MaterialSet m_matSet;
std::experimental::optional<GeometryUniformLayout> m_geomLayout;
int m_matSetIdx;
SShader(int idx) : m_matSetIdx(idx) {}
SShader(int idx) : m_matSetIdx(idx)
{
x0_textures.clear();
m_shaders.clear();
}
void InitializeLayout(const CModel* model) { m_geomLayout.emplace(model, &m_matSet); }
void UnlockTextures();
std::shared_ptr<hecl::Runtime::ShaderPipelines>

View File

@ -217,14 +217,14 @@ BOO_GLSL_BINDING_HEAD
" {\n"
" vec3 delta = mvPosIn - lights[i].pos.xyz;\n"
" float dist = length(delta);\n"
" float angDot = clamp(dot(normalize(delta), lights[i].dir.xyz), 0.0, 1.0);\n"
" float angDot = clamp(dot(normalize(delta).xyz, lights[i].dir.xyz), 0.0, 1.0);\n"
" float att = 1.0 / (lights[i].linAtt[2] * dist * dist +\n"
" lights[i].linAtt[1] * dist +\n"
" lights[i].linAtt[0]);\n"
" float angAtt = lights[i].angAtt[2] * angDot * angDot +\n"
" lights[i].angAtt[1] * angDot +\n"
" lights[i].angAtt[0];\n"
" ret += lights[i].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn), 0.0, 1.0);\n"
" ret += lights[i].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta).xyz, mvNormIn), 0.0, 1.0);\n"
" }\n"
" \n"
" return ret;\n"
@ -554,8 +554,8 @@ static void _BuildFragShader(std::string& finalFS, int& nextTex, const char* tex
// Output reg 0, subtract, clamp, no bias
combiner += " vec3 lightVec = lights[3].pos.xyz - vtf.mvPos.xyz;\n"
" float lx = dot(vtf.mvTangent, lightVec);\n"
" float ly = dot(vtf.mvBinorm, lightVec);\n";
" float lx = dot(vtf.mvTangent.xyz, lightVec);\n"
" float ly = dot(vtf.mvBinorm.xyz, lightVec);\n";
combiner += hecl::Format(" vec4 emboss1 = texture(bumpMap, vtf.uvs[%d]) + vec4(0.5);\n"
" vec4 emboss2 = texture(bumpMap, vtf.uvs[%d] + vec2(lx, ly));\n",
bumpMapUv, bumpMapUv);

View File

@ -100,9 +100,10 @@ void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue)
case EClientFlowStates::Game:
{
g_GameState->GameOptions().EnsureSettings();
std::shared_ptr<CMFGameLoader> gameLoader = std::make_shared<CMFGameLoader>();
main->SetFlowState(EFlowState::Default);
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000,
std::make_shared<CMFGameLoader>()));
gameLoader));
break;
}
default: break;

View File

@ -1597,7 +1597,7 @@ void CSamusHud::Draw(const CStateManager& mgr, float alpha,
if (x29c_decoIntf && !x2cc_preLoadCountdown)
x29c_decoIntf->Draw();
if (x2bc_nextState >= EHudState::Combat && x2bc_nextState < EHudState::Scan)
if (x2bc_nextState >= EHudState::Combat && x2bc_nextState <= EHudState::Scan)
{
if (hudVis &&
helmetVis != CInGameGuiManager::EHelmetVisMode::ReducedUpdate &&

View File

@ -488,6 +488,8 @@ void CMain::Give(hecl::Console* console, const std::vector<std::string>& args)
{
pState->IncrPickup(eType, 9999);
console->report(hecl::Console::Level::Info, "Cheater....., Greatly increasing Metroid encounters, have fun!");
if (g_StateManager)
g_StateManager->Player()->AsyncLoadSuit(*g_StateManager);
return;
}
@ -517,7 +519,8 @@ void CMain::Give(hecl::Console* console, const std::vector<std::string>& args)
else
pState->DecrPickup(eType, zeus::clamp(0u, u32(abs(itemAmt)), pState->GetItemAmount(eType)));
}
g_StateManager->Player()->AsyncLoadSuit(*g_StateManager);
if (g_StateManager)
g_StateManager->Player()->AsyncLoadSuit(*g_StateManager);
console->report(hecl::Console::Level::Info, "Cheater....., Greatly increasing Metroid encounters, have fun!");
}

View File

@ -0,0 +1,14 @@
#include "CAtomicAlpha.hpp"
namespace urde::MP1
{
CAtomicAlpha::CAtomicAlpha(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo,
CAssetId wpsc, const CDamageInfo& dInfo, float f1, float f2, float f3, CAssetId cmdl,
bool b1, bool b2)
: CPatterned(ECharacter::AtomicAlpha, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::One, EBodyType::Flyer, actParms, 1)
{
}
}

View File

@ -0,0 +1,16 @@
#pragma once
#include "World/CPatterned.hpp"
namespace urde::MP1
{
class CAtomicAlpha : public CPatterned
{
public:
DEFINE_PATTERNED(AtomicAlpha)
CAtomicAlpha(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CActorParameters&, const CPatternedInfo&, CAssetId, const CDamageInfo&, float, float, float,
CAssetId, bool, bool);
};
}

View File

@ -0,0 +1,42 @@
#include "CBabygoth.hpp"
namespace urde::MP1
{
CBabygothData::CBabygothData(CInputStream& in)
: x0_(in.readFloatBig())
, x4_(in.readFloatBig())
, x8_(in)
, xc_(in)
, x28_(in)
, x44_(in)
, x48_(in)
, x4c_(in)
, x68_(in)
, xd0_(in)
, x138_(in)
, x13c_(in)
, x140_(in.readFloatBig())
, x144_(CSfxManager::TranslateSFXID(in.readUint32Big()))
, x148_(in)
, x14c_(in)
, x150_(in)
, x154_(in)
, x158_(CSfxManager::TranslateSFXID(in.readUint32Big()))
, x15c_(CSfxManager::TranslateSFXID(in.readUint32Big()))
, x160_(in.readFloatBig())
, x164_(in.readFloatBig())
, x168_(in.readFloatBig())
, x16c_(in)
, x170_(CSfxManager::TranslateSFXID(in.readUint32Big()))
, x174_(in)
{
}
CBabygoth::CBabygoth(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, const CBabygothData& babyData)
: CPatterned(ECharacter::Babygoth, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo, EMovementType::Ground,
EColliderType::One, EBodyType::BiPedal, actParms, 1)
{
}
}

View File

@ -3,37 +3,37 @@
#include "World/CPatterned.hpp"
namespace urde
namespace urde::MP1
{
class CBabygothData
{
float x0_;
float x4_;
u32 x8_;
CAssetId x8_;
CDamageInfo xc_;
CDamageInfo x28_;
u32 x44_;
u32 x48_;
CAssetId x44_;
CAssetId x48_;
CDamageInfo x4c_;
CDamageVulnerability x68_;
CDamageVulnerability xd0_;
u32 x138_;
u32 x13c_;
CAssetId x138_;
CAssetId x13c_;
float x140_;
s16 x144_;
u32 x148_;
u32 x14c_;
u32 x150_;
u32 x154_;
CAssetId x148_;
CAssetId x14c_;
CAssetId x150_;
CAssetId x154_;
s16 x158_;
s16 x15a_;
s16 x15c_;
float x160_;
float x164_;
float x168_;
u32 x16c_;
CAssetId x16c_;
s16 x170_;
u32 x174_;
CAssetId x174_;
public:
CBabygothData(CInputStream&);
CAssetId GetShellModelResId() const;
@ -47,5 +47,13 @@ public:
CAssetId GetFireBreathResId() const;
};
class CBabygoth : public CPatterned
{
public:
DEFINE_PATTERNED(Babygoth)
CBabygoth(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CPatternedInfo&, const CActorParameters&, const CBabygothData&);
};
}
#endif // __URDE_MP1_CBABYGOTH_HPP__

View File

@ -0,0 +1,12 @@
#include "CBloodFlower.hpp"
namespace urde::MP1
{
CBloodFlower::CBloodFlower(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, CAssetId partId1, CAssetId wpscId1,
const CActorParameters& actParms, CAssetId wpscId2, const CDamageInfo& dInfo1,
const CDamageInfo& dInfo2, const CDamageInfo& dInfo3, CAssetId partId2, CAssetId partId3,
CAssetId partId4, float f1, CAssetId partId5, u32 soundId)
: CPatterned(ECharacter::BloodFlower, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Ground, EColliderType::One, EBodyType::Restricted, actParms, 1) {}
}

View File

@ -0,0 +1,16 @@
#pragma once
#include "World/CPatterned.hpp"
namespace urde::MP1
{
class CBloodFlower : public CPatterned
{
public:
DEFINE_PATTERNED(BloodFlower)
CBloodFlower(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CPatternedInfo&, CAssetId, CAssetId, const CActorParameters&, CAssetId, const CDamageInfo&,
const CDamageInfo&, const CDamageInfo&, CAssetId, CAssetId, CAssetId, float, CAssetId, u32);
};
}

View File

@ -0,0 +1,14 @@
#include "CBurrower.hpp"
namespace urde::MP1
{
CBurrower::CBurrower(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
CAssetId, CAssetId, CAssetId, const CDamageInfo&, CAssetId, u32, CAssetId)
: CPatterned(ECharacter::Burrower, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Ground, EColliderType::One, EBodyType::BiPedal, actParms, 0)
{
}
}

View File

@ -0,0 +1,17 @@
#pragma once
#include "World/CPatterned.hpp"
namespace urde::MP1
{
class CBurrower : public CPatterned
{
public:
DEFINE_PATTERNED(Burrower)
CBurrower(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CPatternedInfo&, const CActorParameters&, CAssetId, CAssetId, CAssetId, const CDamageInfo&, CAssetId, u32,
CAssetId);
};
}

View File

@ -0,0 +1,26 @@
#include "CElitePirate.hpp"
#include "World/ScriptLoader.hpp"
namespace urde::MP1
{
CElitePirateData::CElitePirateData(CInputStream& in, u32 propCount)
: x0_(in.readFloatBig()), x4_(in.readFloatBig()), x8_(in.readFloatBig()), xc_(in.readFloatBig()),
x10_(in.readFloatBig()), x14_(in.readFloatBig()), x18_(in.readFloatBig()), x1c_(in.readFloatBig()), x20_(in),
x24_(CSfxManager::TranslateSFXID(in.readUint32Big())), x28_(ScriptLoader::LoadActorParameters(in)),
x90_(ScriptLoader::LoadAnimationParameters(in)), x9c_(in), xa0_(CSfxManager::TranslateSFXID(in.readUint32Big())),
xa4_(in), xa8_(in), xc4_(in.readFloatBig()), xc8_(in), xcc_(in), xd0_(in), xd4_(in), xd8_(in.readFloatBig()),
xdc_(in.readFloatBig()), xe0_(in.readFloatBig()), xe4_(in.readFloatBig()),
xe8_(zeus::degToRad(in.readFloatBig())), xec_(zeus::degToRad(in.readFloatBig())), xf0_(in.readUint32Big()),
xf4_(CSfxManager::TranslateSFXID(in.readUint32Big())), xf8_(in), xfc_(in), x118_(in),
x11c_(CSfxManager::TranslateSFXID(in.readUint32Big())), x11e_(in.readBool()),
x11f_(propCount < 24 ? true : in.readBool()) {}
CElitePirate::CElitePirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
const CElitePirateData& eliteData)
: CPatterned(ECharacter::ElitePirate, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Ground, EColliderType::One, EBodyType::BiPedal, actParms, 2)
{
}
}

View File

@ -0,0 +1,58 @@
#pragma once
#include "World/CPatterned.hpp"
#include "World/CActorParameters.hpp"
#include "World/CAnimationParameters.hpp"
namespace urde::MP1
{
class CElitePirateData
{
float x0_;
float x4_;
float x8_;
float xc_;
float x10_;
float x14_;
float x18_;
float x1c_;
CAssetId x20_;
s16 x24_;
CActorParameters x28_;
CAnimationParameters x90_;
CAssetId x9c_;
s16 xa0_;
CAssetId xa4_;
CDamageInfo xa8_;
float xc4_;
CAssetId xc8_;
CAssetId xcc_;
CAssetId xd0_;
CAssetId xd4_;
float xd8_;
float xdc_;
float xe0_;
float xe4_;
float xe8_;
float xec_;
u32 xf0_;
u32 xf4_;
CAssetId xf8_;
CDamageInfo xfc_;
CAssetId x118_;
s16 x11c_;
bool x11e_;
bool x11f_;
public:
CElitePirateData(CInputStream&, u32 propCount);
};
class CElitePirate : public CPatterned
{
public:
DEFINE_PATTERNED(ElitePirate)
CElitePirate(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CPatternedInfo&, const CActorParameters&, const CElitePirateData&);
};
}

View File

@ -0,0 +1,14 @@
#include "CEyeball.hpp"
namespace urde::MP1
{
CEyeball::CEyeball(TUniqueId uid, std::string_view name, CPatterned::EFlavorType flavor, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo, float, float,
CAssetId, const CDamageInfo&, CAssetId, CAssetId, CAssetId, CAssetId, u32, u32, u32, u32, u32,
const CActorParameters& actParms, bool)
: CPatterned(ECharacter::EyeBall, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer,
EColliderType::Zero, EBodyType::Restricted, actParms, 1)
{
}
}

View File

@ -0,0 +1,17 @@
#pragma once
#include "World/CPatterned.hpp"
namespace urde::MP1
{
class CEyeball : public CPatterned
{
public:
DEFINE_PATTERNED(EyeBall)
CEyeball(TUniqueId, std::string_view, EFlavorType, const CEntityInfo&, const zeus::CTransform&,
CModelData&&, const CPatternedInfo&, float, float, CAssetId, const CDamageInfo&, CAssetId, CAssetId,
CAssetId, CAssetId, u32, u32, u32, u32, u32, const CActorParameters&, bool);
};
}

View File

@ -0,0 +1,13 @@
#include "CFireFlea.hpp"
namespace urde::MP1
{
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,
EMovementType::Flyer, EColliderType::One, EBodyType::NewFlyer, actParms, 0)
{
}
}

View File

@ -0,0 +1,15 @@
#pragma once
#include "World/CPatterned.hpp"
namespace urde::MP1
{
class CFireFlea : public CPatterned
{
public:
DEFINE_PATTERNED(FireFlea)
CFireFlea(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CActorParameters&, const CPatternedInfo&, float);
};
}

View File

@ -0,0 +1,14 @@
#include "CFlickerBat.hpp"
namespace urde::MP1
{
CFlickerBat::CFlickerBat(TUniqueId uid, std::string_view name, CPatterned::EFlavorType flavor, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
EColliderType colType, bool b1, const CActorParameters& actParms, bool b2)
: CPatterned(ECharacter::FlickerBat, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer, colType,
EBodyType::Pitchable, actParms, 0)
{
}
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "World/CPatterned.hpp"
namespace urde::MP1
{
class CFlickerBat : public CPatterned
{
public:
DEFINE_PATTERNED(FlickerBat)
CFlickerBat(TUniqueId, std::string_view name, EFlavorType, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CPatternedInfo&, EColliderType, bool, const CActorParameters&, bool);
};
}

View File

@ -0,0 +1,28 @@
#include "CMagdolite.hpp"
namespace urde::MP1
{
CMagdolite::CMagdoliteData::CMagdoliteData(CInputStream& in)
: x0_propertyCount(in.readUint32Big())
, x4_(in.readUint32Big())
, x8_(in)
, xc_(in.readUint32Big())
, x10_(in.readFloatBig())
, x18_(in.readFloatBig())
, x1c_(in.readFloatBig())
{
}
CMagdolite::CMagdolite(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, float f1, float f2,
const CDamageInfo& dInfo1, const CDamageInfo& dInfo2, const CDamageVulnerability& dVuln1,
const CDamageVulnerability& dVuln2, CAssetId modelId, CAssetId skinId, float f3, float f4,
float f5, float f6, const urde::MP1::CMagdolite::CMagdoliteData& magData, float f7, float f8, float f9)
: CPatterned(ECharacter::Magdolite, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::One, EBodyType::BiPedal, actParms, 2)
{
}
}

View File

@ -0,0 +1,32 @@
#pragma once
#include "World/CPatterned.hpp"
namespace urde::MP1
{
class CMagdolite : public CPatterned
{
public:
class CMagdoliteData
{
u32 x0_propertyCount;
u32 x4_;
CAssetId x8_;
u32 xc_;
float x10_;
float x18_;
float x1c_;
public:
CMagdoliteData(CInputStream&);
};
private:
public:
DEFINE_PATTERNED(Magdolite)
CMagdolite(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CPatternedInfo&, const CActorParameters&, float, float, const CDamageInfo&, const CDamageInfo&,
const CDamageVulnerability&, const CDamageVulnerability&, CAssetId, CAssetId, float, float, float, float,
const CMagdoliteData&, float, float, float);
};
}

View File

@ -2,9 +2,16 @@ set(MP1_WORLD_SOURCES
CNewIntroBoss.hpp CNewIntroBoss.cpp
CBeetle.hpp CBeetle.cpp
CWarWasp.hpp CWarWasp.cpp
CElitePirate.hpp CElitePirate.cpp
CBloodFlower.hpp CBloodFlower.cpp
CSpacePirate.hpp CSpacePirate.cpp
CParasite.hpp CParasite.cpp
CBabygoth.hpp CBabygoth.cpp
CTryclops.hpp CTryclops.cpp
CFireFlea.hpp CFireFlea.cpp
CEyeball.hpp CEyeball.cpp
CAtomicAlpha.hpp CAtomicAlpha.cpp
CFlickerBat.hpp CFlickerBat.cpp
CMetroidPrimeRelay.hpp CMetroidPrimeRelay.cpp
CMetroidPrimeExo.hpp CMetroidPrimeExo.cpp
CMetroidPrimeProjectile.hpp CMetroidPrimeProjectile.cpp
@ -13,6 +20,9 @@ set(MP1_WORLD_SOURCES
CMetroidBeta.hpp CMetroidBeta.cpp
CMetroid.hpp CMetroid.cpp
CMetaree.hpp CMetaree.cpp
CBurrower.hpp CBurrower.cpp
CPuffer.hpp CPuffer.cpp
CMagdolite.hpp CMagdolite.cpp
CSeedling.hpp CSeedling.cpp
CRidley.hpp CRidley.cpp
CPuddleToadGamma.hpp CPuddleToadGamma.cpp

View File

@ -1,7 +1,3 @@
//
// Created by antidote on 8/19/17.
//
#include "CMetaree.hpp"
namespace urde::MP1

View File

@ -0,0 +1,15 @@
#include "CPuffer.hpp"
namespace urde::MP1
{
CPuffer::CPuffer(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& modelData, const CActorParameters& actorParameters, const CPatternedInfo& patternedInfo,
float hoverSpeed, CAssetId cloudEffect, const CDamageInfo& cloudDamage, CAssetId cloudSteam, float f2,
bool b1, bool b2, bool b3, const CDamageInfo& explosionDamage, s16 sfxId)
: CPatterned(ECharacter::Puffer, uid, name, EFlavorType::Zero, info, xf, std::move(modelData), patternedInfo,
EMovementType::Flyer, EColliderType::One, EBodyType::RestrictedFlyer, actorParameters, 0)
{
}
}

View File

@ -0,0 +1,16 @@
#pragma once
#include "World/CPatterned.hpp"
namespace urde::MP1
{
class CPuffer : public CPatterned
{
public:
DEFINE_PATTERNED(Puffer)
CPuffer(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CActorParameters&, const CPatternedInfo&, float, CAssetId, const CDamageInfo&, CAssetId,
float, bool, bool, bool, const CDamageInfo&, s16);
};
}

View File

@ -7,24 +7,23 @@ namespace MP1
{
CRidleyData::CRidleyData(CInputStream& in, u32 propCount)
: x0_(in), x4_(in), x8_(in), xc_(in), x10_(in), x14_(in), x18_(in), x1c_(in), x20_(in), x24_(in), x28_(in)
, x2c_(in), x30_(in), x34_(in.readFloatBig()), x38_(in.readFloatBig()), x3c_(in.readFloatBig()), x40_(in.readFloatBig())
, x44_(in), x48_(in), x64_(in), xa8_(CSfxManager::TranslateSFXID(in.readUint32Big())), xac_(in), xb0_(in)
, xcc_(in), x1a0_(in), x1a4_(in), x1c0_(in), x294_(CSfxManager::TranslateSFXID(in.readUint32Big()))
, x298_(in), x2b4_(in), x388_(in.readFloatBig()), x38c_(in.readFloatBig()), x390_(in), x3ac_(in.readFloatBig())
, x3b0_(in), x3cc_(in.readFloatBig()), x3d0_(in), x3f4_(in.readFloatBig()), x3f8_(CSfxManager::TranslateSFXID(in.readUint32Big()))
, x3fc_(propCount > 47 ? CDamageInfo(in) : x48_)
: x0_(in), x4_(in), x8_(in), xc_(in), x10_(in), x14_(in), x18_(in), x1c_(in), x20_(in), x24_(in), x28_(in),
x2c_(in), x30_(in), x34_(in.readFloatBig()), x38_(in.readFloatBig()), x3c_(in.readFloatBig()),
x40_(in.readFloatBig()), x44_(in), x48_(in), x64_(in), xa8_(CSfxManager::TranslateSFXID(in.readUint32Big())),
xac_(in), xb0_(in), xcc_(in), x1a0_(in), x1a4_(in), x1c0_(in),
x294_(CSfxManager::TranslateSFXID(in.readUint32Big())), x298_(in), x2b4_(in), x388_(in.readFloatBig()),
x38c_(in.readFloatBig()), x390_(in), x3ac_(in.readFloatBig()), x3b0_(in), x3cc_(in.readFloatBig()), x3d0_(in),
x3f4_(in.readFloatBig()), x3f8_(CSfxManager::TranslateSFXID(in.readUint32Big())),
x3fc_(propCount > 47 ? CDamageInfo(in) : x48_)
{
}
CRidley::CRidley(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, CInputStream& in, u32 propCount)
: CPatterned(ECharacter::Ridley, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::Zero, EBodyType::Flyer, actParms, 2)
, x568_(in, propCount)
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
const CActorParameters& actParms, CInputStream& in, u32 propCount)
: CPatterned(ECharacter::Ridley, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::Zero, EBodyType::Flyer, actParms, 2), x568_(in, propCount)
{
}
void CRidley::Accept(IVisitor &visitor) { visitor.Visit(this); }
}
}

View File

@ -65,8 +65,6 @@ public:
DEFINE_PATTERNED(Ridley)
CRidley(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CPatternedInfo&, const CActorParameters&, CInputStream&, u32);
void Accept(IVisitor&);
};
}
}

View File

@ -0,0 +1,10 @@
#include "CTryclops.hpp"
namespace urde::MP1
{
CTryclops::CTryclops(urde::TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
urde::CModelData&& mData, const urde::CPatternedInfo& pInfo, const urde::CActorParameters& actParms, float, float, float, float)
: CPatterned(ECharacter::Tryclops, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Ground, EColliderType::One, EBodyType::BiPedal, actParms, 0)
{}
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "World/CPatterned.hpp"
namespace urde::MP1
{
class CTryclops : public CPatterned
{
public:
DEFINE_PATTERNED(Tryclops)
CTryclops(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CPatternedInfo&, const CActorParameters&, float, float, float, float);
};
}

View File

@ -275,7 +275,7 @@ bool CElementGen::Update(double t)
Log.report(logvisor::Info,
"Running warmup on particle system 0x%08x for %d ticks.",
desc, pswt);
InternalUpdate(pswt / 60.0);
InternalUpdate((1.f / 60.f) * pswt);
x26d_25_warmedUp = true;
}
bool ret = InternalUpdate(t);

View File

@ -251,7 +251,7 @@ void CGrappleArm::LoadSuitPoll()
{
if (NWeaponTypes::are_tokens_ready(x19c_suitDeps[int(x3a8_loadedSuit)]))
{
x0_grappleArmModel.emplace(CAnimRes(g_tweakGunRes->x8_grappleArm, 0, x31c_scale, 41, false));
x0_grappleArmModel.emplace(CAnimRes(g_tweakGunRes->x8_grappleArm, int(x3a8_loadedSuit), x31c_scale, 41, false));
x0_grappleArmModel->SetSortThermal(true);
x328_gunController = std::make_unique<CGunController>(*x0_grappleArmModel);
x3b2_29_suitLoading = false;

View File

@ -188,9 +188,7 @@ bool CDamageVulnerability::WeaponHurts(const CWeaponMode& mode, bool ignoreDirec
return true;
if (chargedHurts && mode.IsCharged())
return true;
if (comboedHurts && mode.IsComboed())
return true;
return false;
return comboedHurts && mode.IsComboed();
}
bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, bool checkDirect) const

View File

@ -73,6 +73,7 @@ set(WORLD_SOURCES
CScriptPlayerHint.hpp CScriptPlayerHint.cpp
CScriptPlayerStateChange.hpp CScriptPlayerStateChange.cpp
CScriptTargetingPoint.hpp CScriptTargetingPoint.cpp
CScriptEMPulse.hpp CScriptEMPulse.cpp
CScriptPlayerActor.hpp CScriptPlayerActor.cpp
CFishCloud.hpp CFishCloud.cpp
CFishCloudModifier.hpp CFishCloudModifier.cpp

View File

@ -52,8 +52,6 @@ CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount)
std::pair<bool, u32> CPatternedInfo::HasCorrectParameterCount(CInputStream& in)
{
u32 pcount = in.readUint32Big();
if (pcount < 35 || pcount > 38)
return {false, pcount};
return {true, pcount};
return {(pcount >= 35 && pcount <= 38), pcount};
}
}

View File

@ -5817,7 +5817,7 @@ float CPlayer::JumpInput(const CFinalInput& input, CStateManager& mgr)
float backwards = ControlMapper::GetAnalogInput(ControlMapper::ECommands::Backward, input);
if (forwards < backwards)
forwards = ControlMapper::GetAnalogInput(ControlMapper::ECommands::Backward, input);
return (vDoubleJumpAccel - (vDoubleJumpAccel - hDoubleJumpAccel) * forwards) * xe8_mass * jumpFactor;
return ((vDoubleJumpAccel - (vDoubleJumpAccel - hDoubleJumpAccel) * forwards) * xe8_mass) * jumpFactor;
}
return GetGravity() * xe8_mass;
@ -5831,7 +5831,7 @@ float CPlayer::JumpInput(const CFinalInput& input, CStateManager& mgr)
if (ControlMapper::GetPressInput(ControlMapper::ECommands::JumpOrBoost, input))
{
SetMoveState(EPlayerMovementState::Jump, mgr);
return vJumpAccel * xe8_mass * jumpFactor;
return (vJumpAccel * xe8_mass) * jumpFactor;
}
return 0.f;
}
@ -5839,7 +5839,7 @@ float CPlayer::JumpInput(const CFinalInput& input, CStateManager& mgr)
float backwards = ControlMapper::GetAnalogInput(ControlMapper::ECommands::Backward, input);
if (forwards < backwards)
forwards = ControlMapper::GetAnalogInput(ControlMapper::ECommands::Backward, input);
return (vJumpAccel - (vJumpAccel - hJumpAccel) * forwards) * xe8_mass * jumpFactor;
return ((vJumpAccel - (vJumpAccel - hJumpAccel) * forwards) * xe8_mass) * jumpFactor;
}
if (x258_movementState == EPlayerMovementState::Jump)

View File

@ -660,6 +660,7 @@ public:
CPlayerGun* GetPlayerGun() const { return x490_gun.get(); }
CMorphBall* GetMorphBall() const { return x768_morphball.get(); }
CPlayerCameraBob* GetCameraBob() const { return x76c_cameraBob.get(); }
float GetStaticTimer() const { return x740_staticTimer; }
float GetDeathTime() const { return x9f4_deathTime; }
const CPlayerEnergyDrain& GetEnergyDrain() const { return x274_energyDrain; }
EPlayerZoneInfo GetOrbitZone() const { return x330_orbitZoneMode; }

View File

@ -6,7 +6,7 @@
namespace urde
{
CScriptDistanceFog::CScriptDistanceFog(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const ERglFogMode& mode, const zeus::CColor& color,
ERglFogMode mode, const zeus::CColor& color,
const zeus::CVector2f& range, float colorDelta,
const zeus::CVector2f& rangeDelta, bool expl, bool active,
float thermalTarget, float thermalSpeed, float xrayTarget, float xraySpeed)

View File

@ -20,7 +20,7 @@ class CScriptDistanceFog : public CEntity
bool x60_explicit;
bool x61_nonZero;
public:
CScriptDistanceFog(TUniqueId, std::string_view, const CEntityInfo&, const ERglFogMode&,
CScriptDistanceFog(TUniqueId, std::string_view, const CEntityInfo&, ERglFogMode,
const zeus::CColor&, const zeus::CVector2f&, float, const zeus::CVector2f&,
bool, bool, float, float, float, float);

View File

@ -0,0 +1,105 @@
#include "CScriptEMPulse.hpp"
#include "CActorParameters.hpp"
#include "Particle/CGenDescription.hpp"
#include "Particle/CElementGen.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "CStateManager.hpp"
#include "CPlayer.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "TCastTo.hpp"
namespace urde
{
CScriptEMPulse::CScriptEMPulse(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, float initialRadius, float finalRadius,
float duration,
float interferenceDur, float f5, float interferenceMag, float f7, CAssetId partId)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Projectile),
CActorParameters::None().HotInThermal(true), kInvalidUniqueId), xe8_duration(duration),
xec_finalRadius(finalRadius), xf0_currentRadius(initialRadius), xf4_initialRadius(initialRadius),
xf8_interferenceDur(interferenceDur), xfc_(f5), x100_interferenceMag(interferenceMag), x104_(f7),
x108_particleDesc(g_SimplePool->GetObj({SBIG('PART'), partId}))
{
}
void CScriptEMPulse::Accept(IVisitor& visitor)
{
visitor.Visit(this);
}
void CScriptEMPulse::Think(float dt, CStateManager& mgr)
{
if (!GetActive())
return;
xf0_currentRadius += ((xec_finalRadius - xf4_initialRadius) / xe8_duration) * dt;
if (xf0_currentRadius < xec_finalRadius)
mgr.FreeScriptObject(GetUniqueId());
x114_particleGen->Update(dt);
}
void CScriptEMPulse::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
CActor::AcceptScriptMsg(msg, uid, mgr);
if (msg == EScriptObjectMessage::Activate)
{
x114_particleGen.reset(new CElementGen(x108_particleDesc, CElementGen::EModelOrientationType::Normal,
CElementGen::EOptionalSystemFlags::One));
x114_particleGen->SetOrientation(GetTransform().getRotation());
x114_particleGen->SetGlobalTranslation(GetTranslation());
x114_particleGen->SetParticleEmission(true);
mgr.GetPlayerState()->GetStaticInterference().AddSource(GetUniqueId(), x100_interferenceMag,
xf8_interferenceDur);
}
}
void CScriptEMPulse::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) const
{
CActor::AddToRenderer(frustum, mgr);
if (GetActive())
g_Renderer->AddParticleGen(*x114_particleGen);
}
void CScriptEMPulse::CalculateRenderBounds()
{
x9c_renderBounds = CalculateBoundingBox();
}
std::experimental::optional<zeus::CAABox> CScriptEMPulse::GetTouchBounds() const
{
return {CalculateBoundingBox()};
}
void CScriptEMPulse::Touch(CActor& act, CStateManager& mgr)
{
if (!GetActive())
return;
if (TCastToPtr<CPlayer> pl = act)
{
zeus::CVector3f posDiff = GetTranslation() - pl->GetTranslation();
if (posDiff.magnitude() < xec_finalRadius)
{
float dur =
((1.f - (posDiff.magnitude() / xec_finalRadius)) * (xfc_ - xf8_interferenceDur)) + xf8_interferenceDur;
float mag = ((1.f - (posDiff.magnitude() / xec_finalRadius)) * (x104_ - xf8_interferenceDur)) +
x100_interferenceMag;
if (dur > pl->GetStaticTimer())
pl->SetHudDisable(dur, 0.5f, 2.5f);
else
mgr.GetPlayerState()->GetStaticInterference().AddSource(GetUniqueId(), mag, dur);
}
}
}
zeus::CAABox CScriptEMPulse::CalculateBoundingBox() const
{
return zeus::CAABox(GetTranslation() - xf0_currentRadius, GetTranslation() + xf0_currentRadius);
}
}

View File

@ -0,0 +1,36 @@
#ifndef __URDE_CSCRIPTEMPULSE_HPP__
#define __URDE_CSCRIPTEMPULSE_HPP__
#include "CActor.hpp"
namespace urde
{
class CGenDescription;
class CElementGen;
class CScriptEMPulse : public CActor
{
float xe8_duration;
float xec_finalRadius;
float xf0_currentRadius;
float xf4_initialRadius;
float xf8_interferenceDur;
float xfc_;
float x100_interferenceMag;
float x104_;
TCachedToken<CGenDescription> x108_particleDesc;
std::unique_ptr<CElementGen> x114_particleGen;
zeus::CAABox CalculateBoundingBox() const;
public:
CScriptEMPulse(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, bool, float, float, float,
float, float, float, float, CAssetId);
void Accept(IVisitor&);
void Think(float, CStateManager&);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
void AddToRenderer(const zeus::CFrustum&, CStateManager&) const;
void CalculateRenderBounds();
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
void Touch(CActor&, CStateManager&);
};
}
#endif // __URDE_CSCRIPTEMPULSE_HPP__

View File

@ -407,6 +407,13 @@ zeus::CAABox CScriptEffect::GetSortingBounds(const CStateManager& mgr) const
bool CScriptEffect::AreBothSystemsDeleteable()
{
return x104_particleSystem->IsSystemDeletable() && xf4_electric->IsSystemDeletable();
bool ret = true;
if (x104_particleSystem && !x104_particleSystem->IsSystemDeletable())
ret = false;
if (xf4_electric && !xf4_electric->IsSystemDeletable())
ret = false;
return ret;
}
}

View File

@ -31,6 +31,10 @@ public:
void Accept(IVisitor& visitor);
void Think(float, CStateManager&);
void Touch(CActor &, CStateManager &);
std::experimental::optional<zeus::CAABox> GetTouchBounds() const
{
return CPhysicsActor::GetBoundingBox();
}
float GetPossibility() const { return x264_possibility; }
CPlayerState::EItemType GetItem() { return x258_itemType; }
};

View File

@ -14,12 +14,13 @@ CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, std::string_view name, const
: CEntity(uid, info, active, name), x34_xf(xf), x64_itemCounts(itemCounts)
{
#ifndef NDEBUG
x64_itemCounts[int(CPlayerState::EItemType::GravitySuit)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::ThermalVisor)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::XRayVisor)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::GrappleBeam)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::BoostBall)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::ChargeBeam)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::PowerBombs)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::PowerBombs)] = 8;
#endif
x10c_24_firstSpawn = defaultSpawn;
x10c_25_morphed = morphed;

View File

@ -1,6 +1,8 @@
#include "CScriptSpindleCamera.hpp"
#include "Camera/CCameraManager.hpp"
#include "CStateManager.hpp"
#include "ScriptLoader.hpp"
#include "Camera/CBallCamera.hpp"
#include "TCastTo.hpp"
namespace urde
@ -43,7 +45,16 @@ void CScriptSpindleCamera::ProcessInput(const CFinalInput& input, CStateManager&
void CScriptSpindleCamera::Reset(const zeus::CTransform& xf, CStateManager& mgr)
{
const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr);
if (!GetActive() || hint == nullptr)
return;
x33c_24_ = true;
mgr.GetCameraManager()->GetBallCamera()->UpdateLookAtPosition(0.01f, mgr);
}
void CScriptSpindleCamera::Think(float, CStateManager&)
{
}
}

View File

@ -49,6 +49,7 @@ class CScriptSpindleCamera : public CGameCamera
float x328_ = 0.f;
bool x32c_24 = false;
zeus::CVector3f x330_lookDir;
bool x33c_24_;
public:
CScriptSpindleCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, u32 r9,
@ -62,8 +63,9 @@ public:
const SSpindleProperty& seg14, const SSpindleProperty& seg15);
void Accept(IVisitor& visitor);
void ProcessInput(const CFinalInput& input, CStateManager& mgr);
void Think(float, CStateManager&);
void Reset(const zeus::CTransform& xf, CStateManager& mgr);
void ProcessInput(const CFinalInput& input, CStateManager& mgr);
};
}

View File

@ -95,8 +95,9 @@ void CScriptWorldTeleporter::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
const auto& world = mgr.WorldNC();
world->SetLoadPauseState(true);
CAssetId currentWorld = g_GameState->CurrentWorldAssetId();
g_GameState->SetCurrentWorldId(x34_worldId);
if (g_ResFactory->GetResourceTypeById(currentWorld) == SBIG('MLVL'))
if (g_ResFactory->GetResourceTypeById(x34_worldId) == SBIG('MLVL'))
{
StartTransition(mgr);
g_GameState->SetCurrentWorldId(x34_worldId);

View File

@ -155,7 +155,7 @@ void CWorldTransManager::UpdateText(float dt)
if (printed >= nextSfxInterval)
{
x3c_sfxInterval = nextSfxInterval;
//CSfxManager::SfxStart(SFXsfx059E, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
CSfxManager::SfxStart(SFXsfx059E, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
}
}
@ -424,6 +424,7 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes,
else
x1c_bgHeight = 0.f;
StartTransition();
TouchModels();
}
@ -446,6 +447,7 @@ void CWorldTransManager::EnableTransition(CAssetId fontId, CAssetId stringId, u3
x8_textData->SetTypeWriteEffectOptions(true, chFadeTime, chFadeRate);
xc_strTable = g_SimplePool->GetObj(SObjectTag{FOURCC('STRG'), stringId});
x8_textData->SetText(u"");
StartTransition();
}
void CWorldTransManager::StartTextFadeOut()

View File

@ -12,14 +12,18 @@
#include "CScriptAiJumpPoint.hpp"
#include "CScriptAreaAttributes.hpp"
#include "MP1/World/CSeedling.hpp"
#include "MP1/World/CBurrower.hpp"
#include "CScriptBeam.hpp"
#include "CScriptCameraBlurKeyframe.hpp"
#include "CScriptCameraFilterKeyframe.hpp"
#include "CScriptCameraHint.hpp"
#include "CScriptCameraHintTrigger.hpp"
#include "CAmbientAI.hpp"
#include "MP1/World/CPuffer.hpp"
#include "MP1/World/CTryclops.hpp"
#include "MP1/World/CRidley.hpp"
#include "CScriptCameraPitchVolume.hpp"
#include "MP1/World/CMagdolite.hpp"
#include "CTeamAiMgr.hpp"
#include "CSnakeWeedSwarm.hpp"
#include "CScriptCameraShaker.hpp"
@ -27,11 +31,15 @@
#include "CScriptColorModulate.hpp"
#include "CScriptControllerAction.hpp"
#include "CScriptCounter.hpp"
#include "MP1/World/CElitePirate.hpp"
#include "CScriptCoverPoint.hpp"
#include "CScriptSpiderBallWaypoint.hpp"
#include "CScriptDamageableTrigger.hpp"
#include "CScriptDebris.hpp"
#include "CScriptDistanceFog.hpp"
#include "CScriptDock.hpp"
#include "MP1/World/CFireFlea.hpp"
#include "MP1/World/CMetaree.hpp"
#include "CScriptDockAreaChange.hpp"
#include "CScriptDoor.hpp"
#include "CScriptEffect.hpp"
@ -44,6 +52,7 @@
#include "CScriptPickup.hpp"
#include "CScriptPickupGenerator.hpp"
#include "CScriptPlatform.hpp"
#include "CScriptEMPulse.hpp"
#include "CScriptPlayerActor.hpp"
#include "CFishCloud.hpp"
#include "CFishCloudModifier.hpp"
@ -57,6 +66,8 @@
#include "CScriptSound.hpp"
#include "CScriptSpawnPoint.hpp"
#include "CScriptSpecialFunction.hpp"
#include "MP1/World/CBabygoth.hpp"
#include "MP1/World/CEyeball.hpp"
#include "CScriptSteam.hpp"
#include "CScriptRipple.hpp"
#include "CScriptBallTrigger.hpp"
@ -72,6 +83,7 @@
#include "CScriptWorldTeleporter.hpp"
#include "CScriptSpiderBallAttractionSurface.hpp"
#include "CScriptSpindleCamera.hpp"
#include "MP1/World/CAtomicAlpha.hpp"
#include "CSimplePool.hpp"
#include "CStateManager.hpp"
#include "CWallCrawlerSwarm.hpp"
@ -88,12 +100,15 @@
#include "MP1/World/CWarWasp.hpp"
#include "MP1/World/CParasite.hpp"
#include "Particle/CWeaponDescription.hpp"
#include "MP1/World/CBloodFlower.hpp"
#include "MP1/World/CFlickerBat.hpp"
#include "Camera/CPathCamera.hpp"
namespace urde
{
static logvisor::Module Log("urde::ScriptLoader");
static SObjectTag MorphballDoorANCS = {};
static const SObjectTag& GetMorphballDoorACS()
{
if (!MorphballDoorANCS)
@ -124,6 +139,7 @@ struct SActorHead
struct SScaledActorHead : SActorHead
{
zeus::CVector3f x40_scale;
SScaledActorHead(SActorHead&& head) : SActorHead(std::move(head)) {}
};
@ -245,11 +261,11 @@ CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in)
if (propCount > 13)
thermalMag = in.readFloatBig();
std::pair<CAssetId, CAssetId> xray = {};
std::pair <CAssetId, CAssetId> xray = {};
if (g_ResFactory->GetResourceTypeById(xrayModel))
xray = {xrayModel, xraySkin};
std::pair<CAssetId, CAssetId> infra = {};
std::pair <CAssetId, CAssetId> infra = {};
if (g_ResFactory->GetResourceTypeById(infraModel))
infra = {infraModel, infraSkin};
@ -374,8 +390,8 @@ zeus::CTransform ScriptLoader::ConvertEditorEulerToTransform4f(const zeus::CVect
const zeus::CVector3f& position)
{
return zeus::CTransform::RotateZ(zeus::degToRad(orientation.z)) *
zeus::CTransform::RotateY(zeus::degToRad(orientation.y)) *
zeus::CTransform::RotateX(zeus::degToRad(orientation.x)) +
zeus::CTransform::RotateY(zeus::degToRad(orientation.y)) *
zeus::CTransform::RotateX(zeus::degToRad(orientation.x)) +
position;
}
@ -505,8 +521,7 @@ CEntity* ScriptLoader::LoadDoor(CStateManager& mgr, CInputStream& in, int propCo
{
if (aParms.GetACSFile() == GetMorphballDoorACS().id)
isMorphballDoor = true;
}
else if (propCount == 14)
} else if (propCount == 14)
isMorphballDoor = in.readBool();
return new CScriptDoor(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData), actParms,
@ -528,7 +543,8 @@ CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int pro
zeus::CVector3f forceVec = zeus::CVector3f::ReadBig(in);
ETriggerFlags flags = ETriggerFlags(in.readUint32Big());
ETriggerFlags
flags = ETriggerFlags(in.readUint32Big());
bool active = in.readBool();
bool b2 = in.readBool();
bool b3 = in.readBool();
@ -656,7 +672,7 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int pr
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), extent, centroid);
FourCC dclnType = g_ResFactory->GetResourceTypeById(dclnId);
std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>> dclnToken;
std::experimental::optional <TLockedToken<CCollidableOBBTreeGroupContainer>> dclnToken;
if (dclnType)
{
dclnToken.emplace(g_SimplePool->GetObj({SBIG('DCLN'), dclnId}));
@ -756,22 +772,23 @@ CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, int prop
bool active = in.readBool();
float shotDuration = in.readFloatBig();
bool b2 = in.readBool();
bool b3 = in.readBool();
bool b4 = in.readBool();
bool b5 = in.readBool();
bool b6 = in.readBool();
bool lookAtPlayer = in.readBool();
bool outOfPlayerEye = in.readBool();
bool intoPlayerEye = in.readBool();
bool drawPlayer = in.readBool();
bool disableInput = in.readBool();
bool b8 = in.readBool();
bool b7 = in.readBool();
bool finishCineSkip = in.readBool();
float fov = in.readFloatBig();
bool b9 = in.readBool();
bool checkFailsafe = in.readBool();
bool b10 = false;
bool disableOutOfInto = false;
if (propCount > 14)
b10 = in.readBool();
disableOutOfInto = in.readBool();
u32 flags = u32(b2) | u32(b3) << 1 | u32(b4) << 2 | u32(b5) << 3 | u32(b6) << 4 | u32(disableInput) << 5 |
u32(b8) << 6 | u32(b9) << 8;
s32 flags = s32(lookAtPlayer) | s32(outOfPlayerEye) << 1 | s32(intoPlayerEye) << 2 | s32(b7) << 3 |
s32(finishCineSkip) << 4 | s32(disableInput) << 5 | s32(drawPlayer) << 6 |
s32(checkFailsafe) << 7 | s32(disableOutOfInto) << 9;
return new CCinematicCamera(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, shotDuration,
fov / CCameraManager::Aspect(), CCameraManager::NearPlane(), CCameraManager::FarPlane(),
@ -1019,7 +1036,7 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int prop
if (animType != SBIG('ANCS'))
return nullptr;
std::experimental::optional<CStaticRes> abdomenRes;
std::experimental::optional <CStaticRes> abdomenRes;
if (flavor == CPatterned::EFlavorType::One)
abdomenRes.emplace(CStaticRes(abdomen, scale));
@ -1220,11 +1237,12 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC
CDamageInfo dInfo(in);
zeus::CVector3f orientedForce;
orientedForce.readBig(in);
ETriggerFlags triggerFlags = ETriggerFlags(in.readUint32Big()) | ETriggerFlags::DetectProjectiles1 |
ETriggerFlags::DetectProjectiles2 | ETriggerFlags::DetectProjectiles3 |
ETriggerFlags::DetectProjectiles4 | ETriggerFlags::DetectBombs |
ETriggerFlags::DetectPowerBombs | ETriggerFlags::DetectProjectiles5 |
ETriggerFlags::DetectProjectiles6 | ETriggerFlags::DetectProjectiles7;
ETriggerFlags
triggerFlags = ETriggerFlags(in.readUint32Big()) | ETriggerFlags::DetectProjectiles1 |
ETriggerFlags::DetectProjectiles2 | ETriggerFlags::DetectProjectiles3 |
ETriggerFlags::DetectProjectiles4 | ETriggerFlags::DetectBombs |
ETriggerFlags::DetectPowerBombs | ETriggerFlags::DetectProjectiles5 |
ETriggerFlags::DetectProjectiles6 | ETriggerFlags::DetectProjectiles7;
bool thermalCold = in.readBool();
bool displaySurface = in.readBool();
CAssetId patternMap1 = in.readUint32Big();
@ -1291,7 +1309,7 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC
u32 w22 = in.readUint32Big();
bool b5 = in.readBool();
std::unique_ptr<u32[]> bitset;
std::unique_ptr < u32[] > bitset;
u32 bitVal0 = 0;
u32 bitVal1 = 0;
@ -1318,7 +1336,8 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC
thermalCold, displaySurface, patternMap1, patternMap2, colorMap, bumpMap, envMap,
envBumpMap, {}, bumpLightDir, bumpScale, morphInTime, morphOutTime, active, fluidType, b4,
alpha, uvMotion, turbSpeed, turbDistance, turbFreqMax, turbFreqMin, turbPhaseMax,
turbPhaseMin, turbAmplitudeMax, turbAmplitudeMin, splashColor, insideFogColor, splashParticle1,
turbPhaseMin, turbAmplitudeMax, turbAmplitudeMin, splashColor, insideFogColor,
splashParticle1,
splashParticle2, splashParticle3, visorRunoffParticle, unmorphVisorRunoffParticle,
visorRunoffSfx, unmorphVisorRunoffSfx, splashSfx1, splashSfx2, splashSfx3, tileSize,
tileSubdivisions, specularMin, specularMax, reflectionSize, rippleIntensity,
@ -1399,7 +1418,28 @@ CEntity* ScriptLoader::LoadFlyingPirate(CStateManager& mgr, CInputStream& in, in
CEntity* ScriptLoader::LoadElitePirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 41, "ElitePirate"))
return nullptr;
SScaledActorHead actHead = LoadScaledActorHead(in, mgr);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
CActorParameters actParms = LoadActorParameters(in);
MP1::CElitePirateData elitePirateData(in, propCount);
if (!pInfo.GetAnimationParameters().GetACSFile().IsValid())
return nullptr;
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CElitePirate(mgr.AllocateUniqueId(), actHead.x0_name, info, actHead.x10_transform, std::move(mData),
pInfo, actParms, elitePirateData);
}
CEntity* ScriptLoader::LoadMetroidBeta(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1432,17 +1472,82 @@ CEntity* ScriptLoader::LoadCoverPoint(CStateManager& mgr, CInputStream& in, int
CEntity* ScriptLoader::LoadSpiderBallWaypoint(CStateManager& mgr, CInputStream& in, int propCount,
const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 5, "SpiderBallWaypoint"))
return nullptr;
SActorHead actHead = LoadActorHead(in, mgr);
bool active = in.readBool();
u32 w1 = in.readUint32Big();
return new CScriptSpiderBallWaypoint(mgr.AllocateUniqueId(), actHead.x0_name, info, actHead.x10_transform, active,
w1);
}
CEntity* ScriptLoader::LoadBloodFlower(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 18, "BloodFlower"))
return nullptr;
SScaledActorHead actHead = LoadScaledActorHead(in, mgr);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
CActorParameters actParms = LoadActorParameters(in);
CAssetId partId1(in);
CAssetId wpsc1(in);
CAssetId wpsc2(in);
CDamageInfo dInfo1(in);
CDamageInfo dInfo2(in);
CDamageInfo dInfo3(in);
CAssetId partId2(in);
CAssetId partId3(in);
CAssetId partId4(in);
float f1 = in.readFloatBig();
CAssetId partId5(in);
u32 soundId = in.readUint32Big();
if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS'))
return nullptr;
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CBloodFlower(mgr.AllocateUniqueId(), actHead.x0_name, info, actHead.x10_transform, std::move(mData),
pInfo, partId1, wpsc1, actParms, wpsc2, dInfo1, dInfo2, dInfo3, partId2, partId3,
partId4, f1, partId5, soundId);
}
CEntity* ScriptLoader::LoadFlickerBat(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 10, "FlickerBat"))
return nullptr;
std::string name = mgr.HashInstanceName(in);
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
zeus::CTransform xf = LoadEditorTransform(in);
zeus::CVector3f scale = zeus::CVector3f::ReadBig(in);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
CActorParameters actParms = LoadActorParameters(in);
bool b1 = in.readBool();
bool b2 = in.readBool();
bool b3 = in.readBool();
if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS'))
return nullptr;
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CFlickerBat(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo,
CPatterned::EColliderType(b1), b2, actParms, b3);
}
CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1543,12 +1648,63 @@ CEntity* ScriptLoader::LoadDistanceFog(CStateManager& mgr, CInputStream& in, int
CEntity* ScriptLoader::LoadFireFlea(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 9, "FireFlea"))
return nullptr;
SScaledActorHead acthead = LoadScaledActorHead(in, mgr);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
CActorParameters actParms = LoadActorParameters(in);
in.readBool();
in.readBool();
float f1 = in.readFloatBig();
if (!pInfo.GetAnimationParameters().GetACSFile().IsValid())
return nullptr;
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
acthead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CFireFlea(mgr.AllocateUniqueId(), acthead.x0_name, info, acthead.x10_transform, std::move(mData),
actParms, pInfo, f1);
}
CEntity* ScriptLoader::LoadMetareeAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
CEntity* ScriptLoader::LoadMetaree(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 12, "Metaree"))
return nullptr;
std::string name = mgr.HashInstanceName(in);
zeus::CTransform xf = LoadEditorTransform(in);
zeus::CVector3f scale = zeus::CVector3f::ReadBig(in);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
CActorParameters aParms = LoadActorParameters(in);
CDamageInfo dInfo(in);
float f1 = in.readFloatBig();
zeus::CVector3f vec = zeus::CVector3f::ReadBig(in);
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS'))
return nullptr;
float f4 = in.readFloatBig();
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CMetaree(mgr.AllocateUniqueId(), name, CPatterned::EFlavorType::Zero, info, xf, std::move(mData),
pInfo,
dInfo, f1, vec, f2, EBodyType::Invalid, f3, f4, aParms);
}
CEntity* ScriptLoader::LoadDockAreaChange(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1798,7 +1954,8 @@ CEntity* ScriptLoader::LoadSteam(CStateManager& mgr, CInputStream& in, int propC
zeus::CVector3f v3 = zeus::CVector3f::ReadBig(in);
ETriggerFlags w1 = ETriggerFlags(in.readUint32Big());
ETriggerFlags
w1 = ETriggerFlags(in.readUint32Big());
bool b1 = in.readBool();
u32 w2 = in.readUint32Big();
float f1 = in.readFloatBig();
@ -1854,7 +2011,22 @@ CEntity* ScriptLoader::LoadTargetingPoint(CStateManager& mgr, CInputStream& in,
CEntity* ScriptLoader::LoadEMPulse(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 12, "EMPulse"))
return nullptr;
SActorHead actorHead = LoadActorHead(in, mgr);
bool active = in.readBool();
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
float f4 = in.readFloatBig();
float f5 = in.readFloatBig();
float f6 = in.readFloatBig();
float f7 = in.readFloatBig();
CAssetId particleId(in);
return new CScriptEMPulse(mgr.AllocateUniqueId(), actorHead.x0_name, info, actorHead.x10_transform, active, f1, f2,
f3, f4, f5, f6, f7, particleId);
}
CEntity* ScriptLoader::LoadIceSheegoth(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2013,7 +2185,7 @@ CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, int
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
u32 w2 = in.readUint32Big();
std::vector<CVisorFlare::CFlareDef> flares;
std::vector <CVisorFlare::CFlareDef> flares;
flares.reserve(5);
for (int i = 0; i < 5; ++i)
if (auto flare = CVisorFlare::LoadFlareDef(in))
@ -2088,11 +2260,10 @@ CEntity* ScriptLoader::LoadVisorGoo(CStateManager& mgr, CInputStream& in, int pr
s32 sfx = in.readInt32Big();
bool forceShow = in.readBool();
if (particle.IsValid() || electric.IsValid())
return new CScriptVisorGoo(mgr.AllocateUniqueId(), name, info, xf, particle, electric, minDist, maxDist,
nearProb, farProb, color, sfx, forceShow, false);
return nullptr;
if (!particle.IsValid() && !electric.IsValid())
return nullptr;
return new CScriptVisorGoo(mgr.AllocateUniqueId(), name, info, xf, particle, electric, minDist, maxDist,
nearProb, farProb, color, sfx, forceShow, false);
}
CEntity* ScriptLoader::LoadJellyZap(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2399,12 +2570,69 @@ CEntity* ScriptLoader::LoadFogVolume(CStateManager& mgr, CInputStream& in, int p
CEntity* ScriptLoader::LoadBabygoth(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 33, "Babygoth"))
return nullptr;
SScaledActorHead actHead = LoadScaledActorHead(in, mgr);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
CActorParameters actParms = LoadActorParameters(in);
MP1::CBabygothData babyData(in);
if (!pInfo.GetAnimationParameters().GetACSFile().IsValid())
return nullptr;
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(),
pInfo.GetAnimationParameters().GetCharacter(), actHead.x40_scale,
pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CBabygoth(mgr.AllocateUniqueId(), actHead.x0_name, info, actHead.x10_transform, std::move(mData),
pInfo, actParms, babyData);
}
CEntity* ScriptLoader::LoadEyeball(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 21, "Eyeball"))
return nullptr;
std::string name = mgr.HashInstanceName(in);
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
zeus::CTransform xf = LoadEditorTransform(in);
zeus::CVector3f scale = zeus::CVector3f::ReadBig(in);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
CActorParameters actParms = LoadActorParameters(in);
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
CAssetId wpsc(in);
CDamageInfo dInfo(in);
CAssetId partId1(in);
CAssetId partId2(in);
CAssetId texture1(in);
CAssetId texture2(in);
u32 w1 = in.readUint32Big();
u32 w2 = in.readUint32Big();
u32 w3 = in.readUint32Big();
u32 w4 = in.readUint32Big();
u32 w5 = in.readUint32Big();
if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS'))
return nullptr;
bool b1 = in.readBool();
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(),
pInfo.GetAnimationParameters().GetCharacter(), scale,
pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CEyeball(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo, f1, f2, wpsc,
dInfo, partId1, partId2, texture1, texture2, w1, w2, w3, w4, w5, actParms, b1);
}
CEntity* ScriptLoader::LoadRadialDamage(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2419,9 +2647,10 @@ CEntity* ScriptLoader::LoadRadialDamage(CStateManager& mgr, CInputStream& in, in
float radius = in.readFloatBig();
zeus::CTransform xf = ConvertEditorEulerToTransform4f(zeus::CVector3f::skZero, center);
return new CScriptSpecialFunction(
mgr.AllocateUniqueId(), name, info, xf, CScriptSpecialFunction::ESpecialFunction::RadialDamage, "", radius, 0.f,
0.f, 0.f, zeus::CVector3f::skZero, zeus::CColor::skBlack, active, dInfo, -1, -1, -1, -1, -1, -1);
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), name, info, xf,
CScriptSpecialFunction::ESpecialFunction::RadialDamage, "", radius, 0.f,
0.f, 0.f, zeus::CVector3f::skZero, zeus::CColor::skBlack, active, dInfo, -1, -1,
-1, -1, -1, -1);
}
CEntity* ScriptLoader::LoadCameraPitchVolume(CStateManager& mgr, CInputStream& in, int propCount,
@ -2459,7 +2688,46 @@ CEntity* ScriptLoader::LoadEnvFxDensityController(CStateManager& mgr, CInputStre
CEntity* ScriptLoader::LoadMagdolite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 22, "Magdolite"))
return nullptr;
SScaledActorHead actorHead = LoadScaledActorHead(in, mgr);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
CActorParameters actorParameters = LoadActorParameters(in);
if (!pInfo.GetAnimationParameters().GetACSFile().IsValid())
return nullptr;
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
CDamageInfo damageInfo1(in);
CDamageInfo damageInfo2(in);
CDamageVulnerability damageVulnerability1(in);
CDamageVulnerability damageVulnerability2(in);
CAssetId modelId(in);
CAssetId skinId(in);
float f3 = in.readFloatBig();
float f4 = in.readFloatBig();
float f5 = in.readFloatBig();
float f6 = in.readFloatBig();
MP1::CMagdolite::CMagdoliteData magData(in);
float f7 = in.readFloatBig();
float f8 = in.readFloatBig();
float f9 = in.readFloatBig();
CModelData modelData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(),
pInfo.GetAnimationParameters().GetCharacter(), actorHead.x40_scale,
pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CMagdolite(mgr.AllocateUniqueId(), actorHead.x0_name, info, actorHead.x10_transform,
std::move(modelData), pInfo, actorParameters, f1, f2, damageInfo1, damageInfo2,
damageVulnerability1,
damageVulnerability2, modelId, skinId, f3, f4, f5, f6, magData, f7, f8, f9);
}
CEntity* ScriptLoader::LoadTeamAIMgr(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2507,9 +2775,9 @@ CEntity* ScriptLoader::LoadSnakeWeedSwarm(CStateManager& mgr, CInputStream& in,
u32 w9 = (propCount < 29 ? -1 : in.readUint32Big());
u32 f16 = (propCount < 29 ? 0.f : in.readFloatBig());
return new CSnakeWeedSwarm(mgr.AllocateUniqueId(), active, name, info, pos, scale, animParms,
actParms, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13,
f14, dInfo, f15, w4, w5, w6, w7, w8, w9, f16);
return new CSnakeWeedSwarm(mgr.AllocateUniqueId(), active, name, info, pos, scale, animParms, actParms, f1, f2, f3,
f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, dInfo, f15, w4, w5, w6, w7, w8, w9,
f16);
}
CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in, int propCount,
@ -2581,11 +2849,13 @@ CEntity* ScriptLoader::LoadGeemer(CStateManager& mgr, CInputStream& in, int prop
u16 sId2 = in.readUint32Big() & 0xFFFF;
u16 sId3 = in.readUint32Big() & 0xFFFF;
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CParasite(mgr.AllocateUniqueId(), actHead.x0_name, CPatterned::EFlavorType::Zero, info,
actHead.x10_transform, std::move(mData), pInfo, EBodyType::WallWalker, 0.f, f1, f2, f3, f4, 0.2f, 0.4f, 0.f,
actHead.x10_transform, std::move(mData), pInfo, EBodyType::WallWalker, 0.f, f1, f2, f3,
f4, 0.2f, 0.4f, 0.f,
0.f, 0.f, 0.f, 0.f, 1.f, f7, 0.f, 0.f, f5, f6, false, 2,
CDamageVulnerability::NormalVulnerabilty(), CDamageInfo(), sId1, sId2, sId3, -1,
-1, 0.f, actParms);
@ -2636,7 +2906,32 @@ CEntity* ScriptLoader::LoadSpindleCamera(CStateManager& mgr, CInputStream& in, i
CEntity* ScriptLoader::LoadAtomicAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 14, "AtomicAlpha"))
return nullptr;
SScaledActorHead actHead = LoadScaledActorHead(in, mgr);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
CActorParameters actParms = LoadActorParameters(in);
CAssetId wpsc(in);
CAssetId model(in);
CDamageInfo dInfo(in);
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
bool b1 = in.readBool();
bool b2 = in.readBool();
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CAtomicAlpha(mgr.AllocateUniqueId(), actHead.x0_name, info, actHead.x10_transform, std::move(mData),
actParms, pInfo, wpsc, dInfo, f1, f2, f3, model, b1, b2);
}
CEntity* ScriptLoader::LoadCameraHintTrigger(CStateManager& mgr, CInputStream& in, int propCount,
@ -2712,7 +3007,8 @@ CEntity* ScriptLoader::LoadAmbientAI(CStateManager& mgr, CInputStream& in, int p
aabox = mData.GetBounds(head.x10_transform.getRotation());
return new CAmbientAI(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData), aabox,
matList, mass, hInfo, dVuln, actParms, alertRange, impactRange, alertAnim, impactAnim, active);
matList, mass, hInfo, dVuln, actParms, alertRange, impactRange, alertAnim, impactAnim,
active);
}
CEntity* ScriptLoader::LoadAtomicBeta(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2727,12 +3023,66 @@ CEntity* ScriptLoader::LoadIceZoomer(CStateManager& mgr, CInputStream& in, int p
CEntity* ScriptLoader::LoadPuffer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 16, "Puffer"))
return nullptr;
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
if (!pInfo.GetAnimationParameters().GetACSFile().IsValid())
return nullptr;
CActorParameters actorParameters = LoadActorParameters(in);
float hoverSpeed = in.readFloatBig();
CAssetId cloudEffect(in);
CDamageInfo cloudDamage(in);
CAssetId cloudSteam(in);
float f2 = in.readFloatBig();
bool b1 = in.readBool();
bool b2 = in.readBool();
bool b3 = in.readBool();
CDamageInfo explosionDamage(in);
s16 sfxId = in.readUint16Big();
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
aHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CPuffer(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, std::move(mData),
actorParameters, pInfo, hoverSpeed, cloudEffect, cloudDamage, cloudSteam, f2, b1, b2, b3,
explosionDamage, sfxId);
}
CEntity* ScriptLoader::LoadTryclops(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 10, "Tryclops"))
return nullptr;
SScaledActorHead actorHead = LoadScaledActorHead(in, mgr);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
if (!pInfo.GetAnimationParameters().GetACSFile().IsValid())
return nullptr;
CActorParameters actorParameters = LoadActorParameters(in);
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
float f4 = in.readFloatBig();
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(),
pInfo.GetAnimationParameters().GetCharacter(), actorHead.x40_scale,
pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CTryclops(mgr.AllocateUniqueId(), actorHead.x0_name, info, actorHead.x10_transform,
std::move(mData), pInfo, actorParameters, f1, f2, f3, f4);
}
CEntity* ScriptLoader::LoadRidley(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2750,8 +3100,11 @@ CEntity* ScriptLoader::LoadRidley(CStateManager& mgr, CInputStream& in, int prop
if (!pInfo.GetAnimationParameters().GetACSFile().IsValid())
return nullptr;
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), aHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CRidley(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, std::move(mData), pInfo, actParms, in, propCount);
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
aHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CRidley(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, std::move(mData), pInfo,
actParms, in, propCount);
}
CEntity* ScriptLoader::LoadSeedling(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2779,8 +3132,11 @@ CEntity* ScriptLoader::LoadSeedling(CStateManager& mgr, CInputStream& in, int pr
float f3 = in.readFloatBig();
float f4 = in.readFloatBig();
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), aHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CSeedling(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, std::move(mData), pInfo, actParms, needleId, weaponId, dInfo1, dInfo2, f1, f2, f3, f4);
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
aHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CSeedling(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, std::move(mData), pInfo,
actParms, needleId, weaponId, dInfo1, dInfo2, f1, f2, f3, f4);
}
CEntity* ScriptLoader::LoadThermalHeatFader(CStateManager& mgr, CInputStream& in, int propCount,
@ -2789,12 +3145,46 @@ CEntity* ScriptLoader::LoadThermalHeatFader(CStateManager& mgr, CInputStream& in
if (!EnsurePropertyCount(propCount, 4, "ThermalHeatFader"))
return nullptr;
return LoadWorldLightFader(mgr, in, propCount, info);
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
float fadedLevel = in.readFloatBig();
float initialLevel = in.readFloatBig();
return new CScriptDistanceFog(mgr.AllocateUniqueId(), name, info, ERglFogMode::None, zeus::CColor::skBlack,
zeus::CVector2f(), 0.f, zeus::CVector2f(), false, active, fadedLevel, initialLevel,
0.f, 0.f);
}
CEntity* ScriptLoader::LoadBurrower(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 13, "Burrower"))
return nullptr;
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
if (!pair.first)
return nullptr;
CPatternedInfo pInfo(in, pair.second);
if (!pInfo.GetAnimationParameters().GetACSFile().IsValid())
return nullptr;
CActorParameters actParms = LoadActorParameters(in);
CAssetId w1(in);
CAssetId w2(in);
CAssetId w3(in);
CDamageInfo dInfo(in);
CAssetId w4(in);
u32 w5 = in.readUint32Big();
CAssetId w6(in);
CModelData mData(
CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
aHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
return new MP1::CBurrower(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, std::move(mData), pInfo,
actParms, w1, w2, w3, dInfo, w4, w5, w6);
}
CEntity* ScriptLoader::LoadBeam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2810,7 +3200,7 @@ CEntity* ScriptLoader::LoadBeam(CStateManager& mgr, CInputStream& in, int propCo
CBeamInfo beamInfo(in);
CDamageInfo dInfo(in);
TToken<CWeaponDescription> weaponDesc = g_SimplePool->GetObj({SBIG('WPSC'), weaponDescId});
TToken <CWeaponDescription> weaponDesc = g_SimplePool->GetObj({SBIG('WPSC'), weaponDescId});
return new CScriptBeam(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, weaponDesc,
beamInfo, dInfo);
@ -2821,7 +3211,14 @@ CEntity* ScriptLoader::LoadWorldLightFader(CStateManager& mgr, CInputStream& in,
if (!EnsurePropertyCount(propCount, 4, "WorldLightFader"))
return nullptr;
return nullptr;
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
return new CScriptDistanceFog(mgr.AllocateUniqueId(), name, info, ERglFogMode::None, zeus::CColor::skBlack,
zeus::CVector2f::skZero, 0.f, zeus::CVector2f::skZero, false, active, 0.f, 0.f, f1,
f2);
}
CEntity* ScriptLoader::LoadMetroidPrimeStage2(CStateManager& mgr, CInputStream& in, int propCount,

View File

@ -82,7 +82,7 @@ public:
static CEntity* LoadPuddleToadGamma(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadDistanceFog(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadFireFlea(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadMetareeAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadMetaree(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadDockAreaChange(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadActorRotate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadSpecialFunction(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);

View File

@ -56,7 +56,7 @@ std::string_view ScriptObjectTypeToStr(EScriptObjectType type)
case EScriptObjectType::PuddleToadGamma: return "PuddleToadGamma"sv;
case EScriptObjectType::DistanceFog: return "DistanceFog"sv;
case EScriptObjectType::FireFlea: return "FireFlea"sv;
case EScriptObjectType::MetareeAlpha: return "MetareeAlpha"sv;
case EScriptObjectType::Metaree: return "Metaree"sv;
case EScriptObjectType::DockAreaChange: return "DockAreaChange"sv;
case EScriptObjectType::ActorRotate: return "ActorRotate"sv;
case EScriptObjectType::SpecialFunction: return "SpecialFunction"sv;

View File

@ -55,7 +55,7 @@ enum class EScriptObjectType
PuddleToadGamma = 0x34,
DistanceFog = 0x35,
FireFlea = 0x36,
MetareeAlpha = 0x37,
Metaree = 0x37,
DockAreaChange = 0x38,
ActorRotate = 0x39,
SpecialFunction = 0x3A,

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
set(BUILD_TESTING OFF)
add_subdirectory(tinyxml2)
add_executable(assetnameparser "main.cpp")
include_directories(${LOGVISOR_INCLUDE_DIR})