CMagdolite: Fix lock-on, retreat & loader

This commit is contained in:
Luke Street 2020-04-21 04:46:07 -04:00
parent b4dad2adf5
commit 449d8409d8
3 changed files with 18 additions and 18 deletions

View File

@ -76,28 +76,30 @@ void CMagdolite::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CState
case EScriptObjectMessage::Damage:
case EScriptObjectMessage::InvulnDamage:
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(uid)) {
if (proj->GetOwnerId() == mgr.GetPlayer().GetUniqueId() &&
(GetBodyController()->GetPercentageFrozen() <= 0.f ||
x5bc_.GetVulnerability(proj->GetDamageInfo().GetWeaponMode(), false) == EVulnerability::Deflect)) {
if (x70c_curHealth - HealthInfo(mgr)->GetHP() <= x574_minHp &&
x624_.GetVulnerability(proj->GetDamageInfo().GetWeaponMode(), false) != EVulnerability::Deflect) {
x400_24_hitByPlayerProjectile = true;
} else {
x70c_curHealth = HealthInfo(mgr)->GetHP();
x754_24_retreat = true;
if (proj->GetOwnerId() == mgr.GetPlayer().GetUniqueId()) {
if (GetBodyController()->GetPercentageFrozen() <= 0.f ||
x5bc_.GetVulnerability(proj->GetDamageInfo().GetWeaponMode(), false) == EVulnerability::Deflect) {
float hp = HealthInfo(mgr)->GetHP();
if (x70c_curHealth - hp <= x574_minHp) {
if (x624_.GetVulnerability(proj->GetDamageInfo().GetWeaponMode(), false) != EVulnerability::Deflect) {
x400_24_hitByPlayerProjectile = true;
}
} else {
x70c_curHealth = hp;
x754_24_retreat = true;
}
} else if (x400_24_hitByPlayerProjectile) {
x754_26_lostMyHead = true;
x401_30_pendingDeath = true;
}
} else if (x400_24_hitByPlayerProjectile) {
x754_26_lostMyHead = true;
x401_30_pendingDeath = true;
}
}
return;
case EScriptObjectMessage::SuspendedMove: {
case EScriptObjectMessage::SuspendedMove:
if (x580_collisionManager) {
x580_collisionManager->SetMovable(mgr, false);
}
break;
}
case EScriptObjectMessage::Registered: {
x450_bodyController->Activate(mgr);
RemoveMaterial(EMaterialTypes::Solid, mgr);
@ -249,7 +251,7 @@ void CMagdolite::Think(float dt, CStateManager& mgr) {
}
x580_collisionManager->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
zeus::CTransform headXf = GetLocatorTransform("head"sv);
MoveCollisionPrimitive(headXf.rotate(GetModelData()->GetScale() * headXf.origin));
MoveCollisionPrimitive(GetTransform().rotate(GetModelData()->GetScale() * headXf.origin));
xe4_27_notInSortedLists = true;
}

View File

@ -65,8 +65,6 @@ void CStateMachineState::Update(CStateManager& mgr, CAi& ai, float delta) {
if (x4_state) {
x8_time += delta;
x4_state->CallFunc(mgr, ai, EStateMsg::Update, delta);
fmt::print(FMT_STRING("Update: {} {} {} - {} {}\n"), ai.GetUniqueId(), ai.GetEditorId(), ai.GetName(),
x4_state->xc_name, int(x4_state - x0_machine->GetStateVector().data()));
for (int i = 0; i < x4_state->GetNumTriggers(); ++i) {
CAiTrigger* trig = x4_state->GetTrig(i);
CAiState* state = nullptr;

View File

@ -3032,7 +3032,7 @@ CEntity* ScriptLoader::LoadMagdolite(CStateManager& mgr, CInputStream& in, int p
return new MP1::CMagdolite(mgr.AllocateUniqueId(), actorHead.x0_name, info, actorHead.x10_transform,
std::move(modelData), pInfo, actorParameters, f1, f2, damageInfo1, damageInfo2,
damageVulnerability1, damageVulnerability2, modelId, skinId, f3, f4, f5, f6, flameInfo, f7,
damageVulnerability1, damageVulnerability2, modelId, skinId, f6, f3, f4, f5, flameInfo, f7,
f8, f9);
}