diff --git a/DataSpec/DNACommon/CMDL.cpp b/DataSpec/DNACommon/CMDL.cpp index 739b07dbf..b5ef17063 100644 --- a/DataSpec/DNACommon/CMDL.cpp +++ b/DataSpec/DNACommon/CMDL.cpp @@ -80,6 +80,14 @@ void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os, " face.smooth = True\n" "\n" " return face, ret_mesh\n" + "\n" + "def expand_lightmap_triangle(uva, uvb, uvc):\n" + " result = ([uva[0],uva[1]], [uvb[0],uvb[1]], [uvc[0],uvc[1]])\n" + " if uva == uvb:\n" + " result[1][0] += 0.005\n" + " if uva == uvc:\n" + " result[2][1] -= 0.005\n" + " return result\n" "\n"; /* Link master shader library */ diff --git a/DataSpec/DNACommon/CMDL.hpp b/DataSpec/DNACommon/CMDL.hpp index a0511679f..6f7e4349c 100644 --- a/DataSpec/DNACommon/CMDL.hpp +++ b/DataSpec/DNACommon/CMDL.hpp @@ -589,12 +589,14 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os, for (unsigned j=0 ; j> dupeTracker; + dupeTracker.reserve(mlvl.areas.size()); + for (const MLVL::Area& area : mlvl.areas) + { + const PAK::Entry* areaNameEnt = m_pak.lookupEntry(area.areaNameId); + if (areaNameEnt) + { + STRG areaName; + PAKEntryReadStream rs = areaNameEnt->beginReadStream(m_node); + areaName.read(rs); + HECL::SystemString name = areaName.getSystemString(FOURCC('ENGL'), 0); + auto search = dupeTracker.find(name); + if (search != dupeTracker.end()) + ++search->second.first; + else + dupeTracker[name] = std::make_pair(1, 1); + } + } + + /* Main-pass: index areas */ for (const MLVL::Area& area : mlvl.areas) { Area& areaDeps = m_areaDeps[area.areaMREAId]; @@ -137,6 +159,13 @@ void PAKBridge::build() PAKEntryReadStream rs = areaNameEnt->beginReadStream(m_node); areaName.read(rs); areaDeps.name = areaName.getSystemString(FOURCC('ENGL'), 0); + auto search = dupeTracker.find(areaDeps.name); + if (search != dupeTracker.end() && search->second.first > 1) + { + char num[16]; + snprintf(num, 16, " (%d)", search->second.second++); + areaDeps.name += num; + } /* Trim possible trailing whitespace */ #if HECL_UCS2 diff --git a/DataSpec/DNAMP1/MREA.cpp b/DataSpec/DNAMP1/MREA.cpp index 317dd35a9..2d3f32562 100644 --- a/DataSpec/DNAMP1/MREA.cpp +++ b/DataSpec/DNAMP1/MREA.cpp @@ -12,6 +12,10 @@ void MREA::ReadBabeDeadToBlender_1_2(HECL::BlenderConnection::PyOutStream& os, atUint32 bdMagic = rs.readUint32Big(); if (bdMagic != 0xBABEDEAD) Log.report(LogVisor::FatalError, "invalid BABEDEAD magic"); + os << "bpy.context.scene.render.engine = 'CYCLES'\n" + "bpy.context.scene.world.use_nodes = True\n" + "bpy.context.scene.render.engine = 'BLENDER_GAME'\n" + "bg_node = bpy.context.scene.world.node_tree.nodes['Background']\n"; for (atUint32 s=0 ; s<2 ; ++s) { atUint32 lightCount = rs.readUint32Big(); @@ -22,8 +26,10 @@ void MREA::ReadBabeDeadToBlender_1_2(HECL::BlenderConnection::PyOutStream& os, switch (light.lightType) { case BabeDeadLight::LightLocalAmbient: - os.format("bpy.context.scene.world.horizon_color = (%f,%f,%f)\n", - light.color.vec[0], light.color.vec[1], light.color.vec[2]); + os.format("bg_node.inputs[0].default_value = (%f,%f,%f,1.0)\n" + "bg_node.inputs[1].default_value = %f\n", + light.color.vec[0], light.color.vec[1], light.color.vec[2], + light.q / 8.0); continue; case BabeDeadLight::LightDirectional: os.format("lamp = bpy.data.lamps.new('LAMP_%01u_%03u', 'SUN')\n" @@ -54,23 +60,30 @@ void MREA::ReadBabeDeadToBlender_1_2(HECL::BlenderConnection::PyOutStream& os, os.format("lamp.retro_layer = %u\n" "lamp.use_nodes = True\n" "falloff_node = lamp.node_tree.nodes.new('ShaderNodeLightFalloff')\n" + "lamp.energy = 0.0\n" "falloff_node.inputs[0].default_value = %f\n" - "lamp.node_tree.nodes['Emission'].inputs[0].default_value = (%f,%f,%f,1.0)\n" - "lamp_obj.hide_render = True\n" + "hue_sat_node = lamp.node_tree.nodes.new('ShaderNodeHueSaturation')\n" + "hue_sat_node.inputs[1].default_value = 1.25\n" + "hue_sat_node.inputs[4].default_value = (%f,%f,%f,1.0)\n" + "lamp.node_tree.links.new(hue_sat_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[0])\n" "lamp_obj.location = (%f,%f,%f)\n" "bpy.context.scene.objects.link(lamp_obj)\n" - "\n", s, light.q, + "\n", s, light.q / 8.0, light.color.vec[0], light.color.vec[1], light.color.vec[2], light.position.vec[0], light.position.vec[1], light.position.vec[2]); switch (light.falloff) { case BabeDeadLight::FalloffConstant: - os << "lamp.node_tree.links.new(falloff_node.outputs[2], lamp.node_tree.nodes['Emission'].inputs[1])\n"; + os << "falloff_node.inputs[0].default_value *= 75.0\n" + "lamp.node_tree.links.new(falloff_node.outputs[2], lamp.node_tree.nodes['Emission'].inputs[1])\n"; + break; case BabeDeadLight::FalloffLinear: os << "lamp.node_tree.links.new(falloff_node.outputs[1], lamp.node_tree.nodes['Emission'].inputs[1])\n"; + break; case BabeDeadLight::FalloffQuadratic: os << "lamp.node_tree.links.new(falloff_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[1])\n"; + break; default: break; } diff --git a/DataSpec/DNAMP2/DNAMP2.cpp b/DataSpec/DNAMP2/DNAMP2.cpp index 273fbaf51..712327284 100644 --- a/DataSpec/DNAMP2/DNAMP2.cpp +++ b/DataSpec/DNAMP2/DNAMP2.cpp @@ -126,6 +126,28 @@ void PAKBridge::build() mlvl.read(rs); m_areaDeps.reserve(mlvl.areaCount); unsigned layerIdx = 0; + + /* Pre-pass: find duplicate area names */ + std::unordered_map> dupeTracker; + dupeTracker.reserve(mlvl.areas.size()); + for (const MLVL::Area& area : mlvl.areas) + { + const DNAMP1::PAK::Entry* areaNameEnt = m_pak.lookupEntry(area.areaNameId); + if (areaNameEnt) + { + STRG areaName; + PAKEntryReadStream rs = areaNameEnt->beginReadStream(m_node); + areaName.read(rs); + HECL::SystemString name = areaName.getSystemString(FOURCC('ENGL'), 0); + auto search = dupeTracker.find(name); + if (search != dupeTracker.end()) + ++search->second.first; + else + dupeTracker[name] = std::make_pair(1, 1); + } + } + + /* Main-pass: index areas */ for (const MLVL::Area& area : mlvl.areas) { Area& areaDeps = m_areaDeps[area.areaMREAId]; @@ -136,6 +158,13 @@ void PAKBridge::build() PAKEntryReadStream rs = areaNameEnt->beginReadStream(m_node); areaName.read(rs); areaDeps.name = areaName.getSystemString(FOURCC('ENGL'), 0); + auto search = dupeTracker.find(areaDeps.name); + if (search != dupeTracker.end() && search->second.first > 1) + { + char num[16]; + snprintf(num, 16, " (%d)", search->second.second++); + areaDeps.name += num; + } /* Trim possible trailing whitespace */ #if HECL_UCS2 diff --git a/Runtime/MP1/CMain.hpp b/Runtime/MP1/CMain.hpp index ac6585259..eaff979df 100644 --- a/Runtime/MP1/CMain.hpp +++ b/Runtime/MP1/CMain.hpp @@ -48,7 +48,7 @@ class CMain : public boo::IApplicationCallback CMemorySys x6c_memSys; CTweaks x70_tweaks; EGameplayResult xe4_gameplayResult; - bool xe8_finished = false; + bool xe8_b24_finished = false; public: CMain(); diff --git a/Runtime/MP1/main.cpp b/Runtime/MP1/main.cpp index 4faa698d9..c32824a9c 100644 --- a/Runtime/MP1/main.cpp +++ b/Runtime/MP1/main.cpp @@ -154,9 +154,9 @@ int CMain::RsMain(int argc, const boo::SystemChar* argv[]) g_TweakManager->ReadFromMemoryCard("AudioTweaks"); FillInAssetIDs(); TOneStatic archSupport; - while (!xe8_finished) + while (!xe8_b24_finished) { - xe8_finished = archSupport->Update(); + xe8_b24_finished = archSupport->Update(); } return 0; } diff --git a/hecl b/hecl index b2b3d9c34..893e16c79 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit b2b3d9c34daa2e2c0e4b8cfd9c7d775f61d4bf56 +Subproject commit 893e16c79579499d3834873c99d3fba5c1236898