CBeetle implementation

This commit is contained in:
Jack Andersen 2018-12-30 19:01:42 -10:00
parent 0ec81477cf
commit 147a9396c4
22 changed files with 1214 additions and 92 deletions

View File

@ -382,8 +382,11 @@ std::string PAKRouter<BRIDGETYPE>::getBestEntryName(const EntryType& entry, bool
std::string name; std::string name;
for (const BRIDGETYPE& bridge : *m_bridges) { for (const BRIDGETYPE& bridge : *m_bridges) {
const typename BRIDGETYPE::PAKType& pak = bridge.getPAK(); const typename BRIDGETYPE::PAKType& pak = bridge.getPAK();
const typename BRIDGETYPE::PAKType::Entry* e = pak.lookupEntry(entry.id);
if (!e)
continue;
if (stdOverride && isShared()) { if (stdOverride && !pak.m_noShare) {
if (entry.type == FOURCC('MLVL')) if (entry.type == FOURCC('MLVL'))
return "!world"; return "!world";
else if (entry.type == FOURCC('MREA')) else if (entry.type == FOURCC('MREA'))
@ -411,7 +414,7 @@ std::string PAKRouter<BRIDGETYPE>::getBestEntryName(const IDType& entry, bool st
if (!e) if (!e)
continue; continue;
if (stdOverride && isShared()) { if (stdOverride && !pak.m_noShare) {
if (e->type == FOURCC('MLVL')) if (e->type == FOURCC('MLVL'))
return "!world"; return "!world";
else if (e->type == FOURCC('MREA')) else if (e->type == FOURCC('MREA'))

View File

@ -175,10 +175,6 @@ public:
hecl::ProjectPath getWorking(const IDType& id, bool silenceWarnings = false) const; hecl::ProjectPath getWorking(const IDType& id, bool silenceWarnings = false) const;
hecl::ProjectPath getCooked(const EntryType* entry) const; hecl::ProjectPath getCooked(const EntryType* entry) const;
hecl::ProjectPath getCooked(const IDType& id, bool silenceWarnings = false) const; hecl::ProjectPath getCooked(const IDType& id, bool silenceWarnings = false) const;
bool isShared() const {
const PAKType* pak = m_pak.get();
return pak ? !pak->m_noShare : false;
}
hecl::SystemString getResourceRelativePath(const EntryType& a, const IDType& b) const; hecl::SystemString getResourceRelativePath(const EntryType& a, const IDType& b) const;

View File

@ -9,37 +9,37 @@ struct Beetle : IScriptObject {
AT_DECL_DNA_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atUint32> unknown1; Value<atUint32> flavor;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;
Value<atVec3f> scale; Value<atVec3f> scale;
PatternedInfo patternedInfo; PatternedInfo patternedInfo;
ActorParameters actorParameters; ActorParameters actorParameters;
DamageInfo damageInfo; DamageInfo touchDamage;
Value<atVec3f> unknown2; Value<atVec3f> tailAimReference;
Value<float> unknown3; Value<float> unused;
DamageVulnerability damageVulnerabilty1; DamageVulnerability tailVuln;
DamageVulnerability damageVulnerabilty2; DamageVulnerability platingVuln;
UniqueID32 model; UniqueID32 tailModel;
Value<atUint32> unknown4; Value<atUint32> entranceType;
Value<float> unknown5; Value<float> initialAttackDelay;
Value<float> unknown6; Value<float> retreatTime;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const { void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters); actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
} }
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const { void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (model) { if (tailModel) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model); PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(tailModel);
ent->name = name + "_model"; ent->name = name + "_tailModel";
} }
patternedInfo.nameIDs(pakRouter, name + "_patterned"); patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp"); actorParameters.nameIDs(pakRouter, name + "_actp");
} }
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const { void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(model, pathsOut); g_curSpec->flattenDependencies(tailModel, pathsOut);
patternedInfo.depIDs(pathsOut); patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut); actorParameters.depIDs(pathsOut, lazyOut);
} }

View File

@ -13,10 +13,10 @@ struct Trigger : IScriptObject {
Value<atVec3f> volume; Value<atVec3f> volume;
DamageInfo damageInfo; DamageInfo damageInfo;
Value<atVec3f> force; Value<atVec3f> force;
Value<atUint32> unknown; Value<atUint32> flags;
Value<bool> active; Value<bool> active;
Value<bool> unknown2; Value<bool> deactivateOnEntered;
Value<bool> unknown3; Value<bool> deactivateOnExited;
zeus::CAABox getVISIAABB(hecl::blender::Token& btok) const { zeus::CAABox getVISIAABB(hecl::blender::Token& btok) const {
zeus::CVector3f halfExtent = zeus::CVector3f(volume) / 2.f; zeus::CVector3f halfExtent = zeus::CVector3f(volume) / 2.f;

View File

@ -228,6 +228,7 @@ void CAutoMapper::UpdateHintNavigation(float dt, const CStateManager& mgr) {
xa8_renderStates[2] = xa8_renderStates[0]; xa8_renderStates[2] = xa8_renderStates[0];
xa8_renderStates[1].x20_areaPoint = GetAreaPointOfInterest(mgr, nextStep.x4_areaId); xa8_renderStates[1].x20_areaPoint = GetAreaPointOfInterest(mgr, nextStep.x4_areaId);
xa8_renderStates[1].ResetInterpolation(); xa8_renderStates[1].ResetInterpolation();
xa8_renderStates[1].x4c_pointEase = SAutoMapperRenderState::Ease::Linear;
ResetInterpolationTimer(2.f * g_tweakAutoMapper->GetHintPanTime()); ResetInterpolationTimer(2.f * g_tweakAutoMapper->GetHintPanTime());
x1e0_hintSteps.pop_front(); x1e0_hintSteps.pop_front();
} }
@ -238,6 +239,7 @@ void CAutoMapper::UpdateHintNavigation(float dt, const CStateManager& mgr) {
xa8_renderStates[2] = xa8_renderStates[0]; xa8_renderStates[2] = xa8_renderStates[0];
xa8_renderStates[1].x20_areaPoint = mwData.GetWorldCenterPoint(); xa8_renderStates[1].x20_areaPoint = mwData.GetWorldCenterPoint();
xa8_renderStates[1].ResetInterpolation(); xa8_renderStates[1].ResetInterpolation();
xa8_renderStates[1].x4c_pointEase = SAutoMapperRenderState::Ease::Linear;
ResetInterpolationTimer(2.f * g_tweakAutoMapper->GetHintPanTime()); ResetInterpolationTimer(2.f * g_tweakAutoMapper->GetHintPanTime());
x1e0_hintSteps.pop_front(); x1e0_hintSteps.pop_front();
break; break;
@ -269,7 +271,8 @@ void CAutoMapper::UpdateHintNavigation(float dt, const CStateManager& mgr) {
nextStep.x4_float = std::max(0.f, nextStep.x4_float - dt); nextStep.x4_float = std::max(0.f, nextStep.x4_float - dt);
for (SAutoMapperHintLocation& loc : x1f8_hintLocations) { for (SAutoMapperHintLocation& loc : x1f8_hintLocations) {
if (x24_world->IGetWorldAssetId() == loc.x8_worldId && xa0_curAreaId == loc.xc_areaId) { if (x24_world->IGetWorldAssetId() == loc.x8_worldId && xa0_curAreaId == loc.xc_areaId) {
nextStep.x4_float = 1.f - std::min(nextStep.x4_float / 0.5f, 1.f); loc.x0_showBeacon = 1;
loc.x4_beaconAlpha = 1.f - std::min(nextStep.x4_float / 0.5f, 1.f);
break; break;
} }
} }
@ -1021,9 +1024,9 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
if (input.PZ() || input.PB()) { if (input.PZ() || input.PB()) {
if (x328_ == 0) { if (x328_ == 0) {
if (CanLeaveMapScreenInternal(mgr)) if (CanLeaveMapScreenInternal(mgr)) {
LeaveMapScreen(mgr); LeaveMapScreen(mgr);
if (NotHintNavigating()) { } else if (NotHintNavigating()) {
BeginMapperStateTransition(EAutoMapperState::MapScreenUniverse, mgr); BeginMapperStateTransition(EAutoMapperState::MapScreenUniverse, mgr);
x328_ = 1; x328_ = 1;
} }

View File

@ -1871,17 +1871,15 @@ void CStateManager::UpdateHintState(float dt) {
void CStateManager::PreThinkObjects(float dt) { void CStateManager::PreThinkObjects(float dt) {
if (x84c_player->x9f4_deathTime > 0.f) { if (x84c_player->x9f4_deathTime > 0.f) {
x84c_player->DoPreThink(dt, *this); x84c_player->DoPreThink(dt, *this);
return; } else if (x904_gameState == EGameState::SoftPaused) {
}
if (x904_gameState == EGameState::SoftPaused)
for (CEntity* ent : GetAllObjectList()) for (CEntity* ent : GetAllObjectList())
if (TCastToPtr<CScriptEffect> effect = ent) if (TCastToPtr<CScriptEffect> effect = ent)
effect->PreThink(dt, *this); effect->PreThink(dt, *this);
} else {
for (CEntity* ent : GetAllObjectList()) for (CEntity* ent : GetAllObjectList())
if (ent && !GetCameraObjectList().GetObjectById(ent->GetUniqueId())) if (ent && !GetCameraObjectList().GetObjectById(ent->GetUniqueId()))
ent->PreThink(dt, *this); ent->PreThink(dt, *this);
}
} }
void CStateManager::MovePlatforms(float dt) { void CStateManager::MovePlatforms(float dt) {

View File

@ -23,6 +23,8 @@ class CBCMeleeAttackCmd : public CBodyStateCmd {
public: public:
CBCMeleeAttackCmd() : CBodyStateCmd(EBodyStateCmd::MeleeAttack) {} CBCMeleeAttackCmd() : CBodyStateCmd(EBodyStateCmd::MeleeAttack) {}
CBCMeleeAttackCmd(pas::ESeverity severity) : CBodyStateCmd(EBodyStateCmd::MeleeAttack), x8_severity(severity) {} CBCMeleeAttackCmd(pas::ESeverity severity) : CBodyStateCmd(EBodyStateCmd::MeleeAttack), x8_severity(severity) {}
CBCMeleeAttackCmd(pas::ESeverity severity, const zeus::CVector3f& target) : CBodyStateCmd(EBodyStateCmd::MeleeAttack)
, x8_severity(severity), xc_targetPos(target), x18_hasTargetPos(true) {}
pas::ESeverity GetAttackSeverity() const { return x8_severity; } pas::ESeverity GetAttackSeverity() const { return x8_severity; }
bool HasAttackTargetPos() const { return x18_hasTargetPos; } bool HasAttackTargetPos() const { return x18_hasTargetPos; }
const zeus::CVector3f& GetAttackTargetPos() const { return xc_targetPos; } const zeus::CVector3f& GetAttackTargetPos() const { return xc_targetPos; }
@ -95,11 +97,16 @@ public:
x1c_24_targetTransform = false; x1c_24_targetTransform = false;
x1c_25_overrideAnim = false; x1c_25_overrideAnim = false;
} }
CBCGenerateCmd(pas::EGenerateType type, s32 animId = -1) CBCGenerateCmd(pas::EGenerateType type)
: CBodyStateCmd(EBodyStateCmd::Generate), x8_type(type), x18_animId(animId) { : CBodyStateCmd(EBodyStateCmd::Generate), x8_type(type) {
x1c_24_targetTransform = false; x1c_24_targetTransform = false;
x1c_25_overrideAnim = false; x1c_25_overrideAnim = false;
} }
CBCGenerateCmd(pas::EGenerateType type, s32 animId)
: CBodyStateCmd(EBodyStateCmd::Generate), x8_type(type), x18_animId(animId) {
x1c_24_targetTransform = false;
x1c_25_overrideAnim = animId != -1;
}
CBCGenerateCmd(pas::EGenerateType type, const zeus::CVector3f& vec, bool targetTransform = false, CBCGenerateCmd(pas::EGenerateType type, const zeus::CVector3f& vec, bool targetTransform = false,
bool overrideAnim = false) bool overrideAnim = false)
: CBodyStateCmd(EBodyStateCmd::Generate), x8_type(type), xc_targetPos(vec) { : CBodyStateCmd(EBodyStateCmd::Generate), x8_type(type), xc_targetPos(vec) {

View File

@ -88,7 +88,7 @@ enum class ELoopAttackType { Invalid = -1 };
enum class EGenerateType { Invalid = -1, Zero, One, Two, Three, Four }; enum class EGenerateType { Invalid = -1, Zero, One, Two, Three, Four };
enum class ESlideType { Invalid = -1 }; enum class ESlideType { Invalid = -1, Zero = 0 };
enum class ETauntType { Invalid = -1, Zero, One, Two }; enum class ETauntType { Invalid = -1, Zero, One, Two };

View File

@ -1602,6 +1602,8 @@ void CSamusHud::SetMessage(std::u16string_view text, const CHUDMemoParms& info)
x558_messageTextTime = info.GetDisplayTime(); x558_messageTextTime = info.GetDisplayTime();
if (info.IsHintMemo()) { if (info.IsHintMemo()) {
if (!isWidgetVisible) { if (!isWidgetVisible) {
x584_abuttonPulse = 0.f;
x560_messageTextScale = 0.f;
CSfxManager::SfxStart(SFXui_show_hint_memo, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(SFXui_show_hint_memo, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
} }
} else { } else {

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,10 @@
#pragma once #pragma once
#include "World/CPatterned.hpp" #include "World/CPatterned.hpp"
#include "World/CPathFindSearch.hpp"
#include "World/CDamageInfo.hpp"
namespace urde { namespace urde {
class CDamageInfo;
namespace MP1 { namespace MP1 {
class CBeetle : public CPatterned { class CBeetle : public CPatterned {
@ -11,14 +12,113 @@ public:
enum class EEntranceType : u32 { FacePlayer, UseOrientation }; enum class EEntranceType : u32 { FacePlayer, UseOrientation };
private: private:
s32 x568_stateProg = -1;
EEntranceType x56c_entranceType;
TUniqueId x570_aiMgr = kInvalidUniqueId;
zeus::CVector3f x574_tailAimReference;
float x580_f3;
CDamageInfo x584_touchDamage;
float x5a0_headbuttDist = FLT_MAX;
float x5a4_jumpBackwardDist = FLT_MAX;
float x5a8_animTimeRem = 0.f;
std::experimental::optional<CModelData> x5ac_tailModel;
CPathFindSearch x5fc_pathFindSearch;
rstl::reserved_vector<zeus::CVector3f, 8> x6e0_retreatPoints;
CDamageVulnerability x744_platingVuln;
CDamageVulnerability x7ac_tailVuln;
float x814_attackDelayTimer;
float x818_stateFinishTimer = FLT_MAX;
float x81c_ = x3b4_speed;
u32 x820_posDeviationCounter = 0;
zeus::CVector3f x824_predictPos;
float x830_intoGroundFactor = 1.f;
float x834_retreatTime;
union {
struct {
bool x838_24_hitSomething : 1;
bool x838_25_burrowing : 1;
bool x838_26_canSkid : 1;
};
u32 _dummy3 = 0;
};
void SquadAdd(CStateManager& mgr);
void SquadRemove(CStateManager& mgr);
void RefinePathFindDest(CStateManager& mgr, zeus::CVector3f& dest);
void SeparateFromMelees(CStateManager& mgr);
void SetupRetreatPoints(CStateManager& mgr);
s32 FindFurthestRetreatPoint(CStateManager& mgr) const;
public: public:
DEFINE_PATTERNED(Beetle) DEFINE_PATTERNED(Beetle)
CBeetle(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&, const CPatternedInfo&, CBeetle(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CPatterned::EFlavorType, EEntranceType, const CDamageInfo&, const CDamageVulnerability&, CModelData&& mData, const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor,
const zeus::CVector3f&, float, float, float, const CDamageVulnerability&, const CActorParameters&, CBeetle::EEntranceType entranceType, const CDamageInfo& touchDamage,
const std::experimental::optional<CStaticRes>); const CDamageVulnerability& platingVuln, const zeus::CVector3f& tailAimReference,
float initialAttackDelay, float retreatTime, float f3,
const CDamageVulnerability& tailVuln, const CActorParameters& aParams,
const std::experimental::optional<CStaticRes>& tailModel);
void Accept(IVisitor& visitor); void Accept(IVisitor& visitor);
void Think(float dt, CStateManager& mgr);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr);
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum);
void Render(const CStateManager& mgr) const;
const CDamageVulnerability* GetDamageVulnerability() const;
const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f& pos,
const zeus::CVector3f& dir,
const CDamageInfo& dInfo) const;
zeus::CVector3f GetOrbitPosition(const CStateManager&) const;
zeus::CVector3f GetAimPosition(const CStateManager& mgr, float) const;
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f& pos,
const zeus::CVector3f& dir,
const CWeaponMode& wMode,
EProjectileAttrib attribs) const;
void DoUserAnimEvent(CStateManager&, const CInt32POINode&, EUserEventType, float dt);
void CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager& mgr);
void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state);
void TakeDamage(const zeus::CVector3f& direction, float magnitude);
bool IsListening() const;
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
const zeus::CVector3f& aimPos) const;
void FollowPattern(CStateManager&, EStateMsg msg, float dt);
void PathFind(CStateManager& mgr, EStateMsg msg, float dt);
void TargetPlayer(CStateManager&, EStateMsg msg, float dt);
void Generate(CStateManager&, EStateMsg msg, float dt);
void Deactivate(CStateManager&, EStateMsg msg, float dt);
void Attack(CStateManager&, EStateMsg msg, float dt);
void JumpBack(CStateManager&, EStateMsg msg, float dt);
void DoubleSnap(CStateManager&, EStateMsg msg, float dt);
void Shuffle(CStateManager&, EStateMsg msg, float dt);
void TurnAround(CStateManager&, EStateMsg msg, float dt);
void Skid(CStateManager&, EStateMsg msg, float dt);
void Taunt(CStateManager&, EStateMsg msg, float dt);
void Retreat(CStateManager&, EStateMsg msg, float dt);
bool InAttackPosition(CStateManager&, float arg);
bool PathShagged(CStateManager&, float arg);
bool InRange(CStateManager&, float arg);
bool PatternOver(CStateManager&, float arg);
bool HasAttackPattern(CStateManager&, float arg);
bool AnimOver(CStateManager&, float arg);
bool ShouldAttack(CStateManager&, float arg);
bool ShouldDoubleSnap(CStateManager&, float arg);
bool ShouldTurn(CStateManager&, float arg);
bool HitSomething(CStateManager&, float arg);
bool ShouldJumpBack(CStateManager&, float arg);
bool Stuck(CStateManager&, float arg);
bool NoPathNodes(CStateManager&, float arg);
bool ShouldTaunt(CStateManager&, float arg);
bool ShotAt(CStateManager&, float arg);
void Burn(float duration, float damage);
void Shock(CStateManager& mgr, float duration, float damage);
CPathFindSearch* GetSearchPath();
float GetGravityConstant() const;
}; };
} // namespace MP1 } // namespace MP1
} // namespace urde } // namespace urde

View File

@ -485,12 +485,12 @@ bool CSpacePirate::ShouldFrenzy(CStateManager& mgr) {
return x63c_frenzyFrames >= 0; return x63c_frenzyFrames >= 0;
} }
void CSpacePirate::ResetTeamAiRole(CStateManager& mgr) { void CSpacePirate::SquadReset(CStateManager& mgr) {
CTeamAiMgr::ResetTeamAiRole(!x634_27_melee ? CTeamAiMgr::EAttackType::Projectile : CTeamAiMgr::EAttackType::Melee, CTeamAiMgr::ResetTeamAiRole(!x634_27_melee ? CTeamAiMgr::EAttackType::Projectile : CTeamAiMgr::EAttackType::Melee,
mgr, x8c8_teamAiMgrId, GetUniqueId(), true); mgr, x8c8_teamAiMgrId, GetUniqueId(), true);
} }
void CSpacePirate::AssignTeamAiRole(CStateManager& mgr) { void CSpacePirate::SquadAdd(CStateManager& mgr) {
if (x8c8_teamAiMgrId == kInvalidUniqueId) if (x8c8_teamAiMgrId == kInvalidUniqueId)
x8c8_teamAiMgrId = CTeamAiMgr::GetTeamAiMgr(*this, mgr); x8c8_teamAiMgrId = CTeamAiMgr::GetTeamAiMgr(*this, mgr);
if (x8c8_teamAiMgrId != kInvalidUniqueId) { if (x8c8_teamAiMgrId != kInvalidUniqueId) {
@ -502,7 +502,7 @@ void CSpacePirate::AssignTeamAiRole(CStateManager& mgr) {
} }
} }
void CSpacePirate::RemoveTeamAiRole(CStateManager& mgr) { void CSpacePirate::SquadRemove(CStateManager& mgr) {
if (x8c8_teamAiMgrId != kInvalidUniqueId) { if (x8c8_teamAiMgrId != kInvalidUniqueId) {
if (TCastToPtr<CTeamAiMgr> aimgr = mgr.ObjectById(x8c8_teamAiMgrId)) { if (TCastToPtr<CTeamAiMgr> aimgr = mgr.ObjectById(x8c8_teamAiMgrId)) {
if (aimgr->IsPartOfTeam(GetUniqueId())) { if (aimgr->IsPartOfTeam(GetUniqueId())) {
@ -611,7 +611,7 @@ void CSpacePirate::UpdateAttacks(float dt, CStateManager& mgr) {
} }
if (reset) if (reset)
ResetTeamAiRole(mgr); SquadReset(mgr);
xe7_31_targetable = CheckTargetable(mgr); xe7_31_targetable = CheckTargetable(mgr);
} }
@ -852,7 +852,7 @@ void CSpacePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, C
x638_31_mayStartAttack = true; x638_31_mayStartAttack = true;
else else
x400_24_hitByPlayerProjectile = true; x400_24_hitByPlayerProjectile = true;
AssignTeamAiRole(mgr); SquadAdd(mgr);
} else if (x634_25_ceilingAmbush) { } else if (x634_25_ceilingAmbush) {
RemoveMaterial(EMaterialTypes::GroundCollider, mgr); RemoveMaterial(EMaterialTypes::GroundCollider, mgr);
x328_27_onGround = false; x328_27_onGround = false;
@ -956,7 +956,7 @@ void CSpacePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, C
break; break;
case EScriptObjectMessage::Deactivate: case EScriptObjectMessage::Deactivate:
case EScriptObjectMessage::Deleted: case EScriptObjectMessage::Deleted:
RemoveTeamAiRole(mgr); SquadRemove(mgr);
mChargePlayerList.remove(GetUniqueId()); mChargePlayerList.remove(GetUniqueId());
break; break;
case EScriptObjectMessage::Start: case EScriptObjectMessage::Start:
@ -1137,7 +1137,8 @@ bool CSpacePirate::Listen(const zeus::CVector3f& pos, EListenNoiseType type) {
return ret; return ret;
} }
zeus::CVector3f CSpacePirate::GetOrigin(const CStateManager& mgr, const CTeamAiRole& role) const { zeus::CVector3f CSpacePirate::GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
const zeus::CVector3f& aimPos) const {
return GetTranslation(); return GetTranslation();
} }
@ -1220,7 +1221,7 @@ void CSpacePirate::Dead(CStateManager& mgr, EStateMsg msg, float dt) {
case EStateMsg::Activate: case EStateMsg::Activate:
x764_boneTracking.SetActive(false); x764_boneTracking.SetActive(false);
SetEyeParticleActive(mgr, false); SetEyeParticleActive(mgr, false);
ResetTeamAiRole(mgr); SquadReset(mgr);
break; break;
case EStateMsg::Update: case EStateMsg::Update:
if (x450_bodyController->GetCurrentStateId() == pas::EAnimationState::Death) { if (x450_bodyController->GetCurrentStateId() == pas::EAnimationState::Death) {
@ -1773,7 +1774,7 @@ void CSpacePirate::GetUp(CStateManager& mgr, EStateMsg msg, float dt) {
switch (msg) { switch (msg) {
case EStateMsg::Activate: case EStateMsg::Activate:
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
ResetTeamAiRole(mgr); SquadReset(mgr);
x8dc_leashTimer = 0.f; x8dc_leashTimer = 0.f;
break; break;
case EStateMsg::Update: case EStateMsg::Update:

View File

@ -221,9 +221,9 @@ private:
void UpdateCloak(float dt, CStateManager& mgr); void UpdateCloak(float dt, CStateManager& mgr);
bool ShouldFrenzy(CStateManager& mgr); bool ShouldFrenzy(CStateManager& mgr);
void ResetTeamAiRole(CStateManager& mgr); void SquadReset(CStateManager& mgr);
void AssignTeamAiRole(CStateManager& mgr); void SquadAdd(CStateManager& mgr);
void RemoveTeamAiRole(CStateManager& mgr); void SquadRemove(CStateManager& mgr);
bool CheckTargetable(CStateManager& mgr); bool CheckTargetable(CStateManager& mgr);
bool FireProjectile(float dt, CStateManager& mgr); bool FireProjectile(float dt, CStateManager& mgr);
void UpdateAttacks(float dt, CStateManager& mgr); void UpdateAttacks(float dt, CStateManager& mgr);
@ -263,7 +263,8 @@ public:
float magnitude); float magnitude);
bool IsListening() const; bool IsListening() const;
bool Listen(const zeus::CVector3f&, EListenNoiseType); bool Listen(const zeus::CVector3f&, EListenNoiseType);
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role) const; zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
const zeus::CVector3f& aimPos) const;
void DetachActorFromPirate() { x7b4_attachedActor = kInvalidUniqueId; } void DetachActorFromPirate() { x7b4_attachedActor = kInvalidUniqueId; }
bool AttachActorToPirate(TUniqueId id); bool AttachActorToPirate(TUniqueId id);
void SetAttackTarget(TUniqueId id); void SetAttackTarget(TUniqueId id);

View File

@ -53,7 +53,8 @@ public:
const CWeaponMode&, EProjectileAttrib) const; const CWeaponMode&, EProjectileAttrib) const;
void FluidFXThink(EFluidState, CScriptWater&, CStateManager&); void FluidFXThink(EFluidState, CScriptWater&, CStateManager&);
virtual zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role) const { virtual zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
const zeus::CVector3f& aimPos) const {
return x34_transform.origin; return x34_transform.origin;
} }
virtual void Patrol(CStateManager&, EStateMsg, float) {} virtual void Patrol(CStateManager&, EStateMsg, float) {}

View File

@ -64,6 +64,6 @@ public:
static const CDamageVulnerability& NormalVulnerabilty() { return sNormalVulnerability; } static const CDamageVulnerability& NormalVulnerabilty() { return sNormalVulnerability; }
static const CDamageVulnerability& ImmuneVulnerabilty() { return sImmuneVulnerability; } static const CDamageVulnerability& ImmuneVulnerabilty() { return sImmuneVulnerability; }
static const CDamageVulnerability& ReflectVulnerabilty() { return sReflectVulnerability; } static const CDamageVulnerability& ReflectVulnerabilty() { return sReflectVulnerability; }
static const CDamageVulnerability& PasshThroughVulnerabilty() { return sPassThroughVulnerability; } static const CDamageVulnerability& PassThroughVulnerabilty() { return sPassThroughVulnerability; }
}; };
} // namespace urde } // namespace urde

View File

@ -183,6 +183,11 @@ void CPatterned::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CState
} }
} }
void CPatterned::MakeThermalColdAndHot() {
x403_24_keepThermalVisorState = true;
xe6_27_thermalVisorFlags = 3;
}
void CPatterned::UpdateThermalFrozenState(bool thawed) { void CPatterned::UpdateThermalFrozenState(bool thawed) {
x402_31_thawed = thawed; x402_31_thawed = thawed;
if (x403_24_keepThermalVisorState) if (x403_24_keepThermalVisorState)
@ -243,7 +248,7 @@ void CPatterned::Think(float dt, CStateManager& mgr) {
if (x460_knockBackController.x81_26_enableShock) { if (x460_knockBackController.x81_26_enableShock) {
/* Shock on logical falling edge */ /* Shock on logical falling edge */
if (!x401_31_nextPendingShock && x402_24_pendingShock) if (!x401_31_nextPendingShock && x402_24_pendingShock)
Shock(0.5f + mgr.GetActiveRandom()->Range(0.f, 0.5f), 0.2f); Shock(mgr, 0.5f + mgr.GetActiveRandom()->Range(0.f, 0.5f), 0.2f);
x402_24_pendingShock = x401_31_nextPendingShock; x402_24_pendingShock = x401_31_nextPendingShock;
x401_31_nextPendingShock = false; x401_31_nextPendingShock = false;
@ -437,7 +442,7 @@ void CPatterned::KnockBack(const zeus::CVector3f& backVec, CStateManager& mgr, c
PhazeOut(mgr); PhazeOut(mgr);
break; break;
case EKnockBackAnimationFollowUp::Shock: case EKnockBackAnimationFollowUp::Shock:
Shock(x460_knockBackController.GetActiveParms().x8_followupDuration, -1.f); Shock(mgr, x460_knockBackController.GetActiveParms().x8_followupDuration, -1.f);
break; break;
case EKnockBackAnimationFollowUp::Burn: case EKnockBackAnimationFollowUp::Burn:
Burn(x460_knockBackController.GetActiveParms().x8_followupDuration, 0.25f); Burn(x460_knockBackController.GetActiveParms().x8_followupDuration, 0.25f);
@ -967,7 +972,7 @@ void CPatterned::Burn(float duration, float damage) {
} }
} }
void CPatterned::Shock(float duration, float damage) { void CPatterned::Shock(CStateManager& mgr, float duration, float damage) {
switch (GetDamageVulnerability()->GetVulnerability(CWeaponMode(EWeaponType::Wave), false)) { switch (GetDamageVulnerability()->GetVulnerability(CWeaponMode(EWeaponType::Wave), false)) {
case EVulnerability::Weak: case EVulnerability::Weak:
x450_bodyController->SetElectrocuting(1.5f * duration); x450_bodyController->SetElectrocuting(1.5f * duration);

View File

@ -64,7 +64,7 @@ public:
WarWasp = 39, WarWasp = 39,
EnergyBall = 40 EnergyBall = 40
}; };
enum class EFlavorType { Zero = 0, One = 1 }; enum class EFlavorType { Zero = 0, One = 1, Two = 2 };
enum class EMovementType { Ground = 0, Flyer = 1 }; enum class EMovementType { Ground = 0, Flyer = 1 };
enum class EColliderType { Zero = 0, One = 1 }; enum class EColliderType { Zero = 0, One = 1 };
enum class EPatternTranslate { RelativeStart, RelativePlayerStart, RelativePlayer, Absolute }; enum class EPatternTranslate { RelativeStart, RelativePlayerStart, RelativePlayer, Absolute };
@ -231,6 +231,7 @@ protected:
std::experimental::optional<TLockedToken<CGenDescription>> x54c_iceDeathExplosionParticle; std::experimental::optional<TLockedToken<CGenDescription>> x54c_iceDeathExplosionParticle;
zeus::CVector3f x55c_moveScale = zeus::CVector3f::skOne; zeus::CVector3f x55c_moveScale = zeus::CVector3f::skOne;
void MakeThermalColdAndHot();
void UpdateThermalFrozenState(bool thawed); void UpdateThermalFrozenState(bool thawed);
void GenerateIceDeathExplosion(CStateManager& mgr); void GenerateIceDeathExplosion(CStateManager& mgr);
void GenerateDeathExplosion(CStateManager& mgr); void GenerateDeathExplosion(CStateManager& mgr);
@ -334,8 +335,8 @@ public:
virtual bool KnockbackWhenFrozen() const { return true; } virtual bool KnockbackWhenFrozen() const { return true; }
virtual void MassiveDeath(CStateManager& mgr); virtual void MassiveDeath(CStateManager& mgr);
virtual void MassiveFrozenDeath(CStateManager& mgr); virtual void MassiveFrozenDeath(CStateManager& mgr);
virtual void Burn(float, float); virtual void Burn(float duration, float damage);
virtual void Shock(float, float); virtual void Shock(CStateManager& mgr, float duration, float damage);
virtual void Freeze(CStateManager& mgr, const zeus::CVector3f& pos, const zeus::CUnitVector3f& dir, float frozenDur); virtual void Freeze(CStateManager& mgr, const zeus::CVector3f& pos, const zeus::CUnitVector3f& dir, float frozenDur);
virtual void ThinkAboutMove(float); virtual void ThinkAboutMove(float);
virtual CPathFindSearch* GetSearchPath() { return nullptr; } virtual CPathFindSearch* GetSearchPath() { return nullptr; }

View File

@ -131,7 +131,7 @@ void CTeamAiMgr::PositionTeam(CStateManager& mgr) {
default: default:
for (auto& role : x58_roles) for (auto& role : x58_roles)
if (TCastToPtr<CAi> ai = mgr.ObjectById(role.GetOwnerId())) if (TCastToPtr<CAi> ai = mgr.ObjectById(role.GetOwnerId()))
role.x1c_position = ai->GetOrigin(mgr, role); role.x1c_position = ai->GetOrigin(mgr, role, aimPos);
break; break;
} }
} }

View File

@ -74,14 +74,6 @@ private:
void UpdateRoles(CStateManager& mgr); void UpdateRoles(CStateManager& mgr);
void SpacingSort(CStateManager& mgr, const zeus::CVector3f& pos); void SpacingSort(CStateManager& mgr, const zeus::CVector3f& pos);
void PositionTeam(CStateManager& mgr); void PositionTeam(CStateManager& mgr);
bool IsMeleeAttacker(TUniqueId aiId) const;
bool CanAcceptMeleeAttacker(TUniqueId aiId) const;
bool AddMeleeAttacker(TUniqueId aiId);
void RemoveMeleeAttacker(TUniqueId aiId);
bool IsProjectileAttacker(TUniqueId aiId) const;
bool CanAcceptProjectileAttacker(TUniqueId aiId) const;
bool AddProjectileAttacker(TUniqueId aiId);
void RemoveProjectileAttacker(TUniqueId aiId);
public: public:
CTeamAiMgr(TUniqueId uid, std::string_view name, const CEntityInfo& info, const CTeamAiData& data); CTeamAiMgr(TUniqueId uid, std::string_view name, const CEntityInfo& info, const CTeamAiData& data);
@ -99,6 +91,15 @@ public:
s32 GetNumAssignedOfRole(CTeamAiRole::ETeamAiRole role) const; s32 GetNumAssignedOfRole(CTeamAiRole::ETeamAiRole role) const;
s32 GetNumAssignedAiRoles() const; s32 GetNumAssignedAiRoles() const;
bool IsMeleeAttacker(TUniqueId aiId) const;
bool CanAcceptMeleeAttacker(TUniqueId aiId) const;
bool AddMeleeAttacker(TUniqueId aiId);
void RemoveMeleeAttacker(TUniqueId aiId);
bool IsProjectileAttacker(TUniqueId aiId) const;
bool CanAcceptProjectileAttacker(TUniqueId aiId) const;
bool AddProjectileAttacker(TUniqueId aiId);
void RemoveProjectileAttacker(TUniqueId aiId);
static CTeamAiRole* GetTeamAiRole(CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId); static CTeamAiRole* GetTeamAiRole(CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId);
static void ResetTeamAiRole(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId, bool clearRole); static void ResetTeamAiRole(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId, bool clearRole);
static bool CanAcceptAttacker(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId); static bool CanAcceptAttacker(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId);

View File

@ -978,29 +978,30 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int prop
CPatternedInfo pInfo(in, pcount.second); CPatternedInfo pInfo(in, pcount.second);
CActorParameters aParams = LoadActorParameters(in); CActorParameters aParams = LoadActorParameters(in);
CDamageInfo dInfo(in); CDamageInfo touchDamage(in);
zeus::CVector3f v1 = zeus::CVector3f::ReadBig(in); zeus::CVector3f tailAimReference = zeus::CVector3f::ReadBig(in);
float f1 = in.readFloatBig(); float unused = in.readFloatBig();
CDamageVulnerability dVuln1(in); CDamageVulnerability tailVuln(in);
CDamageVulnerability dVuln2(in); CDamageVulnerability platingVuln(in);
CAssetId abdomen = in.readUint32Big(); CAssetId tailModel = in.readUint32Big();
MP1::CBeetle::EEntranceType entrance = MP1::CBeetle::EEntranceType(in.readUint32Big()); MP1::CBeetle::EEntranceType entranceType = MP1::CBeetle::EEntranceType(in.readUint32Big());
float f2 = in.readFloatBig(); float initialAttackDelay = in.readFloatBig();
float f3 = in.readFloatBig(); float retreatTime = in.readFloatBig();
FourCC animType = g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()); FourCC animType = g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile());
if (animType != SBIG('ANCS')) if (animType != SBIG('ANCS'))
return nullptr; return nullptr;
std::experimental::optional<CStaticRes> abdomenRes; std::experimental::optional<CStaticRes> tailRes;
if (flavor == CPatterned::EFlavorType::One) if (flavor == CPatterned::EFlavorType::One)
abdomenRes.emplace(CStaticRes(abdomen, scale)); tailRes.emplace(CStaticRes(tailModel, scale));
const CAnimationParameters& animParams = pInfo.GetAnimationParameters(); const CAnimationParameters& animParams = pInfo.GetAnimationParameters();
CAnimRes animRes(animParams.GetACSFile(), animParams.GetCharacter(), scale, animParams.GetInitialAnimation(), true); CAnimRes animRes(animParams.GetACSFile(), animParams.GetCharacter(), scale, animParams.GetInitialAnimation(), true);
return new MP1::CBeetle(mgr.AllocateUniqueId(), name, info, xfrm, animRes, pInfo, flavor, entrance, dInfo, dVuln2, v1, return new MP1::CBeetle(mgr.AllocateUniqueId(), name, info, xfrm, animRes, pInfo, flavor, entranceType, touchDamage,
f2, f3, f1, dVuln1, aParams, abdomenRes); platingVuln, tailAimReference, initialAttackDelay, retreatTime, unused, tailVuln, aParams,
tailRes);
} }
CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {

View File

@ -1,6 +1,14 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17 cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
set(BUILD_TESTING OFF)
add_subdirectory(tinyxml2) set(TINYXML_LIB_VERSION "5.0.1")
set(TINYXML_LIB_SOVERSION "5")
add_library(tinyxml2_static STATIC tinyxml2/tinyxml2.cpp tinyxml2/tinyxml2.h)
set_target_properties(tinyxml2_static PROPERTIES
COMPILE_DEFINITONS "TINYXML2_EXPORT"
VERSION "${TINYXML_LIB_VERSION}"
SOVERSION "${TINYXML_LIB_SOVERSION}")
set_target_properties( tinyxml2_static PROPERTIES OUTPUT_NAME tinyxml2 )
add_executable(assetnameparser "main.cpp") add_executable(assetnameparser "main.cpp")
include_directories(${LOGVISOR_INCLUDE_DIR}) include_directories(${LOGVISOR_INCLUDE_DIR})

2
hecl

@ -1 +1 @@
Subproject commit 88299f0e7bdcd60797d9788c440d940f225333ea Subproject commit cdba678eee605cf0aff96f1276bc3593fca0de2b