mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 15:04:56 +00:00
CActorContraption fixes, better CMake dependency handling
This commit is contained in:
@@ -188,7 +188,7 @@ void CBooRenderer::ActivateLightsForModel(CAreaListItem* item, CBooModel& model)
|
||||
if (x300_dynamicLights.size()) {
|
||||
u32 lightOctreeWordCount = 0;
|
||||
u32* lightOctreeWords = nullptr;
|
||||
if (item && model.x44_areaInstanceIdx != -1) {
|
||||
if (item && model.x44_areaInstanceIdx != UINT32_MAX) {
|
||||
lightOctreeWordCount = item->x4_octTree->x14_bitmapWordCount;
|
||||
lightOctreeWords = item->x1c_lightOctreeWords.data();
|
||||
}
|
||||
@@ -441,7 +441,6 @@ void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus::
|
||||
zeus::CVector2i vpMax(0, 0);
|
||||
zeus::CVector2i vpMin(g_Viewport.x8_width, g_Viewport.xc_height);
|
||||
|
||||
bool vpInvalid = true;
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
zeus::CVector3f overW;
|
||||
if (i < 8) {
|
||||
@@ -476,7 +475,6 @@ void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus::
|
||||
vpMin.x = std::min(vpMin.x, vpX);
|
||||
vpMax.y = std::max(vpMax.y, vpY);
|
||||
vpMin.y = std::min(vpMin.y, vpY);
|
||||
vpInvalid = false;
|
||||
}
|
||||
|
||||
zeus::CVector2i vpSize = {vpMax.x - vpMin.x, vpMax.y - vpMin.y};
|
||||
@@ -703,7 +701,7 @@ void CBooRenderer::EnablePVS(const CPVSVisSet& set, u32 areaIdx) {
|
||||
xe0_pvsAreaIdx = areaIdx;
|
||||
}
|
||||
|
||||
void CBooRenderer::DisablePVS() { xc8_pvs = rstl::nullopt; }
|
||||
void CBooRenderer::DisablePVS() { xc8_pvs = std::nullopt; }
|
||||
|
||||
void CBooRenderer::UpdateAreaUniforms(int areaIdx, bool shadowRender, bool activateLights, int cubeFace) {
|
||||
SetupRendererStates();
|
||||
@@ -1223,7 +1221,7 @@ void CBooRenderer::FindOverlappingWorldModels(std::vector<u32>& modelBits, const
|
||||
item.x4_octTree->FindOverlappingModels(modelBits.data() + curWord, aabb);
|
||||
|
||||
u32 wordModel = 0;
|
||||
for (int i = 0; i < item.x4_octTree->x14_bitmapWordCount; ++i, wordModel += 32) {
|
||||
for (u32 i = 0; i < item.x4_octTree->x14_bitmapWordCount; ++i, wordModel += 32) {
|
||||
u32& word = modelBits[curWord + i];
|
||||
if (!word)
|
||||
continue;
|
||||
@@ -1254,7 +1252,7 @@ int CBooRenderer::DrawOverlappingWorldModelIDs(int alphaVal, const std::vector<u
|
||||
continue;
|
||||
|
||||
u32 wordModel = 0;
|
||||
for (int i = 0; i < item.x4_octTree->x14_bitmapWordCount; ++i, wordModel += 32) {
|
||||
for (u32 i = 0; i < item.x4_octTree->x14_bitmapWordCount; ++i, wordModel += 32) {
|
||||
const u32& word = modelBits[curWord + i];
|
||||
if (!word)
|
||||
continue;
|
||||
@@ -1292,7 +1290,7 @@ void CBooRenderer::DrawOverlappingWorldModelShadows(int alphaVal, const std::vec
|
||||
continue;
|
||||
|
||||
u32 wordModel = 0;
|
||||
for (int i = 0; i < item.x4_octTree->x14_bitmapWordCount; ++i, wordModel += 32) {
|
||||
for (u32 i = 0; i < item.x4_octTree->x14_bitmapWordCount; ++i, wordModel += 32) {
|
||||
const u32& word = modelBits[curWord + i];
|
||||
if (!word)
|
||||
continue;
|
||||
|
||||
@@ -100,7 +100,7 @@ class CBooRenderer final : public IRenderer {
|
||||
zeus::CPlane xb0_viewPlane = {0.f, 1.f, 0.f, 0.f};
|
||||
|
||||
enum class EPVSMode { Mask, PVS, PVSAndMask } xc4_pvsMode = EPVSMode::Mask;
|
||||
rstl::optional<CPVSVisSet> xc8_pvs;
|
||||
std::optional<CPVSVisSet> xc8_pvs;
|
||||
u32 xe0_pvsAreaIdx = 0;
|
||||
|
||||
// boo::ITextureS* xe4_blackTex = nullptr;
|
||||
@@ -142,8 +142,8 @@ class CBooRenderer final : public IRenderer {
|
||||
zeus::CColor x2f4_thermColor;
|
||||
float x2f8_thermColdScale = 0.f;
|
||||
zeus::CColor x2fc_tevReg1Color = {1.f, 0.f, 1.f, 1.f};
|
||||
rstl::optional<CThermalColdFilter> m_thermColdFilter;
|
||||
rstl::optional<CThermalHotFilter> m_thermHotFilter;
|
||||
std::optional<CThermalColdFilter> m_thermColdFilter;
|
||||
std::optional<CThermalHotFilter> m_thermHotFilter;
|
||||
|
||||
std::vector<CLight> x300_dynamicLights;
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ struct SShader {
|
||||
std::unordered_map<CAssetId, TCachedToken<CTexture>> x0_textures;
|
||||
std::unordered_map<int, CModelShaders::ShaderPipelines> m_shaders;
|
||||
MaterialSet m_matSet;
|
||||
rstl::optional<GeometryUniformLayout> m_geomLayout;
|
||||
std::optional<GeometryUniformLayout> m_geomLayout;
|
||||
int m_matSetIdx;
|
||||
SShader(int idx) : m_matSetIdx(idx) {
|
||||
x0_textures.clear();
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
private:
|
||||
CBooModel* m_next = nullptr;
|
||||
CBooModel* m_prev = nullptr;
|
||||
int m_uniUpdateCount = 0;
|
||||
size_t m_uniUpdateCount = 0;
|
||||
TToken<CModel> m_modelTok;
|
||||
CModel* m_model;
|
||||
std::vector<CBooSurface>* x0_surfaces;
|
||||
@@ -143,7 +143,7 @@ private:
|
||||
bool x40_24_texturesLoaded : 1;
|
||||
bool x40_25_modelVisible : 1;
|
||||
u8 x41_mask;
|
||||
u32 x44_areaInstanceIdx = -1;
|
||||
u32 x44_areaInstanceIdx = UINT32_MAX;
|
||||
|
||||
struct UVAnimationBuffer {
|
||||
static void ProcessAnimation(u8*& bufOut, const MaterialSet::Material::PASS& anim);
|
||||
|
||||
@@ -785,7 +785,7 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet
|
||||
return;
|
||||
}
|
||||
|
||||
rstl::optional<std::array<zeus::CMatrix4f, 2>> specialMtxOut;
|
||||
std::optional<std::array<zeus::CMatrix4f, 2>> specialMtxOut;
|
||||
if (flags.m_extendedShader == EExtendedShader::Thermal) {
|
||||
/* Special Mode0 matrix for exclusive Thermal Visor use */
|
||||
specialMtxOut.emplace();
|
||||
|
||||
@@ -114,7 +114,7 @@ u32 CMoviePlayer::THPAudioDecode(s16* buffer, const u8* audioFrame, bool stereo)
|
||||
s16* bufferCur = buffer + i;
|
||||
int16_t prev1 = header.channelPrevs[i][0];
|
||||
int16_t prev2 = header.channelPrevs[i][1];
|
||||
for (int f = 0; f < (header.numSamples + 13) / 14; ++f) {
|
||||
for (u32 f = 0; f < (header.numSamples + 13) / 14; ++f) {
|
||||
DSPDecompressFrameStereoStride(bufferCur, audioFrame, header.channelCoefs[i], &prev1, &prev2, samples);
|
||||
samples -= 14;
|
||||
bufferCur += 28;
|
||||
@@ -126,7 +126,7 @@ u32 CMoviePlayer::THPAudioDecode(s16* buffer, const u8* audioFrame, bool stereo)
|
||||
s16* bufferCur = buffer;
|
||||
int16_t prev1 = header.channelPrevs[0][0];
|
||||
int16_t prev2 = header.channelPrevs[0][1];
|
||||
for (int f = 0; f < (header.numSamples + 13) / 14; ++f) {
|
||||
for (u32 f = 0; f < (header.numSamples + 13) / 14; ++f) {
|
||||
DSPDecompressFrameStereoDupe(bufferCur, audioFrame, header.channelCoefs[0], &prev1, &prev2, samples);
|
||||
samples -= 14;
|
||||
bufferCur += 28;
|
||||
@@ -154,7 +154,7 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
||||
cur += 20;
|
||||
x58_thpComponents.swapBig();
|
||||
|
||||
for (int i = 0; i < x58_thpComponents.numComponents; ++i) {
|
||||
for (u32 i = 0; i < x58_thpComponents.numComponents; ++i) {
|
||||
switch (x58_thpComponents.comps[i]) {
|
||||
case THPComponents::Type::Video:
|
||||
SyncSeekRead(buf, 32, ESeekOrigin::Begin, cur);
|
||||
@@ -277,7 +277,7 @@ void CMoviePlayer::SetSfxVolume(u8 volume) { SfxVolume = std::min(volume, u8(127
|
||||
|
||||
void CMoviePlayer::MixAudio(s16* out, const s16* in, u32 samples) {
|
||||
/* No audio frames ready */
|
||||
if (xd4_audioSlot == -1) {
|
||||
if (xd4_audioSlot == UINT32_MAX) {
|
||||
if (in)
|
||||
memmove(out, in, samples * 4);
|
||||
else
|
||||
@@ -404,7 +404,7 @@ void CMoviePlayer::SetFrame(const zeus::CVector3f& a, const zeus::CVector3f& b,
|
||||
}
|
||||
|
||||
void CMoviePlayer::DrawFrame() {
|
||||
if (xd0_drawTexSlot == -1)
|
||||
if (xd0_drawTexSlot == UINT32_MAX)
|
||||
return;
|
||||
|
||||
/* draw appropriate field */
|
||||
@@ -458,7 +458,7 @@ void CMoviePlayer::Update(float dt) {
|
||||
if (xd8_decodedTexCount < 2) {
|
||||
if (xe0_playMode == EPlayMode::Playing && xc4_requestFrameWrapped < xf0_preLoadFrames) {
|
||||
u32 minFrame = std::min(u32(xa0_bufferQueue.size()) - 1, xc4_requestFrameWrapped);
|
||||
if (minFrame == -1)
|
||||
if (minFrame == UINT32_MAX)
|
||||
return;
|
||||
std::unique_ptr<uint8_t[]>& frameData = xa0_bufferQueue[minFrame];
|
||||
DecodeFromRead(frameData.get());
|
||||
@@ -489,7 +489,7 @@ void CMoviePlayer::Update(float dt) {
|
||||
++xd0_drawTexSlot;
|
||||
if (xd0_drawTexSlot >= x80_textures.size())
|
||||
xd0_drawTexSlot = 0;
|
||||
if (xd4_audioSlot == -1)
|
||||
if (xd4_audioSlot == UINT32_MAX)
|
||||
xd4_audioSlot = 0;
|
||||
--xd8_decodedTexCount;
|
||||
++xc8_curFrame;
|
||||
@@ -514,7 +514,7 @@ void CMoviePlayer::DecodeFromRead(const void* data) {
|
||||
frameHeader.swapBig();
|
||||
inptr += 8 + x58_thpComponents.numComponents * 4;
|
||||
|
||||
for (int i = 0; i < x58_thpComponents.numComponents; ++i) {
|
||||
for (u32 i = 0; i < x58_thpComponents.numComponents; ++i) {
|
||||
switch (x58_thpComponents.comps[i]) {
|
||||
case THPComponents::Type::Video: {
|
||||
tjDecompressToYUV(TjHandle, (u8*)inptr, frameHeader.imageSize, m_yuvBuf.get(), 0);
|
||||
|
||||
@@ -11,7 +11,7 @@ CPVSAreaSet::CPVSAreaSet(const u8* data, u32 len) {
|
||||
x10_leafSize = r.readUint32Big();
|
||||
x14_lightIndexCount = r.readUint32Big();
|
||||
x18_entityIndex.reserve(xc_numActors);
|
||||
for (int i = 0; i < xc_numActors; ++i)
|
||||
for (u32 i = 0; i < xc_numActors; ++i)
|
||||
x18_entityIndex.push_back(r.readUint32Big());
|
||||
x1c_lightLeaves = data + r.position();
|
||||
const u8* octreeData = x1c_lightLeaves + x14_lightIndexCount * x10_leafSize;
|
||||
|
||||
@@ -15,7 +15,7 @@ CRainSplashGenerator::CRainSplashGenerator(const zeus::CVector3f& scale, u32 max
|
||||
x48_25_raining = true;
|
||||
x0_rainSplashes.reserve(maxSplashes);
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
for (int i = 0; i < maxSplashes; ++i)
|
||||
for (u32 i = 0; i < maxSplashes; ++i)
|
||||
x0_rainSplashes.emplace_back(ctx);
|
||||
return true;
|
||||
} BooTrace);
|
||||
@@ -47,16 +47,16 @@ void CRainSplashGenerator::DoDraw(const zeus::CTransform& xf) const {
|
||||
CGraphics::SetModelMatrix(xf);
|
||||
if (x40_queueSize > 0) {
|
||||
if (x38_queueTail <= x3c_queueHead) {
|
||||
for (int i = x3c_queueHead; i < x0_rainSplashes.size(); ++i) {
|
||||
for (size_t i = x3c_queueHead; i < x0_rainSplashes.size(); ++i) {
|
||||
const SRainSplash& splash = x0_rainSplashes[i];
|
||||
splash.Draw(x30_alpha, x28_dt, splash.x64_pos);
|
||||
}
|
||||
for (int i = 0; i < x38_queueTail; ++i) {
|
||||
for (size_t i = 0; i < x38_queueTail; ++i) {
|
||||
const SRainSplash& splash = x0_rainSplashes[i];
|
||||
splash.Draw(x30_alpha, x28_dt, splash.x64_pos);
|
||||
}
|
||||
} else {
|
||||
for (int i = x3c_queueHead; i < x38_queueTail; ++i) {
|
||||
for (size_t i = x3c_queueHead; i < x38_queueTail; ++i) {
|
||||
const SRainSplash& splash = x0_rainSplashes[i];
|
||||
splash.Draw(x30_alpha, x28_dt, splash.x64_pos);
|
||||
}
|
||||
@@ -181,7 +181,7 @@ void CRainSplashGenerator::GeneratePoints(const std::vector<std::pair<zeus::CVec
|
||||
return;
|
||||
|
||||
if (x20_generateTimer > x24_generateInterval) {
|
||||
for (int i = 0; i < x44_genRate; ++i) {
|
||||
for (u32 i = 0; i < x44_genRate; ++i) {
|
||||
if (x40_queueSize >= x0_rainSplashes.size())
|
||||
break;
|
||||
x34_curPoint = GetNextBestPt(x34_curPoint, vn, x10_random, x2c_minZ);
|
||||
|
||||
@@ -18,7 +18,7 @@ class CSimpleShadow {
|
||||
bool x48_24_collision : 1;
|
||||
bool x48_25_alwaysCalculateRadius : 1;
|
||||
bool x48_26_radiusCalculated : 1;
|
||||
mutable rstl::optional<CTexturedQuadFilter> m_filter;
|
||||
mutable std::optional<CTexturedQuadFilter> m_filter;
|
||||
|
||||
public:
|
||||
CSimpleShadow(float scale, float userAlpha, float maxObjHeight, float displacement);
|
||||
|
||||
@@ -23,7 +23,7 @@ CSkinnedModel::CSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinR
|
||||
store.GetObj(SObjectTag{FOURCC('CINF'), layoutInfo}), shaderIdx, drawInsts) {}
|
||||
|
||||
void CSkinnedModel::Calculate(const CPoseAsTransforms& pose, const CModelFlags& drawFlags,
|
||||
const rstl::optional<CVertexMorphEffect>& morphEffect,
|
||||
const std::optional<CVertexMorphEffect>& morphEffect,
|
||||
const float* morphMagnitudes) {
|
||||
if (morphEffect || g_PointGenFunc) {
|
||||
if (boo::ObjToken<boo::IGraphicsBufferD> vertBuf = m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr)) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "CToken.hpp"
|
||||
#include "CModel.hpp"
|
||||
#include "optional.hpp"
|
||||
#include <optional>
|
||||
|
||||
namespace urde {
|
||||
class CModel;
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
const TLockedToken<CCharLayoutInfo>& GetLayoutInfo() const { return x1c_layoutInfo; }
|
||||
|
||||
void Calculate(const CPoseAsTransforms& pose, const CModelFlags& drawFlags,
|
||||
const rstl::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes);
|
||||
const std::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes);
|
||||
void Draw(const CModelFlags& drawFlags) const;
|
||||
|
||||
typedef void (*FPointGenerator)(void* item, const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn);
|
||||
|
||||
@@ -818,7 +818,7 @@ std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f
|
||||
const RGBA8* paletteTexels = reinterpret_cast<const RGBA8*>(data + 4);
|
||||
const u8* sourceMip = data + 4 + nentries * 4;
|
||||
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
for (u32 i = 0; i < 256; ++i) {
|
||||
u16& color = paletteColors[i];
|
||||
if (i >= nentries) {
|
||||
color = 0;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "hecl/Runtime.hpp"
|
||||
#include "hecl/Backend.hpp"
|
||||
#include "optional.hpp"
|
||||
#include <optional>
|
||||
#include "zeus/CVector3f.hpp"
|
||||
#include "zeus/CColor.hpp"
|
||||
#include "Graphics/CGraphics.hpp"
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace urde {
|
||||
|
||||
class CWorldShadowShader {
|
||||
boo::ObjToken<boo::ITextureR> m_tex;
|
||||
rstl::optional<CTexturedQuadFilter> m_prevQuad;
|
||||
std::optional<CTexturedQuadFilter> m_prevQuad;
|
||||
u32 m_w, m_h;
|
||||
|
||||
struct Uniform {
|
||||
|
||||
Reference in New Issue
Block a user