Fix CNewIntroBoss and particle bugs

This commit is contained in:
Jack Andersen 2019-01-04 17:28:02 -10:00
parent 5b55320e9b
commit d60fcc99c9
17 changed files with 151 additions and 92 deletions

View File

@ -14,7 +14,7 @@ struct NewIntroBoss : IScriptObject {
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown1;
Value<float> turnRadius;
UniqueID32 weaponDesc;
DamageInfo damageInfo;
UniqueID32 beamContactFxId;

View File

@ -57,14 +57,13 @@ struct Application : boo::IApplicationCallback {
std::atomic_bool m_running = {true};
Application() : m_fileMgr(_SYS_STR("urde")), m_cvarManager(m_fileMgr), m_cvarCommons(m_cvarManager) {
m_viewManager = std::make_unique<ViewManager>(m_fileMgr, m_cvarManager);
}
Application() : m_fileMgr(_SYS_STR("urde")), m_cvarManager(m_fileMgr), m_cvarCommons(m_cvarManager) {}
virtual ~Application() = default;
int appMain(boo::IApplication* app) {
initialize(app);
m_viewManager = std::make_unique<ViewManager>(m_fileMgr, m_cvarManager);
m_viewManager->init(app);
while (m_running.load()) {
if (!m_viewManager->proc())

View File

@ -1377,44 +1377,42 @@ void CStateManager::ProcessRadiusDamage(const CActor& damager, CActor& damagee,
void CStateManager::ApplyRadiusDamage(const CActor& a1, const zeus::CVector3f& pos, CActor& a2,
const CDamageInfo& info) {
zeus::CVector3f delta = a2.GetTranslation() - pos;
if (delta.magSquared() >= info.GetRadius() * info.GetRadius()) {
std::experimental::optional<zeus::CAABox> bounds = a2.GetTouchBounds();
if (!bounds)
return;
if (CCollidableSphere::Sphere_AABox_Bool(zeus::CSphere{pos, info.GetRadius()}, *bounds)) {
float rad = info.GetRadius();
if (rad > FLT_EPSILON)
rad = delta.magnitude() / rad;
else
rad = 0.f;
if (rad > 0.f)
delta.normalize();
std::experimental::optional<zeus::CAABox> bounds;
if (delta.magSquared() < info.GetRadius() * info.GetRadius() ||
((bounds = a2.GetTouchBounds()) &&
CCollidableSphere::Sphere_AABox_Bool(zeus::CSphere{pos, info.GetRadius()}, *bounds))) {
float rad = info.GetRadius();
if (rad > FLT_EPSILON)
rad = delta.magnitude() / rad;
else
rad = 0.f;
if (rad > 0.f)
delta.normalize();
bool alive = false;
if (CHealthInfo* hInfo = a2.HealthInfo(*this))
if (hInfo->GetHP() > 0.f)
alive = true;
bool alive = false;
if (CHealthInfo* hInfo = a2.HealthInfo(*this))
if (hInfo->GetHP() > 0.f)
alive = true;
const CDamageVulnerability* vuln;
if (rad > 0.f)
vuln = a2.GetDamageVulnerability(pos, delta, info);
else
vuln = a2.GetDamageVulnerability();
const CDamageVulnerability* vuln;
if (rad > 0.f)
vuln = a2.GetDamageVulnerability(pos, delta, info);
else
vuln = a2.GetDamageVulnerability();
if (vuln->WeaponHurts(info.GetWeaponMode(), true)) {
float dam = info.GetRadiusDamage(*vuln);
if (dam > 0.f)
ApplyLocalDamage(pos, delta, a2, dam, info.GetWeaponMode());
a2.SendScriptMsgs(EScriptObjectState::Damage, *this, EScriptObjectMessage::None);
SendScriptMsg(&a2, a1.GetUniqueId(), EScriptObjectMessage::Damage);
} else {
a2.SendScriptMsgs(EScriptObjectState::InvulnDamage, *this, EScriptObjectMessage::None);
SendScriptMsg(&a2, a1.GetUniqueId(), EScriptObjectMessage::InvulnDamage);
}
if (alive && info.GetKnockBackPower() > 0.f)
ApplyKnockBack(a2, info, *vuln, (a2.GetTranslation() - a1.GetTranslation()).normalized(), rad);
if (vuln->WeaponHurts(info.GetWeaponMode(), true)) {
float dam = info.GetRadiusDamage(*vuln);
if (dam > 0.f)
ApplyLocalDamage(pos, delta, a2, dam, info.GetWeaponMode());
a2.SendScriptMsgs(EScriptObjectState::Damage, *this, EScriptObjectMessage::None);
SendScriptMsg(&a2, a1.GetUniqueId(), EScriptObjectMessage::Damage);
} else {
a2.SendScriptMsgs(EScriptObjectState::InvulnDamage, *this, EScriptObjectMessage::None);
SendScriptMsg(&a2, a1.GetUniqueId(), EScriptObjectMessage::InvulnDamage);
}
if (alive && info.GetKnockBackPower() > 0.f)
ApplyKnockBack(a2, info, *vuln, (a2.GetTranslation() - a1.GetTranslation()).normalized(), rad);
}
}

View File

@ -130,7 +130,7 @@ void CBallCamera::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CSt
case EScriptObjectMessage::Registered: {
x46c_collisionActorId = stateMgr.AllocateUniqueId();
CCollisionActor* colAct =
new CCollisionActor(x46c_collisionActorId, GetAreaId(), kInvalidUniqueId, true, 0.3f, 1.f);
new CCollisionActor(x46c_collisionActorId, GetAreaId(), kInvalidUniqueId, true, 0.3f, 1.f, "BallCamera"sv);
colAct->SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(
{EMaterialTypes::Solid}, {EMaterialTypes::Player, EMaterialTypes::CameraPassthrough}));
colAct->SetMaterialList({EMaterialTypes::ProjectilePassthrough, EMaterialTypes::ScanPassthrough,

View File

@ -22,11 +22,20 @@ CCollidableOBBTreeGroupContainer::CCollidableOBBTreeGroupContainer(CInputStream&
x10_aabbs.reserve(x0_trees.size());
for (const std::unique_ptr<COBBTree>& tree : x0_trees)
for (const std::unique_ptr<COBBTree>& tree : x0_trees) {
x10_aabbs.push_back(CCollidableOBBTree(tree.get(), CMaterialList()).CalculateLocalAABox());
x20_aabox.accumulateBounds(x10_aabbs.back());
}
}
CCollidableOBBTreeGroupContainer::CCollidableOBBTreeGroupContainer(const zeus::CVector3f&, const zeus::CVector3f&) {}
CCollidableOBBTreeGroupContainer::CCollidableOBBTreeGroupContainer(const zeus::CVector3f& extent, const zeus::CVector3f& center) {
x0_trees.push_back(COBBTree::BuildOrientedBoundingBoxTree(extent, center));
for (const std::unique_ptr<COBBTree>& tree : x0_trees) {
x10_aabbs.push_back(CCollidableOBBTree(tree.get(), CMaterialList()).CalculateLocalAABox());
x20_aabox.accumulateBounds(x10_aabbs.back());
}
}
CCollidableOBBTreeGroup::CCollidableOBBTreeGroup(const CCollidableOBBTreeGroupContainer* container,
const CMaterialList& matList)

View File

@ -11,17 +11,19 @@ static const CMaterialList gkDefaultCollisionActorMaterials =
CMaterialList(EMaterialTypes::Solid, EMaterialTypes::CollisionActor, EMaterialTypes::ScanPassthrough,
EMaterialTypes::CameraPassthrough);
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, const zeus::CVector3f& vec1,
const zeus::CVector3f& vec2, bool active, float mass)
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, const zeus::CVector3f& extent,
const zeus::CVector3f& center, bool active, float mass, std::string_view name)
: CPhysicsActor(uid1, active, "CollisionActor", CEntityInfo(aId, CEntity::NullConnectionList),
zeus::CTransform::Identity(), CModelData::CModelDataNull(), gkDefaultCollisionActorMaterials,
zeus::CAABox::skNullBox, SMoverData(mass), CActorParameters::None(), 0.3f, 0.1f)
, x258_primitiveType(EPrimitiveType::OBBTreeGroup)
, x25c_owner(uid2)
, x260_boxSize(vec1)
, x26c_(vec2)
, x278_obbContainer(new CCollidableOBBTreeGroupContainer(vec1, vec2))
, x260_boxSize(extent)
, x26c_center(center)
, x278_obbContainer(new CCollidableOBBTreeGroupContainer(extent, center))
, x27c_obbTreeGroupPrimitive(new CCollidableOBBTreeGroup(x278_obbContainer.get(), GetMaterialList())) {
x10_name += ' ';
x10_name += name;
SetCoefficientOfRestitutionModifier(0.5f);
SetCallTouch(false);
SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(
@ -29,7 +31,7 @@ CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, co
}
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, const zeus::CVector3f& boxSize,
bool active, float mass)
bool active, float mass, std::string_view name)
: CPhysicsActor(uid1, active, "CollisionActor", CEntityInfo(aId, CEntity::NullConnectionList),
zeus::CTransform::Identity(), CModelData::CModelDataNull(), gkDefaultCollisionActorMaterials,
zeus::CAABox::skNullBox, SMoverData(mass), CActorParameters::None(), 0.3f, 0.1f)
@ -38,13 +40,16 @@ CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, co
, x260_boxSize(boxSize)
, x280_aaboxPrimitive(new CCollidableAABox(zeus::CAABox(-0.5f * boxSize, 0.5f * boxSize),
CMaterialList(EMaterialTypes::Solid, EMaterialTypes::NoStaticCollision))) {
x10_name += ' ';
x10_name += name;
SetCoefficientOfRestitutionModifier(0.5f);
SetCallTouch(false);
SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(
{EMaterialTypes::Solid}, {EMaterialTypes::CollisionActor, EMaterialTypes::NoStaticCollision}));
}
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, bool active, float radius, float mass)
CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, bool active, float radius, float mass,
std::string_view name)
: CPhysicsActor(uid1, active, "CollisionActor", CEntityInfo(aId, CEntity::NullConnectionList),
zeus::CTransform::Identity(), CModelData::CModelDataNull(), gkDefaultCollisionActorMaterials,
zeus::CAABox::skNullBox, SMoverData(mass), CActorParameters::None(), 0.3f, 0.1f)
@ -53,6 +58,8 @@ CCollisionActor::CCollisionActor(TUniqueId uid1, TAreaId aId, TUniqueId uid2, bo
, x284_spherePrimitive(new CCollidableSphere(zeus::CSphere(zeus::CVector3f::skZero, radius),
CMaterialList(EMaterialTypes::NoStaticCollision, EMaterialTypes::Solid)))
, x288_sphereRadius(radius) {
x10_name += ' ';
x10_name += name;
SetCoefficientOfRestitutionModifier(0.5f);
SetCallTouch(false);
SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(
@ -71,12 +78,13 @@ void CCollisionActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
case EScriptObjectMessage::Touched:
case EScriptObjectMessage::Damage:
case EScriptObjectMessage::InvulnDamage: {
CEntity* ent = mgr.ObjectById(x25c_owner);
if (ent)
mgr.SendScriptMsg(ent, x2fc_lastTouched, msg);
if (CEntity* ent = mgr.ObjectById(x25c_owner)) {
x2fc_lastTouched = uid;
mgr.SendScriptMsg(ent, GetUniqueId(), msg);
}
} break;
default:
mgr.SendScriptMsgAlways(x25c_owner, x8_uid, msg);
mgr.SendScriptMsgAlways(x25c_owner, GetUniqueId(), msg);
break;
}

View File

@ -13,7 +13,7 @@ class CCollisionActor : public CPhysicsActor {
EPrimitiveType x258_primitiveType;
TUniqueId x25c_owner;
zeus::CVector3f x260_boxSize;
zeus::CVector3f x26c_;
zeus::CVector3f x26c_center;
std::unique_ptr<CCollidableOBBTreeGroupContainer> x278_obbContainer;
std::unique_ptr<CCollidableOBBTreeGroup> x27c_obbTreeGroupPrimitive;
std::unique_ptr<CCollidableAABox> x280_aaboxPrimitive;
@ -26,9 +26,10 @@ class CCollisionActor : public CPhysicsActor {
zeus::CVector3f x304_extendedTouchBounds = zeus::CVector3f::skZero;
public:
CCollisionActor(TUniqueId, TAreaId, TUniqueId, const zeus::CVector3f&, const zeus::CVector3f&, bool, float);
CCollisionActor(TUniqueId, TAreaId, TUniqueId, const zeus::CVector3f&, bool, float);
CCollisionActor(TUniqueId, TAreaId, TUniqueId, bool, float, float);
CCollisionActor(TUniqueId, TAreaId, TUniqueId, const zeus::CVector3f&, const zeus::CVector3f&, bool, float,
std::string_view name);
CCollisionActor(TUniqueId, TAreaId, TUniqueId, const zeus::CVector3f&, bool, float, std::string_view name);
CCollisionActor(TUniqueId, TAreaId, TUniqueId, bool, float, float, std::string_view name);
void Accept(IVisitor& visitor);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);

View File

@ -30,7 +30,7 @@ CCollisionActorManager::CCollisionActorManager(CStateManager& mgr, TUniqueId own
bounds.y() += dist;
CCollisionActor* newAct =
new CCollisionActor(mgr.AllocateUniqueId(), area, x10_ownerId, bounds,
zeus::CVector3f(0.f, 0.5f * dist, 0.f), active, modDesc.GetMass());
zeus::CVector3f(0.f, 0.5f * dist, 0.f), active, modDesc.GetMass(), desc.GetName());
if (modDesc.GetOrientationType() == CJointCollisionDescription::EOrientationType::Zero) {
newAct->SetTransform(locXf);
} else {
@ -46,7 +46,8 @@ CCollisionActorManager::CCollisionActorManager(CStateManager& mgr, TUniqueId own
} else {
TUniqueId newId = mgr.AllocateUniqueId();
CCollisionActor* newAct =
new CCollisionActor(newId, area, x10_ownerId, active, modDesc.GetRadius(), modDesc.GetMass());
new CCollisionActor(newId, area, x10_ownerId, active, modDesc.GetRadius(), modDesc.GetMass(),
desc.GetName());
newAct->SetTransform(locXf);
mgr.AddObject(newAct);
x0_jointDescriptions.push_back(CJointCollisionDescription::SphereCollision(
@ -63,7 +64,8 @@ CCollisionActorManager::CCollisionActorManager(CStateManager& mgr, TUniqueId own
CJointCollisionDescription::EOrientationType::One, modDesc.GetName(), 0.001f));
TUniqueId newId2 = mgr.AllocateUniqueId();
CCollisionActor* newAct2 =
new CCollisionActor(newId2, area, x10_ownerId, active, modDesc.GetRadius(), modDesc.GetMass());
new CCollisionActor(newId2, area, x10_ownerId, active, modDesc.GetRadius(), modDesc.GetMass(),
desc.GetName());
if (modDesc.GetOrientationType() == CJointCollisionDescription::EOrientationType::Zero) {
newAct2->SetTransform(zeus::CTransform::Translate(locXf.origin + separation * locXf.basis[1]));
} else {
@ -83,12 +85,14 @@ CCollisionActorManager::CCollisionActorManager(CStateManager& mgr, TUniqueId own
TUniqueId newId = mgr.AllocateUniqueId();
CCollisionActor* newAct;
if (modDesc.GetType() == CJointCollisionDescription::ECollisionType::Sphere)
newAct = new CCollisionActor(newId, area, x10_ownerId, active, modDesc.GetRadius(), modDesc.GetMass());
newAct = new CCollisionActor(newId, area, x10_ownerId, active, modDesc.GetRadius(), modDesc.GetMass(),
desc.GetName());
else if (modDesc.GetType() == CJointCollisionDescription::ECollisionType::OBB)
newAct = new CCollisionActor(newId, area, x10_ownerId, modDesc.GetBounds(), modDesc.GetPivotPoint(), active,
modDesc.GetMass());
modDesc.GetMass(), desc.GetName());
else
newAct = new CCollisionActor(newId, area, x10_ownerId, modDesc.GetBounds(), active, modDesc.GetMass());
newAct = new CCollisionActor(newId, area, x10_ownerId, modDesc.GetBounds(), active, modDesc.GetMass(),
desc.GetName());
newAct->SetTransform(locXf);
mgr.AddObject(newAct);
x0_jointDescriptions.push_back(desc);

View File

@ -10,6 +10,7 @@ class CCollisionEdge {
public:
CCollisionEdge() = default;
CCollisionEdge(CInputStream&);
CCollisionEdge(u16 v0, u16 v1) : x0_index1(v0), x2_index2(v1) {}
u16 GetVertIndex1() const { return x0_index1; }
u16 GetVertIndex2() const { return x2_index2; }

View File

@ -8,8 +8,6 @@ u32 verify_deaf_babe(CInputStream& in) { return in.readUint32Big(); }
/* This is exactly what retro did >.< */
u32 verify_version(CInputStream& in) { return in.readUint32Big(); }
COBBTree::COBBTree(const SIndexData& indexData, const CNode* root) : x18_indexData(indexData), x88_root((CNode*)root) {}
COBBTree::COBBTree(CInputStream& in)
: x0_magic(verify_deaf_babe(in))
, x4_version(verify_version(in))
@ -17,9 +15,48 @@ COBBTree::COBBTree(CInputStream& in)
, x18_indexData(in)
, x88_root(new CNode(in)) {}
std::unique_ptr<CCollidableOBBTreeGroupContainer> COBBTree::BuildOrientedBoundingBoxTree(const zeus::CVector3f& a,
const zeus::CVector3f& b) {
return std::make_unique<CCollidableOBBTreeGroupContainer>(a, b);
static const u8 DefaultEdgeMaterials[] = {
2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 2, 2
};
static const u8 DefaultSurfaceMaterials[] = {
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1
};
static const CCollisionEdge DefaultEdges[] = {
{4, 1}, {1, 5}, {5, 4}, {4, 0}, {0, 1}, {7, 2}, {2, 6}, {6, 7}, {7, 3},
{3, 2}, {6, 0}, {4, 6}, {2, 0}, {5, 3}, {7, 5}, {1, 3}, {6, 5}, {0, 3}
};
static const u16 DefaultSurfaceIndices[] = {
0, 1, 2, 0, 3, 4, 5, 6, 7, 5, 8, 9, 10, 3, 11, 10, 6, 12, 13,
8, 14, 13, 1, 15, 16, 14, 7, 16, 11, 2, 17, 15, 4, 17, 12, 9
};
std::unique_ptr<COBBTree> COBBTree::BuildOrientedBoundingBoxTree(const zeus::CVector3f& extent,
const zeus::CVector3f& center) {
zeus::CAABox aabb(extent * -0.5f + center, extent * 0.5f + center);
std::unique_ptr<COBBTree> ret = std::make_unique<COBBTree>();
COBBTree::SIndexData& idxData = ret->x18_indexData;
idxData.x0_materials.reserve(3);
idxData.x0_materials.push_back(0x40180000);
idxData.x0_materials.push_back(0x42180000);
idxData.x0_materials.push_back(0x41180000);
idxData.x10_vertMaterials = std::vector<u8>(8, u8(0));
idxData.x20_edgeMaterials = std::vector<u8>(std::begin(DefaultEdgeMaterials), std::end(DefaultEdgeMaterials));
idxData.x30_surfaceMaterials = std::vector<u8>(std::begin(DefaultSurfaceMaterials), std::end(DefaultSurfaceMaterials));
idxData.x40_edges = std::vector<CCollisionEdge>(std::begin(DefaultEdges), std::end(DefaultEdges));
idxData.x50_surfaceIndices = std::vector<u16>(std::begin(DefaultSurfaceIndices), std::end(DefaultSurfaceIndices));
idxData.x60_vertices.reserve(8);
for (int i = 0; i < 8; ++i)
idxData.x60_vertices.push_back(aabb.getPoint(i));
std::vector<u16> surface;
surface.reserve(12);
for (int i = 0; i < 12; ++i)
surface.push_back(i);
ret->x88_root = std::make_unique<CNode>(zeus::CTransform::Translate(center), extent * 0.5f,
std::unique_ptr<CNode>{}, std::unique_ptr<CNode>{}, std::make_unique<CLeafData>(std::move(surface)));
return ret;
}
CCollisionSurface COBBTree::GetSurface(u16 idx) const {
@ -118,13 +155,14 @@ COBBTree::SIndexData::SIndexData(CInputStream& in) {
x60_vertices.push_back(zeus::CVector3f::ReadBig(in));
}
COBBTree::CNode::CNode(const zeus::CTransform& xf, const zeus::CVector3f& point, const COBBTree::CNode* left,
const COBBTree::CNode* right, const COBBTree::CLeafData* leaf)
: x0_obb(xf, point), x3c_isLeaf(leaf != nullptr) {
x40_left.reset((CNode*)left);
x44_right.reset((CNode*)right);
x48_leaf.reset((CLeafData*)leaf);
}
COBBTree::CNode::CNode(const zeus::CTransform& xf, const zeus::CVector3f& point,
std::unique_ptr<CNode>&& left, std::unique_ptr<CNode>&& right,
std::unique_ptr<CLeafData>&& leaf)
: x0_obb(xf, point)
, x3c_isLeaf(leaf.operator bool())
, x40_left(std::move(left))
, x44_right(std::move(right))
, x48_leaf(std::move(leaf)) {}
COBBTree::CNode::CNode(CInputStream& in) {
x0_obb = zeus::COBBox::ReadBig(in);
@ -151,7 +189,7 @@ size_t COBBTree::CNode::GetMemoryUsage() const {
return (ret + 3) & ~3;
}
COBBTree::CLeafData::CLeafData(const std::vector<u16>& surface) : x0_surface(surface) {}
COBBTree::CLeafData::CLeafData(std::vector<u16>&& surface) : x0_surface(std::move(surface)) {}
const std::vector<u16>& COBBTree::CLeafData::GetSurfaceVector() const { return x0_surface; }

View File

@ -27,7 +27,7 @@ public:
public:
CLeafData() = default;
CLeafData(const std::vector<u16>&);
CLeafData(std::vector<u16>&& surface);
CLeafData(CInputStream&);
const std::vector<u16>& GetSurfaceVector() const;
@ -45,7 +45,8 @@ public:
public:
CNode() = default;
CNode(const CNode&) = default;
CNode(const zeus::CTransform&, const zeus::CVector3f&, const CNode*, const CNode*, const CLeafData*);
CNode(const zeus::CTransform&, const zeus::CVector3f&, std::unique_ptr<CNode>&&, std::unique_ptr<CNode>&&,
std::unique_ptr<CLeafData>&&);
CNode(CInputStream&);
bool WasHit() const { return x4c_hit; }
@ -68,11 +69,10 @@ private:
public:
COBBTree() = default;
COBBTree(const COBBTree::SIndexData&, const CNode*);
COBBTree(CInputStream&);
static std::unique_ptr<CCollidableOBBTreeGroupContainer> BuildOrientedBoundingBoxTree(const zeus::CVector3f&,
const zeus::CVector3f&);
static std::unique_ptr<COBBTree> BuildOrientedBoundingBoxTree(const zeus::CVector3f&,
const zeus::CVector3f&);
CCollisionSurface GetSurface(u16 idx) const;
const u16* GetTriangleEdgeIndices(u16 idx) const { return &x18_indexData.x50_surfaceIndices[idx * 3]; }
void GetTriangleVertexIndices(u16 idx, u16 indicesOut[3]) const;

View File

@ -14,11 +14,11 @@ namespace urde::MP1 {
CNewIntroBoss::CNewIntroBoss(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
float f1, CAssetId projectile, const CDamageInfo& dInfo, CAssetId beamContactFxId,
float turnRadius, CAssetId projectile, const CDamageInfo& dInfo, CAssetId beamContactFxId,
CAssetId beamPulseFxId, CAssetId beamTextureId, CAssetId beamGlowTextureId)
: CPatterned(ECharacter::NewIntroBoss, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::One, EBodyType::Restricted, actParms, EKnockBackVariant::Medium)
, x570_(f1)
, x570_turnRadius(turnRadius)
, x574_boneTracking(*GetModelData()->GetAnimationData(), "Head_1"sv, zeus::degToRad(80.f), zeus::degToRad(180.f), false)
, x5ac_projectileInfo(projectile, dInfo)
, x5f0_beamContactFxId(beamContactFxId)
@ -327,7 +327,8 @@ bool CNewIntroBoss::ShouldTurn(CStateManager& mgr, float dt) {
zeus::CVector2f diffPos = (x604_predictedPlayerPos - GetTranslation()).toVec2f();
return zeus::CVector2f::getAngleDiff(GetTransform().frontVector().toVec2f(), diffPos) > zeus::degToRad(1.f);
return zeus::CVector2f::getAngleDiff(GetTransform().frontVector().toVec2f(), diffPos) >
zeus::degToRad(x570_turnRadius);
}
bool CNewIntroBoss::ShouldAttack(CStateManager& mgr, float dt) {

View File

@ -12,7 +12,7 @@ namespace MP1 {
class CNewIntroBoss : public CPatterned {
pas::ELocomotionType x568_locomotion = pas::ELocomotionType::Relaxed;
u32 x56c_stateProg = 0;
float x570_;
float x570_turnRadius;
CBoneTracking x574_boneTracking;
CProjectileInfo x5ac_projectileInfo;
TUniqueId x5d4_stage1Projectile = kInvalidUniqueId;
@ -49,7 +49,7 @@ public:
DEFINE_PATTERNED(NewIntroBoss)
CNewIntroBoss(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
float f1, CAssetId projectile, const CDamageInfo& dInfo, CAssetId beamContactFxId,
float turnRadius, CAssetId projectile, const CDamageInfo& dInfo, CAssetId beamContactFxId,
CAssetId beamPulseFxId, CAssetId beamTextureId, CAssetId beamGlowTextureId);
void Accept(IVisitor& visitor);

View File

@ -370,7 +370,7 @@ bool CElementGen::UpdateVelocitySource(u32 idx, u32 particleFrame, CParticle& pa
zeus::CVector3f localPos = x208_orientationInverse * (particle.x4_pos - xdc_translation);
err = x280_VELSources[idx]->GetValue(particleFrame, localVel, localPos);
particle.x1c_vel = x1d8_orientation.rotate(localVel);
particle.x4_pos = x1d8_orientation.rotate(localVel) + xdc_translation;
particle.x4_pos = x1d8_orientation.rotate(localPos) + xdc_translation;
} else {
err = x280_VELSources[idx]->GetValue(particleFrame, particle.x1c_vel, particle.x4_pos);
}

View File

@ -62,7 +62,7 @@ private:
float x8c_generatorRemainder = 0.f;
int x90_MAXP = 0;
int m_maxMAXP = 256;
u16 x94_randomSeed = 99;
u16 x94_randomSeed = g_GlobalSeed;
float x98_generatorRate = 1.f;
float x9c_cextValues[16] = {};

View File

@ -677,9 +677,8 @@ void CActor::MoveScannableObjectInfoToActor(CActor* act, CStateManager& mgr) {
if (!act)
return;
if (act->GetScannableObjectInfo() != GetScannableObjectInfo())
act->x98_scanObjectInfo = x98_scanObjectInfo;
act->x98_scanObjectInfo = x98_scanObjectInfo;
x98_scanObjectInfo = TLockedToken<CScannableObjectInfo>();
act->AddMaterial(EMaterialTypes::Scannable, mgr);
RemoveMaterial(EMaterialTypes::Scannable, mgr);
}

View File

@ -790,7 +790,7 @@ CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, in
CActorParameters actParms = LoadActorParameters(in);
float f1 = in.readFloatBig();
float turnRadius = in.readFloatBig();
CAssetId projectile(in);
CDamageInfo dInfo(in);
@ -808,7 +808,8 @@ CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, in
CAnimRes res(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, aParms.GetInitialAnimation(), true);
return new MP1::CNewIntroBoss(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, res, pInfo, actParms,
f1, projectile, dInfo, beamContactFxId, beamPulseFxId, beamTextureId, beamGlowTextureId);
turnRadius, projectile, dInfo, beamContactFxId, beamPulseFxId, beamTextureId,
beamGlowTextureId);
}
CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {