This commit is contained in:
Jack Andersen 2016-05-06 18:30:05 -10:00
commit 8847d9a429
21 changed files with 371 additions and 70 deletions

View File

@ -135,9 +135,9 @@ struct ANCS : BigYAML
DNAFourCC type; DNAFourCC type;
UniqueID32 id; UniqueID32 id;
String<-1> locator; String<-1> locator;
Value<float> unk1; Value<float> scale;
Value<atUint32> unk2; Value<atUint32> parentMode;
Value<atUint32> unk3; Value<atUint32> flags;
}; };
Vector<EffectComponent, DNA_COUNT(compCount)> comps; Vector<EffectComponent, DNA_COUNT(compCount)> comps;
}; };

View File

@ -56,7 +56,7 @@ struct EVNT : BigYAML
{ {
DECL_YAML DECL_YAML
Value<atUint32> value; Value<atUint32> value;
String<-1> locatorName; String<-1> locator;
}; };
std::vector<Int32POINode> int32POINodes; std::vector<Int32POINode> int32POINodes;
@ -64,9 +64,9 @@ struct EVNT : BigYAML
{ {
DECL_YAML DECL_YAML
Value<atUint32> duration; Value<atUint32> duration;
DNAFourCC effectType; DNAFourCC type;
UniqueID32 effectId; UniqueID32 id;
String<-1> locatorName; String<-1> locator;
Value<float> scale; Value<float> scale;
Value<atUint32> parentMode; Value<atUint32> parentMode;
}; };

View File

@ -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;
}
}

View File

@ -1,11 +1,25 @@
#ifndef __URDE_CSFXHANDLE_HPP__ #ifndef __URDE_CSFXHANDLE_HPP__
#define __URDE_CSFXHANDLE_HPP__ #define __URDE_CSFXHANDLE_HPP__
#include "RetroTypes.hpp"
namespace urde namespace urde
{ {
class CSfxHandle 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 {}; }
}; };
} }

View File

@ -139,6 +139,7 @@ public:
u8 vol); u8 vol);
static void RemoveEmitter(const CSfxHandle&) {} static void RemoveEmitter(const CSfxHandle&) {}
static void PitchBend(const CSfxHandle&, s32) {}
static u16 TranslateSFXID(u16); static u16 TranslateSFXID(u16);
}; };

View File

@ -15,6 +15,7 @@ class CAnimation
public: public:
CAnimation(CInputStream& in); CAnimation(CInputStream& in);
const std::shared_ptr<IMetaAnim>& GetMetaAnim() const {return x10_anim;} const std::shared_ptr<IMetaAnim>& GetMetaAnim() const {return x10_anim;}
const std::string& GetMetaAnimName() const { return x0_name; }
}; };
} }

View File

@ -13,9 +13,19 @@ CEffectComponent::CEffectComponent(CInputStream& in)
x0_name = in.readString(); x0_name = in.readString();
x10_tag = GetSObjectTagFromStream(in); x10_tag = GetSObjectTagFromStream(in);
x18_boneName = in.readString(); x18_boneName = in.readString();
x28_ = in.readFloatBig(); x28_scale = in.readFloatBig();
x2c_ = in.readUint32Big(); x2c_ = in.readUint32Big();
x30_ = in.readUint32Big(); x30_ = in.readUint32Big();
} }
const std::string& CEffectComponent::GetComponentName() const
{
return x0_name;
}
const SObjectTag& CEffectComponent::GetParticleTag() const
{
return x10_tag;
}
} }

View File

@ -12,12 +12,15 @@ class CEffectComponent
std::string x0_name; std::string x0_name;
SObjectTag x10_tag; SObjectTag x10_tag;
std::string x18_boneName; std::string x18_boneName;
float x28_; float x28_scale;
u32 x2c_; u32 x2c_;
u32 x30_; u32 x30_;
static SObjectTag GetSObjectTagFromStream(CInputStream& in); static SObjectTag GetSObjectTagFromStream(CInputStream& in);
public: public:
CEffectComponent(CInputStream& in); CEffectComponent(CInputStream& in);
const std::string& GetComponentName() const;
const SObjectTag& GetParticleTag() const;
}; };
} }

View File

@ -130,6 +130,7 @@ public:
const CActorLights* lights, const CModelFlags& drawFlags) const; const CActorLights* lights, const CModelFlags& drawFlags) const;
CAnimData* AnimationData() { return x10_animData.get(); } CAnimData* AnimationData() { return x10_animData.get(); }
bool IsNull() { return !x10_animData && !x1c_normalModel; }
}; };
} }

View File

