From 23315610ed6d5bf5176461d1468c8bf52a41c8e4 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Wed, 28 Dec 2016 11:41:43 -0800 Subject: [PATCH] Complete collision flags --- DataSpec/DNACommon/DeafBabe.cpp | 56 ++++++- DataSpec/DNAMP1/DeafBabe.cpp | 108 ++++++++----- DataSpec/DNAMP1/DeafBabe.hpp | 102 ++++++++++--- DataSpec/DNAMP2/AGSC.hpp | 1 + DataSpec/DNAMP2/CMakeLists.txt | 1 + DataSpec/DNAMP2/DeafBabe.cpp | 259 ++++++++++++++++++++++++++++++++ DataSpec/DNAMP2/DeafBabe.hpp | 107 ++++++++++--- hecl | 2 +- 8 files changed, 551 insertions(+), 85 deletions(-) create mode 100644 DataSpec/DNAMP2/DeafBabe.cpp diff --git a/DataSpec/DNACommon/DeafBabe.cpp b/DataSpec/DNACommon/DeafBabe.cpp index d72743b2a..c5dd2c992 100644 --- a/DataSpec/DNACommon/DeafBabe.cpp +++ b/DataSpec/DNACommon/DeafBabe.cpp @@ -2,6 +2,7 @@ #include "AROTBuilder.hpp" #include "DataSpec/DNAMP1/DeafBabe.hpp" #include "DataSpec/DNAMP2/DeafBabe.hpp" +#include namespace DataSpec { @@ -41,10 +42,10 @@ void DeafBabeSendToBlender(hecl::BlenderConnection::PyOutStream& os, const DEAFB " for i in range(3):\n" " face.verts[i].co = tri_verts[i].co\n" " col_bm.verts.ensure_lookup_table()\n" - "face.material_index = select_material(0x%08X)\n" + "face.material_index = select_material(0x%016" PRIX64 ")\n" "face.smooth = False\n" "\n", - atUint32(triMat.material)); + atUint64(triMat.material)); } db.insertNoClimb(os); @@ -58,6 +59,11 @@ void DeafBabeSendToBlender(hecl::BlenderConnection::PyOutStream& os, const DEAFB " col_mesh.materials.append(mat)\n" "\n" "bpy.context.scene.objects.link(col_mesh_obj)\n" + "bpy.context.scene.objects.active = col_mesh_obj\n" + "bpy.ops.object.mode_set(mode='EDIT')\n" + "bpy.ops.mesh.tris_convert_to_quads(materials=True)\n" + "bpy.ops.object.mode_set(mode='OBJECT')\n" + "bpy.context.scene.objects.active = None\n" "col_mesh_obj.layers[1] = True\n" "col_mesh_obj.layers[0] = False\n" "col_mesh_obj.draw_type = 'SOLID'\n" @@ -79,11 +85,51 @@ void DeafBabeBuildFromBlender(DEAFBABE& db, const hecl::BlenderConnection::DataS } db.materials.reserve(colMesh.materials.size()); - for (const auto& mat : colMesh.materials) + for (const hecl::BlenderConnection::DataStream::ColMesh::Material& mat : colMesh.materials) { db.materials.emplace_back(); - db.materials.back().setFireThrough(mat.fireThrough); - db.materials.back().setType(typename DEAFBABE::Material::Type(mat.type)); + db.materials.back().setUnknown(mat.unknown); + db.materials.back().setSurfaceStone(mat.surfaceStone); + db.materials.back().setSurfaceMetal(mat.surfaceMetal); + db.materials.back().setSurfaceGrass(mat.surfaceGrass); + db.materials.back().setSurfaceIce(mat.surfaceIce); + db.materials.back().setPillar(mat.pillar); + db.materials.back().setSurfaceMetalGrating(mat.surfaceMetalGrating); + db.materials.back().setSurfacePhazon(mat.surfacePhazon); + db.materials.back().setSurfaceDirt(mat.surfaceDirt); + db.materials.back().setSurfaceLava(mat.surfaceLava); + db.materials.back().setSurfaceSPMetal(mat.surfaceSPMetal); + db.materials.back().setSurfaceStoneRock(mat.surfaceStoneRock); + db.materials.back().setSurfaceSnow(mat.surfaceSnow); + db.materials.back().setSurfaceMudSlow(mat.surfaceMudSlow); + db.materials.back().setSurfaceFabric(mat.surfaceFabric); + db.materials.back().setHalfPipe(mat.halfPipe); + db.materials.back().setSurfaceMud(mat.surfaceMud); + db.materials.back().setSurfaceGlass(mat.surfaceGlass); + db.materials.back().setUnused3(mat.unused3); + db.materials.back().setUnused4(mat.unused4); + db.materials.back().setSurfaceShield(mat.surfaceShield); + db.materials.back().setSurfaceSand(mat.surfaceSand); + db.materials.back().setSurfaceMothOrSeedOrganics(mat.surfaceMothOrSeedOrganics); + db.materials.back().setSurfaceWeb(mat.surfaceWeb); + db.materials.back().setProjectilePassthrough(mat.projPassthrough); + db.materials.back().setSolid(mat.solid); + db.materials.back().setU20(mat.u20); + db.materials.back().setCameraPassthrough(mat.camPassthrough); + db.materials.back().setSurfaceWood(mat.surfaceWood); + db.materials.back().setSurfaceOrganic(mat.surfaceOrganic); + db.materials.back().setU24(mat.u24); + db.materials.back().setSurfaceRubber(mat.surfaceRubber); + db.materials.back().setSeeThrough(mat.seeThrough); + db.materials.back().setScanPassthrough(mat.scanPassthrough); + db.materials.back().setAiPassthrough(mat.aiPassthrough); + db.materials.back().setCeiling(mat.ceiling); + db.materials.back().setWall(mat.wall); + db.materials.back().setFloor(mat.floor); + db.materials.back().setAiBlock(mat.aiBlock); + db.materials.back().setJumpNotAllowed(mat.jumpNotAllowed); + db.materials.back().setSpiderBall(mat.spiderBall); + db.materials.back().setScrewAttackWallJump(mat.screwAttackWallJump); } db.materialCount = colMesh.materials.size(); diff --git a/DataSpec/DNAMP1/DeafBabe.cpp b/DataSpec/DNAMP1/DeafBabe.cpp index a438a5bac..48743d98f 100644 --- a/DataSpec/DNAMP1/DeafBabe.cpp +++ b/DataSpec/DNAMP1/DeafBabe.cpp @@ -14,11 +14,11 @@ void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os) " 'Ice':(0.0, 0.1, 0.1),\n" " 'Metal Grating':(0.09, 0.09, 0.09),\n" " 'Phazon':(0.24, 0.0, 0.21),\n" - " 'Rock':(0.1, 0.07, 0.05),\n" + " 'Dirt':(0.1, 0.07, 0.05),\n" " 'Stone':(0.12, 0.12, 0.12),\n" " 'Lava':(0.8, 0.15, 0.0),\n" " 'Stone/Rock':(0.06, 0.05, 0.03),\n" - " 'Snow':(0.60, 0.74, 1.0),\n" + " 'Snow':(0.9, 1.0, 1.0),\n" " 'Mud (Slow)':(0.12, 0.06, 0.02),\n" " 'Mud':(0.12, 0.06, 0.02),\n" " 'Glass':(0.27, 0.38, 0.9),\n" @@ -36,36 +36,37 @@ void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os) " new_mat.diffuse_color.hsv = ((index / 6.0) % 1.0, 1.0-((index // 6) / 6.0), 1)\n" " return new_mat\n" "\n" - "bpy.types.Material.retro_u0 = bpy.props.BoolProperty(name='Retro u0')\n" + "bpy.types.Material.retro_unknown = bpy.props.BoolProperty(name='Retro: Unknown (U)')\n" "bpy.types.Material.retro_surface_stone = bpy.props.BoolProperty(name='Retro Surface: Stone')\n" "bpy.types.Material.retro_surface_metal = bpy.props.BoolProperty(name='Retro Surface: Metal')\n" "bpy.types.Material.retro_surface_grass = bpy.props.BoolProperty(name='Retro Surface: Grass')\n" "bpy.types.Material.retro_surface_ice = bpy.props.BoolProperty(name='Retro Surface: Ice')\n" - "bpy.types.Material.retro_u5 = bpy.props.BoolProperty(name='Retro u5')\n" + "bpy.types.Material.retro_pillar = bpy.props.BoolProperty(name='Retro Pillar (I)')\n" "bpy.types.Material.retro_surface_metal_grating = bpy.props.BoolProperty(name='Retro Surface: Metal Grating')\n" "bpy.types.Material.retro_surface_phazon = bpy.props.BoolProperty(name='Retro Surface: Phazon')\n" - "bpy.types.Material.retro_surface_rock = bpy.props.BoolProperty(name='Retro Surface: Rock')\n" + "bpy.types.Material.retro_surface_dirt = bpy.props.BoolProperty(name='Retro Surface: Rock')\n" "bpy.types.Material.retro_surface_lava = bpy.props.BoolProperty(name='Retro Surface: Lava')\n" "bpy.types.Material.retro_surface_stone_rock = bpy.props.BoolProperty(name='Retro Surface: Stone/Rock')\n" "bpy.types.Material.retro_surface_snow = bpy.props.BoolProperty(name='Retro Surface: Snow')\n" "bpy.types.Material.retro_surface_mud_slow = bpy.props.BoolProperty(name='Retro Surface: Mud (Slow)')\n" - "bpy.types.Material.retro_half_pipe = bpy.props.BoolProperty(name='Retro: Half Pipe')\n" + "bpy.types.Material.retro_half_pipe = bpy.props.BoolProperty(name='Retro: Half Pipe (H)')\n" "bpy.types.Material.retro_surface_mud = bpy.props.BoolProperty(name='Retro Surface: Mud')\n" "bpy.types.Material.retro_surface_glass = bpy.props.BoolProperty(name='Retro Surface: Glass')\n" "bpy.types.Material.retro_surface_shield = bpy.props.BoolProperty(name='Retro Surface: Sheild')\n" "bpy.types.Material.retro_surface_sand = bpy.props.BoolProperty(name='Retro Surface: Sand')\n" - "bpy.types.Material.retro_projectile_passthrough = bpy.props.BoolProperty(name='Retro: Projectile Passthrough')\n" - "bpy.types.Material.retro_solid = bpy.props.BoolProperty(name='Retro: Solid')\n" - "bpy.types.Material.retro_camera_passthrough = bpy.props.BoolProperty(name='Retro: Camera Passthrough')\n" + "bpy.types.Material.retro_projectile_passthrough = bpy.props.BoolProperty(name='Retro: Projectile Passthrough (P)')\n" + "bpy.types.Material.retro_solid = bpy.props.BoolProperty(name='Retro: Solid (K)')\n" + "bpy.types.Material.retro_u20 = bpy.props.BoolProperty(name='Retro: u20')\n" + "bpy.types.Material.retro_camera_passthrough = bpy.props.BoolProperty(name='Retro: Camera Passthrough (O)')\n" "bpy.types.Material.retro_surface_wood = bpy.props.BoolProperty(name='Retro Surface: Wood')\n" "bpy.types.Material.retro_surface_organic = bpy.props.BoolProperty(name='Retro Surface: Organic')\n" - "bpy.types.Material.retro_ai_passthrough = bpy.props.BoolProperty(name='Retro: AI Passthrough')\n" - "bpy.types.Material.retro_u26 = bpy.props.BoolProperty(name='Retro: u26')\n" - "bpy.types.Material.retro_scan_passthrough = bpy.props.BoolProperty(name='Retro: Scan Passthrough')\n" - "bpy.types.Material.retro_u28 = bpy.props.BoolProperty(name='Retro u28')\n" - "bpy.types.Material.retro_u29 = bpy.props.BoolProperty(name='Retro u28')\n" - "bpy.types.Material.retro_no_climb = bpy.props.BoolProperty(name='Retro: No Walk')\n" - "bpy.types.Material.retro_u31 = bpy.props.BoolProperty(name='Retro u31')\n" + "bpy.types.Material.retro_u24 = bpy.props.BoolProperty(name='Retro: u24')\n" + "bpy.types.Material.retro_seeThrough = bpy.props.BoolProperty(name='Retro: See Through')\n" + "bpy.types.Material.retro_scan_passthrough = bpy.props.BoolProperty(name='Retro: Scan Passthrough (S)')\n" + "bpy.types.Material.retro_ai_passthrough = bpy.props.BoolProperty(name='Retro: AI Passthrough (A)')\n" + "bpy.types.Material.retro_ceiling = bpy.props.BoolProperty(name='Retro: Ceiling (C)')\n" + "bpy.types.Material.retro_wall = bpy.props.BoolProperty(name='Retro: Wall (W)')\n" + "bpy.types.Material.retro_floor = bpy.props.BoolProperty(name='Retro: Floor (F)')\n" "\n" "material_dict = {}\n" "material_index = []\n" @@ -98,10 +99,10 @@ void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os) " elif type_id == 7:\n" " mat_type = 'Phazon'\n" " elif type_id == 8:\n" - " mat_type = 'Rock'\n" + " mat_type = 'Dirt'\n" " elif type_id == 9:\n" " mat_type = 'Lava'\n" - " elif type_id == 10:\n" + " elif type_id == 10:\n" " mat_type = 'Stone/Rock'\n" " elif type_id == 11:\n" " mat_type = 'Snow'\n" @@ -122,37 +123,61 @@ void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os) "\n" " mat_flags = ''\n" " if ((data >> 0) & 1):\n" - " mat_flags += 'u0'\n" + " mat_flags += 'U'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 5) & 1):\n" - " mat_flags += 'u5'\n" + " mat_flags += 'I'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 13) & 1):\n" " mat_flags += 'H'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 18) & 1):\n" " mat_flags += 'P'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 19) & 1):\n" " mat_flags += 'K'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 20) & 1):\n" - " mat_flags += 'u20'\n" + " mat_flags += 'u'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 21) & 1):\n" - " mat_flags += 'C'\n" - " if ((data >> 22) & 1):\n" - " mat_flags += 'u22'\n" - " if ((data >> 23)& 1):\n" - " mat_flags += 'u23'\n" + " mat_flags += 'O'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 24) & 1):\n" - " mat_flags += 'A'\n" + " mat_flags += 'u'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 26) & 1):\n" - " mat_flags += 'u26'\n" + " mat_flags += 'T'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 27) & 1):\n" " mat_flags += 'S'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 28) & 1):\n" - " mat_flags += 'u28'\n" + " mat_flags += 'A'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 29) & 1):\n" - " mat_flags += 'u29'\n" + " mat_flags += 'C'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 30) & 1):\n" - " mat_flags += 'N'\n" + " mat_flags += 'W'\n" + " else:\n" + " mat_flags += 'x'\n" " if ((data >> 31) & 1):\n" - " mat_flags += 'u31'\n" + " mat_flags += 'F'\n" + " else:\n" + " mat_flags += 'x'\n" "\n" " if len(mat_flags) > 0:\n" " mat_flags = ' ' + mat_flags\n" @@ -168,15 +193,15 @@ void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os) " mat = make_color(len(material_dict), mat_type, mat_name)\n" " mat.diffuse_intensity = 1.0\n" " mat.specular_intensity = 0.0\n" - " mat.retro_u0 = ((data >> 0) & 1)\n" + " mat.retro_unknown = ((data >> 0) & 1)\n" " mat.retro_surface_stone = ((data >> 1) & 1)\n" " mat.retro_surface_metal = ((data >> 2) & 1)\n" " mat.retro_surface_grass = ((data >> 3) & 1) \n" " mat.retro_surface_ice = ((data >> 4) & 1)\n" - " mat.retro_u5 = ((data >> 5) & 1)\n" + " mat.retro_pillar = ((data >> 5) & 1)\n" " mat.retro_surface_metal_grating = ((data >> 6) & 1)\n" " mat.retro_surface_phazon = ((data >> 7) & 1)\n" - " mat.retro_surface_rock = ((data >> 8) & 1)\n" + " mat.retro_surface_dirt = ((data >> 8) & 1)\n" " mat.retro_surface_lava = ((data >> 9) & 1)\n" " mat.retro_surface_stone_rock = ((data >> 10) & 1)\n" " mat.retro_surface_snow = ((data >> 11) & 1)\n" @@ -188,16 +213,17 @@ void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os) " mat.retro_surface_sand = ((data >> 17) & 1)\n" " mat.retro_projectile_passthrough = ((data >> 18) & 1)\n" " mat.retro_solid = ((data >> 19) & 1)\n" + " mat.retro_u20 = ((data >> 20) & 1)\n" " mat.retro_camera_passthrough = ((data >> 21) & 1)\n" " mat.retro_surface_wood = ((data >> 22) & 1)\n" " mat.retro_surface_organic = ((data >> 23) & 1)\n" - " mat.retro_ai_passthrough = ((data >> 24) & 1)\n" - " mat.retro_u26 = ((data >> 26) & 1)\n" + " mat.retro_u24 = ((data >> 24) & 1)\n" + " mat.retro_seeThrough = ((data >> 26) & 1)\n" " mat.retro_scan_passthrough = ((data >> 27) & 1)\n" - " mat.retro_u28 = ((data >> 28) & 1)\n" - " mat.retro_u29 = ((data >> 29) & 1)\n" - " mat.retro_no_climb = ((data >> 30) & 1)\n" - " mat.retro_u31 = ((data >> 31) & 1)\n" + " mat.retro_ai_passthrough = ((data >> 28) & 1)\n" + " mat.retro_ceiling = ((data >> 29) & 1)\n" + " mat.retro_wall= ((data >> 30) & 1)\n" + " mat.retro_floor = ((data >> 31) & 1)\n" " material_dict[mat_name] = mat\n" " material_index.append(mat_name)\n" " return len(material_index)-1\n" diff --git a/DataSpec/DNAMP1/DeafBabe.hpp b/DataSpec/DNAMP1/DeafBabe.hpp index c6d74f983..b5dd88129 100644 --- a/DataSpec/DNAMP1/DeafBabe.hpp +++ b/DataSpec/DNAMP1/DeafBabe.hpp @@ -17,24 +17,92 @@ struct DeafBabe : BigDNA { DECL_DNA Value material; - bool fireThrough() const {return material >> 18 & 0x1;} - void setFireThrough(bool v) {material &= ~0x40000; material |= v << 18;} + bool unknown() const { return material & 1; } + void setUnknown(bool v) { material &= ~1; material |= v; } + bool surfaceStone() const { return (material >> 1) & 1; } + void setSurfaceStone(bool v) { material &= ~(1ull << 1); material |= (v << 1); } + bool surfaceMetal() const { return (material >> 2) & 1; } + void setSurfaceMetal(bool v) { material &= ~(1ull << 2); material |= (v << 2); } + bool surfaceGrass() const { return (material >> 3) & 1; } + void setSurfaceGrass(bool v) { material &= ~(1ull << 3); material |= (v << 3); } + bool surfaceIce() const { return (material >> 4) & 1; } + void setSurfaceIce(bool v) { material &= ~(1ull << 4); material |= (v << 4); } + bool pillar() const { return (material >> 5) & 1; } + void setPillar(bool v) { material &= ~(1ull << 5); material |= (v << 5); } + bool surfaceMetalGrating() const { return (material >> 6) & 1; } + void setSurfaceMetalGrating(bool v) { material &= ~(1ull << 6); material |= (v << 6); } + bool surfacePhazon() const { return (material >> 7) & 1; } + void setSurfacePhazon(bool v) { material &= ~(1ull << 7); material |= (v << 7); } + bool surfaceDirt() const { return (material >> 8) & 1; } + void setSurfaceDirt(bool v) { material &= ~(1ull << 8); material |= (v << 8); } + bool surfaceLava() const {return (material >> 9) & 1; } + void setSurfaceLava(bool v) { material &= ~(1ull << 9); material |= (v << 9); } + bool surfaceStoneRock() const { return (material >> 10) & 1; } + void setSurfaceStoneRock(bool v) { material &= ~(1ull << 10); material |= (v << 10); } + bool surfaceSnow() const { return (material >> 11) & 1; } + void setSurfaceSnow(bool v) { material &= ~(1ull << 11); material |= (v << 11); } + bool surfaceMudSlow() const { return (material >> 12) & 1; } + void setSurfaceMudSlow(bool v) { material &= ~(1ull << 12); material |= (v << 12); } + bool halfPipe() const { return (material >> 13) & 1; } + void setHalfPipe(bool v) { material &= ~(1ull << 13); material |= (v << 13); } + bool surfaceMud() const { return (material >> 14) & 1; } + void setSurfaceMud(bool v) { material &= ~(1ull << 14); material |= (v << 14); } + bool surfaceGlass() const { return (material >> 15) & 1; } + void setSurfaceGlass(bool v) { material &= ~(1ull << 15); material |= (v << 15); } + bool surfaceShield() const { return (material >> 16) & 1; } + void setSurfaceShield(bool v) { material &= ~(1ull << 16); material |= (v << 16); } + bool surfaceSand() const { return (material >> 17) & 1; } + void setSurfaceSand(bool v) { material &= ~(1ull << 17); material |= (v << 17); } + bool projectilePassthrough() const { return (material >> 18) & 1; } + void setProjectilePassthrough(bool v) { material &= ~(1ull << 18); material |= (v << 18); } + bool solid() const { return (material >> 19) & 1; } + void setSolid(bool v) { material &= ~(1ull << 19); material |= (v << 19); } + bool u20() const { return (material >> 20) & 1; } + void setU20(bool v) { material &= ~(1ull << 20); material |= (v << 20); } + bool cameraPassthrough() const { return (material >> 21) & 1; } + void setCameraPassthrough(bool v) { material &= ~(1ull << 21); material |= (v << 19); } + bool surfaceWood() const { return (material >> 22) & 1; } + void setSurfaceWood(bool v) { material &= ~(1ull << 22); material |= (v << 22); } + bool surfaceOrganic() const { return (material >> 23) & 1; } + void setSurfaceOrganic(bool v) { material &= ~(1ull << 23); material |= (v << 23); } + bool u24() const { return (material >> 24) & 1; } + void setU24(bool v) { material &= ~(1ull << 24); material |= (v << 24); } + bool seeThrough() const { return (material >> 26) & 1; } + void setSeeThrough(bool v) { material &= ~(1ull << 26); material |= (v << 26); } + bool scanPassthrough() const { return (material >> 27) & 1; } + void setScanPassthrough(bool v) { material &= ~(1ull << 27); material |= (v << 27); } + bool aiPassthrough() const { return (material >> 28) & 1; } + void setAiPassthrough(bool v) { material &= ~(1ull << 28); material |= (v << 28); } + bool ceiling() const { return (material >> 29) & 1; } + void setCeiling(bool v) { material &= ~(1ull << 29); material |= (v << 29); } + bool wall() const { return (material >> 30) & 1; } + void setWall(bool v) { material &= ~(1ull << 30); material |= (v << 30); } + bool floor() const { return (material >> 31) & 1; } + void setFloor(bool v) { material &= ~(1ull << 31); material |= (v << 31); } - enum class Type - { - Mat0, - MatGround, - Mat2, - MatStone, - MatHardStone, - MatMetal, - Mat6, - Mat7, - Mat8, - MatLeaves - }; - Type type() const {return Type(material & 0xff);} - void setType(Type t) {material &= ~0xff; material |= atUint32(t);} + /* Dummies for later games */ + bool surfaceSPMetal() const { return false; } + void setSurfaceSPMetal(bool v) { } + bool surfaceFabric() const { return false; } + void setSurfaceFabric(bool v) { } + bool surfaceRubber() const { return false; } + void setSurfaceRubber(bool v) { } + bool surfaceMothOrSeedOrganics() const { return false; } + void setSurfaceMothOrSeedOrganics(bool v) { } + bool surfaceWeb() const { return false; } + void setSurfaceWeb(bool v) { } + bool unused3() const { return false; } + void setUnused3(bool v) {} + bool unused4() const { return false; } + void setUnused4(bool v) {} + bool aiBlock() const { return false; } + void setAiBlock(bool v) { } + bool jumpNotAllowed() const { return false; } + void setJumpNotAllowed(bool v) { } + bool spiderBall() const { return false; } + void setSpiderBall(bool v) { } + bool screwAttackWallJump() const { return false; } + void setScrewAttackWallJump(bool v) { } }; struct Edge : BigDNA diff --git a/DataSpec/DNAMP2/AGSC.hpp b/DataSpec/DNAMP2/AGSC.hpp index b41fa381a..15fd4534d 100644 --- a/DataSpec/DNAMP2/AGSC.hpp +++ b/DataSpec/DNAMP2/AGSC.hpp @@ -14,6 +14,7 @@ class AGSC struct Header : BigDNA { DECL_DNA + Value unk; String<-1> groupName; Value groupId = -1; Value poolSz = 0; diff --git a/DataSpec/DNAMP2/CMakeLists.txt b/DataSpec/DNAMP2/CMakeLists.txt index 04587d501..fb8b2be60 100644 --- a/DataSpec/DNAMP2/CMakeLists.txt +++ b/DataSpec/DNAMP2/CMakeLists.txt @@ -12,6 +12,7 @@ make_dnalist(liblist DNAMP2 DeafBabe) set(DNAMP2_SOURCES DNAMP2.hpp DNAMP2.cpp + DeafBabe.cpp ANIM.cpp AGSC.cpp CINF.cpp diff --git a/DataSpec/DNAMP2/DeafBabe.cpp b/DataSpec/DNAMP2/DeafBabe.cpp new file mode 100644 index 000000000..9fcb583dc --- /dev/null +++ b/DataSpec/DNAMP2/DeafBabe.cpp @@ -0,0 +1,259 @@ +#include "DeafBabe.hpp" + +namespace DataSpec +{ +namespace DNAMP2 +{ + +void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os) +{ + os << "TYPE_COLORS = {'NoSFX':(0.0, 0.0, 0.0),\n" + " 'Stone':(1.0, 0.43, 0.15),\n" + " 'Metal':(0.5, 0.5, 0.5),\n" + " 'Grass':(0.0, 0.42, 0.01)," + " 'Ice':(0.0, 0.1, 0.1),\n" + " 'Metal Grating':(0.09, 0.09, 0.09),\n" + " 'Phazon':(0.24, 0.0, 0.21),\n" + " 'Dirt':(0.1, 0.07, 0.05),\n" + " 'Stone':(0.12, 0.12, 0.12),\n" + " 'SP Metal':(0.41, 0.44, 0.5),\n" + " 'Snow':(0.9, 1.0, 1.0),\n" + " 'Fabric':(0.27, 0.34, 0.39),\n" + " 'Moth/Seed Organics':(0.0, 0.02, 0.05),\n" + " 'Glass':(0.27, 0.38, 0.9),\n" + " 'Shield':(1.0, 0.6, 0.0),\n" + " 'Web':(1.0, 1.0, 0.28),\n" + " 'Sand':(0.53, 0.44, 0.21),\n" + " 'Wood':(0.30, 0.15, 0.03),\n" + " 'Organic':(0.19, 0.45, 0.2),\n" + " 'Rubber':(0.09, 0.02, 0.01)}\n" + "\n" + "# Diffuse Color Maker\n" + "def make_color(index, mat_type, name):\n" + " new_mat = bpy.data.materials.new(name)\n" + " if mat_type in TYPE_COLORS:\n" + " new_mat.diffuse_color = TYPE_COLORS[mat_type]\n" + " else:\n" + " new_mat.diffuse_color.hsv = ((index / 6.0) % 1.0, 1.0-((index // 6) / 6.0), 1)\n" + " return new_mat\n" + "\n" + "bpy.types.Material.retro_unknown = bpy.props.BoolProperty(description='Retro: Unknown (U)')\n" + "bpy.types.Material.retro_surface_stone = bpy.props.BoolProperty(description='Retro Surface: Stone')\n" + "bpy.types.Material.retro_surface_metal = bpy.props.BoolProperty(description='Retro Surface: Metal')\n" + "bpy.types.Material.retro_surface_grass = bpy.props.BoolProperty(description='Retro Surface: Grass')\n" + "bpy.types.Material.retro_surface_ice = bpy.props.BoolProperty(description='Retro Surface: Ice')\n" + "bpy.types.Material.retro_pillar = bpy.props.BoolProperty(description='Retro Pillar (I)')\n" + "bpy.types.Material.retro_surface_metal_grating = bpy.props.BoolProperty(description='Retro Surface: Metal Grating')\n" + "bpy.types.Material.retro_surface_phazon = bpy.props.BoolProperty(description='Retro Surface: Phazon')\n" + "bpy.types.Material.retro_surface_dirt = bpy.props.BoolProperty(description='Retro Surface: Rock')\n" + "bpy.types.Material.retro_surface_sp_metal = bpy.props.BoolProperty(description='Retro Surface: Lava')\n" + "bpy.types.Material.retro_surface_snow = bpy.props.BoolProperty(description='Retro Surface: Snow')\n" + "bpy.types.Material.retro_surface_fabric = bpy.props.BoolProperty(description='Retro Surface: fabric')\n" + "bpy.types.Material.retro_half_pipe = bpy.props.BoolProperty(description='Retro: Half Pipe (H)')\n" + "bpy.types.Material.retro_unused3 = bpy.props.BoolProperty(description='Retro: Unused 3 (U)')\n" + "bpy.types.Material.retro_unused4 = bpy.props.BoolProperty(description='Retro: Unused 4 (U)')\n" + "bpy.types.Material.retro_surface_mud = bpy.props.BoolProperty(description='Retro Surface: Mud')\n" + "bpy.types.Material.retro_surface_glass = bpy.props.BoolProperty(description='Retro Surface: Glass')\n" + "bpy.types.Material.retro_surface_shield = bpy.props.BoolProperty(description='Retro Surface: Sheild')\n" + "bpy.types.Material.retro_surface_sand = bpy.props.BoolProperty(description='Retro Surface: Sand')\n" + "bpy.types.Material.retro_surface_moth_or_seed_organics = bpy.props.BoolProperty(description='Retro Surface: Moth/Seed Organics')\n" + "bpy.types.Material.retro_surface_web = bpy.props.BoolProperty(description='Retro Surface: Web')\n" + "bpy.types.Material.retro_projectile_passthrough = bpy.props.BoolProperty(description='Retro: Projectile Passthrough (P)')\n" + "bpy.types.Material.retro_camera_passthrough = bpy.props.BoolProperty(description='Retro: Camera Passthrough (O)')\n" + "bpy.types.Material.retro_surface_wood = bpy.props.BoolProperty(description='Retro Surface: Wood')\n" + "bpy.types.Material.retro_surface_organic = bpy.props.BoolProperty(description='Retro Surface: Organic')\n" + "bpy.types.Material.retro_surface_rubber = bpy.props.BoolProperty(description='Retro Surface: Rubber')\n" + "bpy.types.Material.retro_see_through = bpy.props.BoolProperty(description='Retro: See Through (T)')\n" + "bpy.types.Material.retro_scan_passthrough = bpy.props.BoolProperty(description='Retro: Scan Passthrough (S)')\n" + "bpy.types.Material.retro_ai_passthrough = bpy.props.BoolProperty(description='Retro: AI Passthrough (A)')\n" + "bpy.types.Material.retro_ceiling = bpy.props.BoolProperty(description='Retro: Ceiling (C)')\n" + "bpy.types.Material.retro_wall = bpy.props.BoolProperty(description='Retro: Wall (W)')\n" + "bpy.types.Material.retro_floor = bpy.props.BoolProperty(description='Retro: Floor (F)')\n" + "bpy.types.Material.retro_ai_block = bpy.props.BoolProperty(description='Retro: AI Block (B)')\n" + "bpy.types.Material.retro_jump_not_allowed = bpy.props.BoolProperty(description='Retro: Jump Not Allowed (J)')\n" + "bpy.types.Material.retro_spider_ball = bpy.props.BoolProperty(description='Retro: Spider Ball (D)')\n" + "bpy.types.Material.retro_screw_attack_wall_jump = bpy.props.BoolProperty(description='Retro: Screw Attack Wall Jump (R)')\n" + "\n" + "material_dict = {}\n" + "material_index = []\n" + "def get_type_id(data):\n" + "\n" + " ret = 0\n" + " for i in range(1, 26):\n" + " if i == 5 or i == 13 or i == 14 or i == 15 or i == 20 or i == 21 or i == 24:\n" + " continue\n" + " if ((data >> i) & 1):\n" + " ret = i\n" + " return ret\n" + "\n" + "def select_material(data):\n" + "\n" + " type_id = get_type_id(data)\n" + " mat_type = str(type_id)\n" + " if type_id == 0:\n" + " mat_type = 'NoSFX'\n" + " if type_id == 1:\n" + " mat_type = 'Stone'\n" + " elif type_id == 2:\n" + " mat_type = 'Metal'\n" + " elif type_id == 3:\n" + " mat_type = 'Grass'\n" + " elif type_id == 4:\n" + " mat_type = 'Ice'\n" + " elif type_id == 6:\n" + " mat_type = 'Metal Grating'\n" + " elif type_id == 7:\n" + " mat_type = 'Phazon'\n" + " elif type_id == 8:\n" + " mat_type = 'Dirt'\n" + " elif type_id == 9:\n" + " mat_type = 'SP Metal'\n" + " elif type_id == 10:\n" + " mat_type = 'Glass'\n" + " elif type_id == 11:\n" + " mat_type = 'Snow'\n" + " elif type_id == 12:\n" + " mat_type = 'Fabric'\n" + " elif type_id == 16:\n" + " mat_type = 'Shield'\n" + " elif type_id == 17:\n" + " mat_type = 'Sand'\n" + " elif type_id == 18:\n" + " mat_type = 'Moth/Seed Organics'\n" + " elif type_id == 19:\n" + " mat_type = 'Web'\n" + " elif type_id == 22:\n" + " mat_type = 'Wood'\n" + " elif type_id == 23:\n" + " mat_type = 'Organic'\n" + " elif type_id == 25:\n" + " mat_type = 'Rubber'\n" + "\n" + " mat_flags = ''\n" + " if ((data >> 0) & 1):\n" + " mat_flags += 'U'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 5) & 1):\n" + " mat_flags += 'I'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 13) & 1):\n" + " mat_flags += 'H'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 14) & 1):\n" + " mat_flags += 'U'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 15) & 1):\n" + " mat_flags += 'U'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 20) & 1):\n" + " mat_flags += 'P'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 21) & 1):\n" + " mat_flags += 'O'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 26) & 1):\n" + " mat_flags += 'T'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 27) & 1):\n" + " mat_flags += 'S'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 28) & 1):\n" + " mat_flags += 'A'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 29) & 1):\n" + " mat_flags += 'C'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 30) & 1):\n" + " mat_flags += 'W'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 31) & 1):\n" + " mat_flags += 'F'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 48) & 1):\n" + " mat_flags += 'B'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 58) & 1):\n" + " mat_flags += 'J'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 61) & 1):\n" + " mat_flags += 'D'\n" + " else:\n" + " mat_flags += 'x'\n" + " if ((data >> 62) & 1):\n" + " mat_flags += 'R'\n" + " else:\n" + " mat_flags += 'x'\n" + "\n" + " if len(mat_flags) > 0:\n" + " mat_flags = ' ' + mat_flags\n" + "\n" + " mat_name = mat_type + mat_flags\n" + "\n" + " if mat_name in material_index:\n" + " return material_index.index(mat_name)\n" + " elif mat_name in material_dict:\n" + " material_index.append(mat_name)\n" + " return len(material_index)-1\n" + " else:\n" + " mat = make_color(len(material_dict), mat_type, mat_name)\n" + " mat.diffuse_intensity = 1.0\n" + " mat.specular_intensity = 0.0\n" + " mat.retro_unknown = ((data >> 0) & 1)\n" + " mat.retro_surface_stone = ((data >> 1) & 1)\n" + " mat.retro_surface_metal = ((data >> 2) & 1)\n" + " mat.retro_surface_grass = ((data >> 3) & 1) \n" + " mat.retro_surface_ice = ((data >> 4) & 1)\n" + " mat.retro_pillar = ((data >> 5) & 1)\n" + " mat.retro_surface_metal_grating = ((data >> 6) & 1)\n" + " mat.retro_surface_phazon = ((data >> 7) & 1)\n" + " mat.retro_surface_dirt = ((data >> 8) & 1)\n" + " mat.retro_surface_sp_metal = ((data >> 9) & 1)\n" + " mat.retro_surface_glass = ((data >> 10) & 1)\n" + " mat.retro_surface_snow = ((data >> 11) & 1)\n" + " mat.retro_surface_fabric = ((data >> 12) & 1)\n" + " mat.retro_half_pipe = ((data >> 13) & 1)\n" + " mat.retro_unused3 = ((data >> 14) & 1)\n" + " mat.retro_unused4 = ((data >> 15) & 1)\n" + " mat.retro_surface_shield = ((data >> 16) & 1)\n" + " mat.retro_surface_sand = ((data >> 17) & 1)\n" + " mat.retro_surface_moth_or_seed_organics = ((data >> 18) & 1)\n" + " mat.retro_surface_web = ((data >> 19) & 1)\n" + " mat.retro_projectile_passthrough = ((data >> 20) & 1)\n" + " mat.retro_camera_passthrough = ((data >> 21) & 1)\n" + " mat.retro_surface_wood = ((data >> 22) & 1)\n" + " mat.retro_surface_organic = ((data >> 23) & 1)\n" + " mat.retro_surface_rubber = ((data >> 25) & 1)\n" + " mat.retro_see_through = ((data >> 26) & 1)\n" + " mat.retro_scan_passthrough = ((data >> 27) & 1)\n" + " mat.retro_ai_passthrough = ((data >> 28) & 1)\n" + " mat.retro_ceiling = ((data >> 29) & 1)\n" + " mat.retro_wall= ((data >> 30) & 1)\n" + " mat.retro_floor = ((data >> 31) & 1)\n" + " mat.retro_ai_block = ((data >> 48) & 1)\n" + " mat.retro_jump_not_allowed = ((data >> 58) & 1)\n" + " mat.retro_spider_ball = ((data >> 61) & 1)\n" + " mat.retro_screw_attack_wall_jump = ((data >> 62) & 1)\n" + " material_dict[mat_name] = mat\n" + " material_index.append(mat_name)\n" + " return len(material_index)-1\n" + "\n" + "\n"; +} + +} +} diff --git a/DataSpec/DNAMP2/DeafBabe.hpp b/DataSpec/DNAMP2/DeafBabe.hpp index 421f73610..78fcda060 100644 --- a/DataSpec/DNAMP2/DeafBabe.hpp +++ b/DataSpec/DNAMP2/DeafBabe.hpp @@ -17,24 +17,92 @@ struct DeafBabe : BigDNA { DECL_DNA Value material; - bool fireThrough() const {return material >> 18 & 0x1;} - void setFireThrough(bool v) {material &= ~0x40000; material |= v << 18;} + bool unknown() const { return material & 1; } + void setUnknown(bool v) { material &= ~1; material |= v; } + bool surfaceStone() const { return (material >> 1ull) & 1; } + void setSurfaceStone(bool v) { material &= ~(1ull << 1ull); material |= (atUint64(v) << 1ull); } + bool surfaceMetal() const { return (material >> 2) & 1; } + void setSurfaceMetal(bool v) { material &= ~(1ull << 2ull); material |= (atUint64(v) << 2ull); } + bool surfaceGrass() const { return (material >> 3) & 1; } + void setSurfaceGrass(bool v) { material &= ~(1ull << 3ull); material |= (atUint64(v) << 3ull); } + bool surfaceIce() const { return (material >> 4ull) & 1; } + void setSurfaceIce(bool v) { material &= ~(1ull << 4ull); material |= (atUint64(v) << 4ull); } + bool pillar() const { return (material >> 5ull) & 1; } + void setPillar(bool v) { material &= ~(1ull << 5ull); material |= (atUint64(v) << 5ull); } + bool surfaceMetalGrating() const { return (material >> 6ull) & 1; } + void setSurfaceMetalGrating(bool v) { material &= ~(1ull << 6ull); material |= (atUint64(v) << 6ull); } + bool surfacePhazon() const { return (material >> 7ull) & 1; } + void setSurfacePhazon(bool v) { material &= ~(1ull << 7ull); material |= (atUint64(v) << 7ull); } + bool surfaceDirt() const { return (material >> 8ull) & 1; } + void setSurfaceDirt(bool v) { material &= ~(1ull << 8); material |= (atUint64(v) << 8ull); } + bool surfaceSPMetal() const {return (material >> 9ull) & 1; } + void setSurfaceSPMetal(bool v) { material &= ~(1ull << 9ull); material |= (atUint64(v) << 9ull); } + bool surfaceGlass() const { return (material >> 10ull) & 1; } + void setSurfaceGlass(bool v) { material &= ~(1ull << 10ull); material |= (atUint64(v) << 10ull); } + bool surfaceSnow() const { return (material >> 11ull) & 1; } + void setSurfaceSnow(bool v) { material &= ~(1ull << 11ull); material |= (atUint64(v) << 11ull); } + bool surfaceFabric() const { return (material >> 12ull) & 1; } + void setSurfaceFabric(bool v) { material &= ~(1ull << 12ull); material |= (atUint64(v) << 12ull); } + bool halfPipe() const { return (material >> 13ull) & 1; } + void setHalfPipe(bool v) { material &= ~(1ull << 13ull); material |= (atUint64(v) << 13ull); } + bool unused3() const { return (material >> 14ull) & 1; } + void setUnused3(bool v) { material &= ~(1ull << 14ull); material |= (atUint64(v) << 14ull); } + bool unused4() const { return (material >> 15ull) & 1; } + void setUnused4(bool v) { material &= ~(1ull << 15ull); material |= (atUint64(v) << 15ull); } + bool surfaceShield() const { return (material >> 16ull) & 1; } + void setSurfaceShield(bool v) { material &= ~(1ull << 16); material |= (atUint64(v) << 16ull); } + bool surfaceSand() const { return (material >> 17ull) & 1; } + void setSurfaceSand(bool v) { material &= ~(1ull << 17ull); material |= (atUint64(v) << 17ull); } + bool surfaceMothOrSeedOrganics() const { return (material >> 18) & 1; } + void setSurfaceMothOrSeedOrganics(bool v) { material &= ~(1ull << 18); material |= (atUint64(v) << 18ull); } + bool surfaceWeb() const { return (material >> 19ull) & 1; } + void setSurfaceWeb(bool v) { material &= ~(1ull << 19ull); material |= (atUint64(v) << 19ull); } + bool projectilePassthrough() const { return (material >> 20ull) & 1; } + void setProjectilePassthrough(bool v) { material &= ~(1ull << 20ull); material |= (atUint64(v) << 20ull); } + bool cameraPassthrough() const { return (material >> 21ull) & 1; } + void setCameraPassthrough(bool v) { material &= ~(1ull << 21ull); material |= (atUint64(v) << 19ull); } + bool surfaceWood() const { return (material >> 22ull) & 1; } + void setSurfaceWood(bool v) { material &= ~(1ull << 22ull); material |= (atUint64(v) << 22ull); } + bool surfaceOrganic() const { return (material >> 23ull) & 1; } + void setSurfaceOrganic(bool v) { material &= ~(1ull << 23ull); material |= (atUint64(v) << 23ull); } + bool surfaceRubber() const { return (material >> 25) & 1; } + void setSurfaceRubber(bool v) { material &= ~(1ull << 25ull); material |= (atUint64(v) << 25ull); } + bool seeThrough() const { return (material >> 26ull) & 1; } + void setSeeThrough(bool v) { material &= ~(1ull << 26ull); material |= (atUint64(v) << 26ull); } + bool scanPassthrough() const { return (material >> 27ull) & 1; } + void setScanPassthrough(bool v) { material &= ~(1ull << 27ull); material |= (atUint64(v) << 27ull); } + bool aiPassthrough() const { return (material >> 28) & 1; } + void setAiPassthrough(bool v) { material &= ~(1ull << 28ull); material |= (atUint64(v) << 28ull); } + bool ceiling() const { return (material >> 29ull) & 1; } + void setCeiling(bool v) { material &= ~(1ull << 29ull); material |= (atUint64(v) << 29ull); } + bool wall() const { return (material >> 30ull) & 1; } + void setWall(bool v) { material &= ~(1ull << 30ull); material |= (atUint64(v) << 30ull); } + bool floor() const { return (material >> 31ull) & 1; } + void setFloor(bool v) { material &= ~(1ull << 31ull); material |= (atUint64(v) << 31ull); } + bool aiBlock() const { return (material >> 48ull) & 1; } + void setAiBlock(bool v) { material &= ~(1ull << 48ull); material |= (atUint64(v) << 48ull); } + bool jumpNotAllowed() const { return (material >> 58ull) & 1; } + void setJumpNotAllowed(bool v) { material &= ~(1ull << 58ull); material |= (atUint64(v) << 58ull); } + bool spiderBall() const { return (material >> 61ull) & 1; } + void setSpiderBall(bool v) { material &= ~(1ull << 61ull); material |= (atUint64(v) << 61ull); } + bool screwAttackWallJump() const { return (material >> 62ull) & 1; } + void setScrewAttackWallJump(bool v) { material &= ~(1ull << 62ull); material |= (atUint64(v) << 62ull); } - enum class Type - { - Mat0, - MatGround, - Mat2, - MatStone, - MatHardStone, - MatMetal, - Mat6, - Mat7, - Mat8, - MatLeaves - }; - Type type() const {return Type(material & 0xff);} - void setType(Type t) {material &= ~0xff; material |= atUint64(t);} + /* Dummies for MP1*/ + bool surfaceLava() const { return false; } + void setSurfaceLava(bool v) {} + bool surfaceMudSlow() const { return false; } + void setSurfaceMudSlow(bool v) {} + bool surfaceMud() const { return false; } + void setSurfaceMud(bool v) {} + bool surfaceStoneRock() const { return false; } + void setSurfaceStoneRock(bool v) {} + bool solid() const { return false; } + void setSolid(bool v) {} + bool u20() const { return false; } + void setU20(bool v) { } + bool u24() const { return false; } + void setU24(bool v) { } }; using Edge = DNAMP1::DeafBabe::Edge; @@ -65,10 +133,7 @@ struct DeafBabe : BigDNA Value vertCount; Vector verts; - static void BlenderInit(hecl::BlenderConnection::PyOutStream& os) - { - DNAMP1::DeafBabe::BlenderInit(os); - } + static void BlenderInit(hecl::BlenderConnection::PyOutStream& os); void insertNoClimb(hecl::BlenderConnection::PyOutStream& os) const { for (atInt16 edgeIdx : noClimbEdges) diff --git a/hecl b/hecl index fb7db9cfc..ac6c54d28 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit fb7db9cfca9d2e6ba1ffee70d934a875bd89e0bd +Subproject commit ac6c54d28b7ab22a66fde2cbf3b22ec0509fb0fe