mirror of https://github.com/AxioDL/metaforce.git
Various imps
This commit is contained in:
parent
7085549a42
commit
4101ea78a2
|
@ -135,9 +135,9 @@ struct ANCS : BigYAML
|
|||
DNAFourCC type;
|
||||
UniqueID32 id;
|
||||
String<-1> locator;
|
||||
Value<float> unk1;
|
||||
Value<atUint32> unk2;
|
||||
Value<atUint32> unk3;
|
||||
Value<float> scale;
|
||||
Value<atUint32> parentMode;
|
||||
Value<atUint32> flags;
|
||||
};
|
||||
Vector<EffectComponent, DNA_COUNT(compCount)> comps;
|
||||
};
|
||||
|
|
|
@ -56,7 +56,7 @@ struct EVNT : BigYAML
|
|||
{
|
||||
DECL_YAML
|
||||
Value<atUint32> value;
|
||||
String<-1> locatorName;
|
||||
String<-1> locator;
|
||||
};
|
||||
std::vector<Int32POINode> int32POINodes;
|
||||
|
||||
|
@ -64,9 +64,9 @@ struct EVNT : BigYAML
|
|||
{
|
||||
DECL_YAML
|
||||
Value<atUint32> duration;
|
||||
DNAFourCC effectType;
|
||||
UniqueID32 effectId;
|
||||
String<-1> locatorName;
|
||||
DNAFourCC type;
|
||||
UniqueID32 id;
|
||||
String<-1> locator;
|
||||
Value<float> scale;
|
||||
Value<atUint32> parentMode;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#include "CSfxHandle.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
u32 CSfxHandle::mRefCount = 0;
|
||||
|
||||
CSfxHandle::CSfxHandle(u32 idx)
|
||||
{
|
||||
x0_index = (idx & 0xFFF) | ((++mRefCount) << 14);
|
||||
}
|
||||
|
||||
void CSfxHandle::operator =(const CSfxHandle& other)
|
||||
{
|
||||
if (x0_index == other.x0_index)
|
||||
return;
|
||||
x0_index = other.x0_index;
|
||||
}
|
||||
|
||||
bool CSfxHandle::operator !=(const CSfxHandle& other) const
|
||||
{
|
||||
return x0_index != other.x0_index;
|
||||
}
|
||||
|
||||
bool CSfxHandle::operator ==(const CSfxHandle& other) const
|
||||
{
|
||||
return x0_index == other.x0_index;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +1,25 @@
|
|||
#ifndef __URDE_CSFXHANDLE_HPP__
|
||||
#define __URDE_CSFXHANDLE_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CSfxHandle
|
||||
{
|
||||
static u32 mRefCount;
|
||||
u32 x0_index = 0;
|
||||
public:
|
||||
CSfxHandle() = default;
|
||||
CSfxHandle(const CSfxHandle&) = default;
|
||||
CSfxHandle(u32 idx);
|
||||
|
||||
void operator =(const CSfxHandle& other);
|
||||
bool operator !=(const CSfxHandle& other) const;
|
||||
bool operator ==(const CSfxHandle& other) const;
|
||||
u32 GetIndex() const { return x0_index; }
|
||||
static CSfxHandle NullHandle() { return {}; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ public:
|
|||
u8 vol);
|
||||
|
||||
static void RemoveEmitter(const CSfxHandle&) {}
|
||||
static void PitchBend(const CSfxHandle&, s32) {}
|
||||
static u16 TranslateSFXID(u16);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ class CAnimation
|
|||
public:
|
||||
CAnimation(CInputStream& in);
|
||||
const std::shared_ptr<IMetaAnim>& GetMetaAnim() const {return x10_anim;}
|
||||
const std::string& GetMetaAnimName() const { return x0_name; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -13,9 +13,19 @@ CEffectComponent::CEffectComponent(CInputStream& in)
|
|||
x0_name = in.readString();
|
||||
x10_tag = GetSObjectTagFromStream(in);
|
||||
x18_boneName = in.readString();
|
||||
x28_ = in.readFloatBig();
|
||||
x28_scale = in.readFloatBig();
|
||||
x2c_ = in.readUint32Big();
|
||||
x30_ = in.readUint32Big();
|
||||
}
|
||||
|
||||
const std::string& CEffectComponent::GetComponentName() const
|
||||
{
|
||||
return x0_name;
|
||||
}
|
||||
|
||||
const SObjectTag& CEffectComponent::GetParticleTag() const
|
||||
{
|
||||
return x10_tag;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,12 +12,15 @@ class CEffectComponent
|
|||
std::string x0_name;
|
||||
SObjectTag x10_tag;
|
||||
std::string x18_boneName;
|
||||
float x28_;
|
||||
float x28_scale;
|
||||
u32 x2c_;
|
||||
u32 x30_;
|
||||
static SObjectTag GetSObjectTagFromStream(CInputStream& in);
|
||||
public:
|
||||
CEffectComponent(CInputStream& in);
|
||||
|
||||
const std::string& GetComponentName() const;
|
||||
const SObjectTag& GetParticleTag() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@ public:
|
|||
const CActorLights* lights, const CModelFlags& drawFlags) const;
|
||||
|
||||
CAnimData* AnimationData() { return x10_animData.get(); }
|
||||
bool IsNull() { return !x10_animData && !x1c_normalModel; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ enum class EMaterialTypes
|
|||
FourtyThree = 43,
|
||||
FourtyEight = 48,
|
||||
FourtyNine = 49,
|
||||
Fifty = 50,
|
||||
FiftySix = 56,
|
||||
SixtyThree = 63
|
||||
};
|
||||
|
||||
|
|
|
@ -20,12 +20,13 @@ static CMaterialList MakeActorMaterialList(const CMaterialList& materialList, co
|
|||
|
||||
CActor::CActor(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform&, CModelData&& mData, const CMaterialList& list,
|
||||
const CActorParameters& params, TUniqueId)
|
||||
const CActorParameters& params, TUniqueId otherUid)
|
||||
: CEntity(uid, info, active, name),
|
||||
x68_material(MakeActorMaterialList(list, params)),
|
||||
x70_(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Nineteen}, {EMaterialTypes::Zero}))
|
||||
x70_(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Nineteen}, {EMaterialTypes::Zero})),
|
||||
xc6_(otherUid)
|
||||
{
|
||||
if (mData.x1c_normalModel)
|
||||
if (mData.x10_animData || mData.x1c_normalModel)
|
||||
x64_modelData = std::make_unique<CModelData>(std::move(mData));
|
||||
}
|
||||
|
||||
|
@ -82,16 +83,21 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
|
|||
}
|
||||
break;
|
||||
case EScriptObjectMessage::UNKM17: // 37
|
||||
//SetInFluid(true, uid);
|
||||
SetInFluid(true, uid);
|
||||
break;
|
||||
case EScriptObjectMessage::UNKM19: // 39
|
||||
//SetInFluid(false, kInvalidUniqueId);
|
||||
SetInFluid(false, kInvalidUniqueId);
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
CEntity::AcceptScriptMsg(msg, uid, mgr);
|
||||
}
|
||||
|
||||
zeus::CVector3f CActor::GetOrbitPosition(const CStateManager&)
|
||||
{
|
||||
return x34_transform.origin;
|
||||
}
|
||||
|
||||
void CActor::RemoveEmitter()
|
||||
{
|
||||
if (x8c_sfxHandle)
|
||||
|
@ -102,6 +108,12 @@ void CActor::RemoveEmitter()
|
|||
}
|
||||
}
|
||||
|
||||
EWeaponCollisionResponseTypes CActor::GetCollisionResponseType(const zeus::CVector3f&,
|
||||
const zeus::CVector3f&, CWeaponMode&, int)
|
||||
{
|
||||
return EWeaponCollisionResponseTypes::Unknown13;
|
||||
}
|
||||
|
||||
void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, CStateManager& mgr)
|
||||
{
|
||||
x68_material.Remove(t1);
|
||||
|
@ -155,9 +167,62 @@ void CActor::AddMaterial(EMaterialTypes type, CStateManager& mgr)
|
|||
mgr.UpdateObjectInLists(*this);
|
||||
}
|
||||
|
||||
void CActor::SetCallTouch(bool callTouch)
|
||||
{
|
||||
xe5_28_callTouch = callTouch;
|
||||
}
|
||||
|
||||
bool CActor::GetCallTouch() const
|
||||
{
|
||||
return xe5_28_callTouch;
|
||||
}
|
||||
|
||||
void CActor::SetUseInSortedList(bool use)
|
||||
{
|
||||
xe5_27_useInSortedLists = use;
|
||||
}
|
||||
|
||||
bool CActor::GetUseInSortedLists() const
|
||||
{
|
||||
return xe5_27_useInSortedLists;
|
||||
}
|
||||
|
||||
void CActor::SetInFluid(bool in, TUniqueId uid)
|
||||
{
|
||||
if (in)
|
||||
{
|
||||
xe6_26_inFluid = false;
|
||||
xc4_fluidId = uid;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!xe6_26_inFluid)
|
||||
return;
|
||||
|
||||
xe6_26_inFluid = true;
|
||||
if (xe6_26_inFluid == 0)
|
||||
xc4_fluidId = kInvalidUniqueId;
|
||||
}
|
||||
}
|
||||
|
||||
bool CActor::HasModelData() const
|
||||
{
|
||||
return x64_modelData.operator bool();
|
||||
return bool(x64_modelData);
|
||||
}
|
||||
|
||||
const CSfxHandle* CActor::GetSfxHandle() const
|
||||
{
|
||||
return x8c_sfxHandle.get();
|
||||
}
|
||||
|
||||
void CActor::SetSfxPitchBend(s32 val)
|
||||
{
|
||||
xe6_30_enablePitchBend = true;
|
||||
xc0_ = val;
|
||||
if (x8c_sfxHandle == 0)
|
||||
return;
|
||||
|
||||
CSfxManager::PitchBend(*x8c_sfxHandle.get(), val);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ class CHealthInfo;
|
|||
class CDamageVulnerability;
|
||||
class CLightParameters;
|
||||
class CSfxHandle;
|
||||
class CSimpleShadow;
|
||||
|
||||
class CActor : public CEntity
|
||||
{
|
||||
protected:
|
||||
|
@ -31,10 +33,16 @@ protected:
|
|||
std::unique_ptr<CModelData> x64_modelData;
|
||||
CMaterialList x68_material;
|
||||
CMaterialFilter x70_;
|
||||
s16 x88_sfxId;
|
||||
s16 x88_sfxId = -1;
|
||||
std::unique_ptr<CSfxHandle> x8c_sfxHandle;
|
||||
//std::unique_ptr<CSimpleShadow> x94_simpleShadow;
|
||||
zeus::CAABox x9c_aabox;
|
||||
u32 xb8_ = 0;
|
||||
float xbc_time = 0.f;
|
||||
s32 xc0_ = 0;
|
||||
TUniqueId xc4_fluidId = kInvalidUniqueId;
|
||||
TUniqueId xc6_ = kInvalidUniqueId;
|
||||
float xbc_time;
|
||||
u8 xd4_ = 0x7F;
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
@ -43,21 +51,37 @@ protected:
|
|||
bool xe4_28_ : 1;
|
||||
bool xe4_29_ : 1;
|
||||
bool xe4_30_ : 1;
|
||||
bool xe5_0_opaque : 1;
|
||||
bool xe5_26_muted : 1;
|
||||
bool xe5_27_useInSortedLists : 1;
|
||||
bool xe5_28_callTouch : 1;
|
||||
};
|
||||
u32 dummy1 = 0;
|
||||
u8 dummy1 = 0;
|
||||
};
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool xe5_0_opaque : 1;
|
||||
bool xe5_26_muted : 1;
|
||||
bool xe5_27_useInSortedLists : 1;
|
||||
bool xe5_28_callTouch : 1;
|
||||
};
|
||||
u8 dummy2 = 0;
|
||||
};
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool xe6_26_inFluid : 1;
|
||||
bool xe6_30_enablePitchBend : 1;
|
||||
};
|
||||
u8 dummy3 = 0;
|
||||
};
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool xe7_29_ : 1;
|
||||
};
|
||||
u32 dummy2 = 0;
|
||||
u8 dummy4 = 0;
|
||||
};
|
||||
public:
|
||||
CActor(TUniqueId, bool, const std::string&, const CEntityInfo&,
|
||||
|
@ -82,14 +106,13 @@ public:
|
|||
virtual bool ValidAimTarget() { return true; }
|
||||
virtual bool ValidOrbitTarget() { return true; }
|
||||
virtual bool GetOrbitDistanceCheck() { return true; }
|
||||
virtual zeus::CVector3f GetOrbitPosition(const CStateManager&)
|
||||
{ return x34_transform.origin; }
|
||||
virtual zeus::CVector3f GetOrbitPosition(const CStateManager&);
|
||||
|
||||
void RemoveEmitter();
|
||||
|
||||
virtual std::experimental::optional<zeus::CAABox> GetTouchBounds() const { return {} ; }
|
||||
virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&, int);
|
||||
|
||||
virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&, int) { return EWeaponCollisionResponseTypes::Unknown13; }
|
||||
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||
void RemoveMaterial(EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||
|
@ -100,29 +123,21 @@ public:
|
|||
void AddMaterial(EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||
void AddMaterial(EMaterialTypes, CStateManager&);
|
||||
|
||||
void SetCallTouch(bool callTouch)
|
||||
{
|
||||
xe5_28_callTouch = callTouch;
|
||||
}
|
||||
void SetCallTouch(bool callTouch);
|
||||
|
||||
bool GetCallTouch() const
|
||||
{
|
||||
return xe5_28_callTouch;
|
||||
}
|
||||
bool GetCallTouch() const;
|
||||
|
||||
void SetUseInSortedList(bool use)
|
||||
{
|
||||
xe5_27_useInSortedLists = use;
|
||||
}
|
||||
void SetUseInSortedList(bool use);
|
||||
|
||||
bool GetUseInSortedLists() const
|
||||
{
|
||||
return xe5_27_useInSortedLists;
|
||||
}
|
||||
bool GetUseInSortedLists() const;
|
||||
|
||||
const CMaterialFilter& GetMaterialFilter() const { return x70_; }
|
||||
|
||||
void SetInFluid(bool in, TUniqueId uid);
|
||||
|
||||
bool HasModelData() const;
|
||||
const CSfxHandle* GetSfxHandle() const;
|
||||
void SetSfxPitchBend(s32);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
x54_visorParms(visorParms), b1(a), b2(b), b3(c), b4(d) {}
|
||||
static CActorParameters None() {return CActorParameters();}
|
||||
|
||||
void SetVisorParameters(const CVisorParameters& vParams) { x54_visorParms = vParams; }
|
||||
CVisorParameters GetVisorParameters() const { return x54_visorParms; }
|
||||
};
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ set(WORLD_SOURCES
|
|||
CScriptCoverPoint.hpp CScriptCoverPoint.cpp
|
||||
CScriptSpawnPoint.hpp CScriptSpawnPoint.cpp
|
||||
CScriptCameraHint.hpp CScriptCameraHint.cpp
|
||||
CScriptDamageableTrigger.hpp CScriptDamageableTrigger.cpp
|
||||
CScriptActorRotate.hpp CScriptActorRotate.cpp
|
||||
CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp
|
||||
CGrappleParameters.hpp
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#include "CScriptDamageableTrigger.hpp"
|
||||
#include "CActorParameters.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CActorParameters MakeDamageableTriggerActorParms(const CActorParameters& aParams, const CVisorParameters& vParams)
|
||||
{
|
||||
CActorParameters ret = aParams;
|
||||
ret.SetVisorParameters(vParams);
|
||||
return ret;
|
||||
}
|
||||
|
||||
CMaterialList MakeDamageableTriggerMaterial(CScriptDamageableTrigger::ECanOrbit canOrbit)
|
||||
{
|
||||
if (canOrbit == CScriptDamageableTrigger::ECanOrbit::Orbit)
|
||||
return CMaterialList(EMaterialTypes::FourtyOne, EMaterialTypes::ThirtyFour, EMaterialTypes::FourtyThree,
|
||||
EMaterialTypes::Fifty, EMaterialTypes::FiftySix);
|
||||
return CMaterialList(EMaterialTypes::ThirtyFour, EMaterialTypes::FourtyThree,
|
||||
EMaterialTypes::Fifty, EMaterialTypes::FiftySix);
|
||||
}
|
||||
|
||||
|
||||
CScriptDamageableTrigger::CScriptDamageableTrigger(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CVector3f& position, const zeus::CVector3f& extent, const CHealthInfo&,
|
||||
const CDamageVulnerability&, u32, ResId, ResId, ResId,
|
||||
CScriptDamageableTrigger::ECanOrbit canOrbit, bool active, const CVisorParameters& vParams)
|
||||
: CActor(uid, active, name, info, zeus::CTransform::Translate(position), CModelData::CModelDataNull(),
|
||||
MakeDamageableTriggerMaterial(canOrbit), MakeDamageableTriggerActorParms(CActorParameters::None(), vParams),
|
||||
kInvalidUniqueId),
|
||||
x14c_bounds(-extent * 0.5f, extent * 0.5f)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef CSCRIPTDAMAGEABLETRIGGER_HPP
|
||||
#define CSCRIPTDAMAGEABLETRIGGER_HPP
|
||||
|
||||
#include "CActor.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CVisorParameters;
|
||||
class CScriptDamageableTrigger : public CActor
|
||||
{
|
||||
public:
|
||||
enum class ECanOrbit
|
||||
{
|
||||
NoOrbit,
|
||||
Orbit,
|
||||
};
|
||||
|
||||
zeus::CAABox x14c_bounds;
|
||||
public:
|
||||
CScriptDamageableTrigger(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CVector3f&, const zeus::CVector3f&,
|
||||
const CHealthInfo&, const CDamageVulnerability&, u32, ResId, ResId, ResId, ECanOrbit, bool,
|
||||
const CVisorParameters&);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CSCRIPTDAMAGEABLETRIGGER_HPP
|
|
@ -4,8 +4,24 @@ namespace urde
|
|||
{
|
||||
|
||||
CScriptGenerator::CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
u32, bool, const zeus::CVector3f&, bool, bool active, float, float)
|
||||
: CEntity(uid, info, active, name)
|
||||
u32 w1, bool b1, const zeus::CVector3f& vec1, bool b2, bool active, float minScale, float maxScale)
|
||||
: CEntity(uid, info, active, name),
|
||||
x34_(w1),
|
||||
x38_24_(b1),
|
||||
x38_25_(b2),
|
||||
x3c_(vec1),
|
||||
x48_minScale(minScale),
|
||||
x4c_maxScale(maxScale)
|
||||
{
|
||||
}
|
||||
|
||||
void CScriptGenerator::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
|
||||
{
|
||||
if (msg == EScriptObjectMessage::SetToZero)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,24 @@ namespace urde
|
|||
|
||||
class CScriptGenerator : public CEntity
|
||||
{
|
||||
u32 x34_;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x38_24_ : 1;
|
||||
bool x38_25_ : 1;
|
||||
};
|
||||
u8 dummy1 =0;
|
||||
};
|
||||
zeus::CVector3f x3c_;
|
||||
float x48_minScale;
|
||||
float x4c_maxScale;
|
||||
public:
|
||||
CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
u32, bool, const zeus::CVector3f&, bool, bool, float, float);
|
||||
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -12,29 +12,7 @@ class CResFactory;
|
|||
|
||||
class CWorld
|
||||
{
|
||||
ResId xc_worldId = -1;
|
||||
ResId x10_ = -1;
|
||||
ResId x24_ = -1;
|
||||
|
||||
std::vector<std::unique_ptr<CGameArea>> x18_areas;
|
||||
|
||||
std::unique_ptr<u8[]> x40_;
|
||||
std::unique_ptr<u8[]> x44_;
|
||||
|
||||
IObjectStore* x60_objectStore;
|
||||
CResFactory* x64_resFactory;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x70_24_ : 1;
|
||||
bool x70_25_ : 1;
|
||||
bool x70_26_ : 1;
|
||||
};
|
||||
};
|
||||
public:
|
||||
|
||||
class CRelay
|
||||
{
|
||||
TEditorId x0_relay = kInvalidEditorId;
|
||||
|
@ -50,6 +28,36 @@ public:
|
|||
s16 GetMessage() const { return x8_msg; }
|
||||
bool GetActive() const { return xa_active; }
|
||||
};
|
||||
private:
|
||||
|
||||
ResId xc_worldId = -1;
|
||||
ResId x10_ = -1;
|
||||
std::vector<std::unique_ptr<CGameArea>> x18_areas;
|
||||
ResId x24_ = -1;
|
||||
std::vector<CRelay> x2c_relays;
|
||||
|
||||
std::unique_ptr<u8[]> x40_;
|
||||
std::unique_ptr<u8[]> x44_;
|
||||
|
||||
IObjectStore* x60_objectStore;
|
||||
CResFactory* x64_resFactory;
|
||||
TAreaId x68_ = kInvalidAreaId;
|
||||
u32 x6c_ = 0;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x70_24_ : 1;
|
||||
bool x70_25_ : 1;
|
||||
bool x70_26_ : 1;
|
||||
bool x70_27_ : 1;
|
||||
};
|
||||
};
|
||||
u32 x78_;
|
||||
u32 x7c_;
|
||||
|
||||
public:
|
||||
|
||||
CWorld(IObjectStore& objStore, CResFactory& resFactory, ResId);
|
||||
bool DoesAreaExist(TAreaId area) const;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "CScriptCoverPoint.hpp"
|
||||
#include "CScriptSpawnPoint.hpp"
|
||||
#include "CScriptCameraHint.hpp"
|
||||
#include "CScriptDamageableTrigger.hpp"
|
||||
#include "CScriptActorRotate.hpp"
|
||||
#include "CScriptSpecialFunction.hpp"
|
||||
#include "Camera/CCinematicCamera.hpp"
|
||||
|
@ -909,9 +910,67 @@ CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream&
|
|||
{
|
||||
}
|
||||
|
||||
u32 ClassifyVector(const zeus::CVector3f& dir)
|
||||
{
|
||||
zeus::CVector3f absDir(std::fabs(dir.x), std::fabs(dir.y), std::fabs(dir.z));
|
||||
u32 max = (absDir.x > absDir.y ? 0 : 1);
|
||||
max = (absDir[max] > absDir.z ? max : 2);
|
||||
|
||||
|
||||
bool positive = (absDir[max] == dir[max]);
|
||||
if (max == 0)
|
||||
return (positive ? 0x08 : 0x04);
|
||||
else if (max == 1)
|
||||
return (positive ? 0x01 : 0x02);
|
||||
else if (max == 2)
|
||||
return (positive ? 0x10 : 0x20);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 TransformDamagableTriggerFlags(CStateManager& mgr, TAreaId aId, u32 flags)
|
||||
{
|
||||
CGameArea* area = mgr.GetWorld()->GetGameAreas().at(aId).get();
|
||||
zeus::CTransform rotation = area->GetTransform().getRotation();
|
||||
|
||||
u32 ret = 0;
|
||||
if (flags & 0x01)
|
||||
ret |= ClassifyVector(rotation * zeus::kForwardVec);
|
||||
if (flags & 0x02)
|
||||
ret |= ClassifyVector(rotation * zeus::kBackVec);
|
||||
if (flags & 0x04)
|
||||
ret |= ClassifyVector(rotation * zeus::kLeftVec);
|
||||
if (flags & 0x08)
|
||||
ret |= ClassifyVector(rotation * zeus::kRightVec);
|
||||
if (flags & 0x10)
|
||||
ret |= ClassifyVector(rotation * zeus::kUpVec);
|
||||
if (flags & 0x20)
|
||||
ret |= ClassifyVector(rotation * zeus::kDownVec);
|
||||
return ret;
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
if (!EnsurePropertyCount(propCount, 12, "DamageableTrigger"))
|
||||
return nullptr;
|
||||
|
||||
const std::string* name = mgr.HashInstanceName(in);
|
||||
zeus::CVector3f position(zeus::CVector3f::ReadBig(in));
|
||||
zeus::CVector3f volume(zeus::CVector3f::ReadBig(in));
|
||||
|
||||
CHealthInfo hInfo(in);
|
||||
CDamageVulnerability dVuln(in);
|
||||
u32 triggerFlags = in.readUint32Big();
|
||||
triggerFlags = TransformDamagableTriggerFlags(mgr, info.GetAreaId(), triggerFlags);
|
||||
ResId w1 = in.readUint32Big();
|
||||
ResId w2 = in.readUint32Big();
|
||||
ResId w3 = in.readUint32Big();
|
||||
CScriptDamageableTrigger::ECanOrbit canOrbit = CScriptDamageableTrigger::ECanOrbit(in.readBool());
|
||||
bool active = in.readBool();
|
||||
CVisorParameters vParms = LoadVisorParameters(in);
|
||||
return new CScriptDamageableTrigger(mgr.AllocateUniqueId(), *name, info, position, volume, hInfo, dVuln, triggerFlags, w1,
|
||||
w2, w3, canOrbit, active, vParms);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadDebris(CStateManager& mgr, CInputStream& in,
|
||||
|
@ -1229,12 +1288,12 @@ CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in,
|
|||
s16 w6 = in.readUint32Big() & 0xFFFF;
|
||||
s16 w7 = in.readUint32Big() & 0xFFFF;
|
||||
if (specialFunction == CScriptSpecialFunction::ESpecialFunction::FourtySeven ||
|
||||
specialFunction == CScriptSpecialFunction::ESpecialFunction::FourtySeven)
|
||||
specialFunction == CScriptSpecialFunction::ESpecialFunction::FourtySeven)
|
||||
return nullptr;
|
||||
|
||||
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, specialFunction, str, f1, f2,
|
||||
f3, f4, zeus::CVector3f::skZero, zeus::CColor::skBlack, active1, CDamageInfo(), w2, w3, w4,
|
||||
w5, w6, w7);
|
||||
f3, f4, zeus::CVector3f::skZero, zeus::CColor::skBlack, active1, CDamageInfo(), w2, w3, w4,
|
||||
w5, w6, w7);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in,
|
||||
|
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit 90daa39c473e5821bf3a54c6c8f0a4a6cd011499
|
||||
Subproject commit a48e2b4ec5087bcb167f15763c84fbac2ca4c272
|
Loading…
Reference in New Issue