@ -29,6 +29,8 @@ enum class EMaterialTypes
FourtyThree = 43, FourtyThree = 43,
FourtyEight = 48, FourtyEight = 48,
FourtyNine = 49, FourtyNine = 49,
Fifty = 50,
FiftySix = 56,
SixtyThree = 63 SixtyThree = 63
}; };

View File

@ -20,12 +20,13 @@ static CMaterialList MakeActorMaterialList(const CMaterialList& materialList, co
CActor::CActor(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, CActor::CActor(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info,
const zeus::CTransform&, CModelData&& mData, const CMaterialList& list, const zeus::CTransform&, CModelData&& mData, const CMaterialList& list,
const CActorParameters& params, TUniqueId) const CActorParameters& params, TUniqueId otherUid)
: CEntity(uid, info, active, name), : CEntity(uid, info, active, name),
x68_material(MakeActorMaterialList(list, params)), 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)); x64_modelData = std::make_unique<CModelData>(std::move(mData));
} }
@ -82,16 +83,21 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
} }
break; break;
case EScriptObjectMessage::UNKM17: // 37 case EScriptObjectMessage::UNKM17: // 37
//SetInFluid(true, uid); SetInFluid(true, uid);
break; break;
case EScriptObjectMessage::UNKM19: // 39 case EScriptObjectMessage::UNKM19: // 39
//SetInFluid(false, kInvalidUniqueId); SetInFluid(false, kInvalidUniqueId);
break; break;
default:break; default:break;
} }
CEntity::AcceptScriptMsg(msg, uid, mgr); CEntity::AcceptScriptMsg(msg, uid, mgr);
} }
zeus::CVector3f CActor::GetOrbitPosition(const CStateManager&)
{
return x34_transform.origin;
}
void CActor::RemoveEmitter() void CActor::RemoveEmitter()
{ {
if (x8c_sfxHandle) 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) void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, CStateManager& mgr)
{ {
x68_material.Remove(t1); x68_material.Remove(t1);
@ -155,9 +167,62 @@ void CActor::AddMaterial(EMaterialTypes type, CStateManager& mgr)
mgr.UpdateObjectInLists(*this); 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 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);
} }
} }

View File

@ -17,6 +17,8 @@ class CHealthInfo;
class CDamageVulnerability; class CDamageVulnerability;
class CLightParameters; class CLightParameters;
class CSfxHandle; class CSfxHandle;
class CSimpleShadow;
class CActor : public CEntity class CActor : public CEntity
{ {
protected: protected:
@ -31,10 +33,16 @@ protected:
std::unique_ptr<CModelData> x64_modelData; std::unique_ptr<CModelData> x64_modelData;
CMaterialList x68_material; CMaterialList x68_material;
CMaterialFilter x70_; CMaterialFilter x70_;
s16 x88_sfxId; s16 x88_sfxId = -1;
std::unique_ptr<CSfxHandle> x8c_sfxHandle; 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; TUniqueId xc6_ = kInvalidUniqueId;
float xbc_time; u8 xd4_ = 0x7F;
union union
{ {
struct struct
@ -43,21 +51,37 @@ protected:
bool xe4_28_ : 1; bool xe4_28_ : 1;
bool xe4_29_ : 1; bool xe4_29_ : 1;
bool xe4_30_ : 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 union
{ {
struct struct
{ {
bool xe7_29_ : 1; bool xe7_29_ : 1;
}; };
u32 dummy2 = 0; u8 dummy4 = 0;
}; };
public: public:
CActor(TUniqueId, bool, const std::string&, const CEntityInfo&, CActor(TUniqueId, bool, const std::string&, const CEntityInfo&,
@ -82,14 +106,13 @@ public:
virtual bool ValidAimTarget() { return true; } virtual bool ValidAimTarget() { return true; }
virtual bool ValidOrbitTarget() { return true; } virtual bool ValidOrbitTarget() { return true; }
virtual bool GetOrbitDistanceCheck() { return true; } virtual bool GetOrbitDistanceCheck() { return true; }
virtual zeus::CVector3f GetOrbitPosition(const CStateManager&) virtual zeus::CVector3f GetOrbitPosition(const CStateManager&);
{ return x34_transform.origin; }
void RemoveEmitter(); void RemoveEmitter();
virtual std::experimental::optional<zeus::CAABox> GetTouchBounds() const { return {} ; } 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, EMaterialTypes, CStateManager&);
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&); void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
void RemoveMaterial(EMaterialTypes, EMaterialTypes, CStateManager&); void RemoveMaterial(EMaterialTypes, EMaterialTypes, CStateManager&);
@ -100,29 +123,21 @@ public:
void AddMaterial(EMaterialTypes, EMaterialTypes, CStateManager&); void AddMaterial(EMaterialTypes, EMaterialTypes, CStateManager&);
void AddMaterial(EMaterialTypes, CStateManager&); void AddMaterial(EMaterialTypes, CStateManager&);
void SetCallTouch(bool callTouch) void SetCallTouch(bool callTouch);
{
xe5_28_callTouch = callTouch;
}
bool GetCallTouch() const bool GetCallTouch() const;
{
return xe5_28_callTouch;
}
void SetUseInSortedList(bool use) void SetUseInSortedList(bool use);
{
xe5_27_useInSortedLists = use;
}
bool GetUseInSortedLists() const bool GetUseInSortedLists() const;
{
return xe5_27_useInSortedLists;
}
const CMaterialFilter& GetMaterialFilter() const { return x70_; } const CMaterialFilter& GetMaterialFilter() const { return x70_; }
void SetInFluid(bool in, TUniqueId uid);
bool HasModelData() const; bool HasModelData() const;
const CSfxHandle* GetSfxHandle() const;
void SetSfxPitchBend(s32);
}; };
} }

