mirror of https://github.com/AxioDL/metaforce.git
CRidley: Various fixes, now you can kick the dragon's ass
This commit is contained in:
parent
6e3370d90f
commit
47d767c441
|
@ -371,7 +371,7 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
||||||
case EScriptObjectMessage::Reset: {
|
case EScriptObjectMessage::Reset: {
|
||||||
xa34_26_ = true;
|
xa34_26_ = true;
|
||||||
if (!GetActive()) {
|
if (!GetActive()) {
|
||||||
AcceptScriptMsg(EScriptObjectMessage::Activate, uid, mgr);
|
CPatterned::AcceptScriptMsg(EScriptObjectMessage::Activate, uid, mgr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -432,19 +432,17 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
||||||
xb24_ = 0.33f;
|
xb24_ = 0.33f;
|
||||||
x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f);
|
x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f);
|
||||||
if (xb10_ > 0.f) {
|
if (xb10_ > 0.f) {
|
||||||
if (xb10_ >= xcbc_) {
|
if (xb10_ >= xcbc_&& xa33_26_ && !xa31_31_ && lowHealth > x568_data.x3f4_) {
|
||||||
if (xa33_26_ && !xa31_31_ && lowHealth > x568_data.x3f4_) {
|
|
||||||
dontKnockback = true;
|
dontKnockback = true;
|
||||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||||
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Zero));
|
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Zero));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
xa32_27_ = true;
|
xa32_27_ = true;
|
||||||
dontKnockback = true;
|
dontKnockback = true;
|
||||||
xcb0_ += 1;
|
xcb0_ += 1;
|
||||||
xcb0_ = xcb0_ < 5 ? xcb0_ : 4;
|
xcb0_ = xcb0_ < 5 ? xcb0_ : 4;
|
||||||
r26 = true;
|
r26 = true;
|
||||||
xcbc_ = .2f * (5 - (xcb0_ + 1)) * xcb8_;
|
xcbc_ = .2f * float(5 - (xcb0_ + 1)) * xcb8_;
|
||||||
xcb4_ = 0;
|
xcb4_ = 0;
|
||||||
xcc8_ = 2.f * 0.33f;
|
xcc8_ = 2.f * 0.33f;
|
||||||
}
|
}
|
||||||
|
@ -480,8 +478,9 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
||||||
if (xa32_29_) {
|
if (xa32_29_) {
|
||||||
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(colAct->GetLastTouchedObject())) {
|
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(colAct->GetLastTouchedObject())) {
|
||||||
CWeaponMode wMode = proj->GetDamageInfo().GetWeaponMode();
|
CWeaponMode wMode = proj->GetDamageInfo().GetWeaponMode();
|
||||||
if (!wMode.IsCharged() && !wMode.IsComboed() && wMode.GetType() == EWeaponType::Missile)
|
if (wMode.IsCharged() || wMode.IsComboed() || wMode.GetType() == EWeaponType::Missile) {
|
||||||
xb14_ = 0.f;
|
xb14_ = 0.f;
|
||||||
|
}
|
||||||
xb14_ -= lowHealth;
|
xb14_ -= lowHealth;
|
||||||
xb24_ = 0.33f;
|
xb24_ = 0.33f;
|
||||||
x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f);
|
x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f);
|
||||||
|
@ -506,18 +505,18 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
||||||
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Six));
|
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Six));
|
||||||
xcbc_ -= (0.333f * x568_data.x3c_);
|
xcbc_ -= (0.333f * x568_data.x3c_);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
xb1c_ -= lowHealth;
|
||||||
xb1c_ -= lowHealth;
|
if (xb1c_ <= 0.f) {
|
||||||
if (xb1c_ <= 0.f) {
|
x401_30_pendingDeath = true;
|
||||||
x401_30_pendingDeath = true;
|
mgr.GetPlayer().SetIsOverrideRadarRadius(false);
|
||||||
mgr.GetPlayer().SetIsOverrideRadarRadius(false);
|
xb1c_ = 0.f;
|
||||||
xb1c_ = 0.f;
|
} else if (xb1c_ < xcbc_) {
|
||||||
} else if (xb1c_ < xcbc_) {
|
dontKnockback = true;
|
||||||
dontKnockback = true;
|
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Six));
|
||||||
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Six));
|
xcbc_ -= (0.333f * x568_data.x40_);
|
||||||
xcbc_ -= (0.333f * x568_data.x40_);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -581,11 +580,12 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // namespace urde::MP1
|
}
|
||||||
|
|
||||||
void CRidley::Think(float dt, CStateManager& mgr) {
|
void CRidley::Think(float dt, CStateManager& mgr) {
|
||||||
if (!GetActive())
|
if (!GetActive()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sub802560d0(dt);
|
sub802560d0(dt);
|
||||||
CPatterned::Think(dt, mgr);
|
CPatterned::Think(dt, mgr);
|
||||||
|
@ -613,10 +613,11 @@ void CRidley::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
|
||||||
|
|
||||||
CPlayerState::EPlayerVisor r28 = mgr.GetPlayerState()->GetActiveVisor(mgr);
|
CPlayerState::EPlayerVisor r28 = mgr.GetPlayerState()->GetActiveVisor(mgr);
|
||||||
bool atLastMat = GetModelData()->GetNumMaterialSets() == (matSet + 1);
|
bool atLastMat = GetModelData()->GetNumMaterialSets() == (matSet + 1);
|
||||||
if (r28 == CPlayerState::EPlayerVisor::Thermal && atLastMat)
|
if (r28 == CPlayerState::EPlayerVisor::Thermal && atLastMat) {
|
||||||
xb4_drawFlags.x2_flags |= 0x40;
|
xb4_drawFlags.x2_flags |= 0x40;
|
||||||
else
|
} else {
|
||||||
xb4_drawFlags.x2_flags &= 0x40;
|
xb4_drawFlags.x2_flags &= 0x40;
|
||||||
|
}
|
||||||
xb4_drawFlags.x1_matSetIdx = matSet;
|
xb4_drawFlags.x1_matSetIdx = matSet;
|
||||||
|
|
||||||
if (xa33_27_) {
|
if (xa33_27_) {
|
||||||
|
@ -674,21 +675,24 @@ void CRidley::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) {
|
||||||
void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
|
void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EUserEventType::Projectile: {
|
case EUserEventType::Projectile: {
|
||||||
if (xc64_aiStage != 2)
|
if (xc64_aiStage != 2) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!xc14_.Token().IsLoaded()) {
|
if (!xc14_.Token().IsLoaded()) {
|
||||||
xc14_.Token().GetObj();
|
xc14_.Token().GetObj();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 9))
|
if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 9)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
zeus::CTransform xf = GetLctrTransform(xa30_breastPlateSegId) * zeus::CTransform::RotateX(zeus::degToRad(-90.f));
|
zeus::CTransform xf = GetLctrTransform(xa30_breastPlateSegId) * zeus::CTransform::RotateX(zeus::degToRad(-90.f));
|
||||||
xf = xf * zeus::CTransform::RotateY(
|
xf = xf * zeus::CTransform::RotateY(
|
||||||
std::atan2(mgr.GetActiveRandom()->Range(-1.f, 1.f), mgr.GetActiveRandom()->Range(-1.f, 1.f)));
|
std::atan2(mgr.GetActiveRandom()->Range(-1.f, 1.f), mgr.GetActiveRandom()->Range(-1.f, 1.f)));
|
||||||
xf.origin = xf * zeus::CVector3f(0.f, 1.f, 1.f);
|
xf.origin = xf * zeus::CVector3f(0.f, 1.f, 1.f);
|
||||||
CEnergyProjectile* proj =
|
auto* proj =
|
||||||
new CEnergyProjectile(true, xc14_.Token(), EWeaponType::AI, xf, EMaterialTypes::Character, xc14_.GetDamage(),
|
new CEnergyProjectile(true, xc14_.Token(), EWeaponType::AI, xf, EMaterialTypes::Character, xc14_.GetDamage(),
|
||||||
mgr.AllocateUniqueId(), GetAreaIdAlways(), GetUniqueId(), mgr.GetPlayer().GetUniqueId(),
|
mgr.AllocateUniqueId(), GetAreaIdAlways(), GetUniqueId(), mgr.GetPlayer().GetUniqueId(),
|
||||||
EProjectileAttrib::None, false, zeus::skOne3f, {}, -1, false);
|
EProjectileAttrib::None, false, zeus::skOne3f, {}, -1, false);
|
||||||
|
@ -703,14 +707,15 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 8))
|
if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 8)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
zeus::CVector3f vec =
|
zeus::CVector3f vec =
|
||||||
zeus::CVector3f(mgr.GetActiveRandom()->Range(-1.f, 1.f), 1.f, mgr.GetActiveRandom()->Range(-1.f, 1.f));
|
zeus::CVector3f(mgr.GetActiveRandom()->Range(-1.f, 1.f), 1.f, mgr.GetActiveRandom()->Range(-1.f, 1.f));
|
||||||
vec = GetLctrTransform(xa30_breastPlateSegId) * vec;
|
vec = GetLctrTransform(xa30_breastPlateSegId) * vec;
|
||||||
|
|
||||||
CEnergyProjectile* proj = new CEnergyProjectile(
|
auto* proj = new CEnergyProjectile(
|
||||||
true, xc3c_.Token(), EWeaponType::AI, zeus::lookAt(vec + mgr.GetPlayer().GetTranslation(), vec),
|
true, xc3c_.Token(), EWeaponType::AI, zeus::lookAt(vec + mgr.GetPlayer().GetTranslation(), vec),
|
||||||
EMaterialTypes::Character, xc3c_.GetDamage(), mgr.AllocateUniqueId(), GetAreaIdAlways(), GetUniqueId(),
|
EMaterialTypes::Character, xc3c_.GetDamage(), mgr.AllocateUniqueId(), GetAreaIdAlways(), GetUniqueId(),
|
||||||
mgr.GetPlayer().GetUniqueId(), EProjectileAttrib::None, false, zeus::skOne3f, {}, -1, false);
|
mgr.GetPlayer().GetUniqueId(), EProjectileAttrib::None, false, zeus::skOne3f, {}, -1, false);
|
||||||
|
@ -725,16 +730,18 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
||||||
case EUserEventType::DamageOn: {
|
case EUserEventType::DamageOn: {
|
||||||
if (xc64_aiStage == 3) {
|
if (xc64_aiStage == 3) {
|
||||||
sub8025784c(mgr);
|
sub8025784c(mgr);
|
||||||
} else if (xc64_aiStage == 2)
|
} else if (xc64_aiStage == 2) {
|
||||||
xa33_28_ = false;
|
xa33_28_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EUserEventType::DamageOff: {
|
case EUserEventType::DamageOff: {
|
||||||
if (xc64_aiStage == 3) {
|
if (xc64_aiStage == 3) {
|
||||||
sub80257650(mgr);
|
sub80257650(mgr);
|
||||||
} else if (xc64_aiStage == 2 && !xa33_31_)
|
} else if (xc64_aiStage == 2 && !xa33_31_) {
|
||||||
xa33_28_ = true;
|
xa33_28_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -749,18 +756,21 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EUserEventType::ScreenShake: {
|
case EUserEventType::ScreenShake: {
|
||||||
if ((mgr.GetPlayer().GetTranslation() - GetTranslation()).magnitude() >= x568_data.x388_)
|
if ((mgr.GetPlayer().GetTranslation() - GetTranslation()).magnitude() >= x568_data.x388_) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x568_data.x298_,
|
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x568_data.x298_,
|
||||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EUserEventType::BeginAction: {
|
case EUserEventType::BeginAction: {
|
||||||
if (xa32_25_ && !xa31_29_)
|
if (xa32_25_ && !xa31_29_) {
|
||||||
FirePlasma(mgr);
|
FirePlasma(mgr);
|
||||||
|
}
|
||||||
|
|
||||||
if (!xa31_31_ || !xa32_26_)
|
if (!xa31_31_ || !xa32_26_) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
xbf0_ = xa84_.basis[0];
|
xbf0_ = xa84_.basis[0];
|
||||||
zeus::CVector3f ourPos = GetTranslation();
|
zeus::CVector3f ourPos = GetTranslation();
|
||||||
|
@ -773,8 +783,9 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EUserEventType::EndAction: {
|
case EUserEventType::EndAction: {
|
||||||
if (xa31_29_)
|
if (xa31_29_) {
|
||||||
ResetPlasmaProjectile(mgr, false);
|
ResetPlasmaProjectile(mgr, false);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EUserEventType::IkLock: {
|
case EUserEventType::IkLock: {
|
||||||
|
@ -794,8 +805,9 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EUserEventType::SoundPlay: {
|
case EUserEventType::SoundPlay: {
|
||||||
if (xa32_25_)
|
if (xa32_25_) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
xcac_ = CSfxManager::AddEmitter({GetTranslation(), {}, 1000.f, 0.1f, 1, x568_data.x294_, 127, 63, false, 127}, true,
|
xcac_ = CSfxManager::AddEmitter({GetTranslation(), {}, 1000.f, 0.1f, 1, x568_data.x294_, 127, 63, false, 127}, true,
|
||||||
-1, false, kInvalidAreaId);
|
-1, false, kInvalidAreaId);
|
||||||
|
@ -860,7 +872,7 @@ void CRidley::FirePlasma(urde::CStateManager& mgr) {
|
||||||
false, EProjectileAttrib::KeepInCinematic));
|
false, EProjectileAttrib::KeepInCinematic));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CPlasmaProjectile* proj = static_cast<CPlasmaProjectile*>(mgr.ObjectById(xb64_plasmaProjectile))) {
|
if (auto* proj = static_cast<CPlasmaProjectile*>(mgr.ObjectById(xb64_plasmaProjectile))) {
|
||||||
proj->Fire(GetLctrTransform(xb91_mouthSegId), mgr, false);
|
proj->Fire(GetLctrTransform(xb91_mouthSegId), mgr, false);
|
||||||
if (!xca8_) {
|
if (!xca8_) {
|
||||||
xca8_ = CSfxManager::AddEmitter({GetTranslation(), {}, 1000.f, 0.1f, 1, x568_data.xa8_, 127, 63, false, 127},
|
xca8_ = CSfxManager::AddEmitter({GetTranslation(), {}, 1000.f, 0.1f, 1, x568_data.xa8_, 127, 63, false, 127},
|
||||||
|
@ -903,8 +915,9 @@ void CRidley::sub802560d0(float dt) {
|
||||||
} else if (xaec_.isMagnitudeSafe()) {
|
} else if (xaec_.isMagnitudeSafe()) {
|
||||||
const float mag = xaec_.magnitude();
|
const float mag = xaec_.magnitude();
|
||||||
float magScale = 0.2f;
|
float magScale = 0.2f;
|
||||||
if (xaf8_.magSquared() == 0.f)
|
if (xaf8_.magSquared() == 0.f) {
|
||||||
magScale *= 3.f;
|
magScale *= 3.f;
|
||||||
|
}
|
||||||
xaec_ = -((zeus::clamp(0.f, dt * (magScale * mag), 0.5f) * mag) - mag) * ((1.f / mag) * xaec_);
|
xaec_ = -((zeus::clamp(0.f, dt * (magScale * mag), 0.5f) * mag) - mag) * ((1.f / mag) * xaec_);
|
||||||
ApplyImpulseWR(GetMass() * xaec_, {});
|
ApplyImpulseWR(GetMass() * xaec_, {});
|
||||||
}
|
}
|
||||||
|
@ -917,18 +930,19 @@ void CRidley::sub802563a8(float dt) {
|
||||||
zeus::CVector3f posDiff = GetTranslation() - xa84_.origin;
|
zeus::CVector3f posDiff = GetTranslation() - xa84_.origin;
|
||||||
float mag = posDiff.magnitude();
|
float mag = posDiff.magnitude();
|
||||||
posDiff *= zeus::CVector3f(1.f / mag);
|
posDiff *= zeus::CVector3f(1.f / mag);
|
||||||
if (xab4_ + -6.f * zeus::clamp(-1.f, posDiff.dot(xa84_.basis[1]), 0.f) < mag)
|
if (xab4_ + -6.f * zeus::clamp(-1.f, posDiff.dot(xa84_.basis[1]), 0.f) < mag && GetVelocity().dot(posDiff) > 0.f) {
|
||||||
if (GetVelocity().dot(posDiff) > 0.f)
|
Stop();
|
||||||
Stop();
|
}
|
||||||
|
|
||||||
MoveToInOneFrameWR(GetTranslation() - posDiff, dt);
|
MoveToInOneFrameWR(GetTranslation() - posDiff, dt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRidley::sub80256b14(float dt, CStateManager& mgr) {
|
void CRidley::sub80256b14(float dt, CStateManager& mgr) {
|
||||||
if (CPlasmaProjectile* proj = static_cast<CPlasmaProjectile*>(mgr.ObjectById(xb64_plasmaProjectile))) {
|
if (auto* proj = static_cast<CPlasmaProjectile*>(mgr.ObjectById(xb64_plasmaProjectile))) {
|
||||||
if (!proj->GetActive())
|
if (!proj->GetActive()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
zeus::CTransform mouthXf = GetLctrTransform(xb91_mouthSegId);
|
zeus::CTransform mouthXf = GetLctrTransform(xb91_mouthSegId);
|
||||||
if (xc64_aiStage == 3) {
|
if (xc64_aiStage == 3) {
|
||||||
|
|
Loading…
Reference in New Issue