mirror of https://github.com/AxioDL/metaforce.git
AutoMapper work
This commit is contained in:
parent
6c9462e099
commit
8e7773aa94
|
@ -1,6 +1,7 @@
|
||||||
make_dnalist(liblist DNACommon
|
make_dnalist(liblist DNACommon
|
||||||
CMDL
|
CMDL
|
||||||
MAPA
|
MAPA
|
||||||
|
MAPU
|
||||||
EGMC
|
EGMC
|
||||||
SAVWCommon
|
SAVWCommon
|
||||||
ParticleCommon
|
ParticleCommon
|
||||||
|
@ -14,6 +15,7 @@ set(DNACOMMON_SOURCES
|
||||||
MLVL.hpp MLVL.cpp
|
MLVL.hpp MLVL.cpp
|
||||||
CMDL.cpp
|
CMDL.cpp
|
||||||
MAPA.cpp
|
MAPA.cpp
|
||||||
|
MAPU.cpp
|
||||||
STRG.hpp STRG.cpp
|
STRG.hpp STRG.cpp
|
||||||
TXTR.hpp TXTR.cpp
|
TXTR.hpp TXTR.cpp
|
||||||
ANCS.hpp
|
ANCS.hpp
|
||||||
|
|
|
@ -90,7 +90,7 @@ void UniqueIDBridge::setThreadProject(hecl::Database::Project& project)
|
||||||
|
|
||||||
/** PAK 32-bit Unique ID */
|
/** PAK 32-bit Unique ID */
|
||||||
void UniqueID32::read(athena::io::IStreamReader& reader)
|
void UniqueID32::read(athena::io::IStreamReader& reader)
|
||||||
{m_id = reader.readUint32Big();}
|
{assign(reader.readUint32Big());}
|
||||||
void UniqueID32::write(athena::io::IStreamWriter& writer) const
|
void UniqueID32::write(athena::io::IStreamWriter& writer) const
|
||||||
{writer.writeUint32Big(m_id);}
|
{writer.writeUint32Big(m_id);}
|
||||||
void UniqueID32::read(athena::io::YAMLDocReader& reader)
|
void UniqueID32::read(athena::io::YAMLDocReader& reader)
|
||||||
|
@ -120,7 +120,7 @@ std::string UniqueID32::toString() const
|
||||||
|
|
||||||
AuxiliaryID32& AuxiliaryID32::operator=(const hecl::ProjectPath& path)
|
AuxiliaryID32& AuxiliaryID32::operator=(const hecl::ProjectPath& path)
|
||||||
{
|
{
|
||||||
m_id = path.ensureAuxInfo(m_auxStr).hash().val32();
|
assign(path.ensureAuxInfo(m_auxStr).hash().val32());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ AuxiliaryID32& AuxiliaryID32::operator=(const UniqueID32& id)
|
||||||
|
|
||||||
void AuxiliaryID32::read(athena::io::IStreamReader& reader)
|
void AuxiliaryID32::read(athena::io::IStreamReader& reader)
|
||||||
{
|
{
|
||||||
m_id = reader.readUint32Big();
|
assign(reader.readUint32Big());
|
||||||
m_baseId = *this;
|
m_baseId = *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ void AuxiliaryID32::write(athena::io::YAMLDocWriter& writer) const
|
||||||
|
|
||||||
/** PAK 64-bit Unique ID */
|
/** PAK 64-bit Unique ID */
|
||||||
void UniqueID64::read(athena::io::IStreamReader& reader)
|
void UniqueID64::read(athena::io::IStreamReader& reader)
|
||||||
{m_id = reader.readUint64Big();}
|
{assign(reader.readUint64Big());}
|
||||||
void UniqueID64::write(athena::io::IStreamWriter& writer) const
|
void UniqueID64::write(athena::io::IStreamWriter& writer) const
|
||||||
{writer.writeUint64Big(m_id);}
|
{writer.writeUint64Big(m_id);}
|
||||||
void UniqueID64::read(athena::io::YAMLDocReader& reader)
|
void UniqueID64::read(athena::io::YAMLDocReader& reader)
|
||||||
|
|
|
@ -151,9 +151,10 @@ public:
|
||||||
void read(athena::io::YAMLDocReader& reader);
|
void read(athena::io::YAMLDocReader& reader);
|
||||||
void write(athena::io::YAMLDocWriter& writer) const;
|
void write(athena::io::YAMLDocWriter& writer) const;
|
||||||
size_t binarySize(size_t __isz) const;
|
size_t binarySize(size_t __isz) const;
|
||||||
|
void assign(uint32_t id) { m_id = id ? id : 0xffffffff; }
|
||||||
|
|
||||||
UniqueID32& operator=(const hecl::ProjectPath& path)
|
UniqueID32& operator=(const hecl::ProjectPath& path)
|
||||||
{m_id = path.hash().val32(); return *this;}
|
{assign(path.hash().val32()); return *this;}
|
||||||
|
|
||||||
bool operator!=(const UniqueID32& other) const {return m_id != other.m_id;}
|
bool operator!=(const UniqueID32& other) const {return m_id != other.m_id;}
|
||||||
bool operator==(const UniqueID32& other) const {return m_id == other.m_id;}
|
bool operator==(const UniqueID32& other) const {return m_id == other.m_id;}
|
||||||
|
@ -164,7 +165,7 @@ public:
|
||||||
void clear() {m_id = 0xffffffff;}
|
void clear() {m_id = 0xffffffff;}
|
||||||
|
|
||||||
UniqueID32() = default;
|
UniqueID32() = default;
|
||||||
UniqueID32(uint32_t idin) : m_id(idin) {}
|
UniqueID32(uint32_t idin) {assign(idin);}
|
||||||
UniqueID32(athena::io::IStreamReader& reader) {read(reader);}
|
UniqueID32(athena::io::IStreamReader& reader) {read(reader);}
|
||||||
UniqueID32(const hecl::ProjectPath& path) {*this = path;}
|
UniqueID32(const hecl::ProjectPath& path) {*this = path;}
|
||||||
UniqueID32(const char* hexStr)
|
UniqueID32(const char* hexStr)
|
||||||
|
@ -172,14 +173,14 @@ public:
|
||||||
char copy[9];
|
char copy[9];
|
||||||
strncpy(copy, hexStr, 8);
|
strncpy(copy, hexStr, 8);
|
||||||
copy[8] = '\0';
|
copy[8] = '\0';
|
||||||
m_id = strtoul(copy, nullptr, 16);
|
assign(strtoul(copy, nullptr, 16));
|
||||||
}
|
}
|
||||||
UniqueID32(const wchar_t* hexStr)
|
UniqueID32(const wchar_t* hexStr)
|
||||||
{
|
{
|
||||||
wchar_t copy[9];
|
wchar_t copy[9];
|
||||||
wcsncpy(copy, hexStr, 8);
|
wcsncpy(copy, hexStr, 8);
|
||||||
copy[8] = L'\0';
|
copy[8] = L'\0';
|
||||||
m_id = wcstoul(copy, nullptr, 16);
|
assign(wcstoul(copy, nullptr, 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr size_t BinarySize() {return 4;}
|
static constexpr size_t BinarySize() {return 4;}
|
||||||
|
@ -216,9 +217,10 @@ public:
|
||||||
void read(athena::io::YAMLDocReader& reader);
|
void read(athena::io::YAMLDocReader& reader);
|
||||||
void write(athena::io::YAMLDocWriter& writer) const;
|
void write(athena::io::YAMLDocWriter& writer) const;
|
||||||
size_t binarySize(size_t __isz) const;
|
size_t binarySize(size_t __isz) const;
|
||||||
|
void assign(uint64_t id) { m_id = id ? id : 0xffffffffffffffff; }
|
||||||
|
|
||||||
UniqueID64& operator=(const hecl::ProjectPath& path)
|
UniqueID64& operator=(const hecl::ProjectPath& path)
|
||||||
{m_id = path.hash().val64(); return *this;}
|
{assign(path.hash().val64()); return *this;}
|
||||||
|
|
||||||
bool operator!=(const UniqueID64& other) const {return m_id != other.m_id;}
|
bool operator!=(const UniqueID64& other) const {return m_id != other.m_id;}
|
||||||
bool operator==(const UniqueID64& other) const {return m_id == other.m_id;}
|
bool operator==(const UniqueID64& other) const {return m_id == other.m_id;}
|
||||||
|
@ -228,7 +230,7 @@ public:
|
||||||
void clear() {m_id = 0xffffffffffffffff;}
|
void clear() {m_id = 0xffffffffffffffff;}
|
||||||
|
|
||||||
UniqueID64() = default;
|
UniqueID64() = default;
|
||||||
UniqueID64(uint64_t idin) : m_id(idin) {}
|
UniqueID64(uint64_t idin) {assign(idin);}
|
||||||
UniqueID64(athena::io::IStreamReader& reader) {read(reader);}
|
UniqueID64(athena::io::IStreamReader& reader) {read(reader);}
|
||||||
UniqueID64(const hecl::ProjectPath& path) {*this = path;}
|
UniqueID64(const hecl::ProjectPath& path) {*this = path;}
|
||||||
UniqueID64(const char* hexStr)
|
UniqueID64(const char* hexStr)
|
||||||
|
@ -237,9 +239,9 @@ public:
|
||||||
strncpy(copy, hexStr, 16);
|
strncpy(copy, hexStr, 16);
|
||||||
copy[16] = '\0';
|
copy[16] = '\0';
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
m_id = _strtoui64(copy, nullptr, 16);
|
assign(_strtoui64(copy, nullptr, 16));
|
||||||
#else
|
#else
|
||||||
m_id = strtouq(copy, nullptr, 16);
|
assign(strtouq(copy, nullptr, 16));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
UniqueID64(const wchar_t* hexStr)
|
UniqueID64(const wchar_t* hexStr)
|
||||||
|
@ -248,9 +250,9 @@ public:
|
||||||
wcsncpy(copy, hexStr, 16);
|
wcsncpy(copy, hexStr, 16);
|
||||||
copy[16] = L'\0';
|
copy[16] = L'\0';
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
m_id = _wcstoui64(copy, nullptr, 16);
|
assign(_wcstoui64(copy, nullptr, 16));
|
||||||
#else
|
#else
|
||||||
m_id = wcstoull(copy, nullptr, 16);
|
assign(wcstoull(copy, nullptr, 16));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
#include "../DNAMP1/DNAMP1.hpp"
|
#include "../DNAMP1/DNAMP1.hpp"
|
||||||
#include "../DNAMP2/DNAMP2.hpp"
|
#include "../DNAMP2/DNAMP2.hpp"
|
||||||
#include "../DNAMP3/DNAMP3.hpp"
|
#include "../DNAMP3/DNAMP3.hpp"
|
||||||
|
#include "../DNAMP1/MAPA.hpp"
|
||||||
|
#include "../DNAMP2/MAPA.hpp"
|
||||||
|
#include "../DNAMP3/MAPA.hpp"
|
||||||
#include "zeus/CTransform.hpp"
|
#include "zeus/CTransform.hpp"
|
||||||
|
#include "zeus/CAABox.hpp"
|
||||||
|
|
||||||
namespace DataSpec
|
namespace DataSpec
|
||||||
{
|
{
|
||||||
|
@ -335,5 +339,98 @@ template bool ReadMAPAToBlender<PAKRouter<DNAMP3::PAKBridge>>
|
||||||
const PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
|
const PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
|
||||||
bool force);
|
bool force);
|
||||||
|
|
||||||
|
template <typename MAPAType>
|
||||||
|
bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapaIn, const hecl::ProjectPath& out)
|
||||||
|
{
|
||||||
|
MAPAType mapa;
|
||||||
|
mapa.magic = 0xDEADD00D;
|
||||||
|
mapa.version = MAPAType::Version();
|
||||||
|
|
||||||
|
zeus::CAABox aabb;
|
||||||
|
for (const hecl::BlenderConnection::DataStream::Vector3f& vert : mapaIn.verts)
|
||||||
|
aabb.accumulateBounds(vert.val);
|
||||||
|
|
||||||
|
mapa.header = std::make_unique<typename MAPAType::Header>();
|
||||||
|
memset((void*)mapa.header.get(), 0, sizeof(typename MAPAType::Header));
|
||||||
|
typename MAPAType::Header& header = static_cast<typename MAPAType::Header&>(*mapa.header);
|
||||||
|
header.unknown1 = 0;
|
||||||
|
header.unknown2 = 1;
|
||||||
|
header.boundingBox[0] = aabb.min;
|
||||||
|
header.boundingBox[1] = aabb.max;
|
||||||
|
header.moCount = mapaIn.pois.size();
|
||||||
|
header.vtxCount = mapaIn.verts.size();
|
||||||
|
header.surfCount = mapaIn.surfaces.size();
|
||||||
|
|
||||||
|
mapa.mappableObjects.reserve(mapaIn.pois.size());
|
||||||
|
for (const hecl::BlenderConnection::DataStream::MapArea::POI& poi : mapaIn.pois)
|
||||||
|
{
|
||||||
|
mapa.mappableObjects.push_back(std::make_unique<typename MAPAType::MappableObject>());
|
||||||
|
typename MAPAType::MappableObject& mobj =
|
||||||
|
static_cast<typename MAPAType::MappableObject&>(*mapa.mappableObjects.back());
|
||||||
|
mobj.type = MAPA::IMappableObject::Type(poi.type);
|
||||||
|
mobj.unknown1 = poi.unk;
|
||||||
|
mobj.sclyId = poi.objid;
|
||||||
|
mobj.transformMtx[0] = poi.xf.val[0];
|
||||||
|
mobj.transformMtx[1] = poi.xf.val[1];
|
||||||
|
mobj.transformMtx[2] = poi.xf.val[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
mapa.vertices.reserve(mapaIn.verts.size());
|
||||||
|
for (const hecl::BlenderConnection::DataStream::Vector3f& vert : mapaIn.verts)
|
||||||
|
mapa.vertices.push_back(vert.val);
|
||||||
|
|
||||||
|
size_t offsetCur = 0;
|
||||||
|
for (const auto& mo : mapa.mappableObjects)
|
||||||
|
offsetCur = mo->binarySize(offsetCur);
|
||||||
|
offsetCur += mapa.vertices.size() * 12;
|
||||||
|
offsetCur += mapaIn.surfaces.size() * sizeof(DNAMAPA::MAPA::SurfaceHeader);
|
||||||
|
|
||||||
|
mapa.surfaceHeaders.reserve(mapaIn.surfaces.size());
|
||||||
|
mapa.surfaces.reserve(mapaIn.surfaces.size());
|
||||||
|
for (const hecl::BlenderConnection::DataStream::MapArea::Surface& surfIn : mapaIn.surfaces)
|
||||||
|
{
|
||||||
|
mapa.surfaceHeaders.emplace_back();
|
||||||
|
DNAMAPA::MAPA::SurfaceHeader& surfHead = mapa.surfaceHeaders.back();
|
||||||
|
mapa.surfaces.emplace_back();
|
||||||
|
DNAMAPA::MAPA::Surface& surf = mapa.surfaces.back();
|
||||||
|
|
||||||
|
surf.primitiveCount = 1;
|
||||||
|
surf.primitives.emplace_back();
|
||||||
|
DNAMAPA::MAPA::Surface::Primitive& prim = surf.primitives.back();
|
||||||
|
prim.type = GX::TRIANGLESTRIP;
|
||||||
|
prim.indexCount = surfIn.count;
|
||||||
|
prim.indices.reserve(surfIn.count);
|
||||||
|
auto itBegin = mapaIn.indices.begin() + surfIn.start.val;
|
||||||
|
auto itEnd = itBegin + surfIn.count;
|
||||||
|
for (auto it = itBegin ; it != itEnd ; ++it)
|
||||||
|
prim.indices.push_back(it->val);
|
||||||
|
|
||||||
|
surf.borderCount = 1;
|
||||||
|
surf.borders.emplace_back();
|
||||||
|
DNAMAPA::MAPA::Surface::Border& border = surf.borders.back();
|
||||||
|
border.indexCount = surfIn.borderCount;
|
||||||
|
border.indices.reserve(surfIn.borderCount);
|
||||||
|
auto it2Begin = mapaIn.indices.begin() + surfIn.borderStart.val;
|
||||||
|
auto it2End = itBegin + surfIn.borderCount;
|
||||||
|
for (auto it = it2Begin ; it != it2End ; ++it)
|
||||||
|
border.indices.push_back(it->val);
|
||||||
|
|
||||||
|
surfHead.normal = surfIn.normal.val;
|
||||||
|
surfHead.centroid = surfIn.centerOfMass;
|
||||||
|
surfHead.polyOff = offsetCur;
|
||||||
|
offsetCur = prim.binarySize(offsetCur + 4);
|
||||||
|
surfHead.edgeOff = offsetCur;
|
||||||
|
offsetCur = border.binarySize(offsetCur + 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
athena::io::FileWriter f(out.getAbsolutePath());
|
||||||
|
mapa.write(f);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template bool Cook<DNAMP1::MAPA>(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out);
|
||||||
|
template bool Cook<DNAMP2::MAPA>(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out);
|
||||||
|
template bool Cook<DNAMP3::MAPA>(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,9 @@ bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
|
||||||
const typename PAKRouter::EntryType& entry,
|
const typename PAKRouter::EntryType& entry,
|
||||||
bool force);
|
bool force);
|
||||||
|
|
||||||
|
template <typename MAPAType>
|
||||||
|
bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,151 @@
|
||||||
|
#include "MAPU.hpp"
|
||||||
|
#include "../DNAMP1/DNAMP1.hpp"
|
||||||
|
#include "../DNAMP2/DNAMP2.hpp"
|
||||||
|
#include "../DNAMP3/DNAMP3.hpp"
|
||||||
|
#include "zeus/CTransform.hpp"
|
||||||
|
|
||||||
|
namespace DataSpec
|
||||||
|
{
|
||||||
|
namespace DNAMAPU
|
||||||
|
{
|
||||||
|
|
||||||
|
template <typename PAKRouter>
|
||||||
|
bool ReadMAPUToBlender(hecl::BlenderConnection& conn,
|
||||||
|
const MAPU& mapu,
|
||||||
|
const hecl::ProjectPath& outPath,
|
||||||
|
PAKRouter& pakRouter,
|
||||||
|
const typename PAKRouter::EntryType& entry,
|
||||||
|
bool force)
|
||||||
|
{
|
||||||
|
if (!force && outPath.isFile())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::MapUniverse))
|
||||||
|
return false;
|
||||||
|
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||||
|
|
||||||
|
os << "import bpy\n"
|
||||||
|
"from mathutils import Matrix\n"
|
||||||
|
"\n"
|
||||||
|
"# Clear Scene\n"
|
||||||
|
"bpy.context.scene.camera = None\n"
|
||||||
|
"for ob in bpy.data.objects:\n"
|
||||||
|
" bpy.context.scene.objects.unlink(ob)\n"
|
||||||
|
" bpy.data.objects.remove(ob)\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"
|
||||||
|
"bpy.types.Object.retro_mapworld_path = bpy.props.StringProperty(name='Retro: MapWorld Path',"
|
||||||
|
" description='Sets path to World root')\n"
|
||||||
|
"\n";
|
||||||
|
|
||||||
|
hecl::ProjectPath hexPath = pakRouter.getWorking(mapu.hexMapa);
|
||||||
|
os.linkBlend(hexPath.getAbsolutePathUTF8().c_str(),
|
||||||
|
pakRouter.getBestEntryName(mapu.hexMapa).c_str());
|
||||||
|
os << "hexMesh = bpy.data.objects['MAP'].data\n";
|
||||||
|
|
||||||
|
for (const MAPU::World& wld : mapu.worlds)
|
||||||
|
{
|
||||||
|
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(wld.mlvl);
|
||||||
|
const MAPU::Transform& wldXf = wld.transform;
|
||||||
|
os.format("wldObj = bpy.data.objects.new('%s', None)\n"
|
||||||
|
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||||
|
"mtxd = mtx.decompose()\n"
|
||||||
|
"wldObj.rotation_mode = 'QUATERNION'\n"
|
||||||
|
"wldObj.location = mtxd[0]\n"
|
||||||
|
"wldObj.rotation_quaternion = mtxd[1]\n"
|
||||||
|
"wldObj.scale = mtxd[2]\n"
|
||||||
|
"wldObj.retro_mapworld_color = (%f, %f, %f, %f)\n"
|
||||||
|
"wldObj.retro_mapworld_path = '''%s'''\n"
|
||||||
|
"bpy.context.scene.objects.link(wldObj)\n", wld.name.c_str(),
|
||||||
|
wldXf.xf[0].vec[0], wldXf.xf[0].vec[1], wldXf.xf[0].vec[2], wldXf.xf[0].vec[3],
|
||||||
|
wldXf.xf[1].vec[0], wldXf.xf[1].vec[1], wldXf.xf[1].vec[2], wldXf.xf[1].vec[3],
|
||||||
|
wldXf.xf[2].vec[0], wldXf.xf[2].vec[1], wldXf.xf[2].vec[2], wldXf.xf[2].vec[3],
|
||||||
|
wld.hexColor.r, wld.hexColor.g, wld.hexColor.b, wld.hexColor.a,
|
||||||
|
path.getParentPath().getRelativePathUTF8().c_str());
|
||||||
|
int idx = 0;
|
||||||
|
for (const MAPU::Transform& hexXf : wld.hexTransforms)
|
||||||
|
{
|
||||||
|
os.format("obj = bpy.data.objects.new('%s_%d', hexMesh)\n"
|
||||||
|
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||||
|
"mtxd = mtx.decompose()\n"
|
||||||
|
"obj.rotation_mode = 'QUATERNION'\n"
|
||||||
|
"obj.location = mtxd[0]\n"
|
||||||
|
"obj.rotation_quaternion = mtxd[1]\n"
|
||||||
|
"obj.scale = mtxd[2]\n"
|
||||||
|
"bpy.context.scene.objects.link(obj)\n"
|
||||||
|
"obj.parent = wldObj\n",
|
||||||
|
wld.name.c_str(), idx++,
|
||||||
|
hexXf.xf[0].vec[0], hexXf.xf[0].vec[1], hexXf.xf[0].vec[2], hexXf.xf[0].vec[3],
|
||||||
|
hexXf.xf[1].vec[0], hexXf.xf[1].vec[1], hexXf.xf[1].vec[2], hexXf.xf[1].vec[3],
|
||||||
|
hexXf.xf[2].vec[0], hexXf.xf[2].vec[1], hexXf.xf[2].vec[2], hexXf.xf[2].vec[3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
os << "for screen in bpy.data.screens:\n"
|
||||||
|
" for area in screen.areas:\n"
|
||||||
|
" for space in area.spaces:\n"
|
||||||
|
" if space.type == 'VIEW_3D':\n"
|
||||||
|
" space.viewport_shade = 'SOLID'\n"
|
||||||
|
" space.clip_end = 8000.0\n";
|
||||||
|
|
||||||
|
os.centerView();
|
||||||
|
os.close();
|
||||||
|
return conn.saveBlend();
|
||||||
|
}
|
||||||
|
|
||||||
|
template bool ReadMAPUToBlender<PAKRouter<DNAMP1::PAKBridge>>
|
||||||
|
(hecl::BlenderConnection& conn,
|
||||||
|
const MAPU& mapu,
|
||||||
|
const hecl::ProjectPath& outPath,
|
||||||
|
PAKRouter<DNAMP1::PAKBridge>& pakRouter,
|
||||||
|
const PAKRouter<DNAMP1::PAKBridge>::EntryType& entry,
|
||||||
|
bool force);
|
||||||
|
|
||||||
|
template bool ReadMAPUToBlender<PAKRouter<DNAMP2::PAKBridge>>
|
||||||
|
(hecl::BlenderConnection& conn,
|
||||||
|
const MAPU& mapu,
|
||||||
|
const hecl::ProjectPath& outPath,
|
||||||
|
PAKRouter<DNAMP2::PAKBridge>& pakRouter,
|
||||||
|
const PAKRouter<DNAMP2::PAKBridge>::EntryType& entry,
|
||||||
|
bool force);
|
||||||
|
|
||||||
|
bool MAPU::Cook(const hecl::BlenderConnection::DataStream::MapUniverse& mapuIn, const hecl::ProjectPath& out)
|
||||||
|
{
|
||||||
|
MAPU mapu;
|
||||||
|
|
||||||
|
mapu.magic = 0xABCDEF01;
|
||||||
|
mapu.version = 1;
|
||||||
|
mapu.hexMapa = mapuIn.hexagonPath;
|
||||||
|
|
||||||
|
mapu.worldCount = mapuIn.worlds.size();
|
||||||
|
mapu.worlds.reserve(mapuIn.worlds.size());
|
||||||
|
for (const hecl::BlenderConnection::DataStream::MapUniverse::World& wld : mapuIn.worlds)
|
||||||
|
{
|
||||||
|
mapu.worlds.emplace_back();
|
||||||
|
MAPU::World& wldOut = mapu.worlds.back();
|
||||||
|
wldOut.name = wld.name;
|
||||||
|
wldOut.mlvl = hecl::ProjectPath(wld.worldPath, _S("!world.*"));
|
||||||
|
wldOut.transform.xf[0] = wld.xf.val[0];
|
||||||
|
wldOut.transform.xf[1] = wld.xf.val[1];
|
||||||
|
wldOut.transform.xf[2] = wld.xf.val[2];
|
||||||
|
wldOut.hexCount = wld.hexagons.size();
|
||||||
|
wldOut.hexTransforms.reserve(wld.hexagons.size());
|
||||||
|
for (const hecl::BlenderConnection::DataStream::Matrix4f& mtx : wld.hexagons)
|
||||||
|
{
|
||||||
|
wldOut.hexTransforms.emplace_back();
|
||||||
|
MAPU::Transform& xf = wldOut.hexTransforms.back();
|
||||||
|
xf.xf[0] = mtx.val[0];
|
||||||
|
xf.xf[1] = mtx.val[1];
|
||||||
|
xf.xf[2] = mtx.val[2];
|
||||||
|
}
|
||||||
|
wldOut.hexColor = zeus::CColor(wld.color.val);
|
||||||
|
}
|
||||||
|
|
||||||
|
athena::io::FileWriter f(out.getAbsolutePath());
|
||||||
|
mapu.write(f);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
#ifndef __DNACOMMON_MAPU_HPP__
|
||||||
|
#define __DNACOMMON_MAPU_HPP__
|
||||||
|
|
||||||
|
#include "DNACommon.hpp"
|
||||||
|
|
||||||
|
namespace DataSpec
|
||||||
|
{
|
||||||
|
namespace DNAMAPU
|
||||||
|
{
|
||||||
|
struct MAPU : BigDNA
|
||||||
|
{
|
||||||
|
DECL_DNA
|
||||||
|
Value<uint32_t> magic;
|
||||||
|
Value<uint32_t> version;
|
||||||
|
UniqueID32 hexMapa;
|
||||||
|
Value<uint32_t> worldCount;
|
||||||
|
struct Transform : BigDNA
|
||||||
|
{
|
||||||
|
DECL_DNA
|
||||||
|
Value<atVec4f> xf[3];
|
||||||
|
};
|
||||||
|
struct World : BigDNA
|
||||||
|
{
|
||||||
|
DECL_DNA
|
||||||
|
String<-1> name;
|
||||||
|
UniqueID32 mlvl;
|
||||||
|
Transform transform;
|
||||||
|
Value<uint32_t> hexCount;
|
||||||
|
Vector<Transform, DNA_COUNT(hexCount)> hexTransforms;
|
||||||
|
DNAColor hexColor;
|
||||||
|
};
|
||||||
|
Vector<World, DNA_COUNT(worldCount)> worlds;
|
||||||
|
|
||||||
|
static bool Cook(const hecl::BlenderConnection::DataStream::MapUniverse& mapu, const hecl::ProjectPath& out);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename PAKRouter>
|
||||||
|
bool ReadMAPUToBlender(hecl::BlenderConnection& conn,
|
||||||
|
const MAPU& mapu,
|
||||||
|
const hecl::ProjectPath& outPath,
|
||||||
|
PAKRouter& pakRouter,
|
||||||
|
const typename PAKRouter::EntryType& entry,
|
||||||
|
bool force);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __DNACOMMON_MAPU_HPP__
|
|
@ -9,6 +9,15 @@ struct ITweakAutoMapper : public ITweak
|
||||||
{
|
{
|
||||||
virtual const zeus::CVector3f& GetDoorCenter() const=0;
|
virtual const zeus::CVector3f& GetDoorCenter() const=0;
|
||||||
virtual float GetCamVerticalOffset() const=0;
|
virtual float GetCamVerticalOffset() const=0;
|
||||||
|
virtual float GetX28() const=0;
|
||||||
|
virtual float GetX2C() const=0;
|
||||||
|
virtual float GetX30() const=0;
|
||||||
|
virtual float GetAlphaSurfaceVisited() const=0;
|
||||||
|
virtual float GetAlphaOutlineVisited() const=0;
|
||||||
|
virtual float GetAlphaSurfaceUnvisited() const=0;
|
||||||
|
virtual float GetAlphaOutlineUnvisited() const=0;
|
||||||
|
virtual float GetMiniMapViewportWidth() const=0;
|
||||||
|
virtual float GetMiniMapViewportHeight() const=0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ struct ITweakGui : ITweak
|
||||||
Four
|
Four
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual float GetMapAlphaInterpolant() const=0;
|
||||||
virtual EHudVisMode GetHudVisMode() const=0;
|
virtual EHudVisMode GetHudVisMode() const=0;
|
||||||
virtual EHelmetVisMode GetHelmetVisMode() const=0;
|
virtual EHelmetVisMode GetHelmetVisMode() const=0;
|
||||||
virtual atUint32 GetEnableAutoMapper() const=0;
|
virtual atUint32 GetEnableAutoMapper() const=0;
|
||||||
|
|
|
@ -48,6 +48,7 @@ set(DNAMP1_SOURCES
|
||||||
CMDL.hpp
|
CMDL.hpp
|
||||||
CMDLMaterials.cpp
|
CMDLMaterials.cpp
|
||||||
MAPA.hpp
|
MAPA.hpp
|
||||||
|
MAPU.hpp
|
||||||
MREA.cpp
|
MREA.cpp
|
||||||
SCLY.hpp SCLY.cpp
|
SCLY.hpp SCLY.cpp
|
||||||
FRME.cpp
|
FRME.cpp
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "ANCS.hpp"
|
#include "ANCS.hpp"
|
||||||
#include "MREA.hpp"
|
#include "MREA.hpp"
|
||||||
#include "MAPA.hpp"
|
#include "MAPA.hpp"
|
||||||
|
#include "MAPU.hpp"
|
||||||
#include "FRME.hpp"
|
#include "FRME.hpp"
|
||||||
#include "AGSC.hpp"
|
#include "AGSC.hpp"
|
||||||
#include "CSNG.hpp"
|
#include "CSNG.hpp"
|
||||||
|
@ -355,6 +356,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
|
||||||
return {MREA::Extract, {_S(".blend")}, 4, MREA::Name};
|
return {MREA::Extract, {_S(".blend")}, 4, MREA::Name};
|
||||||
case SBIG('MAPA'):
|
case SBIG('MAPA'):
|
||||||
return {MAPA::Extract, {_S(".blend")}, 4};
|
return {MAPA::Extract, {_S(".blend")}, 4};
|
||||||
|
case SBIG('MAPU'):
|
||||||
|
return {MAPU::Extract, {_S(".blend")}, 5};
|
||||||
case SBIG('PART'):
|
case SBIG('PART'):
|
||||||
return {DNAParticle::ExtractGPSM<UniqueID32>, {_S(".gpsm.yaml")}};
|
return {DNAParticle::ExtractGPSM<UniqueID32>, {_S(".gpsm.yaml")}};
|
||||||
case SBIG('ELSC'):
|
case SBIG('ELSC'):
|
||||||
|
|
|
@ -28,6 +28,15 @@ struct MAPA : DNAMAPA::MAPA
|
||||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||||
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
|
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out)
|
||||||
|
{
|
||||||
|
return DNAMAPA::Cook<MAPA>(mapa, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t Version() { return 2; }
|
||||||
|
using Header = DNAMAPA::MAPA::HeaderMP1;
|
||||||
|
using MappableObject = DNAMAPA::MAPA::MappableObjectMP1_2;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
#ifndef __DNAMP1_MAPU_HPP__
|
||||||
|
#define __DNAMP1_MAPU_HPP__
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "../DNACommon/PAK.hpp"
|
||||||
|
#include "../DNACommon/MAPU.hpp"
|
||||||
|
#include "DNAMP1.hpp"
|
||||||
|
|
||||||
|
namespace DataSpec
|
||||||
|
{
|
||||||
|
namespace DNAMP1
|
||||||
|
{
|
||||||
|
|
||||||
|
struct MAPU : DNAMAPU::MAPU
|
||||||
|
{
|
||||||
|
static bool Extract(const SpecBase& dataSpec,
|
||||||
|
PAKEntryReadStream& rs,
|
||||||
|
const hecl::ProjectPath& outPath,
|
||||||
|
PAKRouter<PAKBridge>& pakRouter,
|
||||||
|
const PAK::Entry& entry,
|
||||||
|
bool force,
|
||||||
|
hecl::BlenderToken& btok,
|
||||||
|
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||||
|
{
|
||||||
|
MAPU mapu;
|
||||||
|
mapu.read(rs);
|
||||||
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||||
|
return DNAMAPU::ReadMAPUToBlender(conn, mapu, outPath, pakRouter, entry, force);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -20,7 +20,7 @@ struct CameraShaker : IScriptObject
|
||||||
Value<float> zA;
|
Value<float> zA;
|
||||||
Value<float> zB;
|
Value<float> zB;
|
||||||
Value<float> duration;
|
Value<float> duration;
|
||||||
Value<bool> shakeY;
|
Value<bool> active;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,18 +14,18 @@ struct NewCameraShaker : IScriptObject
|
||||||
DECL_YAML
|
DECL_YAML
|
||||||
String<-1> name;
|
String<-1> name;
|
||||||
Value<atVec3f> location;
|
Value<atVec3f> location;
|
||||||
Value<bool> unknown1;
|
Value<bool> active;
|
||||||
PlayerParameters playerParams;
|
PlayerParameters flags;
|
||||||
Value<float> unknown3;
|
Value<float> duration;
|
||||||
Value<float> unknown4;
|
Value<float> unknown4;
|
||||||
struct CameraShakerParameters : BigYAML
|
struct CameraShakerParameters : BigYAML
|
||||||
{
|
{
|
||||||
DECL_YAML
|
DECL_YAML
|
||||||
PlayerParameters playerParams;
|
PlayerParameters flags;
|
||||||
struct ShakerInfo : BigYAML
|
struct ShakerInfo : BigYAML
|
||||||
{
|
{
|
||||||
DECL_YAML
|
DECL_YAML
|
||||||
PlayerParameters playerParams;
|
PlayerParameters flags;
|
||||||
Value<float> unknown1;
|
Value<float> unknown1;
|
||||||
Value<float> unknown2;
|
Value<float> unknown2;
|
||||||
Value<float> unknown3;
|
Value<float> unknown3;
|
||||||
|
|
|
@ -45,20 +45,20 @@ struct CTweakAutoMapper : public ITweakAutoMapper
|
||||||
Value<float> x78_;
|
Value<float> x78_;
|
||||||
DNAColor x7c_;
|
DNAColor x7c_;
|
||||||
DNAColor x80_;
|
DNAColor x80_;
|
||||||
Value<float> x84_;
|
Value<float> x84_alphaSurfaceVisited;
|
||||||
Value<float> x88_;
|
Value<float> x88_;
|
||||||
Value<float> x8c_;
|
Value<float> x8c_alphaOutlineVisited;
|
||||||
Value<float> x90_;
|
Value<float> x90_;
|
||||||
Value<float> x94_;
|
Value<float> x94_alphaSurfaceUnvisited;
|
||||||
Value<float> x98_;
|
Value<float> x98_;
|
||||||
Value<float> x9c_;
|
Value<float> x9c_alphaOutlineUnvisited;
|
||||||
Value<float> xa0_;
|
Value<float> xa0_;
|
||||||
/* Originally 4 separate floats */
|
/* Originally 4 separate floats */
|
||||||
Value<zeus::CVector3f> xa4_doorCenter;
|
Value<zeus::CVector3f> xa4_doorCenter;
|
||||||
Value<float> xb0_;
|
Value<float> xb0_;
|
||||||
Value<float> xb4_;
|
Value<float> xb4_;
|
||||||
Value<float> xb8_;
|
Value<float> xb8_miniMapViewportWidth;
|
||||||
Value<float> xbc_;
|
Value<float> xbc_miniMapViewportHeight;
|
||||||
Value<float> xc0_;
|
Value<float> xc0_;
|
||||||
Value<float> xc4_;
|
Value<float> xc4_;
|
||||||
Value<float> xc8_;
|
Value<float> xc8_;
|
||||||
|
@ -84,6 +84,15 @@ struct CTweakAutoMapper : public ITweakAutoMapper
|
||||||
CTweakAutoMapper(athena::io::IStreamReader& r) { this->read(r); }
|
CTweakAutoMapper(athena::io::IStreamReader& r) { this->read(r); }
|
||||||
const zeus::CVector3f& GetDoorCenter() const { return xa4_doorCenter; }
|
const zeus::CVector3f& GetDoorCenter() const { return xa4_doorCenter; }
|
||||||
float GetCamVerticalOffset() const { return xec_camVerticalOffset; }
|
float GetCamVerticalOffset() const { return xec_camVerticalOffset; }
|
||||||
|
float GetX28() const { return x28_; }
|
||||||
|
float GetX2C() const { return x2c_; }
|
||||||
|
float GetX30() const { return x30_; }
|
||||||
|
float GetAlphaSurfaceVisited() const { return x84_alphaSurfaceVisited; }
|
||||||
|
float GetAlphaOutlineVisited() const { return x8c_alphaOutlineVisited; }
|
||||||
|
float GetAlphaSurfaceUnvisited() const { return x94_alphaSurfaceUnvisited; }
|
||||||
|
float GetAlphaOutlineUnvisited() const { return x9c_alphaOutlineUnvisited; }
|
||||||
|
float GetMiniMapViewportWidth() const { return xb8_miniMapViewportWidth; }
|
||||||
|
float GetMiniMapViewportHeight() const { return xbc_miniMapViewportHeight; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ struct CTweakGui : ITweakGui
|
||||||
{
|
{
|
||||||
DECL_YAML
|
DECL_YAML
|
||||||
Value<bool> x4_;
|
Value<bool> x4_;
|
||||||
Value<float> x8_;
|
Value<float> x8_mapAlphaInterp;
|
||||||
Value<float> xc_;
|
Value<float> xc_;
|
||||||
Value<float> x10_;
|
Value<float> x10_;
|
||||||
Value<float> x14_;
|
Value<float> x14_;
|
||||||
|
@ -195,6 +195,7 @@ struct CTweakGui : ITweakGui
|
||||||
CTweakGui() = default;
|
CTweakGui() = default;
|
||||||
CTweakGui(athena::io::IStreamReader& r) { this->read(r); }
|
CTweakGui(athena::io::IStreamReader& r) { this->read(r); }
|
||||||
|
|
||||||
|
float GetMapAlphaInterpolant() const { return x8_mapAlphaInterp; }
|
||||||
EHudVisMode GetHudVisMode() const { return xf8_hudVisMode; }
|
EHudVisMode GetHudVisMode() const { return xf8_hudVisMode; }
|
||||||
EHelmetVisMode GetHelmetVisMode() const { return xfc_helmetVisMode; }
|
EHelmetVisMode GetHelmetVisMode() const { return xfc_helmetVisMode; }
|
||||||
atUint32 GetEnableAutoMapper() const { return x100_enableAutoMapper; }
|
atUint32 GetEnableAutoMapper() const { return x100_enableAutoMapper; }
|
||||||
|
|
|
@ -20,6 +20,7 @@ set(DNAMP2_SOURCES
|
||||||
CMDL.hpp
|
CMDL.hpp
|
||||||
MREA.cpp
|
MREA.cpp
|
||||||
MAPA.hpp
|
MAPA.hpp
|
||||||
|
MAPU.hpp
|
||||||
AFSM.hpp
|
AFSM.hpp
|
||||||
STRG.hpp STRG.cpp)
|
STRG.hpp STRG.cpp)
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "ANCS.hpp"
|
#include "ANCS.hpp"
|
||||||
#include "MREA.hpp"
|
#include "MREA.hpp"
|
||||||
#include "MAPA.hpp"
|
#include "MAPA.hpp"
|
||||||
|
#include "MAPU.hpp"
|
||||||
#include "AFSM.hpp"
|
#include "AFSM.hpp"
|
||||||
#include "SAVW.hpp"
|
#include "SAVW.hpp"
|
||||||
#include "AGSC.hpp"
|
#include "AGSC.hpp"
|
||||||
|
@ -278,6 +279,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const DNAMP1::PAK& pak, const
|
||||||
return {MREA::Extract, {_S(".blend")}, 4};
|
return {MREA::Extract, {_S(".blend")}, 4};
|
||||||
case SBIG('MAPA'):
|
case SBIG('MAPA'):
|
||||||
return {MAPA::Extract, {_S(".blend")}, 4};
|
return {MAPA::Extract, {_S(".blend")}, 4};
|
||||||
|
case SBIG('MAPU'):
|
||||||
|
return {MAPU::Extract, {_S(".blend")}, 5};
|
||||||
case SBIG('FSM2'):
|
case SBIG('FSM2'):
|
||||||
return {DNAFSM2::ExtractFSM2<UniqueID32>, {_S(".yaml")}};
|
return {DNAFSM2::ExtractFSM2<UniqueID32>, {_S(".yaml")}};
|
||||||
case SBIG('FONT'):
|
case SBIG('FONT'):
|
||||||
|
|
|
@ -25,6 +25,15 @@ struct MAPA : DNAMAPA::MAPA
|
||||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||||
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
|
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out)
|
||||||
|
{
|
||||||
|
return DNAMAPA::Cook<MAPA>(mapa, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t Version() { return 3; }
|
||||||
|
using Header = DNAMAPA::MAPA::HeaderMP2;
|
||||||
|
using MappableObject = DNAMAPA::MAPA::MappableObjectMP1_2;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
#ifndef __DNAMP2_MAPU_HPP__
|
||||||
|
#define __DNAMP2_MAPU_HPP__
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "../DNACommon/PAK.hpp"
|
||||||
|
#include "../DNACommon/MAPU.hpp"
|
||||||
|
#include "DNAMP2.hpp"
|
||||||
|
|
||||||
|
namespace DataSpec
|
||||||
|
{
|
||||||
|
namespace DNAMP2
|
||||||
|
{
|
||||||
|
|
||||||
|
struct MAPU : DNAMAPU::MAPU
|
||||||
|
{
|
||||||
|
static bool Extract(const SpecBase& dataSpec,
|
||||||
|
PAKEntryReadStream& rs,
|
||||||
|
const hecl::ProjectPath& outPath,
|
||||||
|
PAKRouter<PAKBridge>& pakRouter,
|
||||||
|
const DNAMP1::PAK::Entry& entry,
|
||||||
|
bool force,
|
||||||
|
hecl::BlenderToken& btok,
|
||||||
|
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||||
|
{
|
||||||
|
MAPU mapu;
|
||||||
|
mapu.read(rs);
|
||||||
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||||
|
return DNAMAPU::ReadMAPUToBlender(conn, mapu, outPath, pakRouter, entry, force);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -25,6 +25,15 @@ struct MAPA : DNAMAPA::MAPA
|
||||||
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||||
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
|
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out)
|
||||||
|
{
|
||||||
|
return DNAMAPA::Cook<MAPA>(mapa, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t Version() { return 5; }
|
||||||
|
using Header = DNAMAPA::MAPA::HeaderMP3;
|
||||||
|
using MappableObject = DNAMAPA::MAPA::MappableObjectMP3;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,6 +270,18 @@ void SpecBase::doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& co
|
||||||
cookGuiFrame(cookedPath, path, ds, btok, progress);
|
cookGuiFrame(cookedPath, path, ds, btok, progress);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case hecl::BlenderConnection::BlendType::MapArea:
|
||||||
|
{
|
||||||
|
hecl::BlenderConnection::DataStream ds = conn.beginData();
|
||||||
|
cookMapArea(cookedPath, path, ds, btok, progress);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case hecl::BlenderConnection::BlendType::MapUniverse:
|
||||||
|
{
|
||||||
|
hecl::BlenderConnection::DataStream ds = conn.beginData();
|
||||||
|
cookMapUniverse(cookedPath, path, ds, btok, progress);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,12 @@ struct SpecBase : hecl::Database::IDataSpec
|
||||||
FCookProgress progress)=0;
|
FCookProgress progress)=0;
|
||||||
virtual void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
virtual void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||||
FCookProgress progress)=0;
|
FCookProgress progress)=0;
|
||||||
|
virtual void cookMapArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||||
|
BlendStream& ds, hecl::BlenderToken& btok,
|
||||||
|
FCookProgress progress)=0;
|
||||||
|
virtual void cookMapUniverse(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||||
|
BlendStream& ds, hecl::BlenderToken& btok,
|
||||||
|
FCookProgress progress)=0;
|
||||||
|
|
||||||
/* Dependency flatteners */
|
/* Dependency flatteners */
|
||||||
void flattenDependencies(const hecl::ProjectPath& in,
|
void flattenDependencies(const hecl::ProjectPath& in,
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "DNAMP1/ANCS.hpp"
|
#include "DNAMP1/ANCS.hpp"
|
||||||
#include "DNAMP1/AGSC.hpp"
|
#include "DNAMP1/AGSC.hpp"
|
||||||
#include "DNAMP1/CSNG.hpp"
|
#include "DNAMP1/CSNG.hpp"
|
||||||
|
#include "DNAMP1/MAPA.hpp"
|
||||||
#include "DNACommon/ATBL.hpp"
|
#include "DNACommon/ATBL.hpp"
|
||||||
#include "DNACommon/FONT.hpp"
|
#include "DNACommon/FONT.hpp"
|
||||||
#include "DNACommon/PART.hpp"
|
#include "DNACommon/PART.hpp"
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
#include "DNACommon/CRSC.hpp"
|
#include "DNACommon/CRSC.hpp"
|
||||||
#include "DNACommon/DPSC.hpp"
|
#include "DNACommon/DPSC.hpp"
|
||||||
#include "DNACommon/DGRP.hpp"
|
#include "DNACommon/DGRP.hpp"
|
||||||
|
#include "DNACommon/MAPU.hpp"
|
||||||
#include "DNACommon/Tweaks/TweakWriter.hpp"
|
#include "DNACommon/Tweaks/TweakWriter.hpp"
|
||||||
#include "DNAMP1/Tweaks/CTweakPlayerRes.hpp"
|
#include "DNAMP1/Tweaks/CTweakPlayerRes.hpp"
|
||||||
#include "DNAMP1/Tweaks/CTweakGunRes.hpp"
|
#include "DNAMP1/Tweaks/CTweakGunRes.hpp"
|
||||||
|
@ -1049,6 +1051,26 @@ struct SpecMP1 : SpecBase
|
||||||
DNAMP1::CSNG::Cook(in, out);
|
DNAMP1::CSNG::Cook(in, out);
|
||||||
progress(_S("Done"));
|
progress(_S("Done"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cookMapArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||||
|
BlendStream& ds, hecl::BlenderToken& btok,
|
||||||
|
FCookProgress progress)
|
||||||
|
{
|
||||||
|
BlendStream::MapArea mapa = ds.compileMapArea();
|
||||||
|
ds.close();
|
||||||
|
DNAMP1::MAPA::Cook(mapa, out);
|
||||||
|
progress(_S("Done"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void cookMapUniverse(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||||
|
BlendStream& ds, hecl::BlenderToken& btok,
|
||||||
|
FCookProgress progress)
|
||||||
|
{
|
||||||
|
BlendStream::MapUniverse mapu = ds.compileMapUniverse();
|
||||||
|
ds.close();
|
||||||
|
DNAMAPU::MAPU::Cook(mapu, out);
|
||||||
|
progress(_S("Done"));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
hecl::Database::DataSpecEntry SpecEntMP1 = {
|
hecl::Database::DataSpecEntry SpecEntMP1 = {
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
#include "DNAMP2/MLVL.hpp"
|
#include "DNAMP2/MLVL.hpp"
|
||||||
#include "DNAMP2/STRG.hpp"
|
#include "DNAMP2/STRG.hpp"
|
||||||
#include "DNAMP2/AGSC.hpp"
|
#include "DNAMP2/AGSC.hpp"
|
||||||
|
#include "DNAMP2/MAPA.hpp"
|
||||||
#include "DNAMP1/CSNG.hpp"
|
#include "DNAMP1/CSNG.hpp"
|
||||||
|
#include "DNACommon/MAPU.hpp"
|
||||||
|
|
||||||
#include "hecl/ClientProcess.hpp"
|
#include "hecl/ClientProcess.hpp"
|
||||||
|
|
||||||
|
@ -365,6 +367,26 @@ struct SpecMP2 : SpecBase
|
||||||
DNAMP1::CSNG::Cook(in, out);
|
DNAMP1::CSNG::Cook(in, out);
|
||||||
progress(_S("Done"));
|
progress(_S("Done"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cookMapArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||||
|
BlendStream& ds, hecl::BlenderToken& btok,
|
||||||
|
FCookProgress progress)
|
||||||
|
{
|
||||||
|
BlendStream::MapArea mapa = ds.compileMapArea();
|
||||||
|
ds.close();
|
||||||
|
DNAMP2::MAPA::Cook(mapa, out);
|
||||||
|
progress(_S("Done"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void cookMapUniverse(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||||
|
BlendStream& ds, hecl::BlenderToken& btok,
|
||||||
|
FCookProgress progress)
|
||||||
|
{
|
||||||
|
BlendStream::MapUniverse mapu = ds.compileMapUniverse();
|
||||||
|
ds.close();
|
||||||
|
DNAMAPU::MAPU::Cook(mapu, out);
|
||||||
|
progress(_S("Done"));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
hecl::Database::DataSpecEntry SpecEntMP2
|
hecl::Database::DataSpecEntry SpecEntMP2
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "DNAMP3/MLVL.hpp"
|
#include "DNAMP3/MLVL.hpp"
|
||||||
#include "DNAMP3/STRG.hpp"
|
#include "DNAMP3/STRG.hpp"
|
||||||
|
#include "DNAMP3/MAPA.hpp"
|
||||||
#include "DNAMP2/STRG.hpp"
|
#include "DNAMP2/STRG.hpp"
|
||||||
|
|
||||||
#include "hecl/ClientProcess.hpp"
|
#include "hecl/ClientProcess.hpp"
|
||||||
|
@ -544,6 +545,22 @@ struct SpecMP3 : SpecBase
|
||||||
FCookProgress progress)
|
FCookProgress progress)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cookMapArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||||
|
BlendStream& ds, hecl::BlenderToken& btok,
|
||||||
|
FCookProgress progress)
|
||||||
|
{
|
||||||
|
BlendStream::MapArea mapa = ds.compileMapArea();
|
||||||
|
ds.close();
|
||||||
|
DNAMP3::MAPA::Cook(mapa, out);
|
||||||
|
progress(_S("Done"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void cookMapUniverse(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||||
|
BlendStream& ds, hecl::BlenderToken& btok,
|
||||||
|
FCookProgress progress)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
hecl::Database::DataSpecEntry SpecEntMP3
|
hecl::Database::DataSpecEntry SpecEntMP3
|
||||||
|
|
|
@ -1,18 +1,155 @@
|
||||||
#include "CAutoMapper.hpp"
|
#include "CAutoMapper.hpp"
|
||||||
|
#include "CSimplePool.hpp"
|
||||||
|
#include "GameGlobalObjects.hpp"
|
||||||
|
#include "Camera/CGameCamera.hpp"
|
||||||
|
#include "AutoMapper/CMapUniverse.hpp"
|
||||||
|
#include "AutoMapper/CMapArea.hpp"
|
||||||
|
#include "zeus/CEulerAngles.hpp"
|
||||||
|
#include "World/CPlayer.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CAutoMapper::CAutoMapper(CStateManager& stateMgr)
|
CAutoMapper::CAutoMapper(CStateManager& stateMgr)
|
||||||
|
: x24_world(*stateMgr.WorldNC())
|
||||||
{
|
{
|
||||||
|
x8_mapu = g_SimplePool->GetObj("MAPU_MapUniverse");
|
||||||
|
x30_miniMapSamus = g_SimplePool->GetObj("CMDL_MiniMapSamus");
|
||||||
|
x3c_hintBeacon = g_SimplePool->GetObj("TXTR_HintBeacon");
|
||||||
|
|
||||||
|
xa0_curAreaId = xa4_otherAreaId = stateMgr.GetWorld()->IGetCurrentAreaId();
|
||||||
|
zeus::CMatrix3f camRot = stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr)->GetTransform().buildMatrix3f();
|
||||||
|
xa8_[0] = xa8_[1] = xa8_[2] = BuildMiniMapWorldRenderState(stateMgr, camRot, xa0_curAreaId);
|
||||||
|
|
||||||
|
x48_mapIcons.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x4_saveStationIcon}));
|
||||||
|
x48_mapIcons.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x8_missileStationIcon}));
|
||||||
|
x48_mapIcons.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->xc_elevatorIcon}));
|
||||||
|
x48_mapIcons.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x10_minesBreakFirstTopIcon}));
|
||||||
|
x48_mapIcons.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x14_minesBreakFirstBottomIcon}));
|
||||||
|
|
||||||
|
for (int i=0 ; i<9 ; ++i)
|
||||||
|
{
|
||||||
|
x210_lstick.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x24_lStick[i]}));
|
||||||
|
x25c_cstick.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x4c_cStick[i]}));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0 ; i<2 ; ++i)
|
||||||
|
{
|
||||||
|
x2a8_ltrigger.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x74_lTrigger[i]}));
|
||||||
|
x2bc_rtrigger.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x80_rTrigger[i]}));
|
||||||
|
x2d0_abutton.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x98_aButton[i]}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAutoMapper::CheckLoadComplete()
|
bool CAutoMapper::CheckLoadComplete()
|
||||||
{
|
{
|
||||||
|
switch (x4_loadPhase)
|
||||||
|
{
|
||||||
|
case ELoadPhase::LoadResources:
|
||||||
|
for (TLockedToken<CTexture>& tex : x48_mapIcons)
|
||||||
|
if (!tex.IsLoaded())
|
||||||
|
return false;
|
||||||
|
if (!x30_miniMapSamus.IsLoaded())
|
||||||
|
return false;
|
||||||
|
if (!x3c_hintBeacon.IsLoaded())
|
||||||
|
return false;
|
||||||
|
x4_loadPhase = ELoadPhase::LoadUniverse;
|
||||||
|
case ELoadPhase::LoadUniverse:
|
||||||
|
if (x8_mapu.IsLoaded())
|
||||||
|
return false;
|
||||||
|
x14_dummyWorlds.resize(x8_mapu->GetNumMapWorldDatas());
|
||||||
|
SetCurWorldAssetId(x24_world.IGetWorldAssetId());
|
||||||
|
x4_loadPhase = ELoadPhase::Done;
|
||||||
|
case ELoadPhase::Done:
|
||||||
|
return true;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAutoMapper::SetCurWorldAssetId(ResId mlvlId)
|
||||||
|
{
|
||||||
|
int numWorlds = x8_mapu->GetNumMapWorldDatas();
|
||||||
|
for (int i=0 ; i<numWorlds ; ++i)
|
||||||
|
if (x8_mapu->GetMapWorldData(i).GetWorldAssetId() == mlvlId)
|
||||||
|
{
|
||||||
|
x9c_worldIdx = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CAutoMapper::SAutoMapperRenderState
|
||||||
|
CAutoMapper::BuildMiniMapWorldRenderState(const CStateManager& stateMgr,
|
||||||
|
const zeus::CQuaternion& rot,
|
||||||
|
TAreaId area) const
|
||||||
|
{
|
||||||
|
zeus::CQuaternion camOrient = GetMiniMapCameraOrientation(stateMgr);
|
||||||
|
zeus::CQuaternion useOrient = (camOrient.dot(rot) >= 0.f) ? camOrient : camOrient.buildEquivalent();
|
||||||
|
return SAutoMapperRenderState(GetMiniMapViewportSize(), useOrient, g_tweakAutoMapper->GetX28(),
|
||||||
|
g_tweakAutoMapper->GetX30(), GetAreaPointOfInterest(stateMgr, area),
|
||||||
|
GetMapAreaMiniMapDrawDepth(), GetMapAreaMiniMapDrawDepth(),
|
||||||
|
GetMapAreaMiniMapDrawAlphaSurfaceVisited(stateMgr),
|
||||||
|
GetMapAreaMiniMapDrawAlphaOutlineVisited(stateMgr),
|
||||||
|
GetMapAreaMiniMapDrawAlphaSurfaceUnvisited(stateMgr),
|
||||||
|
GetMapAreaMiniMapDrawAlphaOutlineUnvisited(stateMgr));
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CQuaternion CAutoMapper::GetMiniMapCameraOrientation(const CStateManager& stateMgr) const
|
||||||
|
{
|
||||||
|
const CGameCamera* cam = stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr);
|
||||||
|
zeus::CEulerAngles camAngles(zeus::CQuaternion(cam->GetTransform().buildMatrix3f()));
|
||||||
|
float rotMod = -(std::floor(camAngles.z * 0.15915494f) * 2.f * M_PIF - camAngles.z);
|
||||||
|
if (rotMod < 0.f)
|
||||||
|
rotMod += 2.f * M_PIF;
|
||||||
|
|
||||||
|
zeus::CQuaternion ret;
|
||||||
|
ret.rotateZ(rotMod);
|
||||||
|
ret.rotateX(zeus::degToRad(g_tweakAutoMapper->GetX2C()));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CVector3f CAutoMapper::GetAreaPointOfInterest(const CStateManager&, TAreaId aid) const
|
||||||
|
{
|
||||||
|
const CMapArea* mapa = x24_world.IGetMapWorld()->GetMapArea(aid);
|
||||||
|
return mapa->GetAreaPostTransform(x24_world, aid) * mapa->GetAreaCenterPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CVector2i CAutoMapper::GetMiniMapViewportSize()
|
||||||
|
{
|
||||||
|
float scaleX = g_Viewport.x8_width / 640.f;
|
||||||
|
float scaleY = g_Viewport.xc_height / 480.f;
|
||||||
|
return {scaleX * g_tweakAutoMapper->GetMiniMapViewportWidth(),
|
||||||
|
scaleY * g_tweakAutoMapper->GetMiniMapViewportHeight()};
|
||||||
|
}
|
||||||
|
|
||||||
|
float CAutoMapper::GetMapAreaMiniMapDrawAlphaSurfaceVisited(const CStateManager& stateMgr)
|
||||||
|
{
|
||||||
|
float mapAlphaInterp = g_tweakGui->GetMapAlphaInterpolant();
|
||||||
|
return g_tweakAutoMapper->GetAlphaOutlineUnvisited() * (1.f - mapAlphaInterp) *
|
||||||
|
stateMgr.Player()->GetMapAlpha() + mapAlphaInterp;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CAutoMapper::GetMapAreaMiniMapDrawAlphaOutlineVisited(const CStateManager& stateMgr)
|
||||||
|
{
|
||||||
|
float mapAlphaInterp = g_tweakGui->GetMapAlphaInterpolant();
|
||||||
|
return g_tweakAutoMapper->GetAlphaOutlineVisited() * (1.f - mapAlphaInterp) *
|
||||||
|
stateMgr.Player()->GetMapAlpha() + mapAlphaInterp;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CAutoMapper::GetMapAreaMiniMapDrawAlphaSurfaceUnvisited(const CStateManager& stateMgr)
|
||||||
|
{
|
||||||
|
float mapAlphaInterp = g_tweakGui->GetMapAlphaInterpolant();
|
||||||
|
return g_tweakAutoMapper->GetAlphaSurfaceUnvisited() * (1.f - mapAlphaInterp) *
|
||||||
|
stateMgr.Player()->GetMapAlpha() + mapAlphaInterp;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CAutoMapper::GetMapAreaMiniMapDrawAlphaOutlineUnvisited(const CStateManager& stateMgr)
|
||||||
|
{
|
||||||
|
float mapAlphaInterp = g_tweakGui->GetMapAlphaInterpolant();
|
||||||
|
return g_tweakAutoMapper->GetAlphaOutlineUnvisited() * (1.f - mapAlphaInterp) *
|
||||||
|
stateMgr.Player()->GetMapAlpha() + mapAlphaInterp;
|
||||||
|
}
|
||||||
|
|
||||||
void CAutoMapper::UnmuteAllLoopedSounds()
|
void CAutoMapper::UnmuteAllLoopedSounds()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,50 @@ class CFinalInput;
|
||||||
class IWorld;
|
class IWorld;
|
||||||
class CMapWorldInfo;
|
class CMapWorldInfo;
|
||||||
class CStateManager;
|
class CStateManager;
|
||||||
|
class CMapUniverse;
|
||||||
|
|
||||||
class CAutoMapper
|
class CAutoMapper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using EInGameGuiState = MP1::EInGameGuiState;
|
using EInGameGuiState = MP1::EInGameGuiState;
|
||||||
|
enum class ELoadPhase
|
||||||
|
{
|
||||||
|
LoadResources,
|
||||||
|
LoadUniverse,
|
||||||
|
Done
|
||||||
|
};
|
||||||
enum class EAutoMapperState
|
enum class EAutoMapperState
|
||||||
{
|
{
|
||||||
|
Zero
|
||||||
};
|
};
|
||||||
struct SAutoMapperRenderState
|
struct SAutoMapperRenderState
|
||||||
{
|
{
|
||||||
|
zeus::CVector2i x0_viewportSize;
|
||||||
|
zeus::CQuaternion x8_camOrientation;
|
||||||
|
float x18_f1;
|
||||||
|
float x1c_f2;
|
||||||
|
zeus::CVector3f x20_areaPoint;
|
||||||
|
float x2c_drawDepth1;
|
||||||
|
float x30_drawDepth2;
|
||||||
|
float x34_alphaSurfaceVisited;
|
||||||
|
float x38_alphaOutlineVisited;
|
||||||
|
float x3c_alphaSurfaceUnvisited;
|
||||||
|
float x40_alphaOutlineUnvisited;
|
||||||
|
u32 x44_;
|
||||||
|
u32 x48_;
|
||||||
|
u32 x4c_;
|
||||||
|
u32 x50_;
|
||||||
|
u32 x54_;
|
||||||
|
u32 x58_;
|
||||||
|
SAutoMapperRenderState() = default;
|
||||||
|
SAutoMapperRenderState(const zeus::CVector2i& v1, const zeus::CQuaternion& rot,
|
||||||
|
float f1, float f2, const zeus::CVector3f& v2, float f3, float f4,
|
||||||
|
float f5, float f6, float f7, float f8)
|
||||||
|
: x0_viewportSize(v1), x8_camOrientation(rot), x18_f1(f1), x1c_f2(f2),
|
||||||
|
x20_areaPoint(v2), x2c_drawDepth1(f3), x30_drawDepth2(f4),
|
||||||
|
x34_alphaSurfaceVisited(f5), x38_alphaOutlineVisited(f6),
|
||||||
|
x3c_alphaSurfaceUnvisited(f7), x40_alphaOutlineUnvisited(f8),
|
||||||
|
x44_(0), x48_(0), x4c_(0), x50_(0), x54_(0), x58_(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CAudioMenu
|
class CAudioMenu
|
||||||
|
@ -51,14 +86,70 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
ELoadPhase x4_loadPhase = ELoadPhase::LoadResources;
|
||||||
|
TLockedToken<CMapUniverse> x8_mapu;
|
||||||
|
std::vector<std::unique_ptr<IWorld>> x14_dummyWorlds;
|
||||||
|
CWorld& x24_world;
|
||||||
|
u32 x28_ = 0;
|
||||||
|
u32 x2c_ = 0;
|
||||||
|
TLockedToken<CModel> x30_miniMapSamus;
|
||||||
|
TLockedToken<CTexture> x3c_hintBeacon;
|
||||||
|
rstl::reserved_vector<TLockedToken<CTexture>, 5> x48_mapIcons;
|
||||||
|
ResId x74_ = -1;
|
||||||
|
u32 x84_ = 0;
|
||||||
|
ResId x88_ = -1;
|
||||||
|
u32 x98_ = 0;
|
||||||
|
u32 x9c_worldIdx = 0;
|
||||||
|
TAreaId xa0_curAreaId;
|
||||||
|
TAreaId xa4_otherAreaId;
|
||||||
|
SAutoMapperRenderState xa8_[3]; // xa8, x104, x160
|
||||||
|
EAutoMapperState x1bc_state = EAutoMapperState::Zero;
|
||||||
|
EAutoMapperState x1c0_nextState = EAutoMapperState::Zero;
|
||||||
|
float x1c4_ = 0.f;
|
||||||
|
float x1c8_ = 0.f;
|
||||||
|
u32 x1cc_ = 0;
|
||||||
|
u32 x1d0_ = 0;
|
||||||
|
u32 x1d4_ = 0;
|
||||||
|
float x1d8_ = 0.f;
|
||||||
|
float x1dc_ = 0.f;
|
||||||
|
std::list<u32> x1e0_;
|
||||||
|
u32 x1f4_ = 0;
|
||||||
|
std::list<u32> x1f8_;
|
||||||
|
u32 x20c_ = 0;
|
||||||
|
rstl::reserved_vector<TLockedToken<CTexture>, 9> x210_lstick;
|
||||||
|
rstl::reserved_vector<TLockedToken<CTexture>, 9> x25c_cstick;
|
||||||
|
rstl::reserved_vector<TLockedToken<CTexture>, 2> x2a8_ltrigger;
|
||||||
|
rstl::reserved_vector<TLockedToken<CTexture>, 2> x2bc_rtrigger;
|
||||||
|
rstl::reserved_vector<TLockedToken<CTexture>, 2> x2d0_abutton;
|
||||||
|
u32 x2e4_ = 0;
|
||||||
|
u32 x2e8_ = 0;
|
||||||
|
u32 x2ec_ = 0;
|
||||||
|
u32 x2f0_ = 0;
|
||||||
|
u32 x2f4_ = 0;
|
||||||
|
u32 x2f8_ = 0;
|
||||||
|
u32 x2fc_ = 0;
|
||||||
|
u32 x300_ = 0;
|
||||||
|
u32 x304_ = 0;
|
||||||
|
u32 x308_ = 0;
|
||||||
|
u32 x30c_ = 0;
|
||||||
|
u32 x310_ = 0;
|
||||||
|
u32 x314_ = 0;
|
||||||
|
float x318_ = 0.f;
|
||||||
|
float x31c_ = 0.f;
|
||||||
|
float x320_ = 0.f;
|
||||||
|
u32 x324_ = 0;
|
||||||
|
u32 x328_ = 0;
|
||||||
|
u32 x32c_ = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAutoMapper(CStateManager&);
|
CAutoMapper(CStateManager& stateMgr);
|
||||||
bool CheckLoadComplete();
|
bool CheckLoadComplete();
|
||||||
bool CanLeaveMapScrean(const CStateManager&) const;
|
bool CanLeaveMapScrean(const CStateManager&) const;
|
||||||
float GetMapRotationX() const;
|
float GetMapRotationX() const;
|
||||||
float GetMapRotationZ() const;
|
float GetMapRotationZ() const;
|
||||||
u32 GetFocusAreaIndex() const;
|
u32 GetFocusAreaIndex() const;
|
||||||
ResId GetCurrWorldAssetId() const;
|
ResId GetCurrWorldAssetId() const;
|
||||||
|
void SetCurWorldAssetId(ResId mlvlId);
|
||||||
void MuteAllLoopedSounds();
|
void MuteAllLoopedSounds();
|
||||||
void UnmuteAllLoopedSounds();
|
void UnmuteAllLoopedSounds();
|
||||||
void ProcessControllerInput(const CFinalInput&, CStateManager&);
|
void ProcessControllerInput(const CFinalInput&, CStateManager&);
|
||||||
|
@ -70,32 +161,36 @@ public:
|
||||||
void BeginMapperStateTransition(EAutoMapperState, const CStateManager&);
|
void BeginMapperStateTransition(EAutoMapperState, const CStateManager&);
|
||||||
void CompleteMapperStateTransition();
|
void CompleteMapperStateTransition();
|
||||||
void ResetInterpolationTimer(float);
|
void ResetInterpolationTimer(float);
|
||||||
void BuildMiniMapWorldRenderState(const CStateManager&, const zeus::CQuaternion&, s32) const;
|
SAutoMapperRenderState BuildMiniMapWorldRenderState(const CStateManager&, const zeus::CQuaternion&, TAreaId) const;
|
||||||
void BuildMapScreenWorldRenderState(const CStateManager&, const zeus::CQuaternion&, s32) const;
|
SAutoMapperRenderState BuildMapScreenWorldRenderState(const CStateManager&, const zeus::CQuaternion&, TAreaId) const;
|
||||||
void BuildMapScreenUniverseRenderState(const CStateManager&, const zeus::CQuaternion&, s32) const;
|
SAutoMapperRenderState BuildMapScreenUniverseRenderState(const CStateManager&, const zeus::CQuaternion&, TAreaId) const;
|
||||||
void SetShouldPanningSoundBePlaying(bool);
|
void SetShouldPanningSoundBePlaying(bool);
|
||||||
void SetShouldZoomingSoundBePlaying(bool);
|
void SetShouldZoomingSoundBePlaying(bool);
|
||||||
void SetShouldRotatingSoundBePlaying(bool);
|
void SetShouldRotatingSoundBePlaying(bool);
|
||||||
void LeaveMapScreenState();
|
void LeaveMapScreenState();
|
||||||
void GetMiniMapCameraOrientation(CStateManager&);
|
zeus::CQuaternion GetMiniMapCameraOrientation(const CStateManager&) const;
|
||||||
void GetAreaPointOfInterest(CStateManager, s32);
|
zeus::CVector3f GetAreaPointOfInterest(const CStateManager&, TAreaId) const;
|
||||||
void FindClosestVisibleArea(const zeus::CVector3f&, const zeus::CUnitVector3f&, const CStateManager&,
|
void FindClosestVisibleArea(const zeus::CVector3f&, const zeus::CUnitVector3f&, const CStateManager&,
|
||||||
const IWorld&, const CMapWorldInfo&) const;
|
const IWorld&, const CMapWorldInfo&) const;
|
||||||
void FindClosestVisibleWorld(const zeus::CVector3f&, const zeus::CUnitVector3f&, const CStateManager&) const;
|
void FindClosestVisibleWorld(const zeus::CVector3f&, const zeus::CUnitVector3f&, const CStateManager&) const;
|
||||||
|
|
||||||
void GetMiniMapViewportSize();
|
static zeus::CVector2i GetMiniMapViewportSize();
|
||||||
void GetMapScreenViewportSize();
|
static void GetMapScreenViewportSize();
|
||||||
float GetMapAreaMiniDrawDepth();
|
static float GetMapAreaMiniMapDrawDepth() { return 2.f; }
|
||||||
float GetMapAreaMaxDrawDepth();
|
static float GetMapAreaMaxDrawDepth();
|
||||||
void GetMapAreaMiniMapDrawAlphaSurfaceVisited(const CStateManager&);
|
static float GetMapAreaMiniMapDrawAlphaSurfaceVisited(const CStateManager&);
|
||||||
void GetMapAreaMiniMapDrawAlphaOutlineVisited(const CStateManager&);
|
static float GetMapAreaMiniMapDrawAlphaOutlineVisited(const CStateManager&);
|
||||||
void GetMapAreaMiniMapDrawAlphaSurfaceUnvisited(const CStateManager&);
|
static float GetMapAreaMiniMapDrawAlphaSurfaceUnvisited(const CStateManager&);
|
||||||
void GetMapAreaMiniMapDrawAlphaOutlineUnvisited(const CStateManager&);
|
static float GetMapAreaMiniMapDrawAlphaOutlineUnvisited(const CStateManager&);
|
||||||
void GetClampedMapScreenCameraDistance(float) const;
|
static void GetClampedMapScreenCameraDistance(float);
|
||||||
void GetDesiredMiniMapCameraDistance(const CStateManager&) const;
|
static void GetDesiredMiniMapCameraDistance(const CStateManager&);
|
||||||
float GetBaseCameraMoveSpeed() const;
|
static float GetBaseCameraMoveSpeed();
|
||||||
float GetFinalCameraMoveSpeed() const;
|
static float GetFinalCameraMoveSpeed();
|
||||||
bool IsInMapperState(EAutoMapperState) const;
|
|
||||||
|
bool IsInMapperState(EAutoMapperState state) const
|
||||||
|
{
|
||||||
|
return state == x1bc_state && state == x1c0_nextState;
|
||||||
|
}
|
||||||
bool IsInMapperTransition() const;
|
bool IsInMapperTransition() const;
|
||||||
bool IsRenderStateInterpolating() const;
|
bool IsRenderStateInterpolating() const;
|
||||||
void TransformRenderStatesWorldToUniverse();
|
void TransformRenderStatesWorldToUniverse();
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
#include "GameGlobalObjects.hpp"
|
#include "GameGlobalObjects.hpp"
|
||||||
#include "CMappableObject.hpp"
|
#include "CMappableObject.hpp"
|
||||||
#include "CToken.hpp"
|
#include "CToken.hpp"
|
||||||
|
#include "World/CWorld.hpp"
|
||||||
|
#include "World/CGameArea.hpp"
|
||||||
|
#include "CResFactory.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -44,6 +47,71 @@ void CMapArea::PostConstruct()
|
||||||
(reinterpret_cast<CMapAreaSurface*>(x40_surfaceStart + j))->PostConstruct(x44_buf.get());
|
(reinterpret_cast<CMapAreaSurface*>(x40_surfaceStart + j))->PostConstruct(x44_buf.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const zeus::CVector3f MinesPostTransforms[3] =
|
||||||
|
{
|
||||||
|
{0.f, 0.f, 200.f},
|
||||||
|
{0.f, 0.f, 0.f},
|
||||||
|
{0.f, 0.f, -200.f}
|
||||||
|
};
|
||||||
|
static const u8 MinesPostTransformIndices[] =
|
||||||
|
{
|
||||||
|
0, // 00 Transport to Tallon Overworld South
|
||||||
|
0, // 01 Quarry Access
|
||||||
|
0, // 02 Main Quarry
|
||||||
|
0, // 03 Waste Disposal
|
||||||
|
0, // 04 Save Station Mines A
|
||||||
|
0, // 05 Security Access A
|
||||||
|
0, // 06 Ore Processing
|
||||||
|
0, // 07 Mine Security Station
|
||||||
|
0, // 08 Research Access
|
||||||
|
0, // 09 Storage Depot B
|
||||||
|
0, // 10 Elevator Access A
|
||||||
|
0, // 11 Security Access B
|
||||||
|
0, // 12 Storage Depot A
|
||||||
|
0, // 13 Elite Research
|
||||||
|
0, // 14 Elevator A
|
||||||
|
1, // 15 Elite Control Access
|
||||||
|
1, // 16 Elite Control
|
||||||
|
1, // 17 Maintenance Tunnel
|
||||||
|
1, // 18 Ventilation Shaft
|
||||||
|
2, // 19 Phazon Processing Center
|
||||||
|
1, // 20 Omega Research
|
||||||
|
2, // 21 Transport Access
|
||||||
|
2, // 22 Processing Center Access
|
||||||
|
1, // 23 Map Station Mines
|
||||||
|
1, // 24 Dynamo Access
|
||||||
|
2, // 25 Transport to Magmoor Caverns South
|
||||||
|
2, // 26 Elite Quarters
|
||||||
|
1, // 27 Central Dynamo
|
||||||
|
2, // 28 Elite Quarters Access
|
||||||
|
1, // 29 Quarantine Access A
|
||||||
|
1, // 30 Save Station Mines B
|
||||||
|
2, // 31 Metroid Quarantine B
|
||||||
|
1, // 32 Metroid Quarantine A
|
||||||
|
2, // 33 Quarantine Access B
|
||||||
|
2, // 34 Save Station Mines C
|
||||||
|
1, // 35 Elevator Access B
|
||||||
|
2, // 36 Fungal Hall B
|
||||||
|
1, // 37 Elevator B
|
||||||
|
2, // 38 Missile Station Mines
|
||||||
|
2, // 39 Phazon Mining Tunnel
|
||||||
|
2, // 40 Fungal Hall Access
|
||||||
|
2, // 41 Fungal Hall A
|
||||||
|
};
|
||||||
|
|
||||||
|
zeus::CTransform CMapArea::GetAreaPostTransform(const CWorld& world, TAreaId aid) const
|
||||||
|
{
|
||||||
|
if (world.IGetWorldAssetId() == g_ResFactory->TranslateOriginalToNew(0xB1AC4D65)) // Phazon Mines
|
||||||
|
{
|
||||||
|
const zeus::CTransform& areaXf = world.IGetAreaAlways(aid)->IGetTM();
|
||||||
|
const zeus::CVector3f& postVec = MinesPostTransforms[MinesPostTransformIndices[aid]];
|
||||||
|
return zeus::CTransform::Translate(postVec) * areaXf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return world.IGetAreaAlways(aid)->IGetTM();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CMapArea::CMapAreaSurface::PostConstruct(const void *)
|
void CMapArea::CMapAreaSurface::PostConstruct(const void *)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
class CWorld;
|
||||||
class CMapArea
|
class CMapArea
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -38,14 +39,14 @@ public:
|
||||||
CMapArea(CInputStream&, u32);
|
CMapArea(CInputStream&, u32);
|
||||||
void PostConstruct();
|
void PostConstruct();
|
||||||
bool GetIsVisibleToAutoMapper(bool, bool) const;
|
bool GetIsVisibleToAutoMapper(bool, bool) const;
|
||||||
zeus::CVector3f GetAreaCenterPoint() const;
|
zeus::CVector3f GetAreaCenterPoint() const { return x10_box.center(); }
|
||||||
zeus::CAABox GetBoundingBox() const;
|
zeus::CAABox GetBoundingBox() const;
|
||||||
const zeus::CVector3f& GetVertices() const;
|
const zeus::CVector3f& GetVertices() const;
|
||||||
void GetMappableObject(s32) const;
|
void GetMappableObject(s32) const;
|
||||||
void GetSurface(s32) const;
|
void GetSurface(s32) const;
|
||||||
u32 GetNumMappableObjects() const;
|
u32 GetNumMappableObjects() const;
|
||||||
u32 GetNumSurfaces() const;
|
u32 GetNumSurfaces() const;
|
||||||
|
zeus::CTransform GetAreaPostTransform(const CWorld& world, TAreaId aid) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
CFactoryFnReturn FMapAreaFactory(const SObjectTag& objTag, CInputStream& in, const CVParamTransfer&);
|
CFactoryFnReturn FMapAreaFactory(const SObjectTag& objTag, CInputStream& in, const CVParamTransfer&);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
zeus::CVector3f x64_ = zeus::CVector3f::skZero;
|
zeus::CVector3f x64_ = zeus::CVector3f::skZero;
|
||||||
public:
|
public:
|
||||||
CMapWorldData(CInputStream& in, u32 version);
|
CMapWorldData(CInputStream& in, u32 version);
|
||||||
ResId GetWorldAssetId() const;
|
ResId GetWorldAssetId() const { return x10_worldAssetId; }
|
||||||
zeus::CVector3f GetWorldCenterPoint() const;
|
zeus::CVector3f GetWorldCenterPoint() const;
|
||||||
std::string GetWorldLabel() const;
|
std::string GetWorldLabel() const;
|
||||||
zeus::CTransform GetWorldTransform() const;
|
zeus::CTransform GetWorldTransform() const;
|
||||||
|
@ -70,8 +70,8 @@ private:
|
||||||
zeus::CVector3f x20_ = zeus::CVector3f::skZero;
|
zeus::CVector3f x20_ = zeus::CVector3f::skZero;
|
||||||
public:
|
public:
|
||||||
CMapUniverse(CInputStream&, u32);
|
CMapUniverse(CInputStream&, u32);
|
||||||
void GetMapWorldData(s32) const;
|
const CMapWorldData& GetMapWorldData(s32 idx) const { return x10_worldDatas[idx]; }
|
||||||
u32 GetNumMapWorldDatas() const;
|
u32 GetNumMapWorldDatas() const { return x10_worldDatas.size(); }
|
||||||
float GetMapUniverseRadius() const;
|
float GetMapUniverseRadius() const;
|
||||||
zeus::CVector3f GetMapUniverseCenterPoint() const;
|
zeus::CVector3f GetMapUniverseCenterPoint() const;
|
||||||
void Draw(const CMapUniverseDrawParms&, const zeus::CVector3f&, float, float) const;
|
void Draw(const CMapUniverseDrawParms&, const zeus::CVector3f&, float, float) const;
|
||||||
|
|
|
@ -12,13 +12,9 @@ u32 CMapWorld::GetNumAreas() const
|
||||||
return x0_areas.size();
|
return x0_areas.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapWorld::GetLoadedMapArea(s32) const
|
const CMapArea* CMapWorld::GetMapArea(TAreaId aid) const
|
||||||
{
|
{
|
||||||
}
|
return x0_areas[aid].GetMapArea();
|
||||||
|
|
||||||
void CMapWorld::GetMapArea(s32) const
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapWorld::IsMapAreaInBFSInfoVector(const CMapWorld::CMapAreaData *, const std::vector<CMapWorld::CMapAreaBFSInfo> &) const
|
void CMapWorld::IsMapAreaInBFSInfoVector(const CMapWorld::CMapAreaData *, const std::vector<CMapWorld::CMapAreaBFSInfo> &) const
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
void Lock();
|
void Lock();
|
||||||
void Unlock();
|
void Unlock();
|
||||||
bool IsLoaded() const;
|
bool IsLoaded() const;
|
||||||
void GetMapArea() const;
|
const CMapArea* GetMapArea() const { return x0_area.IsLoaded() ? x0_area.GetObj() : nullptr; }
|
||||||
void GetNextMapAreaData() const;
|
void GetNextMapAreaData() const;
|
||||||
void GetContainingList() const;
|
void GetContainingList() const;
|
||||||
void NextMapAreaData();
|
void NextMapAreaData();
|
||||||
|
@ -88,8 +88,7 @@ private:
|
||||||
public:
|
public:
|
||||||
CMapWorld(CInputStream&);
|
CMapWorld(CInputStream&);
|
||||||
u32 GetNumAreas() const;
|
u32 GetNumAreas() const;
|
||||||
void GetLoadedMapArea(s32) const;
|
const CMapArea* GetMapArea(TAreaId) const;
|
||||||
void GetMapArea(s32) const;
|
|
||||||
void IsMapAreaInBFSInfoVector(const CMapAreaData*, const std::vector<CMapAreaBFSInfo>&) const;
|
void IsMapAreaInBFSInfoVector(const CMapAreaData*, const std::vector<CMapAreaBFSInfo>&) const;
|
||||||
void SetWhichMapAreasLoaded(const IWorld&, int start, int count);
|
void SetWhichMapAreasLoaded(const IWorld&, int start, int count);
|
||||||
bool IsMapAreasStreaming() const;
|
bool IsMapAreasStreaming() const;
|
||||||
|
|
|
@ -69,7 +69,7 @@ bool CMapWorldInfo::IsAreaVisted(TAreaId aid)
|
||||||
{
|
{
|
||||||
if (aid + 1 > x0_visitedAreasAllocated)
|
if (aid + 1 > x0_visitedAreasAllocated)
|
||||||
{
|
{
|
||||||
x4_visitedAreas.resize((aid + 31) / 32);
|
x4_visitedAreas.resize((aid + 32) / 32);
|
||||||
x0_visitedAreasAllocated = aid + 1;
|
x0_visitedAreasAllocated = aid + 1;
|
||||||
}
|
}
|
||||||
return (x4_visitedAreas[aid / 32] >> (aid % 32)) & 0x1;
|
return (x4_visitedAreas[aid / 32] >> (aid % 32)) & 0x1;
|
||||||
|
@ -79,7 +79,7 @@ void CMapWorldInfo::SetAreaVisited(TAreaId aid, bool visited)
|
||||||
{
|
{
|
||||||
if (aid + 1 > x0_visitedAreasAllocated)
|
if (aid + 1 > x0_visitedAreasAllocated)
|
||||||
{
|
{
|
||||||
x4_visitedAreas.resize((aid + 31) / 32);
|
x4_visitedAreas.resize((aid + 32) / 32);
|
||||||
x0_visitedAreasAllocated = aid + 1;
|
x0_visitedAreasAllocated = aid + 1;
|
||||||
}
|
}
|
||||||
if (visited)
|
if (visited)
|
||||||
|
@ -92,7 +92,7 @@ bool CMapWorldInfo::IsMapped(TAreaId aid)
|
||||||
{
|
{
|
||||||
if (aid + 1 > x14_mappedAreasAllocated)
|
if (aid + 1 > x14_mappedAreasAllocated)
|
||||||
{
|
{
|
||||||
x18_mappedAreas.resize((aid + 31) / 32);
|
x18_mappedAreas.resize((aid + 32) / 32);
|
||||||
x14_mappedAreasAllocated = aid + 1;
|
x14_mappedAreasAllocated = aid + 1;
|
||||||
}
|
}
|
||||||
return (x18_mappedAreas[aid / 32] >> (aid % 32)) & 0x1;
|
return (x18_mappedAreas[aid / 32] >> (aid % 32)) & 0x1;
|
||||||
|
@ -102,7 +102,7 @@ void CMapWorldInfo::SetIsMapped(TAreaId aid, bool mapped)
|
||||||
{
|
{
|
||||||
if (aid + 1 > x14_mappedAreasAllocated)
|
if (aid + 1 > x14_mappedAreasAllocated)
|
||||||
{
|
{
|
||||||
x18_mappedAreas.resize((aid + 31) / 32);
|
x18_mappedAreas.resize((aid + 32) / 32);
|
||||||
x14_mappedAreasAllocated = aid + 1;
|
x14_mappedAreasAllocated = aid + 1;
|
||||||
}
|
}
|
||||||
if (mapped)
|
if (mapped)
|
||||||
|
|
|
@ -65,7 +65,7 @@ CEntity* CObjectList::operator[](size_t i)
|
||||||
|
|
||||||
const CEntity* CObjectList::GetObjectById(TUniqueId uid) const
|
const CEntity* CObjectList::GetObjectById(TUniqueId uid) const
|
||||||
{
|
{
|
||||||
if (!uid)
|
if (uid == kInvalidUniqueId)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
const SObjectListEntry& ent = x0_list[uid & 0x3ff];
|
const SObjectListEntry& ent = x0_list[uid & 0x3ff];
|
||||||
if (ent.entity->x30_26_scriptingBlocked)
|
if (ent.entity->x30_26_scriptingBlocked)
|
||||||
|
@ -75,7 +75,7 @@ const CEntity* CObjectList::GetObjectById(TUniqueId uid) const
|
||||||
|
|
||||||
CEntity* CObjectList::GetObjectById(TUniqueId uid)
|
CEntity* CObjectList::GetObjectById(TUniqueId uid)
|
||||||
{
|
{
|
||||||
if (!uid)
|
if (uid == kInvalidUniqueId)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
SObjectListEntry& ent = x0_list[uid & 0x3ff];
|
SObjectListEntry& ent = x0_list[uid & 0x3ff];
|
||||||
if (ent.entity->x30_26_scriptingBlocked)
|
if (ent.entity->x30_26_scriptingBlocked)
|
||||||
|
|
|
@ -285,7 +285,13 @@ void CStateManager::RendererDrawCallback(const void* drawable, const void* ctx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CStateManager::RenderLast(TUniqueId) { return false; }
|
bool CStateManager::RenderLast(TUniqueId uid)
|
||||||
|
{
|
||||||
|
if (x86c_stateManagerContainer->xf39c_renderLast.size() == 20)
|
||||||
|
return false;
|
||||||
|
x86c_stateManagerContainer->xf39c_renderLast.push_back(uid);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CStateManager::AddDrawableActorPlane(const CActor& actor, const zeus::CPlane& plane,
|
void CStateManager::AddDrawableActorPlane(const CActor& actor, const zeus::CPlane& plane,
|
||||||
const zeus::CAABox& aabb) const
|
const zeus::CAABox& aabb) const
|
||||||
|
@ -632,10 +638,10 @@ void CStateManager::DrawWorld() const
|
||||||
|
|
||||||
if (thermal)
|
if (thermal)
|
||||||
{
|
{
|
||||||
if (x86c_stateManagerContainer->xf39c_.size())
|
if (x86c_stateManagerContainer->xf39c_renderLast.size())
|
||||||
{
|
{
|
||||||
CGraphics::SetDepthRange(0.015625f, 0.03125f);
|
CGraphics::SetDepthRange(0.015625f, 0.03125f);
|
||||||
for (TUniqueId id : x86c_stateManagerContainer->xf39c_)
|
for (TUniqueId id : x86c_stateManagerContainer->xf39c_renderLast)
|
||||||
if (const CActor* actor = static_cast<const CActor*>(GetObjectById(id)))
|
if (const CActor* actor = static_cast<const CActor*>(GetObjectById(id)))
|
||||||
if (actor->xe6_27_ & 0x2)
|
if (actor->xe6_27_ & 0x2)
|
||||||
actor->Render(*this);
|
actor->Render(*this);
|
||||||
|
@ -703,10 +709,10 @@ void CStateManager::DrawWorld() const
|
||||||
if (x84c_player)
|
if (x84c_player)
|
||||||
x84c_player->RenderGun(*this, x870_cameraManager->GetGlobalCameraTranslation(*this));
|
x84c_player->RenderGun(*this, x870_cameraManager->GetGlobalCameraTranslation(*this));
|
||||||
|
|
||||||
if (x86c_stateManagerContainer->xf39c_.size())
|
if (x86c_stateManagerContainer->xf39c_renderLast.size())
|
||||||
{
|
{
|
||||||
CGraphics::SetDepthRange(0.015625f, 0.03125f);
|
CGraphics::SetDepthRange(0.015625f, 0.03125f);
|
||||||
for (TUniqueId id : x86c_stateManagerContainer->xf39c_)
|
for (TUniqueId id : x86c_stateManagerContainer->xf39c_renderLast)
|
||||||
if (const CActor* actor = static_cast<const CActor*>(GetObjectById(id)))
|
if (const CActor* actor = static_cast<const CActor*>(GetObjectById(id)))
|
||||||
if (actor->xe6_27_ & 0x4)
|
if (actor->xe6_27_ & 0x4)
|
||||||
actor->Render(*this);
|
actor->Render(*this);
|
||||||
|
@ -772,7 +778,7 @@ void CStateManager::PreRender()
|
||||||
if (xf94_24_)
|
if (xf94_24_)
|
||||||
{
|
{
|
||||||
x86c_stateManagerContainer->xf370_.clear();
|
x86c_stateManagerContainer->xf370_.clear();
|
||||||
x86c_stateManagerContainer->xf39c_.clear();
|
x86c_stateManagerContainer->xf39c_renderLast.clear();
|
||||||
xf7c_projectedShadow = nullptr;
|
xf7c_projectedShadow = nullptr;
|
||||||
x850_world->PreRender();
|
x850_world->PreRender();
|
||||||
BuildDynamicLightListForWorld();
|
BuildDynamicLightListForWorld();
|
||||||
|
|
|
@ -109,7 +109,7 @@ class CStateManager
|
||||||
CRumbleManager xf250_rumbleManager;
|
CRumbleManager xf250_rumbleManager;
|
||||||
u32 xf344_ = 0;
|
u32 xf344_ = 0;
|
||||||
rstl::reserved_vector<TUniqueId, 20> xf370_;
|
rstl::reserved_vector<TUniqueId, 20> xf370_;
|
||||||
rstl::reserved_vector<TUniqueId, 20> xf39c_;
|
rstl::reserved_vector<TUniqueId, 20> xf39c_renderLast;
|
||||||
};
|
};
|
||||||
std::unique_ptr<CStateManagerContainer> x86c_stateManagerContainer;
|
std::unique_ptr<CStateManagerContainer> x86c_stateManagerContainer;
|
||||||
CCameraManager* x870_cameraManager = nullptr;
|
CCameraManager* x870_cameraManager = nullptr;
|
||||||
|
|
|
@ -317,7 +317,7 @@ void CModelData::RenderUnsortedParts(EWhichModel which, const zeus::CTransform&
|
||||||
const CActorLights* lights, const CModelFlags& drawFlags)
|
const CActorLights* lights, const CModelFlags& drawFlags)
|
||||||
{
|
{
|
||||||
if ((x14_25_sortThermal && which == EWhichModel::Thermal) ||
|
if ((x14_25_sortThermal && which == EWhichModel::Thermal) ||
|
||||||
x10_animData || !x1c_normalModel || drawFlags.m_blendMode > 2)
|
x10_animData || !x1c_normalModel || drawFlags.x0_blendMode > 2)
|
||||||
{
|
{
|
||||||
const_cast<CModelData*>(this)->x14_24_renderSorted = false;
|
const_cast<CModelData*>(this)->x14_24_renderSorted = false;
|
||||||
return;
|
return;
|
||||||
|
@ -342,7 +342,7 @@ void CModelData::Render(EWhichModel which, const zeus::CTransform& xf,
|
||||||
{
|
{
|
||||||
if (x14_25_sortThermal && which == EWhichModel::Thermal)
|
if (x14_25_sortThermal && which == EWhichModel::Thermal)
|
||||||
{
|
{
|
||||||
zeus::CColor mul(drawFlags.color.a, drawFlags.color.a, drawFlags.color.a, drawFlags.color.a);
|
zeus::CColor mul(drawFlags.x4_color.a, drawFlags.x4_color.a, drawFlags.x4_color.a, drawFlags.x4_color.a);
|
||||||
RenderThermal(xf, mul, {0.f, 0.f, 0.f, 0.25f});
|
RenderThermal(xf, mul, {0.f, 0.f, 0.f, 0.25f});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -437,19 +437,19 @@ void CBooRenderer::RenderFogVolumeModel(const zeus::CAABox& aabb, const CModel*
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
flags.m_extendedShader = EExtendedShader::SolidColorFrontfaceCullLEqualAlphaOnly;
|
flags.m_extendedShader = EExtendedShader::SolidColorFrontfaceCullLEqualAlphaOnly;
|
||||||
flags.color = zeus::CColor(1.f, 1.f, 1.f, 1.f);
|
flags.x4_color = zeus::CColor(1.f, 1.f, 1.f, 1.f);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
flags.m_extendedShader = EExtendedShader::SolidColorFrontfaceCullAlwaysAlphaOnly;
|
flags.m_extendedShader = EExtendedShader::SolidColorFrontfaceCullAlwaysAlphaOnly;
|
||||||
flags.color = zeus::CColor(1.f, 1.f, 1.f, 1.f);
|
flags.x4_color = zeus::CColor(1.f, 1.f, 1.f, 1.f);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly;
|
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly;
|
||||||
flags.color = zeus::CColor(1.f, 1.f, 1.f, 0.f);
|
flags.x4_color = zeus::CColor(1.f, 1.f, 1.f, 0.f);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullGreaterAlphaOnly;
|
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullGreaterAlphaOnly;
|
||||||
flags.color = zeus::CColor(1.f, 1.f, 1.f, 0.f);
|
flags.x4_color = zeus::CColor(1.f, 1.f, 1.f, 0.f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,7 +1004,7 @@ void CBooRenderer::DrawThermalModel(const CModel& model, const zeus::CColor& mul
|
||||||
{
|
{
|
||||||
CModelFlags flags;
|
CModelFlags flags;
|
||||||
flags.m_extendedShader = EExtendedShader::Thermal;
|
flags.m_extendedShader = EExtendedShader::Thermal;
|
||||||
flags.color = mulCol;
|
flags.x4_color = mulCol;
|
||||||
flags.addColor = addCol;
|
flags.addColor = addCol;
|
||||||
model.UpdateLastFrame();
|
model.UpdateLastFrame();
|
||||||
model.Draw(flags);
|
model.Draw(flags);
|
||||||
|
@ -1206,7 +1206,7 @@ int CBooRenderer::DrawOverlappingWorldModelIDs(int alphaVal, const std::vector<u
|
||||||
if (alphaVal > 255)
|
if (alphaVal > 255)
|
||||||
return alphaVal;
|
return alphaVal;
|
||||||
|
|
||||||
flags.color.a = alphaVal / 255.f;
|
flags.x4_color.a = alphaVal / 255.f;
|
||||||
const CBooModel& model = *item.x10_models[wordModel + j];
|
const CBooModel& model = *item.x10_models[wordModel + j];
|
||||||
const_cast<CBooModel&>(model).VerifyCurrentShader(0);
|
const_cast<CBooModel&>(model).VerifyCurrentShader(0);
|
||||||
for (const CBooSurface* surf = model.x38_firstUnsortedSurface; surf; surf = surf->m_next)
|
for (const CBooSurface* surf = model.x38_firstUnsortedSurface; surf; surf = surf->m_next)
|
||||||
|
@ -1227,7 +1227,7 @@ void CBooRenderer::DrawOverlappingWorldModelShadows(int alphaVal, const std::vec
|
||||||
const zeus::CAABox& aabb, float alpha) const
|
const zeus::CAABox& aabb, float alpha) const
|
||||||
{
|
{
|
||||||
CModelFlags flags;
|
CModelFlags flags;
|
||||||
flags.color.a = alpha;
|
flags.x4_color.a = alpha;
|
||||||
flags.m_extendedShader = EExtendedShader::MorphBallShadow; // Do shadow draw
|
flags.m_extendedShader = EExtendedShader::MorphBallShadow; // Do shadow draw
|
||||||
|
|
||||||
u32 curWord = 0;
|
u32 curWord = 0;
|
||||||
|
@ -1249,7 +1249,7 @@ void CBooRenderer::DrawOverlappingWorldModelShadows(int alphaVal, const std::vec
|
||||||
if (alphaVal > 255)
|
if (alphaVal > 255)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
flags.color.r = alphaVal / 255.f;
|
flags.x4_color.r = alphaVal / 255.f;
|
||||||
const CBooModel& model = *item.x10_models[wordModel + j];
|
const CBooModel& model = *item.x10_models[wordModel + j];
|
||||||
const_cast<CBooModel&>(model).VerifyCurrentShader(0);
|
const_cast<CBooModel&>(model).VerifyCurrentShader(0);
|
||||||
for (const CBooSurface* surf = model.x38_firstUnsortedSurface; surf; surf = surf->m_next)
|
for (const CBooSurface* surf = model.x38_firstUnsortedSurface; surf; surf = surf->m_next)
|
||||||
|
|
|
@ -23,18 +23,18 @@ class CModel;
|
||||||
|
|
||||||
struct CModelFlags
|
struct CModelFlags
|
||||||
{
|
{
|
||||||
u8 m_blendMode = 0; /* Blend state 3/5 enable additive */
|
u8 x0_blendMode = 0; /* Blend state 3/5 enable additive */
|
||||||
u8 m_matSetIdx = 0;
|
u8 x1_matSetIdx = 0;
|
||||||
EExtendedShader m_extendedShader = EExtendedShader::Flat;
|
EExtendedShader m_extendedShader = EExtendedShader::Flat;
|
||||||
u16 m_flags = 0; /* Flags */
|
u16 x2_flags = 0; /* Flags */
|
||||||
zeus::CColor color; /* Set into kcolor slot specified by material */
|
zeus::CColor x4_color; /* Set into kcolor slot specified by material */
|
||||||
zeus::CColor addColor = zeus::CColor::skClear;
|
zeus::CColor addColor = zeus::CColor::skClear;
|
||||||
zeus::CColor regColors[3];
|
zeus::CColor regColors[3];
|
||||||
zeus::CAABox mbShadowBox;
|
zeus::CAABox mbShadowBox;
|
||||||
|
|
||||||
CModelFlags() = default;
|
CModelFlags() = default;
|
||||||
CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)
|
CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)
|
||||||
: m_blendMode(blendMode), m_matSetIdx(shadIdx), m_flags(flags), color(col) {}
|
: x0_blendMode(blendMode), x1_matSetIdx(shadIdx), x2_flags(flags), x4_color(col) {}
|
||||||
|
|
||||||
/* Flags
|
/* Flags
|
||||||
0x4: render without texture lock
|
0x4: render without texture lock
|
||||||
|
|
|
@ -677,21 +677,21 @@ void CBooModel::UpdateUniformData(const CModelFlags& flags,
|
||||||
if (flags.m_extendedShader == EExtendedShader::Thermal) /* Thermal Model (same as UV Mode 0) */
|
if (flags.m_extendedShader == EExtendedShader::Thermal) /* Thermal Model (same as UV Mode 0) */
|
||||||
{
|
{
|
||||||
CModelShaders::ThermalUniform& thermalOut = *reinterpret_cast<CModelShaders::ThermalUniform*>(dataCur);
|
CModelShaders::ThermalUniform& thermalOut = *reinterpret_cast<CModelShaders::ThermalUniform*>(dataCur);
|
||||||
thermalOut.mulColor = flags.color;
|
thermalOut.mulColor = flags.x4_color;
|
||||||
thermalOut.addColor = flags.addColor;
|
thermalOut.addColor = flags.addColor;
|
||||||
}
|
}
|
||||||
else if (flags.m_extendedShader >= EExtendedShader::SolidColor &&
|
else if (flags.m_extendedShader >= EExtendedShader::SolidColor &&
|
||||||
flags.m_extendedShader <= EExtendedShader::SolidColorBackfaceCullGreaterAlphaOnly) /* Solid color render */
|
flags.m_extendedShader <= EExtendedShader::SolidColorBackfaceCullGreaterAlphaOnly) /* Solid color render */
|
||||||
{
|
{
|
||||||
CModelShaders::SolidUniform& solidOut = *reinterpret_cast<CModelShaders::SolidUniform*>(dataCur);
|
CModelShaders::SolidUniform& solidOut = *reinterpret_cast<CModelShaders::SolidUniform*>(dataCur);
|
||||||
solidOut.solidColor = flags.color;
|
solidOut.solidColor = flags.x4_color;
|
||||||
}
|
}
|
||||||
else if (flags.m_extendedShader == EExtendedShader::MorphBallShadow) /* MorphBall shadow render */
|
else if (flags.m_extendedShader == EExtendedShader::MorphBallShadow) /* MorphBall shadow render */
|
||||||
{
|
{
|
||||||
CModelShaders::MBShadowUniform& shadowOut = *reinterpret_cast<CModelShaders::MBShadowUniform*>(dataCur);
|
CModelShaders::MBShadowUniform& shadowOut = *reinterpret_cast<CModelShaders::MBShadowUniform*>(dataCur);
|
||||||
shadowOut.shadowUp = CGraphics::g_GXModelView * zeus::CVector3f::skUp;
|
shadowOut.shadowUp = CGraphics::g_GXModelView * zeus::CVector3f::skUp;
|
||||||
shadowOut.shadowUp.w = flags.color.a;
|
shadowOut.shadowUp.w = flags.x4_color.a;
|
||||||
shadowOut.shadowId = flags.color.r;
|
shadowOut.shadowId = flags.x4_color.r;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -700,7 +700,7 @@ void CBooModel::UpdateUniformData(const CModelFlags& flags,
|
||||||
lightingOut.colorRegs[0] = flags.regColors[0];
|
lightingOut.colorRegs[0] = flags.regColors[0];
|
||||||
lightingOut.colorRegs[1] = flags.regColors[1];
|
lightingOut.colorRegs[1] = flags.regColors[1];
|
||||||
lightingOut.colorRegs[2] = flags.regColors[2];
|
lightingOut.colorRegs[2] = flags.regColors[2];
|
||||||
lightingOut.mulColor = flags.color;
|
lightingOut.mulColor = flags.x4_color;
|
||||||
lightingOut.fog = CGraphics::g_Fog;
|
lightingOut.fog = CGraphics::g_Fog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,19 +863,19 @@ void CBooModel::Touch(int shaderIdx) const
|
||||||
|
|
||||||
void CModel::DrawSortedParts(const CModelFlags& flags) const
|
void CModel::DrawSortedParts(const CModelFlags& flags) const
|
||||||
{
|
{
|
||||||
const_cast<CBooModel&>(*x28_modelInst).VerifyCurrentShader(flags.m_matSetIdx);
|
const_cast<CBooModel&>(*x28_modelInst).VerifyCurrentShader(flags.x1_matSetIdx);
|
||||||
x28_modelInst->DrawAlpha(flags, nullptr, nullptr);
|
x28_modelInst->DrawAlpha(flags, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModel::DrawUnsortedParts(const CModelFlags& flags) const
|
void CModel::DrawUnsortedParts(const CModelFlags& flags) const
|
||||||
{
|
{
|
||||||
const_cast<CBooModel&>(*x28_modelInst).VerifyCurrentShader(flags.m_matSetIdx);
|
const_cast<CBooModel&>(*x28_modelInst).VerifyCurrentShader(flags.x1_matSetIdx);
|
||||||
x28_modelInst->DrawNormal(flags, nullptr, nullptr);
|
x28_modelInst->DrawNormal(flags, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModel::Draw(const CModelFlags& flags) const
|
void CModel::Draw(const CModelFlags& flags) const
|
||||||
{
|
{
|
||||||
const_cast<CBooModel&>(*x28_modelInst).VerifyCurrentShader(flags.m_matSetIdx);
|
const_cast<CBooModel&>(*x28_modelInst).VerifyCurrentShader(flags.x1_matSetIdx);
|
||||||
x28_modelInst->Draw(flags, nullptr, nullptr);
|
x28_modelInst->Draw(flags, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ namespace urde
|
||||||
CGuiFrame::CGuiFrame(ResId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp)
|
CGuiFrame::CGuiFrame(ResId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp)
|
||||||
: x0_id(id), x8_guiSys(sys), x4c_a(a), x50_b(b), x54_c(c), x58_24_loaded(false)
|
: x0_id(id), x8_guiSys(sys), x4c_a(a), x50_b(b), x54_c(c), x58_24_loaded(false)
|
||||||
{
|
{
|
||||||
x3c_lights.resize(8);
|
x3c_lights.reserve(8);
|
||||||
|
m_indexedLights.reserve(8);
|
||||||
x10_rootWidget.reset(new CGuiWidget(
|
x10_rootWidget.reset(new CGuiWidget(
|
||||||
CGuiWidget::CGuiWidgetParms(this, false, 0, 0, false, false, false, zeus::CColor::skWhite,
|
CGuiWidget::CGuiWidgetParms(this, false, 0, 0, false, false, false, zeus::CColor::skWhite,
|
||||||
CGuiWidget::EGuiModelDrawFlags::Alpha, false,
|
CGuiWidget::EGuiModelDrawFlags::Alpha, false,
|
||||||
|
@ -56,8 +57,14 @@ void CGuiFrame::EnableLights(u32 lights) const
|
||||||
zeus::CColor accumColor(zeus::CColor::skBlack);
|
zeus::CColor accumColor(zeus::CColor::skBlack);
|
||||||
ERglLight lightId = ERglLight::Zero;
|
ERglLight lightId = ERglLight::Zero;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (auto& light : x3c_lights)
|
for (auto& light : m_indexedLights)
|
||||||
{
|
{
|
||||||
|
if (!light)
|
||||||
|
{
|
||||||
|
++reinterpret_cast<std::underlying_type_t<ERglLight>&>(lightId);
|
||||||
|
++idx;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ((lights & (1 << idx)) != 0)
|
if ((lights & (1 << idx)) != 0)
|
||||||
{
|
{
|
||||||
// accumulate color
|
// accumulate color
|
||||||
|
@ -68,7 +75,7 @@ void CGuiFrame::EnableLights(u32 lights) const
|
||||||
++reinterpret_cast<std::underlying_type_t<ERglLight>&>(lightId);
|
++reinterpret_cast<std::underlying_type_t<ERglLight>&>(lightId);
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
if (x3c_lights.empty())
|
if (m_indexedLights.empty())
|
||||||
CGraphics::SetAmbientColor(zeus::CColor::skWhite);
|
CGraphics::SetAmbientColor(zeus::CColor::skWhite);
|
||||||
else
|
else
|
||||||
CGraphics::SetAmbientColor(accumColor);
|
CGraphics::SetAmbientColor(accumColor);
|
||||||
|
@ -81,12 +88,17 @@ void CGuiFrame::DisableLights() const
|
||||||
|
|
||||||
void CGuiFrame::RemoveLight(CGuiLight* light)
|
void CGuiFrame::RemoveLight(CGuiLight* light)
|
||||||
{
|
{
|
||||||
x3c_lights[light->GetLoadedIdx()].reset();
|
m_indexedLights[light->GetLoadedIdx()] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuiFrame::AddLight(std::shared_ptr<CGuiLight>&& light)
|
void CGuiFrame::AddLight(CGuiLight* light)
|
||||||
{
|
{
|
||||||
x3c_lights[light->GetLoadedIdx()] = std::move(light);
|
m_indexedLights[light->GetLoadedIdx()] = light;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGuiFrame::RegisterLight(std::shared_ptr<CGuiLight>&& light)
|
||||||
|
{
|
||||||
|
x3c_lights.push_back(std::move(light));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGuiFrame::GetIsFinishedLoading() const
|
bool CGuiFrame::GetIsFinishedLoading() const
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "CGuiHeadWidget.hpp"
|
#include "CGuiHeadWidget.hpp"
|
||||||
#include "CGuiWidgetIdDB.hpp"
|
#include "CGuiWidgetIdDB.hpp"
|
||||||
#include "IObj.hpp"
|
#include "IObj.hpp"
|
||||||
|
#include <array>
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -30,6 +31,7 @@ private:
|
||||||
CGuiWidgetIdDB x18_idDB;
|
CGuiWidgetIdDB x18_idDB;
|
||||||
std::vector<std::shared_ptr<CGuiWidget>> x2c_widgets;
|
std::vector<std::shared_ptr<CGuiWidget>> x2c_widgets;
|
||||||
std::vector<std::shared_ptr<CGuiLight>> x3c_lights;
|
std::vector<std::shared_ptr<CGuiLight>> x3c_lights;
|
||||||
|
std::vector<CGuiLight*> m_indexedLights;
|
||||||
int x4c_a;
|
int x4c_a;
|
||||||
int x50_b;
|
int x50_b;
|
||||||
int x54_c;
|
int x54_c;
|
||||||
|
@ -44,7 +46,7 @@ public:
|
||||||
|
|
||||||
CGuiSys& GetGuiSys() {return x8_guiSys;}
|
CGuiSys& GetGuiSys() {return x8_guiSys;}
|
||||||
|
|
||||||
CGuiLight* GetFrameLight(int idx) const { return x3c_lights[idx].get(); }
|
CGuiLight* GetFrameLight(int idx) const { return m_indexedLights[idx]; }
|
||||||
CGuiCamera* GetFrameCamera() const { return x14_camera.get(); }
|
CGuiCamera* GetFrameCamera() const { return x14_camera.get(); }
|
||||||
CGuiWidget* FindWidget(const std::string& name) const;
|
CGuiWidget* FindWidget(const std::string& name) const;
|
||||||
CGuiWidget* FindWidget(s16 id) const;
|
CGuiWidget* FindWidget(s16 id) const;
|
||||||
|
@ -55,7 +57,8 @@ public:
|
||||||
void EnableLights(u32 lights) const;
|
void EnableLights(u32 lights) const;
|
||||||
void DisableLights() const;
|
void DisableLights() const;
|
||||||
void RemoveLight(CGuiLight* light);
|
void RemoveLight(CGuiLight* light);
|
||||||
void AddLight(std::shared_ptr<CGuiLight>&& light);
|
void AddLight(CGuiLight* light);
|
||||||
|
void RegisterLight(std::shared_ptr<CGuiLight>&& light);
|
||||||
bool GetIsFinishedLoading() const;
|
bool GetIsFinishedLoading() const;
|
||||||
void Touch() const;
|
void Touch() const;
|
||||||
const zeus::CTransform& GetAspectTransform() const { return m_aspectTransform; }
|
const zeus::CTransform& GetAspectTransform() const { return m_aspectTransform; }
|
||||||
|
|
|
@ -48,7 +48,7 @@ CLight CGuiLight::BuildLight() const
|
||||||
void CGuiLight::SetIsVisible(bool vis)
|
void CGuiLight::SetIsVisible(bool vis)
|
||||||
{
|
{
|
||||||
if (vis)
|
if (vis)
|
||||||
xb0_frame->AddLight(shared_from_this());
|
xb0_frame->AddLight(this);
|
||||||
else
|
else
|
||||||
xb0_frame->RemoveLight(this);
|
xb0_frame->RemoveLight(this);
|
||||||
CGuiWidget::SetIsVisible(vis);
|
CGuiWidget::SetIsVisible(vis);
|
||||||
|
@ -100,7 +100,8 @@ std::shared_ptr<CGuiWidget> CGuiLight::Create(CGuiFrame* frame, CInputStream& in
|
||||||
}
|
}
|
||||||
|
|
||||||
ret->ParseBaseInfo(frame, in, parms);
|
ret->ParseBaseInfo(frame, in, parms);
|
||||||
frame->AddLight(ret->shared_from_this());
|
frame->RegisterLight(ret->shared_from_this());
|
||||||
|
frame->AddLight(ret.get());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,10 +96,10 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
|
||||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
|
|
||||||
flags.m_blendMode = 5;
|
flags.x0_blendMode = 5;
|
||||||
flags.m_matSetIdx = 0;
|
flags.x1_matSetIdx = 0;
|
||||||
flags.m_flags = (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest);
|
flags.x2_flags = (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest);
|
||||||
flags.color = moduCol;
|
flags.x4_color = moduCol;
|
||||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -235,7 +235,7 @@ CInGameGuiManager::CInGameGuiManager(CStateManager& stateMgr,
|
||||||
|
|
||||||
xc8_inGameGuiDGRPs.reserve(14);
|
xc8_inGameGuiDGRPs.reserve(14);
|
||||||
for (int i=0 ; i<14 ; ++i)
|
for (int i=0 ; i<14 ; ++i)
|
||||||
xc8_inGameGuiDGRPs.push_back(g_SimplePool->GetObj(PauseScreenDGRPs[i]));
|
xc8_inGameGuiDGRPs.push_back(g_SimplePool->GetObj(InGameGuiDGRPs[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CInGameGuiManager::CheckLoadComplete(CStateManager& stateMgr)
|
bool CInGameGuiManager::CheckLoadComplete(CStateManager& stateMgr)
|
||||||
|
|
|
@ -302,6 +302,17 @@ float CActor::GetPitch() const { return zeus::CQuaternion(x34_transform.buildMat
|
||||||
|
|
||||||
float CActor::GetYaw() const { return zeus::CQuaternion(x34_transform.buildMatrix3f()).yaw(); }
|
float CActor::GetYaw() const { return zeus::CQuaternion(x34_transform.buildMatrix3f()).yaw(); }
|
||||||
|
|
||||||
|
void CActor::EnsureRendered(const CStateManager& stateMgr, const zeus::CVector3f& pos,
|
||||||
|
const zeus::CAABox& aabb) const
|
||||||
|
{
|
||||||
|
if (x64_modelData)
|
||||||
|
{
|
||||||
|
x64_modelData->RenderUnsortedParts(x64_modelData->GetRenderingModel(stateMgr),
|
||||||
|
x34_transform, x90_actorLights.get(), xb4_drawFlags);
|
||||||
|
}
|
||||||
|
stateMgr.AddDrawableActor(*this, pos, aabb);
|
||||||
|
}
|
||||||
|
|
||||||
SAdvancementDeltas CActor::UpdateAnimation(float, CStateManager&, bool)
|
SAdvancementDeltas CActor::UpdateAnimation(float, CStateManager&, bool)
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
|
@ -319,7 +330,7 @@ bool CActor::CanDrawStatic() const
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (x64_modelData && x64_modelData->HasNormalModel())
|
if (x64_modelData && x64_modelData->HasNormalModel())
|
||||||
return xb4_ <= 4;
|
return xb4_drawFlags.x0_blendMode <= 4;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,10 +38,7 @@ protected:
|
||||||
std::unique_ptr<CSimpleShadow> x94_simpleShadow;
|
std::unique_ptr<CSimpleShadow> x94_simpleShadow;
|
||||||
std::unique_ptr<TToken<CScannableObjectInfo>> x98_scanObjectInfo;
|
std::unique_ptr<TToken<CScannableObjectInfo>> x98_scanObjectInfo;
|
||||||
zeus::CAABox x9c_aabox;
|
zeus::CAABox x9c_aabox;
|
||||||
u8 xb4_ = 0;
|
CModelFlags xb4_drawFlags;
|
||||||
u8 xb5_ = 0;
|
|
||||||
u16 xb6_ = 3;
|
|
||||||
zeus::CColor xb8_ = zeus::CColor::skWhite;
|
|
||||||
float xbc_time = 0.f;
|
float xbc_time = 0.f;
|
||||||
s32 xc0_ = 0;
|
s32 xc0_ = 0;
|
||||||
TUniqueId xc4_fluidId = kInvalidUniqueId;
|
TUniqueId xc4_fluidId = kInvalidUniqueId;
|
||||||
|
@ -158,7 +155,7 @@ public:
|
||||||
const CModelData* GetModelData() const { return x64_modelData.get(); }
|
const CModelData* GetModelData() const { return x64_modelData.get(); }
|
||||||
CModelData* ModelData() { return x64_modelData.get(); }
|
CModelData* ModelData() { return x64_modelData.get(); }
|
||||||
void EnsureRendered(const CStateManager&);
|
void EnsureRendered(const CStateManager&);
|
||||||
void EnsureRendered(const CStateManager&, const zeus::CVector3f&, const zeus::CVector3f&);
|
void EnsureRendered(const CStateManager&, const zeus::CVector3f&, const zeus::CAABox&) const;
|
||||||
SAdvancementDeltas UpdateAnimation(float, CStateManager&, bool);
|
SAdvancementDeltas UpdateAnimation(float, CStateManager&, bool);
|
||||||
void SetActorLights(std::unique_ptr<CActorLights>);
|
void SetActorLights(std::unique_ptr<CActorLights>);
|
||||||
bool CanDrawStatic() const;
|
bool CanDrawStatic() const;
|
||||||
|
|
|
@ -91,6 +91,7 @@ set(WORLD_SOURCES
|
||||||
CScriptStreamedMusic.hpp CScriptStreamedMusic.cpp
|
CScriptStreamedMusic.hpp CScriptStreamedMusic.cpp
|
||||||
CScriptRoomAcoustics.hpp CScriptRoomAcoustics.cpp
|
CScriptRoomAcoustics.hpp CScriptRoomAcoustics.cpp
|
||||||
CScriptControllerAction.hpp CScriptControllerAction.cpp
|
CScriptControllerAction.hpp CScriptControllerAction.cpp
|
||||||
|
CVisorFlare.hpp CVisorFlare.cpp
|
||||||
CGrappleParameters.hpp
|
CGrappleParameters.hpp
|
||||||
CActorParameters.hpp
|
CActorParameters.hpp
|
||||||
CLightParameters.hpp
|
CLightParameters.hpp
|
||||||
|
|
|
@ -81,7 +81,7 @@ void CMorphBallShadow::RenderIdBuffer(const zeus::CAABox& aabb, const CStateMana
|
||||||
CModelFlags flags(0, 0, 3, zeus::CColor{1.f, 1.f, 1.f, alphaVal / 255.f});
|
CModelFlags flags(0, 0, 3, zeus::CColor{1.f, 1.f, 1.f, alphaVal / 255.f});
|
||||||
flags.m_extendedShader = EExtendedShader::SolidColor; // Do solid color draw
|
flags.m_extendedShader = EExtendedShader::SolidColor; // Do solid color draw
|
||||||
const CBooModel& model = *modelData->PickStaticModel(CModelData::EWhichModel::Normal);
|
const CBooModel& model = *modelData->PickStaticModel(CModelData::EWhichModel::Normal);
|
||||||
const_cast<CBooModel&>(model).VerifyCurrentShader(flags.m_matSetIdx);
|
const_cast<CBooModel&>(model).VerifyCurrentShader(flags.x1_matSetIdx);
|
||||||
model.DrawNormal(flags, nullptr, nullptr);
|
model.DrawNormal(flags, nullptr, nullptr);
|
||||||
alphaVal += 4;
|
alphaVal += 4;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ void CMorphBallShadow::Render(const CStateManager& mgr, float alpha)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CModelFlags flags;
|
CModelFlags flags;
|
||||||
flags.color.a = alpha;
|
flags.x4_color.a = alpha;
|
||||||
flags.m_extendedShader = EExtendedShader::MorphBallShadow;
|
flags.m_extendedShader = EExtendedShader::MorphBallShadow;
|
||||||
|
|
||||||
int alphaVal = 4;
|
int alphaVal = 4;
|
||||||
|
@ -138,9 +138,9 @@ void CMorphBallShadow::Render(const CStateManager& mgr, float alpha)
|
||||||
zeus::CTransform modelXf = actor->GetTransform() * zeus::CTransform::Scale(modelData->GetScale());
|
zeus::CTransform modelXf = actor->GetTransform() * zeus::CTransform::Scale(modelData->GetScale());
|
||||||
CGraphics::SetModelMatrix(modelXf);
|
CGraphics::SetModelMatrix(modelXf);
|
||||||
|
|
||||||
flags.color.r = alphaVal / 255.f;
|
flags.x4_color.r = alphaVal / 255.f;
|
||||||
const CBooModel& model = *modelData->PickStaticModel(CModelData::EWhichModel::Normal);
|
const CBooModel& model = *modelData->PickStaticModel(CModelData::EWhichModel::Normal);
|
||||||
const_cast<CBooModel&>(model).VerifyCurrentShader(flags.m_matSetIdx);
|
const_cast<CBooModel&>(model).VerifyCurrentShader(flags.x1_matSetIdx);
|
||||||
model.DrawNormal(flags, nullptr, nullptr);
|
model.DrawNormal(flags, nullptr, nullptr);
|
||||||
alphaVal += 4;
|
alphaVal += 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,12 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox&
|
||||||
MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(mass), CActorParameters::None(), stepUp,
|
MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(mass), CActorParameters::None(), stepUp,
|
||||||
stepDown), x7d0_animRes(resId, 0, playerScale, 0, true)
|
stepDown), x7d0_animRes(resId, 0, playerScale, 0, true)
|
||||||
{
|
{
|
||||||
|
x490_gun.reset(new CPlayerGun(uid));
|
||||||
x768_morphball.reset(new CMorphBall(*this, f4));
|
x768_morphball.reset(new CMorphBall(*this, f4));
|
||||||
|
x76c_cameraBob.reset(new CPlayerCameraBob(CPlayerCameraBob::ECameraBobType::One,
|
||||||
|
zeus::CVector2f{CPlayerCameraBob::kCameraBobExtentX,
|
||||||
|
CPlayerCameraBob::kCameraBobExtentY},
|
||||||
|
CPlayerCameraBob::kCameraBobPeriod));
|
||||||
x9c4_26_ = true;
|
x9c4_26_ = true;
|
||||||
x9c4_27_ = true;
|
x9c4_27_ = true;
|
||||||
x9c4_28_ = true;
|
x9c4_28_ = true;
|
||||||
|
|
|
@ -162,7 +162,7 @@ private:
|
||||||
zeus::CVector3f x480_ = zeus::CVector3f::skZero;
|
zeus::CVector3f x480_ = zeus::CVector3f::skZero;
|
||||||
float x48c_ = 0.f;
|
float x48c_ = 0.f;
|
||||||
std::unique_ptr<CPlayerGun> x490_gun;
|
std::unique_ptr<CPlayerGun> x490_gun;
|
||||||
float x494_ = 1.f;
|
float x494_mapAlpha = 1.f;
|
||||||
float x49c_; /* Value retrieved from TweakPlayerGun */
|
float x49c_; /* Value retrieved from TweakPlayerGun */
|
||||||
// std::unqiue_ptr<> x4a0_;
|
// std::unqiue_ptr<> x4a0_;
|
||||||
u32 x4a4_ = 0;
|
u32 x4a4_ = 0;
|
||||||
|
@ -411,6 +411,7 @@ public:
|
||||||
float GetDampedClampedVelocityWR() const;
|
float GetDampedClampedVelocityWR() const;
|
||||||
const CVisorSteam& GetVisorSteam() const { return x7a0_visorSteam; }
|
const CVisorSteam& GetVisorSteam() const { return x7a0_visorSteam; }
|
||||||
float Get74C() const { return x74c_; }
|
float Get74C() const { return x74c_; }
|
||||||
|
float GetMapAlpha() const { return x494_mapAlpha; }
|
||||||
void UpdateCinematicState(CStateManager& mgr);
|
void UpdateCinematicState(CStateManager& mgr);
|
||||||
CPlayerGun* GetPlayerGun() const { return x490_gun.get(); }
|
CPlayerGun* GetPlayerGun() const { return x490_gun.get(); }
|
||||||
CMorphBall* GetMorphBall() const { return x768_morphball.get(); }
|
CMorphBall* GetMorphBall() const { return x768_morphball.get(); }
|
||||||
|
|
|
@ -32,7 +32,6 @@ public:
|
||||||
Eight
|
Eight
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
|
||||||
static float kCameraBobExtentX;
|
static float kCameraBobExtentX;
|
||||||
static float kCameraBobExtentY;
|
static float kCameraBobExtentY;
|
||||||
static float kCameraBobPeriod;
|
static float kCameraBobPeriod;
|
||||||
|
@ -49,6 +48,7 @@ private:
|
||||||
static float kHelmetBobMagnitude;
|
static float kHelmetBobMagnitude;
|
||||||
static const float kLandingBobDamping;
|
static const float kLandingBobDamping;
|
||||||
|
|
||||||
|
private:
|
||||||
ECameraBobType x0_type;
|
ECameraBobType x0_type;
|
||||||
zeus::CVector2f x4_vec;
|
zeus::CVector2f x4_vec;
|
||||||
float xc_;
|
float xc_;
|
||||||
|
|
|
@ -135,37 +135,37 @@ void CScriptActor::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum)
|
||||||
zeus::CColor col(1.f, 1.f, x2dc_xrayAlpha);
|
zeus::CColor col(1.f, 1.f, x2dc_xrayAlpha);
|
||||||
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay)
|
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay)
|
||||||
{
|
{
|
||||||
xb4_ = 5;
|
xb4_drawFlags.x0_blendMode = 5;
|
||||||
xb5_ = 0;
|
xb4_drawFlags.x1_matSetIdx = 0;
|
||||||
xb6_ = 3;
|
xb4_drawFlags.x2_flags = 3;
|
||||||
xb8_ = col;
|
xb4_drawFlags.x4_color = col;
|
||||||
x2e2_28_ = true;
|
x2e2_28_ = true;
|
||||||
}
|
}
|
||||||
|
else if (x2e2_28_)
|
||||||
if (x2e2_28_)
|
|
||||||
{
|
{
|
||||||
x2e2_28_ = false;
|
x2e2_28_ = false;
|
||||||
if (xb4_ != 5 && xb5_ != 0 && xb4_ != 3 && xb8_ != col)
|
if (xb4_drawFlags.x0_blendMode != 5 && xb4_drawFlags.x1_matSetIdx != 0 &&
|
||||||
|
xb4_drawFlags.x2_flags != 3 && xb4_drawFlags.x4_color != col)
|
||||||
{
|
{
|
||||||
xb4_ = 5;
|
xb4_drawFlags.x0_blendMode = 5;
|
||||||
xb5_ = 0;
|
xb4_drawFlags.x1_matSetIdx = 0;
|
||||||
xb6_ = 3;
|
xb4_drawFlags.x2_flags = 3;
|
||||||
xb8_ = col;
|
xb4_drawFlags.x4_color = col;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!x2e2_24_ && xe6_27_ == 2 &&
|
if (!x2e2_24_ && xe6_27_ == 2 &&
|
||||||
mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay)
|
mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay)
|
||||||
{
|
{
|
||||||
xb6_ &= ~3;
|
xb4_drawFlags.x2_flags &= ~3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xb6_ |= 3;
|
xb4_drawFlags.x2_flags |= 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x2d8_ != 0)
|
if (x2d8_ != 0)
|
||||||
xb5_ = 0;
|
xb4_drawFlags.x1_matSetIdx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mgr.GetObjectById(x2e0_triggerId) == nullptr)
|
if (mgr.GetObjectById(x2e0_triggerId) == nullptr)
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#include "CScriptVisorFlare.hpp"
|
||||||
|
#include "CActorParameters.hpp"
|
||||||
|
#include "TCastTo.hpp"
|
||||||
|
#include "CStateManager.hpp"
|
||||||
|
#include "CPlayer.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
CScriptVisorFlare::CScriptVisorFlare(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
|
bool active, const zeus::CVector3f& pos, CVisorFlare::EBlendMode blendMode,
|
||||||
|
bool b1, float f1, float f2, float f3, u32 w1, u32 w2,
|
||||||
|
const std::vector<CVisorFlare::CFlareDef>& flares)
|
||||||
|
: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(),
|
||||||
|
CMaterialList(EMaterialTypes::Unknown), CActorParameters::None(), kInvalidUniqueId),
|
||||||
|
xe8_flare(blendMode, b1, f1, f2, f3, w1, w2, flares)
|
||||||
|
{
|
||||||
|
xe6_27_ = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptVisorFlare::Accept(IVisitor& visitor)
|
||||||
|
{
|
||||||
|
visitor.Visit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptVisorFlare::Think(float dt, CStateManager& stateMgr)
|
||||||
|
{
|
||||||
|
if (GetActive())
|
||||||
|
xe8_flare.Update(dt, GetTranslation(), this, stateMgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptVisorFlare::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
|
||||||
|
{
|
||||||
|
CActor::AcceptScriptMsg(msg, objId, stateMgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptVisorFlare::PreRender(CStateManager& stateMgr, const zeus::CFrustum&)
|
||||||
|
{
|
||||||
|
x11c_notInRenderLast = !stateMgr.RenderLast(x8_uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptVisorFlare::AddToRenderer(const zeus::CFrustum&, const CStateManager& stateMgr) const
|
||||||
|
{
|
||||||
|
if (x11c_notInRenderLast)
|
||||||
|
EnsureRendered(stateMgr, stateMgr.GetPlayer().GetTranslation(), GetSortingBounds(stateMgr));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptVisorFlare::Render(const CStateManager& stateMgr) const
|
||||||
|
{
|
||||||
|
xe8_flare.Render(GetTranslation(), stateMgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
#ifndef __URDE_CSCRIPTVISORFLARE_HPP__
|
||||||
|
#define __URDE_CSCRIPTVISORFLARE_HPP__
|
||||||
|
|
||||||
|
#include "CActor.hpp"
|
||||||
|
#include "CVisorFlare.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
class CScriptVisorFlare : public CActor
|
||||||
|
{
|
||||||
|
CVisorFlare xe8_flare;
|
||||||
|
bool x11c_notInRenderLast = true;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CScriptVisorFlare(TUniqueId, const std::string& name, const CEntityInfo& info,
|
||||||
|
bool, const zeus::CVector3f&, CVisorFlare::EBlendMode blendMode,
|
||||||
|
bool, float, float, float, u32, u32,
|
||||||
|
const std::vector<CVisorFlare::CFlareDef>& flares);
|
||||||
|
|
||||||
|
void Accept(IVisitor& visitor);
|
||||||
|
void Think(float, CStateManager& stateMgr);
|
||||||
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
|
||||||
|
void PreRender(CStateManager&, const zeus::CFrustum&);
|
||||||
|
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
|
||||||
|
void Render(const CStateManager&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CSCRIPTVISORFLARE_HPP__
|
|
@ -0,0 +1,42 @@
|
||||||
|
#include "CVisorFlare.hpp"
|
||||||
|
#include "CSimplePool.hpp"
|
||||||
|
#include "GameGlobalObjects.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
std::experimental::optional<CVisorFlare::CFlareDef> CVisorFlare::LoadFlareDef(CInputStream& in)
|
||||||
|
{
|
||||||
|
u32 propCount = in.readUint32Big();
|
||||||
|
if (propCount != 4)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
u32 txtrId = in.readUint32Big();
|
||||||
|
float f1 = in.readFloatBig();
|
||||||
|
float f2 = in.readFloatBig();
|
||||||
|
zeus::CColor color = zeus::CColor::ReadRGBABig(in);
|
||||||
|
if (txtrId == -1)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
TToken<CTexture> tex = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), txtrId});
|
||||||
|
|
||||||
|
return CFlareDef(tex, f1, f2, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
CVisorFlare::CVisorFlare(EBlendMode blendMode, bool b1, float f1, float f2, float f3, u32 w1, u32 w2,
|
||||||
|
const std::vector<CFlareDef>& flares)
|
||||||
|
: x0_blendMode(blendMode), x4_flareDefs(flares), x14_b1(b1), x18_f1(std::max(f1, 0.0001f)),
|
||||||
|
x1c_f2(f2), x20_f3(f3), x2c_w1(w1), x30_w2(w2)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void CVisorFlare::Update(float dt, const zeus::CVector3f& pos, const CActor* act, CStateManager& mgr)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CVisorFlare::Render(const zeus::CVector3f& pos, const CStateManager& mgr) const
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
#ifndef __URDE_CVISORFLARE_HPP__
|
||||||
|
#define __URDE_CVISORFLARE_HPP__
|
||||||
|
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
#include "CToken.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CTexture;
|
||||||
|
class CActor;
|
||||||
|
class CStateManager;
|
||||||
|
|
||||||
|
class CVisorFlare
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum class EBlendMode
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
class CFlareDef
|
||||||
|
{
|
||||||
|
TToken<CTexture> x0_tex;
|
||||||
|
float x8_f1;
|
||||||
|
float xc_f2;
|
||||||
|
zeus::CColor x10_color;
|
||||||
|
public:
|
||||||
|
CFlareDef(const TToken<CTexture>& tex, float f1, float f2, const zeus::CColor& color)
|
||||||
|
: x0_tex(tex), x8_f1(f1), xc_f2(f2), x10_color(color) { x0_tex.Lock(); }
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
EBlendMode x0_blendMode;
|
||||||
|
std::vector<CFlareDef> x4_flareDefs;
|
||||||
|
bool x14_b1;
|
||||||
|
float x18_f1;
|
||||||
|
float x1c_f2;
|
||||||
|
float x20_f3;
|
||||||
|
float x24_ = 0.f;
|
||||||
|
float x28_ = 0.f;
|
||||||
|
u32 x2c_w1;
|
||||||
|
u32 x30_w2;
|
||||||
|
public:
|
||||||
|
CVisorFlare(EBlendMode blendMode, bool, float, float, float, u32, u32,
|
||||||
|
const std::vector<CFlareDef>& flares);
|
||||||
|
void Update(float dt, const zeus::CVector3f& pos, const CActor* act, CStateManager& mgr);
|
||||||
|
void Render(const zeus::CVector3f& pos, const CStateManager& mgr) const;
|
||||||
|
static std::experimental::optional<CFlareDef> LoadFlareDef(CInputStream& in);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CVISORFLARE_HPP__
|
|
@ -57,6 +57,7 @@
|
||||||
#include "CRepulsor.hpp"
|
#include "CRepulsor.hpp"
|
||||||
#include "CScriptCameraPitchVolume.hpp"
|
#include "CScriptCameraPitchVolume.hpp"
|
||||||
#include "CScriptCameraHintTrigger.hpp"
|
#include "CScriptCameraHintTrigger.hpp"
|
||||||
|
#include "CScriptVisorFlare.hpp"
|
||||||
#include "CScriptBeam.hpp"
|
#include "CScriptBeam.hpp"
|
||||||
#include "Camera/CCinematicCamera.hpp"
|
#include "Camera/CCinematicCamera.hpp"
|
||||||
#include "MP1/World/CNewIntroBoss.hpp"
|
#include "MP1/World/CNewIntroBoss.hpp"
|
||||||
|
@ -1823,7 +1824,25 @@ CEntity* ScriptLoader::LoadFishCloudModifier(CStateManager& mgr, CInputStream& i
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||||
{
|
{
|
||||||
return nullptr;
|
if (!EnsurePropertyCount(propCount, 14, "VisorFlare"))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
std::string name = mgr.HashInstanceName(in);
|
||||||
|
zeus::CVector3f pos = zeus::CVector3f::ReadBig(in);
|
||||||
|
bool b1 = in.readBool();
|
||||||
|
CVisorFlare::EBlendMode w1 = CVisorFlare::EBlendMode(in.readUint32Big());
|
||||||
|
bool b2 = in.readBool();
|
||||||
|
float f1 = in.readFloatBig();
|
||||||
|
float f2 = in.readFloatBig();
|
||||||
|
float f3 = in.readFloatBig();
|
||||||
|
u32 w2 = in.readUint32Big();
|
||||||
|
std::vector<CVisorFlare::CFlareDef> flares;
|
||||||
|
flares.reserve(5);
|
||||||
|
for (int i=0 ; i<5 ; ++i)
|
||||||
|
if (auto flare = CVisorFlare::LoadFlareDef(in))
|
||||||
|
flares.push_back(*flare);
|
||||||
|
|
||||||
|
return new CScriptVisorFlare(mgr.AllocateUniqueId(), name, info, b1, pos, w1, b2, f1, f2, f3, 2, w2, flares);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 8e1bc5d94e83949e13fcb4c83071f8b195d9e23b
|
Subproject commit 2bc1c30547e891355bc99d8809f356d93c3ff7f3
|
2
specter
2
specter
|
@ -1 +1 @@
|
||||||
Subproject commit 6b909b404061c98df1fd8320bcffe2ccb13c9bcb
|
Subproject commit d66529af905afd39da49c6175c8bd9cf5c3a415e
|
|
@ -551,12 +551,12 @@ void VISIRenderer::Run(FPercent updatePercent)
|
||||||
Light& light = m_lights[i];
|
Light& light = m_lights[i];
|
||||||
light.point = r.readVec3fBig();
|
light.point = r.readVec3fBig();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!SetupVertexBuffersAndFormats())
|
if (!SetupVertexBuffersAndFormats())
|
||||||
{
|
{
|
||||||
m_return = 1;
|
m_return = 1;
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBuilder builder(*this);
|
VISIBuilder builder(*this);
|
||||||
|
|
Loading…
Reference in New Issue