View File

@ -31,6 +31,7 @@ public:
x54_visorParms(visorParms), b1(a), b2(b), b3(c), b4(d) {} x54_visorParms(visorParms), b1(a), b2(b), b3(c), b4(d) {}
static CActorParameters None() {return CActorParameters();} static CActorParameters None() {return CActorParameters();}
void SetVisorParameters(const CVisorParameters& vParams) { x54_visorParms = vParams; }
CVisorParameters GetVisorParameters() const { return x54_visorParms; } CVisorParameters GetVisorParameters() const { return x54_visorParms; }
}; };

View File

@ -36,6 +36,7 @@ set(WORLD_SOURCES
CScriptCoverPoint.hpp CScriptCoverPoint.cpp CScriptCoverPoint.hpp CScriptCoverPoint.cpp
CScriptSpawnPoint.hpp CScriptSpawnPoint.cpp CScriptSpawnPoint.hpp CScriptSpawnPoint.cpp
CScriptCameraHint.hpp CScriptCameraHint.cpp CScriptCameraHint.hpp CScriptCameraHint.cpp
CScriptDamageableTrigger.hpp CScriptDamageableTrigger.cpp
CScriptActorRotate.hpp CScriptActorRotate.cpp CScriptActorRotate.hpp CScriptActorRotate.cpp
CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp
CGrappleParameters.hpp CGrappleParameters.hpp

View File

@ -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)
{
}
}

View File

@ -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

View File

@ -4,8 +4,24 @@ namespace urde
{ {
CScriptGenerator::CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info, CScriptGenerator::CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info,
u32, bool, const zeus::CVector3f&, bool, bool active, float, float) u32 w1, bool b1, const zeus::CVector3f& vec1, bool b2, bool active, float minScale, float maxScale)
: CEntity(uid, info, active, name) : 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);
}
} }

View File

@ -9,9 +9,24 @@ namespace urde
class CScriptGenerator : public CEntity 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: public:
CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info, CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info,
u32, bool, const zeus::CVector3f&, bool, bool, float, float); u32, bool, const zeus::CVector3f&, bool, bool, float, float);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
}; };
} }

View File

@ -12,29 +12,7 @@ class CResFactory;
class CWorld 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: public:
class CRelay class CRelay
{ {
TEditorId x0_relay = kInvalidEditorId; TEditorId x0_relay = kInvalidEditorId;
@ -50,6 +28,36 @@ public:
s16 GetMessage() const { return x8_msg; } s16 GetMessage() const { return x8_msg; }
bool GetActive() const { return xa_active; } 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); CWorld(IObjectStore& objStore, CResFactory& resFactory, ResId);
bool DoesAreaExist(TAreaId area) const; bool DoesAreaExist(TAreaId area) const;

View File

@ -30,6 +30,7 @@
#include "CScriptCoverPoint.hpp" #include "CScriptCoverPoint.hpp"
#include "CScriptSpawnPoint.hpp" #include "CScriptSpawnPoint.hpp"
#include "CScriptCameraHint.hpp" #include "CScriptCameraHint.hpp"
#include "CScriptDamageableTrigger.hpp"
#include "CScriptActorRotate.hpp" #include "CScriptActorRotate.hpp"
#include "CScriptSpecialFunction.hpp" #include "CScriptSpecialFunction.hpp"
#include "Camera/CCinematicCamera.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, CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& in,
int propCount, const CEntityInfo& info) 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, CEntity* ScriptLoader::LoadDebris(CStateManager& mgr, CInputStream& in,

@ -1 +1 @@
Subproject commit 90daa39c473e5821bf3a54c6c8f0a4a6cd011499 Subproject commit a48e2b4ec5087bcb167f15763c84fbac2ca4c272