mirror of https://github.com/AxioDL/metaforce.git
More CThardus imps, add reference CTevPass imps
This commit is contained in:
parent
617844efce
commit
9f5f0abab4
|
@ -37,29 +37,17 @@ u32 CGraphics::g_FrameCounter = 0;
|
|||
|
||||
const zeus::CMatrix3f CGraphics::skCubeBasisMats[] = {
|
||||
/* Right */
|
||||
{0.f, 1.f, 0.f,
|
||||
1.f, 0.f, 0.f,
|
||||
0.f, 0.f, -1.f},
|
||||
{0.f, 1.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, -1.f},
|
||||
/* Left */
|
||||
{0.f, -1.f, 0.f,
|
||||
-1.f, 0.f, 0.f,
|
||||
0.f, 0.f, -1.f},
|
||||
{0.f, -1.f, 0.f, -1.f, 0.f, 0.f, 0.f, 0.f, -1.f},
|
||||
/* Up */
|
||||
{1.f, 0.f, 0.f,
|
||||
0.f, 0.f, -1.f,
|
||||
0.f, 1.f, 0.f},
|
||||
{1.f, 0.f, 0.f, 0.f, 0.f, -1.f, 0.f, 1.f, 0.f},
|
||||
/* Down */
|
||||
{1.f, 0.f, 0.f,
|
||||
0.f, 0.f, 1.f,
|
||||
0.f, -1.f, 0.f},
|
||||
{1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, -1.f, 0.f},
|
||||
/* Back */
|
||||
{1.f, 0.f, 0.f,
|
||||
0.f, -1.f, 0.f,
|
||||
0.f, 0.f, -1.f},
|
||||
{1.f, 0.f, 0.f, 0.f, -1.f, 0.f, 0.f, 0.f, -1.f},
|
||||
/* Forward */
|
||||
{-1.f, 0.f, 0.f,
|
||||
0.f, 1.f, 0.f,
|
||||
0.f, 0.f, -1.f},
|
||||
{-1.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, -1.f},
|
||||
};
|
||||
|
||||
void CGraphics::DisableAllLights() {
|
||||
|
@ -462,4 +450,48 @@ boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr;
|
|||
boo::ObjToken<boo::ITextureR> CGraphics::g_SpareTexture;
|
||||
const boo::SystemChar* CGraphics::g_BooPlatformName = nullptr;
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass805a564c(
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA});
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass805a5698(
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_C0, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_A0, GX::TevAlphaArg::CA_ZERO});
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass805a5e70(
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_C0},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_A0});
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass805a5ebc(
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_ZERO});
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass805a5f08(
|
||||
{GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_TEXA, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA});
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass805a5f54(
|
||||
{GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ONE, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO});
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass805a5fa0(
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA});
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass804bfcc0(
|
||||
{GX::TevColorArg::CC_C0, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA});
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass805a5fec(
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO});
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass805a6038(
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_KONST, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO});
|
||||
|
||||
const CTevCombiners::CTevPass CGraphics::sTevPass805a6084(
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_CPREV, GX::TevColorArg::CC_APREV, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_APREV});
|
||||
} // namespace urde
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
|
||||
#include "DataSpec/DNACommon/GX.hpp"
|
||||
|
||||
#include <boo/graphicsdev/IGraphicsCommandQueue.hpp>
|
||||
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
||||
|
||||
|
@ -183,6 +185,46 @@ enum class ETexelFormat {
|
|||
#define CUBEMAP_RES 256
|
||||
#define CUBEMAP_MIPS 6
|
||||
|
||||
static s32 sNextUniquePass = 0;
|
||||
namespace CTevCombiners {
|
||||
struct CTevOp {
|
||||
bool x0_clamp = true;
|
||||
GX::TevOp x4_op = GX::TevOp::TEV_ADD;
|
||||
GX::TevBias x8_bias = GX::TevBias::TB_ZERO;
|
||||
GX::TevScale xc_scale = GX::TevScale::CS_SCALE_1;
|
||||
GX::TevRegID xc_regId = GX::TevRegID::TEVPREV;
|
||||
};
|
||||
|
||||
struct ColorPass {
|
||||
GX::TevColorArg x0_a;
|
||||
GX::TevColorArg x4_b;
|
||||
GX::TevColorArg x8_c;
|
||||
GX::TevColorArg xc_d;
|
||||
};
|
||||
struct AlphaPass {
|
||||
GX::TevAlphaArg x0_a;
|
||||
GX::TevAlphaArg x4_b;
|
||||
GX::TevAlphaArg x8_c;
|
||||
GX::TevAlphaArg xc_d;
|
||||
};
|
||||
|
||||
class CTevPass {
|
||||
u32 x0_id;
|
||||
ColorPass x4_colorPass;
|
||||
AlphaPass x14_alphaPass;
|
||||
CTevOp x24_colorOp;
|
||||
CTevOp x38_alphaOp;
|
||||
|
||||
public:
|
||||
CTevPass(const ColorPass& colPass, const AlphaPass& alphaPass, const CTevOp& colorOp = CTevOp(), const CTevOp alphaOp = CTevOp())
|
||||
: x0_id(++sNextUniquePass)
|
||||
, x4_colorPass(colPass)
|
||||
, x14_alphaPass(alphaPass)
|
||||
, x24_colorOp(colorOp)
|
||||
, x38_alphaOp(alphaOp) {}
|
||||
};
|
||||
};
|
||||
|
||||
class CGraphics {
|
||||
public:
|
||||
struct CProjectionState {
|
||||
|
@ -312,7 +354,28 @@ public:
|
|||
g_BooMainCommandQueue->drawInstances(start, count, instCount, startInst);
|
||||
}
|
||||
static void DrawArray(size_t start, size_t count) { g_BooMainCommandQueue->draw(start, count); }
|
||||
static void DrawArrayIndexed(size_t start, size_t count) { g_BooMainCommandQueue->drawIndexed(start, count); }
|
||||
static void DrawArrayIndexed(size_t start, size_t count) { g_BooMainCommandQueue->drawIndexed(start, count); }\
|
||||
|
||||
static const CTevCombiners::CTevPass sTevPass805a564c;
|
||||
static const CTevCombiners::CTevPass sTevPass805a5698;
|
||||
|
||||
static const CTevCombiners::CTevPass sTevPass805a5e70;
|
||||
|
||||
static const CTevCombiners::CTevPass sTevPass805a5ebc;
|
||||
|
||||
static const CTevCombiners::CTevPass sTevPass805a5f08;
|
||||
|
||||
static const CTevCombiners::CTevPass sTevPass805a5f54;
|
||||
|
||||
static const CTevCombiners::CTevPass sTevPass805a5fa0;
|
||||
|
||||
static const CTevCombiners::CTevPass sTevPass804bfcc0;
|
||||
|
||||
static const CTevCombiners::CTevPass sTevPass805a5fec;
|
||||
|
||||
static const CTevCombiners::CTevPass sTevPass805a6038;
|
||||
|
||||
static const CTevCombiners::CTevPass sTevPass805a6084;
|
||||
};
|
||||
|
||||
template <class VTX>
|
||||
|
|
|
@ -4,19 +4,22 @@
|
|||
#include "Runtime/Camera/CFirstPersonCamera.hpp"
|
||||
#include "Runtime/Collision/CCollisionActor.hpp"
|
||||
#include "Runtime/Collision/CCollisionActorManager.hpp"
|
||||
#include "Runtime/CSimplePool.hpp"
|
||||
#include "Runtime/CStateManager.hpp"
|
||||
#include "Runtime/MP1/CSamusHud.hpp"
|
||||
#include "Runtime/MP1/World/CThardusRockProjectile.hpp"
|
||||
#include "Runtime/World/CActorParameters.hpp"
|
||||
#include "Runtime/World/CDestroyableRock.hpp"
|
||||
#include "Runtime/World/CGameLight.hpp"
|
||||
#include "Runtime/World/CPatternedInfo.hpp"
|
||||
#include "Runtime/World/CPlayer.hpp"
|
||||
#include "Runtime/World/CScriptDistanceFog.hpp"
|
||||
#include "Runtime/World/CScriptWaypoint.hpp"
|
||||
#include "Runtime/World/CWorld.hpp"
|
||||
#include "Runtime/MP1/CSamusHud.hpp"
|
||||
|
||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||
|
||||
#include <DataSpec/DNAMP1/SFX/IceWorld.h>
|
||||
namespace urde::MP1 {
|
||||
|
||||
namespace {
|
||||
|
@ -110,7 +113,8 @@ CThardus::CThardus(TUniqueId uid, std::string_view name, const CEntityInfo& info
|
|||
xd0_damageMag = 0.f;
|
||||
x50c_baseDamageMag = 0.f;
|
||||
x8f4_waypoints.reserve(16);
|
||||
x91c_.Lock();
|
||||
x91c_flareTexture = g_SimplePool->GetObj("Thermal_Spot_2"sv);
|
||||
x91c_flareTexture.Lock();
|
||||
x403_26_stateControlledMassiveDeath = false;
|
||||
x460_knockBackController.SetAutoResetImpulse(false);
|
||||
SetMass(100000.f);
|
||||
|
@ -133,7 +137,7 @@ void CThardus::sub801dcfa4(CStateManager& mgr) {}
|
|||
|
||||
void CThardus::Think(float dt, CStateManager& mgr) {
|
||||
if (!GetActive() && x450_bodyController->GetActive()) {
|
||||
x91c_.Lock();
|
||||
x91c_flareTexture.Lock();
|
||||
}
|
||||
|
||||
if (x7c8_) {
|
||||
|
@ -203,7 +207,8 @@ void CThardus::Think(float dt, CStateManager& mgr) {
|
|||
x688_ = false;
|
||||
|
||||
} else {
|
||||
UpdateNonDestroyableCollisionActorMaterials(EUpdateMaterialMode::Remove, EMaterialTypes::ProjectilePassthrough, mgr);
|
||||
UpdateNonDestroyableCollisionActorMaterials(EUpdateMaterialMode::Remove, EMaterialTypes::ProjectilePassthrough,
|
||||
mgr);
|
||||
for (size_t i = 0; i < x610_destroyableRocks.size(); ++i) {
|
||||
if (CActor* act = static_cast<CActor*>(mgr.ObjectById(x610_destroyableRocks[i]))) {
|
||||
if (!x688_ && !x93c_ && !x909_ && !x93d_) {
|
||||
|
@ -394,7 +399,7 @@ void CThardus::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMa
|
|||
rstl::reserved_vector<TUniqueId, 16> wpIds;
|
||||
GatherWaypoints(wp, mgr, wpIds);
|
||||
for (const auto& id : wpIds)
|
||||
x570_waypoints.push_back(id);
|
||||
x574_waypoints.push_back(id);
|
||||
} else if (CPatterned* p = CPatterned::CastTo<CThardusRockProjectile>(mgr.ObjectById(connId))) {
|
||||
x5fc_projectileId = connId;
|
||||
x60c_projectileEditorId = conn.x8_objId;
|
||||
|
@ -436,7 +441,7 @@ void CThardus::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
|
|||
void CThardus::Render(const CStateManager& mgr) const {
|
||||
CPatterned::Render(mgr);
|
||||
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Thermal && x7c4_ != 0) {
|
||||
// sub801e32a0(mgr, x7c0_);
|
||||
RenderFlare(mgr, x7c0_);
|
||||
}
|
||||
}
|
||||
void CThardus::Touch(CActor& act, CStateManager& mgr) { CPatterned::Touch(act, mgr); }
|
||||
|
@ -476,7 +481,19 @@ void CThardus::Dead(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
}
|
||||
CPatterned::Dead(mgr, msg, arg);
|
||||
}
|
||||
void CThardus::PathFind(CStateManager& mgr, EStateMsg msg, float arg) { CPatterned::PathFind(mgr, msg, arg); }
|
||||
void CThardus::PathFind(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
CPatterned::PathFind(mgr, msg, arg);
|
||||
return;
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x2e0_destPos = sub801de550(mgr);
|
||||
x7e4_ = x7d8_ = x2e0_destPos;
|
||||
CPatterned::PathFind(mgr, EStateMsg::Activate, arg);
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x8d4_ = false;
|
||||
}
|
||||
}
|
||||
void CThardus::TargetPatrol(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x5ec_ = 0;
|
||||
|
@ -514,10 +531,31 @@ void CThardus::Generate(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
x93d_ = false;
|
||||
}
|
||||
}
|
||||
void CThardus::Attack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Attack(mgr, msg, arg); }
|
||||
void CThardus::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x5ec_ = 0;
|
||||
++x570_;
|
||||
x5ec_ = 0;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (x5ec_ == 0) {
|
||||
if (GetBodyController()->GetCurrentStateId() != pas::EAnimationState::MeleeAttack) {
|
||||
if (mgr.GetActiveRandom()->Float() <= 0.5f) {
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(pas::ESeverity::One));
|
||||
} else {
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(pas::ESeverity::Zero));
|
||||
}
|
||||
++x570_;
|
||||
} else {
|
||||
x5ec_ = 2;
|
||||
}
|
||||
} else if (x5ec_ == 2 && GetBodyController()->GetCurrentStateId() != pas::EAnimationState::MeleeAttack) {
|
||||
x5ec_ = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
void CThardus::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::LoopedAttack(mgr, msg, arg); }
|
||||
void CThardus::DoubleSnap(CStateManager& mgr, EStateMsg msg, float arg) { CAi::DoubleSnap(mgr, msg, arg); }
|
||||
void CThardus::Shuffle(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Shuffle(mgr, msg, arg); }
|
||||
void CThardus::DoubleSnap(CStateManager& mgr, EStateMsg msg, float arg) { }
|
||||
void CThardus::Shuffle(CStateManager& mgr, EStateMsg msg, float arg) { }
|
||||
void CThardus::GetUp(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg != EStateMsg::Activate)
|
||||
return;
|
||||
|
@ -539,21 +577,207 @@ void CThardus::Taunt(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
}
|
||||
}
|
||||
|
||||
void CThardus::Suck(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Suck(mgr, msg, arg); }
|
||||
void CThardus::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::ProjectileAttack(mgr, msg, arg); }
|
||||
void CThardus::Flinch(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Flinch(mgr, msg, arg); }
|
||||
void CThardus::TelegraphAttack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::TelegraphAttack(mgr, msg, arg); }
|
||||
void CThardus::Explode(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Explode(mgr, msg, arg); }
|
||||
void CThardus::Cover(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Cover(mgr, msg, arg); }
|
||||
void CThardus::Enraged(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Enraged(mgr, msg, arg); }
|
||||
void CThardus::Growth(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Growth(mgr, msg, arg); }
|
||||
void CThardus::Faint(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Faint(mgr, msg, arg); }
|
||||
void CThardus::Suck(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x909_ = true;
|
||||
x93d_ = true;
|
||||
SendScriptMsgs(EScriptObjectState::MaxReached, mgr, EScriptObjectMessage::None);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x689_ = true;
|
||||
}
|
||||
}
|
||||
void CThardus::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x5ec_ = 0;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (x5ec_ == 1)
|
||||
return;
|
||||
|
||||
if (x5ec_ == 0) {
|
||||
if (GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::ProjectileAttack) {
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(CBCProjectileAttackCmd(pas::ESeverity::Zero, {}, false));
|
||||
x5ec_ = 0;
|
||||
} else {
|
||||
x5ec_ = 2;
|
||||
}
|
||||
} else if (x5ec_ == 2 &&
|
||||
GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::ProjectileAttack) {
|
||||
x5ec_ = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
void CThardus::Flinch(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
for (TUniqueId uid : x798_) {
|
||||
if (CThardusRockProjectile* rock = CPatterned::CastTo<CThardusRockProjectile>(mgr.ObjectById(uid)))
|
||||
rock->sub80203d58();
|
||||
}
|
||||
x93b_ = true;
|
||||
x93d_ = true;
|
||||
x909_ = true;
|
||||
x93c_ = false;
|
||||
SetState(-1, mgr);
|
||||
x94d_ = true;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
pas::ESeverity severity = pas::ESeverity::Invalid;
|
||||
switch (x648_currentRock) {
|
||||
case 1:
|
||||
severity = pas::ESeverity::Zero;
|
||||
break;
|
||||
case 2:
|
||||
severity = pas::ESeverity::One;
|
||||
break;
|
||||
case 3:
|
||||
severity = pas::ESeverity::Two;
|
||||
break;
|
||||
case 4:
|
||||
severity = pas::ESeverity::Three;
|
||||
break;
|
||||
case 5:
|
||||
severity = pas::ESeverity::Four;
|
||||
break;
|
||||
case 6:
|
||||
severity = pas::ESeverity::Five;
|
||||
break;
|
||||
}
|
||||
|
||||
if (x5ec_ == 0) {
|
||||
if (GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::KnockBack)
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(CBCKnockBackCmd({}, severity));
|
||||
else
|
||||
x5ec_ = 2;
|
||||
} else if (x5ec_ == 2 &&
|
||||
GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::KnockBack) {
|
||||
x5ec_ = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
void CThardus::TelegraphAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x5ec_ = 0;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (x5ec_ == 0) {
|
||||
if (GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::ProjectileAttack) {
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(CBCProjectileAttackCmd(pas::ESeverity::One, {}, false));
|
||||
x5ec_ = 0;
|
||||
} else
|
||||
x5ec_ = 2;
|
||||
} else if (x5ec_ == 2 &&
|
||||
GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::ProjectileAttack) {
|
||||
x5ec_ = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
void CThardus::Explode(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x5ec_ = 0;
|
||||
CSfxManager::SfxStop(x904_);
|
||||
x909_ = true;
|
||||
x93d_ = true;
|
||||
x909_ = true;
|
||||
SendScriptMsgs(EScriptObjectState::Arrived, mgr, EScriptObjectMessage::None);
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (x5ec_ == 0) {
|
||||
if (GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Step) {
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(
|
||||
CBCStepCmd(pas::EStepDirection::Forward, pas::EStepType::Dodge));
|
||||
} else {
|
||||
x5ec_ = 2;
|
||||
}
|
||||
} else if (x5ec_ == 2 &&
|
||||
GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Step) {
|
||||
x5ec_ = 3;
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x8f0_ = true;
|
||||
x909_ = false;
|
||||
x93d_ = false;
|
||||
}
|
||||
}
|
||||
void CThardus::Cover(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
SetState(1, mgr);
|
||||
x93d_ = false;
|
||||
x909_ = false;
|
||||
if (x610_destroyableRocks.size() - 2 <= x648_currentRock)
|
||||
x690_ = 1.1f;
|
||||
AddMaterial(EMaterialTypes::RadarObject, mgr);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x690_ = 1.f;
|
||||
}
|
||||
}
|
||||
void CThardus::Enraged(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x5ec_ = 0;
|
||||
x688_ = true;
|
||||
x908_ = true;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (x5ec_ == 0) {
|
||||
if (GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Taunt) {
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(CBCTauntCmd(pas::ETauntType::Zero));
|
||||
} else {
|
||||
x5ec_ = 2;
|
||||
}
|
||||
} else if (x5ec_ == 2 &&
|
||||
GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Taunt) {
|
||||
x5ec_ = 3;
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x908_ = false;
|
||||
}
|
||||
}
|
||||
void CThardus::Growth(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x5ec_ = 0;
|
||||
x904_ = CSfxManager::SfxStart(SFXsfx07AD, 1.f, 0.f, false, 0x7f, true, GetAreaIdAlways());
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (x5ec_ == 0) {
|
||||
if (GetBodyController()->GetCurrentStateId() != pas::EAnimationState::Step) {
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(
|
||||
CBCStepCmd(pas::EStepDirection::Forward, pas::EStepType::BreakDodge));
|
||||
} else {
|
||||
x5ec_ = 2;
|
||||
}
|
||||
} else if (x5ec_ == 2 && GetBodyController()->GetCurrentStateId() != pas::EAnimationState::Step) {
|
||||
x5ec_ = 3;
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
if (TCastToPtr<CScriptDistanceFog> fog = mgr.ObjectById(x64c_fog)) {
|
||||
mgr.SendScriptMsg(GetUniqueId(), mgr.GetEditorIdForUniqueId(fog->GetUniqueId()), EScriptObjectMessage::Activate,
|
||||
EScriptObjectState::Any);
|
||||
SendScriptMsgs(EScriptObjectState::Play, mgr, EScriptObjectMessage::None);
|
||||
}
|
||||
}
|
||||
}
|
||||
void CThardus::Faint(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x5ec_ = 0;
|
||||
x93c_ = false;
|
||||
SetState(-1, mgr);
|
||||
for (TUniqueId uid : x798_) {
|
||||
if (CThardusRockProjectile* rock = CPatterned::CastTo<CThardusRockProjectile>(mgr.ObjectById(uid)))
|
||||
rock->sub80203d58();
|
||||
}
|
||||
x94d_ = true;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (x5ec_ == 0) {
|
||||
if (GetBodyController()->GetCurrentStateId() != pas::EAnimationState::KnockBack) {
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(CBCKnockBackCmd({}, pas::ESeverity::Six));
|
||||
} else {
|
||||
x5ec_ = 2;
|
||||
}
|
||||
} else if (x5ec_ == 2 && GetBodyController()->GetCurrentStateId() != pas::EAnimationState::KnockBack) {
|
||||
x5ec_ = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CThardus::PathFound(CStateManager& mgr, float arg) { return x8d4_; }
|
||||
bool CThardus::InRange(CStateManager& mgr, float arg) {
|
||||
return (mgr.GetPlayer().GetTranslation().toVec2f() - GetTranslation().toVec2f()).magnitude() <
|
||||
10.f * GetModelData()->GetScale().x();
|
||||
}
|
||||
bool CThardus::PatternOver(CStateManager& mgr, float arg) { return !x570_waypoints.empty() || x93b_; }
|
||||
bool CThardus::PatternOver(CStateManager& mgr, float arg) { return !x574_waypoints.empty() || x93b_; }
|
||||
bool CThardus::AnimOver(CStateManager& mgr, float arg) { return x5ec_ == 3; }
|
||||
bool CThardus::InPosition(CStateManager& mgr, float arg) { return CPatterned::InPosition(mgr, arg); }
|
||||
bool CThardus::ShouldTurn(CStateManager& mgr, float arg) { return CAi::ShouldTurn(mgr, arg); }
|
||||
|
@ -718,7 +942,8 @@ void CThardus::sub801dbbdc(CStateManager& mgr, CDestroyableRock* rock) {
|
|||
x92c_currentRockPos = rock->GetTranslation();
|
||||
}
|
||||
|
||||
void CThardus::UpdateNonDestroyableCollisionActorMaterials(EUpdateMaterialMode mode, EMaterialTypes mat, urde::CStateManager& mgr) {
|
||||
void CThardus::UpdateNonDestroyableCollisionActorMaterials(EUpdateMaterialMode mode, EMaterialTypes mat,
|
||||
urde::CStateManager& mgr) {
|
||||
for (const auto& uid : x634_nonDestroyableActors) {
|
||||
if (TCastToPtr<CCollisionActor> col = mgr.ObjectById(uid)) {
|
||||
if (mode == EUpdateMaterialMode::Remove)
|
||||
|
@ -731,8 +956,8 @@ void CThardus::UpdateNonDestroyableCollisionActorMaterials(EUpdateMaterialMode m
|
|||
}
|
||||
}
|
||||
|
||||
void CThardus::UpdateExcludeList(const std::unique_ptr<CCollisionActorManager>& colMgr, EUpdateMaterialMode mode, EMaterialTypes w2,
|
||||
CStateManager& mgr) {
|
||||
void CThardus::UpdateExcludeList(const std::unique_ptr<CCollisionActorManager>& colMgr, EUpdateMaterialMode mode,
|
||||
EMaterialTypes w2, CStateManager& mgr) {
|
||||
for (size_t i = 0; i < colMgr->GetNumCollisionActors(); ++i) {
|
||||
if (TCastToPtr<CActor> colAct = mgr.ObjectById(colMgr->GetCollisionDescFromIndex(i).GetCollisionActorId())) {
|
||||
CMaterialList exclude = colAct->GetMaterialFilter().GetExcludeList();
|
||||
|
@ -746,4 +971,51 @@ void CThardus::UpdateExcludeList(const std::unique_ptr<CCollisionActorManager>&
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CThardus::RenderFlare(const CStateManager& mgr, float t) const {
|
||||
if (!x91c_flareTexture)
|
||||
return;
|
||||
if (!m_flareFilter)
|
||||
m_flareFilter.emplace(EFilterType::Add, x91c_flareTexture);
|
||||
|
||||
const float scale = 30.f * t;
|
||||
zeus::CVector3f offset = scale * CGraphics::g_ViewMatrix.basis[2];
|
||||
zeus::CVector3f max = x92c_currentRockPos + (scale * CGraphics::g_ViewMatrix.basis[0]);
|
||||
zeus::CVector3f min = x92c_currentRockPos - (scale * CGraphics::g_ViewMatrix.basis[0]);
|
||||
CGraphics::SetModelMatrix(zeus::CTransform());
|
||||
const std::array<CTexturedQuadFilter::Vert, 4> verts{{
|
||||
{{max.x() + offset.x(), max.y() + offset.y(), max.z() + offset.z()}, {0.f, 1.f}},
|
||||
{{min.x() + offset.x(), min.y() + offset.y(), min.z() + offset.z()}, {0.f, 0.f}},
|
||||
{{max.x() - offset.x(), max.y() - offset.y(), max.z() - offset.z()}, {1.f, 1.f}},
|
||||
{{min.x() - offset.x(), min.y() - offset.y(), min.z() - offset.z()}, {1.f, 0.f}},
|
||||
}};
|
||||
|
||||
m_flareFilter->drawVerts({t, t}, verts.data());
|
||||
}
|
||||
|
||||
#if 0
|
||||
CGraphics::SetModelMatrix(zeus::CTransform());
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::One, ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||
CGraphics::SetTevOp(0, CGraphics::sTevPass805a5ebc);
|
||||
CGraphics::SetTevOp(1, CGraphics::sTevPass805a564c);
|
||||
CGraphics::SetDepthWriteMode(false, ERglEnum::Always, false);
|
||||
CGraphics::StreamColor(zeus::CColor(f1, f1));
|
||||
CGraphics::StreamBegin(0xa0);
|
||||
CGraphics::StreamTexCoord(0.f, 0.f);
|
||||
CGraphics::StreamVertex(min + offset);
|
||||
CGraphics::StreamTexCoord(1.f, 0.f);
|
||||
CGraphics::StreamVertex(min - offset);
|
||||
CGraphics::StreamTexCoord(1.f, 1.f);
|
||||
CGraphics::StreamVertex(max - offset);
|
||||
CGraphics::StreamTexCoord(0.f, 1.f);
|
||||
CGraphics::StreamVertex(max + offset);
|
||||
CGraphics::StreamEnd();
|
||||
#endif
|
||||
|
||||
zeus::CVector3f CThardus::sub801de550(const CStateManager& mgr) const {
|
||||
if (x570_)
|
||||
return {};
|
||||
|
||||
return {};
|
||||
}
|
||||
} // namespace urde::MP1
|
|
@ -21,7 +21,8 @@ class CThardus : public CPatterned {
|
|||
};
|
||||
u32 x568_;
|
||||
TUniqueId x56c_ = kInvalidUniqueId;
|
||||
std::vector<TUniqueId> x570_waypoints;
|
||||
u32 x570_ = 0;
|
||||
std::vector<TUniqueId> x574_waypoints;
|
||||
u32 x5c4_ = 1;
|
||||
bool x5c8_heardPlayer = false;
|
||||
/* NOTE(phil) These two vectors used to vectors of CModelData, They have been converted to vectors of CStaticRes due
|
||||
|
@ -85,7 +86,7 @@ class CThardus : public CPatterned {
|
|||
std::vector<TUniqueId> x7a8_timers;
|
||||
float x7b8_ = 0.f;
|
||||
float x7bc_ = 10.f;
|
||||
u32 x7c0_;
|
||||
float x7c0_ = 1.0f;
|
||||
u32 x7c4_ = 0;
|
||||
bool x7c8_ = false;
|
||||
zeus::CVector3f x7cc_;
|
||||
|
@ -97,11 +98,11 @@ class CThardus : public CPatterned {
|
|||
zeus::CVector3f x8e4_;
|
||||
bool x8f0_ = false;
|
||||
std::vector<TUniqueId> x8f4_waypoints;
|
||||
u32 x904_ = 0;
|
||||
CSfxHandle x904_ = 0;
|
||||
bool x908_ = false;
|
||||
bool x909_ = false;
|
||||
std::vector<float> x90c_;
|
||||
TLockedToken<CTexture> x91c_;
|
||||
TLockedToken<CTexture> x91c_flareTexture;
|
||||
TUniqueId x928_currentRockId;
|
||||
zeus::CVector3f x92c_currentRockPos;
|
||||
bool x938_ = false;
|
||||
|
@ -138,7 +139,7 @@ class CThardus : public CPatterned {
|
|||
void sub801dd608(CStateManager& mgr);
|
||||
void sub801dcfa4(CStateManager& mgr);
|
||||
void sub80deadc(CStateManager& mgr) {
|
||||
if (x570_waypoints.empty()) {
|
||||
if (x574_waypoints.empty()) {
|
||||
sub801de9f8(mgr);
|
||||
} else {
|
||||
if (sub801dc2c8() || x5c4_ != 0 || x944_ <= 0.f)
|
||||
|
@ -158,6 +159,11 @@ class CThardus : public CPatterned {
|
|||
void _SetupCollisionManagers(CStateManager& mgr);
|
||||
void _BuildSphereJointList(const SSphereJointInfo* arr, int count, std::vector<CJointCollisionDescription>& list);
|
||||
void _BuildAABoxJointList(const SAABoxJointInfo* arr, int count, std::vector<CJointCollisionDescription>& list);
|
||||
void RenderFlare(const CStateManager& mgr, float t) const;
|
||||
zeus::CVector3f sub801de550(const CStateManager& mgr) const;
|
||||
zeus::CVector3f sub801de434(const CStateManager& mgr) const { return {}; }
|
||||
|
||||
mutable std::optional<CTexturedQuadFilter> m_flareFilter;
|
||||
|
||||
public:
|
||||
DEFINE_PATTERNED(Thardus)
|
||||
|
@ -214,7 +220,7 @@ public:
|
|||
bool AggressionCheck(CStateManager& mgr, float arg) override { return x330_stateMachineState.GetTime() > 0.1f; }
|
||||
bool AttackOver(CStateManager& mgr, float arg) override { return true; }
|
||||
bool ShouldTaunt(CStateManager& mgr, float arg) override { return false; }
|
||||
bool ShouldMove(CStateManager& mgr, float arg) override { return x68c_ < x570_waypoints.size() || x93b_; }
|
||||
bool ShouldMove(CStateManager& mgr, float arg) override { return x68c_ < x574_waypoints.size() || x93b_; }
|
||||
bool CodeTrigger(CStateManager& mgr, float arg) override { return x95c_doCodeTrigger; }
|
||||
bool IsDizzy(CStateManager& mgr, float arg) override { return x330_stateMachineState.GetTime() > 4.f; }
|
||||
bool ShouldCallForBackup(CStateManager& mgr, float arg) override { return x330_stateMachineState.GetTime() > .5f; }
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#include "Runtime/MP1/World/CThardusRockProjectile.hpp"
|
||||
|
||||
namespace urde {
|
||||
|
||||
namespace urde::MP1 {
|
||||
CThardusRockProjectile::CThardusRockProjectile(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& modelData,
|
||||
const CActorParameters& aParms, const CPatternedInfo& patternedInfo,
|
||||
const std::vector<CModelData>& mDataVec, u32)
|
||||
std::vector<std::unique_ptr<CModelData>>&& mDataVec,
|
||||
CAssetId stateMachine, float)
|
||||
: CPatterned(ECharacter::ThardusRockProjectile, uid, name, EFlavorType::Zero, info, xf, std::move(modelData),
|
||||
patternedInfo, EMovementType::Flyer, EColliderType::One, EBodyType::Flyer, aParms,
|
||||
EKnockBackVariant::Medium) {}
|
||||
EKnockBackVariant::Medium)
|
||||
, x57c_(std::move(mDataVec)) {}
|
||||
|
||||
} // namespace urde
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -2,14 +2,27 @@
|
|||
|
||||
#include "Runtime/World/CPatterned.hpp"
|
||||
|
||||
namespace urde {
|
||||
|
||||
namespace urde::MP1 {
|
||||
class CThardusRockProjectile : public CPatterned {
|
||||
float x568_;
|
||||
u32 x56c_ = 0;
|
||||
TUniqueId x570_ = kInvalidUniqueId;
|
||||
bool x572_ = false;
|
||||
s32 x574_ = -1;
|
||||
s32 x578_ = 0;
|
||||
std::vector<std::unique_ptr<CModelData>> x57c_;
|
||||
u32 x590_ = 0;
|
||||
|
||||
public:
|
||||
DEFINE_PATTERNED(ThardusRockProjectile)
|
||||
CThardusRockProjectile(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& modelData, const CActorParameters& aParms, const CPatternedInfo& patternedInfo,
|
||||
const std::vector<CModelData>& mDataVec, u32);
|
||||
};
|
||||
std::vector<std::unique_ptr<CModelData>>&& mDataVec, CAssetId, float);
|
||||
|
||||
} // namespace urde
|
||||
void sub80203d58() {
|
||||
x328_25_verticalMovement = false;
|
||||
x150_momentum = {0.f, 0.f, 2.f * -GetWeight()};
|
||||
x56c_ = 3;
|
||||
}
|
||||
};
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -32,7 +32,7 @@ void CDestroyableRock::PreRender(CStateManager& mgr, const zeus::CFrustum& frust
|
|||
xb4_drawFlags = CModelFlags(0, 0, 3, zeus::skWhite);
|
||||
} else {
|
||||
x330_.a() = 1.f;
|
||||
xb4_drawFlags = CModelFlags(0, 0, 3, x330_);
|
||||
xb4_drawFlags = CModelFlags(2, 0, 3, x330_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3659,7 +3659,7 @@ void CPlayer::SetOrbitTargetId(TUniqueId id, CStateManager& mgr) {
|
|||
if (id != kInvalidUniqueId) {
|
||||
x394_orbitingEnemy =
|
||||
(TCastToPtr<CPatterned>(mgr.ObjectById(id)) || TCastToPtr<CWallCrawlerSwarm>(mgr.ObjectById(id)) ||
|
||||
CPatterned::CastTo<CThardusRockProjectile>(mgr.ObjectById(id)) ||
|
||||
CPatterned::CastTo<MP1::CThardusRockProjectile>(mgr.ObjectById(id)) ||
|
||||
TCastToPtr<CScriptGunTurret>(mgr.ObjectById(id)));
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "Runtime/MP1/World/CSpacePirate.hpp"
|
||||
#include "Runtime/MP1/World/CSpankWeed.hpp"
|
||||
#include "Runtime/MP1/World/CThardus.hpp"
|
||||
#include "Runtime/MP1/World/CThardusRockProjectile.hpp"
|
||||
#include "Runtime/MP1/World/CTryclops.hpp"
|
||||
#include "Runtime/MP1/World/CWarWasp.hpp"
|
||||
#include "Runtime/Particle/CWeaponDescription.hpp"
|
||||
|
@ -2738,7 +2739,31 @@ CEntity* ScriptLoader::LoadColorModulate(CStateManager& mgr, CInputStream& in, i
|
|||
|
||||
CEntity* ScriptLoader::LoadThardusRockProjectile(CStateManager& mgr, CInputStream& in, int propCount,
|
||||
const CEntityInfo& info) {
|
||||
if (!EnsurePropertyCount(propCount, 3, "ThardusRockProjectile"))
|
||||
return nullptr;
|
||||
|
||||
SScaledActorHead actorHead = LoadScaledActorHead(in, mgr);
|
||||
auto [pInfoValid, pInfoCount] = CPatternedInfo::HasCorrectParameterCount(in);
|
||||
if (!pInfoValid)
|
||||
return nullptr;
|
||||
|
||||
CPatternedInfo pInfo(in, pInfoCount);
|
||||
CActorParameters actParms = LoadActorParameters(in);
|
||||
in.readBool();
|
||||
in.readBool();
|
||||
float f1 = in.readFloatBig();
|
||||
CAssetId modelId(in);
|
||||
CAssetId stateMachine(in);
|
||||
if (!pInfo.GetAnimationParameters().GetACSFile().IsValid())
|
||||
return nullptr;
|
||||
|
||||
std::vector<std::unique_ptr<CModelData>> mDataVec;
|
||||
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), 0, actorHead.x40_scale,
|
||||
pInfo.GetAnimationParameters().GetInitialAnimation(), true));
|
||||
mDataVec.reserve(3);
|
||||
mDataVec.emplace_back(std::make_unique<CModelData>(CStaticRes(modelId, zeus::skOne3f)));
|
||||
return new MP1::CThardusRockProjectile(mgr.AllocateUniqueId(), actorHead.x0_name, info, actorHead.x10_transform,
|
||||
std::move(mData), actParms, pInfo, std::move(mDataVec), stateMachine, f1);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadMidi(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
|
|
Loading…
Reference in New Issue