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:
@@ -101,8 +101,8 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"
|
||||
"\n"
|
||||
"# Clear Scene\n"
|
||||
"if 'Collection 1' in bpy.data.collections:\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
|
||||
"if len(bpy.data.collections):\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections[0])\n"
|
||||
"\n"
|
||||
"actor_data = bpy.context.scene.hecl_sact_data\n"
|
||||
"arm_obj = None\n",
|
||||
|
||||
@@ -59,7 +59,7 @@ bool AROTBuilder::Node::compareSets(int a, int b) const {
|
||||
void AROTBuilder::Node::addChild(int level, int minChildren, const std::vector<zeus::CAABox>& triBoxes,
|
||||
const zeus::CAABox& curAABB, BspNodeType& typeOut) {
|
||||
/* Gather intersecting faces */
|
||||
for (int i = 0; i < triBoxes.size(); ++i)
|
||||
for (size_t i = 0; i < triBoxes.size(); ++i)
|
||||
if (triBoxes[i].intersects(curAABB))
|
||||
childIndices.insert(i);
|
||||
|
||||
@@ -343,7 +343,7 @@ void AROTBuilder::build(std::vector<std::vector<uint8_t>>& secs, const zeus::CAA
|
||||
auto bmpIt = bmp.cbegin();
|
||||
if (bmpIt != bmp.cend()) {
|
||||
int curIdx = 0;
|
||||
for (int w = 0; w < bmpWordCount; ++w) {
|
||||
for (size_t w = 0; w < bmpWordCount; ++w) {
|
||||
for (int b = 0; b < 32; ++b) {
|
||||
if (*bmpIt == curIdx) {
|
||||
bmpWords[w] |= 1 << b;
|
||||
|
||||
@@ -75,7 +75,7 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
|
||||
"lamp_obj.location = (%f,%f,%f)\n"
|
||||
"bpy.context.scene.collection.objects.link(lamp_obj)\n"
|
||||
"\n",
|
||||
s, light.lightType, light.q / 8.f, light.color.simd[0], light.color.simd[1], light.color.simd[2],
|
||||
s, unsigned(light.lightType), light.q / 8.f, light.color.simd[0], light.color.simd[1], light.color.simd[2],
|
||||
light.position.simd[0], light.position.simd[1], light.position.simd[2]);
|
||||
|
||||
switch (light.falloff) {
|
||||
|
||||
@@ -377,8 +377,8 @@ void InitGeomBlenderContext(hecl::blender::PyOutStream& os, const hecl::ProjectP
|
||||
"from mathutils import Vector\n"
|
||||
"\n"
|
||||
"# Clear Scene\n"
|
||||
"if 'Collection 1' in bpy.data.collections:\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
|
||||
"if len(bpy.data.collections):\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections[0])\n"
|
||||
"\n"
|
||||
"def loop_from_facevert(bm, face, vert_idx):\n"
|
||||
" for loop in face.loops:\n"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
make_dnalist(liblist DNACommon
|
||||
CMDL
|
||||
make_dnalist(CMDL
|
||||
FONT
|
||||
DGRP
|
||||
FSM2
|
||||
@@ -54,4 +53,3 @@ set(DNACOMMON_SOURCES
|
||||
Tweaks/ITweakGuiColors.hpp)
|
||||
|
||||
dataspec_add_list(DNACommon DNACOMMON_SOURCES)
|
||||
list(APPEND DNACOMMON_SOURCES ${liblist})
|
||||
|
||||
@@ -91,7 +91,7 @@ void CRSM<IDType>::_write(athena::io::YAMLDocWriter& w) const {
|
||||
pair.second.write(w);
|
||||
|
||||
for (const auto& pair : x10_sfx)
|
||||
if (pair.second != ~0)
|
||||
if (pair.second != UINT32_MAX)
|
||||
w.writeUint32(pair.first.toString().c_str(), pair.second);
|
||||
|
||||
for (const auto& pair : x20_decals)
|
||||
@@ -115,7 +115,7 @@ void CRSM<IDType>::_binarySize(size_t& __isz) const {
|
||||
}
|
||||
}
|
||||
for (const auto& pair : x10_sfx) {
|
||||
if (pair.second != ~0)
|
||||
if (pair.second != UINT32_MAX)
|
||||
__isz += 12;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ void CRSM<IDType>::_write(athena::io::IStreamWriter& w) const {
|
||||
|
||||
for (const auto& pair : x10_sfx) {
|
||||
w.writeBytes(pair.first.getChars(), 4);
|
||||
if (pair.second != ~0) {
|
||||
if (pair.second != UINT32_MAX) {
|
||||
w.writeBytes("CNST", 4);
|
||||
w.writeUint32Big(pair.second);
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "ParticleCommon.hpp"
|
||||
#include "PAK.hpp"
|
||||
#include "athena/FileWriter.hpp"
|
||||
#include "optional.hpp"
|
||||
#include <optional>
|
||||
|
||||
namespace DataSpec::DNAParticle {
|
||||
template <class IDType>
|
||||
|
||||
@@ -121,8 +121,8 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||
"name='Retro: Map Object Visibility Mode')\n"
|
||||
"\n"
|
||||
"# Clear Scene\n"
|
||||
"if 'Collection 1' in bpy.data.collections:\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
|
||||
"if len(bpy.data.collections):\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections[0])\n"
|
||||
"\n"
|
||||
"def add_triangle(bm, verts):\n"
|
||||
" verts = [bm.verts[vi] for vi in verts]\n"
|
||||
@@ -167,8 +167,9 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||
"obj.location = mtxd[0]\n"
|
||||
"obj.rotation_quaternion = mtxd[1]\n"
|
||||
"obj.scale = mtxd[2]\n",
|
||||
moIdx, moMP12->type, RetroMapObjVisModes[moMP12->visMode], moMP12->sclyId, mtxF[0][0], mtxF[0][1], mtxF[0][2],
|
||||
mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2], mtxF[2][3]);
|
||||
moIdx, int(moMP12->type), RetroMapObjVisModes[moMP12->visMode], moMP12->sclyId, mtxF[0][0], mtxF[0][1],
|
||||
mtxF[0][2], mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2],
|
||||
mtxF[2][3]);
|
||||
++moIdx;
|
||||
continue;
|
||||
} else {
|
||||
@@ -188,8 +189,9 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||
"obj.location = mtxd[0]\n"
|
||||
"obj.rotation_quaternion = mtxd[1]\n"
|
||||
"obj.scale = mtxd[2]\n",
|
||||
moIdx, moMP3->type, RetroMapObjVisModes[moMP3->visMode], moMP3->sclyId, mtxF[0][0], mtxF[0][1], mtxF[0][2],
|
||||
mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2], mtxF[2][3]);
|
||||
moIdx, int(moMP3->type), RetroMapObjVisModes[moMP3->visMode], moMP3->sclyId, mtxF[0][0], mtxF[0][1],
|
||||
mtxF[0][2], mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2],
|
||||
mtxF[2][3]);
|
||||
++moIdx;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn, const MAPU& mapu, const
|
||||
"from mathutils import Matrix\n"
|
||||
"\n"
|
||||
"# Clear Scene\n"
|
||||
"if 'Collection 1' in bpy.data.collections:\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
|
||||
"if len(bpy.data.collections):\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections[0])\n"
|
||||
"\n"
|
||||
"bpy.types.Object.retro_mapworld_color = bpy.props.FloatVectorProperty(name='Retro: MapWorld Color',"
|
||||
" description='Sets map world color', subtype='COLOR', size=4, min=0.0, max=1.0)\n"
|
||||
|
||||
@@ -25,8 +25,8 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, const MLVL& mlvl, const
|
||||
"bpy.context.scene.name = 'World'\n"
|
||||
"\n"
|
||||
"# Clear Scene\n"
|
||||
"if 'Collection 1' in bpy.data.collections:\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n";
|
||||
"if len(bpy.data.collections):\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections[0])\n";
|
||||
|
||||
/* Insert area empties */
|
||||
int areaIdx = 0;
|
||||
|
||||
@@ -17,7 +17,7 @@ struct FittedOBB {
|
||||
static std::vector<int> MakeRootTriangleIndex(const ColMesh& mesh) {
|
||||
std::vector<int> ret;
|
||||
ret.reserve(mesh.trianges.size());
|
||||
for (int i = 0; i < mesh.trianges.size(); ++i)
|
||||
for (size_t i = 0; i < mesh.trianges.size(); ++i)
|
||||
ret.push_back(i);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ hecl::SystemString PAKRouter<BRIDGETYPE>::getResourceRelativePath(const EntryTyp
|
||||
return hecl::SystemString();
|
||||
hecl::ProjectPath aPath = getWorking(&a, BRIDGETYPE::LookupExtractor(*node, *pak, a));
|
||||
hecl::SystemString ret;
|
||||
for (int i = 0; i < aPath.levelCount(); ++i)
|
||||
for (size_t i = 0; i < aPath.levelCount(); ++i)
|
||||
ret += _SYS_STR("../");
|
||||
hecl::ProjectPath bPath = getWorking(be, BRIDGETYPE::LookupExtractor(*node, *pak, *be));
|
||||
ret += bPath.getRelativePath();
|
||||
|
||||
@@ -49,7 +49,7 @@ template <>
|
||||
void VEConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r) {
|
||||
size_t elemCount;
|
||||
if (auto v = r.enterSubVector(nullptr, elemCount)) {
|
||||
for (int i = 0; i < 3 && i < elemCount; ++i) {
|
||||
for (size_t i = 0; i < 3 && i < elemCount; ++i) {
|
||||
if (auto rec = r.enterSubRecord(nullptr))
|
||||
comps[i].read(r);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ RigInverter<CINFType>::Bone::Bone(const CINFType& cinf, const typename CINFType:
|
||||
atUint32 parentIdx = cinf.getInternalBoneIdxFromId(origBone.parentId);
|
||||
zeus::CVector3f boneOrigin(origBone.origin);
|
||||
zeus::CVector3f naturalTail = boneOrigin + zeus::CVector3f{0.f, 0.5f, 0.f};
|
||||
if (parentIdx != -1) {
|
||||
if (parentIdx != UINT32_MAX) {
|
||||
const typename CINFType::Bone& pBone = cinf.bones[parentIdx];
|
||||
m_parentDelta = boneOrigin - zeus::CVector3f(pBone.origin);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ RigInverter<CINFType>::Bone::Bone(const CINFType& cinf, const typename CINFType:
|
||||
if (chId == origBone.parentId)
|
||||
continue;
|
||||
atUint32 chIdx = cinf.getInternalBoneIdxFromId(chId);
|
||||
if (chIdx != -1)
|
||||
if (chIdx != UINT32_MAX)
|
||||
++actualChildren;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ RigInverter<CINFType>::Bone::Bone(const CINFType& cinf, const typename CINFType:
|
||||
if (bName)
|
||||
isLCTR = bName->find("_LCTR") != std::string::npos;
|
||||
|
||||
if (parentIdx == -1) {
|
||||
if (parentIdx == UINT32_MAX) {
|
||||
/* Root will always use +Y tail */
|
||||
m_tail = naturalTail;
|
||||
} else if (actualChildren) {
|
||||
@@ -40,7 +40,7 @@ RigInverter<CINFType>::Bone::Bone(const CINFType& cinf, const typename CINFType:
|
||||
if (chId == origBone.parentId)
|
||||
continue;
|
||||
atUint32 chIdx = cinf.getInternalBoneIdxFromId(chId);
|
||||
if (chIdx != -1) {
|
||||
if (chIdx != UINT32_MAX) {
|
||||
const typename CINFType::Bone& chBone = cinf.bones[chIdx];
|
||||
m_tail += chBone.origin;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ RigInverter<CINFType>::Bone::Bone(const CINFType& cinf, const typename CINFType:
|
||||
m_tail = naturalTail;
|
||||
else if (isLCTR)
|
||||
m_tail = boneOrigin + zeus::CVector3f{0.f, 1.0f, 0.f} * (m_tail - boneOrigin).magnitude();
|
||||
} else if (parentIdx != -1) {
|
||||
} else if (parentIdx != UINT32_MAX) {
|
||||
/* Extrapolate by delta with parent */
|
||||
m_tail = boneOrigin + m_parentDelta;
|
||||
float deltaMag = m_parentDelta.magnitude();
|
||||
@@ -91,8 +91,8 @@ RigInverter<CINFType>::RigInverter(const CINFType& cinf,
|
||||
auto search = matrices.find(*name);
|
||||
if (search != matrices.cend()) {
|
||||
zeus::CMatrix3f boneMtx(search->second[0], search->second[1], search->second[2]);
|
||||
m_bones.back().m_inverter = boneMtx.transposed();
|
||||
m_bones.back().m_restorer = boneMtx;
|
||||
m_bones.back().m_inverter = m_bones.back().m_restorer.inverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ template <class CINFType>
|
||||
zeus::CQuaternion RigInverter<CINFType>::invertRotation(atUint32 boneId, const zeus::CQuaternion& origRot) const {
|
||||
for (const Bone& b : m_bones)
|
||||
if (b.m_origBone.id == boneId)
|
||||
return b.m_restorer * zeus::CMatrix3f(origRot) * b.m_inverter;
|
||||
return b.m_restorer * origRot * b.m_inverter;
|
||||
return origRot;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ zeus::CVector3f RigInverter<CINFType>::invertPosition(atUint32 boneId, const zeu
|
||||
zeus::CVector3f localPos = origPos;
|
||||
if (subDelta)
|
||||
localPos -= b.m_parentDelta;
|
||||
return b.m_restorer * localPos;
|
||||
return b.m_restorer.transform(localPos);
|
||||
}
|
||||
return origPos;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ template <class CINFType>
|
||||
zeus::CQuaternion RigInverter<CINFType>::restoreRotation(atUint32 boneId, const zeus::CQuaternion& origRot) const {
|
||||
for (const Bone& b : m_bones)
|
||||
if (b.m_origBone.id == boneId)
|
||||
return b.m_inverter * zeus::CMatrix3f(origRot) * b.m_restorer;
|
||||
return b.m_inverter * origRot * b.m_restorer;
|
||||
return origRot;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ zeus::CVector3f RigInverter<CINFType>::restorePosition(atUint32 boneId, const ze
|
||||
bool subDelta) const {
|
||||
for (const Bone& b : m_bones)
|
||||
if (b.m_origBone.id == boneId) {
|
||||
zeus::CVector3f localPos = b.m_inverter * origPos;
|
||||
zeus::CVector3f localPos = b.m_inverter.transform(origPos);
|
||||
if (subDelta)
|
||||
localPos += b.m_parentDelta;
|
||||
return localPos;
|
||||
|
||||
@@ -15,8 +15,8 @@ class RigInverter {
|
||||
public:
|
||||
struct Bone {
|
||||
const typename CINFType::Bone& m_origBone;
|
||||
zeus::CMatrix3f m_inverter;
|
||||
zeus::CMatrix3f m_restorer;
|
||||
zeus::CQuaternion m_inverter;
|
||||
zeus::CQuaternion m_restorer;
|
||||
zeus::CVector3f m_tail;
|
||||
zeus::CVector3f m_parentDelta;
|
||||
Bone(const CINFType& cinf, const typename CINFType::Bone& origBone);
|
||||
|
||||
@@ -1148,7 +1148,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
||||
bool doDXT1 = (colorType == PNG_COLOR_TYPE_RGB || colorType == PNG_COLOR_TYPE_RGB_ALPHA) && width >= 4 && height >= 4;
|
||||
|
||||
/* Read into mip0 image buffer */
|
||||
for (int r = 0; r < height; ++r) {
|
||||
for (png_uint_32 r = 0; r < height; ++r) {
|
||||
if (colorType == PNG_COLOR_TYPE_RGB) {
|
||||
png_read_row(pngRead, rowBuf.get(), nullptr);
|
||||
for (unsigned i = 0; i < width; ++i) {
|
||||
@@ -1175,7 +1175,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
||||
fclose(inf);
|
||||
|
||||
/* Reduce mipmaps to minimum allowed dimensions */
|
||||
int minDimX, minDimY;
|
||||
unsigned minDimX, minDimY;
|
||||
if (doDXT1) {
|
||||
minDimX = minDimY = 4;
|
||||
} else {
|
||||
@@ -1601,7 +1601,7 @@ static const atInt32 RetroToDol[11] {
|
||||
|
||||
std::string TXTR::CalculateDolphinName(DataSpec::PAKEntryReadStream& rs) {
|
||||
atUint32 format = RetroToDol[rs.readUint32Big()];
|
||||
if (format == -1)
|
||||
if (format == UINT32_MAX)
|
||||
return {};
|
||||
|
||||
atUint16 width = rs.readUint16Big();
|
||||
|
||||
@@ -205,7 +205,7 @@ void WPSM<IDType>::_write(athena::io::YAMLDocWriter& w) const {
|
||||
if (!xa6_SWTR)
|
||||
if (auto rec = w.enterSubRecord("SWTR"))
|
||||
xa6_SWTR.write(w);
|
||||
if (xa8_PJFX != ~0)
|
||||
if (xa8_PJFX != UINT32_MAX)
|
||||
w.writeUint32("PJFX", xa8_PJFX);
|
||||
if (xac_RNGE)
|
||||
if (auto rec = w.enterSubRecord("RNGE"))
|
||||
@@ -339,7 +339,7 @@ void WPSM<IDType>::_binarySize(size_t& __isz) const {
|
||||
__isz += 4;
|
||||
xa6_SWTR.binarySize(__isz);
|
||||
}
|
||||
if (xa8_PJFX != ~0)
|
||||
if (xa8_PJFX != UINT32_MAX)
|
||||
__isz += 12;
|
||||
if (xac_RNGE) {
|
||||
__isz += 4;
|
||||
@@ -606,7 +606,7 @@ void WPSM<IDType>::_write(athena::io::IStreamWriter& w) const {
|
||||
w.writeBytes("SWTR", 4);
|
||||
xa6_SWTR.write(w);
|
||||
}
|
||||
if (xa8_PJFX != ~0) {
|
||||
if (xa8_PJFX != UINT32_MAX) {
|
||||
w.writeBytes("PJFXCNST", 8);
|
||||
w.writeUint32(xa8_PJFX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user