mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' into metroid
This commit is contained in:
commit
6ad1aa79ab
|
@ -117,7 +117,7 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
|
|||
xd0_29_allItemsCollected = stream.ReadEncoded(1) != 0;
|
||||
xbc_autoMapperKeyState = stream.ReadEncoded(2);
|
||||
|
||||
auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
|
||||
const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
|
||||
size_t cinematicCount = 0;
|
||||
for (const auto& world : memWorlds) {
|
||||
TLockedToken<CSaveWorld> saveWorld =
|
||||
|
@ -162,7 +162,7 @@ void CPersistentOptions::PutTo(CBitStreamWriter& w) const {
|
|||
w.WriteEncoded(xd0_29_allItemsCollected, 1);
|
||||
w.WriteEncoded(xbc_autoMapperKeyState, 2);
|
||||
|
||||
auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
|
||||
const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
|
||||
for (const auto& world : memWorlds) {
|
||||
const TLockedToken<CSaveWorld> saveWorld =
|
||||
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()});
|
||||
|
|
|
@ -69,8 +69,8 @@ public:
|
|||
[[nodiscard]] iterator end() { return iterator(*this, -1); }
|
||||
[[nodiscard]] const_iterator begin() const { return const_iterator(*this, x2008_firstId); }
|
||||
[[nodiscard]] const_iterator end() const { return const_iterator(*this, -1); }
|
||||
[[nodiscard]] const_iterator cbegin() const { return const_iterator(*this, x2008_firstId); }
|
||||
[[nodiscard]] const_iterator cend() const { return const_iterator(*this, -1); }
|
||||
[[nodiscard]] const_iterator cbegin() const { return begin(); }
|
||||
[[nodiscard]] const_iterator cend() const { return end(); }
|
||||
|
||||
explicit CObjectList(EGameObjectList listEnum);
|
||||
virtual ~CObjectList() = default;
|
||||
|
|
|
@ -42,7 +42,7 @@ void CRelayTracker::RemoveRelay(TEditorId id) {
|
|||
return;
|
||||
}
|
||||
|
||||
x0_relayStates.erase(std::remove(x0_relayStates.begin(), x0_relayStates.end(), id), x0_relayStates.end());
|
||||
std::erase(x0_relayStates, id);
|
||||
}
|
||||
|
||||
void CRelayTracker::SendMsgs(TAreaId areaId, CStateManager& stateMgr) {
|
||||
|
|
|
@ -132,10 +132,10 @@ void CResLoader::GetTagListForFile(const char* pakName, std::vector<SObjectTag>&
|
|||
bool CResLoader::_GetTagListForFile(std::vector<SObjectTag>& out, const std::string& path,
|
||||
const std::unique_ptr<CPakFile>& file) const {
|
||||
if (CStringExtras::CompareCaseInsensitive(file->GetPath(), path)) {
|
||||
auto& depList = file->GetDepList();
|
||||
const auto& depList = file->GetDepList();
|
||||
out.reserve(depList.size());
|
||||
for (const auto& dep : depList) {
|
||||
auto resInfo = file->GetResInfo(dep);
|
||||
const auto* const resInfo = file->GetResInfo(dep);
|
||||
out.emplace_back(resInfo->GetType(), dep);
|
||||
}
|
||||
return true;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -106,24 +106,27 @@ void CAnimSourceReaderBase::UpdatePOIStates() {
|
|||
const std::vector<CSoundPOINode>& soundNodes = x4_sourceInfo->GetSoundPOIStream();
|
||||
|
||||
while (x14_passedBoolCount < boolNodes.size() && boolNodes[x14_passedBoolCount].GetTime() <= xc_curTime) {
|
||||
auto& node = boolNodes[x14_passedBoolCount];
|
||||
if (node.GetIndex() >= 0)
|
||||
const auto& node = boolNodes[x14_passedBoolCount];
|
||||
if (node.GetIndex() >= 0) {
|
||||
x24_boolStates[node.GetIndex()].second = node.GetValue();
|
||||
}
|
||||
++x14_passedBoolCount;
|
||||
}
|
||||
|
||||
while (x18_passedIntCount < int32Nodes.size() && int32Nodes[x18_passedIntCount].GetTime() <= xc_curTime) {
|
||||
auto& node = int32Nodes[x18_passedIntCount];
|
||||
if (node.GetIndex() >= 0)
|
||||
const auto& node = int32Nodes[x18_passedIntCount];
|
||||
if (node.GetIndex() >= 0) {
|
||||
x34_int32States[node.GetIndex()].second = node.GetValue();
|
||||
}
|
||||
++x18_passedIntCount;
|
||||
}
|
||||
|
||||
while (x1c_passedParticleCount < particleNodes.size() &&
|
||||
particleNodes[x1c_passedParticleCount].GetTime() <= xc_curTime) {
|
||||
auto& node = particleNodes[x1c_passedParticleCount];
|
||||
if (node.GetIndex() >= 0)
|
||||
const auto& node = particleNodes[x1c_passedParticleCount];
|
||||
if (node.GetIndex() >= 0) {
|
||||
x44_particleStates[node.GetIndex()].second = node.GetParticleData().GetParentedMode();
|
||||
}
|
||||
++x1c_passedParticleCount;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,11 @@ void CAnimTreeTweenBase::VGetSegStatementSet(const CSegIdList& list, CSegStateme
|
|||
if (w >= 1.f) {
|
||||
x18_b->VGetSegStatementSet(list, setOut);
|
||||
} else if (sStack > 3) {
|
||||
auto& n = w > 0.5f ? x18_b : x14_a;
|
||||
const auto& n = w > 0.5f ? x18_b : x14_a;
|
||||
auto ptr = n->GetBestUnblendedChild();
|
||||
if (!ptr)
|
||||
if (!ptr) {
|
||||
ptr = n;
|
||||
}
|
||||
ptr->VGetSegStatementSet(list, setOut);
|
||||
} else {
|
||||
CSegStatementSet setA, setB;
|
||||
|
@ -61,7 +62,7 @@ void CAnimTreeTweenBase::VGetSegStatementSet(const CSegIdList& list, CSegStateme
|
|||
if (w >= 1.f) {
|
||||
x18_b->VGetSegStatementSet(list, setOut, time);
|
||||
} else if (sStack > 3) {
|
||||
auto& n = w > 0.5f ? x18_b : x14_a;
|
||||
const auto& n = w > 0.5f ? x18_b : x14_a;
|
||||
n->GetBestUnblendedChild()->VGetSegStatementSet(list, setOut, time);
|
||||
} else {
|
||||
CSegStatementSet setA, setB;
|
||||
|
|
|
@ -27,13 +27,14 @@ void CMetaAnimRandom::GetUniquePrimitives(std::set<CPrimitive>& primsOut) const
|
|||
|
||||
std::shared_ptr<CAnimTreeNode> CMetaAnimRandom::VGetAnimationTree(const CAnimSysContext& animSys,
|
||||
const CMetaAnimTreeBuildOrders& orders) const {
|
||||
u32 r = animSys.x8_random->Range(1, 100);
|
||||
const u32 r = animSys.x8_random->Range(1, 100);
|
||||
const std::pair<std::shared_ptr<IMetaAnim>, u32>* useRd = nullptr;
|
||||
for (auto& rd : x4_randomData) {
|
||||
for (const auto& rd : x4_randomData) {
|
||||
useRd = &rd;
|
||||
if (r <= rd.second)
|
||||
if (r <= rd.second) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return useRd->first->GetAnimationTree(animSys, orders);
|
||||
}
|
||||
|
|
|
@ -205,38 +205,41 @@ void CParticleDatabase::Update(float dt, const CPoseAsTransforms& pose, const CC
|
|||
}
|
||||
|
||||
void CParticleDatabase::RenderParticleGenMap(const std::map<std::string, std::unique_ptr<CParticleGenInfo>>& map) {
|
||||
for (auto& e : map) {
|
||||
for (const auto& e : map) {
|
||||
e.second->Render();
|
||||
}
|
||||
}
|
||||
|
||||
void CParticleDatabase::RenderParticleGenMapMasked(const std::map<std::string, std::unique_ptr<CParticleGenInfo>>& map,
|
||||
int mask, int target) {
|
||||
for (auto& e : map) {
|
||||
if ((e.second->GetFlags() & mask) == target)
|
||||
for (const auto& e : map) {
|
||||
if ((e.second->GetFlags() & mask) == target) {
|
||||
e.second->Render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CParticleDatabase::AddToRendererClippedParticleGenMap(
|
||||
const std::map<std::string, std::unique_ptr<CParticleGenInfo>>& map, const zeus::CFrustum& frustum) {
|
||||
for (auto& e : map) {
|
||||
auto bounds = e.second->GetBounds();
|
||||
if (bounds && frustum.aabbFrustumTest(*bounds))
|
||||
for (const auto& e : map) {
|
||||
const auto bounds = e.second->GetBounds();
|
||||
if (bounds && frustum.aabbFrustumTest(*bounds)) {
|
||||
e.second->AddToRenderer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CParticleDatabase::AddToRendererClippedParticleGenMapMasked(
|
||||
const std::map<std::string, std::unique_ptr<CParticleGenInfo>>& map, const zeus::CFrustum& frustum, int mask,
|
||||
int target) {
|
||||
for (auto& e : map) {
|
||||
for (const auto& e : map) {
|
||||
if ((e.second->GetFlags() & mask) == target) {
|
||||
auto bounds = e.second->GetBounds();
|
||||
if (bounds && frustum.aabbFrustumTest(*bounds))
|
||||
const auto bounds = e.second->GetBounds();
|
||||
if (bounds && frustum.aabbFrustumTest(*bounds)) {
|
||||
e.second->AddToRenderer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CParticleDatabase::RenderSystemsToBeDrawnLastMasked(int mask, int target) const {
|
||||
|
|
|
@ -340,12 +340,13 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf) {
|
|||
};
|
||||
if (!g_DummyTextures) {
|
||||
for (const auto& ch : mat.chunks) {
|
||||
if (auto pass = ch.get_if<MaterialSet::Material::PASS>()) {
|
||||
if (const auto* const pass = ch.get_if<MaterialSet::Material::PASS>()) {
|
||||
auto search = x1c_textures.find(pass->texId.toUint32());
|
||||
boo::ObjToken<boo::ITexture> btex;
|
||||
if (search != x1c_textures.cend() && (btex = search->second.GetObj()->GetBooTexture()))
|
||||
if (search != x1c_textures.cend() && (btex = search->second.GetObj()->GetBooTexture())) {
|
||||
texs[MaterialSet::Material::TexMapIdx(pass->type)] = btex;
|
||||
} else if (auto pass = ch.get_if<MaterialSet::Material::CLR>()) {
|
||||
}
|
||||
} else if (const auto* const pass = ch.get_if<MaterialSet::Material::CLR>()) {
|
||||
boo::ObjToken<boo::ITexture> btex = g_Renderer->GetColorTexture(zeus::CColor(pass->color));
|
||||
texs[MaterialSet::Material::TexMapIdx(pass->type)] = btex;
|
||||
}
|
||||
|
@ -424,7 +425,7 @@ void CBooModel::MakeTexturesFromMats(const MaterialSet& matSet,
|
|||
IObjectStore& store) {
|
||||
for (const auto& mat : matSet.materials) {
|
||||
for (const auto& chunk : mat.chunks) {
|
||||
if (auto pass = chunk.get_if<MaterialSet::Material::PASS>()) {
|
||||
if (const auto* const pass = chunk.get_if<MaterialSet::Material::PASS>()) {
|
||||
toksOut.emplace(std::make_pair(pass->texId.toUint32(), store.GetObj({SBIG('TXTR'), pass->texId.toUint32()})));
|
||||
}
|
||||
}
|
||||
|
@ -485,8 +486,8 @@ bool CBooModel::TryLockTextures() {
|
|||
}
|
||||
|
||||
if (allLoad) {
|
||||
for (auto& pipeline : *m_pipelines) {
|
||||
for (auto& subpipeline : *pipeline.second) {
|
||||
for (const auto& pipeline : *m_pipelines) {
|
||||
for (const auto& subpipeline : *pipeline.second) {
|
||||
if (!subpipeline->isReady()) {
|
||||
allLoad = false;
|
||||
break;
|
||||
|
@ -682,7 +683,7 @@ void CBooModel::WarmupDrawSurface(const CBooSurface& surf) const {
|
|||
return;
|
||||
const ModelInstance& inst = m_instances[m_uniUpdateCount - 1];
|
||||
|
||||
for (auto& binding : inst.m_shaderDataBindings[surf.selfIdx]) {
|
||||
for (const auto& binding : inst.m_shaderDataBindings[surf.selfIdx]) {
|
||||
CGraphics::SetShaderDataBinding(binding);
|
||||
CGraphics::DrawArrayIndexed(surf.m_data.idxStart, std::min(u32(3), surf.m_data.idxCount));
|
||||
}
|
||||
|
@ -865,7 +866,7 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet
|
|||
}
|
||||
u8* bufOrig = bufOut;
|
||||
for (const auto& chunk : mat.chunks) {
|
||||
if (auto pass = chunk.get_if<MaterialSet::Material::PASS>()) {
|
||||
if (const auto* const pass = chunk.get_if<MaterialSet::Material::PASS>()) {
|
||||
ProcessAnimation(bufOut, *pass);
|
||||
}
|
||||
}
|
||||
|
@ -1289,14 +1290,14 @@ bool CModel::IsLoaded(int shaderIdx) const {
|
|||
size_t CModel::GetPoolVertexOffset(size_t idx) const { return m_hmdlMeta.vertStride * idx; }
|
||||
|
||||
zeus::CVector3f CModel::GetPoolVertex(size_t idx) const {
|
||||
auto* floats = reinterpret_cast<const float*>(m_dynamicVertexData.get() + GetPoolVertexOffset(idx));
|
||||
const auto* floats = reinterpret_cast<const float*>(m_dynamicVertexData.get() + GetPoolVertexOffset(idx));
|
||||
return {floats};
|
||||
}
|
||||
|
||||
size_t CModel::GetPoolNormalOffset(size_t idx) const { return m_hmdlMeta.vertStride * idx + 12; }
|
||||
|
||||
zeus::CVector3f CModel::GetPoolNormal(size_t idx) const {
|
||||
auto* floats = reinterpret_cast<const float*>(m_dynamicVertexData.get() + GetPoolNormalOffset(idx));
|
||||
const auto* floats = reinterpret_cast<const float*>(m_dynamicVertexData.get() + GetPoolNormalOffset(idx));
|
||||
return {floats};
|
||||
}
|
||||
|
||||
|
|
|
@ -151,13 +151,13 @@ void CRainSplashGenerator::Update(float dt, CStateManager& mgr) {
|
|||
|
||||
u32 CRainSplashGenerator::GetNextBestPt(u32 pt, const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn,
|
||||
CRandom16& rand, float minZ) {
|
||||
auto& refVert = vn[pt];
|
||||
const auto& refVert = vn[pt];
|
||||
float maxDist = 0.f;
|
||||
u32 nextPt = pt;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
auto idx = u32(rand.Range(0, int(vn.size() - 1)));
|
||||
auto& vert = vn[idx];
|
||||
float distSq = (refVert.first - vert.first).magSquared();
|
||||
const auto idx = u32(rand.Range(0, int(vn.size() - 1)));
|
||||
const auto& vert = vn[idx];
|
||||
const float distSq = (refVert.first - vert.first).magSquared();
|
||||
if (distSq > maxDist && vert.second.dot(zeus::skUp) >= 0.f &&
|
||||
(vert.first.z() <= 0.f || vert.first.z() > minZ)) {
|
||||
nextPt = idx;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "Runtime/Graphics/CTexture.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Runtime/CSimplePool.hpp"
|
||||
#include "Runtime/CToken.hpp"
|
||||
#include "Runtime/Graphics/CGraphics.hpp"
|
||||
|
@ -7,28 +9,43 @@
|
|||
#include "Runtime/GameGlobalObjects.hpp"
|
||||
|
||||
namespace urde {
|
||||
static logvisor::Module Log("urde::CTextureBoo");
|
||||
namespace {
|
||||
logvisor::Module Log("urde::CTextureBoo");
|
||||
|
||||
struct RGBA8 {
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 a;
|
||||
};
|
||||
|
||||
struct DXT1Block {
|
||||
u16 color1;
|
||||
u16 color2;
|
||||
std::array<u8, 4> lines;
|
||||
};
|
||||
|
||||
/* GX uses this upsampling technique to extract full 8-bit range */
|
||||
constexpr uint8_t Convert3To8(uint8_t v) {
|
||||
constexpr u8 Convert3To8(u8 v) {
|
||||
/* Swizzle bits: 00000123 -> 12312312 */
|
||||
return (v << 5) | (v << 2) | (v >> 1);
|
||||
return static_cast<u8>((u32{v} << 5) | (u32{v} << 2) | (u32{v} >> 1));
|
||||
}
|
||||
|
||||
constexpr uint8_t Convert4To8(uint8_t v) {
|
||||
constexpr u8 Convert4To8(u8 v) {
|
||||
/* Swizzle bits: 00001234 -> 12341234 */
|
||||
return (v << 4) | v;
|
||||
return static_cast<u8>((u32{v} << 4) | u32{v});
|
||||
}
|
||||
|
||||
constexpr uint8_t Convert5To8(uint8_t v) {
|
||||
constexpr u8 Convert5To8(u8 v) {
|
||||
/* Swizzle bits: 00012345 -> 12345123 */
|
||||
return (v << 3) | (v >> 2);
|
||||
return static_cast<u8>((u32{v} << 3) | (u32{v} >> 2));
|
||||
}
|
||||
|
||||
constexpr uint8_t Convert6To8(uint8_t v) {
|
||||
constexpr u8 Convert6To8(u8 v) {
|
||||
/* Swizzle bits: 00123456 -> 12345612 */
|
||||
return (v << 2) | (v >> 4);
|
||||
return static_cast<u8>((u32{v} << 2) | (u32{v} >> 4));
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
size_t CTexture::ComputeMippedTexelCount() const {
|
||||
size_t w = x4_w;
|
||||
|
@ -58,32 +75,25 @@ size_t CTexture::ComputeMippedBlockCountDXT1() const {
|
|||
return ret;
|
||||
}
|
||||
|
||||
struct RGBA8 {
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 a;
|
||||
};
|
||||
|
||||
void CTexture::BuildI4FromGCN(CInputStream& in) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
int w = x4_w;
|
||||
int h = x6_h;
|
||||
RGBA8* targetMip = buf.get();
|
||||
for (u32 mip = 0; mip < x8_mips; ++mip) {
|
||||
int bwidth = (w + 7) / 8;
|
||||
int bheight = (h + 7) / 8;
|
||||
const int bwidth = (w + 7) / 8;
|
||||
const int bheight = (h + 7) / 8;
|
||||
for (int by = 0; by < bheight; ++by) {
|
||||
int baseY = by * 8;
|
||||
const int baseY = by * 8;
|
||||
for (int bx = 0; bx < bwidth; ++bx) {
|
||||
int baseX = bx * 8;
|
||||
const int baseX = bx * 8;
|
||||
for (int y = 0; y < 8; ++y) {
|
||||
RGBA8* target = targetMip + (baseY + y) * w + baseX;
|
||||
u8 source[4];
|
||||
in.readBytesToBuf(source, 4);
|
||||
for (int x = 0; x < 8; ++x) {
|
||||
std::array<u8, 4> source;
|
||||
in.readBytesToBuf(source.data(), source.size());
|
||||
for (size_t x = 0; x < 8; ++x) {
|
||||
target[x].r = Convert4To8(source[x / 2] >> ((x & 1) ? 0 : 4) & 0xf);
|
||||
target[x].g = target[x].r;
|
||||
target[x].b = target[x].r;
|
||||
|
@ -93,11 +103,13 @@ void CTexture::BuildI4FromGCN(CInputStream& in) {
|
|||
}
|
||||
}
|
||||
targetMip += w * h;
|
||||
if (w > 1)
|
||||
if (w > 1) {
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
}
|
||||
if (h > 1) {
|
||||
h /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
||||
|
@ -108,24 +120,24 @@ void CTexture::BuildI4FromGCN(CInputStream& in) {
|
|||
}
|
||||
|
||||
void CTexture::BuildI8FromGCN(CInputStream& in) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
int w = x4_w;
|
||||
int h = x6_h;
|
||||
RGBA8* targetMip = buf.get();
|
||||
for (u32 mip = 0; mip < x8_mips; ++mip) {
|
||||
int bwidth = (w + 7) / 8;
|
||||
int bheight = (h + 3) / 4;
|
||||
const int bwidth = (w + 7) / 8;
|
||||
const int bheight = (h + 3) / 4;
|
||||
for (int by = 0; by < bheight; ++by) {
|
||||
int baseY = by * 4;
|
||||
const int baseY = by * 4;
|
||||
for (int bx = 0; bx < bwidth; ++bx) {
|
||||
int baseX = bx * 8;
|
||||
const int baseX = bx * 8;
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
RGBA8* target = targetMip + (baseY + y) * w + baseX;
|
||||
u8 source[8];
|
||||
in.readBytesToBuf(source, 8);
|
||||
for (int x = 0; x < 8; ++x) {
|
||||
std::array<u8, 8> source;
|
||||
in.readBytesToBuf(source.data(), source.size());
|
||||
for (size_t x = 0; x < source.size(); ++x) {
|
||||
target[x].r = source[x];
|
||||
target[x].g = source[x];
|
||||
target[x].b = source[x];
|
||||
|
@ -135,11 +147,13 @@ void CTexture::BuildI8FromGCN(CInputStream& in) {
|
|||
}
|
||||
}
|
||||
targetMip += w * h;
|
||||
if (w > 1)
|
||||
if (w > 1) {
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
}
|
||||
if (h > 1) {
|
||||
h /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
||||
|
@ -150,25 +164,25 @@ void CTexture::BuildI8FromGCN(CInputStream& in) {
|
|||
}
|
||||
|
||||
void CTexture::BuildIA4FromGCN(CInputStream& in) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
int w = x4_w;
|
||||
int h = x6_h;
|
||||
RGBA8* targetMip = buf.get();
|
||||
for (u32 mip = 0; mip < x8_mips; ++mip) {
|
||||
int bwidth = (w + 7) / 8;
|
||||
int bheight = (h + 3) / 4;
|
||||
const int bwidth = (w + 7) / 8;
|
||||
const int bheight = (h + 3) / 4;
|
||||
for (int by = 0; by < bheight; ++by) {
|
||||
int baseY = by * 4;
|
||||
const int baseY = by * 4;
|
||||
for (int bx = 0; bx < bwidth; ++bx) {
|
||||
int baseX = bx * 8;
|
||||
const int baseX = bx * 8;
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
RGBA8* target = targetMip + (baseY + y) * w + baseX;
|
||||
u8 source[8];
|
||||
in.readBytesToBuf(source, 8);
|
||||
for (int x = 0; x < 8; ++x) {
|
||||
u8 intensity = Convert4To8(source[x] >> 4 & 0xf);
|
||||
std::array<u8, 8> source;
|
||||
in.readBytesToBuf(source.data(), source.size());
|
||||
for (size_t x = 0; x < source.size(); ++x) {
|
||||
const u8 intensity = Convert4To8(source[x] >> 4 & 0xf);
|
||||
target[x].r = intensity;
|
||||
target[x].g = intensity;
|
||||
target[x].b = intensity;
|
||||
|
@ -178,11 +192,13 @@ void CTexture::BuildIA4FromGCN(CInputStream& in) {
|
|||
}
|
||||
}
|
||||
targetMip += w * h;
|
||||
if (w > 1)
|
||||
if (w > 1) {
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
}
|
||||
if (h > 1) {
|
||||
h /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
||||
|
@ -193,25 +209,25 @@ void CTexture::BuildIA4FromGCN(CInputStream& in) {
|
|||
}
|
||||
|
||||
void CTexture::BuildIA8FromGCN(CInputStream& in) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
int w = x4_w;
|
||||
int h = x6_h;
|
||||
RGBA8* targetMip = buf.get();
|
||||
for (u32 mip = 0; mip < x8_mips; ++mip) {
|
||||
int bwidth = (w + 3) / 4;
|
||||
int bheight = (h + 3) / 4;
|
||||
const int bwidth = (w + 3) / 4;
|
||||
const int bheight = (h + 3) / 4;
|
||||
for (int by = 0; by < bheight; ++by) {
|
||||
int baseY = by * 4;
|
||||
const int baseY = by * 4;
|
||||
for (int bx = 0; bx < bwidth; ++bx) {
|
||||
int baseX = bx * 4;
|
||||
const int baseX = bx * 4;
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
RGBA8* target = targetMip + (baseY + y) * w + baseX;
|
||||
u16 source[4];
|
||||
in.readBytesToBuf(source, 8);
|
||||
for (int x = 0; x < 4; ++x) {
|
||||
u8 intensity = source[x] >> 8;
|
||||
std::array<u16, 4> source;
|
||||
in.readBytesToBuf(source.data(), sizeof(source));
|
||||
for (size_t x = 0; x < source.size(); ++x) {
|
||||
const u8 intensity = source[x] >> 8;
|
||||
target[x].r = intensity;
|
||||
target[x].g = intensity;
|
||||
target[x].b = intensity;
|
||||
|
@ -221,11 +237,13 @@ void CTexture::BuildIA8FromGCN(CInputStream& in) {
|
|||
}
|
||||
}
|
||||
targetMip += w * h;
|
||||
if (w > 1)
|
||||
if (w > 1) {
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
}
|
||||
if (h > 1) {
|
||||
h /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
||||
|
@ -277,7 +295,7 @@ static std::vector<RGBA8> DecodePalette(int numEntries, CInputStream& in) {
|
|||
}
|
||||
|
||||
void CTexture::BuildC4FromGCN(CInputStream& in) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
std::vector<RGBA8> palette = DecodePalette(16, in);
|
||||
|
||||
|
@ -285,27 +303,30 @@ void CTexture::BuildC4FromGCN(CInputStream& in) {
|
|||
int h = x6_h;
|
||||
RGBA8* targetMip = buf.get();
|
||||
for (u32 mip = 0; mip < x8_mips; ++mip) {
|
||||
int bwidth = (w + 7) / 8;
|
||||
int bheight = (h + 7) / 8;
|
||||
const int bwidth = (w + 7) / 8;
|
||||
const int bheight = (h + 7) / 8;
|
||||
for (int by = 0; by < bheight; ++by) {
|
||||
int baseY = by * 8;
|
||||
const int baseY = by * 8;
|
||||
for (int bx = 0; bx < bwidth; ++bx) {
|
||||
int baseX = bx * 8;
|
||||
const int baseX = bx * 8;
|
||||
for (int y = 0; y < 8; ++y) {
|
||||
RGBA8* target = targetMip + (baseY + y) * w + baseX;
|
||||
u8 source[4];
|
||||
in.readBytesToBuf(source, 4);
|
||||
for (int x = 0; x < 8; ++x)
|
||||
std::array<u8, 4> source;
|
||||
in.readBytesToBuf(source.data(), source.size());
|
||||
for (size_t x = 0; x < 8; ++x) {
|
||||
target[x] = palette[source[x / 2] >> ((x & 1) ? 0 : 4) & 0xf];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
targetMip += w * h;
|
||||
if (w > 1)
|
||||
if (w > 1) {
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
}
|
||||
if (h > 1) {
|
||||
h /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
||||
|
@ -316,7 +337,7 @@ void CTexture::BuildC4FromGCN(CInputStream& in) {
|
|||
}
|
||||
|
||||
void CTexture::BuildC8FromGCN(CInputStream& in) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
std::vector<RGBA8> palette = DecodePalette(256, in);
|
||||
|
||||
|
@ -324,27 +345,30 @@ void CTexture::BuildC8FromGCN(CInputStream& in) {
|
|||
int h = x6_h;
|
||||
RGBA8* targetMip = buf.get();
|
||||
for (u32 mip = 0; mip < x8_mips; ++mip) {
|
||||
int bwidth = (w + 7) / 8;
|
||||
int bheight = (h + 3) / 4;
|
||||
const int bwidth = (w + 7) / 8;
|
||||
const int bheight = (h + 3) / 4;
|
||||
for (int by = 0; by < bheight; ++by) {
|
||||
int baseY = by * 4;
|
||||
const int baseY = by * 4;
|
||||
for (int bx = 0; bx < bwidth; ++bx) {
|
||||
int baseX = bx * 8;
|
||||
const int baseX = bx * 8;
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
RGBA8* target = targetMip + (baseY + y) * w + baseX;
|
||||
u8 source[8];
|
||||
in.readBytesToBuf(source, 8);
|
||||
for (int x = 0; x < 8; ++x)
|
||||
std::array<u8, 8> source;
|
||||
in.readBytesToBuf(source.data(), source.size());
|
||||
for (size_t x = 0; x < source.size(); ++x) {
|
||||
target[x] = palette[source[x]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
targetMip += w * h;
|
||||
if (w > 1)
|
||||
if (w > 1) {
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
}
|
||||
if (h > 1) {
|
||||
h /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
||||
|
@ -357,23 +381,23 @@ void CTexture::BuildC8FromGCN(CInputStream& in) {
|
|||
void CTexture::BuildC14X2FromGCN(CInputStream& in) {}
|
||||
|
||||
void CTexture::BuildRGB565FromGCN(CInputStream& in) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
int w = x4_w;
|
||||
int h = x6_h;
|
||||
RGBA8* targetMip = buf.get();
|
||||
for (u32 mip = 0; mip < x8_mips; ++mip) {
|
||||
int bwidth = (w + 3) / 4;
|
||||
int bheight = (h + 3) / 4;
|
||||
const int bwidth = (w + 3) / 4;
|
||||
const int bheight = (h + 3) / 4;
|
||||
for (int by = 0; by < bheight; ++by) {
|
||||
int baseY = by * 4;
|
||||
const int baseY = by * 4;
|
||||
for (int bx = 0; bx < bwidth; ++bx) {
|
||||
int baseX = bx * 4;
|
||||
const int baseX = bx * 4;
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
RGBA8* target = targetMip + (baseY + y) * w + baseX;
|
||||
for (int x = 0; x < 4; ++x) {
|
||||
u16 texel = in.readUint16Big();
|
||||
for (size_t x = 0; x < 4; ++x) {
|
||||
const u16 texel = in.readUint16Big();
|
||||
target[x].r = Convert5To8(texel >> 11 & 0x1f);
|
||||
target[x].g = Convert6To8(texel >> 5 & 0x3f);
|
||||
target[x].b = Convert5To8(texel & 0x1f);
|
||||
|
@ -383,11 +407,13 @@ void CTexture::BuildRGB565FromGCN(CInputStream& in) {
|
|||
}
|
||||
}
|
||||
targetMip += w * h;
|
||||
if (w > 1)
|
||||
if (w > 1) {
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
}
|
||||
if (h > 1) {
|
||||
h /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
||||
|
@ -405,17 +431,17 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in) {
|
|||
int h = x6_h;
|
||||
RGBA8* targetMip = buf.get();
|
||||
for (u32 mip = 0; mip < x8_mips; ++mip) {
|
||||
int bwidth = (w + 3) / 4;
|
||||
int bheight = (h + 3) / 4;
|
||||
const int bwidth = (w + 3) / 4;
|
||||
const int bheight = (h + 3) / 4;
|
||||
for (int by = 0; by < bheight; ++by) {
|
||||
int baseY = by * 4;
|
||||
const int baseY = by * 4;
|
||||
for (int bx = 0; bx < bwidth; ++bx) {
|
||||
int baseX = bx * 4;
|
||||
const int baseX = bx * 4;
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
RGBA8* target = targetMip + (baseY + y) * w + baseX;
|
||||
for (int x = 0; x < 4; ++x) {
|
||||
u16 texel = in.readUint16Big();
|
||||
if (texel & 0x8000) {
|
||||
for (size_t x = 0; x < 4; ++x) {
|
||||
const u16 texel = in.readUint16Big();
|
||||
if ((texel & 0x8000) != 0) {
|
||||
target[x].r = Convert5To8(texel >> 10 & 0x1f);
|
||||
target[x].g = Convert5To8(texel >> 5 & 0x1f);
|
||||
target[x].b = Convert5To8(texel & 0x1f);
|
||||
|
@ -431,11 +457,13 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in) {
|
|||
}
|
||||
}
|
||||
targetMip += w * h;
|
||||
if (w > 1)
|
||||
if (w > 1) {
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
}
|
||||
if (h > 1) {
|
||||
h /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
||||
|
@ -446,26 +474,26 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in) {
|
|||
}
|
||||
|
||||
void CTexture::BuildRGBA8FromGCN(CInputStream& in) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
int w = x4_w;
|
||||
int h = x6_h;
|
||||
RGBA8* targetMip = buf.get();
|
||||
for (u32 mip = 0; mip < x8_mips; ++mip) {
|
||||
int bwidth = (w + 3) / 4;
|
||||
int bheight = (h + 3) / 4;
|
||||
const int bwidth = (w + 3) / 4;
|
||||
const int bheight = (h + 3) / 4;
|
||||
for (int by = 0; by < bheight; ++by) {
|
||||
int baseY = by * 4;
|
||||
const int baseY = by * 4;
|
||||
for (int bx = 0; bx < bwidth; ++bx) {
|
||||
int baseX = bx * 4;
|
||||
const int baseX = bx * 4;
|
||||
for (int c = 0; c < 2; ++c) {
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
RGBA8* target = targetMip + (baseY + y) * w + baseX;
|
||||
u8 source[8];
|
||||
in.readBytesToBuf(source, 8);
|
||||
for (int x = 0; x < 4; ++x) {
|
||||
if (c) {
|
||||
std::array<u8, 8> source;
|
||||
in.readBytesToBuf(source.data(), source.size());
|
||||
for (size_t x = 0; x < 4; ++x) {
|
||||
if (c != 0) {
|
||||
target[x].g = source[x * 2];
|
||||
target[x].b = source[x * 2 + 1];
|
||||
} else {
|
||||
|
@ -478,11 +506,13 @@ void CTexture::BuildRGBA8FromGCN(CInputStream& in) {
|
|||
}
|
||||
}
|
||||
targetMip += w * h;
|
||||
if (w > 1)
|
||||
if (w > 1) {
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
}
|
||||
if (h > 1) {
|
||||
h /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat,
|
||||
|
@ -492,36 +522,30 @@ void CTexture::BuildRGBA8FromGCN(CInputStream& in) {
|
|||
} BooTrace);
|
||||
}
|
||||
|
||||
struct DXT1Block {
|
||||
uint16_t color1;
|
||||
uint16_t color2;
|
||||
uint8_t lines[4];
|
||||
};
|
||||
|
||||
void CTexture::BuildDXT1FromGCN(CInputStream& in) {
|
||||
size_t blockCount = ComputeMippedBlockCountDXT1();
|
||||
const size_t blockCount = ComputeMippedBlockCountDXT1();
|
||||
std::unique_ptr<DXT1Block[]> buf(new DXT1Block[blockCount]);
|
||||
|
||||
int w = x4_w / 4;
|
||||
int h = x6_h / 4;
|
||||
DXT1Block* targetMip = buf.get();
|
||||
for (u32 mip = 0; mip < x8_mips; ++mip) {
|
||||
int bwidth = (w + 1) / 2;
|
||||
int bheight = (h + 1) / 2;
|
||||
const int bwidth = (w + 1) / 2;
|
||||
const int bheight = (h + 1) / 2;
|
||||
for (int by = 0; by < bheight; ++by) {
|
||||
int baseY = by * 2;
|
||||
const int baseY = by * 2;
|
||||
for (int bx = 0; bx < bwidth; ++bx) {
|
||||
int baseX = bx * 2;
|
||||
const int baseX = bx * 2;
|
||||
for (int y = 0; y < 2; ++y) {
|
||||
DXT1Block* target = targetMip + (baseY + y) * w + baseX;
|
||||
DXT1Block source[2];
|
||||
in.readBytesToBuf(source, 16);
|
||||
for (int x = 0; x < 2; ++x) {
|
||||
std::array<DXT1Block, 2> source;
|
||||
in.readBytesToBuf(source.data(), sizeof(source));
|
||||
for (size_t x = 0; x < source.size(); ++x) {
|
||||
target[x].color1 = hecl::SBig(source[x].color1);
|
||||
target[x].color2 = hecl::SBig(source[x].color2);
|
||||
for (u32 i = 0; i < 4; ++i) {
|
||||
u8 ind[4];
|
||||
u8 packed = source[x].lines[i];
|
||||
for (size_t i = 0; i < 4; ++i) {
|
||||
std::array<u8, 4> ind;
|
||||
const u8 packed = source[x].lines[i];
|
||||
ind[3] = packed & 0x3;
|
||||
ind[2] = (packed >> 2) & 0x3;
|
||||
ind[1] = (packed >> 4) & 0x3;
|
||||
|
@ -534,11 +558,13 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in) {
|
|||
}
|
||||
targetMip += w * h;
|
||||
|
||||
if (w > 1)
|
||||
if (w > 1) {
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
}
|
||||
if (h > 1) {
|
||||
h /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::DXT1, boo::TextureClampMode::Repeat,
|
||||
|
@ -602,10 +628,9 @@ void CTexture::BuildC8Font(const void* data, EFontType ftype) {
|
|||
break;
|
||||
}
|
||||
|
||||
uint32_t nentries = hecl::SBig(*reinterpret_cast<const uint32_t*>(data));
|
||||
const uint32_t nentries = hecl::SBig(*reinterpret_cast<const uint32_t*>(data));
|
||||
const u8* texels = reinterpret_cast<const u8*>(data) + 4 + nentries * 4;
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount * layerCount]);
|
||||
memset(buf.get(), 0, texelCount * layerCount * 4);
|
||||
auto buf = std::make_unique<RGBA8[]>(texelCount * layerCount);
|
||||
|
||||
size_t w = x4_w;
|
||||
size_t h = x6_h;
|
||||
|
|
|
@ -88,8 +88,6 @@ void CWideScreenFilter::draw(const zeus::CColor& color, float t) {
|
|||
}
|
||||
}
|
||||
|
||||
void CWideScreenFilter::DrawFilter(EFilterShape shape, const zeus::CColor& color, float t) {}
|
||||
|
||||
float CWideScreenFilter::SetViewportToMatch(float t) {
|
||||
if (g_Viewport.aspect < 1.7777f) {
|
||||
float targetHeight = g_Viewport.x8_width / 1.7777f;
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
explicit CWideScreenFilter(EFilterType type) : m_top(type), m_bottom(type) {}
|
||||
explicit CWideScreenFilter(EFilterType type, const TLockedToken<CTexture>&) : CWideScreenFilter(type) {}
|
||||
void draw(const zeus::CColor& color, float t);
|
||||
void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t);
|
||||
void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t) { draw(color, t); }
|
||||
|
||||
static float SetViewportToMatch(float t);
|
||||
static void SetViewportToFull();
|
||||
|
|
|
@ -204,10 +204,10 @@ CFluidPlaneShader::CFluidPlaneShader(EFluidType type, const TLockedToken<CTextur
|
|||
, m_envBumpMap(envBumpMap)
|
||||
, m_lightmap(lightmap)
|
||||
, m_rippleMap(rippleMap) {
|
||||
SFluidPlaneShaderInfo shaderInfo(type, m_patternTex1.operator bool(), m_patternTex2.operator bool(),
|
||||
m_colorTex.operator bool(), m_bumpMap.operator bool(), m_envMap.operator bool(),
|
||||
m_envBumpMap.operator bool(), m_lightmap.operator bool(),
|
||||
m_rippleMap.operator bool(), doubleLightmapBlend, additive);
|
||||
SFluidPlaneShaderInfo shaderInfo(type, m_patternTex1.HasReference(), m_patternTex2.HasReference(),
|
||||
m_colorTex.HasReference(), m_bumpMap.HasReference(), m_envMap.HasReference(),
|
||||
m_envBumpMap.HasReference(), m_lightmap.HasReference(), m_rippleMap.operator bool(),
|
||||
doubleLightmapBlend, additive);
|
||||
m_pipelines = _cache.GetOrBuildShader(shaderInfo);
|
||||
PrepareBinding(maxVertCount);
|
||||
}
|
||||
|
@ -216,8 +216,8 @@ CFluidPlaneShader::CFluidPlaneShader(const TLockedToken<CTexture>& patternTex1,
|
|||
const TLockedToken<CTexture>& patternTex2, const TLockedToken<CTexture>& colorTex,
|
||||
u32 maxVertCount)
|
||||
: m_patternTex1(patternTex1), m_patternTex2(patternTex2), m_colorTex(colorTex) {
|
||||
SFluidPlaneDoorShaderInfo shaderInfo(m_patternTex1.operator bool(), m_patternTex2.operator bool(),
|
||||
m_colorTex.operator bool());
|
||||
SFluidPlaneDoorShaderInfo shaderInfo(m_patternTex1.HasReference(), m_patternTex2.HasReference(),
|
||||
m_colorTex.HasReference());
|
||||
m_pipelines = _cache.GetOrBuildShader(shaderInfo);
|
||||
PrepareBinding(maxVertCount);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noT
|
|||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noTexAdditiveZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noTexAdditiveNoZWrite;
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||
|
||||
void CParticleSwooshShaders::Initialize() {
|
||||
m_texZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderTexZWrite{}),
|
||||
hecl::conv->convert(Shader_CParticleSwooshShaderTexZWriteAWrite{})};
|
||||
|
|
|
@ -349,7 +349,7 @@ void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager
|
|||
const TUniqueId targetId = mgr.GetPlayer().GetOrbitTargetId();
|
||||
if (targetId != xf0_targetId) {
|
||||
if (targetId != kInvalidUniqueId) {
|
||||
if (const TCastToConstPtr<CScriptGrapplePoint> point = mgr.GetObjectById(targetId)) {
|
||||
if (TCastToConstPtr<CScriptGrapplePoint>(mgr.GetObjectById(targetId))) {
|
||||
CSfxManager::SfxStart(SFXui_lockon_grapple, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
} else {
|
||||
CSfxManager::SfxStart(SFXui_lockon_poi, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
|
|
|
@ -187,12 +187,15 @@ void CGuiFrame::LoadWidgetsInGame(CInputStream& in, CSimplePool* sp) {
|
|||
}
|
||||
|
||||
void CGuiFrame::ProcessUserInput(const CFinalInput& input) const {
|
||||
if (input.ControllerIdx() != 0)
|
||||
if (input.ControllerIdx() != 0) {
|
||||
return;
|
||||
for (auto& widget : x2c_widgets) {
|
||||
if (widget->GetIsActive())
|
||||
}
|
||||
|
||||
for (const auto& widget : x2c_widgets) {
|
||||
if (widget->GetIsActive()) {
|
||||
widget->ProcessUserInput(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CGuiFrame::ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDrawParms& parms) {
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace urde {
|
|||
|
||||
CGuiPane::CGuiPane(const CGuiWidgetParms& parms, const zeus::CVector2f& dim, const zeus::CVector3f& scaleCenter)
|
||||
: CGuiWidget(parms), xb8_dim(dim), xc8_scaleCenter(scaleCenter) {
|
||||
InitializeBuffers();
|
||||
CGuiPane::InitializeBuffers();
|
||||
}
|
||||
|
||||
void CGuiPane::ScaleDimensions(const zeus::CVector3f& scale) {
|
||||
|
|
|
@ -33,12 +33,15 @@ void CGuiSliderGroup::StartIncreasing() {
|
|||
}
|
||||
|
||||
bool CGuiSliderGroup::TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2f& point) const {
|
||||
if (xcc_sliderRangeWidgets[0]->GetWidgetTypeID() != FOURCC('MODL'))
|
||||
if (xcc_sliderRangeWidgets[0]->GetWidgetTypeID() != FOURCC('MODL')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CGuiModel* bar = static_cast<CGuiModel*>(xcc_sliderRangeWidgets[0]);
|
||||
auto& modelTok = bar->GetModel();
|
||||
if (!modelTok || !modelTok.IsLoaded())
|
||||
const auto& modelTok = bar->GetModel();
|
||||
if (!modelTok || !modelTok.IsLoaded()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const zeus::CVector3f& s0 = xcc_sliderRangeWidgets[0]->GetIdlePosition();
|
||||
const zeus::CVector3f& s1 = xcc_sliderRangeWidgets[1]->GetIdlePosition();
|
||||
|
|
|
@ -68,7 +68,7 @@ float CGuiTextSupport::GetCurrentAnimationOverAge() const {
|
|||
if (const CTextRenderBuffer* buf = GetCurrentPageRenderBuffer()) {
|
||||
if (x50_typeEnable) {
|
||||
if (x40_primStartTimes.size()) {
|
||||
auto& lastTime = x40_primStartTimes.back();
|
||||
const auto& lastTime = x40_primStartTimes.back();
|
||||
ret = std::max(ret, (buf->GetPrimitiveCount() - lastTime.second) / x58_chRate + lastTime.first);
|
||||
} else {
|
||||
ret = std::max(ret, buf->GetPrimitiveCount() / x58_chRate);
|
||||
|
|
|
@ -13,23 +13,23 @@
|
|||
namespace urde {
|
||||
|
||||
constexpr std::array BaseMenuNames{
|
||||
"BaseWidget_VisorMenu",
|
||||
"BaseWidget_BeamMenu",
|
||||
"BaseWidget_VisorMenu"sv,
|
||||
"BaseWidget_BeamMenu"sv,
|
||||
};
|
||||
|
||||
constexpr std::array TextNames{
|
||||
"TextPane_VisorMenu",
|
||||
"TextPane_BeamMenu",
|
||||
"TextPane_VisorMenu"sv,
|
||||
"TextPane_BeamMenu"sv,
|
||||
};
|
||||
|
||||
constexpr std::array BaseTitleNames{
|
||||
"basewidget_visormenutitle",
|
||||
"basewidget_beammenutitle",
|
||||
"basewidget_visormenutitle"sv,
|
||||
"basewidget_beammenutitle"sv,
|
||||
};
|
||||
|
||||
constexpr std::array ModelNames{
|
||||
"model_visor",
|
||||
"model_beam",
|
||||
"model_visor"sv,
|
||||
"model_beam"sv,
|
||||
};
|
||||
|
||||
constexpr std::array<std::array<char, 4>, 2> MenuItemOrders{{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
namespace urde {
|
||||
|
||||
static float u16stof(char16_t* str) {
|
||||
static float u16stof(const char16_t* str) {
|
||||
char cstr[16];
|
||||
int i;
|
||||
for (i = 0; i < 15 && str[i] != u'\0'; ++i)
|
||||
|
|
|
@ -289,7 +289,7 @@ void CMFGameLoader::MakeLoadDependencyList() {
|
|||
static constexpr std::array loadDepPAKs{"TestAnim", "SamusGun", "SamGunFx"};
|
||||
|
||||
std::vector<SObjectTag> tags;
|
||||
for (const auto pak : loadDepPAKs) {
|
||||
for (const auto* const pak : loadDepPAKs) {
|
||||
g_ResFactory->GetTagListForFile(pak, tags);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
#include "Runtime/MP1/CSlideShow.hpp"
|
||||
|
||||
#include "Editor/ProjectManager.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
#include "Editor/ProjectManager.hpp"
|
||||
#include "Runtime/GameGlobalObjects.hpp"
|
||||
|
||||
namespace urde {
|
||||
namespace {
|
||||
bool AreAllDepsLoaded(const std::vector<TLockedToken<CDependencyGroup>>& deps) {
|
||||
return std::all_of(deps.cbegin(), deps.cend(), [](const auto& dep) { return dep.IsLoaded(); });
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
CSlideShow::CSlideShow() : CIOWin("SlideShow"), x130_(g_tweakSlideShow->GetX54()) {
|
||||
const SObjectTag* font = g_ResFactory->GetResourceIdByName(g_tweakSlideShow->GetFont());
|
||||
|
@ -58,14 +64,6 @@ bool CSlideShow::LoadTXTRDep(std::string_view name) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CSlideShow::AreAllDepsLoaded(const std::vector<TLockedToken<CDependencyGroup>>& deps) {
|
||||
for (const TLockedToken<CDependencyGroup>& token : deps) {
|
||||
if (!token.IsLoaded())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
CIOWin::EMessageReturn CSlideShow::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) {
|
||||
switch (msg.GetType()) {
|
||||
case EArchMsgType::TimerTick: {
|
||||
|
|
|
@ -98,7 +98,6 @@ private:
|
|||
bool x135_24_ : 1 = true;
|
||||
|
||||
bool LoadTXTRDep(std::string_view name);
|
||||
static bool AreAllDepsLoaded(const std::vector<TLockedToken<CDependencyGroup>>& deps);
|
||||
|
||||
public:
|
||||
CSlideShow();
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
|
||||
#include <logvisor/logvisor.hpp>
|
||||
|
||||
namespace urde {
|
||||
|
||||
namespace MP1 {
|
||||
namespace urde::MP1 {
|
||||
|
||||
static logvisor::Module Log("MP1::CTweaks");
|
||||
|
||||
|
@ -136,5 +134,4 @@ void CTweaks::RegisterResourceTweaks(hecl::CVarManager* cvarMgr) {
|
|||
g_tweakPlayerRes->initCVars(cvarMgr);
|
||||
}
|
||||
|
||||
} // namespace MP1
|
||||
} // namespace urde
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -228,7 +228,7 @@ void CBurrower::Active(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
x6ac_24_doFacePlayer = true;
|
||||
x32c_animState = EAnimState::Ready;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 0);
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 0);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x6ac_24_doFacePlayer = false;
|
||||
x6ac_25_inAir = true;
|
||||
|
@ -267,7 +267,7 @@ void CBurrower::Retreat(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (msg == EStateMsg::Activate) {
|
||||
x32c_animState = EAnimState::Ready;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 1);
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 1);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
if (x678_trailParticle) {
|
||||
|
|
|
@ -405,7 +405,7 @@ void CChozoGhost::Deactivate(CStateManager& mgr, EStateMsg msg, float) {
|
|||
x32c_animState = EAnimState::Ready;
|
||||
x665_24_ = true;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 1);
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 1);
|
||||
if (x32c_animState == EAnimState::Repeat)
|
||||
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Relaxed);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "Runtime/MP1/World/CElitePirate.hpp"
|
||||
|
||||
#include "Runtime/Camera/CFirstPersonCamera.hpp"
|
||||
#include "Runtime/Collision/CCollisionActor.hpp"
|
||||
#include "Runtime/Collision/CCollisionActorManager.hpp"
|
||||
#include "Runtime/CSimplePool.hpp"
|
||||
|
@ -248,10 +249,10 @@ void CElitePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
|
|||
|
||||
void CElitePirate::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
|
||||
CPatterned::PreRender(mgr, frustum);
|
||||
auto modelData = GetModelData();
|
||||
auto* modelData = GetModelData();
|
||||
x6f8_boneTracking.PreRender(mgr, *modelData->GetAnimationData(), GetTransform(), modelData->GetScale(),
|
||||
*x450_bodyController);
|
||||
auto numMaterialSets = modelData->GetNumMaterialSets();
|
||||
const auto numMaterialSets = modelData->GetNumMaterialSets();
|
||||
xb4_drawFlags.x1_matSetIdx =
|
||||
numMaterialSets - 1 < x7cc_activeMaterialSet ? numMaterialSets - 1 : x7cc_activeMaterialSet;
|
||||
}
|
||||
|
@ -292,27 +293,22 @@ zeus::CVector3f CElitePirate::GetAimPosition(const CStateManager& mgr, float) co
|
|||
}
|
||||
|
||||
void CElitePirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
|
||||
bool handled = false;
|
||||
switch (type) {
|
||||
case EUserEventType::Projectile:
|
||||
if (x772_launcherId != kInvalidUniqueId) {
|
||||
CEntity* launcher = mgr.ObjectById(x772_launcherId);
|
||||
mgr.SendScriptMsg(launcher, GetUniqueId(), EScriptObjectMessage::Action);
|
||||
}
|
||||
handled = true;
|
||||
break;
|
||||
return;
|
||||
case EUserEventType::DamageOn:
|
||||
handled = true;
|
||||
x988_24_damageOn = true;
|
||||
break;
|
||||
return;
|
||||
case EUserEventType::DamageOff:
|
||||
handled = true;
|
||||
x988_24_damageOn = false;
|
||||
break;
|
||||
return;
|
||||
case EUserEventType::ScreenShake:
|
||||
HasWeakPointHead();
|
||||
handled = true;
|
||||
break;
|
||||
ShakeCamera(mgr);
|
||||
return;
|
||||
case EUserEventType::BeginAction: {
|
||||
const zeus::CVector3f origin = GetTranslation();
|
||||
const zeus::CVector3f front = GetTransform().frontVector();
|
||||
|
@ -325,8 +321,7 @@ void CElitePirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node
|
|||
mgr.AddObject(new CShockWave(mgr.AllocateUniqueId(), "Shock Wave", {GetAreaIdAlways(), CEntity::NullConnectionList},
|
||||
xf, GetUniqueId(), GetShockWaveData(), IsElitePirate() ? 2.f : 1.3f,
|
||||
IsElitePirate() ? 0.4f : 0.5f));
|
||||
handled = true;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
case EUserEventType::BecomeShootThrough:
|
||||
if (HasWeakPointHead()) {
|
||||
|
@ -338,14 +333,11 @@ void CElitePirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node
|
|||
}
|
||||
}
|
||||
}
|
||||
handled = true;
|
||||
break;
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!handled) {
|
||||
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
|
||||
}
|
||||
}
|
||||
|
||||
const CCollisionPrimitive* CElitePirate::GetCollisionPrimitive() const { return &x738_collisionAabb; }
|
||||
|
@ -757,7 +749,7 @@ void CElitePirate::SetupHealthInfo(CStateManager& mgr) {
|
|||
x7b4_hp = health->GetHP();
|
||||
if (HasWeakPointHead()) {
|
||||
if (TCastToPtr<CCollisionActor> actor = mgr.ObjectById(x770_collisionHeadId)) {
|
||||
auto actHealth = actor->HealthInfo(mgr);
|
||||
auto* actHealth = actor->HealthInfo(mgr);
|
||||
actHealth->SetHP(health->GetHP());
|
||||
actHealth->SetKnockbackResistance(health->GetKnockbackResistance());
|
||||
actor->SetDamageVulnerability(x56c_vulnerability);
|
||||
|
@ -940,21 +932,23 @@ void CElitePirate::CreateEnergyAbsorb(CStateManager& mgr, const zeus::CTransform
|
|||
|
||||
void CElitePirate::SetupLauncherHealthInfo(CStateManager& mgr, TUniqueId uid) {
|
||||
const CHealthInfo* const health = HealthInfo(mgr);
|
||||
if (uid != kInvalidUniqueId) {
|
||||
if (TCastToPtr<CCollisionActor> actor = mgr.ObjectById(uid)) {
|
||||
auto actHealth = actor->HealthInfo(mgr);
|
||||
if (uid == kInvalidUniqueId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (const TCastToPtr<CCollisionActor> actor = mgr.ObjectById(uid)) {
|
||||
auto* actHealth = actor->HealthInfo(mgr);
|
||||
actHealth->SetHP(x5d8_data.GetLauncherHP());
|
||||
actHealth->SetKnockbackResistance(health->GetKnockbackResistance());
|
||||
actor->SetDamageVulnerability(x56c_vulnerability);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CElitePirate::SetLauncherActive(CStateManager& mgr, bool val, TUniqueId uid) {
|
||||
if (uid == kInvalidUniqueId) {
|
||||
return;
|
||||
}
|
||||
if (auto entity = mgr.ObjectById(uid)) {
|
||||
if (auto* entity = mgr.ObjectById(uid)) {
|
||||
mgr.SendScriptMsg(entity, GetUniqueId(), val ? EScriptObjectMessage::Start : EScriptObjectMessage::Stop);
|
||||
}
|
||||
}
|
||||
|
@ -1178,6 +1172,25 @@ bool CElitePirate::IsClosestEnergyAttractor(const CStateManager& mgr,
|
|||
return true;
|
||||
}
|
||||
|
||||
void CElitePirate::ShakeCamera(CStateManager& mgr) {
|
||||
CPlayer& player = mgr.GetPlayer();
|
||||
const float distance = (GetTranslation() - player.GetTranslation()).magnitude();
|
||||
const float scale = x988_29_shockWaveAnim ? 1.f : 0.25f;
|
||||
const float magnitude = (scale * GetModelData()->GetScale().magnitude()) - (0.005f * distance);
|
||||
if (magnitude <= 0.f || player.GetSurfaceRestraint() == CPlayer::ESurfaceRestraints::Air ||
|
||||
player.IsInWaterMovement()) {
|
||||
return;
|
||||
}
|
||||
if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed) {
|
||||
const float intensity = x988_29_shockWaveAnim ? 20.f : 10.f;
|
||||
player.ApplyImpulseWR(player.GetMass() * intensity * zeus::skUp, zeus::CAxisAngle{});
|
||||
player.SetMoveState(CPlayer::EPlayerMovementState::ApplyJump, mgr);
|
||||
} else if (mgr.GetCameraManager()->GetCurrentCameraId() ==
|
||||
mgr.GetCameraManager()->GetFirstPersonCamera()->GetUniqueId()) {
|
||||
mgr.GetCameraManager()->AddCameraShaker(CCameraShakeData{0.5f, magnitude}, true);
|
||||
}
|
||||
}
|
||||
|
||||
zeus::CVector3f CElitePirate::SPositionHistory::GetValue(const zeus::CVector3f& pos, const zeus::CVector3f& face) {
|
||||
while (!x4_values.empty()) {
|
||||
const zeus::CVector3f v = x4_values.back() - pos;
|
||||
|
|
|
@ -244,5 +244,6 @@ private:
|
|||
const zeus::CVector3f& vec) const;
|
||||
bool IsClosestEnergyAttractor(const CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024>& charNearList,
|
||||
const zeus::CVector3f& projectilePos) const;
|
||||
void ShakeCamera(CStateManager& mgr);
|
||||
};
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -350,7 +350,7 @@ void CMagdolite::Generate(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
x32c_animState = EAnimState::Ready;
|
||||
x754_24_retreat = false;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 0);
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 0);
|
||||
if (x32c_animState == EAnimState::Repeat) {
|
||||
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Relaxed);
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ void CMagdolite::Retreat(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
GetBodyController()->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::NextState));
|
||||
x754_28_alert = true;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 1);
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 1);
|
||||
if (x32c_animState == EAnimState::Repeat) {
|
||||
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal7);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ CMetaree::CMetaree(TUniqueId uid, std::string_view name, EFlavorType flavor, con
|
|||
: CPatterned(ECharacter::Metaree, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer,
|
||||
EColliderType::Zero, bodyType, aParms, EKnockBackVariant::Small)
|
||||
, x568_delay(f3)
|
||||
, x56c_(f4)
|
||||
, x56c_haltDelay(f4)
|
||||
, x570_dropHeight(f1)
|
||||
, x574_offset(v1)
|
||||
, x580_attackSpeed(f2)
|
||||
|
@ -29,10 +29,11 @@ void CMetaree::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
|||
void CMetaree::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||
CPatterned::AcceptScriptMsg(msg, uid, mgr);
|
||||
|
||||
if (msg == EScriptObjectMessage::Start)
|
||||
if (msg == EScriptObjectMessage::Start) {
|
||||
x5ca_25_started = true;
|
||||
else if (msg == EScriptObjectMessage::Registered)
|
||||
} else if (msg == EScriptObjectMessage::Registered) {
|
||||
x450_bodyController->Activate(mgr);
|
||||
}
|
||||
}
|
||||
|
||||
void CMetaree::Think(float dt, CStateManager& mgr) {
|
||||
|
@ -46,8 +47,9 @@ void CMetaree::Think(float dt, CStateManager& mgr) {
|
|||
}
|
||||
|
||||
void CMetaree::Explode(CStateManager& mgr, EStateMsg msg, float) {
|
||||
if (msg != EStateMsg::Activate)
|
||||
if (msg != EStateMsg::Activate) {
|
||||
return;
|
||||
}
|
||||
|
||||
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x5ac_damageInfo,
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
||||
|
@ -55,12 +57,14 @@ void CMetaree::Explode(CStateManager& mgr, EStateMsg msg, float) {
|
|||
}
|
||||
|
||||
void CMetaree::Touch(CActor& act, CStateManager& mgr) {
|
||||
if (!x400_25_alive)
|
||||
if (!x400_25_alive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (TCastToPtr<CGameProjectile> projectile = act) {
|
||||
if (projectile->GetOwnerId() != mgr.GetPlayer().GetUniqueId())
|
||||
if (projectile->GetOwnerId() != mgr.GetPlayer().GetUniqueId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
x400_24_hitByPlayerProjectile = true;
|
||||
x590_projectileDelta = projectile->GetTranslation() - projectile->GetPreviousPos();
|
||||
|
@ -68,8 +72,9 @@ void CMetaree::Touch(CActor& act, CStateManager& mgr) {
|
|||
}
|
||||
|
||||
void CMetaree::CollidedWith(TUniqueId id, const CCollisionInfoList& colList, CStateManager& mgr) {
|
||||
if (!x400_25_alive || colList.GetCount() <= 0)
|
||||
if (!x400_25_alive || colList.GetCount() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
mgr.ApplyDamageToWorld(GetUniqueId(), *this, GetTranslation(), x5ac_damageInfo,
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Player}));
|
||||
|
@ -79,15 +84,15 @@ void CMetaree::CollidedWith(TUniqueId id, const CCollisionInfoList& colList, CSt
|
|||
|
||||
void CMetaree::Flee(CStateManager& mgr, EStateMsg msg, float) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
ApplyImpulseWR(5.f * (GetMass() * (x590_projectileDelta * zeus::CVector3f{1.f, 1.f, 0.f})),
|
||||
zeus::CAxisAngle());
|
||||
ApplyImpulseWR(5.f * (GetMass() * (x590_projectileDelta * zeus::CVector3f{1.f, 1.f, 0.f})), zeus::CAxisAngle());
|
||||
|
||||
SetMomentumWR({0.f, 0.f, -GetGravityConstant() * GetMass()});
|
||||
SetTranslation(GetTranslation());
|
||||
x5a8_ = 0;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (x5a8_ != 0)
|
||||
if (x5a8_ != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::LieOnGround) {
|
||||
x5a8_ = 1;
|
||||
|
@ -99,8 +104,9 @@ void CMetaree::Flee(CStateManager& mgr, EStateMsg msg, float) {
|
|||
}
|
||||
|
||||
void CMetaree::Dead(CStateManager& mgr, EStateMsg msg, float) {
|
||||
if (msg != EStateMsg::Activate)
|
||||
if (msg != EStateMsg::Activate) {
|
||||
return;
|
||||
}
|
||||
|
||||
mgr.ApplyDamageToWorld(GetUniqueId(), *this, GetTranslation(), x5ac_damageInfo,
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Player}, {}));
|
||||
|
@ -116,9 +122,9 @@ void CMetaree::Attack(CStateManager&, EStateMsg msg, float) {
|
|||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat);
|
||||
x59c_velocity = x580_attackSpeed * dir;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (x450_bodyController->GetPercentageFrozen() == 0.f)
|
||||
if (x450_bodyController->GetPercentageFrozen() == 0.f) {
|
||||
SetVelocityWR(x59c_velocity);
|
||||
else {
|
||||
} else {
|
||||
Stop();
|
||||
SetVelocityWR({});
|
||||
}
|
||||
|
@ -126,15 +132,17 @@ void CMetaree::Attack(CStateManager&, EStateMsg msg, float) {
|
|||
}
|
||||
|
||||
void CMetaree::Halt(CStateManager& mgr, EStateMsg msg, float) {
|
||||
if (msg != EStateMsg::Activate)
|
||||
if (msg != EStateMsg::Activate) {
|
||||
return;
|
||||
}
|
||||
|
||||
Stop();
|
||||
SetVelocityWR({});
|
||||
SetMomentumWR({});
|
||||
SetVelocityWR(zeus::skZero3f);
|
||||
SetMomentumWR(zeus::skZero3f);
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Lurk);
|
||||
x584_lookPos = x574_offset + mgr.GetPlayer().GetTranslation();
|
||||
SetTransform(zeus::lookAt(GetTranslation(), x584_lookPos));
|
||||
x330_stateMachineState.SetDelay(x56c_haltDelay);
|
||||
}
|
||||
|
||||
void CMetaree::Active(CStateManager& mgr, EStateMsg msg, float) {
|
||||
|
@ -153,8 +161,7 @@ void CMetaree::Active(CStateManager& mgr, EStateMsg msg, float) {
|
|||
|
||||
void CMetaree::InActive(CStateManager&, EStateMsg msg, float) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
const auto locomotionType = x5ca_26_deactivated ? pas::ELocomotionType::Crouch
|
||||
: pas::ELocomotionType::Relaxed;
|
||||
const auto locomotionType = x5ca_26_deactivated ? pas::ELocomotionType::Crouch : pas::ELocomotionType::Relaxed;
|
||||
x450_bodyController->SetLocomotionType(locomotionType);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x5ca_26_deactivated = true;
|
||||
|
@ -162,8 +169,9 @@ void CMetaree::InActive(CStateManager&, EStateMsg msg, float) {
|
|||
}
|
||||
|
||||
bool CMetaree::InRange(CStateManager& mgr, float arg) {
|
||||
if (x5ca_25_started)
|
||||
if (x5ca_25_started) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return CPatterned::InRange(mgr, arg);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
namespace urde::MP1 {
|
||||
class CMetaree : public CPatterned {
|
||||
float x568_delay;
|
||||
float x56c_;
|
||||
float x56c_haltDelay;
|
||||
float x570_dropHeight;
|
||||
zeus::CVector3f x574_offset;
|
||||
float x580_attackSpeed;
|
||||
|
@ -20,16 +20,9 @@ class CMetaree : public CPatterned {
|
|||
u32 x5a8_ = 0;
|
||||
CDamageInfo x5ac_damageInfo;
|
||||
u16 x5c8_attackSfx = SFXsfx0225;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
bool x5ca_24_ : 1;
|
||||
bool x5ca_25_started : 1;
|
||||
bool x5ca_26_deactivated : 1;
|
||||
};
|
||||
u16 _dummy;
|
||||
};
|
||||
|
||||
u32 x5cc_;
|
||||
|
||||
public:
|
||||
|
|
|
@ -162,9 +162,9 @@ void CPhazonHealingNodule::UpdateParticleElectric(CStateManager& mgr) {
|
|||
if (!x57c_particleElectric) {
|
||||
return;
|
||||
}
|
||||
if (auto entity = static_cast<const CPatterned*>(mgr.GetObjectById(x56e_connId))) {
|
||||
auto electricityLctrXf = GetLctrTransform("Electricity_LCTR"sv);
|
||||
auto actorLctrXf = entity->GetLctrTransform(x58c_actorLctr);
|
||||
if (const auto* entity = static_cast<const CPatterned*>(mgr.GetObjectById(x56e_connId))) {
|
||||
const auto electricityLctrXf = GetLctrTransform("Electricity_LCTR"sv);
|
||||
const auto actorLctrXf = entity->GetLctrTransform(x58c_actorLctr);
|
||||
x57c_particleElectric->SetOverrideIPos(electricityLctrXf.origin);
|
||||
x57c_particleElectric->SetOverrideFPos(actorLctrXf.origin);
|
||||
}
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
#include "Runtime/World/CScriptWaypoint.hpp"
|
||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||
|
||||
namespace urde {
|
||||
namespace MP1 {
|
||||
|
||||
namespace urde::MP1 {
|
||||
namespace {
|
||||
struct SSomeRidleyStruct {
|
||||
u32 x0_;
|
||||
|
@ -116,11 +114,14 @@ constexpr std::array<std::array<SSomeRidleyStruct2, 12>, 5> skSomeRidleyStruct{{
|
|||
}},
|
||||
}};
|
||||
|
||||
constexpr std::array<SSomeRidleyStruct, 5> skSomeStruct{{{4, 6, 50.f, 50.f, 0.f, 33.f, 0.f, 1, 0, 0, 0, 0},
|
||||
constexpr std::array<SSomeRidleyStruct, 5> skSomeStruct{{
|
||||
{4, 6, 50.f, 50.f, 0.f, 33.f, 0.f, 1, 0, 0, 0, 0},
|
||||
{4, 6, 20.f, 20.f, 60.f, 50.f, 0.f, 2, 0, 0, 0, 0},
|
||||
{4, 6, 40.f, 40.f, 20.f, 50.f, 50.f, 2, 1, 0, 0, 0},
|
||||
{3, 5, 10.f, 15.f, 75.f, 100.f, 25.f, 2, 0, 0, 0, 0},
|
||||
{3, 5, 30.f, 30.f, 40.f, 50.f, 50.f, 2, 1, 0, 0, 0}}};
|
||||
{3, 5, 30.f, 30.f, 40.f, 50.f, 50.f, 2, 1, 0, 0, 0},
|
||||
}};
|
||||
|
||||
constexpr std::array skWingBones{
|
||||
"L_wingBone1_1"sv, "L_wingBone1_2"sv, "L_wingBone2_1"sv, "L_wingBone2_2"sv, "L_wingBone3_1"sv,
|
||||
"L_wingBone3_2"sv, "L_wingFlesh1_1"sv, "L_wingFlesh1_2"sv, "L_wingFlesh2_1"sv, "L_wingFlesh2_2"sv,
|
||||
|
@ -131,30 +132,11 @@ constexpr std::array skWingBones{
|
|||
};
|
||||
|
||||
constexpr std::array skWingEffects{
|
||||
"WingSmokeSmall1"sv,
|
||||
"WingSmokeSmall2"sv,
|
||||
"WingSmokeSmall3"sv,
|
||||
"WingSmokeSmall4"sv,
|
||||
"WingSmokeSmall5"sv,
|
||||
"WingSmokeSmall6"sv,
|
||||
"WingSmokeSmall7"sv,
|
||||
"WingSmokeSmall8"sv
|
||||
"WingFire1"sv,
|
||||
"WingFire2"sv,
|
||||
"WingFire3"sv,
|
||||
"WingFire4"sv,
|
||||
"WingFire5"sv,
|
||||
"WingFire6"sv,
|
||||
"WingFire7"sv,
|
||||
"WingFire8"sv,
|
||||
"WingSparks1"sv,
|
||||
"WingSparks2"sv,
|
||||
"WingSparks3"sv,
|
||||
"WingSparks4"sv,
|
||||
"WingSparks5"sv,
|
||||
"WingSparks6"sv,
|
||||
"WingSparks7"sv,
|
||||
"WingSparks8"sv,
|
||||
"WingSmokeSmall1"sv, "WingSmokeSmall2"sv, "WingSmokeSmall3"sv, "WingSmokeSmall4"sv, "WingSmokeSmall5"sv,
|
||||
"WingSmokeSmall6"sv, "WingSmokeSmall7"sv, "WingSmokeSmall8"sv, "WingFire1"sv, "WingFire2"sv,
|
||||
"WingFire3"sv, "WingFire4"sv, "WingFire5"sv, "WingFire6"sv, "WingFire7"sv,
|
||||
"WingFire8"sv, "WingSparks1"sv, "WingSparks2"sv, "WingSparks3"sv, "WingSparks4"sv,
|
||||
"WingSparks5"sv, "WingSparks6"sv, "WingSparks7"sv, "WingSparks8"sv,
|
||||
};
|
||||
|
||||
constexpr std::array<SOBBRadiiJointInfo, 4> skTail{{
|
||||
|
@ -167,7 +149,7 @@ constexpr std::array<SOBBRadiiJointInfo, 4> skTail{{
|
|||
constexpr std::array<SSphereJointInfo, 10> skSphereJoints{{
|
||||
{"Skeleton_Root", 0.6f},
|
||||
{"Spine_2", 0.6f},
|
||||
{"breastPlate_LCTR", 0.6f},
|
||||
{"breastPlate_LCTR", 0.3f},
|
||||
{"Head_1", 0.6f},
|
||||
{"L_wrist", 0.5f},
|
||||
{"R_wrist", 0.5f},
|
||||
|
@ -186,14 +168,16 @@ struct SSomeRidleyStruct3 {
|
|||
float x14_;
|
||||
};
|
||||
|
||||
constexpr std::array<SSomeRidleyStruct3, 6> skFloats{{{0.0, 20.0, 40.0, 0.0, 0.0, 40.0},
|
||||
constexpr std::array<SSomeRidleyStruct3, 6> skFloats{{
|
||||
{0.0, 20.0, 40.0, 0.0, 0.0, 40.0},
|
||||
{0.0, 0.0, 70.0, 0.0, 0.0, 30.0},
|
||||
{0.0, 60.0, 0.0, 0.0, 0.0, 40.0},
|
||||
{0.0, 40.0, 30.0, 0.0, 0.0, 30.0},
|
||||
{0.0, 0.0, 50.0, 0.0, 0.0, 50.0},
|
||||
{0.0, 40.0, 60.0, 0.0, 0.0, 0.0}}};
|
||||
{0.0, 40.0, 60.0, 0.0, 0.0, 0.0},
|
||||
}};
|
||||
|
||||
const CDamageVulnerability skDirectNormal{EVulnerability::DirectNormal, EVulnerability::DirectNormal,
|
||||
constexpr CDamageVulnerability skDirectNormal{EVulnerability::DirectNormal, EVulnerability::DirectNormal,
|
||||
EVulnerability::DirectNormal, EVulnerability::DirectNormal,
|
||||
EVulnerability::DirectNormal, EVulnerability::DirectNormal,
|
||||
EVulnerability::DirectNormal, EVulnerability::DirectNormal,
|
||||
|
@ -201,7 +185,7 @@ const CDamageVulnerability skDirectNormal{EVulnerability::DirectNormal, EVulnera
|
|||
EVulnerability::DirectNormal, EVulnerability::DirectNormal,
|
||||
EVulnerability::DirectNormal, EVulnerability::DirectNormal,
|
||||
EVulnerability::DirectNormal, EDeflectType::None};
|
||||
const CDamageVulnerability skIceWeakness{EVulnerability::DirectNormal, EVulnerability::DirectWeak,
|
||||
constexpr CDamageVulnerability skIceWeakness{EVulnerability::DirectNormal, EVulnerability::DirectWeak,
|
||||
EVulnerability::DirectNormal, EVulnerability::DirectNormal,
|
||||
EVulnerability::DirectNormal, EVulnerability::DirectNormal,
|
||||
EVulnerability::DirectNormal, EVulnerability::DirectNormal,
|
||||
|
@ -289,12 +273,13 @@ CRidley::CRidley(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
|||
xc14_.Token().Lock();
|
||||
xc3c_.Token().Lock();
|
||||
|
||||
if (xce0_)
|
||||
if (xce0_) {
|
||||
xce0_->SetParticleEmission(false);
|
||||
}
|
||||
|
||||
const auto& animData = GetModelData()->GetAnimationData();
|
||||
for (size_t i = 0; i < skWingBones.size(); ++i) {
|
||||
xce4_wingBoneIds.push_back(animData->GetLocatorSegId(skWingBones[i]));
|
||||
for (const auto& wingBone : skWingBones) {
|
||||
xce4_wingBoneIds.push_back(animData->GetLocatorSegId(wingBone));
|
||||
}
|
||||
|
||||
xae4_ = GetModelData()->GetScale().x() *
|
||||
|
@ -344,7 +329,6 @@ void CRidley::SetupCollisionActorManager(urde::CStateManager& mgr) {
|
|||
include.Remove(EMaterialTypes::Platform);
|
||||
SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(include, exclude));
|
||||
AddMaterial(EMaterialTypes::ProjectilePassthrough);
|
||||
// mgr.SendScriptMsg(this, GetUniqueId(), EScriptObjectMessage::Reset);
|
||||
}
|
||||
|
||||
void CRidley::SetupCollisionActors(CStateManager& mgr) {
|
||||
|
@ -387,7 +371,7 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
|||
case EScriptObjectMessage::Reset: {
|
||||
xa34_26_ = true;
|
||||
if (!GetActive()) {
|
||||
AcceptScriptMsg(EScriptObjectMessage::Activate, uid, mgr);
|
||||
CPatterned::AcceptScriptMsg(EScriptObjectMessage::Activate, uid, mgr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -416,8 +400,9 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
|||
}
|
||||
case EScriptObjectMessage::InitializedInArea: {
|
||||
TUniqueId wpId = GetWaypointForState(mgr, EScriptObjectState::Patrol, EScriptObjectMessage::Follow);
|
||||
if (wpId == kInvalidUniqueId)
|
||||
if (wpId == kInvalidUniqueId) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(wpId)) {
|
||||
xa84_ = wp->GetTransform();
|
||||
|
@ -441,14 +426,27 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
|||
colAct->HealthInfo(mgr)->SetHP(1000.f);
|
||||
bool dontKnockback = false;
|
||||
if (xc64_aiStage == 2) {
|
||||
if (xa33_28_) {
|
||||
dontKnockback = true;
|
||||
} else {
|
||||
if (!xa33_28_) {
|
||||
bool r26 = false;
|
||||
xb10_ -= lowHealth;
|
||||
xb24_ = 0.33f;
|
||||
x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f);
|
||||
if (xb10_ <= 0.f) {
|
||||
if (xb10_ > 0.f) {
|
||||
if (xb10_ >= xcbc_&& xa33_26_ && !xa31_31_ && lowHealth > x568_data.x3f4_) {
|
||||
dontKnockback = true;
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Zero));
|
||||
} else {
|
||||
xa32_27_ = true;
|
||||
dontKnockback = true;
|
||||
xcb0_ += 1;
|
||||
xcb0_ = xcb0_ < 5 ? xcb0_ : 4;
|
||||
r26 = true;
|
||||
xcbc_ = .2f * float(5 - (xcb0_ + 1)) * xcb8_;
|
||||
xcb4_ = 0;
|
||||
xcc8_ = 2.f * 0.33f;
|
||||
}
|
||||
} else {
|
||||
xc64_aiStage = 3;
|
||||
xa31_25_ = false;
|
||||
sub80257650(mgr);
|
||||
|
@ -461,37 +459,28 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
|||
|
||||
xcc8_ = 2.f * 0.33f;
|
||||
xb10_ = 0.f;
|
||||
} else {
|
||||
if (xb10_ < xcbc_) {
|
||||
xa32_27_ = true;
|
||||
dontKnockback = true;
|
||||
xcb0_ += 1;
|
||||
xcb0_ = xcb0_ < 5 ? xcb0_ : 4;
|
||||
r26 = true;
|
||||
xcbc_ = .2f * (5 - (xcb0_ + 1)) * xcb8_;
|
||||
xcb4_ = 0;
|
||||
xcc8_ = 2.f * 0.33f;
|
||||
} else if (xa33_26_ && !xa31_31_ && lowHealth > x568_data.x3f4_) {
|
||||
dontKnockback = true;
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Zero));
|
||||
}
|
||||
}
|
||||
sub80256914(2.f * 0.33f, r26);
|
||||
} else {
|
||||
dontKnockback = true;
|
||||
}
|
||||
} else if (xc64_aiStage == 3) {
|
||||
if (xa32_29_) {
|
||||
zeus::CTransform xf = GetLctrTransform(xb90_headSegId);
|
||||
if (xf.basis[1].dot(mgr.GetPlayer().GetTranslation() - xf.origin) < 0.5f) {
|
||||
dontKnockback = true;
|
||||
} else {
|
||||
if ((mgr.GetPlayer().GetTranslation() - xf.origin).dot(xf.frontVector()) < 0.5f) {
|
||||
HealthInfo(mgr)->SetHP(xb1c_ + xb10_ + xb18_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TakeDamage(zeus::skForward, 1.f);
|
||||
xb20_ = 0.33f;
|
||||
if (xa32_29_) {
|
||||
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(colAct->GetLastTouchedObject())) {
|
||||
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_ -= lowHealth;
|
||||
xb24_ = 0.33f;
|
||||
x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f);
|
||||
|
@ -510,13 +499,12 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
|||
xa31_26_ = true;
|
||||
dontKnockback = true;
|
||||
xb18_ = 0.f;
|
||||
xcbc_ = 0.6667 * x568_data.x40_;
|
||||
xcbc_ = 0.6667f * x568_data.x40_;
|
||||
} else if (xb18_ < xcbc_) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Six));
|
||||
xcbc_ -= (0.333f * x568_data.x3c_);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
xb1c_ -= lowHealth;
|
||||
if (xb1c_ <= 0.f) {
|
||||
|
@ -532,7 +520,7 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HealthInfo(mgr)->SetHP(xb1c_ + xb10_ + xb18_);
|
||||
|
||||
if (!dontKnockback) {
|
||||
|
@ -546,8 +534,7 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
|||
}
|
||||
case EScriptObjectMessage::InvulnDamage: {
|
||||
/* This code never executes, should have a `TCastTo<CCollisionActor>` followed by `GetLastTouchedObject` */
|
||||
if (TCastToConstPtr<CCollisionActor> colAct = mgr.GetObjectById(uid)) {
|
||||
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(colAct->GetLastTouchedObject())) {
|
||||
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(uid)) {
|
||||
TUniqueId tmpId = kInvalidUniqueId;
|
||||
bool doDamage = false;
|
||||
if (xc64_aiStage == 3) {
|
||||
|
@ -570,7 +557,6 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
|||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EScriptObjectMessage::Touched: {
|
||||
|
@ -597,8 +583,9 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
|
|||
}
|
||||
|
||||
void CRidley::Think(float dt, CStateManager& mgr) {
|
||||
if (!GetActive())
|
||||
if (!GetActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
sub802560d0(dt);
|
||||
CPatterned::Think(dt, mgr);
|
||||
|
@ -612,6 +599,7 @@ void CRidley::Think(float dt, CStateManager& mgr) {
|
|||
sub80256624(dt, mgr);
|
||||
xb2c_.Update(dt);
|
||||
}
|
||||
|
||||
void CRidley::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
|
||||
CPatterned::PreRender(mgr, frustum);
|
||||
xb2c_.PreRender(mgr, *GetModelData()->GetAnimationData(), x34_transform, GetModelData()->GetScale(),
|
||||
|
@ -625,10 +613,11 @@ void CRidley::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
|
|||
|
||||
CPlayerState::EPlayerVisor r28 = mgr.GetPlayerState()->GetActiveVisor(mgr);
|
||||
bool atLastMat = GetModelData()->GetNumMaterialSets() == (matSet + 1);
|
||||
if (r28 == CPlayerState::EPlayerVisor::Thermal && atLastMat)
|
||||
if (r28 == CPlayerState::EPlayerVisor::Thermal && atLastMat) {
|
||||
xb4_drawFlags.x2_flags |= 0x40;
|
||||
else
|
||||
} else {
|
||||
xb4_drawFlags.x2_flags &= 0x40;
|
||||
}
|
||||
xb4_drawFlags.x1_matSetIdx = matSet;
|
||||
|
||||
if (xa33_27_) {
|
||||
|
@ -653,7 +642,7 @@ void CRidley::Render(CStateManager& mgr) {
|
|||
if (xb24_ > 0.f) {
|
||||
multiplyColor = zeus::CColor::lerp(zeus::skWhite, x430_damageColor, xb24_ / 0.33f);
|
||||
}
|
||||
g_Renderer->SetWorldLightMultiplyColor(multiplyColor);
|
||||
g_Renderer->SetGXRegister1Color(multiplyColor);
|
||||
|
||||
const zeus::CTransform xf = GetLctrTransform(xa30_breastPlateSegId);
|
||||
|
||||
|
@ -682,24 +671,28 @@ void CRidley::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) {
|
|||
g_Renderer->AddParticleGen(*xce0_);
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
|
||||
switch (type) {
|
||||
case EUserEventType::Projectile: {
|
||||
if (xc64_aiStage != 2)
|
||||
if (xc64_aiStage != 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!xc14_.Token().IsLoaded()) {
|
||||
xc14_.Token().GetObj();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 9))
|
||||
if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 9)) {
|
||||
return;
|
||||
}
|
||||
|
||||
zeus::CTransform xf = GetLctrTransform(xa30_breastPlateSegId) * zeus::CTransform::RotateX(zeus::degToRad(-90.f));
|
||||
xf = xf * zeus::CTransform::RotateY(
|
||||
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);
|
||||
CEnergyProjectile* proj =
|
||||
auto* proj =
|
||||
new CEnergyProjectile(true, xc14_.Token(), EWeaponType::AI, xf, EMaterialTypes::Character, xc14_.GetDamage(),
|
||||
mgr.AllocateUniqueId(), GetAreaIdAlways(), GetUniqueId(), mgr.GetPlayer().GetUniqueId(),
|
||||
EProjectileAttrib::None, false, zeus::skOne3f, {}, -1, false);
|
||||
|
@ -714,14 +707,15 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
|||
break;
|
||||
}
|
||||
|
||||
if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 6))
|
||||
if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 8)) {
|
||||
break;
|
||||
}
|
||||
|
||||
zeus::CVector3f vec =
|
||||
zeus::CVector3f(mgr.GetActiveRandom()->Range(-1.f, 1.f), 1.f, mgr.GetActiveRandom()->Range(-1.f, 1.f));
|
||||
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),
|
||||
EMaterialTypes::Character, xc3c_.GetDamage(), mgr.AllocateUniqueId(), GetAreaIdAlways(), GetUniqueId(),
|
||||
mgr.GetPlayer().GetUniqueId(), EProjectileAttrib::None, false, zeus::skOne3f, {}, -1, false);
|
||||
|
@ -736,16 +730,18 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
|||
case EUserEventType::DamageOn: {
|
||||
if (xc64_aiStage == 3) {
|
||||
sub8025784c(mgr);
|
||||
} else if (xc64_aiStage == 2)
|
||||
} else if (xc64_aiStage == 2) {
|
||||
xa33_28_ = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case EUserEventType::DamageOff: {
|
||||
if (xc64_aiStage == 3) {
|
||||
sub80257650(mgr);
|
||||
} else if (xc64_aiStage == 2 && !xa33_31_)
|
||||
} else if (xc64_aiStage == 2 && !xa33_31_) {
|
||||
xa33_28_ = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -760,18 +756,21 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
|||
return;
|
||||
}
|
||||
case EUserEventType::ScreenShake: {
|
||||
if ((mgr.GetPlayer().GetTranslation() - GetTranslation()).magnitude() >= x568_data.x388_)
|
||||
if ((mgr.GetPlayer().GetTranslation() - GetTranslation()).magnitude() >= x568_data.x388_) {
|
||||
break;
|
||||
}
|
||||
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x568_data.x298_,
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
||||
break;
|
||||
}
|
||||
case EUserEventType::BeginAction: {
|
||||
if (xa32_25_ && !xa31_29_)
|
||||
if (xa32_25_ && !xa31_29_) {
|
||||
FirePlasma(mgr);
|
||||
}
|
||||
|
||||
if (!xa31_31_ || !xa32_26_)
|
||||
if (!xa31_31_ || !xa32_26_) {
|
||||
break;
|
||||
}
|
||||
|
||||
xbf0_ = xa84_.basis[0];
|
||||
zeus::CVector3f ourPos = GetTranslation();
|
||||
|
@ -780,12 +779,13 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
|||
}
|
||||
xbfc_ = xbf0_;
|
||||
xbe4_ = xa84_.origin - xabc_ * xbf0_;
|
||||
xbe4_ *= zeus::CVector3f((mgr.GetPlayer().GetTranslation() - xa84_.origin).dot(xa84_.basis[1]));
|
||||
xbe4_ += (mgr.GetPlayer().GetTranslation() - xa84_.origin).dot(xa84_.frontVector()) * xa84_.frontVector();
|
||||
break;
|
||||
}
|
||||
case EUserEventType::EndAction: {
|
||||
if (xa31_29_)
|
||||
if (xa31_29_) {
|
||||
ResetPlasmaProjectile(mgr, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EUserEventType::IkLock: {
|
||||
|
@ -805,8 +805,9 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
|||
break;
|
||||
}
|
||||
case EUserEventType::SoundPlay: {
|
||||
if (xa32_25_)
|
||||
if (xa32_25_) {
|
||||
break;
|
||||
}
|
||||
|
||||
xcac_ = CSfxManager::AddEmitter({GetTranslation(), {}, 1000.f, 0.1f, 1, x568_data.x294_, 127, 63, false, 127}, true,
|
||||
-1, false, kInvalidAreaId);
|
||||
|
@ -871,7 +872,7 @@ void CRidley::FirePlasma(urde::CStateManager& mgr) {
|
|||
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);
|
||||
if (!xca8_) {
|
||||
xca8_ = CSfxManager::AddEmitter({GetTranslation(), {}, 1000.f, 0.1f, 1, x568_data.xa8_, 127, 63, false, 127},
|
||||
|
@ -914,8 +915,9 @@ void CRidley::sub802560d0(float dt) {
|
|||
} else if (xaec_.isMagnitudeSafe()) {
|
||||
const float mag = xaec_.magnitude();
|
||||
float magScale = 0.2f;
|
||||
if (xaf8_.magSquared() == 0.f)
|
||||
if (xaf8_.magSquared() == 0.f) {
|
||||
magScale *= 3.f;
|
||||
}
|
||||
xaec_ = -((zeus::clamp(0.f, dt * (magScale * mag), 0.5f) * mag) - mag) * ((1.f / mag) * xaec_);
|
||||
ApplyImpulseWR(GetMass() * xaec_, {});
|
||||
}
|
||||
|
@ -928,18 +930,19 @@ void CRidley::sub802563a8(float dt) {
|
|||
zeus::CVector3f posDiff = GetTranslation() - xa84_.origin;
|
||||
float mag = posDiff.magnitude();
|
||||
posDiff *= zeus::CVector3f(1.f / mag);
|
||||
if (xab4_ + -6.f * zeus::clamp(-1.f, posDiff.dot(xa84_.basis[1]), 0.f) < mag)
|
||||
if (GetVelocity().dot(posDiff) > 0.f)
|
||||
if (xab4_ + -6.f * zeus::clamp(-1.f, posDiff.dot(xa84_.basis[1]), 0.f) < mag && GetVelocity().dot(posDiff) > 0.f) {
|
||||
Stop();
|
||||
}
|
||||
|
||||
MoveToInOneFrameWR(GetTranslation() - posDiff, dt);
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::sub80256b14(float dt, CStateManager& mgr) {
|
||||
if (CPlasmaProjectile* proj = static_cast<CPlasmaProjectile*>(mgr.ObjectById(xb64_plasmaProjectile))) {
|
||||
if (!proj->GetActive())
|
||||
if (auto* proj = static_cast<CPlasmaProjectile*>(mgr.ObjectById(xb64_plasmaProjectile))) {
|
||||
if (!proj->GetActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
zeus::CTransform mouthXf = GetLctrTransform(xb91_mouthSegId);
|
||||
if (xc64_aiStage == 3) {
|
||||
|
@ -1015,28 +1018,26 @@ void CRidley::Patrol(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
xa32_27_ = false;
|
||||
xa33_26_ = true;
|
||||
}
|
||||
|
||||
void CRidley::Dead(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg != EStateMsg::Activate)
|
||||
return;
|
||||
mgr.SetBossParams(kInvalidUniqueId, 0.f, 0);
|
||||
}
|
||||
|
||||
void CRidley::Generate(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg != EStateMsg::Activate)
|
||||
return;
|
||||
|
||||
xa34_26_ = false;
|
||||
zeus::CVector3f vec;
|
||||
vec.x() = 0.f;
|
||||
vec.y() = xabc_;
|
||||
vec.z() = xac0_ - xadc_;
|
||||
SetTranslation(xa84_ * vec);
|
||||
SetTranslation(xa84_ * zeus::CVector3f{0.f, xabc_, xac0_ - xadc_});
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::NextState));
|
||||
}
|
||||
|
||||
void CRidley::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
xbe4_ = (GetTranslation() + zeus::skUp) - (8.f * GetTransform().basis[0]);
|
||||
xbfc_ = xbf0_ = GetTransform().basis[0];
|
||||
xbe4_ = (GetTranslation() + zeus::skUp) - (8.f * GetTransform().rightVector());
|
||||
xbfc_ = xbf0_ = GetTransform().rightVector();
|
||||
xc08_ = xc0c_ = 0.f;
|
||||
xc10_ = 240.f;
|
||||
x32c_animState = EAnimState::Ready;
|
||||
|
@ -1112,7 +1113,7 @@ void CRidley::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
xbe4_ += (90.f * arg) * xbf0_;
|
||||
}
|
||||
|
||||
if (xa32_24_ && xcac_ != 0) {
|
||||
if (xa32_24_ && xcac_) {
|
||||
CSfxManager::UpdateEmitter(xca8_, GetTranslation(), {}, 127);
|
||||
}
|
||||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step)
|
||||
|
@ -1122,17 +1123,21 @@ void CRidley::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
zeus::CVector3f local_54 = xbc4_ - GetTranslation();
|
||||
float mag = local_54.magnitude();
|
||||
if (mag <= 2.f || local_54.dot(xbc4_ - x2ec_reflectedDestPos) <= 0.f) {
|
||||
pas::EStepDirection dir = pas::EStepDirection::Right;
|
||||
if (xa32_31_)
|
||||
auto dir = pas::EStepDirection::Right;
|
||||
if (xa32_31_) {
|
||||
dir = pas::EStepDirection::Left;
|
||||
if (xcc0_ == 3)
|
||||
dir = pas::EStepDirection::Up;
|
||||
else if (xcc0_ == 2)
|
||||
dir = pas::EStepDirection::Forward;
|
||||
}
|
||||
|
||||
pas::EStepType type = pas::EStepType::Normal;
|
||||
if (xa33_24_)
|
||||
if (xcc0_ == 3) {
|
||||
dir = pas::EStepDirection::Up;
|
||||
} else if (xcc0_ == 2) {
|
||||
dir = pas::EStepDirection::Forward;
|
||||
}
|
||||
|
||||
auto type = pas::EStepType::Normal;
|
||||
if (xa33_24_) {
|
||||
type = pas::EStepType::BreakDodge;
|
||||
}
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(dir, type));
|
||||
xa31_30_ = true;
|
||||
} else {
|
||||
|
@ -1147,7 +1152,7 @@ void CRidley::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
|
||||
if (xa32_25_) {
|
||||
ResetPlasmaProjectile(mgr, 1);
|
||||
ResetPlasmaProjectile(mgr, true);
|
||||
}
|
||||
|
||||
if (xa32_24_) {
|
||||
|
@ -1206,7 +1211,7 @@ void CRidley::JumpBack(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
xc78_ = 0.f;
|
||||
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 4);
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 4);
|
||||
|
||||
if (x32c_animState == EAnimState::Repeat) {
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
|
||||
|
@ -1242,9 +1247,11 @@ void CRidley::DoubleSnap(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
x402_28_isMakingBigStrike = false;
|
||||
x504_damageDur = 0.f;
|
||||
xc8c_ = GetContactDamage();
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::CoverAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x32c_animState = EAnimState::Ready;
|
||||
|
@ -1277,6 +1284,7 @@ void CRidley::Crouch(urde::CStateManager& mgr, urde::EStateMsg msg, float arg) {
|
|||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(zeus::skZero3f, faceDir, 1.f));
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::FadeOut(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x32c_animState = EAnimState::Ready;
|
||||
|
@ -1288,12 +1296,13 @@ void CRidley::FadeOut(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
|
||||
xb68_.SetDamage(x568_data.x3fc_);
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack, 5);
|
||||
TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack_Front, 5);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
xcbc_ = 0.6667f * x568_data.x3c_;
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Taunt(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x32c_animState = EAnimState::Ready;
|
||||
|
@ -1304,6 +1313,7 @@ void CRidley::Taunt(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
x32c_animState = EAnimState::NotReady;
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Flee(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
zeus::CVector3f destPos =
|
||||
|
@ -1315,6 +1325,7 @@ void CRidley::Flee(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
x450_bodyController->FaceDirection((x2e0_destPos - GetTranslation()).normalized(), arg);
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Lurk(urde::CStateManager& mgr, urde::EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
if (!xa33_25_) {
|
||||
|
@ -1347,6 +1358,7 @@ void CRidley::Lurk(urde::CStateManager& mgr, urde::EStateMsg msg, float arg) {
|
|||
FacePlayer(10.f * arg, mgr);
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x32c_animState = EAnimState::Ready;
|
||||
|
@ -1361,24 +1373,26 @@ void CRidley::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
xa33_31_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Flinch(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
sub80257744(mgr);
|
||||
x32c_animState = EAnimState::Ready;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack, 3);
|
||||
TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack_Front, 3);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
sub80257650(mgr);
|
||||
xa32_28_shotAt = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Hurled(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg != EStateMsg::Activate)
|
||||
return;
|
||||
|
||||
sub80257650(mgr);
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Four));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity::Four));
|
||||
}
|
||||
|
||||
void CRidley::TelegraphAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
|
@ -1396,17 +1410,20 @@ void CRidley::TelegraphAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
xa32_25_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Jump(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x32c_animState = EAnimState::Ready;
|
||||
xc88_ = (mgr.GetPlayer().GetTranslation() - GetTranslation()).magnitude() <= xae4_ ? 4 : 5;
|
||||
x402_28_isMakingBigStrike = x568_data.x3ac_ > 0.f;
|
||||
x504_damageDur = x568_data.x3ac_;
|
||||
xc8c_ = x568_data.x390_;
|
||||
sub80256580();
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, xc88_);
|
||||
if (x330_stateMachineState.GetTime() < 1.75f)
|
||||
if (x330_stateMachineState.GetTime() < 1.75f) {
|
||||
FacePlayer(arg, mgr);
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr);
|
||||
x402_28_isMakingBigStrike = false;
|
||||
|
@ -1416,24 +1433,27 @@ void CRidley::Jump(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
xa34_25_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Explode(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
xa32_27_ = false;
|
||||
x32c_animState = EAnimState::Ready;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack, 2);
|
||||
TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack_Front, 2);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Dodge(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
const zeus::CVector3f vec = zeus::CVector3f{GetTranslation().toVec2f() - xa84_.origin.toVec2f()}.normalized();
|
||||
float dist = zeus::clamp(0.f, 2.f * vec.dot(xa84_.rightVector()) + 1.f, 1.f);
|
||||
|
||||
xc84_ = 2;
|
||||
float dist = zeus::clamp(
|
||||
0.f, zeus::CVector3f(GetTranslation().toVec2f() - xa84_.origin.toVec2f()).normalized().dot(xa84_.basis[0]),
|
||||
1.f);
|
||||
if (dist < mgr.GetActiveRandom()->Float())
|
||||
if (dist < mgr.GetActiveRandom()->Float()) {
|
||||
xc84_ = 3;
|
||||
}
|
||||
x32c_animState = EAnimState::Ready;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryDodge, xc84_);
|
||||
|
@ -1442,31 +1462,34 @@ void CRidley::Dodge(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
zeus::CVector3f someVec(((xa84_.origin.x() + xabc_) * vec.x()) - GetTranslation().x(),
|
||||
((xa84_.origin.y() + xabc_) * vec.y()) - GetTranslation().y(),
|
||||
((xa84_.origin.z() + xac0_) - GetTranslation().z()));
|
||||
if (someVec.magnitude() > 1.f)
|
||||
if (someVec.magnitude() > 1.f) {
|
||||
someVec.normalize();
|
||||
}
|
||||
|
||||
sub80255fe8(10.f, arg, someVec);
|
||||
} else {
|
||||
x450_bodyController->FaceDirection((xa84_.origin - GetTranslation()).normalized(), arg);
|
||||
}
|
||||
|
||||
x450_bodyController->FaceDirection((xa84_.origin - GetTranslation()).normalized(), arg);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Retreat(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
x32c_animState = EAnimState::Ready;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryDodge, 5);
|
||||
TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryDodge, 5); // Down
|
||||
} else {
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Approach(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
zeus::CVector3f direction = (GetTranslation() - xa84_.origin).normalized();
|
||||
zeus::CVector3f destPos(xa84_.origin.x() + xab4_ * direction.x(), xa84_.origin.y() + xab4_ * direction.y(),
|
||||
(xae8_ + xa84_.origin.z()) - 1.f);
|
||||
zeus::CVector3f destPos = xa84_.origin.toVec2f() + xab4_ * direction.toVec2f();
|
||||
destPos.z() = (xae8_ + xa84_.origin.z()) - 1.f;
|
||||
SetDestPos(destPos);
|
||||
xa33_26_ = false;
|
||||
if (xc64_aiStage == 3 && !xa34_24_) {
|
||||
|
@ -1506,6 +1529,7 @@ void CRidley::SpecialAttack(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
x32c_animState = EAnimState::NotReady;
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::Land(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||
if (msg == EStateMsg::Activate) {
|
||||
zeus::CVector3f diff = zeus::CVector3f(mgr.GetPlayer().GetTranslation().x() - xa84_.origin.x(),
|
||||
|
@ -1525,7 +1549,7 @@ void CRidley::Land(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
x402_28_isMakingBigStrike = x568_data.x38c_ > 0.f;
|
||||
x504_damageDur = x568_data.x38c_;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 8);
|
||||
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack_TargetPos, 8);
|
||||
|
||||
if (x32c_animState == EAnimState::Repeat) {
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat);
|
||||
|
@ -1546,6 +1570,7 @@ void CRidley::Land(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
}
|
||||
}
|
||||
bool CRidley::Attacked(CStateManager& mgr, float arg) { return xa31_24_ && xa31_26_; }
|
||||
|
||||
bool CRidley::TooClose(CStateManager& mgr, float arg) {
|
||||
if (xb0c_ == 4)
|
||||
return true;
|
||||
|
@ -1561,24 +1586,32 @@ bool CRidley::TooClose(CStateManager& mgr, float arg) {
|
|||
|
||||
return false;
|
||||
}
|
||||
bool CRidley::InRange(CStateManager& mgr, float arg) {
|
||||
float mag = (GetTranslation() - x2e0_destPos).magnitude();
|
||||
return mag < 2.f;
|
||||
}
|
||||
|
||||
bool CRidley::InRange(CStateManager& mgr, float arg) { return (GetTranslation() - x2e0_destPos).magnitude() < 2.f; }
|
||||
|
||||
bool CRidley::ShouldAttack(CStateManager& mgr, float arg) {
|
||||
return (xc64_aiStage == 3 && xb0c_ == 2) || (xc64_aiStage == 2 && xb04_ == 0);
|
||||
}
|
||||
|
||||
bool CRidley::ShouldDoubleSnap(CStateManager& mgr, float arg) { return xa33_30_; }
|
||||
|
||||
bool CRidley::ShouldTurn(CStateManager& mgr, float arg) { return xb04_ == 5; }
|
||||
|
||||
bool CRidley::HitSomething(CStateManager& mgr, float arg) { return xa32_27_ || xc64_aiStage == 3; }
|
||||
|
||||
bool CRidley::AttackOver(CStateManager& mgr, float arg) { return xcc4_ == 0; }
|
||||
|
||||
bool CRidley::ShouldTaunt(CStateManager& mgr, float arg) {
|
||||
return (xc64_aiStage == 3 && xb0c_ == 1) || (xc64_aiStage == 2 && xb04_ == 4);
|
||||
}
|
||||
bool CRidley::ShouldFire(CStateManager& mgr, float arg) { return xc64_aiStage == 2 && xb04_ == 2; }
|
||||
|
||||
bool CRidley::ShouldDodge(CStateManager& mgr, float arg) { return xb04_ == 3; }
|
||||
|
||||
bool CRidley::ShouldRetreat(CStateManager& mgr, float arg) { return xa34_26_; }
|
||||
|
||||
bool CRidley::ShouldCrouch(CStateManager& mgr, float arg) { return xb04_ == 1; }
|
||||
|
||||
bool CRidley::ShouldMove(urde::CStateManager& mgr, float arg) {
|
||||
if (xb0c_ == 5) {
|
||||
xa34_25_ = true;
|
||||
|
@ -1596,12 +1629,16 @@ bool CRidley::ShouldMove(urde::CStateManager& mgr, float arg) {
|
|||
return false;
|
||||
}
|
||||
bool CRidley::ShotAt(CStateManager& mgr, float arg) { return xa32_28_shotAt; }
|
||||
|
||||
bool CRidley::SetAIStage(CStateManager& mgr, float arg) {
|
||||
xc64_aiStage = arg;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CRidley::AIStage(CStateManager& mgr, float arg) { return xc64_aiStage >= arg; }
|
||||
|
||||
bool CRidley::ShouldStrafe(CStateManager& mgr, float arg) { return xa33_29_doStrafe; }
|
||||
|
||||
bool CRidley::IsDizzy(CStateManager& mgr, float arg) {
|
||||
if (xb0c_ == 3)
|
||||
return true;
|
||||
|
@ -1616,13 +1653,15 @@ bool CRidley::IsDizzy(CStateManager& mgr, float arg) {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CRidley::sub80255fe8(float f1, float f2, const zeus::CVector3f& vec) {
|
||||
xaf8_ = (0.2f * (f1 * f1)) * vec;
|
||||
xaf8_ = (f1 * (0.2f * f1)) * vec;
|
||||
xaec_ += f2 * xaf8_;
|
||||
if (xaec_.magnitude() > f1) {
|
||||
xaec_ = f1 * xaec_.normalized();
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::sub80255e5c(CStateManager& mgr) {
|
||||
zeus::CVector3f posDiff = mgr.GetPlayer().GetTranslation() - GetTranslation();
|
||||
if (posDiff.magnitude() < 8.f) {
|
||||
|
@ -1631,6 +1670,7 @@ void CRidley::sub80255e5c(CStateManager& mgr) {
|
|||
mgr.GetPlayer().ApplyImpulseWR(impulse, {});
|
||||
}
|
||||
}
|
||||
|
||||
void CRidley::FacePlayer(float arg, CStateManager& mgr) {
|
||||
x450_bodyController->FaceDirection((mgr.GetPlayer().GetTranslation() - GetTranslation()).normalized(), arg);
|
||||
}
|
||||
|
@ -1682,5 +1722,4 @@ void CRidley::sub80253710(urde::CStateManager& mgr) {
|
|||
if (frontMag > 0.f && diffMag < x2fc_minAttackRange && xb08_ != 4)
|
||||
xb0c_ = 4;
|
||||
}
|
||||
} // namespace MP1
|
||||
} // namespace urde
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -105,11 +105,11 @@ class CRidley : public CPatterned {
|
|||
float xab4_ = 20.f;
|
||||
float xab8_ = 12.f;
|
||||
float xabc_ = 40.f;
|
||||
float xac0_ = 10;
|
||||
float xac0_ = 10.f;
|
||||
zeus::CAABox xac4_ = zeus::skInvertedBox;
|
||||
float xadc_;
|
||||
float xae0_;
|
||||
u32 xae4_;
|
||||
float xae4_;
|
||||
float xae8_;
|
||||
zeus::CVector3f xaec_;
|
||||
zeus::CVector3f xaf8_;
|
||||
|
@ -195,7 +195,8 @@ class CRidley : public CPatterned {
|
|||
|
||||
void sub80253710(CStateManager& mgr);
|
||||
bool sub80253960() {
|
||||
return (GetTranslation() + (1.75f * GetTransform().basis[1]) - xa84_.origin).magnitude() < 1.75f * (xab4_ + xabc_);
|
||||
const float mag = ((GetTranslation() + ((0.5f * xae4_) * GetTransform().frontVector())) - xa84_.origin).magnitude();
|
||||
return mag < 0.5f * (xab4_ + xabc_);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -196,7 +196,7 @@ void CSeedling::Generate(CStateManager& mgr, EStateMsg msg, float) {
|
|||
if (msg == EStateMsg::Activate)
|
||||
x32c_animState = EAnimState::Ready;
|
||||
else if (msg == EStateMsg::Update)
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 0);
|
||||
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 0);
|
||||
}
|
||||
|
||||
bool CSeedling::ShouldAttack(CStateManager& mgr, float) {
|
||||
|
|
|
@ -57,7 +57,7 @@ CParticleSwoosh::CParticleSwoosh(const TToken<CSwooshDescription>& desc, int len
|
|||
0.f, 0.f, zeus::skClear);
|
||||
}
|
||||
|
||||
SetOrientation(zeus::CTransform());
|
||||
CParticleSwoosh::SetOrientation(zeus::CTransform());
|
||||
|
||||
x16c_p0.resize(x1b8_SIDE);
|
||||
x17c_p1.resize(x1b8_SIDE);
|
||||
|
|
|
@ -66,7 +66,7 @@ struct SObjectTag {
|
|||
};
|
||||
|
||||
struct TEditorId {
|
||||
u32 id = u32(-1);
|
||||
u32 id = UINT32_MAX;
|
||||
|
||||
constexpr TEditorId() noexcept = default;
|
||||
constexpr TEditorId(u32 idin) noexcept : id(idin) {}
|
||||
|
@ -83,7 +83,7 @@ struct TEditorId {
|
|||
#define kInvalidEditorId TEditorId()
|
||||
|
||||
struct TUniqueId {
|
||||
u16 id = u16(-1);
|
||||
u16 id = UINT16_MAX;
|
||||
|
||||
constexpr TUniqueId() noexcept = default;
|
||||
constexpr TUniqueId(u16 value, u16 version) noexcept : id(value | (version << 10)) {}
|
||||
|
|
|
@ -24,7 +24,7 @@ constexpr CCameraShakeData skHardShake{
|
|||
};
|
||||
|
||||
constexpr std::array skComboNames{
|
||||
"SuperMissile", "IceCombo", "WaveBuster", "FlameThrower", "SuperMissile",
|
||||
"SuperMissile"sv, "IceCombo"sv, "WaveBuster"sv, "FlameThrower"sv, "SuperMissile"sv,
|
||||
};
|
||||
|
||||
constexpr std::array<u16, 5> skSoundId{
|
||||
|
@ -326,16 +326,20 @@ void CAuxWeapon::RenderMuzzleFx() const {
|
|||
}
|
||||
|
||||
TUniqueId CAuxWeapon::HasTarget(const CStateManager& mgr) const {
|
||||
if (x74_firingBeamId == CPlayerState::EBeamId::Wave)
|
||||
if (auto* wb = static_cast<const CWaveBuster*>(mgr.GetObjectById(x70_waveBusterId)))
|
||||
if (x74_firingBeamId == CPlayerState::EBeamId::Wave) {
|
||||
if (const auto* wb = static_cast<const CWaveBuster*>(mgr.GetObjectById(x70_waveBusterId))) {
|
||||
return wb->GetHomingTargetId();
|
||||
}
|
||||
}
|
||||
return kInvalidUniqueId;
|
||||
}
|
||||
|
||||
void CAuxWeapon::SetNewTarget(TUniqueId targetId, CStateManager& mgr) {
|
||||
if (x74_firingBeamId == CPlayerState::EBeamId::Wave)
|
||||
if (auto* wb = static_cast<CWaveBuster*>(mgr.ObjectById(x70_waveBusterId)))
|
||||
if (x74_firingBeamId == CPlayerState::EBeamId::Wave) {
|
||||
if (auto* wb = static_cast<CWaveBuster*>(mgr.ObjectById(x70_waveBusterId))) {
|
||||
wb->SetNewTarget(targetId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
|
|
@ -75,7 +75,7 @@ void CBeamProjectile::UpdateFx(const zeus::CTransform& xf, float dt, CStateManag
|
|||
mgr.BuildNearList(nearList, x36c_, CMaterialFilter::MakeExclude({EMaterialTypes::ProjectilePassthrough}), nullptr);
|
||||
TUniqueId collideId = kInvalidUniqueId;
|
||||
CRayCastResult res = RayCollisionCheckWithWorld(collideId, x298_previousPos, beamEnd, x300_intBeamLength, nearList, mgr);
|
||||
if (TCastToPtr<CActor> act = mgr.ObjectById(collideId)) {
|
||||
if (TCastToConstPtr<CActor>(mgr.ObjectById(collideId))) {
|
||||
SetCollisionResultData(EDamageType::Actor, res, collideId);
|
||||
if (x464_25_enableTouchDamage)
|
||||
ApplyDamageToActors(mgr, CDamageInfo(x12c_curDamageInfo, dt));
|
||||
|
|
|
@ -38,7 +38,7 @@ void CFlameThrower::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
|||
|
||||
void CFlameThrower::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||
if (msg == EScriptObjectMessage::Registered) {
|
||||
xe6_27_thermalVisorFlags |= 2;
|
||||
xe6_27_thermalVisorFlags = 2;
|
||||
mgr.AddWeaponId(xec_ownerId, xf0_weaponType);
|
||||
} else if (msg == EScriptObjectMessage::Deleted) {
|
||||
mgr.RemoveWeaponId(xec_ownerId, xf0_weaponType);
|
||||
|
@ -227,12 +227,12 @@ void CFlameThrower::Think(float dt, CStateManager& mgr) {
|
|||
if (r28 && x34c_flameWarp.IsProcessed()) {
|
||||
x318_flameBounds = x34c_flameWarp.CalculateBounds();
|
||||
TUniqueId id = kInvalidUniqueId;
|
||||
CRayCastResult res = DoCollisionCheck(id, x318_flameBounds, mgr);
|
||||
if (TCastToPtr<CActor> act = mgr.ObjectById(id)) {
|
||||
const CRayCastResult res = DoCollisionCheck(id, x318_flameBounds, mgr);
|
||||
if (TCastToConstPtr<CActor>(mgr.ObjectById(id))) {
|
||||
ApplyDamageToActor(mgr, id, dt);
|
||||
} else if (res.IsValid()) {
|
||||
CMaterialFilter useFilter = xf8_filter;
|
||||
CDamageInfo useDInfo = CDamageInfo(x12c_curDamageInfo, dt);
|
||||
const CMaterialFilter useFilter = xf8_filter;
|
||||
const CDamageInfo useDInfo = CDamageInfo(x12c_curDamageInfo, dt);
|
||||
mgr.ApplyDamageToWorld(xec_ownerId, *this, res.GetPoint(), useDInfo, useFilter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1515,12 +1515,13 @@ void CPlayerGun::UpdateWeaponFire(float dt, const CPlayerState& playerState, CSt
|
|||
if (!x835_31_actorAttached) {
|
||||
x835_28_bombReady = true;
|
||||
if (x53a_powerBomb != kInvalidUniqueId && !mgr.CanCreateProjectile(x538_playerId, EWeaponType::PowerBomb, 1)) {
|
||||
auto* pb = static_cast<const CPowerBomb*>(mgr.GetObjectById(x53a_powerBomb));
|
||||
if (pb && pb->GetCurTime() <= 4.25f)
|
||||
const auto* pb = static_cast<const CPowerBomb*>(mgr.GetObjectById(x53a_powerBomb));
|
||||
if (pb && pb->GetCurTime() <= 4.25f) {
|
||||
x835_28_bombReady = false;
|
||||
else
|
||||
} else {
|
||||
x53a_powerBomb = kInvalidUniqueId;
|
||||
}
|
||||
}
|
||||
if (((pressedStates & 0x1) != 0 || x32c_chargePhase != EChargePhase::NotCharging) &&
|
||||
mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::MorphBallBombs)) {
|
||||
if (x835_28_bombReady)
|
||||
|
@ -2088,9 +2089,9 @@ void CPlayerGun::PreRender(const CStateManager& mgr, const zeus::CFrustum& frust
|
|||
}
|
||||
|
||||
void CPlayerGun::RenderEnergyDrainEffects(const CStateManager& mgr) const {
|
||||
if (TCastToConstPtr<CPlayer> player = mgr.GetObjectById(x538_playerId)) {
|
||||
if (const TCastToConstPtr<CPlayer> player = mgr.GetObjectById(x538_playerId)) {
|
||||
for (const auto& source : player->GetEnergyDrain().GetEnergyDrainSources()) {
|
||||
if (auto* metroid = CPatterned::CastTo<MP1::CMetroidBeta>(mgr.GetObjectById(source.GetEnergyDrainSourceId()))) {
|
||||
if (const auto* metroid = CPatterned::CastTo<MP1::CMetroidBeta>(mgr.GetObjectById(source.GetEnergyDrainSourceId()))) {
|
||||
metroid->RenderHitGunEffect();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "Runtime/CSimplePool.hpp"
|
||||
#include "Runtime/GameGlobalObjects.hpp"
|
||||
|
||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||
|
||||
namespace urde {
|
||||
|
||||
CWaveBuster::CWaveBuster(const TToken<CWeaponDescription>& desc, EWeaponType type, const zeus::CTransform& xf,
|
||||
|
@ -32,6 +34,33 @@ void CWaveBuster::ResetBeam(bool deactivate) {}
|
|||
|
||||
void CWaveBuster::SetNewTarget(TUniqueId id) {}
|
||||
|
||||
void CWaveBuster::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||
|
||||
void CWaveBuster::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId senderId, CStateManager& mgr) {
|
||||
if (msg == EScriptObjectMessage::Deleted) {
|
||||
DeleteProjectileLight(mgr);
|
||||
} else if (msg == EScriptObjectMessage::Registered) {
|
||||
if (x390_busterLightGen != nullptr && x390_busterLightGen->SystemHasLight()) {
|
||||
const CLight light = x390_busterLightGen->GetLight();
|
||||
CreateProjectileLight("WaveBuster_Light", light, mgr);
|
||||
}
|
||||
|
||||
// Thermal hot
|
||||
xe6_27_thermalVisorFlags = 2;
|
||||
|
||||
x318_ = x2e8_originalXf.origin;
|
||||
x324_ = x34_transform.origin;
|
||||
x330_ = x34_transform.origin;
|
||||
}
|
||||
|
||||
CGameProjectile::AcceptScriptMsg(msg, senderId, mgr);
|
||||
}
|
||||
|
||||
void CWaveBuster::AddToRenderer([[maybe_unused]] const zeus::CFrustum& frustum, CStateManager& mgr) {
|
||||
const auto bounds = GetSortingBounds(mgr);
|
||||
EnsureRendered(mgr, x2e8_originalXf.origin, bounds);
|
||||
}
|
||||
|
||||
std::optional<zeus::CAABox> CWaveBuster::GetTouchBounds() const {
|
||||
if (x3d0_28_) {
|
||||
return std::nullopt;
|
||||
|
|
|
@ -55,6 +55,9 @@ public:
|
|||
void ResetBeam(bool deactivate);
|
||||
void SetNewTarget(TUniqueId id);
|
||||
|
||||
void Accept(IVisitor& visitor) override;
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId senderId, CStateManager& mgr) override;
|
||||
void AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) override;
|
||||
std::optional<zeus::CAABox> GetTouchBounds() const override;
|
||||
};
|
||||
|
||||
|
|
|
@ -78,9 +78,9 @@ void CAi::FluidFXThink(EFluidState state, CScriptWater& water, urde::CStateManag
|
|||
water.GetFluidPlane().AddRipple(GetMass(), GetUniqueId(), center, GetVelocity(), water, mgr, pos);
|
||||
}
|
||||
|
||||
CAiStateFunc CAi::GetStateFunc(const char* func) { return m_FuncMap->GetStateFunc(func); }
|
||||
CAiStateFunc CAi::GetStateFunc(std::string_view func) { return m_FuncMap->GetStateFunc(func); }
|
||||
|
||||
CAiTriggerFunc CAi::GetTrigerFunc(const char* func) { return m_FuncMap->GetTriggerFunc(func); }
|
||||
CAiTriggerFunc CAi::GetTriggerFunc(std::string_view func) { return m_FuncMap->GetTriggerFunc(func); }
|
||||
|
||||
const CStateMachine* CAi::GetStateMachine() const { return x2c8_stateMachine.GetObj(); }
|
||||
void CAi::CreateFuncLookup(CAiFuncMap* funcMap) { m_FuncMap = funcMap; }
|
||||
|
|
|
@ -36,8 +36,8 @@ public:
|
|||
const CMaterialList& list, CAssetId fsm, const CActorParameters&, float f1, float f2);
|
||||
|
||||
static void CreateFuncLookup(CAiFuncMap* funcMap);
|
||||
static CAiStateFunc GetStateFunc(const char* func);
|
||||
static CAiTriggerFunc GetTrigerFunc(const char* func);
|
||||
static CAiStateFunc GetStateFunc(std::string_view func);
|
||||
static CAiTriggerFunc GetTriggerFunc(std::string_view func);
|
||||
|
||||
const CStateMachine* GetStateMachine() const;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
namespace urde {
|
||||
CAiFuncMap::CAiFuncMap() {
|
||||
/* Ai States */
|
||||
x0_stateFuncs.reserve(55);
|
||||
x0_stateFuncs.emplace("Patrol", &CAi::Patrol);
|
||||
x0_stateFuncs.emplace("FollowPattern", &CAi::FollowPattern);
|
||||
x0_stateFuncs.emplace("Dead", &CAi::Dead);
|
||||
|
@ -63,6 +64,7 @@ CAiFuncMap::CAiFuncMap() {
|
|||
x0_stateFuncs.emplace("PodAttack", &CAi::PodAttack);
|
||||
|
||||
/* Ai Triggers */
|
||||
x10_triggerFuncs.reserve(68);
|
||||
x10_triggerFuncs.emplace("InAttackPosition", &CAi::InAttackPosition);
|
||||
x10_triggerFuncs.emplace("Leash", &CAi::Leash);
|
||||
x10_triggerFuncs.emplace("OffLine", &CAi::OffLine);
|
||||
|
@ -135,7 +137,7 @@ CAiFuncMap::CAiFuncMap() {
|
|||
CAi::CreateFuncLookup(this);
|
||||
}
|
||||
|
||||
CAiStateFunc CAiFuncMap::GetStateFunc(const char* func) const {
|
||||
CAiStateFunc CAiFuncMap::GetStateFunc(std::string_view func) const {
|
||||
const auto iter = x0_stateFuncs.find(func);
|
||||
|
||||
if (iter == x0_stateFuncs.cend()) {
|
||||
|
@ -145,7 +147,7 @@ CAiStateFunc CAiFuncMap::GetStateFunc(const char* func) const {
|
|||
return iter->second;
|
||||
}
|
||||
|
||||
CAiTriggerFunc CAiFuncMap::GetTriggerFunc(const char* func) const {
|
||||
CAiTriggerFunc CAiFuncMap::GetTriggerFunc(std::string_view func) const {
|
||||
const auto iter = x10_triggerFuncs.find(func);
|
||||
|
||||
if (iter == x10_triggerFuncs.cend()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace urde {
|
||||
|
@ -13,12 +13,12 @@ using CAiStateFunc = void (CAi::*)(CStateManager&, EStateMsg, float);
|
|||
using CAiTriggerFunc = bool (CAi::*)(CStateManager&, float);
|
||||
|
||||
class CAiFuncMap {
|
||||
std::unordered_map<std::string, CAiStateFunc> x0_stateFuncs;
|
||||
std::unordered_map<std::string, CAiTriggerFunc> x10_triggerFuncs;
|
||||
std::unordered_map<std::string_view, CAiStateFunc> x0_stateFuncs;
|
||||
std::unordered_map<std::string_view, CAiTriggerFunc> x10_triggerFuncs;
|
||||
|
||||
public:
|
||||
CAiFuncMap();
|
||||
CAiStateFunc GetStateFunc(const char*) const;
|
||||
CAiTriggerFunc GetTriggerFunc(const char*) const;
|
||||
CAiStateFunc GetStateFunc(std::string_view func) const;
|
||||
CAiTriggerFunc GetTriggerFunc(std::string_view func) const;
|
||||
};
|
||||
} // namespace urde
|
||||
|
|
|
@ -178,10 +178,10 @@ void CEnvFxManager::CalculateSnowForces(const CVectorFixed8_8& zVec,
|
|||
|
||||
void CEnvFxManager::BuildBlockObjectList(rstl::reserved_vector<TUniqueId, 1024>& list, CStateManager& mgr) {
|
||||
for (CEntity* ent : mgr.GetAllObjectList()) {
|
||||
TCastToPtr<CScriptTrigger> trig = ent;
|
||||
const TCastToConstPtr<CScriptTrigger> trig = ent;
|
||||
if (trig && True(trig->GetTriggerFlags() & ETriggerFlags::BlockEnvironmentalEffects)) {
|
||||
list.push_back(ent->GetUniqueId());
|
||||
} else if (TCastToPtr<CScriptWater> water = ent) {
|
||||
} else if (TCastToConstPtr<CScriptWater>(ent)) {
|
||||
list.push_back(ent->GetUniqueId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -643,7 +643,7 @@ std::optional<zeus::CAABox> CFishCloud::GetTouchBounds() const {
|
|||
|
||||
void CFishCloud::CreateBoidDeathParticle(CBoid& b) const {
|
||||
auto it = x21c_deathParticleCounts.begin();
|
||||
for (auto& p : x1f8_particleGens) {
|
||||
for (const auto& p : x1f8_particleGens) {
|
||||
p->SetParticleEmission(true);
|
||||
p->SetTranslation(b.x0_pos);
|
||||
p->ForceParticleCreation(*it);
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||
|
||||
#define kTableSize 2048
|
||||
|
||||
namespace urde {
|
||||
constexpr u32 kTableSize = 2048;
|
||||
|
||||
CFluidPlaneCPU::CTurbulence::CTurbulence(float speed, float distance, float freqMax, float freqMin, float phaseMax,
|
||||
float phaseMin, float amplitudeMax, float amplitudeMin)
|
||||
: x0_speed(speed)
|
||||
|
@ -25,27 +25,29 @@ CFluidPlaneCPU::CTurbulence::CTurbulence(float speed, float distance, float freq
|
|||
, x1c_amplitudeMin(amplitudeMin)
|
||||
, x2c_ooTurbSpeed(1.f / x0_speed)
|
||||
, x30_ooTurbDistance(1.f / x4_distance) {
|
||||
if (x18_amplitudeMax != 0.f || x1c_amplitudeMin != 0.f) {
|
||||
if (x18_amplitudeMax == 0.f && x1c_amplitudeMin == 0.f) {
|
||||
return;
|
||||
}
|
||||
|
||||
x24_tableCount = kTableSize;
|
||||
x28_heightSelPitch = x24_tableCount;
|
||||
x20_table.reset(new float[x24_tableCount]);
|
||||
float anglePitch = 2.f * M_PIF / x28_heightSelPitch;
|
||||
float freqConstant = 0.5f * (x8_freqMax + xc_freqMin);
|
||||
float freqLinear = 0.5f * (x8_freqMax - xc_freqMin);
|
||||
float phaseConstant = 0.5f * (x10_phaseMax + x14_phaseMin);
|
||||
float phaseLinear = 0.5f * (x10_phaseMax - x14_phaseMin);
|
||||
float amplitudeConstant = 0.5f * (x18_amplitudeMax + x1c_amplitudeMin);
|
||||
float amplitudeLinear = 0.5f * (x18_amplitudeMax - x1c_amplitudeMin);
|
||||
const float anglePitch = 2.f * M_PIF / x28_heightSelPitch;
|
||||
const float freqConstant = 0.5f * (x8_freqMax + xc_freqMin);
|
||||
const float freqLinear = 0.5f * (x8_freqMax - xc_freqMin);
|
||||
const float phaseConstant = 0.5f * (x10_phaseMax + x14_phaseMin);
|
||||
const float phaseLinear = 0.5f * (x10_phaseMax - x14_phaseMin);
|
||||
const float amplitudeConstant = 0.5f * (x18_amplitudeMax + x1c_amplitudeMin);
|
||||
const float amplitudeLinear = 0.5f * (x18_amplitudeMax - x1c_amplitudeMin);
|
||||
|
||||
float curAng = 0.f;
|
||||
for (int i = 0; i < x24_tableCount; ++i, curAng += anglePitch) {
|
||||
float angCos = std::cos(curAng);
|
||||
for (size_t i = 0; i < x24_tableCount; ++i, curAng += anglePitch) {
|
||||
const float angCos = std::cos(curAng);
|
||||
x20_table[i] = (amplitudeLinear * angCos + amplitudeConstant) *
|
||||
std::sin((freqLinear * angCos + freqConstant) * curAng + (phaseLinear * angCos + phaseConstant));
|
||||
}
|
||||
|
||||
x34_hasTurbulence = true;
|
||||
}
|
||||
}
|
||||
|
||||
CFluidPlaneCPU::CFluidPlaneCPU(CAssetId texPattern1, CAssetId texPattern2, CAssetId texColor, CAssetId bumpMap,
|
||||
|
|
|
@ -1199,7 +1199,7 @@ void CGameArea::SetAreaAttributes(const CScriptAreaAttributes* areaAttributes) {
|
|||
bool CGameArea::CAreaObjectList::IsQualified(const CEntity& ent) const { return (ent.GetAreaIdAlways() == x200c_areaIdx); }
|
||||
void CGameArea::WarmupShaders(const SObjectTag& mreaTag) {
|
||||
// Calling this version of the constructor performs warmup implicitly
|
||||
CGameArea area(mreaTag.id);
|
||||
[[maybe_unused]] CGameArea area(mreaTag.id);
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -249,8 +249,8 @@ public:
|
|||
void ComputeLiftForces(const zeus::CVector3f& controlForce, const zeus::CVector3f& velocity,
|
||||
const CStateManager& mgr);
|
||||
float CalculateSurfaceFriction() const;
|
||||
void ApplyGravity(CStateManager& mgr);
|
||||
void SpinToSpeed(float holdMag, zeus::CVector3f torque, float mag);
|
||||
void ApplyGravity(const CStateManager& mgr);
|
||||
void SpinToSpeed(float holdMag, const zeus::CVector3f& torque, float mag);
|
||||
float ComputeMaxSpeed() const;
|
||||
void Touch(CActor& actor, CStateManager& mgr);
|
||||
bool IsClimbable(const CCollisionInfo& cinfo) const;
|
||||
|
|
|
@ -33,33 +33,43 @@ CPFRegion::CPFRegion(CMemoryInStream& in) {
|
|||
const CPFLink* CPFRegion::GetPathLink() const { return &xc_startLink[x4c_regionData->GetPathLink()]; }
|
||||
|
||||
void CPFRegion::Fixup(CPFArea& area, u32& maxRegionNodes) {
|
||||
if (x0_numNodes)
|
||||
if (x0_numNodes != 0) {
|
||||
x4_startNode = &area.x140_nodes[reinterpret_cast<uintptr_t>(x4_startNode)];
|
||||
else
|
||||
} else {
|
||||
x4_startNode = nullptr;
|
||||
if (x8_numLinks)
|
||||
}
|
||||
|
||||
if (x8_numLinks != 0) {
|
||||
xc_startLink = &area.x148_links[reinterpret_cast<uintptr_t>(xc_startLink)];
|
||||
else
|
||||
} else {
|
||||
xc_startLink = nullptr;
|
||||
}
|
||||
|
||||
x4c_regionData = &area.x178_regionDatas[x24_regionIdx];
|
||||
if (x0_numNodes > maxRegionNodes)
|
||||
if (x0_numNodes > maxRegionNodes) {
|
||||
maxRegionNodes = x0_numNodes;
|
||||
}
|
||||
}
|
||||
|
||||
bool CPFRegion::IsPointInside(const zeus::CVector3f& point) const {
|
||||
if (!x34_aabb.pointInside(point))
|
||||
if (!x34_aabb.pointInside(point)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 i;
|
||||
for (i = 0; i < x0_numNodes; ++i) {
|
||||
CPFNode& node = x4_startNode[i];
|
||||
if ((point - node.GetPos()).dot(node.GetNormal()) < 0.f)
|
||||
const CPFNode& node = x4_startNode[i];
|
||||
if ((point - node.GetPos()).dot(node.GetNormal()) < 0.f) {
|
||||
break;
|
||||
}
|
||||
if (i != x0_numNodes)
|
||||
}
|
||||
|
||||
if (i != x0_numNodes) {
|
||||
return false;
|
||||
zeus::CVector3f nodeToPoint = point - x4_startNode->GetPos();
|
||||
return nodeToPoint.dot(x18_normal) >= 0.f &&
|
||||
(nodeToPoint - x14_height * zeus::skUp).dot(x18_normal) <= 0.f;
|
||||
}
|
||||
|
||||
const zeus::CVector3f nodeToPoint = point - x4_startNode->GetPos();
|
||||
return nodeToPoint.dot(x18_normal) >= 0.f && (nodeToPoint - x14_height * zeus::skUp).dot(x18_normal) <= 0.f;
|
||||
}
|
||||
|
||||
float CPFRegion::PointHeight(const zeus::CVector3f& point) const {
|
||||
|
@ -73,13 +83,14 @@ bool CPFRegion::FindClosestPointOnPolygon(const std::vector<zeus::CVector3f>& po
|
|||
for (i = 0; i < polyPoints.size(); ++i) {
|
||||
const zeus::CVector3f& p0 = polyPoints[i];
|
||||
const zeus::CVector3f& p1 = polyPoints[(i + 1) % polyPoints.size()];
|
||||
if ((p1 - p0).cross(normal).dot(point - p0) < 0.f)
|
||||
if ((p1 - p0).cross(normal).dot(point - p0) < 0.f) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == polyPoints.size()) {
|
||||
float distToPoly = (polyPoints.front() - point).dot(normal);
|
||||
float distToPolySq = distToPoly * distToPoly;
|
||||
const float distToPoly = (polyPoints.front() - point).dot(normal);
|
||||
const float distToPolySq = distToPoly * distToPoly;
|
||||
if (distToPolySq < x4c_regionData->GetBestPointDistanceSquared()) {
|
||||
found = true;
|
||||
x4c_regionData->SetBestPointDistanceSquared(distToPolySq);
|
||||
|
@ -93,11 +104,12 @@ bool CPFRegion::FindClosestPointOnPolygon(const std::vector<zeus::CVector3f>& po
|
|||
zeus::CVector3f p0ToP1 = p1 - p0;
|
||||
zeus::CVector3f p1ToPoint = point - p1;
|
||||
zeus::CVector3f sum = p1ToPoint + p0ToP1;
|
||||
|
||||
if (p0ToP1.cross(normal).dot(p1ToPoint) < 0.f && p0ToP1.dot(p1ToPoint) <= 0.f && sum.dot(p0ToP1) >= 0.f) {
|
||||
projected = true;
|
||||
p0ToP1.normalize();
|
||||
sum -= p0ToP1.dot(sum) * p0ToP1;
|
||||
float distSq = sum.magSquared();
|
||||
const float distSq = sum.magSquared();
|
||||
if (distSq < x4c_regionData->GetBestPointDistanceSquared()) {
|
||||
found = true;
|
||||
x4c_regionData->SetBestPointDistanceSquared(distSq);
|
||||
|
@ -110,7 +122,7 @@ bool CPFRegion::FindClosestPointOnPolygon(const std::vector<zeus::CVector3f>& po
|
|||
if (!projected && !excludePolyPoints) {
|
||||
for (i = 0; i < polyPoints.size(); ++i) {
|
||||
const zeus::CVector3f& p0 = polyPoints[i];
|
||||
float distSq = (point - p0).magSquared();
|
||||
const float distSq = (point - p0).magSquared();
|
||||
if (distSq < x4c_regionData->GetBestPointDistanceSquared()) {
|
||||
found = true;
|
||||
x4c_regionData->SetBestPointDistanceSquared(distSq);
|
||||
|
@ -125,12 +137,14 @@ bool CPFRegion::FindClosestPointOnPolygon(const std::vector<zeus::CVector3f>& po
|
|||
bool CPFRegion::FindBestPoint(std::vector<zeus::CVector3f>& polyPoints, const zeus::CVector3f& point, u32 flags,
|
||||
float paddingSq) const {
|
||||
bool found = false;
|
||||
bool isFlyer = (flags & 0x2) != 0;
|
||||
const bool isFlyer = (flags & 0x2) != 0;
|
||||
|
||||
x4c_regionData->SetBestPointDistanceSquared(paddingSq);
|
||||
|
||||
if (!isFlyer) {
|
||||
for (u32 i = 0; i < x0_numNodes; ++i) {
|
||||
CPFNode& node = x4_startNode[i];
|
||||
CPFNode& nextNode = x4_startNode[(i + 1) % x0_numNodes];
|
||||
const CPFNode& node = x4_startNode[i];
|
||||
const CPFNode& nextNode = x4_startNode[(i + 1) % x0_numNodes];
|
||||
polyPoints.clear();
|
||||
polyPoints.push_back(node.GetPos());
|
||||
polyPoints.push_back(node.GetPos());
|
||||
|
@ -144,7 +158,7 @@ bool CPFRegion::FindBestPoint(std::vector<zeus::CVector3f>& polyPoints, const ze
|
|||
|
||||
polyPoints.clear();
|
||||
for (u32 i = 0; i < x0_numNodes; ++i) {
|
||||
CPFNode& node = x4_startNode[i];
|
||||
const CPFNode& node = x4_startNode[i];
|
||||
polyPoints.push_back(node.GetPos());
|
||||
}
|
||||
found |= FindClosestPointOnPolygon(polyPoints, x18_normal, point, false);
|
||||
|
@ -152,7 +166,7 @@ bool CPFRegion::FindBestPoint(std::vector<zeus::CVector3f>& polyPoints, const ze
|
|||
if (!isFlyer) {
|
||||
polyPoints.clear();
|
||||
for (int i = int(x0_numNodes) - 1; i >= 0; --i) {
|
||||
CPFNode& node = x4_startNode[i];
|
||||
const CPFNode& node = x4_startNode[i];
|
||||
polyPoints.push_back(node.GetPos());
|
||||
polyPoints.back().z() += x14_height;
|
||||
}
|
||||
|
@ -162,14 +176,17 @@ bool CPFRegion::FindBestPoint(std::vector<zeus::CVector3f>& polyPoints, const ze
|
|||
return found;
|
||||
}
|
||||
|
||||
void CPFRegion::SetLinkTo(s32 idx) {
|
||||
if (x8_numLinks <= 0)
|
||||
void CPFRegion::SetLinkTo(u32 idx) {
|
||||
if (x8_numLinks <= 0) {
|
||||
return;
|
||||
for (u32 i = 0; i < x8_numLinks; ++i)
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < x8_numLinks; ++i) {
|
||||
if (xc_startLink[i].GetRegion() == idx) {
|
||||
Data()->SetPathLink(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPFRegion::DropToGround(zeus::CVector3f& point) const {
|
||||
|
@ -184,55 +201,59 @@ zeus::CVector3f CPFRegion::GetLinkMidPoint(const CPFLink& link) const {
|
|||
|
||||
zeus::CVector3f CPFRegion::FitThroughLink2d(const zeus::CVector3f& p1, const CPFLink& link, const zeus::CVector3f& p2,
|
||||
float chRadius) const {
|
||||
CPFNode& node = x4_startNode[link.GetNode()];
|
||||
CPFNode& nextNode = x4_startNode[(link.GetNode() + 1) % x0_numNodes];
|
||||
zeus::CVector3f nodeDelta = nextNode.GetPos() - node.GetPos();
|
||||
const CPFNode& node = x4_startNode[link.GetNode()];
|
||||
const CPFNode& nextNode = x4_startNode[(link.GetNode() + 1) % x0_numNodes];
|
||||
const zeus::CVector3f nodeDelta = nextNode.GetPos() - node.GetPos();
|
||||
float t = 0.5f;
|
||||
|
||||
if (chRadius < 0.5f * link.Get2dWidth()) {
|
||||
zeus::CVector2f delta2d = nodeDelta.toVec2f();
|
||||
delta2d *= link.GetOO2dWidth();
|
||||
zeus::CVector3f nodeToP1 = p1 - node.GetPos();
|
||||
float f27 = nodeToP1.dot(node.GetNormal());
|
||||
float f31 = delta2d.dot(nodeToP1.toVec2f());
|
||||
zeus::CVector3f nodeToP2 = p2 - node.GetPos();
|
||||
float f26 = -nodeToP2.dot(node.GetNormal());
|
||||
float f1b = delta2d.dot(nodeToP2.toVec2f());
|
||||
float f3 = f27 + f26;
|
||||
if (f3 > FLT_EPSILON)
|
||||
const zeus::CVector3f nodeToP1 = p1 - node.GetPos();
|
||||
const float f27 = nodeToP1.dot(node.GetNormal());
|
||||
const float f31 = delta2d.dot(nodeToP1.toVec2f());
|
||||
const zeus::CVector3f nodeToP2 = p2 - node.GetPos();
|
||||
const float f26 = -nodeToP2.dot(node.GetNormal());
|
||||
const float f1b = delta2d.dot(nodeToP2.toVec2f());
|
||||
const float f3 = f27 + f26;
|
||||
if (f3 > FLT_EPSILON) {
|
||||
t = zeus::clamp(chRadius, 1.f / f3 * (f26 * f31 + f27 * f1b), link.Get2dWidth() - chRadius) * link.GetOO2dWidth();
|
||||
}
|
||||
}
|
||||
return nodeDelta * t + node.GetPos();
|
||||
}
|
||||
|
||||
zeus::CVector3f CPFRegion::FitThroughLink3d(const zeus::CVector3f& p1, const CPFLink& link, float regionHeight,
|
||||
const zeus::CVector3f& p2, float chRadius, float chHalfHeight) const {
|
||||
CPFNode& node = x4_startNode[link.GetNode()];
|
||||
CPFNode& nextNode = x4_startNode[(link.GetNode() + 1) % x0_numNodes];
|
||||
zeus::CVector3f nodeDelta = nextNode.GetPos() - node.GetPos();
|
||||
float f25 = (p1 - node.GetPos()).dot(node.GetNormal());
|
||||
float f24 = (node.GetPos() - p2).dot(node.GetNormal());
|
||||
float f23 = f25 + f24;
|
||||
const CPFNode& node = x4_startNode[link.GetNode()];
|
||||
const CPFNode& nextNode = x4_startNode[(link.GetNode() + 1) % x0_numNodes];
|
||||
const zeus::CVector3f nodeDelta = nextNode.GetPos() - node.GetPos();
|
||||
const float f25 = (p1 - node.GetPos()).dot(node.GetNormal());
|
||||
const float f24 = (node.GetPos() - p2).dot(node.GetNormal());
|
||||
const float f23 = f25 + f24;
|
||||
|
||||
#if 0
|
||||
if (chRadius < 0.5f * link.Get2dWidth()) {
|
||||
zeus::CVector2f delta2d(nodeDelta.x, nodeDelta.y);
|
||||
delta2d *= link.GetOO2dWidth();
|
||||
zeus::CVector3f nodeToP1 = p1 - node.GetPos();
|
||||
float f29 = delta2d.dot(zeus::CVector2f(nodeToP1.y, nodeToP1.y));
|
||||
zeus::CVector3f nodeToP2 = p2 - node.GetPos();
|
||||
float f1b = delta2d.dot(zeus::CVector2f(nodeToP2.y, nodeToP2.y));
|
||||
const zeus::CVector3f nodeToP1 = p1 - node.GetPos();
|
||||
const float f29 = delta2d.dot(zeus::CVector2f(nodeToP1.y, nodeToP1.y));
|
||||
const zeus::CVector3f nodeToP2 = p2 - node.GetPos();
|
||||
const float f1b = delta2d.dot(zeus::CVector2f(nodeToP2.y, nodeToP2.y));
|
||||
if (f23 > FLT_EPSILON) {
|
||||
zeus::clamp(chRadius, 1.f / f23 * f24 * f29 + f25 * f1b, link.Get2dWidth() - chRadius) *
|
||||
link.GetOO2dWidth();
|
||||
zeus::clamp(chRadius, 1.f / f23 * f24 * f29 + f25 * f1b, link.Get2dWidth() - chRadius) * link.GetOO2dWidth();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
zeus::CVector3f midPoint = nodeDelta * 0.5f + node.GetPos();
|
||||
|
||||
const zeus::CVector3f midPoint = nodeDelta * 0.5f + node.GetPos();
|
||||
float z;
|
||||
if (chHalfHeight < 0.5f * regionHeight) {
|
||||
float minZ = chHalfHeight + midPoint.z();
|
||||
const float minZ = chHalfHeight + midPoint.z();
|
||||
z = 0.5f * (p1.z() + p2.z());
|
||||
if (f23 > FLT_EPSILON)
|
||||
if (f23 > FLT_EPSILON) {
|
||||
z = (f24 * p1.z() + f25 * p2.z()) / f23;
|
||||
}
|
||||
z = zeus::clamp(minZ, z, regionHeight + midPoint.z() - chHalfHeight);
|
||||
} else {
|
||||
z = (p1.z() + p2.z()) * 0.5f;
|
||||
|
|
|
@ -52,27 +52,35 @@ class CPFRegion {
|
|||
public:
|
||||
CPFRegion() = default;
|
||||
explicit CPFRegion(CMemoryInStream& in);
|
||||
|
||||
void SetData(CPFRegionData* data) { x4c_regionData = data; }
|
||||
CPFRegionData* Data() const { return x4c_regionData; }
|
||||
CPFRegionData* Data() { return x4c_regionData; }
|
||||
const CPFRegionData* Data() const { return x4c_regionData; }
|
||||
|
||||
u32 GetIndex() const { return x24_regionIdx; }
|
||||
float GetHeight() const { return x14_height; }
|
||||
const CPFLink* GetPathLink() const;
|
||||
u32 GetNumLinks() const { return x8_numLinks; }
|
||||
u32 GetFlags() const { return x10_flags; }
|
||||
const CPFLink* GetLink(u32 i) const { return xc_startLink + i; }
|
||||
|
||||
void SetCentroid(const zeus::CVector3f& c) { x28_centroid = c; }
|
||||
const zeus::CVector3f& GetCentroid() const { return x28_centroid; }
|
||||
|
||||
void Fixup(CPFArea& area, u32& maxRegionNodes);
|
||||
bool IsPointInside(const zeus::CVector3f& point) const;
|
||||
|
||||
const zeus::CVector3f& GetNormal() const { return x18_normal; }
|
||||
u32 GetNumNodes() const { return x0_numNodes; }
|
||||
const CPFNode* GetNode(u32 i) const { return x4_startNode + i; }
|
||||
|
||||
float PointHeight(const zeus::CVector3f& point) const;
|
||||
bool FindClosestPointOnPolygon(const std::vector<zeus::CVector3f>&, const zeus::CVector3f&, const zeus::CVector3f&,
|
||||
bool) const;
|
||||
bool FindBestPoint(std::vector<zeus::CVector3f>& polyPoints, const zeus::CVector3f& point, u32 flags,
|
||||
float paddingSq) const;
|
||||
void SetLinkTo(s32 idx);
|
||||
|
||||
void SetLinkTo(u32 idx);
|
||||
void DropToGround(zeus::CVector3f& point) const;
|
||||
zeus::CVector3f GetLinkMidPoint(const CPFLink& link) const;
|
||||
zeus::CVector3f FitThroughLink2d(const zeus::CVector3f& p1, const CPFLink& link, const zeus::CVector3f& p2,
|
||||
|
|
|
@ -881,15 +881,20 @@ void CPatterned::TryLoopReaction(CStateManager& mgr, int arg) {
|
|||
void CPatterned::TryProjectileAttack(CStateManager&, int arg) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCProjectileAttackCmd(pas::ESeverity(arg), x2e0_destPos, false));
|
||||
}
|
||||
|
||||
void CPatterned::TryMeleeAttack_TargetPos(CStateManager& mgr, int arg) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(pas::ESeverity(arg), x2e0_destPos));
|
||||
}
|
||||
|
||||
void CPatterned::TryMeleeAttack(CStateManager& mgr, int arg) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(pas::ESeverity(arg)));
|
||||
}
|
||||
|
||||
void CPatterned::TryGenerate(CStateManager& mgr, int arg) {
|
||||
void CPatterned::TryGenerateNoXf(CStateManager& mgr, int arg) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType(arg), x2e0_destPos, false));
|
||||
}
|
||||
|
||||
void CPatterned::TryGenerateNoXf(CStateManager& mgr, int arg) {
|
||||
void CPatterned::TryGenerate(CStateManager& mgr, int arg) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType::Zero, x2e0_destPos, true));
|
||||
}
|
||||
|
||||
|
@ -941,6 +946,10 @@ void CPatterned::TryKnockBack(CStateManager& mgr, int arg) {
|
|||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTranslation(), pas::ESeverity(arg)));
|
||||
}
|
||||
|
||||
void CPatterned::TryKnockBack_Front(CStateManager& mgr, int arg) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity(arg)));
|
||||
}
|
||||
|
||||
void CPatterned::TryGenerateDeactivate(urde::CStateManager& mgr, int arg) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType(arg), zeus::skZero3f));
|
||||
}
|
||||
|
|
|
@ -320,9 +320,10 @@ public:
|
|||
void TryCommand(CStateManager& mgr, pas::EAnimationState state, CPatternedTryFunc func, int arg);
|
||||
void TryLoopReaction(CStateManager& mgr, int arg);
|
||||
void TryProjectileAttack(CStateManager& mgr, int arg);
|
||||
void TryMeleeAttack_TargetPos(CStateManager& mgr, int arg);
|
||||
void TryMeleeAttack(CStateManager& mgr, int arg);
|
||||
void TryGenerate(CStateManager& mgr, int arg);
|
||||
void TryGenerateNoXf(CStateManager& mgr, int arg);
|
||||
void TryGenerate(CStateManager& mgr, int arg);
|
||||
void TryJump(CStateManager& mgr, int arg);
|
||||
void TryTurn(CStateManager& mgr, int arg);
|
||||
void TryGetUp(CStateManager& mgr, int arg);
|
||||
|
@ -334,6 +335,7 @@ public:
|
|||
void TryCover(CStateManager& mgr, int arg);
|
||||
void TryWallHang(CStateManager& mgr, int arg);
|
||||
void TryKnockBack(CStateManager& mgr, int arg);
|
||||
void TryKnockBack_Front(CStateManager& mgr, int arg);
|
||||
void TryGenerateDeactivate(CStateManager& mgr, int arg);
|
||||
void TryStep(CStateManager& mgr, int arg);
|
||||
|
||||
|
|
|
@ -1267,7 +1267,7 @@ static CAssetId UpdatePersistentScanPercent(u32 prevLogScans, u32 logScans, u32
|
|||
if (scanPercentProgStep > prevScanPercentProgStep) {
|
||||
const char* const messageResBase = UnlockMessageResBases[zeus::clamp(0, scanPercentProgStep - 1, 1)];
|
||||
const auto message = std::string(messageResBase).append(1, firstTime ? '1' : '2');
|
||||
const auto id = g_ResFactory->GetResourceIdByName(message);
|
||||
const auto* const id = g_ResFactory->GetResourceIdByName(message);
|
||||
if (id != nullptr) {
|
||||
return id->id;
|
||||
}
|
||||
|
@ -2376,7 +2376,11 @@ bool CPlayer::SetAreaPlayerHint(const CScriptPlayerHint& hint, CStateManager& mg
|
|||
}
|
||||
|
||||
void CPlayer::AddToPlayerHintRemoveList(TUniqueId id, CStateManager& mgr) {
|
||||
if (const TCastToConstPtr<CScriptPlayerHint> hint = mgr.ObjectById(id)) {
|
||||
const TCastToConstPtr<CScriptPlayerHint> hint = mgr.ObjectById(id);
|
||||
if (!hint) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const TUniqueId existId : x93c_playerHintsToRemove) {
|
||||
if (id == existId) {
|
||||
return;
|
||||
|
@ -2386,11 +2390,14 @@ void CPlayer::AddToPlayerHintRemoveList(TUniqueId id, CStateManager& mgr) {
|
|||
if (x93c_playerHintsToRemove.size() != 32) {
|
||||
x93c_playerHintsToRemove.push_back(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayer::AddToPlayerHintAddList(TUniqueId id, CStateManager& mgr) {
|
||||
if (const TCastToConstPtr<CScriptPlayerHint> hint = mgr.ObjectById(id)) {
|
||||
const TCastToConstPtr<CScriptPlayerHint> hint = mgr.ObjectById(id);
|
||||
if (!hint) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const TUniqueId existId : x980_playerHintsToAdd) {
|
||||
if (id == existId) {
|
||||
return;
|
||||
|
@ -2400,11 +2407,14 @@ void CPlayer::AddToPlayerHintAddList(TUniqueId id, CStateManager& mgr) {
|
|||
if (x980_playerHintsToAdd.size() != 32) {
|
||||
x980_playerHintsToAdd.push_back(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayer::DeactivatePlayerHint(TUniqueId id, CStateManager& mgr) {
|
||||
if (TCastToPtr<CScriptPlayerHint> hint = mgr.ObjectById(id)) {
|
||||
const TCastToPtr<CScriptPlayerHint> hint = mgr.ObjectById(id);
|
||||
if (!hint) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const TUniqueId existId : x93c_playerHintsToRemove) {
|
||||
if (id == existId) {
|
||||
return;
|
||||
|
@ -2416,7 +2426,6 @@ void CPlayer::DeactivatePlayerHint(TUniqueId id, CStateManager& mgr) {
|
|||
hint->ClearObjectList();
|
||||
hint->SetDeactivated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayer::UpdatePlayerHints(CStateManager& mgr) {
|
||||
|
@ -3233,7 +3242,9 @@ void CPlayer::UpdateGunTransform(const zeus::CVector3f& gunPos, CStateManager& m
|
|||
|
||||
void CPlayer::UpdateAssistedAiming(const zeus::CTransform& xf, const CStateManager& mgr) {
|
||||
zeus::CTransform assistXf = xf;
|
||||
if (TCastToConstPtr<CActor> target = mgr.GetObjectById(x3f4_aimTarget)) {
|
||||
const TCastToConstPtr<CActor> target = mgr.GetObjectById(x3f4_aimTarget);
|
||||
|
||||
if (target) {
|
||||
zeus::CVector3f gunToTarget = x480_assistedTargetAim - xf.origin;
|
||||
zeus::CVector3f gunToTargetFlat = gunToTarget;
|
||||
gunToTargetFlat.z() = 0.f;
|
||||
|
@ -4646,7 +4657,7 @@ void CPlayer::UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr) {
|
|||
}
|
||||
break;
|
||||
case EPlayerOrbitState::OrbitObject:
|
||||
if (const TCastToConstPtr<CScriptGrapplePoint> point = mgr.GetObjectById(x310_orbitTargetId)) {
|
||||
if (TCastToConstPtr<CScriptGrapplePoint>(mgr.GetObjectById(x310_orbitTargetId))) {
|
||||
if (ValidateCurrentOrbitTargetId(mgr) == EOrbitValidationResult::OK) {
|
||||
UpdateOrbitPosition(g_tweakPlayer->GetOrbitNormalDistance(int(x308_orbitType)), mgr);
|
||||
} else {
|
||||
|
@ -4729,7 +4740,7 @@ void CPlayer::UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr) {
|
|||
case EPlayerOrbitState::NoOrbit:
|
||||
break;
|
||||
case EPlayerOrbitState::OrbitObject:
|
||||
if (TCastToConstPtr<CScriptGrapplePoint> point = mgr.GetObjectById(x310_orbitTargetId)) {
|
||||
if (TCastToConstPtr<CScriptGrapplePoint>(mgr.GetObjectById(x310_orbitTargetId))) {
|
||||
BreakGrapple(EPlayerOrbitRequest::Default, mgr);
|
||||
} else {
|
||||
SetOrbitRequest(EPlayerOrbitRequest::StopOrbit, mgr);
|
||||
|
|
|
@ -89,6 +89,7 @@ CScriptDebris::CScriptDebris(TUniqueId uid, std::string_view name, const CEntity
|
|||
, x281_27_particle2GlobalTranslation(particle2GlobalTranslation)
|
||||
, x281_28_deferDeleteTillParticle2Done(deferDeleteTillParticle2Done)
|
||||
, x281_30_debrisExtended(true)
|
||||
, x281_31_dieOnProjectile(dieOnProjectile)
|
||||
, x282_24_noBounce(noBounce)
|
||||
, x288_linConeAngle(linConeAngle)
|
||||
, x28c_linMinMag(linMinMag)
|
||||
|
|
|
@ -14,9 +14,9 @@ namespace urde {
|
|||
class CElementGen;
|
||||
class CScriptDebris : public CPhysicsActor {
|
||||
public:
|
||||
enum class EScaleType { NoScale, EndsToZero };
|
||||
enum class EScaleType : u8 { NoScale, EndsToZero };
|
||||
|
||||
enum class EOrientationType { NotOriented, AlongVelocity, ToObject, AlongCollisionNormal };
|
||||
enum class EOrientationType : u8 { NotOriented, AlongVelocity, ToObject, AlongCollisionNormal };
|
||||
|
||||
private:
|
||||
zeus::CVector3f x258_velocity;
|
||||
|
|
|
@ -381,8 +381,8 @@ void CScriptGunTurret::SetupCollisionManager(CStateManager& mgr) {
|
|||
x49c_collisionManager->SetActive(mgr, GetActive());
|
||||
|
||||
for (int i = 0; i < x49c_collisionManager->GetNumCollisionActors(); ++i) {
|
||||
auto& desc = x49c_collisionManager->GetCollisionDescFromIndex(i);
|
||||
if (TCastToPtr<CCollisionActor> cAct = mgr.ObjectById(desc.GetCollisionActorId())) {
|
||||
const auto& desc = x49c_collisionManager->GetCollisionDescFromIndex(i);
|
||||
if (const TCastToPtr<CCollisionActor> cAct = mgr.ObjectById(desc.GetCollisionActorId())) {
|
||||
cAct->AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr);
|
||||
cAct->SetMaterialFilter(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Player},
|
||||
{EMaterialTypes::Character, EMaterialTypes::NoStaticCollision, EMaterialTypes::NoPlatformCollision}));
|
||||
|
|
|
@ -14,7 +14,7 @@ CStateMachine::CStateMachine(CInputStream& in) {
|
|||
|
||||
for (u32 i = 0; i < stateCount; ++i) {
|
||||
std::string name = in.readString(31, false);
|
||||
CAiStateFunc func = CAi::GetStateFunc(name.c_str());
|
||||
CAiStateFunc func = CAi::GetStateFunc(name);
|
||||
x0_states.emplace_back(func, name.c_str());
|
||||
}
|
||||
|
||||
|
@ -28,14 +28,14 @@ CStateMachine::CStateMachine(CInputStream& in) {
|
|||
x0_states[i].SetTriggers(firstTrig);
|
||||
x10_triggers.resize(x10_triggers.size() + x0_states[i].GetNumTriggers());
|
||||
|
||||
for (u32 j = 0; j < x0_states[i].GetNumTriggers(); ++j) {
|
||||
u32 triggerCount = in.readUint32Big();
|
||||
u32 lastTriggerIdx = triggerCount - 1;
|
||||
for (s32 j = 0; j < x0_states[i].GetNumTriggers(); ++j) {
|
||||
const u32 triggerCount = in.readUint32Big();
|
||||
const u32 lastTriggerIdx = triggerCount - 1;
|
||||
for (u32 k = 0; k < triggerCount; ++k) {
|
||||
std::string name = in.readString(31, false);
|
||||
bool isNot = name.front() == '!';
|
||||
CAiTriggerFunc func = CAi::GetTrigerFunc(isNot ? name.c_str() + 1 : name.c_str());
|
||||
float arg = in.readFloatBig();
|
||||
const bool isNot = name.front() == '!';
|
||||
const CAiTriggerFunc func = CAi::GetTriggerFunc(isNot ? name.c_str() + 1 : name.c_str());
|
||||
const float arg = in.readFloatBig();
|
||||
CAiTrigger* newTrig;
|
||||
if (k < lastTriggerIdx) {
|
||||
newTrig = &x10_triggers.emplace_back();
|
||||
|
|
|
@ -53,11 +53,12 @@ void CWallWalker::AlignToFloor(CStateManager& mgr, float radius, const zeus::CVe
|
|||
zeus::CAABox aabb(newPos - margin, newPos + margin);
|
||||
CAreaCollisionCache ccache(aabb);
|
||||
CGameCollision::BuildAreaCollisionCache(mgr, ccache);
|
||||
if (x5d6_25_hasAlignSurface)
|
||||
if (x5d6_25_hasAlignSurface) {
|
||||
x5d6_25_hasAlignSurface = PointOnSurface(x568_alignNormal, newPos);
|
||||
}
|
||||
if (!x5d6_25_hasAlignSurface || !(x5d4_thinkCounter & 0x3)) {
|
||||
for (auto& leaf : ccache) {
|
||||
for (auto& node : leaf) {
|
||||
for (const auto& leaf : ccache) {
|
||||
for (const auto& node : leaf) {
|
||||
CAreaOctTree::TriListReference triArr = node.GetTriangleArray();
|
||||
for (u16 i = 0; i < triArr.GetSize(); ++i) {
|
||||
u16 triIdx = triArr.GetAt(i);
|
||||
|
|
134
Runtime/rstl.hpp
134
Runtime/rstl.hpp
|
@ -119,106 +119,8 @@ public:
|
|||
T& operator[](std::ptrdiff_t i) const { return const_cast<T*>(const_iterator::m_val)[i]; }
|
||||
};
|
||||
|
||||
class const_reverse_iterator {
|
||||
friend class _reserved_vector_base;
|
||||
|
||||
protected:
|
||||
const T* m_val;
|
||||
|
||||
public:
|
||||
explicit const_reverse_iterator(const T* val) : m_val(val) {}
|
||||
using value_type = T;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using pointer = T*;
|
||||
using reference = T&;
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
|
||||
const T& operator*() const { return *m_val; }
|
||||
const T* operator->() const { return m_val; }
|
||||
const_reverse_iterator& operator++() {
|
||||
--m_val;
|
||||
return *this;
|
||||
}
|
||||
const_reverse_iterator& operator--() {
|
||||
++m_val;
|
||||
return *this;
|
||||
}
|
||||
const_reverse_iterator operator++(int) {
|
||||
auto ret = *this;
|
||||
--m_val;
|
||||
return ret;
|
||||
}
|
||||
const_reverse_iterator operator--(int) {
|
||||
auto ret = *this;
|
||||
++m_val;
|
||||
return ret;
|
||||
}
|
||||
bool operator!=(const const_reverse_iterator& other) const { return m_val != other.m_val; }
|
||||
bool operator==(const const_reverse_iterator& other) const { return m_val == other.m_val; }
|
||||
const_reverse_iterator operator+(std::ptrdiff_t i) const { return const_reverse_iterator(m_val - i); }
|
||||
const_reverse_iterator operator-(std::ptrdiff_t i) const { return const_reverse_iterator(m_val + i); }
|
||||
const_reverse_iterator& operator+=(std::ptrdiff_t i) {
|
||||
m_val -= i;
|
||||
return *this;
|
||||
}
|
||||
const_reverse_iterator& operator-=(std::ptrdiff_t i) {
|
||||
m_val += i;
|
||||
return *this;
|
||||
}
|
||||
std::ptrdiff_t operator-(const const_reverse_iterator& it) const { return it.m_val - m_val; }
|
||||
bool operator>(const const_iterator& it) const { return it.m_val > m_val; }
|
||||
bool operator<(const const_iterator& it) const { return it.m_val < m_val; }
|
||||
bool operator>=(const const_iterator& it) const { return it.m_val >= m_val; }
|
||||
bool operator<=(const const_iterator& it) const { return it.m_val <= m_val; }
|
||||
const T& operator[](std::ptrdiff_t i) const { return m_val[-i]; }
|
||||
};
|
||||
|
||||
class reverse_iterator : public const_reverse_iterator {
|
||||
friend class _reserved_vector_base;
|
||||
|
||||
public:
|
||||
explicit reverse_iterator(T* val) : const_reverse_iterator(val) {}
|
||||
T& operator*() const { return *const_cast<T*>(const_reverse_iterator::m_val); }
|
||||
T* operator->() const { return const_cast<T*>(const_reverse_iterator::m_val); }
|
||||
reverse_iterator& operator++() {
|
||||
--const_reverse_iterator::m_val;
|
||||
return *this;
|
||||
}
|
||||
reverse_iterator& operator--() {
|
||||
++const_reverse_iterator::m_val;
|
||||
return *this;
|
||||
}
|
||||
reverse_iterator operator++(int) {
|
||||
auto ret = *this;
|
||||
--const_reverse_iterator::m_val;
|
||||
return ret;
|
||||
}
|
||||
reverse_iterator operator--(int) {
|
||||
auto ret = *this;
|
||||
++const_reverse_iterator::m_val;
|
||||
return ret;
|
||||
}
|
||||
reverse_iterator operator+(std::ptrdiff_t i) const {
|
||||
return reverse_iterator(const_cast<T*>(const_reverse_iterator::m_val) - i);
|
||||
}
|
||||
reverse_iterator operator-(std::ptrdiff_t i) const {
|
||||
return reverse_iterator(const_cast<T*>(const_reverse_iterator::m_val) + i);
|
||||
}
|
||||
reverse_iterator& operator+=(std::ptrdiff_t i) {
|
||||
const_reverse_iterator::m_val -= i;
|
||||
return *this;
|
||||
}
|
||||
reverse_iterator& operator-=(std::ptrdiff_t i) {
|
||||
const_reverse_iterator::m_val += i;
|
||||
return *this;
|
||||
}
|
||||
std::ptrdiff_t operator-(const reverse_iterator& it) const { return it.m_val - const_reverse_iterator::m_val; }
|
||||
bool operator>(const const_reverse_iterator& it) const { return it.m_val > const_reverse_iterator::m_val; }
|
||||
bool operator<(const const_reverse_iterator& it) const { return it.m_val < const_reverse_iterator::m_val; }
|
||||
bool operator>=(const const_reverse_iterator& it) const { return it.m_val >= const_reverse_iterator::m_val; }
|
||||
bool operator<=(const const_reverse_iterator& it) const { return it.m_val <= const_reverse_iterator::m_val; }
|
||||
T& operator[](std::ptrdiff_t i) const { return const_cast<T*>(const_reverse_iterator::m_val)[-i]; }
|
||||
};
|
||||
using reverse_iterator = decltype(std::make_reverse_iterator(iterator{nullptr}));
|
||||
using const_reverse_iterator = decltype(std::make_reverse_iterator(const_iterator{nullptr}));
|
||||
|
||||
protected:
|
||||
static iterator _const_cast_iterator(const const_iterator& it) { return iterator(const_cast<T*>(it.m_val)); }
|
||||
|
@ -540,16 +442,12 @@ public:
|
|||
[[nodiscard]] const_iterator cbegin() const noexcept { return begin(); }
|
||||
[[nodiscard]] const_iterator cend() const noexcept { return end(); }
|
||||
|
||||
[[nodiscard]] const_reverse_iterator rbegin() const noexcept {
|
||||
return const_reverse_iterator(std::addressof(_value(x0_size - 1)));
|
||||
}
|
||||
[[nodiscard]] const_reverse_iterator rend() const noexcept {
|
||||
return const_reverse_iterator(std::addressof(_value(-1)));
|
||||
}
|
||||
[[nodiscard]] reverse_iterator rbegin() noexcept { return reverse_iterator(std::addressof(_value(x0_size - 1))); }
|
||||
[[nodiscard]] reverse_iterator rend() noexcept { return reverse_iterator(std::addressof(_value(-1))); }
|
||||
[[nodiscard]] const_reverse_iterator crbegin() const noexcept { return rbegin(); }
|
||||
[[nodiscard]] const_reverse_iterator crend() const noexcept { return rend(); }
|
||||
[[nodiscard]] auto rbegin() const noexcept { return std::make_reverse_iterator(end()); }
|
||||
[[nodiscard]] auto rend() const noexcept { return std::make_reverse_iterator(begin()); }
|
||||
[[nodiscard]] auto rbegin() noexcept { return std::make_reverse_iterator(end()); }
|
||||
[[nodiscard]] auto rend() noexcept { return std::make_reverse_iterator(begin()); }
|
||||
[[nodiscard]] auto crbegin() const noexcept { return rbegin(); }
|
||||
[[nodiscard]] auto crend() const noexcept { return rend(); }
|
||||
|
||||
[[nodiscard]] T& operator[](size_t idx) {
|
||||
#ifndef NDEBUG
|
||||
|
@ -608,16 +506,12 @@ public:
|
|||
[[nodiscard]] const_iterator cbegin() const noexcept { return begin(); }
|
||||
[[nodiscard]] const_iterator cend() const noexcept { return end(); }
|
||||
|
||||
[[nodiscard]] const_reverse_iterator rbegin() const noexcept {
|
||||
return const_reverse_iterator(std::addressof(_value(x0_size - 1)));
|
||||
}
|
||||
[[nodiscard]] const_reverse_iterator rend() const noexcept {
|
||||
return const_reverse_iterator(std::addressof(_value(-1)));
|
||||
}
|
||||
[[nodiscard]] reverse_iterator rbegin() noexcept { return reverse_iterator(std::addressof(_value(x0_size - 1))); }
|
||||
[[nodiscard]] reverse_iterator rend() noexcept { return reverse_iterator(std::addressof(_value(-1))); }
|
||||
[[nodiscard]] const_reverse_iterator crbegin() const noexcept { return rbegin(); }
|
||||
[[nodiscard]] const_reverse_iterator crend() const noexcept { return rend(); }
|
||||
[[nodiscard]] auto rbegin() const noexcept { return std::make_reverse_iterator(end()); }
|
||||
[[nodiscard]] auto rend() const noexcept { return std::make_reverse_iterator(begin()); }
|
||||
[[nodiscard]] auto rbegin() noexcept { return std::make_reverse_iterator(end()); }
|
||||
[[nodiscard]] auto rend() noexcept { return std::make_reverse_iterator(begin()); }
|
||||
[[nodiscard]] auto crbegin() const noexcept { return rbegin(); }
|
||||
[[nodiscard]] auto crend() const noexcept { return rend(); }
|
||||
|
||||
[[nodiscard]] T& operator[](size_t idx) { return _value(idx); }
|
||||
[[nodiscard]] const T& operator[](size_t idx) const { return _value(idx); }
|
||||
|
|
|
@ -376,7 +376,7 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
|
|||
if (info.m_hasEnvMap)
|
||||
fmt::print(out, FMT_STRING(",texture2d<float> envMap [[ texture({}) ]]"), nextTex++);
|
||||
if (info.m_hasEnvBumpMap)
|
||||
fmt::print(out, FMT_STRING(",exture2d<float> envBumpMap [[ texture({}) ]]"), nextTex++);
|
||||
fmt::print(out, FMT_STRING(",texture2d<float> envBumpMap [[ texture({}) ]]"), nextTex++);
|
||||
if (info.m_hasLightmap)
|
||||
fmt::print(out, FMT_STRING(",texture2d<float> lightMap [[ texture({}) ]]"), nextTex++);
|
||||
out << '\n';
|
||||
|
|
Loading…
Reference in New Issue