mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 13:44:56 +00:00
CActorContraption fixes, better CMake dependency handling
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
include_directories(${LIBPNG_INCLUDE_DIR} ${SQUISH_INCLUDE_DIR})
|
||||
|
||||
# Assembles a source/header pair list for use in a DNA library
|
||||
macro(make_dnalist outlist subdir)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
|
||||
macro(make_dnalist)
|
||||
file(RELATIVE_PATH subdir "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}")
|
||||
set(CMAKE_CURRENT_LIST_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}")
|
||||
foreach(type ${ARGN})
|
||||
get_filename_component(dir ${type} DIRECTORY)
|
||||
if(dir)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${subdir}/${dir}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}/${dir}")
|
||||
set(dir "${dir}/")
|
||||
endif()
|
||||
get_filename_component(name ${type} NAME)
|
||||
atdna("${subdir}/${dir}atdna_${name}.cpp" "${subdir}/${dir}${name}.hpp")
|
||||
list(APPEND ${outlist}
|
||||
${subdir}/${dir}atdna_${name}.cpp
|
||||
${subdir}/${dir}${name}.hpp)
|
||||
list(APPEND DNA_SOURCES "${subdir}/${dir}atdna_${name}.cpp")
|
||||
list(APPEND DNA_HEADERS "${subdir}/${dir}${name}.hpp")
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
@@ -30,9 +28,9 @@ macro(dataspec_add_list rel_path a_list)
|
||||
set(${a_list} "${tmp_list}")
|
||||
endmacro(dataspec_add_list)
|
||||
|
||||
include_directories(${ZLIB_INCLUDE_DIR} ${LZOKAY_INCLUDE_DIR})
|
||||
|
||||
# Each game's DNA library
|
||||
unset(DNA_SOURCES)
|
||||
unset(DNA_HEADERS)
|
||||
include(DNACommon/CMakeLists.txt)
|
||||
include(DNAMP1/CMakeLists.txt)
|
||||
include(DNAMP2/CMakeLists.txt)
|
||||
@@ -70,10 +68,22 @@ add_library(RetroDataSpec
|
||||
AssetNameMap32.bin AssetNameMap32.cpp
|
||||
AssetNameMap64.bin AssetNameMap64.cpp
|
||||
RetroMasterShader.cpp)
|
||||
|
||||
get_target_property(HECL_INCLUDES hecl-full INCLUDE_DIRECTORIES)
|
||||
target_include_directories(RetroDataSpec PUBLIC ${LIBPNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
|
||||
${HECL_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR})
|
||||
target_link_libraries(RetroDataSpec PUBLIC amuse zeus nod specter squish ${PNG_LIB} ${ZLIB_LIBRARIES} lzokay logvisor)
|
||||
if(COMMAND add_sanitizers)
|
||||
add_sanitizers(RetroDataSpec)
|
||||
endif()
|
||||
if(COMMAND cotire)
|
||||
set_target_properties(RetroDataSpec PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
||||
cotire(RetroDataSpec)
|
||||
endif()
|
||||
|
||||
# Resolve all DNA sources into target
|
||||
list(LENGTH DNA_SOURCES count)
|
||||
math(EXPR count "${count}-1")
|
||||
foreach(i RANGE ${count})
|
||||
list(GET DNA_SOURCES ${i} src)
|
||||
list(GET DNA_HEADERS ${i} header)
|
||||
target_atdna(RetroDataSpec ${src} ${header})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "$<TARGET_PROPERTY:RetroDataSpec,INCLUDE_DIRECTORIES>")
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1376,8 +1376,8 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
||||
|
||||
/* Build bone ID map */
|
||||
std::unordered_map<std::string, atInt32> boneIdMap;
|
||||
std::experimental::optional<CINF> rigCinf;
|
||||
std::experimental::optional<DNAANIM::RigInverter<CINF>> rigInv;
|
||||
std::optional<CINF> rigCinf;
|
||||
std::optional<DNAANIM::RigInverter<CINF>> rigInv;
|
||||
for (const DNAANCS::Armature& arm : actor.armatures) {
|
||||
if (!rigInv) {
|
||||
rigCinf.emplace(arm, boneIdMap);
|
||||
|
||||
@@ -256,7 +256,7 @@ template <class MAT>
|
||||
static uint32_t _HashTextureConfig(const MAT& mat) {
|
||||
XXH32_state_t xxHash;
|
||||
XXH32_reset(&xxHash, 0);
|
||||
for (int i = 0; i < mat.tevStageCount; ++i) {
|
||||
for (uint32_t i = 0; i < mat.tevStageCount; ++i) {
|
||||
const auto& stage = mat.tevStages[i];
|
||||
XXH32_update(&xxHash, &stage.ciFlags, sizeof(stage.ciFlags));
|
||||
XXH32_update(&xxHash, &stage.aiFlags, sizeof(stage.aiFlags));
|
||||
@@ -352,7 +352,7 @@ static const char* ToString(GX::TevRegID arg) {
|
||||
|
||||
template <class MAT>
|
||||
static void _DescribeTEV(const MAT& mat) {
|
||||
for (int i = 0; i < mat.tevStageCount; ++i) {
|
||||
for (uint32_t i = 0; i < mat.tevStageCount; ++i) {
|
||||
const auto& stage = mat.tevStages[i];
|
||||
fprintf(stderr, "A:%s B:%s C:%s D:%s -> %s | A:%s B:%s C:%s D:%s -> %s\n",
|
||||
ToString(stage.colorInA()), ToString(stage.colorInB()),
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
include(DNAMP1/ScriptObjects/CMakeLists.txt)
|
||||
include(DNAMP1/SFX/CMakeLists.txt)
|
||||
|
||||
make_dnalist(liblist DNAMP1
|
||||
PAK
|
||||
make_dnalist(PAK
|
||||
MLVL
|
||||
AGSC
|
||||
CSNG
|
||||
@@ -68,4 +67,3 @@ set(DNAMP1_SOURCES
|
||||
Tweaks/CTweakGame.cpp)
|
||||
|
||||
dataspec_add_list(DNAMP1 DNAMP1_SOURCES)
|
||||
list(APPEND DNAMP1_SOURCES ${liblist})
|
||||
|
||||
@@ -39,11 +39,11 @@ bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
||||
hecl::ProjectPath audGrp(outPath.getParentPath().getParentPath(), _SYS_STR("AudioGrp"));
|
||||
audGrp.makeDirChain(true);
|
||||
hecl::ProjectPath songsPath(audGrp, _SYS_STR("!songs.yaml"));
|
||||
std::experimental::optional<athena::io::FileReader> r;
|
||||
std::optional<athena::io::FileReader> r;
|
||||
if (songsPath.isFile())
|
||||
r.emplace(songsPath.getAbsolutePath());
|
||||
athena::io::YAMLDocWriter ydw("amuse::Songs", r ? &*r : nullptr);
|
||||
r = std::experimental::nullopt;
|
||||
r = std::nullopt;
|
||||
char id[16];
|
||||
snprintf(id, 16, "%04X", head.midiSetupId);
|
||||
ydw.writeString(id, hecl::Format("../MidiData/%s", midPath.getLastComponentUTF8().data()));
|
||||
|
||||
@@ -37,8 +37,8 @@ void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
|
||||
"\n"
|
||||
"bpy.context.scene.name = '%s'\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",
|
||||
entryName.data());
|
||||
|
||||
DeafBabe::BlenderInit(os);
|
||||
|
||||
@@ -292,8 +292,8 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||
os << "import bpy, math, bmesh\n"
|
||||
"from mathutils import Matrix, Quaternion\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 duplicateObject(copy_obj):\n"
|
||||
" # Create new mesh\n"
|
||||
@@ -438,7 +438,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||
"verts = []\n",
|
||||
w.header.name.c_str());
|
||||
|
||||
for (int i = 0; i < info->quadCoordCount; ++i) {
|
||||
for (uint32_t i = 0; i < info->quadCoordCount; ++i) {
|
||||
int ti;
|
||||
if (i == 2)
|
||||
ti = 3;
|
||||
@@ -452,7 +452,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||
os << "bm.faces.new(verts)\n"
|
||||
"bm.loops.layers.uv.new('UV')\n"
|
||||
"bm.verts.ensure_lookup_table()\n";
|
||||
for (int i = 0; i < info->uvCoordCount; ++i) {
|
||||
for (uint32_t i = 0; i < info->uvCoordCount; ++i) {
|
||||
int ti;
|
||||
if (i == 2)
|
||||
ti = 3;
|
||||
|
||||
@@ -202,7 +202,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||
areaOut.docks.emplace_back();
|
||||
MLVL::Area::Dock& dockOut = areaOut.docks.back();
|
||||
|
||||
if (dock.targetArea != -1 && dock.targetDock != -1) {
|
||||
if (dock.targetArea != UINT32_MAX && dock.targetDock != UINT32_MAX) {
|
||||
dockOut.endpointCount = 1;
|
||||
dockOut.endpoints.emplace_back();
|
||||
MLVL::Area::Dock::Endpoint& ep = dockOut.endpoints.back();
|
||||
|
||||
@@ -207,8 +207,8 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
|
||||
MaterialSet::RegisterMaterialProps(os);
|
||||
os << "# 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.Light.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
|
||||
"bpy.types.Light.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n"
|
||||
@@ -296,7 +296,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||
rs.seek(18, athena::Current);
|
||||
uint32_t entityCount = rs.readUint32Big();
|
||||
rs.seek(8, athena::Current);
|
||||
for (int i = 0; i < entityCount; ++i) {
|
||||
for (uint32_t i = 0; i < entityCount; ++i) {
|
||||
uint32_t entityId = rs.readUint32Big();
|
||||
visiWriter.writeUint32(nullptr, entityId);
|
||||
}
|
||||
@@ -584,7 +584,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||
athena::io::MemoryWriter w(secs.back().data(), secs.back().size());
|
||||
w.writeUint32Big(0xBABEDEAD);
|
||||
|
||||
for (int lay = 0; lay < 2; ++lay) {
|
||||
for (uint32_t lay = 0; lay < 2; ++lay) {
|
||||
int lightCount = 0;
|
||||
for (const Light& l : lights) {
|
||||
if (l.layer == lay)
|
||||
|
||||
@@ -71,8 +71,8 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
|
||||
"\n"
|
||||
"bpy.context.scene.name = '%s'\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"
|
||||
"bm = bmesh.new()\n"
|
||||
"height_lay = bm.faces.layers.float.new('Height')\n",
|
||||
@@ -87,7 +87,7 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
|
||||
|
||||
for (const Region& r : regions) {
|
||||
os << "tri_verts = []\n";
|
||||
for (int i = 0; i < r.nodeCount; ++i)
|
||||
for (atUint32 i = 0; i < r.nodeCount; ++i)
|
||||
os.format("tri_verts.append(bm.verts[%u])\n", r.nodeStart + i);
|
||||
|
||||
os.format(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
make_dnalist(liblist DNAMP1/ScriptObjects
|
||||
make_dnalist(
|
||||
IScriptObject
|
||||
Parameters
|
||||
Actor
|
||||
@@ -141,4 +141,3 @@ set(ScriptObjectsMP1_SOURCES
|
||||
WorldTeleporter.cpp)
|
||||
|
||||
dataspec_add_list(DNAMP1/ScriptObjects ScriptObjectsMP1_SOURCES)
|
||||
list(APPEND ScriptObjectsMP1_SOURCES ${liblist})
|
||||
|
||||
@@ -303,7 +303,7 @@ struct CTweakGui final : ITweakGui {
|
||||
float GetHudLightAttMulQuadratic() const { return x2c0_hudLightAttMulQuadratic; }
|
||||
|
||||
float GetScanSpeed(int idx) const {
|
||||
if (idx < 0 || idx >= x2c4_scanSpeeds.size())
|
||||
if (idx < 0 || size_t(idx) >= x2c4_scanSpeeds.size())
|
||||
return 0.f;
|
||||
return x2c4_scanSpeeds[idx];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
make_dnalist(liblist DNAMP2
|
||||
MLVL
|
||||
make_dnalist(MLVL
|
||||
ANIM
|
||||
AGSC
|
||||
ANCS
|
||||
@@ -28,4 +27,3 @@ set(DNAMP2_SOURCES
|
||||
STRG.hpp STRG.cpp)
|
||||
|
||||
dataspec_add_list(DNAMP2 DNAMP2_SOURCES)
|
||||
list(APPEND DNAMP2_SOURCES ${liblist})
|
||||
|
||||
@@ -200,8 +200,8 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
|
||||
MaterialSet::RegisterMaterialProps(os);
|
||||
os << "# 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.Light.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
|
||||
"bpy.types.Light.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
make_dnalist(liblist DNAMP3
|
||||
PAK
|
||||
make_dnalist(PAK
|
||||
MLVL
|
||||
ANIM
|
||||
CHAR
|
||||
@@ -26,4 +25,3 @@ set(DNAMP3_SOURCES
|
||||
MREA.cpp)
|
||||
|
||||
dataspec_add_list(DNAMP3 DNAMP3_SOURCES)
|
||||
list(APPEND DNAMP3_SOURCES ${liblist})
|
||||
|
||||
@@ -103,8 +103,8 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
|
||||
MaterialSet::RegisterMaterialProps(os);
|
||||
os << "# 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.Light.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
|
||||
"bpy.types.Light.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n"
|
||||
|
||||
@@ -735,7 +735,7 @@ struct SpecMP1 : SpecBase {
|
||||
std::vector<Mesh> meshCompiles;
|
||||
meshCompiles.reserve(meshes.size());
|
||||
|
||||
std::experimental::optional<ColMesh> colMesh;
|
||||
std::optional<ColMesh> colMesh;
|
||||
|
||||
for (const std::string& mesh : meshes) {
|
||||
hecl::SystemStringConv meshSys(mesh);
|
||||
@@ -1110,7 +1110,7 @@ struct SpecMP1 : SpecBase {
|
||||
Log.report(logvisor::Fatal, _SYS_STR("Corrupt MAPW %s"), mapCookedPath.getRelativePath().data());
|
||||
r.readUint32Big();
|
||||
atUint32 mapaCount = r.readUint32Big();
|
||||
for (int i = 0; i < mapaCount; ++i) {
|
||||
for (atUint32 i = 0; i < mapaCount; ++i) {
|
||||
UniqueID32 id;
|
||||
id.read(r);
|
||||
listOut.push_back({FOURCC('MAPA'), originalToNew(id)});
|
||||
|
||||
Reference in New Issue
Block a user