mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of https://github.com/AxioDL/urde
This commit is contained in:
commit
5f5c1ce2f1
|
@ -341,7 +341,7 @@ struct SpecMP1 : SpecBase
|
|||
/* Extract non-pak files */
|
||||
progress(_S("MP1 Root"), _S(""), 3, 0.0);
|
||||
int prog = 0;
|
||||
ctx.progressCB = [&](const std::string& name) {
|
||||
ctx.progressCB = [&](const std::string& name, float) {
|
||||
hecl::SystemStringView nameView(name);
|
||||
progress(_S("MP1 Root"), nameView.c_str(), 3, prog / (float)m_nonPaks.size());
|
||||
};
|
||||
|
|
|
@ -229,7 +229,7 @@ struct SpecMP2 : SpecBase
|
|||
mp2OutPath.makeDir();
|
||||
progress(_S("MP2 Root"), _S(""), 3, 0.0);
|
||||
int prog = 0;
|
||||
ctx.progressCB = [&](const std::string& name) {
|
||||
ctx.progressCB = [&](const std::string& name, float) {
|
||||
hecl::SystemStringView nameView(name);
|
||||
progress(_S("MP2 Root"), nameView.c_str(), 3, prog / (float)m_nonPaks.size());
|
||||
};
|
||||
|
|
|
@ -334,7 +334,7 @@ struct SpecMP3 : SpecBase
|
|||
size_t nodeCount = 0;
|
||||
int prog = 0;
|
||||
nod::ExtractionContext ctx = {true, force,
|
||||
[&](const std::string& name)
|
||||
[&](const std::string& name, float)
|
||||
{
|
||||
hecl::SystemStringView nameView(name);
|
||||
progress(currentTarget.c_str(), nameView.c_str(), compIdx, prog / (float)nodeCount);
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace urde
|
|||
|
||||
void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
||||
{
|
||||
// m_modelTest = objStore.GetObj("MP1/Shared/CMDL_B2B41738.blend");
|
||||
m_modelTest = objStore.GetObj("MP1/Shared/CMDL_B2B41738.blend");
|
||||
#if 0
|
||||
SObjectTag samusCharSet = m_projManager.TagFromPath(_S("MP1/Shared/ANCS_77289A4A.*"));
|
||||
SObjectTag platModel = m_projManager.TagFromPath(_S("MP1/Shared/CMDL_6FA561D0.blend"));
|
||||
|
|
|
@ -22,7 +22,7 @@ EPVSVisSetState CPVSVisSet::GetVisible(u32 idx) const
|
|||
if (idx < numFeatures)
|
||||
{
|
||||
/* This is a feature lookup */
|
||||
if (!x10_ptr[idx / 8] & (1 << (idx & 0x7)))
|
||||
if (!(x10_ptr[idx / 8] & (1 << (idx & 0x7))))
|
||||
return EPVSVisSetState::EndOfTree;
|
||||
return EPVSVisSetState::OutOfBounds;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
"TBINDING0 uniform sampler2D tex;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" colorOut = vtf.color * vec4(texture(tex, vtf.uv, lod).rgb, 1.0);\n"
|
||||
" colorOut = vtf.color * vec4(texture(tex, vtf.uv, vtf.lod).rgb, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
static const char* FSAlpha =
|
||||
|
@ -98,7 +98,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
"TBINDING0 uniform sampler2D tex;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" colorOut = vtf.color * texture(tex, vtf.uv, lod);\n"
|
||||
" colorOut = vtf.color * texture(tex, vtf.uv, vtf.lod);\n"
|
||||
"}\n";
|
||||
|
||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "MP1/World/CActorContraption.hpp"
|
||||
#include "Weapon/CFlameThrower.hpp"
|
||||
#include "Weapon/CFlameInfo.hpp"
|
||||
#include "Character/CInt32POINode.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
|
@ -11,27 +12,39 @@ namespace urde
|
|||
|
||||
MP1::CActorContraption::CActorContraption(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData, const zeus::CAABox& aabox,
|
||||
const CMaterialList& matList, float f1, float f2, const CHealthInfo& hInfo,
|
||||
const CMaterialList& matList, float mass, float zMomentum, const CHealthInfo& hInfo,
|
||||
const CDamageVulnerability& dVuln, const CActorParameters& aParams,
|
||||
ResId part, const CDamageInfo& dInfo, bool active)
|
||||
: CScriptActor(uid, name, info, xf, std::move(mData), aabox, f1, f2, matList, hInfo, dVuln, aParams, false, active, 0,
|
||||
: CScriptActor(uid, name, info, xf, std::move(mData), aabox, mass, zMomentum, matList, hInfo, dVuln, aParams, false, active, 0,
|
||||
1.f, false, false, false, false)
|
||||
, x300_flameThrowerGen(g_SimplePool->GetObj("FlameThrower"))
|
||||
, x308_partId(part)
|
||||
, x308_flameFxId(part)
|
||||
, x30c_dInfo(dInfo)
|
||||
{
|
||||
}
|
||||
|
||||
void MP1::CActorContraption::Accept(IVisitor& visitor)
|
||||
void MP1::CActorContraption::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||
|
||||
void MP1::CActorContraption::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
bool curActive = GetActive();
|
||||
if (msg == EScriptObjectMessage::Registered)
|
||||
AddMaterial(EMaterialTypes::ScanPassthrough, mgr);
|
||||
else if (msg == EScriptObjectMessage::SetToZero)
|
||||
ResetFlameThrowers(mgr);
|
||||
|
||||
AcceptScriptMsg(msg, uid, mgr);
|
||||
if (curActive == GetActive() || !GetActive())
|
||||
return;
|
||||
|
||||
ResetFlameThrowers(mgr);
|
||||
}
|
||||
|
||||
void MP1::CActorContraption::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
CScriptActor::Think(dt, mgr);
|
||||
|
||||
for (const std::pair<TUniqueId, std::string>& uid : x2e4_children)
|
||||
for (const std::pair<TUniqueId, std::string>& uid : x2e8_children)
|
||||
{
|
||||
CFlameThrower* act = static_cast<CFlameThrower*>(mgr.ObjectById(uid.first));
|
||||
|
||||
|
@ -40,16 +53,21 @@ void MP1::CActorContraption::Think(float dt, CStateManager& mgr)
|
|||
}
|
||||
}
|
||||
|
||||
void MP1::CActorContraption::ResetFlameThrowers(CStateManager& mgr)
|
||||
{
|
||||
for (const std::pair<TUniqueId, std::string>& uid : x2e8_children)
|
||||
{
|
||||
CFlameThrower* act = static_cast<CFlameThrower*>(mgr.ObjectById(uid.first));
|
||||
if (act && !act->GetX400_25())
|
||||
act->Reset(mgr, false);
|
||||
}
|
||||
}
|
||||
|
||||
void MP1::CActorContraption::DoUserAnimEvent(CStateManager& mgr, CInt32POINode& node, EUserEventType evType)
|
||||
{
|
||||
if (evType == EUserEventType::DamageOff)
|
||||
{
|
||||
for (const std::pair<TUniqueId, std::string>& uid : x2e4_children)
|
||||
{
|
||||
CFlameThrower* act = static_cast<CFlameThrower*>(mgr.ObjectById(uid.first));
|
||||
if (act && act->GetX400_25())
|
||||
act->Reset(mgr, false);
|
||||
}
|
||||
ResetFlameThrowers(mgr);
|
||||
}
|
||||
else if (evType == EUserEventType::DamageOn)
|
||||
{
|
||||
|
@ -61,8 +79,24 @@ void MP1::CActorContraption::DoUserAnimEvent(CStateManager& mgr, CInt32POINode&
|
|||
CActor::DoUserAnimEvent(mgr, node, evType);
|
||||
}
|
||||
|
||||
CFlameThrower* MP1::CActorContraption::CreateFlameThrower(const std::string&, CStateManager&)
|
||||
CFlameThrower* MP1::CActorContraption::CreateFlameThrower(const std::string& name, CStateManager& mgr)
|
||||
{
|
||||
return nullptr;
|
||||
const auto& it = std::find_if(x2e8_children.begin(), x2e8_children.end(),
|
||||
[&name](const std::pair<TUniqueId, std::string>& p) { return p.second == name; });
|
||||
|
||||
if (it == x2e8_children.end())
|
||||
{
|
||||
TUniqueId id = mgr.AllocateUniqueId();
|
||||
CFlameInfo flameInfo(6, 6, x308_flameFxId, 20, 0.5f, 1.f, 1.f);
|
||||
CFlameThrower* ret = new CFlameThrower(x300_flameThrowerGen, name, EWeaponType::Missile, flameInfo,
|
||||
zeus::CTransform::Identity(), EMaterialTypes::CollisionActor, x30c_dInfo,
|
||||
id, GetAreaId(), GetUniqueId(), 0, -1, -1, -1);
|
||||
|
||||
x2e8_children.emplace_back(id, name);
|
||||
|
||||
mgr.AddObject(ret);
|
||||
return ret;
|
||||
}
|
||||
return static_cast<CFlameThrower*>(mgr.ObjectById(it->first));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace MP1
|
|||
class CActorContraption : public CScriptActor
|
||||
{
|
||||
/* AKA Why Zoid?!?!?!? */
|
||||
std::vector<std::pair<TUniqueId, std::string>> x2e4_children;
|
||||
std::vector<std::pair<TUniqueId, std::string>> x2e8_children;
|
||||
TToken<CGenDescription> x300_flameThrowerGen;
|
||||
ResId x308_partId;
|
||||
ResId x308_flameFxId;
|
||||
CDamageInfo x30c_dInfo;
|
||||
public:
|
||||
CActorContraption(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||
|
@ -22,10 +22,11 @@ public:
|
|||
const CDamageVulnerability&, const CActorParameters&, ResId, const CDamageInfo&, bool);
|
||||
|
||||
void Accept(IVisitor &visitor);
|
||||
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
|
||||
void Think(float, CStateManager &);
|
||||
void DoUserAnimEvent(CStateManager &, CInt32POINode &, EUserEventType);
|
||||
CFlameThrower* CreateFlameThrower(const std::string&, CStateManager&);
|
||||
void ResetFlameThrowers(CStateManager& mgr);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#include "Weapon/CFlameInfo.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CFlameInfo::CFlameInfo(s32 w1, s32 w2, ResId flameFxId, s32 w3, float f1, float f2, float f3)
|
||||
: x0_(w1)
|
||||
, x4_(w2)
|
||||
, x8_flameFxId(flameFxId)
|
||||
, xc_(w3)
|
||||
, x10_(f1)
|
||||
, x18_(f2)
|
||||
, x1c_(f3)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -7,12 +7,18 @@ namespace urde
|
|||
{
|
||||
class CFlameInfo
|
||||
{
|
||||
s32 x0_;
|
||||
s32 x4_;
|
||||
ResId x8_flameFxId;
|
||||
s32 xc_;
|
||||
float x10_;
|
||||
float x18_;
|
||||
float x1c_;
|
||||
public:
|
||||
CFlameInfo(s32, u32, s32, s32, float, float, float);
|
||||
CFlameInfo(s32, s32, ResId, s32, float, float, float);
|
||||
|
||||
void GetAttributes() const;
|
||||
void GetLength() const;
|
||||
float GetLength() const;
|
||||
ResId GetFlameFxId() const { return x8_flameFxId; }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ const zeus::CVector3f CFlameThrower::kLightOffset(0, 3.f, 2.f);
|
|||
|
||||
CFlameThrower::CFlameThrower(const TToken<CWeaponDescription>& wDesc, const std::string& name, EWeaponType wType,
|
||||
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
|
||||
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1)
|
||||
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1, u32 w2,
|
||||
s16 sId, u32 w3)
|
||||
: CGameProjectile(false, wDesc, name, wType, xf, matType, dInfo, owner, aId, uid, kInvalidUniqueId, w1, false,
|
||||
zeus::CVector3f(1.f), {}, -1, false)
|
||||
, x2e8_(xf)
|
||||
|
@ -24,12 +25,7 @@ void CFlameThrower::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
|||
|
||||
void CFlameThrower::SetTransform(const zeus::CTransform& xf) { x2e8_ = xf; }
|
||||
|
||||
void CFlameThrower::Reset(CStateManager&, bool)
|
||||
{
|
||||
}
|
||||
|
||||
void CFlameThrower::Fire(const zeus::CTransform&, CStateManager&, bool)
|
||||
{
|
||||
void CFlameThrower::Reset(CStateManager&, bool) {}
|
||||
|
||||
}
|
||||
void CFlameThrower::Fire(const zeus::CTransform&, CStateManager&, bool) {}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,12 @@ class CFlameThrower : public CGameProjectile
|
|||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
|
||||
public:
|
||||
CFlameThrower(const TToken<CWeaponDescription>& wDesc, const std::string& name, EWeaponType wType,
|
||||
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
|
||||
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1);
|
||||
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1, u32 w2, s16 sId,
|
||||
u32 w3);
|
||||
|
||||
void Accept(IVisitor& visitor);
|
||||
void SetTransform(const zeus::CTransform& xf);
|
||||
|
|
|
@ -10,20 +10,20 @@ enum class EWeaponType
|
|||
{
|
||||
None = -1,
|
||||
Power = 0,
|
||||
Ice,
|
||||
Wave,
|
||||
Plasma,
|
||||
Bomb,
|
||||
PowerBomb,
|
||||
Missile,
|
||||
BoostBall,
|
||||
Phazon,
|
||||
AI,
|
||||
PoisonWater,
|
||||
Lava,
|
||||
Hot,
|
||||
Unused1,
|
||||
Unused2
|
||||
Ice = 1,
|
||||
Wave = 2,
|
||||
Plasma = 3,
|
||||
Bomb = 4,
|
||||
PowerBomb = 5,
|
||||
Missile = 6,
|
||||
BoostBall = 7,
|
||||
Phazon = 8,
|
||||
AI = 9,
|
||||
PoisonWater = 10,
|
||||
Lava = 11,
|
||||
Hot = 12,
|
||||
Unused1 = 13,
|
||||
Unused2 = 14
|
||||
};
|
||||
}
|
||||
#endif // __URDE_WEAPONCOMMON_HPP__
|
||||
|
|
|
@ -308,8 +308,8 @@ CLightParameters ScriptLoader::LoadLightParameters(CInputStream& in)
|
|||
if (propCount >= 14)
|
||||
layerIdx = in.readUint32Big();
|
||||
|
||||
return CLightParameters(a, b, shadowTess, d, e, noLightsAmbient, makeLights, lightOpts, recalcOpts, actorPosBias,
|
||||
maxDynamicLights, maxAreaLights, ambientChannelOverflow, layerIdx);
|
||||
return CLightParameters(a, b, shadowTess, d, e, noLightsAmbient, makeLights, lightOpts, recalcOpts,
|
||||
actorPosBias, maxDynamicLights, maxAreaLights, ambientChannelOverflow, layerIdx);
|
||||
}
|
||||
return CLightParameters::None();
|
||||
}
|
||||
|
@ -1677,12 +1677,11 @@ CEntity* ScriptLoader::LoadDebrisExtended(CStateManager& mgr, CInputStream& in,
|
|||
if (g_ResFactory->GetResourceTypeById(model))
|
||||
modelData = CModelData(CStaticRes(model, aHead.x40_scale));
|
||||
|
||||
return new CScriptDebris(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform,
|
||||
std::move(modelData), aParam, f1, f2, f3, f4, f5, f6, f7, f8, f9,
|
||||
c1, c2, f10, aHead.x40_scale, v1, f11, f12, v2,
|
||||
particle1, particle1Scale, particle1B1, particle1B2, particle1W,
|
||||
particle2, particle2Scale, particle2B1, particle2B2, particle2W,
|
||||
particle3, particle3Scale, particle3W, b1, b2, b3, b4);
|
||||
return new CScriptDebris(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, std::move(modelData),
|
||||
aParam, f1, f2, f3, f4, f5, f6, f7, f8, f9, c1, c2, f10, aHead.x40_scale, v1, f11, f12, v2,
|
||||
particle1, particle1Scale, particle1B1, particle1B2, particle1W, particle2, particle2Scale,
|
||||
particle2B1, particle2B2, particle2W, particle3, particle3Scale, particle3W, b1, b2, b3,
|
||||
b4);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadSteam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
@ -1710,8 +1709,7 @@ CEntity* ScriptLoader::LoadSteam(CStateManager& mgr, CInputStream& in, int propC
|
|||
|
||||
zeus::CAABox aabb(-v2 * 0.5f, v2 * 0.5f);
|
||||
|
||||
return new CScriptSteam(mgr.AllocateUniqueId(), name, info, v1, aabb, dInfo,
|
||||
v3, w1, b1, w2, f1, f2, f3, f4, b2);
|
||||
return new CScriptSteam(mgr.AllocateUniqueId(), name, info, v1, aabb, dInfo, v3, w1, b1, w2, f1, f2, f3, f4, b2);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadRipple(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
@ -1778,8 +1776,9 @@ CEntity* ScriptLoader::LoadPlayerActor(CStateManager& mgr, CInputStream& in, int
|
|||
|
||||
return new CScriptPlayerActor(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform,
|
||||
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), aHead.x40_scale,
|
||||
animParms.GetInitialAnimation(), loop), CModelData::CModelDataNull(),
|
||||
aabox, true, list, mass, zMomentum, hInfo, dVuln, actParms, loop, active, flags, w1);
|
||||
animParms.GetInitialAnimation(), loop),
|
||||
CModelData::CModelDataNull(), aabox, true, list, mass, zMomentum, hInfo, dVuln,
|
||||
actParms, loop, active, flags, w1);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadFlaahgra(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
@ -2170,8 +2169,38 @@ CEntity* ScriptLoader::Load(CStateManager& mgr, CInputStream& in, int propCount,
|
|||
CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in, int propCount,
|
||||
const CEntityInfo& info)
|
||||
{
|
||||
|
||||
if (!EnsurePropertyCount(propCount, 15, "ActorContraption"))
|
||||
return nullptr;
|
||||
|
||||
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
||||
zeus::CVector3f collisionExtent = zeus::CVector3f::ReadBig(in);
|
||||
zeus::CVector3f collisionOrigin = zeus::CVector3f::ReadBig(in);
|
||||
float mass = in.readFloatBig();
|
||||
float zMomentum = in.readFloatBig();
|
||||
CHealthInfo hInfo(in);
|
||||
CDamageVulnerability dVuln(in);
|
||||
CAnimationParameters animParams(in);
|
||||
CActorParameters actParams = LoadActorParameters(in);
|
||||
ResId flameFxId = in.readUint32Big();
|
||||
CDamageInfo dInfo(in);
|
||||
bool active = in.readBool();
|
||||
|
||||
if (!g_ResFactory->GetResourceTypeById(animParams.GetACSFile()))
|
||||
return nullptr;
|
||||
|
||||
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), collisionExtent, collisionOrigin);
|
||||
CMaterialList list;
|
||||
list.Add(EMaterialTypes::Immovable);
|
||||
list.Add(EMaterialTypes::Solid);
|
||||
|
||||
CModelData data(CAnimRes(animParams.GetACSFile(), animParams.GetCharacter(), head.x40_scale,
|
||||
animParams.GetInitialAnimation(), true));
|
||||
|
||||
if ((collisionExtent.x < 0.f || collisionExtent.y < 0.f || collisionExtent.z < 0.f) || collisionExtent.isZero())
|
||||
aabb = data.GetBounds(head.x10_transform.getRotation());
|
||||
|
||||
return new MP1::CActorContraption(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(data),
|
||||
aabb, list, mass, zMomentum, hInfo, dVuln, actParams, flameFxId, dInfo, active);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadOculus(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
|
2
nod
2
nod
|
@ -1 +1 @@
|
|||
Subproject commit e86971c9e082b58bb04ee794a106874b3ceae1c7
|
||||
Subproject commit e494dbba9f29634ccbd2b9af203b86d11d5466d5
|
Loading…
Reference in New Issue